Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_EpetraIntVector.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Xpetra: A linear algebra interface package
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef XPETRA_EPETRAINTVECTOR_HPP
47#define XPETRA_EPETRAINTVECTOR_HPP
48
50
51#include "Xpetra_ConfigDefs.hpp"
52#include "Xpetra_MultiVector.hpp"
53#include "Xpetra_Vector.hpp"
54#include "Xpetra_Exceptions.hpp"
55
56#include "Xpetra_EpetraMap.hpp"
58#include "Epetra_IntVector.h"
59
60namespace Xpetra {
61
62// TODO: move that elsewhere
63template<class GlobalOrdinal, class Node>
65
66template<class GlobalOrdinal, class Node>
67const Epetra_IntVector & toEpetra(const Vector<int, int, GlobalOrdinal, Node> &);
68//
69
70 // stub implementation for EpetraIntVectorT
71 template<class EpetraGlobalOrdinal, class Node>
73 : public Vector<int,int,EpetraGlobalOrdinal, Node>
74 {
75 typedef int Scalar;
76 typedef int LocalOrdinal;
77 typedef EpetraGlobalOrdinal GlobalOrdinal;
78
79 public:
80
82
83
85 explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut=true) { }
86
89
91
93
94
97
98
101
102
105
108
111
114
115
117
119
120
122 void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
123
125 void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
126
128 void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
129
131 void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
132
134 void putScalar(const int &value) { }
135
137 void randomize(bool bUseXpetraImplementation = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
138
140 void randomize(const Scalar& /*minVal*/, const Scalar& /*maxVal*/, bool bUseXpetraImplementation = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
141
142
144
145 void setSeed(unsigned int seed) { XPETRA_MONITOR("EpetraIntVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra"); }
146
147
149
151
152
157
162
166
170
172
174
175
177
180
183
185 void scale(const int &alpha) { }
186
189 XPETRA_MONITOR("EpetraIntVectorT::scale");
191 }
192
194 void update(const int &alpha, const MultiVector<int,int,GlobalOrdinal,Node> &A, const int &beta) {
195 XPETRA_MONITOR("EpetraIntVectorT::update");
196
197 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
199 }
200
202 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) {
203 XPETRA_MONITOR("EpetraIntVectorT::update");
204
205 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
206 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
208 }
209
212
215
218
220 void meanValue(const Teuchos::ArrayView<int> &means) const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
221
223 void maxValue(const Teuchos::ArrayView<int> &maxs) const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
224
226 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("EpetraIntVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
227
230 XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
231 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
232 }
233
235
237
238
240 void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
241
243 void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
244
246 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
247
249 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
250
252
254
255
257 size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntVectorT::getNumVectors"); return 1; }
258
259
261 size_t getLocalLength() const { return 0; }
262
264 global_size_t getGlobalLength() const { return 0; }
265
267 bool isSameSize(const MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & vec) const { return false; }
268
270
272
273
275 std::string description() const {
276 return std::string("");
277 }
278
281
283
284 RCP< Epetra_IntVector > getEpetra_IntVector() const { return Teuchos::null; }
285
286 const RCP<const Comm<int> > getComm() const {
287 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
288 }
289
290 // Implementing DistObject
292 return Teuchos::null;
293 }
294
297
300
303
306
308 // do nothing
309 }
310
311 protected:
314 virtual void
317
318
319 private:
321 //RCP< Epetra_IntVector > vec_;
322
323 }; // class EpetraIntVectorT
324
325 // specialization on GO=int and Node=Serial
326#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
327 template<>
329 : public virtual Vector<int,int,int,EpetraNode>
330 {
331 typedef int Scalar;
332 typedef int LocalOrdinal;
333 typedef int GlobalOrdinal;
335
336 public:
337
339
340
342 explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut=true)
343 {
345 }
346
349
351
353
354
357
358
361
362
365
368
371
373 int maxValue() const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); return vec_->MaxValue(); }
374
375
377
379
380
382 void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
383
385 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
386
388 void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");(*vec_)[myRow] = value; }
389
391 void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); (*vec_)[myRow] += value;}
392
394 void putScalar(const int &value) { vec_->PutValue(value); }
395
397 void randomize(bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
398
400 void randomize(const Scalar& /*minVal*/, const Scalar& /*maxVal*/, bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
401
403
404 void setSeed(unsigned int /* seed */) { XPETRA_MONITOR("EpetraIntVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra"); }
405
407
408 typename dual_view_type::t_host_const_um getHostLocalView (Access::ReadOnlyStruct) const override { return getHostLocalView(Access::ReadWrite); }
409
410 typename dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const override { return getDeviceLocalView(Access::ReadWrite); }
411
412 typename dual_view_type::t_host_um getHostLocalView (Access::OverwriteAllStruct) const override { return getHostLocalView(Access::ReadWrite); }
413
414 typename dual_view_type::t_dev_um getDeviceLocalView(Access::OverwriteAllStruct) const override { return getDeviceLocalView(Access::ReadWrite); }
415
416 typename dual_view_type::t_host_um getHostLocalView (Access::ReadWriteStruct) const override {
417 typedef Kokkos::View< typename dual_view_type::t_host::data_type ,
418 Kokkos::LayoutLeft,
419 typename dual_view_type::t_host::device_type ,
420 Kokkos::MemoryUnmanaged> epetra_view_type;
421 // access Epetra vector data
422 Scalar* data = NULL;
423 vec_->ExtractView(&data);
424 int localLength = vec_->MyLength();
425
426 // create view
427 epetra_view_type test = epetra_view_type(data, localLength, 1);
428 typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
429 return ret;
430 }
431
432 typename dual_view_type::t_dev_um getDeviceLocalView(Access::ReadWriteStruct) const override { return getHostLocalView(Access::ReadWrite); }
433
434
436
438
439
444
449
452 Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
453 XPETRA_MONITOR("EpetraIntVectorT::getData");
454
455 int * data = vec_->Values();
456 int localLength = vec_->MyLength();
457
458 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
459 }
460
464 XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
465
466 int * data = vec_->Values();
467 int localLength = vec_->MyLength();
468
469 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
470 }
471
473
475
476
477 void dot(const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const Teuchos::ArrayView<int> &/* dots */) const {
478 XPETRA_MONITOR("EpetraIntVectorT::dot");
479
480 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
482 }
483
486 XPETRA_MONITOR("EpetraIntVectorT::abs");
487
488 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
490 }
491
494 XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
495
496 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
498 }
499
501 void scale(const int &/* alpha */) {
502 XPETRA_MONITOR("EpetraIntVectorT::scale");
504 }
505
508 XPETRA_MONITOR("EpetraIntVectorT::scale");
510 }
511
513 void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
514 XPETRA_MONITOR("EpetraIntVectorT::update");
515
516 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
518 }
519
521 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 */) {
522 XPETRA_MONITOR("EpetraIntVectorT::update");
523
524 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
525 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
527 }
528
531
534
537
539 void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
540
542 void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
543
545 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("EpetraIntVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
546
548 void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
549 XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
550 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
551 }
552
554
556
557
559 void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
560
562 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
563
565 void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
566
568 void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
569
571
573
574
576 size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntVectorT::getNumVectors"); return 1; }
577
578
580 size_t getLocalLength() const { return vec_->MyLength(); }
581
583 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
584
587 XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
589 if(!asvec) return false;
590 auto vv = toEpetra(*asvec);
591 return ( (vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
592 }
593
595
597
598
600 std::string description() const {
601 XPETRA_MONITOR("EpetraIntVectorT::description");
602
603 // This implementation come from Epetra_Vector_def.hpp (without modification)
604 std::ostringstream oss;
606 oss << "{length="<<this->getGlobalLength()
607 << "}";
608 return oss.str();
609 }
610
613 XPETRA_MONITOR("EpetraIntVectorT::describe");
614
615 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
616 using std::endl;
617 using std::setw;
619 using Teuchos::VERB_NONE;
620 using Teuchos::VERB_LOW;
622 using Teuchos::VERB_HIGH;
624
625 if (verbLevel > Teuchos::VERB_NONE)
626 vec_->Print(out);
627 }
628
630
632
633 const RCP<const Comm<int> > getComm() const {
634 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
635 }
636
637 // Implementing DistObject
642
644 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
645 XPETRA_MONITOR("EpetraIntVectorT::doImport");
646
647 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
648 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
649
650 const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
651 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
652 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
653 }
654
656 const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
657 XPETRA_MONITOR("EpetraIntVectorT::doExport");
658
659 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
660 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
661
662 const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
663 int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
664 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
665 }
666
668 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
669 XPETRA_MONITOR("EpetraIntVectorT::doImport");
670
671 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
672 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
673
674 const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
675 int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
676 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
677 }
678
680 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
681 XPETRA_MONITOR("EpetraIntVectorT::doExport");
682
683 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
684 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
685
686 const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
687 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
688 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
689 }
690
691 void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& /* map */) {
692 // do nothing
693 }
694
695 protected:
698 virtual void
700 {
702 const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
704 rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
705 "The left-hand side (LHS) of the assignment has a different type than "
706 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
707 "(which means it wraps an Epetra_IntVector), but the RHS has some "
708 "other type. This probably means that the RHS wraps either an "
709 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
710 "does not currently implement assignment from a Tpetra object to an "
711 "Epetra object, though this could be added with sufficient interest.");
712
713 RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector ();
715
717 rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
718 "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
719 "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
720 "report this bug to the Xpetra developers.");
722 lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
723 "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
724 "assignment has a null RCP<Epetra_IntVector> inside. Please report "
725 "this bug to the Xpetra developers.");
726
727 // Epetra_IntVector's assignment operator does a deep copy.
728 *lhsImpl = *rhsImpl;
729 }
730
731
732 private:
735 };
736#endif
737
738 // specialization on GO=long long and Node=Serial
739#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
740 template<>
741 class EpetraIntVectorT<long long, EpetraNode>
742 : public virtual Vector<int,int,long long,EpetraNode>
743 {
744 typedef int Scalar;
745 typedef int LocalOrdinal;
746 typedef long long GlobalOrdinal;
748
749 public:
750
752
753
755 explicit EpetraIntVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, bool zeroOut=true)
756 {
758 }
759
762
764
766
767
769 int dot(const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &/* a */) const { XPETRA_MONITOR("EpetraIntVectorT::dot"); TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */ }
770
771
774
775
778
781
783 int meanValue() const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::NotImplemented, "TODO"); /* return -1; */ }
784
786 int maxValue() const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); return Teuchos::as<int>(vec_->MaxValue()); }
787
789
791
792
794 void replaceGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
795
797 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
798
800 void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue");(*vec_)[myRow] = value;}
801
803 void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); (*vec_)[myRow] += value;}
804
806 void putScalar(const int &value) { vec_->PutValue(value); }
807
809 void randomize(bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
810
812 void randomize(const Scalar& /*minVal*/, const Scalar& /*maxVal*/, bool /* bUseXpetraImplementation */ = true) { XPETRA_MONITOR("EpetraIntVectorT::randomize"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::randomize(): Functionnality not available in Epetra"); }
813
815
816 void setSeed(unsigned int /* seed */) { XPETRA_MONITOR("EpetraIntVectorT::setSeed"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntVectorT::setSeed(): Functionnality not available in Epetra"); }
817
818
820
822
823
828
833
836 Teuchos::ArrayRCP<const int> getData(size_t /* j */) const {
837 XPETRA_MONITOR("EpetraIntVectorT::getData");
838
839 int * data = vec_->Values();
840 int localLength = vec_->MyLength();
841
842 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
843 }
844
848 XPETRA_MONITOR("EpetraIntVectorT::getDataNonConst");
849
850 int * data = vec_->Values();
851 int localLength = vec_->MyLength();
852
853 return ArrayRCP<int>(data, 0, localLength, false); // not ownership
854 }
855
857
859
860
861 void dot(const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const Teuchos::ArrayView<int> &/* dots */) const {
862 XPETRA_MONITOR("EpetraIntVectorT::dot");
863
864 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
866 }
867
870 XPETRA_MONITOR("EpetraIntVectorT::abs");
871
872 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
874 }
875
878 XPETRA_MONITOR("EpetraIntVectorT::reciprocal");
879
880 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
882 }
883
885 void scale(const int &/* alpha */) {
886 XPETRA_MONITOR("EpetraIntVectorT::scale");
888 }
889
892 XPETRA_MONITOR("EpetraIntVectorT::scale");
894 }
895
897 void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
898 XPETRA_MONITOR("EpetraIntVectorT::update");
899
900 // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
902 }
903
905 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 */) {
906 XPETRA_MONITOR("EpetraIntVectorT::update");
907
908 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
909 //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
911 }
912
915
918
921
923 void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
924
926 void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
927
929 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("EpetraIntVectorT::multiply"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra"); }
930
932 void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
933 XPETRA_MONITOR("EpetraIntVectorT::elementWiseMultiply");
934 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntVector: elementWiseMultiply not implemented because Epetra_IntVector does not support this operation");
935 }
936
938
940
941
943 void replaceGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
944
946 void sumIntoGlobalValue(GlobalOrdinal /* globalRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoGlobalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
947
949 void replaceLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::replaceLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
950
952 void sumIntoLocalValue(LocalOrdinal /* myRow */, size_t /* vectorIndex */, const Scalar &/* value */) { XPETRA_MONITOR("EpetraIntVectorT::sumIntoLocalValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
953
955
957
958
960 size_t getNumVectors() const { XPETRA_MONITOR("EpetraIntVectorT::getNumVectors"); return 1; }
961
962
964 size_t getLocalLength() const { return vec_->MyLength(); }
965
967 global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
968
969
972 XPETRA_MONITOR("EpetraIntVectorT::isSameSize");
974 if(!asvec) return false;
975 auto vv = toEpetra(*asvec);
976 return ( (vec_->MyLength() == vv.MyLength()) && (getNumVectors() == vec.getNumVectors()));
977 }
978
979
981
982
984 std::string description() const {
985 XPETRA_MONITOR("EpetraIntVectorT::description");
986
987 // This implementation come from Epetra_Vector_def.hpp (without modification)
988 std::ostringstream oss;
990 oss << "{length="<<this->getGlobalLength()
991 << "}";
992 return oss.str();
993 }
994
997 XPETRA_MONITOR("EpetraIntVectorT::describe");
998
999 // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
1000 using std::endl;
1001 using std::setw;
1003 using Teuchos::VERB_NONE;
1004 using Teuchos::VERB_LOW;
1006 using Teuchos::VERB_HIGH;
1008
1009 if (verbLevel > Teuchos::VERB_NONE)
1010 vec_->Print(out);
1011 }
1012
1014
1016
1018 TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1019 }
1020
1021 // Implementing DistObject
1026
1028 const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1029 XPETRA_MONITOR("EpetraIntVectorT::doImport");
1030
1031 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1032 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1033
1034 const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
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 Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
1041 XPETRA_MONITOR("EpetraIntVectorT::doExport");
1042
1043 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1044 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1045
1046 const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
1047 int err = vec_->Import(v, *tImporter.getEpetra_Import(), 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("EpetraIntVectorT::doImport");
1054
1055 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1056 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1057
1058 const Epetra_IntVector & v = *tSource.getEpetra_IntVector();
1059 int err = vec_->Import(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 const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1065 XPETRA_MONITOR("EpetraIntVectorT::doExport");
1066
1067 XPETRA_DYNAMIC_CAST(const EpetraIntVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraIntVectorT as input arguments.");
1068 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1069
1070 const Epetra_IntVector & v = *tDest.getEpetra_IntVector();
1071 int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1072 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1073 }
1074
1075 void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& /* map */) {
1076 // do nothing
1077 }
1078
1079 protected:
1082 virtual void
1084 {
1085 typedef EpetraIntVectorT<GlobalOrdinal, Node> this_type;
1086 const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
1088 rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
1089 "The left-hand side (LHS) of the assignment has a different type than "
1090 "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntVectorT "
1091 "(which means it wraps an Epetra_IntVector), but the RHS has some "
1092 "other type. This probably means that the RHS wraps either an "
1093 "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1094 "does not currently implement assignment from a Tpetra object to an "
1095 "Epetra object, though this could be added with sufficient interest.");
1096
1097 RCP<const Epetra_IntVector> rhsImpl = rhsPtr->getEpetra_IntVector ();
1098 RCP<Epetra_IntVector> lhsImpl = this->getEpetra_IntVector ();
1099
1101 rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1102 "(in Xpetra::EpetraIntVectorT::assign): *this (the right-hand side of "
1103 "the assignment) has a null RCP<Epetra_IntVector> inside. Please "
1104 "report this bug to the Xpetra developers.");
1106 lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1107 "(in Xpetra::EpetraIntVectorT::assign): The left-hand side of the "
1108 "assignment has a null RCP<Epetra_IntVector> inside. Please report "
1109 "this bug to the Xpetra developers.");
1110
1111 // Epetra_IntVector's assignment operator does a deep copy.
1112 *lhsImpl = *rhsImpl;
1113 }
1114
1115
1116 private:
1119 };
1120#endif
1121
1122
1123} // namespace Xpetra
1124
1125#endif // XPETRA_EPETRAINTVECTOR_HPP
#define XPETRA_MONITOR(funcName)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
static const EVerbosityLevel verbLevel_default
virtual std::string description() const
bool is_null() const
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
int maxValue() const
Compute max value of this Vector.
const RCP< const Comm< int > > getComm() const
dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const override
dual_view_type::t_host_um getHostLocalView(Access::ReadWriteStruct) const override
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void setSeed(unsigned int)
Set seed for Random function.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void multiply(Teuchos::ETransp, Teuchos::ETransp, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Matrix-Matrix multiplication, this = beta*this + alpha*op(A)*op(B).
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void dot(const MultiVector< int, int, GlobalOrdinal, Node > &, const Teuchos::ArrayView< int > &) const
Computes dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &)
void reciprocal(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
dual_view_type::t_dev_um getDeviceLocalView(Access::OverwriteAllStruct) const override
void elementWiseMultiply(int, const Vector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, int)
Element-wise multiply of a Vector A with a EpetraMultiVector B.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const override
void sumIntoGlobalValue(GlobalOrdinal, const Scalar &)
Adds specified value to existing value at the specified location.
Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
dual_view_type::t_host_um getHostLocalView(Access::OverwriteAllStruct) const override
void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
void replaceGlobalValue(GlobalOrdinal, const Scalar &)
Replace current value at the specified location with specified value.
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
void randomize(bool=true)
Set multi-vector values to random numbers.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
dual_view_type::t_dev_um getDeviceLocalView(Access::ReadWriteStruct) const override
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
TODO missing comment.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
int meanValue() const
Compute mean (average) value of this Vector.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export data into this object using an Export object ("forward mode").
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
void randomize(const Scalar &, const Scalar &, bool=true)
Set multi-vector values to random numbers.
Teuchos::ArrayRCP< const int > getData(size_t) const
std::string description() const
Return a simple one-line description of this object.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this).
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
TODO missing comment.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
Teuchos::ArrayRCP< const int > getData(size_t) const
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
void reciprocal(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this).
void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
RCP< Epetra_IntVector > vec_
The Epetra_IntVector which this class wraps.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export data into this object using an Export object ("forward mode").
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
void randomize(const Scalar &, const Scalar &, bool=true)
Set multi-vector values to random numbers.
void elementWiseMultiply(int, const Vector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, int)
Element-wise multiply of a Vector A with a EpetraMultiVector B.
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
int meanValue() const
Compute mean (average) value of this Vector.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
void sumIntoGlobalValue(GlobalOrdinal, const Scalar &)
Adds specified value to existing value at the specified location.
void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void randomize(bool=true)
Set multi-vector values to random numbers.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void setSeed(unsigned int)
Set seed for Random function.
void replaceGlobalValue(GlobalOrdinal, const Scalar &)
Replace current value at the specified location with specified value.
std::string description() const
Return a simple one-line description of this object.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &)
int maxValue() const
Compute max value of this Vector.
void update(const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void dot(const MultiVector< int, int, GlobalOrdinal, Node > &, const Teuchos::ArrayView< int > &) const
Computes dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
void multiply(Teuchos::ETransp, Teuchos::ETransp, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Matrix-Matrix multiplication, this = beta*this + alpha*op(A)*op(B).
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this).
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const int &alpha, const MultiVector< int, int, GlobalOrdinal, Node > &A, const MultiVector< int, int, GlobalOrdinal, Node > &B, const int &beta)
Matrix-Matrix multiplication, this = beta*this + alpha*op(A)*op(B).
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
EpetraIntVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, bool zeroOut=true)
Sets all vector entries to zero.
RCP< Epetra_IntVector > getEpetra_IntVector() const
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
std::string description() const
Return a simple one-line description of this object.
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
int maxValue() const
Compute max value of this Vector.
void randomize(const Scalar &, const Scalar &, bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
Teuchos::ArrayRCP< int > getDataNonConst(size_t j)
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void dot(const MultiVector< int, int, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< int > &dots) const
Computes dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
Teuchos::ArrayRCP< const int > getData(size_t j) const
void meanValue(const Teuchos::ArrayView< int > &means) const
Compute mean (average) value of each vector in multi-vector.
Teuchos::ScalarTraits< int >::magnitudeType norm1() const
Return 1-norm of this Vector.
void randomize(bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
const RCP< const Comm< int > > getComm() const
void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Adds specified value to existing value at the specified location.
void reciprocal(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Adds specified value to existing value at the specified location.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
Teuchos::ScalarTraits< int >::magnitudeType normInf() const
Compute Inf-norm of this Vector.
void elementWiseMultiply(int scalarAB, const Vector< int, int, GlobalOrdinal, Node > &A, const MultiVector< int, int, GlobalOrdinal, Node > &B, int scalarThis)
Element-wise multiply of a Vector A with a EpetraMultiVector B.
void update(const int &alpha, const MultiVector< int, int, GlobalOrdinal, Node > &A, const int &beta, const MultiVector< int, int, GlobalOrdinal, Node > &B, const int &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace current value at the specified location with specified value.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export data into this object using an Export object ("forward mode").
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 2-norm of each vector in multi-vector.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
void update(const int &alpha, const MultiVector< int, int, GlobalOrdinal, Node > &A, const int &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void scale(Teuchos::ArrayView< const int > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void setSeed(unsigned int seed)
Set seed for Random function.
Teuchos::ScalarTraits< int >::magnitudeType norm2() const
Compute 2-norm of this Vector.
void maxValue(const Teuchos::ArrayView< int > &maxs) const
Compute max value of each vector in multi-vector.
void scale(const int &alpha)
Scale the current values of a multi-vector, this = alpha*this.
int dot(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &a) const
TODO missing comment.
void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace current value at the specified location with specified values.
int meanValue() const
Compute mean (average) value of this Vector.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
Exception throws when you call an unimplemented method of Xpetra.
virtual size_t getNumVectors() const =0
Number of columns in the multivector.
virtual dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TypeTo as(const TypeFrom &t)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
basic_FancyOStream< char > FancyOStream
constexpr struct ReadWriteStruct ReadWrite
Xpetra namespace
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
size_t global_size_t
Global size_t object.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
CombineMode
Xpetra::Combine Mode enumerable type.