Skip to content

num::scalar_field_like

Defined in header <fields/concepts.hpp>

template <class F, class T = real>
concept scalar_field_like = field<T> && requires(F &f, const F &cf, int i, int j) {
  { cf(i, j) } -> std::convertible_to<T>;
  { f(i, j) } -> std::convertible_to<T &>;
  { f.as_vec() };
};

scalar-valued field sampled on a grid.

Indexing by grid coordinate reads a sample. The values are contiguous and exposed as a vector space, so a field can be handed to a Krylov solver without being copied.