IPPL (Independent Parallel Particle Layer)
IPPL
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 HostMirror = 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
 ~BareField ()=default
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
HostMirror 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
T sum (int nghost=0) const
T max (int nghost=0) const
T min (int nghost=0) const
T prod (int nghost=0) const
template<typename E, size_t N>
BareField< T, Dim, ViewArgs... > & operator= (const detail::Expression< E, N > &expr)
KOKKOS_INLINE_FUNCTION auto operator[] (size_t i) const

Static Public Attributes

static constexpr unsigned dim = Dim

Private Member Functions

void setup ()

Private Attributes

int nghost_m
 Number of ghost layers on each field boundary.
view_type dview_m
 Actual field data.
Domain_t owned_m
 Domain of the data.
halo_type halo_m
Layout_tlayout_m = nullptr
 How the arrays are laid out.

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.

Definition at line 40 of file BareField.h.

Member Typedef Documentation

◆ Domain_t

template<typename T, unsigned Dim, class... ViewArgs>
using ippl::BareField< T, Dim, ViewArgs >::Domain_t = NDIndex<Dim>

Domain type specifying the index region.

Definition at line 47 of file BareField.h.

◆ execution_space

template<typename T, unsigned Dim, class... ViewArgs>
typedef view_type::execution_space ippl::BareField< T, Dim, ViewArgs >::execution_space

Definition at line 52 of file BareField.h.

◆ halo_type

template<typename T, unsigned Dim, class... ViewArgs>
using ippl::BareField< T, Dim, ViewArgs >::halo_type = detail::HaloCells<T, Dim, ViewArgs...>

Definition at line 57 of file BareField.h.

◆ HostMirror

template<typename T, unsigned Dim, class... ViewArgs>
using ippl::BareField< T, Dim, ViewArgs >::HostMirror = typename view_type::host_mirror_type

Definition at line 53 of file BareField.h.

◆ Layout_t

template<typename T, unsigned Dim, class... ViewArgs>
using ippl::BareField< T, Dim, ViewArgs >::Layout_t = FieldLayout<Dim>

Definition at line 44 of file BareField.h.

◆ memory_space

template<typename T, unsigned Dim, class... ViewArgs>
typedef view_type::memory_space ippl::BareField< T, Dim, ViewArgs >::memory_space

Definition at line 51 of file BareField.h.

◆ policy_type

template<typename T, unsigned Dim, class... ViewArgs>
template<class... PolicyArgs>
using ippl::BareField< T, Dim, ViewArgs >::policy_type = typename RangePolicy<Dim, PolicyArgs...>::policy_type

Definition at line 55 of file BareField.h.

◆ value_type

template<typename T, unsigned Dim, class... ViewArgs>
using ippl::BareField< T, Dim, ViewArgs >::value_type = T

Definition at line 59 of file BareField.h.

◆ view_type

template<typename T, unsigned Dim, class... ViewArgs>
using ippl::BareField< T, Dim, ViewArgs >::view_type = typename detail::ViewType<T, Dim, ViewArgs...>::view_type

View type storing the data.

Definition at line 50 of file BareField.h.

Constructor & Destructor Documentation

◆ BareField() [1/3]

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.

Definition at line 89 of file BareField.hpp.

References layout_m, and nghost_m.

Referenced by deepCopy(), and operator=().

Here is the caller graph for this function:

◆ BareField() [2/3]

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

◆ BareField() [3/3]

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

Definition at line 101 of file BareField.hpp.

References layout_m, nghost_m, and setup().

Here is the call graph for this function:

◆ ~BareField()

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

Member Function Documentation

◆ accumulateHalo()

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

Definition at line 154 of file BareField.hpp.

References Dim, dview_m, halo_m, layout_m, and nghost_m.

Referenced by ippl::assemble_rhs_from_particles().

Here is the caller graph for this function:

◆ accumulateHalo_noghost()

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

Definition at line 165 of file BareField.hpp.

References dview_m, halo_m, and layout_m.

◆ 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

Definition at line 94 of file BareField.hpp.

References BareField(), Dim, dview_m, layout_m, and nghost_m.

Here is the call graph for this function:

