21 #include "SheafSystem/met_e3.impl.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/stp_space.h" 28 #include "SheafSystem/fiber_bundles_namespace.h" 29 #include "SheafSystem/schema_poset_member.h" 30 #include "SheafSystem/wsv_block.h" 99 ensure_for_all(i, 0, d(), component(i) == xother[i]);
143 _row_dofs = xrow_dofs;
192 fiber_bundle::met_e3_lite::
208 fiber_bundle::met_e3_lite::
224 fiber_bundle::met_e3_lite::
240 fiber_bundle::met_e3_lite::
268 put_components(xx_comp, xy_comp, xz_comp, yy_comp, yz_comp, zz_comp);
297 put_component(0, xx_comp);
298 put_component(1, xy_comp);
299 put_component(2, xz_comp);
300 put_component(3, yy_comp);
301 put_component(4, yz_comp);
302 put_component(5, zz_comp);
409 require(precondition_of(e3_lite::static_tp_prototype(xp)));
413 const tp_lite& result = e3_lite::static_tp_prototype(xp);
417 ensure(postcondition_of(e3_lite::static_tp_prototype(xp)));
430 require(precondition_of(e3_lite::static_atp_prototype(xp)));
434 const atp_lite& result = e3_lite::static_atp_prototype(xp);
438 ensure(postcondition_of(e3_lite::static_atp_prototype(xp)));
451 require(precondition_of(e3_lite::static_stp_prototype(xp)));
455 const stp_lite& result = e3_lite::static_stp_prototype(xp);
459 ensure(postcondition_of(e3_lite::static_stp_prototype(xp)));
496 const string& result = static_class_name();
500 ensure(!result.empty());
515 static const string result(
"met_e3_lite");
519 ensure(!result.empty());
541 ensure(is_same_type(*result));
565 require(&xother != 0);
571 bool result =
dynamic_cast<const met_e3_lite*
>(&xother) != 0;
584 if(invariant_check())
588 disable_invariant_check();
592 invariance(met_ed_lite::invariant());
598 enable_invariant_check();
644 static const poset_path result(standard_schema_poset_name(),
"met_e3_schema");
665 string lmember_names =
"xx DOUBLE false ";
666 lmember_names +=
"xy DOUBLE false ";
667 lmember_names +=
"yy DOUBLE false ";
668 lmember_names +=
"xz DOUBLE false ";
669 lmember_names +=
"yz DOUBLE false ";
670 lmember_names +=
"zz DOUBLE false";
673 standard_schema_path().member_name(),
674 met_ed::standard_schema_path(),
703 require(!xhost_path.
empty());
706 require(xschema_path.
full());
708 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
709 require(schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access) == 6);
719 host_type::new_table(xns, xhost_path, xschema_path, 2, xvector_space_path, xauto_access);
723 ensure(xns.
owns(result, xauto_access));
724 ensure(result.path(
true) == xhost_path);
725 ensure(result.state_is_not_read_accessible());
726 ensure(result.schema(
true).path(xauto_access) == xschema_path);
728 ensure(result.factor_ct(
true) == 6);
729 ensure(result.d(
true) == 6);
731 ensure(result.p(
true) == 2);
732 ensure(result.dd(
true) == 3);
733 ensure(result.vector_space_path(
true) == xvector_space_path);
751 require(xsuffix.empty() || poset_path::is_valid_name(xsuffix));
752 require(standard_host_is_available<met_e3>(xns, xsuffix, xauto_access));
762 poset_path lvector_space_path = vector_space_type::standard_host(xns, xsuffix, xauto_access).
path(
true);
764 poset_path lpath(standard_host_path<met_e3>(xsuffix));
773 result_ptr = &new_host(xns, lpath, standard_schema_path(), lvector_space_path, xauto_access);
780 ensure(xns.
owns(result, xauto_access));
781 ensure(result.
path(
true) == standard_host_path<met_e3>(xsuffix));
783 ensure(result.
schema(
true).
path(xauto_access) == standard_schema_path());
786 ensure(result.
d(
true) == 6);
787 ensure(result.
scalar_space_path(
true) == standard_host_path<vector_space_type::scalar_type>(xsuffix) );
788 ensure(result.
p(
true) == 2);
789 ensure(result.
dd(
true) == 3);
790 ensure(result.
vector_space_path(
true) == standard_host_path<vector_space_type>(xsuffix) );
832 attach_to_state(xhost, xhub_id);
838 ensure(index() == xhub_id);
839 ensure(is_attached());
853 attach_to_state(xhost, xid.
hub_pod());
859 ensure(index() ==~ xid);
860 ensure(is_attached());
871 require(!xname.empty());
876 attach_to_state(xhost, xname);
882 ensure(name() == xname);
883 ensure(is_attached());
893 require(xother != 0);
897 attach_to_state(xother);
902 ensure(is_attached());
903 ensure(is_same_state(xother));
913 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
917 new_jim_state(xhost, 0,
false, xauto_access);
921 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
936 require(precondition_of(new_jim_state(&xhost, 0,
false, xauto_access)));
940 new_jim_state(&xhost, 0,
false, xauto_access);
956 ensure(postcondition_of(new_jim_state(&xhost, 0,
false, xauto_access)));
969 require(state_is_read_write_accessible());
977 ensure_for_all(i, 0, d(), component(i) == xrdt.
components[i]);
992 require(is_ancestor_of(&xother));
993 require(precondition_of(attach_to_state(&xother)));
997 attach_to_state(&xother);
1001 ensure(postcondition_of(attach_to_state(&xother)));
1015 require(precondition_of(attach_to_state(&xother)));
1019 attach_to_state(&xother);
1023 ensure(postcondition_of(attach_to_state(&xother)));
1077 fiber_bundle::met_e3::
1093 fiber_bundle::met_e3::
1192 require(precondition_of(e3::new_tp(vector_space(xauto_access), xp)));
1196 tp* result = e3::new_tp(vector_space(xauto_access), xp);
1200 ensure(postcondition_of(e3::new_tp(vector_space(xauto_access), xp)));
1213 require(precondition_of(e3::new_atp(vector_space(xauto_access), xp)));
1217 atp* result = e3::new_atp(vector_space(xauto_access), xp);
1221 ensure(postcondition_of(e3::new_atp(vector_space(xauto_access), xp)));
1234 require(precondition_of(e3::new_stp(vector_space(xauto_access), xp)));
1238 stp* result = e3::new_stp(vector_space(xauto_access), xp);
1242 ensure(postcondition_of(e3::new_stp(vector_space(xauto_access), xp)));
1270 const string& result = static_class_name();
1274 ensure(!result.empty());
1289 static const string result(
"met_e3");
1293 ensure(!result.empty());
1315 ensure(result != 0);
1342 require(xother != 0);
1349 bool result =
dynamic_cast<const met_e3*
>(xother) != 0;
1373 invariance(met_ed::invariant());
1375 if (invariant_check())
1379 disable_invariant_check();
1383 invariance(is_attached() ? (d() == 6) :
true);
1387 enable_invariant_check();
1392 ensure(is_derived_query);
1420 require(unexecutable(
"xmetric.is_contravariant())"));
1421 require(unexecutable(
"xcovector.is_covariant())"));
1445 value_type comp0 = xcovector.
component(0);
1446 value_type comp1 = xcovector.
component(1);
1447 value_type comp2 = xcovector.
component(2);
1449 value_type result_comp;
1451 result_comp = m00*comp0 + m01*comp1 + m02*comp2;
1454 result_comp = m10*comp0 + m11*comp1 + m12*comp2;
1457 result_comp = m20*comp0 + m21*comp1 + m22*comp2;
1462 ensure(unexecutable(
"xresult.is_contravariant())"));
1474 require(precondition_of(
raise(xmetric, xcovector, *result)));
1480 raise(xmetric, xcovector, *result);
1484 ensure(result != 0);
1485 ensure(postcondition_of(
raise(xmetric, xcovector, *result)));
1498 require(unexecutable(
"xmetric.is_covariant())"));
1499 require(unexecutable(
"xvector.is_contravariant())"));
1523 value_type comp0 = xvector.
component(0);
1524 value_type comp1 = xvector.
component(1);
1525 value_type comp2 = xvector.
component(2);
1527 value_type result_comp;
1529 result_comp = m00*comp0 + m10*comp1 + m20*comp2;
1532 result_comp = m01*comp0 + m11*comp1 + m21*comp2;
1535 result_comp = m02*comp0 + m12*comp1 + m22*comp2;
1540 ensure(unexecutable(
"xresult.is_covariant())"));
1552 require(precondition_of(
lower(xmetric, xvector, *result)));
1558 lower(xmetric, xvector, *result);
1562 ensure(result != 0);
1563 ensure(postcondition_of(
lower(xmetric, xvector, *result)));
1579 require(xcovector.
d(xauto_access) == xmetric.
dd(xauto_access));
1580 require(xresult.
d(xauto_access) == xmetric.
dd(xauto_access));
1605 value_type m10 = m01;
1609 value_type m20 = m02;
1610 value_type m21 = m12;
1613 value_type comp0 = xcovector.
component(0);
1614 value_type comp1 = xcovector.
component(1);
1615 value_type comp2 = xcovector.
component(2);
1617 value_type result_comp;
1619 result_comp = m00*comp0 + m01*comp1 + m02*comp2;
1622 result_comp = m10*comp0 + m11*comp1 + m12*comp2;
1625 result_comp = m20*comp0 + m21*comp1 + m22*comp2;
1661 require(xvector.
d(xauto_access) == xmetric.
dd(xauto_access));
1662 require(xresult.
d(xauto_access) == xmetric.
dd(xauto_access));
1687 value_type m10 = m01;
1691 value_type m20 = m02;
1692 value_type m21 = m12;
1695 value_type comp0 = xvector.
component(0);
1696 value_type comp1 = xvector.
component(1);
1697 value_type comp2 = xvector.
component(2);
1699 value_type result_comp;
1701 result_comp = m00*comp0 + m10*comp1 + m20*comp2;
1704 result_comp = m01*comp0 + m11*comp1 + m21*comp2;
1707 result_comp = m02*comp0 + m12*comp1 + m22*comp2;
SHEAF_DLL_SPEC void lower(const met &xmetric, const ed &xvector, ed &xresult, bool xauto_access)
Lower vector (pre-allocated version for persistent type).
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...
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.
met_e3_lite()
Default constructor.
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 symmetric tensor of degree p over an abstract vector space.
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.
An antisymmetric tensor of degree p.
void put_is_p_vector(bool xauto_access)
Sets is_p_vector to true; synonym for put_is_contravariant(xauto_access).
Euclidean vector space of dimension 3 (volatile version).
row_dofs_type _row_dofs
Row_dofs_type.
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
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...
A metric tensor over a 1 dimensional Euclidean vector space (volatile version).
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.
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
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_path vector_space_path() const
The path of the underlying vector space.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
virtual int dd() const
Dimension 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".
met_e3 & operator=(const row_dofs_type &xrdt)
Assignment to an instance of the associated row dofs type.
value_type component(int xindex) const
The xindex-th component.
T components[6]
The xx, xy and yy dofs.
virtual value_type component(int xrow, int xcolumn) const
The value of the component in a specified row and column.
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.
A metric tensor over an abstract vector space (volatile version).
Euclidean vector space of dimension 3 (persistent version).
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual void * row_dofs()
The row dofs for this instance (mutable version).
virtual bool is_covariant(bool xauto_access) const
True if and only if all tensor index positions are covariant.
An antisymmetric tensor of degree p over an abstract vector space (volatile version).
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...
A general tensor of "degree" p and given "variance" over an abstract vector space.
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.
met_e3()
Default constructor.
met_e3_lite & operator=(const met_e3_lite &xother)
Assignment operator.
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 schema_poset_member & schema()
The schema for this poset (mutable version).
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 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)
virtual void detach_from_state()
Detach this handle from its state, if any.
An index within the external ("client") scope of a given id space.
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 stp * new_stp(int xp, bool xauto_access) const
Virtual constructor for symmetric tensors of degree xp over vector space xvector_space.
bool is_p_form(bool xauto_access) const
True if this is a p-form; synonym for is_covariant(xauto_access).
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.
bool empty() const
True if both poset name and member name are empty.
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...
virtual met_e3_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
virtual void put_components(const value_type &xx_comp, const value_type &xy_comp, const value_type &xz_comp, const value_type &yy_comp, const value_type &yz_comp, const value_type &zz_comp)
A general tensor of degree p over an abstract vector space (volatile version). Volatile version does ...
A metric tensor over a 3 dimensional Euclidean vector space (persistent version). ...
bool contains_poset(pod_index_type xhub_id, bool xauto_access=true) const
True if this contains a poset with hub id xhub_id..
bool path_is_auto_read_available(const poset_path &xpath, bool xauto_access) const
True if the state referred to xpath does not exist or exists and is auto read accessible.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
static host_type & standard_host(namespace_type &xns, const std::string &xsuffix, bool xauto_access)
The host with path standard_host_path<met_e3>(xsuffix). Returns the host if it already exists...
bool invariant() const
Class invariant.
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...
void put_component(int xindex, value_type xcomp)
Set the xindex-th component to xcomp.
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
bool invariant() const
Class invariant.
virtual const tp_lite & tp_prototype(int xp) const
Prototype for general tensors of degree xp over this vector space.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
static const std::string & static_class_name()
The name of this class.
virtual tp * new_tp(int xp, bool xauto_access) const
Virtual constructor for general tensors of degree xp over vector space xvector_space.
virtual const std::string & class_name() const
The name of this class.
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
virtual met_e3 * clone() const
Make a new handle, no state instance of current.
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.
bool is_p_vector(bool xauto_access) const
True if this is a p-vector; synonym for is_contravariant(xauto_access).
virtual ~met_e3_lite()
Destructor.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
virtual int d() const
Dimension of this as a vector space.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
An abstract client handle for a member of a poset.
std::string path() const
The full path as a string.
virtual atp * new_atp(int xp, bool xauto_access) const
Virtual constructor for antisymmetric tensors of degree xp over vector space xvector_space.
virtual const stp_lite & stp_prototype(int xp) const
Prototype for symmetric tensors of degree xp over this vector space.
virtual void put_component(int xindex, value_type xvalue)
Sets the value of the xindex-th component to xvalue.
virtual const atp_lite & atp_prototype(int xp) const
Prototype for antisymmetric tensors of degree xp over this vector space.
void put_is_p_form(bool xauto_access)
Sets is_p_form to true; synonym for put_is_covariant(xauto_access).
A symmetric tensor of degree p over an abstract vector space (volatile version).
An abstract symmetric tensor space of degree p.
Namespace for the fiber_bundles component of the sheaf system.
value_type component(int xrow, int xcolumn) const
The component with row index xrow and column index xcolumn.
SHEAF_DLL_SPEC void raise(const met &xmetric, const ed &xcovector, ed &xresult, bool xauto_access)
Raise covector (pre-allocated version for persistent type).
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.
met_e3_row_dofs_type< double >::matrix_type matrix_type
The type of the associated matrix.
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.