Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_EpetraVector.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 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_EPETRAVECTOR_HPP
47 #define XPETRA_EPETRAVECTOR_HPP
48 
49 /* this file is automatically generated - do not edit (see script/epetra.py) */
50 
52 
53 #include "Xpetra_Vector.hpp"
55 #include "Xpetra_EpetraMap.hpp" //TMP
56 #include "Xpetra_Utils.hpp"
57 #include "Xpetra_EpetraImport.hpp"
58 #include "Xpetra_EpetraExport.hpp"
59 #include "Xpetra_Exceptions.hpp"
60 
61 #include <Epetra_Vector.h>
62 
63 namespace Xpetra {
64 
65 // TODO: move that elsewhere
66 template<class GlobalOrdinal, class Node>
67 Epetra_Vector & toEpetra(Vector<double, int, GlobalOrdinal, Node> &);
68 
69 template<class GlobalOrdinal, class Node>
70 const Epetra_Vector & toEpetra(const Vector<double, int, GlobalOrdinal, Node> &);
71 //
72 
73 template<class EpetraGlobalOrdinal, class Node>
74 class EpetraVectorT
75  : public virtual Vector<double,int,EpetraGlobalOrdinal, Node>, public EpetraMultiVectorT<EpetraGlobalOrdinal, Node>
76 {
77 
78  typedef double Scalar;
79  typedef int LocalOrdinal;
80  typedef EpetraGlobalOrdinal GlobalOrdinal;
81 
82 public:
83 
85  void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const { }
86 
88  void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const { }
89 
91  void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const { }
92 
94  void meanValue(const Teuchos::ArrayView< Scalar > &means) const { }
95 
97  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { }
98 
100  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { }
101 
103  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { }
104 
106  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { }
107 
109  void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const { }
110 
112 
113 
115  explicit EpetraVectorT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true) : EpetraMultiVectorT<GlobalOrdinal, Node>(map,1,zeroOut) {};
116 
117  // Commenting out since no definition provided in cpp.
119  // EpetraVectorT(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source);
120 
122  virtual ~EpetraVectorT() { }
123 
125 
127 
128 
130  void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {};
131 
133  void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {};
134 
136  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {};
137 
139  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {};
140 
142 
144 
145 
147  Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const { return Teuchos::ScalarTraits<Scalar>::zero(); };
148 
150  Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const { return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());};
151 
153  Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const {return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());};
154 
156  Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const {return Teuchos::ScalarTraits<Scalar>::magnitude(Teuchos::ScalarTraits<Scalar>::zero());};
157 
159  //Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &weights) const;
160 
162  Scalar meanValue() const {return Teuchos::ScalarTraits<Scalar>::zero();};
163 
165 
167 
168 
170  std::string description() const { return std::string(""); }
171 
173  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const {};
174 
176 
178 
179 
181  EpetraVectorT(const Teuchos::RCP<Epetra_Vector> &vec) : EpetraMultiVectorT<GlobalOrdinal, Node>(vec) { // TODO: removed const of Epetra::Vector
182  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
183  "Xpetra::EpetraVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
184  }
185 
187  Epetra_Vector * getEpetra_Vector() const { return NULL; /*return (*this->EpetraMultiVectorT<GlobalOrdinal, Node>::getEpetra_MultiVector())(0);*/ }
188  //RCP<Epetra_Vector> getEpetra_Vector() const { return this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->getVectorNonConst(0); }
189 
193  EpetraVectorT(const RCP<Epetra_MultiVector> &mv, size_t j) : EpetraMultiVectorT<GlobalOrdinal, Node>(mv) {};
194 
195 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
197 
198  typename dual_view_type::t_host_um getHostLocalView () const {
200  }
201 
202  typename dual_view_type::t_dev_um getDeviceLocalView() const {
203  throw std::runtime_error("Epetra does not support device views!");
204 #ifndef __NVCC__ //prevent nvcc warning
205  typename dual_view_type::t_dev ret;
206 #endif
207  TEUCHOS_UNREACHABLE_RETURN(ret);
208  }
209 
220  template<class TargetDeviceType>
221  typename Kokkos::Impl::if_c<
222  std::is_same<
223  typename dual_view_type::t_dev_um::execution_space::memory_space,
224  typename TargetDeviceType::memory_space>::value,
225  typename dual_view_type::t_dev_um,
226  typename dual_view_type::t_host_um>::type
227  getLocalView () const {
228  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
229  }
230 #endif
231 
233 
234 private:
235 
236  // This private member is only used by the constructor EpetraVectorT(const RCP<EpetraMultiVectorT<GlobalOrdinal> > &mv, size_t j). The actual private member holding the Epetra vector (vec_) is in the base class (Xpetra:EpetraMultiVectorT)
237  // TODO remove this...
238  const RCP<const Epetra_MultiVector> internalRefToBaseMV_;
239 
240 }; // EpetraVectorT class
241 
242 // specialization on GO=int and Node=Serial
243 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
244 template<>
246 : public virtual Vector<double,int,int,EpetraNode>, public EpetraMultiVectorT<int,EpetraNode>
247 {
248  typedef double Scalar;
249  typedef int LocalOrdinal;
250  typedef int GlobalOrdinal;
251  typedef EpetraNode Node;
252 
253 public:
254 
255  using EpetraMultiVectorT<GlobalOrdinal, Node>::dot; // overloading, not hiding
256  using EpetraMultiVectorT<GlobalOrdinal, Node>::norm1; // overloading, not hiding
257  using EpetraMultiVectorT<GlobalOrdinal, Node>::norm2; // overloading, not hiding
258  using EpetraMultiVectorT<GlobalOrdinal, Node>::normInf; // overloading, not hiding
259  using EpetraMultiVectorT<GlobalOrdinal, Node>::meanValue; // overloading, not hiding
260  using EpetraMultiVectorT<GlobalOrdinal, Node>::replaceGlobalValue; // overloading, not hiding
261  using EpetraMultiVectorT<GlobalOrdinal, Node>::sumIntoGlobalValue; // overloading, not hiding
262  using EpetraMultiVectorT<GlobalOrdinal, Node>::replaceLocalValue; // overloading, not hiding
263  using EpetraMultiVectorT<GlobalOrdinal, Node>::sumIntoLocalValue; // overloading, not hiding
264 
265 
266 
268 
269 
271  explicit EpetraVectorT(const Teuchos::RCP<const Map<int,GlobalOrdinal,Node> > &map, bool zeroOut=true) : EpetraMultiVectorT<GlobalOrdinal, Node>(map,1,zeroOut) { }
272 
273  // Commenting out since no definition provided in cpp.
275  // EpetraVectorT(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source);
276 
278  virtual ~EpetraVectorT() { }
279 
281 
283 
284 
286  void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::replaceGlobalValue"); this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->ReplaceGlobalValue(globalRow, 0, value); }
287 
289  void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::sumIntoGlobalValue");this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->SumIntoGlobalValue(globalRow, 0, value); }
290 
292  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::replaceLocalValue");this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->ReplaceMyValue(myRow, 0, value); }
293 
295  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::sumIntoLocalValue");this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->SumIntoMyValue(myRow, 0, value); }
296 
298 
300 
301 
304  XPETRA_MONITOR("EpetraVectorT::dot");
305 
306  XPETRA_DYNAMIC_CAST(const EpetraVectorT, a, tA, "This Xpetra::EpetraVectorT method only accept Xpetra::EpetraVectorT as input arguments.");
307  // return getEpetra_Vector()->Dot(*tA.getEpetra_Vector());
308 
309  // other way: use the MultiVector Dot instead of VectorDot:
310  double r;
311  this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->Epetra_MultiVector::Dot(*tA.getEpetra_MultiVector(), &r);
312  return r;
313  }
314 
316  Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const { XPETRA_MONITOR("EpetraVectorT::norm1"); Scalar r; this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->Norm1(&r); return r; }
317 
319  Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const { XPETRA_MONITOR("EpetraVectorT::norm2"); Scalar r; this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->Norm2(&r); return r; }
320 
322  Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const { XPETRA_MONITOR("EpetraVectorT::normInf"); Scalar r; this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->NormInf(&r); return r; }
323 
325  //Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &weights) const;
326 
328  Scalar meanValue() const {
329  XPETRA_MONITOR("EpetraVectorT::meanValue");
330  Scalar r;
332  return r;
333  }
334 
336 
338 
339 
341  std::string description() const {
342  XPETRA_MONITOR("EpetraVectorT::description");
343  // This implementation come from Epetra_Vector_def.hpp (without modification)
344  std::ostringstream oss;
345  oss << Teuchos::Describable::description();
346  oss << "{length="<<this->getGlobalLength()
347  << "}";
348  return oss.str();
349  }
350 
352  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const {
353  XPETRA_MONITOR("EpetraVectorT::describe");
354 
355  if (verbLevel > Teuchos::VERB_NONE) {
356  getEpetra_Vector()->Print (out);
357  }
358  }
360 
362 
363 
365  EpetraVectorT(const Teuchos::RCP<Epetra_Vector> &vec) : EpetraMultiVectorT<GlobalOrdinal, Node>(vec) { } // TODO: removed const of Epetra::Vector
366 
369  //RCP<Epetra_Vector> getEpetra_Vector() const { return this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->getVectorNonConst(0); }
370 
374  EpetraVectorT(const RCP<Epetra_MultiVector> &mv, size_t j)
375  : EpetraMultiVectorT<GlobalOrdinal,Node>(rcp((*mv)(j), false)), // view of the vector number j. false == I do not own the data.
376  internalRefToBaseMV_(mv) // keep an internal reference to the initial MultiVector to avoid desallocation of the view.
377  {
378  // The view of the internal data of 'mv' is only valid until the destruction of 'mv'.
379  // The new vector hold an internal reference to 'mv' in order to keep the view valid after disappearance of 'mv' references in user code.
380  // This implements the logic of subArray rcp (as required by the Tpetra interface).
381  }
382 
383 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
385 
386  typename dual_view_type::t_host_um getHostLocalView () const {
388  }
389 
390  typename dual_view_type::t_dev_um getDeviceLocalView() const {
391  throw std::runtime_error("Epetra does not support device views!");
392 #ifndef __NVCC__ //prevent nvcc warning
393  typename dual_view_type::t_dev ret;
394 #endif
395  TEUCHOS_UNREACHABLE_RETURN(ret);
396  }
397 
408  template<class TargetDeviceType>
409  typename Kokkos::Impl::if_c<
410  std::is_same<
411  typename dual_view_type::t_dev_um::execution_space::memory_space,
412  typename TargetDeviceType::memory_space>::value,
413  typename dual_view_type::t_dev_um,
414  typename dual_view_type::t_host_um>::type
415  getLocalView () const {
416  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
417  }
418 #endif
419 
421 
422 private:
423 
424  // This private member is only used by the constructor EpetraVectorT(const RCP<EpetraMultiVectorT<GlobalOrdinal> > &mv, size_t j). The actual private member holding the Epetra vector (vec_) is in the base class (Xpetra:EpetraMultiVectorT)
425  const RCP<const Epetra_MultiVector> internalRefToBaseMV_;
426 };
427 #endif
428 
429 // specialization on GO=long long and Node=Serial
430 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
431 template<>
432 class EpetraVectorT<long long, EpetraNode>
433 : public virtual Vector<double,int,long long,EpetraNode>, public EpetraMultiVectorT<long long,EpetraNode>
434 {
435  typedef double Scalar;
436  typedef int LocalOrdinal;
437  typedef long long GlobalOrdinal;
438  typedef EpetraNode Node;
439 
440 public:
441 
442  using EpetraMultiVectorT<GlobalOrdinal, Node>::dot; // overloading, not hiding
443  using EpetraMultiVectorT<GlobalOrdinal, Node>::norm1; // overloading, not hiding
444  using EpetraMultiVectorT<GlobalOrdinal, Node>::norm2; // overloading, not hiding
445  using EpetraMultiVectorT<GlobalOrdinal, Node>::normInf; // overloading, not hiding
446  using EpetraMultiVectorT<GlobalOrdinal, Node>::meanValue; // overloading, not hiding
447  using EpetraMultiVectorT<GlobalOrdinal, Node>::replaceGlobalValue; // overloading, not hiding
448  using EpetraMultiVectorT<GlobalOrdinal, Node>::sumIntoGlobalValue; // overloading, not hiding
449  using EpetraMultiVectorT<GlobalOrdinal, Node>::replaceLocalValue; // overloading, not hiding
450  using EpetraMultiVectorT<GlobalOrdinal, Node>::sumIntoLocalValue; // overloading, not hiding
451 
453 
454 
456  explicit EpetraVectorT(const Teuchos::RCP<const Map<int,GlobalOrdinal,Node> > &map, bool zeroOut=true) : EpetraMultiVectorT<GlobalOrdinal, Node>(map,1,zeroOut) { }
457 
458  // Commenting out since no definition provided in cpp.
460  // EpetraVectorT(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source);
461 
463  virtual ~EpetraVectorT() { }
464 
466 
468 
469 
471  void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::replaceGlobalValue"); this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->ReplaceGlobalValue(globalRow, 0, value); }
472 
474  void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::sumIntoGlobalValue");this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->SumIntoGlobalValue(globalRow, 0, value); }
475 
477  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::replaceLocalValue");this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->ReplaceMyValue(myRow, 0, value); }
478 
480  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraVectorT::sumIntoLocalValue");this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->SumIntoMyValue(myRow, 0, value); }
481 
483 
485 
486 
489  XPETRA_MONITOR("EpetraVectorT::dot");
490 
491  XPETRA_DYNAMIC_CAST(const EpetraVectorT, a, tA, "This Xpetra::EpetraVectorT method only accept Xpetra::EpetraVectorT as input arguments.");
492  // return getEpetra_Vector()->Dot(*tA.getEpetra_Vector());
493 
494  // other way: use the MultiVector Dot instead of VectorDot:
495  double r;
496  this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->Epetra_MultiVector::Dot(*tA.getEpetra_MultiVector(), &r);
497  return r;
498  }
499 
501  Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const { XPETRA_MONITOR("EpetraVectorT::norm1"); Scalar r; this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->Norm1(&r); return r; }
502 
504  Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const { XPETRA_MONITOR("EpetraVectorT::norm2"); Scalar r; this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->Norm2(&r); return r; }
505 
507  Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const { XPETRA_MONITOR("EpetraVectorT::normInf"); Scalar r; this->EpetraMultiVectorT<GlobalOrdinal,Node>::getEpetra_MultiVector()->NormInf(&r); return r; }
508 
510  //Teuchos::ScalarTraits< Scalar >::magnitudeType normWeighted(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &weights) const;
511 
513  Scalar meanValue() const {
514  XPETRA_MONITOR("EpetraVectorT::meanValue");
515  Scalar r;
517  return r;
518  }
519 
521 
523 
524 
526  std::string description() const {
527  XPETRA_MONITOR("EpetraVectorT::description");
528  // This implementation come from Epetra_Vector_def.hpp (without modification)
529  std::ostringstream oss;
530  oss << Teuchos::Describable::description();
531  oss << "{length="<<this->getGlobalLength()
532  << "}";
533  return oss.str();
534  }
535 
537  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const {
538  XPETRA_MONITOR("EpetraVectorT::describe");
539 
540  if (verbLevel > Teuchos::VERB_NONE) {
541  getEpetra_Vector()->Print (out);
542  }
543  }
545 
547 
548 
550  EpetraVectorT(const Teuchos::RCP<Epetra_Vector> &vec) : EpetraMultiVectorT<GlobalOrdinal, Node>(vec) { } // TODO: removed const of Epetra::Vector
551 
554  //RCP<Epetra_Vector> getEpetra_Vector() const { return this->EpetraMultiVectorT<GlobalOrdinal>::getEpetra_MultiVector()->getVectorNonConst(0); }
555 
559  EpetraVectorT(const RCP<Epetra_MultiVector> &mv, size_t j)
560  : EpetraMultiVectorT<GlobalOrdinal,Node>(rcp((*mv)(j), false)), // view of the vector number j. false == I do not own the data.
561  internalRefToBaseMV_(mv) // keep an internal reference to the initial MultiVector to avoid desallocation of the view.
562  {
563  // The view of the internal data of 'mv' is only valid until the destruction of 'mv'.
564  // The new vector hold an internal reference to 'mv' in order to keep the view valid after disappearance of 'mv' references in user code.
565  // This implements the logic of subArray rcp (as required by the Tpetra interface).
566  }
567 
568 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
570 
571  typename dual_view_type::t_host_um getHostLocalView () const {
573  }
574 
575  typename dual_view_type::t_dev_um getDeviceLocalView() const {
576  throw std::runtime_error("Epetra does not support device views!");
577 #ifndef __NVCC__ //prevent nvcc warning
578  typename dual_view_type::t_dev ret;
579 #endif
580  TEUCHOS_UNREACHABLE_RETURN(ret);
581  }
582 
593  template<class TargetDeviceType>
594  typename Kokkos::Impl::if_c<
595  std::is_same<
596  typename dual_view_type::t_dev_um::execution_space::memory_space,
597  typename TargetDeviceType::memory_space>::value,
598  typename dual_view_type::t_dev_um,
599  typename dual_view_type::t_host_um>::type
600  getLocalView () const {
601  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
602  }
603 #endif
604 
606 
607 private:
608 
609  // This private member is only used by the constructor EpetraVectorT(const RCP<EpetraMultiVectorT<GlobalOrdinal> > &mv, size_t j). The actual private member holding the Epetra vector (vec_) is in the base class (Xpetra:EpetraMultiVectorT)
610  const RCP<const Epetra_MultiVector> internalRefToBaseMV_;
611 };
612 #endif
613 
614 } // Xpetra namespace
615 
616 #endif // XPETRA_EPETRAVECTOR_HPP
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
EpetraVectorT(const Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
Computes dot product of this Vector against input Vector x.
Scalar meanValue() const
Compute Weighted 2-norm (RMS Norm) of this Vector.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Exception throws to report errors in the internal logical of the program.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
EpetraVectorT(const RCP< Epetra_MultiVector > &mv, size_t j)
global_size_t getGlobalLength() const
Global number of rows in the multivector.
EpetraVectorT(const Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
std::string description() const
Return a simple one-line description of this object.
std::string description() const
Return a simple one-line description of this object.
Epetra_Vector * getEpetra_Vector() const
Get the underlying Epetra vector.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
virtual ~EpetraVectorT()
Vector copy constructor.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
const RCP< const Epetra_MultiVector > internalRefToBaseMV_
virtual ~EpetraVectorT()
Vector copy constructor.
Epetra_Vector * getEpetra_Vector() const
Get the underlying Epetra vector.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
EpetraGlobalOrdinal GlobalOrdinal
EpetraVectorT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute the dot product of each corresponding pair of vectors (columns) in A and B.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Return 1-norm of this Vector.
EpetraVectorT(const Teuchos::RCP< Epetra_Vector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_Vector object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
Computes dot product of this Vector against input Vector x.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Scalar dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
Computes dot product of this Vector against input Vector x.
EpetraVectorT(const Teuchos::RCP< Epetra_Vector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_Vector object.
const RCP< const Epetra_MultiVector > internalRefToBaseMV_
virtual ~EpetraVectorT()
Vector copy constructor.
EpetraVectorT(const Teuchos::RCP< Epetra_Vector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_Vector object.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
Scalar meanValue() const
Compute Weighted 2-norm (RMS Norm) of this Vector.
Epetra_Vector * getEpetra_Vector() const
Get the underlying Epetra vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
const RCP< const Epetra_MultiVector > internalRefToBaseMV_
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
#define XPETRA_MONITOR(funcName)
std::string description() const
Return a simple one-line description of this object.
EpetraVectorT(const RCP< Epetra_MultiVector > &mv, size_t j)
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of this Vector.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Scalar meanValue() const
Compute Weighted 2-norm (RMS Norm) of this Vector.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.