79int main(
int argc,
char *argv[])
82 const char *mesh_file =
"../data/star.mesh";
84 bool static_cond =
false;
87 const char *device_config =
"cpu";
88 bool visualization =
true;
89 bool algebraic_ceed =
false;
92 args.
AddOption(&mesh_file,
"-m",
"--mesh",
95 "Finite element order (polynomial degree) or -1 for"
96 " isoparametric space.");
97 args.
AddOption(&static_cond,
"-sc",
"--static-condensation",
"-no-sc",
98 "--no-static-condensation",
"Enable static condensation.");
99 args.
AddOption(&pa,
"-pa",
"--partial-assembly",
"-no-pa",
100 "--no-partial-assembly",
"Enable Partial Assembly.");
101 args.
AddOption(&fa,
"-fa",
"--full-assembly",
"-no-fa",
102 "--no-full-assembly",
"Enable Full Assembly.");
103 args.
AddOption(&device_config,
"-d",
"--device",
104 "Device configuration string, see Device::Configure().");
106 args.
AddOption(&algebraic_ceed,
"-a",
"--algebraic",
"-no-a",
"--no-algebraic",
107 "Use algebraic Ceed solver");
109 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
110 "--no-visualization",
111 "Enable or disable GLVis visualization.");
122 Device device(device_config);
128 Mesh mesh(mesh_file, 1, 1);
137 (int)floor(log(50000./mesh.
GetNE())/log(2.)/
dim);
138 for (
int l = 0; l < ref_levels; l++)
159 cout <<
"Using isoparametric FEs: " << fec->
Name() << endl;
166 cout <<
"Number of finite element unknowns: "
204 if (pa) {
a.SetAssemblyLevel(AssemblyLevel::PARTIAL); }
207 a.SetAssemblyLevel(AssemblyLevel::FULL);
219 if (static_cond) {
a.EnableStaticCondensation(); }
226 cout <<
"Size of linear system: " << A->
Height() << endl;
237 cudss_solver.
Mult(B, X);
242#ifndef MFEM_USE_SUITESPARSE
245 PCG(*A, M, B, X, 1, 200, 1e-12, 0.0);
249 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
251 umf_solver.
Mult(B, X);
262 PCG(*A, M, B, X, 1, 400, 1e-12, 0.0);
267 PCG(*A, M, B, X, 1, 400, 1e-12, 0.0);
272 CG(*A, B, X, 1, 400, 1e-12, 0.0);
277 a.RecoverFEMSolution(X,
b, x);
281 ofstream mesh_ofs(
"refined.mesh");
282 mesh_ofs.precision(8);
283 mesh.
Print(mesh_ofs);
284 ofstream sol_ofs(
"sol.gf");
285 sol_ofs.precision(8);
294 sol_sock.precision(8);
295 sol_sock <<
"solution\n" << mesh << x << flush;
299 if (order > 0) {
delete fec; }
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.
@ GaussLobatto
Closed type.
@ Positive
Bernstein polynomials.
A coefficient that is constant across space and time.
cuDSS: A high-performance CUDA Library for Direct Sparse Solvers
void Mult(const Vector &x, Vector &y) const override
Solve .
void SetOperator(const Operator &op) override
Set/update the solver for the given operator.
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
void Print(std::ostream &os=mfem::out)
Print the configuration of the MFEM virtual device object.
static bool Allows(unsigned long b_mask)
Return true if any of the backends in the backend mask, b_mask, are allowed.
static bool IsEnabled()
Return true if any backend other than Backend::CPU is enabled.
Class for domain integration .
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
virtual const char * Name() const
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 ...
Gauss-Seidel smoother of a sparse matrix.
Class for grid function - Vector with associated FE space.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Arbitrary order H1-conforming (continuous) finite elements.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
virtual void MarkExternalBoundaries(Array< int > &bdr_marker, bool excl=true) const
Mark boundary attributes of external boundaries.
virtual void Print(std::ostream &os=mfem::out, const std::string &comments="") const
Print the mesh to the given stream using the default MFEM mesh format.
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
bool IsSimplexMesh() const
Returns true if the mesh is a simplex mesh, false otherwise.
void GetNodes(Vector &node_coord) const
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).
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
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.
Direct sparse solver using UMFPACK.
real_t Control[UMFPACK_CONTROL]
void SetOperator(const Operator &op) override
Factorize the given Operator op which must be a SparseMatrix.
void Mult(const Vector &b, Vector &x) const override
Direct solution of the linear system using UMFPACK.
Wrapper for AlgebraicMultigrid object.
const int * ess_tdof_list
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)
void CG(const Operator &A, const Vector &b, Vector &x, int print_iter, int max_num_iter, real_t RTOLERANCE, real_t ATOLERANCE)
Conjugate gradient method. (tolerances are squared)
bool UsesTensorBasis(const FiniteElementSpace &fes)
Return true if the mesh contains only one topology and the elements are tensor elements.
@ CUDA_MASK
Biwise-OR of all CUDA backends.