Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef XPETRA_IMPORTFACTORY_HPP
00047 #define XPETRA_IMPORTFACTORY_HPP
00048
00049 #include "Xpetra_ConfigDefs.hpp"
00050
00051 #include "Xpetra_Import.hpp"
00052
00053 #ifdef HAVE_XPETRA_TPETRA
00054 #include "Xpetra_TpetraImport.hpp"
00055 #endif
00056 #ifdef HAVE_XPETRA_EPETRA
00057 #include "Xpetra_EpetraImport.hpp"
00058 #endif
00059
00060 #include "Xpetra_Exceptions.hpp"
00061
00062 namespace Xpetra {
00063
00064 template <class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = Kokkos::DefaultNode::DefaultNodeType>
00065 class ImportFactory {
00066
00067 private:
00069 ImportFactory() {}
00070
00071 public:
00072
00074 static RCP<Import<LocalOrdinal, GlobalOrdinal, Node> > Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &source, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &target) {
00075 XPETRA_MONITOR("ImportFactory::Build");
00076
00077 TEUCHOS_TEST_FOR_EXCEPTION(source->lib() != target->lib(), Xpetra::Exceptions::RuntimeError, "");
00078
00079 #ifdef HAVE_XPETRA_TPETRA
00080 if (source->lib() == UseTpetra)
00081 return rcp( new TpetraImport<LocalOrdinal, GlobalOrdinal, Node>(source, target));
00082 #endif
00083
00084 XPETRA_FACTORY_ERROR_IF_EPETRA(source->lib());
00085 XPETRA_FACTORY_END;
00086 }
00087
00088 };
00089
00090 template <>
00091 class ImportFactory<int, int> {
00092
00093 typedef int LocalOrdinal;
00094 typedef int GlobalOrdinal;
00095 typedef Kokkos::DefaultNode::DefaultNodeType Node;
00096
00097 private:
00099 ImportFactory() {}
00100
00101 public:
00102
00103 static RCP<Import<LocalOrdinal, GlobalOrdinal, Node> > Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &source, const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &target) {
00104 XPETRA_MONITOR("ImportFactory::Build");
00105 TEUCHOS_TEST_FOR_EXCEPTION(source->lib() != target->lib(), Xpetra::Exceptions::RuntimeError, "");
00106
00107 #ifdef HAVE_XPETRA_TPETRA
00108 if (source->lib() == UseTpetra)
00109 return rcp( new TpetraImport<LocalOrdinal, GlobalOrdinal, Node>(source, target));
00110 #endif
00111
00112 #ifdef HAVE_XPETRA_EPETRA
00113 if (source->lib() == UseEpetra)
00114 return rcp( new EpetraImport(source, target));
00115 #endif
00116
00117 XPETRA_FACTORY_END;
00118 }
00119
00120 };
00121
00122 }
00123
00124 #define XPETRA_IMPORTFACTORY_SHORT
00125 #endif