IPPL API Reference
Independent Parallel Particle Layer C++ API
Loading...
Searching...
No Matches
ippl::BareField< T, Dim, ViewArgs > Class Template Reference

#include <BareField.h>

+ Inheritance diagram for ippl::BareField< T, Dim, ViewArgs >:
+ Collaboration diagram for ippl::BareField< T, Dim, ViewArgs >:

Public Types

using Layout_t = FieldLayout< Dim >
 
using Domain_t = NDIndex< Dim >
 Domain type specifying the index region.
 
using view_type = typename detail::ViewType< T, Dim, ViewArgs... >::view_type
 View type storing the data.
 
typedef view_type::memory_space memory_space
 
typedef view_type::execution_space execution_space
 
using host_mirror_type = typename view_type::host_mirror_type
 
template<class... PolicyArgs>
using policy_type = typename RangePolicy< Dim, PolicyArgs... >::policy_type
 
using halo_type = detail::HaloCells< T, Dim, ViewArgs... >
 
using value_type = T
 

Public Member Functions

 BareField ()
 
 BareField (const BareField &)=default
 
 BareField (Layout_t &l, int nghost=1)
 
BareField deepCopy () const
 
template<typename... Args>
void resize (Args... args)
 
void initialize (Layout_t &l, int nghost=1)
 
void updateLayout (Layout_t &, int nghost=1)
 
detail::size_type size (unsigned d) const
 
const Domain_tgetOwned () const
 
const Domain_t getAllocated () const
 
int getNghost () const
 
void fillHalo ()
 
void accumulateHalo ()
 
void accumulateHalo_noghost (int nghost=1)
 
auto & getCommunicator () const
 
Layout_tgetLayout () const
 
const IndexgetIndex (unsigned d) const
 
const NDIndex< Dim > & getDomain () const
 
halo_typegetHalo ()
 
BareFieldoperator= (T x)
 
template<typename E , size_t N>
BareFieldoperator= (const detail::Expression< E, N > &expr)
 
template<typename... Args>
KOKKOS_INLINE_FUNCTION T operator() (Args... args) const
 
view_typegetView ()
 
const view_typegetView () const
 
host_mirror_type getHostMirror () const
 
template<class... PolicyArgs>
policy_type< execution_space, PolicyArgs... > getFieldRangePolicy (const int nghost=0) const
 
void write (std::ostream &out=std::cout) const
 
void write (Inform &inf) const
 
void write_as_list (std::ostream &out=std::cout) const
 
void write_as_list (Inform &inf) const
 
sum (int nghost=0) const
 
max (int nghost=0) const
 
min (int nghost=0) const
 
prod (int nghost=0) const
 
template<typename E , size_t N>
BareField< T, Dim, ViewArgs... > & operator= (const detail::Expression< E, N > &expr)
 
- Public Member Functions inherited from ippl::detail::Expression< BareField< T, Dim, ViewArgs... >, sizeof(detail::ViewType< T, Dim, ViewArgs... >::view_type)>
KOKKOS_INLINE_FUNCTION auto operator[] (size_t i) const
 

Static Public Attributes

static constexpr unsigned dim = Dim
 
- Static Public Attributes inherited from ippl::detail::Expression< BareField< T, Dim, ViewArgs... >, sizeof(detail::ViewType< T, Dim, ViewArgs... >::view_type)>
static constexpr unsigned dim
 

Friends

std::ostream & operator<< (std::ostream &out, const BareField< T, Dim, ViewArgs... > &field)
 

Detailed Description

template<typename T, unsigned Dim, class... ViewArgs>
class ippl::BareField< T, Dim, ViewArgs >
Template Parameters
Tdata type
Dimfield dimension
Warning
The implementation currently only supports 3-dimensional fields. The reason are runtime issues with "if constrexpr" in the assignment operator when running on GPU.

Constructor & Destructor Documentation

◆ BareField() [1/2]

template<typename T , unsigned Dim, class... ViewArgs>
ippl::BareField< T, Dim, ViewArgs >::BareField ( )

A default constructor, which should be used only if the user calls the 'initialize' function before doing anything else. There are no special checks in the rest of the BareField methods to check that the field has been properly initialized.

◆ BareField() [2/2]

template<typename T , unsigned Dim, class... ViewArgs>
ippl::BareField< T, Dim, ViewArgs >::BareField ( Layout_t l,
int  nghost = 1 
)

Constructor for a BareField. The default constructor is deleted.

