25#ifndef VULPES_GEOMETRY_MESH_MESH_BASE_HPP_
26#define VULPES_GEOMETRY_MESH_MESH_BASE_HPP_
37#include <unordered_map>
43#include <boost/unordered/unordered_flat_set.hpp>
45#include <vtkAbstractArray.h>
46#include <vtkAppendFilter.h>
48#include <vtkCellArray.h>
49#include <vtkCellData.h>
50#include <vtkDataArray.h>
51#include <vtkFieldData.h>
52#include <vtkFloatArray.h>
55#include <vtkPointData.h>
57#include <vtkPolyData.h>
58#include <vtkPolyDataReader.h>
59#include <vtkPolygon.h>
60#include <vtkPolyhedron.h>
61#include <vtkSmartPointer.h>
63#include <vtkUnstructuredGrid.h>
64#include <vtkXMLUnstructuredGridReader.h>
65#include <vtkXMLUnstructuredGridWriter.h>
101template <
typename Dst,
typename Src>
103 if constexpr (std::is_same_v<Dst, Src>) {
106 using Vec = std::vector<Dst>;
108 Vec{map.
data().begin(), map.
data().end()},
131template <
typename VecType>
133 std::vector<bool> class_found;
134 for (
size_t i = 0; i < labels.size(); i++) {
135 if (class_found.size() <= labels[i]) {
136 class_found.resize(labels[i] + 1,
false);
138 class_found[labels[i]] =
true;
140 for (
size_t i = 0; i < class_found.size(); i++) {
141 if (!class_found[i]) {
142 std::cerr <<
"WARNING: The class " << i <<
" of " << class_found.size()
143 <<
" is empty!" << std::endl;
163template <
typename index_t>
166 const std::vector<index_t>& subset_idxs) {
168 using IndVec = std::vector<index_t>;
172 const IndVec* subset_idxs_sorted = &subset_idxs;
173 if (!std::is_sorted(subset_idxs.begin(), subset_idxs.end())) {
175 std::sort(tmp.begin(), tmp.end());
176 subset_idxs_sorted = &tmp;
180 index_t n_nodes = dual_map.
size();
181 IndVec old_to_new(n_nodes, -1);
182 const index_t n_subset_idxs = subset_idxs.size();
183 for (index_t new_id = 0; new_id < n_subset_idxs; ++new_id) {
184 old_to_new[(*subset_idxs_sorted)[new_id]] = new_id;
189 sub_dual_map.data().resize(0);
190 sub_dual_map.indices().resize(0);
191 sub_dual_map.indices().push_back(0);
192 for (index_t ncid = 0; ncid < n_subset_idxs; ++ncid) {
193 const auto ocid = (*subset_idxs_sorted)[ncid];
194 for (
const auto neigh_ocid : dual_map[ocid]) {
195 const auto it = std::lower_bound(
196 (*subset_idxs_sorted).begin(), (*subset_idxs_sorted).end(),
198 if (it != (*subset_idxs_sorted).end() && (*it) == neigh_ocid) {
199 sub_dual_map.data().push_back(old_to_new[neigh_ocid]);
202 sub_dual_map.indices().push_back(sub_dual_map.data().size());
222template <
typename index_t>
224 constexpr auto npos =
static_cast<index_t
>(-1);
225 if (labels.empty()) {
230 const index_t max_label_id = *std::max_element(labels.begin(), labels.end());
231 std::vector<index_t> old_to_new(max_label_id + 1, npos);
233 for (std::size_t i = 0; i < labels.size(); i++) {
234 if (old_to_new[labels[i]] == npos) {
235 old_to_new[labels[i]] = new_id++;
237 labels[i] = old_to_new[labels[i]];
254template <
typename IndexType>
256 vtkFieldData* field_data,
257 std::string_view association,
258 std::unordered_map<std::string, std::vector<IndexType>>& tags) {
259 const vtkIdType n_arrays = field_data->GetNumberOfArrays();
260 for (vtkIdType i = 0; i < n_arrays; ++i) {
261 vtkAbstractArray* abstract_array = field_data->GetAbstractArray(i);
262 const char* raw_name =
263 abstract_array ==
nullptr ? nullptr : abstract_array->GetName();
264 const std::string array_name =
265 raw_name !=
nullptr && *raw_name !=
'\0'
267 :
"<unnamed array at index " + std::to_string(i) +
">";
269 vtkDataArray* data_array = vtkDataArray::SafeDownCast(abstract_array);
270 if (data_array ==
nullptr) {
271 throw std::runtime_error(
272 "Cannot import " + std::string(association) +
" mesh-tag array \"" +
273 array_name +
"\": the array is nonnumeric");
276 const int n_components = data_array->GetNumberOfComponents();
277 if (n_components != 1) {
280 std::cerr <<
"WARNING: Skipping " << association <<
" mesh-tag array \""
281 << array_name <<
"\" because it has " << n_components
282 <<
" components; only scalar arrays are supported.\n";
286 const int data_type = data_array->GetDataType();
287 if (data_type == VTK_FLOAT || data_type == VTK_DOUBLE) {
288 std::cerr <<
"WARNING: Converting floating-point " << association
289 <<
" mesh-tag array \"" << array_name
290 <<
"\" to an integer type; fractional values may be "
294 auto& tag = tags[array_name];
295 const vtkIdType n_tuples = data_array->GetNumberOfTuples();
296 tag.reserve(
static_cast<std::size_t
>(n_tuples));
297 for (vtkIdType j = 0; j < n_tuples; ++j) {
298 tag.push_back(
static_cast<IndexType
>(data_array->GetComponent(j, 0)));
313template <
typename FloatType,
typename IndexType>
318 std::unordered_map<MetadataLabel, std::vector<FloatType>>
doubles;
320 std::unordered_map<MetadataLabel, std::vector<IndexType>>
ints;
332template <std::
size_t Dim,
typename IndexType>
339 using TagTable = std::unordered_map<TagLabel, std::vector<TagType>>;
342 std::array<TagTable, Dim + 1>
tags;
371 static_assert(SelfDim > 0 && SelfDim <= 3);
372 static_assert(OuterDim > 0 && OuterDim <= 3);
386 static inline constexpr IndexType
UNDEF =
static_cast<IndexType
>(-1);
409 std::vector<std::array<IndexType, 2>>>;
527 constexpr IndexType
nEntity(std::size_t dim)
const {
528 return self().nEntity(dim);
539 return self().nEntity(dim);
549 template <std::
size_t dim>
561 template <std::
size_t dim>
578 constexpr static inline bool parallel() {
return false; }
586 template <
class Archive>
624 const auto&
self()
const {
return static_cast<const Derived&
>(*this); }
627 auto&
self() {
return static_cast<Derived&
>(*this); }
638 const std::vector<index_t>& old_to_new_cell)
const;
651 const auto& new_to_old_cell, Derived& agg_mesh)
const;
662 const std::vector<index_t>& new_to_old_facet,
663 const std::vector<index_t>& old_to_new_cell,
664 Derived& agg_mesh)
const;
674 const auto& new_to_old_cell,
675 const auto& old_to_new_vtx,
676 Derived& agg_mesh)
const;
689 const std::vector<index_t>& old_to_new_cell,
690 bool check_connected =
true)
const;
763 const std::vector<IndexType>& old_to_new_cell)
const {
765 for (std::size_t cell_id = 0; cell_id < old_to_new_cell.size(); ++cell_id) {
766 const auto cell_id_new = old_to_new_cell[cell_id];
767 if (cell_id_new ==
UNDEF) {
770 new_to_old_cell_uncompr.
getRow(cell_id_new).push_back(cell_id);
772 return new_to_old_cell_uncompr.template compress<IndexType>();
781std::vector<IndexType>
784 const auto& new_to_old_cell, Derived& agg_mesh)
const {
785 std::vector<IndexType> new_to_old_facet;
788 new_cell_to_facets_uncpr.
resize(new_to_old_cell.size());
790 boost::unordered_flat_map<IndexType, IndexType> facet_table;
791 for (IndexType new_cid = 0; new_cid < new_to_old_cell.size(); ++new_cid) {
792 for (
const auto old_cid : new_to_old_cell[new_cid]) {
798 facet_table[old_fid] = !facet_table[old_fid];
801 for (
auto it = facet_table.begin(); it != facet_table.end(); ++it) {
802 const auto count = it->second;
803 const auto old_fid = it->first;
805 IndexType new_fid = old_to_new_facet[old_fid];
806 if (new_fid ==
UNDEF) {
807 new_fid = new_to_old_facet.size();
808 old_to_new_facet[old_fid] = new_fid;
809 new_to_old_facet.push_back(old_fid);
811 new_cell_to_facets_uncpr[new_cid].
push_back(new_fid);
816 agg_mesh.m_cell_to_facet =
817 new_cell_to_facets_uncpr.template compress<IndexType>();
818 return new_to_old_facet;
829 const std::vector<IndexType>& new_to_old_facet,
830 const std::vector<IndexType>& old_to_new_cell,
831 Derived& agg_mesh)
const {
832 std::vector<IndexType> new_to_old_vtx;
835 agg_mesh.m_facet_to_cell.resize(new_to_old_facet.size(), {UNDEF, UNDEF});
836 agg_mesh.m_facet_to_vtx.indices().push_back(0);
838 for (std::size_t new_fid = 0; new_fid < new_to_old_facet.size(); ++new_fid) {
839 const auto old_fid = new_to_old_facet[new_fid];
841 for (std::size_t d = 0; d < 2; ++d) {
843 if (old_cid !=
UNDEF) {
844 const auto new_cid = old_to_new_cell[old_cid];
845 assert(new_cid !=
UNDEF);
846 agg_mesh.m_facet_to_cell[new_fid][d] = new_cid;
852 IndexType new_vid = old_to_new_vtx[old_vid];
853 if (new_vid ==
UNDEF) {
854 new_vid = new_to_old_vtx.size();
855 new_to_old_vtx.push_back(old_vid);
856 old_to_new_vtx[old_vid] = new_vid;
858 agg_mesh.m_facet_to_vtx.data().push_back(new_vid);
861 agg_mesh.m_facet_to_vtx.indices().push_back(
862 agg_mesh.m_facet_to_vtx.data().size());
867 for (std::size_t ovid = 0; ovid < old_to_new_vtx.size(); ++ovid) {
868 const auto nvid = old_to_new_vtx[ovid];
870 if (agg_mesh.m_vertexes.size() <
static_cast<std::size_t
>(nvid + 1)) {
871 agg_mesh.m_vertexes.resize(nvid + 1);
877 return old_to_new_vtx;
888 const auto& new_to_old_cell,
889 const auto& old_to_new_vtx,
890 Derived& agg_mesh)
const {
891 agg_mesh.m_cell_to_vtx.indices().push_back(0);
892 std::vector<bool> is_vtx_present(old_to_new_vtx.size(),
false);
894 for (IndexType new_cid = 0; new_cid < new_to_old_cell.size(); ++new_cid) {
895 for (
const auto old_cid : new_to_old_cell[new_cid]) {
897 const auto new_vid = old_to_new_vtx[old_vid];
898 if (new_vid !=
UNDEF && (!is_vtx_present[old_vid])) {
899 agg_mesh.m_cell_to_vtx.data().push_back(new_vid);
900 is_vtx_present[old_vid] =
true;
904 std::fill(is_vtx_present.begin(), is_vtx_present.end(),
false);
905 agg_mesh.m_cell_to_vtx.indices().push_back(
906 agg_mesh.m_cell_to_vtx.data().size());
918 new_to_old_cell)
const {
921 IndexType prev_new_cid =
UNDEF;
922 for (IndexType new_cid = 0; new_cid < new_to_old_cell.
size(); ++new_cid) {
923 if (new_to_old_cell[new_cid].size() <= 1) {
926 std::vector<IndexType> old_cids(
927 new_to_old_cell[new_cid].begin(), new_to_old_cell[new_cid].end());
930 for (
auto id : new_to_old_cell[prev_new_cid]) {
931 glob_to_loc[id] =
UNDEF;
934 prev_new_cid = new_cid;
936 for (std::size_t i = 0; i < old_cids.size(); ++i) {
937 glob_to_loc[old_cids[i]] = i;
940 std::vector<bool> visited(old_cids.size(),
false);
941 std::vector<IndexType> to_visit = {old_cids[0]};
942 while (!to_visit.empty()) {
943 const auto curr = to_visit.back();
944 visited[glob_to_loc[curr]] =
true;
947 if (glob_to_loc[neigh] ==
UNDEF) {
950 if (!visited[glob_to_loc[neigh]]) {
951 to_visit.push_back(neigh);
956 for (std::size_t i = 0; i < visited.size(); ++i) {
958 std::cout <<
"ERROR: in new cell " + std::to_string(new_cid) +
959 ", starting from old cell " +
960 std::to_string(old_cids[0]) +
961 " is not possible to reach the old cell " +
962 std::to_string(old_cids[i])
965 for (
auto cid : {old_cids[0], old_cids[i]}) {
971 std::cout <<
"Old cell " << cid <<
" avg: " << avg.transpose()
974 throw std::runtime_error(
"agglomerated cell is not connected");
988 const std::vector<IndexType>& old_to_new_cell_input,
989 bool check_connected)
const {
990 auto old_to_new_cell = old_to_new_cell_input;
992 assert(old_to_new_cell.size() ==
static_cast<std::size_t
>(
numCells()));
1000 if (check_connected) {
1007 const auto new_to_old_facet =
1014 new_to_old_facet, old_to_new_cell, agg_mesh);
1023 agg_mesh.buildDualGraph();
1027 agg_mesh.buildVtxToCell();
1033 agg_mesh.m_mesh_tags.tags[
CellEnty][tag_name].resize(
1034 new_to_old_cell.size());
1035 for (
index_t ncid = 0; ncid < new_to_old_cell.size(); ++ncid) {
1036 const auto row = new_to_old_cell[ncid];
1037 agg_mesh.m_mesh_tags.tags[
CellEnty][tag_name][ncid] = tag[row[0]];
1039 for (
const auto old_cid : row) {
1040 std::cout <<
"old_cid" << old_cid <<
" tag " << tag[old_cid]
1041 <<
" new_cid " << ncid <<
" tag " << tag[row[0]]
1043 assert(tag[old_cid] == tag[row[0]]);
1061 for (IndexType cell_id = 0; cell_id <
m_cell_to_vtx.size(); ++cell_id) {
1063 vtx_to_cell.
getRow(vid).push_back(cell_id);
1079 for (IndexType facet_id = 0; facet_id < n_facets; ++facet_id) {
1082 if (cell_id != IndexType(-1)) {
1083 cell_to_facet.
getRow(cell_id).push_back(facet_id);
1100 for (IndexType cell_id = 0; cell_id <
m_cell_to_facet.size(); ++cell_id) {
1101 auto& cell_neighs = dual_graph[cell_id];
1104 if ((cell_neigh !=
UNDEF) && (cell_neigh != cell_id)) {
1105 const auto begin = cell_neighs.begin();
1106 const auto end = cell_neighs.end();
1107 if (std::find(begin, end, cell_neigh) == end) {
1108 cell_neighs.push_back(cell_neigh);
1115 (dual_graph.
getRow(cell_id).size() > 0)) &&
1116 "Cell is unconnected");
1118 m_dual_graph = dual_graph.template compress<IndexType>();
static void stop(const char *label)
stop(label) when recording is on.
Definition profiler.hpp:90
static void start(const char *label)
start(label) when recording is on.
Definition profiler.hpp:84
A class that behaves like a vector of vectors, providing automatic row range checking.
Definition crs_map.hpp:758
constexpr void resize(std::size_t new_size)
Resizes the map to contain the specified number of SmallVector objects.
Definition crs_map.hpp:807
constexpr void push_back(const SmallVector< DataType, N > &value)
Appends a copy of a SmallVector to the map.
Definition crs_map.hpp:830
SmallVector< DataType, N > & getRow(std::size_t row_idx)
Access a row of the matrix as a mutable reference.
Definition crs_map.hpp:857
Definition crs_map.hpp:72
IndexType size() const
Get the number of rows in the CRS map.
Definition crs_map.hpp:331
const auto & indices() const
Constant accessor to the indices buffer.
Definition crs_map.hpp:442
const auto & data() const
Constant accessor to the data buffer.
Definition crs_map.hpp:438
A base class for creating and managing mesh data structures.
Definition mesh_base.hpp:370
void buildCellToVtxAgglomeration(const auto &new_to_old_cell, const auto &old_to_new_vtx, Derived &agg_mesh) const
Builds the cell-to-vertex map for an agglomerated mesh.
Definition mesh_base.hpp:887
const VtxToCellMap & getVtxToCellMap() const
Gets a constant reference to the vertex-to-cell map.
Definition mesh_base.hpp:476
constexpr auto & getEntityToCellMap() const
Gets the map from a given entity dimension to cells.
Definition mesh_base.hpp:550
FacetToCellMap & getFacetToCellMap()
Gets a modifiable reference to the facet-to-cell map.
Definition mesh_base.hpp:464
Derived agglomerateBase(const std::vector< index_t > &old_to_new_cell, bool check_connected=true) const
Creates a new, coarser mesh by grouping cells together.
Definition mesh_base.hpp:987
static constexpr IndexType self_dim
Definition mesh_base.hpp:378
CellToFacetMap m_cell_to_facet
Definition mesh_base.hpp:733
void buildDualGraph()
Builds the dual graph (cell-to-cell adjacency).
Definition mesh_base.hpp:1097
datastructure::CrsMap< IndexType, IndexType > CellToVtxMap
Definition mesh_base.hpp:399
datastructure::CrsMap< IndexType, IndexType > DualMap
Definition mesh_base.hpp:395
Metadata< FloatType, IndexType > m_metadata
Definition mesh_base.hpp:751
const auto & getCellToFacetGlobalMap() const
Definition mesh_base.hpp:481
const FacetToCellMap & getFacetToCellMap() const
Gets a constant reference to the facet-to-cell map.
Definition mesh_base.hpp:466
const CellToFacetMap & getCellToFacetMap() const
Gets a constant reference to the cell-to-facet map.
Definition mesh_base.hpp:456
VtxToCellMap & getVtxToCellMap()
Gets a modifiable reference to the vertex-to-cell map.
Definition mesh_base.hpp:474
datastructure::CrsMap< IndexType, IndexType > CellToFacetMap
Definition mesh_base.hpp:397
const auto & getMetadata() const
Gets a constant reference to the mesh metadata.
Definition mesh_base.hpp:495
const auto & getMeshTags() const
Gets a constant reference to the mesh tags.
Definition mesh_base.hpp:490
Entity
Enumerates the different types of mesh entities based on their dimension.
Definition mesh_base.hpp:428
@ CellEnty
Definition mesh_base.hpp:434
@ FacetEnty
Definition mesh_base.hpp:432
@ VtxEnty
Definition mesh_base.hpp:430
MeshTag< SelfDim, IndexType > m_mesh_tags
Definition mesh_base.hpp:749
std::vector< SelfPoint > m_vertexes
Definition mesh_base.hpp:728
const auto & self() const
Helper to get a constant reference to the Derived class instance.
Definition mesh_base.hpp:624
const auto & getCellToVtxGlobalMap() const
Definition mesh_base.hpp:482
static constexpr bool is_manifold
Definition mesh_base.hpp:384
CellToFacetMap & getCellToFacetMap()
Gets a modifiable reference to the cell-to-facet map.
Definition mesh_base.hpp:454
datastructure::CrsMap< IndexType, IndexType > VtxToCellMap
Definition mesh_base.hpp:414
const CellToVtxMap & getCellToVtxMap() const
Gets a constant reference to the cell-to-vertex map.
Definition mesh_base.hpp:461
datastructure::CrsMap< IndexType, IndexType > EdgeToCellMap
Definition mesh_base.hpp:422
DualMap & getDualMap()
Gets a modifiable reference to the dual graph (cell-to-cell connections).
Definition mesh_base.hpp:448
FloatType float_t
Definition mesh_base.hpp:392
const FacetToVtxMap & getFacetToVtxMap() const
Gets a constant reference to the facet-to-vertex map.
Definition mesh_base.hpp:471
static constexpr IndexType vtx_per_face
Definition mesh_base.hpp:381
auto & self()
Helper to get a reference to the Derived class instance.
Definition mesh_base.hpp:627
void serialize(Archive &ar, const unsigned int)
Serializes the mesh data.
Definition mesh_base.hpp:587
datastructure::CrsMap< IndexType, IndexType > CellToEdgeMap
Definition mesh_base.hpp:420
std::vector< index_t > buildNewToOldFacetAgglomerationAndCellToFacet(const auto &new_to_old_cell, Derived &agg_mesh) const
Builds the facet mapping and cell-to-facet map for an agglomerated mesh.
Definition mesh_base.hpp:783
constexpr IndexType nLocEntity(std::size_t dim) const
Returns the number of locally owned entities of a given dimension.
Definition mesh_base.hpp:538
friend bool operator==(const MeshBase &lhs, const MeshBase &rhs)
Checks if two meshes are identical.
Definition mesh_base.hpp:607
std::vector< SelfPoint > & getVertexes()
Gets a modifiable reference to the vector of vertices.
Definition mesh_base.hpp:442
const auto & getFacetToVtxGlobalMap() const
Definition mesh_base.hpp:484
constexpr auto & getEntityToCellGlobalMap() const
Gets the global map from a given entity dimension to cells.
Definition mesh_base.hpp:562
void agglomerateCheckConnected(const datastructure::CrsMap< IndexType, IndexType > &new_to_old_cell) const
Checks if each new agglomerated cell consists of connected old cells.
Definition mesh_base.hpp:917
const auto & getDualGlobalMap() const
Definition mesh_base.hpp:480
VtxToCellMap m_vtx_to_cell
Definition mesh_base.hpp:747
DualMap m_dual_graph
Definition mesh_base.hpp:731
void buildCellToFacet()
Builds the cell-to-facet connectivity map.
Definition mesh_base.hpp:1076
constexpr IndexType nEntity(std::size_t dim) const
Returns the total number of entities of a given dimension.
Definition mesh_base.hpp:527
FacetToCellMap m_facet_to_cell
Definition mesh_base.hpp:743
FacetToVtxMap & getFacetToVtxMap()
Gets a modifiable reference to the facet-to-vertex map.
Definition mesh_base.hpp:469
auto & getMeshTags()
Gets a modifiable reference to the mesh tags.
Definition mesh_base.hpp:488
const std::vector< SelfPoint > & getVertexes() const
Gets a constant reference to the vector of vertices.
Definition mesh_base.hpp:444
CellToVtxMap & getCellToVtxMap()
Gets a modifiable reference to the cell-to-vertex map.
Definition mesh_base.hpp:459
auto buildFacetToCellAndFacetToVtxAgglomeration(const std::vector< index_t > &new_to_old_facet, const std::vector< index_t > &old_to_new_cell, Derived &agg_mesh) const
Builds the facet-to-cell and facet-to-vertex maps for an agglomerated mesh.
Definition mesh_base.hpp:828
datastructure::CrsMap< IndexType, IndexType, vtx_per_face > FacetToVtxMap
Definition mesh_base.hpp:411
IndexType index_t
Definition mesh_base.hpp:391
const auto & getFacetToCellGlobalMap() const
Definition mesh_base.hpp:483
std::conditional_t< is_manifold, datastructure::CrsMap< IndexType, IndexType >, std::vector< std::array< IndexType, 2 > > > FacetToCellMap
Definition mesh_base.hpp:406
auto & getMetadata()
Gets a modifiable reference to the mesh metadata.
Definition mesh_base.hpp:493
std::vector< EdgeVtxs > EdgeToVtxMap
Definition mesh_base.hpp:418
CellToVtxMap m_cell_to_vtx
Definition mesh_base.hpp:735
IndexType numCells() const
Returns the total number of cells in the mesh.
Definition mesh_base.hpp:502
static constexpr IndexType UNDEF
Definition mesh_base.hpp:386
const DualMap & getDualMap() const
Gets a constant reference to the dual graph (cell-to-cell connections).
Definition mesh_base.hpp:451
const auto & getVtxToCellGlobalMap() const
Definition mesh_base.hpp:485
constexpr IndexType nOwnedCells() const
Returns the number of locally owned cells.
Definition mesh_base.hpp:570
void buildInternalMaps()
Builds all the secondary connectivity maps from the primary ones.
Definition mesh_base.hpp:514
Point< FloatType, SelfDim > SelfPoint
Definition mesh_base.hpp:393
datastructure::CrsMap< index_t, index_t > invertCellAgglomeration(const std::vector< index_t > &old_to_new_cell) const
Creates a map from new (agglomerated) cell IDs to old (fine) cell IDs.
Definition mesh_base.hpp:762
static constexpr IndexType outer_dim
Definition mesh_base.hpp:376
datastructure::CrsMapUncompressed< IndexType > CellToVtxMapUncompressed
Definition mesh_base.hpp:401
static constexpr bool parallel()
Indicates if the mesh is configured for parallel computation.
Definition mesh_base.hpp:578
std::array< IndexType, 2 > EdgeVtxs
Definition mesh_base.hpp:416
FacetToVtxMap m_facet_to_vtx
Definition mesh_base.hpp:745
void buildVtxToCell()
Builds the vertex-to-cell connectivity map.
Definition mesh_base.hpp:1059
#define VULPES_UNLIKELY(x)
Branch hint: x is expected to evaluate to false.
Definition macros.hpp:41
Helpers implementing VulPoly's Voronoi construction and cleanup.
Definition abs_agg_model.cpp:42
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.
Definition mesh_base.hpp:164
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.
Definition mesh_base.hpp:255
index_t removeEmptySets(std::vector< index_t > &labels)
Compresses labels to a contiguous range [0, N-1].
Definition mesh_base.hpp:223
constexpr auto cast(const datastructure::CrsMap< Src, Src > &map)
Re-types a CRS map to use a different integral type for indices and values.
Definition mesh_base.hpp:102
void checkEmptySets(const VecType &labels)
Checks for and warns about empty classes in a label vector.
Definition mesh_base.hpp:132
Definition abs_agg_model.cpp:40
Eigen::Matrix< DataType, Dim, 1, Eigen::ColMajor > Point
Definition traits.hpp:34
Definition cell_manager.hpp:38
A structure to store tags for different parts of a mesh.
Definition mesh_base.hpp:333
std::string TagLabel
< The name of the tag (e.g., "inlet_boundary").
Definition mesh_base.hpp:335
std::unordered_map< TagLabel, std::vector< TagType > > TagTable
An array of tag tables, one for each dimension from 0 (vertices) to Dim (cells).
Definition mesh_base.hpp:339
IndexType TagType
A table to store, for each tag name, a list of tag values.
Definition mesh_base.hpp:337
std::array< TagTable, Dim+1 > tags
Definition mesh_base.hpp:342