Skip to content

Commit

Permalink
#46: Cleaned TpetraMultiVectorAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrinel committed Jul 24, 2023
1 parent 20db562 commit 9449fba
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ namespace Zoltan2 {
The template parameter is the user's input object:
\li \c Tpetra::MultiVector
\li \c Xpetra::MultiVector
The \c scalar_t type, representing use data such as vector values, is
used by Zoltan2 for weights, coordinates, part sizes and
Expand Down Expand Up @@ -90,7 +89,7 @@ template <typename User>

/*! \brief Constructor
*
* \param invector the user's Xpetra, Tpetra MultiVector object
* \param invector the user's Tpetra MultiVector object
* \param weights a list of pointers to arrays of weights.
* The number of weights per multivector element is assumed to be
* \c weights.size().
Expand All @@ -108,7 +107,7 @@ template <typename User>

/*! \brief Constructor for case when weights are not being used.
*
* \param invector the user's Xpetra, Tpetra MultiVector object
* \param invector the user's Tpetra MultiVector object
*/

TpetraMultiVectorAdapter(const RCP<const User> &invector);
Expand All @@ -128,8 +127,6 @@ template <typename User>
void getIDsKokkosView(
Kokkos::View<const gno_t *, typename node_t::device_type> &ids) const {
using device_type = typename node_t::device_type;
// const xt_mvector_t *tvector =
// dynamic_cast<const xt_mvector_t *>(vector_.get());
// MJ can be running Host, CudaSpace, or CudaUVMSpace while Map now
// internally never stores CudaUVMSpace so we may need a conversion.
// However Map stores both Host and CudaSpace so this could be improved
Expand Down Expand Up @@ -198,6 +195,7 @@ template <typename User>

private:

// MPL: 07/20/2023: TOCHECK: invector_ seems to be useless
RCP<const User> invector_;
RCP<const t_mvector_t> vector_;
RCP<const Tpetra::Map<lno_t, gno_t, node_t> > map_;
Expand All @@ -221,6 +219,7 @@ template <typename User>
numWeights_(weights.size()), weights_(weights.size())
{
typedef StridedData<lno_t, scalar_t> input_t;
// MPL: 07/13/86: should we copy the data from invector to vector_ ?
vector_ = invector;

map_ = vector_->getMap();
Expand All @@ -246,14 +245,8 @@ template <typename User>
invector_(invector), vector_(), map_(),
numWeights_(0), weights_()
{
try {
// RCP<t_mvector_t> tmp =
// XpetraTraits<User>::convertToXpetra(rcp_const_cast<User>(invector));
// MPL: 07/13/86: should we copy the data from invector to vector_ ?
vector_ = rcp_const_cast<const t_mvector_t>(invector);
}
Z2_FORWARD_EXCEPTIONS

// MPL: 07/13/86: should we copy the data from invector to vector_ ?
vector_ = invector;
map_ = vector_->getMap();
}

Expand All @@ -265,8 +258,6 @@ template <typename User>
size_t vecsize;
stride = 1;
elements = NULL;
// const xt_mvector_t *tvector =
// dynamic_cast<const xt_mvector_t *>(vector_.get());

vecsize = vector_->getLocalLength();
if (vecsize > 0){
Expand Down Expand Up @@ -307,7 +298,6 @@ template <typename User>
Z2_FORWARD_EXCEPTIONS;

// Move the rows, creating a new vector.
// RCP<User> outPtr = XpetraTraits<User>::doMigration(in, numNewRows, importList.getRawPtr());
RCP<User> outPtr = doMigration(in, numNewRows, importList.getRawPtr());
out = outPtr.get();
outPtr.release();
Expand Down

0 comments on commit 9449fba

Please sign in to comment.