Introduce SimulatorBuilder
[gromacs.git] / src / gromacs / domdec / localatomsetdata.h
blobdc257791a70fd76c0027de9587258c4ecf5856bf
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2018, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
35 /*! \file
36 * \internal \brief
37 * Declares gmx::internal::LocalAtomSetData.
39 * \author Christian Blau <cblau@gwdg.de>
40 * \ingroup module_domdec
42 #ifndef GMX_DOMDEC_LOCALATOMSETDATA_H
43 #define GMX_DOMDEC_LOCALATOMSETDATA_H
45 #include <vector>
47 #include "gromacs/utility/arrayref.h"
49 class gmx_ga2la_t;
51 namespace gmx
54 namespace internal
57 /* \brief Internal class for storing and managing atom indices of an atom set.
59 class LocalAtomSetData
61 public:
62 /*! \brief Store the data for an atom set with an index group.
64 * Prior to domain decomposition, local atom indices are global atom indices
65 * and the collective index runs from 0..numberOfAtoms-1.
66 * local and collective indices will be updated in setLocalAndCollectiveIndices
67 * to match domain decompostion if domain decomposition is performed.
69 * \param[in] globalAtomIndex Indices of the atoms to be managed
71 explicit LocalAtomSetData(ArrayRef<const int> globalAtomIndex);
72 /*! \brief Sets the local and collective indices from a lookup in ga2la.
74 * Calculate local and collective indices of home atoms, assuming a valid
75 * global atom to local atom look-up table.
77 * \param[in] ga2la lookup table that reports if an atom is local.
79 void setLocalAndCollectiveIndices(const gmx_ga2la_t &ga2la);
80 /*! \brief Global indices of the atoms in this set. */
81 const std::vector<int> globalIndex_;
82 /*! \brief Maps indices on this rank [0..num_atoms_local_) to global atom indicices,
83 * so that localIndex[i] = globalIndex[collectiveIndex[i]].
85 * This translation of locally dense atom data to global representation,
86 * allows to adresses per-atom properties, e.g., scattering factors,
87 * that are stored in a global continuous array for each atom of the atom set.
89 std::vector<int> collectiveIndex_;
90 /*! \brief Local indices of the atoms.
91 * Access the i-th local atom coordinate of this set by x[local_index_[i]].
92 * Constructed and updated every domain-decomposition step.
94 std::vector<int> localIndex_;
97 } // namespace internal
99 } // namespace gmx
104 #endif