Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
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

◆ Boxes

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

Definition at line 26 of file point_locater.hpp.

◆ Error

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

Definition at line 28 of file point_locater.hpp.

◆ Self

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.

◆ Tree

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

◆ Point_search() [1/2]

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.

36 : tree_( _tree ), boxes( _boxes ) {}

◆ Point_search() [2/2]

template<typename _Tree , typename _Boxes >
moab::Point_search< _Tree, _Boxes >::Point_search ( Self s)
inline

Definition at line 39 of file point_locater.hpp.

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

Member Function Documentation

◆ bruteforce_locate_points()

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.

120  {
121  // TODO: this could be faster with caching, but of course this is
122  // really just for testing
123  typedef typename Points::const_iterator Point_iterator;
124  typedef typename Entities::value_type::first_type Entity_handle;
125  Entities result;
126  result.reserve( query_points.size() );
127  std::size_t count = 0;
128  std::stringstream ss;
129  typename Entities::iterator j = entities.begin();
130  for( Point_iterator i = query_points.begin(); i != query_points.end(); ++i, ++j )
131  {
132  if( j->first == 0 )
133  {
134  const Entity_handle h = tree_.bruteforce_find( *i, tol );
135  if( h == 0 )
136  {
137  ++count;
138  for( int k = 0; k < 3; ++k )
139  {
140  ss << ( *i )[k];
141  if( k < 2 )
142  {
143  ss << ", ";
144  }
145  else
146  {
147  ss << std::endl;
148  }
149  }
150  }
151  }
152  }
153  std::ofstream out( "unlocated_pts" );
154  out << ss.str();
155  out.close();
156  std::cout << count << " vertices are not contained in _any_ elements!" << std::endl;
157  return 0;
158  }

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

◆ locate_points() [1/2]

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.

103  {
104  typedef typename Points::const_iterator Point_iterator;
105  typedef typename Entities::value_type Result;
106  Entities result;
107  result.reserve( query_points.size() );
108  for( Point_iterator i = query_points.begin(); i != query_points.end(); ++i )
109  {
110  Result h;
111  tree_.find( *i, tol, h );
112  result.push_back( h );
113  }
114  entities = result;
115  return 0;
116  }

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

◆ locate_points() [2/2]

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.

81  {
82  /*TODO: implement a parallel location algorithm here
83  original algorithm:
84  all-scatter/gather bounding boxes
85  for each point perform box checks
86  scatter/gather points
87  perform location and solution interpolation
88  //send results back
89  ------------
90  new algorithm
91  Assume power num_proc = n^2;
92  all-reduce bounding boxes
93  divide box up into n x n grid
94  each source processor can communicate its elements to grid proc
95  each target processor then communicates its points to grid proc
96  grid proc sends points to correct source proc.
97  */
98  return 0;
99  }

◆ resolve_boxes()

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 
)
inlineprivate

Definition at line 45 of file point_locater.hpp.

46  {
47  /*
48  typedef typename std::vector< bool> Bitmask;
49  typedef typename Points::const_iterator Point;
50  typedef typename Tree::const_element_iterator Element;
51  typedef typename std::vector< std::size_t> Processor_list;
52  typedef typename List::value_type Tuple;
53  const Element & end = tree_.element_end();
54  Bitmask located_points( query_points.size(), 0);
55  std::size_t index=0;
56  for( Point i = query_points.begin();
57  i != query_points.end(); ++i,++index){
58  const Element & element = tree_.find( *i);
59  if(element != end){
60  located_points[ index] = 1;
61  }
62  }
63  for(int i = 0; i < located_points.size(); ++i){
64  if(!located_points[ i]){
65  Processor_list processors;
66  const Point & point = query_point.begin()+i;
67  resolve_box_for_point( point, processors);
68  for( std::size_t p = processors.begin();
69  p != processors.end(); ++p){
70  list.push_back( Tuple( *point, *p) );
71  }
72  }
73  }
74  */
75  }

◆ tree()

template<typename _Tree , typename _Boxes >
Tree& moab::Point_search< _Tree, _Boxes >::tree ( ) const
inline

Definition at line 162 of file point_locater.hpp.

163  {
164  return tree_;
165  }

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

Member Data Documentation

◆ boxes

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

Definition at line 170 of file point_locater.hpp.

◆ tree_

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

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