21 #include "SheafSystem/t4.h" 23 #include "SheafSystem/abstract_poset_member.impl.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/at1.h" 26 #include "SheafSystem/at1_space.h" 27 #include "SheafSystem/fiber_bundles_namespace.h" 28 #include "SheafSystem/schema_poset_member.h" 29 #include "SheafSystem/tp_space.h" 30 #include "SheafSystem/wsv_block.h" 133 vd_lite::operator=(xrow_dofs);
137 postcondition_of(vd_lite::operator=(xrow_dofs));
195 int result =
static_cast<int>(dd()*dd()*dd()*dd());
200 ensure(result == static_cast<int>(dd()*dd()*dd()*dd()));
213 require((0 <= xi) && (xi < dd()));
214 require((0 <= xj) && (xj < dd()));
215 require((0 <= xk) && (xk < dd()));
216 require((0 <= xl) && (xl < dd()));
220 value_type result = component(index_for_ijkl(xi, xj, xk, xl));
237 require((0 <= xi) && (xi < dd()));
238 require((0 <= xj) && (xj < dd()));
239 require((0 <= xk) && (xk < dd()));
240 require((0 <= xl) && (xl < dd()));
244 put_component(index_for_ijkl(xi, xj, xk, xl), xvalue);
262 require((0 <= xi) && (xi < dd()));
263 require((0 <= xj) && (xj < dd()));
264 require((0 <= xk) && (xk < dd()));
265 require((0 <= xl) && (xl < dd()));
270 int result = ((xi*ldd + xj)*ldd + xk)*ldd + xl;
275 ensure(result < d());
312 const string& result = static_class_name();
316 ensure(!result.empty());
331 static const string result(
"t4_lite");
335 ensure(!result.empty());
357 ensure(is_same_type(*result));
381 require(&xother != 0);
387 bool result =
dynamic_cast<const t4_lite*
>(&xother) != 0;
400 if(invariant_check())
404 disable_invariant_check();
408 invariance(tp_lite::invariant());
414 enable_invariant_check();
446 static const poset_path result(standard_schema_poset_name(),
"t4_schema");
468 standard_schema_path().member_name(),
469 tp::standard_schema_path(),
473 lschema.detach_from_state();
498 require(!xhost_path.
empty());
501 require(xschema_path.
full());
503 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
508 require(host_type::d(xns, xschema_path, xauto_access) == host_type::d(xns, 4, xvector_space_path, xauto_access));
513 host_type::new_table(xns, xhost_path, xschema_path, 4, xvector_space_path, xauto_access);
517 ensure(xns.
owns(result, xauto_access));
518 ensure(result.
path(
true) == xhost_path);
520 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
522 ensure(result.
factor_ct(
true) == result.
d(
true));
523 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
525 ensure(result.
p(
true) == 4);
570 attach_to_state(&xother);
588 require(is_ancestor_of(&xother));
589 require(precondition_of(attach_to_state(&xother)));
593 attach_to_state(&xother);
597 ensure(postcondition_of(attach_to_state(&xother)));
611 require(precondition_of(attach_to_state(&xother)));
615 attach_to_state(&xother);
619 ensure(postcondition_of(attach_to_state(&xother)));
682 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
686 new_jim_state(xhost, 0,
false, xauto_access);
690 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
708 attach_to_state(xhost, xhub_id);
713 ensure(is_attached());
715 ensure(index() == xhub_id);
729 attach_to_state(xhost, xid.
hub_pod());
734 ensure(is_attached());
736 ensure(index() ==~ xid);
740 t4(
const poset* xhost,
const std::string& xname)
747 require(!xname.empty());
752 attach_to_state(xhost, xname);
757 ensure(is_attached());
759 ensure(name() == xname);
792 require(state_is_read_accessible());
793 require((0 <= xi) && (xi < dd()));
794 require((0 <= xj) && (xj < dd()));
795 require((0 <= xk) && (xk < dd()));
796 require((0 <= xl) && (xl < dd()));
800 value_type result = component(index_for_ijkl(xi, xj, xk, xl));
813 component(
int xi,
int xj,
int xk,
int xl,
bool xauto_access)
const 817 require(state_is_auto_read_accessible(xauto_access));
818 require((0 <= xi) && (xi < dd(xauto_access)));
819 require((0 <= xj) && (xj < dd(xauto_access)));
820 require((0 <= xk) && (xk < dd(xauto_access)));
821 require((0 <= xl) && (xl < dd(xauto_access)));
830 value_type result = component(index_for_ijkl(xi, xj, xk, xl));
854 require(state_is_read_write_accessible());
855 require((0 <= xi) && (xi < dd()));
856 require((0 <= xj) && (xj < dd()));
857 require((0 <= xk) && (xk < dd()));
858 require((0 <= xk) && (xk < dd()));
862 put_component(index_for_ijkl(xi, xj, xk, xl), xvalue);
880 require(state_is_auto_read_write_accessible(xauto_access));
881 require((0 <= xi) && (xi < dd()));
882 require((0 <= xj) && (xj < dd()));
883 require((0 <= xk) && (xk < dd()));
884 require((0 <= xl) && (xl < dd()));
890 get_read_write_access(
true);
893 put_component(index_for_ijkl(xi, xj, xk, xl), xvalue);
915 require(state_is_read_write_accessible());
916 require((0 <= xi) && (xi < dd()));
917 require((0 <= xj) && (xj < dd()));
918 require((0 <= xk) && (xk < dd()));
919 require((0 <= xl) && (xl < dd()));
924 int result = ((xi*ldd + xj)*ldd + xk)*ldd + xl;
929 ensure(result < d());
966 const string& result = static_class_name();
970 ensure(!result.empty());
985 static const string result(
"t4");
989 ensure(!result.empty());
1007 t4* result =
new t4();
1011 ensure(result != 0);
1039 if(invariant_check())
1043 disable_invariant_check();
1047 invariance(tp::invariant());
1051 invariance(state_is_read_accessible() ? p() == 4 :
true);
1052 invariance(state_is_read_accessible() ? d() == dd()*dd()*dd()*dd() :
true);
1056 enable_invariant_check();
1070 require(xother != 0);
1076 bool result =
dynamic_cast<const t4*
>(xother) != 0;
1080 ensure(invariant());
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 ...
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.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
virtual t4_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
virtual value_type component(int xi, int xj, int xk, int xl) const
The component with indices xi, xj, xk, xl.
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 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 void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
virtual const std::string & class_name() const
The name of this class.
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.
virtual ~t4_lite()
Destructor.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual const std::string & class_name() const
The name of this class.
virtual int d() const
Dimension of this as a vector space.
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
virtual t4 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
static const poset_path & standard_schema_path()
The path to the standard schema for 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...
static const std::string & static_class_name()
The name of this class.
A client handle for a mutable partially ordered set.
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 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.
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 int p() const
The degree of the tensor; the sum of the contravariant and covariant degrees.
An index within the external ("client") scope of a given id 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_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, int xl, value_type xvalue)
Sets the component with indices xi, xj, xk, xl 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. ...
int p(int xd, int xdd) const
Tensor degree as a function of tensor dimension xd and domain dimension xdd.
bool empty() const
True if both poset name and member name are empty.
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
A tensor of degree 4 over an abstract vector space (volatile version).
virtual value_type component(int xi, int xj, int xk, int xl) const
The component with indices xi, xj, xk, xl.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
t4_lite()
Default constructor.
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.
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
static int d(const namespace_poset &xns, const poset_path &xschema_path, bool xauto_access)
The tensor dimension implied by the schema specified by xschema_path.
bool invariant() const
Class invariant.
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.
int dd() const
The dimension of the underlying ("domain") vector space.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
An abstract client handle for a member of a poset.
An abstract tensor space of degree p.
virtual t4 * clone() const
Make a new handle, no state instance of current.
Namespace for the fiber_bundles component of the sheaf system.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
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...
t4_lite & operator=(const t4_lite &xother)
Assignment operator.
A tensor of degree 4 over an abstract vector space (persistent version).
A client handle for a poset member which has been prepared for use as a schema.
virtual bool invariant() const
Class invariant.
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.