21 #include "SheafSystem/ed.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/fiber_bundles_namespace.h" 28 #include "SheafSystem/schema_poset_member.h" 29 #include "SheafSystem/wsv_block.h" 133 vd_lite::operator=(xrow_dofs);
137 postcondition_of(vd_lite::operator=(xrow_dofs));
219 const string& result = static_class_name();
223 ensure(!result.empty());
238 static const string result(
"ed_lite");
242 ensure(!result.empty());
264 ensure(is_same_type(*result));
288 require(&xother != 0);
294 bool result =
dynamic_cast<const ed_lite*
>(&xother) != 0;
307 if(invariant_check())
311 disable_invariant_check();
315 invariance(at1_lite::invariant());
321 enable_invariant_check();
353 static const poset_path result(standard_schema_poset_name(),
"ed_schema");
375 standard_schema_path().member_name(),
376 at1::standard_schema_path(),
380 lschema.detach_from_state();
405 require(!xhost_path.
empty());
408 require(xschema_path.
full());
410 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
418 host_type::new_table(xns, xhost_path, xschema_path, xscalar_space_path, xauto_access);
422 ensure(xns.
owns(result, xauto_access));
423 ensure(result.
path(
true) == xhost_path);
425 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
427 ensure(result.
factor_ct(
true) == result.
d(
true));
428 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
430 ensure(result.
p(
true) == 1);
431 ensure(result.
dd(
true) == result.
d(
true));
475 attach_to_state(xhost, xhub_id);
481 ensure(index() == xhub_id);
482 ensure(is_attached());
496 attach_to_state(xhost, xid.
hub_pod());
502 ensure(index() ==~ xid);
503 ensure(is_attached());
514 require(!xname.empty());
519 attach_to_state(xhost, xname);
525 ensure(name() == xname);
526 ensure(is_attached());
536 require(xother != 0);
540 attach_to_state(xother);
545 ensure(is_attached());
546 ensure(is_same_state(xother));
556 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
560 new_jim_state(xhost, 0,
false, xauto_access);
564 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
578 require(is_ancestor_of(&xother));
579 require(precondition_of(attach_to_state(&xother)));
583 attach_to_state(&xother);
587 ensure(postcondition_of(attach_to_state(&xother)));
601 require(precondition_of(attach_to_state(&xother)));
605 attach_to_state(&xother);
609 ensure(postcondition_of(attach_to_state(&xother)));
727 const string& result = static_class_name();
731 ensure(!result.empty());
746 static const string result(
"ed");
750 ensure(!result.empty());
768 ed* result =
new ed();
799 require(xother != 0);
806 bool result =
dynamic_cast<const ed*
>(xother) != 0;
830 invariance(at1::invariant());
832 if(invariant_check())
836 disable_invariant_check();
840 enable_invariant_check();
845 ensure(is_derived_query);
863 dot(
const ed& x0,
const ed& x1,
bool xauto_access)
883 for(
int i=0; i<ld; ++i)
896 ensure(unexecutable(\
897 "result == sum(i, 0, x0.d(), x0.component(i) * x1.component(i)"));
922 for(
int i=0; i<ld; ++i)
928 result =
sqrt(result);
937 ensure(result >= 0.0);
938 ensure(unexecutable(
"result == sqrt(sum(i, 0, x0.d(), x0.component(i)**2)"));
952 ensure(xlength >= 0.0);
971 for(
int i=0; i<ld; ++i)
983 ensure(unexecutable(
"length(x0, xauto_access) == xlength"));
1016 int ld = xresult.
d();
1017 for(
int i=0; i<ld; ++i)
1040 ensure(unexecutable(
"length(xresult, xauto_access) == 1.0"));
1053 require(x0.
d() == x1.
d());
1060 for(
int i=0; i<ld; ++i)
1067 ensure(unexecutable(
"result == sum(i, 0, x0.d(), x0.component(i)*x1.component(i)"));
1085 for(
int i=0; i<ld; ++i)
1091 result =
sqrt(result);
1095 ensure(result >= 0.0);
1096 ensure(unexecutable(
"result == sqrt(sum(i, 0, x0.d(), x0.component(i)**2)"));
1109 require(xlength >= 0.0);
1118 vd_value_type lscale = (len != 0.0) ? (xlength / len) : 0.0;
1124 for(
int i=0; i<ld; ++i)
1131 ensure(unexecutable(
"length(x0) == xlength"));
1156 int ld = xresult.
d();
1157 for(
int i=0; i<ld; ++i)
1164 ensure(unexecutable(
"length(xresult) == 1.0"));
SHEAF_DLL_SPEC void sqrt(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sqrt of x0 (sqrt(x0)) (pre-allocated version).
virtual poset_path path(bool xauto_access=true) const
The path of this poset.
virtual const std::string & class_name() const
The name of this class.
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 ...
bool full() const
True if both poset name and member name are not empty.
void put_is_p_vector(bool xauto_access)
Sets is_p_vector to true; synonym for put_is_contravariant(xauto_access).
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...
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
poset_path path(bool xauto_access=true) const
A path to this component.
bool is_same_type(const any_lite &xother) const
True if other is the same type as this.
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.
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...
A client handle for a general, abstract partially order set.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
ed_lite()
Default constructor.
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 xindex) const
The xindex-th component.
virtual void get_read_access() const
Get read access to the state associated with this.
static const std::string & static_class_name()
The name of this class.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
SHEAF_DLL_SPEC vd_value_type dot(const ed &x0, const ed &x1, bool xauto_access)
The Euclidean "dot" product of x0 with x1 (version for persistent types).
SHEAF_DLL_SPEC vd_value_type length(const ed &x0, bool xauto_access)
The Euclidean length (magnitude) of x0 (version for persistent types).
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.
static const std::string & static_class_name()
The name of this class.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
SHEAF_DLL_SPEC void put_length(ed &x0, const vd_value_type &xlength, bool xauto_access)
Set the Euclidean length (magnitude) of x0 to xlength. (version for persistent types).
bool invariant() const
Class invariant.
Euclidean vector space of dimension d (volatile 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...
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 std::string & class_name() const
The name of this class.
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
bool is_p_form(bool xauto_access) const
True if this is a p-form; synonym for is_covariant(xauto_access).
virtual ed & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
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 ~ed_lite()
Destructor.
virtual int d() const
Dimension of this as a vector space.
bool empty() const
True if both poset name and member name are empty.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
bool invariant() const
Class invariant.
SHEAF_DLL_SPEC void normalize(const ed &x0, ed &xresult, bool xauto_access)
Normalize x0 (convert to a unit vector) (pre_allocated version for persistent types).
virtual ed * clone() const
Make a new handle, no state instance of current.
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 const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
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.
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, const poset_path &xscalar_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...
Euclidean vector space of dimension d (peresistent version).
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
virtual ed_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
int_type pod_index_type
The plain old data index type.
int dd() const
The dimension of the underlying ("domain") vector space.
virtual int d() const
Dimension of this as a vector space.
An abstract client handle for a member of a poset.
ed_lite & operator=(const ed_lite &xother)
Assignment operator.
virtual void put_component(int xindex, value_type xvalue)
Sets the value of the xindex-th component to xvalue.
void put_is_p_form(bool xauto_access)
Sets is_p_form to true; synonym for put_is_covariant(xauto_access).
Namespace for the fiber_bundles component of the sheaf system.
bool is_same_type(const any *other) const
True if other is the same type as this.
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.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.