![]() |
Block-Structured AMR Software Framework
|
Distributed dense vector that mirrors the layout of an AlgPartition. More...
#include <AMReX_AlgVector.H>
Public Types | |
| using | value_type = T |
| using | allocator_type = Allocator |
| using | Vec = PODVector< T, Allocator > |
Public Member Functions | |
| AlgVector ()=default | |
| Create an empty vector; call define() before use. | |
| AlgVector (Long global_size) | |
Allocate and partition global_size rows across MPI ranks. | |
| AlgVector (AlgPartition partition) | |
| Adopt an explicit partition that describes the data layout. | |
| AlgVector (AlgVector< T, Allocator > const &)=delete | |
| AlgVector & | operator= (AlgVector< T, Allocator > const &)=delete |
| AlgVector (AlgVector< T, Allocator > &&) noexcept=default | |
| AlgVector & | operator= (AlgVector< T, Allocator > &&) noexcept=default |
| ~AlgVector ()=default | |
| void | define (Long global_size) |
Resize/repartition the vector to span global_size rows. | |
| void | define (AlgPartition partition) |
Replace the current partition and storage with partition. | |
| bool | empty () const |
| True if the local storage holds zero entries. | |
| AlgPartition const & | partition () const |
| Partition describing the global layout of the vector. | |
| Long | numLocalRows () const |
| Number of entries stored on this rank. | |
| Long | numGlobalRows () const |
| Global number of rows. | |
| Long | globalBegin () const |
| Inclusive global index begin. | |
| Long | globalEnd () const |
| Exclusive global index end. | |
| T const * | data () const |
| T * | data () |
| Table1D< T const, Long > | view () const |
| Table1D< T const, Long > | const_view () const |
| Table1D< T, Long > | view () |
| 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) |
| T | sum (bool local=false) const |
| Return the sum of elements. | |
| T | norminf (bool local=false) const |
| Return the infinity norm. | |
| T | norm1 (bool local=false) const |
| Return the 1-norm. | |
| T | 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) |
| Flatten a cell-centered FabArray into this vector's storage. | |
| 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 |
| Scatter this vector back into a cell-centered FabArray. | |
| void | printToFile (std::string const &file) const |
Distributed dense vector that mirrors the layout of an AlgPartition.
| using amrex::AlgVector< T, Allocator >::allocator_type = Allocator |
| using amrex::AlgVector< T, Allocator >::value_type = T |
| using amrex::AlgVector< T, Allocator >::Vec = PODVector<T,Allocator> |
|
default |
Create an empty vector; call define() before use.
|
explicit |
Allocate and partition global_size rows across MPI ranks.
|
explicit |
Adopt an explicit partition that describes the data layout.
|
delete |
|
defaultnoexcept |
|
default |
|
inline |
| 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.
| 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.
| void amrex::AlgVector< T, Allocator >::copyFrom | ( | FabArray< FAB > const & | fa | ) |
Flatten a cell-centered FabArray into this vector's storage.
| fa | Source data; each valid box is copied in IndexType order. |
| void amrex::AlgVector< T, Allocator >::copyTo | ( | FabArray< FAB > & | fa | ) | const |
Scatter this vector back into a cell-centered FabArray.
| fa | Destination data that receives entries owned by this rank. |
|
inline |
Return raw data pointer. Unlike view(), the starting index is zero. Use the local row index when accessing the data.
|
inline |
Return raw data pointer. Unlike view(), the starting index is zero. Use the local row index when accessing the data.
| void amrex::AlgVector< T, Allocator >::define | ( | AlgPartition | partition | ) |
Replace the current partition and storage with partition.
| partition | Partition describing the global layout to adopt. |
| void amrex::AlgVector< T, Allocator >::define | ( | Long | global_size | ) |
Resize/repartition the vector to span global_size rows.
Existing contents are discarded; rows are divided evenly across participating ranks.
| global_size | Total number of entries in the vector. |
|
inline |
True if the local storage holds zero entries.
|
inline |
Inclusive global index begin.
|
inline |
Exclusive global index end.
| 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.
| local | If true, compute the norm over local entries only. |
| 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.
| local | If true, compute the norms over local entries only. |
| 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.
| local | If true, compute the norm over local entries only. |
| 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.
| local | If true, compute the norm over local entries only. |
|
inline |
Global number of rows.
|
inline |
Number of entries stored on this rank.
|
defaultnoexcept |
|
delete |
|
inline |
Partition describing the global layout of the vector.
| 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.
| 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.
| void amrex::AlgVector< T, Allocator >::printToFile | ( | std::string const & | file | ) | const |
| void amrex::AlgVector< T, Allocator >::scale | ( | T | scale_factor | ) |
Scale this vector by scale_factor in-place. For GPU builds, this function synchronizes with the hostr before returning.
| void amrex::AlgVector< T, Allocator >::scaleAsync | ( | T | scale_factor | ) |
Scale this vector by scale_factor in-place. For GPU guilds, this function is asynchronous with respect to the host.
| void amrex::AlgVector< T, Allocator >::setVal | ( | T | val | ) |
Set every element to val. For GPU builds, this function synchronizes with the host before returning.
| void amrex::AlgVector< T, Allocator >::setValAsync | ( | T | val | ) |
Set every element to val. For GPU builds, this function is asynchronous with respect to the host.
| 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.
| local | If true, compute the sum over local entries only. |
|
inline |
|
inline |