MFEM  v3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
pfespace.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_PFESPACE
13 #define MFEM_PFESPACE
14 
15 #include "../config/config.hpp"
16 
17 #ifdef MFEM_USE_MPI
18 
19 #include "../linalg/hypre.hpp"
20 #include "../mesh/pmesh.hpp"
21 #include "../mesh/nurbs.hpp"
22 #include "fespace.hpp"
23 
24 namespace mfem
25 {
26 
29 {
30 private:
32  MPI_Comm MyComm;
33  int NRanks, MyRank;
34 
36  ParMesh *pmesh;
37 
39  GroupCommunicator *gcomm;
40 
42  int ltdof_size;
43 
45  Array<int> ldof_group;
46 
48  Array<int> ldof_ltdof;
49 
51  Array<int> dof_offsets;
52 
54  Array<int> tdof_offsets;
55 
57  Array<int> tdof_nb_offsets;
58 
60  Array<int> ldof_sign;
61 
63  HypreParMatrix *P;
64 
65  ParNURBSExtension *pNURBSext()
66  { return dynamic_cast<ParNURBSExtension *>(NURBSext); }
67 
68  GroupTopology &GetGroupTopo()
69  { return (NURBSext) ? pNURBSext()->gtopo : pmesh->gtopo; }
70 
74 
75  // ldof_type = 0 : DOFs communicator, otherwise VDOFs communicator
76  void GetGroupComm(GroupCommunicator &gcomm, int ldof_type,
77  Array<int> *ldof_sign = NULL);
78 
80  void GenerateGlobalOffsets();
81 
83  void ConstructTrueDofs();
84  void ConstructTrueNURBSDofs();
85 
86  void ApplyLDofSigns(Array<int> &dofs) const;
87 
88 public:
89  // Face-neighbor data
93  // Local face-neighbor data
95 
97  int dim = 1, int order = Ordering::byNODES);
98 
99  MPI_Comm GetComm() { return MyComm; }
100  int GetNRanks() { return NRanks; }
101  int GetMyRank() { return MyRank; }
102 
103  inline ParMesh *GetParMesh() { return pmesh; }
104 
105  int TrueVSize() { return ltdof_size; }
106  int *GetDofOffsets() { return dof_offsets; }
107  int *GetTrueDofOffsets() { return tdof_offsets; }
110  int GetDofSign(int i) { return NURBSext ? 1 : ldof_sign[VDofToDof(i)]; }
111 
113  virtual void GetElementDofs(int i, Array<int> &dofs) const;
114 
116  virtual void GetBdrElementDofs(int i, Array<int> &dofs) const;
117 
120  virtual void GetFaceDofs(int i, Array<int> &dofs) const;
121 
124 
128  { return (new HypreParVector(MyComm,GlobalTrueVSize(),GetTrueDofOffsets()));}
129 
131  void DivideByGroupSize(double *vec);
132 
134  GroupCommunicator &GroupComm() { return *gcomm; }
135 
138 
141  void Synchronize(Array<int> &ldof_marker) const;
142 
144  virtual void GetEssentialVDofs(const Array<int> &bdr_attr_is_ess,
145  Array<int> &ess_dofs) const;
146 
149  int GetLocalTDofNumber(int ldof);
151  int GetGlobalTDofNumber(int ldof);
155  int GetGlobalScalarTDofNumber(int sldof);
156  int GetMyDofOffset();
157 
158  // Face-neighbor functions
159  void ExchangeFaceNbrData();
160  int GetFaceNbrVSize() const { return num_face_nbr_dofs; }
161  void GetFaceNbrElementVDofs(int i, Array<int> &vdofs) const;
162  const FiniteElement *GetFaceNbrFE(int i) const;
164 
166  void LoseDofOffsets() { dof_offsets.LoseData(); }
167  void LoseTrueDofOffsets() { tdof_offsets.LoseData(); }
168 
169  virtual void Update();
171  virtual FiniteElementSpace *SaveUpdate();
172 
173  virtual ~ParFiniteElementSpace() { delete gcomm; delete P; }
174 };
175 
176 }
177 
178 #endif // MFEM_USE_MPI
179 
180 #endif
Abstract class for Finite Elements.
Definition: fe.hpp:42
int * GetJ()
Definition: table.hpp:88
HypreParVector * NewTrueDofVector()
Definition: pfespace.hpp:127
int VDofToDof(int vdof) const
Definition: fespace.hpp:232
void DivideByGroupSize(double *vec)
Scale a vector of true dofs.
Definition: pfespace.cpp:401
Abstract parallel finite element space.
Definition: pfespace.hpp:28
void Synchronize(Array< int > &ldof_marker) const
Definition: pfespace.cpp:420
virtual void GetBdrElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom for i&#39;th boundary element.
Definition: pfespace.cpp:234
void GetFaceNbrElementVDofs(int i, Array< int > &vdofs) const
Definition: pfespace.cpp:689
int GetGlobalTDofNumber(int ldof)
Returns the global tdof number of the given local degree of freedom.
Definition: pfespace.cpp:448
const FiniteElement * GetFaceNbrFE(int i) const
Definition: pfespace.cpp:695
void LoseData()
NULL-ifies the data.
Definition: array.hpp:102
int GetLocalTDofNumber(int ldof)
Definition: pfespace.cpp:440
int GetGlobalScalarTDofNumber(int sldof)
Definition: pfespace.cpp:462
virtual void GetFaceDofs(int i, Array< int > &dofs) const
Definition: pfespace.cpp:245
HypreParMatrix * Dof_TrueDof_Matrix()
The true dof-to-dof interpolation matrix.
Definition: pfespace.cpp:303
Wrapper for hypre&#39;s parallel vector class.
Definition: hypre.hpp:38
Abstract finite element space.
Definition: fespace.hpp:61
GroupCommunicator & GroupComm()
Return a reference to the internal GroupCommunicator (on VDofs)
Definition: pfespace.hpp:134
int GetGlobalNumCols() const
Definition: hypre.hpp:193
virtual void GetElementDofs(int i, Array< int > &dofs) const
Returns indexes of degrees of freedom in array dofs for i&#39;th element.
Definition: pfespace.cpp:223
int GetFaceNbrVSize() const
Definition: pfespace.hpp:160
int GetGlobalNumRows() const
Definition: hypre.hpp:191
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_dofs) const
Determine the boundary degrees of freedom.
Definition: pfespace.cpp:430
NURBSExtension * NURBSext
Definition: fespace.hpp:89
GroupTopology gtopo
Definition: pmesh.hpp:72
Wrapper for hypre&#39;s ParCSR matrix class.
Definition: hypre.hpp:103
GroupCommunicator * ScalarGroupComm()
Return a new GroupCommunicator on Dofs.
Definition: pfespace.cpp:410
Class for parallel meshes.
Definition: pmesh.hpp:27
virtual FiniteElementSpace * SaveUpdate()
Return a copy of the current FE space and update.
Definition: pfespace.cpp:823
GroupTopology gtopo
Definition: nurbs.hpp:348