Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_EpetraIntVector.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Xpetra: A linear algebra interface package
4//
5// Copyright 2012 NTESS and the Xpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef XPETRA_EPETRAINTVECTOR_HPP
11#define XPETRA_EPETRAINTVECTOR_HPP
12
14
15#include "Xpetra_ConfigDefs.hpp"
16#include "Xpetra_MultiVector.hpp"
17#include "Xpetra_Vector.hpp"
18#include "Xpetra_Exceptions.hpp"
19
20#include "Xpetra_EpetraMap.hpp"
22#include "Epetra_IntVector.h"
23
24#if defined(XPETRA_ENABLE_DEPRECATED_CODE)
25#ifdef __GNUC__
26#if defined(Xpetra_SHOW_DEPRECATED_WARNINGS)
27#warning "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp is deprecated."
28#endif
29#endif
30#else
31#error "The header file Trilinos/packages/xpetra/src/Vector/Xpetra_EpetraIntVector.hpp is deprecated."
32#endif
33
34namespace Xpetra {
35
36// TODO: move that elsewhere
37template <class GlobalOrdinal, class Node>
38XPETRA_DEPRECATED Epetra_IntVector &toEpetra(Vector<int, int, GlobalOrdinal, Node> &);
39
40template <class GlobalOrdinal, class Node>
41const XPETRA_DEPRECATED Epetra_IntVector &toEpetra(const Vector<int, int, GlobalOrdinal, Node> &);
42//
43
44// stub implementation for EpetraIntVectorT
45template <class EpetraGlobalOrdinal, class Node>
46class XPETRA_DEPRECATED EpetraIntVectorT
47 : public Vector<int, int, EpetraGlobalOrdinal, Node> {
48 typedef int Scalar;
49 typedef int LocalOrdinal;
50 typedef EpetraGlobalOrdinal GlobalOrdinal;
51
52 public:
54
55
57 explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut = true) {}
58
61
63
65
66
73
80
87
94
96 int meanValue() const {
97 XPETRA_MONITOR("EpetraIntVectorT::meanValue");
100 }
101
103 int maxValue() const {
104 XPETRA_MONITOR("EpetraIntVectorT::maxValue");
107 }
108
110
112
113
115 void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {
116 XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
118 }
119
121 void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {
122 XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
124 }
125
127 void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {
128 XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
130 }
131
133 void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {
134 XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
136 }
137
139 void putScalar(const int &value) {}
140
142 void randomize(bool bUseXpetraImplementation = true) {
143 XPETRA_MONITOR("EpetraIntVectorT::randomize");
144 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
145 }
146
148 void randomize(const Scalar & /*minVal*/, const Scalar & /*maxVal*/, bool bUseXpetraImplementation = true) {
149 XPETRA_MONITOR("EpetraIntVectorT::randomize");
150 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
151 }
152
154
155 void setSeed(unsigned int seed) {
156 XPETRA_MONITOR("EpetraIntVectorT::setSeed");
157 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra");
158 }
159
161
163
164
169
174
178
182
184
186
187
189
192
195
197 void scale(const int &alpha) {}
198
201 XPETRA_MONITOR("EpetraIntVectorT::scale");
203 }
204
206 void update(const int &alpha, const MultiVector<int, int, GlobalOrdinal, Node> &A, const int &beta) {
207 XPETRA_MONITOR("EpetraIntVectorT::update");
208
209 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
211 }
212
214 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) {
215 XPETRA_MONITOR("EpetraIntVectorT::update");
216
217 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
218 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
220 }
221
227
233
239
241 void meanValue(const Teuchos::ArrayView<int> &means) const {
242 XPETRA_MONITOR("EpetraIntVectorT::meanValue");
244 }
245
247 void maxValue(const Teuchos::ArrayView<int> &maxs) const {
248 XPETRA_MONITOR("EpetraIntVectorT::maxValue");
250 }
251
254 XPETRA_MONITOR("EpetraIntVectorT::multiply");
256 }
257
260 XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
261 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
262 }
263
265
267
268
270 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
271 XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
273 }
274
276 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
277 XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
279 }
280
282 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
283 XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
285 }
286
288 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
289 XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
291 }
292
294
296
297
299 size_t getNumVectors() const {
300 XPETRA_MONITOR("EpetraIntVectorT::getNumVectors");
301 return 1;
302 }
303
305 size_t getLocalLength() const { return 0; }
306
308 global_size_t getGlobalLength() const { return 0; }
309
312
314
316
317
319 std::string description() const {
320 return std::string("");
321 }
322
325
327
328 RCP<Epetra_IntVector> getEpetra_IntVector() const { return Teuchos::null; }
329
330 const RCP<const Comm<int> > getComm() const {
331 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
332 }
333
334 // Implementing DistObject
336 return Teuchos::null;
337 }
338
341
344
347
350
352 // do nothing
353 }
354
355 protected:
358 virtual void
360
361 private:
363 // RCP< Epetra_IntVector > vec_;
364
365}; // class EpetraIntVectorT
366
367// specialization on GO=int and Node=Serial
368#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
369template <>
371 : public virtual Vector<int, int, int, EpetraNode> {
372 typedef int Scalar;
373 typedef int LocalOrdinal;
374 typedef int GlobalOrdinal;
376
377 public:
379
380
382 explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut = true) {
383 vec_ = rcp(new Epetra_IntVector(toEpetra<GlobalOrdinal, Node>(map), zeroOut));
384 }
385
388
390
392
393
400
407
414
421
423 int meanValue() const {
424 XPETRA_MONITOR("EpetraIntVectorT::meanValue");
427 }
428
430 int maxValue() const {
431 XPETRA_MONITOR("EpetraIntVectorT::maxValue");
432 return vec_->MaxValue();
433 }
434
436
438
439
441 void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
442 XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
444 }
445
447 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
448 XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
450 }
451
453 void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {
454 XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
455 (*vec_)[myRow] = value;
456 }
457
459 void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {
460 XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
461 (*vec_)[myRow] += value;
462 }
463
465 void putScalar(const int &value) { vec_->PutValue(value); }
466
468 void randomize(bool /* bUseXpetraImplementation */ = true) {
469 XPETRA_MONITOR("EpetraIntVectorT::randomize");
470 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
471 }
472
474 void randomize(const Scalar & /*minVal*/, const Scalar & /*maxVal*/, bool /* bUseXpetraImplementation */ = true) {
475 XPETRA_MONITOR("EpetraIntVectorT::randomize");
476 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
477 }
478
480
481 void setSeed(unsigned int /* seed */) {
482 XPETRA_MONITOR("EpetraIntVectorT::setSeed");
483 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra");
484 }
485
487
488 typename dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const override { return getLocalViewHost(Access::ReadWrite); }
489
490 typename dual_view_type::t_dev_const_um getLocalViewDevice(Access::ReadOnlyStruct) const override { return getLocalViewDevice(Access::ReadWrite); }
491
492 typename dual_view_type::t_host_um getLocalViewHost(Access::OverwriteAllStruct) const override { return getLocalViewHost(Access::ReadWrite); }
493
494 typename dual_view_type::t_dev_um getLocalViewDevice(Access::OverwriteAllStruct) const override { return getLocalViewDevice(Access::ReadWrite); }
495
496 typename dual_view_type::t_host_um getLocalViewHost(Access::ReadWriteStruct) const override {
497 typedef Kokkos::View<typename dual_view_type::t_host::data_type,
498 Kokkos::LayoutLeft,
499 typename dual_view_type::t_host::device_type,
500 Kokkos::MemoryUnmanaged>
501 epetra_view_type;
502 // access Epetra vector data
503 Scalar *data = NULL;
504 vec_->ExtractView(&data);
505 int localLength = vec_->MyLength();
506
507 // create view
508 epetra_view_type test = epetra_view_type(data, localLength, 1);
509 typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
510 return ret;
511 }
512
513 typename dual_view_type::t_dev_um getLocalViewDevice(Access::ReadWriteStruct) const override { return getLocalViewHost(Access::ReadWrite); }
514
516
518
519
524
529
532 Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
533 XPETRA_MONITOR("EpetraIntVectorT::getData");
534
535 int *data = vec_->Values();
536 int localLength = vec_->MyLength();
537
538 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
539 }
540
544 XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
545
546 int *data = vec_->Values();
547 int localLength = vec_->MyLength();
548
549 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
550 }
551
553
555
556
557 void dot(const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const Teuchos::ArrayView<int> & /* dots */) const {
558 XPETRA_MONITOR("EpetraIntVectorT::dot");
559
560 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
562 }
563
566 XPETRA_MONITOR("EpetraIntVectorT::abs");
567
568 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
570 }
571
574 XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
575
576 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
578 }
579
581 void scale(const int & /* alpha */) {
582 XPETRA_MONITOR("EpetraIntVectorT::scale");
584 }
585
588 XPETRA_MONITOR("EpetraIntVectorT::scale");
590 }
591
593 void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
594 XPETRA_MONITOR("EpetraIntVectorT::update");
595
596 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
598 }
599
601 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 */) {
602 XPETRA_MONITOR("EpetraIntVectorT::update");
603
604 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
605 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
607 }
608
611 XPETRA_MONITOR("EpetraIntVectorT::norm1");
613 }
614
617 XPETRA_MONITOR("EpetraIntVectorT::norm2");
619 }
620
623 XPETRA_MONITOR("EpetraIntVectorT::normInf");
625 }
626
628 void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
629 XPETRA_MONITOR("EpetraIntVectorT::meanValue");
631 }
632
634 void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
635 XPETRA_MONITOR("EpetraIntVectorT::maxValue");
637 }
638
640 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 */) {
641 XPETRA_MONITOR("EpetraIntVectorT::multiply");
643 }
644
646 void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
647 XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
648 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
649 }
650
652
654
655
657 void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
658 XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
660 }
661
663 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
664 XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
666 }
667
669 void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
670 XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
672 }
673
675 void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
676 XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
678 }
679
681
683
684
686 size_t getNumVectors() const {
687 XPETRA_MONITOR("EpetraIntVectorT::getNumVectors");
688 return 1;
689 }
690
692 size_t getLocalLength() const { return vec_->MyLength(); }
693
695 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
696
699 XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
701 if (!asvec) return false;
702 auto vv = toEpetra(*asvec);
703 return ((vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
704 }
705
707
709
710
712 std::string description() const {
713 XPETRA_MONITOR("EpetraIntVectorT::description");
714
715 // This implementation come from Epetra_Vector_def.hpp (without modification)
716 std::ostringstream oss;
718 oss << "{length=" << this->getGlobalLength()
719 << "}";
720 return oss.str();
721 }
722
725 XPETRA_MONITOR("EpetraIntVectorT::describe");
726
727 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
728 using std::endl;
729 using std::setw;
732 using Teuchos::VERB_HIGH;
733 using Teuchos::VERB_LOW;
735 using Teuchos::VERB_NONE;
736
737 if (verbLevel > Teuchos::VERB_NONE)
738 vec_->Print(out);
739 }
740
742
744
745 const RCP<const Comm<int> > getComm() const {
746 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
747 }
748
749 // Implementing DistObject
754
756 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
757 XPETRA_MONITOR("EpetraIntVectorT::doImport");
758
759 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
760 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
761
762 const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
763 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
764 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
765 }
766
768 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
769 XPETRA_MONITOR("EpetraIntVectorT::doExport");
770
771 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
772 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
773
774 const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
775 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
776 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
777 }
778
780 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
781 XPETRA_MONITOR("EpetraIntVectorT::doImport");
782
783 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
784 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
785
786 const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
787 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
788 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
789 }
790
792 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
793 XPETRA_MONITOR("EpetraIntVectorT::doExport");
794
795 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
796 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
797
798 const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
799 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
800 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
801 }
802
803 void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > & /* map */) {
804 // do nothing
805 }
806
807 protected:
810 virtual void
813 const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
815 rhsPtr == NULL, std::invalid_argument,
816 "Xpetra::MultiVector::operator=: "
817 "The left-hand side (LHS) of the assignment has a different type than "
818 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
819 "(which means it wraps an Epetra_IntVector), but the RHS has some "
820 "other type. This probably means that the RHS wraps either an "
821 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
822 "does not currently implement assignment from a Tpetra object to an "
823 "Epetra object, though this could be added with sufficient interest.");
824
825 RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector();
827
829 rhsImpl.is_null(), std::logic_error,
830 "Xpetra::MultiVector::operator= "
831 "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
832 "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
833 "report this bug to the Xpetra developers.");
835 lhsImpl.is_null(), std::logic_error,
836 "Xpetra::MultiVector::operator= "
837 "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
838 "assignment has a null RCP<Epetra_IntVector> inside. Please report "
839 "this bug to the Xpetra developers.");
840
841 // Epetra_IntVector's assignment operator does a deep copy.
842 *lhsImpl = *rhsImpl;
843 }
844
845 private:
848};
849#endif
850
851// specialization on GO=long long and Node=Serial
852#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
853template <>
855 : public virtual Vector<int, int, long long, EpetraNode> {
856 typedef int Scalar;
857 typedef int LocalOrdinal;
858 typedef long long GlobalOrdinal;
860
861 public:
863
864
866 explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut = true) {
867 vec_ = rcp(new Epetra_IntVector(toEpetra<GlobalOrdinal, Node>(map), zeroOut));
868 }
869
872
874
876
877
880 XPETRA_MONITOR("EpetraIntVectorT::dot");
882 }
883
886 XPETRA_MONITOR("EpetraIntVectorT::norm1");
888 }
889
892 XPETRA_MONITOR("EpetraIntVectorT::norm2");
894 }
895
898 XPETRA_MONITOR("EpetraIntVectorT::normInf");
900 }
901
903 int meanValue() const {
904 XPETRA_MONITOR("EpetraIntVectorT::meanValue");
906 }
907
909 int maxValue() const {
910 XPETRA_MONITOR("EpetraIntVectorT::maxValue");
911 return Teuchos::as<int>(vec_->MaxValue());
912 }
913
915
917
918
920 void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
921 XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
923 }
924
926 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar & /* value */) {
927 XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
929 }
930
932 void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {
933 XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
934 (*vec_)[myRow] = value;
935 }
936
938 void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {
939 XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
940 (*vec_)[myRow] += value;
941 }
942
944 void putScalar(const int &value) { vec_->PutValue(value); }
945
947 void randomize(bool /* bUseXpetraImplementation */ = true) {
948 XPETRA_MONITOR("EpetraIntVectorT::randomize");
949 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
950 }
951
953 void randomize(const Scalar & /*minVal*/, const Scalar & /*maxVal*/, bool /* bUseXpetraImplementation */ = true) {
954 XPETRA_MONITOR("EpetraIntVectorT::randomize");
955 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra");
956 }
957
959
960 void setSeed(unsigned int /* seed */) {
961 XPETRA_MONITOR("EpetraIntVectorT::setSeed");
962 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra");
963 }
964
966
968
969
974
979
982 Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
983 XPETRA_MONITOR("EpetraIntVectorT::getData");
984
985 int *data = vec_->Values();
986 int localLength = vec_->MyLength();
987
988 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
989 }
990
994 XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
995
996 int *data = vec_->Values();
997 int localLength = vec_->MyLength();
998
999 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
1000 }
1001
1003
1005
1006
1007 void dot(const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const Teuchos::ArrayView<int> & /* dots */) const {
1008 XPETRA_MONITOR("EpetraIntVectorT::dot");
1009
1010 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1012 }
1013
1016 XPETRA_MONITOR("EpetraIntVectorT::abs");
1017
1018 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1020 }
1021
1024 XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
1025
1026 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1028 }
1029
1031 void scale(const int & /* alpha */) {
1032 XPETRA_MONITOR("EpetraIntVectorT::scale");
1034 }
1035
1038 XPETRA_MONITOR("EpetraIntVectorT::scale");
1040 }
1041
1043 void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
1044 XPETRA_MONITOR("EpetraIntVectorT::update");
1045
1046 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1048 }
1049
1051 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 */) {
1052 XPETRA_MONITOR("EpetraIntVectorT::update");
1053
1054 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1055 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
1057 }
1058
1061 XPETRA_MONITOR("EpetraIntVectorT::norm1");
1063 }
1064
1067 XPETRA_MONITOR("EpetraIntVectorT::norm2");
1069 }
1070
1073 XPETRA_MONITOR("EpetraIntVectorT::normInf");
1075 }
1076
1078 void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
1079 XPETRA_MONITOR("EpetraIntVectorT::meanValue");
1081 }
1082
1084 void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
1085 XPETRA_MONITOR("EpetraIntVectorT::maxValue");
1087 }
1088
1090 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 */) {
1091 XPETRA_MONITOR("EpetraIntVectorT::multiply");
1093 }
1094
1096 void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
1097 XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
1098 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
1099 }
1100
1102
1104
1105
1107 void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1108 XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue");
1110 }
1111
1113 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1114 XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue");
1116 }
1117
1119 void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1120 XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");
1122 }
1123
1125 void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar & /* value */) {
1126 XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue");
1128 }
1129
1131
1133
1134
1136 size_t getNumVectors() const {
1137 XPETRA_MONITOR("EpetraIntVectorT::getNumVectors");
1138 return 1;
1139 }
1140
1142 size_t getLocalLength() const { return vec_->MyLength(); }
1143
1145 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
1146
1149 XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
1151 if (!asvec) return false;
1152 auto vv = toEpetra(*asvec);
1153 return ((vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
1154 }
1156
1158
1159
1161 std::string description() const {
1162 XPETRA_MONITOR("EpetraIntVectorT::description");
1163
1164 // This implementation come from Epetra_Vector_def.hpp (without modification)
1165 std::ostringstream oss;
1167 oss << "{length=" << this->getGlobalLength()
1168 << "}";
1169 return oss.str();
1170 }
1171
1174 XPETRA_MONITOR("EpetraIntVectorT::describe");
1175
1176 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
1177 using std::endl;
1178 using std::setw;
1181 using Teuchos::VERB_HIGH;
1182 using Teuchos::VERB_LOW;
1184 using Teuchos::VERB_NONE;
1185
1186 if (verbLevel > Teuchos::VERB_NONE)
1187 vec_->Print(out);
1188 }
1189
1191
1193
1195 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1196 }
1197
1198 // Implementing DistObject
1203
1205 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1206 XPETRA_MONITOR("EpetraIntVectorT::doImport");
1207
1208 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1209 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1210
1211 const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
1212 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1213 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1214 }
1215
1217 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1218 XPETRA_MONITOR("EpetraIntVectorT::doExport");
1219
1220 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1221 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1222
1223 const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
1224 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1225 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1226 }
1227
1229 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1230 XPETRA_MONITOR("EpetraIntVectorT::doImport");
1231
1232 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1233 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1234
1235 const Epetra_IntVector &v = *tSource.getEpetra_IntVector();
1236 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1237 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1238 }
1239
1241 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1242 XPETRA_MONITOR("EpetraIntVectorT::doExport");
1243
1244 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1245 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1246
1247 const Epetra_IntVector &v = *tDest.getEpetra_IntVector();
1248 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1249 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1250 }
1251
1252 void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > & /* map */) {
1253 // do nothing
1254 }
1255
1256 protected:
1259 virtual void
1261 typedef EpetraIntVectorT<GlobalOrdinal, Node> this_type;
1262 const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
1264 rhsPtr == NULL, std::invalid_argument,
1265 "Xpetra::MultiVector::operator=: "
1266 "The left-hand side (LHS) of the assignment has a different type than "
1267 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
1268 "(which means it wraps an Epetra_IntVector), but the RHS has some "
1269 "other type. This probably means that the RHS wraps either an "
1270 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1271 "does not currently implement assignment from a Tpetra object to an "
1272 "Epetra object, though this could be added with sufficient interest.");
1273
1274 RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector();
1276
1278 rhsImpl.is_null(), std::logic_error,
1279 "Xpetra::MultiVector::operator= "
1280 "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
1281 "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
1282 "report this bug to the Xpetra developers.");
1284 lhsImpl.is_null(), std::logic_error,
1285 "Xpetra::MultiVector::operator= "
1286 "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
1287 "assignment has a null RCP<Epetra_IntVector> inside. Please report "
1288 "this bug to the Xpetra developers.");
1289
1290 // Epetra_IntVector's assignment operator does a deep copy.
1291 *lhsImpl = *rhsImpl;
1292 }
1293
1294 private:
1297};
1298#endif
1299
1300} // namespace Xpetra
1301
1302#endif // XPETRA_EPETRAINTVECTOR_HPP
#define XPETRA_MONITOR(funcName)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
int Import(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
int Export(const Epetra_SrcDistObject &A, const Epetra_Import &Importer, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor=0)
static const EVerbosityLevel verbLevel_default
virtual std::string description() const
bool is_null() const
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
int maxValue() const
Compute max value of this Vector.
const RCP< const Comm< int > > getComm() const
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void setSeed(unsigned int)
Set seed for Random function.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
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::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
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.
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).
dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const override
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 dot(const MultiVector< int, int, GlobalOrdinal, Node > &, const Teuchos::ArrayView< int > &) const
Computes dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i])
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &)
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,...
dual_view_type::t_host_um getLocalViewHost(Access::OverwriteAllStruct) const override
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
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 sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
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.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
void sumIntoGlobalValue(GlobalOrdinal, const Scalar &)
Adds specified value to existing value at the specified location.
Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
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.
dual_view_type::t_host_um getLocalViewHost(Access::ReadWriteStruct) const override
dual_view_type::t_dev_const_um getLocalViewDevice(Access::ReadOnlyStruct) const override
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
void replaceGlobalValue(GlobalOrdinal, const Scalar &)
Replace current value at the specified location with specified value.
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void randomize(bool=true)
Set multi-vector values to random numbers.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
TODO missing comment.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
int meanValue() const
Compute mean (average) value of this Vector.
dual_view_type::t_dev_um getLocalViewDevice(Access::ReadWriteStruct) const override
dual_view_type::t_dev_um getLocalViewDevice(Access::OverwriteAllStruct) const override
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
void randomize(const Scalar &, const Scalar &, bool=true)
Set multi-vector values to random numbers.
Teuchos::ArrayRCP< const int > getData(size_t) const
std::string description() const
Return a simple one-line description of this object.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
TODO missing comment.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
Teuchos::ArrayRCP< const int > getData(size_t) const
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
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,...
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
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 sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
void randomize(const Scalar &, const Scalar &, bool=true)
Set multi-vector values to random numbers.
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.
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
int meanValue() const
Compute mean (average) value of this Vector.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
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.
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
void sumIntoGlobalValue(GlobalOrdinal, const Scalar &)
Adds specified value to existing value at the specified location.
void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void randomize(bool=true)
Set multi-vector values to random numbers.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void setSeed(unsigned int)
Set seed for Random function.
void replaceGlobalValue(GlobalOrdinal, const Scalar &)
Replace current value at the specified location with specified value.
std::string description() const
Return a simple one-line description of this object.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &)
int maxValue() const
Compute max value of this Vector.
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.
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
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 dot(const MultiVector< int, int, GlobalOrdinal, Node > &, const Teuchos::ArrayView< int > &) const
Computes dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i])
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
size_t getNumVectors() const
Returns the number of vectors in the 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 scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
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 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 norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
RCP< Epetra_IntVector > getEpetra_IntVector() const
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
std::string description() const
Return a simple one-line description of this object.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
int maxValue() const
Compute max value of this Vector.
void randomize(const Scalar &, const Scalar &, bool bUseXpetraImplementation=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)
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
Teuchos::ArrayRCP< int > getDataNonConst(size_t j)
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void dot(const MultiVector< int, int, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< int > &dots) const
Computes dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i])
Teuchos::ArrayRCP< const int > getData(size_t j) const
void meanValue(const Teuchos::ArrayView< int > &means) const
Compute mean (average) value of each vector in multi-vector.
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
void randomize(bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
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 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,...
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this 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.
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.
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 replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 2-norm of each vector in multi-vector.
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 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.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void scale(Teuchos::ArrayView< const int > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void setSeed(unsigned int seed)
Set seed for Random function.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
void maxValue(const Teuchos::ArrayView< int > &maxs) const
Compute max value of each vector in multi-vector.
void scale(const int &alpha)
Scale the current values of a multi-vector, this = alpha*this.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
TODO missing comment.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
int meanValue() const
Compute mean (average) value of this Vector.
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.
Exception throws when you call an unimplemented method of Xpetra.
virtual size_t getNumVectors() const =0
Number of columns in the multivector.
virtual dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
constexpr struct ReadWriteStruct ReadWrite
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
size_t global_size_t
Global size_t object.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
CombineMode
Xpetra::Combine Mode enumerable type.