45 for (
int i = 0; i < mesh.
GetNE(); i++)
65 MFEM_ASSERT(children.
Size() == 2,
"");
67 const int elem1 = children[0];
78 const double a = 1000 * sin(s * 1.1234 * M_PI);
79 return int(std::abs(
a));
86 for (
int i = 0; i < iter; i++)
99int main(
int argc,
char *argv[])
102 const char *mesh_file =
"../../data/star.mesh";
104 bool visualization =
true;
105 bool makeMesh =
false;
110 args.
AddOption(&mesh_file,
"-m",
"--mesh",
111 "Mesh file to use.");
113 "Finite element order (polynomial degree) or -1 for"
114 " isoparametric space.");
115 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
116 "--no-visualization",
117 "Enable or disable GLVis visualization.");
118 args.
AddOption(&makeMesh,
"-mm",
"--make-mesh",
"-no-mm",
119 "--no-make-mesh",
"Create Cartesian mesh");
120 args.
AddOption(&tdim,
"-dim",
"--dimension",
"Dimension for Cartesian mesh");
121 args.
AddOption(&num_refs,
"-r",
"--refs",
"Number of 3:1 refinements");
151 cout <<
"Number of finite element unknowns: "
179 a.FormLinearSystem(ess_tdof_list, x,
b, A, X, B);
182 PCG(*A, M, B, X, 1, 2000, 1e-12, 0.0);
183 a.RecoverFEMSolution(X,
b, x);
188 cout <<
"Error of H1 continuity: " << h1err << endl;
189 MFEM_VERIFY(h1err < 1.0e-7,
"");
193 ofstream mesh_ofs(
"ref321.mesh");
194 mesh_ofs.precision(8);
195 mesh.
Print(mesh_ofs);
196 ofstream sol_ofs(
"sol.gf");
197 sol_ofs.precision(8);
206 sol_sock.precision(8);
207 sol_sock <<
"solution\n" << mesh << x << flush;
229 int Inf1, Inf2, NCFace;
236 auto &int_rule =
IntRules.
Get(FT->FaceGeom, 2 * faceOrder);
244 bool isNCSlave = FT->Elem2No >= 0 && NCFace >= 0;
245 bool isConforming = FT->Elem2No >= 0 && NCFace == -1;
246 if ((FT->Elem1No < FT->Elem2No && isConforming) || isNCSlave)
248 for (
int i = 0; i < nip; i++)
250 const auto &fip = int_rule.IntPoint(i);
253 FT->Loc1.Transform(fip, ip);
256 FT->Loc2.Transform(fip, ip);
259 const real_t err_i = std::abs(v1 - v2);
260 errorMax = std::max(errorMax, err_i);
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.
A coefficient that is constant across space and time.
Class for domain integration .
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
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.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1) const
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
Mesh * GetMesh() const
Returns the mesh.
Data type for Gauss-Seidel smoother of sparse matrix.
Class for grid function - Vector with associated FE space.
virtual real_t GetValue(int i, const IntegrationPoint &ip, int vdim=1) const
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
FiniteElementSpace * FESpace()
Arbitrary order H1-conforming (continuous) finite elements.
Class for integration point with weight.
int GetNPoints() const
Returns the number of the points in the integration rule.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
virtual FaceElementTransformations * GetFaceElementTransformations(int FaceNo, int mask=31)
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void GetFaceInfos(int Face, int *Inf1, int *Inf2) const
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...
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
bool FaceIsInterior(int FaceNo) const
Return true if the given face is interior.
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.
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...
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.
void PCG(const Operator &A, Solver &B, const Vector &b, Vector &x, int print_iter, int max_num_iter, real_t RTOLERANCE, real_t ATOLERANCE)
Preconditioned conjugate gradient method. (tolerances are squared)
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)
real_t CheckH1Continuity(GridFunction &x)
void Refine31(Mesh &mesh, int elem, char type)
void TestAnisoRefRandom(int iter, int dim, Mesh &mesh)