21 #include "SheafSystem/sec_tp.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/binary_section_space_schema_member.impl.h" 25 #include "SheafSystem/binary_section_space_schema_poset.h" 26 #include "SheafSystem/fiber_bundles_namespace.h" 27 #include "SheafSystem/section_space_schema_member.impl.h" 28 #include "SheafSystem/section_space_schema_poset.h" 29 #include "SheafSystem/sec_at1.h" 30 #include "SheafSystem/sec_at1_space.h" 31 #include "SheafSystem/sec_tuple_space.impl.h" 32 #include "SheafSystem/tp.h" 33 #include "SheafSystem/tp_space.h" 62 require(!xhost_path.
empty());
65 require(xschema_path.
full());
67 require(host_type::fiber_space_conforms<fiber_type::host_type>(xns, xschema_path, xauto_access));
71 require(host_type::same_vector_fiber_space(xns, xschema_path, xvector_space_path, xauto_access));
75 host_type& result = host_type::new_table(xns, xhost_path, xschema_path, xvector_space_path, xauto_access);
79 ensure(xns.
owns(result, xauto_access));
80 ensure(result.
path(
true) == xhost_path);
82 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
132 attach_to_state(xhost, xhub_id);
137 ensure(host() == xhost);
138 ensure(index() == xhub_id);
139 ensure(is_attached());
140 ensure(!is_restricted());
154 attach_to_state(xhost, xid.
hub_pod());
159 ensure(host() == xhost);
160 ensure(index() ==~ xid);
161 ensure(is_attached());
162 ensure(!is_restricted());
172 require(!xname.empty());
177 attach_to_state(xhost, xname);
182 ensure(host() == xhost);
183 ensure(name() == xname);
184 ensure(is_attached());
185 ensure(!is_restricted());
196 require(precondition_of(attach_to_state(same args)));
200 attach_to_state(xnamespace, xpath, xauto_access);
204 ensure(postcondition_of(attach_to_state(same args)));
216 require(xother != 0);
220 attach_to_state(xother);
225 ensure(is_attached());
226 ensure(is_same_state(xother));
227 ensure(is_same_restriction(xother));
237 require(precondition_of(new_jim_state(xhost, xdof_map,
false, xauto_access)));
241 new_jim_state(xhost, xdof_map,
false, xauto_access);
245 ensure(postcondition_of(new_jim_state(xhost, xdof_map,
false, xauto_access)));
255 int xbase_version,
bool xauto_access)
259 require(precondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
263 new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access);
267 ensure(postcondition_of(new_jim_state(xhost, xbase_mbr, xbase_version, xauto_access)));
280 require(is_ancestor_of(&xother));
281 require(precondition_of(attach_to_state(&xother)));
285 attach_to_state(&xother);
289 ensure(postcondition_of(attach_to_state(&xother)));
302 require(precondition_of(attach_to_state(&xother)));
306 attach_to_state(&xother);
310 ensure(postcondition_of(attach_to_state(&xother)));
323 require(precondition_of(sec_vd::operator=(xfiber)));
327 sec_vd::operator=(xfiber);
331 ensure(postcondition_of(sec_vd::operator=(xfiber)));
344 require(precondition_of(sec_vd::operator=(xfiber)));
348 sec_vd::operator=(xfiber);
352 ensure(postcondition_of(sec_vd::operator=(xfiber)));
395 require(state_is_read_accessible());
399 int result = host()->p();
412 p(
bool xauto_access)
const 416 require(state_is_auto_read_accessible(xauto_access));
420 int result = host()->p(xauto_access);
437 require(state_is_read_accessible());
441 int result = host()->dd();
454 dd(
bool xauto_access)
const 458 require(state_is_auto_read_accessible(xauto_access));
462 int result = host()->dd(xauto_access);
479 require(state_is_read_accessible());
483 poset_path result(host()->vector_space_path());
487 ensure(!result.
empty());
500 require(state_is_auto_read_accessible(xauto_access));
504 poset_path result(host()->vector_space_path(xauto_access));
508 ensure(!result.
empty());
521 require(state_is_read_accessible());
522 require(name_space()->state_is_read_accessible());
544 require(state_is_auto_read_accessible(xauto_access));
545 require(name_space()->state_is_auto_read_accessible(xauto_access));
551 name_space()->get_read_access();
560 name_space()->release_access();
578 const string result = xvector_space_name +
"_" + xname;
593 require(state_is_auto_read_accessible(xauto_access));
612 require(state_is_auto_read_accessible(xauto_access));
616 bool result = host()->variance(_index, xi, xauto_access);
631 require(state_is_auto_read_write_accessible(xauto_access));
635 host()->put_variance(_index, xvariance, xauto_access);
650 require(state_is_auto_read_write_accessible(xauto_access));
651 require((0 <= xi) && (xi < p(xauto_access)));
655 host()->put_variance(_index, xi, xvariance, xauto_access);
670 require(state_is_auto_read_accessible(xauto_access));
674 bool result = host()->is_covariant(_index, xauto_access);
689 require(state_is_auto_read_accessible(xauto_access));
690 require((0 <= xi) && (xi < p(xauto_access)));
694 bool result = host()->is_covariant(_index, xi, xauto_access);
709 require(state_is_auto_read_accessible(xauto_access));
713 host()->put_is_covariant(_index, xauto_access);
717 ensure(is_covariant(xauto_access));
730 require(state_is_auto_read_write_accessible(xauto_access));
731 require((0 <= xi) && (xi < p(xauto_access)));
735 host()->put_is_covariant(_index, xi, xauto_access);
739 ensure(is_covariant(xi, xauto_access));
752 require(state_is_auto_read_accessible(xauto_access));
756 bool result = host()->is_contravariant(_index, xauto_access);
773 require(state_is_auto_read_accessible(xauto_access));
774 require((0 <= xi) && (xi < p(xauto_access)));
778 bool result = host()->is_contravariant(_index, xi, xauto_access);
793 require(state_is_auto_read_accessible(xauto_access));
797 host()->put_is_contravariant(_index, xauto_access);
801 ensure(is_contravariant(xauto_access));
814 require(state_is_auto_read_write_accessible(xauto_access));
815 require((0 <= xi) && (xi < p(xauto_access)));
819 host()->put_is_contravariant(_index, xi, xauto_access);
823 ensure(is_contravariant(xi, xauto_access));
871 const string& result = static_class_name();
875 ensure(!result.empty());
890 static const string result(
"sec_tp");
894 ensure(!result.empty());
941 return reinterpret_cast<host_type*
>(_host);
948 return dynamic_cast<const host_type*
>(xother) != 0;
968 require(xother != 0);
975 bool result =
dynamic_cast<const tp*
>(xother) != 0;
994 require(xother != 0);
1001 bool result =
dynamic_cast<const sec_tp*
>(xother) != 0;
1025 invariance(sec_vd::invariant());
1027 if (invariant_check())
1031 disable_invariant_check();
1033 invariance(is_attached() ? (p() >= 0) :
true);
1037 enable_invariant_check();
1042 ensure(is_derived_query);
1058 #include "SheafSystem/error_message.h" 1059 #include "SheafSystem/sec_at0.h" 1060 #include "SheafSystem/sec_at1.h" 1061 #include "SheafSystem/sec_at2.h" 1062 #include "SheafSystem/sec_at3_e3.h" 1063 #include "SheafSystem/sec_atp.h" 1064 #include "SheafSystem/sec_st2.h" 1065 #include "SheafSystem/sec_st3.h" 1066 #include "SheafSystem/sec_st3_e3.h" 1067 #include "SheafSystem/sec_st4_e2.h" 1068 #include "SheafSystem/sec_st4_e3.h" 1069 #include "SheafSystem/sec_stp.h" 1070 #include "SheafSystem/sec_t2.h" 1071 #include "SheafSystem/sec_t3.h" 1072 #include "SheafSystem/sec_t3_e3.h" 1073 #include "SheafSystem/sec_t4_e2.h" 1074 #include "SheafSystem/sec_t4_e3.h" 1084 require(x0.
dd(xauto_access) == xresult.
dd(xauto_access));
1091 const sec_t2* t2_x0 =
dynamic_cast<const sec_t2*
>(&x0);
1092 const sec_t3* t3_x0 =
dynamic_cast<const sec_t3*
>(&x0);
1101 if(t2_x0 && at2_xresult)
1103 alt(*t2_x0, *at2_xresult, xauto_access);
1105 else if(t2_x0 && t2_xresult)
1107 alt(*t2_x0, *t2_xresult, xauto_access);
1109 else if(t3_e3_x0 && at3_e3_xresult)
1111 alt(*t3_e3_x0, *at3_e3_xresult, xauto_access);
1113 else if(t3_x0 && t3_xresult)
1115 alt(*t3_x0, *t3_xresult, xauto_access);
1117 else if(t3_x0 && at3_xresult)
1119 alt(*t3_x0, *at3_xresult, xauto_access);
1123 post_fatal_error_message(\
1124 "Unsupported argument types in call to tensor(...)");
1142 require(x0.
dd(xauto_access) == xresult.
dd(xauto_access));
1149 const sec_t2* t2_x0 =
dynamic_cast<const sec_t2*
>(&x0);
1150 const sec_t3* t3_x0 =
dynamic_cast<const sec_t3*
>(&x0);
1163 if(t2_x0 && st2_xresult)
1165 sym(*t2_x0, *st2_xresult, xauto_access);
1167 else if(t2_x0 && t2_xresult)
1169 sym(*t2_x0, *t2_xresult, xauto_access);
1171 else if(t3_e3_x0 && st3_e3_xresult)
1173 sym(*t3_e3_x0, *st3_e3_xresult, xauto_access);
1175 else if(t3_x0 && t3_xresult)
1177 sym(*t3_x0, *t3_xresult, xauto_access);
1179 else if(t3_x0 && st3_xresult)
1181 sym(*t3_x0, *st3_xresult, xauto_access);
1183 else if(t4_e2_x0 && st4_e2_xresult)
1185 sym(*t4_e2_x0, *st4_e2_xresult, xauto_access);
1187 else if(t4_e3_x0 && st4_e3_xresult)
1189 sym(*t4_e3_x0, *st4_e3_xresult, xauto_access);
1193 post_fatal_error_message(\
1194 "Unsupported argument types in call to tensor(...)");
1213 require(xp >= 0 && xp < x0.
p(xauto_access));
1214 require(xq >= 0 && xq < x0.
p(xauto_access));
1216 x0.is_contravariant(xq, xauto_access));
1222 const sec_t2* t2_x0 =
dynamic_cast<const sec_t2*
>(&x0);
1223 const sec_t3* t3_x0 =
dynamic_cast<const sec_t3*
>(&x0);
1228 if(t2_x0 && at0_xresult)
1230 contract(*t2_x0, xp, xq, *at0_xresult, xauto_access);
1232 else if(t3_x0 && at1_xresult)
1234 contract(*t3_x0, xp, xq, *at1_xresult, xauto_access);
1238 post_fatal_error_message(\
1239 "Unsupported argument types in call to tensor(...)");
1260 require(x1.
dd(xauto_access) == x0.
dd(xauto_access));
1261 require(xresult.
dd(xauto_access) == x0.
dd(xauto_access));
1270 const sec_t2* t2_x0 =
dynamic_cast<const sec_t2*
>(&x0);
1275 const sec_t2* t2_x1 =
dynamic_cast<const sec_t2*
>(&x1);
1280 if(at1_x0 && at1_x1 && t2_xresult)
1282 tensor(*at1_x0, *at1_x1, *t2_xresult, xauto_access);
1284 else if(t2_x0 && at1_x1 && t3_xresult)
1286 tensor(*t2_x0, *at1_x1, *t3_xresult, xauto_access);
1288 else if(at1_x0 && t2_x1 && t3_xresult)
1290 tensor(*at1_x0, *t2_x1, *t3_xresult, xauto_access);
1292 else if(at2_x0 && at1_x1 && t3_xresult)
1294 tensor(*at2_x0, *at1_x1, *t3_xresult, xauto_access);
1296 else if(at1_x0 && at2_x1 && t3_xresult)
1298 tensor(*at1_x0, *at2_x1, *t3_xresult, xauto_access);
1300 else if(st2_x0 && at1_x1 && t3_xresult)
1302 tensor(*st2_x0, *at1_x1, *t3_xresult, xauto_access);
1304 else if(at1_x0 && st2_x1 && t3_xresult)
1306 tensor(*at1_x0, *st2_x1, *t3_xresult, xauto_access);
1310 post_fatal_error_message(\
1311 "Unsupported argument types in call to tensor(...)");
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
static const std::string create_tensor_space_name(const std::string &xvector_space_name, const std::string &xname)
Create a standard tensor space name.
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 ...
A section of a bundle with fiber type st3_e3.
sec_tp()
Default constructor.
SHEAF_DLL_SPEC void sym(const sec_t2 &x0, sec_st2 &xresult, bool xauto_access)
The symmetric part of tensor x0 (pre-allocated version).
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)...
virtual void put_is_contravariant(bool xauto_access)
Sets all tensor index positions to contravariant.
bool full() const
True if both poset name and member name are not empty.
The "type" of a tensor; specifies the degree and the co- or contra-variance for each index of a tenso...
The abstract map from section dof ids to section dof values of heterogeneous type.
A section of a bundle with fiber type at3_e3.
A space of scalars viewed as an antisymmetric tensor section space of degree 1.
virtual sec_tp & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
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...
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.
bool fiber_is_ancestor_of(const any *xother) const
True if xother conforms to an instance of the fiber of current.
SHEAF_DLL_SPEC void sym(const t2_lite &x0, st2_lite &xresult)
The symmetric part of tensor x0 (pre-allocated version for volatile types).
virtual const std::string & class_name() const
The name of this class.
SHEAF_DLL_SPEC void alt(const sec_t2 &x0, sec_at2 &xresult, bool xauto_access)
The alternating (antisymmetric) part of tensor x0 (pre-allocated version).
static const std::string & static_class_name()
The name of this class.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
A member of a sec_rep_space; a section.
poset_path vector_space_path() const
The path of the underlying vector space.
A schema poset for a section space. A binary Cartesian product subspace of the binary tensor product ...
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.
A section of a bundle with fiber type at1.
virtual void put_is_covariant(bool xauto_access)
Sets all tensor index positions to covariant.
virtual tensor_variance variance(bool xauto_access) const
The variance.
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.
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...
A section of a bundle with fiber type t3_e3.
A general tensor of "degree" p and given "variance" over an abstract vector space.
A section of a bundle with fiber type t3.
Abstract base class with useful features for all objects.
int p() const
The tensor degree of this space.
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
virtual bool is_contravariant(bool xauto_access) const
True if and only if all tensor index positions are contravariant.
A section of a bundle with fiber type st4_e3.
An abstract tensor section space of degree p.
bool is_ancestor_of(const any *xother) const
True if xother conforms to current.
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 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 section of a bundle with fiber type at2.
A section of a bundle with fiber type atp.
host_type * host() const
The poset this is a member of.
virtual int dd() const
Dimension of the underlying vector space.
A section of a bundle with fiber type st2.
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
A section of a bundle with fiber type stp.
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. ...
A section of a bundle with fiber type at3.
int dd() const
The dimension of the underlying ("domain") vector space.
virtual sec_tp_space & vector_space() const
The underlying vector space.
bool empty() const
True if both poset name and member name are empty.
A section of a bundle with fiber type st3.
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
virtual sec_tp * clone() const
Make a new handle, no state instance of current.
A section of a bundle with fiber type st4_e2.
A section of a bundle with fiber type t4_e2.
virtual const fiber_type & fiber_prototype() const
Virtual constructor for the associated fiber type.
A section of a bundle with fiber type tp.
A section of a bundle with fiber type t4_e3.
SHEAF_DLL_SPEC void contract(const sec_t2 &x0, int xp, int xq, sec_at0 &xresult, bool xauto_access)
Contraction on contravariant index xp and covariant index xq (pre-allocated version).
int_type pod_index_type
The plain old data index type.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
poset & fiber_space()
The fiber space for section spaces on this schema (mutable version).
SHEAF_DLL_SPEC void tensor(const sec_at1 &x0, const sec_at1 &x1, sec_t2 &xresult, bool xauto_access)
poset_path vector_space_path() const
The path of the underlying vector space.
bool variance(int xi) const
The variance of the xi-th index; covariant if true, contravariant if false.
virtual int d(int xp, int xdd) const
Dimension d() as a function of degree xp and domain dimension xdd.
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
virtual bool is_covariant(bool xauto_access) const
True if and only if all tensor index positions are covariant.
bool invariant() const
Class invariant.
An abstract client handle for a member of a poset.
An abstract tensor space of degree p.
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.
Antisymetric tensor of degree 0. As the degree is 0 there is nothing to be symmetric or antisymmetric...
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...
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 section of a bundle with fiber type tp.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
A handle for a poset whose members are numerical representations of sections of a fiber bundle...