2 #ifndef ROL_VECTORCLONE_HPP
3 #define ROL_VECTORCLONE_HPP
69 template<
typename Real>
82 if(
typeid(x) !=
typeid(*vec_) )
83 throw logic_error(
"Argument and member vector types are different!");
85 throw logic_error(
"Argument and member vector types have different dimensions!");
94 Ptr<Vector<Real>> operator() (
const Ptr<
const Vector<Real>>& x ) {
96 if(
typeid(*x) !=
typeid(*vec_) )
97 throw logic_error(
"Argument and member vector types are different!");
98 if( x->dimension() != vec_->dimension() )
99 throw logic_error(
"Argument and member vector types have different dimensions!");
103 is_allocated_ =
true;
118 template<
typename Real,
typename KeyType=const
char*>
123 template<
typename First,
typename...Rest>
126 Constructor_Impl( rest... );
129 template<
typename First>
137 template<
typename... Keys>
139 Constructor_Impl( forward<Keys>(keys)... );
143 return clones_[key](x);
146 Ptr<Vector<Real>> operator() (
const Ptr<
const Vector<Real>>& x, KeyType key ) {
147 return clones_[key](x);
163 #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.