Thyra  Version of the Day
Thyra_VectorDefaultBase_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_DEFAULT_BASE_DECL_HPP
43 #define THYRA_VECTOR_DEFAULT_BASE_DECL_HPP
44 
45 #include "Thyra_VectorBase.hpp"
46 #include "Thyra_MultiVectorDefaultBase_decl.hpp"
47 
48 
49 namespace Thyra {
50 
51 
72 template<class Scalar>
74  : virtual public VectorBase<Scalar>,
75  virtual protected MultiVectorDefaultBase<Scalar>
76 {
77 public:
78 
81 
83  virtual std::string description() const;
84 
107  virtual void describe(
108  Teuchos::FancyOStream &out
109  ,const Teuchos::EVerbosityLevel verbLevel
110  ) const;
111 
113 
116 
118  virtual RCP< const VectorSpaceBase<Scalar> > range() const;
122  virtual RCP< const VectorSpaceBase<Scalar> > domain() const;
123 
125 
128 
130  RCP<MultiVectorBase<Scalar> > clone_mv() const;
131 
133 
136 
140  RCP<VectorBase<Scalar> > clone_v() const;
141 
143 
144 protected:
145 
148 
150  virtual RCP<VectorBase<Scalar> > nonconstColImpl(Ordinal j);
152  virtual RCP<const MultiVectorBase<Scalar> >
153  contigSubViewImpl( const Range1D& col_rng ) const;
155  virtual RCP<MultiVectorBase<Scalar> >
156  nonconstContigSubViewImpl( const Range1D& col_rng );
158  virtual RCP<const MultiVectorBase<Scalar> >
159  nonContigSubViewImpl( const ArrayView<const int> &cols ) const;
161  virtual RCP<MultiVectorBase<Scalar> >
162  nonconstNonContigSubViewImpl( const ArrayView<const int> &cols );
165  const Range1D &rowRng,
166  const Range1D &colRng,
168  ) const;
172  ) const;
175  const Range1D &rowRng,
176  const Range1D &colRng,
178  );
182  );
183 
185 
188 
203  virtual void acquireDetachedVectorViewImpl(
204  const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec
205  ) const;
213  virtual void releaseDetachedVectorViewImpl(
215  ) const;
230  const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec
231  );
240  );
250  virtual void setSubVectorImpl( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec );
251 
253 
256 
261  bool opSupportedImpl(EOpTransp M_trans) const;
262 
266  void applyImpl(
267  const EOpTransp M_trans,
268  const MultiVectorBase<Scalar> &X,
269  const Ptr<MultiVectorBase<Scalar> > &Y,
270  const Scalar alpha,
271  const Scalar beta
272  ) const;
273 
275 
276 private:
277 
278  // /////////////////////////////////////
279  // Private data members
280 
281  mutable RCP<const VectorSpaceBase<Scalar> > domain_;
282  // Above only initialized if *this is used as a MultiVectorBase
283 
284  // /////////////////////////////////////
285  // Private member functions
286 
287  void validateColRng( const Range1D &rowRng ) const;
288  void validateColIndexes( const ArrayView<const int> &cols ) const;
289 
290 };
291 
292 
293 } // end namespace Thyra
294 
295 
296 #endif // THYRA_VECTOR_DEFAULT_BASE_DECL_HPP
virtual RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &col_rng) const
Returns Teuchos::rcp(this,false).
RCP< MultiVectorBase< Scalar > > clone_mv() const
Returns this->clone_v().
virtual RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &col_rng)
Returns Teuchos::rcp(this,false).
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
. Applies vector or its adjoint (transpose) as a linear operator.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Generates a default outputting for all vectors.
virtual void releaseDetachedMultiVectorViewImpl(RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this->releaseDetachedView().
Node subclass that uses a default MultiVectorBase implementation to provide default implementations f...
virtual void acquireNonconstDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this->acquireDetachedView().
virtual void releaseDetachedVectorViewImpl(RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
Convenient node subclass for concrete VectorBase subclasses that relies on a default MultiVectorBase ...
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
virtual RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
Returns Teuchos::rcp(this,false).
Abstract interface for finite-dimensional dense vectors.
virtual void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
virtual std::string description() const
Default description that gives the label, type, and dimenstion .
virtual RCP< const VectorSpaceBase< Scalar > > range() const
Returns this->space().
RCP< VectorBase< Scalar > > clone_v() const
Simply creates a new vector and copies the contents from *this.
virtual void acquireDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this->acquireDetachedView().
virtual void setSubVectorImpl(const RTOpPack::SparseSubVectorT< Scalar > &sub_vec)
virtual RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
Returns Teuchos::rcp(this,false).
virtual void commitNonconstDetachedMultiVectorViewImpl(RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this->commitDetachedView().
virtual void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
bool opSupportedImpl(EOpTransp M_trans) const
For complex Scalar types returns true for NOTRANS and CONJTRANS and for real types returns true for a...
virtual RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
Returns Teuchos::rcp(this,false).
virtual RCP< const VectorSpaceBase< Scalar > > domain() const
Returns a DefaultSerialVectorSpace object with dimension 1.
Teuchos::Range1D Range1D
virtual void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)