|
IPPL (Independent Parallel Particle Layer)
IPPL
|
1D vector used in the context of FEM. More...
#include <FEMVector.h>
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< 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. | |
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< BoundaryInfo > | boundaryInfo_m |
| Struct holding all the MPI and boundary information. | |
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.
| T | The datatype which the vector is storing. |
Definition at line 30 of file FEMVector.h.
| 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.
| 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.
| n | The size of the vector. |
| neighbors | The ranks of the neighboring MPI tasks. |
| sendIdxs | The indices for which the data should be sent to the MPI neighbors. |
| recvIdxs | The 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().
| 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.
| other | The other vector we are copying from. |
Definition at line 22 of file FEMVector.hpp.
References boundaryInfo_m, data_m, and FEMVector().
| 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.
| 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().
| 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).
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()().
| 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().
| 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().
| 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().
| i | The index off the value to retrieve. |
Definition at line 217 of file FEMVector.hpp.
References operator[]().
| 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
| expr | The expression from which to copy the values |
Definition at line 186 of file FEMVector.hpp.
References data_m, and FEMVector().
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.
| v | The other vector to copy values from. |
Definition at line 199 of file FEMVector.hpp.
References data_m, FEMVector(), and getView().
Set all the values of the vector to value.
Sets all the values in the vector to value this also includes the halo cells.
| value | The value to which the entries should be set. |
Definition at line 174 of file FEMVector.hpp.
References data_m, and FEMVector().
| 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().
| i | The index off the value to retrieve. |
Definition at line 211 of file FEMVector.hpp.
References data_m.
Referenced by operator()().
| 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.
| idxStore | A 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().
| void ippl::FEMVector< T >::setHalo | ( | T | setValue | ) |
Set the halo cells to setValue.
| setValue | The 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()().
| 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().
| 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.
| K | The data type of the new vector. |
Definition at line 270 of file FEMVector.hpp.
References boundaryInfo_m, FEMVector(), and size().
| 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.
| idxStore | A 1D Kokkos view which stores the the indices for FEMVector::data_m to which we want to store. |
| Op | The 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().
|
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().
|
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().
|
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.