49 #ifndef XPETRA_STRIDEDMAPFACTORY_DEF_HPP
50 #define XPETRA_STRIDEDMAPFACTORY_DEF_HPP
65 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
74 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
79 GlobalOrdinal indexBase,
80 std::vector<size_t>& stridingInfo,
82 LocalOrdinal stridedBlockId,
92 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
97 size_t numLocalElements,
98 GlobalOrdinal indexBase,
99 std::vector<size_t>& stridingInfo,
101 LocalOrdinal stridedBlockId,
102 GlobalOrdinal offset)
104 return rcp(
new StridedMap(lib, numGlobalElements, numLocalElements, indexBase, stridingInfo, comm, stridedBlockId, offset));
108 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 std::vector<size_t>& stridingInfo,
113 LocalOrdinal stridedBlockId,
114 GlobalOrdinal offset)
116 return rcp(
new StridedMap(map, stridingInfo, map->getIndexBase(), stridedBlockId, offset));
120 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
127 "Xpetra::StridedMapFactory::Build: constructor expects stridedBlockId > -1.");
131 "Xpetra::StridedMapFactory::Build: constructor expects a full map (stridedBlockId == -1).");
133 std::vector<size_t> stridingInfo = map->getStridingData();
139 size_t nStridedOffset = 0;
140 for(
int j = 0; j < map->getStridedBlockId(); j++)
142 nStridedOffset += stridingInfo[ j ];
145 size_t numMyBlockDofs = (stridingInfo[ stridedBlockId ] * map->getNodeNumElements()) / map->getFixedBlockSize();
147 std::vector<GlobalOrdinal> subBlockDofGids(numMyBlockDofs);
150 LocalOrdinal ind = 0;
153 if(map->GID2StridingBlockId(*it) == Teuchos::as<size_t>(stridedBlockId))
155 subBlockDofGids[ ind++ ] = *it;
163 subBlockDofGids_view,
171 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
182 for(LocalOrdinal i = 0; i < N; i++)
184 newElements[ i ] = oldElements[ i ];
196 template<
class LocalOrdinal,
class GlobalOrdinal,
class Node>
202 GlobalOrdinal indexBase,
203 std::vector<size_t>& stridingInfo,
205 LocalOrdinal stridedBlockId,
208 return rcp(
new StridedMap(lib, numGlobalElements, elementList, indexBase, stridingInfo, comm, stridedBlockId));
#define XPETRA_MONITOR(funcName)
Exception throws to report errors in the internal logical of the program.
StridedMapFactory()
Private constructor. This is a static class.
static RCP< Xpetra::StridedMap< LocalOrdinal, GlobalOrdinal, Node > > 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)
Map constructor with Xpetra-defined contiguous uniform distribution.
Class that stores a strided map.
Teuchos::ArrayView< const GlobalOrdinal > getNodeElementList() const
Return a list of the global indices owned by this node.
UnderlyingLib lib() const
Get the library used by this object (Tpetra or Epetra?)
global_size_t getGlobalNumElements() const
Returns the number of elements in this Map.
LocalOrdinal getStridedBlockId() const
std::vector< size_t > getStridingData() const
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Get the Comm object for this Map.
size_t getNodeNumElements() const
Returns the number of elements belonging to the calling node.
GlobalOrdinal getIndexBase() const
Returns the index base for this Map.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
size_t global_size_t
Global size_t object.