/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
std::iota(collectiveIndex_.begin(), collectiveIndex_.end(), 0);
}
+LocalAtomSetData::LocalAtomSetData(ArrayRef<const index> globalIndex) :
+ globalIndex_(globalIndex.begin(), globalIndex.end()), localIndex_(globalIndex.begin(), globalIndex.end())
+{
+ collectiveIndex_.resize(localIndex_.size());
+ std::iota(collectiveIndex_.begin(), collectiveIndex_.end(), 0);
+}
+
void
LocalAtomSetData::setLocalAndCollectiveIndices(const gmx_ga2la_t &ga2la)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <vector>
#include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/basedefinitions.h"
class gmx_ga2la_t;
* local and collective indices will be updated in setLocalAndCollectiveIndices
* to match domain decompostion if domain decomposition is performed.
*
+ * \todo remove this constructor once all indices are represented
+ * as gmx::index instead of int.
+ *
* \param[in] globalAtomIndex Indices of the atoms to be managed
*/
explicit LocalAtomSetData(ArrayRef<const int> globalAtomIndex);
+
+ /*! \brief Store the data for an atom set with an index group.
+ *
+ * Prior to domain decomposition, local atom indices are global atom indices
+ * and the collective index runs from 0..numberOfAtoms-1.
+ * local and collective indices will be updated in setLocalAndCollectiveIndices
+ * to match domain decompostion if domain decomposition is performed.
+ *
+ * \param[in] globalAtomIndex Indices of the atoms to be managed
+ */
+ explicit LocalAtomSetData(ArrayRef<const index> globalAtomIndex);
+
/*! \brief Sets the local and collective indices from a lookup in ga2la.
*
* Calculate local and collective indices of home atoms, assuming a valid
return LocalAtomSet(*impl_->atomSetData_.back());
}
+LocalAtomSet
+LocalAtomSetManager::add(ArrayRef<const index> globalAtomIndex)
+{
+ impl_->atomSetData_.push_back(std::make_unique<internal::LocalAtomSetData>(globalAtomIndex));
+ return LocalAtomSet(*impl_->atomSetData_.back());
+}
+
void
LocalAtomSetManager::setIndicesInDomainDecomposition(const gmx_ga2la_t &ga2la)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <memory>
#include "gromacs/utility/arrayref.h"
+#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/classhelpers.h"
class gmx_ga2la_t;
~LocalAtomSetManager();
/*! \brief Add a new atom set to be managed and give back a handle.
+ *
+ * \todo remove this routine once all indices are represented as
+ * gmx::index instead of int.
*
* \param[in] globalAtomIndex Indices of the atoms to be managed
* \returns Handle to LocalAtomSet.
*/
LocalAtomSet add(ArrayRef<const int> globalAtomIndex);
+ /*! \brief Add a new atom set to be managed and give back a handle.
+ *
+ * \param[in] globalAtomIndex Indices of the atoms to be managed
+ * \returns Handle to LocalAtomSet.
+ */
+ LocalAtomSet add(ArrayRef<const index> globalAtomIndex);
+
/*! \brief Recalculate local and collective indices from ga2la.
* Uses global atom to local atom lookup structure to
* update atom indices.