21 #include "SheafSystem/st3.h" 23 #include "SheafSystem/abstract_poset_member.impl.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/at0.h" 26 #include "SheafSystem/stp_space.h" 27 #include "SheafSystem/fiber_bundles_namespace.h" 28 #include "SheafSystem/schema_poset_member.h" 29 #include "SheafSystem/wsv_block.h" 134 vd_lite::operator=(xrow_dofs);
138 postcondition_of(vd_lite::operator=(xrow_dofs));
194 require((0 <= xi) && (xi < dd()));
195 require((0 <= xj) && (xj < dd()));
196 require((0 <= xk) && (xk < dd()));
200 value_type result = component(index_for_ijk(xi, xj, xk));
217 require((0 <= xi) && (xi < dd()));
218 require((0 <= xj) && (xj < dd()));
219 require((0 <= xk) && (xk < dd()));
223 put_component(index_for_ijk(xi, xj, xk), xvalue);
241 require((0 <= xi) && (xi < dd()));
242 require((0 <= xj) && (xj < dd()));
243 require((0 <= xk) && (xk < dd()));
253 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
254 if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
255 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
259 int result = (xi*ldd + xj)*ldd + xk;
260 result -= (xi*(5 + xi) + (xj*(xj+1))/2);
265 ensure(result < d());
302 const string& result = static_class_name();
306 ensure(!result.empty());
321 static const string result(
"st3_lite");
325 ensure(!result.empty());
347 ensure(is_same_type(*result));
371 require(&xother != 0);
377 bool result =
dynamic_cast<const st3_lite*
>(&xother) != 0;
391 if(invariant_check())
395 disable_invariant_check();
399 invariance(stp_lite::invariant());
405 enable_invariant_check();
437 static const poset_path result(standard_schema_poset_name(),
"st3_schema");
460 standard_schema_path().member_name(),
461 stp::standard_schema_path(),
465 lschema.detach_from_state();
490 require(!xhost_path.
empty());
493 require(xschema_path.
full());
495 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
503 host_type::new_table(xns, xhost_path, xschema_path, 3, xvector_space_path, xauto_access);
507 ensure(xns.
owns(result, xauto_access));
508 ensure(result.
path(
true) == xhost_path);
510 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
512 ensure(result.
factor_ct(
true) == result.
d(
true));
513 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
515 ensure(result.
p(
true) == 3);
516 ensure(result.
dd(
true) == result.
d(
true));
560 attach_to_state(xhost, xhub_id);
566 ensure(index() == xhub_id);
567 ensure(is_attached());
581 attach_to_state(xhost, xid.
hub_pod());
587 ensure(index() ==~ xid);
588 ensure(is_attached());
599 require(!xname.empty());
604 attach_to_state(xhost, xname);
610 ensure(name() == xname);
611 ensure(is_attached());
621 require(xother != 0);
625 attach_to_state(xother);
630 ensure(is_attached());
631 ensure(is_same_state(xother));
641 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
645 new_jim_state(xhost, 0,
false, xauto_access);
649 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
663 require(is_ancestor_of(&xother));
664 require(precondition_of(attach_to_state(&xother)));
668 attach_to_state(&xother);
672 ensure(postcondition_of(attach_to_state(&xother)));
686 require(precondition_of(attach_to_state(&xother)));
690 attach_to_state(&xother);
694 ensure(postcondition_of(attach_to_state(&xother)));
767 require(state_is_read_accessible());
768 require((0 <= xi) && (xi < dd()));
769 require((0 <= xj) && (xj < dd()));
770 require((0 <= xk) && (xk < dd()));
774 value_type result = component(index_for_ijk(xi, xj, xk));
787 component(
int xi,
int xj,
int xk,
bool xauto_access)
const 791 require(state_is_auto_read_accessible(xauto_access));
792 require((0 <= xi) && (xi < dd(xauto_access)));
793 require((0 <= xj) && (xj < dd(xauto_access)));
794 require((0 <= xk) && (xk < dd(xauto_access)));
803 value_type result = component(index_for_ijk(xi, xj, xk));
827 require(state_is_read_write_accessible());
828 require((0 <= xi) && (xi < dd()));
829 require((0 <= xj) && (xj < dd()));
830 require((0 <= xk) && (xk < dd()));
834 put_component(index_for_ijk(xi, xj, xk), xvalue);
851 require(state_is_auto_read_write_accessible(xauto_access));
852 require((0 <= xi) && (xi < dd()));
853 require((0 <= xj) && (xj < dd()));
854 require((0 <= xk) && (xk < dd()));
860 get_read_write_access(
true);
863 put_component(index_for_ijk(xi, xj, xk), xvalue);
886 require(state_is_read_write_accessible());
887 require((0 <= xi) && (xi < dd()));
888 require((0 <= xj) && (xj < dd()));
889 require((0 <= xk) && (xk < dd()));
899 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
900 if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
901 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
905 int result = (xi*ldd + xj)*ldd + xk;
906 result -= (xi*(5 + xi) + (xj*(xj+1))/2);
911 ensure(result < d());
948 const string& result = static_class_name();
952 ensure(!result.empty());
967 static const string result(
"st3");
971 ensure(!result.empty());
1020 require(xother != 0);
1027 bool result =
dynamic_cast<const st3*
>(xother) != 0;
1048 if (invariant_check())
1052 disable_invariant_check();
1056 invariance(stp::invariant());
1060 invariance((state_is_read_accessible() ? p() == 3 :
true));
1064 enable_invariant_check();
st3()
Default constructor.
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
virtual st3 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
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 ...
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
bool full() const
True if both poset name and member name are not empty.
st3_lite()
Default constructor.
virtual const std::string & class_name() const
The name of this class.
virtual const std::string & class_name() const
The name of this class.
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...
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...
poset_path vector_space_path() const
The path of the underlying vector space.
bool contains_poset_member(pod_index_type xposet_hub_id, pod_index_type xmember_hub_id, bool xauto_access=true) const
True if this contains a poset with hub id xposet_hub_id which contains a member with hub id xmember_h...
A client handle for a general, abstract partially order set.
virtual st3 * clone() const
Make a new handle, no state instance of current.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
virtual void put_component(int xi, int xj, int xk, value_type xvalue)
Sets the component with indices xi, xj, xk to xvalue.
virtual value_type component(int xi, int xj, int xk) const
The component with indices xi, xj, xk.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
static int d(const namespace_poset &xns, int xp, const poset_path &xvector_space_path, bool xauto_access)
The tensor dimension implied by tensor degree xp and the dimension of the domain vector space specifi...
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
static const std::string & static_class_name()
The name of this class.
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, const poset_path &xvector_space_path, bool xauto_access)
Creates a new host table for members of this type. The poset is created in namespace xns with path xh...
virtual st3_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
A space of scalars viewed as an antisymmetric tensor space of degree 0.
bool state_is_read_write_accessible() const
True if this is attached and if the state is accessible for read and write or access control is disab...
virtual int index_for_ijk(int xi, int xj, int xk) const
The index into linear storage of the component for specified indices xi, xj, xk.
virtual value_type component(int xi, int xj, int xk) const
The component with indices xi, xj, xk.
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 const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
An index within the external ("client") scope of a given id space.
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
virtual void put_component(int xi, int xj, int xk, value_type xvalue)
Sets the component with indices xi, xj, xk to xvalue.
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. ...
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
int p(int xd, int xdd) const
Tensor degree as a function of tensor dimension xd and domain dimension xdd.
A symmetric rank 3 tensor over an abstract vector space (persistent version).
A symmetric rank 3 tensor over an abstract vector space. (volatile version).
bool empty() const
True if both poset name and member name are empty.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
virtual int index_for_ijk(int xi, int xj, int xk) const
The index into linear storage of the component for specified indices xi, xj, xk.
static const std::string & static_class_name()
The name of this class.
bool invariant() const
Class invariant.
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
st3_lite & operator=(const st3_lite &xother)
Assignment operator.
bool invariant() const
Class invariant.
int_type pod_index_type
The plain old data index type.
vd_value_type value_type
The POD ("plain old data") type of scalar in the vector space of this.
int dd() const
The dimension of the underlying ("domain") vector space.
An abstract client handle for a member of a poset.
An abstract symmetric tensor space of degree p.
Namespace for the fiber_bundles component of the sheaf system.
virtual ~st3_lite()
Destructor.
Row dofs type for class vd.
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 int p() const
Degree of this as a symmetric tensor space.
A client handle for a poset member which has been prepared for use as a schema.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
SHEAF_DLL_SPEC bool isunordered_or_equals(float x1, float x2)
True if isunordered(x1, x2) or x1 == x2.