DFT-EFE
 
Loading...
Searching...
No Matches
dftefe::linearAlgebra::Vector< ValueType, memorySpace > Class Template Reference

A class that encapsulates a vector. This is a vector in the mathematical sense and not in the sense of an array or STL container. This class handles both serial and distributed vector in a unfied way. There are different constructors provided for the serial and distributed case. More...

#include <Vector.h>

Inheritance diagram for dftefe::linearAlgebra::Vector< ValueType, memorySpace >:
Collaboration diagram for dftefe::linearAlgebra::Vector< ValueType, memorySpace >:

Public Types

using Storage = typename MultiVector< ValueType, memorySpace >::Storage
 
using value_type = typename Storage::value_type
 
using pointer = typename Storage::pointer
 
using reference = typename Storage::reference
 
using const_reference = typename Storage::const_reference
 
using iterator = typename Storage::iterator
 
using const_iterator = typename Storage::const_iterator
 
- Public Types inherited from dftefe::linearAlgebra::MultiVector< ValueType, memorySpace >
using Storage = dftefe::utils::MemoryStorage< ValueType, memorySpace >
 
using value_type = typename Storage::value_type
 
using pointer = typename Storage::pointer
 
using reference = typename Storage::reference
 
using const_reference = typename Storage::const_reference
 
using iterator = typename Storage::iterator
 
using const_iterator = typename Storage::const_iterator
 

