39 int main(
int argc,
char *argv[])
42 const char *mesh_file =
"../data/star.mesh";
44 bool visualization = 1;
47 args.
AddOption(&mesh_file,
"-m",
"--mesh",
50 "Finite element order (polynomial degree).");
51 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
53 "Enable or disable GLVis visualization.");
65 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
74 (int)floor(log(10000./mesh->
GetNE())/log(2.)/
dim);
75 for (
int l = 0; l < ref_levels; l++)
89 unsigned int trial_order = order;
90 unsigned int trace_order = order - 1;
91 unsigned int test_order = order;
93 if (dim == 2 && (order%2 == 0 || (mesh->
MeshGenerator() & 2 && order > 1)))
97 if (test_order < trial_order)
98 cerr <<
"Warning, test space not enriched enough to handle primal"
114 enum {x0_var, xhat_var, NVAR};
118 int s_test = test_space->
GetVSize();
127 offsets_test[1] = s_test;
129 std::cout <<
"\nNumber of Unknowns:\n"
130 <<
" Trial space, X0 : " << s0
131 <<
" (order " << trial_order <<
")\n"
132 <<
" Interface space, Xhat : " << s1
133 <<
" (order " << trace_order <<
")\n"
134 <<
" Test space, Y : " << s_test
135 <<
" (order " << test_order <<
")\n\n";
194 matSinv.
Mult(F,SinvF);
206 #ifndef MFEM_USE_SUITESPARSE
207 const double prec_rtol = 1e-3;
208 const int prec_maxit = 200;
235 PCG(A, P, b, x, 1, 200, 1e-12, 0.0);
242 cout <<
"\n|| B0*x0 + Bhat*xhat - F ||_{S^-1} = " << res << endl;
246 x0.
MakeRef(x0_space, x.GetBlock(x0_var), 0);
251 ofstream mesh_ofs(
"refined.mesh");
252 mesh_ofs.precision(8);
253 mesh->
Print(mesh_ofs);
254 ofstream sol_ofs(
"sol.gf");
255 sol_ofs.precision(8);
262 char vishost[] =
"localhost";
265 sol_sock.precision(8);
266 sol_sock <<
"solution\n" << *mesh << x0 << 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
Conjugate gradient method.
Class for grid function - Vector with associated FE space.
Integrator defining a sum of multiple Integrators.
Subclass constant coefficient.
HypreParMatrix * RAP(const HypreParMatrix *A, const HypreParMatrix *P)
Returns the matrix P^t * A * P.
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator.
int GetNE() const
Returns number of elements.
void AddIntegrator(BilinearFormIntegrator *integ)
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
int main(int argc, char *argv[])
Direct sparse solver using UMFPACK.
Integrator that inverts the matrix assembled by another integrator.
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
void SetPrintLevel(int print_lvl)
A class to handle Block diagonal preconditioners in a matrix-free implementation. ...
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetMaxIter(int max_it)
int MeshGenerator()
Get the mesh generator/type.
T Max() const
Find the maximal element in the array, using the comparison operator < for class T.
The operator x -> R*A*P*x constructed through the actions of R^T, A and P.
virtual void MakeRef(FiniteElementSpace *f, double *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
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
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void SetRelTol(double rtol)
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual void Mult(const Vector &x, Vector &y) const
Matrix vector multiplication.
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)
void PrintOptions(std::ostream &out) const
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
Arbitrary order H1-conforming (continuous) finite elements.
A class to handle Block systems in a matrix-free implementation.
double InnerProduct(const Vector &x, const Vector &y) const
Compute y^t A x.
void SetBlock(int iRow, int iCol, Operator *op, double c=1.0)
Add a block op in the block-entry (iblock, jblock).
void SetDiagonalBlock(int iblock, Operator *op)
Add a square block op in the block-entry (iblock, iblock).
Arbitrary order "L2-conforming" discontinuous finite elements.