Advanced Multi-Physics (AMP)
On-Line Documentation
Vector.h
Go to the documentation of this file.
1#ifndef included_AMP_Vector
2#define included_AMP_Vector
3
4#include "AMP/utils/Units.h"
5#include "AMP/utils/Utilities.h"
6#include "AMP/utils/enable_shared_from_this.h"
7#include "AMP/vectors/Variable.h"
8#include "AMP/vectors/data/VectorData.h"
9#include "AMP/vectors/operations/VectorOperations.h"
10
11#include <iosfwd>
12#include <memory>
13#include <string>
14
15
16namespace AMP::Discretization {
17class DOFManager;
18}
19namespace AMP::IO {
20class RestartManager;
21}
22
23
24namespace AMP::LinearAlgebra {
25
26
27class VectorSelector;
28
29
54{
55
56public: // typedefs
60 typedef std::shared_ptr<Vector> shared_ptr;
61
65 typedef std::shared_ptr<const Vector> const_shared_ptr;
66
67
68public: // Constructor/destructors
71
76 explicit Vector( const std::string &name );
77
85 Vector( std::shared_ptr<VectorData> data,
86 std::shared_ptr<VectorOperations> ops,
87 std::shared_ptr<Variable> var,
88 std::shared_ptr<AMP::Discretization::DOFManager> DOFManager );
89
91 Vector( const Vector & ) = delete;
92
94 void operator=( const Vector & ) = delete;
95
97 virtual ~Vector();
98
99
100public: // Virtual functions
103 virtual std::string type() const;
104
106
112 virtual std::unique_ptr<Vector> rawClone() const;
113
124 virtual void swapVectors( Vector &other );
125
130
131 // This is the const version of selectInto.
133
134 virtual void copyVector( std::shared_ptr<const Vector> x )
135 {
136 AMP_ASSERT( x );
137 if ( x.get() == this )
138 return;
139 d_VectorOps->copy( *( x->getVectorData() ), *d_VectorData );
140 }
141
142
143public: // the next set of functions defines the public math. interface for vectors
149 void copy( const Vector &x );
150
156 void zero();
157
163 void setToScalar( const Scalar &alpha );
164
169
176 void scale( const Scalar &alpha, const Vector &x );
177
183 void scale( const Scalar &alpha );
184
191 void add( const Vector &x, const Vector &y );
192
199 void subtract( const Vector &x, const Vector &y );
200
207 void multiply( const Vector &x, const Vector &y );
208
215 void divide( const Vector &x, const Vector &y );
216
222 void reciprocal( const Vector &x );
223
232 void linearSum( const Scalar &alpha, const Vector &x, const Scalar &beta, const Vector &y );
233
240 void axpy( const Scalar &alpha, const Vector &x, const Vector &y );
241
249 void axpby( const Scalar &alpha, const Scalar &beta, const Vector &x );
250
256 void abs( const Vector &x );
257
264 void addScalar( const Vector &x, const Scalar &alpha );
265
269 void setMax( const Scalar &val );
270
274 void setMin( const Scalar &val );
275
279 Scalar min() const;
280
284 Scalar max() const;
285
289 Scalar sum() const;
290
294 Scalar mean() const;
295
300 Scalar L1Norm() const;
301
306 Scalar L2Norm() const;
307
319 Scalar minQuotient( const Vector &x ) const;
320
327 Scalar wrmsNorm( const Vector &x, const Vector &y ) const;
328
336 Scalar wrmsNormMask( const Vector &x, const Vector &mask, const Vector &y ) const;
337
343 Scalar dot( const Vector &x ) const;
344
352 std::pair<Scalar, Scalar> L2NormAndDot( const Vector &x ) const;
353
361 bool equals( const Vector &x, const Scalar &tol = 1e-6 ) const;
362
363
364public: // Clone vectors
371 std::shared_ptr<Vector> clone() const;
372
381 std::shared_ptr<Vector> clone( const std::string &name ) const;
382
390 std::shared_ptr<Vector> clone( const std::shared_ptr<Variable> name ) const;
391
392
393public: // Up/down-cast vectors
399 void copyCast( std::shared_ptr<const Vector> x );
400
401public: // Get/Set data/variables/operations
403 inline auto &getUnits() const { return d_units; }
404
406 virtual void setUnits( AMP::Units );
407
409 inline std::shared_ptr<AMP::Discretization::DOFManager> getDOFManager() const;
410
412 std::shared_ptr<VectorData> getVectorData() { return d_VectorData; }
413
415 std::shared_ptr<const VectorData> getVectorData() const { return d_VectorData; }
416
418 std::shared_ptr<VectorOperations> getVectorOperations() { return d_VectorOps; }
419
421 std::shared_ptr<const VectorOperations> getVectorOperations() const { return d_VectorOps; }
422
426 void setVariable( const std::shared_ptr<Variable> name );
427
431 const std::shared_ptr<Variable> getVariable() const;
432
436 std::shared_ptr<Variable> getVariable();
437
439 size_t getNumberOfComponents() const;
440
442 std::string getName() const;
443
445 void setName( const std::string &name );
446
452 virtual void rename( const std::string &src, const std::string &dst );
453
455 virtual void reset();
456
457public: // Subset/Select
466
475
481 Vector::shared_ptr subsetVectorForVariable( const std::string &name );
482
490 Vector::const_shared_ptr subsetVectorForVariable( const std::string &name ) const;
491
499 Vector::shared_ptr subsetVectorForVariable( std::shared_ptr<const Variable> var );
500
508 Vector::const_shared_ptr subsetVectorForVariable( std::shared_ptr<const Variable> var ) const;
509
516
523
536
542 template<typename VIEW_TYPE>
543 std::shared_ptr<VIEW_TYPE> getView() const;
544
550 template<typename VIEW_TYPE>
551 bool hasView() const;
552
556 template<typename VIEW_TYPE>
557 void registerView( std::shared_ptr<VIEW_TYPE> v ) const;
558
559
560public: // Iterators/Data
571 template<class TYPE = double>
573 {
574 return d_VectorData->begin<TYPE>();
575 }
576
578 template<class TYPE = double>
580 {
581 return d_VectorData->begin<const TYPE>();
582 }
583
585 template<class TYPE = double>
587 {
588 return d_VectorData->constBegin<const TYPE>();
589 }
590
601 template<class TYPE = double>
603 {
604 return d_VectorData->end<TYPE>();
605 }
606
608 template<class TYPE = double>
610 {
611 return d_VectorData->end<const TYPE>();
612 }
613
615 template<class TYPE = double>
617 {
618 return d_VectorData->constEnd<const TYPE>();
619 }
620
626 template<typename RETURN_TYPE>
627 inline RETURN_TYPE *getRawDataBlock( size_t i = 0 )
628 {
629 return d_VectorData->getRawDataBlock<RETURN_TYPE>( i );
630 }
631
637 template<typename RETURN_TYPE>
638 inline const RETURN_TYPE *getRawDataBlock( size_t i = 0 ) const
639 {
640 return d_VectorData->getRawDataBlock<RETURN_TYPE>( i );
641 }
642
643
644public: // VectorData operations
645 inline bool hasComm() const { return !d_VectorData->getComm().isNull(); }
646 inline const AMP_MPI &getComm() const { return d_VectorData->getComm(); }
647 inline std::string VectorDataName() const { return d_VectorData->VectorDataName(); }
648 inline size_t numberOfDataBlocks() const { return d_VectorData->numberOfDataBlocks(); }
649 inline size_t sizeOfDataBlock( size_t i = 0 ) const
650 {
651 return d_VectorData->sizeOfDataBlock( i );
652 }
653 template<class TYPE>
654 inline void putRawData( const TYPE *buf )
655 {
656 d_VectorData->putRawData( buf );
657 }
658 template<class TYPE>
659 inline void getRawData( TYPE *buf ) const
660 {
661 d_VectorData->getRawData( buf );
662 }
663 inline size_t getLocalSize() const { return d_VectorData->getLocalSize(); }
664 inline size_t getGlobalSize() const { return d_VectorData->getGlobalSize(); }
665 inline size_t getLocalStartID() const { return d_VectorData->getLocalStartID(); }
666 template<class TYPE>
667 inline void setValuesByLocalID( int num, size_t *indices, const TYPE *vals )
668 {
669 d_VectorData->setValuesByLocalID( num, indices, vals );
670 }
671 template<class TYPE>
672 inline void addValuesByLocalID( int num, size_t *indices, const TYPE *vals )
673 {
674 d_VectorData->addValuesByLocalID( num, indices, vals );
675 }
676 inline uint64_t getDataID() const { return d_VectorData->getDataID(); }
677 inline void *getRawDataBlockAsVoid( size_t i )
678 {
679 return d_VectorData->getRawDataBlockAsVoid( i );
680 }
681 inline const void *getRawDataBlockAsVoid( size_t i ) const
682 {
683 return d_VectorData->getRawDataBlockAsVoid( i );
684 }
685 inline size_t sizeofDataBlockType( size_t i ) const
686 {
687 return d_VectorData->sizeofDataBlockType( i );
688 }
689 template<typename TYPE>
690 inline bool isType( size_t block ) const
691 {
692 constexpr auto type = getTypeID<TYPE>();
693 return d_VectorData->isType( type, block );
694 }
695 inline void swapData( VectorData &rhs ) { d_VectorData->swapData( rhs ); }
696 inline std::shared_ptr<VectorData> cloneData() const { return d_VectorData->cloneData(); }
698 {
699 return d_VectorData->getLocalUpdateStatus();
700 }
702 {
703 d_VectorData->setUpdateStatus( state );
704 }
705 inline void makeConsistent() { d_VectorData->makeConsistent(); }
707 {
708 d_VectorData->makeConsistent( t );
709 }
711 inline std::shared_ptr<CommunicationList> getCommunicationList() const
712 {
713 return d_VectorData->getCommunicationList();
714 }
715 inline void setCommunicationList( std::shared_ptr<CommunicationList> comm )
716 {
717 d_VectorData->setCommunicationList( comm );
718 }
719 inline void dataChanged() { return d_VectorData->dataChanged(); }
720
721 inline size_t getGhostSize() const { return d_VectorData->getGhostSize(); }
722 template<typename TYPE>
723 inline void setGhostValuesByGlobalID( int num, const size_t *indices, const TYPE *vals )
724 {
725 d_VectorData->setGhostValuesByGlobalID( num, indices, vals );
726 }
727 template<typename TYPE>
728 inline void addGhostValuesByGlobalID( int num, const size_t *indices, const TYPE *vals )
729 {
730 d_VectorData->addGhostValuesByGlobalID( num, indices, vals );
731 }
732 template<typename TYPE>
733 inline void setValuesByGlobalID( int num, const size_t *indices, const TYPE *vals )
734 {
735 d_VectorData->setValuesByGlobalID( num, indices, vals );
736 }
737 template<typename TYPE>
738 inline void addValuesByGlobalID( int num, const size_t *indices, const TYPE *vals )
739 {
740 d_VectorData->addValuesByGlobalID( num, indices, vals );
741 }
742 template<typename TYPE>
743 inline void getValuesByGlobalID( int num, const size_t *indices, TYPE *vals ) const
744 {
745 d_VectorData->getValuesByGlobalID( num, indices, vals );
746 }
747 template<typename TYPE>
748 inline void getGhostValuesByGlobalID( int num, const size_t *indices, TYPE *vals ) const
749 {
750 d_VectorData->getGhostValuesByGlobalID( num, indices, vals );
751 }
752 template<typename TYPE>
753 inline void getValuesByLocalID( int num, const size_t *indices, TYPE *vals ) const
754 {
755 d_VectorData->getValuesByLocalID( num, indices, vals );
756 }
757
758 inline bool containsGlobalElement( size_t id )
759 {
760 return d_VectorData->containsGlobalElement( id );
761 }
762
763 inline void dumpOwnedData( std::ostream &out, size_t GIDoffset = 0, size_t LIDoffset = 0 ) const
764 {
765 d_VectorData->dumpOwnedData( out, GIDoffset, LIDoffset );
766 }
767 inline void dumpGhostedData( std::ostream &out, size_t offset = 0 ) const
768 {
769 d_VectorData->dumpGhostedData( out, offset );
770 }
771
775 inline void setNoGhosts() { d_VectorData->setNoGhosts(); }
776
780 {
781 return d_VectorData->getMemoryLocation();
782 }
783
784public: // Get values
791 template<typename TYPE = double>
792 TYPE getValueByGlobalID( size_t i ) const;
793
800 template<typename TYPE = double>
801 TYPE getLocalValueByGlobalID( size_t i ) const;
802
809 template<typename TYPE = double>
810 TYPE getGhostValueByGlobalID( size_t i ) const;
811
818 template<typename TYPE = double>
819 TYPE getValueByLocalID( size_t i ) const;
820
821
822public: // Set values
829 template<typename TYPE>
830 void setValueByGlobalID( size_t i, TYPE v );
831
832
833public:
836
837
838public: // Write/read restart data
845
851 virtual void writeRestart( int64_t fid ) const;
852
860
861
862protected: // Internal data
863 AMP::Units d_units; // Optional units for the data
864 std::shared_ptr<Variable> d_Variable; // Variable
865 std::shared_ptr<AMP::Discretization::DOFManager> d_DOFManager; // The DOF_Manager
866 std::shared_ptr<VectorData> d_VectorData; // Pointer to data
867 std::shared_ptr<VectorOperations> d_VectorOps; // Pointer to a VectorOperations
868 std::shared_ptr<std::vector<std::any>> d_Views; // Views of the vector
869};
870
871
873std::ostream &operator<<( std::ostream &out, const Vector::shared_ptr );
875std::ostream &operator<<( std::ostream &out, const Vector & );
876
877
878} // namespace AMP::LinearAlgebra
879
880#include "AMP/vectors/Vector.inline.h"
881
882#endif
Provides C++ wrapper around MPI routines.
Definition AMP_MPI.h:63
Class to manage reading/writing restart data.
A class used to hold vector data.
Definition VectorData.h:38
A class used by Vector::select and Vector::selectInto to create vectors with particular data.
Abstraction of a discrete Vector in a linear simulation.
Definition Vector.h:54
void setName(const std::string &name)
Set the vector name.
void dumpGhostedData(std::ostream &out, size_t offset=0) const
Definition Vector.h:767
size_t getNumberOfComponents() const
Return integer number of patch data components in vector.
void makeConsistent(AMP::LinearAlgebra::ScatterType t)
Definition Vector.h:706
void axpy(const Scalar &alpha, const Vector &x, const Vector &y)
Set this vector to alpha * x + y. .
Scalar wrmsNormMask(const Vector &x, const Vector &mask, const Vector &y) const
Return a weighted norm of a subset of a vector.
void getGhostValuesByGlobalID(int num, const size_t *indices, TYPE *vals) const
Definition Vector.h:748
void getValuesByGlobalID(int num, const size_t *indices, TYPE *vals) const
Definition Vector.h:743
bool containsGlobalElement(size_t id)
Definition Vector.h:758
Vector::const_shared_ptr subsetVectorForVariable(const std::string &name) const
Retrieve a sub-vector associated with a particular Variable.
virtual void reset()
Reset.
uint64_t getDataID() const
Definition Vector.h:676
void copy(const Vector &x)
Set vector equal to x For Vectors, .
void setValuesByGlobalID(int num, const size_t *indices, const TYPE *vals)
Definition Vector.h:733
Scalar min() const
Return the minimum value of the vector. .
std::shared_ptr< Vector > clone() const
Allocate space in the same fashion as this
size_t sizeofDataBlockType(size_t i) const
Definition Vector.h:685
virtual ~Vector()
Destructor.
TYPE getValueByLocalID(size_t i) const
Return a local value from the vector.
std::shared_ptr< std::vector< std::any > > d_Views
Definition Vector.h:868
VectorDataIterator< const TYPE > end() const
Return an iterator to the end of the data.
Definition Vector.h:609
VectorDataIterator< const TYPE > begin() const
Return an iterator to the beginning of the data.
Definition Vector.h:579
virtual void swapVectors(Vector &other)
Swap the data in this Vector for another.
size_t getGhostSize() const
Definition Vector.h:721
void addGhostValuesByGlobalID(int num, const size_t *indices, const TYPE *vals)
Definition Vector.h:728
VectorDataIterator< const TYPE > constEnd() const
Return an iterator to the end of the data.
Definition Vector.h:616
VectorDataIterator< const TYPE > constBegin() const
Return an iterator to the beginning of the data.
Definition Vector.h:586
Vector::const_shared_ptr subsetVectorForComponent(size_t index) const
Retrieve ith subvector.
void swapData(VectorData &rhs)
Definition Vector.h:695
const_shared_ptr select(const VectorSelector &criterion) const
Selects a portion of this vector and creates a view.
Scalar dot(const Vector &x) const
Return the dot product of this vector with the argument vector.
TYPE getGhostValueByGlobalID(size_t i) const
Return a ghost value from the vector.
Scalar mean() const
Return the maximum value of the vector. .
void addValuesByLocalID(int num, size_t *indices, const TYPE *vals)
Definition Vector.h:672
Vector(int64_t fid, AMP::IO::RestartManager *manager)
Read restart data to file.
std::shared_ptr< VIEW_TYPE > getView() const
If a particular type of view of this Vector has been created, return it.
void subtract(const Vector &x, const Vector &y)
Subtracts one vector from another. For Vectors, .
const AMP_MPI & getComm() const
Definition Vector.h:646
AMP::LinearAlgebra::UpdateState getUpdateStatus() const
Definition Vector.h:697
size_t getGlobalSize() const
Definition Vector.h:664
std::shared_ptr< Vector > shared_ptr
Shorthand for shared pointer to Vector.
Definition Vector.h:60
void operator=(const Vector &)=delete
No direct copying.
std::shared_ptr< VectorData > getVectorData()
Return the pointer to the VectorData.
Definition Vector.h:412
void copyCast(std::shared_ptr< const Vector > x)
Copy up/down-casting this
virtual Vector::const_shared_ptr selectInto(const VectorSelector &criterion) const
Vector::shared_ptr subsetVectorForComponent(size_t index)
Retrieve ith subvector.
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. .
void scale(const Scalar &alpha)
Scale a vector. For Vectors, .
virtual std::string type() const
Return the name of the vector.
std::shared_ptr< Vector > clone(const std::string &name) const
Allocate space in the same fashion as this
std::shared_ptr< VectorOperations > d_VectorOps
Definition Vector.h:867
Scalar minQuotient(const Vector &x) const
Returns the minimum of the quotient of two vectors:
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 setNoGhosts()
Ensure this vector has no ghosts.
Definition Vector.h:775
std::shared_ptr< AMP::Discretization::DOFManager > d_DOFManager
Definition Vector.h:865
void setVariable(const std::shared_ptr< Variable > name)
Change the variable associated with this vector.
const RETURN_TYPE * getRawDataBlock(size_t i=0) const
Obtain a particular contiguous block of data cast to RETURN_TYPE.
Definition Vector.h:638
std::shared_ptr< VectorOperations > getVectorOperations()
Return the pointer to the VectorOperation.
Definition Vector.h:418
void addValuesByGlobalID(int num, const size_t *indices, const TYPE *vals)
Definition Vector.h:738
size_t sizeOfDataBlock(size_t i=0) const
Definition Vector.h:649
std::shared_ptr< Variable > d_Variable
Definition Vector.h:864
uint64_t getID() const
Get a unique id hash for the vector.
std::shared_ptr< VectorData > d_VectorData
Definition Vector.h:866
virtual void setUnits(AMP::Units)
Get the units for this Vector.
void setUpdateStatus(AMP::LinearAlgebra::UpdateState state)
Definition Vector.h:701
void reciprocal(const Vector &x)
Set this to the component-wise reciprocal of a vector. .
virtual Vector::shared_ptr selectInto(const VectorSelector &criterion)
Selects a portion of this vector and puts a view into a vector.
const std::shared_ptr< Variable > getVariable() const
Get the variable associated with this vector.
void add(const Vector &x, const Vector &y)
Adds two vectors. For Vectors, .
void setToScalar(const Scalar &alpha)
Set all compenents of a vector to a scalar. For Vectors, the components of this are set to .
TYPE getValueByGlobalID(size_t i) const
Return a value from the vector.
bool isType(size_t block) const
Definition Vector.h:690
std::string getName() const
Return the vector name.
size_t numberOfDataBlocks() const
Definition Vector.h:648
virtual void registerChildObjects(AMP::IO::RestartManager *manager) const
Register any child objects.
void * getRawDataBlockAsVoid(size_t i)
Definition Vector.h:677
void putRawData(const TYPE *buf)
Definition Vector.h:654
bool hasView() const
If a particular type of view of this Vector has been created, return true.
Scalar wrmsNorm(const Vector &x, const Vector &y) const
Return a weighted norm of a vector.
std::shared_ptr< CommunicationList > getCommunicationList() const
Get the CommunicationList for this Vector.
Definition Vector.h:711
RETURN_TYPE * getRawDataBlock(size_t i=0)
Obtain a particular contiguous block of data cast to RETURN_TYPE.
Definition Vector.h:627
Vector::const_shared_ptr subsetVectorForVariable(std::shared_ptr< const Variable > var) const
Retrieve a sub-vector associated with a particular Variable.
shared_ptr select(const VectorSelector &criterion)
Selects a portion of this vector and creates a view.
Scalar sum() const
Return the maximum value of the vector. .
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.
void setMin(const Scalar &val)
modify vector to have min value 'val' specified
AMP::Utilities::MemoryType getMemoryLocation() const
returns the memory location for data
Definition Vector.h:779
virtual void writeRestart(int64_t fid) const
Write restart data to file.
std::shared_ptr< AMP::Discretization::DOFManager > getDOFManager() const
Get the DOFManager for this Vector.
Scalar max() const
Return the maximum value of the vector. .
void multiply(const Vector &x, const Vector &y)
Component-wise multiply one vector with another. For Vectors, .
std::shared_ptr< const VectorData > getVectorData() const
Return the pointer to the VectorData.
Definition Vector.h:415
void setGhostValuesByGlobalID(int num, const size_t *indices, const TYPE *vals)
Definition Vector.h:723
void setValuesByLocalID(int num, size_t *indices, const TYPE *vals)
Definition Vector.h:667
void abs(const Vector &x)
Set this to the component-wise absolute value of a vector. .
std::shared_ptr< Vector > clone(const std::shared_ptr< Variable > name) const
Allocate space in the same fashion as this
Scalar L2Norm() const
Return discrete -norm of this vector.
void axpby(const Scalar &alpha, const Scalar &beta, const Vector &x)
Set this vector alpha * x + this. .
Scalar maxNorm() const
Return the -norm of this vector.
void dumpOwnedData(std::ostream &out, size_t GIDoffset=0, size_t LIDoffset=0) const
Definition Vector.h:763
const void * getRawDataBlockAsVoid(size_t i) const
Definition Vector.h:681
void zero()
Set vector entries (including ghosts) to zero.
Vector::shared_ptr subsetVectorForVariable(const std::string &name)
Retrieve a sub-vector associated with a particular Variable.
Scalar L1Norm() const
Return discrete -norm of this vector.
bool equals(const Vector &x, const Scalar &tol=1e-6) const
Check if two vectors are equal.
VectorDataIterator< TYPE > begin()
Return an iterator to the beginning of the data.
Definition Vector.h:572
virtual void copyVector(std::shared_ptr< const Vector > x)
Definition Vector.h:134
void swapVectors(Vector::shared_ptr other)
Swap the data in this Vector for another.
Vector(const Vector &)=delete
No direct copying.
void setCommunicationList(std::shared_ptr< CommunicationList > comm)
Definition Vector.h:715
Vector(const std::string &name)
Create an empty vector with the given name.
auto & getUnits() const
Get the units for this Vector.
Definition Vector.h:403
std::shared_ptr< const Vector > const_shared_ptr
Definition Vector.h:65
void setRandomValues()
Set data in this vector to random values on [0,1).
Vector::shared_ptr subsetVectorForVariable(std::shared_ptr< const Variable > var)
Retrieve a sub-vector associated with a particular Variable.
std::string VectorDataName() const
Definition Vector.h:647
void setValueByGlobalID(size_t i, TYPE v)
Set a value in the vector.
std::shared_ptr< const VectorOperations > getVectorOperations() const
Return the pointer to the VectorOperation.
Definition Vector.h:421
void getRawData(TYPE *buf) const
Definition Vector.h:659
virtual std::unique_ptr< Vector > rawClone() const
Allocate space in the same fashion as this
size_t getLocalSize() const
Definition Vector.h:663
void divide(const Vector &x, const Vector &y)
Component-wise divide one vector by another. For Vectors, .
void getValuesByLocalID(int num, const size_t *indices, TYPE *vals) const
Definition Vector.h:753
void registerView(std::shared_ptr< VIEW_TYPE > v) const
Add a view of this vector to an internal queue.
size_t getLocalStartID() const
Definition Vector.h:665
Vector()
Empty Constructor.
void setMax(const Scalar &val)
modify vector to have max value 'val' specified
void scale(const Scalar &alpha, const Vector &x)
Set vector equal to scaled input. For Vectors, .
TYPE getLocalValueByGlobalID(size_t i) const
Return a local value from the vector.
void addScalar(const Vector &x, const Scalar &alpha)
set vector to .
std::shared_ptr< Variable > getVariable()
Get the variable associated with this vector.
std::shared_ptr< VectorData > cloneData() const
Definition Vector.h:696
VectorDataIterator< TYPE > end()
Return an iterator to the end of the data.
Definition Vector.h:602
virtual void rename(const std::string &src, const std::string &dst)
Renames.
Scalar is a class used to store a scalar variable that may be different types/precision.
Definition Scalar.h:21
Provides a class for storing units.
Definition Units.h:101
Enhancement of std::enable_shared_from_this.
#define AMP_ASSERT(EXP)
Assert error.
UpdateState
The four states a Vector can be in.
Definition Variable.h:26
ScatterType
Flag to choose algorithm for makeConsistent.
Definition Variable.h:21
std::ostream & operator<<(std::ostream &out, const Matrix &p)
MemoryType
Enum to store pointer type.
Definition Memory.h:21



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:41.
Comments on this page