Struct t8_geometry_handler
Defined in File t8_geometry_handler.hxx
Struct Documentation
-
struct t8_geometry_handler
Handles the geometries of a t8_cmesh.
Each tree can be assigned a geometry in this handler. The geometries get assigned using their hash value. Stores geometries of type t8_geometry.
Public Functions
-
inline t8_geometry_handler()
Constructor.
-
inline ~t8_geometry_handler()
Destructor.
-
template<typename geometry_type, typename ..._args>
inline geometry_type *register_geometry(_args&&... args) Register a geometry with the geometry handler.
- Template Parameters:
geometry_type – The type of the geometry to register.
_args – The constructor arguments of the geometry.
- Parameters:
args – [in] The constructor arguments of the geometry.
- Returns:
A pointer to the geometry.
-
void register_geometry(t8_geometry *geom)
Register a geometry with the geometry handler.
The handler will take ownership of the geometry.
- Parameters:
geom – [in] The geometry to register.
-
inline t8_geometry *get_geometry(const std::string &name)
Find a geometry by its name.
- Parameters:
name – [in] The name of the geometry to find.
- Returns:
An iterator to the geometry if found, NULL otherwise.
-
inline t8_geometry *get_geometry(const t8_geometry_hash &hash)
Find a geometry by its hash.
- Parameters:
hash – [in] The hash of the geometry to find.
- Returns:
An iterator to the geometry if found, NULL otherwise.
-
inline size_t get_num_geometries() const
Get the number of registered geometries.
- Returns:
The number of registered geometries.
-
inline t8_geometry *get_unique_geometry()
If a geometry handler only has one registered geometry, get a pointer to this geometry.
Note
Most cmeshes will have only one geometry and this function is an optimization for that special case. It is used for example in t8_cmesh_get_tree_geometry.
- Returns:
The only registered geometry of geom_handler.
-
inline void deactivate_tree()
Deactivate the current active tree.
Can be used to reload data, after it has been moved, for example by the partition-algorithm
-
inline t8_geometry *get_tree_geometry(t8_cmesh_t cmesh, t8_gloidx_t gtreeid)
Get the geometry of the provided tree.
- Parameters:
cmesh – [in] The cmesh.
gtreeid – [in] The global tree id of the tree for which the geometry should be returned.
- Returns:
The geometry of the tree.
-
inline void evaluate_tree_geometry(t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *out_coords)
Evaluate the geometry of the provided tree at the given reference coordinates.
- Parameters:
cmesh – [in] The cmesh.
gtreeid – [in] The global tree id of the tree for which the geometry should be evaluated.
ref_coords – [in] The reference coordinates at which to evaluate the geometry.
num_coords – [in] The number of reference coordinates.
out_coords – [out] The evaluated coordinates.
-
inline void evaluate_tree_geometry_jacobian(t8_cmesh_t cmesh, t8_gloidx_t gtreeid, const double *ref_coords, const size_t num_coords, double *out_coords)
Evaluate the Jacobian of the geometry of the provided tree at the given reference coordinates.
- Parameters:
cmesh – [in] The cmesh.
gtreeid – [in] The global tree id of the tree for which the geometry should be evaluated.
ref_coords – [in] The reference coordinates at which to evaluate the geometry.
num_coords – [in] The number of reference coordinates.
out_coords – [out] The evaluated Jacobian coordinates.
-
inline t8_geometry_type_t get_tree_geometry_type(t8_cmesh_t cmesh, t8_gloidx_t gtreeid)
Get the geometry type of the provided tree.
- Parameters:
cmesh – [in] The cmesh.
gtreeid – [in] The global tree id of the tree for which the geometry type should be returned.
- Returns:
The geometry type of the tree.
-
inline bool tree_negative_volume(const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid)
Check if the volume of a tree is negative.
- Parameters:
cmesh – [in] The cmesh.
gtreeid – [in] The global tree id of the tree to check.
- Returns:
True if the volume of the tree is negative, false otherwise.
-
inline bool tree_compatible_with_geom(const t8_cmesh_t cmesh, const t8_gloidx_t gtreeid)
Check for compatibility of the tree with the assigned geometry.
- Parameters:
cmesh – [in] The cmesh.
gtreeid – [in] The global tree id of the tree to check.
- Returns:
True if the tree and assigned geometry are compatible.
-
inline bool get_tree_bounding_box(t8_cmesh_t cmesh, t8_gloidx_t gtreeid, double bounds[6])
Get the bounding box of the tree.
Note
This function updates the active tree to the provided gtreeid.
- Parameters:
cmesh – [in] The cmesh.
gtreeid – [in] The global tree id of the tree for which the bounding box should be returned.
bounds – [out] The bounding box of the tree, in the format [xmin, xmax, ymin, ymax, zmin, zmax].
-
inline void ref()
Increase the reference count of the geometry handler.
-
inline void unref()
Decrease the reference count of the geometry handler.
If the reference count reaches zero, the geometry handler is deleted.
-
inline t8_geometry_handler()