Block-Structured AMR Software Framework
Loading...
Searching...
No Matches
amrex::AlgVector< T, Allocator > Class Template Reference

#include <AMReX_AlgVector.H>

Public Types

using value_type = T
 
using allocator_type = Allocator
 
using Vec = PODVector< T, Allocator >
 

Public Member Functions

 AlgVector ()=default
 
 AlgVector (Long global_size)
 
 AlgVector (AlgPartition partition)
 
 AlgVector (AlgVector< T, Allocator > const &)=delete
 
AlgVectoroperator= (AlgVector< T, Allocator > const &)=delete
 
 AlgVector (AlgVector< T, Allocator > &&) noexcept=default
 
AlgVectoroperator= (AlgVector< T, Allocator > &&) noexcept=default
 
 ~AlgVector ()=default
 
void define (Long global_size)
 
void define (AlgPartition partition)
 
bool empty () const
 
AlgPartition const & partition () const
 
Long numLocalRows () const
 
Long numGlobalRows () const
 
Long globalBegin () const
 Inclusive global index begin.
 
Long globalEnd () const
 Exclusive global index end.
 
T const * data () const
 
T * data ()
 
Table1D< T const, Longview () const
 
Table1D< T const, Longconst_view () const
 
Table1D< T, Longview ()
 
void setVal (T val)
 
void setValAsync (T val)
 
void copy (AlgVector< T, Allocator > const &rhs)
 
void copyAsync (AlgVector< T, Allocator > const &rhs)
 
void plus (AlgVector< T, Allocator > const &rhs)
 
void plusAsync (AlgVector< T, Allocator > const &rhs)
 
void scale (T scale_factor)
 
void scaleAsync (T scale_factor)
 
sum (bool local=false) const
 Return the sum of elements.
 
norminf (bool local=false) const
 Return the infinity norm.
 
norm1 (bool local=false) const
 Return the 1-norm.
 
norm2 (bool local=false) const
 Return the 2-norm.
 
std::pair< T, T > norm1and2 (bool local=false) const
 Return the 1-norm and 2-norm as a pair.
 
template<typename FAB , std::enable_if_t< amrex::IsBaseFab< FAB >::value &&std::is_same_v< T, typename FAB::value_type >, int > = 0>
void copyFrom (FabArray< FAB > const &fa)
 
template<typename FAB , std::enable_if_t< amrex::IsBaseFab< FAB >::value &&std::is_same_v< T, typename FAB::value_type >, int > = 0>
void copyTo (FabArray< FAB > &fa) const
 
void printToFile (std::string const &file) const
 

Member Typedef Documentation

◆ allocator_type

template<typename T , typename Allocator = DefaultAllocator<T>>
using amrex::AlgVector< T, Allocator >::allocator_type = Allocator

◆ value_type

template<typename T , typename Allocator = DefaultAllocator<T>>
using amrex::AlgVector< T, Allocator >::value_type = T

◆ Vec

template<typename T , typename Allocator = DefaultAllocator<T>>
using amrex::AlgVector< T, Allocator >::Vec = PODVector<T,Allocator>

Constructor & Destructor Documentation

◆ AlgVector() [1/5]

template<typename T , typename Allocator = DefaultAllocator<T>>
amrex::AlgVector< T, Allocator >::AlgVector ( )
default

◆ AlgVector() [2/5]

template<typename T , typename Allocator >
amrex::AlgVector< T, Allocator >::AlgVector ( Long  global_size)
explicit

◆ AlgVector() [3/5]

template<typename T , typename Allocator >
amrex::AlgVector< T, Allocator >::AlgVector ( AlgPartition  partition)
explicit

◆ AlgVector() [4/5]

template<typename T , typename Allocator = DefaultAllocator<T>>
amrex::AlgVector< T, Allocator >::AlgVector ( AlgVector< T, Allocator > const &  )
delete

◆ AlgVector() [5/5]

template<typename T , typename Allocator = DefaultAllocator<T>>
amrex::AlgVector< T, Allocator >::AlgVector ( AlgVector< T, Allocator > &&  )
defaultnoexcept

◆ ~AlgVector()

template<typename T , typename Allocator = DefaultAllocator<T>>
amrex::AlgVector< T, Allocator >::~AlgVector ( )
default

Member Function Documentation

◆ const_view()

template<typename T , typename Allocator = DefaultAllocator<T>>
Table1D< T const, Long > amrex::AlgVector< T, Allocator >::const_view ( ) const
inline

Return a Table1D view of the data. Unlike data(), indexing starts at the global row index. Use the global row index when accessing the data.

◆ copy()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::copy ( AlgVector< T, Allocator > const &  rhs)

Copy values from rhs into this vector. For GPU builds, this function synchronizes with the hostr before returning.

◆ copyAsync()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::copyAsync ( AlgVector< T, Allocator > const &  rhs)

Copy values from rhs into this vector. For GPU guilds, this function is asynchronous with respect to the host.

◆ copyFrom()

template<typename T , typename Allocator >
template<typename FAB , std::enable_if_t< amrex::IsBaseFab< FAB >::value &&std::is_same_v< T, typename FAB::value_type >, int > >
void amrex::AlgVector< T, Allocator >::copyFrom ( FabArray< FAB > const &  fa)

◆ copyTo()

template<typename T , typename Allocator >
template<typename FAB , std::enable_if_t< amrex::IsBaseFab< FAB >::value &&std::is_same_v< T, typename FAB::value_type >, int > >
void amrex::AlgVector< T, Allocator >::copyTo ( FabArray< FAB > &  fa) const

◆ data() [1/2]

