50int 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);
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;
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
int Size() const
Return the logical size of the array.
A coefficient that is constant across space and time.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Class for domain integration .
Base class for all element based error estimators.
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.
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 ...
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
Data type for Gauss-Seidel smoother of sparse matrix.
Class for grid function - Vector with associated FE space.
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
void ProjectBdrCoefficient(Coefficient &coeff, const Array< int > &attr)
Project a Coefficient on the GridFunction, modifying only DOFs on the boundary associated with the bo...
Arbitrary order H1-conforming (continuous) finite elements.
The LSZienkiewiczZhuEstimator class implements the Zienkiewicz-Zhu error estimation procedure [1,...
bool Apply(Mesh &mesh)
Perform the mesh operation.
bool Stop() const
Check if STOP action is requested, e.g. stopping criterion is satisfied.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
NURBSExtension * NURBSext
Optional NURBS mesh extension.
Element::Type GetElementType(int i) const
Returns the type of element i.
int Dimension() const
Dimension of the reference space used within the elements.
int SpaceDimension() const
Dimension of the physical space containing the mesh.
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.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Pointer to an Operator of a specified type.
Jacobi smoothing for a given bilinear form (no matrix necessary).
@ DIAG_ONE
Set the diagonal value to one.
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.
Mesh refinement operator using an error threshold.
void SetTotalErrorFraction(real_t fraction)
Set the total fraction used in the computation of the threshold. The default value is 1/2.
Direct sparse solver using UMFPACK.
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.
real_t Control[UMFPACK_CONTROL]
virtual void Mult(const Vector &b, Vector &x) const
Direct solution of the linear system using UMFPACK.
The ZienkiewiczZhuEstimator class implements the Zienkiewicz-Zhu error estimation procedure.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
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)