21 #include "SheafSystem/st2.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" 131 vd_lite::operator=(xrow_dofs);
135 postcondition_of(vd_lite::operator=(xrow_dofs));
149 require(xrow >= 0 && xrow < dd());
150 require(xcolumn >= 0 && xcolumn < dd());
154 value_type result = component(index_for_row_column(xrow, xcolumn));
171 require(xrow >= 0 && xrow < dd());
172 require(xcolumn >= 0 && xcolumn < dd());
176 put_component(index_for_row_column(xrow, xcolumn), xcomp);
194 require(0 <= xrow && xrow < dd());
195 require(0 <= xcolumn && xcolumn < dd());
214 int result = j + (i*(2*dd()-1-i))/2;
220 ensure(result < dd()*dd());
305 const string& result = static_class_name();
309 ensure(!result.empty());
324 static const string result(
"st2_lite");
328 ensure(!result.empty());
350 ensure(is_same_type(*result));
374 require(&xother != 0);
380 bool result =
dynamic_cast<const st2_lite*
>(&xother) != 0;
393 if(invariant_check())
397 disable_invariant_check();
401 invariance(stp_lite::invariant());
407 enable_invariant_check();
439 static const poset_path result(standard_schema_poset_name(),
"st2_schema");
461 standard_schema_path().member_name(),
462 stp::standard_schema_path(),
466 lschema.detach_from_state();
491 require(!xhost_path.
empty());
494 require(xschema_path.
full());
496 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
504 host_type::new_table(xns, xhost_path, xschema_path, 2, xvector_space_path, xauto_access);
508 ensure(xns.
owns(result, xauto_access));
509 ensure(result.
path(
true) == xhost_path);
511 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
513 ensure(result.
factor_ct(
true) == result.
d(
true));
514 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
516 ensure(result.
p(
true) == 2);
517 ensure(result.
dd(
true) == result.
d(
true));
560 attach_to_state(xhost, xhub_id);
567 ensure(index() == xhub_id);
568 ensure(is_attached());
582 attach_to_state(xhost, xid.
hub_pod());
589 ensure(index() ==~ xid);
590 ensure(is_attached());
601 require(!xname.empty());
606 attach_to_state(xhost, xname);
612 ensure(name() == xname);
613 ensure(is_attached());
623 require(xother != 0);
627 attach_to_state(xother);
632 ensure(is_attached());
633 ensure(is_same_state(xother));
643 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
647 new_jim_state(xhost, 0,
false, xauto_access);
651 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
665 require(is_ancestor_of(&xother));
666 require(precondition_of(attach_to_state(&xother)));
670 attach_to_state(&xother);
674 ensure(postcondition_of(attach_to_state(&xother)));
688 require(precondition_of(attach_to_state(&xother)));
692 attach_to_state(&xother);
696 ensure(postcondition_of(attach_to_state(&xother)));
755 require(state_is_read_accessible());
756 require((0 <= xrow) && (xrow < dd()));
757 require((0 <= xcolumn) && (xcolumn < dd()));
761 value_type result = component(index_for_row_column(xrow, xcolumn));
774 component(
int xrow,
int xcolumn,
bool xauto_access)
const 778 require(state_is_auto_read_accessible(xauto_access));
779 require((0 <= xrow) && (xrow < dd(xauto_access)));
780 require((0 <= xcolumn) && (xcolumn < dd(xauto_access)));
812 require(state_is_read_write_accessible());
813 require((0 <= xrow) && (xrow < dd()));
814 require((0 <= xcolumn) && (xcolumn < dd()));
818 put_component(index_for_row_column(xrow, xcolumn), xvalue);
837 require(state_is_auto_read_write_accessible(xauto_access));
838 require((0 <= xrow) && (xrow < dd(xauto_access)));
839 require((0 <= xcolumn) && (xcolumn < dd(xauto_access)));
845 get_read_write_access(
true);
848 put_component(index_for_row_column(xrow, xcolumn), xvalue);
871 require(0 <= xrow && xrow < dd());
872 require(0 <= xcolumn && xcolumn < dd());
891 int result = j + (i*(2*dd()-1-i))/2;
897 ensure(result < dd()*dd());
967 const string& result = static_class_name();
971 ensure(!result.empty());
986 static const string result(
"st2");
990 ensure(!result.empty());
1012 ensure(result != 0);
1039 require(xother != 0);
1046 bool result =
dynamic_cast<const st2*
>(xother) != 0;
1050 ensure(invariant());
1070 invariance(stp::invariant());
1072 if (invariant_check())
1076 disable_invariant_check();
1080 invariance(is_attached() ? (p() == 2) :
true);
1084 enable_invariant_check();
1089 ensure(is_derived_query);
1109 #include "SheafSystem/error_message.h" 1110 #include "SheafSystem/st2_e2.h" 1111 #include "SheafSystem/st2_e3.h" 1132 for(
int i=0; i<ldd; ++i)
1144 ensure(unexecutable(
"xresult == trace(x0)"));
1158 require(precondition_of(
trace(x0, result, xauto_access)));
1164 trace(x0, result, xauto_access);
1168 ensure(postcondition_of(
trace(x0, result, xauto_access)));
1187 for(
int i=0; i<ldd; ++i)
1194 ensure(unexecutable(
"xresult == trace(x0)"));
1208 require(precondition_of(
trace(x0, result)));
1218 ensure(postcondition_of(
trace(x0, result)));
1236 const st2_e2* st2_e2_x0 =
dynamic_cast<const st2_e2*
>(&x0);
1237 const st2_e3* st2_e3_x0 =
dynamic_cast<const st2_e3*
>(&x0);
1249 post_fatal_error_message(\
1250 "Unsupported argument types in call to determinant(...)");
1267 require(precondition_of(
determinant(x0, result, xauto_access)));
1277 ensure(postcondition_of(
determinant(x0, result, xauto_access)));
1305 post_fatal_error_message(\
1306 "Unsupported argument types in call to determinant(...)");
1323 require(precondition_of(
determinant(x0, result)));
1333 ensure(postcondition_of(
determinant(x0, result)));
virtual int dd() const
Dimension of the underlying vector space.
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 ...
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
static const std::string & static_class_name()
The name of this class.
virtual int dd() const
Dimension of the underlying vector space.
bool full() const
True if both poset name and member name are not empty.
virtual int p() const
Degree of this as an antisymmetric tensor space.
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
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...
virtual ~st2_lite()
Destructor.
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...
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".
bool invariant() const
Class invariant.
virtual value_type component(int xrow, int xcolumn) const
The value of the component in a specified row and column.
virtual st2 * clone() const
Make a new handle, no state instance of current.
virtual void get_read_access() const
Get read access to the state associated with this.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
SHEAF_DLL_SPEC void determinant(const st2 &x0, vd_value_type &xresult, bool xauto_access)
The determinant of a symmetric tensor (pre-allocated version for persistent types).
SHEAF_DLL_SPEC void trace(const st2 &x0, vd_value_type &xresult, bool xauto_access)
The trace of a symmetric tensor (pre-allocated version for persistent types).
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
st2_lite()
Default constructor.
virtual void put_component(int xrow, int xcolumn, value_type xcomp)
Sets value of a component in a specified row and column.
static const std::string & static_class_name()
The name of this class.
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 void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
bool invariant() const
Class invariant.
A general symmetric tensor of degree 2 over an abstract vector space (volatile version).
virtual const std::string & class_name() const
The name of this class.
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...
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 bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 3 (volatile version)...
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 const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
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 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 int index_for_row_column(int xrow, int xcolumn) const
The index into linear storage of the component in a specified row and column.
bool empty() const
True if both poset name and member name are empty.
virtual int index_for_row_column(int xrow, int xcolumn) const
Returns index into linear storage of the component in a specified row and column. ...
void put_component(int xrow, int xcolumn, value_type xvalue)
Sets the component with row index xrow and column index xcolumn to xvalue.
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 const poset_path & standard_schema_path()
The path to the standard schema for this class.
st2_lite & operator=(const st2_lite &xother)
Assignment operator.
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.
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 2 (persistent version)...
int dd() const
The dimension of the underlying ("domain") vector space.
virtual st2_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 2 (volatile version)...
virtual const std::string & class_name() const
The name of this class.
An abstract client handle for a member of a poset.
st2()
Default constructor.
An abstract symmetric tensor space of degree p.
Namespace for the fiber_bundles component of the sheaf system.
A general symmetric tensor of degree 2 over an abstract vector space (persistent version).
value_type component(int xrow, int xcolumn) const
The component with row index xrow and column index xcolumn.
virtual st2 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
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...
A client handle for a poset member which has been prepared for use as a schema.
double vd_value_type
The type of component in the fiber; the scalar type in the fiber vector space.
A symmetric tensor of degree 2 over a Euclidean vector space of dimension 3 (persistent 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.