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 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_VECTOR_SPACE_BASE_DECL_HPP
43 #define THYRA_VECTOR_SPACE_BASE_DECL_HPP
44 
45 #include "Thyra_OperatorVectorTypes.hpp"
46 #include "Teuchos_Describable.hpp"
47 
48 
49 namespace Thyra {
50 
51 
57 template<class Scalar>
58 RCP<const VectorSpaceBase<Scalar> >
59 makeHaveOwnership( const RCP<const VectorSpaceBase<Scalar> > &vs );
60 
61 
69 template<class Scalar>
70 RCP< VectorBase<Scalar> >
71 createMember(
72  const RCP<const VectorSpaceBase<Scalar> > &vs,
73  const std::string &label=""
74  );
75 
76 
81 template<class Scalar>
82 RCP< VectorBase<Scalar> >
83 createMember( const VectorSpaceBase<Scalar> &vs, const std::string &label="" );
84 
85 
93 template<class Scalar>
94 RCP< MultiVectorBase<Scalar> >
95 createMembers(
96  const RCP<const VectorSpaceBase<Scalar> > &vs, int numMembers,
97  const std::string &label=""
98  );
99 
100 
108 template<class Scalar>
109 RCP< MultiVectorBase<Scalar> >
110 createMembers(
111  const RCP<const VectorSpaceBase<Scalar> > &vs,
112  const RCP<const VectorSpaceBase<Scalar> > &domain,
113  const std::string &label=""
114  );
115 
116 
121 template<class Scalar>
122 RCP< MultiVectorBase<Scalar> >
123 createMembers(
124  const VectorSpaceBase<Scalar> &vs, int numMembers,
125  const std::string &label=""
126  );
127 
128 
136 template<class Scalar>
137 RCP<VectorBase<Scalar> >
138 createMemberView(
139  const RCP<const VectorSpaceBase<Scalar> > &vs,
140  const RTOpPack::SubVectorView<Scalar> &raw_v,
141  const std::string &label=""
142  );
143 
144 
149 template<class Scalar>
150 RCP<VectorBase<Scalar> >
151 createMemberView(
152  const VectorSpaceBase<Scalar> &vs,
153  const RTOpPack::SubVectorView<Scalar> &raw_v,
154  const std::string &label=""
155  );
156 
157 
165 template<class Scalar>
166 RCP<const VectorBase<Scalar> >
167 createMemberView(
168  const RCP<const VectorSpaceBase<Scalar> > &vs,
170  const std::string &label=""
171  );
172 
173 
178 template<class Scalar>
179 RCP<const VectorBase<Scalar> >
180 createMemberView(
181  const VectorSpaceBase<Scalar> &vs,
183  const std::string &label=""
184  );
185 
186 
194 template<class Scalar>
195 RCP<MultiVectorBase<Scalar> >
196 createMembersView(
197  const RCP<const VectorSpaceBase<Scalar> > &vs,
199  const std::string &label=""
200  );
201 
202 
207 template<class Scalar>
208 RCP<MultiVectorBase<Scalar> >
209 createMembersView(
210  const VectorSpaceBase<Scalar> &vs,
212  const std::string &label=""
213  );
214 
215 
223 template<class Scalar>
224 RCP<const MultiVectorBase<Scalar> >
225 createMembersView(
226  const RCP<const VectorSpaceBase<Scalar> > &vs,
228  const std::string &label=""
229  );
230 
231 
236 template<class Scalar>
237 RCP<const MultiVectorBase<Scalar> >
238 createMembersView(
239  const VectorSpaceBase<Scalar> &vs,
241  const std::string &label=""
242  );
243 
244 
298 template<class Scalar>
299 class VectorSpaceBase : virtual public Teuchos::Describable {
300 public:
301 
304 
310  virtual Ordinal dim() const = 0;
311 
335  virtual bool isCompatible( const VectorSpaceBase<Scalar>& vecSpc ) const = 0;
336 
344  virtual RCP< const VectorSpaceFactoryBase<Scalar> > smallVecSpcFcty() const = 0;
345 
358  virtual Scalar scalarProd(
359  const VectorBase<Scalar>& x, const VectorBase<Scalar>& y
360  ) const = 0;
361 
389  const ArrayView<Scalar> &scalarProds_out
390  ) const
391  {
392  scalarProdsImpl(X, Y, scalarProds_out);
393  }
394 
396 
399 
406  virtual bool isEuclidean() const;
407 
452  virtual bool hasInCoreView(
453  const Range1D &rng = Range1D(),
454  const EViewType viewType = VIEW_TYPE_DETACHED,
455  const EStrideType strideType = STRIDE_TYPE_NONUNIT
456  ) const;
457 
469  virtual RCP< const VectorSpaceBase<Scalar> > clone() const;
470 
472 
473 #ifndef DOXYGEN_COMPILE
474 
475 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
476 
479 
480  friend RCP< VectorBase<Scalar> >
481  createMember<>(
483  const std::string &label
484  );
485 
487  createMembers<>(
489  int numMembers, const std::string &label
490  );
491 
492  friend RCP<VectorBase<Scalar> >
493  createMemberView<>(
495  const RTOpPack::SubVectorView<Scalar> &raw_v,
496  const std::string &label
497  );
498 
500  createMemberView<>(
503  const std::string &label
504  );
505 
507  createMembersView<>(
510  const std::string &label
511  );
512 
514  createMembersView<>(
517  const std::string &label
518  );
519 
521 
522 #endif // DOXYGEN_COMPILE
523 
524 #endif // TEMPLATE_FRIENDS_NOT_SUPPORTED
525 
526 #ifndef TEMPLATE_FRIENDS_NOT_SUPPORTED
527 protected:
528 #endif
529 
532 
558  virtual RCP< VectorBase<Scalar> > createMember() const = 0;
559 
587  createMembers(int numMembers) const = 0;
588 
620  virtual RCP<VectorBase<Scalar> >
621  createMemberView( const RTOpPack::SubVectorView<Scalar> &raw_v ) const = 0;
622 
645  createMemberView( const RTOpPack::ConstSubVectorView<Scalar> &raw_v ) const = 0;
646 
679  createMembersView( const RTOpPack::SubMultiVectorView<Scalar> &raw_mv ) const = 0;
680 
710  const RTOpPack::ConstSubMultiVectorView<Scalar> &raw_mv ) const = 0;
711 
713 
714 protected:
715 
719  virtual void scalarProdsImpl(
722  ) const = 0;
723 
724 public:
725 
726 private:
727 
728  // Not defined and not to be called
730  operator=(const VectorSpaceBase<Scalar>&);
731 
732 };
733 
734 
735 } // end namespace Thyra
736 
737 
738 #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 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 > > 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