Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_BlockedVector_decl.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Xpetra: A linear algebra interface package
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Tobias Wiesner (tawiesn@sandia.gov)
42// Ray Tuminaro (rstumin@sandia.gov)
43//
44// ***********************************************************************
45//
46// @HEADER
47#ifndef XPETRA_BLOCKEDVECTOR_DECL_HPP
48#define XPETRA_BLOCKEDVECTOR_DECL_HPP
49
50/* this file is automatically generated - do not edit (see script/interfaces.py) */
51
52#include "Xpetra_ConfigDefs.hpp"
53
56#include "Xpetra_Map_decl.hpp"
57#include "Xpetra_Vector.hpp"
58
59
60
61namespace Xpetra {
62
63
64
65template<class Scalar,
66 class LocalOrdinal,
67 class GlobalOrdinal,
70 : public virtual Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>
71 , public virtual Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>
72{
73 public:
74 using scalar_type = Scalar;
75 using local_ordinal_type = LocalOrdinal;
76 using global_ordinal_type = GlobalOrdinal;
77 using node_type = Node;
78
79 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::dot; // overloading, not hiding
80 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm1; // overloading, not hiding
81 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::norm2; // overloading, not hiding
82 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::normInf; // overloading, not hiding
83 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::meanValue; // overloading, not hiding
84 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::replaceGlobalValue; // overloading, not hiding
85 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::sumIntoGlobalValue; // overloading, not hiding
86 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::replaceLocalValue; // overloading, not hiding
87 using Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>::sumIntoLocalValue; // overloading, not hiding
88
89
90 private:
91#undef XPETRA_BLOCKEDVECTOR_SHORT
93
94 public:
96
97
99
100
108 BlockedVector(const Teuchos::RCP<const BlockedMap>& map, bool zeroOut = true);
109
110
124
125
139
140
142 virtual ~BlockedVector();
143
144
154
155
157
159
160
162 virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar& value);
163
165 virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar& value);
166
168 virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value);
169
171 virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value);
172
174 virtual void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar& value);
175
177 virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar& value);
178
180 virtual void replaceLocalValue(LocalOrdinal myRow, const Scalar& value);
181
183 virtual void sumIntoLocalValue(LocalOrdinal myRow, const Scalar& value);
184
185
187 virtual void putScalar(const Scalar& value);
188
189
191
192
194
195
196
199 getVector(size_t j) const;
200
203 getVectorNonConst(size_t j);
204
206 virtual Teuchos::ArrayRCP<const Scalar> getData(size_t j) const;
207
210
212
214
215
218 const Teuchos::ArrayView<Scalar>& dots) const;
219
221
222
225
228
230 virtual void scale(const Scalar& alpha);
231
233 virtual void scale(Teuchos::ArrayView<const Scalar> alpha);
234
235 virtual void update(const Scalar& alpha,
237 const Scalar& beta);
238
239
241 virtual void update(const Scalar& alpha,
243 const Scalar& beta,
245 const Scalar& gamma);
246
249
252
255
257 virtual void norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
258
260 virtual void norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
261
263 virtual void normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
264
267 virtual void meanValue(const Teuchos::ArrayView<Scalar>& /* means */) const;
268
269 virtual Scalar meanValue() const;
270
272 virtual void multiply(Teuchos::ETransp /* transA */,
273 Teuchos::ETransp /* transB */,
274 const Scalar& /* alpha */,
277 const Scalar& /* beta */);
278
279 virtual void multiply(Teuchos::ETransp /* transA */,
280 Teuchos::ETransp /* transB */,
281 const Scalar& /* alpha */,
284 const Scalar& /* beta */);
285
286
287 virtual void elementWiseMultiply(Scalar /* scalarAB */,
290 Scalar /* scalarThis */);
291
293 virtual void elementWiseMultiply(Scalar /* scalarAB */,
296 Scalar /* scalarThis */);
297
298
300
301
303
304
305
307 virtual size_t getNumVectors() const;
308
310 virtual size_t getLocalLength() const;
311
313 virtual global_size_t getGlobalLength() const;
314
317
319
321
322
324 virtual std::string description() const;
325
327 virtual void describe(Teuchos::FancyOStream& out,
329
330 virtual void replaceMap(const RCP<const Map>& map);
331
334 const Import& /* importer */,
335 CombineMode /* CM */);
336
339 const Import& /* importer */,
340 CombineMode /* CM */);
341
344 const Export& /* exporter */,
345 CombineMode /* CM */);
346
349 const Export& /* exporter */,
350 CombineMode /* CM */);
351
352
354
355
357
358
359
361 virtual void setSeed(unsigned int seed);
362
363
364 virtual void randomize(bool bUseXpetraImplementation = false);
365
366 virtual void randomize(const Scalar& minVal, const Scalar& maxVal, bool bUseXpetraImplementation = false);
367
369 virtual void Xpetra_randomize();
370
372 virtual void Xpetra_randomize(const Scalar& minVal, const Scalar& maxVal);
373
375
376
379
382 getMultiVector(size_t r) const;
383
386 getMultiVector(size_t r, bool bThyraMode) const;
387
389 void
390 setMultiVector(size_t r,
392 bool bThyraMode);
393
396 Merge() const;
397
398
399 protected:
407
408 // virtual void assign (const MultiVector& rhs);
409
410 //private:
411 // Teuchos::RCP<const BlockedMap> map_; ///< blocked map containing the sub block maps (either thyra or xpetra mode)
412 // std::vector<Teuchos::RCP<Vector> > vv_; ///< array containing RCPs of the partial vectors
413
414
415}; // BlockedVector class
416
417
418
419} // namespace Xpetra
420
421#define XPETRA_BLOCKEDVECTOR_SHORT
422#endif // XPETRA_BLOCKEDVECTOR_DECL_HPP
423
static const EVerbosityLevel verbLevel_default
virtual void multiply(Teuchos::ETransp, Teuchos::ETransp, const Scalar &, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Scalar &)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Merge() const
merge BlockedVector blocks to a single Vector
virtual size_t getLocalLength() const
Local number of rows on the calling process.
virtual void replaceMap(const RCP< const Map > &map)
virtual std::string description() const
A simple one-line description of this object.
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Assignment operator: Does a deep copy.
virtual void Xpetra_randomize()
Set vector values to random numbers. XPetra implementation.
virtual Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this vector.
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual void dot(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of vector.
virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void setMultiVector(size_t r, Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > v, bool bThyraMode)
set partial Vector associated with block row r
virtual void reciprocal(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input vector in target, this(i,j) = 1/A(i,j).
virtual void putScalar(const Scalar &value)
Set all values in the vector with the given value.
virtual void setSeed(unsigned int seed)
Set seed for Random function.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Compute 1-norm of vector.
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
virtual void scale(const Scalar &alpha)
Scale the current values of a vector, this = alpha*this.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this vector.
virtual void elementWiseMultiply(Scalar, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, Scalar)
Element-wise multiply of a Vector A with a MultiVector B.
virtual size_t getNumVectors() const
Number of columns in the Vector.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
virtual Scalar meanValue() const
Compute mean (average) value of this Vector.
virtual bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
Local number of rows on the calling process.
virtual void update(const Scalar &alpha, const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual global_size_t getGlobalLength() const
Global number of rows in the Vector.
virtual void assign(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMultiVector(size_t r) const
return partial Vector associated with block row r
virtual ~BlockedVector()
Destructor.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
virtual void abs(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input vector in target: A = abs(this).
Xpetra namespace
size_t global_size_t
Global size_t object.
CombineMode
Xpetra::Combine Mode enumerable type.