21 #ifndef D_BIN_POINT_LOCATOR_IMPL_H 22 #define D_BIN_POINT_LOCATOR_IMPL_H 24 #ifndef SHEAF_DLL_SPEC_H 25 #include "SheafSystem/sheaf_dll_spec.h" 28 #ifndef D_BIN_POINT_LOCATOR_H 29 #include "SheafSystem/d_bin_point_locator.h" 32 #ifndef ASSERT_CONTRACT_H 33 #include "SheafSystem/assert_contract.h" 36 #ifndef CHART_POINT_3D_H 37 #include "SheafSystem/chart_point_3d.h" 40 #ifndef D_BIN_COORDINATES_H 41 #include "SheafSystem/d_bin_coordinates.h" 44 #ifndef EVAL_ITERATOR_H 45 #include "SheafSystem/eval_iterator.h" 48 #ifndef ERROR_MESSAGE_H 49 #include "SheafSystem/error_message.h" 52 #ifndef PREORDER_ITERATOR_H 53 #include "SheafSystem/preorder_iterator.h" 56 #ifndef SEC_AT1_SPACE_H 57 #include "SheafSystem/sec_at1_space.h" 61 #include "SheafSystem/sec_ed.h" 77 template <
int DC,
int DB>
81 _eval_itr(xcoords.schema(), false)
121 template <
int DC,
int DB>
138 template <
int DC,
int DB>
152 template <
int DC,
int DB>
166 ensure_for_all(i, 0,
dc(), result[i] > 0);
173 template <
int DC,
int DB>
195 template <
int DC,
int DB>
217 template <
int DC,
int DB>
233 ensure(result == (
box_ct() == 0));
241 template <
int DC,
int DB>
251 require(xpt_ub >=
dc());
268 template <
int DC,
int DB>
278 require(xpt_ub >=
dc());
289 for(
int i=0; i<DC; i++)
309 template <
int DC,
int DB>
327 ensure(
box_ct() == old_box_ct + 1);
334 template <
int DC,
int DB>
353 ensure(
box_ct() == old_box_ct - 1);
360 template <
int DC,
int DB>
368 require(xpt_ub >=
dc());
386 template <
int DC,
int DB>
409 template <
int DC,
int DB>
429 template <
int DC,
int DB>
440 template <
int DC,
int DB>
467 template <
int DC,
int DB>
472 #ifdef DIAGNOSTIC_OUTPUT 473 post_information_message(
"Entering update");
478 require(this->
coordinates().state_is_read_accessible());
490 #ifdef DIAGNOSTIC_OUTPUT 491 post_information_message(
"Leaving update");
497 template <
int DC,
int DB>
502 #ifdef DIAGNOSTIC_OUTPUT 503 post_information_message(
"Entering update(bool)");
515 require(this->
coordinates().state_is_read_accessible());
530 if(xeval_capacity < leval_ct)
532 xeval_capacity = leval_ct;
537 this->
_boxes.reserve(xeval_capacity);
603 levaluator.
min(dofs_ptr, dof_ct, gbl_pos, DC);
614 levaluator.
max(dofs_ptr, dof_ct, gbl_pos, DC);
663 #ifdef DIAGNOSTIC_OUTPUT 664 post_information_message(
"Leaving update");
670 template <
int DC,
int DB>
679 #ifdef DIAGNOSTIC_OUTPUT 680 post_information_message(
"Entering assign_box");
691 require(this->
coordinates().state_is_read_accessible());
692 require(xdofs_ct > 0);
715 dofs_ptr[i] = xdofs[i];
732 xeval.
min(dofs_ptr, xdofs_ct, gbl_pos, DC);
743 xeval.
max(dofs_ptr, xdofs_ct, gbl_pos, DC);
764 ensure(
box_ct() == old_box_ct);
767 ensure(result ==
box(xmbr_id.
pod()));
776 #ifdef DIAGNOSTIC_OUTPUT 777 post_information_message(
"Leaving assign_box");
783 template <
int DC,
int DB>
791 template <
int DC,
int DB>
796 #ifdef DIAGNOSTIC_OUTPUT 797 post_information_message(
"Entering box");
813 #ifdef DIAGNOSTIC_OUTPUT 814 post_information_message(
"Leaving box");
820 template <
int DC,
int DB>
825 #ifdef DIAGNOSTIC_OUTPUT 826 post_information_message(
"Entering update_box");
832 require(
box(xi)->evaluator() != 0);
833 require(
box(xi)->dof_ct() > 0);
834 require(xdofs_ct >=
box(xi)->dof_ct());
859 for(
size_type i=0; i<xdofs_ct; ++i, ++lptr)
871 leval.
min(xdofs, xdofs_ct, gbl_pos, DC);
875 leval.
max(xdofs, xdofs_ct, gbl_pos, DC);
890 #ifdef DIAGNOSTIC_OUTPUT 891 post_information_message(
"Leaving update_box");
897 template <
int DC,
int DB>
904 require(xvalue != 0);
905 require(xvalue_ub >= this->
dc());
906 require(xresult.
db() >= this->
db());
931 typename box_list_type::const_iterator iter;
981 ensure(unexecutable(xresult.
is_valid() ?
982 xresult.chart() contains xvalue at xresult.
local_coord() :
983 no chart contains xvalue));
991 template <
int DC,
int DB>
998 #ifdef DIAGNOSTIC_OUTPUT 999 post_information_message(
"Entering all_points_at_value");
1002 require(xvalue != 0);
1003 require(xvalue_ub >= this->
dc());
1004 require(this->
db() <= 3);
1012 define_old_variable(
int old_xresult_ct = xresult.
ct());
1028 typename box_list_type::const_iterator iter;
1030 for(iter = blist.
begin(); iter != blist.
end(); ++iter)
1048 lchart_pt.local_coords(),
1057 lchart_pt.put_chart_id(bbox->
member_id());
1075 #ifdef DIAGNOSTIC_OUTPUT 1076 cout <<
"result: " << xresult << endl;
1081 ensure_for_all(i, 0, xresult.
ct(), xresult[i].is_valid());
1086 #ifdef DIAGNOSTIC_OUTPUT 1088 post_information_message(
"Leaving all_points_at_value");
1094 template <
int DC,
int DB>
1101 #ifdef DIAGNOSTIC_OUTPUT 1102 post_information_message(
"Entering branch_points_at_value");
1105 require(xvalue != 0);
1106 require(xvalue_ub >= this->
dc());
1107 require(this->
dc() <= 3);
1111 define_old_variable(
int old_xresult_ct = xresult.
ct());
1133 typename box_list_type::const_iterator iter;
1135 for(iter = blist.
begin(); iter != blist.
end(); ++iter)
1139 #ifdef DIAGNOSTIC_OUTPUT 1141 cout <<
"considering " << *bbox << endl;
1150 #ifdef DIAGNOSTIC_OUTPUT 1151 cout <<
"Inverting it ... ";
1176 #ifdef DIAGNOSTIC_OUTPUT 1177 cout <<
"valid" << endl;
1191 #ifdef DIAGNOSTIC_OUTPUT 1192 cout <<
"invalid" << endl;
1199 #ifdef DIAGNOSTIC_OUTPUT 1200 cout <<
"Ignoring it" << endl;
1218 #ifdef DIAGNOSTIC_OUTPUT 1220 cout <<
"result: " << xresult << endl;
1225 ensure(xresult.
ct() >= old_xresult_ct);
1226 ensure_for_all(i, old_xresult_ct, xresult.
ct(),
1228 ensure_for_all(i, old_xresult_ct, xresult.
ct(), xresult[i].second.is_valid());
1233 #ifdef DIAGNOSTIC_OUTPUT 1235 post_information_message(
"Leaving branch_points_at_value");
1248 #endif // D_BIN_POINT_LOCATOR_IMPL_H std::set< stl_scoped_index<> > _branches
The branches for which a point has already been found for the current evaluation member. Used in all_points_at_value, allocated her to avoid reallocation for each query.
virtual void remove_box(d_bounding_box< DC, DB > *xbox)=0
Remove xbox from the search structure.
virtual void branch_points_at_value(const sec_vd_value_type *xvalue, size_type xvalue_ub, block< branch_point_pair > &xresult)
Finds one chart point in each branch at which coordinates() has value xvalue and appends them to xres...
void truncate()
Makes this the next member of the subset which is not less than old this, i.e. the depth-first descen...
const block< sec_vd_value_type > & bin_size() const
The dimensions of the smallest bins.
virtual void update()
Updates the search structure to the current values of coordinates(); synonym for update(true);.
size_type ct() const
The number of items currently in use.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
sec_ed & coordinates() const
The coordinate section this inverts.
const scoped_index & member_id() const
Index of the evaluation member this bounds.
void put_lb(const d_bin_coordinates< DC, DB > &xlb)
Copies the contents of xlb to lb().
section_evaluator & evaluator()
The section evaluator associated with the current evaluation member (mutable version).
block< sec_vd_value_type > _one_over_min_bin_size
Reciprocal of the dimensions of the smallest bins.
A point in a 3D chart space.
size_type box_capacity()
The number of boxes that have been allocated.
bool is_empty() const
True if this contains no bounding boxes.
d_bounding_box< DC, DB > * box(pod_index_type xi)
The xi-th bounding box.
virtual void force_is_done()
Force the iterator to be done.
virtual int db() const =0
The dimension of this chart.
void put_dof_ct(size_type xct)
Sets dof_ct() to xct.
virtual int db() const
The dimension of this chart.
eval_iterator _eval_itr
The evaluator iterator used to populate the search structure; must have same life time as the search ...
void force_item(index_type xindex, const_reference_type xitem)
Puts the item xitem at index xindex, resizing if necessary; any other new storage allocated is uninit...
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
point_locator()
Default constructor.
void put_chart_id(pod_index_type xchart)
Sets chart_id() to xchart_id.
void update_domain()
Initializes the domain bounds and dimension.
virtual ~d_bin_point_locator()
Destructor.
host_type * host() const
The poset this is a member of.
const scoped_index & index() const
The index of the component state this handle is attached to.
iterator begin()
Returns an iterator to the first element of the container.
Fixed point relative coordinates for a tree domain.
virtual bool in_standard_domain(const dof_type xlocal_coords[], size_type xlocal_coords_ub) const =0
True if the specified local coordinates are in the "standard" domain.
bool is_valid() const
True if this ia a valid point in a chart.
A section of a fiber bundle with a d-dimensional Euclidean vector space fiber.
void update_box(pod_index_type xi, const sec_vd_dof_type *xdofs, size_type xdofs_ct)
Updates the xi-th bounding box with dofs xdofs.
std::pair< scoped_index, chart_point_3d > branch_point_pair
A point in base space paired with a branch in section space.
void invalidate()
Makes this invalid.
virtual void clear()=0
Clear the search structure of all bounding boxes.
const bool NOT_STRICT
Iteration strictness control.
const bool DOWN
Iteration directions.
bool contains_point(const d_bin_coordinates< DC, DB > &xpt) const
True if this contains point xpt.
virtual coord_type * local_coords()=0
The array of local coordinates.
size_type dof_ct() const
The number of dofs in the gathered dofs array for the evaluation member this bounds.
block< sec_vd_value_type > _lb
The lower bound of the domain.
void push_back(const_reference_type item)
Insert item at the end of the items in the auto_block.
virtual dof_type max(const dof_type xdofs[], size_type xdofs_ub) const
The maximum value of the scalar or component section defined by xdofs.
block< d_bounding_box< DC, DB > > _boxes
Bounding boxes for the evaluation members.
size_type dofs_index() const
Index into the gathered dofs array for the evaluation member this bounds.
block< size_type > _bin_ub
The upper bound for the bin index.
virtual const box_list_type & box_list(sec_vd_value_type *xpt, size_type xpt_ub) const =0
The list of bounding boxes which may contain xpt.
pointer_type base() const
The underlying storage array.
void put_schema_anchor(const section_space_schema_member &xschema_anchor)
Set schema_anchor() to the same state as xschema_anchor.
void set_ct(size_type xct)
Sets ct() == xct.
void put_member_id(const scoped_index &xid)
Sets member_id() to xid.
An index within the external ("client") scope of a given id space.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
A bounding box that can be strung together into a list.
virtual void coord_at_value(const dof_type xdofs[], size_type xdofs_ub, const dof_type xvalue[], size_type xvalue_ub, dof_type xlocal_coords[], size_type xlocal_coords_ub) const =0
The local coordinates of a point at which the field has the value xvalue. The dofs are assumed to be ...
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. ...
void put_dofs_index(size_type xindex)
Sets dofs_index() to xindex.
virtual bool contains_box(d_bounding_box< DC, DB > *xbox) const =0
True if xbox is in the box list of some bin.
void next()
Makes this the next member of the subset.
d_bin_coordinates< DC, DB > * relative_position(sec_vd_value_type *xpt, size_type xpt_ub) const
The position of xpt relative to the lower bound, in integer coordinates; auto-allocated version...
iterator end()
Returns an iterator to the element following the last element of the container.
size_type box_ct() const
The number of bounding boxes stored in the search structure.
virtual void insert_box(d_bounding_box< DC, DB > *xbox)=0
Insert xbox into the search structure.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
coord_type * local_coords()
The array of local coordinates.
A section of a fiber bundle with a d-dimensional vector space fiber.
section_evaluator * evaluator() const
Evaluator for the evaluation member this bounds.
bool is_done() const
True if iteration finished.
void detach_from_state()
Detaches field from state it is currently attached to.
virtual void update_bins()=0
Updates the bin parameters.
virtual void all_points_at_value(const sec_vd_value_type *xvalue, size_type xvalue_ub, block< chart_point_3d > &xresult)
Finds all chart points at which coordinates() has value xvalue and appends them to xresult...
void put_evaluator(section_evaluator *xevaluator)
Sets evaluator() to xevaluator.
int db() const
The intrinsic dimension of the domain; the dimension of the local coordinates.
virtual void reset(bool xreset_markers=true)
Restarts the iteration over the down set of anchor().
virtual dof_type min(const dof_type xdofs[], size_type xdofs_ub) const
The minimum value of the scalar or component section defined by xdofs.
void relative_position_pa(sec_vd_value_type *xpt, size_type xpt_ub, d_bin_coordinates< DC, DB > &xresult) const
The position of xpt relative to the lower bound, in integer coordinates; pre-allocated version...
size_type _box_ct
The number of bounding boxes stored in the search structure.
void put_ub(const d_bin_coordinates< DC, DB > &xub)
Copies the contents of xub to ub().
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
const block< size_type > & bin_ub() const
The upper bound for the bin index.
d_bounding_box< DC, DB > * assign_box(const scoped_index &xmbr_id, const scoped_index &xbranch_id, section_evaluator &xeval, const sec_vd_dof_type *xdofs, size_type xdofs_ct)
Assigns a box to xmbr_id and initializes it, but does not insert it in the search structure...
int_type pod_index_type
The plain old data index type.
int dc() const
The spatial dimension of the domain; the dimension of the global coordinates.
const scoped_index & branch_id() const
Index of the branch that contains the evaluation member this bounds.
int evaluation_ct() const
The number of members in the intersection of the evaluation subposet and the down set of the base spa...
void gather_dofs(const sec_vd &xsec, block< sec_vd::dof_type > &xdofs)
Gathers the dofs for the current evalaution member from section xsec and appends them to the back of ...
virtual void point_at_value(const sec_vd_value_type *xvalue, size_type xvalue_ub, chart_point &xresult)
Finds a chart point at which coordinates() has value xvalue.
const block< sec_vd_dof_type > & gathered_dofs() const
The dofs of gathered by evaluation member.
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
void put_branch_id(const scoped_index &xid)
Sets branch_id() to xid.
double sec_vd_dof_type
The type of degree of freedom in the section space.
block< scoped_index > & discretization_members()
The discretization members in the downset of the current evaluation member (mutable version)...
virtual bool invariant() const
Class invariant.
Namespace for geometry component of sheaf system.
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
bool domain_contains(sec_vd_value_type *xpt, size_type xpt_ub) const
True if the domain contains xpt.
block< sec_vd_dof_type > _gathered_dofs
The dofs of gathered by evaluation member.
block< sec_vd_value_type > _bin_size
The dimensions of the smallest bins.
virtual coord_type local_coord(int xi) const =0
The xi-th local coordinate of this point.
Wrapper class for forward_list or slist depending on compiler. The class replicates the minimum subse...
An abstract point location query in domains with global coordinate dimension dc and local coordinate ...
const scoped_index & index() const
The index of the current member of the iteration.
d_bin_point_locator()
Default constructor; disabled.