IPPL (Independent Parallel Particle Layer)
IPPL
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...
struct  BoundaryInfo
 Structure holding MPI neighbor and boundary information. 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< TdeepCopy () 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.

Static Public Attributes

static constexpr unsigned dim = 1
 Dummy parameter in order for the detail::Expression defined operators to work.

Private Attributes

Kokkos::View< T * > data_m
 Data this object is storing.
std::shared_ptr< BoundaryInfoboundaryInfo_m
 Struct holding all the MPI and boundary information.

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.

Definition at line 30 of file FEMVector.h.

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.

Definition at line 54 of file FEMVector.h.

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.

Definition at line 4 of file FEMVector.hpp.

References boundaryInfo_m, and data_m.

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

Here is the caller graph for this function:

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

Definition at line 22 of file FEMVector.hpp.

References boundaryInfo_m, data_m, and FEMVector().

Here is the call graph for this function:

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

Definition at line 14 of file FEMVector.hpp.

References boundaryInfo_m, and data_m.

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.

Definition at line 95 of file FEMVector.hpp.

References boundaryInfo_m, ippl::Comm, ippl::mpi::tag::FEMVECTOR, pack(), and unpack().

Referenced by ippl::FEMMaxwellDiffusionSolver< FieldType >::solve().

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

◆ 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

Definition at line 234 of file FEMVector.hpp.

References boundaryInfo_m, FEMVector(), and size().

Referenced by ippl::CG< FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T > >::operator()(), and ippl::CG< OperatorRet, LowerRet, UpperRet, UpperLowerRet, InverseDiagRet, FEMVector< T >, FEMVector< T > >::operator()().

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

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

Definition at line 38 of file FEMVector.hpp.

References boundaryInfo_m, ippl::Comm, ippl::mpi::tag::FEMVECTOR, pack(), and unpack().

Referenced by ippl::FEMMaxwellDiffusionSolver< FieldType >::solve().

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

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

Definition at line 223 of file FEMVector.hpp.

References data_m.

Referenced by ippl::NedelecSpace< T, Dim, Order, ElementType, QuadratureType, FieldType >::computeError(), ippl::NedelecSpace< T, Dim, Order, ElementType, QuadratureType, FieldType >::evaluateAx(), ippl::NedelecSpace< T, Dim, Order, ElementType, QuadratureType, FieldType >::evaluateLoadVector(), ippl::NedelecSpace< T, Dim, Order, ElementType, QuadratureType, FieldType >::evaluateLoadVectorFunctor(), ippl::innerProduct(), ippl::norm(), operator=(), and ippl::NedelecSpace< T, Dim, Order, ElementType, QuadratureType, FieldType >::reconstructToPoints().

Here is the caller graph for this function:

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

Definition at line 217 of file FEMVector.hpp.

References operator[]().

Here is the call graph for this function:

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

Definition at line 186 of file FEMVector.hpp.

References data_m, and FEMVector().

Here is the call graph for this function:

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

Definition at line 199 of file FEMVector.hpp.

References data_m, FEMVector(), and getView().

Here is the call graph for this function:

◆ operator=() [3/3]

template<typename T>
FEMVector< T > & ippl::FEMVector< T >::operator= ( T 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.

Definition at line 174 of file FEMVector.hpp.

References data_m, and FEMVector().

Here is the call graph for this function:

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

Definition at line 211 of file FEMVector.hpp.

References data_m.

Referenced by operator()().

Here is the caller graph for this function:

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

Definition at line 302 of file FEMVector.hpp.

References boundaryInfo_m, ippl::Comm, and data_m.

Referenced by accumulateHalo(), and fillHalo().

Here is the caller graph for this function:

◆ setHalo()

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

Set the halo cells to setValue.

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

Definition at line 152 of file FEMVector.hpp.

References boundaryInfo_m, and data_m.

Referenced by ippl::CG< OperatorRet, LowerRet, UpperRet, UpperLowerRet, InverseDiagRet, FEMVector< T >, FEMVector< T > >::operator()().

Here is the caller graph for this function:

◆ size()

template<typename T>
size_t ippl::FEMVector< T >::size ( ) const

Get the size (number of elements) of the vector.

Definition at line 229 of file FEMVector.hpp.

References data_m.

Referenced by deepCopy(), and skeletonCopy().

Here is the caller graph for this function:

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

Definition at line 270 of file FEMVector.hpp.

References boundaryInfo_m, FEMVector(), and size().

Here is the call graph for this function:

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

Definition at line 330 of file FEMVector.hpp.

References boundaryInfo_m, ippl::Comm, and data_m.

Referenced by accumulateHalo(), and fillHalo().

Here is the caller graph for this function:

Member Data Documentation

◆ boundaryInfo_m

template<typename T>
std::shared_ptr<BoundaryInfo> ippl::FEMVector< T >::boundaryInfo_m
private

Struct holding all the MPI and boundary information.

Pointer to a struct holding all the information required for MPI communication and general boundary information. The reason for it beeing a pointer, is such that when this FEMVector object is copied to device only a pointer and not all the data needs to be copied to device.

Definition at line 385 of file FEMVector.h.

Referenced by accumulateHalo(), deepCopy(), FEMVector(), FEMVector(), FEMVector(), fillHalo(), pack(), setHalo(), skeletonCopy(), and unpack().

◆ data_m

template<typename T>
Kokkos::View<T*> ippl::FEMVector< T >::data_m
private

Data this object is storing.

The data which the FEMVector is storing, it is represented by a one dimensional Kokkos::View and lives on the default device.

Definition at line 373 of file FEMVector.h.

Referenced by FEMVector(), FEMVector(), FEMVector(), getView(), operator=(), operator=(), operator=(), operator[](), pack(), setHalo(), size(), and unpack().

◆ dim

template<typename T>
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.

Definition at line 43 of file FEMVector.h.

Referenced by ippl::CG< FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T >, FEMVector< T > >::operator()().


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