Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
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

Definition at line 208 of file BVHTree.hpp.

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

Definition at line 209 of file BVHTree.hpp.

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

Definition at line 210 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 330 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 217 of file BVHTree.hpp.

References boundingBox, and mySize.

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

Member Data Documentation

Definition at line 215 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