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,
68 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
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:
95 //! @name Constructor/Destructor Methods
96
97
99
102
108 BlockedVector(const Teuchos::RCP<const BlockedMap>& map, bool zeroOut = true);
109
110
124
125
137 BlockedVector(Teuchos::RCP<const Xpetra::MapExtractor<Scalar, LocalOrdinal, GlobalOrdinal, Node>> mapExtractor,
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);
177 virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar& value);
180 virtual void replaceLocalValue(LocalOrdinal myRow, const Scalar& value);
181
182
183 virtual void sumIntoLocalValue(LocalOrdinal myRow, const Scalar& value);
187 virtual void putScalar(const Scalar& value);
188
189
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
209 virtual Teuchos::ArrayRCP<Scalar> getDataNonConst(size_t j);
210
212
213 //! @name Mathematical methods
218 const Teuchos::ArrayView<Scalar>& dots) const;
219
220 virtual Scalar dot(const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A) const;
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);
248 virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType norm1() const;
251 virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType norm2() const;
252
253
254 virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType normInf() const;
257 virtual void norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
260 virtual void norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
261
262
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
316 virtual bool isSameSize(const Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* vec */) const;
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
333 virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */,
334 const Import& /* importer */,
335 CombineMode /* CM */);
336
338 virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* dest */,
339 const Import& /* importer */,
340 CombineMode /* CM */);
341
343 virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */,
344 const Export& /* exporter */,
345 CombineMode /* CM */);
346
348 virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* dest */,
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
378 Teuchos::RCP<const Map> getMap() const;
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
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Assignment operator: Does a deep copy.
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 void putScalar(const Scalar &value)
Set all values in the vector with the given value.
BlockedVector(const Teuchos::RCP< const BlockedMap > &map, bool zeroOut=true)
Constructor.
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 sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
virtual void meanValue(const Teuchos::ArrayView< Scalar > &) const
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
basic_FancyOStream< char > FancyOStream
Xpetra namespace
size_t global_size_t
Global size_t object.
CombineMode
Xpetra::Combine Mode enumerable type.