Class TempLat::Field
template <typename T, size_t _NDim>
A class which is a classical field on your n-dimensional equisized grid. You use it as a scalar field, a vector component, whatever. Template parameter is your type of floating point precision: float or double. Default: double. More...
#include <field.h>
Inherits the following classes: TempLat::FieldNDimCheck, TempLat::ConfigView
Public Types
| Type | Name |
|---|---|
| typedef T | value_type |
Public Static Attributes
| Type | Name |
|---|---|
| constexpr size_t | NDim = \_NDim |
Public Static Attributes inherited from TempLat::ConfigView
| Type | Name |
|---|---|
| constexpr size_t | NDim = \_NDim |
Public Static Attributes inherited from TempLat::AbstractField
| Type | Name |
|---|---|
| constexpr size_t | NDim = \_NDim |
Public Functions
| Type | Name |
|---|---|
| Field (std::string name, device::memory::host_ptr< MemoryToolBox< NDim > > toolBox, LatticeParameters< T > pLatPar=LatticeParameters< T >()) |
|
| auto | d (const S & other) const |
| device::Idx | d (const Field< T, NDim > & other) const The real overlord: is it a Field , then we must compare. |
| auto | d (const S & other) const |
| FourierView< T, NDim > & | inFourierSpace () The Fourier-space view, materialised on first use. |
| void | operator= (R && g) |
| void | operator= (const Field< T, NDim > & other) |
Public Functions inherited from TempLat::ConfigView
| Type | Name |
|---|---|
| ConfigView (std::string name, device::memory::host_ptr< MemoryToolBox< NDim > > toolBox, LatticeParameters< T > pLatPar) |
|
| void | assign (R && g) |
| void | confirmSpace (const LayoutStruct< NDim > & newLayout, const SpaceStateType & spaceType) const |
| DEVICE_INLINE_FUNCTION auto | eval (const IDX &... idx) const |
| auto | getFullNDHostView () const |
| const auto & | getLayout () const |
| auto | getLocalNDHostView () const |
| auto | getRawHostView () const |
| DEVICE_INLINE_FUNCTION T & | getSet (IDX &&... idx) const |
| auto | getView () const |
| void | onBeforeAssignment (R && g) |
| void | operator+= (R && g) |
| void | operator= (R && g) |
| void | operator= (const ConfigView< T, NDim > & other) |
| void | setDisableFFTBlocking () Disable the blocking of going from configuration space to fourier space. Used by PowerSpectrumBuilder, which uses newly allocate memory which is filled in configuration space, and then FFT'ed to fourier space. |
| std::string | toString () const |
| std::string | to_string () const |
| void | updateGhosts () const |
Public Functions inherited from TempLat::AbstractField
| Type | Name |
|---|---|
| AbstractField (std::string name, device::memory::host_ptr< MemoryToolBox< NDim > > toolBox, LatticeParameters< T > pLatPar) |
|
| bool | areGhostsStale () const |
| device::Idx | confirmGhostsUpToDate () const |
| void | confirmSpace (const LayoutStruct< NDim > & newLayout, const SpaceStateType & spaceType) const |
| const BCSpec< NDim > & | getBCSpec () const |
| auto | getDx () const |
| auto | getKIR () const |
| auto | getLatParams () const |
| device::memory::host_ptr< MemoryManager< T, NDim > > | getMemoryManager () const |
| device::memory::host_ptr< MemoryToolBox< NDim > > | getToolBox () const |
| bool | isConfigSpace () const Check the current state. |
| bool | isFourierSpace () const Check the current state. |
| void | setBCSpec (BCSpec< NDim > bcSpec) |
| void | setGhostsAreStale () const |
Protected Attributes inherited from TempLat::AbstractField
| Type | Name |
|---|---|
| const LatticeParameters< T > | latPar |
| device::memory::host_ptr< MemoryManager< T, NDim > > | mManager |
Protected Functions inherited from TempLat::AbstractField
| Type | Name |
|---|---|
| const device::memory::host_ptr< MemoryToolBox< NDim > > & | toolBox () const The toolbox, without copying a reference count. |
Detailed Description
Implements a get method, and is hence suitable for all algebra.
Unit test: ctest -R test-field
@vocab-summary A real scalar field on the lattice, and the type that owns the memory. Assigning to it evaluates an expression across every site; passing it into one makes it a leaf. @vocab-signature Field<T, NDim> phi("phi", toolBox);
Public Types Documentation
typedef value_type
Public Static Attributes Documentation
variable NDim
Public Functions Documentation
function Field
inline TempLat::Field::Field (
std::string name,
device::memory::host_ptr < MemoryToolBox < NDim > > toolBox,
LatticeParameters < T > pLatPar=LatticeParameters < T >()
)
function d [1/3]
function d [2/3]
The real overlord: is it a Field , then we must compare.
function d [3/3]
function inFourierSpace
The Fourier-space view, materialised on first use.
confirmFourierSpace() begins with allocate(), so materialising after it is safe, and the view cannot go stale afterwards: MemoryManager::allocate latches mAllocated and is the only caller of MemoryBlock::allocate, so the data pointer and the extents are fixed for the manager's lifetime, and FourierView caches no host view its three host accessors re-derive from mManager on every call.
Still returns FourierView& and not the handle: f.inFourierSpace() = expr and .setZeroMode(...) depend on that.
The lazy write is thread-safe ONLY because there is no host-side threading: there are zero host #pragma omp regions in templat, CosmoInterface or MCInterface, and Kokkos parallel regions run device lambdas, which never call this. If host-side OpenMP is ever put around field access, this becomes a genuine data race. Not mutable, and this must stay non-const, for the same reason: a const overload would make the race reachable through a shared const&.
function operator=
function operator=
Friends Documentation
friend operator==
The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/lattice/field/field.h