Xpetra Version of the Day
Xpetra_TpetraBlockCrsMatrix_def.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_TPETRABLOCKCRSMATRIX_DEF_HPP
47#define XPETRA_TPETRABLOCKCRSMATRIX_DEF_HPP
48
50
51namespace Xpetra {
52
53
55 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
58 size_t maxNumEntriesPerRow,
60 {
61 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
62 }
63
64
66 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
69 const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc,
71 {
72 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
73 }
74
75
77 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
81 size_t maxNumEntriesPerRow,
83 {
84 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
85 }
86
87
89 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
93 const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc,
95 {
96 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
97 }
98
99
101 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
105 // : mtx_(Teuchos::rcp(new Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >(toTpetra(graph), params)))
106 // * there is no Tpetra::BlockCrsMatrix(graph, params) c'tor. We throw anyways here so no need to set mtx_.
107 {
108 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
109 }
110
111
113 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
116 const LocalOrdinal blockSize)
117 : mtx_(Teuchos::rcp(new Tpetra::BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(*toTpetra(graph), blockSize)))
118 { }
119
120
122 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
124 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
126 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
129 {
130 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
131 }
132
133
135 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
137 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
139 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
142 {
143 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
144 }
145
146
148 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
150 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
151 const Import<LocalOrdinal,GlobalOrdinal,Node> & RowImporter,
152 const Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > DomainImporter,
153 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
156 {
157 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
158 }
159
160
162 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
164 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
165 const Export<LocalOrdinal,GlobalOrdinal,Node> & RowExporter,
166 const Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > DomainExporter,
167 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
170 {
171 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
172 }
173
174
176 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
179
180
182
183
185 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
186 void
188 insertGlobalValues(GlobalOrdinal globalRow,
190 const ArrayView< const Scalar > &vals)
191 {
192 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
193 }
194
195
197 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
198 void
200 insertLocalValues(LocalOrdinal localRow,
202 const ArrayView< const Scalar > &vals)
203 {
204 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
205 }
206
207
209 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
210 void
212 replaceGlobalValues(GlobalOrdinal globalRow,
214 const ArrayView< const Scalar > &vals)
215 {
216 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in"+std::string(__FILE__)+":"+std::to_string(__LINE__));
217 }
218
219
221 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
222 void
224 replaceLocalValues (LocalOrdinal localRow,const ArrayView<const LocalOrdinal> &cols,const ArrayView<const Scalar> &vals)
225 {
226 XPETRA_MONITOR("TpetraBlockCrsMatrix::replaceLocalValues");
227 mtx_->replaceLocalValues(localRow,cols.getRawPtr(),vals.getRawPtr(),cols.size());
228 }
229
230
232 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
233 void
235 setAllToScalar(const Scalar &alpha)
236 {
237 XPETRA_MONITOR("TpetraBlockCrsMatrix::setAllToScalar"); mtx_->setAllToScalar(alpha);
238 }
239
240
242 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
243 void
245 scale(const Scalar &alpha)
246 {
247 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
248 }
249
250
252 //** \warning This is an expert-only routine and should not be called from user code. (not implemented)
253 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
254 void
256 allocateAllValues(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values)
257 {
258 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
259 }
260
261
263 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
264 void
266 setAllValues(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind, const ArrayRCP<Scalar> & values)
267 {
268 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
269 }
270
271
273 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
274 void
278 ArrayRCP<const Scalar>& values) const
279 {
280 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
281 }
282
284 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
285 void
288 {
289 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
290 }
291
292
293
295
296 // Transformational Methods
298
299
300 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
301 void
304 {
305 /*noop*/
306 }
307
308
309 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
310 void
313 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap,
314 const RCP< ParameterList > &params)
315 {
316 /*noop*/
317 }
318
319
320 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
321 void
324 {
325 /*noop*/
326 }
327
328
329 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
330 void
334 {
335 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
336 }
337
338
339 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
340 void
343 const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & rangeMap,
344 const RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > &importer,
345 const RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > &exporter,
346 const RCP<ParameterList> &params)
347 {
348 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
349 }
350
352
353
355
356
357 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
360 getRowMap() const
361 {
362 XPETRA_MONITOR("TpetraBlockCrsMatrix::getRowMap"); return toXpetra(mtx_->getRowMap());
363 }
364
365
366 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
369 getColMap() const
370 {
371 XPETRA_MONITOR("TpetraBlockCrsMatrix::getColMap"); return toXpetra(mtx_->getColMap());
372 }
373
374
375 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
378 getCrsGraph() const
379 {
380 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
381 }
382
383
384 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
387 getGlobalNumRows() const
388 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getGlobalNumRows"); return mtx_->getGlobalNumRows(); }
389
390
391 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
394 getGlobalNumCols() const
395 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getGlobalNumCols"); return mtx_->getGlobalNumCols(); }
396
397
398 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
399 size_t
401 getNodeNumRows() const
402 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getNodeNumRows"); return mtx_->getNodeNumRows(); }
403
404
405 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
406 size_t
408 getNodeNumCols() const
409 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getNodeNumCols"); return mtx_->getNodeNumCols(); }
410
411
412 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
416 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getGlobalNumEntries"); return mtx_->getGlobalNumEntries(); }
417
418
419 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
420 size_t
422 getNodeNumEntries() const
423 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getNodeNumEntries"); return mtx_->getNodeNumEntries(); }
424
425
426 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
427 size_t
429 getNumEntriesInLocalRow(LocalOrdinal localRow) const
430 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getNumEntriesInLocalRow"); return mtx_->getNumEntriesInLocalRow(localRow); }
431
432
433 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
434 size_t
436 getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
437 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getNumEntriesInGlobalRow"); return mtx_->getNumEntriesInGlobalRow(globalRow); }
438
439
440 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
442 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getGlobalMaxNumRowEntries"); return mtx_->getGlobalMaxNumRowEntries(); }
443
444
445 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
447 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getNodeMaxNumRowEntries"); return mtx_->getNodeMaxNumRowEntries(); }
448
449
450 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
452 { XPETRA_MONITOR("TpetraBlockCrsMatrix::isLocallyIndexed"); return mtx_->isLocallyIndexed(); }
453
454
455 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
457 { XPETRA_MONITOR("TpetraBlockCrsMatrix::isGloballyIndexed"); return mtx_->isGloballyIndexed(); }
458
459
460 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
462 { XPETRA_MONITOR("TpetraBlockCrsMatrix::isFillComplete"); return mtx_->isFillComplete(); }
463
464
465 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
467 { XPETRA_MONITOR("TpetraBlockCrsMatrix::isFillActive"); return false; }
468
469
470 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
472 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getFrobeniusNorm"); return mtx_->getFrobeniusNorm(); }
473
474
475 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
477 { XPETRA_MONITOR("TpetraBlockCrsMatrix::supportsRowViews"); return mtx_->supportsRowViews(); }
478
479
480 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
481 void
483 getLocalRowCopy(LocalOrdinal LocalRow,
484 const ArrayView< LocalOrdinal > &Indices,
485 const ArrayView< Scalar > &Values,
486 size_t &NumEntries) const
487 {
488 XPETRA_MONITOR("TpetraBlockCrsMatrix::getLocalRowCopy");
489 typename Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>::nonconst_local_inds_host_view_type indices("indices",Indices.size());
490 typename Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::nonconst_values_host_view_type values("values", Values.size());
491
492 mtx_->getLocalRowCopy(LocalRow, indices, values, NumEntries);
493 for (size_t i=0;i<NumEntries; ++i) {
494 Indices[i]=indices(i);
495 Values[i]=values(i);
496 }
497 }
498 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
499 void
501 getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &Indices,
502 ArrayView< const Scalar > &Values) const
503 {
504 XPETRA_MONITOR("TpetraBlockCrsMatrix::getLocalRowView");
505 typename Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>::local_inds_host_view_type indices;
506 typename Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::values_host_view_type values;
507
508 mtx_->getLocalRowView(LocalRow, indices, values);
509 Indices = ArrayView<const LocalOrdinal> (indices.data(), indices.extent(0));
510 Values = ArrayView<const Scalar> (reinterpret_cast<const Scalar*>(values.data()), values.extent(0));
511 }
512
513
514 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
515 void
517 getGlobalRowView(GlobalOrdinal GlobalRow,
519 ArrayView< const Scalar > &Values) const
520 {
521 XPETRA_MONITOR("TpetraBlockCrsMatrix::getGlobalRowView");
522 typename Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>::global_inds_host_view_type indices;
523 typename Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::values_host_view_type values;
524
525 mtx_->getGlobalRowView(GlobalRow, indices, values);
526 Indices = ArrayView<const GlobalOrdinal> (indices.data(), indices.extent(0));
527 Values = ArrayView<const Scalar> (reinterpret_cast<const Scalar*>(values.data()), values.extent(0));
528 }
529
530
531 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
532 void
534 getGlobalRowCopy(GlobalOrdinal GlobalRow,
535 const ArrayView< GlobalOrdinal > &Indices,
536 const ArrayView< Scalar > &Values,
537 size_t &NumEntries) const
538 {
539 XPETRA_MONITOR("TpetraBlockCrsMatrix::getGlobalRowCopy");
540 typename Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>::nonconst_global_inds_host_view_type indices("indices",Indices.size());
541 typename Tpetra::CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::nonconst_values_host_view_type values("values", Values.size());
542
543 mtx_->getGlobalRowCopy(GlobalRow, indices, values, NumEntries);
544 for (size_t i=0;i<NumEntries; ++i) {
545 Indices[i]=indices(i);
546 Values[i]=values(i);
547 }
548 }
549
550
551 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
552 bool
555 { return true; }
556
557
558 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
562 Teuchos::ETransp mode,
563 Scalar alpha,
564 Scalar beta) const
565 { XPETRA_MONITOR("TpetraBlockCrsMatrix::apply"); mtx_->apply(toTpetra(X), toTpetra(Y), mode, alpha, beta); }
566
567 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
571 Teuchos::ETransp mode,
572 Scalar alpha,
573 Scalar beta,
574 bool sumInterfaceValues,
575 const RCP<Import<LocalOrdinal, GlobalOrdinal, Node> >& regionInterfaceImporter,
576 const Teuchos::ArrayRCP<LocalOrdinal>& regionInterfaceLIDs) const
577 { }
578
579
580 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
583 getDomainMap() const
584 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getDomainMap"); return toXpetra(mtx_->getDomainMap()); }
585
586
587 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
590 getRangeMap() const
591 { XPETRA_MONITOR("TpetraBlockCrsMatrix::getRangeMap"); return toXpetra(mtx_->getRangeMap()); }
592
593
594 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
595 std::string
597 description() const
598 { XPETRA_MONITOR("TpetraBlockCrsMatrix::description"); return mtx_->description(); }
599
600
601 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
602 void
605 const Teuchos::EVerbosityLevel verbLevel) const
606 {
607 XPETRA_MONITOR("TpetraBlockCrsMatrix::describe");
608 mtx_->describe(out, verbLevel);
609 }
610
611
612 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
613 void
615 setObjectLabel( const std::string &objectLabel )
616 {
617 XPETRA_MONITOR("TpetraCrsMatrix::setObjectLabel");
619 mtx_->setObjectLabel(objectLabel);
620 }
621
622
623
624 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
625 void
628 {
629 XPETRA_MONITOR("TpetraBlockCrsMatrix::getLocalDiagCopy");
631 diag,
632 tDiag,
633 "Xpetra::TpetraBlockCrsMatrix.getLocalDiagCopy() only accept Xpetra::TpetraVector as input arguments.");
634 mtx_->getLocalDiagCopy(*tDiag.getTpetra_Vector());
635 }
636
637
639 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
640 void
643 const Teuchos::ArrayView<const size_t> &offsets) const
644 {
645 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
646 }
647
648
649
650 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
651 void
654 {
655 XPETRA_MONITOR("TpetraBlockCrsMatrix::getLocalDiagOffsets");
656
657 const size_t lclNumRows = mtx_->getGraph()->getNodeNumRows();
658 if (static_cast<size_t>(offsets.size()) < lclNumRows)
659 {
660 offsets.resize(lclNumRows);
661 }
662
663 // The input ArrayRCP must always be a host pointer. Thus, if
664 // device_type::memory_space is Kokkos::HostSpace, it's OK for us
665 // to write to that allocation directly as a Kokkos::View.
666 typedef typename Node::device_type device_type;
667 typedef typename device_type::memory_space memory_space;
668 if (std::is_same<memory_space, Kokkos::HostSpace>::value)
669 {
670 // It is always syntactically correct to assign a raw host
671 // pointer to a device View, so this code will compile correctly
672 // even if this branch never runs.
673 typedef Kokkos::View<size_t*, device_type, Kokkos::MemoryUnmanaged> output_type;
674 output_type offsetsOut (offsets.getRawPtr(), offsets.size());
675 mtx_->getLocalDiagOffsets(offsetsOut);
676 }
677 else
678 {
679 Kokkos::View<size_t*, device_type> offsetsTmp ("diagOffsets", offsets.size());
680 mtx_->getLocalDiagOffsets(offsetsTmp);
681 typedef Kokkos::View<size_t*, Kokkos::HostSpace, Kokkos::MemoryUnmanaged> output_type;
682 output_type offsetsOut(offsets.getRawPtr(), offsets.size());
683 Kokkos::deep_copy(offsetsOut, offsetsTmp);
684 }
685 }
686
687
688 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
689 void
692 {
693 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix::replaceDiag: function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
694 }
695
696
697 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
698 void
701 {
702 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
703 }
704
705
706 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
707 void
710 {
711 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
712 }
713
714
715 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
718 getMap() const
719 {
720 XPETRA_MONITOR("TpetraBlockCrsMatrix::getMap"); return rcp( new TpetraMap< LocalOrdinal, GlobalOrdinal, Node >(mtx_->getMap()) );
721 }
722
723
725 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
726 void
730 {
731 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
732 }
733
734
736 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
737 void
741 {
742 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
743 }
744
745
747 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
748 void
752 {
753 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
754 }
755
756
758 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
759 void
763 {
764 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
765 }
766
767
768 template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
769 void
772 {
773 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix function not implemented in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
774 }
775
776
777template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
778bool
780hasMatrix() const
781{
782 return !mtx_.is_null();
783}
784
785
786template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
788TpetraBlockCrsMatrix(const Teuchos::RCP<Tpetra::BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &mtx)
789: mtx_(mtx)
790{ }
791
792
793template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
797{
798 return mtx_;
799}
800
801
802// TODO: remove
803template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
807{
808 return mtx_;
809}
810
811#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
812#ifdef HAVE_XPETRA_TPETRA
813
814// was: typedef typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type local_matrix_type;
815//using local_matrix_type = typename CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type;
816
817template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
821{
822 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix does not support getLocalMatrix due to missing Kokkos::CrsMatrix in Tpetra's experimental implementation in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
823
824#ifndef __NVCC__
825 local_matrix_type ret;
826#endif // __NVCC__
827
829}
830
831template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
832typename CrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::local_matrix_type::HostMirror
833TpetraBlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::
834getLocalMatrixHost () const
835{
836 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix does not support getLocalMatrix due to missing Kokkos::CrsMatrix in Tpetra's experimental implementation in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
837
838#ifndef __NVCC__
839 typename local_matrix_type::HostMirror ret;
840#endif // __NVCC__
841
843}
844
845
846template<class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
847void
849setAllValues (const typename local_matrix_type::row_map_type& ptr,
850 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ind,
851 const typename local_matrix_type::values_type& val)
852{
853 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix does not support setAllValues due to missing Kokkos::CrsMatrix in Tpetra's experimental implementation in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
854}
855
856#endif // HAVE_XPETRA_TPETRA
857#endif // HAVE_XPETRA_KOKKOS_REFACTOR
858
859
860#ifdef HAVE_XPETRA_EPETRA
861
862#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
863 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
864
865
866 // specialization of TpetraBlockCrsMatrix for GO=LO=int and Node=EpetraNode
867 template <class Scalar>
868 class TpetraBlockCrsMatrix<Scalar,int,int,EpetraNode>
869 : public CrsMatrix<Scalar,int,int,EpetraNode>//, public TpetraRowMatrix<Scalar,int,int,Node>
870 {
871
872 // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
873 typedef int LocalOrdinal;
874 typedef int GlobalOrdinal;
880
881 public:
882
884
886 TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) {
888 }
889
891 TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) {
893 }
894
896 TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null) {
898 }
899
903 }
904
908 }
909
913 }
914
916 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
918 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
919 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
920 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
922
924 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
926 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
927 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
928 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
930
932 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
933 const Import<LocalOrdinal,GlobalOrdinal,Node> & RowImporter,
934 const Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > DomainImporter,
935 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
939
941 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
942 const Export<LocalOrdinal,GlobalOrdinal,Node> & RowExporter,
943 const Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > DomainExporter,
944 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
947 {
949 }
950
953
954
956
959 {}
960
963 {}
964
967 {}
968
971 {}
972
974 void setAllToScalar(const Scalar &alpha) {}
975
977 void scale(const Scalar &alpha)
978 {}
979
981 //** \warning This is an expert-only routine and should not be called from user code. (not implemented)
982 void allocateAllValues(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values)
983 {}
984
986 void setAllValues(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind, const ArrayRCP<Scalar> & values)
987 {}
988
991 {}
992
993
996 {}
997
999
1001 void resumeFill(const RCP< ParameterList > &params=null) { /*noop*/ }
1002
1004 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null) { /*noop*/ }
1005
1007 void fillComplete(const RCP< ParameterList > &params=null) { /*noop*/ }
1008
1009
1012 {}
1013
1016 const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & rangeMap,
1017 const RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > &importer=Teuchos::null,
1018 const RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > &exporter=Teuchos::null,
1019 const RCP<ParameterList> &params=Teuchos::null)
1020 {}
1021
1022
1024
1026 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { return Teuchos::null; }
1027
1029 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { return Teuchos::null; }
1030
1033 {return Teuchos::null;}
1034
1036 global_size_t getGlobalNumRows() const { return 0; }
1037
1039 global_size_t getGlobalNumCols() const { return 0; }
1040
1042 size_t getNodeNumRows() const { return 0; }
1043
1045 size_t getNodeNumCols() const { return 0; }
1046
1049
1051 size_t getNodeNumEntries() const { return 0; }
1052
1054 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1055
1057 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1058
1060 size_t getGlobalMaxNumRowEntries() const { return 0; }
1061
1063 size_t getNodeMaxNumRowEntries() const { return 0; }
1064
1066 bool isLocallyIndexed() const { return false; }
1067
1069 bool isGloballyIndexed() const { return false; }
1070
1072 bool isFillComplete() const { return false; }
1073
1075 bool isFillActive() const { return false; }
1076
1079
1081 bool supportsRowViews() const { return false; }
1082
1084 void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const { }
1085
1088
1090 void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const { }
1091
1094
1096 bool haveGlobalConstants() const {return false;}
1097
1098
1100
1103
1106
1109
1110
1112
1114 std::string description() const { return std::string(""); }
1115
1118
1119
1122
1125
1128
1131 {}
1132
1134
1137
1138
1140
1143
1147 {}
1148
1152 {}
1153
1157 {}
1158
1162 {}
1163
1165 {}
1166
1167
1168
1170
1172 bool hasMatrix() const { return false; }
1173
1175 TpetraBlockCrsMatrix(const Teuchos::RCP<Tpetra::BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &mtx) {
1177 }
1178
1181
1184
1185#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1186#ifdef HAVE_XPETRA_TPETRA
1188
1189 local_matrix_type getLocalMatrix () const {
1190 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix does not support getLocalMatrix due to missing Kokkos::CrsMatrix in Tpetra's experimental implementation in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
1191 local_matrix_type ret;
1192 return ret; // make compiler happy
1193 }
1194
1195 void setAllValues (const typename local_matrix_type::row_map_type& ptr,
1196 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ind,
1197 const typename local_matrix_type::values_type& val)
1198 {
1199 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix does not support setAllValues due to missing Kokkos::CrsMatrix in Tpetra's experimental implementation in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
1200 }
1201#endif // HAVE_XPETRA_TPETRA
1202#endif // HAVE_XPETRA_KOKKOS_REFACTOR
1203
1204 }; // TpetraBlockCrsMatrix class
1205
1206
1207#endif // #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT)))
1208
1209
1210
1211
1212#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
1213 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
1214
1215 // specialization of TpetraBlockCrsMatrix for GO=long long and Node=EpetraNode
1216 template <class Scalar>
1217 class TpetraBlockCrsMatrix<Scalar,int,long long,EpetraNode>
1218 : public CrsMatrix<Scalar,int,long long,EpetraNode>//, public TpetraRowMatrix<Scalar,int,int,Node>
1219 {
1220
1221 // The following typedef are used by the XPETRA_DYNAMIC_CAST() macro.
1222 typedef int LocalOrdinal;
1223 typedef long long GlobalOrdinal;
1229
1230 public:
1231
1233
1235 TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
1237
1241
1245
1249
1253
1257
1258
1259
1260
1262 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
1264 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
1265 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
1266 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
1268
1270 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
1272 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
1273 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
1274 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null)
1276
1278 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
1279 const Import<LocalOrdinal,GlobalOrdinal,Node> & RowImporter,
1280 const Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > DomainImporter,
1281 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
1282 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
1285
1287 TpetraBlockCrsMatrix(const Teuchos::RCP<const Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& sourceMatrix,
1288 const Export<LocalOrdinal,GlobalOrdinal,Node> & RowExporter,
1289 const Teuchos::RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > DomainExporter,
1290 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap,
1291 const Teuchos::RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap,
1294
1297
1298
1300
1303 {}
1304
1307 {}
1308
1311 {}
1312
1315 {}
1316
1318 void setAllToScalar(const Scalar &alpha) {}
1319
1321 void scale(const Scalar &alpha)
1322 {}
1323
1325 //** \warning This is an expert-only routine and should not be called from user code. (not implemented)
1326 void allocateAllValues(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values)
1327 {}
1328
1330 void setAllValues(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind, const ArrayRCP<Scalar> & values)
1331 {}
1332
1335 {}
1336
1337
1340 {}
1341
1342
1344
1346 void resumeFill(const RCP< ParameterList > &params=null) { /*noop*/ }
1347
1349 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null) { /*noop*/ }
1350
1352 void fillComplete(const RCP< ParameterList > &params=null) { /*noop*/ }
1353
1354
1357 {}
1358
1361 const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> > & rangeMap,
1362 const RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > &importer=Teuchos::null,
1363 const RCP<const Export<LocalOrdinal,GlobalOrdinal,Node> > &exporter=Teuchos::null,
1364 const RCP<ParameterList> &params=Teuchos::null)
1365 {}
1366
1367
1369
1371 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { return Teuchos::null; }
1372
1374 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { return Teuchos::null; }
1375
1378 {return Teuchos::null;}
1379
1381 global_size_t getGlobalNumRows() const { return 0; }
1382
1384 global_size_t getGlobalNumCols() const { return 0; }
1385
1387 size_t getNodeNumRows() const { return 0; }
1388
1390 size_t getNodeNumCols() const { return 0; }
1391
1394
1396 size_t getNodeNumEntries() const { return 0; }
1397
1399 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1400
1402 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1403
1405 size_t getGlobalMaxNumRowEntries() const { return 0; }
1406
1408 size_t getNodeMaxNumRowEntries() const { return 0; }
1409
1411 bool isLocallyIndexed() const { return false; }
1412
1414 bool isGloballyIndexed() const { return false; }
1415
1417 bool isFillComplete() const { return false; }
1418
1420 bool isFillActive() const { return false; }
1421
1424
1426 bool supportsRowViews() const { return false; }
1427
1429 void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const { }
1430
1433
1435 void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const { }
1436
1439
1441 bool haveGlobalConstants() const {return true;}
1442
1443
1445
1448
1451
1454
1455
1457
1459 std::string description() const { return std::string(""); }
1460
1463
1466
1469
1472
1475 {}
1476
1478
1481
1483
1486
1490 {}
1491
1495 {}
1496
1500 {}
1501
1505 {}
1506
1508 {}
1509
1510
1511
1513
1515 bool hasMatrix() const { return false; }
1516
1518 TpetraBlockCrsMatrix(const Teuchos::RCP<Tpetra::BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &mtx) {
1520 }
1521
1524
1527
1528#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1529#ifdef HAVE_XPETRA_TPETRA
1531
1532 local_matrix_type getLocalMatrix () const {
1533 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix does not support getLocalMatrix due to missing Kokkos::CrsMatrix in Tpetra's experimental implementation in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
1534 local_matrix_type ret;
1536 }
1537
1538 void setAllValues (const typename local_matrix_type::row_map_type& ptr,
1539 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ind,
1540 const typename local_matrix_type::values_type& val)
1541 {
1542 throw std::runtime_error("Xpetra::TpetraBlockCrsMatrix does not support setAllValues due to missing Kokkos::CrsMatrix in Tpetra's experimental implementation in "+std::string(__FILE__)+":"+std::to_string(__LINE__));
1543 }
1544#endif // HAVE_XPETRA_TPETRA
1545#endif // HAVE_XPETRA_KOKKOS_REFACTOR
1546
1547 }; // TpetraBlockCrsMatrix class
1548
1549
1550#endif // IF ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG)))
1551
1552
1553
1554
1555#endif // HAVE_XPETRA_EPETRA
1556
1557
1558} // Xpetra namespace
1559
1560#endif // XPETRA_TPETRABLOCKCRSMATRIX_DEF_HPP
1561
1562
#define XPETRA_MONITOR(funcName)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
size_type size() const
T * getRawPtr() const
void resize(const size_type n, const T &val=T())
size_type size() const
T * getRawPtr() const
static const EVerbosityLevel verbLevel_default
virtual void setObjectLabel(const std::string &objectLabel)
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
RCP< Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_BlockCrsMatrixNonConst() const
Get the underlying Tpetra matrix.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
bool isFillActive() const
Returns true if the matrix is in edit mode.
TpetraBlockCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const LocalOrdinal blockSize)
Constructor specifying a previously constructed graph & blocksize.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor for a fused export (not implemented(.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y....
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs (not implemented)
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph (not impelmented)
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor for a fused import ( not implemented )
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
TpetraExport< LocalOrdinal, GlobalOrdinal, Node > TpetraExportClass
std::string description() const
A simple one-line description of this object.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying fixed number of entries for each row (not implemented)
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > &params=Teuchos::null)
Expert static fill complete.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused import ( not implemented )
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
TpetraImport< LocalOrdinal, GlobalOrdinal, Node > TpetraImportClass
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Right scale matrix using the given vector entries.
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
Get a copy of the diagonal entries owned by this node, with local row indices.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row (not implemented)
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row (not implemented)
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the (locally owned) global row.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
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.
RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_BlockCrsMatrix() const
Get the underlying Tpetra matrix.
TpetraBlockCrsMatrix(const TpetraBlockCrsMatrix &matrix)
Deep copy constructor.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void getAllValues(ArrayRCP< Scalar > &values)
Gets the 1D pointer arrays of the graph (not implemented)
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row (not implemented)
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
TpetraBlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraBlockCrsMatrixClass
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row idices.
TpetraBlockCrsMatrix(const Teuchos::RCP< Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &mtx)
TpetraBlockCrsMatrix constructor to wrap a Tpetra::BlockCrsMatrix object.
TpetraBlockCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a previously constructed graph ( not implemented )
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused export (not implemented(.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Left scale matrix using the given vector entries.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph (not implemented)
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs (not implemented)
TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraVectorClass
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this (not implemented)
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs (not implemented)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
TpetraBlockCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying a previously constructed graph ( not implemented )
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Right scale matrix using the given vector entries.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused import (not implemented)
void getAllValues(ArrayRCP< Scalar > &values)
Gets the 1D pointer arrays of the graph (not implemented)
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs (not implemented)
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
TpetraBlockCrsMatrix(const Teuchos::RCP< Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &mtx)
TpetraBlockCrsMatrix constructor to wrap a Tpetra::BlockCrsMatrix object.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
TpetraBlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraBlockCrsMatrixClass
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor for a fused import (not implemented)
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor for a fused export (not implemented)
RCP< Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_BlockCrsMatrixNonConst() const
Get the underlying Tpetra matrix.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor for a fused export (not implemented)
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the (locally owned) global row.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
Get a copy of the diagonal entries owned by this node, with local row indices.
TpetraBlockCrsMatrix(const TpetraBlockCrsMatrix &matrix)
Deep copy constructor.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs (not implemented)
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs (not implemented)
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row (not implemented)
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 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y....
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > &params=Teuchos::null)
Expert static fill complete.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
bool isFillActive() const
Returns true if the matrix is in edit mode.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying column Map and number of entries in each row (not implemented)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void replaceDiag(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_BlockCrsMatrix() const
Get the underlying Tpetra matrix.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph (not implemented)
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this (not implemented)
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph (not impelmented)
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying fixed number of entries for each row (not implemented)
TpetraBlockCrsMatrix(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const LocalOrdinal blockSize)
Constructor specifying a previously constructed graph & blocksize.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
std::string description() const
A simple one-line description of this object.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row (not implemented)
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Left scale matrix using the given vector entries.
TpetraVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraVectorClass
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row idices.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs (not implemented)
TpetraBlockCrsMatrix(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor specifying fixed number of entries for each row (not implemented)
void setObjectLabel(const std::string &objectLabel)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
std::string description() const
A simple one-line description of this object.
virtual bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Left scale operator with given vector values.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph (not implemented)
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row idices.
bool hasMatrix() const
Does this have an underlying matrix.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph (not impelmented)
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Right scale operator with given vector values.
RCP< const Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_BlockCrsMatrix() const
Get the underlying Tpetra matrix.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this (not implemented)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs (not implemented)
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y....
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void resumeFill(const RCP< ParameterList > &params=null)
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the (locally owned) global row.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using local IDs.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &indices, const ArrayView< Scalar > &values, size_t &numEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > &params=Teuchos::null)
Expert static fill complete.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Replace matrix entries, using global IDs (not implemented)
bool isFillActive() const
Returns true if the matrix is in edit mode.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
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 replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
RCP< Tpetra::BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_BlockCrsMatrixNonConst() const
Get the underlying Tpetra matrix.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Xpetra namespace
size_t global_size_t
Global size_t object.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
CombineMode
Xpetra::Combine Mode enumerable type.
static magnitudeType magnitude(T a)