10 #ifndef THYRA_VECTOR_SPACE_BASE_DEF_HPP
11 #define THYRA_VECTOR_SPACE_BASE_DEF_HPP
13 #include "Thyra_VectorSpaceBase_decl.hpp"
14 #include "Thyra_VectorBase.hpp"
15 #include "Thyra_MultiVectorBase.hpp"
16 #include "Teuchos_Tuple.hpp"
20 # define THYRA_INITIALIZE_VECS_MULTIVECS_WITH_NANS
36 template<
class Scalar>
43 template<
class Scalar>
51 template<
class Scalar>
67 template<
class Scalar>
69 Thyra::makeHaveOwnership(
const RCP<
const VectorSpaceBase<Scalar> > &vs_in )
71 if (vs_in.has_ownership())
73 const RCP<const VectorSpaceBase<Scalar> > vs = vs_in->clone();
76 ,
"Thyra::makeHaveOwnership(vs): Error, the concrete VectorSpaceBase object identified as \'"
77 << vs->description() <<
"\' does not support the clone() function!"
83 template<
class Scalar>
86 const RCP<
const VectorSpaceBase<Scalar> > &vs,
87 const std::string &label
90 RCP<VectorBase<Scalar> > v = vs->createMember();
91 #ifdef THYRA_INITIALIZE_VECS_MULTIVECS_WITH_NANS
98 if (label.length()) v->setObjectLabel(label);
103 template<
class Scalar>
106 const VectorSpaceBase<Scalar> &vs,
const std::string &label
113 template<
class Scalar>
115 Thyra::createMembers(
116 const RCP<
const VectorSpaceBase<Scalar> > &vs,
117 int numMembers,
const std::string &label
120 RCP<MultiVectorBase<Scalar> >
121 mv = vs->createMembers(numMembers);
122 #ifdef THYRA_INITIALIZE_VECS_MULTIVECS_WITH_NANS
128 Teuchos::outArg(mv));
129 if(label.length()) mv->setObjectLabel(label);
134 template<
class Scalar>
136 Thyra::createMembers(
137 const RCP<
const VectorSpaceBase<Scalar> > &vs,
138 const RCP<
const VectorSpaceBase<Scalar> > &domain,
139 const std::string &label
146 template<
class Scalar>
148 Thyra::createMembers(
149 const VectorSpaceBase<Scalar> &vs,
int numMembers,
150 const std::string &label
157 template<
class Scalar>
159 Thyra::createMemberView(
160 const RCP<
const VectorSpaceBase<Scalar> > &vs,
162 const std::string &label
165 RCP<VectorBase<Scalar> >
166 v = vs->createMemberView(raw_v);
168 Teuchos::outArg(v) );
169 if (label.length()) v->setObjectLabel(label);
174 template<
class Scalar>
176 Thyra::createMemberView(
177 const VectorSpaceBase<Scalar> &vs,
179 const std::string &label
186 template<
class Scalar>
188 Thyra::createMemberView(
189 const RCP<
const VectorSpaceBase<Scalar> > &vs,
191 const std::string &label
194 RCP<const VectorBase<Scalar> >
195 v = vs->createMemberView(raw_v);
197 Teuchos::outArg(v) );
199 Teuchos::rcp_const_cast<VectorBase<Scalar> >(v)->setObjectLabel(label);
204 template<
class Scalar>
206 Thyra::createMemberView(
207 const VectorSpaceBase<Scalar> &vs,
209 const std::string &label
216 template<
class Scalar>
218 Thyra::createMembersView(
219 const RCP<
const VectorSpaceBase<Scalar> > &vs,
221 const std::string &label
224 RCP<MultiVectorBase<Scalar> >
225 mv = vs->createMembersView(raw_mv);
227 Teuchos::outArg(mv) );
228 if (label.length()) mv->setObjectLabel(label);
233 template<
class Scalar>
235 Thyra::createMembersView(
236 const VectorSpaceBase<Scalar> &vs,
238 const std::string &label
245 template<
class Scalar>
247 Thyra::createMembersView(
248 const RCP<
const VectorSpaceBase<Scalar> > &vs,
250 const std::string &label
253 RCP<const MultiVectorBase<Scalar> >
254 mv = vs->createMembersView(raw_mv);
256 Teuchos::outArg(mv) );
258 Teuchos::rcp_const_cast<MultiVectorBase<Scalar> >(mv)->setObjectLabel(label);
263 template<
class Scalar>
265 Thyra::createMembersView(
const VectorSpaceBase<Scalar> &vs,
267 const std::string &label
282 #define THYRA_VECTOR_SPACE_BASE_INSTANT(SCALAR) \
284 template class VectorSpaceBase<SCALAR >; \
286 template RCP< VectorBase<SCALAR > > \
288 const RCP<const VectorSpaceBase<SCALAR > > &vs, \
289 const std::string &label \
292 template RCP< VectorBase<SCALAR > > \
294 const VectorSpaceBase<SCALAR > &vs, const std::string &label \
297 template RCP< MultiVectorBase<SCALAR > > \
299 const RCP<const VectorSpaceBase<SCALAR > > &vs, \
300 int numMembers, const std::string &label \
303 template RCP< Thyra::MultiVectorBase<SCALAR > > \
305 const RCP<const VectorSpaceBase<SCALAR > > &vs, \
306 const RCP<const VectorSpaceBase<SCALAR > > &domain, \
307 const std::string &label \
310 template RCP< MultiVectorBase<SCALAR > > \
312 const VectorSpaceBase<SCALAR > &vs, int numMembers, \
313 const std::string &label \
316 template RCP<VectorBase<SCALAR > > \
318 const RCP<const VectorSpaceBase<SCALAR > > &vs, \
319 const RTOpPack::SubVectorView<SCALAR > &raw_v, \
320 const std::string &label \
323 template RCP<VectorBase<SCALAR > > \
325 const VectorSpaceBase<SCALAR > &vs, \
326 const RTOpPack::SubVectorView<SCALAR > &raw_v, \
327 const std::string &label \
330 template RCP<const VectorBase<SCALAR > > \
332 const RCP<const VectorSpaceBase<SCALAR > > &vs, \
333 const RTOpPack::ConstSubVectorView<SCALAR > &raw_v, \
334 const std::string &label \
337 template RCP<const VectorBase<SCALAR > > \
339 const VectorSpaceBase<SCALAR > &vs, \
340 const RTOpPack::ConstSubVectorView<SCALAR > &raw_v, \
341 const std::string &label \
344 template RCP<MultiVectorBase<SCALAR > > \
346 const RCP<const VectorSpaceBase<SCALAR > > &vs, \
347 const RTOpPack::SubMultiVectorView<SCALAR > &raw_mv, \
348 const std::string &label \
351 template RCP<MultiVectorBase<SCALAR > > \
353 const VectorSpaceBase<SCALAR > &vs, \
354 const RTOpPack::SubMultiVectorView<SCALAR > &raw_mv, \
355 const std::string &label \
358 template RCP<const MultiVectorBase<SCALAR > > \
360 const RCP<const VectorSpaceBase<SCALAR > > &vs, \
361 const RTOpPack::ConstSubMultiVectorView<SCALAR > &raw_mv, \
362 const std::string &label \
365 template RCP<const MultiVectorBase<SCALAR > > \
366 createMembersView( const VectorSpaceBase<SCALAR > &vs, \
367 const RTOpPack::ConstSubMultiVectorView<SCALAR > &raw_mv, \
368 const std::string &label \
372 #endif // THYRA_VECTOR_SPACE_BASE_DEF_HPP
bool is_null(const boost::shared_ptr< T > &p)
virtual RCP< const VectorSpaceBase< Scalar > > clone() const
Clone this object (if supported).
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
EViewType
Determines if a view is a direct view of data or a detached copy of data.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RCP< VectorBase< Scalar > > createMemberView(const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::SubVectorView< Scalar > &raw_v, const std::string &label="")
Create a vector member that is a non-const view of raw data.
RCP< const VectorSpaceBase< Scalar > > makeHaveOwnership(const RCP< const VectorSpaceBase< Scalar > > &vs)
Helper function that clones a VectorSpaceBase object if the RCP does not have ownership.
RCP< VectorBase< Scalar > > createMember(const RCP< const VectorSpaceBase< Scalar > > &vs, const std::string &label="")
Create a vector member from the vector space.
EStrideType
Determine if data is unit stride or non-unit stride.
RCP< MultiVectorBase< Scalar > > createMembersView(const RCP< const VectorSpaceBase< Scalar > > &vs, const RTOpPack::SubMultiVectorView< Scalar > &raw_mv, const std::string &label="")
Create a multi-vector member that is a non-const view of raw data.
RCP< MultiVectorBase< Scalar > > createMembers(const RCP< const VectorSpaceBase< Scalar > > &vs, int numMembers, const std::string &label="")
Create a set of vector members (a MultiVectorBase) from the vector space.
virtual bool hasInCoreView(const Range1D &rng=Range1D(), const EViewType viewType=VIEW_TYPE_DETACHED, const EStrideType strideType=STRIDE_TYPE_NONUNIT) const
Returns true if this->acquireDetachedView(rng,...) returns a direct view of the range of data request...
virtual bool isEuclidean() const
Return if this vector space has a Euclidean (identity) basis in which case the scalar product is the ...