21 #include "SheafSystem/zone_nodes_block_crg_interval.h" 23 #include "SheafSystem/array_implicit_index_space_iterator.h" 24 #include "SheafSystem/array_index_space_interval.h" 25 #include "SheafSystem/assert_contract.h" 26 #include "SheafSystem/block_connectivity.h" 27 #include "SheafSystem/constant_index_space_interval.h" 28 #include "SheafSystem/error_message.h" 29 #include "SheafSystem/explicit_index_space_interval.h" 30 #include "SheafSystem/factory.h" 31 #include "SheafSystem/offset_index_space_handle.h" 32 #include "SheafSystem/offset_index_space_state.h" 33 #include "SheafSystem/list_index_space_handle.h" 34 #include "SheafSystem/list_index_space_state.h" 35 #include "SheafSystem/hash_index_space_handle.h" 36 #include "SheafSystem/hash_index_space_state.h" 37 #include "SheafSystem/homogeneous_block.h" 38 #include "SheafSystem/index_space_iterator.h" 39 #include "SheafSystem/ragged_array_index_space_interval.h" 40 #include "SheafSystem/section_space_schema_member.h" 41 #include "SheafSystem/std_iomanip.h" 42 #include "SheafSystem/std_string.h" 43 #include "SheafSystem/std_sstream.h" 73 _vertex_client_id_space_initialized =
false;
85 ensure(!is_initialized());
102 _id_spaces->delete_space(_lower_covers_begin);
106 _id_spaces->delete_space(_lower_covers_begin + 1);
110 _id_spaces->delete_space(_lower_covers_begin + 1 + _zone_size);
117 _id_spaces->delete_space(_upper_covers_begin);
121 _id_spaces->delete_space(_upper_covers_begin + 1);
125 _id_spaces->delete_space(_upper_covers_begin + 1 + _zone_size);
128 if(
is_valid(_vertex_client_space_id))
130 _id_spaces->delete_space(_vertex_client_space_id);
143 fiber_bundle::zone_nodes_block_crg_interval::
151 static const string prototype_names[block_connectivity::CELL_TYPE_END] =
161 const string& result = prototype_names[xconn.
element_type()];
165 ensure(!result.empty());
174 fiber_bundle::zone_nodes_block_crg_interval::
181 static const int ldb[block_connectivity::CELL_TYPE_END] =
214 bool result = _vertex_client_id_space_initialized;
218 ensure(is_basic_query);
231 require(vertex_client_id_space_initialized());
239 ensure(is_basic_query);
256 string result(poset_path::make_reserved_name(
"", interval_member(),
"_vertex_client_ids"));
260 ensure(!result.empty());
273 require(id_spaces_initialized());
274 require(local_id_space_initialized());
280 string lname = vertex_client_id_space_name();
285 hash_index_space_state::new_space(*_id_spaces,
295 for(node_itr_type v = xadjacency.
begin(); v != xadjacency.
end(); ++v)
297 lclient_id_space.
insert(v->first, lhub_vertex_id);
301 assertion(lhub_vertex_id == lzone_begin + xadjacency.
zone_ct() + xadjacency.
node_ct());
303 _vertex_client_space_id = lclient_id_space.
index();
304 _vertex_client_id_space_initialized =
true;
308 ensure(vertex_client_id_space_initialized());
309 ensure(id_spaces().ct(vertex_client_space_id()) == _vertex_size);
344 require(id_spaces_initialized());
345 require(local_id_space_initialized());
346 require(!zones_initialized());
352 const string& lzone_id_space_name =
353 section_space_schema_member::intersection_id_space_name(xhost.
d_cells(_zone_db), interval_member());
356 offset_index_space_state::new_space(*_id_spaces,
361 _zones_initialized =
true;
365 ensure(zones_initialized());
389 require(id_spaces_initialized());
390 require(local_id_space_initialized());
391 require(!vertices_initialized());
397 const string& lvertex_id_space_name =
398 section_space_schema_member::intersection_id_space_name(xhost.
d_cells(0),
402 offset_index_space_state::new_space(*_id_spaces,
403 lvertex_id_space_name,
405 _vertex_size).index();
407 _vertices_initialized =
true;
411 ensure(vertices_initialized());
431 require(contains_member(xmbr_id));
435 int result = (member_class(xmbr_id) == VERTEX) ? 0 : _zone_db;
458 result = _vertices_space_id;
460 else if(xd == _zone_db)
462 result = _zones_space_id;
495 require(!block_vertices_initialized());
496 require(vertices_initialized());
500 _block_vertices_space_id =
501 list_index_space_state::new_space(*_id_spaces,
502 block_vertices_name(),
507 _block_vertices_initialized =
true;
511 ensure(block_vertices_initialized());
567 require(id_spaces_initialized());
568 require(local_id_space_initialized());
569 require(!covers_initialized(
LOWER));
578 _lower_covers_begin =
579 explicit_index_space_interval::new_space(*_id_spaces, 1).begin();
581 offset_index_space_state::new_space(*_id_spaces,
583 implicit_cover_name(
LOWER, interval_member()),
595 _connectivity_begin =
596 array_index_space_interval::new_space(*_id_spaces,
606 constant_index_space_interval::new_space(*_id_spaces,
612 _lower_covers_initialized =
true;
616 ensure(covers_initialized(
LOWER));
629 require(id_spaces_initialized());
630 require(local_id_space_initialized());
631 require(!covers_initialized(
UPPER));
639 _upper_covers_begin =
640 explicit_index_space_interval::new_space(*_id_spaces, 1).begin();
642 list_index_space_state::new_space(*_id_spaces,
644 explicit_cover_name(
UPPER, interval_member()),
651 constant_index_space_interval::new_space(*_id_spaces,
664 ragged_array_index_space_interval::new_space(*_id_spaces,
671 _upper_covers_initialized =
true;
675 ensure(covers_initialized(
UPPER));
702 result.
reserve(MEMBER_CLASS_END);
703 result.
set_ct(MEMBER_CLASS_END);
705 string lname = zone_prototype_name(xconn);
709 homogeneous_block::new_row_dof_map(xhost,
"unstructured_block", lname, lzone_ct,
true).hub_pod();
710 result[ZONE] = base_space_member::new_row_dof_map(xhost, lname,
true).hub_pod();
711 result[VERTEX] = base_space_member::new_row_dof_map(xhost,
"point",
true).hub_pod();
743 size_type lpd_size = lnode_ids_ct + NODE_IDS_BEGIN + EXPLICIT_PRIVATE_DATA_SIZE;
748 xdata[j++] = zone_db(xconn);
751 xdata[j++] = lnode_ids_ct;
755 for(
size_type i = 0; i < lnode_ids_ct; ++i)
757 xdata[j++] = lnode_ids[i];
770 ensure(unexecutable(
"node ids are clients ids"));
783 return _zone_size*_nodes_per_zone + NODE_IDS_BEGIN;
794 size_type lconn_size = _zone_size*_nodes_per_zone;
796 size_type lpd_size = lconn_size + NODE_IDS_BEGIN;
800 xdata[j++] = _zone_db;
801 xdata[j++] = _zone_size;
802 xdata[j++] = _nodes_per_zone;
803 xdata[j++] = lconn_size;
810 xdata[j++] = lclient_id_space.
pod(_connectivity[i]);
815 ensure(xdata.
ct() == implicit_private_data_size());
816 ensure(unexecutable(
"node ids are clients ids"));
829 require(xdata[3] == xdata[1]*xdata[2]);
830 require(xdata.ct() > NODE_IDS_BEGIN);
831 require(xdata.ct() >= xdata[3] + NODE_IDS_BEGIN);
837 _zone_db = xdata[j++];
838 _zone_size = xdata[j++];
839 _nodes_per_zone = xdata[j++];
845 _zone_begin = implicit_begin();
846 _vertex_begin = _zone_begin + _zone_size;
851 lconn_ct, &xdata[j]);
855 _vertex_size = ladjacency.
node_ct();
859 initialize_vertex_client_id_space(ladjacency);
868 _connectivity.
reserve(lconn_ct);
869 _connectivity.set_ct(lconn_ct);
873 _connectivity[i] = lclient_id_space.
hub_pod(xdata[j++]);
876 _id_spaces->release_id_space(lclient_id_space);
885 node_itr_type v = ladjacency.
begin();
887 while(v != ladjacency.
end())
889 for(zone_itr_type z = v->second.begin(); z != v->second.end(); ++z)
891 _adjacency.push_back((*z) + _zone_begin);
898 if(v != ladjacency.
end())
900 _adjacency.new_back_row();
928 require(dynamic_cast<base_space_poset*>(&xhost) != 0);
937 initialize_zones(lhost);
941 initialize_vertices(lhost);
945 initialize_block_vertices();
953 lhost.insert_interval_in_standard_subposets(*
this);
958 _vertex_begin + _vertex_size);
960 homogeneous_block_crg_interval::finalize(xhost);
965 ensure(is_initialized());
987 static const string result(
"zone_nodes_block_crg_interval");
996 homogeneous_block_crg_interval::is_initialized() &&
997 _vertex_client_id_space_initialized;
1007 fiber_bundle::zone_nodes_block_crg_interval::
1017 interval_factory().insert_prototype(lproto);
1041 require(other != 0);
1066 ensure(result != 0);
1067 ensure(is_same_type(result));
1080 if(invariant_check())
1084 disable_invariant_check();
1088 invariance(homogeneous_block_crg_interval::invariant());
1092 invariance(dof_tuple_ids_initialized() ?
is_valid(block_dof_tuple_id()) :
true);
1093 invariance(dof_tuple_ids_initialized() ?
is_valid(zone_dof_tuple_id()) :
true);
1094 invariance(dof_tuple_ids_initialized() ?
is_valid(vertex_dof_tuple_id()) :
true);
1098 enable_invariant_check();
void initialize_block_vertices()
Initialize the block vertices id space.
void initialize_zones(base_space_poset &xhost)
Initialize the zones id space.
zone_nodes_block_crg_interval()
Default Constructor.
virtual pod_type index() const
Index of this space.
pod_index_type vertex_client_space_id() const
The index of the vertex client id space.
size_type ct() const
The number of items currently in use.
node_iterator_type begin()
Beginning of adjacency relation.
virtual int db(pod_index_type xmbr_id) const
The dimension of the member with id xmbr_id. Does not require access to dof tuple.
virtual void initialize_lower_covers()
Initialize the lower covers for this interval.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
subposet & d_cells(int xd)
The subposet containing the cells of dimension xd (mutable version).
virtual void put_implicit_private_data(const block< pod_index_type > &xdata)
Initializes this using private data xdata.
virtual zone_nodes_block_crg_interval * clone() const
Virtual constructor, makes a new instance of the same type as this.
A client handle for a general, abstract partially order set.
size_type node_id_ct() const
The number of entries in node_ids().
size_type zone_ct() const
The number of distinct zones.
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
Zone to node connectivity relation for a block of zones of a given type.
virtual void finalize(poset_state_handle &xhost)
Finialize the initialization of this crg interval in the host xhost.
virtual const std::string & class_name() const
The name of this class; provided to satisfy factory template.
static void get_size(const block_connectivity &xconn, size_type &result)
The size of the interval for block connectivity xconn.
size_type node_ct() const
The number of distinct nodes.
virtual ~zone_nodes_block_crg_interval()
Destructor.
static void get_private_data(const block_connectivity &xconn, block< pod_index_type > &result)
The private data for an instance with connectivity xconn.
pod_index_type * node_ids()
The nodal connectivity array.
virtual pod_type pod(pod_type xid) const
The pod index in this space equivalent to xid in the hub id space.
void append_upper_cover_of_bottom(pod_index_type xmbr_hub_begin, pod_index_type xmbr_hub_end)
Appends the interval of hub ids [xmbr_hub_begin, xmbr_hub_end) to the upper cover of bottom...
virtual pod_index_type d_cells_space_id(int xd) const
The id space index for the cells of dimension xd. Returns invalid_pod_index() if there is no id space...
adj_type::const_iterator const_node_iterator_type
Type of const iterator for nodes.
Abstract base class with useful features for all objects.
The lattice of closed cells of a cellular space; a lattice representation of a computational mesh...
virtual size_type implicit_private_data_size() const
The size of the private data.
size_type nodes_per_element() const
The number of nodes per element.
virtual cell_type element_type() const =0
The element (zone) type.
virtual index_space_handle & get_id_space() const
Allocates an id space handle from the handle pool.
void set_ct(size_type xct)
Sets ct() == xct.
void initialize_vertex_client_id_space(block_adjacency &xadjacency)
Initializes the vertex client id space.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
const bool UPPER
Selector for upper cover.
void reserve(size_type xcapacity)
Reserve enough memory for xcapacity number of ids.
void insert(pod_type xid, const scoped_index &xhub_id)
Make id xid in this id space equivalent to xhub_id in the hub id space. synonym for insert(xid...
static void get_dof_tuple_ids(poset_state_handle &xhost, const block_connectivity &xconn, block< pod_index_type > &result)
The dof tuple ids for an instance created with parameter xi_size.
void initialize_vertices(base_space_poset &xhost)
Initialize the vertex id space.
virtual void initialize_upper_covers()
Initialize the upper cover for this interval.
Node to zone adjacency relation for a block of zones of a given type.
Emulator for a interval of implicit base space members representing an unstructured block...
const bool LOWER
Selector for lower cover.
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...
size_type node_ct() const
The number of distinct nodes.
size_type element_ct() const
The number of elements.
int_type pod_index_type
The plain old data index type.
A handle for a scattered_insertion_index_space_state.
adj_type::mapped_type::const_iterator const_zone_iterator_type
Type of const iterator for zones.
virtual void get_implicit_private_data(block< pod_index_type > &xdata) const
Initializes this using private data xdata.
std::string vertex_client_id_space_name()
The reserved name for the vertex client id space of this interval.
node_iterator_type end()
End of adjacency relation.
bool vertex_client_id_space_initialized() const
True if and only if the vertex client id space has been initialized.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Namespace for the fiber_bundles component of the sheaf system.
virtual bool is_initialized() const
True if fully initialized.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
virtual bool invariant() const
Class invariant.