41 int main(
int argc,
char *argv[])
45 MPI_Init(&argc, &argv);
46 MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
47 MPI_Comm_rank(MPI_COMM_WORLD, &myid);
50 const char *mesh_file =
"../data/star.mesh";
52 bool visualization =
true;
55 args.
AddOption(&mesh_file,
"-m",
"--mesh",
58 "Finite element order (polynomial degree).");
59 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
61 "Enable or disable GLVis visualization.");
81 ifstream imesh(mesh_file);
86 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
91 mesh =
new Mesh(imesh, 1, 1);
108 ParMesh pmesh(MPI_COMM_WORLD, *mesh);
112 "Boundary attributes required in the mesh.");
138 char vishost[] =
"localhost";
144 sout.
open(vishost, visport);
149 cout <<
"Unable to connect to GLVis server at "
150 << vishost <<
':' << visport << endl;
151 cout <<
"GLVis visualization disabled.\n";
153 visualization =
false;
163 const int max_dofs = 100000;
164 for (
int it = 0; ; it++)
169 cout <<
"\nIteration " << it << endl;
170 cout <<
"Number of unknowns: " << global_dofs << endl;
212 sout <<
"parallel " << num_procs <<
" " << myid <<
"\n";
213 sout <<
"solution\n" << pmesh << x << flush;
216 if (global_dofs > max_dofs)
242 smooth_flux_fes, flux_fes, errors, norm_p);
244 double local_max_err = errors.Max();
245 double global_max_err;
246 MPI_Allreduce(&local_max_err, &global_max_err, 1,
247 MPI_DOUBLE, MPI_MAX, pmesh.
GetComm());
252 const double frac = 0.7;
253 double threshold = frac * global_max_err;
254 for (
int i = 0; i < errors.Size(); i++)
256 if (errors[i] >= threshold) { ref_list.
Append(i); }
int Size() const
Logical size of the array.
Class for domain integration L(v) := (f, v)
Subclass constant coefficient.
HYPRE_Int GlobalTrueVSize()
int GetNE() const
Returns number of elements.
Abstract parallel finite element space.
void SetPrintLevel(int print_lvl)
The BoomerAMG solver in hypre.
int Append(const T &el)
Append element to array, resize if necessary.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void SetPrintLevel(int print_level)
void SetCurvature(int order, bool discont=false, int space_dim=-1, int ordering=1)
void L2ZZErrorEstimator(BilinearFormIntegrator &flux_integrator, ParGridFunction &x, ParFiniteElementSpace &smooth_flux_fes, ParFiniteElementSpace &flux_fes, Vector &errors, int norm_p, double solver_tol, int solver_max_it)
void PrintUsage(std::ostream &out) const
void SetMaxIter(int max_iter)
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
int SpaceDimension() const
Array< int > bdr_attributes
int main(int argc, char *argv[])
virtual void GetEssentialTrueDofs(const Array< int > &bdr_attr_is_ess, Array< int > &ess_tdof_list)
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
int open(const char hostname[], int port)
Arbitrary order H1-conforming (continuous) finite elements.
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.
void GeneralRefinement(const Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
Class for parallel meshes.
Arbitrary order "L2-conforming" discontinuous finite elements.