21 #include "SheafSystem/jcb.h" 23 #include "SheafSystem/abstract_poset_member.impl.h" 24 #include "SheafSystem/assert_contract.h" 25 #include "SheafSystem/at1.h" 26 #include "SheafSystem/at1_space.h" 27 #include "SheafSystem/jcb_space.h" 28 #include "SheafSystem/fiber_bundles_namespace.h" 29 #include "SheafSystem/schema_poset_member.h" 30 #include "SheafSystem/wsv_block.h" 131 vd_lite::operator=(xrow_dofs);
135 postcondition_of(vd_lite::operator=(xrow_dofs));
192 int lfactor_ct = factor_ct();
197 char* lscalar_space_path =
new char[1];
198 lscalar_space_path[0] = 0;
202 char* ldomain_path =
new char[1];
205 char* lrange_path =
new char[1];
233 require(xrow >= 0 && xrow < dr());
234 require(xcolumn >= 0 && xcolumn < dd());
238 value_type result = component(index_for_row_column(xrow, xcolumn));
255 require(xrow >= 0 && xrow < dr());
256 require(xcolumn >= 0 && xcolumn < dd());
260 put_component(index_for_row_column(xrow, xcolumn), xcomp);
278 require(0 <= xrow && xrow < dr());
279 require(0 <= xcolumn && xcolumn < dd());
285 int result = xrow*dd() + xcolumn;
291 ensure(result < dr()*dd());
317 int result = dd()*dr();
322 ensure(result==dd()*dr());
359 const string& result = static_class_name();
363 ensure(!result.empty());
378 static const string result(
"jcb_lite");
382 ensure(!result.empty());
404 ensure(is_same_type(*result));
428 require(&xother != 0);
434 bool result =
dynamic_cast<const vd_lite*
>(&xother) != 0;
447 if(invariant_check())
451 disable_invariant_check();
455 invariance(vd_lite::invariant());
461 enable_invariant_check();
493 static const poset_path result(standard_schema_poset_name(),
"jcb_schema");
497 ensure(result.
full());
498 ensure(result.
poset_name() == standard_schema_poset_name());
519 string lmember_names;
520 lmember_names +=
"dd INT true";
521 lmember_names +=
" domain_path C_STRING true";
522 lmember_names +=
" range_path C_STRING true";
523 lmember_names +=
" dr INT true";
526 standard_schema_path().member_name(),
527 vd::standard_schema_path(),
557 require(!xhost_path.
empty());
560 require(xschema_path.
full());
562 require(schema_poset_member::conforms_to(xns, xschema_path, standard_schema_path()));
567 require(host_type::d(xns, xschema_path, xauto_access) == host_type::d(xns, xdomain_path, xrange_path, xauto_access));
575 host_type::new_table(xns, xhost_path, xschema_path, xdomain_path, xrange_path, xauto_access);
579 ensure(xns.
owns(result, xauto_access));
580 ensure(result.path(
true) == xhost_path);
581 ensure(result.state_is_not_read_accessible());
582 ensure(result.schema(
true).path(xauto_access) == xschema_path);
584 ensure(result.factor_ct(
true) == result.d(
true));
585 ensure(result.d(
true) == host_type::d(xns, xschema_path, xauto_access));
587 ensure(result.domain_path(
true) == xdomain_path);
590 ensure(result.range_path(
true) == xrange_path);
593 ensure(result.scalar_space_path(
true) ==
595 ensure(result.scalar_space_path(
true) ==
640 attach_to_state(xhost, xhub_id);
646 ensure(index() == xhub_id);
647 ensure(is_attached());
662 attach_to_state(xhost, xid.
hub_pod());
668 ensure(index() ==~ xid);
669 ensure(is_attached());
680 require(!xname.empty());
685 attach_to_state(xhost, xname);
691 ensure(name() == xname);
692 ensure(is_attached());
702 require(xother != 0);
706 attach_to_state(xother);
711 ensure(is_attached());
712 ensure(is_same_state(xother));
722 require(precondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
726 new_jim_state(xhost, 0,
false, xauto_access);
730 ensure(postcondition_of(new_jim_state(xhost, 0,
false, xauto_access)));
744 require(is_ancestor_of(&xother));
745 require(precondition_of(attach_to_state(&xother)));
749 attach_to_state(&xother);
753 ensure(postcondition_of(attach_to_state(&xother)));
767 require(precondition_of(attach_to_state(&xother)));
771 attach_to_state(&xother);
775 ensure(postcondition_of(attach_to_state(&xother)));
835 require(state_is_read_accessible());
839 int result = host()->dd();
852 dd(
bool xauto_access)
const 856 require(state_is_auto_read_accessible(xauto_access));
860 int result = host()->dd(xauto_access);
877 require(state_is_read_accessible());
885 ensure(!result.
empty());
898 require(state_is_auto_read_accessible(xauto_access));
902 poset_path result(host()->domain_path(xauto_access));
906 ensure(!result.
empty());
919 require(state_is_read_accessible());
923 int result = host()->dr();
936 dr(
bool xauto_access)
const 940 require(state_is_auto_read_accessible(xauto_access));
944 int result = host()->dr(xauto_access);
961 require(state_is_read_accessible());
969 ensure(!result.
empty());
982 require(state_is_auto_read_accessible(xauto_access));
986 poset_path result(host()->range_path(xauto_access));
990 ensure(!result.
empty());
1003 require(state_is_read_accessible());
1004 require(0 <= xrow && xrow < dr());
1005 require(0 <= xcolumn && xcolumn < dd());
1011 int result = xrow*dd() + xcolumn;
1016 ensure(result >= 0);
1017 ensure(result < dr()*dd());
1041 require(state_is_read_accessible());
1042 require((0 <= xrow) && (xrow < dr()));
1043 require((0 <= xcolumn) && (xcolumn < dd()));
1047 value_type result = component(index_for_row_column(xrow, xcolumn));
1051 ensure(invariant());
1064 require(state_is_auto_read_accessible(xauto_access));
1065 require((0 <= xrow) && (xrow < dr(xauto_access)));
1066 require((0 <= xcolumn) && (xcolumn < dd(xauto_access)));
1075 value_type result = component(xrow, xcolumn);
1084 ensure(invariant());
1098 require(state_is_read_write_accessible());
1099 require((0 <= xrow) && (xrow < dr()));
1100 require((0 <= xcolumn) && (xcolumn < dd()));
1104 put_component(index_for_row_column(xrow, xcolumn), xvalue);
1108 ensure(invariant());
1123 require(state_is_auto_read_write_accessible(xauto_access));
1124 require((0 <= xrow) && (xrow < dr(xauto_access)));
1125 require((0 <= xcolumn) && (xcolumn < dd(xauto_access)));
1131 get_read_write_access(
true);
1134 put_component(index_for_row_column(xrow, xcolumn), xvalue);
1143 ensure(invariant());
1181 const string& result = static_class_name();
1185 ensure(!result.empty());
1200 static const string result(
"jcb");
1204 ensure(!result.empty());
1226 return reinterpret_cast<host_type*
>(_host);
1233 return dynamic_cast<const host_type*
>(xother) != 0;
1255 require(xother != 0);
1262 bool result =
dynamic_cast<const jcb*
>(xother) != 0;
1289 ensure(result != 0);
1310 invariance(vd::invariant());
1312 if (invariant_check())
1316 disable_invariant_check();
1318 invariance((is_attached() ? (d() == dd() * dr()) :
true));
1322 enable_invariant_check();
1327 ensure(is_derived_query);
1362 #include "SheafSystem/error_message.h" 1363 #include "SheafSystem/at1.h" 1364 #include "SheafSystem/e1.h" 1365 #include "SheafSystem/e2.h" 1366 #include "SheafSystem/e3.h" 1367 #include "SheafSystem/jcb_e13.h" 1368 #include "SheafSystem/jcb_e23.h" 1369 #include "SheafSystem/jcb_e33.h" 1381 require(xvector.
d(xauto_access) == xjcb.
dd(xauto_access));
1382 require(xresult.
d(xauto_access) == xjcb.
dr(xauto_access));
1400 const jcb_e13* jcb_e13_xjcb =
dynamic_cast<const jcb_e13*
>(&xjcb);
1401 const jcb_e23* jcb_e23_xjcb =
dynamic_cast<const jcb_e23*
>(&xjcb);
1402 const jcb_e33* jcb_e33_xjcb =
dynamic_cast<const jcb_e33*
>(&xjcb);
1404 const e1* e1_xvector =
dynamic_cast<const e1*
>(&xvector);
1405 const e2* e2_xvector =
dynamic_cast<const e2*
>(&xvector);
1406 const e3* e3_xvector =
dynamic_cast<const e3*
>(&xvector);
1408 e3* e3_xresult =
dynamic_cast<e3*
>(&xresult);
1410 if(jcb_e13_xjcb && e1_xvector && e3_xresult)
1412 push(*jcb_e13_xjcb, *e1_xvector, *e3_xresult, xauto_access);
1414 else if(jcb_e23_xjcb && e2_xvector && e3_xresult)
1416 push(*jcb_e23_xjcb, *e2_xvector, *e3_xresult, xauto_access);
1418 else if(jcb_e33_xjcb && e3_xvector && e3_xresult)
1420 push(*jcb_e33_xjcb, *e3_xvector, *e3_xresult, xauto_access);
1424 post_fatal_error_message(\
1425 "Unsupported argument types in call to push(...)");
1447 require(xcovector.
d(xauto_access) == xjcb.
dr(xauto_access));
1448 require(xresult.
d(xauto_access) == xjcb.
dd(xauto_access));
1466 const jcb_e13* jcb_e13_xjcb =
dynamic_cast<const jcb_e13*
>(&xjcb);
1467 const jcb_e23* jcb_e23_xjcb =
dynamic_cast<const jcb_e23*
>(&xjcb);
1468 const jcb_e33* jcb_e33_xjcb =
dynamic_cast<const jcb_e33*
>(&xjcb);
1470 const e3* e3_xcovector =
dynamic_cast<const e3*
>(&xcovector);
1472 e1* e1_xresult =
dynamic_cast<e1*
>(&xresult);
1473 e2* e2_xresult =
dynamic_cast<e2*
>(&xresult);
1474 e3* e3_xresult =
dynamic_cast<e3*
>(&xresult);
1476 if(jcb_e13_xjcb && e3_xcovector && e1_xresult)
1478 pull(*jcb_e13_xjcb, *e3_xcovector, *e1_xresult, xauto_access);
1480 else if(jcb_e23_xjcb && e3_xcovector && e2_xresult)
1482 pull(*jcb_e23_xjcb, *e3_xcovector, *e2_xresult, xauto_access);
1484 else if(jcb_e33_xjcb && e3_xcovector && e3_xresult)
1486 pull(*jcb_e33_xjcb, *e3_xcovector, *e3_xresult, xauto_access);
1490 post_fatal_error_message(\
1491 "Unsupported argument types in call to pull(...)");
1510 require(xvector.
d() == xjcb.
dd());
1511 require(xresult.
d() == xjcb.
dr());
1512 require(unexecutable(
"xvector.is_contravariant())"));
1513 require(unexecutable(
"xresult.is_contravariant())"));
1521 const e1_lite* e1_xvector =
dynamic_cast<const e1_lite*
>(&xvector);
1522 const e2_lite* e2_xvector =
dynamic_cast<const e2_lite*
>(&xvector);
1523 const e3_lite* e3_xvector =
dynamic_cast<const e3_lite*
>(&xvector);
1527 if(jcb_e13_xjcb && e1_xvector && e3_xresult)
1529 push(*jcb_e13_xjcb, *e1_xvector, *e3_xresult);
1531 else if(jcb_e23_xjcb && e2_xvector && e3_xresult)
1533 push(*jcb_e23_xjcb, *e2_xvector, *e3_xresult);
1535 else if(jcb_e33_xjcb && e3_xvector && e3_xresult)
1537 push(*jcb_e33_xjcb, *e3_xvector, *e3_xresult);
1541 post_fatal_error_message(\
1542 "Unsupported argument types in call to push(...)");
1561 require(precondition_of(
push(xjcb, xvector, *result)));
1566 push(xjcb, xvector, *result);
1570 ensure(postcondition_of(
push(xjcb, xvector, *result)));
1585 require(xcovector.
d() == xjcb.
dr());
1586 require(xresult.
d() == xjcb.
dd());
1587 require(unexecutable(
"xcovector.is_covariant())"));
1588 require(unexecutable(
"xresult.is_covariant())"));
1596 const e3_lite* e3_xcovector =
dynamic_cast<const e3_lite*
>(&xcovector);
1602 if(jcb_e13_xjcb && e3_xcovector && e1_xresult)
1604 pull(*jcb_e13_xjcb, *e3_xcovector, *e1_xresult);
1606 else if(jcb_e23_xjcb && e3_xcovector && e2_xresult)
1608 pull(*jcb_e23_xjcb, *e3_xcovector, *e2_xresult);
1610 else if(jcb_e33_xjcb && e3_xcovector && e3_xresult)
1612 pull(*jcb_e33_xjcb, *e3_xcovector, *e3_xresult);
1616 post_fatal_error_message(\
1617 "Unsupported argument types in call to pull(...)");
1636 require(precondition_of(
pull(xjcb, xcovector, *result)));
1641 pull(xjcb, xcovector, *result);
1645 ensure(postcondition_of(
pull(xjcb, xcovector, *result)));
virtual bool is_contravariant(bool xauto_access) const
True if and only if all tensor index positions are contravariant.
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 ...
value_type component(int xrow, int xcolumn) const
The value of the component in a specified row and column (const version).
Jacobian of a map from a 3 dimensional domain (u, v, w) to a 3 dimensional Euclidean space (x...
virtual int d() const
Dimension of this as a vector space.
vd_value_type value_type
The type of component in the fiber; the scalar type in the fiber vector space.
bool full() const
True if both poset name and member name are not empty.
Euclidean vector space of dimension 3 (volatile version).
int d
Dimension of this as a vector space.
virtual const std::string & class_name() const
The name of this class.
Euclidean vector space of dimension 2 (persistent version).
poset_path domain_path() const
The path of the domain vector space.
Jacobian of a map from a 2 dimensional domain (u, v) to a 3 dimensional Euclidean space (x...
Jacobian of a map from a 1 dimensional domain (u) to a 3 dimensional Euclidean space (x...
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.
A general antisymmetric tensor of degree 1 over an abstract vector space (persistent version)...
The standard fiber bundles name space; extends the standard sheaves namespace by defining base space...
virtual bool is_ancestor_of(const any_lite &xother) const
Conformance test; true if other conforms to this.
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 host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, const poset_path &xdomain_path, const poset_path &xrange_path, bool xauto_access)
Creates a new host table for members of this type. The poset is created in namespace xns with path xh...
void put_component(int xrow, int xcolumn, value_type xvalue)
Sets the component with row index xrow and column index xcolumn to xvalue.
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
int factor_ct
Number of factors (components) in tuple.
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.
value_type component(int xrow, int xcolumn) const
The component with row index xrow and column index xcolumn.
virtual bool host_is_ancestor_of(const poset_state_handle *other) const
True if other conforms to host.
bool invariant() const
Class invariant.
Euclidean vector space of dimension 3 (persistent version).
T::row_dofs_type & row_dofs(T &x0)
The row dofs pod type for x0 (mutable version).
virtual bool is_covariant(bool xauto_access) const
True if and only if all tensor index positions are covariant.
Euclidean vector space of dimension 1 (persistent version).
static void make_standard_schema(namespace_poset &xns)
Creates the standard schema for this class in namespace xns.
int dr
Dimension of the range.
virtual const volatile_type & lite_prototype() const
Virtual constructor for the associated volatile type.
Abstract base class with useful features for all volatile objects.
Abstract base class with useful features for all objects.
Abstract vector space over dof_type (volatile version).
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.
Table dofs type for class jcb.
Euclidean vector space of dimension 2 (volatile version).
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)
Abstract jacobian class (volatile version).
virtual void detach_from_state()
Detach this handle from its state, if any.
jcb_lite & operator=(const jcb_lite &xother)
Assignment operator.
An index within the external ("client") scope of a given id space.
jcb()
Default constructor.
virtual jcb & operator=(const abstract_poset_member &xother)
Assignment operator; synonym for attach_to_state(&xother).
std::string poset_name() const
The poset name part of the path.
bool contains_path(const poset_path &xpath, bool xauto_access=true) const
True if this contains the poset or poset member specified by xpath.
c_string domain_path
The path of the domain 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. ...
Jacobian of a map from a 1 dimensional domain (u) to a 3 dimensional Euclidean space (x...
virtual int d() const
Dimension of this as a vector space.
bool empty() const
True if both poset name and member name are empty.
table_dofs_type table_dofs() const
The table dofs.
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.
host_type * host() const
The poset this is a member of.
SHEAF_DLL_SPEC void pull(const jcb &xjcb, const at1 &xcovector, at1 &xresult, bool xauto_access)
Pull covector back (pre-allocated version for persistent types).
jcb_lite()
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..
static const std::string & static_class_name()
The name of this class.
virtual int dd() const
Dimension of the domain.
poset_path scalar_space_path() const
The path of the underlying space of scalars.
virtual jcb * clone() const
Make a new handle, no state instance of current.
Jacobian of a map from a 3 dimensional domain (u, v, w) to a 3 dimensional Euclidean space (x...
Jacobian of a map from a 2 dimensional domain (u, v) to a 3 dimensional Euclidean space (x...
An abstract vector space viewed as an antisymmetric tensor space of degree 1.
virtual volatile_type * lite_type() const
Virtual conversion to the associated volatile type.
c_string range_path
The path of the range vector space.
virtual jcb_lite * clone() const
Virtual constructor, makes a new instance of the same type as this.
bool is_ancestor_of(const any *xother) const
True if xother conforms to current.
An abstract space of Jacobians.
int_type pod_index_type
The plain old data index type.
virtual ~jcb_lite()
Destructor.
int dd
Dimension of the domain.
virtual const std::string & class_name() const
The name of this class.
virtual int dr() const
Dimension of the range.
static const poset_path & standard_schema_path()
The path to the standard schema for this class.
vd_value_type value_type
The POD ("plain old data") type of scalar in the vector space of this.
virtual int dd() const
Dimension of the domain.
Euclidean vector space of dimension 1 (volatile version).
poset_path range_path() const
The path of the range vector space.
virtual int d() const
Dimension of this as a vector space.
void put_component(int xrow, int xcolumn, value_type xcomp)
Sets value of a component in a specified row and column.
bool invariant() const
Class invariant.
virtual int dr() const
Dimension of the range.
An abstract client handle for a member of a poset.
c_string scalar_space_path
The path of the underlying scalar space.
SHEAF_DLL_SPEC void push(const jcb &xjcb, const at1 &xvector, at1 &xresult, bool xauto_access)
Push vector forward (pre-allocated version for persistent types).
Namespace for the fiber_bundles component of the sheaf system.
Row dofs type for class vd.
static const std::string & static_class_name()
The name of this class.
A client handle for a poset member which has been prepared for use as a schema.
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.
SHEAF_DLL_SPEC bool isunordered_or_equals(float x1, float x2)
True if isunordered(x1, x2) or x1 == x2.