20 #include "SheafSystem/section_evaluator.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/block.h" 24 #include "SheafSystem/sec_vd.h" 116 require((0 <= xindex) && (xindex < dof_ct()));
117 require(xresult_ub >= db());
125 ensure(in_standard_domain(xresult, xresult_ub));
144 local_coordinates(xindex, xresult.
base(), xresult.
ub());
149 ensure(postcondition_of(local_coordinates(xindex, xresult.
base(), xresult.
ub())));
150 ensure(xresult.
ct() == db());
164 require(xresult != 0);
165 require(xresult_ub >= db());
192 require(precondition_of(center(xresult.
base(), xresult.
ub())));
196 center(xresult.
base(), xresult.
ub());
201 ensure(postcondition_of(center(xresult.
base(), xresult.
ub())));
202 ensure(xresult.
ct() == db());
219 require(xlocal_coords != 0);
220 require(xlocal_coords_ub >= db());
242 require(precondition_of(in_standard_domain(xlocal_coords.
base(), xlocal_coords.
ct())));
246 result = in_standard_domain(xlocal_coords.
base(), xlocal_coords.
ct());
250 ensure(postcondition_of(in_standard_domain(xlocal_coords.
base(), xlocal_coords.
ct())));
293 bool result = (df() == 0);
297 ensure(result == (df() == 0));
338 require(df_is_variable());
339 require(precondition_of(value_at_coord(xdofs.
base(), xdofs.
ct(), xlocal_coords.
base(), xlocal_coords.
ct());));
343 result = value_at_coord(xdofs.
base(),
345 xlocal_coords.
base(),
350 ensure(postcondition_of(value_at_coord(xdofs.
base(), xdofs.
ct(), xlocal_coords.
base(), xlocal_coords.
ct());));
367 require(df_is_variable());
369 require(xdofs_ub >= dof_ct());
370 require(unexecutable(xdofs must be interleaved));
371 require(xlocal_coords != 0);
372 require(xlocal_coords_ub >= db());
377 value_at_coord(xdofs, xdofs_ub, xlocal_coords, xlocal_coords_ub, &result, 1);
396 require(precondition_of(value_at_coord(xdofs.
base(),
398 xlocal_coords.
base(),
405 value_at_coord(xdofs.
base(),
407 xlocal_coords.
base(),
414 ensure(postcondition_of(value_at_coord(xdofs.
base(),
416 xlocal_coords.
base(),
457 require(precondition_of(coord_at_value(xdofs.
base(),
461 xlocal_coords.
base(),
462 xlocal_coords.
ub())));
466 coord_at_value(xdofs.
base(),
470 xlocal_coords.
base(),
473 xlocal_coords.
set_ct(db());
478 ensure(postcondition_of(coord_at_value(xdofs.
base(),
482 xlocal_coords.
base(),
483 xlocal_coords.
ub())));
484 ensure(xlocal_coords.
ct() == db());
498 require(df_is_variable());
500 require(xdofs_ub > 0);
508 for(
int i=1; i<xdofs_ub; ++i)
527 require(precondition_of(
min(xdofs.
base(), xdofs.
ct())));
535 ensure(postcondition_of(
min(xdofs.
base(), xdofs.
ct())));
553 require(xdofs_ub > 0);
554 require(xresult != 0);
555 require(xresult_ub > 0);
562 for(
int j=0; j<xresult_ub; ++j)
564 xresult[j] = xdofs[j];
567 for(
int i=0; i<xdofs_ub; i+=xresult_ub)
569 for(
int j=0; j<xresult_ub; ++j)
589 require(precondition_of(
min(xdofs.
base(), xdofs.
ct(), xresult.
base(), xresult.
ct())));
597 ensure(postcondition_of(
min(xdofs.
base(), xdofs.
ct(), xresult.
base(), xresult.
ct())));
598 ensure(xresult.
ct() == xresult.
ct());
612 require(df_is_variable());
614 require(xdofs_ub > 0);
620 for(
int i=1; i<xdofs_ub; ++i)
639 require(precondition_of(
max(xdofs.
base(), xdofs.
ct())));
647 ensure(postcondition_of(
max(xdofs.
base(), xdofs.
ct())));
665 require(xdofs_ub > 0);
666 require(xresult != 0);
667 require(xresult_ub > 0);
674 for(
int j=0; j<xresult_ub; ++j)
676 xresult[j] = xdofs[j];
679 for(
int i=0; i<xdofs_ub; i+=xresult_ub)
681 for(
int j=0; j<xresult_ub; ++j)
701 require(precondition_of(
max(xdofs.
base(), xdofs.
ct(), xresult.
base(), xresult.
ct())));
709 ensure(postcondition_of(
max(xdofs.
base(), xdofs.
ct(), xresult.
base(), xresult.
ct())));
736 ensure(is_same_type(result));
751 require(is_ancestor_of(&xother));
781 if(invariant_check())
785 disable_invariant_check();
789 enable_invariant_check();
805 require(xother != 0);
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
bool df_is_variable() const
True if and only if the fiber dimension (number of components of the dependent variable) is variable...
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
size_type ct() const
The number of items currently in use.
sec_vd_dof_type dof_type
The type of degree of freedom.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
virtual dof_type value_at_coord(const dof_type xdofs[], size_type xdofs_ub, const dof_type xlocal_coords[], size_type xlocal_coords_ub) const
Value at a specified local_coordinate. Single component version.
virtual bool in_standard_domain(const dof_type xlocal_coords[], size_type xlocal_coords_ub) const =0
True if the specified local coordinates are in the "standard" domain.
virtual ~section_evaluator()
Destructor.
Abstract base class with useful features for all objects.
virtual dof_type max(const dof_type xdofs[], size_type xdofs_ub) const
The maximum value of the scalar or component section defined by xdofs.
virtual size_type dof_ct() const =0
The number of dofs required for each component of the dependent variable.
pointer_type base() const
The underlying storage array.
void set_ct(size_type xct)
Sets ct() == xct.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
virtual void coord_at_value(const dof_type xdofs[], size_type xdofs_ub, const dof_type xvalue[], size_type xvalue_ub, dof_type xlocal_coords[], size_type xlocal_coords_ub) const =0
The local coordinates of a point at which the field has the value xvalue. The dofs are assumed to be ...
virtual void center(coord_type xresult[], size_type xresult_ub) const
The local coordinates at the center of the evaluator.
chart_point_coord_type coord_type
The type of local coordinate; the scalar type for the local coordinate vector space.
virtual bool invariant() const
Class invariant.
SHEAF_DLL_SPEC void max(const vd &x0, vd_value_type &xresult, bool xauto_access)
Maximum component of x0, pre-allocated version.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
SHEAF_DLL_SPEC void min(const vd &x0, vd_value_type &xresult, bool xauto_access)
Minimum component of x0, pre-allocated version.
virtual int df() const
The fiber dimension (number of components of dependent variable).
virtual section_evaluator * clone() const =0
Virtual constructor, makes a new instance of the same type as this.
virtual section_evaluator & operator=(const section_evaluator &xother)
Assignment operator.
virtual dof_type min(const dof_type xdofs[], size_type xdofs_ub) const
The minimum value of the scalar or component section defined by xdofs.
int_type pod_index_type
The plain old data index type.
virtual int db() const =0
The base dimension; the dimension of the local coordinates (independent variable).
double sec_vd_dof_type
The type of degree of freedom in the section space.
virtual void local_coordinates(pod_index_type xindex, coord_type xresult[], size_type xresult_ub) const =0
The local coordinates of the dof with local index xindex.
An auto_block with a no-initialization initialization policy.
Namespace for the fiber_bundles component of the sheaf system.
void local_coordinates(pod_index_type xindex, block< coord_type > &xresult) const
The local coordinates of the dof with local index xindex.
section_evaluator()
Default constructor.