40 int main(
int argc,
char *argv[])
43 const char *mesh_file =
"../data/star.mesh";
45 bool visualization = 1;
48 args.
AddOption(&mesh_file,
"-m",
"--mesh",
51 "Finite element order (polynomial degree).");
52 args.
AddOption(&visualization,
"-vis",
"--visualization",
"-no-vis",
54 "Enable or disable GLVis visualization.");
66 ifstream imesh(mesh_file);
69 cerr <<
"\nCan not open mesh file: " << mesh_file <<
'\n' << endl;
72 Mesh mesh(imesh, 1, 1);
81 for (
int i = 0; i < 2; i++)
117 char vishost[] =
"localhost";
121 sol_sock.
open(vishost, visport);
127 const int max_it = 15;
128 for (
int it = 0; it < max_it; it++)
130 cout <<
"\nIteration " << it << endl;
153 #ifndef MFEM_USE_SUITESPARSE
157 PCG(A, M, b, x, 1, 200, 1e-12, 0.0);
162 umf_solver.
Control[UMFPACK_ORDERING] = UMFPACK_ORDERING_METIS;
164 umf_solver.
Mult(b, x);
174 if (visualization && sol_sock.good())
176 sol_sock.precision(8);
177 sol_sock <<
"solution\n" << mesh << x << flush;
195 const double frac = 0.7;
197 double threshold = (frac*frac) * errors.
Max();
198 for (
int i = 0; i < errors.Size(); i++)
199 if (errors[i] >= threshold)
Class for domain integration L(v) := (f, v)
Class for grid function - Vector with associated FE space.
void ComputeFlux(BilinearFormIntegrator &blfi, GridFunction &u, GridFunction &flux, int wcoef, int sd)
Subclass constant coefficient.
void ConformingProlongate(const Vector &x)
int GetNE() const
Returns number of elements.
Data type for Gauss-Seidel smoother of sparse matrix.
Direct sparse solver using UMFPACK.
void ZZErrorEstimator(BilinearFormIntegrator &blfi, GridFunction &u, GridFunction &flux, Vector &ErrorEstimates, int wsd)
int Append(const T &el)
Append element to array, resize if necessary.
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
void PCG(const Operator &A, Solver &B, const Vector &b, Vector &x, int print_iter, int max_num_iter, double RTOLERANCE, double ATOLERANCE)
Preconditioned conjugate gradient method. (tolerances are squared)
void SetNodalFESpace(FiniteElementSpace *nfes)
void PrintUsage(std::ostream &out) const
Array< int > bdr_attributes
void UseTwoLevelState(int use)
int main(int argc, char *argv[])
double Control[UMFPACK_CONTROL]
Abstract finite element space.
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
virtual void UpdateAndInterpolate(int num_grid_fns,...)
int GetNConformingDofs() const
void PrintOptions(std::ostream &out) const
int open(const char hostname[], int port)
void GetNodes(Vector &node_coord) const
Arbitrary order H1-conforming (continuous) finite elements.
virtual void Mult(const Vector &b, Vector &x) const
Operator application.
void GeneralRefinement(Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
void ProjectBdrCoefficient(Coefficient &coeff, Array< int > &attr)
virtual void SetOperator(const Operator &op)
Set/update the solver for the given operator.