Tatooine
vertex_property_sampler.h
Go to the documentation of this file.
1#ifndef TATOOINE_RECTILINEAR_GRID_VERTEX_PROPERTY_SAMPLER_H
2#define TATOOINE_RECTILINEAR_GRID_VERTEX_PROPERTY_SAMPLER_H
3//==============================================================================
5#include <tatooine/concepts.h>
6#include <tatooine/crtp.h>
8#include <tatooine/field.h>
12
13#include <vector>
14//==============================================================================
16//==============================================================================
17template <typename Derived, typename Real, std::size_t N, typename Tensor>
18struct field;
19//------------------------------------------------------------------------------
20template <typename GridVertexProperty,
21 template <typename> typename... InterpolationKernels>
23//==============================================================================
24template <typename TopSampler, typename Real, typename ValueType,
25 template <typename> typename... InterpolationKernels>
27//==============================================================================
28template <typename DerivedSampler, typename Real, typename ValueType,
29 template <typename> typename... InterpolationKernels>
31//------------------------------------------------------------------------------
32template <typename DerivedSampler, typename Real, typename ValueType,
33 template <typename> typename InterpolationKernel0,
34 template <typename> typename InterpolationKernel1,
35 template <typename> typename... TailInterpolationKernels>
37 DerivedSampler, Real, ValueType, InterpolationKernel0, InterpolationKernel1,
38 TailInterpolationKernels...> {
39 using value_type =
40 vertex_property_sampler_view<DerivedSampler, Real, ValueType,
41 InterpolationKernel1,
42 TailInterpolationKernels...>;
43};
44//------------------------------------------------------------------------------
45template <typename DerivedSampler, typename Real, typename ValueType,
46 template <typename> typename InterpolationKernel>
47struct base_vertex_property_sampler_at<DerivedSampler, Real, ValueType,
48 InterpolationKernel> {
49 using value_type = std::decay_t<ValueType>&;
50};
51//==============================================================================
52template <typename DerivedSampler, typename Real, typename ValueType,
53 template <typename> typename... InterpolationKernels>
55 DerivedSampler, Real, ValueType, InterpolationKernels...>::value_type;
56//==============================================================================
59template <typename DerivedSampler, typename Real, typename ValueType,
60 template <typename> typename HeadInterpolationKernel,
61 template <typename> typename... TailInterpolationKernels>
63 template <typename, typename, typename, template <typename> typename,
64 template <typename> typename...>
66 //----------------------------------------------------------------------------
67 // typedefs
68 //----------------------------------------------------------------------------
69 using this_type =
70 base_vertex_property_sampler<DerivedSampler, Real, ValueType,
71 HeadInterpolationKernel,
72 TailInterpolationKernels...>;
74 this_type, Real, ValueType, HeadInterpolationKernel,
75 TailInterpolationKernels...>;
76 using real_type = Real;
77 using value_type = ValueType;
78 static auto constexpr current_dimension_index() {
79 return DerivedSampler::current_dimension_index();
80 }
81 static auto constexpr num_dimensions() -> std::size_t {
82 return sizeof...(TailInterpolationKernels) + 1;
83 }
84 static auto constexpr num_components() {
85 return tatooine::tensor_num_components<value_type>;
86 }
87 //----------------------------------------------------------------------------
89 [[nodiscard]] auto constexpr as_derived_sampler() -> DerivedSampler& {
90 return static_cast<DerivedSampler&>(*this);
91 }
92 //----------------------------------------------------------------------------
94 [[nodiscard]] auto constexpr as_derived_sampler() const
95 -> DerivedSampler const& {
96 return static_cast<DerivedSampler const&>(*this);
97 }
98 //============================================================================
99 auto property() const -> auto const& {
100 return as_derived_sampler().property();
101 }
102 //----------------------------------------------------------------------------
103 auto grid() const -> auto const& { return as_derived_sampler().grid(); }
104 //----------------------------------------------------------------------------
107 auto data_at(integral auto const... is) const -> value_type const& {
108 static_assert(sizeof...(is) == num_dimensions(),
109 "Number of indices does not match number of dimensions.");
110 return as_derived_sampler().data_at(is...);
111 }
112 //----------------------------------------------------------------------------
113 auto position_at(integral auto const... is) const {
114 static_assert(sizeof...(is) == num_dimensions(),
115 "Number of indices does not match number of dimensions.");
116 return as_derived_sampler().position_at(is...);
117 }
118 //----------------------------------------------------------------------------
119 template <std::size_t DimensionIndex>
120 auto cell_index(arithmetic auto const x) const -> decltype(auto) {
121 return as_derived_sampler().template cell_index<DimensionIndex>(x);
122 }
123 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
127 auto at(std::size_t const i) const -> decltype(auto) {
128 if constexpr (num_dimensions() > 1) {
129 return indexing_type{*this, i};
130 } else {
131 return data_at(i);
132 }
133 }
134 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
135 auto operator[](std::size_t i) const -> decltype(auto) { return at(i); }
136 //----------------------------------------------------------------------------
137 protected:
138 auto finite_differences_coefficients(std::size_t const vertex_index,
139 std::size_t const stencil_size) const {
140 auto d = grid().finite_differences_coefficients(
141 stencil_size, current_dimension_index(), vertex_index);
142 return d;
143 }
144 //----------------------------------------------------------------------------
146 template <typename It>
147 auto differentiate(floating_point_range auto const& coeffs, It sample_begin,
148 It sample_end) const {
149 auto df_dx = value_type{};
150 auto sample_it = sample_begin;
151 auto coeff_it = begin(coeffs);
152 for (; sample_it != sample_end; ++sample_it, ++coeff_it) {
153 if (*coeff_it != 0) {
154 df_dx += *coeff_it * *sample_it;
155 }
156 }
157 return df_dx;
158 }
159 //----------------------------------------------------------------------------
160 auto interpolate_cell_without_derivative(auto const& cit_head,
161 auto const&... cit_tail) const
162 -> value_type {
163 auto const [cell_index, interpolation_factor] = cit_head;
164 if constexpr (num_dimensions() == 1) {
165 return HeadInterpolationKernel{
166 at(cell_index), at(cell_index + 1)}(interpolation_factor);
167 } else {
168 return HeadInterpolationKernel{
169 at(cell_index).interpolate_cell(cit_tail...),
170 at(cell_index + 1).interpolate_cell(cit_tail...)}(
171 interpolation_factor);
172 }
173 }
174 //----------------------------------------------------------------------------
175 auto interpolate_cell_with_one_derivative(auto const& cit_head,
176 auto const&... cit_tail) const
177 -> value_type {
178 auto const [left_global_index, interpolation_factor] = cit_head;
179 auto const right_global_index = left_global_index + 1;
180 auto const& dim = grid().template dimension<current_dimension_index()>();
181 auto const stencil_size = min(dim.size(), std::size_t(5));
182 auto const half_stencil_size = stencil_size / 2;
183
184 auto left_global_begin = left_global_index < half_stencil_size
185 ? std::size_t(0)
186 : left_global_index - half_stencil_size;
187 if (auto potential_left_global_end = left_global_begin + stencil_size;
188 potential_left_global_end > dim.size()) {
189 left_global_begin -= potential_left_global_end - dim.size();
190 }
191 auto const left_global_end = left_global_begin + stencil_size;
192
193 auto right_global_end =
194 dim.size() - right_global_index <= half_stencil_size
195 ? dim.size()
196 : right_global_index + half_stencil_size + 1;
197 if (right_global_end < stencil_size) {
198 right_global_end = stencil_size ;
199 }
200 auto const right_global_begin = right_global_end - stencil_size;
201
202 auto const range_global_begin = min(left_global_begin, right_global_begin);
203 auto const range_global_end = max(left_global_end, right_global_end);
204
205 auto const left_local_index = left_global_index - range_global_begin;
206 auto const right_local_index = left_local_index + 1;
207
208 // get samples for calculating derivatives
209 auto samples = std::vector<value_type>{};
210 samples.reserve(stencil_size + 1);
211 // get samples
212 for (auto i = range_global_begin; i < range_global_end; ++i) {
213 if constexpr (num_dimensions() == 1) {
214 samples.push_back(at(i));
215 } else {
216 samples.push_back(at(i).interpolate_cell(cit_tail...));
217 }
218 }
219
220 // differentiate left sample
221 auto coeffs_left =
222 finite_differences_coefficients(left_global_index, stencil_size);
223 auto const dleft_dx = differentiate(coeffs_left, begin(samples),
224 begin(samples) + stencil_size);
225
226 // differentiate right sample
227 auto coeffs_right =
228 finite_differences_coefficients(right_global_index, stencil_size);
229 auto const dright_dx =
230 differentiate(coeffs_right, end(samples) - stencil_size, end(samples));
231
232 auto const dy = dim[right_global_index] - dim[left_global_index];
233 return HeadInterpolationKernel<value_type>{
234 samples[left_local_index], samples[right_local_index], dleft_dx * dy,
235 dright_dx * dy}(interpolation_factor);
236 }
237 //----------------------------------------------------------------------------
239 auto constexpr interpolate_cell(
240 auto const&... cell_indices_interpolation_factors) const -> value_type {
241 auto constexpr num_derivatives_needed =
242 HeadInterpolationKernel<value_type>::num_derivatives;
243 if constexpr (num_derivatives_needed == 0) {
245 cell_indices_interpolation_factors...);
246 } else if constexpr (num_derivatives_needed == 1) {
248 cell_indices_interpolation_factors...);
249 }
250 }
251 //------------------------------------------------------------------------------
252 template <std::size_t... Is>
253 auto constexpr sample(std::index_sequence<Is...> /*seq*/,
254 arithmetic auto const... xs) const -> value_type
255 requires(sizeof...(Is) == sizeof...(xs)) {
256 return interpolate_cell(cell_index<Is>(xs)...);
257 }
258};
259//==============================================================================
260template <typename GridVertexProperty,
261 template <typename> typename... InterpolationKernels>
264 vertex_property_sampler<GridVertexProperty, InterpolationKernels...>,
265 typename GridVertexProperty::real_type,
266 typename GridVertexProperty::value_type, InterpolationKernels...>,
268 vertex_property_sampler<GridVertexProperty, InterpolationKernels...>,
269 typename GridVertexProperty::real_type,
270 sizeof...(InterpolationKernels),
271 typename GridVertexProperty::value_type> {
272 static_assert(sizeof...(InterpolationKernels) ==
273 GridVertexProperty::num_dimensions());
274 using property_type = GridVertexProperty;
275 using this_type =
276 vertex_property_sampler<property_type, InterpolationKernels...>;
277 using real_type = typename GridVertexProperty::real_type;
278 using value_type = typename GridVertexProperty::value_type;
281 InterpolationKernels...>;
283 tatooine::field<this_type, real_type, sizeof...(InterpolationKernels),
284 value_type>;
285 //============================================================================
286 static constexpr std::size_t current_dimension_index() { return 0; }
287 //----------------------------------------------------------------------------
288 static auto constexpr num_dimensions() -> std::size_t {
289 return sizeof...(InterpolationKernels);
290 }
291 //----------------------------------------------------------------------------
292 static_assert(is_floating_point<tatooine::value_type<value_type>>);
293 //============================================================================
294 private:
296 //============================================================================
297 public:
299 //----------------------------------------------------------------------------
302 //============================================================================
303 auto property() const -> auto const& { return m_property; }
304 //----------------------------------------------------------------------------
305 auto grid() const -> auto const& { return m_property.grid(); }
306 //----------------------------------------------------------------------------
307 auto data_at(integral auto const... is) const -> value_type const&
308 requires(sizeof...(is) == GridVertexProperty::grid_type::num_dimensions()) {
309 return m_property(is...);
310 }
311 //----------------------------------------------------------------------------
312 auto position_at(integral auto const... is) const {
313 static_assert(sizeof...(is) == num_dimensions(),
314 "Number of indices does not match number of dimensions.");
315 return grid().position_at(is...);
316 }
317 //----------------------------------------------------------------------------
318 template <std::size_t DimensionIndex>
319 auto cell_index(arithmetic auto const x) const -> decltype(auto) {
320 return grid().template cell_index<DimensionIndex>(x);
321 }
322 //----------------------------------------------------------------------------
323 auto evaluate(typename field_parent_type::pos_type const& x,
324 typename field_parent_type::real_type const /*t*/) const ->
325 value_type {
326 if (!grid().is_inside(x)) {
328 }
329 return invoke_unpacked(
330 [&](auto const... xs) {
331 return this->sample(std::make_index_sequence<num_dimensions()>{},
332 xs...);
333 },
334 unpack(x));
335 }
336};
337//==============================================================================
341template <typename TopSampler, typename Real, typename ValueType,
342 template <typename> typename... InterpolationKernels>
345 vertex_property_sampler_view<TopSampler, Real, ValueType,
346 InterpolationKernels...>,
347 Real, ValueType, InterpolationKernels...> {
348 //============================================================================
349 static auto constexpr data_is_changeable() {
350 return TopSampler::data_is_changeable();
351 }
352 using this_type = vertex_property_sampler_view<TopSampler, Real, ValueType,
353 InterpolationKernels...>;
354 using real_type = Real;
355 using value_type = ValueType;
358 InterpolationKernels...>;
359 //============================================================================
360 static auto constexpr num_dimensions() -> std::size_t {
361 return TopSampler::num_dimensions() - 1;
362 }
363 //============================================================================
364 static auto constexpr current_dimension_index() {
365 return TopSampler::current_dimension_index() + 1;
366 }
367 //============================================================================
368 TopSampler const& m_top_sampler;
369 std::size_t m_fixed_index;
370 //============================================================================
371 vertex_property_sampler_view(TopSampler const& top_sampler,
372 std::size_t const fixed_index)
373 : m_top_sampler{top_sampler}, m_fixed_index{fixed_index} {}
374 //============================================================================
375 auto constexpr property() const -> auto const& {
376 return m_top_sampler.property();
377 }
378 //----------------------------------------------------------------------------
379 auto grid() const -> auto const& { return m_top_sampler.grid(); }
380 //----------------------------------------------------------------------------
383 auto constexpr data_at(integral auto const... is) const -> value_type const& {
384 static_assert(sizeof...(is) == num_dimensions(),
385 "Number of indices is not equal to number of dimensions.");
386 return m_top_sampler.data_at(m_fixed_index, is...);
387 }
388 //----------------------------------------------------------------------------
389 template <std::size_t DimensionIndex>
390 auto constexpr cell_index(arithmetic auto const x) const -> decltype(auto) {
391 return m_top_sampler.template cell_index<DimensionIndex>(x);
392 }
393};
394//==============================================================================
395template <typename GridVertexProperty,
396 template <typename> typename... InterpolationKernels>
398 static auto constexpr num_dimensions() -> std::size_t {
399 return GridVertexProperty::num_dimensions();
400 }
401
402 private:
403 vertex_property_sampler<GridVertexProperty, InterpolationKernels...> const&
405
406 public:
408 vertex_property_sampler<GridVertexProperty,
409 InterpolationKernels...> const&
412 //----------------------------------------------------------------------------
413 template <typename Tensor, typename TensorReal>
414 auto constexpr sample(
415 base_tensor<Tensor, TensorReal, num_dimensions()> const& x) const {
416 auto constexpr eps = 1e-9;
417 vec<TensorReal, num_dimensions()> fw = x, bw = x;
418
419 using value_type = typename std::decay_t<decltype(m_sampler)>::value_type;
420 if constexpr (is_arithmetic<value_type>) {
421 auto gradient = vec<value_type, num_dimensions()>::zeros();
422 for (std::size_t i = 0; i < num_dimensions(); ++i) {
423 fw(i) += eps;
424 bw(i) -= eps;
425 auto dx = eps + eps;
426
427 if (!m_sampler.grid().is_inside(fw)) {
428 fw(i) = x(i);
429 dx = eps;
430 }
431
432 if (!m_sampler.grid().is_inside(bw)) {
433 bw(i) = x(i);
434 dx = eps;
435 }
436
437 gradient(i) = m_sampler(fw) / dx - m_sampler(bw) / dx;
438 fw(i) = x(i);
439 bw(i) = x(i);
440 }
441 return gradient;
442 }
443 }
444 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
445 auto constexpr sample(arithmetic auto const... xs) const {
446 return sample(
447 vec<typename GridVertexProperty::grid_type::real_type, sizeof...(xs)>{
448 xs...});
449 }
450};
451//==============================================================================
452template <typename GridVertexProperty>
453struct differentiated_sampler<GridVertexProperty, interpolation::linear,
455 static auto constexpr num_dimensions() -> std::size_t { return 2; }
456
457 private:
460
461 public:
467 //----------------------------------------------------------------------------
468 public:
469 auto constexpr sample(arithmetic auto x, arithmetic auto y) const {
470 auto const [ix, u] = m_sampler.template cell_index<0>(x);
471 auto const [iy, v] = m_sampler.template cell_index<1>(y);
472 auto const& a = m_sampler.data_at(ix, iy);
473 auto const& b = m_sampler.data_at(ix + 1, iy);
474 auto const& c = m_sampler.data_at(ix, iy + 1);
475 auto const& d = m_sampler.data_at(ix + 1, iy + 1);
476
477 auto const k = d - c - b + a;
478 auto const dx = k * v + b - a;
479 auto const dy = k * u + c - a;
480 using value_type = typename std::decay_t<decltype(m_sampler)>::value_type;
481 if constexpr (arithmetic<value_type>) {
482 return vec{dx, dy};
483 } else if constexpr (static_vec<value_type>) {
484 return mat{{dx(0), dy(0)}, {dx(1), dy(1)}};
485 }
486 }
487 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
488 template <typename Tensor, typename TensorReal>
489 auto constexpr sample(
490 base_tensor<Tensor, TensorReal, num_dimensions()> const& x) const {
491 return invoke_unpacked([this](auto const... xs) { return sample(xs...); },
492 unpack(x));
493 }
494};
495//==============================================================================
496template <typename GridVertexProperty>
497struct differentiated_sampler<GridVertexProperty, interpolation::linear,
499 static auto constexpr num_dimensions() -> std::size_t { return 3; }
500
501 private:
505
506 public:
509 GridVertexProperty, interpolation::linear, interpolation::linear,
512 //----------------------------------------------------------------------------
513 public:
514 auto constexpr sample(arithmetic auto x, arithmetic auto y,
515 arithmetic auto z) const {
516 auto const [ix, u] = m_sampler.template cell_index<0>(x);
517 auto const [iy, v] = m_sampler.template cell_index<1>(y);
518 auto const [iz, w] = m_sampler.template cell_index<2>(z);
519 auto const& a = m_sampler.data_at(ix, iy, iz);
520 auto const& b = m_sampler.data_at(ix + 1, iy, iz);
521 auto const& c = m_sampler.data_at(ix, iy + 1, iz);
522 auto const& d = m_sampler.data_at(ix + 1, iy + 1, iz);
523 auto const& e = m_sampler.data_at(ix, iy, iz + 1);
524 auto const& f = m_sampler.data_at(ix + 1, iy, iz + 1);
525 auto const& g = m_sampler.data_at(ix, iy + 1, iz + 1);
526 auto const& h = m_sampler.data_at(ix + 1, iy + 1, iz + 1);
527
528 auto const k = h - g - f + e - d + c + b - a;
529 auto const dx = (k * v + f - e - b + a) * w + (d - c - b + a) * v + b - a;
530 auto const dy = (k * u + g - e - c + a) * w + (d - c - b + a) * u + c - a;
531 auto const dz = (k * u + g - e - c + a) * v + (f - e - b + a) * u + e - a;
532 using value_type = typename std::decay_t<decltype(m_sampler)>::value_type;
533 if constexpr (arithmetic<value_type>) {
534 return vec{dx, dy, dz};
535 } else if constexpr (static_vec<value_type>) {
536 return mat{
537 {dx(0), dy(0), dz(0)}, {dx(1), dy(1), dz(1)}, {dx(2), dy(2), dz(2)}};
538 }
539 }
540 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
541 template <typename Tensor, typename TensorReal>
542 auto constexpr sample(
543 base_tensor<Tensor, TensorReal, num_dimensions()> const& x) const {
544 return invoke_unpacked(unpack(x),
545 [this](auto const... xs) { return sample(xs...); });
546 }
547};
548//==============================================================================
549template <typename GridVertexProperty,
550 template <typename> typename... InterpolationKernels>
551auto diff(
554 return differentiated_sampler<GridVertexProperty, InterpolationKernels...>{
556}
557//==============================================================================
558} // namespace tatooine::detail::rectilinear_grid
559//==============================================================================
560#endif
Definition: concepts.h:33
Definition: concepts.h:94
Definition: concepts.h:21
Definition: tensor_concepts.h:23
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
typename base_vertex_property_sampler_at< DerivedSampler, Real, ValueType, InterpolationKernels... >::value_type base_vertex_property_sampler_at_t
Definition: vertex_property_sampler.h:55
auto diff(typed_vertex_property_interface< Grid, ValueType, HasNonConstReference > const &prop, std::size_t const stencil_size=default_diff_stencil_size)
Definition: vertex_property.h:822
typename value_type_impl< T >::type value_type
Definition: type_traits.h:280
constexpr auto max(A &&a, B &&b)
Definition: math.h:20
constexpr auto min(A &&a, B &&b)
Definition: math.h:15
constexpr decltype(auto) invoke_unpacked(F &&f)
All arguments are bound -> just call f.
Definition: invoke_unpacked.h:15
Definition: base_tensor.h:23
auto constexpr interpolate_cell(auto const &... cell_indices_interpolation_factors) const -> value_type
Decides if first derivative is needed or not.
Definition: vertex_property_sampler.h:239
static auto constexpr num_dimensions() -> std::size_t
Definition: vertex_property_sampler.h:81
ValueType value_type
Definition: vertex_property_sampler.h:77
auto interpolate_cell_without_derivative(auto const &cit_head, auto const &... cit_tail) const -> value_type
Definition: vertex_property_sampler.h:160
auto at(std::size_t const i) const -> decltype(auto)
Definition: vertex_property_sampler.h:127
auto operator[](std::size_t i) const -> decltype(auto)
Definition: vertex_property_sampler.h:135
friend struct base_vertex_property_sampler
Definition: vertex_property_sampler.h:65
auto constexpr as_derived_sampler() const -> DerivedSampler const &
returns casted as_derived data
Definition: vertex_property_sampler.h:94
base_vertex_property_sampler_at_t< this_type, Real, ValueType, HeadInterpolationKernel, TailInterpolationKernels... > indexing_type
Definition: vertex_property_sampler.h:75
auto position_at(integral auto const ... is) const
Definition: vertex_property_sampler.h:113
Real real_type
Definition: vertex_property_sampler.h:76
auto constexpr sample(std::index_sequence< Is... >, arithmetic auto const ... xs) const -> value_type requires(sizeof...(Is)==sizeof...(xs))
Definition: vertex_property_sampler.h:253
base_vertex_property_sampler< DerivedSampler, Real, ValueType, HeadInterpolationKernel, TailInterpolationKernels... > this_type
Definition: vertex_property_sampler.h:72
auto finite_differences_coefficients(std::size_t const vertex_index, std::size_t const stencil_size) const
Definition: vertex_property_sampler.h:138
auto data_at(integral auto const ... is) const -> value_type const &
Definition: vertex_property_sampler.h:107
static auto constexpr current_dimension_index()
Definition: vertex_property_sampler.h:78
static auto constexpr num_components()
Definition: vertex_property_sampler.h:84
auto interpolate_cell_with_one_derivative(auto const &cit_head, auto const &... cit_tail) const -> value_type
Definition: vertex_property_sampler.h:175
auto differentiate(floating_point_range auto const &coeffs, It sample_begin, It sample_end) const
Calcuates derivative from samples and differential coefficients.
Definition: vertex_property_sampler.h:147
auto grid() const -> auto const &
Definition: vertex_property_sampler.h:103
auto property() const -> auto const &
Definition: vertex_property_sampler.h:99
auto constexpr as_derived_sampler() -> DerivedSampler &
returns casted as_derived data
Definition: vertex_property_sampler.h:89
auto cell_index(arithmetic auto const x) const -> decltype(auto)
Definition: vertex_property_sampler.h:120
differentiated_sampler(vertex_property_sampler< GridVertexProperty, interpolation::linear, interpolation::linear, interpolation::linear > const &vertex_property_sampler)
Definition: vertex_property_sampler.h:507
auto constexpr sample(arithmetic auto x, arithmetic auto y, arithmetic auto z) const
Definition: vertex_property_sampler.h:514
auto constexpr sample(base_tensor< Tensor, TensorReal, num_dimensions()> const &x) const
Definition: vertex_property_sampler.h:542
vertex_property_sampler< GridVertexProperty, interpolation::linear, interpolation::linear, interpolation::linear > const & m_sampler
Definition: vertex_property_sampler.h:504
vertex_property_sampler< GridVertexProperty, interpolation::linear, interpolation::linear > const & m_sampler
Definition: vertex_property_sampler.h:459
auto constexpr sample(base_tensor< Tensor, TensorReal, num_dimensions()> const &x) const
Definition: vertex_property_sampler.h:489
auto constexpr sample(arithmetic auto x, arithmetic auto y) const
Definition: vertex_property_sampler.h:469
differentiated_sampler(vertex_property_sampler< GridVertexProperty, interpolation::linear, interpolation::linear > const &vertex_property_sampler)
Definition: vertex_property_sampler.h:462
Definition: vertex_property_sampler.h:397
differentiated_sampler(vertex_property_sampler< GridVertexProperty, InterpolationKernels... > const &vertex_property_sampler)
Definition: vertex_property_sampler.h:407
vertex_property_sampler< GridVertexProperty, InterpolationKernels... > const & m_sampler
Definition: vertex_property_sampler.h:404
auto constexpr sample(base_tensor< Tensor, TensorReal, num_dimensions()> const &x) const
Definition: vertex_property_sampler.h:414
static auto constexpr num_dimensions() -> std::size_t
Definition: vertex_property_sampler.h:398
auto constexpr sample(arithmetic auto const ... xs) const
Definition: vertex_property_sampler.h:445
Definition: vertex_property_sampler.h:18
auto constexpr property() const -> auto const &
Definition: vertex_property_sampler.h:375
std::size_t m_fixed_index
Definition: vertex_property_sampler.h:369
static auto constexpr num_dimensions() -> std::size_t
Definition: vertex_property_sampler.h:360
static auto constexpr data_is_changeable()
Definition: vertex_property_sampler.h:349
TopSampler const & m_top_sampler
Definition: vertex_property_sampler.h:368
auto constexpr data_at(integral auto const ... is) const -> value_type const &
Definition: vertex_property_sampler.h:383
auto grid() const -> auto const &
Definition: vertex_property_sampler.h:379
auto constexpr cell_index(arithmetic auto const x) const -> decltype(auto)
Definition: vertex_property_sampler.h:390
ValueType value_type
Definition: vertex_property_sampler.h:355
static auto constexpr current_dimension_index()
Definition: vertex_property_sampler.h:364
Real real_type
Definition: vertex_property_sampler.h:354
vertex_property_sampler_view< TopSampler, Real, ValueType, InterpolationKernels... > this_type
Definition: vertex_property_sampler.h:353
vertex_property_sampler_view(TopSampler const &top_sampler, std::size_t const fixed_index)
Definition: vertex_property_sampler.h:371
Definition: vertex_property_sampler.h:271
vertex_property_sampler< property_type, InterpolationKernels... > this_type
Definition: vertex_property_sampler.h:276
vertex_property_sampler(vertex_property_sampler &&other) noexcept=default
auto position_at(integral auto const ... is) const
Definition: vertex_property_sampler.h:312
auto data_at(integral auto const ... is) const -> value_type const &requires(sizeof...(is)==GridVertexProperty::grid_type::num_dimensions())
Definition: vertex_property_sampler.h:307
auto property() const -> auto const &
Definition: vertex_property_sampler.h:303
typename GridVertexProperty::value_type value_type
Definition: vertex_property_sampler.h:278
vertex_property_sampler(property_type const &prop)
Definition: vertex_property_sampler.h:298
auto cell_index(arithmetic auto const x) const -> decltype(auto)
Definition: vertex_property_sampler.h:319
auto evaluate(typename field_parent_type::pos_type const &x, typename field_parent_type::real_type const) const -> value_type
Definition: vertex_property_sampler.h:323
static constexpr std::size_t current_dimension_index()
Definition: vertex_property_sampler.h:286
static auto constexpr num_dimensions() -> std::size_t
Definition: vertex_property_sampler.h:288
vertex_property_sampler(vertex_property_sampler const &other)=default
auto grid() const -> auto const &
Definition: vertex_property_sampler.h:305
GridVertexProperty property_type
Definition: vertex_property_sampler.h:274
property_type const & m_property
Definition: vertex_property_sampler.h:295
typename GridVertexProperty::real_type real_type
Definition: vertex_property_sampler.h:277
Definition: field.h:134
Real real_type
Definition: field.h:17
Definition: interpolation.h:16
Definition: mat.h:14
static auto constexpr ood_tensor()
Definition: field.h:21
Definition: invoke_unpacked.h:11
Definition: vec.h:12