21 #include "SheafSystem/gl2.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/e2.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" 69 require(unexecutable(
"The component matrix is the inverse of the basis matrix."));
88 require(unexecutable(
"The component matrix is the inverse of the basis matrix."));
124 require(unexecutable(
"The component matrix is the inverse of the basis matrix."));
143 require(unexecutable(
"The component matrix is the inverse of the basis matrix."));
147 _row_dofs = xrow_dofs;
163 require(unexecutable(
"The component matrix is the inverse of the basis matrix."));
182 require(unexecutable(
"The component matrix is the inverse of the basis matrix."));
199 fiber_bundle::gl2_lite::
215 fiber_bundle::gl2_lite::
231 fiber_bundle::gl2_lite::
247 fiber_bundle::gl2_lite::
290 const matrix_type& result = _row_dofs.basis_matrix();
305 matrix_type& result = _row_dofs.component_matrix();
320 const matrix_type& result = _row_dofs.component_matrix();
357 cm[0][0] = 1.0/xscale;
360 cm[1][1] = 1.0/yscale;
408 require(unexecutable(
"Each xbi is a vector of length at least 2."));
415 xb0[0] = component(0);
416 xb1[0] = component(1);
418 xb0[1] = component(2);
419 xb1[1] = component(3);
424 ensure(unexecutable(
"Return values are set to the correct components"));
439 require(unexecutable(
"Each xbi is a vector of length at least 2."));
446 put_component(0, xb0[0]);
447 put_component(1, xb1[0]);
449 put_component(2, xb0[1]);
450 put_component(3, xb1[1]);
454 component_matrix() = basis_matrix().inverse();
459 ensure(unexecutable(
"Components are set to the correct basis values"));
460 ensure(unexecutable(
"The component matrix is the inverse of the basis matrix"));
473 require(unexecutable(
"Each xbi is a vector of length at least 3."));
484 ensure_for_all(i, 0, d(), xmatrix.
components[i] == component(i));
514 ensure_for_all(i, 0, d(), component(i) == xmatrix.
components[i]);
515 ensure(unexecutable(
"The component matrix is the inverse of the basis matrix"));
583 const string& result = static_class_name();
587 ensure(!result.empty());
602 static const string result(
"gl2_lite");
606 ensure(!result.empty());
628 ensure(is_same_type(*result));
652 require(&xother != 0);
658 bool result =
dynamic_cast<const gl2_lite*
>(&xother) != 0;
671 if(invariant_check())
675 disable_invariant_check();
679 invariance(gln_lite::invariant());
685 enable_invariant_check();
731 static const poset_path result(standard_schema_poset_name(),
"gl2_schema");
752 string lmember_names =
"bxx DOUBLE false ";
753 lmember_names +=
"bxy DOUBLE false ";
754 lmember_names +=
"byx DOUBLE false ";
755 lmember_names +=
"byy DOUBLE false ";
756 lmember_names +=
"cxx DOUBLE false ";
757 lmember_names +=
"cxy DOUBLE false ";
758 lmember_names +=
"cyx DOUBLE false ";
759 lmember_names +=
"cyy DOUBLE false";
762 standard_schema_path().member_name(),
763 gln::standard_schema_path(),
792 require(!xhost_path.
empty());
795 require(xschema_path.
full());
797 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
802 require(schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access) == 8);
807 host_type::new_table(xns, xhost_path, xschema_path, xvector_space_path, xauto_access);
811 ensure(xns.
owns(result, xauto_access));
812 ensure(result.
path(
true) == xhost_path);
814 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
817 ensure(result.
n(
true) == 2);
820 ensure(result.
d(
true) == 8);
838 require(xsuffix.empty() || poset_path::is_valid_name(xsuffix));
839 require(standard_host_is_available<gl2>(xns, xsuffix, xauto_access));
849 poset_path lvector_space_path = vector_space_type::standard_host(xns, xsuffix, xauto_access).
path(
true);
851 poset_path lpath(standard_host_path<gl2>(xsuffix));
860 result_ptr = &new_host(xns, lpath, standard_schema_path(), lvector_space_path, xauto_access);
867 ensure(xns.
owns(result, xauto_access));
868 ensure(result.
path(
true) == standard_host_path<gl2>(xsuffix));
870 ensure(result.
schema(
true).
path(xauto_access) == standard_schema_path());
872 ensure(result.
scalar_space_path(
true) == vector_space_type::scalar_type::standard_host_path<vector_space_type::scalar_type>(xsuffix));
873 ensure(result.
n(
true) == 2);
874 ensure(result.
vector_space_path(
true) == vector_space_type::standard_host_path<vector_space_type>(xsuffix));
876 ensure(result.
d(
true) == 8);
931 new_jem_state(const_cast<gl2*>(&xother),
true,
true);
935 attach_to_state(&xother);
951 require(is_ancestor_of(&xother));
952 require(precondition_of(attach_to_state(&xother)));
956 attach_to_state(&xother);
960 ensure(postcondition_of(attach_to_state(&xother)));
974 require(precondition_of(attach_to_state(&xother)));
978 attach_to_state(&xother);
982 ensure(postcondition_of(attach_to_state(&xother)));
1010 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
1014 new_jim_state(xhost, 0,
false, xauto_access);
1018 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
1033 require(precondition_of(new_jim_state(&xhost, 0,
false, xauto_access)));
1037 new_jim_state(&xhost, 0,
false, xauto_access);
1053 ensure(postcondition_of(new_jim_state(&xhost, 0,
false, xauto_access)));
1066 require(state_is_read_write_accessible());
1074 for(
int i=0; i<ld; ++i)
1081 ensure_for_all(i, 0, d(), component(i) == xrdt.
components[i]);
1096 require(xhost != 0);
1102 attach_to_state(xhost, xhub_id);
1106 ensure(invariant());
1107 ensure(is_attached());
1109 ensure(index() == xhub_id);
1117 require(xhost != 0);
1123 attach_to_state(xhost, xid.
hub_pod());
1127 ensure(invariant());
1128 ensure(is_attached());
1130 ensure(index() ==~ xid);
1139 require(xhost != 0);
1141 require(!xname.empty());
1146 attach_to_state(xhost, xname);
1150 ensure(invariant());
1151 ensure(is_attached());
1153 ensure(name() == xname);
1163 require(xother != 0);
1167 attach_to_state(xother);
1171 ensure(invariant());
1172 ensure(is_attached());
1173 ensure(is_same_state(xother));
1215 require(state_is_read_accessible());
1223 ensure(invariant());
1236 require(state_is_read_write_accessible());
1251 ensure(invariant());
1252 ensure_for_all(i, 0, d(), component(i) == xmatrix.
components[i]);
1318 const string& result = static_class_name();
1322 ensure(!result.empty());
1337 static const string result(
"gl2");
1341 ensure(!result.empty());
1363 ensure(result != 0);
1394 invariance(gln::invariant());
1396 if (invariant_check())
1400 disable_invariant_check();
1402 invariance(state_is_read_accessible() ? n() == 2 :
true);
1406 enable_invariant_check();
1411 ensure(is_derived_query);
1425 require(xother != 0);
1431 bool result =
dynamic_cast<const gl2*
>(xother) != 0;
1453 xos <<
"basis" << endl;
1454 xos <<
" " << xlite[0] <<
" " << xlite[1] << endl;
1455 xos <<
" " << xlite[2] <<
" " << xlite[3] << endl;
1459 xos <<
"component:" << endl;
1460 xos <<
" " << xlite[4] <<
" " << xlite[5] << endl;
1461 xos <<
" " << xlite[6] <<
" " << xlite[7] << endl;
1470 xos <<
"basis:" << endl;
1471 xos <<
" " << lm[0] <<
" " << lm[1] << endl;
1472 xos <<
" " << lm[2] <<
" " << lm[3] << endl;
1475 xos <<
"component:" << endl;
1476 xos <<
" " << lm[4] <<
" " << lm[5] << endl;
1477 xos <<
" " << lm[6] <<
" " << lm[7] << endl;
1505 ensure(unexecutable(
"xresult is the inverse of xgl"));
1532 const row_dofs_type& lrdt_gl = xgl;
1533 row_dofs_type& lrdt_result = xresult;
1535 lrdt_gl.basis_matrix().inverse(lrdt_result.basis_matrix());
1536 lrdt_gl.component_matrix().inverse(lrdt_result.component_matrix());
1540 ensure(unexecutable(
"xresult is the inverse of xgl"));
void get_matrix(row_dofs_type &xmatrix) const
Copies row dof tuple into xmatrix.
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...
matrix_type & component_matrix()
The associated component transformation matrix (non const version).
void determinant(T &xresult) const
The determinant of the matrix (pre-allocated).
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 ...
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
bool full() const
True if both poset name and member name are not empty.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
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...
gl2_lite & operator=(const gl2_lite &xother)
Assignment operator.
poset_path path(bool xauto_access=true) const
A path to this component.
The default name space; a poset which contains other posets as members.
virtual const std::string & class_name() const
The name of this class.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
virtual bool invariant() const
Class invariant.
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...
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.
void rescale(const value_type &xscale, const value_type &yscale)
Set this transform to rescale the x and y axes by xscale and yscale, respectively.
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".
row_dofs_type _row_dofs
Row_dofs_type.
virtual ~gl2()
Destructor.
virtual void * row_dofs()
The row dofs for this instance (mutable version).
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.
gl2_row_dofs_type< double >::matrix_type matrix_type
The type of the associated matrix.
virtual gl2 * clone() const
Make a new handle, no state instance of current.
void put_basis(const value_type xb0[], const value_type xb1[])
Set this transformation to transform to the basis specified by component vectors xb0, xb1, where xbi gives the components of new basis vector i w.r.t. the old basis.
virtual gl2 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
gl2_lite()
Default constructor.
The mathematical group GL(2, R). The group of all invertible, linear transformations on the R2...
bool invariant() const
Class invariant.
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
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).
matrix_type & component_matrix()
The associated component transformation matrix (non const version).
static const std::string & static_class_name()
The name of this class.
The mathematical group GL(2, R). The group of all invertible, linear transformations on the R2...
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...
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.
static int d()
The dimension of the row dof components.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
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.
matrix_type & basis_matrix()
The associated basis transformation matrix (non const version).
static host_type & standard_host(namespace_type &xns, const std::string &xsuffix, bool xauto_access)
The host with path standard_host_path<gl2>(xsuffix). Returns the host if it already exists...
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 void release_access(bool xall=false) const
Release access. If xall is true, release all levels of access. Otherwise, release one level of access...
matrix_type & basis_matrix()
The associated basis transformation matrix (non const version).
void rotate_z(const value_type &xangle)
Set this transform to a rotation about the z-axis by angle xangle, in radians.
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.
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.
virtual const std::string & class_name() const
The name of this class.
virtual ~gl2_lite()
Destructor.
void basis(value_type xb0[], value_type xb1[]) const
The components of the new basis vectors w.r.t. the old basis, pre-allocated version.
int_type pod_index_type
The plain old data index type.
T components[8]
The dofs in the following order:
gl2()
Default constructor.
An abstract client handle for a member of a poset.
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...
Namespace for the fiber_bundles component of the sheaf system.
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).
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.
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.
void get_matrix(row_dofs_type &xmatrix) const
Copies the row dofs of this into xmatrix.
virtual gl2_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.
virtual int n() const
Dimension of the representation space; n in GL(n, R).
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
void inverse(general_matrix_2x2< T > &xresult) const
The inverse of the matrix (pre-allocated).
poset_path scalar_space_path() const
The path of the underlying scalar space.