SheafSystem  0.0.0.0
d_array_point_locator.h
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #ifndef D_ARRAY_POINT_LOCATOR_H
22 #define D_ARRAY_POINT_LOCATOR_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef D_BIN_POINT_LOCATOR_H
29 #include "SheafSystem/d_bin_point_locator.h"
30 #endif
31 
32 namespace geometry
33 {
34 
35 template <int DC, int DB>
36 class d_bounding_box;
37 
44 template <int DC, int DB>
45 class SHEAF_DLL_SPEC d_array_point_locator : public d_bin_point_locator<DC, DB>
46 {
47 
48  // ===========================================================
50  // ===========================================================
52 
53 public:
54 
59 
63  typedef std::set<const d_bounding_box<DC, DB>*> box_set_type;
64 
68  virtual void insert_box(d_bounding_box<DC, DB>* xbox);
69 
73  virtual void remove_box(d_bounding_box<DC, DB>* xbox);
74 
76 
80  virtual const box_list_type& box_list(sec_vd_value_type* xpt,
81  size_type xpt_ub) const;
82 
86  virtual void box_list(const section_evaluator& xeval,
87  sec_vd_value_type* xdofs,
88  size_type xdofs_ub,
89  box_list_type& xresult) const;
90 
94  virtual void box_list(d_bounding_box<DC, DB>* xbox, box_set_type& xresult) const;
95 
99  virtual bool contains_box(d_bounding_box<DC, DB>* xbox) const;
100 
104  virtual void clear();
105 
107 
108 
109  // ===========================================================
111  // ===========================================================
113 
118  d_array_point_locator(sec_ed& xcoords,
119  const block<size_type>& xbin_ub,
120  bool xpopulate = true,
121  size_type xeval_capacity = 256);
122 
128  d_array_point_locator(sec_ed& xcoords,
129  bool xpopulate = true,
130  size_type xeval_capacity = 256);
131 
135  virtual ~d_array_point_locator();
136 
140  size_type size() const;
141 
145  size_type capacity() const;
146 
150  void to_stream(std::ostream& xos) const;
151 
152 protected:
153 
158 
163 
167  virtual d_array_point_locator& operator=(const point_locator& xother) {return *this;};
168 
172  d_array_point_locator& operator=(const d_array_point_locator& xother) {return *this;};
173 
178  void update_bins();
179 
184 
188  size_type bin_id(const d_bin_coordinates<DC, DB>& xcoord) const;
189 
193  size_type bin_id(const block<size_type>& xid) const;
194 
198  size_type bin_id(size_type xi, size_type xj) const;
199 
203  size_type bin_id(size_type xi, size_type xj, size_type xk) const;
204 
206 
207 
208  // ===========================================================
210  // ===========================================================
212 
213 public:
214 
218  virtual bool invariant() const;
219 
221 
222 };
223 
224 
225 // ===========================================================
226 // NON-MEMBER FUNCTIONS
227 // ===========================================================
228 
232 template <int DC, int DB>
233 SHEAF_DLL_SPEC
234 std::ostream&
235 operator << (std::ostream& xos, const d_array_point_locator<DC, DB>& xpl);
236 
240 template <int DC, int DB>
241 SHEAF_DLL_SPEC
242 std::ostream&
243 operator << (std::ostream& xos, const singly_linked_list<const d_bounding_box<DC, DB>*>& xbl);
244 
245 
246 // ============================================================================
247 // SPECIALIZATIONS
248 // ============================================================================
249 
250 //
251 // Insert xbox into this;
252 // DC = 1, DB = 1 specialization.
253 //
254 template <>
255 SHEAF_DLL_SPEC
256 void
259 
260 //
261 // Insert xbox into this;
262 // DC = 2, DB = 2 specialization.
263 //
264 template <>
265 SHEAF_DLL_SPEC
266 void
269 
270 //
271 // Insert xbox into this;
272 // DC = 3, DB = 1 specialization.
273 //
274 template <>
275 SHEAF_DLL_SPEC
276 void
279 
280 //
281 // Insert xbox into this;
282 // DC = 3, DB = 2 specialization.
283 //
284 template <>
285 SHEAF_DLL_SPEC
286 void
289 
290 //
291 // Insert xbox into this;
292 // DC = 3, DB = 3 specialization.
293 //
294 template <>
295 SHEAF_DLL_SPEC
296 void
299 
300 //
301 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
302 // DC = 1, DB = 1 specialization
303 //
304 template <>
305 SHEAF_DLL_SPEC
306 void
308 box_list(const section_evaluator& xeval, sec_vd_value_type* xdofs, size_type xdofs_ub, box_list_type& xresult) const;
309 
310 //
311 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
312 // DC = 2, DB = 2 specialization.
313 //
314 template <>
315 SHEAF_DLL_SPEC
316 void
318 box_list(const section_evaluator& xeval, sec_vd_value_type* xdofs, size_type xdofs_ub, box_list_type& xresult) const;
319 
320 //
321 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
322 // DC = 3, DB = 1 specialization.
323 //
324 template <>
325 SHEAF_DLL_SPEC
326 void
328 box_list(const section_evaluator& xeval, sec_vd_value_type* xdofs, size_type xdofs_ub, box_list_type& xresult) const;
329 
330 //
331 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
332 // DC = 3, DB = 2 specialization.
333 //
334 template <>
335 SHEAF_DLL_SPEC
336 void
338 box_list(const section_evaluator& xeval, sec_vd_value_type* xdofs, size_type xdofs_ub, box_list_type& xresult) const;
339 
340 //
341 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
342 // DC = 3, DB = 3 specialization.
343 //
344 template <>
345 SHEAF_DLL_SPEC
346 void
348 box_list(const section_evaluator& xeval, sec_vd_value_type* xdofs, size_type xdofs_ub, box_list_type& xresult) const;
349 
350 //
351 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
352 // DC = 1, DB = 1 specialization
353 //
354 template <>
355 SHEAF_DLL_SPEC
356 void
358 box_list(d_bounding_box<1, 1>* xbox, box_set_type& xresult) const;
359 
360 //
361 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
362 // DC = 2, DB = 2 specialization.
363 //
364 template <>
365 SHEAF_DLL_SPEC
366 void
368 box_list(d_bounding_box<2, 2>* xbox, box_set_type& xresult) const;
369 
370 //
371 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
372 // DC = 3, DB = 1 specialization.
373 //
374 template <>
375 SHEAF_DLL_SPEC
376 void
378 box_list(d_bounding_box<3, 1>* xbox, box_set_type& xresult) const;
379 
380 //
381 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
382 // DC = 3, DB = 2 specialization.
383 //
384 template <>
385 SHEAF_DLL_SPEC
386 void
388 box_list(d_bounding_box<3, 2>* xbox, box_set_type& xresult) const;
389 
390 //
391 // Get list of boxes possibly overlapping the cell described by xeval, xdofs;
392 // DC = 3, DB = 3 specialization.
393 //
394 template <>
395 SHEAF_DLL_SPEC
396 void
398 box_list(d_bounding_box<3, 3>* xbox, box_set_type& xresult) const;
399 
400 //
401 // Remove xbox from this;
402 // DC = 1, DB = 1 specialization
403 //
404 template <>
405 SHEAF_DLL_SPEC
406 void
409 
410 //
411 // Remove xbox from this;
412 // DC = 2, DB = 2 specialization
413 //
414 template <>
415 SHEAF_DLL_SPEC
416 void
419 
420 //
421 // Remove xbox from this;
422 // DC = 3, DB = 1 specialization
423 //
424 template <>
425 SHEAF_DLL_SPEC
426 void
429 
430 //
431 // Remove xbox from this;
432 // DC = 3, DB = 2 specialization
433 //
434 template <>
435 SHEAF_DLL_SPEC
436 void
439 
440 //
441 // Remove xbox from this;
442 // DC = 3, DB = 3 specialization
443 //
444 template <>
445 SHEAF_DLL_SPEC
446 void
449 
454 template <>
455 SHEAF_DLL_SPEC
456 size_type
458 bin_id(const d_bin_coordinates<1, 1>& xcoord) const;
459 
464 template <>
465 SHEAF_DLL_SPEC
466 size_type
468 bin_id(const d_bin_coordinates<2, 2>& xcoord) const;
469 
474 template <>
475 SHEAF_DLL_SPEC
476 size_type
478 bin_id(const d_bin_coordinates<3, 1>& xcoord) const;
479 
484 template <>
485 SHEAF_DLL_SPEC
486 size_type
488 bin_id(const d_bin_coordinates<3, 2>& xcoord) const;
489 
494 template <>
495 SHEAF_DLL_SPEC
496 size_type
498 bin_id(const d_bin_coordinates<3, 3>& xcoord) const;
499 
504 template <>
505 SHEAF_DLL_SPEC
506 size_type
508 bin_id(const block<size_type>& xid) const;
509 
514 template <>
515 SHEAF_DLL_SPEC
516 size_type
518 bin_id(const block<size_type>& xid) const;
519 
524 template <>
525 SHEAF_DLL_SPEC
526 size_type
528 bin_id(const block<size_type>& xid) const;
529 
534 template <>
535 SHEAF_DLL_SPEC
536 size_type
538 bin_id(const block<size_type>& xid) const;
539 
544 template <>
545 SHEAF_DLL_SPEC
546 size_type
548 bin_id(const block<size_type>& xid) const;
549 
550 
551 }
552 
553 // namespace geometry/
554 
555 #endif // D_ARRAY_POINT_LOCATOR_H
singly_linked_list< const d_bounding_box< DC, DB > * > box_list_type
The type of box list.
d_array_point_locator(const d_array_point_locator &xother)
Copy constructor; disabled.
d_array_point_locator & operator=(const d_array_point_locator &xother)
Assignment operator; disabled.
Fixed point relative coordinates for a tree domain.
virtual void insert_box(d_bounding_box< DC, DB > *xbox)
Insert xbox into this.
block< box_list_type > _bins
The search structure; a d-dimensional array of bins.
A section of a fiber bundle with a d-dimensional Euclidean vector space fiber.
Definition: sec_ed.h:47
d_array_point_locator()
Default constructor; disabled.
size_type bin_id(const d_bin_coordinates< DC, DB > &xcoord) const
The single index (offset) associated with tree coordinates xcoord.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
A bounding box that can be strung together into a list.
An abstract local section evaluator; a map from {local coordinates x dofs} to section value...
virtual const box_list_type & box_list(sec_vd_value_type *xpt, size_type xpt_ub) const
The list of bounding boxes which may contain xpt.
virtual d_array_point_locator & operator=(const point_locator &xother)
Assignment operator; disabled.
std::set< const d_bounding_box< DC, DB > * > box_set_type
The type of box set.
virtual void remove_box(d_bounding_box< DC, DB > *xbox)
Remove xbox from this.
Namespace for geometry component of sheaf system.
Definition: field_vd.h:54
vd_value_type sec_vd_value_type
The type of component in the value of a section at a point.
Definition: fiber_bundle.h:73
An abstract point location query in domains with global coordinate dimension dc and local coordinate ...
Wrapper class for forward_list or slist depending on compiler. The class replicates the minimum subse...
A point location query in domains with global coordinate dimension DC and local coordinate dimension ...
An abstract point location query in domains with global coordinate dimension dc and local coordinate ...
Definition: point_locator.h:52