2 #ifndef ROL_VECTORCLONE_HPP
3 #define ROL_VECTORCLONE_HPP
33 template<
typename Real>
46 if(
typeid(x) !=
typeid(*
vec_) )
47 throw std::logic_error(
"Argument and member vector types are different!");
49 throw std::logic_error(
"Argument and member vector types have different dimensions!");
60 if(
typeid(*x) !=
typeid(*
vec_) )
61 throw std::logic_error(
"Argument and member vector types are different!");
62 if( x->dimension() !=
vec_->dimension() )
63 throw std::logic_error(
"Argument and member vector types have different dimensions!");
82 template<
typename Real,
typename KeyType=const
char*>
85 std::map<KeyType, VectorClone<Real>>
clones_;
87 template<
typename First,
typename...Rest>
93 template<
typename First>
101 template<
typename... Keys>
127 #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.
Ptr< Vector< Real > > operator()(const Vector< Real > &x)
Defines the linear algebra or vector space interface.
Ptr< Vector< Real > > vec_
void Constructor_Impl(First first)
std::map< KeyType, VectorClone< Real > > clones_
void Constructor_Impl(First first, Rest...rest)
Ptr< Vector< Real > > operator()(const Vector< Real > &x, KeyType key)
VectorCloneMap(Keys &&...keys)
Preallocate keys if desired.