36 int main(
int argc,
char *argv[])
40 MPI_Init(&argc, &argv);
41 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
42 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
45 const char *mesh_file =
"../data/star.mesh";
46 int ser_ref_levels = -1;
47 int par_ref_levels = 2;
51 bool visualization = 1;
54 args.
AddOption(&mesh_file,
"-m",
"--mesh",
56 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
57 "Number of times to refine the mesh uniformly in serial,"
59 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
60 "Number of times to refine the mesh uniformly in parallel.");
62 "Finite element order (polynomial degree) >= 0.");
64 "One of the two DG penalty parameters, typically +1/-1."
65 " See the documentation of class DGDiffusionIntegrator.");
67 "One of the two DG penalty parameters, should be positive."
68 " Negative values are replaced with (order+1)^2.");
69 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
71 "Enable or disable GLVis visualization.");
84 kappa = (order+1)*(order+1);
94 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
102 if (ser_ref_levels < 0)
104 ser_ref_levels = (int)floor(log(10000./mesh->
GetNE())/log(2.)/
dim);
106 for (
int l = 0; l < ser_ref_levels; l++)
122 for (
int l = 0; l < par_ref_levels; l++)
135 cout <<
"Number of unknowns: " << size << endl;
208 ostringstream mesh_name, sol_name;
209 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
210 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
212 ofstream mesh_ofs(mesh_name.str().c_str());
213 mesh_ofs.precision(8);
214 pmesh->
Print(mesh_ofs);
216 ofstream sol_ofs(sol_name.str().c_str());
217 sol_ofs.precision(8);
224 char vishost[] =
"localhost";
227 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
228 sol_sock.precision(8);
229 sol_sock <<
"solution\n" << *pmesh << x << flush;
Class for domain integration L(v) := (f, v)
Subclass constant coefficient.
int GetNE() const
Returns number of elements.
virtual void Save(std::ostream &out) const
Abstract parallel finite element space.
void SetPrintLevel(int print_lvl)
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
The BoomerAMG solver in hypre.
void SetPrintLevel(int print_lvl)
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetMaxIter(int max_it)
void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
HYPRE_Int GlobalTrueVSize() const
virtual void Print(std::ostream &out=mfem::out) const
void PrintUsage(std::ostream &out) const
void SetMaxIter(int max_iter)
L2_FECollection DG_FECollection
Wrapper for hypre's parallel vector class.
void SetAbsTol(double atol)
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)
NURBSExtension * NURBSext
Optional NURBS mesh extension.
void SetPreconditioner(HypreSolver &precond)
Set the hypre solver to be used as a preconditioner.
void PrintOptions(std::ostream &out) const
Abstract class for hypre's solvers and preconditioners.
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Class for parallel grid function.
Wrapper for hypre's ParCSR matrix class.
virtual void Mult(const HypreParVector &b, HypreParVector &x) const
Solve Ax=b with hypre's PCG.
Class for parallel meshes.
void ParallelProject(Vector &tv) const
Returns the vector restricted to the true dofs.