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 // ***********************************************************************
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_BLOCKEDMULTIVECTOR_DECL_HPP
48 #define XPETRA_BLOCKEDMULTIVECTOR_DECL_HPP
49 
50 /* this file is automatically generated - do not edit (see script/interfaces.py) */
51 
52 #include "Xpetra_ConfigDefs.hpp"
53 #include "Xpetra_Map_decl.hpp"
55 
57 
58 namespace Xpetra {
59 
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61 // forward declaration of Vector, needed to prevent circular inclusions
62 template <class S, class LO, class GO, class N>
63 class Vector;
64 
65 // forward declaration of MapExtractor, we just need the class sig here.
66 template <class S, class LO, class GO, class N>
67 class MapExtractor;
68 #endif
69 
70 template <class Scalar,
71  class LocalOrdinal,
72  class GlobalOrdinal,
73  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
75  : public MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
76  public:
77  typedef Scalar scalar_type;
78  typedef LocalOrdinal local_ordinal_type;
79  typedef GlobalOrdinal global_ordinal_type;
80  typedef Node node_type;
81 
82  private:
83 #undef XPETRA_BLOCKEDMULTIVECTOR_SHORT
84 #include "Xpetra_UseShortNames.hpp"
85 
86  public:
88 
89 
91 
100  BlockedMultiVector(const Teuchos::RCP<const BlockedMap>& map, size_t NumVectors, bool zeroOut = true);
101 
114  Teuchos::RCP<const MultiVector> v);
115 
128  Teuchos::RCP<const MultiVector> v);
129 
138  BlockedMultiVector(const Teuchos::RCP<const BlockedMap>& map, std::vector<Teuchos::RCP<MultiVector>>& vin);
139 
141  virtual ~BlockedMultiVector();
142 
151 
153 
155 
157  virtual void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar& /* value */);
158 
160  virtual void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar& /* value */);
161 
163  virtual void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar& /* value */);
164 
166  virtual void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar& /* value */);
167 
169  virtual void putScalar(const Scalar& value);
170 
172 
174 
176  virtual Teuchos::RCP<const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getVector(size_t j) const;
177 
179  virtual Teuchos::RCP<Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>> getVectorNonConst(size_t j);
180 
182  virtual Teuchos::ArrayRCP<const Scalar> getData(size_t j) const;
183 
185  virtual Teuchos::ArrayRCP<Scalar> getDataNonConst(size_t j);
186 
188 
190 
192  virtual void dot(const MultiVector& /* A */, const Teuchos::ArrayView<Scalar>& /* dots */) const;
193 
195  virtual void abs(const MultiVector& /* A */);
196 
198  virtual void reciprocal(const MultiVector& /* A */);
199 
201  virtual void scale(const Scalar& alpha);
202 
204  virtual void scale(Teuchos::ArrayView<const Scalar> alpha);
205 
207  virtual void update(const Scalar& alpha, const MultiVector& A, const Scalar& beta);
208 
210  virtual void update(const Scalar& alpha, const MultiVector& A, const Scalar& beta, const MultiVector& B, const Scalar& gamma);
211 
213  virtual void norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
214 
216  virtual void norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
217 
219  virtual void normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
220 
222  virtual void meanValue(const Teuchos::ArrayView<Scalar>& /* means */) const;
223 
225  virtual void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const Scalar& /* alpha */, const MultiVector& /* A */, const MultiVector& /* B */, const Scalar& /* beta */);
226 
228  virtual void elementWiseMultiply(Scalar scalarAB, const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A, const MultiVector& B, Scalar scalarThis);
229 
231 
233 
235  virtual size_t getNumVectors() const;
236 
238  virtual size_t getLocalLength() const;
239 
241  virtual global_size_t getGlobalLength() const;
242 
245 
247 
249 
251  virtual std::string description() const;
252 
254  virtual void describe(Teuchos::FancyOStream& out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const;
255 
256  virtual void replaceMap(const RCP<const Map>& map);
257 
259  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */, const Import& /* importer */, CombineMode /* CM */);
260 
262  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* dest */, const Import& /* importer */, CombineMode /* CM */);
263 
265  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */, const Export& /* exporter */, CombineMode /* CM */);
266 
268  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* dest */, const Export& /* exporter */, CombineMode /* CM */);
269 
271 
273 
275  virtual void setSeed(unsigned int seed);
276 
277  virtual void randomize(bool bUseXpetraImplementation = false);
278 
279  virtual void randomize(const Scalar& minVal, const Scalar& maxVal, bool bUseXpetraImplementation = false);
280 
282  virtual void Xpetra_randomize();
283 
285  virtual void Xpetra_randomize(const Scalar& minVal, const Scalar& maxVal);
286 
288 
290  Teuchos::RCP<const Map> getMap() const;
291 
293  Teuchos::RCP<const Xpetra::BlockedMap<LocalOrdinal, GlobalOrdinal, Node>> getBlockedMap() const;
294 
296  Teuchos::RCP<MultiVector> getMultiVector(size_t r) const;
297 
299  Teuchos::RCP<MultiVector> getMultiVector(size_t r, bool bThyraMode) const;
300 
302  void setMultiVector(size_t r, Teuchos::RCP<const MultiVector> v, bool bThyraMode);
303 
305  Teuchos::RCP<MultiVector> Merge() const;
306 
307  protected:
314  virtual void assign(const MultiVector& rhs);
315 
316  private:
317  // helper routines for interaction of MultiVector and BlockedMultiVectors
318 
319  void ExtractVector(RCP<const MultiVector>& full, size_t block, RCP<MultiVector>& partial) const;
320  void ExtractVector(RCP<MultiVector>& full, size_t block, RCP<MultiVector>& partial) const;
321 
322  RCP<MultiVector> ExtractVector(RCP<const MultiVector>& full, size_t block, bool bThyraMode = false) const;
323  RCP<MultiVector> ExtractVector(RCP<MultiVector>& full, size_t block, bool bThyraMode = false) const;
324 
325  void ExtractVector(const MultiVector& full, size_t block, MultiVector& partial) const;
326 
327  void InsertVector(const MultiVector& partial, size_t block, MultiVector& full, bool bThyraMode = false) const; // 1019
328  void InsertVector(RCP<const MultiVector> partial, size_t block, RCP<MultiVector> full, bool bThyraMode = false) const; // 1059
329  void InsertVector(RCP<MultiVector> partial, size_t block, RCP<MultiVector> full, bool bThyraMode = false) const; // 1069
330 
331  private:
332  Teuchos::RCP<const BlockedMap> map_;
333  std::vector<Teuchos::RCP<MultiVector>> vv_;
334  size_t numVectors_;
335 
336 }; // BlockedMultiVector class
337 
338 } // namespace Xpetra
339 
340 #define XPETRA_BLOCKEDMULTIVECTOR_SHORT
341 #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.