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
567 bool prepare(const MeshBase * mesh_to_clone);
568
572 void update();
573
577 unsigned int uniformRefineLevel() const;
578
582 void setUniformRefineLevel(unsigned int, bool deletion = true);
583
595
600
604 void addGhostedBoundary(BoundaryID boundary_id);
605
610 void setGhostedBoundaryInflation(const std::vector<Real> & inflation);
611
615 const std::set<unsigned int> & getGhostedBoundaries() const;
616
620 const std::vector<Real> & getGhostedBoundaryInflation() const;
621
626
630 void needGhostGhostedBoundaries(bool needghost) { _need_ghost_ghosted_boundaries = needghost; }
631
635 unsigned int getPatchSize() const;
636
640 unsigned int getGhostingPatchSize() const { return _ghosting_patch_size; }
641
645 unsigned int getMaxLeafSize() const { return _max_leaf_size; }
646
650 void setPatchUpdateStrategy(Moose::PatchUpdateType patch_update_strategy);
651
656
663 libMesh::BoundingBox getInflatedProcessorBoundingBox(Real inflation_multiplier = 0.01) const;
664
668 operator libMesh::MeshBase &();
669 operator const libMesh::MeshBase &() const;
670
674 MeshBase & getMesh();
675 MeshBase & getMesh(const std::string & name);
676 const MeshBase & getMesh() const;
677 const MeshBase & getMesh(const std::string & name) const;
678 const MeshBase * getMeshPtr() const;
679
683#ifdef MOOSE_KOKKOS_ENABLED
685 const Moose::Kokkos::Mesh * getKokkosMesh() const { return _kokkos_mesh.get(); }
686#endif
687
691 void printInfo(std::ostream & os = libMesh::out, const unsigned int verbosity = 0) const;
692
696 const std::set<SubdomainID> & getNodeBlockIds(const Node & node) const;
697
702 const std::vector<dof_id_type> & getNodeList(boundary_id_type nodeset_id) const;
703
709 const Node * addUniqueNode(const Point & p, Real tol = 1e-6);
710
724 Node * addQuadratureNode(const Elem * elem,
725 const unsigned short int side,
726 const unsigned int qp,
727 BoundaryID bid,
728 const Point & point);
729
737 Node * getQuadratureNode(const Elem * elem, const unsigned short int side, const unsigned int qp);
738
744
751 BoundaryID getBoundaryID(const BoundaryName & boundary_name) const;
752
759 std::vector<BoundaryID> getBoundaryIDs(const std::vector<BoundaryName> & boundary_name,
760 bool generate_unknown = false) const;
761
768 SubdomainID getSubdomainID(const SubdomainName & subdomain_name) const;
769
776 std::vector<SubdomainID>
777 getSubdomainIDs(const std::vector<SubdomainName> & subdomain_names) const;
778 std::set<SubdomainID> getSubdomainIDs(const std::set<SubdomainName> & subdomain_names) const;
779
783 void setSubdomainName(SubdomainID subdomain_id, const SubdomainName & name);
784
788 static void
789 setSubdomainName(MeshBase & mesh, SubdomainID subdomain_id, const SubdomainName & name);
790
794 const std::string & getSubdomainName(SubdomainID subdomain_id) const;
795
802 std::vector<SubdomainName>
803 getSubdomainNames(const std::vector<SubdomainID> & subdomain_ids) const;
804
808 void setBoundaryName(BoundaryID boundary_id, BoundaryName name);
809
813 const std::string & getBoundaryName(const BoundaryID boundary_id) const;
814
819 std::string getBoundaryString(const BoundaryID boundary_id) const;
820
826 void buildPeriodicNodeMap(std::multimap<dof_id_type, dof_id_type> & periodic_node_map,
827 unsigned int var_number,
828 libMesh::PeriodicBoundaries * pbs) const;
829
833 void buildPeriodicNodeSets(std::map<BoundaryID, std::set<dof_id_type>> & periodic_node_sets,
834 unsigned int var_number,
835 libMesh::PeriodicBoundaries * pbs) const;
836
840 Real dimensionWidth(unsigned int component) const;
841
843
846 virtual Real getMinInDimension(unsigned int component) const;
847 virtual Real getMaxInDimension(unsigned int component) const;
849
860 bool detectOrthogonalDimRanges(Real tol = 1e-6);
861
866 void addPeriodicVariable(const unsigned int sys_num,
867 const unsigned int var_num,
868 const BoundaryID primary,
869 const BoundaryID secondary);
870
880 const std::array<bool, 3> & queryPeriodicDimensions(const unsigned int sys_num,
881 const unsigned int var_num) const;
890 const std::array<bool, 3> & queryPeriodicDimensions(const MooseVariableBase & var) const;
891
899 bool isTranslatedPeriodic(const unsigned int sys_num,
900 const unsigned int var_num,
901 const unsigned int component) const;
902
908 bool isTranslatedPeriodic(const MooseVariableBase & var, const unsigned int component) const;
909
919 bool isTranslatedPeriodic(const unsigned int var_num, const unsigned int component) const;
920
929 RealVectorValue
930 minPeriodicVector(const unsigned int sys_num, const unsigned int var_num, Point p, Point q) const;
931
939 RealVectorValue
940 minPeriodicVector(const MooseVariableBase & var, const Point & p, const Point & q) const;
941
953 RealVectorValue
954 minPeriodicVector(const unsigned int var_num, const Point & p, const Point & q) const;
955
964 Real minPeriodicDistance(const unsigned int sys_num,
965 const unsigned int var_num,
966 const Point & p,
967 const Point & q) const;
968
976 Real minPeriodicDistance(const MooseVariableBase & var, const Point & p, const Point & q) const;
977
989 Real minPeriodicDistance(const unsigned int var_num, const Point & p, const Point & q) const;
990
998
1002 bool hasDetectedPairedSidesets() const { return _paired_boundary.has_value(); }
1003
1013 const std::pair<BoundaryID, BoundaryID> * getPairedBoundaryMapping(unsigned int component) const;
1014
1022
1032 const std::vector<std::vector<QpMap>> &
1033 getRefinementMap(const Elem & elem, int parent_side, int child, int child_side);
1034
1042 const std::vector<std::pair<unsigned int, QpMap>> & getCoarseningMap(const Elem & elem,
1043 int input_side);
1044
1049 void
1050 changeBoundaryId(const boundary_id_type old_id, const boundary_id_type new_id, bool delete_prev);
1051
1056 static void changeBoundaryId(MeshBase & mesh,
1057 const boundary_id_type old_id,
1058 const boundary_id_type new_id,
1059 bool delete_prev);
1060
1067 const std::set<BoundaryID> & getSubdomainBoundaryIds(const SubdomainID subdomain_id) const;
1068
1075 std::set<BoundaryID> getSubdomainInterfaceBoundaryIds(const SubdomainID subdomain_id) const;
1076
1083 std::set<SubdomainID> getBoundaryConnectedBlocks(const BoundaryID bid) const;
1084
1091 std::set<SubdomainID> getBoundaryConnectedSecondaryBlocks(const BoundaryID bid) const;
1092
1099 std::set<SubdomainID> getInterfaceConnectedBlocks(const BoundaryID bid) const;
1100
1107 const std::set<SubdomainID> & getBlockConnectedBlocks(const SubdomainID subdomain_id) const;
1108
1112 bool isBoundaryNode(dof_id_type node_id) const;
1113
1118 bool isBoundaryNode(dof_id_type node_id, BoundaryID bnd_id) const;
1119
1123 bool isBoundaryElem(dof_id_type elem_id) const;
1124
1129 bool isBoundaryElem(dof_id_type elem_id, BoundaryID bnd_id) const;
1130
1138 void errorIfDistributedMesh(std::string name) const;
1139
1143 virtual bool isDistributedMesh() const { return _use_distributed_mesh; }
1144
1149
1153 void setParallelType(ParallelType parallel_type);
1154
1159
1160 /*
1161 * Set/Get the partitioner name
1162 */
1163 const MooseEnum & partitionerName() const { return _partitioner_name; }
1164
1169
1173 void allowRecovery(bool allow) { _allow_recovery = allow; }
1174
1178 static void setPartitioner(MeshBase & mesh_base,
1179 MooseEnum & partitioner,
1180 bool use_distributed_mesh,
1181 const InputParameters & params,
1182 MooseObject & context_obj);
1183
1187 void setCustomPartitioner(libMesh::Partitioner * partitioner);
1188
1190
1193 bool isCustomPartitionerRequested() const;
1194 void setIsCustomPartitionerRequested(bool cpr);
1196
1199
1202
1207 virtual std::unique_ptr<libMesh::PointLocatorBase> getPointLocator() const;
1208
1213 virtual std::string getFileName() const { return ""; }
1214
1216 using PeriodicNodeInfo = std::pair<const Node *, BoundaryID>;
1217
1221 void needsRemoteElemDeletion(bool need_delete) { _need_delete = need_delete; }
1222
1226 bool needsRemoteElemDeletion() const { return _need_delete; }
1227
1231 void allowRemoteElementRemoval(bool allow_removal);
1232
1237
1241 void deleteRemoteElements();
1242
1246 bool hasMeshBase() const { return _mesh.get() != nullptr; }
1247
1251 bool hasElementID(const std::string & id_name) const;
1252
1256 unsigned int getElementIDIndex(const std::string & id_name) const;
1257
1261 dof_id_type maxElementID(unsigned int elem_id_index) const { return _max_ids[elem_id_index]; }
1262
1266 dof_id_type minElementID(unsigned int elem_id_index) const { return _min_ids[elem_id_index]; }
1267
1271 bool areElemIDsIdentical(const std::string & id_name1, const std::string & id_name2) const;
1272
1276 std::set<dof_id_type> getAllElemIDs(unsigned int elem_id_index) const;
1277
1282 std::set<dof_id_type> getElemIDsOnBlocks(unsigned int elem_id_index,
1283 const std::set<SubdomainID> & blks) const;
1284
1288 unsigned int getMaxSidesPerElem() const { return _max_sides_per_elem; }
1289
1293 unsigned int getMaxNodesPerElem() const { return _max_nodes_per_elem; }
1294
1298 unsigned int getMaxNodesPerSide() const { return _max_nodes_per_side; }
1299
1300 std::unordered_map<dof_id_type, std::set<dof_id_type>>
1301 getElemIDMapping(const std::string & from_id_name, const std::string & to_id_name) const;
1302
1304 unsigned int nFace() const { return _face_info.size(); }
1305
1307 const std::vector<const FaceInfo *> & faceInfo() const;
1308
1310 struct face_info_iterator;
1311 struct const_face_info_iterator;
1312
1317 face_info_iterator ownedFaceInfoBegin();
1318 face_info_iterator ownedFaceInfoEnd();
1319
1321 struct elem_info_iterator;
1322 struct const_elem_info_iterator;
1323
1328 elem_info_iterator ownedElemInfoBegin();
1329 elem_info_iterator ownedElemInfoEnd();
1330
1332 const FaceInfo * faceInfo(const Elem * elem, unsigned int side) const;
1333
1335 const ElemInfo & elemInfo(const dof_id_type id) const;
1336
1338 const std::vector<const ElemInfo *> & elemInfoVector() const { return _elem_info; }
1339
1341 const std::vector<FaceInfo> & allFaceInfo() const;
1343
1347 void cacheFaceInfoVariableOwnership() const;
1348
1353 void cacheFVElementalDoFs() const;
1354
1360 void computeFiniteVolumeCoords() const;
1361
1365 void isDisplaced(bool is_displaced) { _is_displaced = is_displaced; }
1366
1370 bool isDisplaced() const { return _is_displaced; }
1371
1375 const std::map<boundary_id_type, std::vector<dof_id_type>> & nodeSetNodes() const;
1376
1382
1388
1392 const std::map<SubdomainID, Moose::CoordinateSystemType> & getCoordSystem() const;
1393
1397 void setCoordSystem(const std::vector<SubdomainName> & blocks, const MultiMooseEnum & coord_sys);
1398
1403 void setAxisymmetricCoordAxis(const MooseEnum & rz_coord_axis);
1404
1419 void setGeneralAxisymmetricCoordAxes(const std::vector<SubdomainName> & blocks,
1420 const std::vector<std::pair<Point, RealVectorValue>> & axes);
1421
1427 const std::pair<Point, RealVectorValue> &
1428 getGeneralAxisymmetricCoordAxis(SubdomainID subdomain_id) const;
1429
1434
1439 unsigned int getAxisymmetricRadialCoord() const;
1440
1447
1451 void setCoordData(const MooseMesh & other_mesh);
1452
1457
1462
1468
1472 const MooseUnits & lengthUnit() const;
1473
1478 const std::unordered_map<std::pair<const Elem *, unsigned short int>, const Elem *> &
1479 getLowerDElemMap() const;
1480
1484 bool isSplit() const { return _is_split; }
1485
1492 void buildFiniteVolumeInfo() const;
1493
1499 void setupFiniteVolumeMeshData() const;
1500
1504 void doingPRefinement(bool doing_p_refinement) { _doing_p_refinement = doing_p_refinement; }
1505
1509 [[nodiscard]] bool doingPRefinement() const { return _doing_p_refinement; }
1510
1514 unsigned int maxPLevel() const { return _max_p_level; }
1515
1519 unsigned int maxHLevel() const { return _max_h_level; }
1520
1525 const std::vector<QpMap> & getPRefinementMap(const Elem & elem) const;
1530 const std::vector<QpMap> & getPRefinementSideMap(const Elem & elem) const;
1535 const std::vector<QpMap> & getPCoarseningMap(const Elem & elem) const;
1540 const std::vector<QpMap> & getPCoarseningSideMap(const Elem & elem) const;
1541
1543
1547 bool hasLowerD() const { return getMesh().elem_dimensions().size() > 1; }
1548
1552 const std::set<SubdomainID> & interiorLowerDBlocks() const { return _lower_d_interior_blocks; }
1556 const std::set<SubdomainID> & boundaryLowerDBlocks() const { return _lower_d_boundary_blocks; }
1557
1560
1563
1570
1571protected:
1575 bool allowRecovery() const { return _allow_recovery; }
1576
1578 std::vector<std::unique_ptr<libMesh::GhostingFunctor>> _ghosting_functors;
1579
1581 std::vector<std::shared_ptr<RelationshipManager>> _relationship_managers;
1582
1585
1589
1596
1598 std::unique_ptr<libMesh::MeshBase> _mesh;
1599
1601#ifdef MOOSE_KOKKOS_ENABLED
1602 std::unique_ptr<Moose::Kokkos::Mesh> _kokkos_mesh;
1603#endif
1604
1608
1610 std::unique_ptr<libMesh::Partitioner> _custom_partitioner;
1612
1614 enum
1615 {
1616 X = 0,
1618 Z
1620 enum
1621 {
1622 MIN = 0,
1623 MAX
1625
1628
1631
1634
1637
1640
1643
1645 std::unique_ptr<ConstElemPointerRange> _refined_elements;
1646
1648 std::unique_ptr<ConstElemPointerRange> _coarsened_elements;
1649
1655 std::map<const Elem *, std::vector<const Elem *>> _coarsened_element_children;
1656
1658 std::set<Node *> _semilocal_node_list;
1659
1664 std::unique_ptr<SemiLocalNodeRange> _active_semilocal_node_range;
1665 std::unique_ptr<libMesh::NodeRange> _active_node_range;
1666 std::unique_ptr<libMesh::ConstNodeRange> _local_node_range;
1667 std::unique_ptr<libMesh::StoredRange<MooseMesh::const_bnd_node_iterator, const BndNode *>>
1669 std::unique_ptr<libMesh::StoredRange<MooseMesh::const_bnd_elem_iterator, const BndElement *>>
1671
1673 std::unordered_map<dof_id_type, std::vector<dof_id_type>> _node_to_elem_map;
1674
1677
1682 std::set<SubdomainID> _mesh_subdomains;
1683
1685
1690 std::set<BoundaryID> _mesh_boundary_ids;
1691 std::set<BoundaryID> _mesh_sideset_ids;
1692 std::set<BoundaryID> _mesh_nodeset_ids;
1694
1696 std::unique_ptr<std::map<BoundaryID, RealVectorValue>> _boundary_to_normal_map;
1697
1699 std::vector<BndNode *> _bnd_nodes;
1700 typedef std::vector<BndNode *>::iterator bnd_node_iterator_imp;
1701 typedef std::vector<BndNode *>::const_iterator const_bnd_node_iterator_imp;
1703 std::map<boundary_id_type, std::set<dof_id_type>> _bnd_node_ids;
1704
1706 std::vector<BndElement *> _bnd_elems;
1707 typedef std::vector<BndElement *>::iterator bnd_elem_iterator_imp;
1708 typedef std::vector<BndElement *>::const_iterator const_bnd_elem_iterator_imp;
1709
1711 std::unordered_map<boundary_id_type, std::unordered_set<dof_id_type>> _bnd_elem_ids;
1712
1713 std::map<dof_id_type, Node *> _quadrature_nodes;
1714 std::map<dof_id_type, std::map<unsigned int, std::map<dof_id_type, Node *>>>
1716 std::vector<BndNode> _extra_bnd_nodes;
1717
1719 std::map<dof_id_type, std::set<SubdomainID>> _block_node_list;
1720
1722 std::map<boundary_id_type, std::vector<dof_id_type>> _node_set_nodes;
1723
1724 std::set<unsigned int> _ghosted_boundaries;
1726
1728 unsigned int _patch_size;
1729
1732
1733 // The maximum number of points in each leaf of the KDTree used in the nearest neighbor search.
1734 unsigned int _max_leaf_size;
1735
1738
1740 std::vector<Node *> _node_map;
1741
1744
1746 std::vector<std::vector<Real>> _bounds;
1747
1749 std::optional<std::vector<std::pair<BoundaryID, BoundaryID>>> _paired_boundary;
1750
1752 const bool _is_split;
1753
1754 void cacheInfo();
1755 void freeBndNodes();
1756 void freeBndElems();
1757 void setPartitionerHelper(MeshBase * mesh = nullptr);
1758
1759private:
1764 std::unordered_map<dof_id_type, std::vector<dof_id_type>> & internalNodeToElemMap();
1765
1768 mutable std::unordered_map<dof_id_type, ElemInfo> _elem_to_elem_info;
1769
1772 mutable std::vector<const ElemInfo *> _elem_info;
1773
1776 mutable std::vector<FaceInfo> _all_face_info;
1777
1780 mutable std::vector<const FaceInfo *> _face_info;
1781
1783 mutable std::unordered_map<std::pair<const Elem *, unsigned int>, FaceInfo *>
1785
1786 // true if the _face_info member needs to be rebuilt/updated.
1787 mutable bool _finite_volume_info_dirty = true;
1788
1789 // True if we have cached elemental dofs ids for the linear finite volume variables.
1790 // This happens in the first system which has a linear finite volume variable, considering
1791 // that currently we only support one variable per linear system.
1793
1800 std::map<std::pair<unsigned int, unsigned int>, std::array<bool, 3>> _periodic_dim;
1801
1805 RealVectorValue _half_range;
1806
1808 std::vector<Node *> _extreme_nodes;
1809
1821 void buildRefinementMap(const Elem & elem,
1822 libMesh::QBase & qrule,
1823 libMesh::QBase & qrule_face,
1824 int parent_side,
1825 int child,
1826 int child_side);
1827
1837 void buildCoarseningMap(const Elem & elem,
1838 libMesh::QBase & qrule,
1839 libMesh::QBase & qrule_face,
1840 int input_side);
1841
1850 void mapPoints(const std::vector<Point> & from,
1851 const std::vector<Point> & to,
1852 std::vector<QpMap> & qp_map);
1853
1876 void findAdaptivityQpMaps(const Elem * template_elem,
1877 libMesh::QBase & qrule,
1878 libMesh::QBase & qrule_face,
1879 std::vector<std::vector<QpMap>> & refinement_map,
1880 std::vector<std::pair<unsigned int, QpMap>> & coarsen_map,
1881 int parent_side,
1882 int child,
1883 int child_side);
1884
1886
1887 const std::vector<QpMap> & getPRefinementMapHelper(
1888 const Elem & elem,
1889 const std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>> &) const;
1890 const std::vector<QpMap> & getPCoarseningMapHelper(
1891 const Elem & elem,
1892 const std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>> &) const;
1893
1898 void updateCoordTransform();
1899
1905
1919 std::map<std::pair<int, libMesh::ElemType>, std::vector<std::vector<QpMap>>>
1921
1922 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1924 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1926
1928 std::map<libMesh::ElemType, std::map<std::pair<int, int>, std::vector<std::vector<QpMap>>>>
1930
1945 std::map<std::pair<int, libMesh::ElemType>, std::vector<std::pair<unsigned int, QpMap>>>
1947
1948 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1950 std::map<std::pair<libMesh::ElemType, unsigned int>, std::vector<QpMap>>
1952
1954 {
1956 std::set<SubdomainID> neighbor_subs;
1957
1960 std::set<BoundaryID> boundary_ids;
1961 };
1962
1964 std::unordered_map<SubdomainID, SubdomainData> _sub_to_data;
1965
1967 std::unordered_map<SubdomainID, std::set<BoundaryID>> _neighbor_subdomain_boundary_ids;
1968
1970 std::set<SubdomainID> _lower_d_interior_blocks;
1972 std::set<SubdomainID> _lower_d_boundary_blocks;
1974 std::unordered_map<std::pair<const Elem *, unsigned short int>, const Elem *>
1976 std::unordered_map<const Elem *, unsigned short int> _lower_d_elem_to_higher_d_elem_side;
1977
1980
1983
1987
1990
1993
1996
2002
2004 std::vector<std::unordered_map<SubdomainID, std::set<dof_id_type>>> _block_id_mapping;
2006 std::vector<dof_id_type> _max_ids;
2008 std::vector<dof_id_type> _min_ids;
2010 std::vector<std::vector<bool>> _id_identical_flag;
2011
2014
2017
2020
2023
2026
2028 void buildElemIDInfo();
2029
2031 void buildLowerDMesh();
2032
2034 std::map<SubdomainID, Moose::CoordinateSystemType> & _coord_sys;
2035
2037 unsigned int _rz_coord_axis;
2038
2040 std::unordered_map<SubdomainID, std::pair<Point, RealVectorValue>> _subdomain_id_to_rz_coord_axis;
2041
2044 std::unique_ptr<MooseAppCoordTransform> _coord_transform;
2045
2048
2050 std::vector<SubdomainName> _provided_coord_blocks;
2051
2055 unsigned int _max_p_level;
2057 unsigned int _max_h_level;
2058
2059 template <typename T>
2060 struct MeshType;
2061};
2062
2065{
2066 mooseAssert(_coord_transform, "The coordinate transformation object is null.");
2067 return *_coord_transform;
2068}
2069
2070template <>
2071struct MooseMesh::MeshType<libMesh::ReplicatedMesh>
2072{
2074};
2075
2076template <>
2077struct MooseMesh::MeshType<libMesh::DistributedMesh>
2078{
2080};
2081
2086 : variant_filter_iterator<MeshBase::Predicate, const FaceInfo *>
2087{
2088 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2089 template <typename PredType, typename IterType>
2090 face_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2091 : variant_filter_iterator<MeshBase::Predicate, const FaceInfo *>(d, e, p)
2092 {
2093 }
2094};
2095
2101 const FaceInfo * const,
2102 const FaceInfo * const &,
2103 const FaceInfo * const *>
2104{
2105 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2106 template <typename PredType, typename IterType>
2107 const_face_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2108 : variant_filter_iterator<MeshBase::Predicate,
2109 const FaceInfo * const,
2110 const FaceInfo * const &,
2111 const FaceInfo * const *>(d, e, p)
2112 {
2113 }
2114
2115 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2116 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2118 : variant_filter_iterator<MeshBase::Predicate,
2119 const FaceInfo * const,
2120 const FaceInfo * const &,
2121 const FaceInfo * const *>(rhs)
2122 {
2123 }
2124};
2125
2130 : variant_filter_iterator<MeshBase::Predicate, const ElemInfo *>
2131{
2132 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2133 template <typename PredType, typename IterType>
2134 elem_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2135 : variant_filter_iterator<MeshBase::Predicate, const ElemInfo *>(d, e, p)
2136 {
2137 }
2138};
2139
2145 const ElemInfo * const,
2146 const ElemInfo * const &,
2147 const ElemInfo * const *>
2148{
2149 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2150 template <typename PredType, typename IterType>
2151 const_elem_info_iterator(const IterType & d, const IterType & e, const PredType & p)
2152 : variant_filter_iterator<MeshBase::Predicate,
2153 const ElemInfo * const,
2154 const ElemInfo * const &,
2155 const ElemInfo * const *>(d, e, p)
2156 {
2157 }
2158
2159 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2160 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2162 : variant_filter_iterator<MeshBase::Predicate,
2163 const ElemInfo * const,
2164 const ElemInfo * const &,
2165 const ElemInfo * const *>(rhs)
2166 {
2167 }
2168};
2169
2173struct MooseMesh::bnd_node_iterator : variant_filter_iterator<MeshBase::Predicate, BndNode *>
2174{
2175 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2176 template <typename PredType, typename IterType>
2177 bnd_node_iterator(const IterType & d, const IterType & e, const PredType & p)
2178 : variant_filter_iterator<MeshBase::Predicate, BndNode *>(d, e, p)
2179 {
2180 }
2181};
2182
2188 BndNode * const,
2189 BndNode * const &,
2190 BndNode * const *>
2191{
2192 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2193 template <typename PredType, typename IterType>
2194 const_bnd_node_iterator(const IterType & d, const IterType & e, const PredType & p)
2195 : variant_filter_iterator<MeshBase::Predicate,
2196 BndNode * const,
2197 BndNode * const &,
2198 BndNode * const *>(d, e, p)
2199 {
2200 }
2201
2202 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2203 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2205 : variant_filter_iterator<MeshBase::Predicate,
2206 BndNode * const,
2207 BndNode * const &,
2208 BndNode * const *>(rhs)
2209 {
2210 }
2211};
2212
2216struct MooseMesh::bnd_elem_iterator : variant_filter_iterator<MeshBase::Predicate, BndElement *>
2217{
2218 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2219 template <typename PredType, typename IterType>
2220 bnd_elem_iterator(const IterType & d, const IterType & e, const PredType & p)
2221 : variant_filter_iterator<MeshBase::Predicate, BndElement *>(d, e, p)
2222 {
2223 }
2224};
2225
2231 BndElement * const,
2232 BndElement * const &,
2233 BndElement * const *>
2234{
2235 // Templated forwarding ctor -- forwards to appropriate variant_filter_iterator ctor
2236 template <typename PredType, typename IterType>
2237 const_bnd_elem_iterator(const IterType & d, const IterType & e, const PredType & p)
2238 : variant_filter_iterator<MeshBase::Predicate,
2239 BndElement * const,
2240 BndElement * const &,
2241 BndElement * const *>(d, e, p)
2242 {
2243 }
2244
2245 // The conversion-to-const ctor. Takes a regular iterator and calls the appropriate
2246 // variant_filter_iterator copy constructor. Note that this one is *not* templated!
2248 : variant_filter_iterator<MeshBase::Predicate,
2249 BndElement * const,
2250 BndElement * const &,
2251 BndElement * const *>(rhs)
2252 {
2253 }
2254};
2255
2263
2264template <typename T>
2265std::unique_ptr<T>
2267{
2268 // If the requested mesh type to build doesn't match our current value for _use_distributed_mesh,
2269 // then we need to make sure to make our state consistent because other objects, like the periodic
2270 // boundary condition action, will be querying isDistributedMesh()
2271 if (_use_distributed_mesh != std::is_same<T, libMesh::DistributedMesh>::value)
2272 {
2273 if (getMeshPtr())
2274 mooseError("A MooseMesh object is being asked to build a libMesh mesh that is a different "
2275 "parallel type than the libMesh mesh that it wraps. This is not allowed. Please "
2276 "create another MooseMesh object to wrap the new libMesh mesh");
2278 }
2279
2281 {
2282 if (isParamValid("dim"))
2283 dim = getParam<MooseEnum>("dim");
2284 else
2285 // Legacy selection of the default for the 'dim' parameter
2286 dim = 1;
2287 }
2288
2289 auto mesh = std::make_unique<T>(_communicator, dim);
2290
2291 if (!getParam<bool>("allow_renumbering"))
2292 mesh->allow_renumbering(false);
2293
2294 mesh->allow_remote_element_removal(_allow_remote_element_removal);
2296
2298 {
2299 // Check of partitioner is supplied (not allowed if custom partitioner is used)
2300 if (!parameters().isParamSetByAddParam("partitioner"))
2301 mooseError("If partitioner block is provided, partitioner keyword cannot be used!");
2302 // Set custom partitioner
2303 if (!_custom_partitioner.get())
2304 mooseError("Custom partitioner requested but not set!");
2305 mesh->partitioner() = _custom_partitioner->clone();
2306 }
2307 else
2309
2310 return mesh;
2311}
2312
2313inline bool
2318
2319inline void
2321{
2322 _parallel_type = parallel_type;
2324}
2325
2326inline bool
2327MooseMesh::hasElementID(const std::string & id_name) const
2328{
2329 return getMesh().has_elem_integer(id_name);
2330}
2331
2332inline unsigned int
2333MooseMesh::getElementIDIndex(const std::string & id_name) const
2334{
2335 if (!hasElementID(id_name))
2336 mooseError("Mesh does not have element ID for ", id_name);
2337 return getMesh().get_elem_integer_index(id_name);
2338}
2339
2340inline bool
2341MooseMesh::areElemIDsIdentical(const std::string & id_name1, const std::string & id_name2) const
2342{
2343 auto id1 = getElementIDIndex(id_name1);
2344 auto id2 = getElementIDIndex(id_name2);
2345 return _id_identical_flag[id1][id2];
2346}
2347
2348inline const std::vector<const FaceInfo *> &
2350{
2351 return _face_info;
2352}
2353
2354inline const std::vector<FaceInfo> &
2356{
2357 return _all_face_info;
2358}
2359
2360inline const std::map<boundary_id_type, std::vector<dof_id_type>> &
2362{
2363 return _node_set_nodes;
2364}
2365
2366inline const std::unordered_map<std::pair<const Elem *, unsigned short int>, const Elem *> &
boundary_id_type BoundaryID
libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > ConstBndNodeRange
Some useful StoredRange typedefs.
Definition MooseMesh.h:2260
libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > ConstBndElemRange
Definition MooseMesh.h:2262
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:110
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:3204
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:3644
virtual bnd_node_iterator bndNodesBegin()
Return iterators to the beginning/end of the boundary nodes list.
Definition MooseMesh.C:1535
const Moose::PatchUpdateType & getPatchUpdateStrategy() const
Get the current patch update strategy.
Definition MooseMesh.C:3514
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:2010
bool _need_delete
Whether we need to delete remote elements after init'ing the EquationSystems.
Definition MooseMesh.h:1989
void setBoundaryName(BoundaryID boundary_id, BoundaryName name)
This method sets the boundary name of the boundary based on the id parameter.
Definition MooseMesh.C:1768
virtual bnd_node_iterator bndNodesEnd()
Definition MooseMesh.C:1543
virtual ~MooseMesh()
Definition MooseMesh.C:345
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:3692
void setupFiniteVolumeMeshData() const
Sets up the additional data needed for finite volume computations.
Definition MooseMesh.C:4193
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:3598
void buildBndElemList()
Definition MooseMesh.C:1184
void printInfo(std::ostream &os=libMesh::out, const unsigned int verbosity=0) const
Calls print_info() on the underlying Mesh.
Definition MooseMesh.C:3563
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:1690
virtual std::vector< std::filesystem::path > writeRecoveryFiles(const std::filesystem::path &file_base)
Write the mesh files needed for recovery/checkpointing.
Definition MooseMesh.C:2978
bool _allow_recovery
Whether or not this Mesh is allowed to read a recovery file.
Definition MooseMesh.h:1979
MeshBase::node_iterator localNodesEnd()
Definition MooseMesh.C:3134
unsigned int _max_p_level
Maximum p-refinement level of all elements.
Definition MooseMesh.h:2055
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:1655
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:1325
std::unique_ptr< ConstElemPointerRange > _coarsened_elements
The elements that were just coarsened.
Definition MooseMesh.h:1648
std::vector< BndNode * >::iterator bnd_node_iterator_imp
Definition MooseMesh.h:1700
MeshBase & getMesh(const std::string &name)
unsigned int getAxisymmetricRadialCoord() const
Returns the desired radial direction for RZ coordinate transformation.
Definition MooseMesh.C:4415
face_info_iterator ownedFaceInfoEnd()
Definition MooseMesh.C:1509
unsigned int sideWithBoundaryID(const Elem *const elem, const BoundaryID boundary_id) const
Calls BoundaryInfo::side_with_boundary_id().
Definition MooseMesh.C:3122
void meshChanged()
Declares that the MooseMesh has changed, invalidates cached data and rebuilds caches.
Definition MooseMesh.C:889
virtual const Node & nodeRef(const dof_id_type i) const
Definition MooseMesh.C:841
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:4499
bool _displace_node_list_by_side_list
Whether or not to displace unrelated nodesets by nodesets constructed from sidesets.
Definition MooseMesh.h:1986
void allowRecovery(bool allow)
Set whether or not this mesh is allowed to read a recovery file.
Definition MooseMesh.h:1173
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:2813
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:949
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:2641
bool isDisplaced() const
whether this mesh is a displaced mesh
Definition MooseMesh.h:1370
libMesh::BoundingBox getInflatedProcessorBoundingBox(Real inflation_multiplier=0.01) const
Get a (slightly inflated) processor bounding box.
Definition MooseMesh.C:3520
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:2272
std::set< Node * > _semilocal_node_list
Used for generating the semilocal node range.
Definition MooseMesh.h:1658
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:2317
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:1768
unsigned int uniformRefineLevel() const
Returns the level of uniform refinement requested (zero if AMR is disabled).
Definition MooseMesh.C:3317
virtual dof_id_type maxElemId() const
Definition MooseMesh.C:3194
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:2630
bool isParallelTypeForced() const
Tell the user if the distribution was overriden for any reason.
Definition MooseMesh.h:1148
bool possiblyRebuildNodeToElemMap()
rebuild the node to element map if it's been requsted previously
Definition MooseMesh.C:603
std::vector< const FaceInfo * > _face_info
Holds only those FaceInfo objects that have processor_id equal to this process's id,...
Definition MooseMesh.h:1780
virtual unsigned int dimension() const
Returns MeshBase::mesh_dimension(), (not MeshBase::spatial_dimension()!) of the underlying libMesh me...
Definition MooseMesh.C:2986
static const std::array< bool, 3 > periodic_dim_default
Default value for the automatically detected paired boundaries for each unit dimension,...
Definition MooseMesh.h:80
std::vector< std::shared_ptr< RelationshipManager > > _relationship_managers
The list of active geometric relationship managers (bound to the underlying MeshBase object).
Definition MooseMesh.h:1581
virtual Elem * elem(const dof_id_type i)
Various accessors (pointers/references) for Elem "i".
Definition MooseMesh.C:3200
unsigned int getMaxLeafSize() const
Getter for the maximum leaf size parameter.
Definition MooseMesh.h:645
std::vector< BndElement * >::const_iterator const_bnd_elem_iterator_imp
Definition MooseMesh.h:1708
std::unique_ptr< ConstElemPointerRange > _refined_elements
The elements that were just refined.
Definition MooseMesh.h:1645
bool _custom_partitioner_requested
Definition MooseMesh.h:1611
bool _need_ghost_ghosted_boundaries
A parallel mesh generator such as DistributedRectilinearMeshGenerator already make everything ready.
Definition MooseMesh.h:2001
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:3110
Node * getQuadratureNode(const Elem *elem, const unsigned short int side, const unsigned int qp)
Get a specified quadrature node.
Definition MooseMesh.C:1649
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:1266
virtual bool skipPartitioning() const
Definition MooseMesh.h:342
void updateCoordTransform()
Update the coordinate transformation object based on our coordinate system data.
Definition MooseMesh.C:4406
void markFiniteVolumeInfoDirty()
Mark the finite volume information as dirty.
Definition MooseMesh.h:1456
elem_info_iterator ownedElemInfoEnd()
Definition MooseMesh.C:1526
virtual MooseMesh & clone() const
Clone method.
Definition MooseMesh.C:2876
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:2040
bool _linear_finite_volume_dofs_cached
Definition MooseMesh.h:1792
virtual Elem * elemPtr(const dof_id_type i)
Definition MooseMesh.C:3214
virtual void onMeshChanged()
Declares a callback function that is executed at the conclusion of meshChanged().
Definition MooseMesh.C:914
bool _coord_system_set
Whether the coordinate system has been set.
Definition MooseMesh.h:2047
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition MooseMesh.C:3549
MooseEnum _partitioner_name
The partitioner used on this mesh.
Definition MooseMesh.h:1606
virtual unsigned int spatialDimension() const
Returns MeshBase::spatial_dimension.
Definition MooseMesh.h:206
ParallelType getParallelType() const
Definition MooseMesh.h:1158
bool _parallel_type_overridden
Definition MooseMesh.h:1595
void buildRefinementAndCoarseningMaps(Assembly *assembly)
Create the refinement and coarsening maps necessary for projection of stateful material properties wh...
Definition MooseMesh.C:2513
void detectPairedSidesets()
This routine detects paired sidesets of a regular orthogonal mesh (.i.e.
Definition MooseMesh.C:1994
bool _is_changed
true if mesh is changed (i.e. after adaptivity step)
Definition MooseMesh.h:1636
void needGhostGhostedBoundaries(bool needghost)
Whether or not we want to ghost ghosted boundaries.
Definition MooseMesh.h:630
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:1731
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:1949
std::set< BoundaryID > _mesh_boundary_ids
A set of boundary IDs currently present in the mesh.
Definition MooseMesh.h:1690
unsigned int getMaxSidesPerElem() const
Get the maximum number of sides per element.
Definition MooseMesh.h:1288
const std::vector< Real > & getGhostedBoundaryInflation() const
Return a writable reference to the _ghosted_boundaries_inflation vector.
Definition MooseMesh.C:3348
virtual void init()
Initialize the Mesh object.
Definition MooseMesh.C:2929
virtual const Node & node(const dof_id_type i) const
Various accessors (pointers/references) for Node "i".
Definition MooseMesh.C:827
bool _is_displaced
Whether this mesh is displaced.
Definition MooseMesh.h:2025
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:1757
Real dimensionWidth(unsigned int component) const
Returns the width of the requested dimension.
Definition MooseMesh.C:2171
unsigned int _max_leaf_size
Definition MooseMesh.h:1734
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_coarsening_side_map
Definition MooseMesh.h:1951
bool skipDeletionRepartitionAfterRefine() const
Return a flag indicating whether or not we should skip remote deletion and repartition after uniform ...
Definition MooseMesh.h:2314
virtual unsigned int nPartitions() const
Definition MooseMesh.h:341
void computeMaxPerElemAndSide()
Compute the maximum numbers per element and side.
Definition MooseMesh.C:1065
virtual dof_id_type nActiveLocalElem() const
Definition MooseMesh.h:338
void update()
Calls buildNodeListFromSideList(), buildNodeList(), and buildBndElemList().
Definition MooseMesh.C:620
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:1722
void freeBndNodes()
Definition MooseMesh.C:353
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:1168
std::vector< FaceInfo > _all_face_info
FaceInfo object storing information for face based loops.
Definition MooseMesh.h:1776
const std::string & getBoundaryName(const BoundaryID boundary_id) const
Return the name of the boundary given the id.
Definition MooseMesh.C:1780
std::unique_ptr< libMesh::MeshBase > _mesh
Pointer to underlying libMesh mesh object.
Definition MooseMesh.h:1598
bool skipRefineWhenUseSplit() const
Whether or not skip uniform refinements when using a pre-split mesh.
Definition MooseMesh.h:599
void determineUseDistributedMesh()
Determine whether to use a distributed mesh.
Definition MooseMesh.C:2882
std::vector< Node * > _node_map
Vector of all the Nodes in the mesh for determining when to add a new point.
Definition MooseMesh.h:1740
std::unique_ptr< libMesh::StoredRange< MooseMesh::const_bnd_elem_iterator, const BndElement * > > _bnd_elem_range
Definition MooseMesh.h:1670
bool hasDetectedPairedSidesets() const
Whether or not detectedPairedSidesets() has been called.
Definition MooseMesh.h:1002
std::map< SubdomainID, Moose::CoordinateSystemType > & _coord_sys
Type of coordinate system per subdomain.
Definition MooseMesh.h:2034
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:1920
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:1668
const MeshBase * getMeshPtr() const
Definition MooseMesh.C:3543
ParallelType _parallel_type
Can be set to DISTRIBUTED, REPLICATED, or DEFAULT.
Definition MooseMesh.h:1588
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:4306
std::pair< const Node *, BoundaryID > PeriodicNodeInfo
Helper type for building periodic node maps.
Definition MooseMesh.h:1216
void buildNodeListFromSideList()
Calls BoundaryInfo::build_node_list_from_side_list().
Definition MooseMesh.C:3049
void setMeshBoundaryIDs(std::set< BoundaryID > boundary_IDs)
Sets the set of BoundaryIDs Is called by AddAllSideSetsByNormals.
Definition MooseMesh.C:3296
const std::map< SubdomainID, Moose::CoordinateSystemType > & getCoordSystem() const
Get the map from subdomain ID to coordinate system type, e.g.
Definition MooseMesh.C:4328
virtual bool isDistributedMesh() const
Returns the final Mesh distribution type.
Definition MooseMesh.h:1143
MooseAppCoordTransform & coordTransform()
Definition MooseMesh.h:2064
unsigned int _max_h_level
Maximum h-refinement level of all elements.
Definition MooseMesh.h:2057
virtual unsigned int effectiveSpatialDimension() const
Returns the effective spatial dimension determined by the coordinates actually used by the mesh.
Definition MooseMesh.C:2992
std::vector< std::unique_ptr< libMesh::GhostingFunctor > > _ghosting_functors
Deprecated (DO NOT USE)
Definition MooseMesh.h:1578
bool _skip_refine_when_use_split
Whether or not to skip uniform refinements when using a pre-split mesh.
Definition MooseMesh.h:1630
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:2341
bool prepared() const
Setter/getter for whether the mesh is prepared.
Definition MooseMesh.C:3238
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:2004
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:1946
bool isSplit() const
Definition MooseMesh.h:1484
bool hasElementID(const std::string &id_name) const
Whether mesh has an extra element integer with a given name.
Definition MooseMesh.h:2327
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:1975
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:1129
bool _use_distributed_mesh
False by default.
Definition MooseMesh.h:1593
void addGhostedBoundary(BoundaryID boundary_id)
This will add the boundary ids to be ghosted to this processor.
Definition MooseMesh.C:3330
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:1701
std::set< SubdomainID > _mesh_subdomains
A set of subdomain IDs currently present in the mesh.
Definition MooseMesh.h:1682
static MooseEnum partitioning()
returns MooseMesh partitioning options so other classes can use it
Definition MooseMesh.C:4019
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:2367
virtual dof_id_type maxNodeId() const
Calls max_node/elem_id() on the underlying libMesh mesh object.
Definition MooseMesh.C:3188
void setSubdomainName(SubdomainID subdomain_id, const SubdomainName &name)
This method sets the name for subdomain_id to name.
Definition MooseMesh.C:1738
void setCoordData(const MooseMesh &other_mesh)
Set the coordinate system data to that of other_mesh.
Definition MooseMesh.C:4443
unsigned int getElementIDIndex(const std::string &id_name) const
Return the accessing integer for an extra element integer with its name.
Definition MooseMesh.h:2333
void checkDuplicateSubdomainNames()
Loop through all subdomain IDs and check if there is name duplication used for the subdomains with sa...
Definition MooseMesh.C:4458
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:1715
bool _regular_orthogonal_mesh
Boolean indicating whether this mesh was detected to be regular and orthogonal.
Definition MooseMesh.h:1743
SemiLocalNodeRange * getActiveSemiLocalNodeRange() const
Definition MooseMesh.C:1262
ConstElemPointerRange * refinedElementRange() const
Return a range that is suitable for threaded execution over elements that were just refined.
Definition MooseMesh.C:937
SubdomainID getSubdomainID(const SubdomainName &subdomain_name) const
Get the associated subdomain ID for the subdomain name.
Definition MooseMesh.C:1720
void clearQuadratureNodes()
Clear out any existing quadrature nodes.
Definition MooseMesh.C:1667
void cacheFaceInfoVariableOwnership() const
Cache if variables live on the elements connected by the FaceInfo objects.
Definition MooseMesh.C:4062
virtual Real getMaxInDimension(unsigned int component) const
Definition MooseMesh.C:2186
void buildFiniteVolumeInfo() const
Builds the face and elem info vectors that store meta-data needed for looping over and doing calculat...
Definition MooseMesh.C:3844
static InputParameters validParams()
Typical "Moose-style" constructor and copy constructor.
Definition MooseMesh.C:83
const std::set< BoundaryID > & meshNodesetIds() const
Returns a read-only reference to the set of nodesets currently present in the Mesh.
Definition MooseMesh.C:3290
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:1236
face_info_iterator ownedFaceInfoBegin()
Iterators to owned faceInfo objects.
Definition MooseMesh.C:1500
libMesh::ConstNodeRange * getLocalNodeRange()
Definition MooseMesh.C:1271
void setIsCustomPartitionerRequested(bool cpr)
Definition MooseMesh.C:3832
void deleteRemoteElements()
Delete remote elements.
Definition MooseMesh.C:4050
bool getConstructNodeListFromSideList()
Return construct node list from side list boolean.
Definition MooseMesh.h:1559
bool allowRemoteElementRemoval() const
Whether we are allow remote element removal.
Definition MooseMesh.h:1236
elem_info_iterator ownedElemInfoBegin()
Iterators to owned faceInfo objects.
Definition MooseMesh.C:1518
std::vector< BndElement * > _bnd_elems
array of boundary elems
Definition MooseMesh.h:1706
unsigned int maxPLevel() const
Returns the maximum p-refinement level of all elements.
Definition MooseMesh.h:1514
bool needsRemoteElemDeletion() const
Whether we need to delete remote elements.
Definition MooseMesh.h:1226
void ghostGhostedBoundaries()
Actually do the ghosting of boundaries that need to be ghosted to this processor.
Definition MooseMesh.C:3415
bool isPartitionerForced() const
Tell the user if the partitioner was overriden for any reason.
Definition MooseMesh.h:1168
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:4511
bool _is_nemesis
True if a Nemesis Mesh was read in.
Definition MooseMesh.h:1639
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:1213
void updateActiveSemiLocalNodeRange(std::set< dof_id_type > &ghosted_elems)
Clears the "semi-local" node list and rebuilds it.
Definition MooseMesh.C:957
bool getDisplaceNodeListBySideList()
Return displace node list by side list boolean.
Definition MooseMesh.h:1562
virtual bool skipNoncriticalPartitioning() const
Definition MooseMesh.C:4523
void checkCoordinateSystems()
Performs a sanity check for every element in the mesh.
Definition MooseMesh.C:4428
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:2523
const std::vector< const FaceInfo * > & faceInfo() const
Accessor for local FaceInfo objects.
Definition MooseMesh.h:2349
void buildElemIDInfo()
Build extra data for faster access to the information of extra element integers.
Definition MooseMesh.C:1088
virtual bnd_elem_iterator bndElemsBegin()
Return iterators to the beginning/end of the boundary elements list.
Definition MooseMesh.C:1551
unsigned int getBlocksMaxDimension(const std::vector< SubdomainName > &blocks) const
Returns the maximum element dimension on the given blocks.
Definition MooseMesh.C:3007
bool isFiniteVolumeInfoDirty() const
Definition MooseMesh.h:1461
const Moose::Kokkos::Mesh * getKokkosMesh() const
Definition MooseMesh.h:685
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:4517
const MooseEnum & partitionerName() const
Definition MooseMesh.h:1163
virtual Elem * queryElemPtr(const dof_id_type i)
Definition MooseMesh.C:3226
const std::set< unsigned int > & getGhostedBoundaries() const
Return a writable reference to the set of ghosted boundary IDs.
Definition MooseMesh.C:3342
void cacheFVElementalDoFs() const
Cache the DoF indices for FV variables on each element.
Definition MooseMesh.C:4140
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:3838
bool _partitioner_overridden
Definition MooseMesh.h:1607
const std::set< BoundaryID > & getBoundaryIDs() const
Returns a const reference to a set of all user-specified boundary IDs.
Definition MooseMesh.C:3043
std::vector< std::vector< Real > > _bounds
The bounds in each dimension of the mesh for regular orthogonal meshes.
Definition MooseMesh.h:1746
void freeBndElems()
Definition MooseMesh.C:372
std::set< SubdomainID > _lower_d_boundary_blocks
Mesh blocks for boundary lower-d elements in different types.
Definition MooseMesh.h:1972
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:3992
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:3302
bool isCustomPartitionerRequested() const
Setter and getter for _custom_partitioner_requested.
Definition MooseMesh.C:3810
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:4505
void computeFiniteVolumeCoords() const
Compute the face coordinate value for all FaceInfo and ElemInfo objects.
Definition MooseMesh.C:3998
bool _moose_mesh_prepared
True if prepare has been called on the mesh.
Definition MooseMesh.h:1642
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:1319
bool _doing_p_refinement
Whether we have p-refinement (whether exclusively p- or hp-refinement)
Definition MooseMesh.h:2053
Moose::Kokkos::Mesh * getKokkosMesh()
Accessor for Kokkos mesh object.
Definition MooseMesh.h:684
unsigned int nFace() const
accessors for the FaceInfo objects
Definition MooseMesh.h:1304
bool _skip_deletion_repartition_after_refine
Whether or not skip remote deletion and repartition after uniform refinements.
Definition MooseMesh.h:1633
void buildNodeList()
Calls BoundaryInfo::build_node_list()/build_side_list() and makes separate copies of Nodes/Elems in t...
Definition MooseMesh.C:1031
virtual dof_id_type nNodes() const
Calls n_nodes/elem() on the underlying libMesh mesh object.
Definition MooseMesh.C:3176
std::vector< Node * > _extreme_nodes
A vector containing the nodes at the corners of a regular orthogonal mesh.
Definition MooseMesh.h:1808
BoundaryID getBoundaryID(const BoundaryName &boundary_name) const
Get the associated BoundaryID for the boundary name.
Definition MooseMesh.C:1681
std::unique_ptr< libMesh::Partitioner > _custom_partitioner
The custom partitioner.
Definition MooseMesh.h:1610
std::optional< std::vector< std::pair< BoundaryID, BoundaryID > > > _paired_boundary
A vector holding the paired boundaries for a regular orthogonal mesh.
Definition MooseMesh.h:1749
unsigned int getGhostingPatchSize() const
Getter for the ghosting_patch_size parameter.
Definition MooseMesh.h:640
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:3571
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:3633
unsigned int getMaxNodesPerSide() const
Get the maximum number of nodes per side.
Definition MooseMesh.h:1298
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:1784
bool isRegularOrthogonal()
Getter to query if the mesh was detected to be regular and orthogonal.
Definition MooseMesh.h:1198
const std::vector< QpMap > & getPRefinementMapHelper(const Elem &elem, const std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > &) const
Definition MooseMesh.C:4478
const std::map< boundary_id_type, std::vector< dof_id_type > > & nodeSetNodes() const
Definition MooseMesh.h:2361
unsigned int _max_nodes_per_elem
The maximum number of nodes per element.
Definition MooseMesh.h:2016
static MooseEnum elemTypes()
returns MooseMesh element type options
Definition MooseMesh.C:4027
std::set< BoundaryID > _mesh_nodeset_ids
Definition MooseMesh.h:1692
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:4342
unsigned int getPatchSize() const
Getter for the patch_size parameter.
Definition MooseMesh.C:3502
void cacheInfo()
Definition MooseMesh.C:1401
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:2195
std::vector< BndElement * >::iterator bnd_elem_iterator_imp
Definition MooseMesh.h:1707
void cacheChangedLists()
Cache information about what elements were refined and coarsened in the previous step.
Definition MooseMesh.C:919
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:2248
const std::pair< Point, RealVectorValue > & getGeneralAxisymmetricCoordAxis(SubdomainID subdomain_id) const
Gets the general axisymmetric coordinate axis for a block.
Definition MooseMesh.C:4390
std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > _elem_type_to_p_refinement_side_map
Definition MooseMesh.h:1925
bool _allow_remote_element_removal
Whether to allow removal of remote elements.
Definition MooseMesh.h:1992
bool _construct_node_list_from_side_list
Whether or not to allow generation of nodesets from sidesets.
Definition MooseMesh.h:1982
std::set< BoundaryID > getSubdomainInterfaceBoundaryIds(const SubdomainID subdomain_id) const
Get the list of boundaries that contact the given subdomain.
Definition MooseMesh.C:3609
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:2266
const Node * addUniqueNode(const Point &p, Real tol=1e-6)
Add a new node to the mesh.
Definition MooseMesh.C:1566
void setParallelType(ParallelType parallel_type)
Allow to change parallel type.
Definition MooseMesh.h:2320
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:3278
const std::set< SubdomainID > & interiorLowerDBlocks() const
Definition MooseMesh.h:1552
std::vector< BndNode * > _bnd_nodes
array of boundary nodes
Definition MooseMesh.h:1699
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:1673
const std::vector< const ElemInfo * > & elemInfoVector() const
Accessor for the element info objects owned by this process.
Definition MooseMesh.h:1338
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:1893
std::unique_ptr< MooseAppCoordTransform > _coord_transform
A coordinate transformation object that describes how to transform this problem's coordinate system i...
Definition MooseMesh.h:2044
std::vector< BndNode * >::const_iterator const_bnd_node_iterator_imp
Definition MooseMesh.h:1701
const std::set< SubdomainID > & getNodeBlockIds(const Node &node) const
Return list of blocks to which the given node belongs.
Definition MooseMesh.C:1489
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:1929
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:1808
const RealVectorValue & getNormalByBoundaryID(BoundaryID id) const
Returns the normal vector associated with a given BoundaryID.
Definition MooseMesh.C:2866
std::unordered_map< SubdomainID, SubdomainData > _sub_to_data
Holds a map from subdomain ids to associated data.
Definition MooseMesh.h:1964
const MooseUnits & lengthUnit() const
Definition MooseMesh.C:4451
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:1696
std::unique_ptr< libMesh::NodeRange > _active_node_range
Definition MooseMesh.h:1665
std::set< SubdomainID > _lower_d_interior_blocks
Mesh blocks for interior lower-d elements in different types.
Definition MooseMesh.h:1970
void setPatchUpdateStrategy(Moose::PatchUpdateType patch_update_strategy)
Set the patch size update strategy.
Definition MooseMesh.C:3508
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:1726
const std::vector< FaceInfo > & allFaceInfo() const
Accessor for all FaceInfo objects.
Definition MooseMesh.h:2355
void setPartitionerHelper(MeshBase *mesh=nullptr)
Definition MooseMesh.C:3729
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:2343
const std::set< BoundaryID > & meshSidesetIds() const
Returns a read-only reference to the set of sidesets currently present in the Mesh.
Definition MooseMesh.C:3284
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:1703
unsigned int _rz_coord_axis
Storage for RZ axis selection.
Definition MooseMesh.h:2037
ConstElemPointerRange * coarsenedElementRange() const
Return a range that is suitable for threaded execution over elements that were just coarsened.
Definition MooseMesh.C:943
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:1967
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:1711
unsigned int _uniform_refine_level
The level of uniform refinement requested (set to zero if AMR is disabled)
Definition MooseMesh.h:1627
const std::string & getSubdomainName(SubdomainID subdomain_id) const
Return the name of a block given an id.
Definition MooseMesh.C:1751
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:2602
bool hasSecondOrderElements()
check if the mesh has SECOND order elements
Definition MooseMesh.C:3816
std::unordered_map< const Elem *, unsigned short int > _lower_d_elem_to_higher_d_elem_side
Definition MooseMesh.h:1976
bool _distribution_overridden
Definition MooseMesh.h:1594
bool _finite_volume_info_dirty
Definition MooseMesh.h:1787
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:1336
bool allowRecovery() const
Returns whether this mesh is allowed to read a recovery file.
Definition MooseMesh.h:1575
virtual const Node * nodePtr(const dof_id_type i) const
Definition MooseMesh.C:855
virtual dof_id_type nLocalNodes() const
Definition MooseMesh.h:336
std::map< dof_id_type, Node * > _quadrature_nodes
Definition MooseMesh.h:1713
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:1311
void needsRemoteElemDeletion(bool need_delete)
Set whether we need to delete remote elements.
Definition MooseMesh.h:1221
const std::vector< QpMap > & getPCoarseningMapHelper(const Elem &elem, const std::map< std::pair< libMesh::ElemType, unsigned int >, std::vector< QpMap > > &) const
Definition MooseMesh.C:4489
virtual dof_id_type nActiveElem() const
Definition MooseMesh.h:337
libMesh::NodeRange * getActiveNodeRange()
Definition MooseMesh.C:1248
std::vector< SubdomainName > _provided_coord_blocks
Set for holding user-provided coordinate system type block names.
Definition MooseMesh.h:2050
unsigned int _patch_size
The number of nodes to consider in the NearestNode neighborhood.
Definition MooseMesh.h:1728
void setCustomPartitioner(libMesh::Partitioner *partitioner)
Setter for custom partitioner.
Definition MooseMesh.C:3800
libMesh::StoredRange< MooseMesh::const_bnd_node_iterator, const BndNode * > * getBoundaryNodeRange()
Definition MooseMesh.C:1285
void setMeshBase(std::unique_ptr< MeshBase > mesh_base)
Method to set the mesh_base object.
Definition MooseMesh.C:2922
std::unique_ptr< libMesh::ConstNodeRange > _local_node_range
Definition MooseMesh.h:1666
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
Definition MooseMesh.C:3272
virtual bnd_elem_iterator bndElemsEnd()
Definition MooseMesh.C:1559
MeshBase::node_iterator localNodesBegin()
Calls local_nodes_begin/end() on the underlying libMesh mesh object.
Definition MooseMesh.C:3128
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:2566
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:4202
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:1600
void buildLowerDMesh()
Build lower-d mesh for all sides.
Definition MooseMesh.C:663
bool doingPRefinement() const
Query whether the kind of adaptivity we're doing includes p-refinement.
Definition MooseMesh.h:1509
virtual const Node * queryNodePtr(const dof_id_type i) const
Definition MooseMesh.C:867
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:1800
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:1261
std::vector< dof_id_type > _max_ids
Maximum integer ID for each extra element integer.
Definition MooseMesh.h:2006
std::unique_ptr< Moose::Kokkos::Mesh > _kokkos_mesh
Pointer to Kokkos mesh object.
Definition MooseMesh.h:1602
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:2672
unsigned int _max_nodes_per_side
The maximum number of nodes per side.
Definition MooseMesh.h:2019
bool _node_to_elem_map_built
Whether _node_to_elem_map has been built.
Definition MooseMesh.h:1676
const MeshBase::element_iterator activeLocalElementsEnd()
Definition MooseMesh.C:3158
std::set< BoundaryID > _mesh_sideset_ids
Definition MooseMesh.h:1691
std::vector< Real > _ghosted_boundaries_inflation
Definition MooseMesh.h:1725
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:3336
std::string getBoundaryString(const BoundaryID boundary_id) const
Return the name of the boundary given the id, if it exists.
Definition MooseMesh.C:1792
std::set< SubdomainID > getBoundaryConnectedBlocks(const BoundaryID bid) const
Get the list of subdomains associated with the given boundary.
Definition MooseMesh.C:3622
bool prepare(const MeshBase *mesh_to_clone)
Calls prepare_for_use() if the underlying MeshBase object isn't prepared, then communicates various b...
Definition MooseMesh.C:386
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:2233
const bool _is_split
Whether or not we are using a (pre-)split mesh (automatically DistributedMesh)
Definition MooseMesh.h:1752
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:1664
void doingPRefinement(bool doing_p_refinement)
Indicate whether the kind of adaptivity we're doing includes p-refinement.
Definition MooseMesh.h:1504
void setUniformRefineLevel(unsigned int, bool deletion=true)
Set uniform refinement level.
Definition MooseMesh.C:3323
Moose::PatchUpdateType _patch_update_strategy
The patch update strategy.
Definition MooseMesh.h:1737
virtual Real getMinInDimension(unsigned int component) const
Returns the min or max of the requested dimension respectively.
Definition MooseMesh.C:2177
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:1367
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition MooseMesh.C:3718
void setAxisymmetricCoordAxis(const MooseEnum &rz_coord_axis)
For axisymmetric simulations, set the symmetry coordinate axis.
Definition MooseMesh.C:4334
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:3266
const libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems,...
Definition MooseMesh.C:1242
unsigned int maxHLevel() const
Returns the maximum h-refinement level of all elements.
Definition MooseMesh.h:1519
unsigned int getMaxNodesPerElem() const
Get the maximum number of nodes per element.
Definition MooseMesh.h:1293
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:1923
bool hasLowerD() const
Definition MooseMesh.h:1547
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:2910
bool _built_from_other_mesh
Whether or not this mesh was built from another mesh.
Definition MooseMesh.h:1584
virtual dof_id_type nElem() const
Definition MooseMesh.C:3182
const std::set< SubdomainID > & getBlockConnectedBlocks(const SubdomainID subdomain_id) const
Get the list of subdomains neighboring a given subdomain.
Definition MooseMesh.C:3655
std::set< Elem * > _ghost_elems_from_ghost_boundaries
Set of elements ghosted by ghostGhostedBoundaries.
Definition MooseMesh.h:1995
std::vector< const ElemInfo * > _elem_info
Holds only those ElemInfo objects that have processor_id equal to this process's id,...
Definition MooseMesh.h:1772
void isDisplaced(bool is_displaced)
Set whether this mesh is a displaced mesh.
Definition MooseMesh.h:1365
bool hasMeshBase() const
Whether mesh base object was constructed or not.
Definition MooseMesh.h:1246
const std::set< SubdomainID > & boundaryLowerDBlocks() const
Definition MooseMesh.h:1556
bool usingGeneralAxisymmetricCoordAxes() const
Returns true if general axisymmetric coordinate axes are being used.
Definition MooseMesh.C:4400
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:1158
std::vector< BndNode > _extra_bnd_nodes
Definition MooseMesh.h:1716
void buildHRefinementAndCoarseningMaps(Assembly *assembly)
Definition MooseMesh.C:2362
std::set< unsigned int > _ghosted_boundaries
Definition MooseMesh.h:1724
std::vector< dof_id_type > _min_ids
Minimum integer ID for each extra element integer.
Definition MooseMesh.h:2008
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:1298
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:3666
RealVectorValue _half_range
A convenience vector used to hold values in each dimension representing half of the range.
Definition MooseMesh.h:1805
MeshBase::element_iterator activeLocalElementsBegin()
Calls active_local_nodes_begin/end() on the underlying libMesh mesh object.
Definition MooseMesh.C:3152
std::map< dof_id_type, std::set< SubdomainID > > _block_node_list
list of nodes that belongs to a specified block (domain)
Definition MooseMesh.h:1719
unsigned int _max_sides_per_elem
The maximum number of sides per element.
Definition MooseMesh.h:2013
bool isSemiLocal(Node *const node) const
Returns true if the node is semi-local.
Definition MooseMesh.C:998
void buildPRefinementAndCoarseningMaps(Assembly *assembly)
Definition MooseMesh.C:2419
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:3741
std::vector< std::tuple< dof_id_type, unsigned short int, boundary_id_type > > buildActiveSideList() const
Calls BoundaryInfo::build_active_side_list.
Definition MooseMesh.C:3116
bool detectOrthogonalDimRanges(Real tol=1e-6)
This routine determines whether the Mesh is a regular orthogonal mesh (i.e.
Definition MooseMesh.C:1920
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:1207
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:1960
std::set< SubdomainID > neighbor_subs
Neighboring subdomain ids.
Definition MooseMesh.h:1956
The definition of the bnd_elem_iterator struct.
Definition MooseMesh.h:2217
bnd_elem_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2220
The definition of the bnd_node_iterator struct.
Definition MooseMesh.h:2174
bnd_node_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2177
The definition of the const_bnd_elem_iterator struct.
Definition MooseMesh.h:2234
const_bnd_elem_iterator(const bnd_elem_iterator &rhs)
Definition MooseMesh.h:2247
const_bnd_elem_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2237
The definition of the const_bnd_node_iterator struct.
Definition MooseMesh.h:2191
const_bnd_node_iterator(const MooseMesh::bnd_node_iterator &rhs)
Definition MooseMesh.h:2204
const_bnd_node_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2194
The definition of the const_elem_info_iterator struct.
Definition MooseMesh.h:2148
const_elem_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2151
const_elem_info_iterator(const MooseMesh::elem_info_iterator &rhs)
Definition MooseMesh.h:2161
The definition of the const_face_info_iterator struct.
Definition MooseMesh.h:2104
const_face_info_iterator(const MooseMesh::face_info_iterator &rhs)
Definition MooseMesh.h:2117
const_face_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2107
The definition of the elem_info_iterator struct.
Definition MooseMesh.h:2131
elem_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2134
The definition of the face_info_iterator struct.
Definition MooseMesh.h:2087
face_info_iterator(const IterType &d, const IterType &e, const PredType &p)
Definition MooseMesh.h:2090