21 #include "SheafSystem/gl3.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/e3.h" 28 #include "SheafSystem/gln_space.h" 29 #include "SheafSystem/fiber_bundles_namespace.h" 30 #include "SheafSystem/schema_poset_member.h" 31 #include "SheafSystem/std_cmath.h" 32 #include "SheafSystem/wsv_block.h" 139 _row_dofs = xrow_dofs;
188 fiber_bundle::gl3_lite::
204 fiber_bundle::gl3_lite::
220 fiber_bundle::gl3_lite::
236 fiber_bundle::gl3_lite::
279 const matrix_type& result = _row_dofs.basis_matrix();
294 matrix_type& result = _row_dofs.component_matrix();
309 const matrix_type& result = _row_dofs.component_matrix();
351 cm[0][0] = 1.0/xscale;
352 cm[1][1] = 1.0/yscale;
353 cm[2][2] = 1.0/zscale;
392 bm.inverse(component_matrix());
430 bm.inverse(component_matrix());
468 bm.inverse(component_matrix());
503 bm[0][0] = cos_gamma*cos_beta*cos_alpha - sin_gamma*sin_alpha;
504 bm[0][1] = -sin_gamma*cos_beta*cos_alpha - cos_gamma*sin_alpha;
505 bm[0][2] = sin_beta*cos_alpha;
507 bm[1][0] = cos_gamma*cos_beta*sin_alpha + sin_gamma*cos_alpha;
508 bm[1][1] = -sin_gamma*cos_beta*sin_alpha + cos_gamma*cos_alpha;
509 bm[1][2] = sin_beta*sin_alpha;
511 bm[2][0] = -cos_gamma*sin_beta;
512 bm[2][1] = sin_gamma*sin_beta;
517 bm.inverse(component_matrix());
536 require(unexecutable(
"Each xbi is a vector of length at least 2."));
543 xb0[0] = component(0);
544 xb1[0] = component(1);
545 xb2[0] = component(2);
547 xb0[1] = component(3);
548 xb1[1] = component(4);
549 xb2[1] = component(5);
551 xb0[2] = component(6);
552 xb1[2] = component(7);
553 xb2[2] = component(8);
558 ensure(unexecutable(
"Return values are set to the correct components"));
573 require(unexecutable(
"Each xbi is a vector of length at least 3."));
580 put_component(0, xb0[0]);
581 put_component(1, xb1[0]);
582 put_component(2, xb2[0]);
584 put_component(3, xb0[1]);
585 put_component(4, xb1[1]);
586 put_component(5, xb2[1]);
588 put_component(6, xb0[2]);
589 put_component(7, xb1[2]);
590 put_component(8, xb2[2]);
594 component_matrix() = basis_matrix().inverse();
599 ensure(unexecutable(
"Components are set to the correct basis values"));
600 ensure(unexecutable(
"The component matrix is the inverse of the basis matrix"));
613 require(unexecutable(
"Each xbi is a vector of length at least 3."));
624 ensure_for_all(i, 0, d(), xmatrix.
components[i] == component(i));
650 ensure_for_all(i, 0, d(), component(i) == xmatrix.
components[i]);
651 ensure(unexecutable(
"The component matrix is the inverse of the basis matrix"));
719 const string& result = static_class_name();
723 ensure(!result.empty());
738 static const string result(
"gl3_lite");
742 ensure(!result.empty());
764 ensure(is_same_type(*result));
788 require(&xother != 0);
794 bool result =
dynamic_cast<const gl3_lite*
>(&xother) != 0;
808 if(invariant_check())
812 disable_invariant_check();
816 invariance(gln_lite::invariant());
822 enable_invariant_check();
868 static const poset_path result(standard_schema_poset_name(),
"gl3_schema");
889 string lmember_names =
"bxx DOUBLE false bxy DOUBLE false bxz DOUBLE false ";
890 lmember_names +=
"byx DOUBLE false byy DOUBLE false byz DOUBLE false ";
891 lmember_names +=
"bzx DOUBLE false bzy DOUBLE false bzz DOUBLE false ";
893 lmember_names +=
"cxx DOUBLE false cxy DOUBLE false cxz DOUBLE false ";
894 lmember_names +=
"cyx DOUBLE false cyy DOUBLE false cyz DOUBLE false ";
895 lmember_names +=
"czx DOUBLE false czy DOUBLE false czz DOUBLE false";
898 standard_schema_path().member_name(),
899 gln::standard_schema_path(),
928 require(!xhost_path.
empty());
931 require(xschema_path.
full());
933 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
938 require(schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access) == 18);
943 host_type::new_table(xns, xhost_path, xschema_path, xvector_space_path, xauto_access);
947 ensure(xns.
owns(result, xauto_access));
948 ensure(result.
path(
true) == xhost_path);
950 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
953 ensure(result.
n(
true) == 3);
956 ensure(result.
d(
true) == 18);
974 require(xsuffix.empty() || poset_path::is_valid_name(xsuffix));
975 require(standard_host_is_available<gl3>(xns, xsuffix, xauto_access));
985 poset_path lvector_space_path = vector_space_type::standard_host(xns, xsuffix, xauto_access).
path(
true);
987 poset_path lpath(standard_host_path<gl3>(xsuffix));
996 result_ptr = &new_host(xns, lpath, standard_schema_path(), lvector_space_path, xauto_access);
1003 ensure(xns.
owns(result, xauto_access));
1004 ensure(result.
path(
true) == standard_host_path<gl3>(xsuffix));
1006 ensure(result.
schema(
true).
path(xauto_access) == standard_schema_path());
1008 ensure(result.
scalar_space_path(
true) == vector_space_type::scalar_type::standard_host_path<vector_space_type::scalar_type>(xsuffix));
1009 ensure(result.
n(
true) == 3);
1010 ensure(result.
vector_space_path(
true) == vector_space_type::standard_host_path<vector_space_type>(xsuffix));
1012 ensure(result.
d(
true) == 18);
1041 ensure(invariant());
1065 new_jem_state(const_cast<gl3*>(&xother),
true,
true);
1069 attach_to_state(&xother);
1074 ensure(invariant());
1085 require(is_ancestor_of(&xother));
1086 require(precondition_of(attach_to_state(&xother)));
1090 attach_to_state(&xother);
1094 ensure(postcondition_of(attach_to_state(&xother)));
1108 require(precondition_of(attach_to_state(&xother)));
1112 attach_to_state(&xother);
1116 ensure(postcondition_of(attach_to_state(&xother)));
1144 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
1148 new_jim_state(xhost, 0,
false, xauto_access);
1152 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
1167 require(precondition_of(new_jim_state(&xhost, 0,
false, xauto_access)));
1171 new_jim_state(&xhost, 0,
false, xauto_access);
1187 ensure(postcondition_of(new_jim_state(&xhost, 0,
false, xauto_access)));
1200 require(state_is_read_write_accessible());
1206 for(
int i=0; i<ld; ++i)
1213 ensure_for_all(i, 0, d(), component(i) == xrdt.
components[i]);
1226 require(xhost != 0);
1232 attach_to_state(xhost, xhub_id);
1236 ensure(invariant());
1237 ensure(is_attached());
1239 ensure(index() == xhub_id);
1247 require(xhost != 0);
1253 attach_to_state(xhost, xid.
hub_pod());
1257 ensure(invariant());
1258 ensure(is_attached());
1260 ensure(index() ==~ xid);
1269 require(xhost != 0);
1271 require(!xname.empty());
1276 attach_to_state(xhost, xname);
1280 ensure(invariant());
1281 ensure(is_attached());
1283 ensure(name() == xname);
1293 require(xother != 0);
1297 attach_to_state(xother);
1301 ensure(invariant());
1302 ensure(is_attached());
1303 ensure(is_same_state(xother));
1345 require(state_is_read_accessible());
1353 ensure(invariant());
1366 require(state_is_read_write_accessible());
1381 ensure(invariant());
1382 ensure_for_all(i, 0, d(), component(i) == xmatrix.
components[i]);
1448 const string& result = static_class_name();
1452 ensure(!result.empty());
1467 static const string result(
"gl3");
1471 ensure(!result.empty());
1493 ensure(result != 0);
1525 invariance(gln::invariant());
1527 if (invariant_check())
1531 disable_invariant_check();
1533 invariance(state_is_read_accessible() ? n() == 3 :
true);
1537 enable_invariant_check();
1542 ensure(is_derived_query);
1556 require(xother != 0);
1562 bool result =
dynamic_cast<const gl3*
>(xother) != 0;
1587 xos <<
"basis:" << endl;
1588 xos <<
" " << xlite[0] <<
" " << xlite[1] <<
" " << xlite[2] << endl;
1589 xos <<
" " << xlite[3] <<
" " << xlite[4] <<
" " << xlite[5] << endl;
1590 xos <<
" " << xlite[6] <<
" " << xlite[7] <<
" " << xlite[8] << endl;
1594 xos <<
"component:" << endl;
1595 xos <<
" " << xlite[ 9] <<
" " << xlite[10] <<
" " << xlite[11] << endl;
1596 xos <<
" " << xlite[12] <<
" " << xlite[13] <<
" " << xlite[14] << endl;
1597 xos <<
" " << xlite[15] <<
" " << xlite[16] <<
" " << xlite[17] << endl;
1608 xos <<
"basis:" << endl;
1609 xos <<
" " << lm[0] <<
" " << lm[1] <<
" " << lm[2] << endl;
1610 xos <<
" " << lm[3] <<
" " << lm[4] <<
" " << lm[5] << endl;
1611 xos <<
" " << lm[6] <<
" " << lm[7] <<
" " << lm[8] << endl;
1615 xos <<
"component:" << endl;
1616 xos <<
" " << lm[ 9] <<
" " << lm[10] <<
" " << lm[11] << endl;
1617 xos <<
" " << lm[12] <<
" " << lm[13] <<
" " << lm[14] << endl;
1618 xos <<
" " << lm[15] <<
" " << lm[16] <<
" " << lm[17] << endl;
1646 ensure(unexecutable(
"xresult is the inverse of xgl"));
1674 const row_dofs_type& lrdt_gl = xgl;
1675 row_dofs_type& lrdt_result = xresult;
1677 lrdt_gl.basis_matrix().inverse(lrdt_result.basis_matrix());
1678 lrdt_gl.component_matrix().inverse(lrdt_result.component_matrix());
1682 ensure(unexecutable(
"xresult is the inverse of xgl"));
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 basis(value_type xb0[], value_type xb1[], value_type xb2[]) const
The components of the new basis vectors w.r.t. the old basis, pre-allocated version.
virtual int n() const
Dimension of the representation space; n in GL(n, R).
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 ...
matrix_type & basis_matrix()
The associated basis transformation matrix (non const version).
void determinant(T &xresult) const
The determinant of the matrix (pre-allocated).
void inverse(general_matrix_3x3< T > &xresult) const
The inverse of the matrix (pre-allocated).
virtual gl3 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
void rotate_x(const value_type &xangle)
Set this transform to a rotation about the x-axis by angle xangle, in radians.
bool full() const
True if both poset name and member name are not empty.
virtual ~gl3()
Destructor.
gl3_lite & operator=(const gl3_lite &xother)
Assignment operator.
virtual gl3 * clone() const
Make a new handle, no state instance of current.
row_dofs_type _row_dofs
Row_dofs_type.
poset_path path(bool xauto_access=true) const
A path to this component.
virtual const std::string & class_name() const
The name of this class.
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...
void get_matrix(row_dofs_type &xmatrix) const
Copies the row dofs of this into xmatrix.
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.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
void put_basis(const value_type xb0[], const value_type xb1[], const value_type xb2[])
Set this transformation to transform to the basis specified by component vectors xb0, xb1, xb2, where xbi gives the components of new basis vector i w.r.t. the old basis.
static const std::string & static_class_name()
The name of this class.
void rotate_y(const value_type &xangle)
Set this transform to a rotation about the y-axis by angle xangle, in radians. See note under rotate_...
static int d()
The dimension of the row dof components.
static host_type & standard_host(namespace_type &xns, const std::string &xsuffix, bool xauto_access)
The host with path standard_host_path<gl3>(xsuffix). Returns the host if it already exists...
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.
matrix_type & component_matrix()
The associated component transformation matrix (non const version).
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
void rescale(const value_type &xscale, const value_type &yscale, const value_type &zscale)
Set this transform to rescale the x, y, and z axes by xscale, yscale, and zscale, respectively...
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
virtual bool invariant() const
Class invariant.
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).
void put_matrix(row_dofs_type &xmatrix)
Updates the component matrix part of xmatrix to be the inverse of the basis part and then copies xmat...
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...
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
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.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
gl3()
Default constructor.
void rotate_z(const value_type &xangle)
Set this transform to a rotation about the z-axis by angle xangle, in radians. See note under rotate_...
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. ...
void put_matrix(row_dofs_type &xmatrix)
Updates the component matrix part of xmatrix to be the inverse of the basis part and then copies xmat...
gl3_row_dofs_type< double >::matrix_type matrix_type
The type of the associated matrix.
void rotate_euler(const value_type &xalpha, const value_type &xbeta, const value_type &xgamma)
Set this transform to a rotation through the Euler angles alpha, beta, and gamma. It is equivalent to...
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...
The mathematical group GL(3, R). The group of all invertible, linear transformations on the R3...
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.
A Cartesian product space.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
virtual gl3_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
SHEAF_DLL_SPEC void cos(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute cos of x0 (cos(x0)) (pre-allocated version).
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
matrix_type & basis_matrix()
The associated basis transformation matrix (non const version).
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
matrix_type & component_matrix()
The associated component transformation matrix (non const version).
int_type pod_index_type
The plain old data index type.
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
virtual ~gl3_lite()
Destructor.
virtual void * row_dofs()
The row dofs for this instance (mutable version).
An abstract client handle for a member of a poset.
void get_matrix(row_dofs_type &xmatrix) const
Copies row dof tuple into xmatrix.
std::string path() const
The full path as a string.
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...
bool invariant() const
Class invariant.
static const std::string & static_class_name()
The name of this class.
Namespace for the fiber_bundles component of the sheaf system.
virtual const std::string & class_name() const
The name of this class.
SHEAF_DLL_SPEC void inverse(const gl2_lite &xlite, gl2_lite &xresult)
Inverse (pre-allocated version for volatile type).
SHEAF_DLL_SPEC void sin(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sin of x0 (sin(x0)) (pre-allocated version).
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.
The mathematical group GL(3, R). The group of all invertible, linear transformations on the R3...
gl3_lite()
Default constructor.
T components[18]
The dofs in the following order:
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.