MOAB: Mesh Oriented datABase  (version 5.3.0)
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 196 of file BVHTree.hpp.


Constructor & Destructor Documentation

Definition at line 199 of file BVHTree.hpp.

: mySize( 0 ) {}
moab::BVHTree::Bucket::Bucket ( const Bucket f) [inline]

Definition at line 200 of file BVHTree.hpp.

: mySize( f.mySize ), boundingBox( f.boundingBox ) {}
moab::BVHTree::Bucket::Bucket ( const unsigned int  sz) [inline]

Definition at line 201 of file BVHTree.hpp.

: mySize( sz ) {}

Member Function Documentation

unsigned int moab::BVHTree::Bucket::bucket_index ( int  num_splits,
const BoundBox box,
const BoundBox interval,
const unsigned int  dim 
) [inline, static]

Definition at line 296 of file BVHTree.hpp.

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

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

{
    // see FastMemoryEfficientCellLocationinUnstructuredGridsForVisualization.pdf
    // around page 9

    // Paper arithmetic is over-optimized.. this is safer.
    const double min    = interval.bMin[dim];
    const double length = ( interval.bMax[dim] - min ) / ( num_splits + 1 );
    const double center = ( ( box.bMax[dim] + box.bMin[dim] ) / 2.0 ) - min;
#ifndef NDEBUG
#ifdef BVH_SHOW_INDEX
    std::cout << "[" << min << " , " << interval.max[dim] << " ]" << std::endl;
    std::cout << "[" << box.bMin[dim] << " , " << box.bMax[dim] << " ]" << std::endl;
    std::cout << "Length of bucket" << length << std::endl;
    std::cout << "Center: " << ( box.bMax[dim] + box.bMin[dim] ) / 2.0 << std::endl;
    std::cout << "Distance of center from min:  " << center << std::endl;
    std::cout << "ratio: " << center / length << std::endl;
    std::cout << "index: " << std::ceil( center / length ) - 1 << std::endl;
#endif
#endif
    unsigned int cl = std::ceil( center / length );
    return ( cl > 0 ? cl - 1 : 0 );
}
Bucket& moab::BVHTree::Bucket::operator= ( const Bucket f) [inline]

Definition at line 206 of file BVHTree.hpp.

References boundingBox, and mySize.

        {
            boundingBox = f.boundingBox;
            mySize      = f.mySize;
            return *this;
        }

Member Data Documentation

Definition at line 204 of file BVHTree.hpp.

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

List of all members.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines