Abstraction of a discrete Vector in a linear simulation. More...
#include <Vector.h>

Public Types | |
| typedef std::shared_ptr< const Vector > | const_shared_ptr |
| typedef std::shared_ptr< Vector > | shared_ptr |
| Shorthand for shared pointer to Vector. | |
Public Member Functions | |
| void | abs (const Vector &x) |
| Set this to the component-wise absolute value of a vector. \(\mathit{this}_i = |x_i|\). | |
| void | add (const Vector &x, const Vector &y) |
| Adds two vectors. For Vectors, \(\mathit{this}_i = x_i + y_i\). | |
| template<typename TYPE > | |
| void | addGhostValuesByGlobalID (int num, const size_t *indices, const TYPE *vals) |
| void | addScalar (const Vector &x, const Scalar &alpha) |
| set vector to \(x + \alpha \bar{1}\). | |
| template<typename TYPE > | |
| void | addValuesByGlobalID (int num, const size_t *indices, const TYPE *vals) |
| template<class TYPE > | |
| void | addValuesByLocalID (int num, size_t *indices, const TYPE *vals) |
| void | axpby (const Scalar &alpha, const Scalar &beta, const Vector &x) |
| Set this vector alpha * x + this. \(\mathit{this}_i = \alpha x_i + \beta \mathit{this}_i \). | |
| void | axpy (const Scalar &alpha, const Vector &x, const Vector &y) |
| Set this vector to alpha * x + y. \(\mathit{this}_i = \alpha x_i + y_i\). | |
| template<class TYPE = double> | |
| VectorDataIterator< TYPE > | begin () |
| Return an iterator to the beginning of the data. | |
| template<class TYPE = double> | |
| VectorDataIterator< const TYPE > | begin () const |
| Return an iterator to the beginning of the data. | |
| std::shared_ptr< Vector > | clone () const |
| Allocate space in the same fashion as this | |
| std::shared_ptr< Vector > | clone (const std::shared_ptr< Variable > name) const |
| Allocate space in the same fashion as this | |
| std::shared_ptr< Vector > | clone (const std::string &name) const |
| Allocate space in the same fashion as this | |
| std::shared_ptr< VectorData > | cloneData () const |
| template<class TYPE = double> | |
| VectorDataIterator< const TYPE > | constBegin () const |
| Return an iterator to the beginning of the data. | |
| template<class TYPE = double> | |
| VectorDataIterator< const TYPE > | constEnd () const |
| Return an iterator to the end of the data. | |
| bool | containsGlobalElement (size_t id) |
| void | copy (const Vector &x) |
| Set vector equal to x For Vectors, \(\mathit{this}_i = x_i\). | |
| void | copyCast (std::shared_ptr< const Vector > x) |
| Copy up/down-casting this | |
| virtual void | copyVector (std::shared_ptr< const Vector > x) |
| void | dataChanged () |
| void | divide (const Vector &x, const Vector &y) |
| Component-wise divide one vector by another. For Vectors, \(\mathit{this}_i = x_i / y_i\). | |
| Scalar | dot (const Vector &x) const |
| Return the dot product of this vector with the argument vector. | |
| void | dumpGhostedData (std::ostream &out, size_t offset=0) const |
| void | dumpOwnedData (std::ostream &out, size_t GIDoffset=0, size_t LIDoffset=0) const |
| template<class TYPE = double> | |
| VectorDataIterator< TYPE > | end () |
| Return an iterator to the end of the data. | |
| template<class TYPE = double> | |
| VectorDataIterator< const TYPE > | end () const |
| Return an iterator to the end of the data. | |
| bool | equals (const Vector &x, const Scalar &tol=1e-6) const |
| Check if two vectors are equal. | |
| const AMP_MPI & | getComm () const |
| std::shared_ptr< CommunicationList > | getCommunicationList () const |
| Get the CommunicationList for this Vector. | |
| uint64_t | getDataID () const |
| std::shared_ptr< AMP::Discretization::DOFManager > | getDOFManager () const |
| Get the DOFManager for this Vector. | |
| size_t | getGhostSize () const |
| template<typename TYPE = double> | |
| TYPE | getGhostValueByGlobalID (size_t i) const |
| Return a ghost value from the vector. | |
| template<typename TYPE > | |
| void | getGhostValuesByGlobalID (int num, const size_t *indices, TYPE *vals) const |
| size_t | getGlobalSize () const |
| uint64_t | getID () const |
| Get a unique id hash for the vector. | |
| size_t | getLocalSize () const |
| size_t | getLocalStartID () const |
| template<typename TYPE = double> | |
| TYPE | getLocalValueByGlobalID (size_t i) const |
| Return a local value from the vector. | |
| AMP::Utilities::MemoryType | getMemoryLocation () const |
| returns the memory location for data | |
| std::string | getName () const |
| Return the vector name. | |
| size_t | getNumberOfComponents () const |
| Return integer number of patch data components in vector. | |
| template<class TYPE > | |
| void | getRawData (TYPE *buf) const |
| template<typename RETURN_TYPE > | |
| RETURN_TYPE * | getRawDataBlock (size_t i=0) |
| Obtain a particular contiguous block of data cast to RETURN_TYPE. | |
| template<typename RETURN_TYPE > | |
| const RETURN_TYPE * | getRawDataBlock (size_t i=0) const |
| Obtain a particular contiguous block of data cast to RETURN_TYPE. | |
| void * | getRawDataBlockAsVoid (size_t i) |
| const void * | getRawDataBlockAsVoid (size_t i) const |
| auto & | getUnits () const |
| Get the units for this Vector. | |
| AMP::LinearAlgebra::UpdateState | getUpdateStatus () const |
| template<typename TYPE = double> | |
| TYPE | getValueByGlobalID (size_t i) const |
| Return a value from the vector. | |
| template<typename TYPE = double> | |
| TYPE | getValueByLocalID (size_t i) const |
| Return a local value from the vector. | |
| template<typename TYPE > | |
| void | getValuesByGlobalID (int num, const size_t *indices, TYPE *vals) const |
| template<typename TYPE > | |
| void | getValuesByLocalID (int num, const size_t *indices, TYPE *vals) const |
| std::shared_ptr< Variable > | getVariable () |
| Get the variable associated with this vector. | |
| const std::shared_ptr< Variable > | getVariable () const |
| Get the variable associated with this vector. | |
| std::shared_ptr< VectorData > | getVectorData () |
| Return the pointer to the VectorData. | |
| std::shared_ptr< const VectorData > | getVectorData () const |
| Return the pointer to the VectorData. | |
| std::shared_ptr< VectorOperations > | getVectorOperations () |
| Return the pointer to the VectorOperation. | |
| std::shared_ptr< const VectorOperations > | getVectorOperations () const |
| Return the pointer to the VectorOperation. | |
| template<typename VIEW_TYPE > | |
| std::shared_ptr< VIEW_TYPE > | getView () const |
| If a particular type of view of this Vector has been created, return it. | |
| bool | hasComm () const |
| template<typename VIEW_TYPE > | |
| bool | hasView () const |
| If a particular type of view of this Vector has been created, return true. | |
| template<typename TYPE > | |
| bool | isType (size_t block) const |
| Scalar | L1Norm () const |
| Return discrete \( L_1 \) -norm of this vector. | |
| Scalar | L2Norm () const |
| Return discrete \( L_2 \) -norm of this vector. | |
| std::pair< Scalar, Scalar > | L2NormAndDot (const Vector &x) const |
| Return the L2 norm of this vector and the dot product with the argument vector. | |
| void | linearSum (const Scalar &alpha, const Vector &x, const Scalar &beta, const Vector &y) |
| Set a vector to be a linear combination of two vectors. \(\mathit{this}_i = \alpha x_i + \beta y_i\). | |
| void | makeConsistent () |
| void | makeConsistent (AMP::LinearAlgebra::ScatterType t) |
| Scalar | max () const |
| Return the maximum value of the vector. \(\max_i \mathit{this}_i\). | |
| Scalar | maxNorm () const |
| Return the \( L_\infty \) -norm of this vector. | |
| Scalar | mean () const |
| Return the maximum value of the vector. \(\max_i \mathit{this}_i\). | |
| Scalar | min () const |
| Return the minimum value of the vector. \(\min_i \mathit{this}_i\). | |
| Scalar | minQuotient (const Vector &x) const |
| Returns the minimum of the quotient of two vectors: | |
| void | multiply (const Vector &x, const Vector &y) |
| Component-wise multiply one vector with another. For Vectors, \(\mathit{this}_i = x_i y_i\). | |
| size_t | numberOfDataBlocks () const |
| void | operator= (const Vector &)=delete |
| No direct copying. | |
| template<class TYPE > | |
| void | putRawData (const TYPE *buf) |
| virtual std::unique_ptr< Vector > | rawClone () const |
| Allocate space in the same fashion as this | |
| void | reciprocal (const Vector &x) |
| Set this to the component-wise reciprocal of a vector. \(\mathit{this}_i =
1/x_i\). | |
| virtual void | registerChildObjects (AMP::IO::RestartManager *manager) const |
| Register any child objects. | |
| template<typename VIEW_TYPE > | |
| void | registerView (std::shared_ptr< VIEW_TYPE > v) const |
| Add a view of this vector to an internal queue. | |
| virtual void | rename (const std::string &src, const std::string &dst) |
| Renames. | |
| virtual void | reset () |
| Reset. | |
| void | scale (const Scalar &alpha) |
| Scale a vector. For Vectors, \(\mathit{this}_i = \alpha\mathit{this}_i\). | |
| void | scale (const Scalar &alpha, const Vector &x) |
| Set vector equal to scaled input. For Vectors, \(\mathit{this}_i = \alpha x_i\). | |
| shared_ptr | select (const VectorSelector &criterion) |
| Selects a portion of this vector and creates a view. | |
| const_shared_ptr | select (const VectorSelector &criterion) const |
| Selects a portion of this vector and creates a view. | |
| virtual Vector::shared_ptr | selectInto (const VectorSelector &criterion) |
| Selects a portion of this vector and puts a view into a vector. | |
| virtual Vector::const_shared_ptr | selectInto (const VectorSelector &criterion) const |
| void | setCommunicationList (std::shared_ptr< CommunicationList > comm) |
| template<typename TYPE > | |
| void | setGhostValuesByGlobalID (int num, const size_t *indices, const TYPE *vals) |
| void | setMax (const Scalar &val) |
| modify vector to have max value 'val' specified | |
| void | setMin (const Scalar &val) |
| modify vector to have min value 'val' specified | |
| void | setName (const std::string &name) |
| Set the vector name. | |
| void | setNoGhosts () |
| Ensure this vector has no ghosts. | |
| void | setRandomValues () |
| Set data in this vector to random values on [0,1). | |
| void | setToScalar (const Scalar &alpha) |
| Set all compenents of a vector to a scalar. For Vectors, the components of this are set to \(\alpha\). | |
| virtual void | setUnits (AMP::Units) |
| Get the units for this Vector. | |
| void | setUpdateStatus (AMP::LinearAlgebra::UpdateState state) |
| template<typename TYPE > | |
| void | setValueByGlobalID (size_t i, TYPE v) |
| Set a value in the vector. | |
| template<typename TYPE > | |
| void | setValuesByGlobalID (int num, const size_t *indices, const TYPE *vals) |
| template<class TYPE > | |
| void | setValuesByLocalID (int num, size_t *indices, const TYPE *vals) |
| void | setVariable (const std::shared_ptr< Variable > name) |
| Change the variable associated with this vector. | |
| std::shared_ptr< Vector > | shared_from_this () |
| std::shared_ptr< const Vector > | shared_from_this () const |
| size_t | sizeOfDataBlock (size_t i=0) const |
| size_t | sizeofDataBlockType (size_t i) const |
| Vector::shared_ptr | subsetVectorForComponent (size_t index) |
| Retrieve ith subvector. | |
| Vector::const_shared_ptr | subsetVectorForComponent (size_t index) const |
| Retrieve ith subvector. | |
| Vector::shared_ptr | subsetVectorForVariable (const std::string &name) |
| Retrieve a sub-vector associated with a particular Variable. | |
| Vector::const_shared_ptr | subsetVectorForVariable (const std::string &name) const |
| Retrieve a sub-vector associated with a particular Variable. | |
| Vector::shared_ptr | subsetVectorForVariable (std::shared_ptr< const Variable > var) |
| Retrieve a sub-vector associated with a particular Variable. | |
| Vector::const_shared_ptr | subsetVectorForVariable (std::shared_ptr< const Variable > var) const |
| Retrieve a sub-vector associated with a particular Variable. | |
| void | subtract (const Vector &x, const Vector &y) |
| Subtracts one vector from another. For Vectors, \(\mathit{this}_i = x_i - y_i\). | |
| Scalar | sum () const |
| Return the maximum value of the vector. \(\max_i \mathit{this}_i\). | |
| void | swapData (VectorData &rhs) |
| virtual void | swapVectors (Vector &other) |
| Swap the data in this Vector for another. | |
| void | swapVectors (Vector::shared_ptr other) |
| Swap the data in this Vector for another. | |
| virtual std::string | type () const |
| Return the name of the vector. | |
| Vector () | |
| Empty Constructor. | |
| Vector (const std::string &name) | |
| Create an empty vector with the given name. | |
| Vector (const Vector &)=delete | |
| No direct copying. | |
| Vector (int64_t fid, AMP::IO::RestartManager *manager) | |
| Read restart data to file. | |
| Vector (std::shared_ptr< VectorData > data, std::shared_ptr< VectorOperations > ops, std::shared_ptr< Variable > var, std::shared_ptr< AMP::Discretization::DOFManager > DOFManager) | |
| Create an vector. | |
| std::string | VectorDataName () const |
| virtual void | writeRestart (int64_t fid) const |
| Write restart data to file. | |
| Scalar | wrmsNorm (const Vector &x, const Vector &y) const |
| Return a weighted norm of a vector. | |
| Scalar | wrmsNormMask (const Vector &x, const Vector &mask, const Vector &y) const |
| Return a weighted norm of a subset of a vector. | |
| void | zero () |
| Set vector entries (including ghosts) to zero. | |
| virtual | ~Vector () |
| Destructor. | |
Protected Attributes | |
| std::shared_ptr< AMP::Discretization::DOFManager > | d_DOFManager |
| AMP::Units | d_units |
| std::shared_ptr< Variable > | d_Variable |
| std::shared_ptr< VectorData > | d_VectorData |
| std::shared_ptr< VectorOperations > | d_VectorOps |
| std::shared_ptr< std::vector< std::any > > | d_Views |
| std::weak_ptr< Vector > | weak_ptr_ |
Abstraction of a discrete Vector in a linear simulation.
This class encapsulates many BLAS level 1 operations for use within AMP. There are a variety of subclasses that implement wrappers around various libraries so that these vectors can be used by methods in those libraries. Also, there are several subclasses that allow combination of Vectors. In general, a user will only need to use Vector as the others are different implementation details the developer need not manage.
Vectors are created by factories. For instance, SimpleVector implements a create method that returns a shared pointer to a Vector (Vector::shared_ptr). The MeshAdpater interface implements a createVector interface that also returns a Vector::shared_ptr. Unless some specialized use of a Vector is needed (see SimpleVector), the Vector::shared_ptr is the only type that should be used when implementing math in AMP.
Each Vector is associated with a Variable. This Variable describes the field this vector represents. The problem may be discretized on a domain and linearized to \(\mathbf{L}\mathbf{\tilde{u}}=\mathbf{f}\). In this case \(\mathbf{\tilde{u}}\) and \(\mathbf{f}\) are Vectors.
| typedef std::shared_ptr<const Vector> AMP::LinearAlgebra::Vector::const_shared_ptr |
| AMP::LinearAlgebra::Vector::Vector | ( | ) |
Empty Constructor.
|
explicit |
Create an empty vector with the given name.
| [in] | name | Name of the vector |
| AMP::LinearAlgebra::Vector::Vector | ( | std::shared_ptr< VectorData > | data, |
| std::shared_ptr< VectorOperations > | ops, | ||
| std::shared_ptr< Variable > | var, | ||
| std::shared_ptr< AMP::Discretization::DOFManager > | DOFManager | ||
| ) |
|
virtual |
Destructor.
| AMP::LinearAlgebra::Vector::Vector | ( | int64_t | fid, |
| AMP::IO::RestartManager * | manager | ||
| ) |
Read restart data to file.
This function will create a variable from the restart file
| fid | File identifier to write |
| manager | Restart manager |
Set this to the component-wise absolute value of a vector. \(\mathit{this}_i = |x_i|\).
| [in] | x | a vector |
Adds two vectors. For Vectors, \(\mathit{this}_i = x_i + y_i\).
| [in] | x | Input vector x |
| [in] | y | Input vector y |
|
inline |
Definition at line 728 of file Vector.h.
References d_VectorData.
set vector to \(x + \alpha \bar{1}\).
| [in] | x | a vector |
| [in] | alpha | a scalar |
for vectors, \(\mathit{this}_i = x_i + \alpha\).
|
inline |
Definition at line 738 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 672 of file Vector.h.
References d_VectorData.
| void AMP::LinearAlgebra::Vector::axpby | ( | const Scalar & | alpha, |
| const Scalar & | beta, | ||
| const Vector & | x | ||
| ) |
Set this vector alpha * x + this. \(\mathit{this}_i = \alpha x_i + \beta \mathit{this}_i \).
| [in] | alpha | a scalar |
| [in] | beta | a scalar |
| [in] | x | a vector |
Set this vector to alpha * x + y. \(\mathit{this}_i = \alpha x_i + y_i\).
| [in] | alpha | a scalar |
| [in] | x | a vector |
| [in] | y | a vector |
|
inline |
Return an iterator to the beginning of the data.
Since the Vector presents an interface to a contiguous block of data, it is natural for it to provide a random access iterator.
Definition at line 572 of file Vector.h.
References d_VectorData.
|
inline |
Return an iterator to the beginning of the data.
Since the Vector presents an interface to a contiguous block of data, it is natural for it to provide a random access iterator.
Definition at line 579 of file Vector.h.
References d_VectorData.
| std::shared_ptr< Vector > AMP::LinearAlgebra::Vector::clone | ( | ) | const |
| std::shared_ptr< Vector > AMP::LinearAlgebra::Vector::clone | ( | const std::shared_ptr< Variable > | name | ) | const |
Allocate space in the same fashion as this
This will allocate new space with identical layout as this. It will have the same number of blocks, each with the same engines and same number of entries.
| [in] | name | The variable to associate with the new vector |
Allocate space in the same fashion as this
This will allocate new space with identical layout as this. It will have the same number of blocks, each with the same engines and same number of entries. The vector will be associated with a clone of the same Variable with the given name.
| [in] | name | Name to give the variable associated with this vector |
|
inline |
Definition at line 696 of file Vector.h.
References d_VectorData.
|
inline |
Return an iterator to the beginning of the data.
Since the Vector presents an interface to a contiguous block of data, it is natural for it to provide a random access iterator.
Definition at line 586 of file Vector.h.
References d_VectorData.
|
inline |
Return an iterator to the end of the data.
Since the Vector presents an interface to a contiguous block of data, it is natural for it to provide a random access iterator.
Definition at line 616 of file Vector.h.
References d_VectorData.
Definition at line 758 of file Vector.h.
References d_VectorData.
Set vector equal to x For Vectors, \(\mathit{this}_i = x_i\).
| [in] | x | a vector |
Copy up/down-casting this
The vector will be associated with the same Variable, and will contain a copy of the data in x after up/down-casting it.
| [in] | x | a vector |
|
inlinevirtual |
Definition at line 134 of file Vector.h.
References AMP_ASSERT, d_VectorData, and d_VectorOps.
|
inline |
Definition at line 719 of file Vector.h.
References d_VectorData.
Component-wise divide one vector by another. For Vectors, \(\mathit{this}_i = x_i / y_i\).
| [in] | x | Input vector x |
| [in] | y | Input vector y |
Return the dot product of this vector with the argument vector.
Returns
\[\sum_i x_i\mathit{this}_i\]
| [in] | x | a vector |
|
inline |
Definition at line 767 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 763 of file Vector.h.
References d_VectorData.
|
inline |
Return an iterator to the end of the data.
Since the Vector presents an interface to a contiguous block of data, it is natural for it to provide a random access iterator.
Definition at line 602 of file Vector.h.
References d_VectorData.
|
inline |
Return an iterator to the end of the data.
Since the Vector presents an interface to a contiguous block of data, it is natural for it to provide a random access iterator.
Definition at line 609 of file Vector.h.
References d_VectorData.
Check if two vectors are equal.
Returns true if each vaue is within tol of the corresponding vaue in the other vector
| [in] | x | a vector |
| [in] | tol | tolerance to use |
Definition at line 646 of file Vector.h.
References d_VectorData.
|
inline |
Get the CommunicationList for this Vector.
Definition at line 711 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 676 of file Vector.h.
References d_VectorData.
|
inline |
Get the DOFManager for this Vector.
|
inline |
Definition at line 721 of file Vector.h.
References d_VectorData.
Return a ghost value from the vector.
| [in] | i | The global index into the vector |
This uses getGhostValuesByGlobalID to get the value
|
inline |
Definition at line 748 of file Vector.h.
References d_VectorData.
Referenced by AMP::Solver::AMG::csr_view< LinearAlgebra::CSRMatrix< Config > >::getGhostValues().
|
inline |
Definition at line 664 of file Vector.h.
References d_VectorData.
| uint64_t AMP::LinearAlgebra::Vector::getID | ( | ) | const |
Get a unique id hash for the vector.
|
inline |
Definition at line 663 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 665 of file Vector.h.
References d_VectorData.
Return a local value from the vector.
| [in] | i | The global index into the vector |
This uses getValuesByGlobalID to get the value
|
inline |
returns the memory location for data
Definition at line 779 of file Vector.h.
References d_VectorData.
| std::string AMP::LinearAlgebra::Vector::getName | ( | ) | const |
Return the vector name.
| size_t AMP::LinearAlgebra::Vector::getNumberOfComponents | ( | ) | const |
Return integer number of patch data components in vector.
Definition at line 659 of file Vector.h.
References d_VectorData.
|
inline |
Obtain a particular contiguous block of data cast to RETURN_TYPE.
| RETURN_TYPE | The pointer type of the return |
| [in] | i | Which block |
Definition at line 627 of file Vector.h.
References d_VectorData.
|
inline |
Obtain a particular contiguous block of data cast to RETURN_TYPE.
| RETURN_TYPE | The pointer type of the return |
| [in] | i | Which block |
Definition at line 638 of file Vector.h.
References d_VectorData.
Definition at line 677 of file Vector.h.
References d_VectorData.
Definition at line 681 of file Vector.h.
References d_VectorData.
|
inline |
|
inline |
Definition at line 697 of file Vector.h.
References d_VectorData.
Return a value from the vector.
| [in] | i | The global index into the vector |
This uses getValuesByGlobalID to get the value
Return a local value from the vector.
| [in] | i | The global index into the vector |
This uses getValuesByGlobalID to get the value
|
inline |
Definition at line 743 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 753 of file Vector.h.
References d_VectorData.
| std::shared_ptr< Variable > AMP::LinearAlgebra::Vector::getVariable | ( | ) |
|
inline |
Return the pointer to the VectorData.
Definition at line 412 of file Vector.h.
References d_VectorData.
|
inline |
Return the pointer to the VectorData.
Definition at line 415 of file Vector.h.
References d_VectorData.
|
inline |
Return the pointer to the VectorOperation.
Definition at line 418 of file Vector.h.
References d_VectorOps.
|
inline |
Return the pointer to the VectorOperation.
Definition at line 421 of file Vector.h.
References d_VectorOps.
| std::shared_ptr< VIEW_TYPE > AMP::LinearAlgebra::Vector::getView | ( | ) | const |
If a particular type of view of this Vector has been created, return it.
| VIEW_TYPE | The type of view to look for |
|
inline |
Definition at line 645 of file Vector.h.
References d_VectorData.
If a particular type of view of this Vector has been created, return true.
| VIEW_TYPE | The type of view to look for |
Definition at line 690 of file Vector.h.
References d_VectorData, and type().
| Scalar AMP::LinearAlgebra::Vector::L1Norm | ( | ) | const |
Return discrete \( L_1 \) -norm of this vector.
Returns
\[\sum_i |\mathit{this}_i|\]
| Scalar AMP::LinearAlgebra::Vector::L2Norm | ( | ) | const |
Return discrete \( L_2 \) -norm of this vector.
Returns
\[\sqrt{\sum_i \mathit{this}_i^2}\]
Return the L2 norm of this vector and the dot product with the argument vector.
Returns
\[\sum_i this_i^2 \]
and
\[\sum_i x_i\mathit{this}_i\]
. Note that this is an unoptimized version purely meant to provide functionality
| [in] | x | a vector |
| void AMP::LinearAlgebra::Vector::linearSum | ( | const Scalar & | alpha, |
| const Vector & | x, | ||
| const Scalar & | beta, | ||
| const Vector & | y | ||
| ) |
Set a vector to be a linear combination of two vectors. \(\mathit{this}_i = \alpha x_i + \beta y_i\).
| [in] | alpha | a scalar |
| [in] | x | a vector |
| [in] | beta | a scalar |
| [in] | y | a vector |
|
inline |
Definition at line 705 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 706 of file Vector.h.
References d_VectorData.
| Scalar AMP::LinearAlgebra::Vector::max | ( | ) | const |
Return the maximum value of the vector. \(\max_i \mathit{this}_i\).
| Scalar AMP::LinearAlgebra::Vector::maxNorm | ( | ) | const |
Return the \( L_\infty \) -norm of this vector.
Returns
\[\max_i |\mathit{this}_i|\]
| Scalar AMP::LinearAlgebra::Vector::mean | ( | ) | const |
Return the maximum value of the vector. \(\max_i \mathit{this}_i\).
| Scalar AMP::LinearAlgebra::Vector::min | ( | ) | const |
Return the minimum value of the vector. \(\min_i \mathit{this}_i\).
Returns the minimum of the quotient of two vectors:
\[\min_{i,y_i\neq0} x_i/\mathit{this}_i\]
| [in] | x | a vector |
\[\min_{i,y_i\neq0} x_i/\mathit{this}_i\]
Component-wise multiply one vector with another. For Vectors, \(\mathit{this}_i = x_i y_i\).
| [in] | x | Input vector x |
| [in] | y | Input vector y |
|
inline |
Definition at line 648 of file Vector.h.
References d_VectorData.
|
delete |
No direct copying.
Definition at line 654 of file Vector.h.
References d_VectorData.
Allocate space in the same fashion as this
This will allocate new space with identical layout as this.
Reimplemented in AMP::LinearAlgebra::MultiVector, AMP::LinearAlgebra::ManagedSundialsVector, and AMP::LinearAlgebra::ManagedThyraVector.
Set this to the component-wise reciprocal of a vector. \(\mathit{this}_i = 1/x_i\).
| x | a vector |
|
virtual |
Register any child objects.
This function will register child objects with the manager
| manager | Restart manager |
Reimplemented in AMP::LinearAlgebra::MultiVector.
Add a view of this vector to an internal queue.
| [in] | v | The view to add |
|
virtual |
Renames.
Renames the vector and any components matching src to dst.
| [in] | src | The original variable name |
| [in] | dst | The new variable name |
Reset.
Reimplemented in AMP::LinearAlgebra::MultiVector.
Scale a vector. For Vectors, \(\mathit{this}_i = \alpha\mathit{this}_i\).
| [in] | alpha | a scalar |
Set vector equal to scaled input. For Vectors, \(\mathit{this}_i = \alpha x_i\).
| [in] | alpha | a scalar |
| [in] | x | a vector |
| shared_ptr AMP::LinearAlgebra::Vector::select | ( | const VectorSelector & | criterion | ) |
Selects a portion of this vector and creates a view.
Selects a portion of this vector and creates a view. This function does NOT always return a multivector. To use: auto disp = data->select( VS_ByVariableName( "displacement" ), "displacement view" );
| [in] | criterion | The method for deciding inclusion in the view |
| const_shared_ptr AMP::LinearAlgebra::Vector::select | ( | const VectorSelector & | criterion | ) | const |
Selects a portion of this vector and creates a view.
Selects a portion of this vector and creates a view. This function does NOT always return a multivector. To use: auto disp = data->select( VS_ByVariableName( "displacement" ), "displacement view" );
| [in] | criterion | The method for deciding inclusion in the view |
|
virtual |
Selects a portion of this vector and puts a view into a vector.
| [in] | criterion | The method for deciding inclusion in the view |
Reimplemented in AMP::LinearAlgebra::MultiVector.
|
virtual |
Reimplemented in AMP::LinearAlgebra::MultiVector.
|
inline |
Definition at line 715 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 723 of file Vector.h.
References d_VectorData.
modify vector to have max value 'val' specified
modify vector to have min value 'val' specified
|
inline |
Ensure this vector has no ghosts.
Calls clearBuffer for the communication list and removes any storage for ghosts
Definition at line 775 of file Vector.h.
References d_VectorData.
| void AMP::LinearAlgebra::Vector::setRandomValues | ( | ) |
Set data in this vector to random values on [0,1).
Set all compenents of a vector to a scalar. For Vectors, the components of this are set to \(\alpha\).
| [in] | alpha | scalar value |
|
virtual |
Get the units for this Vector.
|
inline |
Definition at line 701 of file Vector.h.
References d_VectorData.
Set a value in the vector.
| [in] | i | The global index into the vector |
| [in] | v | The value to set |
This uses setValuesByGlobalID to set the value
|
inline |
Definition at line 733 of file Vector.h.
References d_VectorData.
|
inline |
Definition at line 667 of file Vector.h.
References d_VectorData.
Change the variable associated with this vector.
| [in] | name | The new variable |
|
inlineinherited |
Definition at line 28 of file enable_shared_from_this.h.
|
inlineinherited |
Definition at line 46 of file enable_shared_from_this.h.
Definition at line 649 of file Vector.h.
References d_VectorData.
Definition at line 685 of file Vector.h.
References d_VectorData.
| Vector::shared_ptr AMP::LinearAlgebra::Vector::subsetVectorForComponent | ( | size_t | index | ) |
Retrieve ith subvector.
Returns the ith subvector based on teh number of components.
| [in] | index | Index to retrieve |
| Vector::const_shared_ptr AMP::LinearAlgebra::Vector::subsetVectorForComponent | ( | size_t | index | ) | const |
Retrieve ith subvector.
Returns the ith subvector based on teh number of components.
| [in] | index | Index to retrieve |
| Vector::shared_ptr AMP::LinearAlgebra::Vector::subsetVectorForVariable | ( | const std::string & | name | ) |
Retrieve a sub-vector associated with a particular Variable.
| [in] | name | Variable by which to retrieve a subvector |
| Vector::const_shared_ptr AMP::LinearAlgebra::Vector::subsetVectorForVariable | ( | const std::string & | name | ) | const |
Retrieve a sub-vector associated with a particular Variable.
| [in] | name | Variable by which to retrieve a subvector |
A null pointer will be returned if the vector does not contain a sub-vector associated with the Variable
| Vector::shared_ptr AMP::LinearAlgebra::Vector::subsetVectorForVariable | ( | std::shared_ptr< const Variable > | var | ) |
Retrieve a sub-vector associated with a particular Variable.
| [in] | var | Variable by which to retrieve a subvector |
A null pointer will be returned if the vector does not contain a sub-vector associated with the Variable
| Vector::const_shared_ptr AMP::LinearAlgebra::Vector::subsetVectorForVariable | ( | std::shared_ptr< const Variable > | var | ) | const |
Retrieve a sub-vector associated with a particular Variable.
| [in] | var | Variable by which to retrieve a subvector |
A null pointer will be returned if the vector does not contain a sub-vector associated with the Variable
Subtracts one vector from another. For Vectors, \(\mathit{this}_i = x_i - y_i\).
| [in] | x | Input vector x |
| [in] | y | Input vector y |
| Scalar AMP::LinearAlgebra::Vector::sum | ( | ) | const |
Return the maximum value of the vector. \(\max_i \mathit{this}_i\).
|
inline |
Definition at line 695 of file Vector.h.
References d_VectorData.
Swap the data in this Vector for another.
| [in] | other | Vector to swap data with |
Effectively, this is
without a and b exchanging pointers.
Reimplemented in AMP::LinearAlgebra::MultiVector, AMP::LinearAlgebra::ManagedSundialsVector, and AMP::LinearAlgebra::ManagedThyraVector.
| void AMP::LinearAlgebra::Vector::swapVectors | ( | Vector::shared_ptr | other | ) |
|
virtual |
Return the name of the vector.
Reimplemented in AMP::LinearAlgebra::MultiVector, AMP::LinearAlgebra::ManagedSundialsVector, and AMP::LinearAlgebra::ManagedThyraVector.
Referenced by isType().
|
inline |
Definition at line 647 of file Vector.h.
References d_VectorData.
Write restart data to file.
This function will write the mesh to an HDF5 file
| fid | File identifier to write |
Reimplemented in AMP::LinearAlgebra::MultiVector.
Return a weighted norm of a vector.
| [in] | x | a vector |
| [in] | y | a vector |
\[\sqrt{\frac{\displaystyle \sum_i x^2_iy^2_i}{n}}\]
| Scalar AMP::LinearAlgebra::Vector::wrmsNormMask | ( | const Vector & | x, |
| const Vector & | mask, | ||
| const Vector & | y | ||
| ) | const |
Return a weighted norm of a subset of a vector.
| [in] | x | a vector |
| [in] | y | a vector |
| [in] | mask | a vector |
\[\sqrt{\frac{\displaystyle \sum_{i,\mathit{mask}_i>0} x^2_iy^2_i}{n}}\]
| void AMP::LinearAlgebra::Vector::zero | ( | ) |
Set vector entries (including ghosts) to zero.
This is equivalent (but more efficient) to calling setToScalar ( 0.0 ) followed by a makeConsistent(SET)
|
protected |
|
protected |
Definition at line 863 of file Vector.h.
Referenced by getUnits().
|
protected |
|
protected |
Definition at line 866 of file Vector.h.
Referenced by addGhostValuesByGlobalID(), addValuesByGlobalID(), addValuesByLocalID(), begin(), begin(), cloneData(), constBegin(), constEnd(), containsGlobalElement(), copyVector(), dataChanged(), dumpGhostedData(), dumpOwnedData(), end(), end(), getComm(), getCommunicationList(), getDataID(), getGhostSize(), getGhostValuesByGlobalID(), getGlobalSize(), getLocalSize(), getLocalStartID(), getMemoryLocation(), getRawData(), getRawDataBlock(), getRawDataBlock(), getRawDataBlockAsVoid(), getRawDataBlockAsVoid(), getUpdateStatus(), getValuesByGlobalID(), getValuesByLocalID(), getVectorData(), getVectorData(), hasComm(), isType(), makeConsistent(), makeConsistent(), numberOfDataBlocks(), putRawData(), setCommunicationList(), setGhostValuesByGlobalID(), setNoGhosts(), setUpdateStatus(), setValuesByGlobalID(), setValuesByLocalID(), sizeOfDataBlock(), sizeofDataBlockType(), swapData(), and VectorDataName().
|
protected |
Definition at line 867 of file Vector.h.
Referenced by copyVector(), getVectorOperations(), and getVectorOperations().
|
protected |
|
mutableprotectedinherited |
Definition at line 69 of file enable_shared_from_this.h.
|
Advanced Multi-Physics (AMP) Oak Ridge National Laboratory Idaho National Laboratory Los Alamos National Laboratory |
This page automatically produced from the source code by Last updated: Tue Mar 10 2026 13:06:43. Comments on this page |