odatse.domain.meshgrid module#

class odatse.domain.meshgrid.MeshGrid(info: Info = None, *, param: dict[str, Any] = None)[source]#

Bases: DomainBase

MeshGrid class for handling grid data for the data analysis framework.

Initialize the MeshGrid object.

Parameters:
  • info (Info, optional) – Information object containing algorithm parameters.

  • param (dict, optional) – Dictionary containing parameters for setting up the grid.

__init__(info: Info = None, *, param: dict[str, Any] = None)[source]#

Initialize the MeshGrid object.

Parameters:
  • info (Info, optional) – Information object containing algorithm parameters.

  • param (dict, optional) – Dictionary containing parameters for setting up the grid.

_setup(info_param)[source]#

Setup the grid based on provided parameters.

Parameters:

info_param – Dictionary containing parameters for setting up the grid.

_setup_from_file(info_param)[source]#

Setup the grid from a file.

Parameters:

info_param – Dictionary containing parameters for setting up the grid.

_setup_grid(info_param)[source]#

Setup the grid based on min, max, and num lists.

Parameters:

info_param – Dictionary containing parameters for setting up the grid.

do_split()[source]#

Split the grid data among MPI processes.

classmethod from_dict(param)[source]#

Create a MeshGrid object from a dictionary of parameters.

Parameters:

param – Dictionary containing parameters for setting up the grid.

Returns:

a MeshGrid object.

Return type:

MeshGrid

classmethod from_file(mesh_path)[source]#

Create a MeshGrid object from a file.

Parameters:

mesh_path – Path to the file containing the grid data.

Returns:

a MeshGrid object.

Return type:

MeshGrid

store_file(store_path, *, header='')[source]#

Store the grid data to a file.

Parameters:
  • store_path – Path to the file where the grid data will be stored.

  • header – Header to be included in the file.

odatse.domain.meshgrid.load_mesh_file(root_dir, info_param: dict, *, root_only: bool = False)[source]#

Read a mesh file on algorithm rank 0 and validate it on every algorithm rank.

This is the single mesh-file reader, shared by MeshGrid (used by bayes, exchange and pamc) and by mapper. It must be called on every rank of the algorithm layer (it is collective over algcomm), and only there.

Parameters:
  • root_dir (Path) – Directory that a relative mesh_path is resolved against.

  • info_param (dict) – mesh_path (required) and the optional comments, delimiter and skiprows passed to numpy.loadtxt.

  • root_only (bool) – If True, the rows are returned on algorithm rank 0 only (None elsewhere); otherwise they are broadcast to every algorithm rank.

Returns:

2-D array of rows index x1 ... xD.

Return type:

np.ndarray or None

Raises:

odatse.exception.InputError – on every algorithm rank, when the file cannot be read, has no data rows, or has no coordinate columns (fewer than two columns). The number of coordinates is not compared with the dimension of the algorithm: a mesh may hold the points in the solver’s coordinates (see tests/transform), and the solver dimension is checked when a point is evaluated.