◆ fillHalo()

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

Definition at line 143 of file BareField.hpp.

References Dim, dview_m, halo_m, layout_m, and nghost_m.

Referenced by ippl::curl(), ippl::div(), ippl::grad(), ippl::hess(), ippl::laplace(), ippl::lower_laplace(), ippl::poisson(), ippl::upper_and_lower_laplace(), and ippl::upper_laplace().

Here is the caller graph for this function:

◆ 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)

Definition at line 123 of file BareField.h.

◆ getCommunicator()

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

Definition at line 131 of file BareField.h.

Referenced by ippl::ExtrapolateFace< Field >::apply(), ippl::PeriodicFace< Field >::apply(), ippl::BConds< Field, Dim >::assignGhostToPhysical(), ippl::BConds< Field, Dim >::findBCNeighbors(), and ippl::PeriodicFace< Field >::findBCNeighbors().

Here is the caller graph for this function:

◆ getDomain()

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

Definition at line 140 of file BareField.h.

◆ 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

Definition at line 183 of file BareField.h.

Referenced by ippl::innerProduct(), ippl::mult(), and ippl::norm().

Here is the caller graph for this function:

◆ getHalo()

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

Definition at line 142 of file BareField.h.

Referenced by ippl::PeriodicFace< Field >::apply().

Here is the caller graph for this function:

◆ getHostMirror()

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

Definition at line 173 of file BareField.h.

◆ getIndex()

template<typename T, unsigned Dim, class... ViewArgs>
const Index & ippl::BareField< T, Dim, ViewArgs >::getIndex ( unsigned d) const
inline

Definition at line 139 of file BareField.h.

◆ getLayout()

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

Definition at line 134 of file BareField.h.

Referenced by ippl::adapted_powermethod(), ippl::ExtrapolateFace< Field >::apply(), ippl::PeriodicFace< Field >::apply(), ippl::assemble_rhs_from_particles(), ippl::ExtrapolateFace< Field >::assignGhostToPhysical(), ippl::PeriodicFace< Field >::assignGhostToPhysical(), ippl::PeriodicFace< Field >::findBCNeighbors(), ippl::BareField< T, Dim, ViewArgs... >::getCommunicator(), ippl::BareField< T, Dim, ViewArgs... >::getDomain(), ippl::BareField< T, Dim, ViewArgs... >::getIndex(), ippl::gs_preconditioner< Field, LowerF, UpperF, InvDiagF >::init_fields(), ippl::richardson_preconditioner< Field, UpperAndLowerF, InvDiagF >::init_fields(), ippl::richardson_preconditioner_alt< Field, OperatorF, InvDiagF >::init_fields(), ippl::ssor_preconditioner< Field, LowerF, UpperF, InvDiagF, DiagF >::init_fields(), ippl::innerProduct(), ippl::interpolate_to_diracs(), ippl::lower_laplace_no_comm(), ippl::norm(), ippl::gs_preconditioner< Field, LowerF, UpperF, InvDiagF >::operator()(), ippl::jacobi_preconditioner< Field, InvDiagF >::operator()(), ippl::polynomial_chebyshev_preconditioner< Field, OperatorF >::operator()(), ippl::richardson_preconditioner< Field, UpperAndLowerF, InvDiagF >::operator()(), ippl::richardson_preconditioner_alt< Field, OperatorF, InvDiagF >::operator()(), ippl::ssor_preconditioner< Field, LowerF, UpperF, InvDiagF, DiagF >::operator()(), ippl::powermethod(), ippl::polynomial_newton_preconditioner< Field, OperatorF >::recursive_preconditioner(), ippl::PoissonCG< Field< T, Dim >, Field_t< Dim > >::setSolver(), and ippl::upper_laplace_no_comm().

Here is the caller graph for this function:

◆ getNghost()

◆ 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.

Definition at line 117 of file BareField.h.

Referenced by ippl::FFT< Cos1Transform, Field >::transform(), ippl::FFT< CosTransform, Field >::transform(), and ippl::FFT< SineTransform, Field >::transform().

Here is the caller graph for this function:

◆ getView() [1/2]

◆ getView() [2/2]

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

