21 #include "SheafSystem/zone_centered_error_bound_refinement_policy.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/factory.h" 25 #include "SheafSystem/field_refinement_buffer.h" 26 #include "SheafSystem/std_cmath.h" 27 #include "SheafSystem/field_vd.h" 133 fields::zone_centered_error_bound_refinement_policy::
134 _has_prototype = make_prototype();
137 fields::zone_centered_error_bound_refinement_policy::
184 #ifdef DIAGNOSTIC_OUTPUT 186 cout <<
" zone_id: " << xbuffer.
zone_id 187 <<
" refinement_depth: " << xrefinement_depth;
206 lprop_norm += abs(lsrc_val);
207 lerror_norm += abs(xbuffer.
prop_value[i] - lsrc_val);
213 if(lprop_norm != 0.0)
215 result = (lerror_norm > (ldp*lprop_norm*
_error_ub));
219 result = (lerror_norm > (ldp*
_error_ub));
222 #ifdef DIAGNOSTIC_OUTPUT 225 <<
" prop norm: " << lprop_norm
226 <<
" error norm: " << lerror_norm;
231 #ifdef DIAGNOSTIC_OUTPUT 232 cout <<
" result: " << boolalpha << result << noboolalpha << endl;
269 static const string result(
"zone_centered_error_bound_refinement_policy");
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
static factory< field_refinement_policy > & policy_factory()
A factory for making policy objects.
size_type _refinement_depth_ub
The upper bound and the refinement level of a cell.
virtual bool should_refine(field_refinement_buffer &xbuffer, size_type xrefinement_depth) const
True if the zone specified by xzone_id should be refined.
A buffer for data which is used by both a local_field_refiner object and its associated field_refinem...
Namespace for fields component of sheaf system.
virtual zone_centered_error_bound_refinement_policy & operator=(const field_refinement_policy &xother)
Assignment operator.
virtual zone_centered_error_bound_refinement_policy * clone() const
Virtual constructor, makes a new instance of the same type as this.
size_type refinement_depth_ub() const
The upper bound on the refinement depth of a cell. A cell will not be refined if its refinement depth...
void put_error_ub(sec_vd_value_type xub)
Sets error_ub to xub.
Abstract base class with useful features for all objects.
scoped_index zone_id
The id of the current zone.
sec_vd_value_type _error_ub
The upper bound on the error.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
An abstract policy that determines the conditions under which a zone should be refined.
sec_vd_value_type error_ub() const
The upper bound on the error at the center of a cell.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
field_vd & target
The field being refined.
block< sec_vd_value_type > prop_value
A buffer for computing target property at a point.
block< sec_vd_value_type > source_prop_value
A buffer for computing source property at a point.
A policy that determines a zone should be refined if the error with respect to the source field at th...
bool same_evaluation() const
True if the coordinates and property sections both use the same evaluation subposet.
bool invariant_check() const
True if invariant checking is enabled.
void evaluate_at_center()
Evaluates the property, the coordinates, and the source property at the center of the zone...
virtual ~zone_centered_error_bound_refinement_policy()
Destructor.
const field_vd & source
The reference field.
bool state_is_read_accessible() const
True if this is attached and if the coordinates and property are accessible for read or access contro...
int dp() const
The dimension of the property (dependent variable) space.
static const std::string & static_class_name()
The class name of this class.
virtual bool invariant() const
Class invariant.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
bool is_same_type(const any *other) const
True if other is the same type as this.
void enable_invariant_check() const
Enable invariant checking.
virtual const std::string & class_name() const
The class name of this.
zone_centered_error_bound_refinement_policy(size_type xrefinement_depth_ub=2, sec_vd_value_type xerror_ub=0.01)
Creates an instance with refinement bound xrefinement_ub and error bound xerror_ub.