38 int main(
int argc,
char *argv[])
42 MPI_Init(&argc, &argv);
43 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
44 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
47 const char *mesh_file =
"../data/star.mesh";
48 int ser_ref_levels = -1;
49 int par_ref_levels = 2;
53 bool visualization = 1;
56 args.
AddOption(&mesh_file,
"-m",
"--mesh",
58 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
59 "Number of times to refine the mesh uniformly in serial,"
61 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
62 "Number of times to refine the mesh uniformly in parallel.");
64 "Finite element order (polynomial degree) >= 0.");
66 "One of the two DG penalty parameters, typically +1/-1."
67 " See the documentation of class DGDiffusionIntegrator.");
69 "One of the two DG penalty parameters, should be positive."
70 " Negative values are replaced with (order+1)^2.");
71 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
73 "Enable or disable GLVis visualization.");
86 kappa = (order+1)*(order+1);
96 Mesh *mesh =
new Mesh(mesh_file, 1, 1);
104 if (ser_ref_levels < 0)
106 ser_ref_levels = (int)floor(log(10000./mesh->
GetNE())/log(2.)/
dim);
108 for (
int l = 0; l < ser_ref_levels; l++)
124 for (
int l = 0; l < par_ref_levels; l++)
137 cout <<
"Number of unknowns: " << size << endl;
210 ostringstream mesh_name, sol_name;
211 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
212 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
214 ofstream mesh_ofs(mesh_name.str().c_str());
215 mesh_ofs.precision(8);
216 pmesh->
Print(mesh_ofs);
218 ofstream sol_ofs(sol_name.str().c_str());
219 sol_ofs.precision(8);
226 char vishost[] =
"localhost";
229 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
230 sol_sock.precision(8);
231 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.
int main(int argc, char *argv[])
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)
virtual void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
HYPRE_Int GlobalTrueVSize() const
void SetKDim(int dim)
Set the number of iteration to perform between restarts, default is 50.
virtual void Print(std::ostream &out=mfem::out) const
void PrintUsage(std::ostream &out) const
void SetMaxIter(int max_iter)
L2_FECollection DG_FECollection
Declare an alternative name for 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.
double sigma(const Vector &x)