27 #define _USE_MATH_DEFINES 31 #include "SheafSystem/gln.impl.h" 33 #include "SheafSystem/abstract_poset_member.impl.h" 34 #include "SheafSystem/assert_contract.h" 35 #include "SheafSystem/at1.h" 36 #include "SheafSystem/at1_space.h" 37 #include "SheafSystem/gln_space.h" 38 #include "SheafSystem/fiber_bundles_namespace.h" 39 #include "SheafSystem/schema_poset_member.h" 40 #include "SheafSystem/std_cmath.h" 41 #include "SheafSystem/wsv_block.h" 154 for(
int i=0; i<ld; ++i)
156 put_component(i, xrow_dofs[i]);
162 ensure_for_all(i, 0, d(), component(i) == xrow_dofs[i]);
178 int result = 2*n()*n();
183 ensure(result == 2*n()*n());
218 require((0 <= xindex) &&(xindex < d()));
239 require((0 <= xindex) && (xindex <= d()));
261 require(xcomps != 0);
262 require(xcomps_dimension >= d());
267 for(
int i=0; i<ld; ++i)
269 xcomps[i] = component(i);
287 require(xcomps != 0);
288 require(xcomps_dimension >= d());
293 for(
int i=0; i<ld; ++i)
295 put_component(i, xcomps[i]);
313 require(xindex >= 0 && xindex < d());
332 require(xindex >= 0 && xindex < d());
370 const string& result = static_class_name();
374 ensure(!result.empty());
389 static const string result(
"gln_lite");
393 ensure(!result.empty());
415 ensure(is_same_type(*result));
435 char* lscalar_space_path =
new char[1];
436 lscalar_space_path[0] = 0;
438 char* lvector_space_path =
new char[1];
439 lvector_space_path[0] = 0;
472 require(&xother != 0);
478 bool result =
dynamic_cast<const gln_lite*
>(&xother) != 0;
492 if(invariant_check())
496 disable_invariant_check();
500 invariance(group_lite::invariant());
506 enable_invariant_check();
538 static const string result(
"fiber_space_schema");
542 ensure(!result.empty());
558 static const poset_path result(standard_schema_poset_name(),
"gln_schema");
562 ensure(result.
full());
563 ensure(result.
poset_name() == standard_schema_poset_name());
592 string lmember_names;
593 lmember_names +=
"scalar_space_path C_STRING true";
594 lmember_names +=
" vector_space_path C_STRING true";
595 lmember_names +=
" n INT true";
598 standard_schema_path().member_name(),
599 poset_path(standard_schema_poset_name(),
"bottom"),
628 require(!xhost_path.
empty());
631 require(xschema_path.
full());
633 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
638 require(schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access) == host_type::d(xns, xvector_space_path, xauto_access));
643 host_type::new_table(xns, xhost_path, xschema_path, xvector_space_path, xauto_access);
647 ensure(xns.
owns(result, xauto_access));
648 ensure(result.
path(
true) == xhost_path);
650 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
656 ensure(result.
d(
true) == host_type::d(xns, xvector_space_path, xauto_access));
712 new_jem_state(const_cast<gln*>(&xother),
true,
true);
716 attach_to_state(&xother);
732 require(is_ancestor_of(&xother));
733 require(precondition_of(attach_to_state(&xother)));
737 attach_to_state(&xother);
741 ensure(postcondition_of(attach_to_state(&xother)));
755 require(precondition_of(attach_to_state(&xother)));
759 attach_to_state(&xother);
763 ensure(postcondition_of(attach_to_state(&xother)));
792 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
796 new_jim_state(xhost, 0,
false, xauto_access);
800 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
818 attach_to_state(xhost, xhub_id);
823 ensure(is_attached());
825 ensure(index() == xhub_id);
839 attach_to_state(xhost, xid.
hub_pod());
844 ensure(is_attached());
846 ensure(index() ==~ xid);
857 require(!xname.empty());
862 attach_to_state(xhost, xname);
867 ensure(is_attached());
869 ensure(name() == xname);
879 require(xother != 0);
883 attach_to_state(xother);
888 ensure(is_attached());
889 ensure(is_same_state(xother));
899 require(state_is_read_accessible());
903 int result = host()->n();
916 n(
bool xauto_access)
const 920 require(state_is_auto_read_accessible(xauto_access));
924 int result = host()->n(xauto_access);
941 require(state_is_read_accessible());
945 poset_path result = host()->scalar_space_path();
949 ensure(!result.
empty());
962 require(state_is_auto_read_accessible(xauto_access));
966 poset_path result = host()->scalar_space_path(xauto_access);
970 ensure(!result.
empty());
983 require(state_is_read_accessible());
987 poset_path result = host()->vector_space_path();
991 ensure(!result.
empty());
1004 require(state_is_auto_read_accessible(xauto_access));
1008 poset_path result = host()->vector_space_path(xauto_access);
1012 ensure(!result.
empty());
1025 require(state_is_read_accessible());
1030 int result = 2*ln*ln;
1036 ensure(result >= 0);
1045 d(
bool xauto_access)
const 1049 require(state_is_auto_read_accessible(xauto_access));
1069 ensure(result >= 0);
1082 require(state_is_read_accessible());
1083 require((0 <= xindex) &&(xindex < d()));
1091 ensure(invariant());
1104 require(state_is_auto_read_accessible(xauto_access));
1105 require((0 <= xindex) &&(xindex < d(xauto_access)));
1123 ensure(invariant());
1136 require(state_is_read_write_accessible());
1137 require((0 <= xindex) && (xindex <= d()));
1145 ensure(invariant());
1159 require(state_is_auto_read_write_accessible(xauto_access));
1160 require((0 <= xindex) && (xindex <= d(xauto_access)));
1166 get_read_write_access(
true);
1169 put_component(xindex, xcomp);
1178 ensure(invariant());
1192 require(state_is_read_accessible());
1193 require(xcomps != 0);
1194 require(xcomps_dimension >= d());
1199 for(
int i=0; i<ld; ++i)
1201 xcomps[i] = component(i);
1219 require(state_is_read_write_accessible());
1220 require(xcomps != 0);
1221 require(xcomps_dimension >= d());
1226 for(
int i=0; i<ld; ++i)
1228 put_component(i, xcomps[i]);
1233 ensure(invariant());
1246 require(state_is_read_write_accessible());
1247 ensure(xindex>=0 && xindex<d());
1266 require(state_is_read_accessible());
1267 require(xindex>=0 && xindex<d());
1294 for(
int i=0; i<d(); ++i)
1337 const string& result = static_class_name();
1341 ensure(!result.empty());
1356 static const string result(
"gln");
1360 ensure(!result.empty());
1381 return reinterpret_cast<host_type*
>(_host);
1388 return dynamic_cast<const host_type*
>(xother) != 0;
1415 invariance(group::invariant());
1417 if (invariant_check())
1421 disable_invariant_check();
1425 enable_invariant_check();
1430 ensure(is_derived_query);
1452 ensure(result != 0);
1467 require(xother != 0);
1473 bool result =
dynamic_cast<const gln*
>(xother) != 0;
1496 static const double RAD_PER_DEG = M_PI/180.0;
1497 return degrees*RAD_PER_DEG;
1516 for(
int i=0; i<ld; ++i)
1518 xos <<
" " << xv[i];
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
void put_components(const dof_type xcomps[], int xcomps_dimension)
Set values of all the components to the values in xcomps.
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 ...
SHEAF_DLL_SPEC double rad(double degrees)
Converts degress to radians. Convenience function for use with rotation routines. ...
bool full() const
True if both poset name and member name are not empty.
void components(dof_type xcomps[], int xcomps_dimension) const
The values of all the components (pre-allocated version).
value_type & operator[](int xindex)
The value of the component corresponding to xindex (non const version).
poset_path vector_space_path() const
The path of the underlying vector space.
virtual ~gln()
Destructor.
poset_path path(bool xauto_access=true) const
A path to this component.
The mathematical group GL(n, R). GL(n,R) is the group of general, invertible, linear transformations ...
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...
virtual gln_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
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...
A client handle for a general, abstract partially order set.
poset_path vector_space_path() const
The path of the underlying vector space.
gln_lite & operator=(const gln_lite &xother)
Assignment operator.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
virtual value_type component(int xindex) const
The value of the xi-th component.
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
The mathematical group GL(n, R). GL(n,R) is the group of general, invertible, linear transformations ...
virtual ~gln_lite()
Destructor.
void put_components(const dof_type xcomps[], int xcomps_dimension)
Sets values of all the components to the values in comps.
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.
table_dofs_type table_dofs() const
The table dofs.
virtual bool invariant() const
Class invariant.
vd_value_type value_type
The POD ("plain old data") type of scalar in the vector space of this.
static const std::string & static_class_name()
The name of this class.
gln_lite()
Default constructor.
virtual int d() const
Dimension of this as a vector space.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
static const std::string & standard_schema_poset_name()
The name of the standard schema poset for this class.
virtual const std::string & class_name() const
The name of this class.
static const std::string & static_class_name()
The name of this class.
host_type * host() const
The poset this is a member of.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
c_string scalar_space_path
The path of the underlying scalar space.
dof_type & operator[](int xindex)
The value of the row dof corresponding to xindex (non const version).
virtual gln & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
int n
Dimension of the representation space; n in GL(n, R).
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
virtual schema_poset_member & schema()
The schema for this poset (mutable version).
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 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 bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
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.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
std::string poset_name() const
The poset name part of the path.
vd_dof_type dof_type
The type of the degrees of freedom.
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
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. ...
bool empty() const
True if both poset name and member name are empty.
virtual int n() const
Dimension of the representation space; n in GL(n, R).
gln()
Default constructor.
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 d() const
The dimension of the row dof components.
A Cartesian product space.
virtual void put_component(int xi, value_type xvalue)
Sets the value of the xi-th component to xvalue.
value_type component(int xindex) const
The xindex-th component.
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
bool invariant() const
Class invariant.
int_type pod_index_type
The plain old data index type.
vd_dof_type dof_type
The type of the degrees of freedom. Note that although dof_type == value_type in this implementation...
poset_path scalar_space_path() const
The path of the underlying scalar space.
virtual gln * clone() const
Make a new handle, no state instance of current.
void components(dof_type xcomps[], int xcomps_dimension) const
The values of all the components (preallocated version).
An abstract client handle for a member of a poset.
void put_component(int xindex, value_type xcomp)
Set the xindex-th component to xcomp.
Row dofs type for class gln.
static int d(const namespace_poset &xns, const poset_path &xvector_space_path, bool xauto_access)
The dimension of the representation space; n in GL(n, R) implied by the vector space specified by xve...
c_string vector_space_path
The path of the underlying vector space.
Namespace for the fiber_bundles component of the sheaf system.
virtual const std::string & class_name() const
The name of this class.
int n() const
Dimension of the representation space; n in GL(n, R).
int n() const
Dimension of the representation space; n in GL(n, R).
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.
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...
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
poset_path scalar_space_path() const
The path of the underlying scalar space.
SHEAF_DLL_SPEC bool isunordered_or_equals(float x1, float x2)
True if isunordered(x1, x2) or x1 == x2.
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.