Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 namespace Xpetra {
60 
61 template <class Scalar,
62  class LocalOrdinal,
63  class GlobalOrdinal,
64  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
66  : public virtual Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>,
67  public virtual Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
68  public:
69  using scalar_type = Scalar;
70  using local_ordinal_type = LocalOrdinal;
71  using global_ordinal_type = GlobalOrdinal;
72  using node_type = Node;
73 
83 
84  private:
85 #undef XPETRA_BLOCKEDVECTOR_SHORT
86 #include "Xpetra_UseShortNames.hpp"
87 
88  public:
90 
91 
93 
101  BlockedVector(const Teuchos::RCP<const BlockedMap>& map, bool zeroOut = true);
102 
116 
130 
132  virtual ~BlockedVector();
133 
143 
145 
147 
149  virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar& value);
150 
152  virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar& value);
153 
155  virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value);
156 
158  virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar& value);
159 
161  virtual void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar& value);
162 
164  virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar& value);
165 
167  virtual void replaceLocalValue(LocalOrdinal myRow, const Scalar& value);
168 
170  virtual void sumIntoLocalValue(LocalOrdinal myRow, const Scalar& value);
171 
173  virtual void putScalar(const Scalar& value);
174 
176 
178 
179 
181  virtual Teuchos::RCP<const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
182  getVector(size_t j) const;
183 
185  virtual Teuchos::RCP<Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
186  getVectorNonConst(size_t j);
187 
189  virtual Teuchos::ArrayRCP<const Scalar> getData(size_t j) const;
190 
192  virtual Teuchos::ArrayRCP<Scalar> getDataNonConst(size_t j);
193 
195 
197 
198 
201  const Teuchos::ArrayView<Scalar>& dots) const;
202 
203  virtual Scalar dot(const Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A) const;
204 
207 
210 
212  virtual void scale(const Scalar& alpha);
213 
215  virtual void scale(Teuchos::ArrayView<const Scalar> alpha);
216 
217  virtual void update(const Scalar& alpha,
219  const Scalar& beta);
220 
222  virtual void update(const Scalar& alpha,
224  const Scalar& beta,
226  const Scalar& gamma);
227 
229  virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType norm1() const;
230 
232  virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType norm2() const;
233 
235  virtual typename Teuchos::ScalarTraits<Scalar>::magnitudeType normInf() const;
236 
238  virtual void norm1(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
239 
241  virtual void norm2(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
242 
244  virtual void normInf(const Teuchos::ArrayView<typename Teuchos::ScalarTraits<Scalar>::magnitudeType>& norms) const;
245 
248  virtual void meanValue(const Teuchos::ArrayView<Scalar>& /* means */) const;
249 
250  virtual Scalar meanValue() const;
251 
253  virtual void multiply(Teuchos::ETransp /* transA */,
254  Teuchos::ETransp /* transB */,
255  const Scalar& /* alpha */,
258  const Scalar& /* beta */);
259 
260  virtual void multiply(Teuchos::ETransp /* transA */,
261  Teuchos::ETransp /* transB */,
262  const Scalar& /* alpha */,
265  const Scalar& /* beta */);
266 
267  virtual void elementWiseMultiply(Scalar /* scalarAB */,
270  Scalar /* scalarThis */);
271 
273  virtual void elementWiseMultiply(Scalar /* scalarAB */,
276  Scalar /* scalarThis */);
277 
279 
281 
282 
284  virtual size_t getNumVectors() const;
285 
287  virtual size_t getLocalLength() const;
288 
290  virtual global_size_t getGlobalLength() const;
291 
294 
296 
298 
299 
301  virtual std::string description() const;
302 
304  virtual void describe(Teuchos::FancyOStream& out,
305  const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const;
306 
307  virtual void replaceMap(const RCP<const Map>& map);
308 
310  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */,
311  const Import& /* importer */,
312  CombineMode /* CM */);
313 
316  const Import& /* importer */,
317  CombineMode /* CM */);
318 
320  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node>& /* source */,
321  const Export& /* exporter */,
322  CombineMode /* CM */);
323 
326  const Export& /* exporter */,
327  CombineMode /* CM */);
328 
330 
332 
333 
335  virtual void setSeed(unsigned int seed);
336 
337  virtual void randomize(bool bUseXpetraImplementation = false);
338 
339  virtual void randomize(const Scalar& minVal, const Scalar& maxVal, bool bUseXpetraImplementation = false);
340 
342  virtual void Xpetra_randomize();
343 
345  virtual void Xpetra_randomize(const Scalar& minVal, const Scalar& maxVal);
346 
348 
350  Teuchos::RCP<const Map> getMap() const;
351 
353  Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
354  getMultiVector(size_t r) const;
355 
357  Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
358  getMultiVector(size_t r, bool bThyraMode) const;
359 
361  void
362  setMultiVector(size_t r,
364  bool bThyraMode);
365 
367  Teuchos::RCP<Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
368  Merge() const;
369 
370  protected:
378 
379  // virtual void assign (const MultiVector& rhs);
380 
381  // private:
382  // Teuchos::RCP<const BlockedMap> map_; ///< blocked map containing the sub block maps (either thyra or xpetra mode)
383  // std::vector<Teuchos::RCP<Vector> > vv_; ///< array containing RCPs of the partial vectors
384 
385 }; // BlockedVector class
386 
387 } // namespace Xpetra
388 
389 #define XPETRA_BLOCKEDVECTOR_SHORT
390 #endif // XPETRA_BLOCKEDVECTOR_DECL_HPP
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual Scalar meanValue() const
Compute mean (average) value of this Vector.
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 setSeed(unsigned int seed)
Set seed for Random function.
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).
virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
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 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 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 void scale(const Scalar &alpha)
Scale the current values of a vector, this = alpha*this.
virtual void replaceMap(const RCP< const Map > &map)
virtual size_t getNumVectors() const
Number of columns in the Vector.
virtual std::string description() const
A simple one-line description of this object.
virtual void abs(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input vector in target: A = abs(this).
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 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 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 bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
Local number of rows on the calling process.
virtual void assign(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual size_t getLocalLength() const
Local number of rows on the calling process.
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
virtual ~BlockedVector()
Destructor.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of vector.
size_t global_size_t
Global size_t object.
BlockedVector(const Teuchos::RCP< const BlockedMap > &map, bool zeroOut=true)
Constructor.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Merge() const
merge BlockedVector blocks to a single Vector
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this vector.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Compute 1-norm of vector.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this vector.
virtual global_size_t getGlobalLength() const
Global number of rows in the Vector.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Assignment operator: Does a deep copy.
CombineMode
Xpetra::Combine Mode enumerable type.
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
virtual void putScalar(const Scalar &value)
Set all values in the vector with the given value.
virtual void Xpetra_randomize()
Set vector values to random numbers. XPetra implementation.
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMultiVector(size_t r) const
return partial Vector associated with block row r
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.