open_viewmin.filter_tree_plot.filters.topology#

Define topological calculations for ViewMinPlot meshes

Module Contents#

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.

open_viewmin.filter_tree_plot.filters.topology.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 (open_viewmin.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

  • mesh_kwargs

open_viewmin.filter_tree_plot.filters.topology.add_connected_sets(plotter, parent_mesh_name, pbc=False)#

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

Parameters:
  • plotter (open_viewmin.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

open_viewmin.filter_tree_plot.filters.topology.add_find_loops_filter(plotter, mesh_name, new_mesh_name=None, **mesh_kwargs)#

Add a filter formula that keeps only loops

Parameters:
  • plotter (open_viewmin.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:

open_viewmin.FilterFormula

open_viewmin.filter_tree_plot.filters.topology.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 (open_viewmin.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

open_viewmin.filter_tree_plot.filters.topology.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 (open_viewmin.FilterTreePlot) –

  • mesh (pyvista.dataset) – Parent mesh.

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

open_viewmin.filter_tree_plot.filters.topology.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 (open_viewmin.FilterTreePlot) –

  • mesh (pyvista.dataset) – Parent mesh.

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

Return type:

list of `pyvista.dataset`s.

open_viewmin.filter_tree_plot.filters.topology.merge_all(list_of_meshes)#

Merge several meshes.

Parameters:

list_of_meshes (Iterable of [pyvista.dataset]) –

Returns:

Merged mesh.

Return type:

pyvista.dataset