21 #include "SheafSystem/t2.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));
151 require(xrow >= 0 && xrow < dd());
152 require(xcolumn >= 0 && xcolumn < dd());
156 value_type result = component(index_for_row_column(xrow, xcolumn));
173 require(xrow >= 0 && xrow < dd());
174 require(xcolumn >= 0 && xcolumn < dd());
178 put_component(index_for_row_column(xrow, xcolumn), xcomp);
196 require(0 <= xrow && xrow < dd());
197 require(0 <= xcolumn && xcolumn < dd());
201 int result = xrow*dd() + xcolumn;
207 ensure(result < dd()*dd());
264 int result =
static_cast<int>(dd()*dd());
269 ensure(result == static_cast<int>(dd()*dd()));
301 const string& result = static_class_name();
305 ensure(!result.empty());
320 static const string result(
"t2_lite");
324 ensure(!result.empty());
346 ensure(is_same_type(*result));
370 require(&xother != 0);
376 bool result =
dynamic_cast<const t2_lite*
>(&xother) != 0;
389 if(invariant_check())
393 disable_invariant_check();
397 invariance(tp_lite::invariant());
403 enable_invariant_check();
435 static const poset_path result(standard_schema_poset_name(),
"t2_schema");
457 standard_schema_path().member_name(),
458 tp::standard_schema_path(),
462 lschema.detach_from_state();
487 require(!xhost_path.
empty());
490 require(xschema_path.
full());
492 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
497 require(host_type::d(xns, xschema_path, xauto_access) == host_type::d(xns, 2, xvector_space_path, xauto_access));
502 host_type::new_table(xns, xhost_path, xschema_path, 2, xvector_space_path, xauto_access);
506 ensure(xns.
owns(result, xauto_access));
507 ensure(result.
path(
true) == xhost_path);
509 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
511 ensure(result.
factor_ct(
true) == result.
d(
true));
512 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
514 ensure(result.
p(
true) == 2);
563 attach_to_state(&xother);
581 require(is_ancestor_of(&xother));
582 require(precondition_of(attach_to_state(&xother)));
586 attach_to_state(&xother);
590 ensure(postcondition_of(attach_to_state(&xother)));
604 require(precondition_of(attach_to_state(&xother)));
608 attach_to_state(&xother);
612 ensure(postcondition_of(attach_to_state(&xother)));
676 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
680 new_jim_state(xhost, 0,
false, xauto_access);
684 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
702 attach_to_state(xhost, xhub_id);
707 ensure(is_attached());
709 ensure(index() == xhub_id);
723 attach_to_state(xhost, xid.
hub_pod());
728 ensure(is_attached());
730 ensure(index() ==~ xid);
734 t2(
const poset* xhost,
const std::string& xname)
741 require(!xname.empty());
746 attach_to_state(xhost, xname);
751 ensure(is_attached());
753 ensure(name() == xname);
763 require(state_is_read_accessible());
764 require(0 <= xrow && xrow < dd());
765 require(0 <= xcolumn && xcolumn < dd());
771 int result = xrow*dd() + xcolumn;
777 ensure(result < dd()*dd());
812 require(state_is_read_accessible());
813 require((0 <= xrow) && (xrow < dd()));
814 require((0 <= xcolumn) && (xcolumn < dd()));
818 value_type result = component(index_for_row_column(xrow, xcolumn));
831 component(
int xrow,
int xcolumn,
bool xauto_access)
const 835 require(state_is_auto_read_accessible(xauto_access));
836 require((0 <= xrow) && (xrow < dd(xauto_access)));
837 require((0 <= xcolumn) && (xcolumn < dd(xauto_access)));
869 require(state_is_read_write_accessible());
870 require((0 <= xrow) && (xrow < dd()));
871 require((0 <= xcolumn) && (xcolumn < dd()));
875 put_component(index_for_row_column(xrow, xcolumn), xvalue);
894 require(state_is_auto_read_write_accessible(xauto_access));
895 require((0 <= xrow) && (xrow < dd(xauto_access)));
896 require((0 <= xcolumn) && (xcolumn < dd(xauto_access)));
902 get_read_write_access(
true);
905 put_component(index_for_row_column(xrow, xcolumn), xvalue);
952 const string& result = static_class_name();
956 ensure(!result.empty());
971 static const string result(
"t2");
975 ensure(!result.empty());
993 t2* result =
new t2();
1025 if(invariant_check())
1029 disable_invariant_check();
1033 invariance(tp::invariant());
1037 invariance(state_is_read_accessible() ? p() == 2 :
true);
1038 invariance(state_is_read_accessible() ? d() == dd()*dd() :
true);
1042 enable_invariant_check();
1056 require(xother != 0);
1062 bool result =
dynamic_cast<const t2*
>(xother) != 0;
1066 ensure(invariant());
1083 #include "SheafSystem/at0.h" 1084 #include "SheafSystem/at1.h" 1085 #include "SheafSystem/at2.h" 1086 #include "SheafSystem/st2.h" 1087 #include "SheafSystem/t2.h" 1096 require(xp >= 0 && xp < x0.
p());
1097 require(xq >= 0 && xq < x0.
p());
1098 require(xresult.
p() == x0.
p() - 2);
1107 for(
int i=0; i<ldd; ++i)
1132 require(xp >= 0 && xp < x0.
p(xauto_access));
1133 require(xq >= 0 && xq < x0.
p(xauto_access));
1135 x0.is_contravariant(xq, xauto_access));
1150 for(
int i=0; i<ldd; ++i)
1180 require(x0.
dd() == xresult.
dd());
1188 for(
int i=0; i<ldd-1; ++i)
1190 for(
int j=i+1; j<ldd; ++j)
1199 ensure(unexecutable(
"xresult is equal to the antisymmetric part of x0"));
1232 for(
int i=0; i<ldd-1; ++i)
1234 for(
int j=i+1; j<ldd; ++j)
1258 ensure(unexecutable(
"xresult is equal to the antisymmetric part of x0"));
1272 require(x0.
dd() == xresult.
dd());
1280 for(
int i=0; i<ldd; ++i)
1282 for(
int j=0; j<ldd; ++j)
1291 ensure(unexecutable(
"xresult is equal to the antisymmetric part of x0"));
1305 require(x0.
dd() == xresult.
dd());
1313 for(
int i=0; i<ldd; ++i)
1315 for(
int j=i; j<ldd; ++j)
1324 ensure(unexecutable(
"xresult is equal to the symmetric part of x0"));
1340 require(x0.
dd(xauto_access) == xresult.
dd(xauto_access));
1359 for(
int i=0; i<ldd; ++i)
1361 for(
int j=i; j<ldd; ++j)
1385 ensure(unexecutable(
"xresult is equal to the symmetric part of x0"));
1399 require(x0.
dd() == xresult.
dd());
1407 for(
int i=0; i<ldd; ++i)
1409 for(
int j=0; j<ldd; ++j)
1418 ensure(unexecutable(
"xresult is equal to the symmetric part of x0"));
1434 require(x0.
dd() == xresult.
dd());
1453 for(
int i=0; i<ldd; ++i)
1455 for(
int j=0; j<ldd; ++j)
1478 ensure(unexecutable(
"xresult is equal to the symmetric part of x0"));
1492 require(x1.
dd() == x0.
dd());
1493 require(xresult.
dd() == x0.
dd());
1499 for(
int i=0; i<ldd; ++i)
1503 for(
int j=0; j<ldd; ++j)
1530 require(x1.
dd(xauto_access) == x0.
dd(xauto_access));
1531 require(xresult.
dd(xauto_access) == x0.
dd(xauto_access));
1544 for(
int i=0; i<ldd; ++i)
1548 for(
int j=0; j<ldd; ++j)
1570 ensure(xresult.
variance(xauto_access) ==
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
virtual int dd() const
Dimension of the underlying vector space.
virtual bool is_contravariant(bool xauto_access) const
True if and only if all tensor index positions are contravariant.
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 ...
t2_lite & operator=(const t2_lite &xother)
Assignment operator.
SHEAF_DLL_SPEC void alt(const t2_lite &x0, at2_lite &xresult)
The alternating (antisymmetric) part of tensor x0 (pre-allocated version for volatile types)...
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
virtual void put_component(int xrow, int xcolumn, value_type xcomp)
Sets value of a component in a specified row and column.
virtual int dd() const
Dimension of the underlying vector space.
bool full() const
True if both poset name and member name are not empty.
void put_variance(const tensor_variance &xvariance, bool xauto_access)
Sets the variance to xvariance.
virtual int p() const
The degree of the tensors in host(); the sum of the contravariant and covariant degrees.
virtual t2_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
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.
A general antisymmetric tensor of degree 1 over an abstract vector space (persistent version)...
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 volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
A general antisymmetric tensor of degree 1 over an abstract vector space (volatile version)...
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...
SHEAF_DLL_SPEC void sym(const t2_lite &x0, st2_lite &xresult)
The symmetric part of tensor x0 (pre-allocated version for volatile types).
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
value_type component(int xrow, int xcolumn) const
The value of the component in a specified row and column.
value_type component(int xindex) const
The xindex-th component.
virtual int p() const
The degree of the tensor; the sum of the contravariant and covariant degrees.
virtual int d() const
Dimension of this as a vector space.
virtual void get_read_access() const
Get read access to the state associated with this.
virtual t2 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
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 const std::string & class_name() const
The name of this class.
static const std::string & static_class_name()
The name of this class.
SHEAF_DLL_SPEC tensor_variance tensor_product(const tensor_variance &x0, const tensor_variance &x1)
The variance of the tensor product of tensors with variance x0 and x1.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual void put_component(int xrow, int xcolumn, value_type xcomp)
Sets value of a component in a specified row and column.
bool is_mixed() const
True if and only if there exists at least one index that is covariant and at least one that is contra...
virtual t2 * clone() const
Make a new handle, no state instance of current.
A tensor of degree 2 over an abstract vector space (volatile version).
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.
void put_component(int xrow, int xcolumn, value_type xvalue)
Sets the component with row index xrow and column index xcolumn to xvalue.
Abstract base class with useful features for all objects.
A general symmetric tensor of degree 2 over an abstract vector space (volatile version).
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
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 int index_for_row_column(int xrow, int xcolumn) const
The index into linear storage of the component in a specified row and column.
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...
bool invariant() const
Class invariant.
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.
A scalar viewed as an antisymmetric tensor of degree 0. As the degree is 0 there is nothing to be sym...
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
Antisymetric tensor of degree 0 (volatile version).
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 value_type component(int xindex) const
The value of the xi-th component.
virtual bool invariant() const
Class invariant.
bool empty() const
True if both poset name and member name are empty.
void put_component(int xrow, int xcolumn, value_type xvalue)
Sets the component with row index xrow and column index xcolumn to xvalue.
value_type component(int xrow, int xcolumn) const
The component with row index xrow and column index xcolumn.
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_row_column(int xrow, int xcolumn) const
The index into linear storage of the component in a specified row and column.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
static const std::string & static_class_name()
The name of this class.
virtual void get_read_write_access(bool xrelease_read_only_access=false)
Get read write access to the state associated with this. If release_read_only_access is requested...
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
virtual int p() const
Degree of this as an antisymmetric tensor space.
virtual void put_component(value_type xcomp)
Set value of (the only) component to xcomp.
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.
virtual ~t2_lite()
Destructor.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
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 tensor_variance variance(bool xauto_access) const
The variance.
A general antisymmetric tensor of degree 2 over an abstract vector space (volatile version)...
An abstract client handle for a member of a poset.
void put_component(int xrow, int xcolumn, value_type xcomp)
Sets value of a component in a specified row and column.
virtual void put_component(int xindex, value_type xvalue)
Sets the value of the xindex-th component to xvalue.
An abstract tensor space of degree p.
void put_component(int xrow, int xcolumn, value_type xvalue)
Sets the component with row index xrow and column index xcolumn to xvalue.
SHEAF_DLL_SPEC void tensor(const at1_lite &x0, const at1_lite &x1, t2_lite &xresult)
Tensor product (pre-allocated version for volatile types).
Namespace for the fiber_bundles component of the sheaf system.
A general symmetric tensor of degree 2 over an abstract vector space (persistent version).
t2_lite()
Default constructor.
Row dofs type for class vd.
A general antisymmetric tensor of degree 2 over an abstract vector space.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
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...
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
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.
SHEAF_DLL_SPEC void contract(const t2_lite &x0, int xp, int xq, at0_lite &xresult)
Contraction on contravariant index xp and covariant index xq (pre-allocated version for volatime type...
A tensor of degree 2 over an abstract vector space (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.