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 rcp(
new StridedMap(lib, numGlobalElements, indexBase, stridingInfo, comm, stridedBlockId, offset, lg, node));
90 LocalOrdinal stridedBlockId = -1, GlobalOrdinal offset = 0,
93 return rcp(
new StridedMap(lib, numGlobalElements, numLocalElements, indexBase, stridingInfo, comm, stridedBlockId, offset, node));
97 return rcp(
new StridedMap(map, stridingInfo, map->getIndexBase(), stridedBlockId, offset));
103 "Xpetra::StridedMapFactory::Build: constructor expects stridedBlockId > -1.");
105 "Xpetra::StridedMapFactory::Build: constructor expects a full map (stridedBlockId == -1).");
107 std::vector<size_t> stridingInfo = map->getStridingData();
113 size_t nStridedOffset = 0;
114 for (
int j = 0; j < map->getStridedBlockId(); j++)
115 nStridedOffset += stridingInfo[j];
117 size_t numMyBlockDofs = (stridingInfo[stridedBlockId] * map->getNodeNumElements()) / map->getFixedBlockSize();
118 std::vector<GlobalOrdinal> subBlockDofGids(numMyBlockDofs);
121 LocalOrdinal ind = 0;
123 if (map->GID2StridingBlockId(*it) == Teuchos::as<size_t>(stridedBlockId))
124 subBlockDofGids[ind++] = *it;
138 for (LocalOrdinal i = 0; i < N; i++)
139 newElements[i] = oldElements[i];
152 GlobalOrdinal indexBase,
153 std::vector<size_t>& stridingInfo,
155 LocalOrdinal stridedBlockId = -1,
156 GlobalOrdinal offset = 0,
159 return rcp (
new StridedMap (lib, numGlobalElements, elementList,
160 indexBase, stridingInfo, comm,
161 stridedBlockId, node));
166 #define XPETRA_STRIDEDMAPFACTORY_SHORT
std::vector< size_t > getStridingData() 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)
GlobalOrdinal getIndexBase() const
Returns the index base for this Map.
Exception throws to report errors in the internal logical of the program.
Teuchos::RCP< Node > getNode() const
Get the Node object for this Map.
global_size_t getGlobalNumElements() const
Returns the number of elements in 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=Teuchos::rcp(new Node))
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...
LocalOrdinal getStridedBlockId() const
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
size_t global_size_t
Global size_t object.
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get the Comm object for this Map.
StridedMapFactory()
Private constructor. This is a static class.
#define XPETRA_MONITOR(funcName)
static RCP< StridedMap > Build(const RCP< const StridedMap > &map, LocalOrdinal stridedBlockId)
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, 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=Teuchos::rcp(new Node))
Map constructor with Xpetra-defined contiguous uniform distribution.
Class that stores a strided map.
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=Teuchos::rcp(new Node))
Map constructor with a user-defined contiguous distribution.
size_t getNodeNumElements() const
Returns the number of elements belonging to the calling node.