ROL
|
Defines a parallel in time vector. More...
#include <ROL_PinTVector.hpp>
Public Types | |
enum | ESendRecv { SEND_AND_RECV, SEND_ONLY, RECV_ONLY } |
Public Member Functions | |
PinTVector () | |
PinTVector (const PinTVector &v) | |
PinTVector (const Ptr< const PinTCommunicators > &comm, const Ptr< Vector< Real >> &localVector, int steps, const std::vector< int > &stencil) | |
virtual | ~PinTVector () |
void | initialize (const Ptr< const PinTCommunicators > &comm, const Ptr< Vector< Real >> &localVector, int steps, const std::vector< int > &stencil) |
int | numOwnedVectors () const |
int | numOwnedSteps () const |
const std::vector< int > & | stencil () const |
const PinTCommunicators & | communicators () const |
bool | isValidIndex (int i) const |
Determine if an index is valid including the stencil. More... | |
Ptr< Vector< Real > > | getVectorPtr (int i) const |
Ptr< Vector< Real > > | getRemoteBufferPtr (int i) const |
void | boundaryExchange (ESendRecv send_recv=SEND_AND_RECV) const |
Exchange unknowns with neighboring processors. More... | |
void | boundaryExchangeSumInto () |
Exchange unknowns with neighboring processors using summation. More... | |
virtual void | plus (const Vector< Real > &x) |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\). More... | |
virtual void | scale (const Real alpha) |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\). More... | |
virtual Real | dot (const Vector< Real > &x) const |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\). More... | |
virtual Real | norm () const |
Returns \( \| y \| \) where \(y = \mathtt{*this}\). More... | |
virtual ROL::Ptr< Vector< Real > > | clone () const |
Clone to make a new (uninitialized) vector. More... | |
virtual void | print (std::ostream &outStream) const override |
virtual void | applyUnary (const Elementwise::UnaryFunction< Real > &f) override |
virtual void | set (const Vector< Real > &x) override |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\). More... | |
virtual void | axpy (const Real alpha, const Vector< Real > &x) override |
Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\). More... | |
virtual void | zeroAll () |
Zeros all entries of the vector, including boundary exchange fields. More... | |
![]() | |
virtual | ~Vector () |
virtual void | plus (const Vector &x)=0 |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\). More... | |
virtual Real | dot (const Vector &x) const =0 |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\). More... | |
virtual void | axpy (const Real alpha, const Vector &x) |
Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\). More... | |
virtual void | zero () |
Set to zero vector. More... | |
virtual ROL::Ptr< Vector > | basis (const int i) const |
Return i-th basis vector. More... | |
virtual int | dimension () const |
Return dimension of the vector space. More... | |
virtual void | set (const Vector &x) |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\). More... | |
virtual const Vector & | dual () const |
Return dual representation of \(\mathtt{*this}\), for example, the result of applying a Riesz map, or change of basis, or change of memory layout. More... | |
virtual void | applyBinary (const Elementwise::BinaryFunction< Real > &f, const Vector &x) |
virtual Real | reduce (const Elementwise::ReductionOp< Real > &r) const |
virtual void | setScalar (const Real C) |
Set \(y \leftarrow C\) where \(C\in\mathbb{R}\). More... | |
virtual std::vector< Real > | checkVector (const Vector< Real > &x, const Vector< Real > &y, const bool printToStream=true, std::ostream &outStream=std::cout) const |
Verify vector-space methods. More... | |
Protected Member Functions | |
void | computeStepStartEnd (int steps) |
void | allocateBoundaryExchangeVectors () |
Protected Attributes | |
bool | isInitialized_ |
Ptr< const PinTCommunicators > | communicators_ |
Ptr< Vector< Real > > | localVector_ |
int | steps_ |
std::vector< int > | stencil_ |
int | stepStart_ |
int | stepEnd_ |
Ptr< PinTVector< Real > > | dual_ |
Ptr< PartitionedVector< Real > > | stepVectors_ |
std::vector< Ptr< Vector< Real > > > | leftVectors_ |
std::vector< Ptr< Vector< Real > > > | rightVectors_ |
Ptr< PinTVectorCommunication < Real > > | vectorComm_ |
Defines a parallel in time vector.
Definition at line 169 of file ROL_PinTVector.hpp.
enum ROL::PinTVector::ESendRecv |
Enumerator | |
---|---|
SEND_AND_RECV | |
SEND_ONLY | |
RECV_ONLY |
Definition at line 258 of file ROL_PinTVector.hpp.
|
inline |
Definition at line 260 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::axpy(), ROL::PinTVector< Real >::dot(), ROL::PinTVector< Real >::plus(), and ROL::PinTVector< Real >::set().
|
inline |
Definition at line 264 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::communicators_, ROL::PinTVector< Real >::initialize(), ROL::PinTVector< Real >::leftVectors_, ROL::PinTVector< Real >::localVector_, ROL::PinTVector< Real >::rightVectors_, ROL::PinTVector< Real >::set(), ROL::PinTVector< Real >::stencil_, and ROL::PinTVector< Real >::steps_.
|
inline |
Definition at line 277 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::initialize().
|
inlinevirtual |
Definition at line 286 of file ROL_PinTVector.hpp.
|
inlineprotected |
Definition at line 199 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::communicators_, ROL::PinTVector< Real >::stepEnd_, and ROL::PinTVector< Real >::stepStart_.
Referenced by ROL::PinTVector< Real >::initialize().
|
inlineprotected |
Definition at line 229 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::leftVectors_, ROL::PinTVector< Real >::localVector_, ROL::PinTVector< Real >::rightVectors_, and ROL::PinTVector< Real >::stencil_.
Referenced by ROL::PinTVector< Real >::initialize().
|
inline |
Definition at line 288 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::allocateBoundaryExchangeVectors(), ROL::PinTVector< Real >::communicators_, ROL::PinTVector< Real >::computeStepStartEnd(), ROL::PinTVector< Real >::isInitialized_, ROL::PinTVector< Real >::leftVectors_, ROL::PinTVector< Real >::localVector_, ROL::PinTVector< Real >::rightVectors_, ROL::PinTVector< Real >::stencil(), ROL::PinTVector< Real >::stencil_, ROL::PinTVector< Real >::stepEnd_, ROL::PinTVector< Real >::steps_, ROL::PinTVector< Real >::stepStart_, ROL::PinTVector< Real >::stepVectors_, and ROL::PinTVector< Real >::vectorComm_.
Referenced by ROL::PinTVector< Real >::PinTVector().
|
inline |
How many vectors are "owned" by this processor. This also includes any duplicate vectors.
It may be the case that this processor belongs to a sub group of processors. All processors in that sub group will return the same number of owned vectors.
Definition at line 323 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::stepVectors_.
|
inline |
How many steps are "owned" by this processor.
It may be the case that this processor belongs to a sub group of processors. All processors in that sub group will return the same number of owned steps.
Definition at line 334 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::leftVectors_, ROL::PinTVector< Real >::rightVectors_, and ROL::PinTVector< Real >::stepVectors_.
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyAdjointHessian_11(), ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_2(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_2(), ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::PinTVector< Real >::getRemoteBufferPtr(), ROL::PinTVector< Real >::isValidIndex(), ROL::Constraint_PinTSimOpt< Real >::solve(), and ROL::Constraint_PinTSimOpt< Real >::value().
|
inline |
What is the stencil used to build this vector?
This accessor is directly based on what the user intiializes the vector with. Its used by ROL algorithms and constraints to ensure the communication patterns are understood.
Definition at line 345 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::stencil_.
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_2(), ROL::Constraint_PinTSimOpt< Real >::getNonconstVector(), ROL::PinTVector< Real >::initialize(), ROL::Constraint_PinTSimOpt< Real >::solve(), and ROL::Constraint_PinTSimOpt< Real >::value().
|
inline |
What is the communicators object used to build this vector?
Definition at line 349 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::communicators_.
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyJacobian_1().
|
inline |
Determine if an index is valid including the stencil.
An index is valid if is in [min(stencil),max(stencil)+numOwnedSteps()-1] Note that this treats owned vectors that live in the "shared" region as negative numbers, or numbers greater than numOwnedSteps()-1
Definition at line 358 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::leftVectors_, ROL::PinTVector< Real >::numOwnedSteps(), and ROL::PinTVector< Real >::rightVectors_.
Referenced by ROL::PinTVector< Real >::getRemoteBufferPtr(), and ROL::PinTVector< Real >::getVectorPtr().
|
inline |
Get a vector pointer. This range is valid from i in [min(stencil),max(stencil)+numOwnedSteps()-1]
Definition at line 382 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::isValidIndex(), ROL::PinTVector< Real >::leftVectors_, and ROL::PinTVector< Real >::stepVectors_.
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_2(), ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::Constraint_PinTSimOpt< Real >::getNonconstVector(), ROL::Constraint_PinTSimOpt< Real >::solve(), and ROL::Constraint_PinTSimOpt< Real >::value().
|
inline |
Get a vector pointer to the local buffer. This uses the same numbering scheme as getVectorPtr
. The valid range is valid from i in [min(stencil),-1], [max(stencil),max(stencil)+numOwnedSteps()-1]
Definition at line 394 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::isValidIndex(), ROL::PinTVector< Real >::leftVectors_, ROL::PinTVector< Real >::numOwnedSteps(), and ROL::PinTVector< Real >::rightVectors_.
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_1(), ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::Constraint_PinTSimOpt< Real >::solve(), and ROL::Constraint_PinTSimOpt< Real >::value().
|
inline |
Exchange unknowns with neighboring processors.
Using the stencil information, do global communication with time neighbor processors.
Definition at line 421 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::communicators_, ROL::PinTVector< Real >::getRemoteBufferPtr(), ROL::PinTVector< Real >::getVectorPtr(), ROL::PinTVector< Real >::numOwnedSteps(), ROL::PinTVector< Real >::RECV_ONLY, ROL::PinTVector< Real >::SEND_ONLY, ROL::PinTVector< Real >::stencil_, ROL::PinTVector< Real >::stepEnd_, ROL::PinTVector< Real >::steps_, ROL::PinTVector< Real >::stepStart_, and ROL::PinTVector< Real >::vectorComm_.
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyAdjointHessian_11(), ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_2(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_1(), ROL::Constraint_PinTSimOpt< Real >::applyJacobian_2(), ROL::Constraint_PinTSimOpt< Real >::solve(), and ROL::Constraint_PinTSimOpt< Real >::value().
|
inline |
Exchange unknowns with neighboring processors using summation.
Using the stencil information, do global communication with time neighbor processors. This sums in the the reverse direction.
Definition at line 479 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::communicators_, ROL::PinTVector< Real >::getRemoteBufferPtr(), ROL::PinTVector< Real >::getVectorPtr(), ROL::PinTVector< Real >::numOwnedSteps(), ROL::PinTVector< Real >::stencil_, ROL::PinTVector< Real >::stepEnd_, ROL::PinTVector< Real >::steps_, ROL::PinTVector< Real >::stepStart_, and ROL::PinTVector< Real >::vectorComm_.
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_1().
|
inlinevirtual |
Compute \(y \leftarrow y + x\), where \(y = \mathtt{*this}\).
[in] | x | is the vector to be added to \(\mathtt{*this}\). |
On return \(\mathtt{*this} = \mathtt{*this} + x\).
Definition at line 529 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::PinTVector(), and ROL::PinTVector< Real >::stepVectors_.
|
inlinevirtual |
Compute \(y \leftarrow \alpha y\) where \(y = \mathtt{*this}\).
[in] | alpha | is the scaling of \(\mathtt{*this}\). |
On return \(\mathtt{*this} = \alpha (\mathtt{*this}) \).
Implements ROL::Vector< Real >.
Definition at line 546 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::stepVectors_.
|
inlinevirtual |
Compute \( \langle y,x \rangle \) where \(y = \mathtt{*this}\).
[in] | x | is the vector that forms the dot product with \(\mathtt{*this}\). |
Definition at line 559 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::communicators_, ROL::PinTVector< Real >::PinTVector(), and ROL::PinTVector< Real >::stepVectors_.
Referenced by ROL::PinTVector< Real >::norm().
|
inlinevirtual |
Returns \( \| y \| \) where \(y = \mathtt{*this}\).
Implements ROL::Vector< Real >.
Definition at line 584 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::dot().
|
inlinevirtual |
Clone to make a new (uninitialized) vector.
Provides the means of allocating temporary memory in ROL.
Implements ROL::Vector< Real >.
Definition at line 598 of file ROL_PinTVector.hpp.
|
inlineoverridevirtual |
Reimplemented from ROL::Vector< Real >.
Definition at line 603 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::stepVectors_.
|
inlineoverridevirtual |
Reimplemented from ROL::Vector< Real >.
Definition at line 608 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::stepVectors_.
|
inlineoverridevirtual |
Set \(y \leftarrow x\) where \(y = \mathtt{*this}\).
[in] | x | is a vector. |
On return \(\mathtt{*this} = x\). Uses zero and plus methods for the computation. Please overload if a more efficient implementation is needed.
Definition at line 622 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::PinTVector(), and ROL::PinTVector< Real >::stepVectors_.
Referenced by ROL::PinTVector< Real >::PinTVector().
|
inlineoverridevirtual |
Compute \(y \leftarrow \alpha x + y\) where \(y = \mathtt{*this}\).
[in] | alpha | is the scaling of x. |
[in] | x | is a vector. |
On return \(\mathtt{*this} = \mathtt{*this} + \alpha x \). Uses clone, set, scale and plus for the computation. Please overload if a more efficient implementation is needed.
Definition at line 640 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::PinTVector(), and ROL::PinTVector< Real >::stepVectors_.
|
inlinevirtual |
Zeros all entries of the vector, including boundary exchange fields.
Definition at line 649 of file ROL_PinTVector.hpp.
References ROL::PinTVector< Real >::leftVectors_, ROL::PinTVector< Real >::rightVectors_, ROL::PinTVector< Real >::stepVectors_, and ROL::Vector< Real >::zero().
Referenced by ROL::Constraint_PinTSimOpt< Real >::applyAdjointHessian_11(), ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_1(), and ROL::Constraint_PinTSimOpt< Real >::applyAdjointJacobian_2().
|
protected |
Definition at line 176 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::initialize().
|
protected |
Definition at line 178 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::PinTVector< Real >::communicators(), ROL::PinTVector< Real >::computeStepStartEnd(), ROL::PinTVector< Real >::dot(), ROL::PinTVector< Real >::initialize(), and ROL::PinTVector< Real >::PinTVector().
|
protected |
Definition at line 180 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::allocateBoundaryExchangeVectors(), ROL::PinTVector< Real >::initialize(), and ROL::PinTVector< Real >::PinTVector().
|
protected |
Definition at line 181 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::PinTVector< Real >::initialize(), and ROL::PinTVector< Real >::PinTVector().
|
protected |
Definition at line 182 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::allocateBoundaryExchangeVectors(), ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::PinTVector< Real >::initialize(), ROL::PinTVector< Real >::PinTVector(), and ROL::PinTVector< Real >::stencil().
|
protected |
Definition at line 185 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::PinTVector< Real >::computeStepStartEnd(), and ROL::PinTVector< Real >::initialize().
|
protected |
Definition at line 186 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), ROL::PinTVector< Real >::computeStepStartEnd(), and ROL::PinTVector< Real >::initialize().
|
mutableprotected |
Definition at line 188 of file ROL_PinTVector.hpp.
|
protected |
Definition at line 190 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::applyUnary(), ROL::PinTVector< Real >::axpy(), ROL::PinTVector< Real >::dot(), ROL::PinTVector< Real >::getVectorPtr(), ROL::PinTVector< Real >::initialize(), ROL::PinTVector< Real >::numOwnedSteps(), ROL::PinTVector< Real >::numOwnedVectors(), ROL::PinTVector< Real >::plus(), ROL::PinTVector< Real >::print(), ROL::PinTVector< Real >::scale(), ROL::PinTVector< Real >::set(), and ROL::PinTVector< Real >::zeroAll().
|
protected |
Definition at line 191 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::allocateBoundaryExchangeVectors(), ROL::PinTVector< Real >::getRemoteBufferPtr(), ROL::PinTVector< Real >::getVectorPtr(), ROL::PinTVector< Real >::initialize(), ROL::PinTVector< Real >::isValidIndex(), ROL::PinTVector< Real >::numOwnedSteps(), ROL::PinTVector< Real >::PinTVector(), and ROL::PinTVector< Real >::zeroAll().
|
protected |
Definition at line 192 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::allocateBoundaryExchangeVectors(), ROL::PinTVector< Real >::getRemoteBufferPtr(), ROL::PinTVector< Real >::initialize(), ROL::PinTVector< Real >::isValidIndex(), ROL::PinTVector< Real >::numOwnedSteps(), ROL::PinTVector< Real >::PinTVector(), and ROL::PinTVector< Real >::zeroAll().
|
protected |
Definition at line 194 of file ROL_PinTVector.hpp.
Referenced by ROL::PinTVector< Real >::boundaryExchange(), ROL::PinTVector< Real >::boundaryExchangeSumInto(), and ROL::PinTVector< Real >::initialize().