2 #ifndef ROL_VECTORCLONE_HPP
3 #define ROL_VECTORCLONE_HPP
35 template<
typename Real>
48 if(
typeid(x) !=
typeid(*vec_) )
49 throw logic_error(
"Argument and member vector types are different!");
51 throw logic_error(
"Argument and member vector types have different dimensions!");
60 Ptr<Vector<Real>> operator() (
const Ptr<
const Vector<Real>>& x ) {
62 if(
typeid(*x) !=
typeid(*vec_) )
63 throw logic_error(
"Argument and member vector types are different!");
64 if( x->dimension() != vec_->dimension() )
65 throw logic_error(
"Argument and member vector types have different dimensions!");
84 template<
typename Real,
typename KeyType=const
char*>
89 template<
typename First,
typename...Rest>
92 Constructor_Impl( rest... );
95 template<
typename First>
103 template<
typename... Keys>
105 Constructor_Impl( forward<Keys>(keys)... );
109 return clones_[key](x);
112 Ptr<Vector<Real>> operator() (
const Ptr<
const Vector<Real>>& x, KeyType key ) {
113 return clones_[key](x);
129 #endif // ROL_VECTORCLONE_HPP
Container for wrapping a collection of uniquely-named reusable cloned vectors, which in are stored in...
virtual ROL::Ptr< Vector > clone() const =0
Clone to make a new (uninitialized) vector.
virtual int dimension() const
Return dimension of the vector space.
Defines the linear algebra or vector space interface.
Ptr< Vector< Real > > vec_
void Constructor_Impl(First first)
map< KeyType, VectorClone< Real > > clones_
void Constructor_Impl(First first, Rest...rest)
VectorCloneMap(Keys &&...keys)
Preallocate keys if desired.