23 #include "SheafSystem/sec_at0.h" 25 #include "SheafSystem/assert_contract.h" 26 #include "SheafSystem/at0.impl.h" 27 #include "SheafSystem/at0_space.h" 28 #include "SheafSystem/base_space_poset.h" 29 #include "SheafSystem/binary_section_space_schema_member.impl.h" 30 #include "SheafSystem/fiber_bundles_namespace.h" 31 #include "SheafSystem/index_space_iterator.h" 32 #include "SheafSystem/sec_at0_space.h" 33 #include "SheafSystem/sec_tuple.impl.h" 34 #include "SheafSystem/sec_tuple_space.impl.h" 35 #include "SheafSystem/std_iomanip.h" 64 require(!xhost_path.
empty());
67 require(xschema_path.
full());
69 require(host_type::fiber_space_conforms<fiber_type::host_type>(xns, xschema_path, xauto_access));
73 host_type& result = host_type::new_table(xns, xhost_path, xschema_path, xauto_access);
77 ensure(xns.
owns(result, xauto_access));
78 ensure(result.
path(
true) == xhost_path);
80 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
84 ensure(result.
d(
true) == result.
dd(
true));
85 ensure(result.
d(
true) == 1);
88 ensure(result.
p(
true) == 0);
90 ensure(result.
dd(
true) == 1);
104 const std::string& xsection_suffix,
105 const std::string& xfiber_suffix,
114 require(xbase_path.
full());
117 require(xrep_path.
empty() || xrep_path.
full());
120 require(xsection_suffix.empty() || poset_path::is_valid_name(xsection_suffix));
122 require(xfiber_suffix.empty() || poset_path::is_valid_name(xfiber_suffix));
124 require(standard_host_is_available<sec_at0>(xns, xbase_path, xrep_path, xsection_suffix, xfiber_suffix, xauto_access));
125 require(fiber_type::standard_host_is_available<fiber_type>(xns, xfiber_suffix, xauto_access));
126 require(schema_type::standard_host_is_available<sec_at0>(xns, xbase_path, xrep_path, xfiber_suffix, xauto_access));
130 poset_path lstd_path = standard_host_path<sec_at0>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix);
146 poset_path lrep_path = (!xrep_path.empty() ? xrep_path : standard_rep_path());
151 schema_type::standard_member<sec_at0>(xns, xbase_path, lrep_path, xfiber_suffix, xauto_access);
155 lresult_ptr = &new_host(xns, lstd_path, lstd_schema_path, xauto_access);
162 ensure(xns.
owns(result, xauto_access));
163 ensure(result.
path(
true) == standard_host_path<sec_at0>(xbase_path, xrep_path, xsection_suffix, xfiber_suffix));
165 ensure(result.
schema(
true).
path(xauto_access) ==
166 schema_type::standard_member_path<sec_at0>(xbase_path, xrep_path, xfiber_suffix));
170 ensure(result.
d(
true) == result.
dd(
true));
171 ensure(result.
d(
true) == 1);
174 ensure(result.
p(
true) == 0);
176 ensure(result.
dd(
true) == 1);
218 attach_to_state(xhost, xhub_id);
223 ensure(host() == xhost);
224 ensure(index() == xhub_id);
225 ensure(is_attached());
226 ensure(!is_restricted());
240 attach_to_state(xhost, xid.
hub_pod());
245 ensure(host() == xhost);
246 ensure(index() ==~ xid);
247 ensure(is_attached());
248 ensure(!is_restricted());
258 require(!xname.empty());
263 attach_to_state(xhost, xname);
268 ensure(host() == xhost);
269 ensure(name() == xname);
270 ensure(is_attached());
271 ensure(!is_restricted());
282 require(precondition_of(attach_to_state(same args)));
286 attach_to_state(xnamespace, xpath, xauto_access);
290 ensure(postcondition_of(attach_to_state(same args)));
302 require(xother != 0);
306 attach_to_state(xother);
307 restrict_to_same(xother);
312 ensure(is_attached());
313 ensure(is_same_state(xother));
314 ensure(is_same_restriction(xother));
324 require(xother != 0);
326 require(xfiber_schema_jim != 0);
328 require(xfiber_schema_jim->
is_jim());
332 attach_to_state(xother);
333 restrict_to(&(xother->
base()), xfiber_schema_jim);
338 ensure(is_attached());
339 ensure(is_same_state(xother));
340 ensure(fiber_schema().is_same_state(xfiber_schema_jim));
350 require(precondition_of(new_jim_state(xhost, xdof_map,
false, xauto_access)));
354 new_jim_state(xhost, xdof_map,
false, xauto_access);
358 ensure(postcondition_of(new_jim_state(xhost, xdof_map,
false, xauto_access)));
369 int xbase_version,
bool xauto_access)
374 require(precondition_of(\
375 new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
379 new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access);
383 ensure(postcondition_of(\
384 new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
396 require(precondition_of(new_jim_state(xhost, xbase_parts, xauto_access)));
400 new_jrm_state(xhost, xbase_parts, xauto_access);
404 require(postcondition_of(new_jim_state(xhost, xbase_parts, xauto_access)));
417 require(is_ancestor_of(&xother));
418 require(precondition_of(attach_to_state(&xother)));
422 attach_to_state(&xother);
426 ensure(postcondition_of(attach_to_state(&xother)));
439 require(precondition_of(attach_to_state(&xother)));
443 attach_to_state(&xother);
447 ensure(postcondition_of(attach_to_state(&xother)));
460 require(precondition_of(sec_vd::operator=(xfiber)));
464 sec_vd::operator=(xfiber);
468 ensure(postcondition_of(sec_vd::operator=(xfiber)));
481 require(precondition_of(sec_vd::operator=(xfiber)));
485 sec_vd::operator=(xfiber);
489 ensure(postcondition_of(sec_vd::operator=(xfiber)));
586 const string& result = static_class_name();
590 ensure(!result.empty());
605 static const string result(
"sec_at0");
609 ensure(!result.empty());
655 return reinterpret_cast<host_type*
>(_host);
662 return dynamic_cast<const host_type*
>(xother) != 0;
682 require(xother != 0);
689 bool result =
dynamic_cast<const at0*
>(xother) != 0;
707 require(xother != 0);
714 bool result =
dynamic_cast<const sec_at0*
>(xother) != 0;
741 if (invariant_check())
745 disable_invariant_check();
750 enable_invariant_check();
755 ensure(is_derived_query);
768 require(state_is_read_accessible());
769 require(xschema != 0);
770 require(schema().is_ancestor_of(xschema));
771 require(xschema->
leqv(host()->schema().index()));
777 sec_rep_space_member::restrict_to(xschema);
781 ensure(schema().is_same_state(xschema));
782 ensure(unexecutable(base().is_same_state(old base())));
794 require(state_is_read_accessible());
806 sec_rep_space_member::restrict_to(xbase_id, xfiber_schema_id);
823 require(state_is_read_accessible());
825 require(xbase->
le(&(host()->base())));
826 require(xfiber_schema != 0);
827 require(xfiber_schema->
le(&(host()->fiber_schema())));
833 sec_rep_space_member::restrict_to(xbase, xfiber_schema);
837 ensure(base().is_same_state(xbase));
838 ensure(fiber_schema().is_same_state(xfiber_schema));
850 require(state_is_read_accessible());
851 require(xother != 0);
853 require(is_ancestor_of(xother));
854 require(has_same_host(xother));
860 sec_rep_space_member::restrict_to_same(xother);
864 ensure(is_same_restriction(xother));
876 require(state_is_read_accessible());
882 sec_rep_space_member::unrestrict();
886 ensure(!is_restricted());
909 xos <<
"sec_at0 " << xv. name() <<
" dofs:" << endl;
1056 const int lexp =
static_cast<const int>(xlexp);
1085 xlfractpart =
std::modf(xl0, &xlintpart[0]);
1148 #include "SheafSystem/sec_vd.impl.h" 1170 unary_op(x0, xresult, acos_functor(), xauto_access);
1197 unary_op(x0, xresult, asin_functor(), xauto_access);
1217 unary_op(x0, xresult, atan_functor(), xauto_access);
1239 binary_op(x0, x1, xresult, atan2_functor(), xauto_access);
1259 unary_op(x0, xresult, ceil_functor(), xauto_access);
1279 unary_op(x0, xresult, cos_functor(), xauto_access);
1299 unary_op(x0, xresult, cosh_functor(), xauto_access);
1319 unary_op(x0, xresult, exp_functor(), xauto_access);
1340 unary_op(x0, xresult, fabs_functor(), xauto_access);
1360 unary_op(x0, xresult, floor_functor(), xauto_access);
1381 binary_op(x0, x1, xresult, fmod_functor(), xauto_access);
1402 unary_op(x0, xsignificand, xexp, frexp_functor(), xauto_access);
1422 binary_op(x0, static_cast<vd_value_type>(xexp), xresult, ldexp_functor(),
1443 unary_op(x0, xresult, log_functor(), xauto_access);
1463 unary_op(x0, xresult, log10_functor(), xauto_access);
1484 unary_op(x0, xintpart, xfractpart, modf_functor(), xauto_access);
1505 binary_op(x0, xexponent, xresult, pow_functor(), xauto_access);
1525 unary_op(x0, xresult, sin_functor(), xauto_access);
1545 unary_op(x0, xresult, sinh_functor(), xauto_access);
1565 unary_op(x0, xresult, sqrt_functor(), xauto_access);
1585 unary_op(x0, xresult, tan_functor(), xauto_access);
1605 unary_op(x0, xresult, tanh_functor(), xauto_access);
virtual sec_at0 * clone() const
Make a new handle, no state instance of current.
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
SHEAF_DLL_SPEC void sqrt(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sqrt of x0 (sqrt(x0)) (pre-allocated version).
SHEAF_DLL_SPEC void asin(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute asin of x0 (asin(x0)) (pre-allocated version).
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
bool state_is_auto_read_write_accessible(bool xauto_access) const
True if state is auto accessible for read and write, that is, if the state is already accessible for ...
virtual const std::string & class_name() const
The name of this class.
virtual bool is_jim(bool xin_current_version=true) const
True if this member is join irreducible in the current version of the host (xin_current_version == tr...
schema_poset_member & fiber_schema()
The schema of the restricted fiber of this section space member (mutable version) ...
A client handle for a subposet.
SHEAF_DLL_SPEC void frexp(const sec_at0 &x0, sec_at0 &xsignificand, sec_at0 &xexp, bool xauto_access)
Compute frexp of x0 (frexp(x0)) (pre-allocated version).
bool full() const
True if both poset name and member name are not empty.
virtual void restrict_to_same(const abstract_poset_member *xother)
Restricts this handle and its components to the same restriction as xother.
const index_space_handle & row_dof_id_space() const
The row dof id space for the schema defined by this.
The abstract map from section dof ids to section dof values of heterogeneous type.
An abstract iterator over the ids of an id space.
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
SHEAF_DLL_SPEC void ldexp(const sec_at0 &x0, int xexp, sec_at0 &xresult, bool xauto_access)
Compute ldexp of x0 (ldexp(x0)) (pre-allocated version).
void unrestrict()
Removes any restriction to this handle and its components; restores base and fiber to the base and fi...
poset_path path(bool xauto_access=true) const
A path to this component.
The default name space; a poset which contains other posets as members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
void unary_op(const S0 &x0, SR &xresult, F xfunctor, bool xauto_access)
Unary operator.
bool path_is_auto_read_accessible(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath exists and is auto read accessible.
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
primitive_value dof(pod_index_type xdof_id) const
The dof referred to by xdof_id.
bool state_is_auto_read_accessible(bool xauto_access) const
True if the state is auto accessible for read, that is, if the state is already accessible for read o...
A client handle for a general, abstract partially order set.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
A member of a sec_rep_space; a section.
poset_path vector_space_path() const
The path of the underlying vector space.
abstract_poset_member & base()
The restricted base of this section space member (mutable version)
A schema poset for a section space. A binary Cartesian product subspace of the binary tensor product ...
poset_state_handle & member_poset(pod_index_type xhub_id, bool xauto_access=true) const
The poset_state_handle object referred to by hub id xhub_id.
SHEAF_DLL_SPEC void log10(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute log10 of x0 (log10(x0)) (pre-allocated version).
SHEAF_DLL_SPEC void ceil(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute ceil of x0 (ceil(x0)) (pre-allocated version).
virtual void next()=0
Makes id() the next id in the iteration.
static const std::string & static_class_name()
The name of this class.
The poset for sec_rep_descriptors.
sec_at0()
Default constructor.
Abstract base class with useful features for all objects.
int p() const
The tensor degree of this space.
A space of scalars viewed as an antisymmetric tensor section space of degree 0.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
bool is_done() const
True if iteration is finished.
SHEAF_DLL_SPEC void atan(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute atan of x0 (atan(x0)) (pre-allocated version).
A space of scalars viewed as an antisymmetric tensor space of degree 0.
host_type * host() const
The poset this is a member of.
void binary_op(const S0 &x0, const S1 &x1, SR &xresult, F xfunctor, bool xauto_access)
Binary operator.
bool leqv(pod_index_type xother_index) const
True if this is less than or equivalent to the member with index xother_index.
bool owns(const poset_state_handle &xposet, bool xauto_access) const
True if and only if this contains the poset xposet. synonym for contains_poset(xposet.poset_path(true), xauto_access)
virtual void release_iterator(index_space_iterator &xitr) const =0
Returns the id space iterator xitr to the iterator pool.
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, bool xauto_access)
Creates a new host table for members of this type. The poset is created in namespace xns with path xh...
An index within the external ("client") scope of a given id space.
A scalar viewed as an antisymmetric tensor of degree 0. As the degree is 0 there is nothing to be sym...
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
SHEAF_DLL_SPEC void atan2(const sec_at0 &x0, const sec_at0 &x1, sec_at0 &xresult, bool xauto_access)
Compute atan2 of x0/x1 (atan2(x0, x1)) (pre-allocated version).
Antisymetric tensor of degree 0 (volatile version).
virtual bool contains_member(pod_index_type xmbr_hub_id, bool xauto_access=true) const
True if some version of this poset contains poset member with hub id xmbr_hub_id. ...
bool le(pod_index_type xother_index) const
True if this is less than or equal to the member with index xother_index.
int dd() const
The dimension of the underlying ("domain") vector space.
SHEAF_DLL_SPEC void fabs(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute fabs of x0 (fabs(x0)) (pre-allocated version).
SHEAF_DLL_SPEC void cosh(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute cosh of x0 (cosh(x0)) (pre-allocated version).
bool empty() const
True if both poset name and member name are empty.
bool is_ancestor_of(const any *xother) const
True if xother conforms to current.
SHEAF_DLL_SPEC void modf(const sec_at0 &x0, sec_at0 &xintpart, sec_at0 &xfractpart, bool xauto_access)
Compute modf of x0 (modf(x0)) (pre-allocated version).
SHEAF_DLL_SPEC void sinh(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sinh of x0 (sinh(x0)) (pre-allocated version).
virtual pod_type index() const =0
Index of this space.
SHEAF_DLL_SPEC void log(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute log of x0 (log(x0)) (pre-allocated version).
virtual index_space_iterator & get_iterator() const =0
Allocates an id space iterator from the iterator pool.
SHEAF_DLL_SPEC void fmod(const sec_at0 &x0, const sec_at0 &x1, sec_at0 &xresult, bool xauto_access)
Compute xsignificand = fmod(x0, xexp) (pre-allocated version).
SHEAF_DLL_SPEC void tanh(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute tanh of x0 (tanh(x0)) (pre-allocated version).
static host_type & standard_host(namespace_type &xns, const poset_path &xbase_path, const poset_path &xrep_path, const std::string &xsection_suffix, const std::string &xfiber_suffix, bool xauto_access)
The standard host for sections of this type with base space xbase_path, representation xrep_path...
SHEAF_DLL_SPEC void cos(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute cos of x0 (cos(x0)) (pre-allocated version).
SHEAF_DLL_SPEC void tan(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute tan of x0 (tan(x0)) (pre-allocated version).
SHEAF_DLL_SPEC void floor(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute floor of x0 (floor(x0)) (pre-allocated version).
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
SHEAF_DLL_SPEC void acos(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute acos of x0 (acos(x0)) (pre-allocated version).
int_type pod_index_type
The plain old data index type.
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
poset & fiber_space()
The fiber space for section spaces on this schema (mutable version).
sec_vd_dof_type dof_type
The type of degree of freedom.
Namespace containing the algrebra functions for a a section of a fiber bundle with a d-dimensional ve...
virtual void restrict_to(const abstract_poset_member *xschema)
Restricts this section and its components to schema member xschema.
virtual sec_at0 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
bool fiber_is_ancestor_of(const any *xother) const
True if xother conforms to an instance of the fiber of current.
An abstract client handle for a member of a poset.
SHEAF_DLL_SPEC void exp(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute exp of x0 (exp(x0)) (pre-allocated version).
bool invariant() const
Class invariant.
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC void pow(const sec_at0 &x0, const vd_value_type &xexponent, sec_at0 &xresult, bool xauto_access)
Compute x0 to power xexponent (pow(x0, xexponent)) (pre-allocated version).
SHEAF_DLL_SPEC void sin(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sin of x0 (sin(x0)) (pre-allocated version).
Antisymetric tensor of degree 0. As the degree is 0 there is nothing to be symmetric or antisymmetric...
virtual int d(int xp, int xdd) const
Dimension d() as a function of degree xp and domain dimension xdd.
bool state_is_not_read_accessible() const
True if this is attached and if the state is accessible for read or if access control is disabled...
virtual section_dof_map & dof_map(bool xrequire_write_access=false)
The map from client_ids to dof values for this poset member (mutable version)
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
A handle for a poset whose members are numerical representations of sections of a fiber bundle...