21 for (
int i =
sequence.Size()-1; i >= 0; i--)
36 case NONE:
if (last) {
return NONE; }
goto next_step;
46 for (
int i = 0; i <
sequence.Size(); i++)
93 const int NE = mesh.
GetNE();
95 MFEM_ASSERT(local_err.
Size() == NE,
"invalid size of local_err");
111 for (
int el = 0; el < NE; el++)
122 if (aniso_flags.
Size() > 0)
124 for (
int i = 0; i < refinements.
Size(); i++)
138 if (action ==
STOP) {
return STOP; }
175 MFEM_VERIFY(max_it > 0,
"max_it must be strictly positive")
203 int order_quad = 2*
order + 3;
211 for (
int i = 0; i < max_it; i++)
214 int NE = mesh.
GetNE();
216 real_t norm_of_coeff = 0.0;
231 real_t av_norm_of_coeff = norm_of_coeff / sqrt(globalNE);
234 Vector element_norms_of_fine_scale(NE);
246 for (
int j = 0; j < NE; j++)
249 real_t element_osc = h * element_norms_of_fine_scale(j);
250 if ( element_osc >
threshold * av_norm_of_coeff )
260 MPI_Comm comm = pmesh->
GetComm();
263 MPI_Comm_rank(comm, &rank);
274 MFEM_WARNING(
"Reached maximum number of elements "
275 "before resolving data to tolerance.");
The AnisotropicErrorEstimator class is the base class for all error estimators that compute one non-n...
virtual const Array< int > & GetAnisotropicFlags()=0
Get an Array<int> with anisotropic flags for all mesh elements.
void SetSize(int nsize)
Change the logical size of the array, keep existing entries.
int Size() const
Return the logical size of the array.
int Append(const T &el)
Append element 'el' to array, resize if necessary.
const IntegrationRule * ir_default[Geometry::NumGeom]
virtual int PreprocessMesh(Mesh &mesh, int max_it)
Apply the operator to the mesh max_it times or until tolerance achieved.
Array< int > mesh_refinements
const IntegrationRule ** irs
void Reset() override
Reset.
int ApplyImpl(Mesh &mesh) override
Apply the operator to the mesh once.
Base class for all element based error estimators.
virtual void Reset()=0
Force recomputation of the estimates on the next call to GetLocalErrors.
virtual const Vector & GetLocalErrors()=0
Get a Vector with all element errors.
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
virtual void Update(bool want_transform=true)
Reflect changes in the mesh: update number of DOFs, etc. Also, calculate GridFunction transformation ...
Class for grid function - Vector with associated FE space.
virtual void ComputeElementL2Errors(Coefficient &exsol, Vector &error, const IntegrationRule *irs[]=NULL) const
Returns ||u_ex - u_h||_L2 elementwise for H1 or L2 elements.
virtual void Update()
Transform by the Space UpdateMatrix (e.g., on Mesh change).
virtual void ProjectCoefficient(Coefficient &coeff, ProjectType type=ProjectType::DEFAULT)
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
virtual void SetSpace(FiniteElementSpace *f)
Associate a new FiniteElementSpace with the GridFunction.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
Arbitrary order "L2-conforming" discontinuous finite elements.
Array< MeshOperator * > sequence
MeshOperators sequence, owned by us.
int ApplyImpl(Mesh &mesh) override
Apply the MeshOperatorSequence.
virtual ~MeshOperatorSequence()
Delete all operators from the sequence.
void Reset() override
Reset all MeshOperators in the sequence.
@ MASK_ACTION
bit mask for all "action" bits
@ STOP
a stopping criterion was satisfied
@ MASK_INFO
bit mask for all "info" bits
@ REFINED
the mesh was refined
@ REBALANCED
the mesh was rebalanced
@ DEREFINED
the mesh was de-refined
virtual long long ReduceInt(int value) const
Utility function: sum integers from all processors (Allreduce).
void GeneralRefinement(const Array< Refinement > &refinements, int nonconforming=-1, int nc_limit=0)
bool Nonconforming() const
int GetNE() const
Returns number of elements.
int Dimension() const
Dimension of the reference space used within the elements.
real_t GetElementSize(int i, int type=0)
Get the size of the i-th element relative to the perfect reference element.
bool DerefineByError(Array< real_t > &elem_error, real_t threshold, int nc_limit=0, int op=1)
long long GetGlobalNE() const
Return the total (global) number of elements.
Abstract parallel finite element space.
Class for parallel grid function.
Class for parallel meshes.
int ApplyImpl(Mesh &mesh) override
Rebalance a parallel mesh (only non-conforming parallel meshes are supported).
ErrorEstimator & estimator
int ApplyImpl(Mesh &mesh) override
Apply the operator to the mesh.
Array< Refinement > marked_elements
ThresholdRefiner(ErrorEstimator &est)
Construct a ThresholdRefiner using the given ErrorEstimator.
AnisotropicErrorEstimator * aniso_estimator
long long num_marked_elements
void Reset() override
Reset the associated estimator.
int MarkWithoutRefining(Mesh &mesh, Array< Refinement > &refinements)
Set the array refinements of elements to refine, without refining.
real_t GetNorm(const Vector &local_err, Mesh &mesh) const
ErrorEstimator & estimator
int ApplyImpl(Mesh &mesh) override
Apply the operator to the mesh.
void Destroy()
Destroy a vector.
int Size() const
Returns the size of the vector.
void SetSize(int s)
Resize the vector to size s.
real_t Normlp(real_t p) const
Returns the l_p norm of the vector.
real_t ParNormlp(const Vector &vec, real_t p, MPI_Comm comm)
Compute the l_p norm of the Vector which is split without overlap across the given communicator.
real_t ComputeGlobalLpNorm(real_t p, Coefficient &coeff, ParMesh &pmesh, const IntegrationRule *irs[])
Compute the global Lp norm of a function f. .
real_t ComputeLpNorm(real_t p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
Compute the Lp norm of a function f. .
constexpr real_t infinity()
Define a shortcut for std::numeric_limits<double>::infinity()
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
Helper struct to convert a C++ type to an MPI type.
int index
Mesh element number.
void SetType(char type, real_t scale=0.5)
Set the type and scale, assuming the element is already set.