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

1D vector used in the context of FEM. More...

#include <FEMVector.h>

+ Inheritance diagram for ippl::FEMVector< T >:
+ Collaboration diagram for ippl::FEMVector< T >:

Classes

struct  Assign
 Struct for assigment operator to be used with FEMVector::unpack(). More...
 
struct  AssignAdd
 Struct for addition+assignment operator to be used with FEMVector::unpack(). More...
 

Public Types

using value_type = T
 Dummy type definition in order for the detail::Expression defined operators to work.
 

Public Member Functions

 FEMVector (size_t n, std::vector< size_t > neighbors, std::vector< Kokkos::View< size_t * > > sendIdxs, std::vector< Kokkos::View< size_t * > > recvIdxs)
 Constructor taking size, neighbors, and halo exchange indices.
 
KOKKOS_FUNCTION FEMVector (const FEMVector< T > &other)
 Copy constructor (shallow).
 
 FEMVector (size_t n)
 Constructor only taking size, does not create any MPI/boundary information.
 
void fillHalo ()
 Copy values from neighboring ranks into local halo.
 
void accumulateHalo ()
 Accumulate halo values in neighbor.
 
void setHalo (T setValue)
 Set the halo cells to setValue.
 
FEMVector< T > & operator= (T value)
 Set all the values of the vector to value.
 
template<typename E , size_t N>
FEMVector< T > & operator= (const detail::Expression< E, N > &expr)
 Set all the values of this vector to the values of the expression.
 
FEMVector< T > & operator= (const FEMVector< T > &v)
 Copy the values from another FEMVector to this one.
 
KOKKOS_INLINE_FUNCTION T operator[] (size_t i) const
 Subscript operator to get value at position i.
 
KOKKOS_INLINE_FUNCTION T operator() (size_t i) const
 Subscript operator to get value at position i.
 
const Kokkos::View< T * > & getView () const
 Get underlying data view.
 
size_t size () const
 Get the size (number of elements) of the vector.
 
FEMVector< T > deepCopy () const
 Create a deep copy, where all the information of this vector is copied to a new one.
 
template<typename K >
FEMVector< K > skeletonCopy () const
 Create a new FEMVector with different data type, but same size and boundary infromation.
 
void pack (const Kokkos::View< size_t * > &idxStore)
 Pack data into BoundaryInfo::commBuffer_m for MPI communication.
 
template<typename Op >
void unpack (const Kokkos::View< size_t * > &idxStore)
 Unpack data from BoundaryInfo::commBuffer_m into FEMVector::data_m after communication.
 
- Public Member Functions inherited from ippl::detail::Expression< FEMVector< T >, sizeof(detail::ViewType< T, 1 >::view_type)>
KOKKOS_INLINE_FUNCTION auto operator[] (size_t i) const
 

Static Public Attributes

static constexpr unsigned dim = 1
 Dummy parameter in order for the detail::Expression defined operators to work.
 
- Static Public Attributes inherited from ippl::detail::Expression< FEMVector< T >, sizeof(detail::ViewType< T, 1 >::view_type)>
static constexpr unsigned dim
 

Detailed Description

template<typename T>
class ippl::FEMVector< T >

1D vector used in the context of FEM.

This class represents a 1D vector which stores elements of type T and provides functionalities to handle halo cells and their exchanges. It can conceptually be though of being a mathemtical vector, and to this extend is used during fem to represent the vectors \(x\), \(b\) when solving the linear system \(Ax = b\).

We use this instead of an ippl::Field, because for basis functions which have DoFs at non-vertex positions a representation as a field is not easily possible.

Template Parameters
TThe datatype which the vector is storing.

Member Typedef Documentation

◆ value_type

template<typename T >
using ippl::FEMVector< T >::value_type = T

Dummy type definition in order for the detail::Expression defined operators to work.

In the file IpplOperations.h a bunch of operations are defined, we want to be able to use them with a FEMVector, the problem is that they require the class to define a value_type type. So therefore we define it here.

Constructor & Destructor Documentation

◆ FEMVector() [1/3]

template<typename T >
ippl::FEMVector< T >::FEMVector ( size_t  n,
std::vector< size_t >  neighbors,
std::vector< Kokkos::View< size_t * > >  sendIdxs,
std::vector< Kokkos::View< size_t * > >  recvIdxs 
)

Constructor taking size, neighbors, and halo exchange indices.

Constructor of a FEMVector taking in the size and information about the neighboring MPI ranks.

Parameters
nThe size of the vector.
neighborsThe ranks of the neighboring MPI tasks.
sendIdxsThe indices for which the data should be sent to the MPI neighbors.
recvIdxsThe halo cell indices.

◆ FEMVector() [2/3]

template<typename T >
KOKKOS_FUNCTION ippl::FEMVector< T >::FEMVector ( const FEMVector< T > &  other)

Copy constructor (shallow).

Creates a shallow copy of the other vector, by copying the underlying Kokkos::View and boundary infromation.

Parameters
otherThe other vector we are copying from.

◆ FEMVector() [3/3]

template<typename T >
ippl::FEMVector< T >::FEMVector ( size_t  n)