template<typename T , typename Allocator = DefaultAllocator<T>>
T * amrex::AlgVector< T, Allocator >::data ( )
inline

Return raw data pointer. Unlike view(), the starting index is zero. Use the local row index when accessing the data.

◆ data() [2/2]

template<typename T , typename Allocator = DefaultAllocator<T>>
T const * amrex::AlgVector< T, Allocator >::data ( ) const
inline

Return raw data pointer. Unlike view(), the starting index is zero. Use the local row index when accessing the data.

◆ define() [1/2]

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::define ( AlgPartition  partition)

◆ define() [2/2]

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::define ( Long  global_size)

◆ empty()

template<typename T , typename Allocator = DefaultAllocator<T>>
bool amrex::AlgVector< T, Allocator >::empty ( ) const
inline

◆ globalBegin()

template<typename T , typename Allocator = DefaultAllocator<T>>
Long amrex::AlgVector< T, Allocator >::globalBegin ( ) const
inline

Inclusive global index begin.

◆ globalEnd()

template<typename T , typename Allocator = DefaultAllocator<T>>
Long amrex::AlgVector< T, Allocator >::globalEnd ( ) const
inline

Exclusive global index end.

◆ norm1()

template<typename T , typename Allocator >
T amrex::AlgVector< T, Allocator >::norm1 ( bool  local = false) const

Return the 1-norm.

By default, this returns the global norm over all MPI ranks. If local is true, it returns the norm over the locally stored entries only.

Parameters
localIf true, compute the norm over local entries only.
Returns
The 1-norm.

◆ norm1and2()

template<typename T , typename Allocator >
std::pair< T, T > amrex::AlgVector< T, Allocator >::norm1and2 ( bool  local = false) const

Return the 1-norm and 2-norm as a pair.

By default, this returns the global norms over all MPI ranks. If local is true, it returns the norms over the locally stored entries only.

Parameters
localIf true, compute the norms over local entries only.
Returns
The 1-norm and 2-norm as a pair.

◆ norm2()

template<typename T , typename Allocator >
T amrex::AlgVector< T, Allocator >::norm2 ( bool  local = false) const

Return the 2-norm.

By default, this returns the global norm over all MPI ranks. If local is true, it returns the norm over the locally stored entries only.

Parameters
localIf true, compute the norm over local entries only.
Returns
The 2-norm.

◆ norminf()

template<typename T , typename Allocator >
T amrex::AlgVector< T, Allocator >::norminf ( bool  local = false) const

Return the infinity norm.

By default, this returns the global norm over all MPI ranks. If local is true, it returns the norm over the locally stored entries only.

Parameters
localIf true, compute the norm over local entries only.
Returns
The infinity norm.

◆ numGlobalRows()

template<typename T , typename Allocator = DefaultAllocator<T>>
Long amrex::AlgVector< T, Allocator >::numGlobalRows ( ) const
inline

◆ numLocalRows()

template<typename T , typename Allocator = DefaultAllocator<T>>
Long amrex::AlgVector< T, Allocator >::numLocalRows ( ) const
inline

◆ operator=() [1/2]

template<typename T , typename Allocator = DefaultAllocator<T>>
AlgVector & amrex::AlgVector< T, Allocator >::operator= ( AlgVector< T, Allocator > &&  )
defaultnoexcept

◆ operator=() [2/2]

template<typename T , typename Allocator = DefaultAllocator<T>>
AlgVector & amrex::AlgVector< T, Allocator >::operator= ( AlgVector< T, Allocator > const &  )
delete

◆ partition()

template<typename T , typename Allocator = DefaultAllocator<T>>
AlgPartition const & amrex::AlgVector< T, Allocator >::partition ( ) const
inline

◆ plus()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::plus ( AlgVector< T, Allocator > const &  rhs)

Add rhs to this vector in-place. For GPU builds, this function synchronizes with the hostr before returning.

◆ plusAsync()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::plusAsync ( AlgVector< T, Allocator > const &  rhs)

Add rhs to this vector in-place. For GPU guilds, this function is asynchronous with respect to the host.

◆ printToFile()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::printToFile ( std::string const &  file) const

◆ scale()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::scale ( scale_factor)

Scale this vector by scale_factor in-place. For GPU builds, this function synchronizes with the hostr before returning.

◆ scaleAsync()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::scaleAsync ( scale_factor)

Scale this vector by scale_factor in-place. For GPU guilds, this function is asynchronous with respect to the host.

◆ setVal()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::setVal ( val)

Set every element to val. For GPU builds, this function synchronizes with the host before returning.

◆ setValAsync()

template<typename T , typename Allocator >
void amrex::AlgVector< T, Allocator >::setValAsync ( val)

Set every element to val. For GPU builds, this function is asynchronous with respect to the host.

◆ sum()

template<typename T , typename Allocator >
T amrex::AlgVector< T, Allocator >::sum ( bool  local = false) const

Return the sum of elements.

By default, this returns the global sum over all MPI ranks. If local is true, it returns the sum over the locally stored entries only.

Parameters
localIf true, compute the sum over local entries only.
Returns
The sum of elements.

◆ view() [1/2]

template<typename T , typename Allocator = DefaultAllocator<T>>
Table1D< T, Long > amrex::AlgVector< T, Allocator >::view ( )
inline

Return a Table1D view of the data. Unlike data(), indexing starts at the global row index. Use the global row index when accessing the data.

◆ view() [2/2]

template<typename T , typename Allocator = DefaultAllocator<T>>
Table1D< T const, Long > amrex::AlgVector< T, Allocator >::view ( ) const
inline

Return a Table1D view of the data. Unlike data(), indexing starts at the global row index. Use the global row index when accessing the data.


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