21 #include "SheafSystem/structured_block_1d.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/tern.h" 32 #include "SheafSystem/wsv_block.h" 54 const poset_path& result = STATIC_PROTOTYPE_PATH;
59 ensure(result.
member_name() ==
"structured_block_1d");
76 require(!xhost_path.
empty());
79 require(xschema_path.
full());
86 host_type::new_table(xns, xhost_path, xschema_path, 1, xauto_access);
90 ensure(xns.
owns(result, xauto_access));
91 ensure(result.
path(
true) == xhost_path);
93 ensure(result.
schema(
true).
path(xauto_access) == xschema_path);
95 ensure(result.
max_db() == 1);
127 result_ptr = &new_host(xns, xhost_path, standard_schema_path(), xauto_access);
134 ensure(xns.
owns(result, xauto_access));
135 ensure(result.
path(
true) == xhost_path);
137 ensure(result.
schema(
true).
path(xauto_access) == standard_schema_path());
139 ensure(result.
max_db() == 1);
170 ensure(! is_attached() );
185 new_jem_state(const_cast<abstract_poset_member*>(&xother),
true,
true);
189 attach_to_state(&xother);
218 require(precondition_of(new_state(same args)));
222 new_state(xhost, xi_size, xauto_access);
226 ensure(postcondition_of(new_state(same args)));
240 require(precondition_of(attach_to_state(xhost, xhub_id)));
244 attach_to_state(xhost, xhub_id);
248 ensure(postcondition_of(attach_to_state(xhost, xhub_id)));
256 require(precondition_of(attach_to_state(xhost, xid)));
260 attach_to_state(xhost, xid.
hub_pod());
264 ensure(postcondition_of(attach_to_state(xhost, xid)));
273 require(precondition_of(attach_to_state(same args)));
277 attach_to_state(xhost, xname);
281 ensure(postcondition_of(attach_to_state(same args)));
294 require(precondition_of(attach_to_state(same args)));
298 attach_to_state(xnamespace, xpath, xauto_access);
302 ensure(postcondition_of(attach_to_state(same args)));
318 require(precondition_of(attach_to_state(same args)));
322 attach_to_state(xnamespace, xposet_id, xmember_id);
326 ensure(postcondition_of(attach_to_state(same args)));
342 require(precondition_of(attach_to_state(same args)));
346 attach_to_state(xnamespace, xposet_id.
hub_pod(), xmember_id.
hub_pod());
350 ensure(postcondition_of(attach_to_state(same args)));
365 require(precondition_of(new_state(host(), xi_size, xauto_access)));
369 new_state(host(), xi_size, xauto_access);
373 ensure(postcondition_of(new_state(host(), xi_size, xauto_access)));
403 require(namespace_is_ancestor_of(xhost->
name_space()));
408 require(dynamic_cast<base_space_poset*>(xhost) != 0);
432 lhost->
new_member_interval(
"structured_block_1d_crg_interval", lsize, ldof_tuple_ids, ldata);
436 attach_to_state(lhost, lindex);
446 ensure(host() == xhost);
447 ensure(is_attached());
449 ensure(prototype_path() == static_prototype_path());
450 ensure(local_cell_type_name() == static_local_cell_prototype_path().member_name());
451 ensure(i_size() == xi_size);
479 require(state_is_read_accessible());
502 require(state_is_read_accessible());
503 require(unexecutable(data members created));
517 ensure(!is_restricted());
542 define_old_variable(
int old_xhost_row_dof_tuple_ct = xhost.
row_dof_tuple_ct());
560 ltuple->
db = lproto.db();
561 ltuple->
type_id = lproto.type_id();
562 ltuple->
type_name = strdup(lproto.type_name());
566 ltuple->
size = xi_size;
571 local_proto.detach_from_state();
572 lproto.detach_from_state();
614 require(state_is_read_accessible());
616 require(xpt.
chart_id() == index().pod());
620 require(xpt.
db() >= db());
621 require(result.
db() >= db());
624 require(unexecutable(
"chart_pt is in standard domain"));
634 refine_coordinate(lu_coord, lu_chart_id_pod, i_size());
638 pod_index_type lu_chart_id = _elements_id_space->hub_pod(lu_chart_id_pod);
661 require(state_is_read_accessible());
662 require(xpt.
chart_id() == index().pod());
666 require(xpt.
db() >= db());
669 require(unexecutable(
"chart_pt is in standard domain"));
677 refine_coordinate(lu_coord, lu_chart_id, i_size());
681 chart_point_3d lrefined_pt(_elements_id_space->hub_pod(lu_chart_id),
685 if(is_close_enough(lu_coord, -1.0) && (lu_chart_id > 0))
695 lrefined_pt.
put(_elements_id_space->hub_pod(lu_chart_id), 1.0, 0.0, 0.0);
715 require(state_is_read_accessible());
722 require(xpt.
db() >= db());
723 require(result.
db() >= db());
724 require(host()->contains_member(xpt.
chart_id()));
738 lcoord = lcoord + lref_chart_id;
743 lcoord = (lcoord/i_size())*2.0 - 1.0;
753 ensure(result.
chart_id() == index().pod());
766 require(state_is_read_write_accessible());
789 require(state_is_read_write_accessible());
811 require(state_is_read_write_accessible());
834 require(state_is_read_write_accessible());
880 const poset_path& result = STATIC_LOCAL_CELL_PROTOTYPE_PATH;
972 if(invariant_check())
976 disable_invariant_check();
980 invariance(state_is_read_accessible() ? is_jim(
false) :
true);
981 invariance(state_is_read_accessible() ? size() == i_size() :
true);
985 enable_invariant_check();
1022 attach_to_state(&xother);
1026 ensure(is_same_state(&xother));
1040 require(is_ancestor_of(&xother));
1048 ensure(invariant());
virtual ~structured_block_1d()
Destructor; deletes a poset member and its attached state, if any.
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 void unrefine()
Removes the standard refinement of this from its lower cover and changes this from a jrm to a jim...
virtual bool invariant() const
Class invariant.
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 ...
virtual void attach_handle_data_members()
Initializes handle data members when attaching to a different member of the same host.
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.
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_...
abstract_poset_member & top()
The top member of the poset (mutable version)
static const poset_path & static_local_cell_prototype_path()
The path of the local cell prototype required by this class.
size_type size
The number of local cells.
virtual structured_block_1d * clone() const
Make a new handle, no state instance of current.
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...
virtual void simplify()
Inserts the standard simplex refinement of this into its lower cover and changes this from a jim to a...
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".
virtual bool invariant() const
Class invariant.
void put_chart_id(pod_index_type xchart)
Sets chart_id() to xchart_id.
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.
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...
static const std::string & prototypes_poset_name()
The name of the prototypes poset.
int db
The base space dimension.
A homogeneous collection of connected segments arranged in an i_size() array.
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.
static void get_size(size_type xi_size, size_type &result)
The size for an instance created with parameter xi_size.
size_type i_size
The upper bound on the x direction index for structured blocks.
A client handle for a mutable partially ordered set.
Emulator for a interval of implicit base space members representing a 1 dimensional structured block...
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)
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 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.
static void get_private_data(size_type xi_size, block< pod_index_type > &result)
The private data for an instance with parameter xi_size.
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 const structured_block_1d_crg_interval & interval() const
The implicit interval member for this block.
virtual bool is_ancestor_of(const any *other) const
True if other conforms to this.
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...
structured_block_1d()
Default constructor; creates a new, unattached structured_block_1d handle.
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.
virtual structured_block_1d & operator=(const abstract_poset_member &xother)
Assignment operator; attaches this to the same state as xother.
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.
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 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.
static const poset_path & static_prototype_path()
The path of the prototype required by this class.
virtual void unsimplify()
Removes the standard simplex refinement of this from its lower cover and changes this from a jrm to a...
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.
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...
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 void get_dof_tuple_ids(poset_state_handle &xhost, size_type xi_size, block< pod_index_type > &result)
The dof tuple ids for an instance created with parameter xi_size.
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 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...
virtual void refine()
Inserts the standard refinement of this into its lower cover and changes this from a jim to a jrm...
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 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...
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...
void new_state(const size_type &xi_size, bool xauto_access=true)
Creates a new structured_block_1d state in host() with i_size() == xi_size and attaches this to it...
static scoped_index new_row_dof_map(poset_state_handle &xhost, size_type xi_size, bool xauto_access)
Creates a new row dof map and initializes it.
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.