Isosurface files

Collection of Isosurface objects. Offers extensive functionality for filtering and using isosurfaces as well as its subclasses such as SubSurface.

Classes:

Isosurface(isosurface_id, double_quantity, ...)

Isosurface file data container including metadata. Consists of a list of vertices forming a

SubSurface(mesh, iso_filepath, times[, ...])

Part of an isosurface with data for a specific mesh.

class fdsreader.isof.isosurface.Isosurface(isosurface_id: int, double_quantity: bool, quantity: str, short_name: str, unit: str, levels: List[float], v_quantity: str = '', v_short_name: str = '', v_unit: str = '')[source]
Isosurface file data container including metadata. Consists of a list of vertices forming a

list of triangles. Can optionally have additional color data for the surfaces.

Variables:
  • id – The ID of this isosurface.

  • quantity – Quantity object containing information about the quantity calculated for this isosurface with the corresponding short_name and unit.

  • v_quantity – Information about the color quantity.

  • levels – All isosurface levels.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

export(file_path, mesh)

Export the isosurface for a single timestep into one of many formats.

get_nearest_timestep(time)

Calculates the nearest timestep for which data has been output for this isosurface.

get_pyvista_mesh(vertices, triangles)

Creates a PyVista mesh from the data.

join_pyvista_meshes(meshes)

Combines multiple PyVista meshes.

to_global(time)

Creates an array containing all global vertices and a list containing numpy arrays with

Attributes:

has_color_data

Defines whether there is color data for this isosurface or not.

surfaces

Gets all surfaces per mesh.

times

List containing all times for which data has been recorded.

triangles

Gets all triangles per mesh.

vertices

Gets all vertices per mesh.

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

export(file_path: str, mesh)[source]

Export the isosurface for a single timestep into one of many formats.

Parameters:
  • file_path – Absolute path to the the file which should we written. The file ending denotes the file format to export to (supports pretty much every common format).

  • time – Either the index of the timestep or an actual time value. In the latter case data for the nearest matching timestep will be used.

get_nearest_timestep(time: float) int[source]

Calculates the nearest timestep for which data has been output for this isosurface.

get_pyvista_mesh(vertices: ndarray, triangles: ndarray)[source]

Creates a PyVista mesh from the data.

property has_color_data: bool

Defines whether there is color data for this isosurface or not.

join_pyvista_meshes(meshes: List)[source]

Combines multiple PyVista meshes.

Returns:

The combined mesh of class PolyData.

property surfaces: Dict[str, List[ndarray]]

Gets all surfaces per mesh.

property times: List[float]

List containing all times for which data has been recorded.

to_global(time: int | float) Tuple[ndarray, List[ndarray], ndarray | None][source]
Creates an array containing all global vertices and a list containing numpy arrays with

triangles for each surface level.

Parameters:

time – Either the index of the timestep or an actual time value. In the latter case data for the nearest matching timestep will be used.

property triangles: Dict[str, List[ndarray]]

Gets all triangles per mesh.

property vertices: Dict[str, List[ndarray]]

Gets all vertices per mesh.

class fdsreader.isof.isosurface.SubSurface(mesh: Mesh, iso_filepath: str, times: List, viso_filepath: str = '')[source]

Part of an isosurface with data for a specific mesh.

Variables:
  • mesh – The mesh containing all data for this SubSurface.

  • file_path – Path to the binary data file.

  • v_file_path – Path to the binary data file containing color data.

  • n_vertices – The number of vertices for this subsurface.

  • n_triangles – The number of triangles for this subsurface.

  • n_t – Total number of time steps for which output data has been written.

Methods:

clear_cache()

Remove all data from the internal cache that has been loaded so far to free memory.

Attributes:

colors

Property to lazy load the color data that might be associated with the isosurfaces.

has_color_data

Defines whether there is color data for this subsurface or not.

surfaces

Property to lazy load a list that maps triangles to an isosurface for a specific level.

triangles

Property to lazy load all triangles of any level.

vertices

Property to lazy load all vertices for all triangles of any level.

clear_cache()[source]

Remove all data from the internal cache that has been loaded so far to free memory.

property colors

Property to lazy load the color data that might be associated with the isosurfaces.

property has_color_data

Defines whether there is color data for this subsurface or not.

property surfaces

Property to lazy load a list that maps triangles to an isosurface for a specific level. The list has the size n_triangles, while the indices correspond to indices of the triangles.

property triangles

Property to lazy load all triangles of any level.

property vertices

Property to lazy load all vertices for all triangles of any level.