![]() |
Vulpes
0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
|
Helpers implementing VulPoly's Voronoi construction and cleanup. More...
Functions | |
| template<typename MeshType> | |
| AbstractAgglomerationModel< MeshType >::float_t | maxVtxToVtxSquaredDistance (const std::vector< typename MeshType::SelfPoint > &vertexes, const typename AbstractAgglomerationModel< MeshType >::IndVec &subset, float_t early_stop=std::numeric_limits< float_t >::infinity()) |
| template<typename T> | |
| constexpr torch::ScalarType | toTorchType () |
| Map C++ mesh types (float, double, int32_t, int64_t) to the corresponding Torch scalar type. | |
| static CellInitOptionsType | normalizeCellFlags (CellInitOptionsType cell_init_options) |
| template<typename Dst, typename Src> | |
| constexpr auto | cast (const datastructure::CrsMap< Src, Src > &map) |
| Re-types a CRS map to use a different integral type for indices and values. | |
| template<typename VecType> | |
| void | checkEmptySets (const VecType &labels) |
| Checks for and warns about empty classes in a label vector. | |
| template<typename index_t> | |
| datastructure::CrsMap< index_t, index_t > | buildSubDual (const datastructure::CrsMap< index_t, index_t > &dual_map, const std::vector< index_t > &subset_idxs) |
| Extracts the dual subgraph corresponding to a subset of vertices. | |
| template<typename index_t> | |
| index_t | removeEmptySets (std::vector< index_t > &labels) |
| Compresses labels to a contiguous range [0, N-1]. | |
| template<typename IndexType> | |
| void | importVtkMeshTags (vtkFieldData *field_data, std::string_view association, std::unordered_map< std::string, std::vector< IndexType > > &tags) |
| Imports scalar numeric VTK arrays into an integer mesh-tag table. | |
| template<int32_t Dim> | |
| std::pair< double, double > | updateVoronoiCentroid (const std::array< Point< double, Dim >, 2 > &bbox, std::vector< Point< double, Dim > > &points, int32_t n_inside_seeds) |
| Move each Voronoi seed to its cell centroid and estimate relaxation error. | |
| template<typename FloatType, typename IndexType, IndexType Dim, typename D> | |
| Point< FloatType, Dim > | computeGradient (const Point< FloatType, Dim > x, const DistanceExpression< double, Dim, D > &distanceFunction, IndexType idx, FloatType finite_difference_h) |
| Estimate a signed-distance gradient by centered finite differences. | |
| template<int32_t Dim, typename D> | |
| Mesh2D< double, int32_t > | computeVoronoiMesh2D (const std::array< Point< double, 2 >, 2 > &bbox, const std::vector< Point< double, 2 > > &points, const DistanceExpression< double, Dim, D > &distanceFunction) |
| Convert in-domain 2D Voronoi cells into a Vulpes mesh. | |
| template<int32_t Dim, typename D> | |
| Mesh3D< double, int32_t > | computeVoronoiMesh3D (const std::array< Point< double, 3 >, 2 > &bbox, const std::vector< Point< double, 3 > > &points, const DistanceExpression< double, Dim, D > &distanceFunction) |
| Convert in-domain 3D Voronoi cells into a Vulpes mesh. | |
| template<typename FloatType, typename IndexType, IndexType Dim> | |
| void | vulPolyAdjustFixedPoints (const std::vector< Point< FloatType, Dim > > &fixed_pts, const std::vector< IndexType > &near_boundary_idxs, std::vector< Point< FloatType, Dim > > &seed_pts) |
| Adjust nearby seeds to keep fixed points represented in the mesh. | |
| template<typename FloatType, typename IndexType, IndexType Dim, typename D> | |
| std::vector< IndexType > | vulPolyReflect (const DistanceExpression< FloatType, Dim, D > &distanceFunction, FloatType alpha, const vulpoly::VulPolyParams< FloatType > ¶ms, std::vector< Point< FloatType, Dim > > &seed_pts) |
| Add reflected seeds near domain boundaries. | |
| template<typename FloatType, typename MeshType, typename D> | |
| void | vulPolyClipToBoundary (MeshType &mesh, FloatType alpha, const DistanceExpression< FloatType, MeshType::self_dim, D > &distanceFunction, const vulpoly::VulPolyParams< FloatType > ¶ms) |
| Improve positions of mesh vertices close to the domain boundary. | |
| template<typename FloatType, typename IndexType> | |
| FloatType | vulPolyComputeEdgeAngle (const Mesh2D< FloatType, IndexType > &mesh, IndexType cell_id, const std::array< IndexType, 2 > &edge) |
| Estimate an edge's normalized angular size in an adjacent cell. | |
| template<typename FloatType, typename IndexType, IndexType Dim, typename D> | |
| void | vulPolyCollapseEdges (Mesh2D< FloatType, IndexType > &mesh, const DistanceExpression< FloatType, Dim, D > &distanceFunction, FloatType edge_collapse_tol) |
| Collapse isolated undersized edges in a 2D mesh. | |
Helpers implementing VulPoly's Voronoi construction and cleanup.
The PolyMesher-derived algorithms are identified in their documentation. This namespace also adapts Voro++ output to Vulpes mesh data structures.
| datastructure::CrsMap< index_t, index_t > vulpes::geometry::internal::buildSubDual | ( | const datastructure::CrsMap< index_t, index_t > & | dual_map, |
| const std::vector< index_t > & | subset_idxs ) |
Extracts the dual subgraph corresponding to a subset of vertices.
Given a dual graph for an entire mesh and a list of vertex indices, this function constructs and returns the induced subgraph containing only the specified vertices and the edges between them. The vertices in the resulting subgraph are re-indexed to form a contiguous range [0, N-1], where N is the number of vertices in the subset.
| index_t | The integral type used for graph indices. |
| dual_map | The dual graph of the entire mesh, represented as a CrsMap. |
| subset_idxs | A vector of vertex indices defining the subgraph to extract. |
|
inlineconstexpr |
Re-types a CRS map to use a different integral type for indices and values.
This function converts a CrsMap from a source integral type Src to a destination integral type Dst. If Dst and Src are the same, the input map is returned unchanged. Otherwise, it constructs a new CrsMap by performing an element-wise cast on both the data and index arrays.
| Dst | The destination integral type for the new map's indices and values. |
| Src | The source integral type for the input map's indices and values. |
| map | The input CrsMap with data and indices of type Src. |
| void vulpes::geometry::internal::checkEmptySets | ( | const VecType & | labels | ) |
Checks for and warns about empty classes in a label vector.
This function inspects a vector of labels and determines the number of classes as max(labels) + 1. It then checks if every class ID in the range [0, max(labels)] is present at least once. A warning message is printed to std::cerr for each class that has no members.
| VecType | A random-access container type that supports size() and operator[], such as std::vector. |
| labels | A container of partition labels. Values are expected to be non-negative. |
| Point< FloatType, Dim > vulpes::geometry::internal::computeGradient | ( | const Point< FloatType, Dim > | x, |
| const DistanceExpression< double, Dim, D > & | distanceFunction, | ||
| IndexType | idx, | ||
| FloatType | finite_difference_h ) |
Estimate a signed-distance gradient by centered finite differences.
| FloatType | Coordinate scalar type. |
| IndexType | Index type used for the selected distance component. |
| Dim | Spatial dimension. |
| D | Distance-expression implementation type. |
| x | Point where the gradient is evaluated. |
| distanceFunction | Signed-distance expression. |
| idx | Distance component to differentiate, or -1 for the final domain distance. |
| finite_difference_h | Centered-difference step size. |
| Mesh2D< double, int32_t > vulpes::geometry::internal::computeVoronoiMesh2D | ( | const std::array< Point< double, 2 >, 2 > & | bbox, |
| const std::vector< Point< double, 2 > > & | points, | ||
| const DistanceExpression< double, Dim, D > & | distanceFunction ) |
Convert in-domain 2D Voronoi cells into a Vulpes mesh.
| Dim | Dimension parameter of the distance expression. |
| D | Distance-expression implementation type. |
| bbox | Bounding box for Voronoi cell construction. |
| points | Voronoi seeds. |
| distanceFunction | Domain signed-distance expression used to retain cells inside the domain. |
| Mesh3D< double, int32_t > vulpes::geometry::internal::computeVoronoiMesh3D | ( | const std::array< Point< double, 3 >, 2 > & | bbox, |
| const std::vector< Point< double, 3 > > & | points, | ||
| const DistanceExpression< double, Dim, D > & | distanceFunction ) |
Convert in-domain 3D Voronoi cells into a Vulpes mesh.
| Dim | Dimension parameter of the distance expression. |
| D | Distance-expression implementation type. |
| bbox | Bounding box for Voronoi cell construction. |
| points | Voronoi seeds. |
| distanceFunction | Domain signed-distance expression used to retain cells inside the domain. |
| void vulpes::geometry::internal::importVtkMeshTags | ( | vtkFieldData * | field_data, |
| std::string_view | association, | ||
| std::unordered_map< std::string, std::vector< IndexType > > & | tags ) |
Imports scalar numeric VTK arrays into an integer mesh-tag table.
Mesh tags currently store one integer per entity. Numeric arrays with more than one component are therefore skipped, while scalar floating-point arrays are converted with an explicit warning. Nonnumeric arrays are rejected.
| IndexType | The integer type used to store mesh tags. |
| field_data | VTK point or cell data containing the arrays to import. |
| association | Human-readable array association used in diagnostics. |
| tags | Destination mesh-tag table. |
| AbstractAgglomerationModel< MeshType >::float_t vulpes::geometry::internal::maxVtxToVtxSquaredDistance | ( | const std::vector< typename MeshType::SelfPoint > & | vertexes, |
| const typename AbstractAgglomerationModel< MeshType >::IndVec & | subset, | ||
| float_t | early_stop = std::numeric_limits<float_t>::infinity() ) |
|
inlinestatic |
| index_t vulpes::geometry::internal::removeEmptySets | ( | std::vector< index_t > & | labels | ) |
Compresses labels to a contiguous range [0, N-1].
This function modifies a vector of labels in-place, remapping them so that the set of unique labels becomes a dense range [0, N-1], where N is the total number of unique labels originally present. The relative ordering of labels is preserved.
For example, an input of {3, 0, 3, 5, 0} would be modified to {1, 0, 1, 2, 0}, and the function would return 3.
| index_t | The integral type of the labels. |
| [in,out] | labels | The vector of labels to be modified. |
|
constexpr |
Map C++ mesh types (float, double, int32_t, int64_t) to the corresponding Torch scalar type.
| T | C++ mesh type |
| std::pair< double, double > vulpes::geometry::internal::updateVoronoiCentroid | ( | const std::array< Point< double, Dim >, 2 > & | bbox, |
| std::vector< Point< double, Dim > > & | points, | ||
| int32_t | n_inside_seeds ) |
Move each Voronoi seed to its cell centroid and estimate relaxation error.
| Dim | Spatial dimension. |
| bbox | Two opposite corners of the box containing the Voronoi diagram. |
| points | Seeds, updated in place by adding each cell's centroid offset. |
| n_inside_seeds | Number of original in-domain seeds used for error and area accumulation; appended reflected seeds are excluded. |
| void vulpes::geometry::internal::vulPolyAdjustFixedPoints | ( | const std::vector< Point< FloatType, Dim > > & | fixed_pts, |
| const std::vector< IndexType > & | near_boundary_idxs, | ||
| std::vector< Point< FloatType, Dim > > & | seed_pts ) |
Adjust nearby seeds to keep fixed points represented in the mesh.
| FloatType | Coordinate scalar type. |
| IndexType | Seed index type. |
| Dim | Spatial dimension. |
| fixed_pts | Locations to preserve. |
| near_boundary_idxs | Indices of seeds close to the domain boundary. |
| seed_pts | Seeds to update in place. |
| void vulpes::geometry::internal::vulPolyClipToBoundary | ( | MeshType & | mesh, |
| FloatType | alpha, | ||
| const DistanceExpression< FloatType, MeshType::self_dim, D > & | distanceFunction, | ||
| const vulpoly::VulPolyParams< FloatType > & | params ) |
Improve positions of mesh vertices close to the domain boundary.
| FloatType | Coordinate scalar type. |
| MeshType | Mesh type being modified. |
| D | Distance-expression implementation type. |
| mesh | Mesh whose vertices may be clipped. |
| alpha | Characteristic cell width. |
| distanceFunction | Domain signed-distance expression. |
| params | VulPoly algorithm parameters. |
| void vulpes::geometry::internal::vulPolyCollapseEdges | ( | Mesh2D< FloatType, IndexType > & | mesh, |
| const DistanceExpression< FloatType, Dim, D > & | distanceFunction, | ||
| FloatType | edge_collapse_tol ) |
Collapse isolated undersized edges in a 2D mesh.
| FloatType | Coordinate scalar type. |
| IndexType | Mesh index type. |
| Dim | Dimension parameter of the distance expression. |
| D | Distance-expression implementation type. |
| mesh | Mesh to simplify in place. |
| distanceFunction | Domain signed-distance expression, used to preserve the boundary approximation. |
| edge_collapse_tol | Threshold for an edge's normalized angular size. |
| FloatType vulpes::geometry::internal::vulPolyComputeEdgeAngle | ( | const Mesh2D< FloatType, IndexType > & | mesh, |
| IndexType | cell_id, | ||
| const std::array< IndexType, 2 > & | edge ) |
Estimate an edge's normalized angular size in an adjacent cell.
| FloatType | Coordinate scalar type. |
| IndexType | Mesh index type. |
| mesh | 2D mesh containing the cell and edge. |
| cell_id | Adjacent cell index, or -1 for a boundary side. |
| edge | The edge's two vertex indices in the requested orientation. |
| std::vector< IndexType > vulpes::geometry::internal::vulPolyReflect | ( | const DistanceExpression< FloatType, Dim, D > & | distanceFunction, |
| FloatType | alpha, | ||
| const vulpoly::VulPolyParams< FloatType > & | params, | ||
| std::vector< Point< FloatType, Dim > > & | seed_pts ) |
Add reflected seeds near domain boundaries.
| FloatType | Coordinate scalar type. |
| IndexType | Seed index type. |
| Dim | Spatial dimension. |
| D | Distance-expression implementation type. |
| distanceFunction | Domain signed-distance expression. |
| alpha | Characteristic distance used to select seeds near boundaries. |
| params | VulPoly algorithm parameters. |
| seed_pts | Seeds, extended in place with successful reflections. |