core
Shared MPI block decomposition + asynchronous ghost-layer exchange (header-only C++20)
Loading...
Searching...
No Matches
peclet::core Namespace Reference

Namespaces

namespace  amr
 
namespace  decomp
 
namespace  geom
 
namespace  halo
 
namespace  interp
 
namespace  python
 
namespace  solver
 

Classes

struct  FieldRec
 One registered field: its flat x-fastest device buffer plus the metadata a consumer needs to exchange or redistribute it. More...
 
class  FieldSet
 Name → FieldRec directory. More...
 
struct  NestedLoop
 Compile-time-unrolled nested loop over [bgn, end) in row-major (axis 0 fastest) order. More...
 
struct  NestedLoop< Dim, 0 >
 
struct  Range
 Half-open range [begin, end) carrying a label (e.g. a block id). Ported from pbs::IndxRange. More...
 

Typedefs

using Index = std::int64_t
 Signed index type for grids and particles (supersedes block_decomposer's long int IndxT).
 
using Real = double
 Default host floating type. Device kernels may use float; conversions happen at the boundary.
 
template<int Dim>
using IVec = std::array< Index, Dim >
 Multi-dimensional integer index / coordinate (x-fastest order by convention).
 
template<int Dim>
using Vec = std::array< Real, Dim >
 Multi-dimensional real vector.
 
using ExecSpace = Kokkos::DefaultExecutionSpace
 
using MemSpace = ExecSpace::memory_space
 
template<class T >
using View = Kokkos::View< T *, MemSpace >
 1D device array.
 
template<class T >
using HostView = decltype(Kokkos::create_mirror_view(std::declval< View< T > >()))
 Host-accessible mirror of View<T> (identical to View<T> on host backends).
 
using IndexView = Kokkos::View< Index *, MemSpace >
 Device array of grid/particle indices (the matched send/recv/self-copy lists).
 
template<class T >
using Field3D = Kokkos::View< T ***, Kokkos::LayoutLeft, MemSpace >
 3D structured field in the suite's x-fastest convention: LayoutLeft makes the leftmost (x) index contiguous, i.e.
 

Enumerations

enum class  Centering { Cell , FaceX , FaceY , FaceZ }
 Where a field's samples sit relative to a cell. More...
 

Functions

Index wrap (Index x, Index n)
 Periodic wrap of a coordinate into [0, n): wrap(x, n) = (x % n + n) % n.
 
template<int Dim, typename Func >
void forEachInBox (const IVec< Dim > &bgn, const IVec< Dim > &end, Func &&func)
 Iterate the box [bgn, end) calling func(const IVec<Dim>&).
 
template<class T >
View< TtoDevice (const std::vector< T > &h, const std::string &label)
 Upload a host std::vector into a freshly-sized device View (empty vector => empty view).
 
template<class V >
std::vector< std::remove_const_t< typename V::value_type > > toVector (const V &view)
 Copy a (host- or device-resident) Kokkos View of any rank into a contiguous host std::vector, flattened in C/row order (last index fastest) — an Nx3 View comes back as out[i*3 + c] == view(i,c), the suite's particle-SoA Python export order.
 

Typedef Documentation

◆ Index

Signed index type for grids and particles (supersedes block_decomposer's long int IndxT).

Definition at line 15 of file types.hpp.

◆ Real

Default host floating type. Device kernels may use float; conversions happen at the boundary.

Definition at line 18 of file types.hpp.

◆ IVec

template<int Dim>
using peclet::core::IVec = typedef std::array<Index, Dim>

Multi-dimensional integer index / coordinate (x-fastest order by convention).

Definition at line 22 of file types.hpp.

◆ Vec

template<int Dim>
using peclet::core::Vec = typedef std::array<Real, Dim>

Multi-dimensional real vector.

Definition at line 26 of file types.hpp.

◆ ExecSpace

using peclet::core::ExecSpace = typedef Kokkos::DefaultExecutionSpace

Definition at line 20 of file view.hpp.

◆ MemSpace

using peclet::core::MemSpace = typedef ExecSpace::memory_space

Definition at line 21 of file view.hpp.

◆ View

template<class T >
using peclet::core::View = typedef Kokkos::View<T*, MemSpace>

1D device array.

The halo addresses cells by precomputed flat local index, so a contiguous per-cell field is a View<T>; the x-fastest ordering lives in the indices, not the View layout.

Definition at line 26 of file view.hpp.

◆ HostView

template<class T >
using peclet::core::HostView = typedef decltype(Kokkos::create_mirror_view(std::declval<View<T> >()))

Host-accessible mirror of View<T> (identical to View<T> on host backends).

Defined via the actual create_mirror_view return type to stay correct across Kokkos backends/versions.

Definition at line 31 of file view.hpp.

◆ IndexView

Device array of grid/particle indices (the matched send/recv/self-copy lists).

Definition at line 34 of file view.hpp.

◆ Field3D

template<class T >
using peclet::core::Field3D = typedef Kokkos::View<T***, Kokkos::LayoutLeft, MemSpace>

3D structured field in the suite's x-fastest convention: LayoutLeft makes the leftmost (x) index contiguous, i.e.

I = x + y*nx + z*nx*ny — identical to peclet::core::Index linearization and cfd-gpu grids.

Definition at line 40 of file view.hpp.

Enumeration Type Documentation

◆ Centering

Where a field's samples sit relative to a cell.

Scalars/properties are cell-centred; the MAC face-normal velocity components are face-centred. (The staggered solver stores its face fields as cell-indexed arrays, so Centering is metadata for consumers — it does not change the buffer.)

Enumerator
Cell 
FaceX 
FaceY 
FaceZ 

Definition at line 32 of file field_set.hpp.

Function Documentation

◆ wrap()

Index peclet::core::wrap ( Index  x,
Index  n 
)
inline

Periodic wrap of a coordinate into [0, n): wrap(x, n) = (x % n + n) % n.

Definition at line 37 of file types.hpp.

Referenced by peclet::core::halo::GridHaloTopology< Dim >::buildTopology(), and peclet::core::halo::ParticleMigrator< Dim >::cellOf().

◆ forEachInBox()

template<int Dim, typename Func >
void peclet::core::forEachInBox ( const IVec< Dim > &  bgn,
const IVec< Dim > &  end,
Func &&  func 
)
inline

Iterate the box [bgn, end) calling func(const IVec<Dim>&).

Definition at line 65 of file types.hpp.

References peclet::core::NestedLoop< Dim, Axis >::run().

◆ toDevice()

◆ toVector()

template<class V >
std::vector< std::remove_const_t< typename V::value_type > > peclet::core::toVector ( const V view)

Copy a (host- or device-resident) Kokkos View of any rank into a contiguous host std::vector, flattened in C/row order (last index fastest) — an Nx3 View comes back as out[i*3 + c] == view(i,c), the suite's particle-SoA Python export order.

This replaces the redundant "create_mirror_view → deep_copy → element-by-element loop → std::vector" idiom in the binding getters (S2a) with a single device→host transfer and no hand-written loop. The row-order flatten is layout-correct on every backend: a LayoutLeft (e.g. CUDA-default) device View is transposed on the host hop rather than blindly memcpy'd, so the exported ordering matches across CPU/GPU builds.

Definition at line 63 of file view.hpp.

Referenced by peclet::core::amr::AmrFlow< Bits >::faceField(), peclet::core::amr::AmrFlow< Bits >::pressure(), peclet::core::amr::AmrFlow< Bits >::velocities(), and peclet::core::amr::AmrFlow< Bits >::velocity().