#include <octreelocalizer.h>


Public Member Functions | |
| OctreeSpatialLocalizer (int n, Domain *d) | |
| Constructor. | |
| ~OctreeSpatialLocalizer () | |
| Destructor - deletes the octree tree. | |
| int | init (bool force=false) |
| Initialize receiver data structure if not done previously Current implementation calls and returns the buildOctreeDataStructure service response. | |
| Element * | giveElementContainingPoint (const FloatArray &coords, const IntArray *regionList=NULL) |
| Returns the element, containing given point. | |
| Element * | giveElementContainingPoint (oofemOctantRec *cell, const FloatArray &coords, oofemOctantRec *scannedChild=NULL, const IntArray *regionList=NULL) |
| Returns the element containing given point. | |
| Element * | giveElementCloseToPoint (const FloatArray &coords, const IntArray *regionList=NULL) |
| Returns the element close to point. | |
| GaussPoint * | giveClosestIP (const FloatArray &coords, int region) |
| Returns the integration point in associated domain, which is closest to given point. | |
| void | giveAllElementsWithIpWithinBox (elementContainerType &elemSet, const FloatArray &coords, const double radius) |
| Returns container (set) of all domain elements having integration point within given box. | |
| void | giveAllNodesWithinBox (nodeContainerType &nodeList, const FloatArray &coords, const double radius) |
| Returns container (list) of all domain nodes within given box. | |
| const char * | giveClassName () const |
| Returns class name of the receiver. | |
| int | giveOctreeMaskValue (int indx) |
| Returns the octreeMask value given by the index. | |
| classType | giveClassID () const |
| Returns classType id of receiver. | |
Protected Member Functions | |
| int | buildOctreeDataStructure () |
| Buids the underlying octree data structure. | |
| int | initElementIPDataStructure () |
| Insert IP records into tree (the tree topology is determined by nodes). | |
| oofemOctantRec * | findTerminalContaining (oofemOctantRec *startCell, const FloatArray &coords) |
| Finds the terminal octant containing the given point. | |
| int | insertNodeIntoOctree (oofemOctantRec *rootCell, int nodeNum, const FloatArray &coords) |
| Inserts the given node (identified by its number and position) to the octree structure. | |
| int | insertIPElementIntoOctree (oofemOctantRec *rootCell, int elemNum, const FloatArray &coords) |
| Inserts the given integration point (or more precisely the element owning it) to the octree data structure. | |
| void | insertElementsUsingNodalConnectivitiesIntoOctree (oofemOctantRec *rootCell) |
| Initializes the element lists in octree data structure. | |
| void | giveElementsWithIPWithinBox (elementContainerType &elemSet, oofemOctantRec *currentCell, const FloatArray &coords, const double radius) |
| Returns container (set) of elements having integration point within given box and given root cell. | |
| void | giveNodesWithinBox (nodeContainerType &nodeList, oofemOctantRec *currentCell, const FloatArray &coords, const double radius) |
| Returns container (list) of nodes within given box and given root cell. | |
| void | giveClosestIPWithinOctant (oofemOctantRec *currentCell, const FloatArray &coords, int region, double &dist, GaussPoint **answer) |
| Returns closest IP to given point contained within given octree cell. | |
| void | giveElementCloseToPointWithinOctant (oofemOctantRec *cell, const FloatArray &coords, double &minDist, Element **answer, const IntArray *regionList) |
| Returns the element close to given point as element which center is closest to the given point. | |
| int | giveCellDepth (oofemOctantRec *cell) |
| Returns the octree depth for given cell. | |
| void | giveMaxTreeDepthFrom (oofemOctantRec *root, int &maxDepth) |
| Determines the max tree depth computed for given tree cell and its childs. | |
| void | giveListOfTerminalCellsInBoundingBox (std::list< oofemOctantRec * > &cellList, const FloatArray &coords, const double radius, oofemOctantRec *currentCell) |
| Builds the list of terminal cells contained within given box (coords, radius), starting from given currentCell. | |
Protected Attributes | |
| oofemOctantRec * | rootCell |
| Root cell of octree. | |
| IntArray | octreeMask |
| Octree degenerate mask. | |
| int | elementIPListsInitialized |
| Flag inficating elementIP tables are initialized. | |
The basic task is to provide spatial information and localization for domain, to which receiver is associated. The octree data structure is build over domain nodes, the element type seraches are completed using nodal conectivity informations provided by ConTable. Typical services include searching the closes node to give position, serching of an element containing given point, etc. If special element algorithms required, these should be included using interface concept.
Definition at line 160 of file octreelocalizer.h.
| OctreeSpatialLocalizer::OctreeSpatialLocalizer | ( | int | n, | |
| Domain * | d | |||
| ) | [inline] |
Constructor.
Definition at line 171 of file octreelocalizer.h.
References elementIPListsInitialized, and rootCell.
| OctreeSpatialLocalizer::~OctreeSpatialLocalizer | ( | ) | [inline] |
Destructor - deletes the octree tree.
Definition at line 176 of file octreelocalizer.h.
References rootCell.
| int OctreeSpatialLocalizer::init | ( | bool | force = false |
) | [virtual] |
Initialize receiver data structure if not done previously Current implementation calls and returns the buildOctreeDataStructure service response.
Reimplemented from SpatialLocalizer.
Definition at line 1281 of file octreelocalizer.C.
References buildOctreeDataStructure(), elementIPListsInitialized, and rootCell.
Referenced by buildOctreeDataStructure(), giveAllElementsWithIpWithinBox(), giveAllNodesWithinBox(), giveClosestIP(), giveElementCloseToPoint(), and giveElementContainingPoint().
| Element * OctreeSpatialLocalizer::giveElementContainingPoint | ( | const FloatArray & | coords, | |
| const IntArray * | regionList = NULL | |||
| ) | [virtual] |
Returns the element, containing given point.
| coords | global problem coordinates of point of interest | |
| regionList | only elements within given regions are considered, if NULL all regions are considered. |
Implements SpatialLocalizer.
Definition at line 578 of file octreelocalizer.C.
References findTerminalContaining(), oofemOctantRec::giveParent(), init(), and rootCell.
Referenced by giveElementContainingPoint().
| Element * OctreeSpatialLocalizer::giveElementContainingPoint | ( | oofemOctantRec * | cell, | |
| const FloatArray & | coords, | |||
| oofemOctantRec * | scannedChild = NULL, |
|||
| const IntArray * | regionList = NULL | |||
| ) |
Returns the element containing given point.
The search is done only for given cell and its childs, skipping the given child from search
| cell | top level cell to search | |
| coords | point coordinates child pointer to exclude from search | |
| regionList | only elements within given regions are considered, if NULL all regions are considered. |
Definition at line 611 of file octreelocalizer.C.
References IntArray::at(), Element_remote, IntArray::findFirstIndexOf(), oofemOctantRec::giveChild(), FEMComponent::giveDomain(), Domain::giveElement(), giveElementContainingPoint(), FEMComponent::giveInterface(), oofemOctantRec::giveIPElementList(), Element::giveParallelMode(), Element::giveRegionNumber(), oofemOctantRec::isTerminalOctant(), octreeMask, SpatialLocalizerInterface::SpatialLocalizerI_BBoxContainsPoint(), SpatialLocalizerInterface::SpatialLocalizerI_containsPoint(), and SpatialLocalizerInterfaceType.
| Element * OctreeSpatialLocalizer::giveElementCloseToPoint | ( | const FloatArray & | coords, | |
| const IntArray * | regionList = NULL | |||
| ) | [virtual] |
Returns the element close to point.
| coords | global problem coordinates of point of interest | |
| regionList | only elements within given regions are considered, if NULL all regions are considered. |
Implements SpatialLocalizer.
Definition at line 687 of file octreelocalizer.C.
References _error, oofemOctantRec::BBS_CONTAINSCELL, oofemOctantRec::BBS_INSIDECELL, Element_remote, IntArray::findFirstIndexOf(), findTerminalContaining(), FEMComponent::giveDomain(), Domain::giveElement(), giveElementCloseToPointWithinOctant(), FEMComponent::giveInterface(), oofemOctantRec::giveIPElementList(), giveListOfTerminalCellsInBoundingBox(), Element::giveParallelMode(), oofemOctantRec::giveParent(), Element::giveRegionNumber(), oofemOctantRec::giveSize(), init(), rootCell, SpatialLocalizerInterface::SpatialLocalizerI_giveDistanceFromParametricCenter(), SpatialLocalizerInterfaceType, and oofemOctantRec::testBoundingBox().
| GaussPoint * OctreeSpatialLocalizer::giveClosestIP | ( | const FloatArray & | coords, | |
| int | region | |||
| ) | [virtual] |
Returns the integration point in associated domain, which is closest to given point.
Since IP holds the information about its element, the IP reference is containing all the information.
| coords | global problem coordinates of point of interest |
Implements SpatialLocalizer.
Definition at line 848 of file octreelocalizer.C.
References _error, oofemOctantRec::BBS_CONTAINSCELL, oofemOctantRec::BBS_INSIDECELL, Element::computeGlobalCoordinates(), FloatArray::distance(), FEMComponent::domain, Element_remote, findTerminalContaining(), IntegrationRule::getIntegrationPoint(), IntegrationRule::getNumberOfIntegrationPoints(), giveClosestIPWithinOctant(), GaussPoint::giveCoordinates(), Element::giveDefaultIntegrationRulePtr(), Domain::giveElement(), oofemOctantRec::giveIPElementList(), giveListOfTerminalCellsInBoundingBox(), Element::giveParallelMode(), oofemOctantRec::giveParent(), Element::giveRegionNumber(), oofemOctantRec::giveSize(), init(), rootCell, and oofemOctantRec::testBoundingBox().
| void OctreeSpatialLocalizer::giveAllElementsWithIpWithinBox | ( | elementContainerType & | elemSet, | |
| const FloatArray & | coords, | |||
| const double | radius | |||
| ) |
Returns container (set) of all domain elements having integration point within given box.
| elemSet | answer containing the list of elements meeting the criteria | |
| coords | center of box of interest | |
| radius | radius of bounding sphere |
Definition at line 1074 of file octreelocalizer.C.
References _error, oofemOctantRec::BBS_INSIDECELL, findTerminalContaining(), giveElementsWithIPWithinBox(), oofemOctantRec::giveParent(), init(), rootCell, and oofemOctantRec::testBoundingBox().
| void OctreeSpatialLocalizer::giveAllNodesWithinBox | ( | nodeContainerType & | nodeList, | |
| const FloatArray & | coords, | |||
| const double | radius | |||
| ) |
Returns container (list) of all domain nodes within given box.
| NODESet | answer containing the list of nodes meeting the criteria | |
| coords | center of box of interest | |
| radius | radius of bounding sphere |
Definition at line 1170 of file octreelocalizer.C.
References oofemOctantRec::BBS_INSIDECELL, findTerminalContaining(), giveNodesWithinBox(), oofemOctantRec::giveParent(), init(), rootCell, and oofemOctantRec::testBoundingBox().
| const char* OctreeSpatialLocalizer::giveClassName | ( | ) | const [inline, virtual] |
Returns class name of the receiver.
Reimplemented from SpatialLocalizer.
Definition at line 233 of file octreelocalizer.h.
| int OctreeSpatialLocalizer::giveOctreeMaskValue | ( | int | indx | ) | [inline] |
Returns the octreeMask value given by the index.
Definition at line 235 of file octreelocalizer.h.
References IntArray::at(), and octreeMask.
Referenced by oofemOctantRec::containsPoint(), oofemOctantRec::giveChildContainingPoint(), and oofemOctantRec::testBoundingBox().
| classType OctreeSpatialLocalizer::giveClassID | ( | ) | const [inline, virtual] |
Returns classType id of receiver.
Reimplemented from SpatialLocalizer.
Definition at line 240 of file octreelocalizer.h.
References OctreeSpatialLocalizerClass.
| int OctreeSpatialLocalizer::buildOctreeDataStructure | ( | ) | [protected] |
Buids the underlying octree data structure.
The desired tree level is determined by following rules:
Definition at line 320 of file octreelocalizer.C.
References IntArray::at(), FloatArray::at(), oofemOctantRec::divideLocally(), FEMComponent::domain, DofManager::giveClassID(), Domain::giveDofManager(), giveMaxTreeDepthFrom(), Domain::giveNumberOfDofManagers(), FloatArray::giveSize(), init(), initElementIPDataStructure(), insertNodeIntoOctree(), max(), min(), NodeClass, OCTREE_MAX_NODES_LIMIT, octreeMask, OOFEM_LOG_INFO(), RigidArmNodeClass, and rootCell.
Referenced by init().
| int OctreeSpatialLocalizer::initElementIPDataStructure | ( | ) | [protected] |
Insert IP records into tree (the tree topology is determined by nodes).
Definition at line 410 of file octreelocalizer.C.
References _error, Element::computeGlobalCoordinates(), FEMComponent::domain, elementIPListsInitialized, IntegrationRule::getIntegrationPoint(), IntegrationRule::getNumberOfIntegrationPoints(), Node::giveCoordinates(), GaussPoint::giveCoordinates(), Element::giveDefaultIntegrationRulePtr(), FEMComponent::giveDomain(), Domain::giveElement(), Element::giveNode(), Domain::giveNumberOfElements(), Element::giveNumberOfNodes(), insertIPElementIntoOctree(), and rootCell.
Referenced by buildOctreeDataStructure().
| oofemOctantRec * OctreeSpatialLocalizer::findTerminalContaining | ( | oofemOctantRec * | startCell, | |
| const FloatArray & | coords | |||
| ) | [protected] |
Finds the terminal octant containing the given point.
| startCell | cell used to start search | |
| coords | coordinates of point of interest |
Definition at line 296 of file octreelocalizer.C.
References _error, oofemOctantRec::containsPoint(), oofemOctantRec::giveChildContainingPoint(), and oofemOctantRec::isTerminalOctant().
Referenced by giveAllElementsWithIpWithinBox(), giveAllNodesWithinBox(), giveClosestIP(), giveElementCloseToPoint(), giveElementContainingPoint(), insertIPElementIntoOctree(), and insertNodeIntoOctree().
| int OctreeSpatialLocalizer::insertNodeIntoOctree | ( | oofemOctantRec * | rootCell, | |
| int | nodeNum, | |||
| const FloatArray & | coords | |||
| ) | [protected] |
Inserts the given node (identified by its number and position) to the octree structure.
The tree is traversed until terminal octant containing given position is found and node is then inserted into octant nodal list. If there is too mach nodes per cell, this is subdivided further and its assigned nodes are propagated to childs.
| rootCell | starting cell for insertion | |
| nodeNum | node number | |
| coords | corresponding node coordinates |
Definition at line 523 of file octreelocalizer.C.
References _error, oofemOctantRec::addNode(), oofemOctantRec::deleteNodeList(), oofemOctantRec::divideLocally(), FEMComponent::domain, findTerminalContaining(), giveCellDepth(), oofemOctantRec::giveChildContainingPoint(), Domain::giveDofManager(), oofemOctantRec::giveNodeList(), OCTREE_MAX_DEPTH, OCTREE_MAX_NODES_LIMIT, and octreeMask.
Referenced by buildOctreeDataStructure().
| int OctreeSpatialLocalizer::insertIPElementIntoOctree | ( | oofemOctantRec * | rootCell, | |
| int | elemNum, | |||
| const FloatArray & | coords | |||
| ) | [protected] |
Inserts the given integration point (or more precisely the element owning it) to the octree data structure.
The tree is traversed until terminal octant containing given position (ip coordinates) is found and corresponding entry is then inserted into corresponding octant list.
| rootCell | starting cell for insertion | |
| elemNum | element number | |
| coords | global ip coordinates |
Definition at line 474 of file octreelocalizer.C.
References oofemOctantRec::addElementIP(), and findTerminalContaining().
Referenced by initElementIPDataStructure().
| void OctreeSpatialLocalizer::insertElementsUsingNodalConnectivitiesIntoOctree | ( | oofemOctantRec * | rootCell | ) | [protected] |
Initializes the element lists in octree data structure.
This implementation requires that the list of nodes in terminate cells exists simply all shared elements to nodes in terminal cell are added. If this is added to existing implementation based on adding elements only if integration point is in the cell this leads to more complete element list in terminal cell.
| rootCell | starting cell for octree transwersal |
Definition at line 486 of file octreelocalizer.C.
References oofemOctantRec::addElementIP(), IntArray::at(), FEMComponent::domain, oofemOctantRec::giveChild(), Domain::giveConnectivityTable(), ConnectivityTable::giveDofManConnectivityArray(), oofemOctantRec::giveNodeList(), IntArray::giveSize(), oofemOctantRec::isTerminalOctant(), and octreeMask.
| void OctreeSpatialLocalizer::giveElementsWithIPWithinBox | ( | elementContainerType & | elemSet, | |
| oofemOctantRec * | currentCell, | |||
| const FloatArray & | coords, | |||
| const double | radius | |||
| ) | [protected] |
Returns container (set) of elements having integration point within given box and given root cell.
| elemSet | answer containing the list of elements meeting the criteria | |
| currentCell | the starting cell to be transversed | |
| coords | center of box of interest | |
| radius | radius of bounding sphere |
Definition at line 1100 of file octreelocalizer.C.
References _error, IntArray::at(), oofemOctantRec::BBS_CONTAINSCELL, oofemOctantRec::BBS_INSIDECELL, Element::computeGlobalCoordinates(), FloatArray::distance(), FEMComponent::domain, IntegrationRule::getIntegrationPoint(), IntegrationRule::getNumberOfIntegrationPoints(), oofemOctantRec::giveChild(), GaussPoint::giveCoordinates(), Element::giveDefaultIntegrationRulePtr(), Domain::giveElement(), oofemOctantRec::giveIPElementList(), oofemOctantRec::isTerminalOctant(), octreeMask, and oofemOctantRec::testBoundingBox().
Referenced by giveAllElementsWithIpWithinBox().
| void OctreeSpatialLocalizer::giveNodesWithinBox | ( | nodeContainerType & | nodeList, | |
| oofemOctantRec * | currentCell, | |||
| const FloatArray & | coords, | |||
| const double | radius | |||
| ) | [protected] |
Returns container (list) of nodes within given box and given root cell.
| elemSet | answer containing the list of nodes meeting the criteria | |
| currentCell | the starting cell to be transversed | |
| coords | center of box of interest | |
| radius | radius of bounding sphere |
Definition at line 1190 of file octreelocalizer.C.
References IntArray::at(), oofemOctantRec::BBS_CONTAINSCELL, oofemOctantRec::BBS_INSIDECELL, FloatArray::distance(), FEMComponent::domain, oofemOctantRec::giveChild(), Node::giveCoordinates(), Domain::giveNode(), oofemOctantRec::giveNodeList(), oofemOctantRec::isTerminalOctant(), octreeMask, and oofemOctantRec::testBoundingBox().
Referenced by giveAllNodesWithinBox().
| void OctreeSpatialLocalizer::giveClosestIPWithinOctant | ( | oofemOctantRec * | currentCell, | |
| const FloatArray & | coords, | |||
| int | region, | |||
| double & | dist, | |||
| GaussPoint ** | answer | |||
| ) | [protected] |
Returns closest IP to given point contained within given octree cell.
| currentCell | starting cell to search, all childs will be serched too | |
| coords | pont coordinates | |
| region | region id of elements | |
| treshold | distance, only update answer param, if distance is smaller, distance is updated too | |
| answer | pointer to IP, which has the smallest distance "distance" from given point |
Definition at line 995 of file octreelocalizer.C.
References _error, IntArray::at(), oofemOctantRec::BBS_CONTAINSCELL, oofemOctantRec::BBS_INSIDECELL, Element::computeGlobalCoordinates(), FloatArray::distance(), FEMComponent::domain, Element_remote, IntegrationRule::getIntegrationPoint(), IntegrationRule::getNumberOfIntegrationPoints(), oofemOctantRec::giveChild(), GaussPoint::giveCoordinates(), Element::giveDefaultIntegrationRulePtr(), Domain::giveElement(), oofemOctantRec::giveIPElementList(), Element::giveParallelMode(), Element::giveRegionNumber(), oofemOctantRec::isTerminalOctant(), octreeMask, and oofemOctantRec::testBoundingBox().
Referenced by giveClosestIP().
| void OctreeSpatialLocalizer::giveElementCloseToPointWithinOctant | ( | oofemOctantRec * | cell, | |
| const FloatArray & | coords, | |||
| double & | minDist, | |||
| Element ** | answer, | |||
| const IntArray * | regionList | |||
| ) | [protected] |
Returns the element close to given point as element which center is closest to the given point.
Only elements with IP in given cell are considered. The search is done only for given cell and its childs, skipping the given child from search
| cell | top level cell to search | |
| coords | point coordinates | |
| minDist | distance from the center of returned element | |
| regionList | only elements within given regions are considered, if NULL all regions are considered. |
Definition at line 781 of file octreelocalizer.C.
References _error, IntArray::at(), oofemOctantRec::BBS_CONTAINSCELL, oofemOctantRec::BBS_INSIDECELL, Element_remote, IntArray::findFirstIndexOf(), oofemOctantRec::giveChild(), FEMComponent::giveDomain(), Domain::giveElement(), FEMComponent::giveInterface(), oofemOctantRec::giveIPElementList(), Element::giveParallelMode(), Element::giveRegionNumber(), oofemOctantRec::isTerminalOctant(), octreeMask, SpatialLocalizerInterface::SpatialLocalizerI_giveDistanceFromParametricCenter(), SpatialLocalizerInterfaceType, and oofemOctantRec::testBoundingBox().
Referenced by giveElementCloseToPoint().
| int OctreeSpatialLocalizer::giveCellDepth | ( | oofemOctantRec * | cell | ) | [protected] |
Returns the octree depth for given cell.
The depth is not parameter of octree cells, but is computed from cell size and root cell size.
Definition at line 1232 of file octreelocalizer.C.
References oofemOctantRec::giveSize(), M_LN2, and rootCell.
Referenced by giveMaxTreeDepthFrom(), and insertNodeIntoOctree().
| void OctreeSpatialLocalizer::giveMaxTreeDepthFrom | ( | oofemOctantRec * | root, | |
| int & | maxDepth | |||
| ) | [protected] |
Determines the max tree depth computed for given tree cell and its childs.
To obtain ttotal tree depth, root cell should be supplied. The tree depth is always measured from the root cell. Before call, maxDepth should be set to zero.
Definition at line 1238 of file octreelocalizer.C.
References IntArray::at(), giveCellDepth(), oofemOctantRec::giveChild(), max(), and octreeMask.
Referenced by buildOctreeDataStructure().
| void OctreeSpatialLocalizer::giveListOfTerminalCellsInBoundingBox | ( | std::list< oofemOctantRec * > & | cellList, | |
| const FloatArray & | coords, | |||
| const double | radius, | |||
| oofemOctantRec * | currentCell | |||
| ) | [protected] |
Builds the list of terminal cells contained within given box (coords, radius), starting from given currentCell.
| cellList | list of terminal cell pointers contained by bbox | |
| coords | center of box of interest | |
| radius | radius of bounding sphere | |
| currentCell | starting cell |
Definition at line 1256 of file octreelocalizer.C.
References IntArray::at(), oofemOctantRec::BBS_CONTAINSCELL, oofemOctantRec::BBS_INSIDECELL, oofemOctantRec::giveChild(), oofemOctantRec::isTerminalOctant(), octreeMask, and oofemOctantRec::testBoundingBox().
Referenced by giveClosestIP(), and giveElementCloseToPoint().
oofemOctantRec* OctreeSpatialLocalizer::rootCell [protected] |
Root cell of octree.
Definition at line 164 of file octreelocalizer.h.
Referenced by buildOctreeDataStructure(), giveAllElementsWithIpWithinBox(), giveAllNodesWithinBox(), giveCellDepth(), giveClosestIP(), giveElementCloseToPoint(), giveElementContainingPoint(), init(), initElementIPDataStructure(), OctreeSpatialLocalizer(), and ~OctreeSpatialLocalizer().
IntArray OctreeSpatialLocalizer::octreeMask [protected] |
Octree degenerate mask.
Definition at line 166 of file octreelocalizer.h.
Referenced by buildOctreeDataStructure(), giveClosestIPWithinOctant(), giveElementCloseToPointWithinOctant(), giveElementContainingPoint(), giveElementsWithIPWithinBox(), giveListOfTerminalCellsInBoundingBox(), giveMaxTreeDepthFrom(), giveNodesWithinBox(), giveOctreeMaskValue(), insertElementsUsingNodalConnectivitiesIntoOctree(), and insertNodeIntoOctree().
int OctreeSpatialLocalizer::elementIPListsInitialized [protected] |
Flag inficating elementIP tables are initialized.
Definition at line 168 of file octreelocalizer.h.
Referenced by init(), initElementIPDataStructure(), and OctreeSpatialLocalizer().
1.5.5 written by Dimitri van Heesch,
© 1997-2001