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 #if defined(XPETRA_ENABLE_DEPRECATED_CODE)
61 #ifdef __GNUC__
62 #warning "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp is deprecated."
63 #endif
64 #else
65 #error "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp is deprecated."
66 #endif
67 
68 namespace Xpetra {
69 
70 // TODO: move that elsewhere
71 template <class GlobalOrdinal, class Node>
72 XPETRA_DEPRECATED Epetra_IntVector &toEpetra(Vector<int, int, GlobalOrdinal, Node> &);
73 
74 template <class GlobalOrdinal, class Node>
75 const XPETRA_DEPRECATED Epetra_IntVector &toEpetra(const Vector<int, int, GlobalOrdinal, Node> &);
76 //
77 
78 // stub implementation for EpetraIntVectorT
79 template <class EpetraGlobalOrdinal, class Node>
80 class XPETRA_DEPRECATED EpetraIntVectorT
81  : public Vector<int, int, EpetraGlobalOrdinal, Node> {
82  typedef int Scalar;
83  typedef int LocalOrdinal;
84  typedef EpetraGlobalOrdinal GlobalOrdinal;
85 
86  public:
88 
89 
91  explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut = true) {}
92 
95 
97 
99 
100 
103  XPETRA_MONITOR("EpetraIntVectorT::dot");
104  TEUCHOS_TEST_FOR_EXCEPTION(-1, Xpetra::Exceptions::NotImplemented, "TODO");
105  TEUCHOS_UNREACHABLE_RETURN(-1);
106  }
107 
109  Teuchos::ScalarTraits<int>::magnitudeType norm1() const {
110  XPETRA_MONITOR("EpetraIntVectorT::norm1");
111  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
112  TEUCHOS_UNREACHABLE_RETURN(-1);
113  }
114 
116  Teuchos::ScalarTraits<int>::magnitudeType norm2() const {
117  XPETRA_MONITOR("EpetraIntVectorT::norm2");
118  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
119  TEUCHOS_UNREACHABLE_RETURN(-1);
120  }
121 
123  Teuchos::ScalarTraits<int>::magnitudeType normInf() const {
124  XPETRA_MONITOR("EpetraIntVectorT::normInf");
125  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
126  TEUCHOS_UNREACHABLE_RETURN(-1);
127  }
128 
130  int meanValue() const {
131  XPETRA_MONITOR("EpetraIntVectorT::meanValue");
132  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
133  TEUCHOS_UNREACHABLE_RETURN(-1);
134  }
135 
137  int maxValue() const {
138  XPETRA_MONITOR("EpetraIntVectorT::maxValue");
139  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
140  TEUCHOS_UNREACHABLE_RETURN(-1);
141  }
142 
144 
146 
147 
149  void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {
150  XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
151  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
152  }
153 
155  void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {
156  XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
157  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
158  }
159 
161  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {
162  XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
163  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
164  }
165 
167  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {
168  XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
169  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
170  }
171 
173  void putScalar(const int &value) {}
174 
176  void randomize(bool bUseXpetraImplementation = true) {
177  XPETRA_MONITOR("EpetraIntVectorT::randomize");
178  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
179  }
180 
182  void randomize(const Scalar & /*minVal*/, const Scalar & /*maxVal*/, bool bUseXpetraImplementation = true) {
183  XPETRA_MONITOR("EpetraIntVectorT::randomize");
184  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
185  }
186 
188 
189  void setSeed(unsigned int seed) {
190  XPETRA_MONITOR("EpetraIntVectorT::setSeed");
191  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra");
192  }
193 
195 
197 
198 
200  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t j) const {
201  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
202  }
203 
205  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t j) {
206  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
207  }
208 
211  Teuchos::ArrayRCP<const int> getData(size_t j) const { return Teuchos::ArrayRCP<const int>(); }
212 
215  Teuchos::ArrayRCP<int> getDataNonConst(size_t j) { return Teuchos::ArrayRCP<int>(); }
216 
218 
220 
221  void dot(const MultiVector<int, int, GlobalOrdinal, Node> &A, const Teuchos::ArrayView<int> &dots) const {}
223 
226 
229 
231  void scale(const int &alpha) {}
232 
234  void scale(Teuchos::ArrayView<const int> alpha) {
235  XPETRA_MONITOR("EpetraIntVectorT::scale");
236  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
237  }
238 
240  void update(const int &alpha, const MultiVector<int, int, GlobalOrdinal, Node> &A, const int &beta) {
241  XPETRA_MONITOR("EpetraIntVectorT::update");
242 
243  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
244  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
245  }
246 
248  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) {
249  XPETRA_MONITOR("EpetraIntVectorT::update");
250 
251  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
252  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
253  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
254  }
255 
257  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const {
258  XPETRA_MONITOR("EpetraIntVectorT::norm1");
259  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
260  }
261 
263  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const {
264  XPETRA_MONITOR("EpetraIntVectorT::norm2");
265  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
266  }
267 
269  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const {
270  XPETRA_MONITOR("EpetraIntVectorT::normInf");
271  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
272  }
273 
275  void meanValue(const Teuchos::ArrayView<int> &means) const {
276  XPETRA_MONITOR("EpetraIntVectorT::meanValue");
277  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
278  }
279 
281  void maxValue(const Teuchos::ArrayView<int> &maxs) const {
282  XPETRA_MONITOR("EpetraIntVectorT::maxValue");
283  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
284  }
285 
287  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) {
288  XPETRA_MONITOR("EpetraIntVectorT::multiply");
289  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra");
290  }
291 
294  XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
295  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
296  }
297 
299 
301 
302 
304  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
305  XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
306  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
307  }
308 
310  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
311  XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
312  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
313  }
314 
316  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
317  XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
318  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
319  }
320 
322  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
323  XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
324  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
325  }
326 
328 
330 
331 
333  size_t getNumVectors() const {
334  XPETRA_MONITOR("EpetraIntVectorT::getNumVectors");
335  return 1;
336  }
337 
339  size_t getLocalLength() const { return 0; }
340 
342  global_size_t getGlobalLength() const { return 0; }
343 
346 
348 
350 
351 
353  std::string description() const {
354  return std::string("");
355  }
356 
358  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
359 
361 
362  RCP<Epetra_IntVector> getEpetra_IntVector() const { return Teuchos::null; }
363 
364  const RCP<const Comm<int> > getComm() const {
365  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
366  }
367 
368  // Implementing DistObject
369  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap() const {
370  return Teuchos::null;
371  }
372 
374  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {}
375 
377  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {}
378 
380  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {}
381 
383  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {}
384 
385  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > &map) {
386  // do nothing
387  }
388 
389  protected:
392  virtual void
394 
395  private:
397  // RCP< Epetra_IntVector > vec_;
398 
399 }; // class EpetraIntVectorT
400 
401 // specialization on GO=int and Node=Serial
402 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
403 template <>
405  : public virtual Vector<int, int, int, EpetraNode> {
406  typedef int Scalar;
407  typedef int LocalOrdinal;
408  typedef int GlobalOrdinal;
409  typedef EpetraNode Node;
410 
411  public:
413 
414 
416  explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut = true) {
417  vec_ = rcp(new Epetra_IntVector(toEpetra<GlobalOrdinal, Node>(map), zeroOut));
418  }
419 
422 
424 
426 
427 
430  XPETRA_MONITOR("EpetraIntVectorT::dot");
431  TEUCHOS_TEST_FOR_EXCEPTION(-1, Xpetra::Exceptions::NotImplemented, "TODO");
432  TEUCHOS_UNREACHABLE_RETURN(-1);
433  }
434 
436  Teuchos::ScalarTraits<int>::magnitudeType norm1() const {
437  XPETRA_MONITOR("EpetraIntVectorT::norm1");
438  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
439  TEUCHOS_UNREACHABLE_RETURN(-1);
440  }
441 
443  Teuchos::ScalarTraits<int>::magnitudeType norm2() const {
444  XPETRA_MONITOR("EpetraIntVectorT::norm2");
445  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
446  TEUCHOS_UNREACHABLE_RETURN(-1);
447  }
448 
450  Teuchos::ScalarTraits<int>::magnitudeType normInf() const {
451  XPETRA_MONITOR("EpetraIntVectorT::normInf");
452  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
453  TEUCHOS_UNREACHABLE_RETURN(-1);
454  }
455 
457  int meanValue() const {
458  XPETRA_MONITOR("EpetraIntVectorT::meanValue");
459  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
460  TEUCHOS_UNREACHABLE_RETURN(-1);
461  }
462 
464  int maxValue() const {
465  XPETRA_MONITOR("EpetraIntVectorT::maxValue");
466  return vec_->MaxValue();
467  }
468 
470 
472 
473 
475  void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
476  XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
477  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
478  }
479 
481  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
482  XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
483  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
484  }
485 
487  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {
488  XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
489  (*vec_)[myRow] = value;
490  }
491 
493  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {
494  XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
495  (*vec_)[myRow] += value;
496  }
497 
499  void putScalar(const int &value) { vec_->PutValue(value); }
500 
502  void randomize(bool /* bUseXpetraImplementation */ = true) {
503  XPETRA_MONITOR("EpetraIntVectorT::randomize");
504  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
505  }
506 
508  void randomize(const Scalar & /*minVal*/, const Scalar & /*maxVal*/, bool /* bUseXpetraImplementation */ = true) {
509  XPETRA_MONITOR("EpetraIntVectorT::randomize");
510  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
511  }
512 
514 
515  void setSeed(unsigned int /* seed */) {
516  XPETRA_MONITOR("EpetraIntVectorT::setSeed");
517  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra");
518  }
519 
521 
522  typename dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const override { return getHostLocalView(Access::ReadWrite); }
523 
524  typename dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const override { return getDeviceLocalView(Access::ReadWrite); }
525 
526  typename dual_view_type::t_host_um getHostLocalView(Access::OverwriteAllStruct) const override { return getHostLocalView(Access::ReadWrite); }
527 
528  typename dual_view_type::t_dev_um getDeviceLocalView(Access::OverwriteAllStruct) const override { return getDeviceLocalView(Access::ReadWrite); }
529 
530  typename dual_view_type::t_host_um getHostLocalView(Access::ReadWriteStruct) const override {
531  typedef Kokkos::View<typename dual_view_type::t_host::data_type,
532  Kokkos::LayoutLeft,
533  typename dual_view_type::t_host::device_type,
534  Kokkos::MemoryUnmanaged>
535  epetra_view_type;
536  // access Epetra vector data
537  Scalar *data = NULL;
538  vec_->ExtractView(&data);
539  int localLength = vec_->MyLength();
540 
541  // create view
542  epetra_view_type test = epetra_view_type(data, localLength, 1);
543  typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
544  return ret;
545  }
546 
547  typename dual_view_type::t_dev_um getDeviceLocalView(Access::ReadWriteStruct) const override { return getHostLocalView(Access::ReadWrite); }
548 
550 
552 
553 
555  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t /* j */) const {
556  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
557  }
558 
560  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t /* j */) {
561  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
562  }
563 
566  Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
567  XPETRA_MONITOR("EpetraIntVectorT::getData");
568 
569  int *data = vec_->Values();
570  int localLength = vec_->MyLength();
571 
572  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
573  }
574 
577  Teuchos::ArrayRCP<int> getDataNonConst(size_t /* j */) {
578  XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
579 
580  int *data = vec_->Values();
581  int localLength = vec_->MyLength();
582 
583  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
584  }
585 
587 
589 
590  void dot(const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const Teuchos::ArrayView<int> & /* dots */) const {
592  XPETRA_MONITOR("EpetraIntVectorT::dot");
593 
594  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
595  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
596  }
597 
600  XPETRA_MONITOR("EpetraIntVectorT::abs");
601 
602  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
603  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
604  }
605 
608  XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
609 
610  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
611  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
612  }
613 
615  void scale(const int & /* alpha */) {
616  XPETRA_MONITOR("EpetraIntVectorT::scale");
617  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
618  }
619 
621  void scale(Teuchos::ArrayView<const int> /* alpha */) {
622  XPETRA_MONITOR("EpetraIntVectorT::scale");
623  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
624  }
625 
627  void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
628  XPETRA_MONITOR("EpetraIntVectorT::update");
629 
630  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
631  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
632  }
633 
635  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 */) {
636  XPETRA_MONITOR("EpetraIntVectorT::update");
637 
638  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
639  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
640  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
641  }
642 
644  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
645  XPETRA_MONITOR("EpetraIntVectorT::norm1");
646  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
647  }
648 
650  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
651  XPETRA_MONITOR("EpetraIntVectorT::norm2");
652  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
653  }
654 
656  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
657  XPETRA_MONITOR("EpetraIntVectorT::normInf");
658  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
659  }
660 
662  void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
663  XPETRA_MONITOR("EpetraIntVectorT::meanValue");
664  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
665  }
666 
668  void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
669  XPETRA_MONITOR("EpetraIntVectorT::maxValue");
670  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
671  }
672 
674  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 */) {
675  XPETRA_MONITOR("EpetraIntVectorT::multiply");
676  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra");
677  }
678 
680  void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
681  XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
682  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
683  }
684 
686 
688 
689 
691  void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
692  XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
693  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
694  }
695 
697  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
698  XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
699  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
700  }
701 
703  void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
704  XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
705  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
706  }
707 
709  void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
710  XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
711  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
712  }
713 
715 
717 
718 
720  size_t getNumVectors() const {
721  XPETRA_MONITOR("EpetraIntVectorT::getNumVectors");
722  return 1;
723  }
724 
726  size_t getLocalLength() const { return vec_->MyLength(); }
727 
729  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
730 
733  XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
735  if (!asvec) return false;
736  auto vv = toEpetra(*asvec);
737  return ((vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
738  }
739 
741 
743 
744 
746  std::string description() const {
747  XPETRA_MONITOR("EpetraIntVectorT::description");
748 
749  // This implementation come from Epetra_Vector_def.hpp (without modification)
750  std::ostringstream oss;
751  oss << Teuchos::Describable::description();
752  oss << "{length=" << this->getGlobalLength()
753  << "}";
754  return oss.str();
755  }
756 
758  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {
759  XPETRA_MONITOR("EpetraIntVectorT::describe");
760 
761  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
762  using std::endl;
763  using std::setw;
764  using Teuchos::VERB_DEFAULT;
765  using Teuchos::VERB_EXTREME;
766  using Teuchos::VERB_HIGH;
767  using Teuchos::VERB_LOW;
768  using Teuchos::VERB_MEDIUM;
769  using Teuchos::VERB_NONE;
770 
771  if (verbLevel > Teuchos::VERB_NONE)
772  vec_->Print(out);
773  }
774 
776 
777  RCP<Epetra_IntVector> getEpetra_IntVector() const { return vec_; }
778 
779  const RCP<const Comm<int> > getComm() const {
780  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
781  }
782 
783  // Implementing DistObject
784  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap() const {
785  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
786  return rcp(new Xpetra::EpetraMapT<GlobalOrdinal, Node>(map));
787  }
788 
790  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
791  XPETRA_MONITOR("EpetraIntVectorT::doImport");
792 
793  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
794  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
795 
796  const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
797  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
798  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
799  }
800 
802  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
803  XPETRA_MONITOR("EpetraIntVectorT::doExport");
804 
805  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
806  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
807 
808  const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
809  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
810  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
811  }
812 
814  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
815  XPETRA_MONITOR("EpetraIntVectorT::doImport");
816 
817  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
818  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
819 
820  const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
821  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
822  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
823  }
824 
826  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
827  XPETRA_MONITOR("EpetraIntVectorT::doExport");
828 
829  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
830  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
831 
832  const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
833  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
834  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
835  }
836 
837  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > & /* map */) {
838  // do nothing
839  }
840 
841  protected:
844  virtual void
846  typedef EpetraIntVectorT<GlobalOrdinal, Node> this_type;
847  const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
848  TEUCHOS_TEST_FOR_EXCEPTION(
849  rhsPtr == NULL, std::invalid_argument,
850  "Xpetra::MultiVector::operator=: "
851  "The left-hand side (LHS) of the assignment has a different type than "
852  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
853  "(which means it wraps an Epetra_IntVector), but the RHS has some "
854  "other type. This probably means that the RHS wraps either an "
855  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
856  "does not currently implement assignment from a Tpetra object to an "
857  "Epetra object, though this could be added with sufficient interest.");
858 
859  RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector();
860  RCP<Epetra_IntVector> lhsImpl = this->getEpetra_IntVector();
861 
862  TEUCHOS_TEST_FOR_EXCEPTION(
863  rhsImpl.is_null(), std::logic_error,
864  "Xpetra::MultiVector::operator= "
865  "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
866  "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
867  "report this bug to the Xpetra developers.");
868  TEUCHOS_TEST_FOR_EXCEPTION(
869  lhsImpl.is_null(), std::logic_error,
870  "Xpetra::MultiVector::operator= "
871  "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
872  "assignment has a null RCP<Epetra_IntVector> inside. Please report "
873  "this bug to the Xpetra developers.");
874 
875  // Epetra_IntVector's assignment operator does a deep copy.
876  *lhsImpl = *rhsImpl;
877  }
878 
879  private:
881  RCP<Epetra_IntVector> vec_;
882 };
883 #endif
884 
885 // specialization on GO=long long and Node=Serial
886 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
887 template <>
888 class EpetraIntVectorT<long long, EpetraNode>
889  : public virtual Vector<int, int, long long, EpetraNode> {
890  typedef int Scalar;
891  typedef int LocalOrdinal;
892  typedef long long GlobalOrdinal;
893  typedef EpetraNode Node;
894 
895  public:
897 
898 
900  explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut = true) {
901  vec_ = rcp(new Epetra_IntVector(toEpetra<GlobalOrdinal, Node>(map), zeroOut));
902  }
903 
906 
908 
910 
911 
914  XPETRA_MONITOR("EpetraIntVectorT::dot");
915  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */
916  }
917 
919  Teuchos::ScalarTraits<int>::magnitudeType norm1() const {
920  XPETRA_MONITOR("EpetraIntVectorT::norm1");
921  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */
922  }
923 
925  Teuchos::ScalarTraits<int>::magnitudeType norm2() const {
926  XPETRA_MONITOR("EpetraIntVectorT::norm2");
927  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */
928  }
929 
931  Teuchos::ScalarTraits<int>::magnitudeType normInf() const {
932  XPETRA_MONITOR("EpetraIntVectorT::normInf");
933  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */
934  }
935 
937  int meanValue() const {
938  XPETRA_MONITOR("EpetraIntVectorT::meanValue");
939  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */
940  }
941 
943  int maxValue() const {
944  XPETRA_MONITOR("EpetraIntVectorT::maxValue");
945  return Teuchos::as<int>(vec_->MaxValue());
946  }
947 
949 
951 
952 
954  void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
955  XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
956  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
957  }
958 
960  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
961  XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
962  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
963  }
964 
966  void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {
967  XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
968  (*vec_)[myRow] = value;
969  }
970 
972  void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {
973  XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
974  (*vec_)[myRow] += value;
975  }
976 
978  void putScalar(const int &value) { vec_->PutValue(value); }
979 
981  void randomize(bool /* bUseXpetraImplementation */ = true) {
982  XPETRA_MONITOR("EpetraIntVectorT::randomize");
983  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
984  }
985 
987  void randomize(const Scalar & /*minVal*/, const Scalar & /*maxVal*/, bool /* bUseXpetraImplementation */ = true) {
988  XPETRA_MONITOR("EpetraIntVectorT::randomize");
989  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
990  }
991 
993 
994  void setSeed(unsigned int /* seed */) {
995  XPETRA_MONITOR("EpetraIntVectorT::setSeed");
996  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra");
997  }
998 
1000 
1002 
1003 
1005  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t /* j */) const {
1006  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1007  }
1008 
1010  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t /* j */) {
1011  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1012  }
1013 
1016  Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
1017  XPETRA_MONITOR("EpetraIntVectorT::getData");
1018 
1019  int *data = vec_->Values();
1020  int localLength = vec_->MyLength();
1021 
1022  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
1023  }
1024 
1027  Teuchos::ArrayRCP<int> getDataNonConst(size_t /* j */) {
1028  XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
1029 
1030  int *data = vec_->Values();
1031  int localLength = vec_->MyLength();
1032 
1033  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
1034  }
1035 
1037 
1039 
1040  void dot(const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const Teuchos::ArrayView<int> & /* dots */) const {
1042  XPETRA_MONITOR("EpetraIntVectorT::dot");
1043 
1044  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1045  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1046  }
1047 
1050  XPETRA_MONITOR("EpetraIntVectorT::abs");
1051 
1052  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1053  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1054  }
1055 
1058  XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
1059 
1060  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1061  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1062  }
1063 
1065  void scale(const int & /* alpha */) {
1066  XPETRA_MONITOR("EpetraIntVectorT::scale");
1067  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1068  }
1069 
1071  void scale(Teuchos::ArrayView<const int> /* alpha */) {
1072  XPETRA_MONITOR("EpetraIntVectorT::scale");
1073  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1074  }
1075 
1077  void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
1078  XPETRA_MONITOR("EpetraIntVectorT::update");
1079 
1080  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1081  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1082  }
1083 
1085  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 */) {
1086  XPETRA_MONITOR("EpetraIntVectorT::update");
1087 
1088  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1089  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1090  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1091  }
1092 
1094  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
1095  XPETRA_MONITOR("EpetraIntVectorT::norm1");
1096  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1097  }
1098 
1100  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
1101  XPETRA_MONITOR("EpetraIntVectorT::norm2");
1102  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1103  }
1104 
1106  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
1107  XPETRA_MONITOR("EpetraIntVectorT::normInf");
1108  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1109  }
1110 
1112  void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
1113  XPETRA_MONITOR("EpetraIntVectorT::meanValue");
1114  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1115  }
1116 
1118  void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
1119  XPETRA_MONITOR("EpetraIntVectorT::maxValue");
1120  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1121  }
1122 
1124  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 */) {
1125  XPETRA_MONITOR("EpetraIntVectorT::multiply");
1126  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra");
1127  }
1128 
1130  void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
1131  XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
1132  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
1133  }
1134 
1136 
1138 
1139 
1141  void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1142  XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
1143  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1144  }
1145 
1147  void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1148  XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
1149  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1150  }
1151 
1153  void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1154  XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
1155  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1156  }
1157 
1159  void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1160  XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
1161  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1162  }
1163 
1165 
1167 
1168 
1170  size_t getNumVectors() const {
1171  XPETRA_MONITOR("EpetraIntVectorT::getNumVectors");
1172  return 1;
1173  }
1174 
1176  size_t getLocalLength() const { return vec_->MyLength(); }
1177 
1179  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
1180 
1183  XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
1185  if (!asvec) return false;
1186  auto vv = toEpetra(*asvec);
1187  return ((vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
1188  }
1190 
1192 
1193 
1195  std::string description() const {
1196  XPETRA_MONITOR("EpetraIntVectorT::description");
1197 
1198  // This implementation come from Epetra_Vector_def.hpp (without modification)
1199  std::ostringstream oss;
1200  oss << Teuchos::Describable::description();
1201  oss << "{length=" << this->getGlobalLength()
1202  << "}";
1203  return oss.str();
1204  }
1205 
1207  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {
1208  XPETRA_MONITOR("EpetraIntVectorT::describe");
1209 
1210  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
1211  using std::endl;
1212  using std::setw;
1213  using Teuchos::VERB_DEFAULT;
1214  using Teuchos::VERB_EXTREME;
1215  using Teuchos::VERB_HIGH;
1216  using Teuchos::VERB_LOW;
1217  using Teuchos::VERB_MEDIUM;
1218  using Teuchos::VERB_NONE;
1219 
1220  if (verbLevel > Teuchos::VERB_NONE)
1221  vec_->Print(out);
1222  }
1223 
1225 
1226  RCP<Epetra_IntVector> getEpetra_IntVector() const { return vec_; }
1227 
1228  const RCP<const Comm<int> > getComm() const {
1229  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1230  }
1231 
1232  // Implementing DistObject
1233  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap() const {
1234  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
1235  return rcp(new Xpetra::EpetraMapT<GlobalOrdinal, Node>(map));
1236  }
1237 
1239  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1240  XPETRA_MONITOR("EpetraIntVectorT::doImport");
1241 
1242  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1243  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1244 
1245  const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
1246  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1247  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1248  }
1249 
1251  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1252  XPETRA_MONITOR("EpetraIntVectorT::doExport");
1253 
1254  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1255  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1256 
1257  const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
1258  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1259  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1260  }
1261 
1263  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1264  XPETRA_MONITOR("EpetraIntVectorT::doImport");
1265 
1266  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1267  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1268 
1269  const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
1270  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1271  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1272  }
1273 
1275  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1276  XPETRA_MONITOR("EpetraIntVectorT::doExport");
1277 
1278  XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1279  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1280 
1281  const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
1282  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1283  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1284  }
1285 
1286  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > & /* map */) {
1287  // do nothing
1288  }
1289 
1290  protected:
1293  virtual void
1295  typedef EpetraIntVectorT<GlobalOrdinal, Node> this_type;
1296  const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
1297  TEUCHOS_TEST_FOR_EXCEPTION(
1298  rhsPtr == NULL, std::invalid_argument,
1299  "Xpetra::MultiVector::operator=: "
1300  "The left-hand side (LHS) of the assignment has a different type than "
1301  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
1302  "(which means it wraps an Epetra_IntVector), but the RHS has some "
1303  "other type. This probably means that the RHS wraps either an "
1304  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1305  "does not currently implement assignment from a Tpetra object to an "
1306  "Epetra object, though this could be added with sufficient interest.");
1307 
1308  RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector();
1309  RCP<Epetra_IntVector> lhsImpl = this->getEpetra_IntVector();
1310 
1311  TEUCHOS_TEST_FOR_EXCEPTION(
1312  rhsImpl.is_null(), std::logic_error,
1313  "Xpetra::MultiVector::operator= "
1314  "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
1315  "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
1316  "report this bug to the Xpetra developers.");
1317  TEUCHOS_TEST_FOR_EXCEPTION(
1318  lhsImpl.is_null(), std::logic_error,
1319  "Xpetra::MultiVector::operator= "
1320  "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
1321  "assignment has a null RCP<Epetra_IntVector> inside. Please report "
1322  "this bug to the Xpetra developers.");
1323 
1324  // Epetra_IntVector's assignment operator does a deep copy.
1325  *lhsImpl = *rhsImpl;
1326  }
1327 
1328  private:
1330  RCP<Epetra_IntVector> vec_;
1331 };
1332 #endif
1333 
1334 } // namespace Xpetra
1335 
1336 #endif // XPETRA_EPETRAINTVECTOR_HPP
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::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.
RCP< Epetra_IntVector > getEpetra_IntVector() const
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.
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
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.
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
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.
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.
dual_view_type::t_host_um getHostLocalView(Access::OverwriteAllStruct) const override
dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const override
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.
dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const override
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.
Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
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.
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).
void randomize(const Scalar &, const Scalar &, bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) 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].
dual_view_type::t_dev_um getDeviceLocalView(Access::ReadWriteStruct) const override
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.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
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.
dual_view_type::t_host_um getHostLocalView(Access::ReadWriteStruct) const override
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.
void randomize(const Scalar &, const Scalar &, bool=true)
Set multi-vector values to random numbers.
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)
#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.
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.
int maxValue() const
Compute max value of this Vector.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
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 randomize(const Scalar &, const Scalar &, bool=true)
Set multi-vector values to random numbers.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
dual_view_type::t_dev_um getDeviceLocalView(Access::OverwriteAllStruct) const override
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.
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
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)
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.
constexpr struct ReadWriteStruct ReadWrite
#define XPETRA_MONITOR(funcName)
virtual dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const
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.
RCP< Epetra_IntVector > getEpetra_IntVector() const
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
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.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
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.