Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_EpetraIntMultiVector.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Xpetra: A linear algebra interface package
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef XPETRA_EPETRAINTMULTIVECTOR_HPP
47#define XPETRA_EPETRAINTMULTIVECTOR_HPP
48
50
51#include "Xpetra_ConfigDefs.hpp"
52#include "Xpetra_MultiVector.hpp"
53#include "Xpetra_Exceptions.hpp"
54
55#include "Xpetra_EpetraMap.hpp"
57#include "Epetra_IntMultiVector.h"
58
59namespace Xpetra {
60
61// TODO: move that elsewhere
62template<class GlobalOrdinal, class Node>
63Epetra_IntMultiVector & toEpetra(MultiVector<int, int, GlobalOrdinal, Node> &);
64
65template<class GlobalOrdinal, class Node>
66const Epetra_IntMultiVector & toEpetra(const MultiVector<int, int, GlobalOrdinal, Node> &);
67//
68
69 // stub implementation for EpetraIntMultiVectorT
70 template<class EpetraGlobalOrdinal, class Node>
72 : public MultiVector<int,int,EpetraGlobalOrdinal, Node>
73 {
74 typedef int Scalar;
75 typedef int LocalOrdinal;
76 typedef EpetraGlobalOrdinal GlobalOrdinal;
77
78 public:
79
81
82
84 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut=true) {
86 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
87 }
88
92 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
93 }
94
98 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
99 }
100
103
105
107
108
110 void putScalar(const int &value) { }
111
113 void randomize(bool bUseXpetraImplementation = true) { XPETRA_MONITOR("EpetraIntMultiVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra"); }
114
116 void randomize(const Scalar& minVal, const Scalar& maxVal, bool bUseXpetraImplementation = true) { XPETRA_MONITOR("EpetraIntMultiVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra"); }
117
119
120 void setSeed(unsigned int seed) { XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
122 "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra"); }
123
124
126
128
129
134
139
145
151
153
155
156
158 const Teuchos::ArrayView<int> &dots) const {
160 "This function is not implemented in Epetra_IntMultiVector");
161 }
162
165
169 "This function is not implemented in Epetra_IntMultiVector");
170 }
171
173 void scale(const int &alpha) { }
174
177 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
179 "Xpetra::EpetraIntMultiVectorT::scale(): Functionnality not available in Epetra");
180 }
181
183 void update(const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const int &beta) {
184 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
186 "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
187 }
188
190 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) {
191 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
193 "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
194 }
195
198 XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
200 "Xpetra::EpetraIntMultiVectorT::norm1(): Functionnality not available in Epetra");
201 }
202
205 XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
207 "Xpetra::EpetraIntMultiVectorT::norm2(): Functionnality not available in Epetra"); }
208
211 XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
213 "Xpetra::EpetraIntMultiVectorT::normInf(): Functionnality not available in Epetra"); }
214
216 void meanValue(const Teuchos::ArrayView<int> &means) const {
217 XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
219 "Xpetra::EpetraIntMultiVectorT::meanValue(): Functionnality not available in Epetra");
220 }
221
223 void maxValue(const Teuchos::ArrayView<int> &maxs) const {
224 XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
226 "Xpetra::EpetraIntMultiVectorT::maxValue(): Functionnality not available in Epetra");
227 }
228
230 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) {
231 XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
233 "Xpetra::EpetraIntMultiVectorT::multiply(): Functionnality not available in Epetra");
234 }
235
238 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
240 "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
241 }
242
244
246
247
249 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
250 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceGlobalValue");
252 }
253
255 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
256 XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoGlobalValue");
258 }
259
261 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
262 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceLocalValue");
264 }
265
267 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
268 XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoLocalValue");
270 }
271
273
275
276
278 size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntMultiVectorT::getNumVectors"); return 1; }
279
280
282 size_t getLocalLength() const { return 0; }
283
285 global_size_t getGlobalLength() const { return 0; }
286
288 bool isSameSize(const MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & vec) const { return false; }
289
291
293
294
296 std::string description() const {
297 return std::string("");
298 }
299
302
304
306
307 const RCP<const Comm<int> > getComm() const {
308 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
309 }
310
311 // Implementing DistObject
313 return Teuchos::null;
314 }
315
318
321
324
327
329 // do nothing
330 }
331
332 protected:
335 virtual void
338
339
340 private:
342 //RCP< Epetra_IntMultiVector > vec_;
343
344 }; // class EpetraIntMultiVectorT
345
346 // specialization on GO=int and Node=Serial
347#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
348 template<>
350 : public virtual MultiVector<int,int,int,EpetraNode>
351 {
352 typedef int Scalar;
353 typedef int LocalOrdinal;
354 typedef int GlobalOrdinal;
356
357 public:
358
360
361
363 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut=true) {
364 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(map), NumVectors, zeroOut));
365 }
366
369
370 if (copyOrView==Teuchos::Copy)
371 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(source)));
372 else {
373 int* indices = new int [getNumVectors()];
374 for (size_t i = 0; i < getNumVectors(); i++)
375 indices[i] = i;
376 vec_ = Teuchos::rcp(new Epetra_IntMultiVector(View, toEpetra<GlobalOrdinal,Node>(source), indices, getNumVectors()));
377 delete [] indices;
378 }
379 }
380
382 EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* map */, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &/* ArrayOfPtrs */, size_t /* NumVectors */) {
384 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
385 }
386
389
391
393
394
396 void putScalar(const int &value) {
397 int ierr = 0;
398 ierr = vec_->PutScalar(value);
399 TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returned an error.")
400 }
401
403 void randomize(bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntMultiVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra"); }
404
406 void randomize(const Scalar& minVal, const Scalar& maxVal, bool bUseXpetraImplementation = true) { XPETRA_MONITOR("EpetraIntMultiVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra"); }
407
408
410
411 void setSeed(unsigned int /* seed */) { XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra"); }
412
413
415
417
418
423
428
432 XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
433
434 int ** arrayOfPointers;
435 vec_->ExtractView(&arrayOfPointers);
436 int * data = arrayOfPointers[j];
437 int localLength = vec_->MyLength();
438
439 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
440 }
441
445 XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
446
447 int ** arrayOfPointers;
448 vec_->ExtractView(&arrayOfPointers);
449 int * data = arrayOfPointers[j];
450 int localLength = vec_->MyLength();
451
452 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
453 }
454
456
458
459
461 const Teuchos::ArrayView<int> &/* dots */) const {
462 XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
463
464 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
466 "This function is not implemented in Epetra_IntMultiVector");
467 }
468
471 XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
473 "This function is not available in Epetra_IntMultiVector");
474 }
475
478 XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
479
480 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
481 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::RuntimeError, "The reciprocal of an IntMultiVector is not defined!");
482 }
483
485 void scale(const int &/* alpha */) {
486 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
488 }
489
492 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
494 }
495
497 void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
498 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
499
500 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
502 }
503
505 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 */) {
506 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
507
508 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
509 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
511 }
512
515
518
521
523 void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
524
526 void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
527
529 void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, const int &/* beta */) { XPETRA_MONITOR("EpetraIntMultiVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
530
532 void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
533 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
534 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
535 }
536
538
540
541
543 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
544 vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
545 }
546
548 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
549 vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
550 }
551
553 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
554 vec_->ReplaceMyValue(myRow, vectorIndex, value);
555 }
556
558 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
559 vec_->SumIntoMyValue(myRow, vectorIndex, value);
560 }
561
563
565
566
568 size_t getNumVectors() const {
569 return vec_->NumVectors();
570 }
571
572
574 size_t getLocalLength() const {
575 return vec_->MyLength();
576 }
577
579 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
580
583 XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
584 auto vv = toEpetra<GlobalOrdinal,Node>(vec);
585 return ( (getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
586 (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
587 }
588
590
592
593
595 std::string description() const {
596 XPETRA_MONITOR("EpetraIntMultiVectorT::description");
597
598 // This implementation come from Epetra_Vector_def.hpp (without modification)
599 std::ostringstream oss;
601 oss << "{length="<<this->getGlobalLength()
602 << "}";
603 return oss.str();
604 }
605
608 XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
609
610 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
611 using std::endl;
612 using std::setw;
614 using Teuchos::VERB_NONE;
615 using Teuchos::VERB_LOW;
617 using Teuchos::VERB_HIGH;
619
620 if (verbLevel > Teuchos::VERB_NONE)
621 vec_->Print(out);
622 }
623
625
627
628 const RCP<const Comm<int> > getComm() const {
629 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
630 }
631
632 // Implementing DistObject
637
639 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
640 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
641
642 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
643 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
644
645 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
646 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
647 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
648 }
649
651 const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
652 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
653
654 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
655 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
656
657 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
658 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
659 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
660 }
661
663 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
664 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
665
666 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
667 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
668
669 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
670 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
671 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
672 }
673
675 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
676 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
677
678 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
679 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
680
681 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
682 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
683 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
684 }
685
687 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
688 int err = 0;
689 if (!map.is_null()) {
690 err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal,Node>(map));
691
692 } else {
693 // Replace map with a dummy map to avoid potential hangs later
694 Epetra_SerialComm SComm;
695 Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
696 err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
697 }
698 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
699 }
700
701 protected:
704 virtual void
706 {
708 const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
710 rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
711 "The left-hand side (LHS) of the assignment has a different type than "
712 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
713 "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
714 "other type. This probably means that the RHS wraps either an "
715 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
716 "does not currently implement assignment from a Tpetra object to an "
717 "Epetra object, though this could be added with sufficient interest.");
718
719 RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector ();
721
723 rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
724 "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
725 "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
726 "report this bug to the Xpetra developers.");
728 lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
729 "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
730 "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
731 "this bug to the Xpetra developers.");
732
733 // Epetra_IntMultiVector's assignment operator does a deep copy.
734 *lhsImpl = *rhsImpl;
735 }
736
737
738 private:
741 };
742#endif
743
744 // specialization on GO=long long and Node=Serial
745#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
746 template<>
748 : public virtual MultiVector<int,int,long long,EpetraNode>
749 {
750 typedef int Scalar;
751 typedef int LocalOrdinal;
752 typedef long long GlobalOrdinal;
754
755 public:
756
758
759
761 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut=true) {
762 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(map), NumVectors, zeroOut));
763 }
764
767 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(source)));
768 }
769
771 EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* map */, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &/* ArrayOfPtrs */, size_t /* NumVectors */) {
773 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
774 }
775
778
780
782
783
785 void putScalar(const int &value) {
786 int ierr = 0;
787 ierr = vec_->PutScalar(value);
788 TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returns a non zero error.");
789 }
790
792 void randomize(bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntMultiVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra"); }
793
795 void randomize(const Scalar& minVal, const Scalar& maxVal, bool bUseXpetraImplementation = true) { XPETRA_MONITOR("EpetraIntMultiVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra"); }
796
797
799
800 void setSeed(unsigned int /* seed */) { XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra"); }
801
802
804
806
807
812
817
821 XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
822
823 int ** arrayOfPointers;
824 vec_->ExtractView(&arrayOfPointers);
825 int * data = arrayOfPointers[j];
826 int localLength = vec_->MyLength();
827
828 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
829 }
830
834 XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
835
836 int ** arrayOfPointers;
837 vec_->ExtractView(&arrayOfPointers);
838 int * data = arrayOfPointers[j];
839 int localLength = vec_->MyLength();
840
841 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
842 }
843
845
847
848
850 const Teuchos::ArrayView<int> &/* dots */) const {
851 XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
852
853 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
855 }
856
859 XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
861 "This function is not available in Epetra_IntMultiVector");
862 }
863
866 XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
868 "This function is not implemented in Epetra_IntMultiVector");
869 }
870
872 void scale(const int &/* alpha */) {
873 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
875 }
876
879 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
881 }
882
884 void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
885 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
886
887 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
889 }
890
892 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 */) {
893 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
894
895 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
896 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
898 }
899
902
905
908
910 void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
911
913 void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
914
916 void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, const int &/* beta */) { XPETRA_MONITOR("EpetraIntMultiVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
917
919 void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
920 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
921 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
922 }
923
925
927
928
930 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
931 vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
932 }
933
935 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
936 vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
937 }
938
940 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
941 vec_->ReplaceMyValue(myRow, vectorIndex, value);
942 }
943
945 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
946 vec_->SumIntoMyValue(myRow, vectorIndex, value);
947 }
948
950
952
953
955 size_t getNumVectors() const {
956 return vec_->NumVectors();
957 }
958
959
961 size_t getLocalLength() const { return vec_->MyLength(); }
962
964 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
965
966
969 XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
970 auto vv = toEpetra<GlobalOrdinal, Node>(vec);
971 return ( (getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
972 (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
973 }
975
977
978
980 std::string description() const {
981 XPETRA_MONITOR("EpetraIntMultiVectorT::description");
982
983 // This implementation come from Epetra_Vector_def.hpp (without modification)
984 std::ostringstream oss;
986 oss << "{length="<<this->getGlobalLength()
987 << "}";
988 return oss.str();
989 }
990
993 XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
994
995 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
996 using std::endl;
997 using std::setw;
999 using Teuchos::VERB_NONE;
1000 using Teuchos::VERB_LOW;
1002 using Teuchos::VERB_HIGH;
1004
1005 if (verbLevel > Teuchos::VERB_NONE)
1006 vec_->Print(out);
1007 }
1008
1010
1012
1014 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1015 }
1016
1017 // Implementing DistObject
1022
1024 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1025 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1026
1027 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1028 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1029
1030 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
1031 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1032 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1033 }
1034
1036 const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
1037 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1038
1039 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1040 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1041
1042 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
1043 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1044 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1045 }
1046
1048 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1049 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1050
1051 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1052 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1053
1054 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
1055 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1056 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1057 }
1058
1060 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1061 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1062
1063 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1064 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1065
1066 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
1067 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1068 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1069 }
1070
1072 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
1073 int err = 0;
1074 if (!map.is_null()) {
1075 err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal,Node>(map));
1076
1077 } else {
1078 // Replace map with a dummy map to avoid potential hangs later
1079 Epetra_SerialComm SComm;
1080 Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
1081 err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
1082 }
1083 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1084 }
1085
1086 protected:
1089 virtual void
1091 {
1093 const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
1095 rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
1096 "The left-hand side (LHS) of the assignment has a different type than "
1097 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
1098 "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
1099 "other type. This probably means that the RHS wraps either an "
1100 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1101 "does not currently implement assignment from a Tpetra object to an "
1102 "Epetra object, though this could be added with sufficient interest.");
1103
1104 RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector ();
1106
1108 rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1109 "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
1110 "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
1111 "report this bug to the Xpetra developers.");
1113 lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1114 "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
1115 "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
1116 "this bug to the Xpetra developers.");
1117
1118 // Epetra_IntMultiVector's assignment operator does a deep copy.
1119 *lhsImpl = *rhsImpl;
1120 }
1121
1122
1123 private:
1126 };
1127#endif
1128
1129
1130} // namespace Xpetra
1131
1132#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.
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.
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 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)
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.
RCP< Epetra_IntMultiVector > vec_
The Epetra_IntMultiVector which this class wraps.
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.
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.
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.
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.
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)
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.
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.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Xpetra namespace
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.