* LocalAtomSetData
*/
-LocalAtomSetData::LocalAtomSetData(ArrayRef<const int> globalIndex) :
- globalIndex_(globalIndex.begin(), globalIndex.end()), localIndex_(globalIndex.begin(), globalIndex.end())
-{
- collectiveIndex_.resize(localIndex_.size());
- std::iota(collectiveIndex_.begin(), collectiveIndex_.end(), 0);
-}
-
LocalAtomSetData::LocalAtomSetData(ArrayRef<const index> globalIndex) :
globalIndex_(globalIndex.begin(), globalIndex.end()), localIndex_(globalIndex.begin(), globalIndex.end())
{
#ifndef GMX_DOMDEC_LOCALATOMSETDATA_H
#define GMX_DOMDEC_LOCALATOMSETDATA_H
+#include <numeric>
#include <vector>
#include "gromacs/utility/arrayref.h"
* \todo remove this constructor once all indices are represented
* as gmx::index instead of int.
*
+ * \note Not created if the internal int type does match gmx::index
+ *
* \param[in] globalAtomIndex Indices of the atoms to be managed
*/
- explicit LocalAtomSetData(ArrayRef<const int> globalAtomIndex);
+ template <typename T = void, typename U = std::enable_if_t<!std::is_same<int, index>::value, T> >
+ explicit LocalAtomSetData(ArrayRef<const int> globalAtomIndex) :
+ globalIndex_(globalAtomIndex.begin(), globalAtomIndex.end()),
+ localIndex_(globalAtomIndex.begin(), globalAtomIndex.end())
+ {
+ collectiveIndex_.resize(localIndex_.size());
+ std::iota(collectiveIndex_.begin(), collectiveIndex_.end(), 0);
+ }
/*! \brief Store the data for an atom set with an index group.
*
LocalAtomSetManager::~LocalAtomSetManager(){}
-LocalAtomSet
-LocalAtomSetManager::add(ArrayRef<const int> globalAtomIndex)
+template<> LocalAtomSet LocalAtomSetManager::add<void, void>(ArrayRef<const int> globalAtomIndex)
{
impl_->atomSetData_.push_back(std::make_unique<internal::LocalAtomSetData>(globalAtomIndex));
return LocalAtomSet(*impl_->atomSetData_.back());
public:
LocalAtomSetManager();
~LocalAtomSetManager();
-
+#ifndef DOXYGEN
/*! \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.
*
+ * \note Not created if the internal int type does match index
+ *
+ * \tparam T template parameter to use SFINAE for conditional function
+ * activation
+ * \tparam U template parameter for conditional function activation
+ *
* \param[in] globalAtomIndex Indices of the atoms to be managed
* \returns Handle to LocalAtomSet.
*/
+ template<typename T = void, typename U = std::enable_if_t< !std::is_same<int, index>::value, T> >
LocalAtomSet add(ArrayRef<const int> globalAtomIndex);
-
+#endif
/*! \brief Add a new atom set to be managed and give back a handle.
*
* \param[in] globalAtomIndex Indices of the atoms to be managed
/*
* 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.
namespace gmx
{
+extern template LocalAtomSet LocalAtomSetManager::add<void, void>(ArrayRef<const int> globalAtomIndex);
+
namespace test
{
#include "pull_internal.h"
+namespace gmx
+{
+extern template LocalAtomSet LocalAtomSetManager::add<void, void>(ArrayRef<const int> globalAtomIndex);
+} // namespace gmx
+
static int groupPbcFromParams(const t_pull_group ¶ms, bool setPbcRefToPrevStepCOM)
{
if (params.nat <= 1)
namespace gmx
{
+extern template LocalAtomSet LocalAtomSetManager::add<void, void>(ArrayRef<const int> globalAtomIndex);
+
class EnforcedRotation::Impl
{
public:
namespace gmx
{
+extern template LocalAtomSet LocalAtomSetManager::add<void, void>(ArrayRef<const int> globalAtomIndex);
+
/*! \internal
* \brief Implement Computational Electrophysiology swapping.
*/