MFEM  v4.4.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
pmesh.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, 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_PMESH
13 #define MFEM_PMESH
14 
15 #include "../config/config.hpp"
16 
17 #ifdef MFEM_USE_MPI
18 
19 #include "../general/communication.hpp"
20 #include "../general/globals.hpp"
21 #include "mesh.hpp"
22 #include "pncmesh.hpp"
23 #include <iostream>
24 
25 namespace mfem
26 {
27 #ifdef MFEM_USE_PUMI
28 class ParPumiMesh;
29 #endif
30 
31 /// Class for parallel meshes
32 class ParMesh : public Mesh
33 {
34 protected:
35  MPI_Comm MyComm;
36  int NRanks, MyRank;
37 
38  struct Vert3
39  {
40  int v[3];
41  Vert3() = default;
42  Vert3(int v0, int v1, int v2) { v[0] = v0; v[1] = v1; v[2] = v2; }
43  void Set(int v0, int v1, int v2) { v[0] = v0; v[1] = v1; v[2] = v2; }
44  void Set(const int *w) { v[0] = w[0]; v[1] = w[1]; v[2] = w[2]; }
45  };
46 
47  struct Vert4
48  {
49  int v[4];
50  Vert4() = default;
51  Vert4(int v0, int v1, int v2, int v3)
52  { v[0] = v0; v[1] = v1; v[2] = v2; v[3] = v3; }
53  void Set(int v0, int v1, int v2, int v3)
54  { v[0] = v0; v[1] = v1; v[2] = v2; v[3] = v3; }
55  void Set(const int *w)
56  { v[0] = w[0]; v[1] = w[1]; v[2] = w[2]; v[3] = w[3]; }
57  };
58 
60  // shared face id 'i' is:
61  // * triangle id 'i', if i < shared_trias.Size()
62  // * quad id 'i-shared_trias.Size()', otherwise
65 
66  /// Shared objects in each group.
69  Table group_stria; // contains shared triangle indices
70  Table group_squad; // contains shared quadrilateral indices
71 
72  /// Shared to local index mapping.
75  // sface ids: all triangles first, then all quads
77 
79  Table face_nbr_el_ori; // orientations for each face (from nbr processor)
80 
82 
83  // glob_elem_offset + local element number defines a global element numbering
85  void ComputeGlobalElementOffset() const;
86 
87  /// Create from a nonconforming mesh.
88  ParMesh(const ParNCMesh &pncmesh);
89 
90  // Convert the local 'meshgen' to a global one.
91  void ReduceMeshGen();
92 
93  // Determine sedge_ledge and sface_lface.
94  void FinalizeParTopo();
95 
96  // Mark all tets to ensure consistency across MPI tasks; also mark the
97  // shared and boundary triangle faces using the consistently marked tets.
98  void MarkTetMeshForRefinement(DSTable &v_to_v) override;
99 
100  /// Return a number(0-1) identifying how the given edge has been split
101  int GetEdgeSplittings(Element *edge, const DSTable &v_to_v, int *middle);
102  /// Append codes identifying how the given face has been split to @a codes
103  void GetFaceSplittings(const int *fv, const HashTable<Hashed2> &v_to_v,
104  Array<unsigned> &codes);
105 
106  bool DecodeFaceSplittings(HashTable<Hashed2> &v_to_v, const int *v,
107  const Array<unsigned> &codes, int &pos);
108 
109  STable3D *GetFaceNbrElementToFaceTable(int ret_ftbl = 0);
110 
112  int i, IsoparametricTransformation *ElTr);
113 
115  FaceElementTransformations* FETr, Element::Type face_type,
116  Geometry::Type face_geom);
117 
118  /// Update the groups after triangle refinement
119  void RefineGroups(const DSTable &v_to_v, int *middle);
120 
121  /// Update the groups after tetrahedron refinement
122  void RefineGroups(int old_nv, const HashTable<Hashed2> &v_to_v);
123 
124  void UniformRefineGroups2D(int old_nv);
125 
126  // f2qf can be NULL if all faces are quads or there are no quad faces
127  void UniformRefineGroups3D(int old_nv, int old_nedges,
128  const DSTable &old_v_to_v,
129  const STable3D &old_faces,
130  Array<int> *f2qf);
131 
132  void ExchangeFaceNbrData(Table *gr_sface, int *s2l_face);
133 
134  /// Refine a mixed 2D mesh uniformly.
135  void UniformRefinement2D() override;
136 
137  /// Refine a mixed 3D mesh uniformly.
138  void UniformRefinement3D() override;
139 
140  void NURBSUniformRefinement() override;
141 
142  /// This function is not public anymore. Use GeneralRefinement instead.
143  void LocalRefinement(const Array<int> &marked_el, int type = 3) override;
144 
145  /// This function is not public anymore. Use GeneralRefinement instead.
146  void NonconformingRefinement(const Array<Refinement> &refinements,
147  int nc_limit = 0) override;
148 
149  bool NonconformingDerefinement(Array<double> &elem_error,
150  double threshold, int nc_limit = 0,
151  int op = 1) override;
152 
153  void RebalanceImpl(const Array<int> *partition);
154 
155  void DeleteFaceNbrData();
156 
157  bool WantSkipSharedMaster(const NCMesh::Master &master) const;
158 
159  /// Fills out partitioned Mesh::vertices
160  int BuildLocalVertices(const Mesh& global_mesh, const int *partitioning,
161  Array<int> &vert_global_local);
162 
163  /// Fills out partitioned Mesh::elements
164  int BuildLocalElements(const Mesh& global_mesh, const int *partitioning,
165  const Array<int> &vert_global_local);
166 
167  /// Fills out partitioned Mesh::boundary
168  int BuildLocalBoundary(const Mesh& global_mesh, const int *partitioning,
169  const Array<int> &vert_global_local,
170  Array<bool>& activeBdrElem,
171  Table* &edge_element);
172 
173  void FindSharedFaces(const Mesh &mesh, const int* partition,
174  Array<int>& face_group,
175  ListOfIntegerSets& groups);
176 
177  int FindSharedEdges(const Mesh &mesh, const int* partition,
178  Table* &edge_element, ListOfIntegerSets& groups);
179 
180  int FindSharedVertices(const int *partition, Table* vertex_element,
181  ListOfIntegerSets& groups);
182 
183  void BuildFaceGroup(int ngroups, const Mesh &mesh,
184  const Array<int>& face_group,
185  int &nstria, int &nsquad);
186 
187  void BuildEdgeGroup(int ngroups, const Table& edge_element);
188 
189  void BuildVertexGroup(int ngroups, const Table& vert_element);
190 
191  void BuildSharedFaceElems(int ntri_faces, int nquad_faces,
192  const Mesh &mesh, int *partitioning,
193  const STable3D *faces_tbl,
194  const Array<int> &face_group,
195  const Array<int> &vert_global_local);
196 
197  void BuildSharedEdgeElems(int nedges, Mesh &mesh,
198  const Array<int> &vert_global_local,
199  const Table *edge_element);
200 
201  void BuildSharedVertMapping(int nvert, const Table* vert_element,
202  const Array<int> &vert_global_local);
203 
204  // Similar to Mesh::GetFacesTable()
206 
207  /// Ensure that bdr_attributes and attributes agree across processors
208  void DistributeAttributes(Array<int> &attr);
209 
210  void LoadSharedEntities(std::istream &input);
211 
212  /// If the mesh is curved, make sure 'Nodes' is ParGridFunction.
213  /** Note that this method is not related to the public 'Mesh::EnsureNodes`.*/
214  void EnsureParNodes();
215 
216  /// Internal function used in ParMesh::MakeRefined (and related constructor)
217  void MakeRefined_(ParMesh &orig_mesh, int ref_factor, int ref_type);
218 
219  // Mark Mesh::Swap as protected, should use ParMesh::Swap to swap @a ParMesh
220  // objects.
221  using Mesh::Swap;
222 
223  void Destroy();
224 
225 public:
226  /// Default constructor. Create an empty @a ParMesh.
229  have_face_nbr_data(false), pncmesh(NULL) { }
230 
231  /// Create a parallel mesh by partitioning a serial Mesh.
232  /** The mesh is partitioned automatically or using external partitioning
233  data (the optional parameter 'partitioning_[i]' contains the desired MPI
234  rank for element 'i'). Automatic partitioning uses METIS for conforming
235  meshes and quick space-filling curve equipartitioning for nonconforming
236  meshes (elements of nonconforming meshes should ideally be ordered as a
237  sequence of face-neighbors). */
238  ParMesh(MPI_Comm comm, Mesh &mesh, int *partitioning_ = NULL,
239  int part_method = 1);
240 
241  /** Copy constructor. Performs a deep copy of (almost) all data, so that the
242  source mesh can be modified (e.g. deleted, refined) without affecting the
243  new mesh. If 'copy_nodes' is false, use a shallow (pointer) copy for the
244  nodes, if present. */
245  explicit ParMesh(const ParMesh &pmesh, bool copy_nodes = true);
246 
247  /// Read a parallel mesh, each MPI rank from its own file/stream.
248  /** The @a refine parameter is passed to the method Mesh::Finalize(). */
249  ParMesh(MPI_Comm comm, std::istream &input, bool refine = true);
250 
251  /// Deprecated: see @a ParMesh::MakeRefined
252  MFEM_DEPRECATED
253  ParMesh(ParMesh *orig_mesh, int ref_factor, int ref_type);
254 
255  /// Move constructor. Used for named constructors.
256  ParMesh(ParMesh &&mesh);
257 
258  /// Move assignment operator.
259  ParMesh& operator=(ParMesh &&mesh);
260 
261  /// Explicitly delete the copy assignment operator.
262  ParMesh& operator=(const ParMesh &mesh) = delete;
263 
264  /// Create a uniformly refined (by any factor) version of @a orig_mesh.
265  /** @param[in] orig_mesh The starting coarse mesh.
266  @param[in] ref_factor The refinement factor, an integer > 1.
267  @param[in] ref_type Specify the positions of the new vertices. The
268  options are BasisType::ClosedUniform or
269  BasisType::GaussLobatto.
270 
271  The refinement data which can be accessed with GetRefinementTransforms()
272  is set to reflect the performed refinements.
273 
274  @note The constructed ParMesh is linear, i.e. it does not have nodes. */
275  static ParMesh MakeRefined(ParMesh &orig_mesh, int ref_factor, int ref_type);
276 
277  /** Create a mesh by splitting each element of @a orig_mesh into simplices.
278  See @a Mesh::MakeSimplicial for more details. */
279  static ParMesh MakeSimplicial(ParMesh &orig_mesh);
280 
281  void Finalize(bool refine = false, bool fix_orientation = false) override;
282 
283  void SetAttributes() override;
284 
285  /// Checks if any rank in the mesh has boundary elements
286  bool HasBoundaryElements() const override;
287 
288  MPI_Comm GetComm() const { return MyComm; }
289  int GetNRanks() const { return NRanks; }
290  int GetMyRank() const { return MyRank; }
291 
292  /** Map a global element number to a local element number. If the global
293  element is not on this processor, return -1. */
294  int GetLocalElementNum(long global_element_num) const;
295 
296  /// Map a local element number to a global element number.
297  long GetGlobalElementNum(int local_element_num) const;
298 
299  /** The following functions define global indices for all local vertices,
300  edges, faces, or elements. The global indices have no meaning or
301  significance for ParMesh, but can be used for purposes beyond this class.
302  */
303  /// AMR meshes are not supported.
305  /// AMR meshes are not supported.
307  /// AMR meshes are not supported.
309  /// AMR meshes are supported.
311 
313 
314  // Face-neighbor elements and vertices
321  // Local face-neighbor elements and vertices ordered by face-neighbor
324 
326 
327  int GetNGroups() const { return gtopo.NGroups(); }
328 
329  ///@{ @name These methods require group > 0
330  int GroupNVertices(int group) { return group_svert.RowSize(group-1); }
331  int GroupNEdges(int group) { return group_sedge.RowSize(group-1); }
332  int GroupNTriangles(int group) { return group_stria.RowSize(group-1); }
333  int GroupNQuadrilaterals(int group) { return group_squad.RowSize(group-1); }
334 
335  int GroupVertex(int group, int i)
336  { return svert_lvert[group_svert.GetRow(group-1)[i]]; }
337  void GroupEdge(int group, int i, int &edge, int &o);
338  void GroupTriangle(int group, int i, int &face, int &o);
339  void GroupQuadrilateral(int group, int i, int &face, int &o);
340  ///@}
341 
342  void GenerateOffsets(int N, HYPRE_BigInt loc_sizes[],
343  Array<HYPRE_BigInt> *offsets[]) const;
344 
345  void ExchangeFaceNbrData();
346  void ExchangeFaceNbrNodes();
347 
348  void SetCurvature(int order, bool discont = false, int space_dim = -1,
349  int ordering = 1) override;
350 
351  int GetNFaceNeighbors() const { return face_nbr_group.Size(); }
352  int GetNFaceNeighborElements() const { return face_nbr_elements.Size(); }
353  int GetFaceNbrGroup(int fn) const { return face_nbr_group[fn]; }
354  int GetFaceNbrRank(int fn) const;
355 
356  /** Similar to Mesh::GetElementFaces */
357  void GetFaceNbrElementFaces(int i, Array<int> &fcs, Array<int> &cor) const;
358 
359  /** Similar to Mesh::GetFaceToElementTable with added face-neighbor elements
360  with indices offset by the local number of elements. */
362 
363  /// Returns (a pointer to an object containing) the following data:
364  ///
365  /// 1) Elem1No - the index of the first element that contains this face this
366  /// is the element that has the same outward unit normal vector as the
367  /// face;
368  ///
369  /// 2) Elem2No - the index of the second element that contains this face this
370  /// element has outward unit normal vector as the face multiplied with -1;
371  ///
372  /// 3) Elem1, Elem2 - pointers to the ElementTransformation's of the first
373  /// and the second element respectively;
374  ///
375  /// 4) Face - pointer to the ElementTransformation of the face;
376  ///
377  /// 5) Loc1, Loc2 - IntegrationPointTransformation's mapping the face
378  /// coordinate system to the element coordinate system (both in their
379  /// reference elements). Used to transform IntegrationPoints from face to
380  /// element. More formally, let:
381  /// TL1, TL2 be the transformations represented by Loc1, Loc2,
382  /// TE1, TE2 - the transformations represented by Elem1, Elem2,
383  /// TF - the transformation represented by Face, then
384  /// TF(x) = TE1(TL1(x)) = TE2(TL2(x)) for all x in the reference face.
385  ///
386  /// 6) FaceGeom - the base geometry for the face.
387  ///
388  /// The mask specifies which fields in the structure to return:
389  /// mask & 1 - Elem1, mask & 2 - Elem2
390  /// mask & 4 - Loc1, mask & 8 - Loc2, mask & 16 - Face.
391  /// These mask values are defined in the ConfigMasks enum type as part of the
392  /// FaceElementTransformations class in fem/eltrans.hpp.
394  int FaceNo,
395  int mask = 31) override;
396 
397  /** Get the FaceElementTransformations for the given shared face (edge 2D)
398  using the shared face index @a sf. @a fill2 specify if the information
399  for elem2 of the face should be computed or not.
400  In the returned object, 1 and 2 refer to the local and the neighbor
401  elements, respectively. */
403  GetSharedFaceTransformations(int sf, bool fill2 = true);
404 
405  /** Get the FaceElementTransformations for the given shared face (edge 2D)
406  using the face index @a FaceNo. @a fill2 specify if the information
407  for elem2 of the face should be computed or not.
408  In the returned object, 1 and 2 refer to the local and the neighbor
409  elements, respectively. */
411  GetSharedFaceTransformationsByLocalIndex(int FaceNo, bool fill2 = true);
412 
415  {
417 
418  return &FaceNbrTransformation;
419  }
420 
421  /// Get the size of the i-th face neighbor element relative to the reference
422  /// element.
423  double GetFaceNbrElementSize(int i, int type=0);
424 
425  /// Return the number of shared faces (3D), edges (2D), vertices (1D)
426  int GetNSharedFaces() const;
427 
428  /// Return the local face index for the given shared face.
429  int GetSharedFace(int sface) const;
430 
431  /** @brief Returns the number of local faces according to the requested type,
432  does not count master non-conforming faces.
433 
434  If type==Boundary returns only the number of true boundary faces
435  contrary to GetNBE() that returns all "boundary" elements which may
436  include actual interior faces.
437  Similarly, if type==Interior, only the true interior faces (including
438  shared faces) are counted excluding all master non-conforming faces. */
439  int GetNFbyType(FaceType type) const override;
440 
441  /// See the remarks for the serial version in mesh.hpp
442  MFEM_DEPRECATED void ReorientTetMesh() override;
443 
444  /// Utility function: sum integers from all processors (Allreduce).
445  long ReduceInt(int value) const override;
446 
447  /** Load balance the mesh by equipartitioning the global space-filling
448  sequence of elements. Works for nonconforming meshes only. */
449  void Rebalance();
450 
451  /** Load balance a nonconforming mesh using a user-defined partition.
452  Each local element 'i' is migrated to processor rank 'partition[i]',
453  for 0 <= i < GetNE(). */
454  void Rebalance(const Array<int> &partition);
455 
456  /// Save the mesh in a parallel mesh format.
457  void ParPrint(std::ostream &out) const;
458 
459  /** Print the part of the mesh in the calling processor adding the interface
460  as boundary (for visualization purposes) using the mfem v1.0 format. */
461  void Print(std::ostream &out = mfem::out) const override;
462 
463  /// Save the ParMesh to files (one for each MPI rank). The files will be
464  /// given suffixes according to the MPI rank. The mesh will be written to the
465  /// files using ParMesh::Print. The given @a precision will be used for ASCII
466  /// output.
467  void Save(const char *fname, int precision=16) const override;
468 
469 #ifdef MFEM_USE_ADIOS2
470  /** Print the part of the mesh in the calling processor using adios2 bp
471  format. */
472  void Print(adios2stream &out) const override;
473 #endif
474 
475  /** Print the part of the mesh in the calling processor adding the interface
476  as boundary (for visualization purposes) using Netgen/Truegrid format .*/
477  void PrintXG(std::ostream &out = mfem::out) const override;
478 
479  /** Write the mesh to the stream 'out' on Process 0 in a form suitable for
480  visualization: the mesh is written as a disjoint mesh and the shared
481  boundary is added to the actual boundary; both the element and boundary
482  attributes are set to the processor number. */
483  void PrintAsOne(std::ostream &out = mfem::out) const;
484 
485  /// Save the mesh as a single file (using ParMesh::PrintAsOne). The given
486  /// @a precision is used for ASCII output.
487  void SaveAsOne(const char *fname, int precision=16) const;
488 
489  /// Old mesh format (Netgen/Truegrid) version of 'PrintAsOne'
490  void PrintAsOneXG(std::ostream &out = mfem::out);
491 
492  /** Print the mesh in parallel PVTU format. The PVTU and VTU files will be
493  stored in the directory specified by @a pathname. If the directory does
494  not exist, it will be created. */
495  void PrintVTU(std::string pathname,
497  bool high_order_output=false,
498  int compression_level=0,
499  bool bdr=false) override;
500 
501  /// Parallel version of Mesh::Load().
502  void Load(std::istream &input, int generate_edges = 0,
503  int refine = 1, bool fix_orientation = true) override;
504 
505  /// Returns the minimum and maximum corners of the mesh bounding box. For
506  /// high-order meshes, the geometry is refined first "ref" times.
507  void GetBoundingBox(Vector &p_min, Vector &p_max, int ref = 2);
508 
509  void GetCharacteristics(double &h_min, double &h_max,
510  double &kappa_min, double &kappa_max);
511 
512  /// Swaps internal data with another ParMesh, including non-geometry members.
513  /// See @a Mesh::Swap
514  void Swap(ParMesh &other);
515 
516  /// Print various parallel mesh stats
517  void PrintInfo(std::ostream &out = mfem::out) override;
518 
519  int FindPoints(DenseMatrix& point_mat, Array<int>& elem_ids,
520  Array<IntegrationPoint>& ips, bool warn = true,
521  InverseElementTransformation *inv_trans = NULL) override;
522 
523  /// Debugging method
524  void PrintSharedEntities(const char *fname_prefix) const;
525 
526  virtual ~ParMesh();
527 
528  friend class ParNCMesh;
529 #ifdef MFEM_USE_PUMI
530  friend class ParPumiMesh;
531 #endif
532 #ifdef MFEM_USE_ADIOS2
533  friend class adios2stream;
534 #endif
535 };
536 
537 }
538 
539 #endif // MFEM_USE_MPI
540 
541 #endif
void UniformRefinement3D() override
Refine a mixed 3D mesh uniformly.
Definition: pmesh.cpp:4432
int GetNFaceNeighbors() const
Definition: pmesh.hpp:351
void PrintAsOneXG(std::ostream &out=mfem::out)
Old mesh format (Netgen/Truegrid) version of &#39;PrintAsOne&#39;.
Definition: pmesh.cpp:5149
int Size() const
Return the logical size of the array.
Definition: array.hpp:138
void GetGhostFaceTransformation(FaceElementTransformations *FETr, Element::Type face_type, Geometry::Type face_geom)
Definition: pmesh.cpp:2861
void GetGlobalFaceIndices(Array< HYPRE_BigInt > &gi) const
AMR meshes are not supported.
Definition: pmesh.cpp:6152
virtual ~ParMesh()
Definition: pmesh.cpp:6249
void LoadSharedEntities(std::istream &input)
Definition: pmesh.cpp:977
long glob_offset_sequence
Definition: pmesh.hpp:84
void UniformRefineGroups2D(int old_nv)
Definition: pmesh.cpp:4208
FaceElementTransformations * GetSharedFaceTransformationsByLocalIndex(int FaceNo, bool fill2=true)
Definition: pmesh.cpp:2917
int NRanks
Definition: pmesh.hpp:36
ParMesh & operator=(ParMesh &&mesh)
Move assignment operator.
Definition: pmesh.cpp:101
void MakeRefined_(ParMesh &orig_mesh, int ref_factor, int ref_type)
Internal function used in ParMesh::MakeRefined (and related constructor)
Definition: pmesh.cpp:1131
int FindSharedVertices(const int *partition, Table *vertex_element, ListOfIntegerSets &groups)
Definition: pmesh.cpp:585
ElementTransformation * GetFaceNbrElementTransformation(int i)
Definition: pmesh.hpp:414
void PrintInfo(std::ostream &out=mfem::out) override
Print various parallel mesh stats.
Definition: pmesh.cpp:5708
void Set(const int *w)
Definition: pmesh.hpp:55
static ParMesh MakeRefined(ParMesh &orig_mesh, int ref_factor, int ref_type)
Create a uniformly refined (by any factor) version of orig_mesh.
Definition: pmesh.cpp:1366
int BuildLocalVertices(const Mesh &global_mesh, const int *partitioning, Array< int > &vert_global_local)
Fills out partitioned Mesh::vertices.
Definition: pmesh.cpp:302
int GetNGroups() const
Definition: pmesh.hpp:327
void UniformRefinement2D() override
Refine a mixed 2D mesh uniformly.
Definition: pmesh.cpp:4408
Array< Element * > face_nbr_elements
Definition: pmesh.hpp:319
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
Definition: pmesh.cpp:3025
Array< int > sface_lface
Definition: pmesh.hpp:76
void BuildSharedFaceElems(int ntri_faces, int nquad_faces, const Mesh &mesh, int *partitioning, const STable3D *faces_tbl, const Array< int > &face_group, const Array< int > &vert_global_local)
Definition: pmesh.cpp:720
A specialized ElementTransformation class representing a face and its two neighboring elements...
Definition: eltrans.hpp:480
Data type dense matrix using column-major storage.
Definition: densemat.hpp:23
void GetRow(int i, Array< int > &row) const
Return row i in array row (the Table must be finalized)
Definition: table.cpp:187
void GetCharacteristics(double &h_min, double &h_max, double &kappa_min, double &kappa_max)
Definition: pmesh.cpp:5695
void NonconformingRefinement(const Array< Refinement > &refinements, int nc_limit=0) override
This function is not public anymore. Use GeneralRefinement instead.
Definition: pmesh.cpp:3793
void EnsureParNodes()
If the mesh is curved, make sure &#39;Nodes&#39; is ParGridFunction.
Definition: pmesh.cpp:1993
long glob_elem_offset
Definition: pmesh.hpp:84
void UniformRefineGroups3D(int old_nv, int old_nedges, const DSTable &old_v_to_v, const STable3D &old_faces, Array< int > *f2qf)
Definition: pmesh.cpp:4259
int FindPoints(DenseMatrix &point_mat, Array< int > &elem_ids, Array< IntegrationPoint > &ips, bool warn=true, InverseElementTransformation *inv_trans=NULL) override
Find the ids of the elements that contain the given points, and their corresponding reference coordin...
Definition: pmesh.cpp:5977
bool have_face_nbr_data
Definition: pmesh.hpp:315
Array< Vert3 > shared_trias
Definition: pmesh.hpp:63
Array< int > face_nbr_vertices_offset
Definition: pmesh.hpp:318
Array< int > face_nbr_group
Definition: pmesh.hpp:316
bool NonconformingDerefinement(Array< double > &elem_error, double threshold, int nc_limit=0, int op=1) override
NC version of GeneralDerefinement.
Definition: pmesh.cpp:3845
Data arrays will be written in ASCII format.
The inverse transformation of a given ElementTransformation.
Definition: eltrans.hpp:185
void RebalanceImpl(const Array< int > *partition)
Definition: pmesh.cpp:3913
void MarkTetMeshForRefinement(DSTable &v_to_v) override
Definition: pmesh.cpp:1636
void BuildFaceGroup(int ngroups, const Mesh &mesh, const Array< int > &face_group, int &nstria, int &nsquad)
Definition: pmesh.cpp:622
void Set(int v0, int v1, int v2)
Definition: pmesh.hpp:43
int GroupNQuadrilaterals(int group)
Definition: pmesh.hpp:333
void Set(const int *w)
Definition: pmesh.hpp:44
STable3D * GetSharedFacesTable()
Definition: pmesh.cpp:2559
Array< int > sedge_ledge
Definition: pmesh.hpp:74
bool HasBoundaryElements() const override
Checks if any rank in the mesh has boundary elements.
Definition: pmesh.cpp:1597
Table group_stria
Definition: pmesh.hpp:69
void GroupTriangle(int group, int i, int &face, int &o)
Definition: pmesh.cpp:1614
bool WantSkipSharedMaster(const NCMesh::Master &master) const
Definition: pmesh.cpp:4671
A parallel extension of the NCMesh class.
Definition: pncmesh.hpp:64
ParNCMesh * pncmesh
Definition: pmesh.hpp:325
Class for PUMI parallel meshes.
Definition: pumi.hpp:69
int FindSharedEdges(const Mesh &mesh, const int *partition, Table *&edge_element, ListOfIntegerSets &groups)
Definition: pmesh.cpp:531
int GetNRanks() const
Definition: pmesh.hpp:289
long GetGlobalElementNum(int local_element_num) const
Map a local element number to a global element number.
Definition: pmesh.cpp:1537
int GroupVertex(int group, int i)
Definition: pmesh.hpp:335
void ExchangeFaceNbrData()
Definition: pmesh.cpp:2015
void BuildSharedVertMapping(int nvert, const Table *vert_element, const Array< int > &vert_global_local)
Definition: pmesh.cpp:834
Vert4(int v0, int v1, int v2, int v3)
Definition: pmesh.hpp:51
void ReduceMeshGen()
Definition: pmesh.cpp:880
void NURBSUniformRefinement() override
Refine NURBS mesh.
Definition: pmesh.cpp:4461
int GetLocalElementNum(long global_element_num) const
Definition: pmesh.cpp:1529
void Rebalance()
Definition: pmesh.cpp:3903
int BuildLocalBoundary(const Mesh &global_mesh, const int *partitioning, const Array< int > &vert_global_local, Array< bool > &activeBdrElem, Table *&edge_element)
Fills out partitioned Mesh::boundary.
Definition: pmesh.cpp:383
FaceType
Definition: mesh.hpp:45
Array< int > face_nbr_elements_offset
Definition: pmesh.hpp:317
MPI_Comm MyComm
Definition: pmesh.hpp:35
void Finalize(bool refine=false, bool fix_orientation=false) override
Finalize the construction of a general Mesh.
Definition: pmesh.cpp:1515
Symmetric 3D Table stored as an array of rows each of which has a stack of column, floor, number nodes. The number of the node is assigned by counting the nodes from zero as they are pushed into the table. Diagonals of any kind are not allowed so the row, column and floor must all be different for each node. Only one node is stored for all 6 symmetric entries that are indexable by unique triplets of row, column, and floor.
Definition: stable3d.hpp:34
void GetBoundingBox(Vector &p_min, Vector &p_max, int ref=2)
Definition: pmesh.cpp:5679
Array< Element * > shared_edges
Definition: pmesh.hpp:59
void Destroy()
Definition: pmesh.cpp:6232
int GetSharedFace(int sface) const
Return the local face index for the given shared face.
Definition: pmesh.cpp:3044
void BuildSharedEdgeElems(int nedges, Mesh &mesh, const Array< int > &vert_global_local, const Table *edge_element)
Definition: pmesh.cpp:797
FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31) override
Definition: pmesh.cpp:2893
FaceElementTransformations * GetSharedFaceTransformations(int sf, bool fill2=true)
Definition: pmesh.cpp:2909
Table send_face_nbr_vertices
Definition: pmesh.hpp:323
Type
Constants for the classes derived from Element.
Definition: element.hpp:41
VTKFormat
Data array format for VTK and VTU files.
Definition: vtk.hpp:93
void PrintVTU(std::string pathname, VTKFormat format=VTKFormat::ASCII, bool high_order_output=false, int compression_level=0, bool bdr=false) override
Definition: pmesh.cpp:5910
void Set(int v0, int v1, int v2, int v3)
Definition: pmesh.hpp:53
long ReduceInt(int value) const override
Utility function: sum integers from all processors (Allreduce).
Definition: pmesh.cpp:5820
int GetNFbyType(FaceType type) const override
Returns the number of local faces according to the requested type, does not count master non-conformi...
Definition: pmesh.cpp:3066
int GroupNVertices(int group)
Definition: pmesh.hpp:330
void GetGlobalVertexIndices(Array< HYPRE_BigInt > &gi) const
AMR meshes are not supported.
Definition: pmesh.cpp:6113
Table * face_nbr_el_to_face
Definition: pmesh.hpp:78
STable3D * GetFaceNbrElementToFaceTable(int ret_ftbl=0)
Definition: pmesh.cpp:2608
Array< Vert4 > shared_quads
Definition: pmesh.hpp:64
int GetFaceNbrGroup(int fn) const
Definition: pmesh.hpp:353
int GetNFaceNeighborElements() const
Definition: pmesh.hpp:352
void PrintXG(std::ostream &out=mfem::out) const override
Definition: pmesh.cpp:4469
Table face_nbr_el_ori
Definition: pmesh.hpp:79
void GroupQuadrilateral(int group, int i, int &face, int &o)
Definition: pmesh.cpp:1625
int GroupNTriangles(int group)
Definition: pmesh.hpp:332
void FindSharedFaces(const Mesh &mesh, const int *partition, Array< int > &face_group, ListOfIntegerSets &groups)
Definition: pmesh.cpp:504
int GetMyRank() const
Definition: pmesh.hpp:290
void LocalRefinement(const Array< int > &marked_el, int type=3) override
This function is not public anymore. Use GeneralRefinement instead.
Definition: pmesh.cpp:3289
void RefineGroups(const DSTable &v_to_v, int *middle)
Update the groups after triangle refinement.
Definition: pmesh.cpp:3951
MPI_Comm GetComm() const
Definition: pmesh.hpp:288
Array< Vertex > face_nbr_vertices
Definition: pmesh.hpp:320
void Swap(ParMesh &other)
Definition: pmesh.cpp:6193
void PrintSharedEntities(const char *fname_prefix) const
Debugging method.
Definition: pmesh.cpp:6026
HYPRE_Int HYPRE_BigInt
void GetFaceNbrElementFaces(int i, Array< int > &fcs, Array< int > &cor) const
Definition: pmesh.cpp:2773
ParMesh()
Default constructor. Create an empty ParMesh.
Definition: pmesh.hpp:227
void SetAttributes() override
Definition: pmesh.cpp:1579
void BuildVertexGroup(int ngroups, const Table &vert_element)
Definition: pmesh.cpp:694
void GetFaceNbrElementTransformation(int i, IsoparametricTransformation *ElTr)
Definition: pmesh.cpp:1893
void DistributeAttributes(Array< int > &attr)
Ensure that bdr_attributes and attributes agree across processors.
Definition: pmesh.cpp:1543
void Swap(Mesh &other, bool non_geometry)
Definition: mesh.cpp:9206
void BuildEdgeGroup(int ngroups, const Table &edge_element)
Definition: pmesh.cpp:668
void GetFaceSplittings(const int *fv, const HashTable< Hashed2 > &v_to_v, Array< unsigned > &codes)
Append codes identifying how the given face has been split to codes.
Definition: pmesh.cpp:1779
A standard isoparametric element transformation.
Definition: eltrans.hpp:361
Table group_sedge
Definition: pmesh.hpp:68
void ComputeGlobalElementOffset() const
Definition: pmesh.cpp:868
void ExchangeFaceNbrNodes()
Definition: pmesh.cpp:2499
int BuildLocalElements(const Mesh &global_mesh, const int *partitioning, const Array< int > &vert_global_local)
Fills out partitioned Mesh::elements.
Definition: pmesh.cpp:350
Table group_svert
Shared objects in each group.
Definition: pmesh.hpp:67
void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1) override
Definition: pmesh.cpp:1973
bool DecodeFaceSplittings(HashTable< Hashed2 > &v_to_v, const int *v, const Array< unsigned > &codes, int &pos)
Definition: pmesh.cpp:1814
double GetFaceNbrElementSize(int i, int type=0)
Definition: pmesh.cpp:1947
void GetGlobalElementIndices(Array< HYPRE_BigInt > &gi) const
AMR meshes are supported.
Definition: pmesh.cpp:6180
int NGroups() const
Return the number of groups.
void GetGlobalEdgeIndices(Array< HYPRE_BigInt > &gi) const
AMR meshes are not supported.
Definition: pmesh.cpp:6129
IsoparametricTransformation FaceNbrTransformation
Definition: pmesh.hpp:81
int GetEdgeSplittings(Element *edge, const DSTable &v_to_v, int *middle)
Return a number(0-1) identifying how the given edge has been split.
Definition: pmesh.cpp:1764
void GroupEdge(int group, int i, int &edge, int &o)
Definition: pmesh.cpp:1606
Vector data type.
Definition: vector.hpp:60
static ParMesh MakeSimplicial(ParMesh &orig_mesh)
Definition: pmesh.cpp:1373
void PrintAsOne(std::ostream &out=mfem::out) const
Definition: pmesh.cpp:4829
Array< int > svert_lvert
Shared to local index mapping.
Definition: pmesh.hpp:73
int MyRank
Definition: pmesh.hpp:36
void SaveAsOne(const char *fname, int precision=16) const
Definition: pmesh.cpp:5138
void Print(std::ostream &out=mfem::out) const override
Definition: pmesh.cpp:4684
int RowSize(int i) const
Definition: table.hpp:108
Table send_face_nbr_elements
Definition: pmesh.hpp:322
List of integer sets.
Definition: sets.hpp:62
Table * GetFaceToAllElementTable() const
Definition: pmesh.cpp:2803
void FinalizeParTopo()
Definition: pmesh.cpp:886
void DeleteFaceNbrData()
Definition: pmesh.cpp:1952
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Definition: globals.hpp:66
GroupTopology gtopo
Definition: pmesh.hpp:312
void Load(std::istream &input, int generate_edges=0, int refine=1, bool fix_orientation=true) override
Parallel version of Mesh::Load().
Definition: pmesh.cpp:941
void ParPrint(std::ostream &out) const
Save the mesh in a parallel mesh format.
Definition: pmesh.cpp:5827
Class for parallel meshes.
Definition: pmesh.hpp:32
Abstract data type element.
Definition: element.hpp:28
int GetFaceNbrRank(int fn) const
Definition: pmesh.cpp:2755
Table group_squad
Definition: pmesh.hpp:70
void Save(const char *fname, int precision=16) const override
Definition: pmesh.cpp:4801
void GenerateOffsets(int N, HYPRE_BigInt loc_sizes[], Array< HYPRE_BigInt > *offsets[]) const
Definition: pmesh.cpp:1850
Vert3(int v0, int v1, int v2)
Definition: pmesh.hpp:42
MFEM_DEPRECATED void ReorientTetMesh() override
See the remarks for the serial version in mesh.hpp.
Definition: pmesh.cpp:3099
int GroupNEdges(int group)
Definition: pmesh.hpp:331