46 for (
int i = 0; i < mesh.
GetNE(); i++)
66 MFEM_ASSERT(children.
Size() == 2,
"");
68 const int elem1 = children[0];
79 std::mt19937 gen(seed);
80 for (
int i = 0; i < num_refs; i++)
82 const int elem = gen() % mesh.
GetNE();
83 const int t = gen() %
dim;
90 std::set<int> conflicts;
97 cout <<
"Anisotropic conflict on iteration " << i
111int main(
int argc,
char *argv[])
120 const char *mesh_file =
"../../data/star.mesh";
122 bool visualization =
true;
123 bool makeMesh =
false;
128 args.
AddOption(&mesh_file,
"-m",
"--mesh",
129 "Mesh file to use.");
131 "Finite element order (polynomial degree).");
132 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
133 "--no-visualization",
134 "Enable or disable GLVis visualization.");
135 args.
AddOption(&makeMesh,
"-mm",
"--make-mesh",
"-no-mm",
136 "--no-make-mesh",
"Create Cartesian mesh");
137 args.
AddOption(&tdim,
"-dim",
"--dimension",
"Dimension for Cartesian mesh");
138 args.
AddOption(&num_refs,
"-r",
"--refs",
"Number of 3:1 refinements");
172 ParMesh pmesh(MPI_COMM_WORLD, mesh);
182 cout <<
"Number of finite element unknowns: "
214 cg.SetPreconditioner(M);
221 a.RecoverFEMSolution(X,
b, x);
228 cout <<
"Error of H1 continuity: " << h1err << endl;
230 MFEM_VERIFY(h1err < 1.0e-7,
"H1 discontinuity found");
235 ostringstream mesh_name, sol_name;
236 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
237 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
239 ofstream mesh_ofs(mesh_name.str().c_str());
240 mesh_ofs.precision(8);
241 pmesh.
Print(mesh_ofs);
243 ofstream sol_ofs(sol_name.str().c_str());
244 sol_ofs.precision(8);
254 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
255 sol_sock.precision(8);
256 sol_sock <<
"solution\n" << pmesh << x << flush;
297 errorMax = std::max(errorMax, std::abs(v1 - v2));
308 if (!info.IsShared())
328 errorMax = std::max(errorMax, std::abs(v1 - v2));
332 MPI_Allreduce(MPI_IN_PLACE, &errorMax, 1, MFEM_MPI_REAL_T, MPI_MAX,
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
Conjugate gradient method.
A coefficient that is constant across space and time.
Class for domain integration .
int GetEdgeOrder(int edge, int variant=0) const
int GetFaceOrder(int face, int variant=0) const
Returns the polynomial degree of the i'th face finite element.
Arbitrary order H1-conforming (continuous) finite elements.
The BoomerAMG solver in hypre.
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
Class for integration point with weight.
Class for an integration rule - an Array of IntegrationPoint.
int GetNPoints() const
Returns the number of the points in the integration rule.
IntegrationPoint & IntPoint(int i)
Returns a reference to the i-th integration point.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
int GetNumFaces() const
Return the number of faces (3D), edges (2D) or vertices (1D).
void GeneralRefinement(const Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
void EnsureNodes()
Make sure that the mesh has valid nodes, i.e. its geometry is described by a vector finite element gr...
void Clear()
Clear the contents of the Mesh.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
FaceInformation GetFaceInformation(int f) const
static Mesh MakeCartesian3D(int nx, int ny, int nz, Element::Type type, real_t sx=1.0, real_t sy=1.0, real_t sz=1.0, bool sfc_ordering=true)
Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type =...
static Mesh LoadFromFile(const std::string &filename, int generate_edges=0, int refine=1, bool fix_orientation=true)
NCMesh * ncmesh
Optional nonconforming mesh extension.
void EnsureNCMesh(bool simplices_nonconforming=false)
static Mesh MakeCartesian2D(int nx, int ny, Element::Type type, bool generate_edges=false, real_t sx=1.0, real_t sy=1.0, bool sfc_ordering=true)
Creates mesh for the rectangle [0,sx]x[0,sy], divided into nx*ny quadrilaterals if type = QUADRILATER...
static int WorldRank()
Return the MPI rank in MPI_COMM_WORLD.
static int WorldSize()
Return the size of MPI_COMM_WORLD.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
const CoarseFineTransformations & GetRefinementTransforms() const
Pointer to an Operator of a specified type.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
void PrintUsage(std::ostream &out) const
Print the usage message.
void PrintOptions(std::ostream &out) const
Print the options.
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
bool Good() const
Return true if the command line options were parsed successfully.
Abstract parallel finite element space.
void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const override
HYPRE_BigInt GlobalTrueVSize() const
ParMesh * GetParMesh() const
Class for parallel grid function.
void ExchangeFaceNbrData()
void Save(std::ostream &out) const override
real_t GetValue(int i, const IntegrationPoint &ip, int vdim=1) const override
ParFiniteElementSpace * ParFESpace() const
Class for parallel meshes.
int GetNSharedFaces() const
Return the number of shared faces (3D), edges (2D), vertices (1D)
FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31) override
bool AnisotropicConflict(const Array< Refinement > &refinements, std::set< int > &conflicts) const
Return true if the input array of refinements to be performed would result in conflicting anisotropic...
void MarkExternalBoundaries(Array< int > &bdr_marker, bool excl=true) const override
Mark boundary attributes of external boundaries.
int GetSharedFace(int sface) const
Return the local face index for the given shared face.
FaceElementTransformations * GetSharedFaceTransformations(int sf, bool fill2=true)
Get the FaceElementTransformations for the given shared face (edge 2D) using the shared face index sf...
void Print(std::ostream &out=mfem::out, const std::string &comments="") const override
const int * ess_tdof_list
std::function< real_t(const Vector &)> f(real_t mass_coeff)
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
real_t p(const Vector &x, real_t t)
void FindChildren(const Mesh &mesh, int elem, Array< int > &children)
void Refine31(Mesh &mesh, int elem, char type)
void TestAnisoRefRandom(int num_refs, int dim, ParMesh &mesh, int myid, int seed=0)
real_t CheckH1Continuity(ParGridFunction &x)