21 #include "SheafSystem/at3.h" 23 #include "SheafSystem/abstract_poset_member.impl.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/at0.h" 26 #include "SheafSystem/at1_space.h" 27 #include "SheafSystem/fiber_bundles_namespace.h" 28 #include "SheafSystem/schema_poset_member.h" 29 #include "SheafSystem/wsv_block.h" 133 vd_lite::operator=(xrow_dofs);
137 postcondition_of(vd_lite::operator=(xrow_dofs));
193 require((0 <= xi) && (xi < dd()));
194 require((0 <= xj) && (xj < dd()));
195 require((0 <= xk) && (xk < dd()));
205 static const int levi_civita[27] =
206 {0, 0, 0, 0, 0, 1, 0, -1, 0,
207 0, 0, -1, 0, 0, 0, 1, 0, 0,
208 0, 1, 0, -1, 0, 0, 0, 0, 0};
211 int lindex = (xi*ldd + xj)*ldd + xk;
212 int lindex_value = levi_civita[lindex];
215 ? (lindex_value*component(0)) : 0;
232 require((0 <= xi) && (xi < dd()));
233 require((0 <= xj) && (xj < dd()));
234 require((0 <= xk) && (xk < dd()));
244 static const int levi_civita[27] =
245 {0, 0, 0, 0, 0, 1, 0, -1, 0,
246 0, 0, -1, 0, 0, 0, 1, 0, 0,
247 0, 1, 0, -1, 0, 0, 0, 0, 0};
250 int lindex = (xi*ldd + xj)*ldd + xk;
251 int lindex_value = levi_civita[lindex];
253 if(lindex_value != 0)
255 put_component(0, xvalue);
258 cout <<
"+++++++++++++++++ component(xi, xj, xk) = "\
259 << component(xi, xj, xk) << endl;
276 require((0 <= xi) && (xi < dd()));
277 require((0 <= xj) && (xj < dd()));
278 require((0 <= xk) && (xk < dd()));
323 const string& result = static_class_name();
327 ensure(!result.empty());
342 static const string result(
"at3_lite");
346 ensure(!result.empty());
368 ensure(is_same_type(*result));
392 require(&xother != 0);
398 bool result =
dynamic_cast<const at3_lite*
>(&xother) != 0;
411 if(invariant_check())
415 disable_invariant_check();
419 invariance(atp_lite::invariant());
425 enable_invariant_check();
457 static const poset_path result(standard_schema_poset_name(),
"at3_schema");
480 standard_schema_path().member_name(),
481 atp::standard_schema_path(),
485 lschema.detach_from_state();
510 require(!xhost_path.
empty());
513 require(xschema_path.
full());
515 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
523 host_type::new_table(xns, xhost_path, xschema_path, 3, xscalar_space_path, xauto_access);
527 ensure(xns.
owns(result, xauto_access));
528 ensure(result.
path(
true) == xhost_path);
530 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
532 ensure(result.
factor_ct(
true) == result.
d(
true));
533 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
535 ensure(result.
p(
true) == 3);
536 ensure(result.
dd(
true) == result.
d(
true));
580 attach_to_state(xhost, xhub_id);
586 ensure(index() == xhub_id);
587 ensure(is_attached());
601 attach_to_state(xhost, xid.
hub_pod());
607 ensure(index() ==~ xid);
608 ensure(is_attached());
619 require(!xname.empty());
624 attach_to_state(xhost, xname);
630 ensure(name() == xname);
631 ensure(is_attached());
641 require(xother != 0);
645 attach_to_state(xother);
650 ensure(is_attached());
651 ensure(is_same_state(xother));
661 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
665 new_jim_state(xhost, 0,
false, xauto_access);
669 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
683 require(is_ancestor_of(&xother));
684 require(precondition_of(attach_to_state(&xother)));
688 attach_to_state(&xother);
692 ensure(postcondition_of(attach_to_state(&xother)));
706 require(precondition_of(attach_to_state(&xother)));
710 attach_to_state(&xother);
714 ensure(postcondition_of(attach_to_state(&xother)));
774 require(state_is_read_write_accessible());
775 require((0 <= xi) && (xi < dd()));
776 require((0 <= xj) && (xj < dd()));
777 require((0 <= xk) && (xk < dd()));
787 static const int levi_civita[27] =
788 {0, 0, 0, 0, 0, 1, 0, -1, 0,
789 0, 0, -1, 0, 0, 0, 1, 0, 0,
790 0, 1, 0, -1, 0, 0, 0, 0, 0};
793 int lindex = (xi*ldd + xj)*ldd + xk;
794 int lindex_value = levi_civita[lindex];
797 ? (lindex_value*component(0)) : 0;
810 component(
int xi,
int xj,
int xk,
bool xauto_access)
const 814 require(state_is_auto_read_accessible(xauto_access));
815 require(precondition_of(component(xi, xj, xk)));
833 ensure(postcondition_of(component(xi, xj, xk)));
847 require(state_is_read_write_accessible());
848 require((0 <= xi) && (xi < dd()));
849 require((0 <= xj) && (xj < dd()));
850 require((0 <= xk) && (xk < dd()));
858 static const int levi_civita[27] =
859 {0, 0, 0, 0, 0, 1, 0, -1, 0,
860 0, 0, -1, 0, 0, 0, 1, 0, 0,
861 0, 1, 0, -1, 0, 0, 0, 0, 0};
864 int lindex = (xi*ldd + xj)*ldd + xk;
865 int lindex_value = levi_civita[lindex];
867 if(lindex_value != 0)
870 put_component(0, lvalue);
890 require(state_is_auto_read_write_accessible(xauto_access));
891 require(precondition_of(put_component(xi, xj, xk, xvalue)));
897 get_read_write_access(
true);
900 put_component(xi, xj, xk, xvalue);
909 ensure(postcondition_of(put_component(xi, xj, xk, xvalue)));
922 require((0 <= xi) && (xi < dd()));
923 require((0 <= xj) && (xj < dd()));
924 require((0 <= xk) && (xk < dd()));
1013 const string& result = static_class_name();
1017 ensure(!result.empty());
1032 static const string result(
"at3");
1036 ensure(!result.empty());
1058 ensure(result != 0);
1085 require(xother != 0);
1092 bool result =
dynamic_cast<const at3*
>(xother) != 0;
1096 ensure(invariant());
1113 if (invariant_check())
1117 disable_invariant_check();
1121 invariance(atp::invariant());
1125 invariance((state_is_read_accessible() ? p() == 3 :
true));
1129 enable_invariant_check();
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
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 ...
An antisymmetric rank 3 tensor over an abstract vector space (volatile version).
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
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.
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...
virtual at3 * clone() const
Make a new handle, no state instance of current.
poset_path path(bool xauto_access=true) const
A path to this component.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
The default name space; a poset which contains other posets as members.
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.
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.
at3_lite & operator=(const at3_lite &xother)
Assignment operator.
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.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
virtual const std::string & class_name() const
The name of this class.
virtual at3_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
virtual value_type component(int xi, int xj, int xk) const
The value of component with indices xi, xj, xk.
bool invariant() const
Class invariant.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
static const std::string & static_class_name()
The name of this class.
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
virtual value_type component(int xi, int xj, int xk) const
The value of component with indices xi, xj, xk.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
at3_lite()
Default constructor.
A space of scalars viewed as an antisymmetric tensor space of degree 0.
An abstract antisymmetric tensor space of degree p.
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, value_type xvalue)
Sets the component with indices xi, xj, xk 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)
An index within the external ("client") scope of a given id space.
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
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 ~at3_lite()
Destructor.
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.
static const std::string & static_class_name()
The name of this class.
bool invariant() const
Class invariant.
An antisymmetric rank 3 tensor over an abstract vector space (volatile version).
bool empty() const
True if both poset name and member name are empty.
virtual const std::string & class_name() const
The name of this class.
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
poset_path scalar_space_path() const
The path of the underlying space of scalars.
virtual at3 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, const poset_path &xscalar_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 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 void put_component(int xi, int xj, int xk, value_type xvalue)
Sets the component with indices xi, xj, xk to xvalue.
An abstract client handle for a member of a poset.
virtual int p() const
Degree of this as an antisymmetric tensor space.
at3()
Default constructor.
Namespace for the fiber_bundles component of the sheaf system.
virtual const volatile_type & lite_prototype() const
Virtual constructor for 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...
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
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.