Compare commits

...
4 changed files with 101 additions and 23 deletions
+8
View File
@@ -341,12 +341,20 @@ public:
// Face-neighbor functions
void ExchangeFaceNbrData();
/// Return the number of face-neighbor dofs
int GetFaceNbrVSize() const { return num_face_nbr_dofs; }
/** Get the vdofs associated with the @a ith face neighbor element. These are
vdof indices that can be used to index into the Vector returned by
ParGridFunction::FaceNbrData(). */
void GetFaceNbrElementVDofs(int i, Array<int> &vdofs) const;
void GetFaceNbrFaceVDofs(int i, Array<int> &vdofs) const;
/// Get the FiniteElement object for the @a ith face neighbor element
const FiniteElement *GetFaceNbrFE(int i) const;
const FiniteElement *GetFaceNbrFaceFE(int i) const;
/// Return an array of global L-dofs corresponding to face neigbor dofs
const HYPRE_Int *GetFaceNbrGlobalDofMap() { return face_nbr_glob_dof_map; }
/// Get the ElementTransformation associated with the @a ith face neighbor
/// element
ElementTransformation *GetFaceNbrElementTransformation(int i) const
{ return pmesh->GetFaceNbrElementTransformation(i); }
+26 -8
View File
@@ -406,13 +406,6 @@ protected:
void AddQuadFaceElement (int lf, int gf, int el,
int v0, int v1, int v2, int v3);
/** For a serial Mesh, return true if the face is interior. For a parallel
ParMesh return true if the face is interior or shared. In parallel, this
method only works if the face neighbor data is exchanged. */
bool FaceIsTrueInterior(int FaceNo) const
{
return FaceIsInterior(FaceNo) || (faces_info[FaceNo].Elem2Inf >= 0);
}
void FreeElement(Element *E);
@@ -1002,11 +995,36 @@ public:
FaceElementTransformations *GetBdrFaceTransformations (int BdrElemNo);
/// Return true if the given face is interior. @sa FaceIsTrueInterior().
/// Return true if the given face is interior. Returns false if the face
/// is on the domain boundary or is a shared face of a parallel mesh.
/// @sa FaceIsTrueInterior().
bool FaceIsInterior(int FaceNo) const
{
return (faces_info[FaceNo].Elem2No >= 0);
}
/** For a serial Mesh, return true if the face is interior. For a parallel
ParMesh return true if the face is interior or shared. In parallel, this
method only works if the face neighbor data is exchanged. */
bool FaceIsTrueInterior(int FaceNo) const
{
return FaceIsInterior(FaceNo) || (faces_info[FaceNo].Elem2Inf >= 0);
}
/// Returns true if the face is shared (i.e. lies in the interior of the
/// domain, and one neighboring element belongs to a different MPI rank)
bool FaceIsShared(int FaceNo) const
{
return !FaceIsInterior(FaceNo) && FaceIsTrueInterior(FaceNo);
}
/** Get the indices of the elements containing the given face. @a *Elem1 will
always be the index of a valid element. @a *Elem2 will be negative if the
given face either lies on the domain boundary or is a shared face of a
parallel mesh, or if the face is a master face in a nonconforming mesh.
The case of boundary or shared faces can be distinguished using
Mesh::FaceIsTrueInterior. If the face is a shared face, the shared face
index is given by -1 - *Elem2. */
void GetFaceElements (int Face, int *Elem1, int *Elem2) const;
void GetFaceInfos (int Face, int *Inf1, int *Inf2) const;
+37 -13
View File
@@ -2505,26 +2505,24 @@ GetSharedFaceTransformations(int sf, bool fill2)
return &FaceElemTr;
}
int ParMesh::GetNSharedFaces() const
int ParMesh::GetSharedFaceIndexOfLocalFace(int face_idx) const
{
if (Conforming())
if (lface_sface.empty())
{
switch (Dim)
const Array<int> *mapping;
if (Dim == 1) { mapping = &svert_lvert; }
else if (Dim == 2) { mapping = &sedge_ledge; }
else { mapping = &sface_lface; }
for (int i=0; i<mapping->Size(); ++i)
{
case 1: return svert_lvert.Size();
case 2: return sedge_ledge.Size();
default: return sface_lface.Size();
lface_sface[(*mapping)[i]] = i;
}
}
else
{
MFEM_ASSERT(Dim > 1, "");
const NCMesh::NCList &shared = pncmesh->GetSharedList(Dim-1);
return shared.conforming.size() + shared.slaves.size();
}
return lface_sface[face_idx];
}
int ParMesh::GetSharedFace(int sface) const
int ParMesh::GetLocalFaceIndexOfSharedFace(int sface) const
{
if (Conforming())
{
@@ -2546,6 +2544,32 @@ int ParMesh::GetSharedFace(int sface) const
}
}
int ParMesh::GetFaceNbrElementOfSharedFace(int sf) const
{
int face_idx = GetSharedFace(sf);
const FaceInfo &face_info = faces_info[face_idx];
return -1 - face_info.Elem2No;
}
int ParMesh::GetNSharedFaces() const
{
if (Conforming())
{
switch (Dim)
{
case 1: return svert_lvert.Size();
case 2: return sedge_ledge.Size();
default: return sface_lface.Size();
}
}
else
{
MFEM_ASSERT(Dim > 1, "");
const NCMesh::NCList &shared = pncmesh->GetSharedList(Dim-1);
return shared.conforming.size() + shared.slaves.size();
}
}
// shift cyclically 3 integers a, b, c, so that the smallest of
// order[a], order[b], order[c] is first
static inline
+30 -2
View File
@@ -78,6 +78,10 @@ protected:
// sface ids: all triangles first, then all quads
Array<int> sface_lface;
/// Local to shared face mapping (vertex in 1D, edge in 2D, face in 3D).
/// Generated on first call to GetSharedFaceIndexOfLocalFace.
mutable std::map<int,int> lface_sface;
IsoparametricTransformation FaceNbrTransformation;
// glob_elem_offset + local element number defines a global element numbering
@@ -277,14 +281,22 @@ public:
void GenerateOffsets(int N, HYPRE_Int loc_sizes[],
Array<HYPRE_Int> *offsets[]) const;
/** Communicate face-neighbor mesh information. Also calls
ExchangeFaceNbrNodes. */
void ExchangeFaceNbrData();
/** Communicate the nodal gridfunction associated with face-neighbor
elements. Calls ExchangeFaceNbrData if it has not been called before. */
void ExchangeFaceNbrNodes();
virtual void SetCurvature(int order, bool discont = false, int space_dim = -1,
int ordering = 1);
/** Returns the number of MPI ranks that are face-neighbors of the current
rank. */
int GetNFaceNeighbors() const { return face_nbr_group.Size(); }
/// Get the group index of the face-neighbor @a fn
int GetFaceNbrGroup(int fn) const { return face_nbr_group[fn]; }
/// Get the MPI rank of the face-neighbor @a fn
int GetFaceNbrRank(int fn) const;
/** Similar to Mesh::GetFaceToElementTable with added face-neighbor elements
@@ -297,6 +309,7 @@ public:
FaceElementTransformations *
GetSharedFaceTransformations(int sf, bool fill2 = true);
/// Get the ElementTransformation of the @a ith face-neighbor element
ElementTransformation *
GetFaceNbrElementTransformation(int i)
{
@@ -305,11 +318,26 @@ public:
return &FaceNbrTransformation;
}
/// Return the shared face index of a given local face
int GetSharedFaceIndexOfLocalFace(int face_idx) const;
/// Return the local face index for the given shared face.
int GetLocalFaceIndexOfSharedFace(int sface) const;
/// Return the local face index for the given shared face. This performs the
/// same function as GetLocalFaceIndexOfSharedFace.
int GetSharedFace(int sface) const
{
return GetLocalFaceIndexOfSharedFace(sface);
}
/// Return the index of the face-neighbor element containing the given
/// shared face.
int GetFaceNbrElementOfSharedFace(int sf) const;
/// Return the number of shared faces (3D), edges (2D), vertices (1D)
int GetNSharedFaces() const;
/// Return the local face index for the given shared face.
int GetSharedFace(int sface) const;
/// See the remarks for the serial version in mesh.hpp
virtual void ReorientTetMesh();