Xpetra Version of the Day
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
115
117
118 void setSeed(unsigned int seed) { XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
120 "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra"); }
121
122
124
126
127
130 return Teuchos::null;
131 }
132
135 return Teuchos::null;
136 }
137
142 }
143
147 return Teuchos::ArrayRCP<int>();
148 }
149
151
153
154
156 const Teuchos::ArrayView<int> &dots) const {
158 "This function is not implemented in Epetra_IntMultiVector");
159 }
160
163
167 "This function is not implemented in Epetra_IntMultiVector");
168 }
169
171 void scale(const int &alpha) { }
172
175 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
177 "Xpetra::EpetraIntMultiVectorT::scale(): Functionnality not available in Epetra");
178 }
179
181 void update(const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const int &beta) {
182 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
184 "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
185 }
186
188 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) {
189 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
191 "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
192 }
193
196 XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
198 "Xpetra::EpetraIntMultiVectorT::norm1(): Functionnality not available in Epetra");
199 }
200
203 XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
205 "Xpetra::EpetraIntMultiVectorT::norm2(): Functionnality not available in Epetra"); }
206
209 XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
211 "Xpetra::EpetraIntMultiVectorT::normInf(): Functionnality not available in Epetra"); }
212
214 void meanValue(const Teuchos::ArrayView<int> &means) const {
215 XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
217 "Xpetra::EpetraIntMultiVectorT::meanValue(): Functionnality not available in Epetra");
218 }
219
221 void maxValue(const Teuchos::ArrayView<int> &maxs) const {
222 XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
224 "Xpetra::EpetraIntMultiVectorT::maxValue(): Functionnality not available in Epetra");
225 }
226
228 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) {
229 XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
231 "Xpetra::EpetraIntMultiVectorT::multiply(): Functionnality not available in Epetra");
232 }
233
236 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
238 "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
239 }
240
242
244
245
247 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
248 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceGlobalValue");
250 }
251
253 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
254 XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoGlobalValue");
256 }
257
259 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
260 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceLocalValue");
262 }
263
265 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
266 XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoLocalValue");
268 }
269
271
273
274
276 size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntMultiVectorT::getNumVectors"); return 1; }
277
278
280 size_t getLocalLength() const { return 0; }
281
283 global_size_t getGlobalLength() const { return 0; }
284
286 bool isSameSize(const MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & vec) const { return false; }
287
289
291
292
294 std::string description() const {
295 return std::string("");
296 }
297
300
302
304
305 const RCP<const Comm<int> > getComm() const {
306 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
307 }
308
309 // Implementing DistObject
311 return Teuchos::null;
312 }
313
315 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) { }
316
318 const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) { }
319
321 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) { }
322
324 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) { }
325
327 // do nothing
328 }
329
330 protected:
333 virtual void
335 { }
336
337
338 private:
340 //RCP< Epetra_IntMultiVector > vec_;
341
342 }; // class EpetraIntMultiVectorT
343
344 // specialization on GO=int and Node=Serial
345#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
346 template<>
348 : public virtual MultiVector<int,int,int,EpetraNode>
349 {
350 typedef int Scalar;
351 typedef int LocalOrdinal;
352 typedef int GlobalOrdinal;
354
355 public:
356
358
359
361 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut=true) {
362 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(map), NumVectors, zeroOut));
363 }
364
367
368 if (copyOrView==Teuchos::Copy)
369 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(source)));
370 else {
371 int* indices = new int [getNumVectors()];
372 for (size_t i = 0; i < getNumVectors(); i++)
373 indices[i] = i;
374 vec_ = Teuchos::rcp(new Epetra_IntMultiVector(View, toEpetra<GlobalOrdinal,Node>(source), indices, getNumVectors()));
375 delete [] indices;
376 }
377 }
378
380 EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* map */, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &/* ArrayOfPtrs */, size_t /* NumVectors */) {
382 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
383 }
384
387
389
391
392
394 void putScalar(const int &value) {
395 int ierr = 0;
396 ierr = vec_->PutScalar(value);
397 TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returned an error.")
398 }
399
401 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"); }
402
403
405
406 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"); }
407
408
410
412
413
417 }
418
422 }
423
427 XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
428
429 int ** arrayOfPointers;
430 vec_->ExtractView(&arrayOfPointers);
431 int * data = arrayOfPointers[j];
432 int localLength = vec_->MyLength();
433
434 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
435 }
436
440 XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
441
442 int ** arrayOfPointers;
443 vec_->ExtractView(&arrayOfPointers);
444 int * data = arrayOfPointers[j];
445 int localLength = vec_->MyLength();
446
447 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
448 }
449
451
453
454
456 const Teuchos::ArrayView<int> &/* dots */) const {
457 XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
458
459 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
461 "This function is not implemented in Epetra_IntMultiVector");
462 }
463
466 XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
468 "This function is not available in Epetra_IntMultiVector");
469 }
470
473 XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
474
475 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
476 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::RuntimeError, "The reciprocal of an IntMultiVector is not defined!");
477 }
478
480 void scale(const int &/* alpha */) {
481 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
483 }
484
487 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
489 }
490
492 void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
493 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
494
495 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
497 }
498
500 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 */) {
501 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
502
503 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
504 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
506 }
507
510
513
516
518 void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
519
521 void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
522
524 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"); }
525
527 void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
528 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
529 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
530 }
531
533
535
536
538 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
539 vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
540 }
541
543 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
544 vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
545 }
546
548 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
549 vec_->ReplaceMyValue(myRow, vectorIndex, value);
550 }
551
553 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
554 vec_->SumIntoMyValue(myRow, vectorIndex, value);
555 }
556
558
560
561
563 size_t getNumVectors() const {
564 return vec_->NumVectors();
565 }
566
567
569 size_t getLocalLength() const {
570 return vec_->MyLength();
571 }
572
574 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
575
578 XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
579 auto vv = toEpetra<GlobalOrdinal,Node>(vec);
580 return ( (getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
581 (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
582 }
583
585
587
588
590 std::string description() const {
591 XPETRA_MONITOR("EpetraIntMultiVectorT::description");
592
593 // This implementation come from Epetra_Vector_def.hpp (without modification)
594 std::ostringstream oss;
596 oss << "{length="<<this->getGlobalLength()
597 << "}";
598 return oss.str();
599 }
600
603 XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
604
605 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
606 using std::endl;
607 using std::setw;
609 using Teuchos::VERB_NONE;
610 using Teuchos::VERB_LOW;
612 using Teuchos::VERB_HIGH;
614
615 if (verbLevel > Teuchos::VERB_NONE)
616 vec_->Print(out);
617 }
618
620
622
623 const RCP<const Comm<int> > getComm() const {
624 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
625 }
626
627 // Implementing DistObject
629 RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
631 }
632
634 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
635 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
636
637 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
638 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
639
640 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
641 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
642 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
643 }
644
646 const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
647 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
648
649 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
650 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
651
652 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
653 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
654 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
655 }
656
658 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
659 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
660
661 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
662 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
663
664 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
665 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
666 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
667 }
668
670 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
671 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
672
673 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
674 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
675
676 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
677 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
678 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
679 }
680
682 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
683 int err = 0;
684 if (!map.is_null()) {
685 err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal,Node>(map));
686
687 } else {
688 // Replace map with a dummy map to avoid potential hangs later
689 Epetra_SerialComm SComm;
690 Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
691 err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
692 }
693 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
694 }
695
696 protected:
699 virtual void
701 {
703 const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
705 rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
706 "The left-hand side (LHS) of the assignment has a different type than "
707 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
708 "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
709 "other type. This probably means that the RHS wraps either an "
710 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
711 "does not currently implement assignment from a Tpetra object to an "
712 "Epetra object, though this could be added with sufficient interest.");
713
714 RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector ();
716
718 rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
719 "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
720 "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
721 "report this bug to the Xpetra developers.");
723 lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
724 "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
725 "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
726 "this bug to the Xpetra developers.");
727
728 // Epetra_IntMultiVector's assignment operator does a deep copy.
729 *lhsImpl = *rhsImpl;
730 }
731
732
733 private:
736 };
737#endif
738
739 // specialization on GO=long long and Node=Serial
740#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
741 template<>
743 : public virtual MultiVector<int,int,long long,EpetraNode>
744 {
745 typedef int Scalar;
746 typedef int LocalOrdinal;
747 typedef long long GlobalOrdinal;
749
750 public:
751
753
754
756 EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut=true) {
757 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(map), NumVectors, zeroOut));
758 }
759
762 vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(source)));
763 }
764
766 EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* map */, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &/* ArrayOfPtrs */, size_t /* NumVectors */) {
768 "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
769 }
770
773
775
777
778
780 void putScalar(const int &value) {
781 int ierr = 0;
782 ierr = vec_->PutScalar(value);
783 TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returns a non zero error.");
784 }
785
787 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"); }
788
789
791
792 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"); }
793
794
796
798
799
803 }
804
808 }
809
813 XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
814
815 int ** arrayOfPointers;
816 vec_->ExtractView(&arrayOfPointers);
817 int * data = arrayOfPointers[j];
818 int localLength = vec_->MyLength();
819
820 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
821 }
822
826 XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
827
828 int ** arrayOfPointers;
829 vec_->ExtractView(&arrayOfPointers);
830 int * data = arrayOfPointers[j];
831 int localLength = vec_->MyLength();
832
833 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
834 }
835
837
839
840
842 const Teuchos::ArrayView<int> &/* dots */) const {
843 XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
844
845 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
847 }
848
851 XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
853 "This function is not available in Epetra_IntMultiVector");
854 }
855
858 XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
860 "This function is not implemented in Epetra_IntMultiVector");
861 }
862
864 void scale(const int &/* alpha */) {
865 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
867 }
868
871 XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
873 }
874
876 void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
877 XPETRA_MONITOR("EpetraIntMultiVectorT::update");
878
879 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
881 }
882
884 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 */) {
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.");
888 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
890 }
891
894
897
900
902 void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
903
905 void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
906
908 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"); }
909
911 void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
912 XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
913 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
914 }
915
917
919
920
922 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
923 vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
924 }
925
927 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
928 vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
929 }
930
932 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
933 vec_->ReplaceMyValue(myRow, vectorIndex, value);
934 }
935
937 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
938 vec_->SumIntoMyValue(myRow, vectorIndex, value);
939 }
940
942
944
945
947 size_t getNumVectors() const {
948 return vec_->NumVectors();
949 }
950
951
953 size_t getLocalLength() const { return vec_->MyLength(); }
954
956 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
957
958
961 XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
962 auto vv = toEpetra<GlobalOrdinal, Node>(vec);
963 return ( (getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
964 (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
965 }
967
969
970
972 std::string description() const {
973 XPETRA_MONITOR("EpetraIntMultiVectorT::description");
974
975 // This implementation come from Epetra_Vector_def.hpp (without modification)
976 std::ostringstream oss;
978 oss << "{length="<<this->getGlobalLength()
979 << "}";
980 return oss.str();
981 }
982
985 XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
986
987 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
988 using std::endl;
989 using std::setw;
991 using Teuchos::VERB_NONE;
992 using Teuchos::VERB_LOW;
994 using Teuchos::VERB_HIGH;
996
997 if (verbLevel > Teuchos::VERB_NONE)
998 vec_->Print(out);
999 }
1000
1002
1004
1006 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1007 }
1008
1009 // Implementing DistObject
1011 RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
1013 }
1014
1016 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1017 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1018
1019 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1020 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1021
1022 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
1023 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1024 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1025 }
1026
1028 const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
1029 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1030
1031 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1032 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1033
1034 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
1035 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1036 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1037 }
1038
1040 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1041 XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1042
1043 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1044 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1045
1046 const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
1047 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1048 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1049 }
1050
1052 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1053 XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1054
1055 XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1056 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1057
1058 const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
1059 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1060 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1061 }
1062
1064 XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
1065 int err = 0;
1066 if (!map.is_null()) {
1067 err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal,Node>(map));
1068
1069 } else {
1070 // Replace map with a dummy map to avoid potential hangs later
1071 Epetra_SerialComm SComm;
1072 Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
1073 err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
1074 }
1075 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1076 }
1077
1078 protected:
1081 virtual void
1083 {
1085 const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
1087 rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
1088 "The left-hand side (LHS) of the assignment has a different type than "
1089 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
1090 "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
1091 "other type. This probably means that the RHS wraps either an "
1092 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1093 "does not currently implement assignment from a Tpetra object to an "
1094 "Epetra object, though this could be added with sufficient interest.");
1095
1096 RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector ();
1098
1100 rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1101 "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
1102 "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
1103 "report this bug to the Xpetra developers.");
1105 lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1106 "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
1107 "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
1108 "this bug to the Xpetra developers.");
1109
1110 // Epetra_IntMultiVector's assignment operator does a deep copy.
1111 *lhsImpl = *rhsImpl;
1112 }
1113
1114
1115 private:
1118 };
1119#endif
1120
1121
1122} // namespace Xpetra
1123
1124#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)
Export data into this object using an Import object ("reverse mode").
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import data into this object using an Export object ("reverse mode").
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)
Export data into this object using an Export object ("forward mode").
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 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)
Import data into this object using an Import object ("forward mode").
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Sets all vector entries to zero.
RCP< Epetra_IntMultiVector > getEpetra_IntMultiVector() const
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 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)
Import data into this object using an Export object ("reverse mode").
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
Teuchos::ArrayRCP< const int > getData(size_t j) const
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)
Import data into this object using an Import object ("forward mode").
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)
Export data into this object using an Import object ("reverse mode").
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)
Export data into this object using an Export object ("forward mode").
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)
Export data into this object using an Import object ("reverse mode").
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)
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)
Import data into this object using an Import object ("forward mode").
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)
Export data into this object using an Export object ("forward mode").
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)
Import data into this object using an Export object ("reverse mode").
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)
View
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.