Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_EpetraIntMultiVector.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_EPETRAINTMULTIVECTOR_HPP
11#define XPETRA_EPETRAINTMULTIVECTOR_HPP
12
14
15#include "Xpetra_ConfigDefs.hpp"
16#include "Xpetra_MultiVector.hpp"
17#include "Xpetra_Exceptions.hpp"
18
19#include "Xpetra_EpetraMap.hpp"
21#include "Epetra_IntMultiVector.h"
22
23#if defined(XPETRA_ENABLE_DEPRECATED_CODE)
24#ifdef __GNUC__
25#if defined(Xpetra_SHOW_DEPRECATED_WARNINGS)
26#warning "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp is deprecated."
27#endif
28#endif
29#else
30#error "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp is deprecated."
31#endif
32
33namespace Xpetra {
34
35// TODO: move that elsewhere
36template <class GlobalOrdinal, class Node>
37XPETRA_DEPRECATED Epetra_IntMultiVector &toEpetra(MultiVector<int, int, GlobalOrdinal, Node> &);
38
39template <class GlobalOrdinal, class Node>
40XPETRA_DEPRECATED const Epetra_IntMultiVector &toEpetra(const MultiVector<int, int, GlobalOrdinal, Node> &);
41//
42
43// stub implementation for EpetraIntMultiVectorT
44template <class EpetraGlobalOrdinal, class Node>
45class XPETRA_DEPRECATED EpetraIntMultiVectorT
46 : public MultiVector<int, int, EpetraGlobalOrdinal, Node> {
47 typedef int Scalar;
48 typedef int LocalOrdinal;
49 typedef EpetraGlobalOrdinal GlobalOrdinal;
50
51 public:
53
54
56 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
58 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
59 }
60
64 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
65 }
66
70 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
71 }
72
75
77
79
80
82 void putScalar(const int &value) {}
83
85 void randomize(bool bUseXpetraImplementation = true) {
86 XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
87 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
88 }
89
91 void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = true) {
92 XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
93 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
94 }
95
97
98 void setSeed(unsigned int seed) {
99 XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
101 "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra");
102 }
103
105
107
108
111 return Teuchos::null;
112 }
113
118
124
130
132
134
135
137 const Teuchos::ArrayView<int> &dots) const {
139 "This function is not implemented in Epetra_IntMultiVector");
140 }
141
144
148 "This function is not implemented in Epetra_IntMultiVector");
149 }
150
152 void scale(const int &alpha) {}
153
156 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
158 "Xpetra::EpetraIntMultiVectorT::scale(): Functionnality not available in Epetra");
159 }
160
162 void update(const int &alpha, const MultiVector<int, int, GlobalOrdinal, Node> &A, const int &beta) {
163 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
165 "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
166 }
167
169 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) {
170 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
172 "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
173 }
174
177 XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
179 "Xpetra::EpetraIntMultiVectorT::norm1(): Functionnality not available in Epetra");
180 }
181
184 XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
186 "Xpetra::EpetraIntMultiVectorT::norm2(): Functionnality not available in Epetra");
187 }
188
191 XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
193 "Xpetra::EpetraIntMultiVectorT::normInf(): Functionnality not available in Epetra");
194 }
195
197 void meanValue(const Teuchos::ArrayView<int> &means) const {
198 XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
200 "Xpetra::EpetraIntMultiVectorT::meanValue(): Functionnality not available in Epetra");
201 }
202
204 void maxValue(const Teuchos::ArrayView<int> &maxs) const {
205 XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
207 "Xpetra::EpetraIntMultiVectorT::maxValue(): Functionnality not available in Epetra");
208 }
209
212 XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
214 "Xpetra::EpetraIntMultiVectorT::multiply(): Functionnality not available in Epetra");
215 }
216
219 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
221 "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
222 }
223
225
227
228
230 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
231 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceGlobalValue");
233 }
234
236 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
237 XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoGlobalValue");
239 }
240
242 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
243 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceLocalValue");
245 }
246
248 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
249 XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoLocalValue");
251 }
252
254
256
257
259 size_t getNumVectors() const {
260 XPETRA_MONITOR("EpetraIntMultiVectorT::getNumVectors");
261 return 1;
262 }
263
265 size_t getLocalLength() const { return 0; }
266
268 global_size_t getGlobalLength() const { return 0; }
269
272
274
276
277
279 std::string description() const {
280 return std::string("");
281 }
282
285
287
288 RCP<Epetra_IntMultiVector> getEpetra_IntMultiVector() const { return Teuchos::null; }
289
290 const RCP<const Comm<int> > getComm() const {
291 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
292 }
293
294 // Implementing DistObject
296 return Teuchos::null;
297 }
298
301
304
307
310
312 // do nothing
313 }
314
315 protected:
318 virtual void
320
321 private:
323 // RCP< Epetra_IntMultiVector > vec_;
324
325}; // class EpetraIntMultiVectorT
326
327// specialization on GO=int and Node=Serial
328#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
329template <>
331 : public virtual MultiVector<int, int, int, EpetraNode> {
332 typedef int Scalar;
333 typedef int LocalOrdinal;
334 typedef int GlobalOrdinal;
336
337 public:
339
340
342 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
343 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(map), NumVectors, zeroOut));
344 }
345
348 if (copyOrView == Teuchos::Copy)
349 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(source)));
350 else {
351 int *indices = new int[getNumVectors()];
352 for (size_t i = 0; i < getNumVectors(); i++)
353 indices[i] = i;
354 vec_ = Teuchos::rcp(new Epetra_IntMultiVector(View, toEpetra<GlobalOrdinal, Node>(source), indices, getNumVectors()));
355 delete[] indices;
356 }
357 }
358
360 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > & /* map */, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > & /* ArrayOfPtrs */, size_t /* NumVectors */) {
362 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
363 }
364
367
369
371
372
374 void putScalar(const int &value) {
375 int ierr = 0;
376 ierr = vec_->PutScalar(value);
377 TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returned an error.")
378 }
379
381 void randomize(bool /* bUseXpetraImplementation */ = true) {
382 XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
383 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
384 }
385
387 void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = true) {
388 XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
389 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
390 }
391
393
394 void setSeed(unsigned int /* seed */) {
395 XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
396 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra");
397 }
398
400
401 typename dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const override { return getLocalViewHost(Access::ReadWrite); }
402
403 typename dual_view_type::t_dev_const_um getLocalViewDevice(Access::ReadOnlyStruct) const override { return getLocalViewDevice(Access::ReadWrite); }
404
405 typename dual_view_type::t_host_um getLocalViewHost(Access::OverwriteAllStruct) const override { return getLocalViewHost(Access::ReadWrite); }
406
407 typename dual_view_type::t_dev_um getLocalViewDevice(Access::OverwriteAllStruct) const override { return getLocalViewDevice(Access::ReadWrite); }
408
409 typename dual_view_type::t_host_um getLocalViewHost(Access::ReadWriteStruct) const override {
410 typedef Kokkos::View<typename dual_view_type::t_host::data_type,
411 Kokkos::LayoutLeft,
412 typename dual_view_type::t_host::device_type,
413 Kokkos::MemoryUnmanaged>
414 epetra_view_type;
415 // access Epetra multivector data
416 Scalar *data = NULL;
417 int myLDA;
418 vec_->ExtractView(&data, &myLDA);
419 int localLength = vec_->MyLength();
420 int numVectors = getNumVectors();
421
422 // create view
423 epetra_view_type test = epetra_view_type(data, localLength, numVectors);
424 typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
425
426 return ret;
427 }
428
429 typename dual_view_type::t_dev_um getLocalViewDevice(Access::ReadWriteStruct) const override { return getLocalViewHost(Access::ReadWrite); }
430
432
434
435
440
445
449 XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
450
451 int **arrayOfPointers;
452 vec_->ExtractView(&arrayOfPointers);
453 int *data = arrayOfPointers[j];
454 int localLength = vec_->MyLength();
455
456 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
457 }
458
462 XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
463
464 int **arrayOfPointers;
465 vec_->ExtractView(&arrayOfPointers);
466 int *data = arrayOfPointers[j];
467 int localLength = vec_->MyLength();
468
469 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
470 }
471
473
475
476
478 const Teuchos::ArrayView<int> & /* dots */) const {
479 XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
480
481 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
483 "This function is not implemented in Epetra_IntMultiVector");
484 }
485
488 XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
490 "This function is not available in Epetra_IntMultiVector");
491 }
492
495 XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
496
497 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
498 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::RuntimeError, "The reciprocal of an IntMultiVector is not defined!");
499 }
500
502 void scale(const int & /* alpha */) {
503 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
505 }
506
509 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
511 }
512
514 void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
515 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
516
517 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
519 }
520
522 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 */) {
523 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
524
525 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
526 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
528 }
529
532 XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
534 }
535
538 XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
540 }
541
544 XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
546 }
547
549 void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
550 XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
552 }
553
555 void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
556 XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
558 }
559
561 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 */) {
562 XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
564 }
565
567 void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
568 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
569 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
570 }
571
573
575
576
578 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
579 vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
580 }
581
583 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
584 vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
585 }
586
588 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
589 vec_->ReplaceMyValue(myRow, vectorIndex, value);
590 }
591
593 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
594 vec_->SumIntoMyValue(myRow, vectorIndex, value);
595 }
596
598
600
601
603 size_t getNumVectors() const {
604 return vec_->NumVectors();
605 }
606
608 size_t getLocalLength() const {
609 return vec_->MyLength();
610 }
611
613 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
614
617 XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
618 auto vv = toEpetra<GlobalOrdinal, Node>(vec);
619 return ((getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
620 (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
621 }
622
624
626
627
629 std::string description() const {
630 XPETRA_MONITOR("EpetraIntMultiVectorT::description");
631
632 // This implementation come from Epetra_Vector_def.hpp (without modification)
633 std::ostringstream oss;
635 oss << "{length=" << this->getGlobalLength()
636 << "}";
637 return oss.str();
638 }
639
642 XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
643
644 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
645 using std::endl;
646 using std::setw;
649 using Teuchos::VERB_HIGH;
650 using Teuchos::VERB_LOW;
652 using Teuchos::VERB_NONE;
653
654 if (verbLevel > Teuchos::VERB_NONE)
655 vec_->Print(out);
656 }
657
659
661
662 const RCP<const Comm<int> > getComm() const {
663 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
664 }
665
666 // Implementing DistObject
671
673 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
674 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
675
676 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
677 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
678
679 const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
680 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
681 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
682 }
683
685 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
686 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
687
688 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
689 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
690
691 const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
692 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
693 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
694 }
695
697 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
698 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
699
700 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
701 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
702
703 const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
704 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
705 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
706 }
707
709 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
710 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
711
712 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
713 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
714
715 const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
716 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
717 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
718 }
719
721 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
722 int err = 0;
723 if (!map.is_null()) {
724 err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal, Node>(map));
725
726 } else {
727 // Replace map with a dummy map to avoid potential hangs later
728 Epetra_SerialComm SComm;
729 Epetra_Map NewMap((GlobalOrdinal)vec_->MyLength(), (GlobalOrdinal)vec_->Map().IndexBase64(), SComm);
730 err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
731 }
732 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
733 }
734
735 protected:
738 virtual void
741 const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
743 rhsPtr == NULL, std::invalid_argument,
744 "Xpetra::MultiVector::operator=: "
745 "The left-hand side (LHS) of the assignment has a different type than "
746 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
747 "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
748 "other type. This probably means that the RHS wraps either an "
749 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
750 "does not currently implement assignment from a Tpetra object to an "
751 "Epetra object, though this could be added with sufficient interest.");
752
753 RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector();
755
757 rhsImpl.is_null(), std::logic_error,
758 "Xpetra::MultiVector::operator= "
759 "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
760 "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
761 "report this bug to the Xpetra developers.");
763 lhsImpl.is_null(), std::logic_error,
764 "Xpetra::MultiVector::operator= "
765 "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
766 "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
767 "this bug to the Xpetra developers.");
768
769 // Epetra_IntMultiVector's assignment operator does a deep copy.
770 *lhsImpl = *rhsImpl;
771 }
772
773 private:
776};
777#endif
778
779// specialization on GO=long long and Node=Serial
780#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
781template <>
783 : public virtual MultiVector<int, int, long long, EpetraNode> {
784 typedef int Scalar;
785 typedef int LocalOrdinal;
786 typedef long long GlobalOrdinal;
788
789 public:
791
792
794 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
795 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(map), NumVectors, zeroOut));
796 }
797
800 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(source)));
801 }
802
804 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > & /* map */, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > & /* ArrayOfPtrs */, size_t /* NumVectors */) {
806 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
807 }
808
811
813
815
816
818 void putScalar(const int &value) {
819 int ierr = 0;
820 ierr = vec_->PutScalar(value);
821 TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returns a non zero error.");
822 }
823
825 void randomize(bool /* bUseXpetraImplementation */ = true) {
826 XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
827 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
828 }
829
831 void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = true) {
832 XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
833 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
834 }
835
837
838 void setSeed(unsigned int /* seed */) {
839 XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
840 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra");
841 }
842
844
846
847
852
857
861 XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
862
863 int **arrayOfPointers;
864 vec_->ExtractView(&arrayOfPointers);
865 int *data = arrayOfPointers[j];
866 int localLength = vec_->MyLength();
867
868 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
869 }
870
874 XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
875
876 int **arrayOfPointers;
877 vec_->ExtractView(&arrayOfPointers);
878 int *data = arrayOfPointers[j];
879 int localLength = vec_->MyLength();
880
881 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
882 }
883
885
887
888
890 const Teuchos::ArrayView<int> & /* dots */) const {
891 XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
892
893 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
895 }
896
899 XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
901 "This function is not available in Epetra_IntMultiVector");
902 }
903
906 XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
908 "This function is not implemented in Epetra_IntMultiVector");
909 }
910
912 void scale(const int & /* alpha */) {
913 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
915 }
916
919 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
921 }
922
924 void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
925 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
926
927 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
929 }
930
932 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 */) {
933 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
934
935 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
936 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
938 }
939
942 XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
944 }
945
948 XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
950 }
951
954 XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
956 }
957
959 void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
960 XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
962 }
963
965 void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
966 XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
968 }
969
971 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 */) {
972 XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
974 }
975
977 void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
978 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
979 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
980 }
981
983
985
986
988 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
989 vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
990 }
991
993 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
994 vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
995 }
996
998 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
999 vec_->ReplaceMyValue(myRow, vectorIndex, value);
1000 }
1001
1003 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
1004 vec_->SumIntoMyValue(myRow, vectorIndex, value);
1005 }
1006
1008
1010
1011
1013 size_t getNumVectors() const {
1014 return vec_->NumVectors();
1015 }
1016
1018 size_t getLocalLength() const { return vec_->MyLength(); }
1019
1021 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
1022
1025 XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
1026 auto vv = toEpetra<GlobalOrdinal, Node>(vec);
1027 return ((getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
1028 (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
1029 }
1031
1033
1034
1036 std::string description() const {
1037 XPETRA_MONITOR("EpetraIntMultiVectorT::description");
1038
1039 // This implementation come from Epetra_Vector_def.hpp (without modification)
1040 std::ostringstream oss;
1042 oss << "{length=" << this->getGlobalLength()
1043 << "}";
1044 return oss.str();
1045 }
1046
1049 XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
1050
1051 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
1052 using std::endl;
1053 using std::setw;
1056 using Teuchos::VERB_HIGH;
1057 using Teuchos::VERB_LOW;
1059 using Teuchos::VERB_NONE;
1060
1061 if (verbLevel > Teuchos::VERB_NONE)
1062 vec_->Print(out);
1063 }
1064
1066
1068
1070 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1071 }
1072
1073 // Implementing DistObject
1078
1080 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1081 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1082
1083 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1084 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1085
1086 const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
1087 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1088 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1089 }
1090
1092 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1093 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1094
1095 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1096 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1097
1098 const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
1099 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1100 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1101 }
1102
1104 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1105 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1106
1107 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1108 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1109
1110 const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
1111 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1112 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1113 }
1114
1116 const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1117 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1118
1119 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1120 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1121
1122 const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
1123 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1124 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1125 }
1126
1128 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
1129 int err = 0;
1130 if (!map.is_null()) {
1131 err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal, Node>(map));
1132
1133 } else {
1134 // Replace map with a dummy map to avoid potential hangs later
1135 Epetra_SerialComm SComm;
1136 Epetra_Map NewMap((GlobalOrdinal)vec_->MyLength(), (GlobalOrdinal)vec_->Map().IndexBase64(), SComm);
1137 err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
1138 }
1139 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1140 }
1141
1142 protected:
1145 virtual void
1148 const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
1150 rhsPtr == NULL, std::invalid_argument,
1151 "Xpetra::MultiVector::operator=: "
1152 "The left-hand side (LHS) of the assignment has a different type than "
1153 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
1154 "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
1155 "other type. This probably means that the RHS wraps either an "
1156 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1157 "does not currently implement assignment from a Tpetra object to an "
1158 "Epetra object, though this could be added with sufficient interest.");
1159
1160 RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector();
1162
1164 rhsImpl.is_null(), std::logic_error,
1165 "Xpetra::MultiVector::operator= "
1166 "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
1167 "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
1168 "report this bug to the Xpetra developers.");
1170 lhsImpl.is_null(), std::logic_error,
1171 "Xpetra::MultiVector::operator= "
1172 "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
1173 "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
1174 "this bug to the Xpetra developers.");
1175
1176 // Epetra_IntMultiVector's assignment operator does a deep copy.
1177 *lhsImpl = *rhsImpl;
1178 }
1179
1180 private:
1183};
1184#endif
1185
1186} // namespace Xpetra
1187
1188#endif // XPETRA_EPETRAINTMULTIVECTOR_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::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 &, 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.
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &, size_t)
Set multi-vector values from array of pointers using Teuchos memory management classes....
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,...
std::string description() const
Return a simple one-line description of this object.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-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.
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.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
dual_view_type::t_host_um getLocalViewHost(Access::ReadWriteStruct) const override
void randomize(bool=true)
Set multi-vector values to random numbers.
RCP< Epetra_IntMultiVector > vec_
The Epetra_IntMultiVector which this class wraps.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
dual_view_type::t_dev_const_um getLocalViewDevice(Access::ReadOnlyStruct) const override
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
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 doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
dual_view_type::t_dev_um getLocalViewDevice(Access::OverwriteAllStruct) const override
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 normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (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.
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
void setSeed(unsigned int)
Set seed for Random function.
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 doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Sets all vector entries to zero.
dual_view_type::t_dev_um getLocalViewDevice(Access::ReadWriteStruct) const override
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const override
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView=Teuchos::Copy)
MultiVector copy constructor.
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
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 putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
Teuchos::ArrayRCP< const int > getData(size_t j) const
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
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 maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
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 doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
void 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.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Sets all vector entries to zero.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &, size_t)
Set multi-vector values from array of pointers using Teuchos memory management classes....
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 meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
void setSeed(unsigned int)
Set seed for Random function.
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.
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 norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
std::string description() const
Return a simple one-line description of this object.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
void randomize(bool=true)
Set multi-vector values to random numbers.
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_IntMultiVector > vec_
The Epetra_IntMultiVector which this class wraps.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
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).
std::string description() const
Return a simple one-line description of this object.
void setSeed(unsigned int seed)
Set seed for Random function.
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.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
void meanValue(const Teuchos::ArrayView< int > &means) const
Compute mean (average) value of each vector in multi-vector.
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 j) const
Return a Vector which is a const view of column j.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView=Teuchos::Copy)
MultiVector copy constructor.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Set multi-vector values from array of pointers using Teuchos memory management classes....
Teuchos::ArrayRCP< int > getDataNonConst(size_t j)
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
void maxValue(const Teuchos::ArrayView< int > &maxs) const
Compute max value of each vector in multi-vector.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Sets all vector entries to zero.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 2-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.
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,...
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 doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
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.
const RCP< const Comm< int > > getComm() const
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])
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
Teuchos::ArrayRCP< const int > getData(size_t j) const
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void scale(const int &alpha)
Scale the current values of a multi-vector, this = alpha*this.
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.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void scale(Teuchos::ArrayView< const int > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
RCP< Epetra_IntMultiVector > getEpetra_IntMultiVector() const
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.
void randomize(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)
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.
Exception throws when you call an unimplemented method of Xpetra.
Exception throws to report errors in the internal logical of the program.
virtual dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const
Kokkos::DualView< impl_scalar_type **, Kokkos::LayoutStride, typename node_type::device_type, Kokkos::MemoryUnmanaged > dual_view_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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.