46 #ifndef XPETRA_MAPFACTORY_DEF_HPP
47 #define XPETRA_MAPFACTORY_DEF_HPP
51 #ifdef HAVE_XPETRA_TPETRA
52 # include "Xpetra_TpetraMap.hpp"
54 #ifdef HAVE_XPETRA_EPETRA
58 #include "Xpetra_BlockedMap.hpp"
63 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
75 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
76 Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
80 GlobalOrdinal indexBase,
81 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm,
86 #ifdef HAVE_XPETRA_TPETRA
100 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
101 Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
105 size_t numLocalElements,
106 GlobalOrdinal indexBase,
107 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
111 #ifdef HAVE_XPETRA_TPETRA
125 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
126 Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
130 const Teuchos::ArrayView<const GlobalOrdinal>& elementList,
131 GlobalOrdinal indexBase,
132 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
136 #ifdef HAVE_XPETRA_TPETRA
147 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
148 Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
151 LocalOrdinal numDofPerNode)
155 RCP<const BlockedMap<LocalOrdinal, GlobalOrdinal, Node>> bmap =
159 TEUCHOS_TEST_FOR_EXCEPTION(numDofPerNode != 1,
161 "Xpetra::MapFactory::Build: When provided a BlockedMap numDofPerNode must set to be one. It is set to "
162 << numDofPerNode <<
".");
166 #ifdef HAVE_XPETRA_TPETRA
167 LocalOrdinal N = map->getNodeNumElements();
168 Teuchos::ArrayView<const GlobalOrdinal> oldElements = map->getNodeElementList();
169 Teuchos::Array<GlobalOrdinal> newElements(map->getNodeNumElements() * numDofPerNode);
170 for(LocalOrdinal i = 0; i < N; i++)
172 for(LocalOrdinal j = 0; j < numDofPerNode; j++)
174 newElements[ i * numDofPerNode + j ] = oldElements[ i ] * numDofPerNode + j;
179 return rcp(
new TpetraMap<LocalOrdinal, GlobalOrdinal, Node>
180 (map->getGlobalNumElements() * numDofPerNode, newElements, map->getIndexBase(), map->getComm())
191 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
192 #ifdef HAVE_XPETRA_TPETRA
193 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
194 Teuchos::RCP<Map<LocalOrdinal, GlobalOrdinal, Node>>
198 const Kokkos::View<const GlobalOrdinal*, typename Node::device_type>& indexList,
199 GlobalOrdinal indexBase,
200 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
204 return rcp(
new TpetraMap<LocalOrdinal, GlobalOrdinal, Node>(numGlobalElements, indexList, indexBase, comm));
208 #endif // HAVE_XPETRA_TPETRA
209 #endif // HAVE_XPETRA_KOKKOS_REFACTOR
213 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
214 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
218 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
222 #ifdef HAVE_XPETRA_TPETRA
233 #endif // HAVE_XPETRA_TPETRA
243 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
244 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
248 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
252 #ifdef HAVE_XPETRA_TPETRA
257 #endif // HAVE_XPETRA_TPETRA
268 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
269 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
273 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
277 #ifdef HAVE_XPETRA_TPETRA
280 Tpetra::createUniformContigMapWithNode<LocalOrdinal, GlobalOrdinal, Node>(numElements, comm)));
281 #endif // HAVE_XPETRA_TPETRA
289 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
290 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
294 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
298 #ifdef HAVE_XPETRA_TPETRA
301 Tpetra::createUniformContigMapWithNode<LocalOrdinal, GlobalOrdinal, Node>(numElements, comm)));
302 #endif // HAVE_XPETRA_TPETRA
309 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
310 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
314 size_t localNumElements,
315 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
319 #ifdef HAVE_XPETRA_TPETRA
322 Tpetra::createContigMapWithNode<LocalOrdinal, GlobalOrdinal, Node>(numElements, localNumElements, comm)));
323 #endif // HAVE_XPETRA_TPETRA
334 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
335 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>
339 size_t localNumElements,
340 const Teuchos::RCP<
const Teuchos::Comm<int>>& comm)
344 #ifdef HAVE_XPETRA_TPETRA
348 Tpetra::createContigMapWithNode<LocalOrdinal, GlobalOrdinal, Node>(numElements, localNumElements, comm)));
350 #endif // HAVE_XPETRA_TPETRA
360 #endif // XPETRA_MAPFACTORY_DEF_HPP
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMap(UnderlyingLib lib, size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a locally replicated Map with the default node.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMap(UnderlyingLib lib, global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a (potentially) non-uniform, contiguous Map with the default node.
Exception throws to report errors in the internal logical of the program.
#define XPETRA_FACTORY_ERROR_IF_EPETRA(lib)
MapFactory()
Private constructor. This is a static class.
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int >> &comm, LocalGlobal lg=Xpetra::GloballyDistributed)
Map constructor with Xpetra-defined contiguous uniform distribution.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createContigMapWithNode(UnderlyingLib lib, global_size_t numElements, size_t localNumElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a (potentially) non-uniform, contiguous Map with a user-specified node.
#define XPETRA_FACTORY_END
size_t global_size_t
Global size_t object.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMapWithNode(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a uniform, contiguous Map with a user-specified node.
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createLocalMapWithNode(UnderlyingLib lib, size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a locally replicated Map with a specified node.
#define XPETRA_MONITOR(funcName)
static Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > createUniformContigMap(UnderlyingLib lib, global_size_t numElements, const Teuchos::RCP< const Teuchos::Comm< int >> &comm)
Create a uniform, contiguous Map with the default node.