50 #ifndef _ZOLTAN2_TPETRACRSMATRIXADAPTER_HPP_
51 #define _ZOLTAN2_TPETRACRSMATRIXADAPTER_HPP_
59 #include <Tpetra_CrsMatrix.hpp>
85 template <
typename User,
typename UserCoord = User>
89 #ifndef DOXYGEN_SHOULD_SKIP_THIS
96 using tmatrix_t = Tpetra::CrsMatrix<scalar_t, lno_t, gno_t, node_t>;
97 using device_t =
typename node_t::device_type;
98 using host_t =
typename Kokkos::HostSpace::memory_space;
100 using userCoord_t = UserCoord;
112 int nWeightsPerRow=0);
118 template <
typename Adapter>
122 template <
typename Adapter>
131 template <
typename User,
typename UserCoord>
133 const RCP<const User> &inmatrix,
int nWeightsPerRow):
134 RowMatrix(nWeightsPerRow, inmatrix) {
136 auto colIdsHost = inmatrix->getLocalIndicesHost();
138 auto colIdsGlobalHost =
139 typename Base::IdsHostView(
"colIdsGlobalHost", colIdsHost.extent(0));
140 auto colMap = inmatrix->getColMap();
143 Kokkos::parallel_for(
"colIdsGlobalHost",
144 Kokkos::RangePolicy<Kokkos::HostSpace::execution_space>(
145 0, colIdsGlobalHost.extent(0)),
147 colIdsGlobalHost(i) =
148 colMap->getGlobalElement(colIdsHost(i));
151 auto colIdsDevice = Kokkos::create_mirror_view_and_copy(
155 this->
offsDevice_ = inmatrix->getLocalRowPtrsDevice();
160 "rowWeightsDevice_", inmatrix->getLocalNumRows(),
173 template <
typename User,
typename UserCoord>
174 template <
typename Adapter>
176 const User &in, User *&out,
181 ArrayRCP<gno_t> importList;
185 (solution,
this, importList);
190 RCP<User> outPtr = this->doMigration(in, numNewRows,importList.getRawPtr());
191 out =
const_cast<User *
>(outPtr.get());
196 template <
typename User,
typename UserCoord>
197 template <
typename Adapter>
199 const User &in, RCP<User> &out,
204 ArrayRCP<gno_t> importList;
208 (solution,
this, importList);
213 out = this->doMigration(in, numNewRows, importList.getRawPtr());
Helper functions for Partitioning Problems.
Base::ConstIdsDeviceView colIdsDevice_
#define Z2_FORWARD_EXCEPTIONS
Forward an exception back through call stack.
typename InputTraits< User >::scalar_t scalar_t
MatrixAdapter defines the adapter interface for matrices.
typename Kokkos::HostSpace::memory_space host_t
TpetraCrsMatrixAdapter(const RCP< const User > &inmatrix, int nWeightsPerRow=0)
Constructor.
Provides access for Zoltan2 to Tpetra::CrsMatrix data.
typename node_t::device_type device_t
typename InputTraits< User >::part_t part_t
size_t getImportList(const PartitioningSolution< SolutionAdapter > &solution, const DataAdapter *const data, ArrayRCP< typename DataAdapter::gno_t > &imports)
From a PartitioningSolution, get a list of IDs to be imported. Assumes part numbers in PartitioningSo...
Provides access for Zoltan2 to Tpetra::RowMatrix data.
typename InputTraits< User >::node_t node_t
A PartitioningSolution is a solution to a partitioning problem.
typename InputTraits< User >::gno_t gno_t
Base::ConstOffsetsDeviceView offsDevice_
Defines the TpetraRowMatrixAdapter class.
void applyPartitioningSolution(const User &in, User *&out, const PartitioningSolution< Adapter > &solution) const
RCP< const User > matrix_
typename InputTraits< User >::offset_t offset_t
Defines the MatrixAdapter interface.
Kokkos::View< bool *, host_t > numNzWeight_
RCP< const User > getUserMatrix() const
Access to user's matrix.
Base::WeightsDeviceView rowWeightsDevice_
typename InputTraits< User >::lno_t lno_t
This file defines the StridedData class.