Constructor only taking size, does not create any MPI/boundary information.

This constructor only takes the size of the vector and allocates the appropriate number of elements, it does not sotre any MPI communication or boundary infromation. This constructor is useful if only a simply vector for arithmetic is needed without the need for any communication.

Member Function Documentation

◆ accumulateHalo()

template<typename T >
void ippl::FEMVector< T >::accumulateHalo ( )

Accumulate halo values in neighbor.

This function takes the local halo values (which are part of another ranks values) and sums them to these corresponding values of the neighbor ranks.

◆ deepCopy()

template<typename T >
FEMVector< T > ippl::FEMVector< T >::deepCopy ( ) const

Create a deep copy, where all the information of this vector is copied to a new one.

Returns a FEMVector which is an exact copy of this one. All the information (elements, MPI information, etc.) are explicitly copied (i.e. deep copy).

Returns
An exact copy of this vector

◆ fillHalo()

template<typename T >
void ippl::FEMVector< T >::fillHalo ( )

Copy values from neighboring ranks into local halo.

This function takes the local values which are part of other ranks halos and copies them to the corresponding halo cells of those neighbors.

◆ getView()

template<typename T >
const Kokkos::View< T * > & ippl::FEMVector< T >::getView ( ) const

Get underlying data view.

Returns a constant reference to the underlying data the FEMVector is storing, this corresponds to a Kokkos::View living on the default device.

◆ operator()()

template<typename T >
KOKKOS_INLINE_FUNCTION T ippl::FEMVector< T >::operator() ( size_t  i) const

Subscript operator to get value at position i.

This function returns the value of the vector at index i, it is equivalent to FEMVector::operator().

Parameters
iThe index off the value to retrieve.

◆ operator=() [1/3]

template<typename T >
template<typename E , size_t N>
FEMVector< T > & ippl::FEMVector< T >::operator= ( const detail::Expression< E, N > &  expr)

Set all the values of this vector to the values of the expression.

Set the values of this vector to the values of expr

Parameters
exprThe expression from which to copy the values
Note
Here we have to check how efficient this is, because in theory we are copying a FEMVector onto the device when we are calling the operator[] function inside of the Kokkos::parallel_for.

◆ operator=() [2/3]

template<typename T >
FEMVector< T > & ippl::FEMVector< T >::operator= ( const FEMVector< T > &  v)

Copy the values from another FEMVector to this one.

Sets the element values of this vector to the ones of v, only the values are set everything else (MPI config, boundaries) are ignored.

Parameters
vThe other vector to copy values from.

◆ operator=() [3/3]

template<typename T >
FEMVector< T > & ippl::FEMVector< T >::operator= ( value)

Set all the values of the vector to value.

Sets all the values in the vector to value this also includes the halo cells.

Parameters
valueThe value to which the entries should be set.

◆ operator[]()

template<typename T >
KOKKOS_INLINE_FUNCTION T ippl::FEMVector< T >::operator[] ( size_t  i) const

Subscript operator to get value at position i.

This function returns the value of the vector at index i, it is equivalent to FEMVector::operator().

Parameters
iThe index off the value to retrieve.

◆ pack()

template<typename T >
void ippl::FEMVector< T >::pack ( const Kokkos::View< size_t * > &  idxStore)

Pack data into BoundaryInfo::commBuffer_m for MPI communication.

This function takes data from the vector accoding to idxStore and stores it inside of BoundaryInfo::commBuffer_m.

Parameters
idxStoreA 1D Kokkos view which stores the the indices for FEMVector::data_m which we want to send.

◆ setHalo()

template<typename T >
void ippl::FEMVector< T >::setHalo ( setValue)

Set the halo cells to setValue.

Parameters
setValueThe value to which the halo cells should be set.

◆ skeletonCopy()

template<typename T >
template<typename K >
FEMVector< K > ippl::FEMVector< T >::skeletonCopy ( ) const

Create a new FEMVector with different data type, but same size and boundary infromation.

This function is used to create a new FEMVector with same size and boundary infromation, but of different data type. The boundary information is copied over via a deep copy fashion.

Template Parameters
KThe data type of the new vector.
Returns
A vector of same structure but new data type.

◆ unpack()

template<typename T >
template<typename Op >
void ippl::FEMVector< T >::unpack ( const Kokkos::View< size_t * > &  idxStore)

Unpack data from BoundaryInfo::commBuffer_m into FEMVector::data_m after communication.

This function takes data from BoundaryInfo::commBuffer_m and stores it accoding to idxStore in FEMVector::data_m.

Parameters
idxStoreA 1D Kokkos view which stores the the indices for FEMVector::data_m to which we want to store.
Template Parameters
OpThe operator to use in order to update the values in FEMVector::data_m.

Member Data Documentation

◆ dim

template<typename T >
constexpr unsigned ippl::FEMVector< T >::dim = 1
staticconstexpr

Dummy parameter in order for the detail::Expression defined operators to work.

In the file IpplOperations.h a bunch of operations are defined, we want to be able to use them with a FEMVector, the problem is that they require the class to have a dim parameter, therefore we have one here.


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