Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros 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 #if defined(XPETRA_ENABLE_DEPRECATED_CODE)
60 #ifdef __GNUC__
61 #warning "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp is deprecated."
62 #endif
63 #else
64 #error "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraIntMultiVector.hpp is deprecated."
65 #endif
66 
67 namespace Xpetra {
68 
69 // TODO: move that elsewhere
70 template <class GlobalOrdinal, class Node>
71 XPETRA_DEPRECATED Epetra_IntMultiVector &toEpetra(MultiVector<int, int, GlobalOrdinal, Node> &);
72 
73 template <class GlobalOrdinal, class Node>
74 XPETRA_DEPRECATED const Epetra_IntMultiVector &toEpetra(const MultiVector<int, int, GlobalOrdinal, Node> &);
75 //
76 
77 // stub implementation for EpetraIntMultiVectorT
78 template <class EpetraGlobalOrdinal, class Node>
79 class XPETRA_DEPRECATED EpetraIntMultiVectorT
80  : public MultiVector<int, int, EpetraGlobalOrdinal, Node> {
81  typedef int Scalar;
82  typedef int LocalOrdinal;
83  typedef EpetraGlobalOrdinal GlobalOrdinal;
84 
85  public:
87 
88 
90  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
91  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
92  "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
93  }
94 
96  EpetraIntMultiVectorT(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &source, const Teuchos::DataAccess copyOrView = Teuchos::Copy) {
97  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
98  "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
99  }
100 
102  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > &ArrayOfPtrs, size_t NumVectors) {
103  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
104  "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
105  }
106 
109 
111 
113 
114 
116  void putScalar(const int &value) {}
117 
119  void randomize(bool bUseXpetraImplementation = true) {
120  XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
121  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
122  }
123 
125  void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = true) {
126  XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
127  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
128  }
129 
131 
132  void setSeed(unsigned int seed) {
133  XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
134  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
135  "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra");
136  }
137 
139 
141 
142 
144  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t j) const {
145  return Teuchos::null;
146  }
147 
149  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t j) {
150  return Teuchos::null;
151  }
152 
155  Teuchos::ArrayRCP<const int> getData(size_t j) const {
156  return Teuchos::ArrayRCP<const int>();
157  }
158 
161  Teuchos::ArrayRCP<int> getDataNonConst(size_t j) {
162  return Teuchos::ArrayRCP<int>();
163  }
164 
166 
168 
171  const Teuchos::ArrayView<int> &dots) const {
172  TEUCHOS_TEST_FOR_EXCEPTION(-1, Xpetra::Exceptions::NotImplemented,
173  "This function is not implemented in Epetra_IntMultiVector");
174  }
175 
178 
181  TEUCHOS_TEST_FOR_EXCEPTION(-1, Xpetra::Exceptions::NotImplemented,
182  "This function is not implemented in Epetra_IntMultiVector");
183  }
184 
186  void scale(const int &alpha) {}
187 
189  void scale(Teuchos::ArrayView<const int> alpha) {
190  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
191  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
192  "Xpetra::EpetraIntMultiVectorT::scale(): Functionnality not available in Epetra");
193  }
194 
196  void update(const int &alpha, const MultiVector<int, int, GlobalOrdinal, Node> &A, const int &beta) {
197  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
198  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
199  "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
200  }
201 
203  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) {
204  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
205  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
206  "Xpetra::EpetraIntMultiVectorT::update(): Functionnality not available in Epetra");
207  }
208 
210  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const {
211  XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
212  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
213  "Xpetra::EpetraIntMultiVectorT::norm1(): Functionnality not available in Epetra");
214  }
215 
217  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const {
218  XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
219  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
220  "Xpetra::EpetraIntMultiVectorT::norm2(): Functionnality not available in Epetra");
221  }
222 
224  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> &norms) const {
225  XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
226  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
227  "Xpetra::EpetraIntMultiVectorT::normInf(): Functionnality not available in Epetra");
228  }
229 
231  void meanValue(const Teuchos::ArrayView<int> &means) const {
232  XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
233  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
234  "Xpetra::EpetraIntMultiVectorT::meanValue(): Functionnality not available in Epetra");
235  }
236 
238  void maxValue(const Teuchos::ArrayView<int> &maxs) const {
239  XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
240  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
241  "Xpetra::EpetraIntMultiVectorT::maxValue(): Functionnality not available in Epetra");
242  }
243 
245  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) {
246  XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
247  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
248  "Xpetra::EpetraIntMultiVectorT::multiply(): Functionnality not available in Epetra");
249  }
250 
253  XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
254  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
255  "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
256  }
257 
259 
261 
262 
264  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
265  XPETRA_MONITOR("EpetraIntMultiVectorT::replaceGlobalValue");
266  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
267  }
268 
270  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
271  XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoGlobalValue");
272  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
273  }
274 
276  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
277  XPETRA_MONITOR("EpetraIntMultiVectorT::replaceLocalValue");
278  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
279  }
280 
282  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
283  XPETRA_MONITOR("EpetraIntMultiVectorT::sumIntoLocalValue");
284  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
285  }
286 
288 
290 
291 
293  size_t getNumVectors() const {
294  XPETRA_MONITOR("EpetraIntMultiVectorT::getNumVectors");
295  return 1;
296  }
297 
299  size_t getLocalLength() const { return 0; }
300 
302  global_size_t getGlobalLength() const { return 0; }
303 
306 
308 
310 
311 
313  std::string description() const {
314  return std::string("");
315  }
316 
318  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {}
319 
321 
322  RCP<Epetra_IntMultiVector> getEpetra_IntMultiVector() const { return Teuchos::null; }
323 
324  const RCP<const Comm<int> > getComm() const {
325  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
326  }
327 
328  // Implementing DistObject
329  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap() const {
330  return Teuchos::null;
331  }
332 
334  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {}
335 
337  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {}
338 
340  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {}
341 
343  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {}
344 
345  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > &map) {
346  // do nothing
347  }
348 
349  protected:
352  virtual void
354 
355  private:
357  // RCP< Epetra_IntMultiVector > vec_;
358 
359 }; // class EpetraIntMultiVectorT
360 
361 // specialization on GO=int and Node=Serial
362 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
363 template <>
365  : public virtual MultiVector<int, int, int, EpetraNode> {
366  typedef int Scalar;
367  typedef int LocalOrdinal;
368  typedef int GlobalOrdinal;
369  typedef EpetraNode Node;
370 
371  public:
373 
374 
376  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
377  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(map), NumVectors, zeroOut));
378  }
379 
381  EpetraIntMultiVectorT(const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &source, const Teuchos::DataAccess copyOrView = Teuchos::Copy) {
382  if (copyOrView == Teuchos::Copy)
383  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(source)));
384  else {
385  int *indices = new int[getNumVectors()];
386  for (size_t i = 0; i < getNumVectors(); i++)
387  indices[i] = i;
388  vec_ = Teuchos::rcp(new Epetra_IntMultiVector(View, toEpetra<GlobalOrdinal, Node>(source), indices, getNumVectors()));
389  delete[] indices;
390  }
391  }
392 
394  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > & /* map */, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > & /* ArrayOfPtrs */, size_t /* NumVectors */) {
395  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
396  "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
397  }
398 
401 
403 
405 
406 
408  void putScalar(const int &value) {
409  int ierr = 0;
410  ierr = vec_->PutScalar(value);
411  TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returned an error.")
412  }
413 
415  void randomize(bool /* bUseXpetraImplementation */ = true) {
416  XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
417  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
418  }
419 
421  void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = true) {
422  XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
423  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
424  }
425 
427 
428  void setSeed(unsigned int /* seed */) {
429  XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
430  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra");
431  }
432 
434 
435  typename dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const override { return getHostLocalView(Access::ReadWrite); }
436 
437  typename dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const override { return getDeviceLocalView(Access::ReadWrite); }
438 
439  typename dual_view_type::t_host_um getHostLocalView(Access::OverwriteAllStruct) const override { return getHostLocalView(Access::ReadWrite); }
440 
441  typename dual_view_type::t_dev_um getDeviceLocalView(Access::OverwriteAllStruct) const override { return getDeviceLocalView(Access::ReadWrite); }
442 
443  typename dual_view_type::t_host_um getHostLocalView(Access::ReadWriteStruct) const override {
444  typedef Kokkos::View<typename dual_view_type::t_host::data_type,
445  Kokkos::LayoutLeft,
446  typename dual_view_type::t_host::device_type,
447  Kokkos::MemoryUnmanaged>
448  epetra_view_type;
449  // access Epetra multivector data
450  Scalar *data = NULL;
451  int myLDA;
452  vec_->ExtractView(&data, &myLDA);
453  int localLength = vec_->MyLength();
454  int numVectors = getNumVectors();
455 
456  // create view
457  epetra_view_type test = epetra_view_type(data, localLength, numVectors);
458  typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
459 
460  return ret;
461  }
462 
463  typename dual_view_type::t_dev_um getDeviceLocalView(Access::ReadWriteStruct) const override { return getHostLocalView(Access::ReadWrite); }
464 
466 
468 
469 
471  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t /* j */) const {
472  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
473  }
474 
476  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t /* j */) {
477  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
478  }
479 
482  Teuchos::ArrayRCP<const int> getData(size_t j) const {
483  XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
484 
485  int **arrayOfPointers;
486  vec_->ExtractView(&arrayOfPointers);
487  int *data = arrayOfPointers[j];
488  int localLength = vec_->MyLength();
489 
490  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
491  }
492 
495  Teuchos::ArrayRCP<int> getDataNonConst(size_t j) {
496  XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
497 
498  int **arrayOfPointers;
499  vec_->ExtractView(&arrayOfPointers);
500  int *data = arrayOfPointers[j];
501  int localLength = vec_->MyLength();
502 
503  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
504  }
505 
507 
509 
510  void dot(const MultiVector<int, int, GlobalOrdinal, Node> & /* A */,
512  const Teuchos::ArrayView<int> & /* dots */) const {
513  XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
514 
515  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
516  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
517  "This function is not implemented in Epetra_IntMultiVector");
518  }
519 
522  XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
523  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
524  "This function is not available in Epetra_IntMultiVector");
525  }
526 
529  XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
530 
531  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
532  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::RuntimeError, "The reciprocal of an IntMultiVector is not defined!");
533  }
534 
536  void scale(const int & /* alpha */) {
537  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
538  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
539  }
540 
542  void scale(Teuchos::ArrayView<const int> /* alpha */) {
543  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
544  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
545  }
546 
548  void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
549  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
550 
551  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
552  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
553  }
554 
556  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 */) {
557  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
558 
559  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
560  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
561  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
562  }
563 
565  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
566  XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
567  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
568  }
569 
571  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
572  XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
573  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
574  }
575 
577  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
578  XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
579  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
580  }
581 
583  void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
584  XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
585  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
586  }
587 
589  void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
590  XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
591  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
592  }
593 
595  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 */) {
596  XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
597  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra");
598  }
599 
601  void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
602  XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
603  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
604  }
605 
607 
609 
610 
612  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
613  vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
614  }
615 
617  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
618  vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
619  }
620 
622  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
623  vec_->ReplaceMyValue(myRow, vectorIndex, value);
624  }
625 
627  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
628  vec_->SumIntoMyValue(myRow, vectorIndex, value);
629  }
630 
632 
634 
635 
637  size_t getNumVectors() const {
638  return vec_->NumVectors();
639  }
640 
642  size_t getLocalLength() const {
643  return vec_->MyLength();
644  }
645 
647  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
648 
651  XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
652  auto vv = toEpetra<GlobalOrdinal, Node>(vec);
653  return ((getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
654  (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
655  }
656 
658 
660 
661 
663  std::string description() const {
664  XPETRA_MONITOR("EpetraIntMultiVectorT::description");
665 
666  // This implementation come from Epetra_Vector_def.hpp (without modification)
667  std::ostringstream oss;
668  oss << Teuchos::Describable::description();
669  oss << "{length=" << this->getGlobalLength()
670  << "}";
671  return oss.str();
672  }
673 
675  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {
676  XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
677 
678  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
679  using std::endl;
680  using std::setw;
681  using Teuchos::VERB_DEFAULT;
682  using Teuchos::VERB_EXTREME;
683  using Teuchos::VERB_HIGH;
684  using Teuchos::VERB_LOW;
685  using Teuchos::VERB_MEDIUM;
686  using Teuchos::VERB_NONE;
687 
688  if (verbLevel > Teuchos::VERB_NONE)
689  vec_->Print(out);
690  }
691 
693 
694  RCP<Epetra_IntMultiVector> getEpetra_IntMultiVector() const { return vec_; }
695 
696  const RCP<const Comm<int> > getComm() const {
697  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
698  }
699 
700  // Implementing DistObject
701  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap() const {
702  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
703  return rcp(new Xpetra::EpetraMapT<GlobalOrdinal, Node>(map));
704  }
705 
707  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
708  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
709 
710  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
711  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
712 
713  const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
714  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
715  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
716  }
717 
719  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
720  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
721 
722  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
723  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
724 
725  const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
726  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
727  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
728  }
729 
731  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
732  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
733 
734  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
735  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
736 
737  const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
738  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
739  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
740  }
741 
743  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
744  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
745 
746  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
747  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
748 
749  const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
750  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
751  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
752  }
753 
754  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > &map) {
755  XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
756  int err = 0;
757  if (!map.is_null()) {
758  err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal, Node>(map));
759 
760  } else {
761  // Replace map with a dummy map to avoid potential hangs later
762  Epetra_SerialComm SComm;
763  Epetra_Map NewMap((GlobalOrdinal)vec_->MyLength(), (GlobalOrdinal)vec_->Map().IndexBase64(), SComm);
764  err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
765  }
766  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
767  }
768 
769  protected:
772  virtual void
775  const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
776  TEUCHOS_TEST_FOR_EXCEPTION(
777  rhsPtr == NULL, std::invalid_argument,
778  "Xpetra::MultiVector::operator=: "
779  "The left-hand side (LHS) of the assignment has a different type than "
780  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
781  "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
782  "other type. This probably means that the RHS wraps either an "
783  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
784  "does not currently implement assignment from a Tpetra object to an "
785  "Epetra object, though this could be added with sufficient interest.");
786 
787  RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector();
788  RCP<Epetra_IntMultiVector> lhsImpl = this->getEpetra_IntMultiVector();
789 
790  TEUCHOS_TEST_FOR_EXCEPTION(
791  rhsImpl.is_null(), std::logic_error,
792  "Xpetra::MultiVector::operator= "
793  "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
794  "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
795  "report this bug to the Xpetra developers.");
796  TEUCHOS_TEST_FOR_EXCEPTION(
797  lhsImpl.is_null(), std::logic_error,
798  "Xpetra::MultiVector::operator= "
799  "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
800  "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
801  "this bug to the Xpetra developers.");
802 
803  // Epetra_IntMultiVector's assignment operator does a deep copy.
804  *lhsImpl = *rhsImpl;
805  }
806 
807  private:
809  RCP<Epetra_IntMultiVector> vec_;
810 };
811 #endif
812 
813 // specialization on GO=long long and Node=Serial
814 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
815 template <>
817  : public virtual MultiVector<int, int, long long, EpetraNode> {
818  typedef int Scalar;
819  typedef int LocalOrdinal;
820  typedef long long GlobalOrdinal;
821  typedef EpetraNode Node;
822 
823  public:
825 
826 
828  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, bool zeroOut = true) {
829  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(map), NumVectors, zeroOut));
830  }
831 
834  vec_ = rcp(new Epetra_IntMultiVector(toEpetra<GlobalOrdinal, Node>(source)));
835  }
836 
838  EpetraIntMultiVectorT(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > & /* map */, const Teuchos::ArrayView<const Teuchos::ArrayView<const Scalar> > & /* ArrayOfPtrs */, size_t /* NumVectors */) {
839  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
840  "Xpetra::EpetraIntMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
841  }
842 
845 
847 
849 
850 
852  void putScalar(const int &value) {
853  int ierr = 0;
854  ierr = vec_->PutScalar(value);
855  TEUCHOS_TEST_FOR_EXCEPTION(ierr != 0, Xpetra::Exceptions::RuntimeError, "Epetra_IntMultiVector::PutScalar returns a non zero error.");
856  }
857 
859  void randomize(bool /* bUseXpetraImplementation */ = true) {
860  XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
861  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
862  }
863 
865  void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation = true) {
866  XPETRA_MONITOR("EpetraIntMultiVectorT::randomize");
867  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::randomize(): Functionnality not available in Epetra");
868  }
869 
871 
872  void setSeed(unsigned int /* seed */) {
873  XPETRA_MONITOR("EpetraIntMultiVectorT::setSeed");
874  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra::EpetraIntMultiVectorT::setSeed(): Functionnality not available in Epetra");
875  }
876 
878 
880 
881 
883  Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVector(size_t /* j */) const {
884  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
885  }
886 
888  Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > getVectorNonConst(size_t /* j */) {
889  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
890  }
891 
894  Teuchos::ArrayRCP<const int> getData(size_t j) const {
895  XPETRA_MONITOR("EpetraIntMultiVectorT::getData");
896 
897  int **arrayOfPointers;
898  vec_->ExtractView(&arrayOfPointers);
899  int *data = arrayOfPointers[j];
900  int localLength = vec_->MyLength();
901 
902  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
903  }
904 
907  Teuchos::ArrayRCP<int> getDataNonConst(size_t j) {
908  XPETRA_MONITOR("EpetraIntMultiVectorT::getDataNonConst");
909 
910  int **arrayOfPointers;
911  vec_->ExtractView(&arrayOfPointers);
912  int *data = arrayOfPointers[j];
913  int localLength = vec_->MyLength();
914 
915  return ArrayRCP<int>(data, 0, localLength, false); // not ownership
916  }
917 
919 
921 
922  void dot(const MultiVector<int, int, GlobalOrdinal, Node> & /* A */,
924  const Teuchos::ArrayView<int> & /* dots */) const {
925  XPETRA_MONITOR("EpetraIntMultiVectorT::dot");
926 
927  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
928  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
929  }
930 
933  XPETRA_MONITOR("EpetraIntMultiVectorT::abs");
934  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
935  "This function is not available in Epetra_IntMultiVector");
936  }
937 
940  XPETRA_MONITOR("EpetraIntMultiVectorT::reciprocal");
941  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented,
942  "This function is not implemented in Epetra_IntMultiVector");
943  }
944 
946  void scale(const int & /* alpha */) {
947  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
948  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
949  }
950 
952  void scale(Teuchos::ArrayView<const int> /* alpha */) {
953  XPETRA_MONITOR("EpetraIntMultiVectorT::scale");
954  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
955  }
956 
958  void update(const int & /* alpha */, const MultiVector<int, int, GlobalOrdinal, Node> & /* A */, const int & /* beta */) {
959  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
960 
961  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
962  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
963  }
964 
966  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 */) {
967  XPETRA_MONITOR("EpetraIntMultiVectorT::update");
968 
969  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, A, eA, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
970  // XPETRA_DYNAMIC_CAST(const EpetraMultiVectorT, B, eB, "This Xpetra::EpetraMultiVectorT method only accept Xpetra::EpetraMultiVectorT as input arguments.");
971  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
972  }
973 
975  void norm1(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
976  XPETRA_MONITOR("EpetraIntMultiVectorT::norm1");
977  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
978  }
979 
981  void norm2(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
982  XPETRA_MONITOR("EpetraIntMultiVectorT::norm2");
983  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
984  }
985 
987  void normInf(const Teuchos::ArrayView<Teuchos::ScalarTraits<int>::magnitudeType> & /* norms */) const {
988  XPETRA_MONITOR("EpetraIntMultiVectorT::normInf");
989  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
990  }
991 
993  void meanValue(const Teuchos::ArrayView<int> & /* means */) const {
994  XPETRA_MONITOR("EpetraIntMultiVectorT::meanValue");
995  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
996  }
997 
999  void maxValue(const Teuchos::ArrayView<int> & /* maxs */) const {
1000  XPETRA_MONITOR("EpetraIntMultiVectorT::maxValue");
1001  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO");
1002  }
1003 
1005  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 */) {
1006  XPETRA_MONITOR("EpetraIntMultiVectorT::multiply");
1007  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Not available in Epetra");
1008  }
1009 
1011  void elementWiseMultiply(int /* scalarAB */, const Vector<int, int, GlobalOrdinal, Node> & /* A */, const MultiVector<int, int, GlobalOrdinal, Node> & /* B */, int /* scalarThis */) {
1012  XPETRA_MONITOR("EpetraIntMultiVectorT::elementWiseMultiply");
1013  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "Xpetra_EpetraIntMultiVector: elementWiseMultiply not implemented because Epetra_IntMultiVector does not support this operation");
1014  }
1015 
1017 
1019 
1020 
1022  void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
1023  vec_->ReplaceGlobalValue(globalRow, vectorIndex, value);
1024  }
1025 
1027  void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
1028  vec_->SumIntoGlobalValue(globalRow, vectorIndex, value);
1029  }
1030 
1032  void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
1033  vec_->ReplaceMyValue(myRow, vectorIndex, value);
1034  }
1035 
1037  void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
1038  vec_->SumIntoMyValue(myRow, vectorIndex, value);
1039  }
1040 
1042 
1044 
1045 
1047  size_t getNumVectors() const {
1048  return vec_->NumVectors();
1049  }
1050 
1052  size_t getLocalLength() const { return vec_->MyLength(); }
1053 
1055  global_size_t getGlobalLength() const { return vec_->GlobalLength64(); }
1056 
1059  XPETRA_MONITOR("EpetraIntMultiVectorT::isSameSize");
1060  auto vv = toEpetra<GlobalOrdinal, Node>(vec);
1061  return ((getLocalLength() == Teuchos::as<size_t>(vv.MyLength())) &&
1062  (getNumVectors() == Teuchos::as<size_t>(vv.NumVectors())));
1063  }
1065 
1067 
1068 
1070  std::string description() const {
1071  XPETRA_MONITOR("EpetraIntMultiVectorT::description");
1072 
1073  // This implementation come from Epetra_Vector_def.hpp (without modification)
1074  std::ostringstream oss;
1075  oss << Teuchos::Describable::description();
1076  oss << "{length=" << this->getGlobalLength()
1077  << "}";
1078  return oss.str();
1079  }
1080 
1082  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default) const {
1083  XPETRA_MONITOR("EpetraIntMultiVectorT::describe");
1084 
1085  // This implementation come from Tpetra_Vector_def.hpp (without modification) // JG: true?
1086  using std::endl;
1087  using std::setw;
1088  using Teuchos::VERB_DEFAULT;
1089  using Teuchos::VERB_EXTREME;
1090  using Teuchos::VERB_HIGH;
1091  using Teuchos::VERB_LOW;
1092  using Teuchos::VERB_MEDIUM;
1093  using Teuchos::VERB_NONE;
1094 
1095  if (verbLevel > Teuchos::VERB_NONE)
1096  vec_->Print(out);
1097  }
1098 
1100 
1101  RCP<Epetra_IntMultiVector> getEpetra_IntMultiVector() const { return vec_; }
1102 
1103  const RCP<const Comm<int> > getComm() const {
1104  TEUCHOS_TEST_FOR_EXCEPTION(1, Xpetra::Exceptions::NotImplemented, "TODO getComm Epetra MultiVector not implemented");
1105  }
1106 
1107  // Implementing DistObject
1108  Teuchos::RCP<const Map<int, GlobalOrdinal, Node> > getMap() const {
1109  RCP<const Epetra_BlockMap> map = rcp(new Epetra_BlockMap(vec_->Map()));
1110  return rcp(new Xpetra::EpetraMapT<GlobalOrdinal, Node>(map));
1111  }
1112 
1114  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1115  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1116 
1117  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1118  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1119 
1120  const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
1121  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1122  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1123  }
1124 
1126  const Import<int, GlobalOrdinal, Node> &importer, CombineMode CM) {
1127  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1128 
1129  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1130  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1131 
1132  const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
1133  int err = vec_->Import(v, *tImporter.getEpetra_Import(), toEpetra(CM));
1134  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1135  }
1136 
1138  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1139  XPETRA_MONITOR("EpetraIntMultiVectorT::doImport");
1140 
1141  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1142  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1143 
1144  const Epetra_IntMultiVector &v = *tSource.getEpetra_IntMultiVector();
1145  int err = vec_->Import(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1146  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1147  }
1148 
1150  const Export<int, GlobalOrdinal, Node> &exporter, CombineMode CM) {
1151  XPETRA_MONITOR("EpetraIntMultiVectorT::doExport");
1152 
1153  XPETRA_DYNAMIC_CAST(const EpetraIntMultiVectorT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraIntMultiVectorT as input arguments.");
1154  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraIntMultiVectorT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1155 
1156  const Epetra_IntMultiVector &v = *tDest.getEpetra_IntMultiVector();
1157  int err = vec_->Export(v, *tExporter.getEpetra_Export(), toEpetra(CM));
1158  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1159  }
1160 
1161  void replaceMap(const RCP<const Map<int, GlobalOrdinal, Node> > &map) {
1162  XPETRA_MONITOR("EpetraIntMultiVectorT::replaceMap");
1163  int err = 0;
1164  if (!map.is_null()) {
1165  err = this->getEpetra_IntMultiVector()->ReplaceMap(toEpetra<GlobalOrdinal, Node>(map));
1166 
1167  } else {
1168  // Replace map with a dummy map to avoid potential hangs later
1169  Epetra_SerialComm SComm;
1170  Epetra_Map NewMap((GlobalOrdinal)vec_->MyLength(), (GlobalOrdinal)vec_->Map().IndexBase64(), SComm);
1171  err = this->getEpetra_IntMultiVector()->ReplaceMap(NewMap);
1172  }
1173  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1174  }
1175 
1176  protected:
1179  virtual void
1182  const this_type *rhsPtr = dynamic_cast<const this_type *>(&rhs);
1183  TEUCHOS_TEST_FOR_EXCEPTION(
1184  rhsPtr == NULL, std::invalid_argument,
1185  "Xpetra::MultiVector::operator=: "
1186  "The left-hand side (LHS) of the assignment has a different type than "
1187  "the right-hand side (RHS). The LHS has type Xpetra::EpetraIntMultiVectorT "
1188  "(which means it wraps an Epetra_IntMultiVector), but the RHS has some "
1189  "other type. This probably means that the RHS wraps either an "
1190  "Tpetra::MultiVector, or an Epetra_MultiVector. Xpetra::MultiVector "
1191  "does not currently implement assignment from a Tpetra object to an "
1192  "Epetra object, though this could be added with sufficient interest.");
1193 
1194  RCP<const Epetra_IntMultiVector> rhsImpl = rhsPtr->getEpetra_IntMultiVector();
1195  RCP<Epetra_IntMultiVector> lhsImpl = this->getEpetra_IntMultiVector();
1196 
1197  TEUCHOS_TEST_FOR_EXCEPTION(
1198  rhsImpl.is_null(), std::logic_error,
1199  "Xpetra::MultiVector::operator= "
1200  "(in Xpetra::EpetraIntMultiVectorT::assign): *this (the right-hand side of "
1201  "the assignment) has a null RCP<Epetra_IntMultiVector> inside. Please "
1202  "report this bug to the Xpetra developers.");
1203  TEUCHOS_TEST_FOR_EXCEPTION(
1204  lhsImpl.is_null(), std::logic_error,
1205  "Xpetra::MultiVector::operator= "
1206  "(in Xpetra::EpetraIntMultiVectorT::assign): The left-hand side of the "
1207  "assignment has a null RCP<Epetra_IntMultiVector> inside. Please report "
1208  "this bug to the Xpetra developers.");
1209 
1210  // Epetra_IntMultiVector's assignment operator does a deep copy.
1211  *lhsImpl = *rhsImpl;
1212  }
1213 
1214  private:
1216  RCP<Epetra_IntMultiVector> vec_;
1217 };
1218 #endif
1219 
1220 } // namespace Xpetra
1221 
1222 #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.
dual_view_type::t_host_um getHostLocalView(Access::ReadWriteStruct) const override
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
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.
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.
void abs(const MultiVector< int, int, GlobalOrdinal, Node > &A)
Puts element-wise absolute values of input Multi-vector in target: A = abs(this)
dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const override
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.
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).
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 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.
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 randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
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.
size_t getNumVectors() const
Returns the number of vectors in the multi-vector.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t) const
Return a Vector which is a const view of column j.
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.
dual_view_type::t_dev_um getDeviceLocalView(Access::OverwriteAllStruct) const override
void scale(const int &alpha)
Scale the current values of a multi-vector, this = alpha*this.
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
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=true)
Set multi-vector values to random numbers.
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.
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.
dual_view_type::t_host_um getHostLocalView(Access::OverwriteAllStruct) const override
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)
RCP< Epetra_IntMultiVector > vec_
The Epetra_IntMultiVector which this class wraps.
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.
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)
RCP< Epetra_IntMultiVector > getEpetra_IntMultiVector() const
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.
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).
RCP< Epetra_IntMultiVector > vec_
The Epetra_IntMultiVector which this class wraps.
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.
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.
Kokkos::DualView< impl_scalar_type **, Kokkos::LayoutStride, typename node_type::device_type, Kokkos::MemoryUnmanaged > dual_view_type
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.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
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.
dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const override
std::string description() const
Return a simple one-line description of this object.
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.
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView=Teuchos::Copy)
MultiVector copy constructor.
CombineMode
Xpetra::Combine Mode enumerable type.
void setSeed(unsigned int)
Set seed for Random function.
EpetraIntMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView=Teuchos::Copy)
MultiVector copy constructor.
constexpr struct ReadWriteStruct ReadWrite
#define XPETRA_MONITOR(funcName)
virtual dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const
void meanValue(const Teuchos::ArrayView< int > &means) const
Compute mean (average) value of each vector in multi-vector.
dual_view_type::t_dev_um getDeviceLocalView(Access::ReadWriteStruct) const override
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.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t)
Return a Vector which is a nonconst view of column j.
void randomize(const Scalar &minVal, const Scalar &maxVal, 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)
RCP< Epetra_IntMultiVector > getEpetra_IntMultiVector() const
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
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.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
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).