Public Member Functions

 Vector ()=default
 Default constructor. More...
 
 ~Vector ()=default
 Default Destructor. More...
 
 Vector (size_type size, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a serial Vector with size and initial value arguments. More...
 
 Vector (std::unique_ptr< typename Vector< ValueType, memorySpace >::Storage > storage, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext)
 Constructor for a serial Vector with predefined Storage (i.e., utils::MemoryStorage). This Constructor transfers the ownership of input Storage to the Vector. This is useful when one does not want to allocate new memory and instead use memory allocated in the Vector::Storage (i.e., MemoryStorage). The locallyOwnedSize, ghostSize, etc., are automatically set using the size of the storage. More...
 
 Vector (std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > mpiPatternP2P, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a distributed Vector based on an input MPIPatternP2P. This is the most prefered and optimal way of constructing a distributed Vector, as one can directly use the information already stored in the MPIPatternP2P. More...
 
 Vector (std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > mpiPatternP2P, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const ValueType min, const ValueType max)
 Constructor for a distributed random Vector based on an input MPIPatternP2P. More...
 
 Vector (std::unique_ptr< typename Vector< ValueType, memorySpace >::Storage > &storage, std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > mpiPatternP2P, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext)
 Constructor for a distributed Vector with a predefined Storage (i.e., utils::MemoryStorage) and MPIPatternP2P. This Constructor transfers the ownership of input Storage to the Vector. This is useful when one does not want to allocate new memory and instead use memory allocated in the Storage (i.e., MemoryStorage). More...
 
 Vector (const std::pair< global_size_type, global_size_type > locallyOwnedRange, const std::vector< dftefe::global_size_type > &ghostIndices, const utils::mpi::MPIComm &mpiComm, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a distributed Vector based on locally owned and ghost indices. More...
 
 Vector (const std::pair< global_size_type, global_size_type > locallyOwnedRange, const utils::mpi::MPIComm &mpiComm, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a special case of distributed Vector where none none of the processors have any ghost indices. More...
 
 Vector (const global_size_type globalSize, const utils::mpi::MPIComm &mpiComm, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a distributed Vector based on total number of global indices. The resulting Vector will not contain any ghost indices on any of the processors. Internally, the vector is divided to ensure as much equitable distribution across all the processors much as possible. More...
 
 Vector (const Vector< ValueType, memorySpace > &u)
 Copy constructor. More...
 
 Vector (const Vector< ValueType, memorySpace > &u, ValueType initVal)
 Copy constructor with reinitialisation. More...
 
 Vector (Vector &&u) noexcept
 Move constructor. More...
 
Vector< ValueType, memorySpace > & operator= (const Vector< ValueType, memorySpace > &u)
 Copy assignment operator. More...
 
Vector< ValueType, memorySpace > & operator= (Vector< ValueType, memorySpace > &&u)
 Move assignment operator. More...
 
double l2Norm () const
 Returns \( l_2 \) norm of the Vector. More...
 
double lInfNorm () const
 Returns \( l_{\inf} \) norm of the Vector. More...
 
- Public Member Functions inherited from dftefe::linearAlgebra::MultiVector< ValueType, memorySpace >
 MultiVector ()=default
 Default Constructor. More...
 
 ~MultiVector ()=default
 Default Destructor. More...
 
 MultiVector (const size_type size, const size_type numVectors, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for serial MultiVector with vector size, number of vectors and initial value arguments. More...
 
 MultiVector (std::unique_ptr< typename MultiVector< ValueType, memorySpace >::Storage > storage, size_type numVectors, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext)
 Constructor for a \serial MultiVector with a predefined MultiVector::Storage (i.e., utils::MemoryStorage). This constructor transfers the ownership of the input Storage to the MultiVector. This is useful when one does not want to allocate new memory and instead use memory allocated in the MultiVector::Storage (i.e., utils::MemoryStorage). The locallyOwnedSize, ghostSize, etc., are automatically set using the size of the input Storage object. More...
 
 MultiVector (std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > mpiPatternP2P, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const size_type numVectors, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a distributed MultiVector based on an input MPIPatternP2P. More...
 
 MultiVector (std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > mpiPatternP2P, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const size_type numVectors, const ValueType min, const ValueType max)
 Constructor for a distributed random MultiVector based on an input MPIPatternP2P. More...
 
 MultiVector (std::unique_ptr< typename MultiVector< ValueType, memorySpace >::Storage > &storage, std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > mpiPatternP2P, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const size_type numVectors)
 Constructor for a distributed MultiVector with a predefined MultiVector::Storage (i.e., utils::MemoryStorage) and MPIPatternP2P. This constructor transfers the ownership of the input Storage to the MultiVector. This is useful when one does not want to allocate new memory and instead use memory allocated in the input MultiVector::Storage (i.e., utils::MemoryStorage). More...
 
 MultiVector (const std::pair< global_size_type, global_size_type > locallyOwnedRange, const std::vector< global_size_type > &ghostIndices, const utils::mpi::MPIComm &mpiComm, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const size_type numVectors, ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a \distributed MultiVector based on locally owned and ghost indices. More...
 
 MultiVector (const std::pair< global_size_type, global_size_type > locallyOwnedRange, const utils::mpi::MPIComm &mpiComm, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const size_type numVectors, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a special case of distributed MultiVector where none none of the processors have any ghost indices. More...
 
 MultiVector (const global_size_type globalSize, const utils::mpi::MPIComm &mpiComm, std::shared_ptr< LinAlgOpContext< memorySpace > > linAlgOpContext, const size_type numVectors, const ValueType initVal=utils::Types< ValueType >::zero)
 Constructor for a distributed MultiVector based on total number of global indices. The resulting MultiVector will not contain any ghost indices on any of the processors. Internally, the vector is divided to ensure as much equitable distribution across all the processors much as possible. More...
 
 MultiVector (const MultiVector &u)
 Copy constructor. More...
 
 MultiVector (const MultiVector &u, const ValueType initVal=utils::Types< ValueType >::zero)
 Copy constructor with reinitialisation. More...
 
 MultiVector (MultiVector &&u) noexcept
 Move constructor. More...
 
MultiVectoroperator= (const MultiVector &u)
 Copy assignment operator. More...
 
MultiVectoroperator= (MultiVector &&u)
 Move assignment operator. More...
 
iterator begin ()
 Return iterator pointing to the beginning of MultiVector data. More...
 
const_iterator begin () const
 Return iterator pointing to the beginning of MultiVector data. More...
 
iterator end ()
 Return iterator pointing to the end of MultiVector data. More...
 
const_iterator end () const
 Return iterator pointing to the end of MultiVector data. More...
 
ValueType * data ()
 Return the raw pointer to the MultiVector data. More...
 
const ValueType * data () const
 Return the constant raw pointer to the MultiVector data. More...
 
void setValue (const ValueType val)
 Set all entries of the MultiVector to a given value. More...
 
std::vector< double > l2Norms () const
 Returns \( l_2 \) norms of all the \(N\) vectors in the MultiVector. More...
 
std::vector< double > lInfNorms () const
 Returns \( l_{\inf} \) norms of all the \(N\) vectors in the MultiVector. More...
 
size_type getNumberComponents () const
 Returns the nunber of vectors in this multi-vector. More...
 
void updateGhostValues (const size_type communicationChannel=0)
 
void accumulateAddLocallyOwned (const size_type communicationChannel=0)
 
void updateGhostValuesBegin (const size_type communicationChannel=0)
 
void updateGhostValuesEnd ()
 
void accumulateAddLocallyOwnedBegin (const size_type communicationChannel=0)
 
void accumulateAddLocallyOwnedEnd ()
 
bool isCompatible (const MultiVector< ValueType, memorySpace > &rhs) const
 
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > getMPIPatternP2P () const
 
std::shared_ptr< LinAlgOpContext< memorySpace > > getLinAlgOpContext () const
 
global_size_type globalSize () const
 
size_type localSize () const
 
size_type locallyOwnedSize () const
 
size_type ghostSize () const
 
size_type numVectors () const
 

Additional Inherited Members

- Protected Attributes inherited from dftefe::linearAlgebra::MultiVector< ValueType, memorySpace >
std::unique_ptr< Storaged_storage
 
std::shared_ptr< LinAlgOpContext< memorySpace > > d_linAlgOpContext
 
VectorAttributes d_vectorAttributes
 
size_type d_localSize
 
global_size_type d_globalSize
 
size_type d_locallyOwnedSize
 
size_type d_ghostSize
 
size_type d_numVectors
 
std::unique_ptr< utils::mpi::MPICommunicatorP2P< ValueType, memorySpace > > d_mpiCommunicatorP2P
 
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > > d_mpiPatternP2P
 

Detailed Description

template<typename ValueType, dftefe::utils::MemorySpace memorySpace>
class dftefe::linearAlgebra::Vector< ValueType, memorySpace >

A class that encapsulates a vector. This is a vector in the mathematical sense and not in the sense of an array or STL container. This class handles both serial and distributed vector in a unfied way. There are different constructors provided for the serial and distributed case.

The serial Vector, as the name suggests, resides entirely in a processor.

The distributed Vector, on the other hand, is distributed across a set of processors. The storage of the distributed Vector in a processor comprises of two parts:

  1. locally owned part: A part of the distribute dVector, defined through a contiguous range of indices \([a,b)\) ( \(a\) is included, but \(b\) is not), for which the current processor is the sole owner. The size of the locally owned part (i.e., \(b-a\)) is termed as locallyOwnedSize.
  2. ghost part: Part of the distributed Vector, defined through a set of ghost indices, that are owned by other processors. The size of ghost part is termed as ghostSize.

Both the locally owned part and the ghost part are stored in a contiguous memory inside a MemoryStorage object, with the locally owned part stored first. The global size of the distributed Vector (i.e., the number of unique indices across all the processors) is simply termed as size. Additionally, we define localSize = locallyOwnedSize + ghostSize.

We handle the serial Vector as a special case of the distributed Vector, wherein size = locallyOwnedSize and ghostSize = 0.

Note
While typically one would link to an MPI library while compiling this class, care is taken to seamlessly allow usage of this class even while not linking to an MPI library. To do so, we have our own MPI wrappers that defaults to the MPI library's function calls and definitions while linking to an MPI library and provides a serial equivalent of those functions while not linking to an MPI library. This allows the user of this class to seamlessly switch between linking and de-linking to an MPI library without any change in the code and with the expected behavior.
Note that the case of not linking to an MPI library and the case of creating a serial mult-Vector are two independent things. One can still create a serial Vector while linking to an MPI library and running the code across multipe processors. That is, one can create a serial Vector in one or more than one of the set of processors used when running in parallel. Internally, we handle this by using MPI_COMM_SELF as our MPI_Comm for the serial Vector (i.e., the processor does self communication). However, while not linking to an MPI library (which by definition means running on a single processor), there is no notion of communication (neither with self nor with other processors). In such case, both serial and distributed mult-Vector mean the same thing and the MPI wrappers ensure the expected behavior (i.e., the behavior of a Vector while using just one processor)
Broadly, there are two ways of constructing a distributed Vector.
  1. [Prefered and efficient approach] The first approach takes a pointer to an MPIPatternP2P as an input argument (along with other arguments). The MPIPatternP2P, in turn, contains all the information regarding the locally owned and ghost part of the Vector as well as the interaction map between processors. This is the most efficient way of constructing a distributed Vector as it allows for reusing of an already constructed MPIPatternP2P.
  2. [ Expensive approach] The second approach takes in the locally owned, ghost indices or the total number of indices across all the processors and internally creates an MPIPatternP2P object. Given that the creation of an MPIPatternP2P is expensive, this route of constructing a distributed Vector should be avoided.
Template Parameters
templateparameter ValueType defines underlying datatype being stored in the vector (i.e., int, double, complex<double>, etc.)
templateparameter memorySpace defines the MemorySpace (i.e., HOST or DEVICE) in which the vector must reside.

Member Typedef Documentation

◆ const_iterator

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
using dftefe::linearAlgebra::Vector< ValueType, memorySpace >::const_iterator = typename Storage::const_iterator

◆ const_reference

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
using dftefe::linearAlgebra::Vector< ValueType, memorySpace >::const_reference = typename Storage::const_reference

◆ iterator

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
using dftefe::linearAlgebra::Vector< ValueType, memorySpace >::iterator = typename Storage::iterator

◆ pointer

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
using dftefe::linearAlgebra::Vector< ValueType, memorySpace >::pointer = typename Storage::pointer

◆ reference

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
using dftefe::linearAlgebra::Vector< ValueType, memorySpace >::reference = typename Storage::reference

◆ Storage

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
using dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Storage = typename MultiVector<ValueType, memorySpace>::Storage

◆ value_type

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
using dftefe::linearAlgebra::Vector< ValueType, memorySpace >::value_type = typename Storage::value_type

Constructor & Destructor Documentation

◆ Vector() [1/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( )
default

Default constructor.

◆ ~Vector()

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::~Vector ( )
default

Default Destructor.

◆ Vector() [2/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( size_type  size,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext,
ValueType  initVal = utils::Types<ValueType>::zero 
)

Constructor for a serial Vector with size and initial value arguments.

Constructor for a serial Vector using size and init value.

Parameters
[in]sizesize of the serial Vector
[in]linAlgOpContextshared pointer to LinAlgOpContext object
[in]initValinitial value of elements of the SerialVector

◆ Vector() [3/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( std::unique_ptr< typename Vector< ValueType, memorySpace >::Storage storage,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext 
)

Constructor for a serial Vector with predefined Storage (i.e., utils::MemoryStorage). This Constructor transfers the ownership of input Storage to the Vector. This is useful when one does not want to allocate new memory and instead use memory allocated in the Vector::Storage (i.e., MemoryStorage). The locallyOwnedSize, ghostSize, etc., are automatically set using the size of the storage.

Constructor for a serial Vector using user provided Vector::Storage (i.e., utils::MemoryStorage)

Parameters
[in]storageunique_ptr to Storage whose ownership is to be transfered to the Vector
[in]linAlgOpContextshared pointer to LinAlgOpContext object
Note
This Constructor transfers the ownership from the input unique_ptr storage to the internal data member of the Vector. Thus, after the function call storage will point to NULL and any access through storage will lead to undefined behavior.

◆ Vector() [4/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > >  mpiPatternP2P,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext,
const ValueType  initVal = utils::Types<ValueType>::zero 
)

Constructor for a distributed Vector based on an input MPIPatternP2P. This is the most prefered and optimal way of constructing a distributed Vector, as one can directly use the information already stored in the MPIPatternP2P.

Constructor for a distributed Vector using an existing MPIPatternP2P object.

Parameters
[in]mpiPatternP2PA shared_ptr to const MPIPatternP2P based on which the distributed Vector will be created.
[in]linAlgOpContextshared pointer to LinAlgOpContext object
[in]initValvalue with which the Vector shoud be initialized

◆ Vector() [5/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > >  mpiPatternP2P,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext,
const ValueType  min,
const ValueType  max 
)

Constructor for a distributed random Vector based on an input MPIPatternP2P.

Parameters
[in]mpiPatternP2PA shared_ptr to const MPIPatternP2P based on which the distributed Vector will be created.
[in]linAlgOpContextshared pointer to LinAlgOpContext object
[in]numVectorsnumber of vectors in the Vector
[in]min,maxvalue between for the random numbers

◆ Vector() [6/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( std::unique_ptr< typename Vector< ValueType, memorySpace >::Storage > &  storage,
std::shared_ptr< const utils::mpi::MPIPatternP2P< memorySpace > >  mpiPatternP2P,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext 
)

Constructor for a distributed Vector with a predefined Storage (i.e., utils::MemoryStorage) and MPIPatternP2P. This Constructor transfers the ownership of input Storage to the Vector. This is useful when one does not want to allocate new memory and instead use memory allocated in the Storage (i.e., MemoryStorage).

Constructorfor a distributed Vector using user provided Vector::Storage (i.e., utils::MemoryStorage) and an existing MPIPatternP2P.

Parameters
[in]storageunique_ptr to Vector::Storage whose ownership is to be transfered to the Vector
[in]mpiPatternP2PA shared_ptr to const MPIPatternP2P based on which the Vector will be created.
[in]linAlgOpContextshared pointer to LinAlgOpContext object
Note
This Constructor transfers the ownership from the input unique_ptr storage to the internal data member of the Vector. Thus, after the function call storage will point to NULL and any access through storage will lead to undefined behavior.

◆ Vector() [7/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( const std::pair< global_size_type, global_size_type locallyOwnedRange,
const std::vector< dftefe::global_size_type > &  ghostIndices,
const utils::mpi::MPIComm mpiComm,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext,
const ValueType  initVal = utils::Types<ValueType>::zero 
)

Constructor for a distributed Vector based on locally owned and ghost indices.

Constructor for a distributed Vector using locally owned range and ghost indices.

Note
This way of construction is expensive. One should use the other constructor based on an input MPIPatternP2P as far as possible.
Parameters
[in]locallyOwnedRangea pair \((a,b)\) which defines a range of indices (continuous) that are owned by the current processor.
[in]ghostIndicesvector containing an ordered set of ghost indices (ordered in increasing order and non-repeating)
[in]mpiCommutils::mpi::MPIComm object associated with the group of processors across which the Vector is to be distributed
[in]linAlgOpContextshared pointer to LinAlgOpContext object
[in]initValvalue with which the Vector shoud be initialized
Note
The locallyOwnedRange should be an open interval where the start index included, but the end index is not included.
This way of construction is expensive. One should use the other constructor based on an input MPIPatternP2P as far as possible.
Here is the call graph for this function:

◆ Vector() [8/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( const std::pair< global_size_type, global_size_type locallyOwnedRange,
const utils::mpi::MPIComm mpiComm,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext,
const ValueType  initVal = utils::Types<ValueType>::zero 
)

Constructor for a special case of distributed Vector where none none of the processors have any ghost indices.

Note
This way of construction is expensive. One should use the other constructor based on an input MPIPatternP2P as far as possible.
Parameters
[in]locallyOwnedRangea pair \((a,b)\) which defines a range of indices (continuous) that are owned by the current processor.
[in]mpiCommutils::mpi::MPIComm object associated with the group of processors across which the Vector is to be distributed
[in]linAlgOpContextshared pointer to LinAlgOpContext object
[in]initValvalue with which the Vector shoud be initialized
Note
The locallyOwnedRange should be an open interval where the start index included, but the end index is not included.
This way of construction is expensive. One should use the other constructor based on an input MPIPatternP2P as far as possible.
Here is the call graph for this function:

◆ Vector() [9/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( const global_size_type  totalGlobalDofs,
const utils::mpi::MPIComm mpiComm,
std::shared_ptr< LinAlgOpContext< memorySpace > >  linAlgOpContext,
const ValueType  initVal = utils::Types<ValueType>::zero 
)

Constructor for a distributed Vector based on total number of global indices. The resulting Vector will not contain any ghost indices on any of the processors. Internally, the vector is divided to ensure as much equitable distribution across all the processors much as possible.

Constructor for a distributed Vector that takes the total number indices across all processors and divides them up equitably (as far as possible) across all processors. The resulting Vector will not contain any ghost indices on any of the processors. This decompositon is not compatible with other constructors.

Note
This way of construction is expensive. One should use the other constructor based on an input MPIPatternP2P as far as possible. Further, the decomposition is not compatible with other ways of distributed vector construction.
Parameters
[in]globalSizeTotal number of global indices that is distributed over the processors.
[in]mpiCommutils::mpi::MPIComm object associated with the group of processors across which the Vector is to be distributed
[in]linAlgOpContextshared pointer to LinAlgOpContext object
[in]initValvalue with which the Vector shoud be initialized
Note
This way of construction is expensive. One should use the other constructor based on an input MPIPatternP2P or another vector as far as possible.

◆ Vector() [10/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( const Vector< ValueType, memorySpace > &  u)

Copy constructor.

Parameters
[in]uVector object to copy from

◆ Vector() [11/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( const Vector< ValueType, memorySpace > &  u,
ValueType  initVal 
)

Copy constructor with reinitialisation.

Parameters
[in]uVector object to copy from
[in]initValInitial value of the vector

◆ Vector() [12/12]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
dftefe::linearAlgebra::Vector< ValueType, memorySpace >::Vector ( Vector< ValueType, memorySpace > &&  u)
noexcept

Move constructor.

Parameters
[in]uVector object to move from

Member Function Documentation

◆ l2Norm()

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
double dftefe::linearAlgebra::Vector< ValueType, memorySpace >::l2Norm

Returns \( l_2 \) norm of the Vector.

Returns
\( l_2 \) norm of the vector

◆ lInfNorm()

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
double dftefe::linearAlgebra::Vector< ValueType, memorySpace >::lInfNorm

Returns \( l_{\inf} \) norm of the Vector.

Returns
\( l_{\inf} \) norm of the vector

◆ operator=() [1/2]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
Vector< ValueType, memorySpace > & dftefe::linearAlgebra::Vector< ValueType, memorySpace >::operator= ( const Vector< ValueType, memorySpace > &  u)

Copy assignment operator.

Parameters
[in]uconst reference to Vector object to copy from
Returns
reference to this object after copying data from u

◆ operator=() [2/2]

template<typename ValueType , dftefe::utils::MemorySpace memorySpace>
Vector< ValueType, memorySpace > & dftefe::linearAlgebra::Vector< ValueType, memorySpace >::operator= ( Vector< ValueType, memorySpace > &&  u)

Move assignment operator.

Parameters
[in]uconst reference to Vector object to move from
Returns
reference to this object after moving data from u

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