OOFEM 3.0
Loading...
Searching...
No Matches
octreelocalizert.h
Go to the documentation of this file.
1/*
2 *
3 * ##### ##### ###### ###### ### ###
4 * ## ## ## ## ## ## ## ### ##
5 * ## ## ## ## #### #### ## # ##
6 * ## ## ## ## ## ## ## ##
7 * ## ## ## ## ## ## ## ##
8 * ##### ##### ## ###### ## ##
9 *
10 *
11 * OOFEM : Object Oriented Finite Element Code
12 *
13 * Copyright (C) 1993 - 2025 Borek Patzak
14 *
15 *
16 *
17 * Czech Technical University, Faculty of Civil Engineering,
18 * Department of Structural Mechanics, 166 29 Prague, Czech Republic
19 *
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License as published by the Free Software Foundation; either
23 * version 2.1 of the License, or (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 * Lesser General Public License for more details.
29 *
30 * You should have received a copy of the GNU Lesser General Public
31 * License along with this library; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35// **************************************
36// *** CLASS OCTREE SPATIAL LOCALIZER ***
37// **************************************
38//
39// Generic templated Octree localizer
40
41#ifndef octreelocalizert_h
42#define octreelocalizert_h
43
44#include "spatiallocalizer.h"
45#include "octreelocalizer.h"
46#include "dofmanager.h"
47#include "node.h"
48#include "element.h"
49#include "mathfem.h"
50#include "timer.h"
51
52#include <set>
53#include <list>
54
55namespace oofem {
56class Domain;
57class Element;
58class TimeStep;
59class DofManager;
60class IntArray;
61
62template< class T >class OctreeSpatialLocalizerT;
63
64
65#define TEMPLATED_OCTREE_MAX_NODES_LIMIT 500
66
67#define TEMPLATED_OCTREE_MAX_DEPTH 8
68
69//#define TEMPLATED_OCTREE_DEBUG
70
73
80{
81protected:
85 double size;
88
89public:
92
95
97 void setOrigin(FloatArray &coords)
98 {
99 origin.resize( coords.giveSize() );
100 for ( int i = 1; i <= coords.giveSize(); i++ ) {
101 origin.at(i) = coords.at(i);
102 }
103 }
104
106 void setSize(double s) { size = s; }
108 void setMask(int i, int mask) { spatialMask.at(i) = mask; }
113 void giveOrigin(FloatArray &answer) { answer = this->origin; }
115 double giveSize() { return size; }
120 void giveMask(IntArray &answer) { answer = this->spatialMask; }
124 void init (FloatArray& _origin, double _size, IntArray &mask)
125 {
126 this->origin = _origin;
127 this->size = _size;
128 this->spatialMask = mask;
129 }
130 bool contains(const FloatArray& coords) const
131 {
132 for ( int i = 1; i <= coords.giveSize(); i++ ) {
133 if ( spatialMask.at(i) ) {
134 if ( coords.at(i) < this->origin.at(i) ) {
135 return 0;
136 }
137
138 if ( coords.at(i) > ( this->origin.at(i) + this->size ) ) {
139 return 0;
140 }
141 }
142 }
143
144 return 1;
145 }
146};
147
153template< class T >
155{
156public:
159 typedef typename std :: list< T > :: iterator listIteratorType;
160
161protected:
167 CellPtrType child [ 2 ] [ 2 ] [ 2 ];
171 double size;
172
174 std :: list< T > *dataList;
175
176public:
177
180 {
181 this->localizer = loc;
182 this->parent = parent;
183 this->origin = origin;
184 this->size = size;
185 this->dataList = NULL;
186
187
188 for ( int i = 0; i <= 1; i++ ) {
189 for ( int j = 0; j <= 1; j++ ) {
190 for ( int k = 0; k <= 1; k++ ) {
191 this->child [ i ] [ j ] [ k ] = NULL;
192 }
193 }
194 }
195 }
196
198 {
199 for ( int i = 0; i <= 1; i++ ) {
200 for ( int j = 0; j <= 1; j++ ) {
201 for ( int k = 0; k <= 1; k++ ) {
202 if ( this->child [ i ] [ j ] [ k ] ) {
203 delete this->child [ i ] [ j ] [ k ];
204 }
205 }
206 }
207 }
208
209 if ( dataList ) {
210 delete dataList;
211 }
212 }
213
215 CellPtrType giveParent() { return this->parent; }
220 void giveOrigin(FloatArray &answer) { answer = this->origin; }
222 double giveSize() { return this->size; }
227 int containsPoint(const FloatArray &coords) {
228 for ( int i = 1; i <= coords.giveSize(); i++ ) {
229 if ( localizer->giveOctreeMaskValue(i) ) {
230 if ( coords.at(i) < this->origin.at(i) ) {
231 return 0;
232 }
233
234 if ( coords.at(i) > ( this->origin.at(i) + this->size ) ) {
235 return 0;
236 }
237 }
238 }
239
240 return 1;
241 }
242
249 CellPtrType giveChild(int xi, int yi, int zi) {
250 if ( ( xi >= 0 ) && ( xi < 2 ) && ( yi >= 0 ) && ( yi < 2 ) && ( zi >= 0 ) && ( zi < 2 ) ) {
251 return this->child [ xi ] [ yi ] [ zi ];
252 } else {
253 OOFEM_ERROR("OctantRecT::giveChild invalid child index (%d,%d,%d)", xi, yi, zi);
254 }
255 }
256
268 IntArray ind(3);
269 if ( this->containsPoint(coords) ) {
270 if ( this->isTerminalOctant() ) {
271 * child = NULL;
272 return -1;
273 }
274
275 for ( int i = 1; i <= coords.giveSize(); i++ ) {
276 if ( localizer->giveOctreeMaskValue(i) && ( coords.at(i) > ( this->origin.at(i) + this->size / 2. ) ) ) {
277 ind.at(i) = 1;
278 } else {
279 ind.at(i) = 0;
280 }
281 }
282
283 * child = this->child [ ind.at(1) ] [ ind.at(2) ] [ ind.at(3) ];
284 return 1;
285 } else {
286 * child = NULL;
287 return -2;
288 }
289 }
290
293 {
294 if ( this->child [ 0 ] [ 0 ] [ 0 ] ) {
295 return 0;
296 }
297
298 return 1;
299 }
300
306 int divideLocally(int level, const IntArray &octantMask)
307 {
308 int i, j, k, result = 1;
309
310 if ( this->isTerminalOctant() ) {
311 // create corresponding child octants
312 FloatArray childOrigin(3);
313
314 for ( i = 0; i <= octantMask.at(1); i++ ) {
315 for ( j = 0; j <= octantMask.at(2); j++ ) {
316 for ( k = 0; k <= octantMask.at(3); k++ ) {
317 childOrigin.at(1) = this->origin.at(1) + i * ( this->size / 2. );
318 childOrigin.at(2) = this->origin.at(2) + j * ( this->size / 2. );
319 childOrigin.at(3) = this->origin.at(3) + k * ( this->size / 2. );
320
321 this->child [ i ] [ j ] [ k ] = new OctantRecT(localizer, this, childOrigin, this->size / 2.0);
322 }
323 }
324 }
325 }
326
327 int newLevel = level - 1;
328 if ( newLevel > 0 ) {
329 // propagate message to childs recursivelly with level param decreased
330 for ( i = 0; i <= octantMask.at(1); i++ ) {
331 for ( j = 0; j <= octantMask.at(2); j++ ) {
332 for ( k = 0; k <= octantMask.at(3); k++ ) {
333 if ( this->child [ i ] [ j ] [ k ] ) {
334 result &= this->child [ i ] [ j ] [ k ]->divideLocally(newLevel, octantMask);
335 }
336 }
337 }
338 }
339 }
340
341 return result;
342 }
343
349 OctantRec :: BoundingBoxStatus testBoundingBox(BoundingBox &A)
350 {
351 double aSize = A.giveSize();
352 FloatArray sA,eA;
353 A.giveOrigin(sA);
354 eA = sA;
355 eA.add(aSize);
356
357 bool sAInside = this->containsPoint(sA);
358 bool eAInside = this->containsPoint(eA);
359 if (sAInside && eAInside) {
360 return OctantRec :: BBS_InsideCell;
361 } else if (sAInside || eAInside) {
362 return OctantRec :: BBS_ContainsCell;
363 } else {
364 return OctantRec :: BBS_OutsideCell;
365 }
366 }
367
375 {
376 int i, test = 1, nsd, size = coords.giveSize();
377 double dist;
378
379 nsd = localizer->giveOctreeMaskValue(1) + localizer->giveOctreeMaskValue(2) + localizer->giveOctreeMaskValue(3);
380
381 FloatArray cellCenter = this->origin;
382 double cellRadius = sqrt( nsd * ( this->size / 2.0 ) * ( this->size / 2. ) );
383 for ( i = 1; i < 4; i++ ) {
384 cellCenter.at(i) += this->size / 2.0;
385 }
386
387 for ( i = 1, dist = 0.0; i <= size; i++ ) {
388 if ( localizer->giveOctreeMaskValue(i) ) {
389 dist += ( cellCenter.at(i) - coords.at(i) ) * ( cellCenter.at(i) - coords.at(i) );
390 }
391 }
392
393 dist = sqrt(dist);
394 if ( dist > ( cellRadius + radius ) ) {
395 return SphereOutsideCell;
396 }
397
398 int centerInside = this->containsPoint(coords);
399 if ( centerInside ) { // test if whole bsphere inside
400 for ( i = 1; i <= size; i++ ) {
401 if ( localizer->giveOctreeMaskValue(i) ) {
402 if ( ( this->origin.at(i) > ( coords.at(i) - radius ) ) || ( ( this->origin.at(i) + this->size ) < ( coords.at(i) + radius ) ) ) {
403 test = 0;
404 }
405 }
406 }
407
408 if ( test ) {
409 return SphereInsideCell;
410 } else {
411 return SphereContainsCell;
412 }
413 } else { // BSphere center not inside cell, but may hit cell
414 // test if bounding sphere hits boundary surface
415 int inBounds = 1;
416 for ( i = 1; i <= size; i++ ) {
417 if ( localizer->giveOctreeMaskValue(i) && ( fabs( cellCenter.at(i) - coords.at(i) ) > ( this->size / 2. + radius ) ) ) {
418 inBounds = 0;
419 }
420 }
421
422 if ( inBounds ) {
423 return SphereContainsCell;
424 }
425 }
426
427 return SphereOutsideCell;
428 }
429
430
432 std :: list< T > *giveDataList() {
433 if ( dataList == NULL ) {
434 dataList = new std :: list< T >;
435 }
436
437 return dataList;
438 }
439
442 if ( dataList ) {
443 delete dataList;
444 dataList = NULL;
445 }
446 }
447
450 {
451 this->giveDataList()->push_front(member);
452 return this->giveDataList()->begin();
453 }
454
456 void removeMember(T &member) { this->giveDataList()->remove(member); }
457
458 friend class OctreeSpatialLocalizerT< T >;
459};
460
466template< class T >
480
481
482
488template< class T >class SL_Insertion_Functor
489{
490protected:
491 typedef typename std :: list< T > :: iterator listIteratorType;
492
493public:
495 virtual bool evaluate(T &member, OctantRecT< T > *cell) = 0;
497 virtual void registerInsertion(T &member, LocalInsertionData< T >LIdata) = 0;
499 virtual std :: list< LocalInsertionData< T > > *giveInsertionList(T &member) = 0;
500};
501
502
508template< class T >class SL_Evaluation_Functor
509{
510public:
512 virtual bool evaluate(T &obj) = 0;
514 virtual void giveStartingPosition(FloatArray &answer) = 0;
516 virtual void giveResult(std :: list< T > &answer) = 0;
517
520 virtual bool isBBXStage1Defined(BoundingBox &BBXStage1) = 0;
521
525 virtual bool isBBXStage2Defined(BoundingBox &BBXStage2) = 0;
526};
527
528
534template< class T >class OctreeSpatialLocalizerT
535{
536protected:
537
539 typedef std :: list< T >dataContainerType;
540 typedef typename std :: list< T > :: iterator listIteratorType;
541 typedef typename std :: list< T > :: const_iterator listConstIteratorType;
544 //Domain *domain;
546
547public:
550 rootCell = NULL;
551 maxDepthReached = 0;
552 }
553
555 if ( rootCell ) {
556 delete rootCell;
557 }
558 }
559
560 void clear () {
561 if (rootCell) delete rootCell;
562 rootCell = NULL;
563 octreeMask.zero();
564 }
565
566 int init(BoundingBox &BBX, int initialDivision = 0) {
567 if ( !rootCell ) {
568 FloatArray origin;
569 BBX.giveOrigin(origin);
570 this->rootCell = new OctantRecT< T >( this, NULL, origin, BBX.giveSize() );
571 BBX.giveMask(octreeMask);
572 if ( initialDivision ) {
573 this->rootCell->divideLocally(initialDivision, this->octreeMask);
574 }
575
576 return 1;
577 } else {
578 return 0;
579 }
580 }
581
584 {
585 int result = 0;
586
587 if ( functor.evaluate(memberID, rootCell) ) {
588 this->insertMemberIntoCell(memberID, functor, rootCell);
589 result = 1;
590 }
591
592 return result;
593 }
594
597 {
598 this->removeMemberFromCell(memberID, functor, rootCell);
599 return 1;
600 }
601
603 void giveDataOnFilter(std :: list< T > &answer, SL_Evaluation_Functor< T > &filter)
604 {
605 typename std :: list< T > *cellDataList;
606
608 BoundingBox BBS1, BBS2;
609 typename std :: list< CellPtrType > *cellListPostSearch = NULL;
610 typename std :: list< CellPtrType > :: iterator cellListPos;
611
612
613 if ( filter.isBBXStage1Defined(BBS1) ) { }
614
615 CellPtrType terminal;
616 FloatArray startPos;
617 filter.giveStartingPosition(startPos);
618 terminal = this->findTerminalContaining(rootCell, startPos);
619
620 cellDataList = terminal->giveDataList();
621 for ( pos = cellDataList->begin(); pos != cellDataList->end(); ++pos ) {
622 filter.evaluate(* pos);
623 }
624
625 if ( filter.isBBXStage2Defined(BBS2) ) {
626 OctantRec :: BoundingBoxStatus BBStatus = terminal->testBoundingBox(BBS2);
627 if ( BBStatus == OctantRec :: BBS_ContainsCell ) {
628 giveListOfTerminalCellsInBoundingBox(* cellListPostSearch, BBS2, rootCell);
629 for ( cellListPos = cellListPostSearch->begin(); cellListPos != cellListPostSearch->end(); ++cellListPos ) {
630 if ( * cellListPos != terminal ) {
631 cellDataList = ( * cellListPos )->giveDataList();
632 for ( pos = cellDataList->begin(); pos != cellDataList->end(); ++pos ) {
633 filter.evaluate(* pos);
634 }
635 }
636 }
637 }
638 }
639
640 filter.giveResult(answer);
641 }
642
645 void proceedDataOnFilterAndRemoveFromOctree(std :: list< T > &answer, SL_Evaluation_Functor< T > &filter, SL_Insertion_Functor< T > &insertor, Timer &searchingTimer)
646 {
647 typename std :: list< T > *cellDataList;
648 listIteratorType pos, positionInDataList;
649 BoundingBox BBS1, BBS2;
650 std :: list< LocalInsertionData< T > > *insertionDataList;
651 typedef typename std :: list< LocalInsertionData< T > > :: iterator LIDiterator;
652
653 if ( filter.isBBXStage1Defined(BBS1) ) { }
654
655 CellPtrType terminal, cell;
656 FloatArray startingPosition;
657 filter.giveStartingPosition(startingPosition);
658 terminal = this->findTerminalContaining(rootCell, startingPosition);
659
660 cellDataList = terminal->giveDataList();
661 for ( pos = cellDataList->begin(); pos != cellDataList->end(); ) {
662 T _obj = * pos;
663 bool ok = filter.evaluate(_obj);
664 if ( ok ) {
665 insertionDataList = insertor.giveInsertionList(_obj);
666 if ( insertionDataList ) {
667 for ( LIDiterator insDataIT = insertionDataList->begin(); insDataIT != insertionDataList->end(); insDataIT++ ) {
668 cell = ( * insDataIT ).containedInCell;
669 positionInDataList = ( * insDataIT ).posInCellDataList;
670 cell->giveDataList()->erase(positionInDataList);
671 }
672 } else {
673 // should not happen
674 removeMemberFromCell(_obj, insertor, terminal);
675 }
676
677 // actual iterator position might not be valid, so start from beginning
678 pos = cellDataList->begin();
679 } else {
680 pos++;
681 }
682 }
683
684 if ( filter.isBBXStage2Defined(BBS2) ) { }
685
686 filter.giveResult(answer);
687 }
688
689 const char *giveClassName() const { return "OctreeSpatialLocalizerT"; }
690 int giveOctreeMaskValue(int indx) { return octreeMask.at(indx); }
691 void giveOctreeMask(IntArray &answer) { answer = this->octreeMask; }
694 {
695 // compute max. tree depth
696 int treeDepth = 0;
697 this->giveMaxTreeDepthFrom(rootCell, treeDepth);
698
699 OOFEM_LOG_INFO("Octree structure [depth %d]\n", treeDepth);
700 }
701
702protected:
705 int result;
706 CellPtrType currCell = startCell;
707 if ( startCell->containsPoint(coords) ) {
708 // found terminal octant containing node
709 while ( !currCell->isTerminalOctant() ) {
710 result = currCell->giveChildContainingPoint(& currCell, coords);
711 if ( result == -2 ) {
712 // report some error
713 }
714 }
715
716 return currCell;
717 } else {
718 return NULL;
719 }
720 }
721
724 return ( int ) ( log( this->rootCell->giveSize() / cell->giveSize() ) / M_LN2 );
725 }
726
730 {
731 int i, j, k;
732 int nCellItems, cellDepth;
733 dataContainerType *cellDataList;
735 listIteratorType insertedPosition;
737 std :: list< LocalInsertionData< T > > *insData;
738 typedef typename std :: list< LocalInsertionData< T > > :: iterator LIDiterator;
739
740 if ( cell == NULL ) {
741 return 0;
742 }
743
744 if ( cell->isTerminalOctant() ) {
745 cellDataList = cell->giveDataList();
746 nCellItems = cellDataList->size();
747 cellDepth = this->giveCellDepth(cell);
748 if ( cellDepth > maxDepthReached ) {
749 maxDepthReached = cellDepth;
750#ifdef TEMPLATED_OCTREE_DEBUG
751 printf("Reached cell depth: %i \n", maxDepthReached);
752#endif
753 }
754
755 if ( ( nCellItems > TEMPLATED_OCTREE_MAX_NODES_LIMIT ) && ( cellDepth < TEMPLATED_OCTREE_MAX_DEPTH ) ) {
756 cell->divideLocally(1, this->octreeMask);
757
758
759#if 1 // more memory efficient implementation
760 while (!cellDataList->empty())
761 {
762 this->insertMemberIntoCell(cellDataList->back(), functor, cell);
763 insData = functor.giveInsertionList(cellDataList->back());
764 if ( insData ) {
765 for ( LIDiterator insDataIT = insData->begin(); insDataIT != insData->end(); ) {
766 if ( ( * insDataIT ).containedInCell == cell ) {
767 insDataIT = insData->erase(insDataIT);
768 } else {
769 insDataIT++;
770 }
771 }
772 }
773 cellDataList->pop_back();
774 }
775#else
776 for ( pos = cellDataList->begin(); pos != cellDataList->end(); ++pos ) {
777 this->insertMemberIntoCell(* pos, functor, cell);
778 insData = functor.giveInsertionList(* pos);
779 if ( insData ) {
780 for ( LIDiterator insDataIT = insData->begin(); insDataIT != insData->end(); ) {
781 if ( ( * insDataIT ).containedInCell == cell ) {
782 insDataIT = insData->erase(insDataIT);
783 } else {
784 insDataIT++;
785 }
786 }
787 }
788 }
789
790 cell->deleteDataList();
791#endif
792 this->insertMemberIntoCell(memberID, functor, cell);
793 } else { // insertion without refinement
794 insertedPosition = cell->addMember(memberID);
795 LIdata.containedInCell = cell;
796 LIdata.posInCellDataList = insertedPosition;
797
798 functor.registerInsertion(memberID, LIdata);
799 return 1;
800 }
801 } else { // not a terminal octant, visit children
802 CellPtrType cptr;
803 for ( i = 0; i <= 1; i++ ) {
804 for ( j = 0; j <= 1; j++ ) {
805 for ( k = 0; k <= 1; k++ ) {
806 cptr = cell->giveChild(i, j, k);
807 if ( cptr ) {
808 if ( functor.evaluate( memberID, cell->giveChild(i, j, k) ) ) {
809 this->insertMemberIntoCell( memberID, functor, cell->giveChild(i, j, k) );
810 }
811 }
812 }
813 }
814 }
815 }
816
817 return 1;
818 }
819
822 {
823 int i, j, k;
825
826 if ( cell ) {
827 if ( cell->isTerminalOctant() ) {
828 if ( functor.evaluate(memberID, cell) ) {
829 cell->removeMember(memberID);
830 return 1;
831 } else {
832 return 0;
833 }
834 } else {
835 for ( i = 0; i <= 1; i++ ) {
836 for ( j = 0; j <= 1; j++ ) {
837 for ( k = 0; k <= 1; k++ ) {
838 this->removeMemberFromCell( memberID, functor, cell->giveChild(i, j, k) );
839 }
840 }
841 }
842 }
843 }
844
845 return 1;
846 }
847
849 void giveMaxTreeDepthFrom(CellPtrType root, int &maxDepth)
850 {
851 int i, j, k, depth = this->giveCellDepth(root);
852 maxDepth = max(maxDepth, depth);
853
854 for ( i = 0; i <= octreeMask.at(1); i++ ) {
855 for ( j = 0; j <= octreeMask.at(2); j++ ) {
856 for ( k = 0; k <= octreeMask.at(3); k++ ) {
857 if ( root->giveChild(i, j, k) ) {
858 this->giveMaxTreeDepthFrom(root->giveChild(i, j, k), maxDepth);
859 }
860 }
861 }
862 }
863 }
864
866 void giveListOfTerminalCellsInBoundingBox(std :: list< CellPtrType > &cellList, BoundingBox &BBX, CellPtrType currentCell)
867 {
868 int i, j, k;
869 OctantRec :: BoundingBoxStatus BBStatus = currentCell->testBoundingBox(BBX);
870 if ( ( BBStatus == OctantRec :: BBS_InsideCell ) || ( BBStatus == OctantRec :: BBS_ContainsCell ) ) {
871 if ( currentCell->isTerminalOctant() ) {
872 cellList.push_back(currentCell);
873 } else {
874 for ( i = 0; i <= octreeMask.at(1); i++ ) {
875 for ( j = 0; j <= octreeMask.at(2); j++ ) {
876 for ( k = 0; k <= octreeMask.at(3); k++ ) {
877 if ( currentCell->giveChild(i, j, k) ) {
878 this->giveListOfTerminalCellsInBoundingBox( cellList, BBX, currentCell->giveChild(i, j, k) );
879 }
880 }
881 }
882 }
883 }
884 }
885 }
886
887 friend class OctantRecT< T >;
888};
889} // end namespace oofem
890#endif // octreelocalizer_h
double size
Bounding box size length.
BoundingBox()
Constructor.
void init(FloatArray &_origin, double _size, IntArray &mask)
void setMask(int i, int mask)
Sets the spatial mask.
bool contains(const FloatArray &coords) const
FloatArray origin
Starting point.
void giveOrigin(FloatArray &answer)
void setOrigin(FloatArray &coords)
Sets the origin of the bounding box.
void setSize(double s)
Sets the size of the bounding box (all sides are equal).
IntArray spatialMask
Spatial dimension mask.
void giveMask(IntArray &answer)
~BoundingBox()
Destructor.
double giveSize()
Gives the size of the bounding box.
double & at(Index i)
Definition floatarray.h:202
Index giveSize() const
Returns the size of receiver.
Definition floatarray.h:261
void add(const FloatArray &src)
Definition floatarray.C:218
int & at(std::size_t i)
Definition intarray.h:104
OctantRecT< T > * CellPtrType
std::list< T >::iterator listIteratorType
listIteratorType posInCellDataList
Iterator position in the list of cell objects.
OctantRecT< T > * containedInCell
Octant cell containing object.
OctantRecT< T > * CellPtrType
std::list< T >::iterator listIteratorType
double giveSize()
Gives the size of the cell.
void giveOrigin(FloatArray &answer)
OctreeSpatialLocalizerT< T > * LocalizerPtrType
friend class OctreeSpatialLocalizerT< T >
int giveChildContainingPoint(CellPtrType *child, const FloatArray &coords)
CellPtrType giveParent()
OctantRecT(LocalizerPtrType loc, CellPtrType parent, FloatArray &origin, double size)
Constructor.
int divideLocally(int level, const IntArray &octantMask)
CellPtrType giveChild(int xi, int yi, int zi)
~OctantRecT()
Destructor.
CellPtrType child[2][2][2]
OctantRec::BoundingBoxStatus testBoundingBox(BoundingBox &A)
void deleteDataList()
Removes the data list.
int containsPoint(const FloatArray &coords)
std ::list< T > * giveDataList()
Return reference to member List.
boundingSphereStatus testBoundingSphere(const FloatArray &coords, double radius)
listIteratorType addMember(T &member)
Adds the object in to the data list returning iterator position to the object in the list.
void removeMember(T &member)
Removes member from data list.
void giveDataOnFilter(std ::list< T > &answer, SL_Evaluation_Functor< T > &filter)
Evalutes the search accoring used functor a fills the list with results - NOT IN USE.
int insertMemberIntoOctree(T &memberID, SL_Insertion_Functor< T > &functor)
Inserts member into the octree using functor for the evaluation.
void giveOctreeMask(IntArray &answer)
const char * giveClassName() const
CellPtrType findTerminalContaining(CellPtrType startCell, const FloatArray &coords)
Returns terminal octant cell containing node with coords.
int removeMemberFromOctree(T &memberID, SL_Insertion_Functor< T > &functor)
Removes member from octree using insertion functor - NOT IN USE.
int insertMemberIntoCell(T &memberID, SL_Insertion_Functor< T > &functor, CellPtrType cell)
std::list< T >::iterator listIteratorType
int giveCellDepth(CellPtrType cell)
Returns the depth of the cell.
void proceedDataOnFilterAndRemoveFromOctree(std ::list< T > &answer, SL_Evaluation_Functor< T > &filter, SL_Insertion_Functor< T > &insertor, Timer &searchingTimer)
void giveMaxTreeDepthFrom(CellPtrType root, int &maxDepth)
Gives the maximal tree depth from given cell.
void giveListOfTerminalCellsInBoundingBox(std ::list< CellPtrType > &cellList, BoundingBox &BBX, CellPtrType currentCell)
Gives a list of terminal cells in a bounding box.
int removeMemberFromCell(T &memberID, SL_Insertion_Functor< T > &functor, CellPtrType cell)
Removes member from cell using insertion functor to ensure member is contained in.
std::list< T >::const_iterator listConstIteratorType
int init(BoundingBox &BBX, int initialDivision=0)
Initilizes the octree structure.
virtual bool evaluate(T &obj)=0
Evaluates wether the search condition is accomplished or not.
virtual void giveResult(std ::list< T > &answer)=0
Gives a container with found objects.
virtual bool isBBXStage1Defined(BoundingBox &BBXStage1)=0
virtual void giveStartingPosition(FloatArray &answer)=0
Gives the starting position of the search.
virtual bool isBBXStage2Defined(BoundingBox &BBXStage2)=0
virtual std ::list< LocalInsertionData< T > > * giveInsertionList(T &member)=0
Returns list of LocalInsertionData stored on the member.
std::list< T >::iterator listIteratorType
virtual void registerInsertion(T &member, LocalInsertionData< T >LIdata)=0
Stores LocalInsertionData on the member.
virtual bool evaluate(T &member, OctantRecT< T > *cell)=0
Evaluates wether the member should be stored in the octant cell.
#define OOFEM_ERROR(...)
Definition error.h:79
#define OOFEM_LOG_INFO(...)
Definition logger.h:143
#define M_LN2
Definition mathfem.h:55
@ SphereOutsideCell
@ SphereContainsCell
FloatArrayF< N > max(const FloatArrayF< N > &a, const FloatArrayF< N > &b)
#define TEMPLATED_OCTREE_MAX_NODES_LIMIT
#define TEMPLATED_OCTREE_MAX_DEPTH

This page is part of the OOFEM-3.0 documentation. Copyright Copyright (C) 1994-2025 Borek Patzak Bořek Patzák
Project e-mail: oofem@fsv.cvut.cz
Generated at for OOFEM by doxygen 1.15.0 written by Dimitri van Heesch, © 1997-2011