All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
59 namespace Xpetra {
60 
61 // TODO: move that elsewhere
62 template<class GlobalOrdinal, class Node>
63 Epetra_IntMultiVector & toEpetra(MultiVector<int, int, GlobalOrdinal, Node> &);
64 
65 template<class GlobalOrdinal, class Node>
66 const 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 
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 
303  RCP< Epetra_IntMultiVector > getEpetra_IntMultiVector() const { return Teuchos::null; }
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 
326  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& map) {
327  // do nothing
328  }
329 
330 
332 
333 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
335 
336  typename dual_view_type::t_host_um getHostLocalView () const {
337  throw std::runtime_error("EpetraIntVector does not support device views! Must be implemented extra...");
338 #ifndef __NVCC__ //prevent nvcc warning
339  typename dual_view_type::t_host_um ret;
340 #endif
342  }
343 
344  typename dual_view_type::t_dev_um getDeviceLocalView() const {
345  throw std::runtime_error("Epetra does not support device views!");
346 #ifndef __NVCC__ //prevent nvcc warning
347  typename dual_view_type::t_dev_um ret;
348 #endif
350  }
351 
352  template<class TargetDeviceType>
353  typename Kokkos::Impl::if_c<
354  Kokkos::Impl::is_same<
355  typename dual_view_type::t_dev_um::execution_space::memory_space,
356  typename TargetDeviceType::memory_space>::value,
357  typename dual_view_type::t_dev_um,
358  typename dual_view_type::t_host_um>::type
359  getLocalView () const {
360  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
361  }
362 #endif
363 
365 
366  protected:
369  virtual void
371  { }
372 
373 
374  private:
376  //RCP< Epetra_IntMultiVector > vec_;
377 
378  }; // class EpetraIntMultiVectorT
379 
380  // specialization on GO=int and Node=Serial
381 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
382  template<>
384  : public virtual MultiVector<int,int,int,EpetraNode>
385  {
386  typedef int Scalar;
387  typedef int LocalOrdinal;
388  typedef int GlobalOrdinal;
389  typedef EpetraNode Node;
390 
391  public:
392 
394 
395 
397  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut=true) {
398  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(map), NumVectors, zeroOut));
399  }
400 
403  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(source)));
404  }
405 
407  EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* map */, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &/* ArrayOfPtrs */, size_t /* NumVectors */) {
409  "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
410  }
411 
414 
416 
418 
419 
421  void putScalar(const int &value) {
422  int ierr = 0;
423  ierr = vec_->PutScalar(value);
424  TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returned an error.")
425  }
426 
428  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"); }
429 
430 
432 
433  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"); }
434 
435 
437 
439 
440 
444  }
445 
449  }
450 
454  XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
455 
456  int ** arrayOfPointers;
457  vec_->ExtractView(&arrayOfPointers);
458  int * data = arrayOfPointers[j];
459  int localLength = vec_->MyLength();
460 
461  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
462  }
463 
467  XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
468 
469  int ** arrayOfPointers;
470  vec_->ExtractView(&arrayOfPointers);
471  int * data = arrayOfPointers[j];
472  int localLength = vec_->MyLength();
473 
474  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
475  }
476 
478 
480 
481  void dot(const MultiVector<int,int,GlobalOrdinal,Node> &/* A */,
483  const Teuchos::ArrayView<int> &/* dots */) const {
484  XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
485 
486  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
488  "This function is not implemented in Epetra_IntMultiVector");
489  }
490 
493  XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
495  "This function is not available in Epetra_IntMultiVector");
496  }
497 
500  XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
501 
502  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
503  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::RuntimeError, "The reciprocal of an IntMultiVector is not defined!");
504  }
505 
507  void scale(const int &/* alpha */) {
508  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
510  }
511 
514  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
516  }
517 
519  void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
520  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
521 
522  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
524  }
525 
527  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 */) {
528  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
529 
530  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
531  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
533  }
534 
537 
540 
543 
545  void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
546 
548  void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
549 
551  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"); }
552 
554  void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
555  XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
556  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
557  }
558 
560 
562 
563 
565  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
566  vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
567  }
568 
570  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
571  vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
572  }
573 
575  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
576  vec_->ReplaceMyValue(myRow, vectorIndex, value);
577  }
578 
580  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
581  vec_->SumIntoMyValue(myRow, vectorIndex, value);
582  }
583 
585 
587 
588 
590  size_t getNumVectors() const {
591  return vec_->NumVectors();
592  }
593 
594 
596  size_t getLocalLength() const {
597  return vec_->MyLength();
598  }
599 
601  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
602 
605  XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
606  auto vv = toEpetra<GlobalOrdinal,Node>(vec);
607  return ( (getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
608  (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
609  }
610 
612 
614 
615 
617  std::string description() const {
618  XPETRA_MONITOR("EpetraIntMultiVectorT::description");
619 
620  // This implementation come from Epetra_Vector_def.hpp (without modification)
621  std::ostringstream oss;
623  oss << "{length="<<this->getGlobalLength()
624  << "}";
625  return oss.str();
626  }
627 
630  XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
631 
632  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
633  using std::endl;
634  using std::setw;
635  using Teuchos::VERB_DEFAULT;
636  using Teuchos::VERB_NONE;
637  using Teuchos::VERB_LOW;
638  using Teuchos::VERB_MEDIUM;
639  using Teuchos::VERB_HIGH;
640  using Teuchos::VERB_EXTREME;
641 
642  if (verbLevel > Teuchos::VERB_NONE)
643  vec_->Print(out);
644  }
645 
647 
649 
650  const RCP<const Comm<int> > getComm() const {
651  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
652  }
653 
654  // Implementing DistObject
656  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
658  }
659 
661  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
662  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
663 
664  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
665  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
666 
667  const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
668  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
669  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
670  }
671 
673  const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
674  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
675 
676  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
677  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
678 
679  const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
680  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
681  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
682  }
683 
685  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
686  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
687 
688  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
689  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
690 
691  const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
692  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
693  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
694  }
695 
697  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
698  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
699 
700  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
701  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
702 
703  const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
704  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
705  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
706  }
707 
708  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& map) {
709  XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
710  int err = 0;
711  if (!map.is_null()) {
712  err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal,Node>(map));
713 
714  } else {
715  // Replace map with a dummy map to avoid potential hangs later
716  Epetra_SerialComm SComm;
717  Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
718  err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
719  }
720  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
721  }
722 
723 
725 
726  #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
728 
729  typename dual_view_type::t_host_um getHostLocalView () const {
730  typedef Kokkos::View< typename dual_view_type::t_host::data_type ,
731  Kokkos::LayoutLeft,
732  typename dual_view_type::t_host::device_type ,
733  Kokkos::MemoryUnmanaged> epetra_view_type;
734 
735  // access Epetra vector data
736  int* data = NULL;
737  int myLDA;
738  vec_->ExtractView(&data, &myLDA);
739  int localLength = vec_->MyLength();
740  int numVectors = vec_->NumVectors();
741 
742  // create view
743  epetra_view_type test = epetra_view_type(data, localLength, numVectors);
744  typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
745 
746  return ret;
747  }
748 
749  typename dual_view_type::t_dev_um getDeviceLocalView() const {
750  throw std::runtime_error("Epetra does not support device views!");
751 #ifndef __NVCC__ //prevent nvcc warning
752  typename dual_view_type::t_dev_um ret;
753 #endif
755  }
756 
767  template<class TargetDeviceType>
768  typename Kokkos::Impl::if_c<
769  Kokkos::Impl::is_same<
770  typename dual_view_type::t_dev_um::execution_space::memory_space,
771  typename TargetDeviceType::memory_space>::value,
772  typename dual_view_type::t_dev_um,
773  typename dual_view_type::t_host_um>::type
774  getLocalView () const {
775  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
776  }
777  #endif
778 
780 
781  protected:
784  virtual void
786  {
788  const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
790  rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
791  "The left-hand side (LHS) of the assignment has a different type than "
792  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
793  "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
794  "other type. This probably means that the RHS wraps either an "
795  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
796  "does not currently implement assignment from a Tpetra object to an "
797  "Epetra object, though this could be added with sufficient interest.");
798 
799  RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector ();
801 
803  rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
804  "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
805  "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
806  "report this bug to the Xpetra developers.");
808  lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
809  "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
810  "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
811  "this bug to the Xpetra developers.");
812 
813  // Epetra_IntMultiVector's assignment operator does a deep copy.
814  *lhsImpl = *rhsImpl;
815  }
816 
817 
818  private:
821  };
822 #endif
823 
824  // specialization on GO=long long and Node=Serial
825 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
826  template<>
828  : public virtual MultiVector<int,int,long long,EpetraNode>
829  {
830  typedef int Scalar;
831  typedef int LocalOrdinal;
832  typedef long long GlobalOrdinal;
833  typedef EpetraNode Node;
834 
835  public:
836 
838 
839 
841  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut=true) {
842  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(map), NumVectors, zeroOut));
843  }
844 
847  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal,Node>(source)));
848  }
849 
851  EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* map */, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &/* ArrayOfPtrs */, size_t /* NumVectors */) {
853  "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
854  }
855 
858 
860 
862 
863 
865  void putScalar(const int &value) {
866  int ierr = 0;
867  ierr = vec_->PutScalar(value);
868  TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returns a non zero error.");
869  }
870 
872  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"); }
873 
874 
876 
877  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"); }
878 
879 
881 
883 
884 
888  }
889 
893  }
894 
898  XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
899 
900  int ** arrayOfPointers;
901  vec_->ExtractView(&arrayOfPointers);
902  int * data = arrayOfPointers[j];
903  int localLength = vec_->MyLength();
904 
905  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
906  }
907 
911  XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
912 
913  int ** arrayOfPointers;
914  vec_->ExtractView(&arrayOfPointers);
915  int * data = arrayOfPointers[j];
916  int localLength = vec_->MyLength();
917 
918  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
919  }
920 
922 
924 
925  void dot(const MultiVector<int,int,GlobalOrdinal,Node> &/* A */,
927  const Teuchos::ArrayView<int> &/* dots */) const {
928  XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
929 
930  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
932  }
933 
936  XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
938  "This function is not available in Epetra_IntMultiVector");
939  }
940 
943  XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
945  "This function is not implemented in Epetra_IntMultiVector");
946  }
947 
949  void scale(const int &/* alpha */) {
950  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
952  }
953 
956  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
958  }
959 
961  void update(const int &/* alpha */, const MultiVector<int,int,GlobalOrdinal,Node> &/* A */, const int &/* beta */) {
962  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
963 
964  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
966  }
967 
969  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 */) {
970  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
971 
972  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
973  //XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
975  }
976 
979 
982 
985 
987  void meanValue(const Teuchos::ArrayView<int> &/* means */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
988 
990  void maxValue(const Teuchos::ArrayView<int> &/* maxs */) const { XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue"); TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO"); }
991 
993  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"); }
994 
996  void elementWiseMultiply(int /* scalarAB */, const Vector<int,int,GlobalOrdinal,Node> &/* A */, const MultiVector<int,int,GlobalOrdinal,Node> &/* B */, int /* scalarThis */) {
997  XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
998  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
999  }
1000 
1002 
1004 
1005 
1007  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
1008  vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
1009  }
1010 
1012  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
1013  vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
1014  }
1015 
1017  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
1018  vec_->ReplaceMyValue(myRow, vectorIndex, value);
1019  }
1020 
1022  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
1023  vec_->SumIntoMyValue(myRow, vectorIndex, value);
1024  }
1025 
1027 
1029 
1030 
1032  size_t getNumVectors() const {
1033  return vec_->NumVectors();
1034  }
1035 
1036 
1038  size_t getLocalLength() const { return vec_->MyLength(); }
1039 
1041  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
1042 
1043 
1046  XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
1047  auto vv = toEpetra<GlobalOrdinal, Node>(vec);
1048  return ( (getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
1049  (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
1050  }
1052 
1054 
1055 
1057  std::string description() const {
1058  XPETRA_MONITOR("EpetraIntMultiVectorT::description");
1059 
1060  // This implementation come from Epetra_Vector_def.hpp (without modification)
1061  std::ostringstream oss;
1063  oss << "{length="<<this->getGlobalLength()
1064  << "}";
1065  return oss.str();
1066  }
1067 
1070  XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
1071 
1072  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
1073  using std::endl;
1074  using std::setw;
1075  using Teuchos::VERB_DEFAULT;
1076  using Teuchos::VERB_NONE;
1077  using Teuchos::VERB_LOW;
1078  using Teuchos::VERB_MEDIUM;
1079  using Teuchos::VERB_HIGH;
1080  using Teuchos::VERB_EXTREME;
1081 
1082  if (verbLevel > Teuchos::VERB_NONE)
1083  vec_->Print(out);
1084  }
1085 
1087 
1089 
1090  const RCP<const Comm<int> > getComm() const {
1091  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1092  }
1093 
1094  // Implementing DistObject
1096  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
1097  return rcp (new Xpetra::EpetraMapT<GlobalOrdinal, Node>(map));
1098  }
1099 
1101  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1102  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1103 
1104  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1105  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1106 
1107  const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
1108  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1109  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1110  }
1111 
1113  const Import<int, GlobalOrdinal, Node>& importer, CombineMode CM) {
1114  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1115 
1116  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1117  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1118 
1119  const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
1120  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1121  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1122  }
1123 
1125  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1126  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1127 
1128  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1129  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1130 
1131  const Epetra_IntMultiVector & v = *tSource.getEpetra_IntMultiVector();
1132  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1133  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1134  }
1135 
1137  const Export<int, GlobalOrdinal, Node>& exporter, CombineMode CM) {
1138  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1139 
1140  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1141  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1142 
1143  const Epetra_IntMultiVector & v = *tDest.getEpetra_IntMultiVector();
1144  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1145  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1146  }
1147 
1148  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> >& map) {
1149  XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
1150  int err = 0;
1151  if (!map.is_null()) {
1152  err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal,Node>(map));
1153 
1154  } else {
1155  // Replace map with a dummy map to avoid potential hangs later
1156  Epetra_SerialComm SComm;
1157  Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
1158  err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
1159  }
1160  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1161  }
1162 
1163 
1165 
1166  #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1168 
1169  typename dual_view_type::t_host_um getHostLocalView () const {
1170  typedef Kokkos::View< typename dual_view_type::t_host::data_type ,
1171  Kokkos::LayoutLeft,
1172  typename dual_view_type::t_host::device_type ,
1173  Kokkos::MemoryUnmanaged> epetra_view_type;
1174 
1175  // access Epetra vector data
1176  int* data = NULL;
1177  int myLDA;
1178  vec_->ExtractView(&data, &myLDA);
1179  int localLength = vec_->MyLength();
1180  int numVectors = vec_->NumVectors();
1181 
1182  // create view
1183  epetra_view_type test = epetra_view_type(data, localLength, numVectors);
1184  typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
1185 
1186  return ret;
1187  }
1188 
1189  typename dual_view_type::t_dev_um getDeviceLocalView() const {
1190  throw std::runtime_error("Epetra does not support device views!");
1191 #ifndef __NVCC__ //prevent nvcc warning
1192  typename dual_view_type::t_dev_um ret;
1193 #endif
1195  }
1196 
1207  template<class TargetDeviceType>
1208  typename Kokkos::Impl::if_c<
1209  Kokkos::Impl::is_same<
1210  typename dual_view_type::t_dev_um::execution_space::memory_space,
1211  typename TargetDeviceType::memory_space>::value,
1212  typename dual_view_type::t_dev_um,
1213  typename dual_view_type::t_host_um>::type
1214  getLocalView () const {
1215  return this->MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::template getLocalView<TargetDeviceType>();
1216  }
1217  #endif
1218 
1220 
1221  protected:
1224  virtual void
1226  {
1228  const this_type* rhsPtr = dynamic_cast<const this_type*> (&rhs);
1230  rhsPtr == NULL, std::invalid_argument, "Xpetra::MultiVector::operator=: "
1231  "The left-hand side (LHS) of the assignment has a different type than "
1232  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
1233  "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
1234  "other type. This probably means that the RHS wraps either an "
1235  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1236  "does not currently implement assignment from a Tpetra object to an "
1237  "Epetra object, though this could be added with sufficient interest.");
1238 
1239  RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector ();
1241 
1243  rhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1244  "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
1245  "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
1246  "report this bug to the Xpetra developers.");
1248  lhsImpl.is_null (), std::logic_error, "Xpetra::MultiVector::operator= "
1249  "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
1250  "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
1251  "this bug to the Xpetra developers.");
1252 
1253  // Epetra_IntMultiVector's assignment operator does a deep copy.
1254  *lhsImpl = *rhsImpl;
1255  }
1256 
1257 
1258  private:
1261  };
1262 #endif
1263 
1264 
1265 } // namespace Xpetra
1266 
1267 #endif // XPETRA_EPETRAINTMULTIVECTOR_HPP
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. (copy).
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Sets all vector entries to zero.
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Sets all vector entries to zero.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
RCP< Epetra_IntMultiVector > getEpetra_IntMultiVector() const
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
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.
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 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< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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 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.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
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,j).
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
Exception throws to report errors in the internal logical of the program.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
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 > > &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. (copy).
void scale(const int &)
Scale the current values of a multi-vector, this = alpha*this.
void meanValue(const Teuchos::ArrayView< int > &) const
Compute mean (average) value of each vector in multi-vector.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in multi-vector.
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
size_t getNumVectors() const
Returns the number 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.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void scale(const int &alpha)
Scale the current values of a multi-vector, this = alpha*this.
RCP< Epetra_IntMultiVector > vec_
The Epetra_IntMultiVector which this class wraps.
const RCP< const Comm< int > > getComm() const
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-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].
std::string description() const
Return a simple one-line description of this object.
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
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 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 reciprocal(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
void randomize(bool=true)
Set multi-vector values to random numbers.
void setSeed(unsigned int)
Set seed for Random function.
void scale(Teuchos::ArrayView< const int > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void putScalar(const int &value)
Initialize all values in a multi-vector with specified value.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
Teuchos::RCP< const Map< int, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
RCP< Epetra_IntMultiVector > getEpetra_IntMultiVector() const
void randomize(bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
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 normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute Inf-norm of each vector in multi-vector.
size_t getLocalLength() const
Returns the local vector length on the calling processor of vectors in the multi-vector.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
Teuchos::ArrayRCP< int > getDataNonConst(size_t j)
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
virtual std::string description() const
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.
global_size_t getGlobalLength() const
Returns the global vector length of vectors in the multi-vector.
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
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
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.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
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,j).
Exception throws when you call an unimplemented method of Xpetra.
void setSeed(unsigned int seed)
Set seed for Random function.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm 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 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.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
void scale(Teuchos::ArrayView< const int >)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
size_t global_size_t
Global size_t object.
static const EVerbosityLevel verbLevel_default
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 2-norm of each vector in multi-vector.
void maxValue(const Teuchos::ArrayView< int > &) const
Compute max value of each vector in multi-vector.
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. (copy).
void randomize(bool=true)
Set multi-vector values to random numbers.
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 norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 2-norm of each vector in 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 doImport(const DistObject< int, int, GlobalOrdinal, Node > &source, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void replaceMap(const RCP< const Map< int, GlobalOrdinal, Node > > &map)
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &norms) const
Compute 1-norm 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 norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< int >::magnitudeType > &) const
Compute 1-norm of each vector in multi-vector.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
RCP< Epetra_IntMultiVector > vec_
The Epetra_IntMultiVector which this class wraps.
std::string description() const
Return a simple one-line description of this object.
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void multiply(Teuchos::ETransp, Teuchos::ETransp, const int &, const MultiVector< int, int, GlobalOrdinal, Node > &, const MultiVector< int, int, GlobalOrdinal, Node > &, const int &)
Matrix-Matrix multiplication, this = beta*this + alpha*op(A)*op(B).
void maxValue(const Teuchos::ArrayView< int > &maxs) const
Compute max value of each vector in multi-vector.
CombineMode
Xpetra::Combine Mode enumerable type.
void setSeed(unsigned int)
Set seed for Random function.
#define XPETRA_MONITOR(funcName)
int ReplaceMap(const Epetra_BlockMap &map)
void meanValue(const Teuchos::ArrayView< int > &means) const
Compute mean (average) value of each vector in multi-vector.
std::string description() const
Return a simple one-line description of this object.
void doExport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< int, GlobalOrdinal, Node > &importer, CombineMode CM)
Teuchos::ArrayRCP< const int > getData(size_t j) const
EpetraIntMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Sets all vector entries to zero.
void doImport(const DistObject< int, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< int, GlobalOrdinal, Node > &exporter, CombineMode CM)
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
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::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
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).
bool is_null() const