21 #include "SheafSystem/structured_block_2d.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/arg_list.h" 26 #include "SheafSystem/chart_point_3d.h" 27 #include "SheafSystem/fiber_bundles_namespace.h" 28 #include "SheafSystem/namespace_poset.h" 29 #include "SheafSystem/poset_path.h" 30 #include "SheafSystem/preorder_iterator.h" 31 #include "SheafSystem/quad_connectivity.h" 32 #include "SheafSystem/tern.h" 33 #include "SheafSystem/wsv_block.h" 56 const poset_path& result = STATIC_PROTOTYPE_PATH;
61 ensure(result.
member_name() ==
"structured_block_2d");
78 require(!xhost_path.
empty());
81 require(xschema_path.
full());
88 host_type::new_table(xns, xhost_path, xschema_path, 2, xauto_access);
92 ensure(xns.
owns(result, xauto_access));
93 ensure(result.
path(
true) == xhost_path);
95 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
97 ensure(result.
max_db() == 2);
129 result_ptr = &new_host(xns, xhost_path, standard_schema_path(), xauto_access);
136 ensure(xns.
owns(result, xauto_access));
137 ensure(result.
path(
true) == xhost_path);
139 ensure(result.
schema(
true).
path(xauto_access) == standard_schema_path());
141 ensure(result.
max_db() == 2);
170 ensure(!is_attached());
184 new_jem_state(const_cast<abstract_poset_member*>(&xother),
true,
true);
188 attach_to_state(&xother);
219 require(precondition_of(new_state(same args)));
223 new_state(xhost, xi_size, xj_size, xauto_access);
227 ensure(postcondition_of(new_state(same args)));
241 require(precondition_of(attach_to_state(xhost, xhub_id)));
245 attach_to_state(xhost, xhub_id);
249 ensure(postcondition_of(attach_to_state(xhost, xhub_id)));
257 require(precondition_of(attach_to_state(xhost, xid)));
261 attach_to_state(xhost, xid.
hub_pod());
265 ensure(postcondition_of(attach_to_state(xhost, xid)));
274 require(precondition_of(attach_to_state(same args)));
278 attach_to_state(xhost, xname);
282 ensure(postcondition_of(attach_to_state(same args)));
295 require(precondition_of(attach_to_state(same args)));
299 attach_to_state(xnamespace, xpath, xauto_access);
303 ensure(postcondition_of(attach_to_state(same args)));
319 require(precondition_of(attach_to_state(same args)));
323 attach_to_state(xnamespace, xposet_id, xmember_id);
327 ensure(postcondition_of(attach_to_state(same args)));
343 require(precondition_of(attach_to_state(same args)));
347 attach_to_state(xnamespace, xposet_id.
hub_pod(), xmember_id.
hub_pod());
351 ensure(postcondition_of(attach_to_state(same args)));
368 require(precondition_of(new_state(host(), xi_size, xj_size, xauto_access)));
372 new_state(host(), xi_size, xj_size, xauto_access);
376 ensure(postcondition_of(new_state(host(), xi_size, xj_size, xauto_access)));
408 require(namespace_is_ancestor_of(xhost->
name_space()));
413 require(dynamic_cast<base_space_poset*>(xhost) != 0);
437 lhost->
new_member_interval(
"structured_block_2d_crg_interval", lsize, ldof_tuple_ids, ldata);
441 attach_to_state(lhost, lindex);
451 ensure(host() == xhost);
452 ensure(is_attached());
454 ensure(prototype_path() == static_prototype_path());
455 ensure(local_cell_type_name() == static_local_cell_prototype_path().member_name());
456 ensure(i_size() == xi_size);
457 ensure(j_size() == xj_size);
485 require(state_is_read_accessible());
504 require(state_is_read_accessible());
537 define_old_variable(
int old_xhost_row_dof_tuple_ct = xhost.
row_dof_tuple_ct());
555 ltuple->
db = lproto.db();
556 ltuple->
type_id = lproto.type_id();
557 ltuple->
type_name = strdup(lproto.type_name());
561 ltuple->
size = xi_size*xj_size;
567 local_proto.detach_from_state();
568 lproto.detach_from_state();
610 require(state_is_read_accessible());
612 require(xpt.
chart_id() == index().pod());
616 require(xpt.
db() >= db());
617 require(result.
db() >= db());
626 refine_coordinate(lu_coord, lu_chart_id, i_size());
630 refine_coordinate(lv_coord, lv_chart_id, j_size());
635 _elements_id_space->hub_pod(offset(lu_chart_id, lv_chart_id));
659 require(state_is_read_accessible());
661 require(xpt.
chart_id() == index().pod());
665 require(xpt.
db() >= db());
673 refine_coordinate(lu_coord, lu_chart_id, i_size());
677 refine_coordinate(lv_coord, lv_chart_id, j_size());
685 chart_point_3d lref_pt(_elements_id_space->hub_pod(lref_chart_id),
686 lu_coord, lv_coord, 0.0);
703 unsigned int lbit_code = 0;
705 if(is_close_enough(lu_coord, -1.0) && (lu_chart_id > 0))
709 lbit_code |=
static_cast<unsigned int>(1);
712 if(is_close_enough(lv_coord, -1.0) && (lv_chart_id > 0))
716 lbit_code |=
static_cast<unsigned int>(2);
721 if((lbit_code & 1) == 1)
726 lref_chart_id = offset(lu_chart_id, lv_chart_id);
730 lref_pt.
put(_elements_id_space->hub_pod(lref_chart_id),
735 if((lbit_code & 2) == 2)
740 lref_chart_id = offset(lu_chart_id, lv_chart_id);
744 lref_pt.
put(_elements_id_space->hub_pod(lref_chart_id),
749 if((lbit_code & 3) == 3)
755 lref_chart_id = offset(lu_chart_id, lv_chart_id);
759 lref_pt.
put(_elements_id_space->hub_pod(lref_chart_id),
780 require(state_is_read_accessible());
787 require(xpt.
db() >= db());
788 require(result.
db() >= db());
789 require(host()->contains_member(xpt.
chart_id()));
805 lxcoord = lxcoord + l_id/j_size();
806 lycoord = lycoord + l_id%j_size();
812 lxcoord = (lxcoord/i_size())*2.0 - 1.0;
813 lycoord = (lycoord/j_size())*2.0 - 1.0;
833 require(state_is_read_write_accessible());
856 require(state_is_read_write_accessible());
878 require(state_is_read_write_accessible());
901 require(state_is_read_write_accessible());
944 const poset_path& result = STATIC_LOCAL_CELL_PROTOTYPE_PATH;
1011 ensure(result != 0);
1043 if(invariant_check())
1047 disable_invariant_check();
1051 invariance(state_is_read_accessible() ? is_jim(
false) :
true);
1052 invariance(state_is_read_accessible() ? size() == i_size()*j_size() :
true);
1056 enable_invariant_check();
1094 attach_to_state(&xother);
1098 ensure(is_same_state(&xother));
1112 require(is_ancestor_of(&xother));
1120 ensure(invariant());
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...
double chart_point_coord_type
The type of local coordinate in the base space; the scalar type for the local coordinate vector space...
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 ...
structured_block_2d()
Default constructor; creates a new, unattached structured_block_2d handle.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
virtual structured_block_2d & operator=(const abstract_poset_member &xother)
Assignment operator; attaches this to the same state as xother.
bool path_is_auto_read_write_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-write accessible...
virtual void create_cover_link(abstract_poset_member *xlesser)
Insert a link from this to lesser; make lesser <= this.
bool full() const
True if both poset name and member name are not empty.
abstract_poset_member & top()
The top member of the poset (mutable version)
static host_type & standard_host(namespace_type &xns, const poset_path &xhost_path, bool xauto_access)
The host with path xhost_path. Returns the host if it already exists, otherwise, creates it in namesp...
A homogeneous collection of connected quads arranged in an i_size() x j_size() array.
size_type size
The number of local cells.
A point in a 3D chart space.
poset_path path(bool xauto_access=true) const
A path to this component.
bool conforms_to(const schema_poset_member &xother) const
True if the dofs defined by this agree in type and in order with the dofs defined by xother...
The default name space; a poset which contains other posets as members.
int local_cell_type_id
The local cell type id.
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...
const char * local_cell_type_name
The local cell type name.
virtual int db() const =0
The dimension of this chart.
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 void * dof_tuple()=0
The dof tuple (mutable version).
A path defined by a poset name and a member name separated by a forward slash ('/'). For example: "cell_definitions/triangle".
static const poset_path & static_prototype_path()
The path of the prototype required by this class.
void put_chart_id(pod_index_type xchart)
Sets chart_id() to xchart_id.
virtual bool invariant() const
Class invariant.
pod_index_type chart_id() const
The id of the chart this point is in.
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.
static const poset_path & static_local_cell_prototype_path()
The path of the local cell prototype required by this class.
static const std::string & prototypes_poset_name()
The name of the prototypes poset.
int db
The base space dimension.
Emulator for a interval of implicit base space members representing a 2 dimensional structured block...
virtual structured_block_2d * clone() const
Make a new handle, no state instance of current.
A client handle for a member of a base space poset.
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 schema_poset_member & schema()
The schema for this poset (mutable version).
Struct representing the closed interval [_begin, _end].
virtual coord_type * local_coords()=0
The array of local coordinates.
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
virtual const structured_block_2d_crg_interval & interval() const
The implicit interval member for this block.
size_type i_size
The upper bound on the x direction index for structured blocks.
A client handle for a mutable partially ordered set.
virtual const scoped_index & new_row_dof_map()
Creates a new row dof map.
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)
void set_ct(size_type xct)
Sets ct() == xct.
An index within the external ("client") scope of a given id space.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
virtual void unrefine_point_pa(const chart_point &xpt, chart_point &result) const
The point in this which is the same as xpt in the direct refinement of this; pre-allocated version...
virtual void get_read_access() const
Get read access to the state associated with this.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
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.
size_type row_dof_tuple_ct() const
The number of row_dof_tuples of this poset.
virtual void refine_point_pa(const chart_point &xpt, chart_point &result) const
The point in the direct refinement of this which is the same as xpt in this; pre-allocated version...
size_type i_size() const
The number of local cells (zones) in the i direction. The number of vertices in the i direction is i_...
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...
virtual ~structured_block_2d()
Destructor; deletes a poset member and its attached state, if any.
static void get_private_data(size_type xi_size, size_type xj_size, block< pod_index_type > &result)
The private data for an instance with parameter xi_size.
virtual void unsimplify()
Removes the standard simplex refinement of this from its lower cover and changes this from a jrm to a...
size_type j_size
The upper bound on the y direction index for structured blocks.
bool poset_state_is_read_accessible(const poset_path &xpath, bool xauto_access=true) const
True if the poset referred to by xpath is read accessible.
virtual poset_dof_map & row_dof_map(pod_index_type xtuple_hub_id, bool xrequire_write_access=false) const
The map from row dof client_ids to row dof values for dof tuple hub id xtuple_hub_id.
namespace_poset * name_space() const
The namespace this poset resides in.
const char * type_name
The cell type name.
virtual bool is_attached() const
True if this is attached to a state.
static void get_dof_tuple_ids(poset_state_handle &xhost, size_type xi_size, size_type xj_size, block< pod_index_type > &result)
The dof tuple ids for an instance created with parameter xi_size.
pod_index_type pod_type
The "plain old data" storage type for this.
int refinement_depth
The refinement depth.
int_type pod_index_type
The plain old data index type.
void put(pod_index_type xchart_id, coord_type xu, coord_type xv, coord_type xw)
Sets chart_id() == xchart_id, u() == xu, v() == xv, w() == xw.
static host_type & new_host(namespace_type &xns, const poset_path &xhost_path, const poset_path &xschema_path, bool xauto_access)
Creates a new host poset for members of this type. The poset is created in namespace xns with path xh...
std::string member_name() const
The member name part of the path.
virtual pod_index_type new_member_interval(const std::string &xinterval_type, size_type xsize, const block< pod_index_type > &xdof_tuple_ids, const block< pod_index_type > &xdata)
Create a disconnected member interval of type xinterval_type with size xsize, dof tuple ids xdof_tupl...
virtual bool invariant() const
Class invariant.
virtual void put_local_coord(int xi, coord_type xvalue)=0
Sets the xi-th local coordinate of this point to xvalue.
int type_id
The cell type id.
virtual void end_jim_edit_mode(bool xensure_lattice_invariant=true, bool xauto_access=true)
Prevent editing of jims and jim order relation.
static bool is_valid_name(const std::string &xname)
True if xname is not empty and contains only name legal characters.
virtual void get_read_access() const
Get read access to the state associated with this.
int max_db() const
The maximum dimension of the members of this base space.
An abstract client handle for a member of a poset.
static scoped_index new_row_dof_map(poset_state_handle &xhost, size_type xi_size, size_type xj_size, bool xauto_access)
Creates a new row dof map and initializes it.
bool row_conforms_to(const schema_poset_member &xother) const
True if the row dofs defined by this agree in type and in order with the dofs defined by xother...
The type of row dof tuple for base_space_member.
bool in_jim_edit_mode() const
True if editing jims and jim order relation is allowed.
static void get_size(size_type xi_size, size_type xj_size, size_type &result)
The size for an instance created with parameter xi_size.
void new_state(const size_type &xi_size, const size_type &xj_size, bool xauto_access=true)
Creates a new structured_block_2d state in host() with i_size() == xi_size and j_size() == xj_size an...
Namespace for the fiber_bundles component of the sheaf system.
virtual coord_type local_coord(int xi) const =0
The xi-th local coordinate of this point.
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...
virtual void unrefine()
Removes the standard refinement of this from its lower cover and changes this from a jrm to a jim...
virtual void simplify()
Inserts the standard simplex refinement of this into its lower cover and changes this from a jim to a...
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...
virtual void refine()
Inserts the standard refinement of this into its lower cover and changes this from a jim to a jrm...
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
virtual void begin_jim_edit_mode(bool xauto_access=true)
Allow editing of jims and jim order relation.
size_type j_size() const
The number of local cells (zones) in the j direction. The number of vertices in the j direction is j_...