MFEM  v3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
pmesh.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.googlecode.com.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
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 "mesh.hpp"
21 #include <iostream>
22 
23 namespace mfem
24 {
25 
27 class ParMesh : public Mesh
28 {
29 private:
30  MPI_Comm MyComm;
31  int NRanks, MyRank;
32 
33  Array<Element *> shared_edges;
34  Array<Element *> shared_faces;
35 
37  Table group_svert;
38  Table group_sedge;
39  Table group_sface;
40 
42  Array<int> svert_lvert;
43  Array<int> sedge_ledge;
44  Array<int> sface_lface;
45 
47  int GetEdgeSplittings(Element *edge, const DSTable &v_to_v, int *middle);
49  int GetFaceSplittings(Element *face, const DSTable &v_to_v, int *middle);
50 
51  void GetFaceNbrElementTransformation(
52  int i, IsoparametricTransformation *ElTr);
53 
55  virtual void QuadUniformRefinement();
56 
58  virtual void HexUniformRefinement();
59 
60  virtual void NURBSUniformRefinement();
61 
62  void DeleteFaceNbrData();
63 
64 public:
65  ParMesh(MPI_Comm comm, Mesh &mesh, int *partitioning_ = NULL,
66  int part_method = 1);
67 
68  MPI_Comm GetComm() { return MyComm; }
69  int GetNRanks() { return NRanks; }
70  int GetMyRank() { return MyRank; }
71 
73 
74  // Face-neighbor elements and vertices
81  // Local face-neighbor elements and vertices ordered by face-neighbor
84 
85  int GetNGroups() { return gtopo.NGroups(); }
86 
87  // next 6 methods do not work for the 'local' group 0
88  int GroupNVertices(int group) { return group_svert.RowSize(group-1); }
89  int GroupNEdges(int group) { return group_sedge.RowSize(group-1); }
90  int GroupNFaces(int group) { return group_sface.RowSize(group-1); }
91 
92  int GroupVertex(int group, int i)
93  { return svert_lvert[group_svert.GetJ()[group_svert.GetI()[group-1]+i]]; }
94  void GroupEdge(int group, int i, int &edge, int &o);
95  void GroupFace(int group, int i, int &face, int &o);
96 
97  void ExchangeFaceNbrData();
98  void ExchangeFaceNbrNodes();
99  int GetNFaceNeighbors() const { return face_nbr_group.Size(); }
100  int GetFaceNbrGroup(int fn) const { return face_nbr_group[fn]; }
101  int GetFaceNbrRank(int fn) const;
105 
110 
112  int GetNSharedFaces() const;
113 
115  virtual void ReorientTetMesh();
116 
118  virtual void LocalRefinement(const Array<int> &marked_el, int type = 3);
119 
121  void RefineGroups(const DSTable &v_to_v, int *middle);
122 
125  virtual void Print(std::ostream &out = std::cout) const;
126 
129  virtual void PrintXG(std::ostream &out = std::cout) const;
130 
136  void PrintAsOne(std::ostream &out = std::cout);
137 
139  void PrintAsOneXG(std::ostream &out = std::cout);
140 
142  void PrintInfo(std::ostream &out = std::cout);
143 
144  virtual ~ParMesh();
145 };
146 
147 }
148 
149 #endif // MFEM_USE_MPI
150 
151 #endif
int GetNFaceNeighbors() const
Definition: pmesh.hpp:99
int Size() const
Logical size of the array.
Definition: array.hpp:108
int * GetJ()
Definition: table.hpp:88
virtual ~ParMesh()
Definition: pmesh.cpp:3306
virtual void ReorientTetMesh()
See the remarks for the serial version in mesh.hpp.
Definition: pmesh.cpp:1200
Array< Element * > face_nbr_elements
Definition: pmesh.hpp:79
MPI_Comm GetComm()
Definition: pmesh.hpp:68
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
Definition: pmesh.cpp:1191
virtual void LocalRefinement(const Array< int > &marked_el, int type=3)
Refine the marked elements.
Definition: pmesh.cpp:1242
bool have_face_nbr_data
Definition: pmesh.hpp:75
Array< int > face_nbr_vertices_offset
Definition: pmesh.hpp:78
Array< int > face_nbr_group
Definition: pmesh.hpp:76
int GroupVertex(int group, int i)
Definition: pmesh.hpp:92
void ExchangeFaceNbrData()
Definition: pmesh.cpp:662
void PrintAsOne(std::ostream &out=std::cout)
Definition: pmesh.cpp:2514
Array< int > face_nbr_elements_offset
Definition: pmesh.hpp:77
Table send_face_nbr_vertices
Definition: pmesh.hpp:83
int GroupNVertices(int group)
Definition: pmesh.hpp:88
int GetFaceNbrGroup(int fn) const
Definition: pmesh.hpp:100
void RefineGroups(const DSTable &v_to_v, int *middle)
Update the groups after tet refinement.
Definition: pmesh.cpp:1856
int GetNRanks()
Definition: pmesh.hpp:69
Array< Vertex > face_nbr_vertices
Definition: pmesh.hpp:80
void PrintInfo(std::ostream &out=std::cout)
Print various parallel mesh stats.
Definition: pmesh.cpp:3205
virtual void PrintXG(std::ostream &out=std::cout) const
Definition: pmesh.cpp:2276
void GroupFace(int group, int i, int &face, int &o)
Definition: pmesh.cpp:535
void ExchangeFaceNbrNodes()
Definition: pmesh.cpp:1029
ParMesh(MPI_Comm comm, Mesh &mesh, int *partitioning_=NULL, int part_method=1)
Definition: pmesh.cpp:26
int GroupNFaces(int group)
Definition: pmesh.hpp:90
int NGroups() const
void GroupEdge(int group, int i, int &edge, int &o)
Definition: pmesh.cpp:527
int * GetI()
Definition: table.hpp:87
void PrintAsOneXG(std::ostream &out=std::cout)
Old mesh format (Netgen/Truegrid) version of &#39;PrintAsOne&#39;.
Definition: pmesh.cpp:2744
int RowSize(int i) const
Definition: table.hpp:82
Table send_face_nbr_elements
Definition: pmesh.hpp:82
Table * GetFaceToAllElementTable() const
Definition: pmesh.cpp:1092
GroupTopology gtopo
Definition: pmesh.hpp:72
FaceElementTransformations * GetSharedFaceTransformations(int)
Definition: pmesh.cpp:1136
int GetNGroups()
Definition: pmesh.hpp:85
int GetMyRank()
Definition: pmesh.hpp:70
Class for parallel meshes.
Definition: pmesh.hpp:27
Abstract data type element.
Definition: element.hpp:27
int GetFaceNbrRank(int fn) const
Definition: pmesh.cpp:1082
int GroupNEdges(int group)
Definition: pmesh.hpp:89
virtual void Print(std::ostream &out=std::cout) const
Definition: pmesh.cpp:2444