MOAB: Mesh Oriented datABase  (version 5.4.1)
moab::Point_search< _Tree, _Boxes > Class Template Reference

#include <point_locater.hpp>

Public Types

typedef _Tree Tree
typedef _Boxes Boxes
typedef int Error

Public Member Functions

 Point_search (Tree &_tree, Boxes &_boxes)
 Point_search (Self &s)
template<typename Point_map , typename Entities , typename Communicator >
Error locate_points (Point_map &query_points, Entities &entities, Communicator &comm, double tol)
template<typename Points , typename Entities >
Error locate_points (const Points &query_points, Entities &entities, double tol) const
template<typename Points , typename Entities >
Error bruteforce_locate_points (const Points &query_points, Entities &entities, double tol) const
Treetree () const

Private Types

typedef Point_search< _Tree,
_Boxes > 
Self

Private Member Functions

template<typename Point_map , typename List >
void resolve_boxes (const Point_map &query_points, List &list)

Private Attributes

const Treetree_
const Boxesboxes

Detailed Description

template<typename _Tree, typename _Boxes>
class moab::Point_search< _Tree, _Boxes >

Definition at line 20 of file point_locater.hpp.


Member Typedef Documentation

template<typename _Tree , typename _Boxes >
typedef _Boxes moab::Point_search< _Tree, _Boxes >::Boxes

Definition at line 26 of file point_locater.hpp.

template<typename _Tree , typename _Boxes >
typedef int moab::Point_search< _Tree, _Boxes >::Error

Definition at line 28 of file point_locater.hpp.

template<typename _Tree , typename _Boxes >
typedef Point_search< _Tree, _Boxes > moab::Point_search< _Tree, _Boxes >::Self [private]

Definition at line 32 of file point_locater.hpp.

template<typename _Tree , typename _Boxes >
typedef _Tree moab::Point_search< _Tree, _Boxes >::Tree

Definition at line 25 of file point_locater.hpp.


Constructor & Destructor Documentation

template<typename _Tree , typename _Boxes >
moab::Point_search< _Tree, _Boxes >::Point_search ( Tree _tree,
Boxes _boxes 
) [inline]

Definition at line 36 of file point_locater.hpp.

: tree_( _tree ), boxes( _boxes ) {}
template<typename _Tree , typename _Boxes >
moab::Point_search< _Tree, _Boxes >::Point_search ( Self s) [inline]

Definition at line 39 of file point_locater.hpp.

: tree_( s.tree_ ), boxes( s.boxes ) {}

Member Function Documentation

template<typename _Tree , typename _Boxes >
template<typename Points , typename Entities >
Error moab::Point_search< _Tree, _Boxes >::bruteforce_locate_points ( const Points query_points,
Entities &  entities,
double  tol 
) const [inline]

Definition at line 119 of file point_locater.hpp.

References moab::Point_search< _Tree, _Boxes >::tree_.

    {
        // TODO: this could be faster with caching, but of course this is
        // really just for testing
        typedef typename Points::const_iterator Point_iterator;
        typedef typename Entities::value_type::first_type Entity_handle;
        Entities result;
        result.reserve( query_points.size() );
        std::size_t count = 0;
        std::stringstream ss;
        typename Entities::iterator j = entities.begin();
        for( Point_iterator i = query_points.begin(); i != query_points.end(); ++i, ++j )
        {
            if( j->first == 0 )
            {
                const Entity_handle h = tree_.bruteforce_find( *i, tol );
                if( h == 0 )
                {
                    ++count;
                    for( int k = 0; k < 3; ++k )
                    {
                        ss << ( *i )[k];
                        if( k < 2 )
                        {
                            ss << ", ";
                        }
                        else
                        {
                            ss << std::endl;
                        }
                    }
                }
            }
        }
        std::ofstream out( "unlocated_pts" );
        out << ss.str();
        out.close();
        std::cout << count << " vertices are not contained in _any_ elements!" << std::endl;
        return 0;
    }
template<typename _Tree , typename _Boxes >
template<typename Point_map , typename Entities , typename Communicator >
Error moab::Point_search< _Tree, _Boxes >::locate_points ( Point_map &  query_points,
Entities &  entities,
Communicator &  comm,
double  tol 
) [inline]

Definition at line 80 of file point_locater.hpp.

    {
        /*TODO: implement a parallel location algorithm here
        original algorithm:
        all-scatter/gather bounding boxes
        for each point perform box checks
        scatter/gather points
        perform location and solution interpolation
        //send results back
        ------------
        new algorithm
        Assume power num_proc = n^2;
        all-reduce bounding boxes
        divide box up into n x n grid
        each source processor can communicate its elements to grid proc
        each target processor then communicates its points to grid proc
        grid proc sends points to correct source proc.
        */
        return 0;
    }
template<typename _Tree , typename _Boxes >
template<typename Points , typename Entities >
Error moab::Point_search< _Tree, _Boxes >::locate_points ( const Points query_points,
Entities &  entities,
double  tol 
) const [inline]

Definition at line 102 of file point_locater.hpp.

References moab::Point_search< _Tree, _Boxes >::tree_.

    {
        typedef typename Points::const_iterator Point_iterator;
        typedef typename Entities::value_type Result;
        Entities result;
        result.reserve( query_points.size() );
        for( Point_iterator i = query_points.begin(); i != query_points.end(); ++i )
        {
            Result h;
            tree_.find( *i, tol, h );
            result.push_back( h );
        }
        entities = result;
        return 0;
    }
template<typename _Tree , typename _Boxes >
template<typename Point_map , typename List >
void moab::Point_search< _Tree, _Boxes >::resolve_boxes ( const Point_map &  query_points,
List list 
) [inline, private]

Definition at line 45 of file point_locater.hpp.

    {
        /*
     typedef typename std::vector< bool> Bitmask;
     typedef typename Points::const_iterator Point;
     typedef typename Tree::const_element_iterator Element;
     typedef typename std::vector< std::size_t> Processor_list;
     typedef typename List::value_type Tuple;
     const Element & end = tree_.element_end();
     Bitmask located_points( query_points.size(), 0);
     std::size_t index=0;
     for( Point i = query_points.begin();
            i != query_points.end(); ++i,++index){
         const Element  & element = tree_.find( *i);
         if(element != end){
             located_points[ index] = 1;
         }
     }
     for(int i = 0; i < located_points.size(); ++i){
         if(!located_points[ i]){
             Processor_list processors;
             const Point & point = query_point.begin()+i;
             resolve_box_for_point( point, processors);
             for( std::size_t p = processors.begin();
                      p != processors.end(); ++p){
                 list.push_back( Tuple( *point, *p) );
             }
         }
     }
     */
    }
template<typename _Tree , typename _Boxes >
Tree& moab::Point_search< _Tree, _Boxes >::tree ( ) const [inline]

Definition at line 162 of file point_locater.hpp.

References moab::Point_search< _Tree, _Boxes >::tree_.

    {
        return tree_;
    }

Member Data Documentation

template<typename _Tree , typename _Boxes >
const Boxes& moab::Point_search< _Tree, _Boxes >::boxes [private]

Definition at line 170 of file point_locater.hpp.

template<typename _Tree , typename _Boxes >
const Tree& moab::Point_search< _Tree, _Boxes >::tree_ [private]

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