Definition at line 171 of file BareField.h.

◆ 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

Definition at line 109 of file BareField.hpp.

References layout_m, nghost_m, and setup().

Here is the call graph for this function:

◆ max()

template<typename T, unsigned Dim, class... ViewArgs>
T ippl::BareField< T, Dim, ViewArgs >::max ( int nghost = 0) const

◆ min()

template<typename T, unsigned Dim, class... ViewArgs>
T ippl::BareField< T, Dim, ViewArgs >::min ( int nghost = 0) const

◆ 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

Definition at line 165 of file BareField.h.

◆ operator=() [1/3]

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

◆ operator=() [2/3]

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

Definition at line 182 of file BareField.hpp.

◆ operator=() [3/3]

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

Definition at line 172 of file BareField.hpp.

References ippl::apply(), BareField(), Dim, dview_m, ippl::getRangePolicy(), and ippl::parallel_for().

Here is the call graph for this function:

◆ operator[]()

KOKKOS_INLINE_FUNCTION auto ippl::detail::Expression< BareField< T, Dim, ViewArgs... >, N >::operator[] ( size_t i) const
inlineinherited

Access single element of the expression

Definition at line 32 of file IpplExpressions.h.

◆ prod()

template<typename T, unsigned Dim, class... ViewArgs>
T ippl::BareField< T, Dim, ViewArgs >::prod ( int nghost = 0) const

◆ 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

Definition at line 138 of file BareField.hpp.

References dview_m.

Referenced by setup().

Here is the caller graph for this function:

◆ setup()

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

Allocate field.

Definition at line 127 of file BareField.hpp.

References layout_m, nghost_m, owned_m, and resize().

Referenced by BareField(), initialize(), and updateLayout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Definition at line 111 of file BareField.h.

◆ sum()

template<typename T, unsigned Dim, class... ViewArgs>
T ippl::BareField< T, Dim, ViewArgs >::sum ( int nghost = 0) const

◆ updateLayout()

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

Definition at line 119 of file BareField.hpp.

References layout_m, nghost_m, and setup().

Here is the call graph for this function:

◆ 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

Definition at line 202 of file BareField.hpp.

References Inform::getDestination(), and write().

Here is the call graph for this function:

◆ 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

Definition at line 196 of file BareField.hpp.

References dview_m, and ippl::detail::write().

Referenced by write().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ dim

template<typename T, unsigned Dim, class... ViewArgs>
unsigned ippl::BareField< T, Dim, ViewArgs >::dim = Dim
staticconstexpr

Definition at line 60 of file BareField.h.

Referenced by ippl::innerProduct(), and ippl::norm().

◆ dview_m

template<typename T, unsigned Dim, class... ViewArgs>
view_type ippl::BareField< T, Dim, ViewArgs >::dview_m
private

◆ halo_m

template<typename T, unsigned Dim, class... ViewArgs>
halo_type ippl::BareField< T, Dim, ViewArgs >::halo_m
private

Definition at line 217 of file BareField.h.

Referenced by accumulateHalo(), accumulateHalo_noghost(), and fillHalo().

◆ layout_m

template<typename T, unsigned Dim, class... ViewArgs>
Layout_t* ippl::BareField< T, Dim, ViewArgs >::layout_m = nullptr
private

How the arrays are laid out.

Definition at line 225 of file BareField.h.

Referenced by accumulateHalo(), accumulateHalo_noghost(), BareField(), BareField(), deepCopy(), fillHalo(), initialize(), setup(), and updateLayout().

◆ nghost_m

template<typename T, unsigned Dim, class... ViewArgs>
int ippl::BareField< T, Dim, ViewArgs >::nghost_m
private

Number of ghost layers on each field boundary.

Definition at line 209 of file BareField.h.

Referenced by accumulateHalo(), BareField(), BareField(), deepCopy(), fillHalo(), initialize(), setup(), and updateLayout().

◆ owned_m

template<typename T, unsigned Dim, class... ViewArgs>
Domain_t ippl::BareField< T, Dim, ViewArgs >::owned_m
private

Domain of the data.

Definition at line 215 of file BareField.h.

Referenced by setup().


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