1#ifndef TATOOINE_DETAIL_RECTILINEAR_GRID_INVERSE_DISTANCE_WEIGHTING_VERTEX_PROPERTY_SAMPLER_H
2#define TATOOINE_DETAIL_RECTILINEAR_GRID_INVERSE_DISTANCE_WEIGHTING_VERTEX_PROPERTY_SAMPLER_H
9template <
typename Gr
id,
typename Property>
12 inverse_distance_weighting_vertex_property_sampler<Grid, Property>,
13 typename Grid::real_type, Grid::num_dimensions(),
14 typename Property::value_type> {
16 return Grid::num_dimensions();
42 m_grid.vertices().iterate_indices([
this](
auto const... is) {
48 auto [indices, squared_distances] =
50 if (indices.empty()) {
56 auto index_it =
begin(indices);
57 auto squared_dist_it =
begin(squared_distances);
58 for (; index_it !=
end(indices); ++index_it, ++squared_dist_it) {
59 auto const& property_value =
m_property.plain_at(*index_it);
60 if (*squared_dist_it == 0) {
61 return property_value;
63 auto const dist = std::sqrt(*squared_dist_it);
64 auto const weight = 1 / (dist * dist * dist);
65 accumulated_prop_val += property_value * weight;
66 accumulated_weight += weight;
68 return accumulated_prop_val / accumulated_weight;
Definition: cell_container.h:15
auto end(vertex_container< Dimensions... > const &c)
Definition: vertex_container.h:142
auto begin(vertex_container< Dimensions... > const &c)
Definition: vertex_container.h:137
Definition: inverse_distance_weighting_vertex_property_sampler.h:14
Grid const & m_grid
Definition: inverse_distance_weighting_vertex_property_sampler.h:32
real_type m_radius
Definition: inverse_distance_weighting_vertex_property_sampler.h:35
typename Grid::real_type real_type
Definition: inverse_distance_weighting_vertex_property_sampler.h:23
Property const & m_property
Definition: inverse_distance_weighting_vertex_property_sampler.h:33
pointset_type m_points
Definition: inverse_distance_weighting_vertex_property_sampler.h:34
typename Property::value_type value_type
Definition: inverse_distance_weighting_vertex_property_sampler.h:24
Grid grid_type
Definition: inverse_distance_weighting_vertex_property_sampler.h:21
auto evaluate(pos_type const &x, real_type const) const -> tensor_type
Definition: inverse_distance_weighting_vertex_property_sampler.h:47
inverse_distance_weighting_vertex_property_sampler< Grid, Property > this_type
Definition: inverse_distance_weighting_vertex_property_sampler.h:20
inverse_distance_weighting_vertex_property_sampler(Grid const &g, Property const &p, real_type const radius)
Definition: inverse_distance_weighting_vertex_property_sampler.h:37
static auto constexpr num_dimensions() -> std::size_t
Definition: inverse_distance_weighting_vertex_property_sampler.h:15
Property property_type
Definition: inverse_distance_weighting_vertex_property_sampler.h:22
vec< real_type, NumDimensions > pos_type
Definition: field.h:20
Tensor tensor_type
Definition: field.h:18
auto insert_vertex(arithmetic auto const ... ts)
Definition: pointset.h:243
auto nearest_neighbors_radius_raw(pos_type const &x, Real const radius, flann::SearchParams const params={}) const -> std::pair< std::vector< int >, std::vector< Real > >
Definition: pointset.h:1088
auto vertices() const
Definition: pointset.h:226
static auto constexpr ood_tensor()
Definition: field.h:21