Go to the documentation of this file.00001 #ifndef OPENTISSUE_COLLISION_BVH_BVH_BOTTOM_UP_REFITTER_H
00002 #define OPENTISSUE_COLLISION_BVH_BVH_BOTTOM_UP_REFITTER_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <boost/shared_ptr.hpp>
00013
00014 namespace OpenTissue
00015 {
00016
00017 namespace bvh
00018 {
00019
00023 template <typename volume_refitter>
00024 class BottomUpRefitter
00025 : public volume_refitter
00026 {
00027 public:
00028
00029 typedef typename volume_refitter::bvh_type bvh_type;
00030 typedef typename bvh_type::bv_ptr bv_ptr;
00031 typedef typename bvh_type::bv_type bv_type;
00032 typedef typename bvh_type::bv_ptr_container bv_ptr_container;
00033
00034 public:
00035
00041 void run( bv_ptr_container const & leaves )
00042 {
00043 bv_ptr_container Q;
00044
00045
00046 std::copy( leaves.begin(), leaves.end(), std::back_inserter( Q ) );
00047
00048 while ( !Q.empty() )
00049 {
00050 bv_ptr bv( Q.front() );
00051 Q.pop_front();
00052 this->refit(bv);
00053 if ( bv->parent() )
00054 {
00055 bv_ptr ptr = boost::const_pointer_cast<bv_type>( bv->parent() ) ;
00056 Q.push_back( ptr );
00057 }
00058 }
00059 }
00060
00061 };
00062
00063 }
00064
00065 }
00066
00067
00068 #endif