21 #include "SheafSystem/section_space_schema_jims_index_space_state.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/ij_product_structure.h" 24 #include "SheafSystem/index_space_family.h" 25 #include "SheafSystem/section_space_schema_jims_index_space_handle.h" 26 #include "SheafSystem/section_space_schema_jims_index_space_iterator.h" 27 #include "SheafSystem/deep_size.h" 28 #include "SheafSystem/hub_index_space_handle.h" 42 const std::string& xname,
49 require(!xname.empty());
50 require(!xid_spaces.
contains(xname));
55 lstate->new_state(xid_spaces, xname,
false);
59 lstate->_base_space = &xbase_space_id_space.
get_id_space();
60 lstate->_fiber_schema = &xfiber_schema_id_space.
get_id_space();
61 lstate->_section_space_schema_product = xsection_space_schema_product.
clone();
71 lstate->_end = lstate->_base_space->end()*lstate->_fiber_schema->end();
72 lstate->_ct = lstate->_base_space->ct()*lstate->_fiber_schema->ct();
78 ensure(&result.
id_spaces() == &xid_spaces);
82 ensure(result.
name() == xname);
85 ensure(result.
base_space() == xbase_space_id_space);
87 ensure(unexecutable(
"result.section_space_schema_product_structure() == xsection_space_schema_product"));
89 ensure(result.
begin() == 0);
90 ensure(result.
end() == xbase_space_id_space.
end()*xfiber_schema_id_space.
end());
91 ensure(result.
ct() == xbase_space_id_space.
ct()*xfiber_schema_id_space.
ct());
102 const std::string& xname,
111 require(!xname.empty());
112 require(!xid_spaces.
contains(xname));
117 lstate->new_state(xid_spaces, xid, xname,
false);
121 lstate->_base_space = &xbase_space_id_space.
get_id_space();
122 lstate->_fiber_schema = &xfiber_schema_id_space.
get_id_space();
123 lstate->_section_space_schema_product = xsection_space_schema_product.
clone();
133 lstate->_end = lstate->_base_space->end()*lstate->_fiber_schema->end();
134 lstate->_ct = lstate->_base_space->ct()*lstate->_fiber_schema->ct();
140 ensure(&result.
id_spaces() == &xid_spaces);
144 ensure(result.
index() == xid);
145 ensure(result.
name() == xname);
148 ensure(result.
base_space() == xbase_space_id_space);
149 ensure(result.
fiber_schema() == xfiber_schema_id_space);
150 ensure(unexecutable(
"result.section_space_schema_product_structure() == xsection_space_schema_product"));
152 ensure(result.
begin() == 0);
153 ensure(result.
end() == xbase_space_id_space.
end()*xfiber_schema_id_space.
end());
154 ensure(result.
ct() == xbase_space_id_space.
ct()*xfiber_schema_id_space.
ct());
179 _section_space_schema_product(0)
275 ensure(is_basic_query);
292 ensure(is_basic_query);
309 ensure(is_basic_query);
331 ensure(is_basic_query);
439 (void) explicit_index_space_state::operator=(xother);
444 ensure((*
this) == xother);
481 ensure(is_basic_query);
498 pod_type lbase_hub_id, lfiber_hub_id;
510 ensure(is_basic_query);
529 pod_type lbase_hub_id, lfiber_hub_id;
661 ensure(is_basic_query);
683 ensure(is_basic_query);
775 handles().release(reinterpret_cast<section_space_schema_jims_index_space_handle&>(xid_space));
779 ensure(is_basic_query);
797 bool result = (lid_space != 0) && handles().allocated(*lid_space);
801 ensure(is_basic_query);
813 fiber_bundle::section_space_schema_jims_index_space_state::
824 ensure(is_basic_query);
912 iterators().release(reinterpret_cast<section_space_schema_jims_index_space_iterator&>(xitr));
916 ensure(is_basic_query);
934 bool result = (litr != 0) && iterators().allocated(*litr);
938 ensure(is_basic_query);
950 fiber_bundle::section_space_schema_jims_index_space_state::
961 ensure(is_basic_query);
979 static const string result(
"section_space_schema_jims_index_space_state");
1008 fiber_bundle::section_space_schema_jims_index_space_state::
1039 require(other != 0);
1102 size_t result = xinclude_shallow ?
sizeof(xn) : 0;
1110 ensure(result >= 0);
abstract_product_structure * _product
The product structure for this id space.
virtual section_space_schema_jims_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
virtual bool allocated_id_space(const index_space_handle &xid_space) const
True if and only if id space handle xid_space was allocated by the handle pool.
An implementation of class explicit_index_space_handle that has a section space schema jims id space ...
static size_type handle_pool_deep_size()
The deep size of the handle pool.
virtual pod_type index() const
Index of this space.
An abstract class that defines the product structure for an id space.
virtual bool contains(pod_type xid) const
True if this space contains id xid.
virtual section_space_schema_jims_index_space_state * clone() const
Virtual constructor; create a new instance of the same type at this.
virtual pod_type end() const =0
Ending id of this space.
An abstract iterator over the ids of an id space.
static size_type iterator_pool_ct()
The number of iterators in the pool.
pod_type end() const
Ending id of this space.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
void put_factors(const index_space_handle &xbase_space_id_space, const index_space_handle &xfiber_schema_id_space, const ij_product_structure &xsection_space_schema_product)
Set the factors for this section space schema id space.
virtual void delete_product_structure()
Deletes the product structure for this id space.
virtual size_type ub(pod_type xi) const =0
The upper-bound for the dimension xi.
void put_ubs(size_type xi_ub, size_type xj_ub)
Set the upper-bounds for this product structure.
const index_space_handle & fiber_schema() const
The fiber schema jims id space.
virtual bool is_persistent() const
True if this id space should be written to disk.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
virtual void detach()=0
Detach this handle form its state, if any.
virtual const index_space_family & id_spaces() const
The id space family for this (const version).
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
void tuple(pod_type xordinal, pod_type &xi, pod_type &xj) const
Ordinal to 2-tuple conversion.
virtual const std::string & class_name() const
The name of this class.
virtual void release_id_space() const =0
Returns this id space handle to the handle pool.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
virtual index_space_handle & get_id_space() const =0
Allocates an id space handle from the handle pool attached to the same id space.
bool has_product_structure() const
True if this id space has a product structure.
virtual void detach()=0
Detach this handle form its state, if any.
virtual bool contains(pod_type xid) const =0
True if this space contains id xid.
bool is_consistent() const
True, if this id space is consistent with the base space and the fiber schema jims id spaces...
virtual bool conforms_to_state(const index_space_collection &xhost, pod_type xlocal_id) const
True if this conforms to the handle type required by the state with local scope id xlocal_id in the h...
static size_type handle_pool_ct()
The number of handles in the pool.
void attach(explicit_index_space_handle &xid_space) const
Attach the id space handle xid_space to this state.
pod_type _end
Ending id of this space.
virtual ij_product_structure * clone() const
Virtual constructor, makes a new instance of the same type as this.
Abstract base class with useful features for all objects.
virtual index_space_handle & get_id_space() const
The id space handle with this state.
const ij_product_structure & section_space_schema_product_structure() const
The product structure of the section space schema id space.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
virtual index_space_iterator & get_iterator() const
Allocates an id space iterator from the iterator pool.
std::string name() const
Name of this space.
virtual bool is_attached() const
True if this handle is attached to a state.
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
const index_space_handle & base_space() const
The base space jims id space.
section_space_schema_jims_index_space_state()
Default constructor.
bool is_explicit_interval(pod_type xid)
True, if and only if the id space interval that contains index xid is an explicit interval...
index_space_handle * _base_space
The base space jims id space.
virtual bool contains_unglued_hub(pod_type xid) const
True if this space contains an id equivalent to xid in the unglued hub id space.
virtual size_type ct() const =0
The number of members.
static section_space_schema_jims_index_space_handle new_space(index_space_family &xid_spaces, const std::string &xname, const index_space_handle &xbase_space_id_space, const index_space_handle &xfiber_schema_id_space, const ij_product_structure &xsection_space_schema_product)
Create a new section space schema jims id space in the id space family xid_space at the next availabl...
index_space_handle * _fiber_schema
The fiber schema jims id space.
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
virtual bool contains_unglued_hub(pod_type xid) const =0
True if this space contains an id equivalent to xid in the unglued hub id space.
virtual pod_type pod(pod_type xid) const =0
The pod index in this space equivalent to xid in the hub id space.
void ordinal(pod_type xi, pod_type xj, pod_type &xordinal) const
2-tuple to ordinal conversion.
virtual pod_type unglued_hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space.
SHEAF_DLL_SPEC size_t deep_size(const sec_vd &x0, bool xinclude_shallow=true)
The deep size of the referenced object of type sec_vd. if xinclude_shallow, add the sizeof x0 to the ...
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
virtual void new_product_structure(const abstract_product_structure &xproduct)
Creates a new product structure for this id space by cloning the product structure, xproduct.
virtual bool invariant() const
Class invariant.
pod_type hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space; synonym for unglued_hub...
virtual ~section_space_schema_jims_index_space_state()
Destructor.
size_type _ct
The number of members.
virtual pod_type begin() const
Beginning id of this space.
bool invariant_check() const
True if invariant checking is enabled.
virtual void release_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the iterator pool.
pod_index_type pod_type
The "plain old data" index type for this.
int_type pod_index_type
The plain old data index type.
A 2D implementation of abstract_product_structure.
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
virtual bool invariant() const
Class invariant.
An implementation class explicit_index_space_state for the jims id space of the section space schema...
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
const index_space_handle & base_space() const
The base space jims id space.
virtual pod_type end() const
Ending id of this space.
ij_product_structure * _section_space_schema_product
The product structure of the section space schema id space.
virtual size_type ct() const
The number of members.
bool is_empty() const
True if there are no ids in the space.
Factory and container for a family of id spaces.
An iterator over an id space in which the equivalence between the ids in the space and the hub id spa...
const ij_product_structure & product_structure() const
The product structure for this id space (const version).
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
static factory< explicit_index_space_state > & id_space_factory()
A factory for making descendants of this class.
virtual void release_id_space(index_space_handle &xid_space) const
Release the id space handle xid_space.
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
bool is_same_type(const any *other) const
True if other is the same type as this.
void enable_invariant_check() const
Enable invariant checking.
virtual bool is_attached() const
True if this iterator is attached to a state.
A reallocated pool of objects of type T. Objects in the pool are either allocated or stored in a free...
virtual bool allocated_iterator(const index_space_iterator &xitr) const
True if and only if id space iterator xitr was allocated by the iterator pool.
static size_type iterator_pool_deep_size()
The deep size of the iterator pool.
const index_space_handle & fiber_schema() const
The fiber schema jims id space.
void update()
Make this id space consistent with the base space and fiber schema jims id spaces.