https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MooseMesh.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#pragma once
11
12#ifdef MOOSE_KOKKOS_ENABLED
13#include "KokkosMesh.h"
14#endif
15
16#include "MooseObject.h"
17#include "BndNode.h"
18#include "BndElement.h"
19#include "Restartable.h"
20#include "MooseEnum.h"
21#include "PerfGraphInterface.h"
22#include "MooseHashing.h"
23#include "MooseApp.h"
24#include "FaceInfo.h"
25#include "ElemInfo.h"
26
27#include <memory> //std::unique_ptr
28#include <filesystem>
29#include <unordered_map>
30#include <unordered_set>
31
32// libMesh
33#include "libmesh/elem_range.h"
34#include "libmesh/mesh_base.h"
35#include "libmesh/replicated_mesh.h"
36#include "libmesh/distributed_mesh.h"
37#include "libmesh/node_range.h"
38#include "libmesh/nanoflann.hpp"
39#include "libmesh/vector_value.h"
40#include "libmesh/point.h"
41#include "libmesh/partitioner.h"
42
43class Assembly;
47class MooseUnits;
48
49// libMesh forward declarations
50namespace libMesh
51{
52class ExodusII_IO;
53class QBase;
54class PeriodicBoundaries;
55class Partitioner;
56class GhostingFunctor;
57class BoundingBox;
58}
59// Useful typedefs
61
62// List of supported geometrical elements
63const std::string LIST_GEOM_ELEM = "EDGE EDGE2 EDGE3 EDGE4 "
64 "QUAD QUAD4 QUAD8 QUAD9 "
65 "TRI TRI3 TRI6 TRI7 "
66 "HEX HEX8 HEX20 HEX27 "
67 "TET TET4 TET10 TET14 "
68 "PRISM PRISM6 PRISM15 PRISM18 "
69 "PYRAMID PYRAMID5 PYRAMID13 PYRAMID14 "
70 "C0POLYGON C0POLYHEDRON";
71
75class QpMap
76{
77public:
78 QpMap() : _distance(std::numeric_limits<Real>::max()) {}
79
81 unsigned int _from;
82
84 unsigned int _to;
85
88};
89
95{
96public:
101
107 static const std::array<bool, 3> periodic_dim_default;
108
110 MooseMesh(const MooseMesh & other_mesh);
111 MooseMesh() = delete;
112 MooseMesh & operator=(const MooseMesh & other_mesh) = delete;
113
114 virtual ~MooseMesh();
115
116 // The type of libMesh::MeshBase that will be used
117 enum class ParallelType
118 {
119 DEFAULT,
122 };
123
127 virtual MooseMesh & clone() const;
128
134 virtual std::unique_ptr<MooseMesh> safeClone() const = 0;
135
140
146 std::unique_ptr<MeshBase> buildMeshBaseObject(unsigned int dim = libMesh::invalid_uint);
147
155 template <typename T>
156 std::unique_ptr<T> buildTypedMesh(unsigned int dim = libMesh::invalid_uint);
157
162 void setMeshBase(std::unique_ptr<MeshBase> mesh_base);
163
165 static MooseEnum partitioning();
166
168 static MooseEnum elemTypes();
169
176 virtual void init();
177
183 virtual void buildMesh() = 0;
184
193 virtual std::vector<std::filesystem::path>
194 writeRecoveryFiles(const std::filesystem::path & file_base);
195
201 virtual unsigned int dimension() const;
202
206 virtual unsigned int spatialDimension() const { return _mesh->spatial_dimension(); }
207
213 virtual unsigned int effectiveSpatialDimension() const;
214
218 unsigned int getBlocksMaxDimension(const std::vector<SubdomainName> & blocks) const;
219
224 std::vector<BoundaryID> getBoundaryIDs(const Elem * const elem,
225 const unsigned short int side) const;
226
230 std::vector<std::vector<BoundaryID>> getBoundaryIDs(const Elem * const elem) const;
231
238 const Elem * getLowerDElem(const Elem *, unsigned short int) const;
239
243 unsigned int getHigherDSide(const Elem * elem) const;
244
252 const std::set<BoundaryID> & getBoundaryIDs() const;
253
260 void buildNodeList();
261 void buildBndElemList();
262
267 const std::unordered_map<dof_id_type, std::vector<dof_id_type>> & nodeToElemMap();
268
273 struct bnd_node_iterator;
274 struct const_bnd_node_iterator;
275
276 struct bnd_elem_iterator;
277 struct const_bnd_elem_iterator;
278
282 virtual bnd_node_iterator bndNodesBegin();
283 virtual bnd_node_iterator bndNodesEnd();
284
288 virtual bnd_elem_iterator bndElemsBegin();
289 virtual bnd_elem_iterator bndElemsEnd();
290
295
300 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>> buildSideList();
301
306 std::vector<std::tuple<dof_id_type, unsigned short int, boundary_id_type>>
307 buildActiveSideList() const;
308
312 unsigned int sideWithBoundaryID(const Elem * const elem, const BoundaryID boundary_id) const;
313
317 MeshBase::node_iterator localNodesBegin();
318 MeshBase::node_iterator localNodesEnd();
319 MeshBase::const_node_iterator localNodesBegin() const;
320 MeshBase::const_node_iterator localNodesEnd() const;
321
325 MeshBase::element_iterator activeLocalElementsBegin();
326 const MeshBase::element_iterator activeLocalElementsEnd();
327 MeshBase::const_element_iterator activeLocalElementsBegin() const;
328 const MeshBase::const_element_iterator activeLocalElementsEnd() const;
329
333 virtual dof_id_type nNodes() const;
334 virtual dof_id_type nElem() const;
335
336 virtual dof_id_type nLocalNodes() const { return _mesh->n_local_nodes(); }
337 virtual dof_id_type nActiveElem() const { return _mesh->n_active_elem(); }
338 virtual dof_id_type nActiveLocalElem() const { return _mesh->n_active_local_elem(); }
339 // NOTE: Expensive operation (iterates through all elements to gather subdomains)
340 virtual SubdomainID nSubdomains() const { return _mesh->n_subdomains(); }
341 virtual unsigned int nPartitions() const { return _mesh->n_partitions(); }
342 virtual bool skipPartitioning() const { return _mesh->skip_partitioning(); }
343 virtual bool skipNoncriticalPartitioning() const;
344
350 virtual dof_id_type maxNodeId() const;
351 virtual dof_id_type maxElemId() const;
352
359 virtual const Node & node(const dof_id_type i) const;
360 virtual Node & node(const dof_id_type i);
361 virtual const Node & nodeRef(const dof_id_type i) const;
362 virtual Node & nodeRef(const dof_id_type i);
363 virtual const Node * nodePtr(const dof_id_type i) const;
364 virtual Node * nodePtr(const dof_id_type i);
365 virtual const Node * queryNodePtr(const dof_id_type i) const;
366 virtual Node * queryNodePtr(const dof_id_type i);
367
374 virtual Elem * elem(const dof_id_type i);
375 virtual const Elem * elem(const dof_id_type i) const;
376 virtual Elem * elemPtr(const dof_id_type i);
377 virtual const Elem * elemPtr(const dof_id_type i) const;
378 virtual Elem * queryElemPtr(const dof_id_type i);
379 virtual const Elem * queryElemPtr(const dof_id_type i) const;
380
384 bool prepared() const;
385 virtual void prepared(bool state);
386
392 void needsPrepareForUse();
393
399 void meshChanged();
400
406 virtual void onMeshChanged();
407
411 void cacheChangedLists();
412
420
428
435 const std::vector<const Elem *> & coarsenedElementChildren(const Elem * elem) const;
436
441 void updateActiveSemiLocalNodeRange(std::set<dof_id_type> & ghosted_elems);
442
448 bool isSemiLocal(Node * const node) const;
449
451
464
468 const std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> &
469 getBoundariesToElems() const;
470
474 const std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> &
476
482 std::unordered_set<dof_id_type> getBoundaryActiveSemiLocalElemIds(BoundaryID bid) const;
483
493 std::unordered_set<dof_id_type> getBoundaryActiveNeighborElemIds(BoundaryID bid) const;
494
503 const std::set<SubdomainID> & blk_group) const;
504
509 const std::set<SubdomainID> & meshSubdomains() const;
510
515 const std::set<BoundaryID> & meshBoundaryIds() const;
516
521 const std::set<BoundaryID> & meshSidesetIds() const;
522
527 const std::set<BoundaryID> & meshNodesetIds() const;
528
533 void setBoundaryToNormalMap(std::unique_ptr<std::map<BoundaryID, RealVectorValue>> boundary_map);
534
535 // DEPRECATED METHOD
536 void setBoundaryToNormalMap(std::map<BoundaryID, RealVectorValue> * boundary_map);
537
542 void setMeshBoundaryIDs(std::set<BoundaryID> boundary_IDs);
543
548 const RealVectorValue & getNormalByBoundaryID(BoundaryID id) const;
549
554 void prepare();
555
561 void prepare(const MeshBase * mesh_to_clone);
562
566 void update();
567
571 unsigned int uniformRefineLevel() const;
572
576 void setUniformRefineLevel(unsigned int, bool deletion = true);
577
589
594
598 void addGhostedBoundary(BoundaryID boundary_id);
599
604 void setGhostedBoundaryInflation(const std::vector<Real> & inflation);
605
609 const std::set<unsigned int> & getGhostedBoundaries() const;
610
614 const std::vector<Real> & getGhostedBoundaryInflation() const;
615
620
624 void needGhostGhostedBoundaries(bool needghost) { _need_ghost_ghosted_boundaries = needghost; }
625
629 unsigned int getPatchSize() const;
630
634 unsigned int getGhostingPatchSize() const { return _ghosting_patch_size; }
635
639 unsigned int getMaxLeafSize() const { return _max_leaf_size; }
640
644 void setPatchUpdateStrategy(Moose::PatchUpdateType patch_update_strategy);
645
650
657 libMesh::BoundingBox getInflatedProcessorBoundingBox(Real inflation_multiplier = 0.01) const;
658
662 operator libMesh::MeshBase &();
663 operator const libMesh::MeshBase &() const;
664
668 MeshBase & getMesh();
669 MeshBase & getMesh(const std::string & name);
670 const MeshBase & getMesh() const;
671 const MeshBase & getMesh(const std::string & name) const;
672 const MeshBase * getMeshPtr() const;
673
677#ifdef MOOSE_KOKKOS_ENABLED
679 const Moose::Kokkos::Mesh * getKokkosMesh() const { return _kokkos_mesh.get(); }
680#endif
681
685 void printInfo(std::ostream & os = libMesh::out, const unsigned int verbosity = 0) const;
686
690 const std::set<SubdomainID> & getNodeBlockIds(const Node & node) const;
691
696 const std::vector<dof_id_type> & getNodeList(boundary_id_type nodeset_id) const;
697
703 const Node * addUniqueNode(const Point & p, Real tol = 1e-6);
704
718 Node * addQuadratureNode(const Elem * elem,
719 const unsigned short int side,
720 const unsigned int qp,
721 BoundaryID bid,
722 const Point & point);
723
731 Node * getQuadratureNode(const Elem * elem, const unsigned short int side, const unsigned int qp);
732
738
745 BoundaryID getBoundaryID(const BoundaryName & boundary_name) const;
746
753 std::vector<BoundaryID> getBoundaryIDs(const std::vector<BoundaryName> & boundary_name,
754 bool generate_unknown = false) const;
755
762 SubdomainID getSubdomainID(const SubdomainName & subdomain_name) const;
763
770 std::vector<SubdomainID>
771 getSubdomainIDs(const std::vector<SubdomainName> & subdomain_names) const;
772 std::set<SubdomainID> getSubdomainIDs(const std::set<SubdomainName> & subdomain_names) const;
773
777 void setSubdomainName(SubdomainID subdomain_id,
778 const SubdomainName & name,
779 const bool synchronous = false);
780
784 static void setSubdomainName(MeshBase & mesh,
785 SubdomainID subdomain_id,
786 const SubdomainName & name,
787 const bool synchronous = false);
788
792 const std::string & getSubdomainName(SubdomainID subdomain_id) const;
793
800 std::vector<SubdomainName>
801 getSubdomainNames(const std::vector<SubdomainID> & subdomain_ids) const;
802
806 void setBoundaryName(BoundaryID boundary_id, BoundaryName name);
807
811 const std::string & getBoundaryName(const BoundaryID boundary_id) const;
812
817 std::string getBoundaryString(const BoundaryID boundary_id) const;
818
824 void buildPeriodicNodeMap(std::multimap<dof_id_type, dof_id_type> & periodic_node_map,
825 unsigned int var_number,
826 libMesh::PeriodicBoundaries * pbs) const;
827
831 void buildPeriodicNodeSets(std::map<BoundaryID, std::set<dof_id_type>> & periodic_node_sets,
832 unsigned int var_number,
833 libMesh::PeriodicBoundaries * pbs) const;
834
838 Real dimensionWidth(unsigned int component) const;
839
841
844 virtual Real getMinInDimension(unsigned int component) const;
845 virtual Real getMaxInDimension(unsigned int component) const;
847
858 bool detectOrthogonalDimRanges(Real tol = 1e-6);
859
864 void addPeriodicVariable(const unsigned int sys_num,
865 const unsigned int var_num,
866 const BoundaryID primary,
867 const BoundaryID secondary);
868
878 const std::array<bool, 3> & queryPeriodicDimensions(const unsigned int sys_num,
879 const unsigned int var_num) const;
888 const std::array<bool, 3> & queryPeriodicDimensions(const MooseVariableBase & var) const;
889
897 bool isTranslatedPeriodic(const unsigned int sys_num,
898 const unsigned int var_num,
899 const unsigned int component) const;
900
906 bool isTranslatedPeriodic(const MooseVariableBase & var, const unsigned int component) const;
907
917 bool isTranslatedPeriodic(const unsigned int var_num, const unsigned int component) const;
918
927 RealVectorValue
928 minPeriodicVector(const unsigned int sys_num, const unsigned int var_num, Point p, Point q) const;
929
937 RealVectorValue
938 minPeriodicVector(const MooseVariableBase & var, const Point & p, const Point & q) const;
939
951 RealVectorValue
952 minPeriodicVector(const unsigned int var_num, const Point & p, const Point & q) const;
953
962 Real minPeriodicDistance(const unsigned int sys_num,
963 const unsigned int var_num,
964 const Point & p,
965 const Point & q) const;
966
974 Real minPeriodicDistance(const MooseVariableBase & var, const Point & p, const Point & q) const;
975
987 Real minPeriodicDistance(const unsigned int var_num, const Point & p, const Point & q) const;
988
996
1000 bool hasDetectedPairedSidesets() const { return _paired_boundary.has_value(); }
1001
1011 const std::pair<BoundaryID, BoundaryID> * getPairedBoundaryMapping(unsigned int component) const;
1012
1020
1030 const std::vector<std::vector<QpMap>> &
1031 getRefinementMap(const Elem & elem, int parent_side, int child, int child_side);
1032
1040 const std::vector<std::pair<unsigned int, QpMap>> & getCoarseningMap(const Elem & elem,
1041 int input_side);
1042
1047 void
1048 changeBoundaryId(const boundary_id_type old_id, const boundary_id_type new_id, bool delete_prev);
1049
1054 static void changeBoundaryId(MeshBase & mesh,
1055 const boundary_id_type old_id,
1056 const boundary_id_type new_id,
1057 bool delete_prev);
1058
1065 const std::set<BoundaryID> & getSubdomainBoundaryIds(const SubdomainID subdomain_id) const;
1066
1073 std::set<BoundaryID> getSubdomainInterfaceBoundaryIds(const SubdomainID subdomain_id) const;
1074
1081 std::set<SubdomainID> getBoundaryConnectedBlocks(const BoundaryID bid) const;
1082
1089 std::set<SubdomainID> getBoundaryConnectedSecondaryBlocks(const BoundaryID bid) const;
1090
1097 std::set<SubdomainID> getInterfaceConnectedBlocks(const BoundaryID bid) const;
1098
1105 const std::set<SubdomainID> & getBlockConnectedBlocks(const SubdomainID subdomain_id) const;
1106
1110 bool isBoundaryNode(dof_id_type node_id) const;
1111
1116 bool isBoundaryNode(dof_id_type node_id, BoundaryID bnd_id) const;
1117
1121 bool isBoundaryElem(dof_id_type elem_id) const;
1122
1127 bool isBoundaryElem(dof_id_type elem_id, BoundaryID bnd_id) const;
1128
1136 void errorIfDistributedMesh(std::string name) const;
1137
1141 virtual bool isDistributedMesh() const { return _use_distributed_mesh; }
1142
1147
1151 void setParallelType(ParallelType parallel_type);
1152
1157
1158 /*
1159 * Set/Get the partitioner name
1160 */
1161 const MooseEnum & partitionerName() const { return _partitioner_name; }
1162
1167
1171 void allowRecovery(bool allow) { _allow_recovery = allow; }
1172
1176 static void setPartitioner(MeshBase & mesh_base,
1177 MooseEnum & partitioner,
1178 bool use_distributed_mesh,
1179 const InputParameters & params,
1180 MooseObject & context_obj);
1181
1185 void setCustomPartitioner(libMesh::Partitioner * partitioner);
1186
1188
1191 bool isCustomPartitionerRequested() const;
1192 void setIsCustomPartitionerRequested(bool cpr);
1194
1197
1200
1205 virtual std::unique_ptr<libMesh::PointLocatorBase> getPointLocator() const;
1206
1211 virtual std::string getFileName() const { return ""; }
1212
1214 using PeriodicNodeInfo = std::pair<const Node *, BoundaryID>;
1215
1219 void needsRemoteElemDeletion(bool need_delete) { _need_delete = need_delete; }
1220
1224 bool needsRemoteElemDeletion() const { return _need_delete; }
1225
1229 void allowRemoteElementRemoval(bool allow_removal);
1230
1235
1239 void deleteRemoteElements();
1240
1244 bool hasMeshBase() const { return _mesh.get() != nullptr; }
1245
1249 bool hasElementID(const std::string & id_name) const;
1250
1254 unsigned int getElementIDIndex(const std::string & id_name) const;
1255
1259 dof_id_type maxElementID(unsigned int elem_id_index) const { return _max_ids[elem_id_index]; }
1260
1264 dof_id_type minElementID(unsigned int elem_id_index) const { return _min_ids[elem_id_index]; }
1265
1269 bool areElemIDsIdentical(const std::string & id_name1, const std::string & id_name2) const;
1270
1274 std::set<dof_id_type> getAllElemIDs(unsigned int elem_id_index) const;
1275
1280 std::set<dof_id_type> getElemIDsOnBlocks(unsigned int elem_id_index,
1281 const std::set<SubdomainID> & blks) const;
1282
1286 unsigned int getMaxSidesPerElem() const { return _max_sides_per_elem; }
1287
1291 unsigned int getMaxNodesPerElem() const { return _max_nodes_per_elem; }
1292
1296 unsigned int getMaxNodesPerSide() const { return _max_nodes_per_side; }
1297
1298 std::unordered_map<dof_id_type, std::set<dof_id_type>>
1299 getElemIDMapping(const std::string & from_id_name, const std::string & to_id_name) const;
1300
1302 unsigned int nFace() const { return _face_info.size(); }
1303
1305 const std::vector<const FaceInfo *> & faceInfo() const;
1306
1308 struct face_info_iterator;
1309 struct const_face_info_iterator;
1310
1315 face_info_iterator ownedFaceInfoBegin();
1316 face_info_iterator ownedFaceInfoEnd();
1317
1319 struct elem_info_iterator;
1320 struct const_elem_info_iterator;
1321
1326 elem_info_iterator ownedElemInfoBegin();
1327 elem_info_iterator ownedElemInfoEnd();
1328
1330 const FaceInfo * faceInfo(const Elem * elem, unsigned int side) const;
1331
1333 const ElemInfo & elemInfo(const dof_id_type id) const;
1334
1336 const std::vector<const ElemInfo *> & elemInfoVector() const { return _elem_info; }
1337
1339 const std::vector<FaceInfo> & allFaceInfo() const;
1341
1345 void cacheFaceInfoVariableOwnership() const;
1346
1351 void cacheFVElementalDoFs() const;
1352
1358 void computeFiniteVolumeCoords() const;
1359
1363 void isDisplaced(bool is_displaced) { _is_displaced = is_displaced; }
1364
1368 bool isDisplaced() const { return _is_displaced; }
1369
1373 const std::map<boundary_id_type, std::vector<dof_id_type>> & nodeSetNodes() const;
1374
1380
1386
1390 const std::map<SubdomainID, Moose::CoordinateSystemType> & getCoordSystem() const;
1391
1395 void setCoordSystem(const std::vector<SubdomainName> & blocks, const MultiMooseEnum & coord_sys);
1396
1401 void setAxisymmetricCoordAxis(const MooseEnum & rz_coord_axis);
1402
1417 void setGeneralAxisymmetricCoordAxes(const std::vector<SubdomainName> & blocks,
1418 const std::vector<std::pair<Point, RealVectorValue>> & axes);
1419
1425 const std::pair<Point, RealVectorValue> &
1426 getGeneralAxisymmetricCoordAxis(SubdomainID subdomain_id) const;
1427
1432
1437 unsigned int getAxisymmetricRadialCoord() const;
1438
1445
1449 void setCoordData(const MooseMesh & other_mesh);
1450
1455
1460
1466
1470 const MooseUnits & lengthUnit() const;
1471
1476 const std::unordered_map<std::pair<const Elem *, unsigned short int>, const Elem *> &
1477 getLowerDElemMap() const;
1478
1482 bool isSplit() const { return _is_split; }
1483
1490 void buildFiniteVolumeInfo() const;
1491
1497 void setupFiniteVolumeMeshData() const;
1498
1502 void doingPRefinement(bool doing_p_refinement) { _doing_p_refinement = doing_p_refinement; }
1503
1507 [[nodiscard]] bool doingPRefinement() const { return _doing_p_refinement; }
1508
1512 unsigned int maxPLevel() const { return _max_p_level; }
1513
1517 unsigned int maxHLevel() const { return _max_h_level; }
1518
1523 const std::vector<QpMap> & getPRefinementMap(const Elem & elem) const;
1528 const std::vector<QpMap> & getPRefinementSideMap(const Elem & elem) const;
1533 const std::vector<QpMap> & getPCoarseningMap(const Elem & elem) const;
1538 const std::vector<QpMap> & getPCoarseningSideMap(const Elem & elem) const;
1539
1541
1545 bool hasLowerD() const { return getMesh().elem_dimensions().size() > 1; }
1546
1550 const std::set<SubdomainID> & interiorLowerDBlocks() const { return _lower_d_interior_blocks; }
1554 const std::set<SubdomainID> & boundaryLowerDBlocks() const { return _lower_d_boundary_blocks; }
1555
1558
1561
1568
1569protected:
1573 bool allowRecovery() const { return _allow_recovery; }
1574
1576 std::vector<std::unique_ptr<libMesh::GhostingFunctor>> _ghosting_functors;
1577
1579 std::vector<std::shared_ptr<RelationshipManager>> _relationship_managers;
1580
1583
1587
1594
1596 std::unique_ptr<libMesh::MeshBase> _mesh;
1597
1599#ifdef MOOSE_KOKKOS_ENABLED
1600 std::unique_ptr<Moose::Kokkos::Mesh> _kokkos_mesh;
1601#endif
1602
1606
1608 std::unique_ptr<libMesh::Partitioner> _custom_partitioner;
1610
1612 enum
1613 {
1614 X = 0,
1616 Z
1618 enum
1619 {
1620 MIN = 0,
1621 MAX
1623
1626
1629
1632
1635
1638
1641
1643 std::unique_ptr<ConstElemPointerRange> _refined_elements;
1644
1646 std::unique_ptr<ConstElemPointerRange> _coarsened_elements;
1647
1653 std::map<const Elem *, std::vector<const Elem *>> _coarsened_element_children;
1654
1656 std::set<Node *> _semilocal_node_list;
1657
1662 std::unique_ptr<SemiLocalNodeRange> _active_semilocal_node_range;
1663 std::unique_ptr<libMesh::NodeRange> _active_node_range;
1664 std::unique_ptr<libMesh::ConstNodeRange> _local_node_range;
1665 std::unique_ptr<libMesh::StoredRange<MooseMesh::const_bnd_node_iterator, const BndNode *>>
1667 std::unique_ptr<libMesh::StoredRange<MooseMesh::const_bnd_elem_iterator, const BndElement *>>
1669
1671 std::unordered_map<dof_id_type, std::vector<dof_id_type>> _node_to_elem_map;
1672
1675
1680 std::set<SubdomainID> _mesh_subdomains;
1681
1683
1688 std::set<BoundaryID> _mesh_boundary_ids;
1689 std::set<BoundaryID> _mesh_sideset_ids;
1690 std::set<BoundaryID> _mesh_nodeset_ids;
1692
1694 std::unique_ptr<std::map<BoundaryID, RealVectorValue>> _boundary_to_normal_map;
1695
1697 std::vector<BndNode *> _bnd_nodes;
1698 typedef std::vector<BndNode *>::iterator bnd_node_iterator_imp;
1699 typedef std::vector<BndNode *>::const_iterator const_bnd_node_iterator_imp;
1701 std::map<boundary_id_type, std::set<dof_id_type>> _bnd_node_ids;
1702
1704 std::vector<BndElement *> _bnd_elems;
1705 typedef std::vector<BndElement *>::iterator bnd_elem_iterator_imp;
1706 typedef std::vector<BndElement *>::const_iterator const_bnd_elem_iterator_imp;
1707
1709 std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> _bnd_elem_ids;
1710
1711 std::map<dof_id_type, Node *> _quadrature_nodes;
1712 std::map<dof_id_type, std::map<unsigned int, std::map<dof_id_type, Node *>>>
1714 std::vector<BndNode> _extra_bnd_nodes;
1715
1717 std::map<dof_id_type, std::set<SubdomainID>> _block_node_list;
1718
1720 std::map<boundary_id_type, std::vector<dof_id_type>> _node_set_nodes;
1721
1722 std::set<unsigned int> _ghosted_boundaries;
1724
1726 unsigned int _patch_size;
1727
1730
1731 // The maximum number of points in each leaf of the KDTree used in the nearest neighbor search.
1732 unsigned int _max_leaf_size;
1733
1736
1738 std::vector<Node *> _node_map;
1739
1742
1744 std::vector<std::vector<Real>> _bounds;
1745
1747 std::optional<std::vector<std::pair<BoundaryID, BoundaryID>>> _paired_boundary;
1748
1750 const bool _is_split;
1751
1752 void cacheInfo();
1753 void freeBndNodes();
1754 void freeBndElems();
1755 void setPartitionerHelper(MeshBase * mesh = nullptr);
1756
1757private:
1762 std::unordered_map<dof_id_type, std::vector<dof_id_type>> & internalNodeToElemMap();
1763
1766 mutable std::unordered_map<dof_id_type, ElemInfo> _elem_to_elem_info;
1767
1770 mutable std::vector<const ElemInfo *> _elem_info;
1771
1774 mutable std::vector<FaceInfo> _all_face_info;
1775
1778 mutable std::vector<const FaceInfo *> _face_info;
1779
1781 mutable std::unordered_map<std::pair<const Elem *, unsigned int>, FaceInfo *>
1783
1784 // true if the _face_info member needs to be rebuilt/updated.
1785 mutable bool _finite_volume_info_dirty = true;
1786
1787 // True if we have cached elemental dofs ids for the linear finite volume variables.
1788 // This happens in the first system which has a linear finite volume variable, considering
1789 // that currently we only support one variable per linear system.
1791
1798 std::map<std::pair<unsigned int, unsigned int>, std::array<bool, 3>> _periodic_dim;
1799
1803 RealVectorValue _half_range;
1804
1806 std::vector<Node *> _extreme_nodes;
1807
1819 void buildRefinementMap(const Elem & elem,
1820 libMesh::QBase & qrule,
1821 libMesh::QBase & qrule_face,
1822 int parent_side,
1823 int child,
1824 int child_side);
1825
1835 void buildCoarseningMap(const Elem & elem,
1836 libMesh::QBase & qrule,
1837 libMesh::QBase & qrule_face,
1838 int input_side);
1839
1848 void mapPoints(const std::vector<Point> & from,
1849 const std::vector<Point> & to,
1850 std::vector<QpMap> & qp_map);
1851
1874 void findAdaptivityQpMaps(const Elem * template_elem,
1875 libMesh::QBase & qrule,
1876 libMesh::QBase & qrule_face,
1877 std::vector<std::vector<QpMap>> & refinement_map,
1878 std::vector<std::pair<unsigned int, QpMap>> & coarsen_map,
1879 int parent_side,
1880 int child,
1881 int child_side);
1882
1884
1885 const std::vector<QpMap> & getPRefinementMapHelper(
1886 const Elem & elem,
1887 const std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>> &) const;
1888 const std::vector<QpMap> & getPCoarseningMapHelper(
1889 const Elem & elem,
1890 const std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>> &) const;
1891
1896 void updateCoordTransform();
1897
1903
1917 std::map<std::pair<int, libMesh::ElemType>, std::vector<std::vector<QpMap>>>
1919
1920 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1922 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1924
1926 std::map<libMesh::ElemType, std::map<std::pair<int, int>, std::vector<std::vector<QpMap>>>>
1928
1943 std::map<std::pair<int, libMesh::ElemType>, std::vector<std::pair<unsigned int, QpMap>>>
1945
1946 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1948 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1950
1952 {
1954 std::set<SubdomainID> neighbor_subs;
1955
1958 std::set<BoundaryID> boundary_ids;
1959 };
1960
1962 std::unordered_map<SubdomainID, SubdomainData> _sub_to_data;
1963
1965 std::unordered_map<SubdomainID, std::set<BoundaryID>> _neighbor_subdomain_boundary_ids;
1966
1968 std::set<SubdomainID> _lower_d_interior_blocks;
1970 std::set<SubdomainID> _lower_d_boundary_blocks;
1972 std::unordered_map<std::pair<const Elem *, unsigned short int>, const Elem *>
1974 std::unordered_map<const Elem *, unsigned short int> _lower_d_elem_to_higher_d_elem_side;
1975
1978
1981
1985
1988
1991
1994
2000
2002 std::vector<std::unordered_map<SubdomainID, std::set<dof_id_type>>> _block_id_mapping;
2004 std::vector<dof_id_type> _max_ids;
2006 std::vector<dof_id_type> _min_ids;
2008 std::vector<std::vector<bool>> _id_identical_flag;
2009
2012
2015
2018
2021
2024
2026 void buildElemIDInfo();
2027
2029 void buildLowerDMesh();
2030
2032 std::map<SubdomainID, Moose::CoordinateSystemType> & _coord_sys;
2033
2035 unsigned int _rz_coord_axis;
2036
2038 std::unordered_map<SubdomainID, std::pair<Point, RealVectorValue>> _subdomain_id_to_rz_coord_axis;
2039
2042 std::unique_ptr<MooseAppCoordTransform> _coord_transform;
2043
2046
2048 std::vector<SubdomainName> _provided_coord_blocks;
2049
2053 unsigned int _max_p_level;
2055 unsigned int _max_h_level;
2056
2057 template <typename T>
2058 struct MeshType;
2059};
2060
2063{
2064 mooseAssert(_coord_transform, "The coordinate transformation object is null.");
2065 return *_coord_transform;
2066}
2067
2068template <>
2069struct MooseMesh::MeshType<libMesh::ReplicatedMesh>
2070{
2072};
2073
2074template <>
2075struct MooseMesh::MeshType<libMesh::DistributedMesh>
2076{
2078};
2079
2084 : variant_filter_iterator<MeshBase::Predicate, const FaceInfo *>
2085{
2086 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2087 template <typename PredType, typename IterType>
2088 face_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2089 : variant_filter_iterator<MeshBase::Predicate, const FaceInfo *>(d, e, p)
2090 {
2091 }
2092};
2093
2099 const FaceInfo * const,
2100 const FaceInfo * const &,
2101 const FaceInfo * const *>
2102{
2103 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2104 template <typename PredType, typename IterType>
2105 const_face_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2106 : variant_filter_iterator<MeshBase::Predicate,
2107 const FaceInfo * const,
2108 const FaceInfo * const &,
2109 const FaceInfo * const *>(d, e, p)
2110 {
2111 }
2112
2113 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2114 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2116 : variant_filter_iterator<MeshBase::Predicate,
2117 const FaceInfo * const,
2118 const FaceInfo * const &,
2119 const FaceInfo * const *>(rhs)
2120 {
2121 }
2122};
2123
2128 : variant_filter_iterator<MeshBase::Predicate, const ElemInfo *>
2129{
2130 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2131 template <typename PredType, typename IterType>
2132 elem_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2133 : variant_filter_iterator<MeshBase::Predicate, const ElemInfo *>(d, e, p)
2134 {
2135 }
2136};
2137
2143 const ElemInfo * const,
2144 const ElemInfo * const &,
2145 const ElemInfo * const *>
2146{
2147 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2148 template <typename PredType, typename IterType>
2149 const_elem_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2150 : variant_filter_iterator<MeshBase::Predicate,
2151 const ElemInfo * const,
2152 const ElemInfo * const &,
2153 const ElemInfo * const *>(d, e, p)
2154 {
2155 }
2156
2157 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2158 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2160 : variant_filter_iterator<MeshBase::Predicate,
2161 const ElemInfo * const,
2162 const ElemInfo * const &,
2163 const ElemInfo * const *>(rhs)
2164 {
2165 }
2166};
2167
2171struct MooseMesh::bnd_node_iterator : variant_filter_iterator<MeshBase::Predicate, BndNode *>
2172{
2173 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2174 template <typename PredType, typename IterType>
2175 bnd_node_iterator(const IterType & d, const IterType & e, const PredType & p)
2176 : variant_filter_iterator<MeshBase::Predicate, BndNode *>(d, e, p)
2177 {
2178 }
2179};
2180
2186 BndNode * const,
2187 BndNode * const &,
2188 BndNode * const *>
2189{
2190 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2191 template <typename PredType, typename IterType>
2192 const_bnd_node_iterator(const IterType & d, const IterType & e, const PredType & p)
2193 : variant_filter_iterator<MeshBase::Predicate,
2194 BndNode * const,
2195 BndNode * const &,
2196 BndNode * const *>(d, e, p)
2197 {
2198 }
2199
2200 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2201 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2203 : variant_filter_iterator<MeshBase::Predicate,
2204 BndNode * const,
2205 BndNode * const &,
2206 BndNode * const *>(rhs)
2207 {
2208 }
2209};
2210
2214struct MooseMesh::bnd_elem_iterator : variant_filter_iterator<MeshBase::Predicate, BndElement *>
2215{
2216 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2217 template <typename PredType, typename IterType>
2218 bnd_elem_iterator(const IterType & d, const IterType & e, const PredType & p)
2219 : variant_filter_iterator<MeshBase::Predicate, BndElement *>(d, e, p)
2220 {
2221 }
2222};
2223
2229 BndElement * const,
2230 BndElement * const &,
2231 BndElement * const *>
2232{
2233 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2234 template <typename PredType, typename IterType>
2235 const_bnd_elem_iterator(const IterType & d, const IterType & e, const PredType & p)
2236 : variant_filter_iterator<MeshBase::Predicate,
2237 BndElement * const,
2238 BndElement * const &,
2239 BndElement * const *>(d, e, p)
2240 {
2241 }
2242
2243 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2244 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2246 : variant_filter_iterator<MeshBase::Predicate,
2247 BndElement * const,
2248 BndElement * const &,
2249 BndElement * const *>(rhs)
2250 {
2251 }
2252};
2253
2261
2262template <typename T>
2263std::unique_ptr<T>
2265{
2266 // If the requested mesh type to build doesn't match our current value for _use_distributed_mesh,
2267 // then we need to make sure to make our state consistent because other objects, like the periodic
2268 // boundary condition action, will be querying isDistributedMesh()
2269 if (_use_distributed_mesh != std::is_same<T, libMesh::DistributedMesh>::value)
2270 {
2271 if (getMeshPtr())
2272 mooseError("A MooseMesh object is being asked to build a libMesh mesh that is a different "
2273 "parallel type than the libMesh mesh that it wraps. This is not allowed. Please "
2274 "create another MooseMesh object to wrap the new libMesh mesh");
2276 }
2277
2279 {
2280 if (isParamValid("dim"))
2281 dim = getParam<MooseEnum>("dim");
2282 else
2283 // Legacy selection of the default for the 'dim' parameter
2284 dim = 1;
2285 }
2286
2287 auto mesh = std::make_unique<T>(_communicator, dim);
2288
2289 if (!getParam<bool>("allow_renumbering"))
2290 mesh->allow_renumbering(false);
2291
2292 mesh->allow_remote_element_removal(_allow_remote_element_removal);
2294
2296 {
2297 // Check of partitioner is supplied (not allowed if custom partitioner is used)
2298 if (!parameters().isParamSetByAddParam("partitioner"))
2299 mooseError("If partitioner block is provided, partitioner keyword cannot be used!");
2300 // Set custom partitioner
2301 if (!_custom_partitioner.get())
2302 mooseError("Custom partitioner requested but not set!");
2303 mesh->partitioner() = _custom_partitioner->clone();
2304 }
2305 else
2307
2308 return mesh;
2309}
2310
2311inline bool
2316
2317inline void
2319{
2320 _parallel_type = parallel_type;
2322}
2323
2324inline bool
2325MooseMesh::hasElementID(const std::string & id_name) const
2326{
2327 return getMesh().has_elem_integer(id_name);
2328}
2329
2330inline unsigned int
2331MooseMesh::getElementIDIndex(const std::string & id_name) const
2332{
2333 if (!hasElementID(id_name))
2334 mooseError("Mesh does not have element ID for ", id_name);
2335 return getMesh().get_elem_integer_index(id_name);
2336}
2337
2338inline bool
2339MooseMesh::areElemIDsIdentical(const std::string & id_name1, const std::string & id_name2) const
2340{
2341 auto id1 = getElementIDIndex(id_name1);
2342 auto id2 = getElementIDIndex(id_name2);
2343 return _id_identical_flag[id1][id2];
2344}
2345
2346inline const std::vector<const FaceInfo *> &
2348{
2349 return _face_info;
2350}
2351
2352inline const std::vector<FaceInfo> &
2354{
2355 return _all_face_info;
2356}
2357
2358inline const std::map<boundary_id_type, std::vector<dof_id_type>> &
2360{
2361 return _node_set_nodes;
2362}
2363
2364inline const std::unordered_map<std::pair<const Elem *, unsigned short int>, const Elem *> &
boundary_id_type BoundaryID
subdomain_id_type SubdomainID
libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition MooseMesh.h:2258
libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
Definition MooseMesh.h:2260
libMesh::StoredRange< std::set< Node * >::iterator, Node * > SemiLocalNodeRange
Definition MooseMesh.h:60
const std::string LIST_GEOM_ELEM
Definition MooseMesh.h:63
char ** blocks
unsigned int dim
Keeps track of stuff related to assembling.
Definition Assembly.h:101
Class used for caching additional information for elements such as the volume and centroid.
Definition ElemInfo.h:26
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void attachRelationshipManagers(Moose::RelationshipManagerType rm_type, bool attach_geometric_rm_final=false)
Attach the relationship managers of the given type Note: Geometric relationship managers that are sup...
Definition MooseApp.C:3210
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
Definition MooseBase.h:271
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
std::set< SubdomainID > getInterfaceConnectedBlocks(const BoundaryID bid) const
Get the list of subdomains contacting the given boundary.
Definition MooseMesh.C:3652
virtual bnd_node_iterator bndNodesBegin()
Return iterators to the beginning/end of the boundary nodes list.
Definition MooseMesh.C:1538
const Moose::PatchUpdateType & getPatchUpdateStrategy() const
Get the current patch update strategy.
Definition MooseMesh.C:3522
std::vector< std::vector< bool > > _id_identical_flag
Flags to indicate whether or not any two extra element integers are the same.
Definition MooseMesh.h:2008
bool _need_delete
Whether we need to delete remote elements after init'ing the EquationSystems.
Definition MooseMesh.h:1987
void setBoundaryName(BoundaryID boundary_id, BoundaryName name)
This method sets the boundary name of the boundary based on the id parameter.
Definition MooseMesh.C:1776
virtual bnd_node_iterator bndNodesEnd()
Definition MooseMesh.C:1546
virtual ~MooseMesh()
Definition MooseMesh.C:356
bool isBoundaryElem(dof_id_type elem_id) const
Returns true if the requested element is in the list of boundary elements, false otherwise.
Definition MooseMesh.C:3700
void setupFiniteVolumeMeshData() const
Sets up the additional data needed for finite volume computations.
Definition MooseMesh.C:4201
const std::set< BoundaryID > & getSubdomainBoundaryIds(const SubdomainID subdomain_id) const
Get the list of boundary ids associated with the given subdomain id.
Definition MooseMesh.C:3606
void buildBndElemList()
Definition MooseMesh.C:1187
void printInfo(std::ostream &os=libMesh::out, const unsigned int verbosity=0) const
Calls print_info() on the underlying Mesh.
Definition MooseMesh.C:3571
const Elem * getLowerDElem(const Elem *, unsigned short int) const
Returns a const pointer to a lower dimensional element that corresponds to a side of a higher dimensi...
Definition MooseMesh.C:1693
virtual std::vector< std::filesystem::path > writeRecoveryFiles(const std::filesystem::path &file_base)
Write the mesh files needed for recovery/checkpointing.
Definition MooseMesh.C:2986
bool _allow_recovery
Whether or not this Mesh is allowed to read a recovery file.
Definition MooseMesh.h:1977
MeshBase::node_iterator localNodesEnd()
Definition MooseMesh.C:3142
unsigned int _max_p_level
Maximum p-refinement level of all elements.
Definition MooseMesh.h:2053
std::map< const Elem *, std::vector< const Elem * > > _coarsened_element_children
Map of Parent elements to child elements for elements that were just coarsened.
Definition MooseMesh.h:1653
std::unordered_set< dof_id_type > getBoundaryActiveSemiLocalElemIds(BoundaryID bid) const
Return all ids of elements which have a side which is part of a sideset.
Definition MooseMesh.C:1328
std::unique_ptr< ConstElemPointerRange > _coarsened_elements
The elements that were just coarsened.
Definition MooseMesh.h:1646
std::vector< BndNode * >::iterator bnd_node_iterator_imp
Definition MooseMesh.h:1698
MeshBase & getMesh(const std::string &name)
unsigned int getAxisymmetricRadialCoord() const
Returns the desired radial direction for RZ coordinate transformation.
Definition MooseMesh.C:4423
face_info_iterator ownedFaceInfoEnd()
Definition MooseMesh.C:1512
unsigned int sideWithBoundaryID(const Elem *const elem, const BoundaryID boundary_id) const
Calls BoundaryInfo::side_with_boundary_id().
Definition MooseMesh.C:3130
void meshChanged()
Declares that the MooseMesh has changed, invalidates cached data and rebuilds caches.
Definition MooseMesh.C:892
virtual const Node & nodeRef(const dof_id_type i) const
Definition MooseMesh.C:844
const std::vector< QpMap > & getPRefinementMap(const Elem &elem) const
Get the map describing for each volumetric quadrature point (qp) on the refined level which qp on the...
Definition MooseMesh.C:4507
bool _displace_node_list_by_side_list
Whether or not to displace unrelated nodesets by nodesets constructed from sidesets.
Definition MooseMesh.h:1984
void allowRecovery(bool allow)
Set whether or not this mesh is allowed to read a recovery file.
Definition MooseMesh.h:1171
void changeBoundaryId(const boundary_id_type old_id, const boundary_id_type new_id, bool delete_prev)
Change all the boundary IDs for a given side from old_id to new_id.
Definition MooseMesh.C:2821
const std::vector< const Elem * > & coarsenedElementChildren(const Elem *elem) const
Get the newly removed children element ids for an element that was just coarsened.
Definition MooseMesh.C:952
void mapPoints(const std::vector< Point > &from, const std::vector< Point > &to, std::vector< QpMap > &qp_map)
Find the closest points that map "from" to "to" and fill up "qp_map".
Definition MooseMesh.C:2649
bool isDisplaced() const
whether this mesh is a displaced mesh
Definition MooseMesh.h:1368
libMesh::BoundingBox getInflatedProcessorBoundingBox(Real inflation_multiplier=0.01) const
Get a (slightly inflated) processor bounding box.
Definition MooseMesh.C:3528
RealVectorValue minPeriodicVector(const unsigned int sys_num, const unsigned int var_num, Point p, Point q) const
Returns the minimum vector between two points on the mesh taking into account periodicity for the giv...
Definition MooseMesh.C:2280
std::set< Node * > _semilocal_node_list
Used for generating the semilocal node range.
Definition MooseMesh.h:1656
Real minPeriodicDistance(const unsigned int sys_num, const unsigned int var_num, const Point &p, const Point &q) const
Returns the distance between two points on the mesh taking into account periodicity for the given var...
Definition MooseMesh.C:2325
std::unordered_map< dof_id_type, ElemInfo > _elem_to_elem_info
Map connecting elems with their corresponding ElemInfo, we use the element ID as the key.
Definition MooseMesh.h:1766
unsigned int uniformRefineLevel() const
Returns the level of uniform refinement requested (zero if AMR is disabled).
Definition MooseMesh.C:3325
virtual dof_id_type maxElemId() const
Definition MooseMesh.C:3202
const std::vector< std::pair< unsigned int, QpMap > > & getCoarseningMap(const Elem &elem, int input_side)
Get the coarsening map for a given element type.
Definition MooseMesh.C:2638
bool isParallelTypeForced() const
Tell the user if the distribution was overriden for any reason.
Definition MooseMesh.h:1146
bool possiblyRebuildNodeToElemMap()
rebuild the node to element map if it's been requsted previously
Definition MooseMesh.C:606
std::vector< const FaceInfo * > _face_info
Holds only those FaceInfo objects that have processor_id equal to this process's id,...
Definition MooseMesh.h:1778
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Definition MooseMesh.C:2994
static const std::array< bool, 3 > periodic_dim_default
Default value for the automatically detected paired boundaries for each unit dimension,...
Definition MooseMesh.h:78
std::vector< std::shared_ptr< RelationshipManager > > _relationship_managers
The list of active geometric relationship managers (bound to the underlying MeshBase object).
Definition MooseMesh.h:1579
virtual Elem * elem(const dof_id_type i)
Various accessors (pointers/references) for Elem "i".
Definition MooseMesh.C:3208
unsigned int getMaxLeafSize() const
Getter for the maximum leaf size parameter.
Definition MooseMesh.h:639
std::vector< BndElement * >::const_iterator const_bnd_elem_iterator_imp
Definition MooseMesh.h:1706
std::unique_ptr< ConstElemPointerRange > _refined_elements
The elements that were just refined.
Definition MooseMesh.h:1643
bool _custom_partitioner_requested
Definition MooseMesh.h:1609
bool _need_ghost_ghosted_boundaries
A parallel mesh generator such as DistributedRectilinearMeshGenerator already make everything ready.
Definition MooseMesh.h:1999
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > buildSideList()
Calls BoundaryInfo::build_side_list(), returns a std::vector of (elem-id, side-id,...
Definition MooseMesh.C:3118
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition MooseMesh.C:1652
dof_id_type minElementID(unsigned int elem_id_index) const
Return the minimum element ID for an extra element integer with its accessing index.
Definition MooseMesh.h:1264
virtual bool skipPartitioning() const
Definition MooseMesh.h:342
void updateCoordTransform()
Update the coordinate transformation object based on our coordinate system data.
Definition MooseMesh.C:4414
void markFiniteVolumeInfoDirty()
Mark the finite volume information as dirty.
Definition MooseMesh.h:1454
elem_info_iterator ownedElemInfoEnd()
Definition MooseMesh.C:1529
virtual MooseMesh & clone() const
Clone method.
Definition MooseMesh.C:2884
std::unordered_map< SubdomainID, std::pair< Point, RealVectorValue > > _subdomain_id_to_rz_coord_axis
Map of subdomain ID to general axisymmetric axis.
Definition MooseMesh.h:2038
bool _linear_finite_volume_dofs_cached
Definition MooseMesh.h:1790
virtual Elem * elemPtr(const dof_id_type i)
Definition MooseMesh.C:3222
virtual void onMeshChanged()
Declares a callback function that is executed at the conclusion of meshChanged().
Definition MooseMesh.C:917
bool _coord_system_set
Whether the coordinate system has been set.
Definition MooseMesh.h:2045
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3557
MooseEnum _partitioner_name
The partitioner used on this mesh.
Definition MooseMesh.h:1604
virtual unsigned int spatialDimension() const
Returns MeshBase::spatial_dimension.
Definition MooseMesh.h:206
ParallelType getParallelType() const
Definition MooseMesh.h:1156
bool _parallel_type_overridden
Definition MooseMesh.h:1593
void buildRefinementAndCoarseningMaps(Assembly *assembly)
Create the refinement and coarsening maps necessary for projection of stateful material properties wh...
Definition MooseMesh.C:2521
void detectPairedSidesets()
This routine detects paired sidesets of a regular orthogonal mesh (.i.e.
Definition MooseMesh.C:2002
bool _is_changed
true if mesh is changed (i.e. after adaptivity step)
Definition MooseMesh.h:1634
void needGhostGhostedBoundaries(bool needghost)
Whether or not we want to ghost ghosted boundaries.
Definition MooseMesh.h:624
MooseMesh()=delete
unsigned int _ghosting_patch_size
The number of nearest neighbors to consider for ghosting purposes when iteration patch update strateg...
Definition MooseMesh.h:1729
virtual void buildMesh()=0
Must be overridden by child classes.
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_coarsening_map
Definition MooseMesh.h:1947
std::set< BoundaryID > _mesh_boundary_ids
A set of boundary IDs currently present in the mesh.
Definition MooseMesh.h:1688
unsigned int getMaxSidesPerElem() const
Get the maximum number of sides per element.
Definition MooseMesh.h:1286
const std::vector< Real > & getGhostedBoundaryInflation() const
Return a writable reference to the _ghosted_boundaries_inflation vector.
Definition MooseMesh.C:3356
virtual void init()
Initialize the Mesh object.
Definition MooseMesh.C:2937
virtual const Node & node(const dof_id_type i) const
Various accessors (pointers/references) for Node "i".
Definition MooseMesh.C:830
bool _is_displaced
Whether this mesh is displaced.
Definition MooseMesh.h:2023
std::vector< SubdomainName > getSubdomainNames(const std::vector< SubdomainID > &subdomain_ids) const
Get the associated subdomainNames for the subdomain ids that are passed in.
Definition MooseMesh.C:1765
Real dimensionWidth(unsigned int component) const
Returns the width of the requested dimension.
Definition MooseMesh.C:2179
unsigned int _max_leaf_size
Definition MooseMesh.h:1732
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_coarsening_side_map
Definition MooseMesh.h:1949
void prepare()
Calls prepare_for_use() if the underlying MeshBase object isn't prepared, then communicates various b...
Definition MooseMesh.C:397
bool skipDeletionRepartitionAfterRefine() const
Return a flag indicating whether or not we should skip remote deletion and repartition after uniform ...
Definition MooseMesh.h:2312
virtual unsigned int nPartitions() const
Definition MooseMesh.h:341
void computeMaxPerElemAndSide()
Compute the maximum numbers per element and side.
Definition MooseMesh.C:1068
virtual dof_id_type nActiveLocalElem() const
Definition MooseMesh.h:338
void update()
Calls buildNodeListFromSideList(), buildNodeList(), and buildBndElemList().
Definition MooseMesh.C:623
std::map< boundary_id_type, std::vector< dof_id_type > > _node_set_nodes
list of nodes that belongs to a specified nodeset: indexing [nodeset_id] -> [array of node ids]
Definition MooseMesh.h:1720
void freeBndNodes()
Definition MooseMesh.C:364
std::set< dof_id_type > getElemIDsOnBlocks(unsigned int elem_id_index, const std::set< SubdomainID > &blks) const
Return all the unique element IDs for an extra element integer with its index on a set of subdomains.
Definition MooseMesh.C:1171
std::vector< FaceInfo > _all_face_info
FaceInfo object storing information for face based loops.
Definition MooseMesh.h:1774
const std::string & getBoundaryName(const BoundaryID boundary_id) const
Return the name of the boundary given the id.
Definition MooseMesh.C:1788
std::unique_ptr< libMesh::MeshBase > _mesh
Pointer to underlying libMesh mesh object.
Definition MooseMesh.h:1596
bool skipRefineWhenUseSplit() const
Whether or not skip uniform refinements when using a pre-split mesh.
Definition MooseMesh.h:593
void determineUseDistributedMesh()
Determine whether to use a distributed mesh.
Definition MooseMesh.C:2890
std::vector< Node * > _node_map
Vector of all the Nodes in the mesh for determining when to add a new point.
Definition MooseMesh.h:1738
std::unique_ptr< libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > > _bnd_elem_range
Definition MooseMesh.h:1668
bool hasDetectedPairedSidesets() const
Whether or not detectedPairedSidesets() has been called.
Definition MooseMesh.h:1000
std::map< SubdomainID, Moose::CoordinateSystemType > & _coord_sys
Type of coordinate system per subdomain.
Definition MooseMesh.h:2032
std::map< std::pair< int, libMesh::ElemType >, std::vector< std::vector< QpMap > > > _elem_type_to_refinement_map
Holds mappings for volume to volume and parent side to child side Map key:
Definition MooseMesh.h:1918
const MeshBase & getMesh(const std::string &name) const
std::unique_ptr< libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > > _bnd_node_range
Definition MooseMesh.h:1666
const MeshBase * getMeshPtr() const
Definition MooseMesh.C:3551
ParallelType _parallel_type
Can be set to DISTRIBUTED, REPLICATED, or DEFAULT.
Definition MooseMesh.h:1586
Moose::CoordinateSystemType getUniqueCoordSystem() const
Get the coordinate system from the mesh, it must be the same in all subdomains otherwise this will er...
Definition MooseMesh.C:4314
std::pair< const Node *, BoundaryID > PeriodicNodeInfo
Helper type for building periodic node maps.
Definition MooseMesh.h:1214
void buildNodeListFromSideList()
Calls BoundaryInfo::build_node_list_from_side_list().
Definition MooseMesh.C:3057
void setMeshBoundaryIDs(std::set< BoundaryID > boundary_IDs)
Sets the set of BoundaryIDs Is called by AddAllSideSetsByNormals.
Definition MooseMesh.C:3304
const std::map< SubdomainID, Moose::CoordinateSystemType > & getCoordSystem() const
Get the map from subdomain ID to coordinate system type, e.g.
Definition MooseMesh.C:4336
virtual bool isDistributedMesh() const
Returns the final Mesh distribution type.
Definition MooseMesh.h:1141
MooseAppCoordTransform & coordTransform()
Definition MooseMesh.h:2062
unsigned int _max_h_level
Maximum h-refinement level of all elements.
Definition MooseMesh.h:2055
virtual unsigned int effectiveSpatialDimension() const
Returns the effective spatial dimension determined by the coordinates actually used by the mesh.
Definition MooseMesh.C:3000
std::vector< std::unique_ptr< libMesh::GhostingFunctor > > _ghosting_functors
Deprecated (DO NOT USE)
Definition MooseMesh.h:1576
bool _skip_refine_when_use_split
Whether or not to skip uniform refinements when using a pre-split mesh.
Definition MooseMesh.h:1628
bool areElemIDsIdentical(const std::string &id_name1, const std::string &id_name2) const
Whether or not two extra element integers are identical.
Definition MooseMesh.h:2339
bool prepared() const
Setter/getter for whether the mesh is prepared.
Definition MooseMesh.C:3246
std::vector< std::unordered_map< SubdomainID, std::set< dof_id_type > > > _block_id_mapping
Unique element integer IDs for each subdomain and each extra element integers.
Definition MooseMesh.h:2002
std::map< std::pair< int, libMesh::ElemType >, std::vector< std::pair< unsigned int, QpMap > > > _elem_type_to_coarsening_map
Holds mappings for volume to volume and parent side to child side Map key:
Definition MooseMesh.h:1944
bool isSplit() const
Definition MooseMesh.h:1482
bool hasElementID(const std::string &id_name) const
Whether mesh has an extra element integer with a given name.
Definition MooseMesh.h:2325
std::unordered_map< std::pair< const Elem *, unsigned short int >, const Elem * > _higher_d_elem_side_to_lower_d_elem
Holds a map from a high-order element side to its corresponding lower-d element.
Definition MooseMesh.h:1973
std::unordered_map< dof_id_type, std::set< dof_id_type > > getElemIDMapping(const std::string &from_id_name, const std::string &to_id_name) const
Definition MooseMesh.C:1132
bool _use_distributed_mesh
False by default.
Definition MooseMesh.h:1591
void addGhostedBoundary(BoundaryID boundary_id)
This will add the boundary ids to be ghosted to this processor.
Definition MooseMesh.C:3338
unsigned int getHigherDSide(const Elem *elem) const
Returns the local side ID of the interior parent aligned with the lower dimensional element.
Definition MooseMesh.C:1704
std::set< SubdomainID > _mesh_subdomains
A set of subdomain IDs currently present in the mesh.
Definition MooseMesh.h:1680
static MooseEnum partitioning()
returns MooseMesh partitioning options so other classes can use it
Definition MooseMesh.C:4027
const std::unordered_map< std::pair< const Elem *, unsigned short int >, const Elem * > & getLowerDElemMap() const
This function attempts to return the map from a high-order element side to its corresponding lower-d ...
Definition MooseMesh.h:2365
virtual dof_id_type maxNodeId() const
Calls max_node/elem_id() on the underlying libMesh mesh object.
Definition MooseMesh.C:3196
void setCoordData(const MooseMesh &other_mesh)
Set the coordinate system data to that of other_mesh.
Definition MooseMesh.C:4451
unsigned int getElementIDIndex(const std::string &id_name) const
Return the accessing integer for an extra element integer with its name.
Definition MooseMesh.h:2331
void checkDuplicateSubdomainNames()
Loop through all subdomain IDs and check if there is name duplication used for the subdomains with sa...
Definition MooseMesh.C:4466
std::map< dof_id_type, std::map< unsigned int, std::map< dof_id_type, Node * > > > _elem_to_side_to_qp_to_quadrature_nodes
Definition MooseMesh.h:1713
bool _regular_orthogonal_mesh
Boolean indicating whether this mesh was detected to be regular and orthogonal.
Definition MooseMesh.h:1741
SemiLocalNodeRange * getActiveSemiLocalNodeRange() const
Definition MooseMesh.C:1265
ConstElemPointerRange * refinedElementRange() const
Return a range that is suitable for threaded execution over elements that were just refined.
Definition MooseMesh.C:940
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition MooseMesh.C:1723
void clearQuadratureNodes()
Clear out any existing quadrature nodes.
Definition MooseMesh.C:1670
void cacheFaceInfoVariableOwnership() const
Cache if variables live on the elements connected by the FaceInfo objects.
Definition MooseMesh.C:4070
virtual Real getMaxInDimension(unsigned int component) const
Definition MooseMesh.C:2194
void buildFiniteVolumeInfo() const
Builds the face and elem info vectors that store meta-data needed for looping over and doing calculat...
Definition MooseMesh.C:3852
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
Definition MooseMesh.C:81
const std::set< BoundaryID > & meshNodesetIds() const
Returns a read-only reference to the set of nodesets currently present in the Mesh.
Definition MooseMesh.C:3298
const std::unordered_map< dof_id_type, std::vector< dof_id_type > > & nodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected.
Definition MooseMesh.C:1239
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition MooseMesh.C:1503
libMesh::ConstNodeRange * getLocalNodeRange()
Definition MooseMesh.C:1274
void setIsCustomPartitionerRequested(bool cpr)
Definition MooseMesh.C:3840
void deleteRemoteElements()
Delete remote elements.
Definition MooseMesh.C:4058
bool getConstructNodeListFromSideList()
Return construct node list from side list boolean.
Definition MooseMesh.h:1557
bool allowRemoteElementRemoval() const
Whether we are allow remote element removal.
Definition MooseMesh.h:1234
elem_info_iterator ownedElemInfoBegin()
Iterators to owned faceInfo objects.
Definition MooseMesh.C:1521
std::vector< BndElement * > _bnd_elems
array of boundary elems
Definition MooseMesh.h:1704
unsigned int maxPLevel() const
Returns the maximum p-refinement level of all elements.
Definition MooseMesh.h:1512
bool needsRemoteElemDeletion() const
Whether we need to delete remote elements.
Definition MooseMesh.h:1224
void ghostGhostedBoundaries()
Actually do the ghosting of boundaries that need to be ghosted to this processor.
Definition MooseMesh.C:3423
bool isPartitionerForced() const
Tell the user if the partitioner was overriden for any reason.
Definition MooseMesh.h:1166
const std::vector< QpMap > & getPCoarseningMap(const Elem &elem) const
Get the map describing for each volumetric quadrature point (qp) on the coarse level which qp on the ...
Definition MooseMesh.C:4519
bool _is_nemesis
True if a Nemesis Mesh was read in.
Definition MooseMesh.h:1637
virtual std::string getFileName() const
Returns the name of the mesh file read to produce this mesh if any or an empty string otherwise.
Definition MooseMesh.h:1211
void updateActiveSemiLocalNodeRange(std::set< dof_id_type > &ghosted_elems)
Clears the "semi-local" node list and rebuilds it.
Definition MooseMesh.C:960
bool getDisplaceNodeListBySideList()
Return displace node list by side list boolean.
Definition MooseMesh.h:1560
virtual bool skipNoncriticalPartitioning() const
Definition MooseMesh.C:4531
void checkCoordinateSystems()
Performs a sanity check for every element in the mesh.
Definition MooseMesh.C:4436
void buildRefinementMap(const Elem &elem, libMesh::QBase &qrule, libMesh::QBase &qrule_face, int parent_side, int child, int child_side)
Build the refinement map for a given element type.
Definition MooseMesh.C:2531
const std::vector< const FaceInfo * > & faceInfo() const
Accessor for local FaceInfo objects.
Definition MooseMesh.h:2347
void buildElemIDInfo()
Build extra data for faster access to the information of extra element integers.
Definition MooseMesh.C:1091
virtual bnd_elem_iterator bndElemsBegin()
Return iterators to the beginning/end of the boundary elements list.
Definition MooseMesh.C:1554
unsigned int getBlocksMaxDimension(const std::vector< SubdomainName > &blocks) const
Returns the maximum element dimension on the given blocks.
Definition MooseMesh.C:3015
bool isFiniteVolumeInfoDirty() const
Definition MooseMesh.h:1459
const Moose::Kokkos::Mesh * getKokkosMesh() const
Definition MooseMesh.h:679
const std::vector< QpMap > & getPCoarseningSideMap(const Elem &elem) const
Get the map describing for each side quadrature point (qp) on the coarse level which qp on the previo...
Definition MooseMesh.C:4525
const MooseEnum & partitionerName() const
Definition MooseMesh.h:1161
virtual Elem * queryElemPtr(const dof_id_type i)
Definition MooseMesh.C:3234
const std::set< unsigned int > & getGhostedBoundaries() const
Return a writable reference to the set of ghosted boundary IDs.
Definition MooseMesh.C:3350
void cacheFVElementalDoFs() const
Cache the DoF indices for FV variables on each element.
Definition MooseMesh.C:4148
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
Proxy function to get a (sub)PointLocator from either the underlying libMesh mesh (default),...
Definition MooseMesh.C:3846
bool _partitioner_overridden
Definition MooseMesh.h:1605
const std::set< BoundaryID > & getBoundaryIDs() const
Returns a const reference to a set of all user-specified boundary IDs.
Definition MooseMesh.C:3051
std::vector< std::vector< Real > > _bounds
The bounds in each dimension of the mesh for regular orthogonal meshes.
Definition MooseMesh.h:1744
void freeBndElems()
Definition MooseMesh.C:383
std::set< SubdomainID > _lower_d_boundary_blocks
Mesh blocks for boundary lower-d elements in different types.
Definition MooseMesh.h:1970
virtual SubdomainID nSubdomains() const
Definition MooseMesh.h:340
const ElemInfo & elemInfo(const dof_id_type id) const
Accessor for the elemInfo object for a given element ID.
Definition MooseMesh.C:4000
void setBoundaryToNormalMap(std::unique_ptr< std::map< BoundaryID, RealVectorValue > > boundary_map)
Sets the mapping between BoundaryID and normal vector Is called by AddAllSideSetsByNormals.
Definition MooseMesh.C:3310
bool isCustomPartitionerRequested() const
Setter and getter for _custom_partitioner_requested.
Definition MooseMesh.C:3818
const std::vector< QpMap > & getPRefinementSideMap(const Elem &elem) const
Get the map describing for each side quadrature point (qp) on the refined level which qp on the previ...
Definition MooseMesh.C:4513
void computeFiniteVolumeCoords() const
Compute the face coordinate value for all FaceInfo and ElemInfo objects.
Definition MooseMesh.C:4006
bool _moose_mesh_prepared
True if prepare has been called on the mesh.
Definition MooseMesh.h:1640
const std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > & getBoundariesToActiveSemiLocalElemIds() const
Returns a map of boundaries to ids of elements on the boundary.
Definition MooseMesh.C:1322
bool _doing_p_refinement
Whether we have p-refinement (whether exclusively p- or hp-refinement)
Definition MooseMesh.h:2051
Moose::Kokkos::Mesh * getKokkosMesh()
Accessor for Kokkos mesh object.
Definition MooseMesh.h:678
unsigned int nFace() const
accessors for the FaceInfo objects
Definition MooseMesh.h:1302
bool _skip_deletion_repartition_after_refine
Whether or not skip remote deletion and repartition after uniform refinements.
Definition MooseMesh.h:1631
void buildNodeList()
Calls BoundaryInfo::build_node_list()/build_side_list() and makes separate copies of Nodes/Elems in t...
Definition MooseMesh.C:1034
virtual dof_id_type nNodes() const
Calls n_nodes/elem() on the underlying libMesh mesh object.
Definition MooseMesh.C:3184
std::vector< Node * > _extreme_nodes
A vector containing the nodes at the corners of a regular orthogonal mesh.
Definition MooseMesh.h:1806
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition MooseMesh.C:1684
std::unique_ptr< libMesh::Partitioner > _custom_partitioner
The custom partitioner.
Definition MooseMesh.h:1608
std::optional< std::vector< std::pair< BoundaryID, BoundaryID > > > _paired_boundary
A vector holding the paired boundaries for a regular orthogonal mesh.
Definition MooseMesh.h:1747
unsigned int getGhostingPatchSize() const
Getter for the ghosting_patch_size parameter.
Definition MooseMesh.h:634
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
Return a writable reference to a vector of node IDs that belong to nodeset_id.
Definition MooseMesh.C:3579
std::set< SubdomainID > getBoundaryConnectedSecondaryBlocks(const BoundaryID bid) const
Get the list of subdomains associated with the given boundary of its secondary side.
Definition MooseMesh.C:3641
unsigned int getMaxNodesPerSide() const
Get the maximum number of nodes per side.
Definition MooseMesh.h:1296
std::unordered_map< std::pair< const Elem *, unsigned int >, FaceInfo * > _elem_side_to_face_info
Map from elem-side pair to FaceInfo.
Definition MooseMesh.h:1782
bool isRegularOrthogonal()
Getter to query if the mesh was detected to be regular and orthogonal.
Definition MooseMesh.h:1196
const std::vector< QpMap > & getPRefinementMapHelper(const Elem &elem, const std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > &) const
Definition MooseMesh.C:4486
const std::map< boundary_id_type, std::vector< dof_id_type > > & nodeSetNodes() const
Definition MooseMesh.h:2359
unsigned int _max_nodes_per_elem
The maximum number of nodes per element.
Definition MooseMesh.h:2014
static MooseEnum elemTypes()
returns MooseMesh element type options
Definition MooseMesh.C:4035
std::set< BoundaryID > _mesh_nodeset_ids
Definition MooseMesh.h:1690
void setGeneralAxisymmetricCoordAxes(const std::vector< SubdomainName > &blocks, const std::vector< std::pair< Point, RealVectorValue > > &axes)
Sets the general coordinate axes for axisymmetric blocks.
Definition MooseMesh.C:4350
unsigned int getPatchSize() const
Getter for the patch_size parameter.
Definition MooseMesh.C:3510
void cacheInfo()
Definition MooseMesh.C:1404
void addPeriodicVariable(const unsigned int sys_num, const unsigned int var_num, const BoundaryID primary, const BoundaryID secondary)
For "regular orthogonal" meshes, determine if variable var_num is periodic with respect to the primar...
Definition MooseMesh.C:2203
std::vector< BndElement * >::iterator bnd_elem_iterator_imp
Definition MooseMesh.h:1705
void cacheChangedLists()
Cache information about what elements were refined and coarsened in the previous step.
Definition MooseMesh.C:922
bool isTranslatedPeriodic(const unsigned int sys_num, const unsigned int var_num, const unsigned int component) const
Returns whether this generated mesh is periodic in the given dimension for the given variable on the ...
Definition MooseMesh.C:2256
const std::pair< Point, RealVectorValue > & getGeneralAxisymmetricCoordAxis(SubdomainID subdomain_id) const
Gets the general axisymmetric coordinate axis for a block.
Definition MooseMesh.C:4398
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_refinement_side_map
Definition MooseMesh.h:1923
bool _allow_remote_element_removal
Whether to allow removal of remote elements.
Definition MooseMesh.h:1990
bool _construct_node_list_from_side_list
Whether or not to allow generation of nodesets from sidesets.
Definition MooseMesh.h:1980
std::set< BoundaryID > getSubdomainInterfaceBoundaryIds(const SubdomainID subdomain_id) const
Get the list of boundaries that contact the given subdomain.
Definition MooseMesh.C:3617
std::unique_ptr< T > buildTypedMesh(unsigned int dim=libMesh::invalid_uint)
Shortcut method to construct a unique pointer to a libMesh mesh instance.
Definition MooseMesh.h:2264
const Node * addUniqueNode(const Point &p, Real tol=1e-6)
Add a new node to the mesh.
Definition MooseMesh.C:1569
void setParallelType(ParallelType parallel_type)
Allow to change parallel type.
Definition MooseMesh.h:2318
const std::set< BoundaryID > & meshBoundaryIds() const
Returns a read-only reference to the set of boundary IDs currently present in the Mesh.
Definition MooseMesh.C:3286
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition MooseMesh.h:1550
std::vector< BndNode * > _bnd_nodes
array of boundary nodes
Definition MooseMesh.h:1697
std::unordered_map< dof_id_type, std::vector< dof_id_type > > _node_to_elem_map
A map of all of the current nodes to the elements that they are connected to.
Definition MooseMesh.h:1671
const std::vector< const ElemInfo * > & elemInfoVector() const
Accessor for the element info objects owned by this process.
Definition MooseMesh.h:1336
void buildPeriodicNodeSets(std::map< BoundaryID, std::set< dof_id_type > > &periodic_node_sets, unsigned int var_number, libMesh::PeriodicBoundaries *pbs) const
This routine builds a datastructure of node ids organized by periodic boundary ids.
Definition MooseMesh.C:1901
std::unique_ptr< MooseAppCoordTransform > _coord_transform
A coordinate transformation object that describes how to transform this problem's coordinate system i...
Definition MooseMesh.h:2042
std::vector< BndNode * >::const_iterator const_bnd_node_iterator_imp
Definition MooseMesh.h:1699
const std::set< SubdomainID > & getNodeBlockIds(const Node &node) const
Return list of blocks to which the given node belongs.
Definition MooseMesh.C:1492
std::map< libMesh::ElemType, std::map< std::pair< int, int >, std::vector< std::vector< QpMap > > > > _elem_type_to_child_side_refinement_map
Holds mappings for "internal" child sides to parent volume. The second key is (child,...
Definition MooseMesh.h:1927
void buildPeriodicNodeMap(std::multimap< dof_id_type, dof_id_type > &periodic_node_map, unsigned int var_number, libMesh::PeriodicBoundaries *pbs) const
This routine builds a multimap of boundary ids to matching boundary ids across all periodic boundarie...
Definition MooseMesh.C:1816
const RealVectorValue & getNormalByBoundaryID(BoundaryID id) const
Returns the normal vector associated with a given BoundaryID.
Definition MooseMesh.C:2874
std::unordered_map< SubdomainID, SubdomainData > _sub_to_data
Holds a map from subdomain ids to associated data.
Definition MooseMesh.h:1962
const MooseUnits & lengthUnit() const
Definition MooseMesh.C:4459
std::unique_ptr< std::map< BoundaryID, RealVectorValue > > _boundary_to_normal_map
The boundary to normal map - valid only when AddAllSideSetsByNormals is active.
Definition MooseMesh.h:1694
std::unique_ptr< libMesh::NodeRange > _active_node_range
Definition MooseMesh.h:1663
std::set< SubdomainID > _lower_d_interior_blocks
Mesh blocks for interior lower-d elements in different types.
Definition MooseMesh.h:1968
void setPatchUpdateStrategy(Moose::PatchUpdateType patch_update_strategy)
Set the patch size update strategy.
Definition MooseMesh.C:3516
std::vector< SubdomainID > getSubdomainIDs(const std::vector< SubdomainName > &subdomain_names) const
Get the associated subdomainIDs for the subdomain names that are passed in.
Definition MooseMesh.C:1729
const std::vector< FaceInfo > & allFaceInfo() const
Accessor for all FaceInfo objects.
Definition MooseMesh.h:2353
void setPartitionerHelper(MeshBase *mesh=nullptr)
Definition MooseMesh.C:3737
const std::pair< BoundaryID, BoundaryID > * getPairedBoundaryMapping(unsigned int component) const
This function attempts to return the paired boundary ids for the given component.
Definition MooseMesh.C:2351
const std::set< BoundaryID > & meshSidesetIds() const
Returns a read-only reference to the set of sidesets currently present in the Mesh.
Definition MooseMesh.C:3292
std::map< boundary_id_type, std::set< dof_id_type > > _bnd_node_ids
Map of sets of node IDs in each boundary.
Definition MooseMesh.h:1701
unsigned int _rz_coord_axis
Storage for RZ axis selection.
Definition MooseMesh.h:2035
ConstElemPointerRange * coarsenedElementRange() const
Return a range that is suitable for threaded execution over elements that were just coarsened.
Definition MooseMesh.C:946
std::unordered_map< SubdomainID, std::set< BoundaryID > > _neighbor_subdomain_boundary_ids
Holds a map from neighbor subomdain ids to the boundary ids that are attached to it.
Definition MooseMesh.h:1965
std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > _bnd_elem_ids
Map of set of elem IDs connected to each boundary.
Definition MooseMesh.h:1709
unsigned int _uniform_refine_level
The level of uniform refinement requested (set to zero if AMR is disabled)
Definition MooseMesh.h:1625
const std::string & getSubdomainName(SubdomainID subdomain_id) const
Return the name of a block given an id.
Definition MooseMesh.C:1759
void buildCoarseningMap(const Elem &elem, libMesh::QBase &qrule, libMesh::QBase &qrule_face, int input_side)
Build the coarsening map for a given element type.
Definition MooseMesh.C:2610
bool hasSecondOrderElements()
check if the mesh has SECOND order elements
Definition MooseMesh.C:3824
std::unordered_map< const Elem *, unsigned short int > _lower_d_elem_to_higher_d_elem_side
Definition MooseMesh.h:1974
bool _distribution_overridden
Definition MooseMesh.h:1592
bool _finite_volume_info_dirty
Definition MooseMesh.h:1785
std::unordered_set< dof_id_type > getBoundaryActiveNeighborElemIds(BoundaryID bid) const
Return all ids of neighbors of elements which have a side which is part of a sideset.
Definition MooseMesh.C:1339
bool allowRecovery() const
Returns whether this mesh is allowed to read a recovery file.
Definition MooseMesh.h:1573
virtual const Node * nodePtr(const dof_id_type i) const
Definition MooseMesh.C:858
virtual dof_id_type nLocalNodes() const
Definition MooseMesh.h:336
std::map< dof_id_type, Node * > _quadrature_nodes
Definition MooseMesh.h:1711
const std::unordered_map< boundary_id_type, std::unordered_set< dof_id_type > > & getBoundariesToElems() const
Returns a map of boundaries to ids of elements on the boundary.
Definition MooseMesh.C:1314
void needsRemoteElemDeletion(bool need_delete)
Set whether we need to delete remote elements.
Definition MooseMesh.h:1219
const std::vector< QpMap > & getPCoarseningMapHelper(const Elem &elem, const std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > &) const
Definition MooseMesh.C:4497
virtual dof_id_type nActiveElem() const
Definition MooseMesh.h:337
libMesh::NodeRange * getActiveNodeRange()
Definition MooseMesh.C:1251
std::vector< SubdomainName > _provided_coord_blocks
Set for holding user-provided coordinate system type block names.
Definition MooseMesh.h:2048
unsigned int _patch_size
The number of nodes to consider in the NearestNode neighborhood.
Definition MooseMesh.h:1726
void setCustomPartitioner(libMesh::Partitioner *partitioner)
Setter for custom partitioner.
Definition MooseMesh.C:3808
libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition MooseMesh.C:1288
void setMeshBase(std::unique_ptr< MeshBase > mesh_base)
Method to set the mesh_base object.
Definition MooseMesh.C:2930
std::unique_ptr< libMesh::ConstNodeRange > _local_node_range
Definition MooseMesh.h:1664
void setSubdomainName(SubdomainID subdomain_id, const SubdomainName &name, const bool synchronous=false)
This method sets the name for subdomain_id to name.
Definition MooseMesh.C:1741
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition MooseMesh.C:3280
virtual bnd_elem_iterator bndElemsEnd()
Definition MooseMesh.C:1562
MeshBase::node_iterator localNodesBegin()
Calls local_nodes_begin/end() on the underlying libMesh mesh object.
Definition MooseMesh.C:3136
const std::vector< std::vector< QpMap > > & getRefinementMap(const Elem &elem, int parent_side, int child, int child_side)
Get the refinement map for a given element type.
Definition MooseMesh.C:2574
void setCoordSystem(const std::vector< SubdomainName > &blocks, const MultiMooseEnum &coord_sys)
Set the coordinate system for the provided blocks to coord_sys.
Definition MooseMesh.C:4210
Node * addQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp, BoundaryID bid, const Point &point)
Adds a fictitious "QuadratureNode".
Definition MooseMesh.C:1603
void buildLowerDMesh()
Build lower-d mesh for all sides.
Definition MooseMesh.C:666
bool doingPRefinement() const
Query whether the kind of adaptivity we're doing includes p-refinement.
Definition MooseMesh.h:1507
virtual const Node * queryNodePtr(const dof_id_type i) const
Definition MooseMesh.C:870
std::map< std::pair< unsigned int, unsigned int >, std::array< bool, 3 > > _periodic_dim
A map from (system number, vector number) to which dimensions are periodic in a regular orthogonal me...
Definition MooseMesh.h:1798
dof_id_type maxElementID(unsigned int elem_id_index) const
Return the maximum element ID for an extra element integer with its accessing index.
Definition MooseMesh.h:1259
std::vector< dof_id_type > _max_ids
Maximum integer ID for each extra element integer.
Definition MooseMesh.h:2004
std::unique_ptr< Moose::Kokkos::Mesh > _kokkos_mesh
Pointer to Kokkos mesh object.
Definition MooseMesh.h:1600
void findAdaptivityQpMaps(const Elem *template_elem, libMesh::QBase &qrule, libMesh::QBase &qrule_face, std::vector< std::vector< QpMap > > &refinement_map, std::vector< std::pair< unsigned int, QpMap > > &coarsen_map, int parent_side, int child, int child_side)
Given an elem type, get maps that tell us what qp's are closest to each other between a parent and it...
Definition MooseMesh.C:2680
unsigned int _max_nodes_per_side
The maximum number of nodes per side.
Definition MooseMesh.h:2017
bool _node_to_elem_map_built
Whether _node_to_elem_map has been built.
Definition MooseMesh.h:1674
const MeshBase::element_iterator activeLocalElementsEnd()
Definition MooseMesh.C:3166
std::set< BoundaryID > _mesh_sideset_ids
Definition MooseMesh.h:1689
std::vector< Real > _ghosted_boundaries_inflation
Definition MooseMesh.h:1723
void setGhostedBoundaryInflation(const std::vector< Real > &inflation)
This sets the inflation amount for the bounding box for each partition for use in ghosting boundaries...
Definition MooseMesh.C:3344
std::string getBoundaryString(const BoundaryID boundary_id) const
Return the name of the boundary given the id, if it exists.
Definition MooseMesh.C:1800
std::set< SubdomainID > getBoundaryConnectedBlocks(const BoundaryID bid) const
Get the list of subdomains associated with the given boundary.
Definition MooseMesh.C:3630
const std::array< bool, 3 > & queryPeriodicDimensions(const unsigned int sys_num, const unsigned int var_num) const
Query the translated periodic dimension flags for the given variable on the given system.
Definition MooseMesh.C:2241
const bool _is_split
Whether or not we are using a (pre-)split mesh (automatically DistributedMesh)
Definition MooseMesh.h:1750
std::unique_ptr< SemiLocalNodeRange > _active_semilocal_node_range
Ranges for use with threading, cached so they don't have to get rebuilt all the time (which takes tim...
Definition MooseMesh.h:1662
void doingPRefinement(bool doing_p_refinement)
Indicate whether the kind of adaptivity we're doing includes p-refinement.
Definition MooseMesh.h:1502
void setUniformRefineLevel(unsigned int, bool deletion=true)
Set uniform refinement level.
Definition MooseMesh.C:3331
Moose::PatchUpdateType _patch_update_strategy
The patch update strategy.
Definition MooseMesh.h:1735
virtual Real getMinInDimension(unsigned int component) const
Returns the min or max of the requested dimension respectively.
Definition MooseMesh.C:2185
bool isBoundaryFullyExternalToSubdomains(BoundaryID bid, const std::set< SubdomainID > &blk_group) const
Returns whether a boundary (given by its id) is not crossing through a group of blocks,...
Definition MooseMesh.C:1370
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition MooseMesh.C:3726
void setAxisymmetricCoordAxis(const MooseEnum &rz_coord_axis)
For axisymmetric simulations, set the symmetry coordinate axis.
Definition MooseMesh.C:4342
void needsPrepareForUse()
If this method is called, we will call libMesh's prepare_for_use method when we call Moose's prepare ...
Definition MooseMesh.C:3274
const libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems,...
Definition MooseMesh.C:1245
unsigned int maxHLevel() const
Returns the maximum h-refinement level of all elements.
Definition MooseMesh.h:1517
unsigned int getMaxNodesPerElem() const
Get the maximum number of nodes per element.
Definition MooseMesh.h:1291
MooseMesh & operator=(const MooseMesh &other_mesh)=delete
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_refinement_map
Definition MooseMesh.h:1921
bool hasLowerD() const
Definition MooseMesh.h:1545
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
Method to construct a libMesh::MeshBase object that is normally set and used by the MooseMesh object ...
Definition MooseMesh.C:2918
bool _built_from_other_mesh
Whether or not this mesh was built from another mesh.
Definition MooseMesh.h:1582
virtual dof_id_type nElem() const
Definition MooseMesh.C:3190
const std::set< SubdomainID > & getBlockConnectedBlocks(const SubdomainID subdomain_id) const
Get the list of subdomains neighboring a given subdomain.
Definition MooseMesh.C:3663
std::set< Elem * > _ghost_elems_from_ghost_boundaries
Set of elements ghosted by ghostGhostedBoundaries.
Definition MooseMesh.h:1993
std::vector< const ElemInfo * > _elem_info
Holds only those ElemInfo objects that have processor_id equal to this process's id,...
Definition MooseMesh.h:1770
void prepare(const MeshBase *mesh_to_clone)
Deprecated method; mesh_to_clone is no longer supported and must be null.
void isDisplaced(bool is_displaced)
Set whether this mesh is a displaced mesh.
Definition MooseMesh.h:1363
bool hasMeshBase() const
Whether mesh base object was constructed or not.
Definition MooseMesh.h:1244
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition MooseMesh.h:1554
bool usingGeneralAxisymmetricCoordAxes() const
Returns true if general axisymmetric coordinate axes are being used.
Definition MooseMesh.C:4408
std::set< dof_id_type > getAllElemIDs(unsigned int elem_id_index) const
Return all the unique element IDs for an extra element integer with its index.
Definition MooseMesh.C:1161
std::vector< BndNode > _extra_bnd_nodes
Definition MooseMesh.h:1714
void buildHRefinementAndCoarseningMaps(Assembly *assembly)
Definition MooseMesh.C:2370
std::set< unsigned int > _ghosted_boundaries
Definition MooseMesh.h:1722
std::vector< dof_id_type > _min_ids
Minimum integer ID for each extra element integer.
Definition MooseMesh.h:2006
virtual std::unique_ptr< MooseMesh > safeClone() const =0
A safer version of the clone() method that hands back an allocated object wrapped in a smart pointer.
libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > * getBoundaryElementRange()
Definition MooseMesh.C:1301
bool isBoundaryNode(dof_id_type node_id) const
Returns true if the requested node is in the list of boundary nodes, false otherwise.
Definition MooseMesh.C:3674
RealVectorValue _half_range
A convenience vector used to hold values in each dimension representing half of the range.
Definition MooseMesh.h:1803
MeshBase::element_iterator activeLocalElementsBegin()
Calls active_local_nodes_begin/end() on the underlying libMesh mesh object.
Definition MooseMesh.C:3160
std::map< dof_id_type, std::set< SubdomainID > > _block_node_list
list of nodes that belongs to a specified block (domain)
Definition MooseMesh.h:1717
unsigned int _max_sides_per_elem
The maximum number of sides per element.
Definition MooseMesh.h:2011
bool isSemiLocal(Node *const node) const
Returns true if the node is semi-local.
Definition MooseMesh.C:1001
void buildPRefinementAndCoarseningMaps(Assembly *assembly)
Definition MooseMesh.C:2427
static void setPartitioner(MeshBase &mesh_base, MooseEnum &partitioner, bool use_distributed_mesh, const InputParameters &params, MooseObject &context_obj)
Method for setting the partitioner on the passed in mesh_base object.
Definition MooseMesh.C:3749
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > buildActiveSideList() const
Calls BoundaryInfo::build_active_side_list.
Definition MooseMesh.C:3124
bool detectOrthogonalDimRanges(Real tol=1e-6)
This routine determines whether the Mesh is a regular orthogonal mesh (i.e.
Definition MooseMesh.C:1928
std::unordered_map< dof_id_type, std::vector< dof_id_type > > & internalNodeToElemMap()
If not already created, creates a map from every node to all elements to which they are connected.
Definition MooseMesh.C:1210
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
Physical unit management class with runtime unit string parsing, unit checking, unit conversion,...
Definition Units.h:33
Base variable class.
The Kokkos mesh object.
Definition KokkosMesh.h:53
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
Interface for objects interacting with the PerfGraph.
Helper object for holding qp mapping info.
Definition MooseMesh.h:76
unsigned int _from
The qp to map from.
Definition MooseMesh.h:81
unsigned int _to
The qp to map to.
Definition MooseMesh.h:84
QpMap()
Definition MooseMesh.h:78
Real _distance
The distance between them.
Definition MooseMesh.h:87
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
A class for creating restricted objects.
Definition Restartable.h:29
const Parallel::Communicator & _communicator
MeshBase & mesh
PatchUpdateType
Type of patch update strategy for modeling node-face constraints or contact.
CoordinateSystemType
Definition MooseTypes.h:864
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const unsigned int invalid_uint
OStreamProxy out(std::cout)
std::set< BoundaryID > boundary_ids
The boundary ids that are attached.
Definition MooseMesh.h:1958
std::set< SubdomainID > neighbor_subs
Neighboring subdomain ids.
Definition MooseMesh.h:1954
The definition of the bnd_elem_iterator struct.
Definition MooseMesh.h:2215
bnd_elem_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2218
The definition of the bnd_node_iterator struct.
Definition MooseMesh.h:2172
bnd_node_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2175
The definition of the const_bnd_elem_iterator struct.
Definition MooseMesh.h:2232
const_bnd_elem_iterator(const bnd_elem_iterator &rhs)
Definition MooseMesh.h:2245
const_bnd_elem_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2235
The definition of the const_bnd_node_iterator struct.
Definition MooseMesh.h:2189
const_bnd_node_iterator(const MooseMesh::bnd_node_iterator &rhs)
Definition MooseMesh.h:2202
const_bnd_node_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2192
The definition of the const_elem_info_iterator struct.
Definition MooseMesh.h:2146
const_elem_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2149
const_elem_info_iterator(const MooseMesh::elem_info_iterator &rhs)
Definition MooseMesh.h:2159
The definition of the const_face_info_iterator struct.
Definition MooseMesh.h:2102
const_face_info_iterator(const MooseMesh::face_info_iterator &rhs)
Definition MooseMesh.h:2115
const_face_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2105
The definition of the elem_info_iterator struct.
Definition MooseMesh.h:2129
elem_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2132
The definition of the face_info_iterator struct.
Definition MooseMesh.h:2085
face_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2088