SubCoordinates< Base > Class Template Reference#

DiFfRG: DiFfRG::SubCoordinates< Base > Class Template Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows
DiFfRG::SubCoordinates< Base > Class Template Reference

A contiguous window into the linear index range of another coordinate system. More...

#include <coordinates.hh>

Inheritance diagram for DiFfRG::SubCoordinates< Base >:

Public Types

using ctype = typename Base::ctype
 

Public Member Functions

 SubCoordinates (const Base &base, size_t offset, size_t size)
 
device::array< size_t, dim > KOKKOS_FORCEINLINE_FUNCTION sizes () const
 
size_t KOKKOS_FORCEINLINE_FUNCTION size () const
 
device::array< size_t, dim > KOKKOS_INLINE_FUNCTION from_linear_index (size_t s) const
 
template<typename... I>
requires (std::is_convertible_v<std::decay_t<I>, size_t> && ...)
KOKKOS_FORCEINLINE_FUNCTION device::array< ctype, dim > forward (I &&...i) const
 
template<typename IT >
KOKKOS_INLINE_FUNCTION device::array< ctype, dim > forward (device::array< IT, dim > i) const
 Takes a base multi-index, i.e. what from_linear_index() above returns.
 
std::string to_string () const
 

Static Public Attributes

static constexpr size_t dim = Base::dim
 

Private Attributes

size_t m_offset
 
size_t m_size
 

Detailed Description

template<typename Base>
class DiFfRG::SubCoordinates< Base >

A contiguous window into the linear index range of another coordinate system.

The window is [offset, offset + size) of Base's flattened grid, which is exactly the shape MapScheduler hands out (part(G, r, j)), and it is deliberately not a per-axis box. An earlier version derived one, by running Base::from_linear_index() on both ends and subtracting; that is only the same set when dim == 1, which is why splitting used to be restricted to one-dimensional grids and the expensive multi-angle vertex flows were assigned whole to a single rank.

Carrying the linear offset instead makes the window exact in any dimension, at no cost: from_linear_index(s) returns the base multi-index of global point offset + s, and forward() is then Base::forward unchanged. So the position computed for a windowed point is the same fp64 value as the unwindowed run computes for that global point, which is what keeps a distributed result bitwise identical to a serial one.

Only MapScheduler's four map() call sites construct this.

Member Typedef Documentation

◆ ctype

template<typename Base >
using DiFfRG::SubCoordinates< Base >::ctype = typename Base::ctype

Constructor & Destructor Documentation

◆ SubCoordinates()

template<typename Base >
DiFfRG::SubCoordinates< Base >::SubCoordinates ( const Base & base,
size_t offset,
size_t size )
inline

Member Function Documentation

◆ forward() [1/2]

template<typename Base >
template<typename IT >
KOKKOS_INLINE_FUNCTION device::array< ctype, dim > DiFfRG::SubCoordinates< Base >::forward ( device::array< IT, dim > i) const
inline

Takes a base multi-index, i.e. what from_linear_index() above returns.

◆ forward() [2/2]

template<typename Base >
template<typename... I>
requires (std::is_convertible_v<std::decay_t<I>, size_t> && ...)
KOKKOS_FORCEINLINE_FUNCTION device::array< ctype, dim > DiFfRG::SubCoordinates< Base >::forward ( I &&... i) const
inline

Spelled-out array rather than forward({{i...}}): a braced-init-list cannot deduce the element type of the overload below, so the old spelling was ill-formed the moment anyone called it. Nothing on the map() path does, which is why it never showed up.

◆ from_linear_index()

template<typename Base >
device::array< size_t, dim > KOKKOS_INLINE_FUNCTION DiFfRG::SubCoordinates< Base >::from_linear_index ( size_t s) const
inline

The base multi-index of the window's s-th point. Note this is a base index: it is fed straight back into Base::forward(), which is what makes the positions identical to the unwindowed ones.

◆ size()

template<typename Base >
size_t KOKKOS_FORCEINLINE_FUNCTION DiFfRG::SubCoordinates< Base >::size ( ) const
inline

◆ sizes()

template<typename Base >
device::array< size_t, dim > KOKKOS_FORCEINLINE_FUNCTION DiFfRG::SubCoordinates< Base >::sizes ( ) const
inline

Per-axis extents, which a linear window only has when the grid is one-dimensional. Nothing on the map() path calls this – the integrators drive everything off size() and from_linear_index() – so a caller that needs a box should say so at compile time rather than receive a plausible-looking wrong answer.

◆ to_string()

template<typename Base >
std::string DiFfRG::SubCoordinates< Base >::to_string ( ) const
inline

Identifies the window, not just the base grid: the position cache in QuadratureIntegrator keys on this, and two windows into one base grid must not collide.

Member Data Documentation

◆ dim

template<typename Base >
size_t DiFfRG::SubCoordinates< Base >::dim = Base::dim
staticconstexpr

◆ m_offset

template<typename Base >
size_t DiFfRG::SubCoordinates< Base >::m_offset
private

◆ m_size

template<typename Base >
size_t DiFfRG::SubCoordinates< Base >::m_size
private

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/coordinates/coordinates.hh