34 int main(
int argc,
char *argv[])
38 MPI_Init(&argc, &argv);
39 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
40 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
43 const char *mesh_file =
"../data/star.mesh";
44 int ser_ref_levels = -1;
45 int par_ref_levels = 2;
49 bool visualization = 1;
52 args.
AddOption(&mesh_file,
"-m",
"--mesh",
54 args.
AddOption(&ser_ref_levels,
"-rs",
"--refine-serial",
55 "Number of times to refine the mesh uniformly in serial,"
57 args.
AddOption(&par_ref_levels,
"-rp",
"--refine-parallel",
58 "Number of times to refine the mesh uniformly in parallel.");
60 "Finite element order (polynomial degree) >= 0.");
62 "One of the two DG penalty parameters, typically +1/-1."
63 " See the documentation of class DiffusionIntegrator.");
65 "One of the two DG penalty parameters, should be positive."
66 " Negative values are replaced with (order+1)^2.");
67 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
69 "Enable or disable GLVis visualization.");
82 kappa = (order+1)*(order+1);
93 ifstream imesh(mesh_file);
98 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
103 mesh =
new Mesh(imesh, 1, 1);
116 if (ser_ref_levels < 0)
118 ser_ref_levels = (int)floor(log(10000./mesh->
GetNE())/log(2.)/
dim);
120 for (
int l = 0; l < ser_ref_levels; l++)
132 for (
int l = 0; l < par_ref_levels; l++)
145 cout <<
"Number of unknowns: " << size << endl;
218 ostringstream mesh_name, sol_name;
219 mesh_name <<
"mesh." << setfill(
'0') << setw(6) << myid;
220 sol_name <<
"sol." << setfill(
'0') << setw(6) << myid;
222 ofstream mesh_ofs(mesh_name.str().c_str());
223 mesh_ofs.precision(8);
224 pmesh->
Print(mesh_ofs);
226 ofstream sol_ofs(sol_name.str().c_str());
227 sol_ofs.precision(8);
234 char vishost[] =
"localhost";
237 sol_sock <<
"parallel " << num_procs <<
" " << myid <<
"\n";
238 sol_sock.precision(8);
239 sol_sock <<
"solution\n" << *pmesh << x << flush;
Class for domain integration L(v) := (f, v)
Subclass constant coefficient.
HYPRE_Int GlobalTrueVSize()
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 &x, Vector &y) const
Operator application.
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)
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)
int main(int argc, char *argv[])
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
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.
virtual void Print(std::ostream &out=std::cout) const