40 int main(
int argc,
char *argv[])
44 MPI_Init(&argc, &argv);
45 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
46 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
49 const char *mesh_file =
"../data/star.mesh";
51 bool visualization = 1;
54 args.
AddOption(&mesh_file,
"-m",
"--mesh",
57 "Finite element order (polynomial degree).");
58 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
60 "Enable or disable GLVis visualization.");
79 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
88 (int)floor(log(10000./mesh->
GetNE())/log(2.)/
dim);
89 for (
int l = 0; l < ref_levels; l++)
101 int par_ref_levels = 1;
102 for (
int l = 0; l < par_ref_levels; l++)
117 int trial_order = order;
118 int trace_order = order - 1;
119 int test_order = order;
120 if (dim == 2 && (order%2 == 0 || (pmesh->
MeshGenerator() & 2 && order > 1)))
124 if (test_order < trial_order)
126 cerr <<
"Warning, test space not enriched enough to handle primal"
146 cout <<
"\nNumber of Unknowns:\n"
147 <<
" Trial space, X0 : " << glob_true_s0
148 <<
" (order " << trial_order <<
")\n"
149 <<
" Interface space, Xhat : " << glob_true_s1
150 <<
" (order " << trace_order <<
")\n"
151 <<
" Test space, Y : " << glob_true_s_test
152 <<
" (order " << test_order <<
")\n\n";
208 enum {x0_var, xhat_var, NVAR};
212 int true_s_test = test_space->
TrueVSize();
216 true_offsets[1] = true_s0;
217 true_offsets[2] = true_s0+true_s1;
220 true_offsets_test[0] = 0;
221 true_offsets_test[1] = true_s_test;
239 matSinv->
Mult(*trueF, SinvF);
258 if (dim == 2) { Shatinv =
new HypreAMS(*Shat, xhat_space); }
259 else { Shatinv =
new HypreADS(*Shat, xhat_space); }
280 matSinv->
Mult(LSres, tmp);
284 cout <<
"\n|| B0*x0 + Bhat*xhat - F ||_{S^-1} = " << res << endl;
293 ostringstream mesh_name, sol_name;
294 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
295 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
297 ofstream mesh_ofs(mesh_name.str().c_str());
298 mesh_ofs.precision(8);
299 pmesh->
Print(mesh_ofs);
301 ofstream sol_ofs(sol_name.str().c_str());
302 sol_ofs.precision(8);
309 char vishost[] =
"localhost";
312 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
313 sol_sock.precision(8);
314 sol_sock <<
"solution\n" << *pmesh << *x0 << flush;
Class for domain integration L(v) := (f, v)
Conjugate gradient method.
The Auxiliary-space Maxwell Solver in hypre.
Integrator defining a sum of multiple Integrators.
The Auxiliary-space Divergence Solver in hypre.
Subclass constant coefficient.
virtual void ReorientTetMesh()
See the remarks for the serial version in mesh.hpp.
HYPRE_Int GlobalTrueVSize()
virtual void MultTranspose(const Vector &x, Vector &y) const
Action of the transpose operator.
int GetNE() const
Returns number of elements.
virtual void Save(std::ostream &out) const
Abstract parallel finite element space.
void AddIntegrator(BilinearFormIntegrator *integ)
void SetBlock(int iRow, int iCol, Operator *op)
Add a block op in the block-entry (iblock, jblock).
virtual void Mult(const Vector &x, Vector &y) const
Operator application: y=A(x).
int main(int argc, char *argv[])
HYPRE_Int Mult(HypreParVector &x, HypreParVector &y, double alpha=1.0, double beta=0.0)
Computes y = alpha * A * x + beta * y.
Integrator that inverts the matrix assembled by another integrator.
The BoomerAMG solver in hypre.
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 SetPrintLevel(int print_level)
void SetMaxIter(int max_it)
HypreParMatrix * RAP(HypreParMatrix *A, HypreParMatrix *P)
Returns the matrix P^t * A * P.
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.
void PrintUsage(std::ostream &out) const
virtual void Mult(const Vector &x, Vector &y) const
Operator application.
Wrapper for hypre's parallel vector class.
Array< int > bdr_attributes
A list of all unique boundary attributes used by the Mesh.
void SetRelTol(double rtol)
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 Distribute(const Vector *tv)
double InnerProduct(HypreParVector *x, HypreParVector *y)
void PrintOptions(std::ostream &out) const
Abstract class for hypre's solvers and preconditioners.
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Arbitrary order H1-conforming (continuous) finite elements.
virtual void GetEssentialVDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_dofs) const
Determine the boundary degrees of freedom.
Class for parallel grid function.
Wrapper for hypre's ParCSR matrix class.
A class to handle Block systems in a matrix-free implementation.
Class for parallel meshes.
void SetDiagonalBlock(int iblock, Operator *op)
Add a square block op in the block-entry (iblock, iblock).
Arbitrary order "L2-conforming" discontinuous finite elements.
virtual void Print(std::ostream &out=std::cout) const