Version:

salvus.project.components.entity_component

salvus.project.components.entity_component salvus project components entity_component
The entity component.

Functions

type_to_entity_string()

Convert a type to the corresponding entity_type string as used in Salvus' entity component.
SIGNATURE
def type_to_entity_string(_type: type | ABCMeta) -> str: ...
ARGUMENTS
Required
_type
Type:type | ABCMeta
Description:
The type to find corresponding entity string for. Allowed to be subtype of defined entity types.
EXCEPTIONS
TypeError
If type does not occur as entity type.
RETURNS
Return type: str
Entity type as string.

Classes

EntityComponent

Project subclass handling all things related to various configuration components which we'll call entities.
SIGNATURE
class EntityComponent(builtins.object):
    def __init__(
        self, project: salvus.project.project.Project, path: pathlib.Path
    ): ...
ARGUMENTS
Required
project
Type:salvus.project.project.Project
Description:
The project.
Required
path
Type:pathlib.Path
Description:
The path where the entities are stored within the project.

Methods

EntityComponent.add()
Add an entity to the project.
SIGNATURE
def add(
    self,
    entity: typing.Any,
    overwrite: bool = False,
    skip_validation: bool = True,
    timer: Timer | None = None,
    log_to_logger: bool = False,
    comm: int | None = None,
) -> None: ...
ARGUMENTS
Required
entity
Type:typing.Any
Description:
The entity to add.
Optional
overwrite
Type:bool
Default value:False
Description:
Potentially overwrite an existing thing in project if it already exists.
Optional
skip_validation
Type:bool
Default value:True
Description:
If set to true, any validation steps are skipped. This currently only affects mesh QC.
Optional
timer
Type:Timer | None
Default value:None
Description:
Execution timer.
Optional
log_to_logger
Type:bool
Default value:False
Description:
Log timings to the logger.
Optional
comm
Type:int | None
Default value:None
Description:
MPI communicator, if any.
EntityComponent.delete()
Remove an entity from the project.
SIGNATURE
def delete(self, entity_type: str, entity_name: str) -> None: ...
ARGUMENTS
Required
entity_type
Type:str
Description:
The type of entity to delete.
Required
entity_name
Type:str
Description:
The name of the entity.
EntityComponent.get()
Get an entity.
SIGNATURE
def get(
    self,
    entity_type: str,
    entity_name: str,
    comm: int | None = None,
    max_wait_time_if_mpi_in_seconds: float = 5.0,
) -> typing.Any: ...
ARGUMENTS
Required
entity_type
Type:str
Description:
The type of entity to get.
Required
entity_name
Type:str
Description:
The name of the entity.
Optional
comm
Type:int | None
Default value:None
Description:
MPI communicator for distributed meshes and models, if any.
Optional
max_wait_time_if_mpi_in_seconds
Type:float
Default value:5.0
Description:
If the file for an entity is not found and a communicator is passed, wait for up to this long for the filesystem to catch up.
EntityComponent.get_all()
Get all entities of a given type.
SIGNATURE
def get_all(self, entity_type: str) -> dict[str, typing.Any]: ...
ARGUMENTS
Required
entity_type
Type:str
Description:
The type of entities to get.
EntityComponent.get_inverse_problem_configurations()
Get the inverse problem configuration objects for the passed inversions.
SIGNATURE
def get_inverse_problem_configurations(
    self, inversions: typing.Sequence[str] | None = None
) -> dict[str, InverseProblemConfiguration]: ...
ARGUMENTS
Optional
inversions
Type:typing.Sequence[str] | None
Default value:None
Description:
Inversions to return the objects for. Omitting this parameter returns all inversion problem configurations related to the project.
EntityComponent.has()
A check if an entity of a given type or name exists.
SIGNATURE
def has(self, entity_type: str, entity_name: str) -> bool: ...
ARGUMENTS
Required
entity_type
Type:str
Description:
The type of entity to get.
Required
entity_name
Type:str
Description:
The name of the entity.
EntityComponent.list()
List all available entities of the chosen type.
SIGNATURE
def list(self, entity_type: str) -> list[str]: ...
ARGUMENTS
Required
entity_type
Type:str
Description:
The type of the entities to list.
PAGE CONTENTS