21 #include "SheafSystem/st4.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()));
197 require((0 <= xl) && (xl < dd()));
201 value_type result = component(index_for_ijkl(xi, xj, xk, xl));
218 require((0 <= xi) && (xi < dd()));
219 require((0 <= xj) && (xj < dd()));
220 require((0 <= xk) && (xk < dd()));
221 require((0 <= xl) && (xl < dd()));
225 put_component(index_for_ijkl(xi, xj, xk, xl), xvalue);
243 require((0 <= xi) && (xi < dd()));
244 require((0 <= xj) && (xj < dd()));
245 require((0 <= xk) && (xk < dd()));
246 require((0 <= xl) && (xl < dd()));
256 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
257 if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
258 if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
259 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
260 if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
261 if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
262 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
267 int result = ((xi*ldd + xj)*ldd + xk)*ldd + xl;
269 static const int iskip2[2] = {0, 7};
270 static const int jskip2[2] = {0, 3};
271 static const int kskip2[2] = {0, 1};
273 static const int iskip3[3] = {0, 23, 49};
274 static const int jskip3[3] = {0, 6, 14};
275 static const int kskip3[3] = {0, 1, 3};
279 result -= (iskip2[xi] + jskip2[xj] + kskip2[xk]);
283 result -= (iskip3[xi] + jskip3[xj] + kskip3[xk]);
293 ensure(result < d());
330 const string& result = static_class_name();
334 ensure(!result.empty());
349 static const string result(
"st4_lite");
353 ensure(!result.empty());
375 ensure(is_same_type(*result));
399 require(&xother != 0);
405 bool result =
dynamic_cast<const st4_lite*
>(&xother) != 0;
419 if(invariant_check())
423 disable_invariant_check();
427 invariance(stp_lite::invariant());
433 enable_invariant_check();
465 static const poset_path result(standard_schema_poset_name(),
"st4_schema");
488 standard_schema_path().member_name(),
489 stp::standard_schema_path(),
493 lschema.detach_from_state();
518 require(!xhost_path.
empty());
521 require(xschema_path.
full());
523 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
531 host_type::new_table(xns, xhost_path, xschema_path, 4, xvector_space_path, xauto_access);
535 ensure(xns.
owns(result, xauto_access));
536 ensure(result.
path(
true) == xhost_path);
538 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
540 ensure(result.
factor_ct(
true) == result.
d(
true));
541 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
543 ensure(result.
p(
true) == 4);
544 ensure(result.
dd(
true) == result.
d(
true));
588 attach_to_state(xhost, xhub_id);
594 ensure(index() == xhub_id);
595 ensure(is_attached());
609 attach_to_state(xhost, xid.
hub_pod());
615 ensure(index() ==~ xid);
616 ensure(is_attached());
627 require(!xname.empty());
632 attach_to_state(xhost, xname);
638 ensure(name() == xname);
639 ensure(is_attached());
649 require(xother != 0);
653 attach_to_state(xother);
658 ensure(is_attached());
659 ensure(is_same_state(xother));
669 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
673 new_jim_state(xhost, 0,
false, xauto_access);
677 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
691 require(is_ancestor_of(&xother));
692 require(precondition_of(attach_to_state(&xother)));
696 attach_to_state(&xother);
700 ensure(postcondition_of(attach_to_state(&xother)));
714 require(precondition_of(attach_to_state(&xother)));
718 attach_to_state(&xother);
722 ensure(postcondition_of(attach_to_state(&xother)));
794 require(state_is_read_accessible());
795 require((0 <= xi) && (xi < dd()));
796 require((0 <= xj) && (xj < dd()));
797 require((0 <= xk) && (xk < dd()));
798 require((0 <= xl) && (xl < dd()));
802 value_type result = component(index_for_ijkl(xi, xj, xk, xl));
815 component(
int xi,
int xj,
int xk,
int xl,
bool xauto_access)
const 819 require(state_is_auto_read_accessible(xauto_access));
820 require((0 <= xi) && (xi < dd(xauto_access)));
821 require((0 <= xj) && (xj < dd(xauto_access)));
822 require((0 <= xk) && (xk < dd(xauto_access)));
823 require((0 <= xl) && (xl < dd()));
832 value_type result = component(index_for_ijkl(xi, xj, xk, xl));
856 require(state_is_read_write_accessible());
857 require((0 <= xi) && (xi < dd()));
858 require((0 <= xj) && (xj < dd()));
859 require((0 <= xk) && (xk < dd()));
860 require((0 <= xl) && (xl < dd()));
864 put_component(index_for_ijkl(xi, xj, xk, xl), xvalue);
882 require(state_is_auto_read_write_accessible(xauto_access));
883 require((0 <= xi) && (xi < dd()));
884 require((0 <= xj) && (xj < dd()));
885 require((0 <= xk) && (xk < dd()));
886 require((0 <= xl) && (xl < dd()));
892 get_read_write_access(
true);
895 put_component(index_for_ijkl(xi, xj, xk, xk), xvalue);
918 require(state_is_read_write_accessible());
919 require((0 <= xi) && (xi < dd()));
920 require((0 <= xj) && (xj < dd()));
921 require((0 <= xk) && (xk < dd()));
922 require((0 <= xl) && (xl < dd()));
932 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
933 if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
934 if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
935 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
936 if(xj > xk) { ltmp = xj; xj = xk; xk = ltmp; }
937 if(xk > xl) { ltmp = xk; xk = xl; xl = ltmp; }
938 if(xi > xj) { ltmp = xi; xi = xj; xj = ltmp; }
941 int result = ((xi*ldd + xj)*ldd + xk)*ldd + xl;
945 static const int iskip2[2] = {0, 7};
946 static const int jskip2[2] = {0, 3};
947 static const int kskip2[2] = {0, 1};
949 static const int iskip3[3] = {0, 23, 49};
950 static const int jskip3[3] = {0, 6, 14};
951 static const int kskip3[3] = {0, 1, 3};
955 result -= (iskip2[xi] + jskip2[xj] + kskip2[xk]);
959 result -= (iskip3[xi] + jskip3[xj] + kskip3[xk]);
969 ensure(result < d());
1006 const string& result = static_class_name();
1010 ensure(!result.empty());
1025 static const string result(
"st4");
1029 ensure(!result.empty());
1051 ensure(result != 0);
1078 require(xother != 0);
1085 bool result =
dynamic_cast<const st4*
>(xother) != 0;
1106 if (invariant_check())
1110 disable_invariant_check();
1114 invariance(stp::invariant());
1118 invariance((state_is_read_accessible() ? p() == 4 :
true));
1122 enable_invariant_check();
static const std::string & static_class_name()
The name of this class.
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 void put_component(int xi, int xj, int xk, int xl, value_type xvalue)
Sets the component with indices xi, xj, xk, xl to xvalue.
virtual void put_component(int xi, int xj, int xk, int xl, value_type xvalue)
Sets the component with indices xi, xj, xk, xl to xvalue.
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
st4_lite & operator=(const st4_lite &xother)
Assignment operator.
bool full() const
True if both poset name and member name are not empty.
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.
virtual st4 * clone() const
Make a new handle, no state instance of current.
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.
virtual int index_for_ijkl(int xi, int xj, int xk, int xl) const
The index into linear storage of the component for specified indices xi, xj, xk, xl.
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.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
static const std::string & static_class_name()
The name of this class.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual int index_for_ijkl(int xi, int xj, int xk, int xl) const
The index into linear storage of the component for specified indices xi, xj, xk, xl.
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...
A symmetric rank 4 tensor over an abstract vector space (persistent version).
st4_lite()
Default constructor.
bool invariant() const
Class invariant.
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).
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...
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)
An index within the external ("client") scope of a given id space.
virtual st4_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
virtual st4 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
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 value_type component(int xi, int xj, int xk, int xl) const
The component with indices xi, xj, xk, xl.
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. ...
int p(int xd, int xdd) const
Tensor degree as a function of tensor dimension xd and domain dimension xdd.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
bool empty() const
True if both poset name and member name are empty.
virtual int p() const
Degree of this as a symmetric tensor space.
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
bool invariant() const
Class invariant.
virtual const std::string & class_name() const
The name of this class.
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
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.
virtual ~st4_lite()
Destructor.
int dd() const
The dimension of the underlying ("domain") vector space.
virtual const std::string & class_name() const
The name of this class.
st4()
Default constructor.
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 const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
virtual value_type component(int xi, int xj, int xk, int xl) const
The component with indices xi, xj, xk, xl.
Row dofs type for class vd.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
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...
A client handle for a poset member which has been prepared for use as a schema.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
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...
A symmetric rank 4 tensor over an abstract vector space. (volatile version).
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.