58 int main(
int argc,
char *argv[])
61 const char *mesh_file =
"../data/star.mesh";
63 bool static_cond =
false;
65 const char *device_config =
"cpu";
66 bool visualization =
true;
69 args.
AddOption(&mesh_file,
"-m",
"--mesh",
72 "Finite element order (polynomial degree) or -1 for"
73 " isoparametric space.");
74 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
75 "--no-static-condensation",
"Enable static condensation.");
76 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
77 "--no-partial-assembly",
"Enable Partial Assembly.");
78 args.
AddOption(&device_config,
"-d",
"--device",
79 "Device configuration string, see Device::Configure().");
80 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
82 "Enable or disable GLVis visualization.");
93 Device device(device_config);
99 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
108 (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
109 for (
int l = 0; l < ref_levels; l++)
126 cout <<
"Using isoparametric FEs: " << fec->
Name() << endl;
133 cout <<
"Number of finite element unknowns: "
180 cout <<
"Size of linear system: " << A->
Height() << endl;
185 #ifndef MFEM_USE_SUITESPARSE
188 PCG(*A, M, B, X, 1, 200, 1e-12, 0.0);
192 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
194 umf_solver.
Mult(B, X);
199 CG(*A, B, X, 1, 2000, 1e-12, 0.0);
207 ofstream mesh_ofs(
"refined.mesh");
208 mesh_ofs.precision(8);
209 mesh->
Print(mesh_ofs);
210 ofstream sol_ofs(
"sol.gf");
211 sol_ofs.precision(8);
217 char vishost[] =
"localhost";
220 sol_sock.precision(8);
221 sol_sock <<
"solution\n" << *mesh << x << flush;
228 if (order > 0) {
delete fec; }
int Size() const
Logical size of the array.
Class for domain integration L(v) := (f, v)
virtual void Print(std::ostream &out=mfem::out) const
Class for grid function - Vector with associated FE space.
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)
int GetNE() const
Returns number of elements.
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.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
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
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 const char * Name() const
void PrintOptions(std::ostream &out) const
void GetNodes(Vector &node_coord) const
Arbitrary order H1-conforming (continuous) finite elements.
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).
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.