Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_BlockedMultiVector_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Xpetra: A linear algebra interface package
4 //
5 // Copyright 2012 NTESS and the Xpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef XPETRA_BLOCKEDMULTIVECTOR_DECL_HPP
11 #define XPETRA_BLOCKEDMULTIVECTOR_DECL_HPP
12 
13 /* this file is automatically generated - do not edit (see script/interfaces.py) */
14 
15 #include "Xpetra_ConfigDefs.hpp"
16 #include "Xpetra_Map_decl.hpp"
18 
20 
21 namespace Xpetra {
22 
23 #ifndef DOXYGEN_SHOULD_SKIP_THIS
24 // forward declaration of Vector, needed to prevent circular inclusions
25 template <class S, class LO, class GO, class N>
26 class Vector;
27 
28 // forward declaration of MapExtractor, we just need the class sig here.
29 template <class S, class LO, class GO, class N>
30 class MapExtractor;
31 #endif
32 
33 template <class Scalar,
34  class LocalOrdinal,
35  class GlobalOrdinal,
36  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
38  : public MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
39  public:
40  typedef Scalar scalar_type;
41  typedef LocalOrdinal local_ordinal_type;
42  typedef GlobalOrdinal global_ordinal_type;
43  typedef Node node_type;
44 
45  private:
46 #undef XPETRA_BLOCKEDMULTIVECTOR_SHORT
47 #include "Xpetra_UseShortNames.hpp"
48 
49  public:
51 
52 
54 
63  BlockedMultiVector(const Teuchos::RCP<const BlockedMap>& map, size_t NumVectors, bool zeroOut = true);
64 
77  Teuchos::RCP<const MultiVector> v);
78 
91  Teuchos::RCP<const MultiVector> v);
92 
101  BlockedMultiVector(const Teuchos::RCP<const BlockedMap>& map, std::vector<Teuchos::RCP<MultiVector>>& vin);
102 
104  virtual ~BlockedMultiVector();
105 
114 
116 
118 
120  virtual void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar& /* value */);
121 
123  virtual void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar& /* value */);
124 
126  virtual void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar& /* value */);
127 
129  virtual void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar& /* value */);
130 
132  virtual void putScalar(const Scalar& value);
133 
135 
137 
139  virtual Teuchos::RCP<const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getVector(size_t j) const;
140 
142  virtual Teuchos::RCP<Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getVectorNonConst(size_t j);
143 
145  virtual Teuchos::ArrayRCP<const Scalar> getData(size_t j) const;
146 
148  virtual Teuchos::ArrayRCP<Scalar> getDataNonConst(size_t j);
149 
151 
153 
155  virtual void dot(const MultiVector& /* A */, const Teuchos::ArrayView<Scalar>& /* dots */) const;
156 
158  virtual void abs(const MultiVector& /* A */);
159 
161  virtual void reciprocal(const MultiVector& /* A */);
162 
164  virtual void scale(const Scalar& alpha);
165 
167  virtual void scale(Teuchos::ArrayView<const Scalar> alpha);
168 
170  virtual void update(const Scalar& alpha, const MultiVector& A, const Scalar& beta);
171 
173  virtual void update(const Scalar& alpha, const MultiVector& A, const Scalar& beta, const MultiVector& B, const Scalar& gamma);
174 
176  virtual void norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
177 
179  virtual void norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
180 
182  virtual void normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
183 
185  virtual void meanValue(const Teuchos::ArrayView<Scalar>& /* means */) const;
186 
188  virtual void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const Scalar& /* alpha */, const MultiVector& /* A */, const MultiVector& /* B */, const Scalar& /* beta */);
189 
191  virtual void elementWiseMultiply(Scalar scalarAB, const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A, const MultiVector& B, Scalar scalarThis);
192 
194 
196 
198  virtual size_t getNumVectors() const;
199 
201  virtual size_t getLocalLength() const;
202 
204  virtual global_size_t getGlobalLength() const;
205 
208 
210 
212 
214  virtual std::string description() const;
215 
217  virtual void describe(Teuchos::FancyOStream& out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const;
218 
219  virtual void replaceMap(const RCP<const Map>& map);
220 
222  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */, const Import& /* importer */, CombineMode /* CM */);
223 
225  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* dest */, const Import& /* importer */, CombineMode /* CM */);
226 
228  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */, const Export& /* exporter */, CombineMode /* CM */);
229 
231  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* dest */, const Export& /* exporter */, CombineMode /* CM */);
232 
234 
236 
238  virtual void setSeed(unsigned int seed);
239 
240  virtual void randomize(bool bUseXpetraImplementation = false);
241 
242  virtual void randomize(const Scalar& minVal, const Scalar& maxVal, bool bUseXpetraImplementation = false);
243 
245  virtual void Xpetra_randomize();
246 
248  virtual void Xpetra_randomize(const Scalar& minVal, const Scalar& maxVal);
249 
251 
253  Teuchos::RCP<const Map> getMap() const;
254 
256  Teuchos::RCP<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>> getBlockedMap() const;
257 
259  Teuchos::RCP<MultiVector> getMultiVector(size_t r) const;
260 
262  Teuchos::RCP<MultiVector> getMultiVector(size_t r, bool bThyraMode) const;
263 
265  void setMultiVector(size_t r, Teuchos::RCP<const MultiVector> v, bool bThyraMode);
266 
268  Teuchos::RCP<MultiVector> Merge() const;
269 
270  protected:
277  virtual void assign(const MultiVector& rhs);
278 
279  private:
280  // helper routines for interaction of MultiVector and BlockedMultiVectors
281 
282  void ExtractVector(RCP<const MultiVector>& full, size_t block, RCP<MultiVector>& partial) const;
283  void ExtractVector(RCP<MultiVector>& full, size_t block, RCP<MultiVector>& partial) const;
284 
285  RCP<MultiVector> ExtractVector(RCP<const MultiVector>& full, size_t block, bool bThyraMode = false) const;
286  RCP<MultiVector> ExtractVector(RCP<MultiVector>& full, size_t block, bool bThyraMode = false) const;
287 
288  void ExtractVector(const MultiVector& full, size_t block, MultiVector& partial) const;
289 
290  void InsertVector(const MultiVector& partial, size_t block, MultiVector& full, bool bThyraMode = false) const; // 1019
291  void InsertVector(RCP<const MultiVector> partial, size_t block, RCP<MultiVector> full, bool bThyraMode = false) const; // 1059
292  void InsertVector(RCP<MultiVector> partial, size_t block, RCP<MultiVector> full, bool bThyraMode = false) const; // 1069
293 
294  private:
295  Teuchos::RCP<const BlockedMap> map_;
296  std::vector<Teuchos::RCP<MultiVector>> vv_;
297  size_t numVectors_;
298 
299 }; // BlockedMultiVector class
300 
301 } // namespace Xpetra
302 
303 #define XPETRA_BLOCKEDMULTIVECTOR_SHORT
304 #endif // XPETRA_BLOCKEDMULTIVECTOR_DECL_HPP
virtual void reciprocal(const MultiVector &)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
virtual void elementWiseMultiply(Scalar scalarAB, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a MultiVector B.
std::vector< Teuchos::RCP< MultiVector > > vv_
array containing RCPs of the partial vectors
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 void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
virtual void multiply(Teuchos::ETransp, Teuchos::ETransp, const Scalar &, const MultiVector &, const MultiVector &, const Scalar &)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
virtual std::string description() const
A simple one-line description of this object.
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
BlockedMultiVector(const Teuchos::RCP< const BlockedMap > &map, size_t NumVectors, bool zeroOut=true)
Constructor.
virtual void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
virtual void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
virtual void meanValue(const Teuchos::ArrayView< Scalar > &) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
virtual void update(const Scalar &alpha, const MultiVector &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
size_t numVectors_
number of vectors (columns in multi vector)
Teuchos::RCP< MultiVector > Merge() const
merge BlockedMultiVector blocks to a single MultiVector
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
virtual void replaceMap(const RCP< const Map > &map)
virtual void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
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 setSeed(unsigned int seed)
Set seed for Random function.
void setMultiVector(size_t r, Teuchos::RCP< const MultiVector > v, bool bThyraMode)
set partial multivector associated with block row r
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
size_t global_size_t
Global size_t object.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
virtual void abs(const MultiVector &)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void InsertVector(const MultiVector &partial, size_t block, MultiVector &full, bool bThyraMode=false) const
virtual size_t getLocalLength() const
Local number of rows on the calling process.
virtual void dot(const MultiVector &, const Teuchos::ArrayView< Scalar > &) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial multivector associated with block row r
virtual void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
Teuchos::RCP< const BlockedMap > map_
blocked map containing the sub block maps (either thyra or xpetra mode)
virtual size_t getNumVectors() const
Number of columns in the multivector.
void ExtractVector(RCP< const MultiVector > &full, size_t block, RCP< MultiVector > &partial) const
Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > getBlockedMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
virtual global_size_t getGlobalLength() const
Global number of rows in the multivector.
virtual bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Local number of rows on the calling process.
CombineMode
Xpetra::Combine Mode enumerable type.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
BlockedMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const MultiVector &rhs)
Assignment operator: Does a deep copy.