open_viewmin.filter_tree_plot.filters.topology#

Define topological calculations for ViewMinPlot meshes

Functions#

add_Euler_characteristic_filter(plotter, mesh_name[, ...])

Add a filter formula that colors a mesh by Euler characteristic

add_connected_sets(plotter, parent_mesh_name[, pbc])

Add a filter formula that colors a mesh according to its connected

add_find_loops_filter(plotter, mesh_name[, new_mesh_name])

Add a filter formula that keeps only loops

calculate_Euler_characteristic(plotter, mesh[, keep_chi])

Calculate Euler characteristic

get_connected_sets(plotter, mesh[, pbc])

Find connected subsets of a mesh.

get_connected_subsets(plotter, mesh[, pbc])

Create a list of connected subset meshes.

merge_all(list_of_meshes)

Merge several meshes.

Module Contents#

add_Euler_characteristic_filter(plotter, mesh_name, new_mesh_name=None, keep_chi=None, **mesh_kwargs)#

Add a filter formula that colors a mesh by Euler characteristic of each connected subset.

Parameters:
  • plotter (FilterTreePlot)

  • mesh_name (str) – Name of parent mesh.

  • new_mesh_name (str or None, optional) – Name of new (child) mesh. Pass None to default to “_chi” appended to parent_mesh_name.

  • keep_chi (int, list of ints, or None) – Resulting mesh includes only those connected subsets whose Euler characteristic matches this value(s). Pass None to keep all chi values.

  • **mesh_kwargs (dict, optional)

Returns:

New child mesh created by filter formula, or None if no filter formula was created.

Return type:

pyvista.dataset or None

add_connected_sets(plotter, parent_mesh_name, pbc=False)#

Add a filter formula that colors a mesh according to its connected subsets.

Parameters:
  • plotter (FilterTreePlot)

  • parent_mesh_name (str) – Name of parent mesh.

  • pbc (bool, optional) – Whether to use periodic boundary conditions.

Returns:

New child mesh

Return type:

pyvista.dataset

add_find_loops_filter(plotter, mesh_name, new_mesh_name=None, **mesh_kwargs)#

Add a filter formula that keeps only loops

Parameters:
  • plotter (FilterTreePlot)

  • mesh_name (str) – Name of parent mesh

  • new_mesh_name (str or None, optional) – Name of new (child) mesh. Pass None to default to “_loops” appended to parent_mesh_name.

  • mesh_kwargs (dict, optional) – Keyword arguments to pyvista.Plotter.add_mesh.

Return type:

FilterFormula

calculate_Euler_characteristic(plotter, mesh, keep_chi=None)#

Calculate Euler characteristic

Calculate Euler characteristic for each connected subset in a mesh, using the formula \(V - E + F\). Add a new scalar dataset named “chi” to the mesh.

Parameters:
  • plotter (FilterTreePlot)

  • mesh (pyvista.dataset) – Parent mesh.

  • keep_chi (int, list of ints, or None) – Resulting mesh includes only those connected subsets whose Euler characteristic matches this value(s). Pass None to keep all chi values.

Returns:

New child mesh.

Return type:

pyvista.dataset

get_connected_sets(plotter, mesh, pbc=False)#

Find connected subsets of a mesh.

Apply PyVista’s connectivity filter and store the resulting subset identification index as a new dataset called “connected”.

Parameters:
  • plotter (FilterTreePlot)

  • mesh (pyvista.dataset) – Parent mesh.

  • pbc (bool, optional) – Whether to apply periodic boundary conditions.

get_connected_subsets(plotter, mesh, pbc=False)#

Create a list of connected subset meshes.

Uses threshold filter on the result of the connectivity filter to extract an individual connected subset of a mesh.

Parameters:
  • plotter (FilterTreePlot)

  • mesh (pyvista.dataset) – Parent mesh.

  • pbc (bool, optional) – Whether to use periodic boundary conditions.

Return type:

list[pyvista.dataset].

merge_all(list_of_meshes)#

Merge several meshes.

Parameters:

list_of_meshes (Iterable of [pyvista.dataset])

Returns:

Merged mesh.

Return type:

pyvista.dataset