Compare commits
19
Commits
mma
...
face-nbr-amr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
819b6ff37d | ||
|
|
80c715729d | ||
|
|
8fba522d6e | ||
|
|
f965aaaf0a | ||
|
|
a32b548379 | ||
|
|
28327819e7 | ||
|
|
7393d33651 | ||
|
|
a6a112e104 | ||
|
|
c63b84d086 | ||
|
|
c6c6ad9b73 | ||
|
|
e1a4094f83 | ||
|
|
5e2737a58b | ||
|
|
23f81955a2 | ||
|
|
f22ecd27ca | ||
|
|
3443d9529b | ||
|
|
398c79ceb9 | ||
|
|
24267173a6 | ||
|
|
ce786cb04f | ||
|
|
d48fe60de2 |
@@ -0,0 +1,65 @@
|
||||
|
||||
#include "mfem.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace mfem;
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// 1. Parse command-line options.
|
||||
const char *mesh_file = "../data/inline-quad.mesh";
|
||||
bool vis = true;
|
||||
OptionsParser args(argc, argv);
|
||||
args.AddOption(&vis, "-vis", "--visualization", "-no-vis",
|
||||
"--no-visualization",
|
||||
"Enable or disable GLVis visualization.");
|
||||
args.Parse();
|
||||
if (!args.Good())
|
||||
{
|
||||
args.PrintUsage(cout);
|
||||
return 1;
|
||||
}
|
||||
args.PrintOptions(cout);
|
||||
|
||||
Mesh mesh(mesh_file, 1, 1);
|
||||
|
||||
Array<int> ref_elems(1);
|
||||
ref_elems = 2;
|
||||
mesh.GeneralRefinement(ref_elems,-1,0);
|
||||
ref_elems = 5;
|
||||
mesh.GeneralRefinement(ref_elems,-1,0);
|
||||
|
||||
Array<int> faces({0,10,26,28,29});
|
||||
|
||||
for (int i = 0; i<faces.Size(); i++)
|
||||
{
|
||||
Array<int> elems;
|
||||
mesh.GetFaceElements(faces[i],elems);
|
||||
|
||||
if (vis)
|
||||
{
|
||||
char vishost[] = "localhost";
|
||||
int visport = 19916;
|
||||
socketstream patch_sock(vishost, visport);
|
||||
L2_FECollection fec(1,mesh.Dimension());
|
||||
FiniteElementSpace fes(&mesh,&fec);
|
||||
GridFunction vis_gf(&fes);
|
||||
vis_gf = 0.0;
|
||||
Array<int> dofs;
|
||||
for (int i=0; i<elems.Size(); i++)
|
||||
{
|
||||
int el = elems[i];
|
||||
fes.GetElementDofs(el, dofs);
|
||||
vis_gf.SetSubVector(dofs,1.0);
|
||||
}
|
||||
patch_sock.precision(8);
|
||||
patch_sock << "solution\n" << mesh << vis_gf <<
|
||||
"keys rRmjnppppp\n" << flush;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1410,6 +1410,59 @@ void Mesh::GetFaceInfos(int Face, int *Inf1, int *Inf2, int *NCFace) const
|
||||
*NCFace = faces_info[Face].NCFace;
|
||||
}
|
||||
|
||||
void Mesh::GetFaceAdjacentElements(int face, Array<int> & elems) const
|
||||
{
|
||||
bool nonconforming_face = ncmesh && (faces_info[face].NCFace != -1);
|
||||
MFEM_VERIFY(face < GetNumFaces(), "GetFaceAdjacentElements only implemented"
|
||||
"for local faces.");
|
||||
if (nonconforming_face) //nonconforming master
|
||||
{
|
||||
int nc_index = faces_info[face].NCFace;
|
||||
const NCFaceInfo &nc_info = nc_faces_info[nc_index];
|
||||
if (!nc_info.Slave)
|
||||
{
|
||||
const mfem::NCMesh::NCList &nc_list = ncmesh->GetNCList(Dim-1);
|
||||
elems.Append(ncmesh->elements[nc_list.masters[nc_index].element].index);
|
||||
int j_begin = nc_list.masters[nc_index].slaves_begin;
|
||||
int j_end = nc_list.masters[nc_index].slaves_end;
|
||||
for (int j = j_begin; j<j_end ; j++)
|
||||
{
|
||||
int fnum = nc_list.slaves[j].index;
|
||||
if (fnum >= GetNumFaces())
|
||||
{
|
||||
const FaceInfo &face_info = faces_info[fnum];
|
||||
elems.Append(GetNE() -1 -face_info.Elem2No);
|
||||
}
|
||||
else
|
||||
{
|
||||
elems.Append(ncmesh->elements[nc_list.slaves[j].element].index);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
//(i) conforming interior -
|
||||
//(ii) conforming processor boundary
|
||||
//(iii) true boundary -
|
||||
//(iv) nonconforming interior slave -
|
||||
//(v) nonconforming processor boundary with slave
|
||||
{
|
||||
const FaceInfo &face_info = faces_info[face];
|
||||
elems.Append(face_info.Elem1No);
|
||||
if (face_info.Elem2No >= 0)
|
||||
{
|
||||
elems.Append(face_info.Elem2No); //(i, iii, iv)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (face_info.Elem2Inf >= 0)
|
||||
{
|
||||
elems.Append(GetNE()-1-face_info.Elem2No); //(ii, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Geometry::Type Mesh::GetFaceGeometry(int Face) const
|
||||
{
|
||||
switch (Dim)
|
||||
|
||||
@@ -1485,6 +1485,16 @@ public:
|
||||
void GetFaceInfos (int Face, int *Inf1, int *Inf2) const;
|
||||
void GetFaceInfos (int Face, int *Inf1, int *Inf2, int *NCFace) const;
|
||||
|
||||
/** Return all elements adjacent to the given Face
|
||||
* Returns local (to the processor element no)
|
||||
* if local_no >= num_elems it num_elements + ghost element index
|
||||
* (This can be used in pmesh.GetFaceNbrElementTransformation)
|
||||
*/
|
||||
void GetFaceAdjacentElements(int Face, Array<int> & elems) const;
|
||||
|
||||
// Returns global (unique) element numbers
|
||||
// void GetFaceAdjacentElementsGlobal(int Face, Array<int> & elems) const;
|
||||
|
||||
/// Deprecated in favor of Mesh::GetFaceGeometry
|
||||
MFEM_DEPRECATED Geometry::Type GetFaceGeometryType(int Face) const
|
||||
{ return GetFaceGeometry(Face); }
|
||||
|
||||
Reference in New Issue
Block a user