6 #ifndef PORTAGE_SEARCH_SEARCH_SIMPLE_POINTS_H_ 7 #define PORTAGE_SEARCH_SEARCH_SIMPLE_POINTS_H_ 16 #include "wonton/support/Point.h" 29 template<
int dim,
class SourceSwarm,
class TargetSwarm>
48 SourceSwarm
const& source_swarm,
49 TargetSwarm
const& target_swarm,
52 Meshfree::WeightCenter center = Meshfree::Scatter)
53 : source_swarm_(source_swarm),
54 target_swarm_(target_swarm),
55 source_extents_(source_extents),
56 target_extents_(target_extents),
80 std::vector<int> candidates;
83 Point<dim> target_coord = target_swarm_.get_particle_coordinates(point_id);
88 int const nb_points = source_swarm_.num_particles(Wonton::ALL);
89 for (
int i = 0; i < nb_points; ++i) {
90 Point<dim> source_coord = source_swarm_.get_particle_coordinates(i);
91 bool contained =
true;
92 Point<dim> source_point_extent = source_extents_[i];
93 Point<dim> target_point_extent = target_extents_[point_id];
95 for (
int d = 0; d < dim; ++d) {
97 if (center_ == Meshfree::Scatter) {
98 maxdist = 2. * source_point_extent[d];
99 }
else if (center_ == Meshfree::Gather) {
100 maxdist = 2. * target_point_extent[d];
102 contained &= (std::abs(target_coord[d] - source_coord[d]) < maxdist);
107 candidates.push_back(i);
115 SourceSwarm
const& source_swarm_;
116 TargetSwarm
const& target_swarm_;
119 Meshfree::WeightCenter center_ = Meshfree::Scatter;
125 #endif // PORTAGE_SEARCH_SEARCH_SIMPLE_POINTS_H_ SearchSimplePoints(SourceSwarm const &source_swarm, TargetSwarm const &target_swarm, Portage::vector< Point< dim >> const &source_extents, Portage::vector< Point< dim >> const &target_extents, Meshfree::WeightCenter center=Meshfree::Scatter)
Builds the search structure for finding neighboring points.
Definition: search_simple_points.h:47
std::vector< T > vector
Definition: portage.h:238
std::vector< int > operator()(int point_id) const
Find the source swarm points within an appropriate distance of a target point.
Definition: search_simple_points.h:78
~SearchSimplePoints()=default
Destructor.
Definition: coredriver.h:42
A simple, crude search algorithm that does a quadratic-time search over a swarm of points...
Definition: search_simple_points.h:30
SearchSimplePoints & operator=(SearchSimplePoints const &)=delete
Copy constructor - use default - std::transfor needs this.
SearchSimplePoints()=delete
Default constructor (disabled)