Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
moab::BVHTree::Bucket Class Reference
+ Collaboration diagram for moab::BVHTree::Bucket:

Public Member Functions

 Bucket ()
 
 Bucket (const Bucket &f)
 
 Bucket (const unsigned int sz)
 
Bucketoperator= (const Bucket &f)
 

Static Public Member Functions

static unsigned int bucket_index (int num_splits, const BoundBox &box, const BoundBox &interval, const unsigned int dim)
 

Public Attributes

unsigned int mySize
 
BoundBox boundingBox
 

Detailed Description

Definition at line 205 of file BVHTree.hpp.

Constructor & Destructor Documentation

◆ Bucket() [1/3]

moab::BVHTree::Bucket::Bucket ( )
inline

Definition at line 208 of file BVHTree.hpp.

208 : mySize( 0 ) {}

◆ Bucket() [2/3]

moab::BVHTree::Bucket::Bucket ( const Bucket f)
inline

Definition at line 209 of file BVHTree.hpp.

209 : mySize( f.mySize ), boundingBox( f.boundingBox ) {}

◆ Bucket() [3/3]

moab::BVHTree::Bucket::Bucket ( const unsigned int  sz)
inline

Definition at line 210 of file BVHTree.hpp.

210 : mySize( sz ) {}

Member Function Documentation

◆ bucket_index()

unsigned int moab::BVHTree::Bucket::bucket_index ( int  num_splits,
const BoundBox box,
const BoundBox interval,
const unsigned int  dim 
)
inlinestatic

Definition at line 330 of file BVHTree.hpp.

334 {
335  // see FastMemoryEfficientCellLocationinUnstructuredGridsForVisualization.pdf
336  // around page 9
337 
338  // Paper arithmetic is over-optimized.. this is safer.
339  const double min = interval.bMin[dim];
340  const double length = ( interval.bMax[dim] - min ) / ( num_splits + 1 );
341  const double center = ( ( box.bMax[dim] + box.bMin[dim] ) / 2.0 ) - min;
342 #ifndef NDEBUG
343 #ifdef BVH_SHOW_INDEX
344  std::cout << "[" << min << " , " << interval.max[dim] << " ]" << std::endl;
345  std::cout << "[" << box.bMin[dim] << " , " << box.bMax[dim] << " ]" << std::endl;
346  std::cout << "Length of bucket" << length << std::endl;
347  std::cout << "Center: " << ( box.bMax[dim] + box.bMin[dim] ) / 2.0 << std::endl;
348  std::cout << "Distance of center from min: " << center << std::endl;
349  std::cout << "ratio: " << center / length << std::endl;
350  std::cout << "index: " << std::ceil( center / length ) - 1 << std::endl;
351 #endif
352 #endif
353  unsigned int cl = std::ceil( center / length );
354  return ( cl > 0 ? cl - 1 : 0 );
355 }

References moab::BoundBox::bMax, moab::BoundBox::bMin, center(), dim, and length().

Referenced by moab::BVHTree::establish_buckets(), and moab::BVHTree::order_elements().

◆ operator=()

Bucket& moab::BVHTree::Bucket::operator= ( const Bucket f)
inline

Definition at line 217 of file BVHTree.hpp.

218  {
219  boundingBox = f.boundingBox;
220  mySize = f.mySize;
221  return *this;
222  }

References boundingBox, and mySize.

Member Data Documentation

◆ boundingBox

BoundBox moab::BVHTree::Bucket::boundingBox

Definition at line 216 of file BVHTree.hpp.

Referenced by moab::BVHTree::establish_buckets(), and operator=().

◆ mySize

unsigned int moab::BVHTree::Bucket::mySize

Definition at line 215 of file BVHTree.hpp.

Referenced by moab::BVHTree::establish_buckets(), and operator=().


The documentation for this class was generated from the following file: