Line data Source code
1 : // Copyright (C) 2015 Technische Universitaet Muenchen
2 : // This file is part of the Mamico project. For conditions of distribution
3 : // and use, please see the copyright notice in Mamico's main folder, or at
4 : // www5.in.tum.de/mamico
5 : #ifndef _MOLECULARDYNAMICS_COUPLING_PARALLELTOPOLOGY_PARALLELTOPOLOGY_H_
6 : #define _MOLECULARDYNAMICS_COUPLING_PARALLELTOPOLOGY_PARALLELTOPOLOGY_H_
7 :
8 : #include "tarch/la/Vector.h"
9 :
10 : namespace coupling {
11 : /** namespace coupling */
12 : namespace paralleltopology {
13 : /** namespace paralleltopology */
14 : template <unsigned int dim> class ParallelTopology;
15 : } // namespace paralleltopology
16 : } // namespace coupling
17 :
18 : /** interface for different parallel topologies. This can be adapted to the
19 : *respective Cartesian topology that is applied to the MD simulation. This class
20 : *solely performs the conversion rank<-> process coordinates, assuming a
21 : *Cartesian grid-like splitting of the MD domain. It is the base class of the
22 : *classe ZYXTopology and XYZTopology.
23 : * @brief This class performs the conversion rank <-> process coordinates.
24 : * @tparam dim Number of dimensions; it can be 1, 2 or 3
25 : * @author Philipp Neumann
26 : */
27 812 : template <unsigned int dim> class coupling::paralleltopology::ParallelTopology {
28 : public:
29 : /** Destructor */
30 48 : virtual ~ParallelTopology() {}
31 : /** This function takes process coordinates as input and returns the
32 : *correpsponding rank.
33 : * @brief converts process coordinates into a rank.
34 : * @param processCoordinates Process coordinates
35 : */
36 : virtual unsigned int getRank(tarch::la::Vector<dim, unsigned int> processCoordinates, unsigned int topologyOffset) const = 0;
37 : /** This function takes rank as input and return the correpsponding process
38 : *coordinates.
39 : * @brief converts rank into process coordinates.
40 : * @param rank Rank
41 : */
42 : virtual tarch::la::Vector<dim, unsigned int> getProcessCoordinates(unsigned int rank, unsigned int topologyOffset) const = 0;
43 : };
44 :
45 : #endif // _MOLECULARDYNAMICS_COUPLING_PARALLELTOPOLOGY_PARALLELTOPOLOGY_H_
|