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_CRSGRAPHFACTORY_HPP
00047 #define XPETRA_CRSGRAPHFACTORY_HPP
00048
00049 #include "Xpetra_ConfigDefs.hpp"
00050
00051 #include "Xpetra_CrsGraph.hpp"
00052
00053 #ifdef HAVE_XPETRA_TPETRA
00054 #include "Xpetra_TpetraCrsGraph.hpp"
00055 #endif
00056
00057 #ifdef HAVE_XPETRA_EPETRA
00058 #include "Xpetra_EpetraCrsGraph.hpp"
00059 #endif
00060
00061 #include "Xpetra_Exceptions.hpp"
00062
00063 namespace Xpetra {
00064
00065 template <class LocalOrdinal = CrsGraph<>::local_ordinal_type,
00066 class GlobalOrdinal =
00067 typename CrsGraph<LocalOrdinal>::global_ordinal_type,
00068 class Node =
00069 typename CrsGraph<LocalOrdinal, GlobalOrdinal>::node_type>
00070 class CrsGraphFactory {
00071 private:
00073 CrsGraphFactory() {}
00074
00075 public:
00077 static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
00078 Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, ProfileType pftype=DynamicProfile) {
00079 XPETRA_MONITOR("CrsGraphFactory::Build");
00080
00081 #ifdef HAVE_XPETRA_TPETRA
00082 if (map->lib() == UseTpetra)
00083 return rcp( new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node> (map, NumVectors, pftype) );
00084 #endif
00085
00086 XPETRA_FACTORY_ERROR_IF_EPETRA(map->lib());
00087 XPETRA_FACTORY_END;
00088 return null;
00089 }
00090 };
00091
00092 template <>
00093 class CrsGraphFactory<int, int> {
00094
00095 typedef int LocalOrdinal;
00096 typedef int GlobalOrdinal;
00097 typedef CrsGraph<int, GlobalOrdinal>::node_type Node;
00098
00099 private:
00101 CrsGraphFactory() {}
00102
00103 public:
00104
00105 static RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
00106 Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, ProfileType pftype=DynamicProfile) {
00107 XPETRA_MONITOR("CrsGraphFactory::Build");
00108
00109 #ifdef HAVE_XPETRA_TPETRA
00110 if (map->lib() == UseTpetra)
00111 return rcp( new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node> (map, NumVectors, pftype) );
00112 #endif
00113
00114 #ifdef HAVE_XPETRA_EPETRA
00115 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
00116 if (map->lib() == UseEpetra)
00117 return rcp( new EpetraCrsGraphT<int>(map, NumVectors, pftype) );
00118 #endif
00119 #endif
00120
00121 XPETRA_FACTORY_END;
00122 return null;
00123 }
00124
00125 };
00126
00127 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
00128 template <>
00129 class CrsGraphFactory<int, long long> {
00130
00131 typedef int LocalOrdinal;
00132 typedef long long GlobalOrdinal;
00133 typedef CrsGraph<int, GlobalOrdinal>::node_type Node;
00134
00135 private:
00137 CrsGraphFactory() {}
00138
00139 public:
00140
00141 static RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
00142 Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > &map, size_t NumVectors, ProfileType pftype=DynamicProfile) {
00143 XPETRA_MONITOR("CrsGraphFactory::Build");
00144
00145 #ifdef HAVE_XPETRA_TPETRA
00146 if (map->lib() == UseTpetra)
00147 return rcp( new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node> (map, NumVectors, pftype) );
00148 #endif
00149
00150 #ifdef HAVE_XPETRA_EPETRA
00151 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
00152 if (map->lib() == UseEpetra)
00153 return rcp( new EpetraCrsGraphT<long long>(map, NumVectors, pftype) );
00154 #endif
00155 #endif
00156
00157 XPETRA_FACTORY_END;
00158 return null;
00159 }
00160
00161 };
00162 #endif // HAVE_TEUCHOS_LONG_LONG_INT
00163 }
00164
00165 #define XPETRA_CRSGRAPHFACTORY_SHORT
00166 #endif