ogstools.mesh.differences module#

ogstools.mesh.differences.difference(base_mesh, subtract_mesh, variable=None)[source]#

Compute the difference of variables between two meshes.

Parameters:
  • base_mesh (UnstructuredGrid) – The mesh to subtract from.

  • subtract_mesh (UnstructuredGrid) – The mesh whose data is to be subtracted.

  • variable (Variable | str | None) – The variable of interest. If not given, all point and cell_data will be processed raw.

Return type:

UnstructuredGrid

Returns:

A new mesh containing the difference of variable or of all datasets between both meshes.

ogstools.mesh.differences.difference_pairwise(meshes_1, meshes_2, variable=None)[source]#

Compute pairwise difference between meshes from two lists/arrays (they have to be of the same length).

Parameters:
Return type:

ndarray

Returns:

An array of meshes containing the differences of variable or all datasets between meshes_1 and meshes_2.

ogstools.mesh.differences.difference_matrix(meshes_1, meshes_2=None, variable=None)[source]#

Compute the difference between all combinations of two meshes from one or two arrays based on a specified variable.

Parameters:
Return type:

ndarray

Returns:

An array of meshes containing the differences of variable or all datasets between meshes_1 and meshes_2 for all possible combinations.

ogstools.mesh.differences.compare(mesh_a, mesh_b, variable=None, point_data=True, cell_data=True, field_data=True, check_topology=True, atol=0.0, *, strict=False)[source]#

Method to compare two meshes.

Returns True if they match within the tolerances, otherwise False.

Parameters:
  • mesh_a (UnstructuredGrid) – The reference base mesh for comparison.

  • mesh_b (UnstructuredGrid) – The mesh to compare against the reference.

  • variable (Variable | str | None) – The variable of interest. If not given, all point, cell and field data will be processed.

  • point_data (bool) – Compare all point data if variable is None.

  • cell_data (bool) – Compare all cell data if variable is None.

  • field_data (bool) – Compare all field data if variable is None.

  • check_topology (bool) – If True, compare topologies

  • atol (float) – Absolute tolerance.

  • strict (bool) – Raises an AssertionError, if mismatch.

Return type:

bool