50 int main(
int argc,
char *argv[])
53 const char *mesh_file =
"../data/star.mesh";
56 const char *device_config =
"cpu";
59 bool visualization =
true;
62 args.
AddOption(&mesh_file,
"-m",
"--mesh",
65 "Finite element order (polynomial degree).");
66 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
67 "--no-partial-assembly",
"Enable Partial Assembly.");
68 args.
AddOption(&device_config,
"-d",
"--device",
69 "Device configuration string, see Device::Configure().");
70 args.
AddOption(&max_dofs,
"-md",
"--max-dofs",
71 "Stop after reaching this many degrees of freedom.");
72 args.
AddOption(&LSZZ,
"-ls",
"--ls-zz",
"-no-ls",
74 "Switch to least-squares ZZ estimator.");
75 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
77 "Enable or disable GLVis visualization.");
88 Device device(device_config);
94 Mesh mesh(mesh_file, 1, 1);
103 for (
int i = 0; i < 2; i++)
121 a.SetAssemblyLevel(AssemblyLevel::PARTIAL);
122 a.SetDiagonalPolicy(Operator::DIAG_ONE);
130 a.AddDomainIntegrator(integ);
140 "Boundary attributes required in the mesh.");
166 (estimator)->SetTichonovRegularization();
185 for (
int it = 0; ; it++)
188 cout <<
"\nAMR iteration " << it << endl;
189 cout <<
"Number of unknowns: " << cdofs << endl;
209 const int copy_interior = 1;
210 a.FormLinearSystem(ess_tdof_list, x,
b, A, X, B, copy_interior);
215 #ifndef MFEM_USE_SUITESPARSE 218 PCG(*A, M, B, X, 3, 200, 1e-12, 0.0);
222 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
224 umf_solver.
Mult(B, X);
230 PCG(*A, M, B, X, 3, 2000, 1e-12, 0.0);
236 a.RecoverFEMSolution(X,
b, x);
239 if (visualization && sol_sock.good())
241 sol_sock.precision(8);
242 sol_sock <<
"solution\n" << mesh << x << flush;
245 if (cdofs > max_dofs)
247 cout <<
"Reached the maximum number of dofs. Stop." << endl;
258 cout <<
"Stopping criterion satisfied. Stop." << endl;
Class for domain integration L(v) := (f, v)
Class for grid function - Vector with associated FE space.
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
A coefficient that is constant across space and time.
void PrintOptions(std::ostream &out) const
Print the options.
void PrintUsage(std::ostream &out) const
Print the usage message.
Pointer to an Operator of a specified type.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list, int component=-1)
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
bool Good() const
Return true if the command line options were parsed successfully.
The LSZienkiewiczZhuEstimator class implements the Zienkiewicz-Zhu error estimation procedure [1...
Data type for Gauss-Seidel smoother of sparse matrix.
Direct sparse solver using UMFPACK.
bool Apply(Mesh &mesh)
Perform the mesh operation.
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
Jacobi smoothing for a given bilinear form (no matrix necessary).
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Mesh refinement operator using an error threshold.
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
Set the curvature of the mesh nodes using the given polynomial degree.
Base class for all element based error estimators.
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.
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)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
int SpaceDimension() const
NURBSExtension * NURBSext
Optional NURBS mesh extension.
Element::Type GetElementType(int i) const
Returns the type of element i.
int main(int argc, char *argv[])
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
int Size() const
Return the logical size of the array.
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 ...
bool Stop() const
Check if STOP action is requested, e.g. stopping criterion is satisfied.
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.