39 int main(
int argc,
char *argv[])
42 const char *mesh_file =
"../data/star.mesh";
47 bool visualization = 1;
50 args.
AddOption(&mesh_file,
"-m",
"--mesh",
52 args.
AddOption(&ref_levels,
"-r",
"--refine",
53 "Number of times to refine the mesh uniformly, -1 for auto.");
55 "Finite element order (polynomial degree) >= 0.");
57 "One of the two DG penalty parameters, typically +1/-1."
58 " See the documentation of class DGDiffusionIntegrator.");
60 "One of the two DG penalty parameters, should be positive."
61 " Negative values are replaced with (order+1)^2.");
62 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
64 "Enable or disable GLVis visualization.");
73 kappa = (order+1)*(order+1);
80 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
90 ref_levels = (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
92 for (
int l = 0; l < ref_levels; l++)
106 cout <<
"Number of unknowns: " << fespace->
GetVSize() << endl;
137 #ifndef MFEM_USE_SUITESPARSE
144 PCG(A, M, *b, x, 1, 500, 1e-12, 0.0);
148 GMRES(A, M, *b, x, 1, 500, 10, 1e-12, 0.0);
153 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
155 umf_solver.
Mult(*b, x);
160 ofstream mesh_ofs(
"refined.mesh");
161 mesh_ofs.precision(8);
162 mesh->
Print(mesh_ofs);
163 ofstream sol_ofs(
"sol.gf");
164 sol_ofs.precision(8);
170 char vishost[] =
"localhost";
173 sol_sock.precision(8);
174 sol_sock <<
"solution\n" << *mesh << x << flush;
Class for domain integration L(v) := (f, v)
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
virtual void Print(std::ostream &out=mfem::out) const
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
int GetNE() const
Returns number of elements.
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.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
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)
void PrintUsage(std::ostream &out) const
L2_FECollection DG_FECollection
Declare an alternative name for L2_FECollection = DG_FECollection.
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)
NURBSExtension * NURBSext
Optional NURBS mesh extension.
void PrintOptions(std::ostream &out) const
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
int GMRES(const Operator &A, Vector &x, const Vector &b, Solver &M, int &max_iter, int m, double &tol, double atol, int printit)
GMRES method. (tolerances are squared)
virtual void SetOperator(const Operator &op)
Factorize the given Operator op which must be a SparseMatrix.
double sigma(const Vector &x)