Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_EpetraIntVector.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_EPETRAINTVECTOR_HPP
47 #define XPETRA_EPETRAINTVECTOR_HPP
48 
50 
51 #include "Xpetra_ConfigDefs.hpp"
52 #include "Xpetra_MultiVector.hpp"
53 #include "Xpetra_Vector.hpp"
54 #include "Xpetra_Exceptions.hpp"
55 
56 #include "Xpetra_EpetraMap.hpp"
58 #include "Epetra_IntVector.h"
59 
60 namespace Xpetra {
61 
62 // TODO: move that elsewhere
63 template<class GlobalOrdinal, class Node>
64 Epetra_IntVector & toEpetra(Vector<int, int, GlobalOrdinal, Node> &);
65 
66 template<class GlobalOrdinal, class Node>
67 const Epetra_IntVector & toEpetra(const Vector<int, int, GlobalOrdinal, Node> &);
68 //
69 
70  // stub implementation for EpetraIntVectorT
71  template<class EpetraGlobalOrdinal, class Node>
72  class EpetraIntVectorT
73  : public Vector<int,int,EpetraGlobalOrdinal, Node>
74  {
75  typedef int Scalar;
76  typedef int LocalOrdinal;
77  typedef EpetraGlobalOrdinal GlobalOrdinal;
78 
79  public:
80 
82 
83 
85  explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut=true) { }
86 
89 
91 
93 
94 
96  int dot(const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &a) const { XPETRA_MONITOR("EpetraIntVectorT::dot"); TEUCHOS_TEST_FOR_EXCEPTION(-1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
97 
98 
100  Teuchos::ScalarTraits<int>::magnitudeType norm1() const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
101 
102 
104  Teuchos::ScalarTraits<int>::magnitudeType norm2() const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
105 
107  Teuchos::ScalarTraits<int>::magnitudeType normInf() const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
108 
110  int meanValue() const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
111 
113  int maxValue() const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
114 
115 
117 
119 
120 
122  void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
123 
125  void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
126 
128  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
129 
131  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
132 
134  void putScalar(const int &value) { }
135 
137  void randomize(bool bUseXpetraImplementation = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
138 
139 
141 
142  void setSeed(unsigned int seed) { XPETRA_MONITOR("EpetraIntVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra"); }
143 
144 
146 
148 
149 
151  Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const {
152  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
153  }
154 
156  Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j) {
157  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
158  }
159 
162  Teuchos::ArrayRCP<const int> getData(size_t j) const { return Teuchos::ArrayRCP<const int>(); }
163 
166  Teuchos::ArrayRCP<int> getDataNonConst(size_t j) { return Teuchos::ArrayRCP<int>(); }
167 
169 
171 
172  void dot(const MultiVector<int,int,GlobalOrdinal,Node> &A, const Teuchos::ArrayView<int> &dots) const { }
174 
177 
180 
182  void scale(const int &alpha) { }
183 
185  void scale (Teuchos::ArrayView< const int > alpha) {
186  XPETRA_MONITOR("EpetraIntVectorT::scale");
187  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
188  }
189 
191  void update(const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const int &beta) {
192  XPETRA_MONITOR("EpetraIntVectorT::update");
193 
194  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
195  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
196  }
197 
199  void update(const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const int &beta, const MultiVector<int,int,GlobalOrdinal,Node> &B, const int &gamma) {
200  XPETRA_MONITOR("EpetraIntVectorT::update");
201 
202  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
203  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
204  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
205  }
206 
208  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
209 
211  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
212 
214  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
215 
217  void meanValue(const Teuchos::ArrayView<int> &means) const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
218 
220  void maxValue(const Teuchos::ArrayView<int> &maxs) const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
221 
223  void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const MultiVector<int,int,GlobalOrdinal,Node> &B, const int &beta) { XPETRA_MONITOR("EpetraIntVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
224 
227  XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
228  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
229  }
230 
232 
234 
235 
237  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
238 
240  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
241 
243  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
244 
246  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
247 
249 
251 
252 
254  size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntVectorT::getNumVectors"); return 1; }
255 
256 
258  size_t getLocalLength() const { return 0; }
259 
261  global_size_t getGlobalLength() const { return 0; }
262 
264  bool isSameSize(const MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & vec) const { return false; }
265 
267 
269 
270 
272  std::string description() const {
273  return std::string("");
274  }
275 
277  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
278 
280 
281  RCP< Epetra_IntVector > getEpetra_IntVector() const { return Teuchos::null; }
282 
283  const RCP<const Comm<int> > getComm() const {
284  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
285  }
286 
287  // Implementing DistObject
288  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap () const {
289  return Teuchos::null;
290  }
291 
293  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) { }
294 
296  const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) { }
297 
299  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) { }
300 
302  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) { }
303 
304  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& map) {
305  // do nothing
306  }
307 
308 
310 
311 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
313 
314  typename dual_view_type::t_host_um getHostLocalView () const {
315  throw std::runtime_error("EpetraIntVector does not support device views! Must be implemented extra...");
316 #ifndef __NVCC__ //prevent nvcc warning
317  typename dual_view_type::t_host_um ret;
318 #endif
319  TEUCHOS_UNREACHABLE_RETURN(ret);
320  }
321 
322  typename dual_view_type::t_dev_um getDeviceLocalView() const {
323  throw std::runtime_error("Epetra does not support device views!");
324 #ifndef __NVCC__ //prevent nvcc warning
325  typename dual_view_type::t_dev_um ret;
326 #endif
327  TEUCHOS_UNREACHABLE_RETURN(ret);
328  }
329 
340  template<class TargetDeviceType>
341  typename Kokkos::Impl::if_c<
342  std::is_same<
343  typename dual_view_type::t_dev_um::execution_space::memory_space,
344  typename TargetDeviceType::memory_space>::value,
345  typename dual_view_type::t_dev_um,
346  typename dual_view_type::t_host_um>::type
347  getLocalView () const {
348  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
349  }
350 #endif
351 
353 
354  protected:
357  virtual void
359  { }
360 
361 
362  private:
364  //RCP< Epetra_IntVector > vec_;
365 
366  }; // class EpetraIntVectorT
367 
368  // specialization on GO=int and Node=Serial
369 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
370  template<>
372  : public virtual Vector<int,int,int,EpetraNode>
373  {
374  typedef int Scalar;
375  typedef int LocalOrdinal;
376  typedef int GlobalOrdinal;
377  typedef EpetraNode Node;
378 
379  public:
380 
382 
383 
385  explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut=true)
386  {
387  vec_ = rcp(new Epetra_IntVector(toEpetra<GlobalOrdinal,Node>(map), zeroOut));
388  }
389 
392 
394 
396 
397 
399  int dot(const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &/* a */) const { XPETRA_MONITOR("EpetraIntVectorT::dot"); TEUCHOS_TEST_FOR_EXCEPTION(-1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
400 
401 
403  Teuchos::ScalarTraits<int>::magnitudeType norm1() const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
404 
405 
407  Teuchos::ScalarTraits<int>::magnitudeType norm2() const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
408 
410  Teuchos::ScalarTraits<int>::magnitudeType normInf() const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
411 
413  int meanValue() const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); TEUCHOS_UNREACHABLE_RETURN(-1); }
414 
416  int maxValue() const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); return vec_->MaxValue(); }
417 
418 
420 
422 
423 
425  void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
426 
428  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
429 
431  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");(*vec_)[myRow] = value; }
432 
434  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); (*vec_)[myRow] += value;}
435 
437  void putScalar(const int &value) { vec_->PutValue(value); }
438 
440  void randomize(bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
441 
442 
444 
445  void setSeed(unsigned int /* seed */) { XPETRA_MONITOR("EpetraIntVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra"); }
446 
447 
449 
451 
452 
454  Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t /* j */) const {
455  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
456  }
457 
459  Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t /* j */) {
460  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
461  }
462 
465  Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
466  XPETRA_MONITOR("EpetraIntVectorT::getData");
467 
468  int * data = vec_->Values();
469  int localLength = vec_->MyLength();
470 
471  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
472  }
473 
476  Teuchos::ArrayRCP<int> getDataNonConst(size_t /* j */) {
477  XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
478 
479  int * data = vec_->Values();
480  int localLength = vec_->MyLength();
481 
482  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
483  }
484 
486 
488 
489  void dot(const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const Teuchos::ArrayView<int> &/* dots */) const {
491  XPETRA_MONITOR("EpetraIntVectorT::dot");
492 
493  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
494  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
495  }
496 
499  XPETRA_MONITOR("EpetraIntVectorT::abs");
500 
501  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
502  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
503  }
504 
507  XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
508 
509  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
510  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
511  }
512 
514  void scale(const int &/* alpha */) {
515  XPETRA_MONITOR("EpetraIntVectorT::scale");
516  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
517  }
518 
520  void scale (Teuchos::ArrayView< const int > /* alpha */) {
521  XPETRA_MONITOR("EpetraIntVectorT::scale");
522  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
523  }
524 
526  void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
527  XPETRA_MONITOR("EpetraIntVectorT::update");
528 
529  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
530  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
531  }
532 
534  void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, const int &/* gamma */) {
535  XPETRA_MONITOR("EpetraIntVectorT::update");
536 
537  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
538  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
539  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
540  }
541 
543  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &/* norms */) const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
544 
546  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &/* norms */) const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
547 
549  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &/* norms */) const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
550 
552  void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
553 
555  void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
556 
558  void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, const int &/* beta */) { XPETRA_MONITOR("EpetraIntVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
559 
561  void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
562  XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
563  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
564  }
565 
567 
569 
570 
572  void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
573 
575  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
576 
578  void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
579 
581  void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
582 
584 
586 
587 
589  size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntVectorT::getNumVectors"); return 1; }
590 
591 
593  size_t getLocalLength() const { return vec_->MyLength(); }
594 
596  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
597 
600  XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
602  if(!asvec) return false;
603  auto vv = toEpetra(*asvec);
604  return ( (vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
605  }
606 
608 
610 
611 
613  std::string description() const {
614  XPETRA_MONITOR("EpetraIntVectorT::description");
615 
616  // This implementation come from Epetra_Vector_def.hpp (without modification)
617  std::ostringstream oss;
618  oss << Teuchos::Describable::description();
619  oss << "{length="<<this->getGlobalLength()
620  << "}";
621  return oss.str();
622  }
623 
625  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const {
626  XPETRA_MONITOR("EpetraIntVectorT::describe");
627 
628  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
629  using std::endl;
630  using std::setw;
631  using Teuchos::VERB_DEFAULT;
632  using Teuchos::VERB_NONE;
633  using Teuchos::VERB_LOW;
634  using Teuchos::VERB_MEDIUM;
635  using Teuchos::VERB_HIGH;
636  using Teuchos::VERB_EXTREME;
637 
638  if (verbLevel > Teuchos::VERB_NONE)
639  vec_->Print(out);
640  }
641 
643 
644  RCP< Epetra_IntVector > getEpetra_IntVector() const { return vec_; }
645 
646  const RCP<const Comm<int> > getComm() const {
647  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
648  }
649 
650  // Implementing DistObject
651  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap () const {
652  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
653  return rcp (new Xpetra::EpetraMapT<GlobalOrdinal, Node>(map));
654  }
655 
657  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
658  XPETRA_MONITOR("EpetraIntVectorT::doImport");
659 
660  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
661  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
662 
663  const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
664  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
665  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
666  }
667 
669  const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
670  XPETRA_MONITOR("EpetraIntVectorT::doExport");
671 
672  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
673  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
674 
675  const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
676  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
677  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
678  }
679 
681  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
682  XPETRA_MONITOR("EpetraIntVectorT::doImport");
683 
684  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
685  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
686 
687  const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
688  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
689  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
690  }
691 
693  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
694  XPETRA_MONITOR("EpetraIntVectorT::doExport");
695 
696  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
697  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
698 
699  const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
700  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
701  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
702  }
703 
704  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& /* map */) {
705  // do nothing
706  }
707 
708 
710 
711  #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
713 
714  typename dual_view_type::t_host_um getHostLocalView () const {
715  typedef Kokkos::View< typename dual_view_type::t_host::data_type ,
716  Kokkos::LayoutLeft,
717  typename dual_view_type::t_host::device_type ,
718  Kokkos::MemoryUnmanaged> epetra_view_type;
719 
720  // access Epetra vector data
721  int* data = NULL;
722  vec_->ExtractView(&data);
723  int localLength = vec_->MyLength();
724 
725  // create view
726  epetra_view_type test = epetra_view_type(data, localLength,1);
727  typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
728 
729  return ret;
730  }
731 
732  typename dual_view_type::t_dev_um getDeviceLocalView() const {
733  throw std::runtime_error("Epetra does not support device views!");
734 #ifndef __NVCC__ //prevent nvcc warning
735  typename dual_view_type::t_dev_um ret;
736 #endif
737  TEUCHOS_UNREACHABLE_RETURN(ret);
738  }
739 
750  template<class TargetDeviceType>
751  typename Kokkos::Impl::if_c<
752  std::is_same<
753  typename dual_view_type::t_dev_um::execution_space::memory_space,
754  typename TargetDeviceType::memory_space>::value,
755  typename dual_view_type::t_dev_um,
756  typename dual_view_type::t_host_um>::type
757  getLocalView () const {
758  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
759  }
760  #endif
761 
763 
764  protected:
767  virtual void
769  {
770  typedef EpetraIntVectorT<GlobalOrdinal, Node> this_type;
771  const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
772  TEUCHOS_TEST_FOR_EXCEPTION(
773  rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
774  "The left-hand side (LHS) of the assignment has a different type than "
775  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
776  "(which means it wraps an Epetra_IntVector), but the RHS has some "
777  "other type. This probably means that the RHS wraps either an "
778  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
779  "does not currently implement assignment from a Tpetra object to an "
780  "Epetra object, though this could be added with sufficient interest.");
781 
782  RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector ();
783  RCP<Epetra_IntVector> lhsImpl = this->getEpetra_IntVector ();
784 
785  TEUCHOS_TEST_FOR_EXCEPTION(
786  rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
787  "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
788  "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
789  "report this bug to the Xpetra developers.");
790  TEUCHOS_TEST_FOR_EXCEPTION(
791  lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
792  "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
793  "assignment has a null RCP<Epetra_IntVector> inside. Please report "
794  "this bug to the Xpetra developers.");
795 
796  // Epetra_IntVector's assignment operator does a deep copy.
797  *lhsImpl = *rhsImpl;
798  }
799 
800 
801  private:
803  RCP< Epetra_IntVector > vec_;
804  };
805 #endif
806 
807  // specialization on GO=long long and Node=Serial
808 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
809  template<>
810  class EpetraIntVectorT<long long, EpetraNode>
811  : public virtual Vector<int,int,long long,EpetraNode>
812  {
813  typedef int Scalar;
814  typedef int LocalOrdinal;
815  typedef long long GlobalOrdinal;
816  typedef EpetraNode Node;
817 
818  public:
819 
821 
822 
824  explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut=true)
825  {
826  vec_ = rcp(new Epetra_IntVector(toEpetra<GlobalOrdinal,Node>(map), zeroOut));
827  }
828 
831 
833 
835 
836 
838  int dot(const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &/* a */) const { XPETRA_MONITOR("EpetraIntVectorT::dot"); TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */ }
839 
840 
842  Teuchos::ScalarTraits<int>::magnitudeType norm1() const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */ }
843 
844 
846  Teuchos::ScalarTraits<int>::magnitudeType norm2() const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */ }
847 
849  Teuchos::ScalarTraits<int>::magnitudeType normInf() const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */ }
850 
852  int meanValue() const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */ }
853 
855  int maxValue() const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); return Teuchos::as<int>(vec_->MaxValue()); }
856 
858 
860 
861 
863  void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
864 
866  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
867 
869  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");(*vec_)[myRow] = value;}
870 
872  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); (*vec_)[myRow] += value;}
873 
875  void putScalar(const int &value) { vec_->PutValue(value); }
876 
878  void randomize(bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
879 
880 
882 
883  void setSeed(unsigned int /* seed */) { XPETRA_MONITOR("EpetraIntVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra"); }
884 
885 
887 
889 
890 
892  Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t /* j */) const {
893  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
894  }
895 
897  Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t /* j */) {
898  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
899  }
900 
903  Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
904  XPETRA_MONITOR("EpetraIntVectorT::getData");
905 
906  int * data = vec_->Values();
907  int localLength = vec_->MyLength();
908 
909  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
910  }
911 
914  Teuchos::ArrayRCP<int> getDataNonConst(size_t /* j */) {
915  XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
916 
917  int * data = vec_->Values();
918  int localLength = vec_->MyLength();
919 
920  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
921  }
922 
924 
926 
927  void dot(const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const Teuchos::ArrayView<int> &/* dots */) const {
929  XPETRA_MONITOR("EpetraIntVectorT::dot");
930 
931  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
932  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
933  }
934 
937  XPETRA_MONITOR("EpetraIntVectorT::abs");
938 
939  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
940  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
941  }
942 
945  XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
946 
947  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
948  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
949  }
950 
952  void scale(const int &/* alpha */) {
953  XPETRA_MONITOR("EpetraIntVectorT::scale");
954  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
955  }
956 
958  void scale (Teuchos::ArrayView< const int > /* alpha */) {
959  XPETRA_MONITOR("EpetraIntVectorT::scale");
960  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
961  }
962 
964  void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
965  XPETRA_MONITOR("EpetraIntVectorT::update");
966 
967  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
968  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
969  }
970 
972  void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, const int &/* gamma */) {
973  XPETRA_MONITOR("EpetraIntVectorT::update");
974 
975  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
976  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
977  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
978  }
979 
981  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &/* norms */) const { XPETRA_MONITOR("EpetraIntVectorT::norm1"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
982 
984  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &/* norms */) const { XPETRA_MONITOR("EpetraIntVectorT::norm2"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
985 
987  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &/* norms */) const { XPETRA_MONITOR("EpetraIntVectorT::normInf"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
988 
990  void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
991 
993  void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
994 
996  void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, const int &/* beta */) { XPETRA_MONITOR("EpetraIntVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
997 
999  void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
1000  XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
1001  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
1002  }
1003 
1005 
1007 
1008 
1010  void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
1011 
1013  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
1014 
1016  void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
1017 
1019  void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
1020 
1022 
1024 
1025 
1027  size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntVectorT::getNumVectors"); return 1; }
1028 
1029 
1031  size_t getLocalLength() const { return vec_->MyLength(); }
1032 
1034  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
1035 
1036 
1039  XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
1041  if(!asvec) return false;
1042  auto vv = toEpetra(*asvec);
1043  return ( (vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
1044  }
1046 
1048 
1049 
1051  std::string description() const {
1052  XPETRA_MONITOR("EpetraIntVectorT::description");
1053 
1054  // This implementation come from Epetra_Vector_def.hpp (without modification)
1055  std::ostringstream oss;
1056  oss << Teuchos::Describable::description();
1057  oss << "{length="<<this->getGlobalLength()
1058  << "}";
1059  return oss.str();
1060  }
1061 
1063  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const {
1064  XPETRA_MONITOR("EpetraIntVectorT::describe");
1065 
1066  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
1067  using std::endl;
1068  using std::setw;
1069  using Teuchos::VERB_DEFAULT;
1070  using Teuchos::VERB_NONE;
1071  using Teuchos::VERB_LOW;
1072  using Teuchos::VERB_MEDIUM;
1073  using Teuchos::VERB_HIGH;
1074  using Teuchos::VERB_EXTREME;
1075 
1076  if (verbLevel > Teuchos::VERB_NONE)
1077  vec_->Print(out);
1078  }
1079 
1081 
1082  RCP< Epetra_IntVector > getEpetra_IntVector() const { return vec_; }
1083 
1084  const RCP<const Comm<int> > getComm() const {
1085  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1086  }
1087 
1088  // Implementing DistObject
1089  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap () const {
1090  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
1091  return rcp (new Xpetra::EpetraMapT<GlobalOrdinal, Node>(map));
1092  }
1093 
1095  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1096  XPETRA_MONITOR("EpetraIntVectorT::doImport");
1097 
1098  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1099  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1100 
1101  const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
1102  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1103  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1104  }
1105 
1107  const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
1108  XPETRA_MONITOR("EpetraIntVectorT::doExport");
1109 
1110  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1111  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1112 
1113  const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
1114  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1115  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1116  }
1117 
1119  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1120  XPETRA_MONITOR("EpetraIntVectorT::doImport");
1121 
1122  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1123  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1124 
1125  const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
1126  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1127  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1128  }
1129 
1131  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1132  XPETRA_MONITOR("EpetraIntVectorT::doExport");
1133 
1134  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1135  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1136 
1137  const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
1138  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1139  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1140  }
1141 
1142  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& /* map */) {
1143  // do nothing
1144  }
1145 
1146 
1148 
1149  #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1151 
1152  typename dual_view_type::t_host_um getHostLocalView () const {
1153  typedef Kokkos::View< typename dual_view_type::t_host::data_type ,
1154  Kokkos::LayoutLeft,
1155  typename dual_view_type::t_host::device_type ,
1156  Kokkos::MemoryUnmanaged> epetra_view_type;
1157 
1158  // access Epetra vector data
1159  int* data = NULL;
1160  vec_->ExtractView(&data);
1161  int localLength = vec_->MyLength();
1162 
1163  // create view
1164  epetra_view_type test = epetra_view_type(data, localLength, 1);
1165  typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
1166 
1167  return ret;
1168  }
1169 
1170  typename dual_view_type::t_dev_um getDeviceLocalView() const {
1171  throw std::runtime_error("Epetra does not support device views!");
1172 #ifndef __NVCC__ //prevent nvcc warning
1173  typename dual_view_type::t_dev_um ret;
1174 #endif
1175  TEUCHOS_UNREACHABLE_RETURN(ret);
1176  }
1177 
1188  template<class TargetDeviceType>
1189  typename Kokkos::Impl::if_c<
1190  std::is_same<
1191  typename dual_view_type::t_dev_um::execution_space::memory_space,
1192  typename TargetDeviceType::memory_space>::value,
1193  typename dual_view_type::t_dev_um,
1194  typename dual_view_type::t_host_um>::type
1195  getLocalView () const {
1196  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
1197  }
1198  #endif
1199 
1201 
1202  protected:
1205  virtual void
1207  {
1208  typedef EpetraIntVectorT<GlobalOrdinal, Node> this_type;
1209  const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
1210  TEUCHOS_TEST_FOR_EXCEPTION(
1211  rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
1212  "The left-hand side (LHS) of the assignment has a different type than "
1213  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
1214  "(which means it wraps an Epetra_IntVector), but the RHS has some "
1215  "other type. This probably means that the RHS wraps either an "
1216  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1217  "does not currently implement assignment from a Tpetra object to an "
1218  "Epetra object, though this could be added with sufficient interest.");
1219 
1220  RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector ();
1221  RCP<Epetra_IntVector> lhsImpl = this->getEpetra_IntVector ();
1222 
1223  TEUCHOS_TEST_FOR_EXCEPTION(
1224  rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1225  "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
1226  "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
1227  "report this bug to the Xpetra developers.");
1228  TEUCHOS_TEST_FOR_EXCEPTION(
1229  lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1230  "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
1231  "assignment has a null RCP<Epetra_IntVector> inside. Please report "
1232  "this bug to the Xpetra developers.");
1233 
1234  // Epetra_IntVector's assignment operator does a deep copy.
1235  *lhsImpl = *rhsImpl;
1236  }
1237 
1238 
1239  private:
1241  RCP< Epetra_IntVector > vec_;
1242  };
1243 #endif
1244 
1245 
1246 } // namespace Xpetra
1247 
1248 #endif // XPETRA_EPETRAINTVECTOR_HPP
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
std::string description() const
Return a simple one-line description of this object.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
TODO missing comment.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
Teuchos::ArrayRCP< const int > getData(size_t j) const
void scale(Teuchos::ArrayView< const int > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void meanValue(const Teuchos::ArrayView< int > &means) const
Compute mean (average) value of each vector in multi-vector.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
int meanValue() const
Compute mean (average) value of this Vector.
Teuchos::ArrayRCP< const int > getData(size_t) const
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void update(const int &alpha, const MultiVector< int, int, GlobalOrdinal, Node > &A, const int &beta, const MultiVector< int, int, GlobalOrdinal, Node > &B, const int &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
Teuchos::ArrayRCP< int > getDataNonConst(size_t)
void randomize(bool=true)
Set multi-vector values to random numbers.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
const RCP< const Comm< int > > getComm() const
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 2-norm of each vector in multi-vector.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
void setSeed(unsigned int)
Set seed for Random function.
void randomize(bool=true)
Set multi-vector values to random numbers.
void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
void update(const int &alpha, const MultiVector< int, int, GlobalOrdinal, Node > &A, const int &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
void elementWiseMultiply(int scalarAB, const Vector< int, int, GlobalOrdinal, Node > &A, const MultiVector< int, int, GlobalOrdinal, Node > &B, int scalarThis)
Element-wise multiply of a Vector A with a EpetraMultiVector B.
int meanValue() const
Compute mean (average) value of this Vector.
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &)
void sumIntoGlobalValue(GlobalOrdinal, const Scalar &)
Adds specified value to existing value at the specified location.
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
int meanValue() const
Compute mean (average) value of this Vector.
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
int maxValue() const
Compute max value of this Vector.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
void reciprocal(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
const RCP< const Comm< int > > getComm() const
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void reciprocal(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
std::string description() const
Return a simple one-line description of this object.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
void reciprocal(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void maxValue(const Teuchos::ArrayView< int > &maxs) const
Compute max value of each vector in multi-vector.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
Teuchos::ArrayRCP< const int > getData(size_t) const
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void randomize(bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
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 norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
Exception throws when you call an unimplemented method of Xpetra.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
TODO missing comment.
void replaceGlobalValue(GlobalOrdinal, const Scalar &)
Replace current value at the specified location with specified value.
void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
RCP< Epetra_IntVector > getEpetra_IntVector() const
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &)
size_t global_size_t
Global size_t object.
int maxValue() const
Compute max value of this Vector.
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const int &alpha, const MultiVector< int, int, GlobalOrdinal, Node > &A, const MultiVector< int, int, GlobalOrdinal, Node > &B, const int &beta)
Matrix-Matrix multiplication, this = beta*this + alpha*op(A)*op(B).
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
RCP< Epetra_IntVector > getEpetra_IntVector() const
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void setSeed(unsigned int)
Set seed for Random function.
void multiply(Teuchos::ETransp, Teuchos::ETransp, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Matrix-Matrix multiplication, this = beta*this + alpha*op(A)*op(B).
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.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
int maxValue() const
Compute max value of this Vector.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void setSeed(unsigned int seed)
Set seed for Random function.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void replaceGlobalValue(GlobalOrdinal, const Scalar &)
Replace current value at the specified location with specified value.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void sumIntoGlobalValue(GlobalOrdinal, const Scalar &)
Adds specified value to existing value at the specified location.
void elementWiseMultiply(int, const Vector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, int)
Element-wise multiply of a Vector A with a EpetraMultiVector B.
Teuchos::ArrayRCP< int > getDataNonConst(size_t j)
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
CombineMode
Xpetra::Combine Mode enumerable type.
void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
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.
#define XPETRA_MONITOR(funcName)
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
TODO missing comment.
void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
void elementWiseMultiply(int, const Vector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, int)
Element-wise multiply of a Vector A with a EpetraMultiVector B.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
virtual size_t getNumVectors() const =0
Number of columns in the multivector.
void scale(const int &alpha)
Scale the current values of a multi-vector, this = alpha*this.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
void multiply(Teuchos::ETransp, Teuchos::ETransp, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Matrix-Matrix multiplication, this = beta*this + alpha*op(A)*op(B).
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
std::string description() const
Return a simple one-line description of this object.