46 int main(
int argc,
char *argv[])
49 const char *mesh_file =
"../data/star.mesh";
52 const char *device_config =
"cpu";
53 bool visualization =
true;
56 args.
AddOption(&mesh_file,
"-m",
"--mesh",
59 "Finite element order (polynomial degree).");
60 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
61 "--no-partial-assembly",
"Enable Partial Assembly.");
62 args.
AddOption(&device_config,
"-d",
"--device",
63 "Device configuration string, see Device::Configure().");
64 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
66 "Enable or disable GLVis visualization.");
77 Device device(device_config);
83 Mesh mesh(mesh_file, 1, 1);
92 for (
int i = 0; i < 2; i++)
125 "Boundary attributes required in the mesh.");
130 char vishost[] =
"localhost";
135 sol_sock.
open(vishost, visport);
156 const int max_dofs = 50000;
157 for (
int it = 0; ; it++)
160 cout <<
"\nAMR iteration " << it << endl;
161 cout <<
"Number of unknowns: " << cdofs << endl;
181 const int copy_interior = 1;
187 #ifndef MFEM_USE_SUITESPARSE
190 PCG(*A, M, B, X, 3, 200, 1e-12, 0.0);
194 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
196 umf_solver.
Mult(B, X);
201 CG(*A, B, X, 3, 2000, 1e-12, 0.0);
210 if (visualization && sol_sock.good())
212 sol_sock.precision(8);
213 sol_sock <<
"solution\n" << mesh << x << flush;
216 if (cdofs > max_dofs)
218 cout <<
"Reached the maximum number of dofs. Stop." << endl;
229 cout <<
"Stopping criterion satisfied. Stop." << endl;
int Size() const
Logical size of the array.
Class for domain integration L(v) := (f, v)
void SetAnisotropic(bool aniso=true)
Enable/disable anisotropic estimates. To enable this option, the BilinearFormIntegrator must support ...
Class for grid function - Vector with associated FE space.
virtual void Update(bool want_transform=true)
Subclass constant coefficient.
Pointer to an Operator of a specified type.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
bool Stop() const
Check if STOP action is requested, e.g. stopping criterion is satisfied.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
int main(int argc, char *argv[])
Data type for Gauss-Seidel smoother of sparse matrix.
Direct sparse solver using UMFPACK.
bool Apply(Mesh &mesh)
Perform the mesh operation.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Mesh refinement operator using an error threshold.
void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
void CG(const Operator &A, const Vector &b, Vector &x, int print_iter, int max_num_iter, double RTOLERANCE, double ATOLERANCE)
Conjugate gradient method. (tolerances are squared)
void PCG(const Operator &A, Solver &B, const Vector &b, Vector &x, int print_iter, int max_num_iter, double RTOLERANCE, double ATOLERANCE)
Preconditioned conjugate gradient method. (tolerances are squared)
virtual int GetTrueVSize() const
Return the number of vector true (conforming) dofs.
void PrintUsage(std::ostream &out) const
int SpaceDimension() const
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
double Control[UMFPACK_CONTROL]
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
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)
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
NURBSExtension * NURBSext
Optional NURBS mesh extension.
void PrintOptions(std::ostream &out) const
int open(const char hostname[], int port)
The ZienkiewiczZhuEstimator class implements the Zienkiewicz-Zhu error estimation procedure...
Arbitrary order H1-conforming (continuous) finite elements.
void SetTotalErrorFraction(double fraction)
Set the total fraction used in the computation of the threshold. The default value is 1/2...
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
void ProjectBdrCoefficient(Coefficient &coeff, Array< int > &attr)
Project a Coefficient on the GridFunction, modifying only DOFs on the boundary associated with the bo...
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.