Parameters
lof field
nghostnumber of ghost layers

Member Function Documentation

◆ deepCopy()

template<typename T , unsigned Dim, class... ViewArgs>
BareField< T, Dim, ViewArgs... > ippl::BareField< T, Dim, ViewArgs >::deepCopy ( ) const

Creates a new BareField with the same properties and contents

Returns
A deep copy of the field

◆ getAllocated()

template<typename T , unsigned Dim, class... ViewArgs>
const Domain_t ippl::BareField< T, Dim, ViewArgs >::getAllocated ( ) const
inline

Index domain of the allocated field.

Returns
the allocated index domain (including ghost cells)

◆ getFieldRangePolicy()

template<typename T , unsigned Dim, class... ViewArgs>
template<class... PolicyArgs>
policy_type< execution_space, PolicyArgs... > ippl::BareField< T, Dim, ViewArgs >::getFieldRangePolicy ( const int  nghost = 0) const
inline

Generate the range policy for iterating over the field, excluding ghost layers

Template Parameters
PolicyArgs...additional template parameters for the range policy
Parameters
nghostNumber of ghost layers to include in the range policy (default 0)
Returns
Range policy for iterating over the field and nghost of the ghost layers

◆ getOwned()

template<typename T , unsigned Dim, class... ViewArgs>
const Domain_t & ippl::BareField< T, Dim, ViewArgs >::getOwned ( ) const
inline

Index domain of the local field.

Returns
the index domain.

◆ initialize()

template<typename T , unsigned Dim, class... ViewArgs>
void ippl::BareField< T, Dim, ViewArgs >::initialize ( Layout_t l,
int  nghost = 1 
)

Initialize the field, if it was constructed from the default constructor. This should NOT be called if the field was constructed by providing a FieldLayout.

Parameters
lof field
nghostnumber of ghost layers

◆ operator()()

template<typename T , unsigned Dim, class... ViewArgs>
template<typename... Args>
KOKKOS_INLINE_FUNCTION T ippl::BareField< T, Dim, ViewArgs >::operator() ( Args...  args) const
inline

Assign another field.

Template Parameters
Args...variadic template to specify an access index for a view element.
Parameters
argsview indices
Returns
a view element

◆ operator=()

template<typename T , unsigned Dim, class... ViewArgs>
template<typename E , size_t N>
BareField & ippl::BareField< T, Dim, ViewArgs >::operator= ( const detail::Expression< E, N > &  expr)

Assign an arbitrary BareField expression

Template Parameters
Eexpression type
Nsize of the expression, this is necessary for running on the device since otherwise it does not allocate enough memory
Parameters
expris the expression

◆ resize()

template<typename T , unsigned Dim, class... ViewArgs>
template<typename... Args>
void ippl::BareField< T, Dim, ViewArgs >::resize ( Args...  args)

Dimension independent view resize function which calls Kokkos.

Template Parameters
Args...variadic template specifying the individiual dimension arguments

◆ size()

template<typename T , unsigned Dim, class... ViewArgs>
detail::size_type ippl::BareField< T, Dim, ViewArgs >::size ( unsigned  d) const
inline

Local field size.

Parameters
dthe dimension
Returns
the number of grid points in the given dimension.

◆ write() [1/2]

template<typename T , unsigned Dim, class... ViewArgs>
void ippl::BareField< T, Dim, ViewArgs >::write ( Inform inf) const

Print the BareField

Parameters
infInform object

◆ write() [2/2]

template<typename T , unsigned Dim, class... ViewArgs>
void ippl::BareField< T, Dim, ViewArgs >::write ( std::ostream &  out = std::cout) const

Print the BareField.

Parameters
outstream

◆ write_as_list() [1/2]

template<typename T , unsigned Dim, class... ViewArgs>
void ippl::BareField< T, Dim, ViewArgs >::write_as_list ( Inform inf) const

Print the rank local BareField.

Parameters
infInform object

◆ write_as_list() [2/2]

template<typename T , unsigned Dim, class... ViewArgs>
void ippl::BareField< T, Dim, ViewArgs >::write_as_list ( std::ostream &  out = std::cout) const

Print the rank local BareField.

Parameters
outstream

Friends And Related Symbol Documentation

◆ operator<<

template<typename T , unsigned Dim, class... ViewArgs>
std::ostream & operator<< ( std::ostream &  out,
const BareField< T, Dim, ViewArgs... > &  field 
)
friend

Stream opreator to print the rank local BareField.


The documentation for this class was generated from the following files: