21 #include "SheafSystem/sec_tp_space.h" 23 #include "SheafSystem/abstract_poset_member.impl.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/binary_section_space_schema_member.impl.h" 26 #include "SheafSystem/binary_section_space_schema_poset.h" 27 #include "SheafSystem/fiber_bundles_namespace.h" 28 #include "SheafSystem/namespace_poset.impl.h" 29 #include "SheafSystem/namespace_poset_member.h" 30 #include "SheafSystem/poset_handle_factory.h" 31 #include "SheafSystem/sec_at1.h" 32 #include "SheafSystem/sec_at1_space.h" 33 #include "SheafSystem/sec_tp.h" 34 #include "SheafSystem/sec_tuple_space.impl.h" 35 #include "SheafSystem/section_space_schema_member.impl.h" 36 #include "SheafSystem/section_space_schema_poset.h" 37 #include "SheafSystem/tp.h" 38 #include "SheafSystem/tp_space.h" 75 result = lfiber_space->
vector_space_path(xauto_access) == lvector_host.schema().fiber_space().
path(xauto_access);
101 require(!xpath.
empty());
104 require(xschema_path.
full());
106 require(fiber_space_conforms<fiber_type::host_type>(xns, xschema_path, xauto_access));
110 require(same_vector_fiber_space(xns, xschema_path, xvector_space_path, xauto_access));
118 table_type& result = *(
new table_type());
122 schema_type lschema(xns, xschema_path, xauto_access);
147 lmap.
put_dof(
"scalar_space_path", lscalar_space_path);
151 lmap.
put_dof(
"vector_space_path", xvector_space_path);
155 result.new_state(xns, xpath, lschema, lmap);
164 ensure(xns.
owns(result, xauto_access));
165 ensure(result.path(
true) == xpath);
166 ensure(result.state_is_not_read_accessible());
167 ensure(result.schema(
true).path(xauto_access) == xschema_path);
169 ensure(result.factor_ct(
true) == result.schema(
true).fiber_space<
fiber_type::host_type>().factor_ct(xauto_access));
171 ensure(result.scalar_space_path(
true) ==
174 ensure(result.dd(
true) == result.schema(
true).fiber_space<
fiber_type::host_type>().dd(xauto_access));
175 ensure(result.vector_space_path(
true) == xvector_space_path);
190 d(
int xp,
int xdd)
const 192 return static_cast<int>(
pow(static_cast<double>(xdd), xp));
201 require(state_is_read_accessible());
216 p(
bool xauto_access)
const 220 require(state_is_auto_read_accessible(xauto_access));
249 require(state_is_read_accessible());
264 dd(
bool xauto_access)
const 268 require(state_is_auto_read_accessible(xauto_access));
297 require(state_is_read_accessible());
305 ensure(!result.
empty());
318 require(state_is_auto_read_accessible(xauto_access));
336 ensure(!result.
empty());
349 require(state_is_auto_read_accessible(xauto_access));
350 require(contains_member(xmbr_id, xauto_access));
351 require(contains_variance_subposets(xauto_access));
363 for(
int i=0; i<lp; ++i)
365 result.
put_variance(i, is_covariant(xmbr_id, i,
false));
386 require(state_is_auto_read_accessible(xauto_access));
387 require(contains_member(xmbr_id, xauto_access));
388 require(contains_variance_subposets(xauto_access));
392 return variance(xmbr_id.
hub_pod(), xauto_access);
401 require(state_is_auto_read_accessible(xauto_access));
402 require(contains_member(xmbr_id, xauto_access));
406 bool result = is_covariant(xmbr_id, xi, xauto_access);
421 require(state_is_auto_read_accessible(xauto_access));
422 require(contains_member(xmbr_id, xauto_access));
426 return variance(xmbr_id.
hub_pod(), xi, xauto_access);
435 require(state_is_auto_read_write_accessible(xauto_access));
436 require(contains_member(xmbr_id, xauto_access));
437 require(xvariance.
p() == p(xauto_access));
443 get_read_write_access(
true);
446 int lct = covariant_subposet_ct();
448 for(
int i=0; i<lct; ++i)
450 put_variance(xmbr_id, i, xvariance.
variance(i),
false);
460 ensure(variance(xmbr_id, xauto_access) == round_variance(xvariance));
473 require(state_is_auto_read_write_accessible(xauto_access));
474 require(contains_member(xmbr_id, xauto_access));
475 require(xvariance.
p() == p(xauto_access));
479 put_variance(xmbr_id.
hub_pod(), xvariance, xauto_access);
483 ensure(variance(xmbr_id, xauto_access) == round_variance(xvariance));
496 require(state_is_auto_read_write_accessible(xauto_access));
497 require(contains_member(xmbr_id, xauto_access));
498 require((0 <= xi) && (xi < p(xauto_access)));
504 put_is_covariant(xmbr_id, xi, xauto_access);
508 put_is_contravariant(xmbr_id, xi, xauto_access);
513 ensure(variance(xmbr_id, xi, xauto_access) == xvariance);
526 require(state_is_auto_read_write_accessible(xauto_access));
527 require(contains_member(xmbr_id, xauto_access));
528 require((0 <= xi) && (xi < p(xauto_access)));
532 put_variance(xmbr_id.
hub_pod(), xi, xvariance, xauto_access);
536 ensure(variance(xmbr_id, xi, xauto_access) == xvariance);
564 require(state_is_auto_read_accessible(xauto_access));
565 require(contains_member(xmbr_id, xauto_access));
575 int lp = covariant_subposet_ct();
576 for(
int i=0; i<lp && result; ++i)
578 subposet lsp(
this, covariant_subposet_name(i));
585 assertion(p() == 0 ? result :
true);
606 require(state_is_auto_read_accessible(xauto_access));
607 require(contains_member(xmbr_id, xauto_access));
611 return is_covariant(xmbr_id.
hub_pod(), xauto_access);
620 require(state_is_auto_read_accessible(xauto_access));
621 require(contains_member(xmbr_id, xauto_access));
622 require((0 <= xi) && (xi < p(xauto_access)));
623 require(contains_variance_subposets(xauto_access));
637 int lxi = (covariant_subposet_ct() > 1) ? xi : 0;
643 subposet lsp(
this, covariant_subposet_name(lxi));
666 require(state_is_auto_read_accessible(xauto_access));
667 require(contains_member(xmbr_id, xauto_access));
668 require((0 <= xi) && (xi < p(xauto_access)));
669 require(contains_variance_subposets(xauto_access));
673 return is_covariant(xmbr_id.
hub_pod(), xi, xauto_access);
682 require(state_is_auto_read_write_accessible(xauto_access));
683 require(contains_member(xmbr_id, xauto_access));
689 get_read_write_access(
true);
692 int lp = covariant_subposet_ct();
693 for(
int i=0; i<lp; ++i)
695 subposet lcovariant(
this, covariant_subposet_name(i));
707 ensure(is_covariant(xmbr_id, xauto_access));
720 require(state_is_auto_read_write_accessible(xauto_access));
721 require(contains_member(xmbr_id, xauto_access));
725 put_is_covariant(xmbr_id.
hub_pod(), xauto_access);
729 ensure(is_covariant(xmbr_id, xauto_access));
742 require(state_is_auto_read_write_accessible(xauto_access));
743 require(contains_member(xmbr_id, xauto_access));
744 require((0 <= xi) && (xi < p(xauto_access)));
750 get_read_write_access(
true);
758 int lxi = (covariant_subposet_ct() > 1) ? xi : 0;
764 subposet lsp(
this, covariant_subposet_name(lxi));
775 ensure(is_covariant(xmbr_id, xi, xauto_access));
788 require(state_is_auto_read_write_accessible(xauto_access));
789 require(contains_member(xmbr_id, xauto_access));
790 require((0 <= xi) && (xi < p(xauto_access)));
794 put_is_covariant(xmbr_id.
hub_pod(), xi, xauto_access);
798 ensure(is_covariant(xmbr_id, xi, xauto_access));
811 require(state_is_auto_read_accessible(xauto_access));
812 require(contains_member(xmbr_id, xauto_access));
822 int lp = covariant_subposet_ct();
823 for(
int i=0; i<lp && result; ++i)
825 subposet lsp(
this, covariant_subposet_name(i));
832 assertion(p() == 0 ? result :
true);
854 require(state_is_auto_read_accessible(xauto_access));
855 require(contains_member(xmbr_id, xauto_access));
859 return is_contravariant(xmbr_id.
hub_pod(), xauto_access);
868 require(state_is_auto_read_accessible(xauto_access));
869 require(contains_member(xmbr_id, xauto_access));
870 require((0 <= xi) && (xi < p(xauto_access)));
874 bool result = !is_covariant(xmbr_id, xi, xauto_access);
896 require(state_is_auto_read_accessible(xauto_access));
897 require(contains_member(xmbr_id, xauto_access));
898 require((0 <= xi) && (xi < p(xauto_access)));
902 return is_contravariant(xmbr_id.
hub_pod(), xi, xauto_access);
911 require(state_is_auto_read_write_accessible(xauto_access));
912 require(contains_member(xmbr_id, xauto_access));
918 get_read_write_access(
true);
921 int lp = covariant_subposet_ct();
922 for(
int i=0; i<lp; ++i)
924 subposet lcovariant(
this, covariant_subposet_name(i));
936 ensure(is_contravariant(xmbr_id, xauto_access));
949 require(state_is_auto_read_write_accessible(xauto_access));
950 require(contains_member(xmbr_id, xauto_access));
954 put_is_contravariant(xmbr_id.
hub_pod(), xauto_access);
958 ensure(is_contravariant(xmbr_id, xauto_access));
971 require(state_is_auto_read_write_accessible(xauto_access));
972 require(contains_member(xmbr_id, xauto_access));
973 require((0 <= xi) && (xi < p(xauto_access)));
979 get_read_write_access(
true);
987 int lxi = (covariant_subposet_ct() > 1) ? xi : 0;
993 subposet lsp(
this, covariant_subposet_name(lxi));
1004 ensure(is_contravariant(xmbr_id, xi, xauto_access));
1017 require(state_is_auto_read_write_accessible(xauto_access));
1018 require(contains_member(xmbr_id, xauto_access));
1019 require((0 <= xi) && (xi < p(xauto_access)));
1023 put_is_contravariant(xmbr_id.
hub_pod(), xi, xauto_access);
1027 ensure(is_contravariant(xmbr_id, xi, xauto_access));
1072 require(xbottom != 0);
1142 fiber_bundle::sec_tp_space::
1145 bool result =
false;
1175 return SEC_TP_SPACE_ID;
1189 static const char* result =
"sec_tp_space";
1274 result =
dynamic_cast<const sec_tp_space*
>(xother) != 0;
1297 ensure(result != 0);
void put_variance(pod_index_type xmbr_id, const tensor_variance &xvariance, bool xauto_access)
Sets the variance of the member with id xmbr_id to xvariance.
A client handle for a subposet.
virtual void put_is_contravariant(pod_index_type xmbr_id, bool xauto_access)
Sets all tensor index positions of the member with id xmbr_id to contravariant.
void insert_prototype(const poset_state_handle *xprototype)
Sets xprototype as the prototype for its client class.
section_space_schema_poset * host() const
The poset which this is a handle to a component of.
A client handle for a poset member which has been prepared for use as a schema for a section space...
bool full() const
True if both poset name and member name are not empty.
int p() const
The tensor degree.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
The "type" of a tensor; specifies the degree and the co- or contra-variance for each index of a tenso...
const scoped_index & index() const
The member index of this poset within the namespace host()
A space of scalars viewed as an antisymmetric tensor section space of degree 1.
static bool same_vector_fiber_space(const namespace_poset &xns, const poset_path &xschema_path, const poset_path &xvector_space_path, bool xauto_access)
True if and only if vector space of fiber space == fiber space of vector space. More precisely...
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_type
Identifiers for poset types.
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...
sec_tp_space()
Default constructor; creates a new sec_tp_space handle not attached to any state. ...
void put_variance(int xi, bool xvalue)
Sets the variance of the xi-th index to xvalue.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
virtual bool invariant() const
Class invariant.
poset_path vector_space_path() const
The path of the underlying vector space.
virtual bool contains_member(pod_index_type xmbr_hub_id) const
True if this poset contains poset member with hub id xmbr_hub_id.
virtual bool invariant() const
Class invariant.
A schema poset for a section space. A binary Cartesian product subspace of the binary tensor product ...
An abstract vector section space of dimension d.
virtual sec_tp_space * clone() const
Virtual constructor; creates a new handle of the same actual type as this, attached to the same state...
virtual void get_read_access() const
Get read access to the state associated with this.
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.
void copy_dof_tuple(const poset_dof_map &xother)
Copies the dof tuple of xother into this.
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 objects.
int p() const
The tensor degree of this space.
poset & fiber_space()
The fiber space for section spaces on this schema.
virtual section_space_schema_member & schema()
The schema for this poset (mutable version)
virtual tensor_variance variance(pod_index_type xmbr_id, bool xauto_access) const
The variance of the member with id xmbr_id.
An abstract tensor section space of degree p.
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 tensor_variance round_variance(const tensor_variance &xvariance) const
"Rounds" xvariance up or down to a supported value. Version defined in this class just returns xvaria...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
virtual void insert_member(pod_index_type xmbr_hub_id)
Inserts the member of host() with hub id xmbr_hub_id.
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
static sec_tp_space & new_table(namespace_type &xhost, const poset_path &xpath, const poset_path &xschema_path, const poset_path &xvector_space_path, bool xauto_access)
Creates a new sec_tp_space in namespace xns with path xpath, schema specified by xschema_path, and vector space specified by xvector_space_path.
virtual void put_is_covariant(pod_index_type xmbr_id, bool xauto_access)
Sets all tensor index positions of the member with id xmbr_id to covariant.
int dd() const
The dimension of the underlying ("domain") vector space.
virtual bool is_ancestor_of(const any *xother) const
True if other conforms to this.
bool empty() const
True if both poset name and member name are empty.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
poset_state_handle()
Default constructor.
sec_vd_space()
Default constructor; creates a new sec_vd_space handle not attached to any state. ...
static poset_handle_factory & factory()
The poset handle factory.
virtual bool is_contravariant(pod_index_type xmbr_id, bool xauto_access) const
True if and only if all tensor index positions of the member with id xmbr_id are contravariant.
virtual void detach_from_state()
Detach this handle from its state, if any.
namespace_poset * name_space() const
The namespace this poset resides in.
virtual bool is_attached() const
True if this is attached to a state.
int factor_ct() const
The number of factors in this product.
virtual const char * class_name() const
The name of this class.
An abstract schema poset for a section space. A Cartesian product subspace of the tensor product of a...
virtual void put_dof(pod_index_type xdof_id, const void *xdof, size_type xdof_size)
Sets the dof referred to by xdof_id to the value at xdof.
bool invariant_check() const
True if invariant checking is enabled.
virtual pod_index_type prereq_id(int xi) const
The id of the xi-th prerequisite poset for this.
virtual bool is_covariant(pod_index_type xmbr_id, bool xauto_access) const
True if and only if all tensor index positions of the member with id xmbr_id are covariant.
virtual void remove_member(pod_index_type xmbr_hub_id)
Removes the member of host() with hub id xmbr_hub_id.
T::table_dofs_type & table_dofs(T &x0)
The table dofs pod type for x0 (mutable version).
int_type pod_index_type
The plain old data index type.
virtual size_type covariant_subposet_ct() const
The number of covariant subposets.
poset & fiber_space()
The fiber space for section spaces on this schema (mutable version).
bool variance(int xi) const
The variance of the xi-th index; covariant if true, contravariant if false.
int d() const
The dimension.
std::string path() const
The full path as a string.
An array representation of abstract class poset_dof_map.
An abstract tensor space of degree p.
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC void pow(const sec_at0 &x0, const vd_value_type &xexponent, sec_at0 &xresult, bool xauto_access)
Compute x0 to power xexponent (pow(x0, xexponent)) (pre-allocated version).
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
bool is_same_type(const any *other) const
True if other is the same type as this.
void enable_invariant_check() const
Enable invariant checking.
virtual ~sec_tp_space()
Destructor.
A section of a bundle with fiber type tp.
virtual poset_type type_id() const
Identifier for the type of this poset.
virtual array_poset_dof_map & table_dof_map(bool xrequire_write_access=false)
The map from table dof client_ids to table dof values for this poset (mutable version) ...
virtual const scoped_index & member_id(bool xauto_access) const
An id in the member hub id space; intended for copying to initialize ids to the member id space...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.