49 #ifndef XPETRA_STRIDEDMAPFACTORY_HPP 50 #define XPETRA_STRIDEDMAPFACTORY_HPP 63 template <class LocalOrdinal = StridedMap<>::local_ordinal_type,
68 class StridedMapFactory {
69 #undef XPETRA_STRIDEDMAPFACTORY_SHORT 84 return KokkosClassic::Details::getNode<Node>();
93 return rcp(
new StridedMap(lib, numGlobalElements, indexBase, stridingInfo, comm, stridedBlockId, offset, lg, node));
99 LocalOrdinal stridedBlockId = -1, GlobalOrdinal offset = 0,
102 return rcp(
new StridedMap(lib, numGlobalElements, numLocalElements, indexBase, stridingInfo, comm, stridedBlockId, offset, node));
106 return rcp(
new StridedMap(map, stridingInfo, map->getIndexBase(), stridedBlockId, offset));
112 "Xpetra::StridedMapFactory::Build: constructor expects stridedBlockId > -1.");
114 "Xpetra::StridedMapFactory::Build: constructor expects a full map (stridedBlockId == -1).");
116 std::vector<size_t> stridingInfo = map->getStridingData();
122 size_t nStridedOffset = 0;
123 for (
int j = 0; j < map->getStridedBlockId(); j++)
124 nStridedOffset += stridingInfo[j];
126 size_t numMyBlockDofs = (stridingInfo[stridedBlockId] * map->getNodeNumElements()) / map->getFixedBlockSize();
127 std::vector<GlobalOrdinal> subBlockDofGids(numMyBlockDofs);
130 LocalOrdinal ind = 0;
132 if (map->GID2StridingBlockId(*it) == Teuchos::as<size_t>(stridedBlockId))
133 subBlockDofGids[ind++] = *it;
147 for (LocalOrdinal i = 0; i < N; i++)
148 newElements[i] = oldElements[i];
161 GlobalOrdinal indexBase,
162 std::vector<size_t>& stridingInfo,
164 LocalOrdinal stridedBlockId = -1,
165 GlobalOrdinal offset = 0,
168 return rcp (
new StridedMap (lib, numGlobalElements, elementList,
169 indexBase, stridingInfo, comm,
170 stridedBlockId, node));
175 #define XPETRA_STRIDEDMAPFACTORY_SHORT
LocalOrdinal getStridedBlockId() const
GlobalOrdinal global_ordinal_type
static RCP< StridedMap > Build(const RCP< const Map > &map, std::vector< size_t > &stridingInfo, LocalOrdinal stridedBlockId=-1, GlobalOrdinal offset=0)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a list of the global indices owned by this node.
static RCP< StridedMap > Build(UnderlyingLib lib, global_size_t numGlobalElements, size_t numLocalElements, GlobalOrdinal indexBase, std::vector< size_t > &stridingInfo, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalOrdinal stridedBlockId=-1, GlobalOrdinal offset=0, const Teuchos::RCP< Node > &node=defaultArgNode())
Map constructor with a user-defined contiguous distribution.
Exception throws to report errors in the internal logical of the program.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get the Comm object for this Map.
Teuchos::RCP< Node > getNode() const
Get the Node object for this Map.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
static RCP< StridedMap > Build(UnderlyingLib lib, global_size_t numGlobalElements, const Teuchos::ArrayView< const GlobalOrdinal > &elementList, GlobalOrdinal indexBase, std::vector< size_t > &stridingInfo, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalOrdinal stridedBlockId=-1, GlobalOrdinal offset=0, const Teuchos::RCP< Node > &node=defaultArgNode())
Map constructor with a user-defined contiguous distribution. (for experts only. There is no special c...
static RCP< StridedMap > Build(const StridedMap &map)
Create copy of existing map (this just creates a copy of your map, it's not a clone in the sense of T...
static RCP< StridedMap > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, std::vector< size_t > &stridingInfo, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalOrdinal stridedBlockId=-1, GlobalOrdinal offset=0, LocalGlobal lg=Xpetra::GloballyDistributed, const Teuchos::RCP< Node > &node=defaultArgNode())
Map constructor with Xpetra-defined contiguous uniform distribution.
std::vector< size_t > getStridingData() const
size_t getNodeNumElements() const
Returns the number of elements belonging to the calling node.
size_t global_size_t
Global size_t object.
GlobalOrdinal getIndexBase() const
Returns the index base for this Map.
global_size_t getGlobalNumElements() const
Returns the number of elements in this Map.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
StridedMapFactory()
Private constructor. This is a static class.
#define XPETRA_MONITOR(funcName)
static Teuchos::RCP< Node > defaultArgNode()
static RCP< StridedMap > Build(const RCP< const StridedMap > &map, LocalOrdinal stridedBlockId)
Class that stores a strided map.