46 #ifndef XPETRA_CRSMATRIXFACTORY_HPP
47 #define XPETRA_CRSMATRIXFACTORY_HPP
53 #ifdef HAVE_XPETRA_TPETRA
57 #ifdef HAVE_XPETRA_EPETRA
65 template <
class Scalar ,
79 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
81 size_t maxNumEntriesPerRow,
83 const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null)
87 #ifdef HAVE_XPETRA_TPETRA
97 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
99 const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc,
101 const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null)
103 #ifdef HAVE_XPETRA_TPETRA
113 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
116 size_t maxNumEntriesPerRow,
118 const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null)
122 #ifdef HAVE_XPETRA_TPETRA
132 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc,
ProfileType pftype=
DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
135 #ifdef HAVE_XPETRA_TPETRA
148 #ifdef HAVE_XPETRA_TPETRA
149 if (graph->getRowMap()->lib() ==
UseTpetra)
158 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
163 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
166 #ifdef HAVE_XPETRA_TPETRA
167 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
175 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
180 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
183 #ifdef HAVE_XPETRA_TPETRA
184 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
192 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
198 const Teuchos::RCP<Teuchos::ParameterList>& params) {
201 #ifdef HAVE_XPETRA_TPETRA
202 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
210 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
216 const Teuchos::RCP<Teuchos::ParameterList>& params) {
219 #ifdef HAVE_XPETRA_TPETRA
220 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
228 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
229 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build (
233 const Teuchos::RCP<Teuchos::ParameterList>& params =
null) {
236 #ifdef HAVE_XPETRA_TPETRA
244 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build (
246 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
247 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
248 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
249 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
250 const Teuchos::RCP<Teuchos::ParameterList>& params =
null) {
253 #ifdef HAVE_XPETRA_TPETRA
255 return rcp(
new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
266 #if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES))
286 #ifdef HAVE_XPETRA_TPETRA
300 #ifdef HAVE_XPETRA_TPETRA
312 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
size_t maxNumEntriesPerRow,
ProfileType pftype=
DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
315 #ifdef HAVE_XPETRA_TPETRA
327 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc,
ProfileType pftype=
DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
330 #ifdef HAVE_XPETRA_TPETRA
345 #ifdef HAVE_XPETRA_TPETRA
346 if (graph->getRowMap()->lib() ==
UseTpetra)
350 if (graph->getRowMap()->lib() ==
UseEpetra)
358 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
363 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
366 #ifdef HAVE_XPETRA_TPETRA
367 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
371 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
378 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
383 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
386 #ifdef HAVE_XPETRA_TPETRA
387 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
391 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
398 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
404 const Teuchos::RCP<Teuchos::ParameterList>& params) {
407 #ifdef HAVE_XPETRA_TPETRA
408 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
412 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
419 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
425 const Teuchos::RCP<Teuchos::ParameterList>& params) {
428 #ifdef HAVE_XPETRA_TPETRA
429 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
433 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
440 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
441 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build (
445 const Teuchos::RCP<Teuchos::ParameterList>& params =
null) {
448 #ifdef HAVE_XPETRA_TPETRA
458 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build (
460 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
461 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
462 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
463 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
464 const Teuchos::RCP<Teuchos::ParameterList>& params =
null) {
467 #ifdef HAVE_XPETRA_TPETRA
469 return rcp(
new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
473 return rcp(
new EpetraCrsMatrixT<int,Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params) );
483 #if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES))
501 #ifdef HAVE_XPETRA_TPETRA
515 #ifdef HAVE_XPETRA_TPETRA
527 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
size_t maxNumEntriesPerRow,
ProfileType pftype=
DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
530 #ifdef HAVE_XPETRA_TPETRA
542 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc,
ProfileType pftype=
DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
545 #ifdef HAVE_XPETRA_TPETRA
560 #ifdef HAVE_XPETRA_TPETRA
561 if (graph->getRowMap()->lib() ==
UseTpetra)
565 if (graph->getRowMap()->lib() ==
UseEpetra)
573 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
578 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
581 #ifdef HAVE_XPETRA_TPETRA
582 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
586 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
593 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
598 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
601 #ifdef HAVE_XPETRA_TPETRA
602 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
606 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
613 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
619 const Teuchos::RCP<Teuchos::ParameterList>& params) {
622 #ifdef HAVE_XPETRA_TPETRA
623 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
627 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
634 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build(
640 const Teuchos::RCP<Teuchos::ParameterList>& params) {
643 #ifdef HAVE_XPETRA_TPETRA
644 if (sourceMatrix->getRowMap()->lib() ==
UseTpetra)
648 if (sourceMatrix->getRowMap()->lib() ==
UseEpetra)
654 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
655 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build (
659 const Teuchos::RCP<Teuchos::ParameterList>& params =
null) {
662 #ifdef HAVE_XPETRA_TPETRA
672 static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
Build (
674 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
675 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
676 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
677 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
678 const Teuchos::RCP<Teuchos::ParameterList>& params =
null) {
681 #ifdef HAVE_XPETRA_TPETRA
683 return rcp(
new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
687 return rcp(
new EpetraCrsMatrixT<long long, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params) );
698 #define XPETRA_CRSMATRIXFACTORY_SHORT