56 const Teuchos::RCP<EntityLocalMap> &local_map,
57 const Teuchos::ParameterList ¶meters )
61 int num_entity = entity_iterator.size();
66 d_entity_centroids.resize( space_dim * num_entity );
72 int entity_local_id = 0;
73 for ( entity_it = begin_it; entity_it != end_it; ++entity_it )
77 d_entity_centroids( space_dim * entity_local_id, space_dim ) );
78 d_entity_map.emplace( entity_local_id, *entity_it );
84 if ( parameters.isParameter(
"Coarse Local Search Leaf Size" ) )
86 leaf_size = parameters.get<
int>(
"Coarse Local Search Leaf Size" );
88 leaf_size = std::min( leaf_size, num_entity );
90 space_dim, d_entity_centroids(), leaf_size );
91 DTK_ENSURE( Teuchos::nonnull( d_tree ) );
99 const Teuchos::ParameterList ¶meters,
100 Teuchos::Array<Entity> &neighbors )
const 103 int num_neighbors = 100;
104 if ( parameters.isParameter(
"Coarse Local Search kNN" ) )
106 num_neighbors = parameters.get<
int>(
"Coarse Local Search kNN" );
109 std::min( num_neighbors, Teuchos::as<int>( d_entity_map.size() ) );
110 Teuchos::Array<unsigned> local_neighbors =
111 d_tree->nnSearch( point, num_neighbors );
114 neighbors.resize( local_neighbors.size() );
115 Teuchos::Array<unsigned>::const_iterator local_it;
116 Teuchos::Array<Entity>::iterator entity_it;
117 for ( local_it = local_neighbors.begin(), entity_it = neighbors.begin();
118 local_it != local_neighbors.end(); ++local_it, ++entity_it )
120 DTK_CHECK( d_entity_map.count( *local_it ) );
121 *entity_it = d_entity_map.find( *local_it )->second;
Entity iterator interface.
void search(const Teuchos::ArrayView< const double > &point, const Teuchos::ParameterList ¶meters, Teuchos::Array< Entity > &neighbors) const
Find the set of entities a point neighbors.
static Teuchos::RCP< StaticSearchTree > createStaticTree(const unsigned dim, const Teuchos::ArrayView< const double > &points, const unsigned leaf_size)
Static tree creation method.
Assertions and Design-by-Contract for error handling.
int physicalDimension() const
Return the physical dimension of the entity.
CoarseLocalSearch(const EntityIterator &entity_iterator, const Teuchos::RCP< EntityLocalMap > &local_map, const Teuchos::ParameterList ¶meters)
Constructor.
CoarseLocalSearch declaration.