Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_DefaultSpmdMultiVector_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_Spmd_MULTI_VECTOR_STD_DECL_HPP
43#define THYRA_Spmd_MULTI_VECTOR_STD_DECL_HPP
44
45#include "Thyra_SpmdMultiVectorDefaultBase_decl.hpp"
46
47
48namespace Thyra {
49
50
67template<class Scalar>
68class DefaultSpmdMultiVector : virtual public SpmdMultiVectorDefaultBase<Scalar> {
69public:
70
73
76
79 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
80 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace
81 );
82
85 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
86 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
87 const ArrayRCP<Scalar> &localValues,
88 const Ordinal leadingDim = -1
89 );
90
106 void initialize(
107 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
108 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace
109 );
110
139 void initialize(
140 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
141 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
142 const ArrayRCP<Scalar> &localValues,
143 const Ordinal leadingDim = -1
144 );
145
151 void uninitialize(
152 RCP<const SpmdVectorSpaceBase<Scalar> > *spmdRangeSpace = NULL,
153 RCP<const ScalarProdVectorSpaceBase<Scalar> > *domainSpace = NULL,
154 ArrayRCP<Scalar> *localValues = NULL,
155 Ordinal *leadingDim = NULL
156 );
157
161
163
164protected:
165
172 contigSubViewImpl(const Range1D& colRng) const;
175 nonconstContigSubViewImpl(const Range1D& colRng);
183
190 const Ptr<ArrayRCP<Scalar> > &localValues, const Ptr<Ordinal> &leadingDim
191 );
194 const Ptr<ArrayRCP<const Scalar> > &localValues, const Ptr<Ordinal> &leadingDim
195 ) const;
197
198private:
199
200 // ///////////////////////////////////////
201 // Private data members
202
205 ArrayRCP<Scalar> localValues_;
206 Ordinal leadingDim_;
207
208 // ///////////////////////////////////////
209 // Private member functions
210
211 ArrayRCP<Scalar> createContiguousCopy(const ArrayView<const int> &cols) const;
212
213public:
214
215#ifdef THYRA_DEBUG
216 // Unit testing sensing varaible
217 static int numSkipCopyBack;
218#endif
219
220}; // end class DefaultSpmdMultiVector
221
222
223template<class Scalar>
225defaultSpmdMultiVector(
226 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace,
227 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
228 const ArrayRCP<Scalar> &localValues,
229 const Ordinal leadingDim = -1
230 )
231{
232 return Teuchos::rcp(
234 spmdRangeSpace, domainSpace, localValues, leadingDim
235 )
236 );
237}
238
239
240} // end namespace Thyra
241
242
243#endif // THYRA_Spmd_MULTI_VECTOR_STD_DECL_HPP
Efficient concrete implementation subclass for SPMD multi-vectors.
void getLocalMultiVectorDataImpl(const Ptr< ArrayRCP< const Scalar > > &localValues, const Ptr< Ordinal > &leadingDim) const
RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpaceImpl() const
DefaultSpmdMultiVector()
Construct to uninitialized.
void uninitialize(RCP< const SpmdVectorSpaceBase< Scalar > > *spmdRangeSpace=NULL, RCP< const ScalarProdVectorSpaceBase< Scalar > > *domainSpace=NULL, ArrayRCP< Scalar > *localValues=NULL, Ordinal *leadingDim=NULL)
Set to an uninitialized state.
RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &colRng) const
void getNonconstLocalMultiVectorDataImpl(const Ptr< ArrayRCP< Scalar > > &localValues, const Ptr< Ordinal > &leadingDim)
RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &colRng)
void initialize(const RCP< const SpmdVectorSpaceBase< Scalar > > &spmdRangeSpace, const RCP< const ScalarProdVectorSpaceBase< Scalar > > &domainSpace)
Initialize only with vector spaces where storage is allocated internally..
RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
RCP< const ScalarProdVectorSpaceBase< Scalar > > domainScalarProdVecSpc() const
Base node implementation class for SPMD multi-vectors.
Base abstract VectorSpaceBase class for all SPMD-based vector spaces.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)