10 #ifndef THYRA_DEFAULT_PRODUCT_VECTOR_SPACE_DECL_HPP
11 #define THYRA_DEFAULT_PRODUCT_VECTOR_SPACE_DECL_HPP
13 #include "Thyra_ProductVectorSpaceBase.hpp"
14 #include "Thyra_VectorSpaceDefaultBase.hpp"
15 #include "Teuchos_implicit_cast.hpp"
103 template<
class Scalar>
104 class DefaultProductVectorSpace
105 :
virtual public ProductVectorSpaceBase<Scalar>,
106 virtual protected VectorSpaceDefaultBase<Scalar>
118 const ArrayView<
const RCP<
const VectorSpaceBase<Scalar> > > &
vecSpaces
160 const ArrayView<
const RCP<
const VectorSpaceBase<Scalar> > > &
vecSpaces
192 const ArrayView<RCP<
const VectorSpaceBase<Scalar> > > &
vecSpaces = Teuchos::null
203 virtual const RCP<const VectorSpaceBase<Scalar> >*
vecSpaces()
const;
253 RCP<const VectorSpaceBase<Scalar> >
getBlock(
const int k)
const;
266 bool isCompatible(
const VectorSpaceBase<Scalar>& vecSpc )
const;
275 const VectorBase<Scalar>& x,
const VectorBase<Scalar>& y )
const;
281 const MultiVectorBase<Scalar>& X,
const MultiVectorBase<Scalar>& Y,
294 RCP< MultiVectorBase<Scalar> >
createMembers(
int numMembers)
const;
297 RCP< const VectorSpaceBase<Scalar> >
clone()
const;
333 typedef Array<RCP<const VectorSpaceBase<Scalar> > > vecSpaces_t;
334 typedef Array<Ordinal> vecSpacesOffsets_t;
340 RCP<vecSpaces_t> vecSpaces_;
341 RCP<vecSpacesOffsets_t> vecSpacesOffsets_;
349 void assertInitialized()
const;
358 template<
class Scalar>
360 RCP<DefaultProductVectorSpace<Scalar> >
371 template<
class Scalar>
387 template<
class Scalar>
396 for (
int i = 0; i < numBlocks; ++i )
398 return productVectorSpace<Scalar>(vecSpaceBlocks());
406 template<
class Scalar>
410 return ( dim_ ? &(*vecSpaces_)[0] : NULL );
414 template<
class Scalar>
418 return ( dim_ ? &(*vecSpacesOffsets_)[0] : NULL );
422 template<
class Scalar>
425 return vecSpaces_.strong_count() > 1;
429 template<
class Scalar>
443 #endif // THYRA_DEFAULT_PRODUCT_VECTOR_SPACE_DECL_HPP
RCP< DefaultProductVectorSpace< Scalar > > productVectorSpace(const ArrayView< RCP< const VectorSpaceBase< Scalar > > > &vecSpaces)
Nonmember constructor that takes an array of vector spaces.
RCP< const VectorSpaceBase< Scalar > > getBlock(const int k) const
bool hasInCoreView(const Range1D &rng, const EViewType viewType, const EStrideType strideType) const
Returns true if all of the constituent vector spaces return true.
RCP< const VectorSpaceBase< Scalar > > clone() const
Clones the object as promised.
bool is_null(const boost::shared_ptr< T > &p)
Ordinal dim() const
Returns the summation of the constituent vector spaces.
RCP< DefaultProductVectorSpace< Scalar > > productVectorSpace()
Nonmember constructor that constructs to uninitialized.
Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Returns the sum of the scalar products of the constituent vectors.
bool hasBeenCloned() const
Return if this vector space was cloned.
RCP< const VectorSpaceFactoryBase< Scalar > > smallVecSpcFcty() const
Returns getBlock(0)->smallVecSpcFcty().
Abstract interface for objects that represent a space for vectors.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
RCP< DefaultProductVectorSpace< Scalar > > productVectorSpace(const RCP< const VectorSpaceBase< Scalar > > &vecSpace, const int numBlocks)
Nonmember constructor that duplicates a block vector space numBlock times to form a product space...
void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds) const
Returns the sum of the scalar products of each of the columns of the constituent multi-vectors.
RCP< VectorBase< Scalar > > createMember() const
Returns a DefaultProductVector object.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
virtual void uninitialize(const ArrayView< RCP< const VectorSpaceBase< Scalar > > > &vecSpaces=Teuchos::null)
Uninitialize.
RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const
Returns a DefaultProductMultiVector object.
virtual void initialize(const ArrayView< const RCP< const VectorSpaceBase< Scalar > > > &vecSpaces)
Initialize with a list of constituent vector spaces.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent vector spaces.
TypeTo implicit_cast(const TypeFrom &t)
void getVecSpcPoss(Ordinal i, int *kth_vector_space, Ordinal *kth_global_offset) const
Get the position of the vector space object and its offset into a composite vector that owns the ith ...
void push_back(const value_type &x)
bool isCompatible(const VectorSpaceBase< Scalar > &vecSpc) const
Returns true only if also a product vector space and all constituent vectors are compatible.
EStrideType
Determine if data is unit stride or non-unit stride.
void scalarProds(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds_out) const
Return the scalar product of each column in two multi-vectors in the vector space.
virtual const RCP< const VectorSpaceBase< Scalar > > * vecSpaces() const
Returns a pointer to an array (of length this->numBlocks()) to the constituent vector spaces...
std::string description() const
Prints just the name DefaultProductVectorSpace along with the overall dimension and the number of blo...
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
virtual const Ordinal * vecSpacesOffsets() const
Returns a pointer to an array (of length this->numBlocks()+1) of offset into each constituent vector ...
DefaultProductVectorSpace()
Default construct to uninitialized.