MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
pncmesh.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_PNCMESH
13#define MFEM_PNCMESH
14
15#include "../config/config.hpp"
16
17#ifdef MFEM_USE_MPI
18
19#include <map>
20#include <set>
21
22#include "ncmesh.hpp"
25
26namespace mfem
27{
28
29class FiniteElementSpace;
30
31
32/** \brief A parallel extension of the NCMesh class.
33 *
34 * The basic idea (and assumption) is that all processors share the coarsest
35 * layer ("root elements"). This has the advantage that refinements can easily
36 * be exchanged between processors when rebalancing since individual elements
37 * can be uniquely identified by the index of the root element and a path in
38 * the refinement tree.
39 *
40 * Each leaf element is owned by one of the processors (NCMesh::Element::rank).
41 * The underlying NCMesh stores not only elements for the current ('MyRank')
42 * processor, but also a minimal layer of adjacent "ghost" elements owned by
43 * other processors. The ghost layer is synchronized after refinement.
44 *
45 * The ghost layer contains all vertex-, edge- and face-neighbors of the
46 * current processor's region. It is used to determine constraining relations
47 * and ownership of DOFs on the processor boundary. Ghost elements are never
48 * seen by the rest of MFEM as they are skipped when a Mesh is created from
49 * the NCMesh.
50 *
51 * The processor that owns a vertex, edge or a face (and in turn its DOFs) is
52 * currently defined to be the one with the lowest rank in the group of
53 * processors that share the entity.
54 *
55 * Vertices, edges and faces that are not owned by this ('MyRank') processor
56 * are ghosts, and are numbered after all real vertices/edges/faces, i.e.,
57 * they have indices greater than NVertices, NEdges, NFaces, respectively.
58 *
59 * A shared vertex/edge/face is identified in an interprocessor message by a
60 * pair of numbers. The first number specifies an element in an ElementSet
61 * (typically sent at the beginning of the message) that contains the v/e/f.
62 * The second number is the local index of the v/e/f in that element.
63 */
64class ParNCMesh : public NCMesh
65{
66public:
67 /// Construct by partitioning a serial NCMesh.
68 /** SFC partitioning is used by default. A user-specified partition can be
69 passed in 'part', where part[i] is the desired MPI rank for element i. */
70 ParNCMesh(MPI_Comm comm, const NCMesh& ncmesh, int* part = NULL);
71
72 /** Load from a stream, parallel version. See the serial NCMesh::NCMesh
73 counterpart for a description of the parameters. */
74 ParNCMesh(MPI_Comm comm, std::istream &input,
75 int version, int &curved, int &is_nc);
76
77 /// Deep copy of another instance.
78 ParNCMesh(const ParNCMesh &other);
79
80 virtual ~ParNCMesh();
81
82 /** An override of NCMesh::Refine, which is called eventually, after making
83 sure that refinements that occur on the processor boundary are sent to
84 the neighbor processors so they can keep their ghost layers up to date.*/
85 void Refine(const Array<Refinement> &refinements) override;
86
87 /// Parallel version of NCMesh::LimitNCLevel.
88 void LimitNCLevel(int max_nc_level) override;
89
90 /** Parallel version of NCMesh::CheckDerefinementNCLevel. */
91 void CheckDerefinementNCLevel(const Table &deref_table,
92 Array<int> &level_ok, int max_nc_level) override;
93
94 /** Parallel reimplementation of NCMesh::Derefine, keeps ghost layers
95 in sync. The interface is identical. */
96 void Derefine(const Array<int> &derefs) override;
97
98 /** Gets partitioning for the coarse mesh if the current fine mesh were to
99 be derefined. */
100 void GetFineToCoarsePartitioning(const Array<int> &derefs,
101 Array<int> &new_ranks) const;
102
103 /** Migrate leaf elements of the global refinement hierarchy (including ghost
104 elements) so that each processor owns the same number of leaves (+-1).
105 The default partitioning strategy is based on equal splitting of the
106 space-filling sequence of leaf elements (custom_partition == NULL).
107 Alternatively, a used-defined element-rank assignment array can be
108 passed. */
109 void Rebalance(const Array<int> *custom_partition = NULL);
110
111 // interface for ParFiniteElementSpace
112 int GetNElements() const { return NElements; }
113
114 int GetNGhostVertices() const { return NGhostVertices; }
115 int GetNGhostEdges() const { return NGhostEdges; }
116 int GetNGhostFaces() const { return NGhostFaces; }
117 int GetNGhostElements() const override { return NGhostElements; }
118
119 // Return a list of vertices/edges/faces shared by this processor and at
120 // least one other processor. These are subsets of NCMesh::<entity>_list. */
124
125 /// Helper to get shared vertices/edges/faces ('entity' == 0/1/2 resp.).
126 const NCList& GetSharedList(int entity)
127 {
128 switch (entity)
129 {
130 case 0: return GetSharedVertices();
131 case 1: return GetSharedEdges();
132 default: return GetSharedFaces();
133 }
134 }
135
136 /// Return (shared) face orientation relative to its owner element.
138 {
139 return (index < NFaces) ? face_orient[index] : 0;
140 }
141
142 using GroupId = short;
143 using CommGroup = std::vector<int>;
144
145 /// Return vertex/edge/face ('entity' == 0/1/2, resp.) owner.
147 {
148 MFEM_ASSERT(entity >= 0 && entity < 3, "");
149 MFEM_ASSERT(index >= 0, "");
150 if (!entity_owner[entity].Size())
151 {
152 GetSharedList(entity);
153 }
154 return entity_owner[entity][index];
155 }
156
157 /** Return the P matrix communication group ID for a vertex/edge/face.
158 The groups are calculated specifically to match the P matrix
159 construction algorithm and its communication pattern. */
161 {
162 MFEM_ASSERT(entity >= 0 && entity < 3, "");
163 MFEM_ASSERT(index >= 0, "");
164 if (!entity_pmat_group[entity].Size())
165 {
167 }
168 return entity_pmat_group[entity][index];
169 }
170
171 /// Return a list of ranks contained in the group of the given ID.
172 const CommGroup& GetGroup(GroupId id) const
173 {
174 MFEM_ASSERT(id >= 0, "");
175 return groups[id];
176 }
177
178 /// Return true if group 'id' contains the given rank.
179 bool GroupContains(GroupId id, int rank) const;
180
181 /// Return true if the specified vertex/edge/face is a ghost.
182 bool IsGhost(int entity, int index) const
183 {
184 if (index < 0) // special case prism edge-face constraint
185 {
186 MFEM_ASSERT(entity == 2, "");
187 entity = 1;
188 index = -1 - index;
189 }
190 switch (entity)
191 {
192 case 0: return index >= NVertices;
193 case 1: return index >= NEdges;
194 default: return index >= NFaces;
195 }
196 }
197
198 /** Returns owner processor for element 'index'. This is normally MyRank but
199 for index >= NElements (i.e., for ghosts) it may be something else. */
200 int ElementRank(int index) const
201 {
202 return elements[leaf_elements[index]].rank;
203 }
204
205
206 // utility
207
208 int GetMyRank() const { return MyRank; }
209
210 /// Use the communication pattern from last Rebalance() to send element DOFs.
211 void SendRebalanceDofs(int old_ndofs, const Table &old_element_dofs,
212 long old_global_offset, FiniteElementSpace* space);
213
214 /// Receive element DOFs sent by SendRebalanceDofs().
216
217 /** Get previous indices (pre-Rebalance) of current elements. Index of -1
218 indicates that an element didn't exist in the mesh before. */
220
221 /** Get previous (pre-Derefine) fine element ranks. This complements the
222 CoarseFineTransformations::embeddings array in parallel. */
224
225 /** Exchange element data for derefinements that straddle processor
226 boundaries. 'elem_data' is enlarged and filled with ghost values. */
227 template<typename Type>
229 const Table &deref_table);
230
231 /** Extension of NCMesh::GetBoundaryClosure. Filters out ghost vertices and
232 ghost edges from 'bdr_vertices' and 'bdr_edges', and uncovers hidden internal
233 boundary faces. */
234 void GetBoundaryClosure(const Array<int> &bdr_attr_is_ess,
235 Array<int> &bdr_vertices,
236 Array<int> &bdr_edges, Array<int> &bdr_faces) override;
237
238 /// Save memory by releasing all non-essential and cached data.
239 void Trim() override;
240
241 /// Return total number of bytes allocated.
242 std::size_t MemoryUsage(bool with_base = true) const;
243
244 int PrintMemoryDetail(bool with_base = true) const;
245
246 /** Extract a debugging Mesh containing all leaf elements, including ghosts.
247 The debug mesh will have element attributes set to element rank + 1. */
248 void GetDebugMesh(Mesh &debug_mesh) const;
249
250protected: // interface for ParMesh
251
252 friend class ParMesh;
253
254 /** For compatibility with conforming code in ParMesh and ParFESpace.
255 Initializes shared structures in ParMesh: gtopo, shared_*, group_s*, s*_l*.
256 The ParMesh then acts as a parallel mesh cut along the NC interfaces. */
257 void GetConformingSharedStructures(class ParMesh &pmesh);
258
259 /** Populate face neighbor members of ParMesh from the ghost layer, without
260 communication. */
261 void GetFaceNeighbors(class ParMesh &pmesh);
262protected: // implementation
263
264 MPI_Comm MyComm;
266
267 using GroupList = std::vector<CommGroup>;
268 using GroupMap = std::map<CommGroup, GroupId>;
269
270 GroupList groups; // comm group list; NOTE: groups[0] = { MyRank }
271 GroupMap group_id; // search index over groups
272
273 // owner rank for each vertex, edge and face (encoded as singleton group)
275 // P matrix comm pattern groups for each vertex/edge/face (0/1/2)
277
278 // ParMesh-compatible (conforming) groups for each vertex/edge/face (0/1/2)
280 // ParMesh compatibility helper arrays to order groups, also temporary
282
283 // lists of vertices/edges/faces shared by us and at least one more processor
285
286 Array<char> face_orient; // see CalcFaceOrientations
287
288 /** Type of each leaf element:
289 1 - our element (rank == MyRank),
290 3 - our element, and neighbor to the ghost layer,
291 2 - ghost layer element (existing element, but rank != MyRank),
292 0 - element beyond the ghost layer, may not be a real element.
293 Note: indexed by Element::index. See also UpdateLayers(). */
295
296 Array<int> ghost_layer; ///< list of elements whose 'element_type' == 2.
297 Array<int> boundary_layer; ///< list of type 3 elements
298
299 void Update() override;
300
301 /// Return the processor number for a global element number.
302 int Partition(long index, long total_elements) const
303 { return index * NRanks / total_elements; }
304
305 /// Helper to get the partitioning when the serial mesh gets split initially
306 int InitialPartition(int index) const
307 { return Partition(index, leaf_elements.Size()); }
308
309 /// Return the global index of the first element owned by processor 'rank'.
310 long PartitionFirstIndex(int rank, long total_elements) const
311 { return (rank * total_elements + NRanks-1) / NRanks; }
312
313 void BuildFaceList() override;
314 void BuildEdgeList() override;
315 void BuildVertexList() override;
316
317 void ElementSharesFace(int elem, int local, int face) override;
318 void ElementSharesEdge(int elem, int local, int enode) override;
319 void ElementSharesVertex(int elem, int local, int vnode) override;
320
321 GroupId GetGroupId(const CommGroup &group);
322 GroupId GetSingletonGroup(int rank);
323
324 Array<int> tmp_owner; // temporary
327
328 void InitOwners(int num, Array<GroupId> &entity_owner);
329 void MakeSharedList(const NCList &list, NCList &shared);
330
331 void AddConnections(int entity, int index, const Array<int> &ranks);
333 void CreateGroups(int nentities, Array<Connection> &index_rank,
334 Array<GroupId> &entity_group);
335
336 static int get_face_orientation(const Face &face, const Element &e1,
337 const Element &e2,
338 int local[2] = NULL /* optional output */);
340
341 void UpdateLayers();
342
343 void MakeSharedTable(int ngroups, int ent, Array<int> &shared_local,
344 Table &group_shared, Array<char> *entity_geom = NULL,
345 char geom = 0);
346
347 /** Uniquely encodes a set of leaf elements in the refinement hierarchy of
348 an NCMesh. Can be dumped to a stream, sent to another processor, loaded,
349 and decoded to identify the same set of elements (refinements) in a
350 different but compatible NCMesh. The encoding can optionally include
351 the refinement types needed to reach the leaves, so the element set can
352 be decoded (recreated) even if the receiver has an incomplete tree. */
354 {
355 public:
358 ElementSet(const ElementSet &other);
359
360 void Encode(const Array<int> &elements);
361 void Dump(std::ostream &os) const;
362
363 void Load(std::istream &is);
364 void Decode(Array<int> &elements) const;
365
366 void SetNCMesh(NCMesh *ncmesh_) { this->ncmesh = ncmesh_; }
367 const NCMesh* GetNCMesh() const { return ncmesh; }
368
369 protected:
370 Array<unsigned char> data; ///< encoded refinement (sub-)trees
373
374 void EncodeTree(int elem);
375 void DecodeTree(int elem, int &pos, Array<int> &elements) const;
376
377 void WriteInt(int value);
378 int GetInt(int pos) const;
379 void FlagElements(const Array<int> &elements, char flag);
380
381#ifdef MFEM_DEBUG
383 std::string RefPath() const;
384#endif
385 };
386
387 /** Adjust some of the MeshIds before encoding for recipient 'rank', so that
388 they only reference elements that exist in the recipient's ref. tree. */
389 void AdjustMeshIds(Array<MeshId> ids[], int rank);
390
391 void ChangeVertexMeshIdElement(NCMesh::MeshId &id, int elem);
392 void ChangeEdgeMeshIdElement(NCMesh::MeshId &id, int elem);
393 void ChangeRemainingMeshIds(Array<MeshId> &ids, int pos,
394 const Array<Pair<int, int> > &find);
395
396 // Write/read a processor-independent encoding of vertex/edge/face IDs.
397 void EncodeMeshIds(std::ostream &os, Array<MeshId> ids[]);
398 void DecodeMeshIds(std::istream &is, Array<MeshId> ids[]);
399
400 // Write/read comm groups and a list of their IDs.
401 void EncodeGroups(std::ostream &os, const Array<GroupId> &ids);
402 void DecodeGroups(std::istream &is, Array<GroupId> &ids);
403
404 bool CheckElementType(int elem, int type);
405
406 Array<int> tmp_neighbors; // temporary, used by ElementNeighborProcessors
407
408 /** Return a list of processors that own elements in the immediate
409 neighborhood of 'elem' (i.e., vertex, edge and face neighbors),
410 and are not 'MyRank'. */
411 void ElementNeighborProcessors(int elem, Array<int> &ranks);
412
413 /** Get a list of ranks that own elements in the neighborhood of our region.
414 NOTE: MyRank is not included. */
415 void NeighborProcessors(Array<int> &neighbors);
416
417 /** Traverse the (local) refinement tree and determine which subtrees are
418 no longer needed, i.e., their leaves are not owned by us nor are they our
419 ghosts. These subtrees are then derefined. */
420 void Prune();
421
422 /// Internal. Recursive part of Prune().
423 bool PruneTree(int elem);
424
425
426 /** A base for internal messages used by Refine(), Derefine() and Rebalance().
427 * Allows sending values associated with elements in a set.
428 * If RefType == true, the element set is recreated on the receiving end.
429 */
430 template<class ValueType, bool RefTypes, int Tag>
431 class ElementValueMessage : public VarMessage<Tag>
432 {
433 public:
434 using VarMessage<Tag>::data;
435 std::vector<int> elements;
436 std::vector<ValueType> values;
437
438 int Size() const { return elements.size(); }
439 void Reserve(int size) { elements.reserve(size); values.reserve(size); }
440
441 void Add(int elem, ValueType val)
442 { elements.push_back(elem); values.push_back(val); }
443
444 /// Set pointer to ParNCMesh (needed to encode the message).
445 void SetNCMesh(ParNCMesh* pncmesh_) { this->pncmesh = pncmesh_; }
446
448
449 protected:
451
452 void Encode(int) override;
453 void Decode(int) override;
454 };
455
456 /** Used by ParNCMesh::Refine() to inform neighbors about refinements at
457 * the processor boundary. This keeps their ghost layers synchronized.
458 */
459 class NeighborRefinementMessage : public ElementValueMessage<char, false, 289>
460 {
461 public:
462 void AddRefinement(int elem, char ref_type) { Add(elem, ref_type); }
463 typedef std::map<int, NeighborRefinementMessage> Map;
464 };
465
466 /** Used by ParNCMesh::Derefine() to keep the ghost layers synchronized.
467 */
468 class NeighborDerefinementMessage : public ElementValueMessage<int, false, 290>
469 {
470 public:
471 void AddDerefinement(int elem, int rank) { Add(elem, rank); }
472 typedef std::map<int, NeighborDerefinementMessage> Map;
473 };
474
475 /** Used in Step 2 of Rebalance() to synchronize new rank assignments in
476 * the ghost layer.
477 */
478 class NeighborElementRankMessage : public ElementValueMessage<int, false, 156>
479 {
480 public:
481 void AddElementRank(int elem, int rank) { Add(elem, rank); }
482 typedef std::map<int, NeighborElementRankMessage> Map;
483 };
484
485 /** Used by Rebalance() to send elements and their ranks. Note that
486 * RefTypes == true which means the refinement hierarchy will be recreated
487 * on the receiving side.
488 */
489 class RebalanceMessage : public ElementValueMessage<int, true, 157>
490 {
491 public:
492 void AddElementRank(int elem, int rank) { Add(elem, rank); }
493 typedef std::map<int, RebalanceMessage> Map;
494 };
495
496 /** Allows migrating element data (DOFs) after Rebalance().
497 * Used by SendRebalanceDofs and RecvRebalanceDofs.
498 */
499 class RebalanceDofMessage : public VarMessage<158>
500 {
501 public:
502 std::vector<int> elem_ids, dofs;
504
505 void SetElements(const Array<int> &elems, NCMesh *ncmesh);
506 void SetNCMesh(NCMesh* ncmesh) { eset.SetNCMesh(ncmesh); }
507 std::size_t MemoryUsage() const;
508
509 typedef std::map<int, RebalanceDofMessage> Map;
510
511 protected:
513
514 void Encode(int) override;
515 void Decode(int) override;
516 };
517
518 /** Assign new Element::rank to leaf elements and send them to their new
519 owners, keeping the ghost layer up to date. Used by Rebalance() and
520 Derefine(). 'target_elements' is the number of elements this rank
521 is supposed to own after the exchange. If this number is not known
522 a priori, the parameter can be set to -1, but more expensive communication
523 (synchronous sends and a barrier) will be used in that case. */
524 void RedistributeElements(Array<int> &new_ranks, int target_elements,
525 bool record_comm);
526
527 /** Recorded communication pattern from last Rebalance. Used by
528 Send/RecvRebalanceDofs to ship element DOFs. */
531
532 /** After Rebalance, this array holds the old element indices, or -1 if an
533 element didn't exist in the mesh previously. After Derefine, it holds
534 the ranks of the old (potentially non-existent) fine elements. */
536
537 /// Stores modified point matrices created by GetFaceNeighbors
539 void ClearAuxPM();
540
541 std::size_t GroupsMemoryUsage() const;
542
543 friend class NeighborRowMessage;
544};
545
546
547
548// comparison operator so that MeshId can be used as key in std::map
549inline bool operator< (const NCMesh::MeshId &a, const NCMesh::MeshId &b)
550{
551 return a.index < b.index;
552}
553
554// equality of MeshId is based on 'index' (element/local are not unique)
555inline bool operator== (const NCMesh::MeshId &a, const NCMesh::MeshId &b)
556{
557 return a.index == b.index;
558}
559
560} // namespace mfem
561
562#endif // MFEM_USE_MPI
563
564#endif // MFEM_PNCMESH
int Size() const
Return the logical size of the array.
Definition array.hpp:144
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition fespace.hpp:220
Mesh data type.
Definition mesh.hpp:56
A class for non-conforming AMR. The class is not used directly by the user, rather it is an extension...
Definition ncmesh.hpp:123
friend class ParNCMesh
Definition ncmesh.hpp:1199
int NGhostElements
Definition ncmesh.hpp:602
int PrintMemoryDetail() const
Definition ncmesh.cpp:6392
BlockArray< Element > elements
Definition ncmesh.hpp:575
Array< int > leaf_elements
finest elements, in Mesh ordering (+ ghosts)
Definition ncmesh.hpp:604
int NGhostVertices
Definition ncmesh.hpp:602
const NCList & GetVertexList()
Definition ncmesh.hpp:313
const NCList & GetFaceList()
Return the current list of conforming and nonconforming faces.
Definition ncmesh.hpp:298
const NCList & GetEdgeList()
Return the current list of conforming and nonconforming edges.
Definition ncmesh.hpp:305
int MyRank
used in parallel, or when loading a parallel file in serial
Definition ncmesh.hpp:483
int NGhostEdges
Definition ncmesh.hpp:602
long MemoryUsage() const
Return total number of bytes allocated.
Definition ncmesh.cpp:6369
int NGhostFaces
Definition ncmesh.hpp:602
A pair of objects.
Class for parallel meshes.
Definition pmesh.hpp:34
void DecodeTree(int elem, int &pos, Array< int > &elements) const
Definition pncmesh.cpp:2405
Array< unsigned char > data
encoded refinement (sub-)trees
Definition pncmesh.hpp:370
const NCMesh * GetNCMesh() const
Definition pncmesh.hpp:367
void Encode(const Array< int > &elements)
Definition pncmesh.cpp:2366
ElementSet(NCMesh *ncmesh=NULL, bool include_ref_types=false)
Definition pncmesh.hpp:356
int GetInt(int pos) const
Definition pncmesh.cpp:2305
void Decode(Array< int > &elements) const
Definition pncmesh.cpp:2447
void FlagElements(const Array< int > &elements, char flag)
Definition pncmesh.cpp:2314
std::string RefPath() const
Definition pncmesh.cpp:2387
void Load(std::istream &is)
Definition pncmesh.cpp:2463
void Dump(std::ostream &os) const
Definition pncmesh.cpp:2457
void SetNCMesh(NCMesh *ncmesh_)
Definition pncmesh.hpp:366
std::vector< ValueType > values
Definition pncmesh.hpp:436
void Add(int elem, ValueType val)
Definition pncmesh.hpp:441
void SetNCMesh(ParNCMesh *pncmesh_)
Set pointer to ParNCMesh (needed to encode the message).
Definition pncmesh.hpp:445
std::map< int, NeighborDerefinementMessage > Map
Definition pncmesh.hpp:472
void AddDerefinement(int elem, int rank)
Definition pncmesh.hpp:471
void AddElementRank(int elem, int rank)
Definition pncmesh.hpp:481
std::map< int, NeighborElementRankMessage > Map
Definition pncmesh.hpp:482
void AddRefinement(int elem, char ref_type)
Definition pncmesh.hpp:462
std::map< int, NeighborRefinementMessage > Map
Definition pncmesh.hpp:463
void SetElements(const Array< int > &elems, NCMesh *ncmesh)
Definition pncmesh.cpp:2852
std::map< int, RebalanceDofMessage > Map
Definition pncmesh.hpp:509
std::map< int, RebalanceMessage > Map
Definition pncmesh.hpp:493
void AddElementRank(int elem, int rank)
Definition pncmesh.hpp:492
A parallel extension of the NCMesh class.
Definition pncmesh.hpp:65
Array< int > entity_elem_local[3]
Definition pncmesh.hpp:281
void SendRebalanceDofs(int old_ndofs, const Table &old_element_dofs, long old_global_offset, FiniteElementSpace *space)
Use the communication pattern from last Rebalance() to send element DOFs.
Definition pncmesh.cpp:2218
void MakeSharedTable(int ngroups, int ent, Array< int > &shared_local, Table &group_shared, Array< char > *entity_geom=NULL, char geom=0)
Definition pncmesh.cpp:767
Array< int > tmp_neighbors
Definition pncmesh.hpp:406
bool IsGhost(int entity, int index) const
Return true if the specified vertex/edge/face is a ghost.
Definition pncmesh.hpp:182
NCList shared_edges
Definition pncmesh.hpp:284
int GetFaceOrientation(int index) const
Return (shared) face orientation relative to its owner element.
Definition pncmesh.hpp:137
Array< Connection > entity_index_rank[3]
Definition pncmesh.hpp:326
GroupMap group_id
Definition pncmesh.hpp:271
std::map< CommGroup, GroupId > GroupMap
Definition pncmesh.hpp:268
GroupId GetEntityGroupId(int entity, int index)
Definition pncmesh.hpp:160
int GetNGhostEdges() const
Definition pncmesh.hpp:115
RebalanceDofMessage::Map send_rebalance_dofs
Definition pncmesh.hpp:529
void CalcFaceOrientations()
Definition pncmesh.cpp:572
const Array< int > & GetDerefineOldRanks() const
Definition pncmesh.hpp:223
void DecodeGroups(std::istream &is, Array< GroupId > &ids)
Definition pncmesh.cpp:2752
bool PruneTree(int elem)
Internal. Recursive part of Prune().
Definition pncmesh.cpp:1370
bool CheckElementType(int elem, int type)
Definition pncmesh.cpp:701
const CommGroup & GetGroup(GroupId id) const
Return a list of ranks contained in the group of the given ID.
Definition pncmesh.hpp:172
void Trim() override
Save memory by releasing all non-essential and cached data.
Definition pncmesh.cpp:2933
void BuildVertexList() override
Definition pncmesh.cpp:274
Array< int > ghost_layer
list of elements whose 'element_type' == 2.
Definition pncmesh.hpp:296
void BuildFaceList() override
Definition pncmesh.cpp:146
void GetFaceNeighbors(class ParMesh &pmesh)
Definition pncmesh.cpp:928
int GetNGhostFaces() const
Definition pncmesh.hpp:116
void LimitNCLevel(int max_nc_level) override
Parallel version of NCMesh::LimitNCLevel.
Definition pncmesh.cpp:1519
RebalanceDofMessage::Map recv_rebalance_dofs
Definition pncmesh.hpp:530
void ChangeVertexMeshIdElement(NCMesh::MeshId &id, int elem)
Definition pncmesh.cpp:2554
void UpdateLayers()
Definition pncmesh.cpp:663
void EncodeGroups(std::ostream &os, const Array< GroupId > &ids)
Definition pncmesh.cpp:2710
virtual ~ParNCMesh()
Definition pncmesh.cpp:88
void Refine(const Array< Refinement > &refinements) override
Definition pncmesh.cpp:1441
int ElementRank(int index) const
Definition pncmesh.hpp:200
Array< GroupId > entity_conf_group[3]
Definition pncmesh.hpp:279
Array< int > boundary_layer
list of type 3 elements
Definition pncmesh.hpp:297
int Partition(long index, long total_elements) const
Return the processor number for a global element number.
Definition pncmesh.hpp:302
void AdjustMeshIds(Array< MeshId > ids[], int rank)
Definition pncmesh.cpp:2472
NCList shared_vertices
Definition pncmesh.hpp:284
std::size_t GroupsMemoryUsage() const
Definition pncmesh.cpp:2974
const NCList & GetSharedVertices()
Definition pncmesh.hpp:121
void ChangeEdgeMeshIdElement(NCMesh::MeshId &id, int elem)
Definition pncmesh.cpp:2572
void GetConformingSharedStructures(class ParMesh &pmesh)
Definition pncmesh.cpp:827
void Derefine(const Array< int > &derefs) override
Definition pncmesh.cpp:1568
void Rebalance(const Array< int > *custom_partition=NULL)
Definition pncmesh.cpp:1880
int GetNGhostElements() const override
Definition pncmesh.hpp:117
void ElementNeighborProcessors(int elem, Array< int > &ranks)
Definition pncmesh.cpp:718
void RecvRebalanceDofs(Array< int > &elements, Array< long > &dofs)
Receive element DOFs sent by SendRebalanceDofs().
Definition pncmesh.cpp:2251
static int get_face_orientation(const Face &face, const Element &e1, const Element &e2, int local[2]=NULL)
Definition pncmesh.cpp:542
void GetFineToCoarsePartitioning(const Array< int > &derefs, Array< int > &new_ranks) const
Definition pncmesh.cpp:1537
void ElementSharesFace(int elem, int local, int face) override
Definition pncmesh.cpp:123
void BuildEdgeList() override
Definition pncmesh.cpp:213
Array< char > tmp_shared_flag
Definition pncmesh.hpp:325
NCList shared_faces
Definition pncmesh.hpp:284
Array< int > old_index_or_rank
Definition pncmesh.hpp:535
MPI_Comm MyComm
Definition pncmesh.hpp:264
std::vector< int > CommGroup
Definition pncmesh.hpp:143
void DecodeMeshIds(std::istream &is, Array< MeshId > ids[])
Definition pncmesh.cpp:2653
void GetBoundaryClosure(const Array< int > &bdr_attr_is_ess, Array< int > &bdr_vertices, Array< int > &bdr_edges, Array< int > &bdr_faces) override
Definition pncmesh.cpp:598
void EncodeMeshIds(std::ostream &os, Array< MeshId > ids[])
Definition pncmesh.cpp:2610
Array< DenseMatrix * > aux_pm_store
Stores modified point matrices created by GetFaceNeighbors.
Definition pncmesh.hpp:538
void CheckDerefinementNCLevel(const Table &deref_table, Array< int > &level_ok, int max_nc_level) override
Definition pncmesh.cpp:1822
void RedistributeElements(Array< int > &new_ranks, int target_elements, bool record_comm)
Definition pncmesh.cpp:1941
const NCList & GetSharedList(int entity)
Helper to get shared vertices/edges/faces ('entity' == 0/1/2 resp.).
Definition pncmesh.hpp:126
Array< int > tmp_owner
Definition pncmesh.hpp:324
int GetMyRank() const
Definition pncmesh.hpp:208
int GetNElements() const
Definition pncmesh.hpp:112
GroupId GetSingletonGroup(int rank)
Definition pncmesh.cpp:412
void ChangeRemainingMeshIds(Array< MeshId > &ids, int pos, const Array< Pair< int, int > > &find)
Definition pncmesh.cpp:2598
Array< char > face_orient
Definition pncmesh.hpp:286
GroupId GetEntityOwnerId(int entity, int index)
Return vertex/edge/face ('entity' == 0/1/2, resp.) owner.
Definition pncmesh.hpp:146
Array< char > element_type
Definition pncmesh.hpp:294
void InitOwners(int num, Array< GroupId > &entity_owner)
Definition pncmesh.cpp:306
int GetNGhostVertices() const
Definition pncmesh.hpp:114
GroupList groups
Definition pncmesh.hpp:270
Array< GroupId > entity_owner[3]
Definition pncmesh.hpp:274
void CalculatePMatrixGroups()
Definition pncmesh.cpp:470
void ElementSharesEdge(int elem, int local, int enode) override
Definition pncmesh.cpp:188
const NCList & GetSharedEdges()
Definition pncmesh.hpp:122
void GetDebugMesh(Mesh &debug_mesh) const
Definition pncmesh.cpp:2916
void Update() override
Definition pncmesh.cpp:93
std::vector< CommGroup > GroupList
Definition pncmesh.hpp:267
bool GroupContains(GroupId id, int rank) const
Return true if group 'id' contains the given rank.
Definition pncmesh.cpp:421
const NCList & GetSharedFaces()
Definition pncmesh.hpp:123
const Array< int > & GetRebalanceOldIndex() const
Definition pncmesh.hpp:219
Array< GroupId > entity_pmat_group[3]
Definition pncmesh.hpp:276
void MakeSharedList(const NCList &list, NCList &shared)
Definition pncmesh.cpp:316
void AddConnections(int entity, int index, const Array< int > &ranks)
Definition pncmesh.cpp:462
int InitialPartition(int index) const
Helper to get the partitioning when the serial mesh gets split initially.
Definition pncmesh.hpp:306
void NeighborProcessors(Array< int > &neighbors)
Definition pncmesh.cpp:750
void CreateGroups(int nentities, Array< Connection > &index_rank, Array< GroupId > &entity_group)
Definition pncmesh.cpp:432
void SynchronizeDerefinementData(Array< Type > &elem_data, const Table &deref_table)
Definition pncmesh.cpp:1740
GroupId GetGroupId(const CommGroup &group)
Definition pncmesh.cpp:396
long PartitionFirstIndex(int rank, long total_elements) const
Return the global index of the first element owned by processor 'rank'.
Definition pncmesh.hpp:310
void ElementSharesVertex(int elem, int local, int vnode) override
Definition pncmesh.cpp:251
int index(int i, int j, int nx, int ny)
Definition life.cpp:235
real_t b
Definition lissajous.cpp:42
real_t a
Definition lissajous.cpp:41
string space
bool operator==(const Array< T > &LHS, const Array< T > &RHS)
Definition array.hpp:342
bool operator<(const Pair< A, B > &p, const Pair< A, B > &q)
Comparison operator for class Pair, based on the first element only.
Identifies a vertex/edge/face in both Mesh and NCMesh.
Definition ncmesh.hpp:189
Lists all edges/faces in the nonconforming mesh.
Definition ncmesh.hpp:230
Variable-length MPI message containing unspecific binary data.