37 int main(
int argc,
char *argv[])
40 const char *mesh_file =
"../data/star.mesh";
45 bool visualization = 1;
48 args.
AddOption(&mesh_file,
"-m",
"--mesh",
50 args.
AddOption(&ref_levels,
"-r",
"--refine",
51 "Number of times to refine the mesh uniformly, -1 for auto.");
53 "Finite element order (polynomial degree) >= 0.");
55 "One of the two DG penalty parameters, typically +1/-1."
56 " See the documentation of class DiffusionIntegrator.");
58 "One of the two DG penalty parameters, should be positive."
59 " Negative values are replaced with (order+1)^2.");
60 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
62 "Enable or disable GLVis visualization.");
71 kappa = (order+1)*(order+1);
79 ifstream imesh(mesh_file);
82 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
85 mesh =
new Mesh(imesh, 1, 1);
100 ref_levels = (int)floor(log(50000./mesh->
GetNE())/log(2.)/
dim);
102 for (
int l = 0; l < ref_levels; l++)
112 cout <<
"Number of unknowns: " << fespace->
GetVSize() << endl;
143 #ifndef MFEM_USE_SUITESPARSE
150 PCG(A, M, *b, x, 1, 500, 1e-12, 0.0);
154 GMRES(A, M, *b, x, 1, 500, 10, 1e-12, 0.0);
159 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
161 umf_solver.
Mult(*b, x);
166 ofstream mesh_ofs(
"refined.mesh");
167 mesh_ofs.precision(8);
168 mesh->
Print(mesh_ofs);
169 ofstream sol_ofs(
"sol.gf");
170 sol_ofs.precision(8);
176 char vishost[] =
"localhost";
179 sol_sock.precision(8);
180 sol_sock <<
"solution\n" << *mesh << x << flush;
Class for domain integration L(v) := (f, v)
Class for grid function - Vector with associated FE space.
Subclass constant coefficient.
int GetNE() const
Returns number of elements.
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 *)
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
virtual void Print(std::ostream &out=std::cout) const
Print the mesh to the given stream using the default MFEM mesh format.
int main(int argc, char *argv[])
double Control[UMFPACK_CONTROL]
Abstract finite element space.
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
void PrintOptions(std::ostream &out) const
virtual void Mult(const Vector &b, Vector &x) const
Operator application.
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)
Set/update the solver for the given operator.