21 #include "SheafSystem/at2.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" 134 vd_lite::operator=(xrow_dofs);
138 postcondition_of(vd_lite::operator=(xrow_dofs));
158 require(xrow >= 0 && xrow < dd());
159 require(xcolumn >= 0 && xcolumn < dd());
168 result = component(index_for_row_column(xrow, xcolumn));
170 else if(xrow > xcolumn)
172 result = -component(index_for_row_column(xcolumn, xrow));
194 require(0 <= xrow && xrow < dd()-1);
195 require(xrow < xcolumn && xcolumn < dd());
199 int lindex = index_for_row_column(xrow, xcolumn);
200 put_component(lindex, xcomp);
222 require(0 <= xrow && xrow < dd()-1);
223 require(xrow < xcolumn && xcolumn < dd());
245 int result = j + (i*(2*dd()-3-i))/2 - 1;
251 ensure(result < d());
341 const string& result = static_class_name();
345 ensure(!result.empty());
360 static const string result(
"at2_lite");
364 ensure(!result.empty());
386 ensure(is_same_type(*result));
410 require(&xother != 0);
416 bool result =
dynamic_cast<const at2_lite*
>(&xother) != 0;
429 if(invariant_check())
433 disable_invariant_check();
437 invariance(atp_lite::invariant());
443 enable_invariant_check();
475 static const poset_path result(standard_schema_poset_name(),
"at2_schema");
497 standard_schema_path().member_name(),
498 atp::standard_schema_path(),
502 lschema.detach_from_state();
527 require(!xhost_path.
empty());
530 require(xschema_path.
full());
532 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
540 host_type::new_table(xns, xhost_path, xschema_path, 2, xscalar_space_path, xauto_access);
544 ensure(xns.
owns(result, xauto_access));
545 ensure(result.
path(
true) == xhost_path);
547 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
549 ensure(result.
factor_ct(
true) == result.
d(
true));
550 ensure(result.
d(
true) == schema_poset_member::row_dof_ct(xns, xschema_path, xauto_access));
552 ensure(result.
p(
true) == 2);
553 ensure(result.
dd(
true) == result.
d(
true));
597 attach_to_state(xhost, xhub_id);
603 ensure(index() == xhub_id);
604 ensure(is_attached());
618 attach_to_state(xhost, xid.
hub_pod());
624 ensure(index() ==~ xid);
625 ensure(is_attached());
636 require(!xname.empty());
641 attach_to_state(xhost, xname);
647 ensure(name() == xname);
648 ensure(is_attached());
658 require(xother != 0);
662 attach_to_state(xother);
667 ensure(is_attached());
668 ensure(is_same_state(xother));
678 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
682 new_jim_state(xhost, 0,
false, xauto_access);
686 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
700 require(is_ancestor_of(&xother));
701 require(precondition_of(attach_to_state(&xother)));
705 attach_to_state(&xother);
709 ensure(postcondition_of(attach_to_state(&xother)));
723 require(precondition_of(attach_to_state(&xother)));
727 attach_to_state(&xother);
731 ensure(postcondition_of(attach_to_state(&xother)));
791 require(state_is_read_accessible());
792 require(xrow >= 0 && xrow < dd());
793 require(xcolumn >= 0 && xcolumn < dd());
800 result = component(index_for_row_column(xrow, xcolumn));
802 else if(xrow > xcolumn)
804 result = -component(index_for_row_column(xcolumn, xrow));
818 component(
int xrow,
int xcolumn,
bool xauto_access)
const 822 require(state_is_auto_read_accessible(xauto_access));
823 require(xrow >= 0 && xrow < dd());
824 require(xcolumn >= 0 && xcolumn < dd());
856 require(state_is_read_write_accessible());
861 require((0 <= xrow) && (xrow < dd()-1));
862 require((xrow < xcolumn) && (xcolumn < dd()));
866 put_component(index_for_row_column(xrow, xcolumn), xvalue);
885 require(state_is_auto_read_write_accessible(xauto_access));
886 require((0 <= xrow) && (xrow < dd(xauto_access)-1));
887 require((xrow < xcolumn) && (xcolumn < dd(xauto_access)));
893 get_read_write_access(
true);
896 put_component(index_for_row_column(xrow, xcolumn), xvalue);
922 require(0 <= xrow && xrow < dd()-1);
923 require(xrow < xcolumn && xcolumn < dd());
932 int result = j + (i*(2*dd()-3-i))/2 - 1;
938 ensure(result < d());
1008 const string& result = static_class_name();
1012 ensure(!result.empty());
1027 static const string result(
"at2");
1031 ensure(!result.empty());
1053 ensure(result != 0);
1079 require(xother != 0);
1086 bool result =
dynamic_cast<const at2*
>(xother) != 0;
1090 ensure(invariant());
1106 if (invariant_check())
1110 disable_invariant_check();
1114 invariance(atp::invariant());
1118 invariance((state_is_read_accessible() ? p() == 2 :
true));
1122 enable_invariant_check();
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
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 const std::string & static_class_name()
The name of this class.
bool invariant() const
Class invariant.
at2()
Default constructor.
virtual void put_component(int xrow, int xcolumn, value_type xcomp)
Sets value of a component in a specified row and column.
bool full() const
True if both poset name and member name are not empty.
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...
virtual int index_for_row_column(int xrow, int xcolumn) const
The index into linear storage of the component in a specified row and column.
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.
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.
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.
virtual at2 & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
virtual int p() const
Degree of this as an antisymmetric tensor space.
virtual const std::string & class_name() const
The name of this class.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
at2_lite & operator=(const at2_lite &xother)
Assignment operator.
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
virtual int index_for_row_column(int xrow, int xcolumn) const
The index into linear storage of the component in a specified row and column.
virtual at2_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
bool is_ancestor_of(const any *xother) const
True if other conforms to current.
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
static const std::string & static_class_name()
The name of this class.
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).
virtual ~at2_lite()
Destructor.
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...
A space of scalars viewed as an antisymmetric tensor space of degree 0.
An abstract antisymmetric tensor space of degree p.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
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)
at2_lite()
Default constructor.
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 const std::string & class_name() const
The name of this class.
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.
bool empty() const
True if both poset name and member name are empty.
virtual at2 * 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..
poset_path scalar_space_path() const
The path of the underlying space of scalars.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
static int factor_ct(int xd)
Factor_ct() as a function of dimension xd.
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.
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
int dd() const
The dimension of the underlying ("domain") vector space.
A general antisymmetric tensor of degree 2 over an abstract vector space (volatile version)...
virtual value_type component(int xrow, int xcolumn) const
The value of the component in a specified row and column.
An abstract client handle for a member of a poset.
bool invariant() const
Class invariant.
value_type component(int xrow, int xcolumn) const
The component with row index xrow and column index xcolumn.
void put_component(int xrow, int xcolumn, value_type xvalue)
Sets the component with row index xrow and column index xcolumn to xvalue.
Namespace for the fiber_bundles component of the sheaf system.
Row dofs type for class vd.
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
A general antisymmetric tensor of degree 2 over an abstract vector space.
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.
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.