Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_DefaultMultiVectorProductVectorSpace_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_DEFAULT_MULTI_VECTOR_PRODUCT_VECTOR_SPACE_DECL_HPP
43#define THYRA_DEFAULT_MULTI_VECTOR_PRODUCT_VECTOR_SPACE_DECL_HPP
44
45#include "Thyra_ProductVectorSpaceBase.hpp" // Interface
46#include "Thyra_DefaultProductVectorSpace.hpp" // Implementation
47#include "Thyra_VectorSpaceDefaultBase.hpp"
48
49
50namespace Thyra {
51
52
64template<class Scalar>
66 : virtual public ProductVectorSpaceBase<Scalar>
67 , virtual protected VectorSpaceDefaultBase<Scalar>
68{
69public:
70
73
76
96 void initialize(
97 const RCP<const VectorSpaceBase<Scalar> > &space,
98 const int numColumns
99 );
100
104
125 void uninitialize(
126 RCP<const VectorSpaceBase<Scalar> > *space = 0,
127 int *numColumns = 0
128 );
129
131
134
136 int numBlocks() const;
138 RCP<const VectorSpaceBase<Scalar> > getBlock(const int k) const;
139
141
144
146 Ordinal dim() const;
148 bool isCompatible( const VectorSpaceBase<Scalar>& vecSpc ) const;
152 Scalar scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y ) const;
156 void scalarProdsImpl(
158 const ArrayView<Scalar> &scalarProds ) const;
162 bool hasInCoreView( const Range1D& rng, const EViewType viewType,
163 const EStrideType strideType ) const;
174 RCP< MultiVectorBase<Scalar> > createMembers(int numMembers) const;
177
179
182
186 std::string description() const;
187
195 void describe(
197 const Teuchos::EVerbosityLevel verbLevel
198 ) const;
199
201
202private:
203
204 // ///////////////////////////////////
205 // Private data members
206
208 int numColumns_;
210
211 // ///////////////////////////////////
212 // Private member functions
213
214 void assertInitialized() const;
215
216};
217
218
223template<class Scalar>
224inline
230
231
236template<class Scalar>
237inline
240 const RCP<const VectorSpaceBase<Scalar> > &space,
241 const int numColumns
242 )
243{
245 multiVectorProductVectorSpace<Scalar>();
246 multiVecProdVecSpace->initialize(space,numColumns);
247 return multiVecProdVecSpace;
248}
249
250
251// /////////////////////////////////
252// Inline members
253
254
255template<class Scalar>
256inline
262
263
264template<class Scalar>
265inline
267{
268#ifdef TEUCHOS_DEBUG
269 TEUCHOS_TEST_FOR_EXCEPT( is_null(space_) );
270#endif
271}
272
273
274} // namespace Thyra
275
276
277#endif // THYRA_DEFAULT_MULTI_VECTOR_PRODUCT_VECTOR_SPACE_DECL_HPP
Standard concrete implementation of a product vector space that creates product vectors fromed implic...
RCP< const DefaultProductVectorSpace< Scalar > > getDefaultProductVectorSpace() const
RCP< const VectorSpaceBase< Scalar > > clone() const
Clones the object as promised.
RCP< MultiVectorBase< Scalar > > createMembers(int numMembers) const
Returns a DefaultColumnwiseMultiVector object.
RCP< const VectorSpaceFactoryBase< Scalar > > smallVecSpcFcty() const
Returns getBlock(0)->smallVecSpcFcty().
void initialize(const RCP< const VectorSpaceBase< Scalar > > &space, const int numColumns)
Initialize with a list of constituent vector spaces.
bool isCompatible(const VectorSpaceBase< Scalar > &vecSpc) const
std::string description() const
Prints just the name DefaultMultiVectorProductVectorSpace along with the overall dimension and the nu...
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 DefaultMultiVectorProductVector object.
bool hasInCoreView(const Range1D &rng, const EViewType viewType, const EStrideType strideType) const
Returns true if all of the constituent vector spaces return true.
Scalar scalarProd(const VectorBase< Scalar > &x, const VectorBase< Scalar > &y) const
Returns the sum of the scalar products of the constituent vectors.
void uninitialize(RCP< const VectorSpaceBase< Scalar > > *space=0, int *numColumns=0)
Uninitialize.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Prints the details about the constituent vector space.
RCP< const VectorSpaceBase< Scalar > > getBlock(const int k) const
RCP< DefaultMultiVectorProductVectorSpace< Scalar > > multiVectorProductVectorSpace()
Nonmember constructor function.
RCP< DefaultMultiVectorProductVectorSpace< Scalar > > multiVectorProductVectorSpace(const RCP< const VectorSpaceBase< Scalar > > &space, const int numColumns)
Nonmember constructor function.
Interface for a collection of column vectors called a multi-vector.
Abstract interface for finite-dimensional dense vectors.
Abstract interface for objects that represent a space for vectors.
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.
Node VectorSpaceBase subclass that provides default implementations for many functions using a defaul...
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
EStrideType
Determine if data is unit stride or non-unit stride.
EViewType
Determines if a view is a direct view of data or a detached copy of data.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)