pydagmc.dagnav
#
This file includes the pydagmc module which is designed to manage and manipulate hierarchical geometric data structures used in computational modeling and simulation built upon the PyMOAB package.
- class pydagmc.dagnav.Model(moab_file=None)[source]#
Bases:
object
-
mb:
Core
#
- property surfaces#
- property surfaces_by_id#
- property volumes#
- property volumes_by_id#
- property volumes_by_material: Dict[str, list[Volume]]#
Returns a dictionary mapping material names to lists of Volume objects associated with that material.
Material names are derived from group names like “mat:material_name”. The dictionary key will be “material_name”. Volumes without a material group are excluded.
- find_volumes_by_material(material_name)[source]#
Retrieves a list of Volume objects associated with the provided material name.
If the exact material name is not found, it KeyError is raised suggesting potential close matches for the requested material.
- Parameters:
material_name (str) – The name of the material to search for (e.g., “fuel”, “water”).
- Returns:
A list of Volume objects tagged with the specified material name.
- Return type:
- Raises:
KeyError – If the material_name is not found in the model. The error message will include suggestions for similar material names if any exist.
- property volumes_without_material: list[Volume]#
Returns a list of Volume objects that have not been assigned a material group (i.e., volume.material is None).
- property groups#
- property category_tag[source]#
Returns the category tag used to intidate the use of meshset. Values include “Group”, “Volume”, “Surface”. “Curve” and “Vertex” are also present in the model options but those classes are not supported in this package.
- write_file(filename)[source]#
Write the model to a file.
- Parameters:
filename (path-like) – The file to write to.
- add_groups(group_map)[source]#
Adds groups of GeometrySets to the model.
- Parameters:
group_map (dict) – A dictionary whose keys are 2-tuples of (str, int) containing the group name and group ID respectively and whose values are iterables of GeometrySet objects or GeometrySet ID numbers.
- create_group(name=None, group_id=None)[source]#
Create a new empty group instance with the given name, or return an existing group if one exists.
-
mb:
- class pydagmc.dagnav.GeometrySet(model, handle)[source]#
Bases:
object
Generic functionality for a DAGMC EntitySet.
- Parameters:
model (Model)
handle (np.uint64)
- to_vtk(filename)[source]#
Write the set to a VTK file. This will recursively gather all triangles under the group, volume or surface and generate a VTK file.
- property triangle_handles#
Returns a pymoab.rng.Range of all triangle handles under this set.
- property triangle_conn#
Returns the triangle connectivity for all triangles under this set.
- Return type:
numpy.ndarray shape=(N, 3), dtype=np.uint64
- property triangle_coords#
Returns the triangle coordinates for all triangles under this set.
- Return type:
numpy.ndarray shape=(N, 3), dtype=np.float64
- get_triangle_conn_and_coords(compress=False)[source]#
Returns the triangle connectivity and coordinates for all triangles under this set.
- Triangle vertex values can be retrieved using:
triangle_conn, coords = Volume.get_triangle_conn_and_coords() triangle_zero_coords = coords[triangle_conn[0]]
- Parameters:
compress (bool, optional) – If False, a coordinate numpy array of size (N, 3) will be returned. If True, the coordinates will be compressed to a unique set of coordinates. In either case, entries in the triangle EntityHandle mapping will correspond with the appropriate indices in the coordinate array.
- Returns:
numpy.ndarray shape=(N, 3), dtype=np.uint64
numpy.ndarray shape=(N, 3), dtype=np.float64
- get_triangle_coordinate_mapping(compress=False)[source]#
Returns a maping from triangle EntityHandle to triangle coordinate indices triangle coordinates.
- Triangle vertex values can be retrieved using:
triangle_handles = Volume.get_triangle_handles() triangle_map, coords = Volume.triangle_coordinate_mapping() triangle_zero_coords = coords[triangle_map[triangle_handles[0]]]
- Parameters:
compress (bool, optional) – If False, a coordinate numpy array of size (N, 3) will be returned. If True, the coordinates will be compressed to a unique set of coordinates. In either case, entries in the triangle EntityHandle mapping will correspond with the appropriate indices in the coordinate array.
- Return type:
numpy.ndarray shape=(N, 3), dtype=np.uint64
- delete()[source]#
Delete this set from the MOAB database, but doesn’t delete this GeometrySet object. The object remains but no longer refers to anything in the model. In many cases, it may make sense to delete this GeometrySet object immediately following this operation.
- class pydagmc.dagnav.Surface(model, handle)[source]#
Bases:
GeometrySet
- Parameters:
model (Model)
handle (np.uint64)
- class pydagmc.dagnav.Volume(model, handle)[source]#
Bases:
GeometrySet
- Parameters:
model (Model)
handle (np.uint64)
- class pydagmc.dagnav.Group(model, handle)[source]#
Bases:
GeometrySet
- Parameters:
model (Model)
handle (np.uint64)
- property volumes: list[Volume]#
Returns a list of Volume objects for the volumes contained by the group set.
- property surfaces: list[Surface]#
Returns a list of Surface objects for the surfaces contained by the group set.
- property volume_ids#
Returns a list of the contained Volume IDs
- property surface_ids#
Returns a lsit of the contained Surface IDs