50 int main(
int argc,
char *argv[])
53 const char *mesh_file =
"../data/star.mesh";
56 const char *device_config =
"cpu";
58 bool visualization =
true;
61 args.
AddOption(&mesh_file,
"-m",
"--mesh",
64 "Finite element order (polynomial degree).");
65 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
66 "--no-partial-assembly",
"Enable Partial Assembly.");
67 args.
AddOption(&device_config,
"-d",
"--device",
68 "Device configuration string, see Device::Configure().");
69 args.
AddOption(&max_dofs,
"-md",
"--max-dofs",
70 "Stop after reaching this many degrees of freedom.");
71 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
73 "Enable or disable GLVis visualization.");
84 Device device(device_config);
90 Mesh mesh(mesh_file, 1, 1);
99 for (
int i = 0; i < 2; i++)
136 "Boundary attributes required in the mesh.");
146 sol_sock.
open(vishost, visport);
167 for (
int it = 0; ; it++)
170 cout <<
"\nAMR iteration " << it << endl;
171 cout <<
"Number of unknowns: " << cdofs << endl;
191 const int copy_interior = 1;
197 #ifndef MFEM_USE_SUITESPARSE
200 PCG(*A, M, B, X, 3, 200, 1e-12, 0.0);
204 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
206 umf_solver.
Mult(B, X);
212 PCG(*A, M, B, X, 3, 2000, 1e-12, 0.0);
221 if (visualization && sol_sock.good())
223 sol_sock.precision(8);
224 sol_sock <<
"solution\n" << mesh << x << flush;
227 if (cdofs > max_dofs)
229 cout <<
"Reached the maximum number of dofs. Stop." << endl;
240 cout <<
"Stopping criterion satisfied. Stop." << endl;
int Size() const
Return the 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)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
A coefficient that is constant across space and time.
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)
Get a list of essential true dofs, ess_tdof_list, corresponding to the boundary attributes marked in ...
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.
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)
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
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
Print the usage message.
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)
Add a boolean option and set 'var' to receive the value. Enable/disable tags are used to set the bool...
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
Print the options.
int open(const char hostname[], int port)
Open the socket stream on 'port' at 'hostname'.
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.
bool Good() const
Return true if the command line options were parsed successfully.