Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_VectorSpaceBase_decl.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_VECTOR_SPACE_BASE_DECL_HPP
11 #define THYRA_VECTOR_SPACE_BASE_DECL_HPP
12 
13 #include "Thyra_OperatorVectorTypes.hpp"
14 #include "Teuchos_Describable.hpp"
15 
16 
17 namespace Thyra {
18 
19 
25 template<class Scalar>
26 RCP<const VectorSpaceBase<Scalar> >
27 makeHaveOwnership( const RCP<const VectorSpaceBase<Scalar> > &vs );
28 
29 
37 template<class Scalar>
38 RCP< VectorBase<Scalar> >
39 createMember(
40  const RCP<const VectorSpaceBase<Scalar> > &vs,
41  const std::string &label=""
42  );
43 
44 
49 template<class Scalar>
50 RCP< VectorBase<Scalar> >
51 createMember( const VectorSpaceBase<Scalar> &vs, const std::string &label="" );
52 
53 
61 template<class Scalar>
62 RCP< MultiVectorBase<Scalar> >
63 createMembers(
64  const RCP<const VectorSpaceBase<Scalar> > &vs, int numMembers,
65  const std::string &label=""
66  );
67 
68 
76 template<class Scalar>
77 RCP< MultiVectorBase<Scalar> >
78 createMembers(
79  const RCP<const VectorSpaceBase<Scalar> > &vs,
80  const RCP<const VectorSpaceBase<Scalar> > &domain,
81  const std::string &label=""
82  );
83 
84 
89 template<class Scalar>
90 RCP< MultiVectorBase<Scalar> >
91 createMembers(
92  const VectorSpaceBase<Scalar> &vs, int numMembers,
93  const std::string &label=""
94  );
95 
96 
104 template<class Scalar>
105 RCP<VectorBase<Scalar> >
106 createMemberView(
107  const RCP<const VectorSpaceBase<Scalar> > &vs,
108  const RTOpPack::SubVectorView<Scalar> &raw_v,
109  const std::string &label=""
110  );
111 
112 
117 template<class Scalar>
118 RCP<VectorBase<Scalar> >
119 createMemberView(
120  const VectorSpaceBase<Scalar> &vs,
121  const RTOpPack::SubVectorView<Scalar> &raw_v,
122  const std::string &label=""
123  );
124 
125 
133 template<class Scalar>
134 RCP<const VectorBase<Scalar> >
135 createMemberView(
136  const RCP<const VectorSpaceBase<Scalar> > &vs,
138  const std::string &label=""
139  );
140 
141 
146 template<class Scalar>
147 RCP<const VectorBase<Scalar> >
148 createMemberView(
149  const VectorSpaceBase<Scalar> &vs,
151  const std::string &label=""
152  );
153 
154 
162 template<class Scalar>
163 RCP<MultiVectorBase<Scalar> >
164 createMembersView(
165  const RCP<const VectorSpaceBase<Scalar> > &vs,
167  const std::string &label=""
168  );
169 
170 
175 template<class Scalar>
176 RCP<MultiVectorBase<Scalar> >
177 createMembersView(
178  const VectorSpaceBase<Scalar> &vs,
180  const std::string &label=""
181  );
182 
183 
191 template<class Scalar>
192 RCP<const MultiVectorBase<Scalar> >
193 createMembersView(
194  const RCP<const VectorSpaceBase<Scalar> > &vs,
196  const std::string &label=""
197  );
198 
199 
204 template<class Scalar>
205 RCP<const MultiVectorBase<Scalar> >
206 createMembersView(
207  const VectorSpaceBase<Scalar> &vs,
209  const std::string &label=""
210  );
211 
212 
266 template<class Scalar>
267 class VectorSpaceBase : virtual public Teuchos::Describable {
268 public:
269 
272 
278  virtual Ordinal dim() const = 0;
279 
303  virtual bool isCompatible( const VectorSpaceBase<Scalar>& vecSpc ) const = 0;
304 
312  virtual RCP< const VectorSpaceFactoryBase<Scalar> > smallVecSpcFcty() const = 0;
313 
326  virtual Scalar scalarProd(
327  const VectorBase<Scalar>& x, const VectorBase<Scalar>& y
328  ) const = 0;
329 
357  const ArrayView<Scalar> &scalarProds_out
358  ) const
359  {
360  scalarProdsImpl(X, Y, scalarProds_out);
361  }
362 
364 
367 
374  virtual bool isEuclidean() const;
375 
420  virtual bool hasInCoreView(
421  const Range1D &rng = Range1D(),
422  const EViewType viewType = VIEW_TYPE_DETACHED,
423  const EStrideType strideType = STRIDE_TYPE_NONUNIT
424  ) const;
425 
437  virtual RCP< const VectorSpaceBase<Scalar> > clone() const;
438 
440 
441 #ifndef DOXYGEN_COMPILE
442 
443 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
444 
447 
448  friend RCP< VectorBase<Scalar> >
449  createMember<>(
451  const std::string &label
452  );
453 
455  createMembers<>(
457  int numMembers, const std::string &label
458  );
459 
460  friend RCP<VectorBase<Scalar> >
461  createMemberView<>(
463  const RTOpPack::SubVectorView<Scalar> &raw_v,
464  const std::string &label
465  );
466 
468  createMemberView<>(
471  const std::string &label
472  );
473 
475  createMembersView<>(
478  const std::string &label
479  );
480 
482  createMembersView<>(
485  const std::string &label
486  );
487 
489 
490 #endif // DOXYGEN_COMPILE
491 
492 #endif // TEMPLATE_FRIENDS_NOT_SUPPORTED
493 
494 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
495 protected:
496 #endif
497 
500 
526  virtual RCP< VectorBase<Scalar> > createMember() const = 0;
527 
555  createMembers(int numMembers) const = 0;
556 
588  virtual RCP<VectorBase<Scalar> >
589  createMemberView( const RTOpPack::SubVectorView<Scalar> &raw_v ) const = 0;
590 
613  createMemberView( const RTOpPack::ConstSubVectorView<Scalar> &raw_v ) const = 0;
614 
647  createMembersView( const RTOpPack::SubMultiVectorView<Scalar> &raw_mv ) const = 0;
648 
678  const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv ) const = 0;
679 
680 
681  public:
682 
716  createCachedMembersView( const RTOpPack::SubMultiVectorView<Scalar> &raw_mv, bool initialize = true) const { return this->createMembersView(raw_mv); };
717 
748 
750 
751 protected:
752 
756  virtual void scalarProdsImpl(
759  ) const = 0;
760 
761 public:
762 
763 private:
764 
765  // Not defined and not to be called
767  operator=(const VectorSpaceBase<Scalar>&);
768 
769 };
770 
771 
772 } // end namespace Thyra
773 
774 
775 #endif // THYRA_VECTOR_SPACE_BASE_DECL_HPP
virtual RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const =0
Create a set of vector members (a MultiVectorBase) from the vector space.
virtual RCP< const MultiVectorBase< Scalar > > createCachedMembersView(const RTOpPack::ConstSubMultiVectorView< Scalar > &raw_mv) const
Create a (possibly) cached multi-vector member that is a const view of raw multi-vector data...
virtual RCP< const VectorSpaceBase< Scalar > > clone() const
Clone this object (if supported).
The stride between elements in an array is greater than or equal to one.
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.
virtual RCP< MultiVectorBase< Scalar > > createCachedMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv, bool initialize=true) const
Create a (possibly) cached multi-vector member that is a non-const view of raw multi-vector data...
virtual RCP< MultiVectorBase< Scalar > > createMembersView(const RTOpPack::SubMultiVectorView< Scalar > &raw_mv) const =0
Create a multi-vector member that is a non-const view of raw multi-vector data.
The view is a detached copy of the data.
virtual Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const =0
Return the scalar product of two vectors in the vector space.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
virtual RCP< const VectorSpaceFactoryBase< Scalar > > smallVecSpcFcty() const =0
Return a VectorSpaceFactoryBase object for the creation of (usually serial) vector spaces with a smal...
virtual RCP< VectorBase< Scalar > > createMemberView(const RTOpPack::SubVectorView< Scalar > &raw_v) const =0
Create a vector member that is a non-const view of raw vector data.
virtual RCP< VectorBase< Scalar > > createMember() const =0
Create a vector member from the vector space.
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 void scalarProdsImpl(const MultiVectorBase< Scalar > &X, const MultiVectorBase< Scalar > &Y, const ArrayView< Scalar > &scalarProds) const =0
virtual bool isCompatible(const VectorSpaceBase< Scalar > &vecSpc) const =0
Compare the compatibility of two vector spaces.
virtual Ordinal dim() const =0
Return the dimension of 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-&gt;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 ...
Teuchos::Range1D Range1D