Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_ExportFactory.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Xpetra: A linear algebra interface package
4//
5// Copyright 2012 NTESS and the Xpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef XPETRA_EXPORTFACTORY_HPP
11#define XPETRA_EXPORTFACTORY_HPP
12
13#include "Xpetra_ConfigDefs.hpp"
14
15#include "Xpetra_Export.hpp"
16
17#ifdef HAVE_XPETRA_TPETRA
18#include "Xpetra_TpetraExport.hpp"
19#endif
20#ifdef HAVE_XPETRA_EPETRA
22#endif
23
24#include "Xpetra_Exceptions.hpp"
25
26namespace Xpetra {
27
28template <class LocalOrdinal,
29 class GlobalOrdinal,
30 class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
32 private:
35
36 public:
39 XPETRA_MONITOR("ExportFactory::Build");
40 TEUCHOS_TEST_FOR_EXCEPTION(source->lib() != target->lib(), Xpetra::Exceptions::RuntimeError, "");
41
42#ifdef HAVE_XPETRA_TPETRA
43 if (source->lib() == UseTpetra)
44 return rcp(new TpetraExport<LocalOrdinal, GlobalOrdinal, Node>(source, target));
45#endif
46
47 XPETRA_FACTORY_ERROR_IF_EPETRA(source->lib());
49 }
50};
51
52// we need the Epetra specialization only if Epetra is enabled
53#if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES))
54template <>
55class ExportFactory<int, int, EpetraNode> {
56 typedef int LocalOrdinal;
57 typedef int GlobalOrdinal;
59
60 private:
63
64 public:
66 XPETRA_MONITOR("ExportFactory::Build");
67
68 TEUCHOS_TEST_FOR_EXCEPTION(source->lib() != target->lib(), Xpetra::Exceptions::RuntimeError, "");
69
70#ifdef HAVE_XPETRA_TPETRA
71 if (source->lib() == UseTpetra)
72 return rcp(new TpetraExport<LocalOrdinal, GlobalOrdinal, Node>(source, target));
73#endif
74
75 if (source->lib() == UseEpetra)
76 return rcp(new EpetraExportT<int, Node>(source, target));
77
79 }
80};
81#endif
82
83// we need the Epetra specialization only if Epetra is enabled
84#if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES))
85template <>
86class ExportFactory<int, long long, EpetraNode> {
87 typedef int LocalOrdinal;
88 typedef long long GlobalOrdinal;
90
91 private:
94
95 public:
97 XPETRA_MONITOR("ExportFactory::Build");
98
99 TEUCHOS_TEST_FOR_EXCEPTION(source->lib() != target->lib(), Xpetra::Exceptions::RuntimeError, "");
100
101#ifdef HAVE_XPETRA_TPETRA
102 if (source->lib() == UseTpetra)
103 return rcp(new TpetraExport<LocalOrdinal, GlobalOrdinal, Node>(source, target));
104#endif
105
106 if (source->lib() == UseEpetra)
107 return rcp(new EpetraExportT<long long, Node>(source, target));
108
110 }
111};
112#endif
113
114} // namespace Xpetra
115
116#define XPETRA_EXPORTFACTORY_SHORT
117#endif
#define XPETRA_MONITOR(funcName)
#define XPETRA_FACTORY_ERROR_IF_EPETRA(lib)
#define XPETRA_FACTORY_END
Exception throws to report errors in the internal logical of the program.
static RCP< Export< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &source, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &target)
ExportFactory()
Private constructor. This is a static class.
ExportFactory()
Private constructor. This is a static class.
static RCP< Export< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &source, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &target)
static RCP< Export< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &source, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &target)
Constructor specifying the number of non-zeros for all rows.
ExportFactory()
Private constructor. This is a static class.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode