Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spatial Search Contact Search Algorithm

Similar presentations


Presentation on theme: "Spatial Search Contact Search Algorithm"— Presentation transcript:

1 Spatial Search Contact Search Algorithm
Nelson Lafontaine

2 Outlook Aviable Method Spatial Searching
The user configure file. Searching my Objects.

3 Spatial Search Available Methods
Brute Force Point to Point Search Kdtree Quadtree,Octree Bins Hybrid Object to Object Search

4 1 2 3 4 5 Spatial Search Algorithm Brute Force Cloud Point
NodesArrayType = mode_part.Nodes(); double distance = 1E15; double dist _comp = 0.00; array_1d<double, 3> vector_distance; for ( Modelpart::NodeIterator inode = pNodes.begin(); inode != pNode.end(); inode++ ){ distance = 1E15; for ( Modelpart::NodeIterator jnode = pNodes.begin(); jnode != pNode.end( ) && jnode!=inode ; jnode++){ vector_distance = inode->Coordinates() – jnode->Coordinates(); dist_com = inner_prod(vector_distance, vector_distance ); If(dist_comp<distande ) inode->GetValue(NEAR_NODE ) = (*jnode).base(); } } 1 2 3 4 5 Very Expensive!!!!!!!!!! Searching Operation O(N2)

5 Point to Point Search Domain Decomposition. Kd-tree
Robust for irregular distribution Slower than others due to the cash miss

6 Point to Point Search Domain Decomposition. Quadtree, Oc-tree
Middle Point Average Point

7 Spatial Search Algorithm
Bins Good for regular distributions Robust Very fast. Or(β*n) CPU and RAM efficient. Easy to implement. Ly lx Lx

8 Point to Point Search Using the Point Search. -----Bucket types------
typedef Bucket< TDim, PointType, PointVector, PointTypePointer, PointIterator, DistanceIterator > BucketType; typedef Bins<Tdim. PointType, PointVector, PointTypePointer, PointIterator, DistanceIterator > StaticBins typedef Tree< KDTreePartition<BucketType> > tree;         // Kdtree typedef Tree< OCTreePartition<BucketType> > tree;         // Octree typedef Tree < Static Bins > tree; // BinsTree Creation------ tree nodes_tree(list_of_new_nodes.begin(),list_of_new_nodes.end(),bucket_size); h

9 Point to Point Search Using the Point Search. Loop over found Nodes.
NodesArrayType = mode_part.Nodes(); double distance = 1E15; double dist _comp = 0.00; array_1d<double, 3> vector_distance; for ( Modelpart::NodeIterator inode = pNodes.begin(); inode != pNode.end(); inode++ ){ distance = 1E15; number_of _point_in _radius = nodes_tree .SearchInRadius(*inode , radius, Results.begin(), ResultsDistances.begin(),  MaximumNumberOfResults); for (PointIterator it_found = Result.begin(); it_found!=Result.begin() + number_of _point_in _radius; it_found ++) { vector_distance = inode->Coordinates() – jnode->Coordinates(); dist_com = inner_prod(vector_distance, vector_distance ); If(dist_comp<distande ) inode->GetValue(NEAR_NODE ) = (*jnode).base() } } Very Good Searching Operation O(NLog(N))

10 Spatial Search Algorithm Object Bins ( Dynamic or Static )
Components: Objects or Points Bounding Box Cells It can be any geometry

11 Spatial Search Algorithm
Bins. Usage List of all Pair of Contacts. Given an object (in bin or not in bin) it can return the contacts objects. Lets you know the location of an object contended or not contained in the bin. It can used to interpolate data between different meshes. List of all the nearby object

12 Spatial Search Algorithm
Bins. Usage List Pair Contacts. Given an object return its contacts. Save the pointers of two objects in contact. Cell Pair 3-2 (4, 5) For each cell in bin For each object in cell Verify Geometric Intersection. (Brute Force) 4 2 1 5 3 Objects in contact.

13 Spatial Search Algorithm
Bins. Encreasing efficiency. Intersection Object to Cell or Box to Cell? Advantage of Object to Cell: Check whether the object is contended in the cell. Less searches operations.

14 Spatial Search Algorithm
Using the Spatial Search algorithm based in Objects List of all objects in model (Objects_Container ) Creation of the Object: BinsDynamicObject<My_Configure> Bins(Begin , End ) Note : The Bins class is a generic class. Contact pair list Bins.SearchContact(mPairContacts); Particle contact list Loop in Objects Container rBinsObjectDynamic.SearchObjectsInner(*it, Result); }

15 Spatial Search Algorithm
Using static and dynamic object Bins. Creating the bins BinsObjectDynamic<Configure>  rBinsObjectDynamic(mBoundaryElements.begin(), mBoundaryElements.end());  BinsObjectStatic<Configure>  rBinsObjectDynamic(mBoundaryElements.begin(), mBoundaryElements.end()); 

16 Spatial Search Algorithm
Using static and dynamic object Bins. ResultContainerType Result; IteratorType it_begin = List_of_object.begin(); IteratorType it_begin = List_of_object.end(); for(IteratorType it = it_begin ; it!=it_end; it++) rBinsObjectDynamic.SearchObjectInner(*it, Result); rBinsObjectDynamic.SearchObjectInCell(*it, Result); rBinsObjectDynamic.SearchContacts(PairContacts); List of contacts objects of particular object. List of nearby objects of particular object. Contact Pair List

17 Spatial Search Algorithm
The user configure file: Very easy to make and use. The main attributes and methods need to be defined The containers Compute bounding box. Intersection between objects. Function for increasing efficiency Intersection between cells and objects

18 Spatial Search Algorithm
The user configure file: The containers Definition of type of object´s container. Iterators and pointers. List Contacts Pairs.

19 Spatial Search Algorithm
Advance. The user configure file: Compute bounding box function The minimum and maximum point of the object. static inline void CalculateBoundingBox( PointerType& p, PointType& pmin, PointType& pmax) { } Intersection between objects function Geometric intersection tools. Many intersection algorithms can be found in computational geometry books. static inline bool Intersection(const PointerType& p1, const PointerType& p2) { ….. }

20 Spatial Search Algorithm
The user configure file: Intersection object and Cell. Increasing the efficiency: Avoid search contacts in cells that no have intersection with the object. Very useful. Geometric tools for intersection between objects and cell (a cell can be reinterpreted like an uniform rectangular shape geometry). static inline bool IntersectionBox(const PointerType& p, const PointType& pmin, const PointType& pmax) { Important Note: return always a true value if you do not have in hand the this kind of algorithm } {} …..{}

21 Spatial Search Algorithm The user configure file. A Little view
Spatial Search Algorithm The user configure file. A Little view Configure.h /// typedef Definitions typedef ContainerType ResultContainerType; typedef IteratorType ResultIteratorType; typedef Pair<PointerType> ContactPairType; typedef std::vector<ContactPairType> ContainerContactType; typedef ContainerContactType::iterator IteratorContactType; /// the most important methods static inline bool Intersection(const PointerType& p1, const PointerType& p2) static inline void CalculateBoundingBox( PointerType& p, PointType& pmin, PointType& pmax) static inline bool IntersectionBox(const PointerType& p, const PointType& pmin, const PointType& pmax)

22 Spatial Search Algorithm
More details visit us at Thanks


Download ppt "Spatial Search Contact Search Algorithm"

Similar presentations


Ads by Google