salvus.opt.models.data_structures
salvus.opt.models.data_structures salvus opt models data_structures Data structures for SalvusOpt models.
Classes
DataBlock
DataBlockclass DataBlock(builtins.object):
def __init__(
self,
block_id: int,
fields: list[str],
number_of_points: int,
data: dict[str, npt.NDArray | types.scalar_],
auxiliary_data: dict[str, npt.NDArray] = default,
material: type[PhysicalMaterial] | None = None,
constant_fields: list[str] = default,
) -> None: ...A data block in a BlockModel.
In contrast to a the MeshBlock object, it does not contain any
information on the geometry of the mesh.
Parameters
block_idint — The block ID.fieldslist[str] — The fields contained in this block.number_of_pointsint — Number of data point per field in this block.datadict[str, npt.NDArray | types.scalar_] — A dictionary mapping field names to their data arrays.auxiliary_datadict[str, npt.NDArray] — A dictionary mapping auxiliary field names to their data arrays. Auxiliary data is for example the valence or the finite element mass matrix.materialtype[PhysicalMaterial] | None — The material associated with this block.constant_fieldslist[str] — List of fields that are constant (scalars).
Methods
from_json()
from_json()def from_json(d: dict) -> DataBlock: ...Create a Block instance from a JSON-compatible dictionary.
Parameters
ddict — A dictionary containing block information.
Returns DataBlock — Block: The deserialized Block instance.
set_data()
set_data()def set_data(self, data: dict[str, npt.NDArray | types.scalar_]) -> None: ...Set the data for this block.
Parameters
datadict[str, npt.NDArray | types.scalar_] — A dictionary mapping field names to their data arrays.
Returns None
to_json()
to_json()def to_json(self) -> dict: ...Serialize basic block information to a JSON-compatible dictionary.
Data is not serialized here as this is handled by the BlockModel class.
Returns dict — dict: A dictionary representation of the block.