LCOV - code coverage report
Current view: top level - coupling/transferstrategies - TransferStrategy.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 27 3.7 %
Date: 2025-06-25 11:26:37 Functions: 0 23 0.0 %

          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_TRANSFERSTRATEGIES_STRATEGY_H_
       6             : #define _MOLECULARDYNAMICS_COUPLING_TRANSFERSTRATEGIES_STRATEGY_H_
       7             : 
       8             : #include "coupling/datastructures/CouplingCell.h"
       9             : #include "coupling/interface/MDSolverInterface.h"
      10             : 
      11             : namespace coupling {
      12             : namespace transferstrategies {
      13             : template <class LinkedCell, unsigned int dim> class TransferStrategy;
      14             : }
      15             : } // namespace coupling
      16             : 
      17             : /** interface for transfer strategy, that is for coupling cell operations
      18             :  * that are carried out before/after send/recv-operations between the two
      19             :  * solvers, or in each MD step for sampling purposes.
      20             :  *  @author Philipp Neumann
      21             :  *  @tparam LinkedCell the LinkedCell class is given by the implementation of
      22             :  * linked cells in the molecular dynamics simulation
      23             :  *  @tparam dim refers to the spacial dimension of the simulation, can be 1, 2,
      24             :  * or 3  */
      25             : template <class LinkedCell, unsigned int dim> class coupling::transferstrategies::TransferStrategy {
      26             : public:
      27             :   /** @brief a simple destructor
      28             :    *  @param mdSolverInterface interface to md solver */
      29           4 :   TransferStrategy(coupling::interface::MDSolverInterface<LinkedCell, dim>* const mdSolverInterface) : _mdSolverInterface(mdSolverInterface) {}
      30             : 
      31             :   /** @brief a dummy destructor */
      32           0 :   virtual ~TransferStrategy() {}
      33             : 
      34             :   /** Here, you might e.g. reset all coupling cell values to zero.
      35             :    *  This method is only applied to coupling cells that cover parts of the
      36             :    * MD domain; it is not applied in the outer coupling cells.
      37             :    *  @brief is called on the inner coupling cells before the data from the
      38             :    * macro solver is applied
      39             :    *  @param cell the coupling cell to apply
      40             :    *  @param index the index of the coupling cell */
      41           0 :   virtual void processInnerCouplingCellBeforeReceivingMacroscopicSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell,
      42           0 :                                                                             I02 index) {}
      43             : 
      44             :   /** This method is only applied to coupling cells that cover parts of the
      45             :    * MD domain; it is not applied in the outer coupling cells. Is called
      46             :    * before the
      47             :    * processInnerCouplingCellBeforeReceivingMacroscopicSolverData() method
      48             :    *  @brief the method is called before the cells are processed, e.g. general
      49             :    * values might be set here */
      50           0 :   virtual void beginProcessInnerCouplingCellsBeforeReceivingMacroscopicSolverData() {}
      51             : 
      52             :   /** This method is only applied to coupling cells that cover parts of the
      53             :    * MD domain; it is not applied in the outer coupling cells. Is called
      54             :    * after the processInnerCouplingCellBeforeReceivingMacroscopicSolverData()
      55             :    * method
      56             :    *  @brief the method is called after the cells are processed, e.g. some
      57             :    * general evaluation might happen like sum/counter */
      58           0 :   virtual void endProcessInnerCouplingCellsBeforeReceivingMacroscopicSolverData() {}
      59             : 
      60             :   /** Here, you might e.g. reset all coupling cell values to zero.
      61             :    *  This method is only applied to outer coupling cells that are not part
      62             :    * of the inner MD domain; it is not applied to the cells in the ghost layer
      63             :    *  @brief is called on the outer coupling cells before the data from the
      64             :    * macro solver is applied
      65             :    *  @param cell the coupling cell to apply
      66             :    *  @param index the index of the coupling cell */
      67           0 :   virtual void processOuterCouplingCellBeforeReceivingMacroscopicSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell,
      68           0 :                                                                             I02 index) {}
      69             : 
      70             :   /** This method is only applied to coupling cells that are not part the
      71             :    * inner MD domain; it is not applied to the ghost layer Is called before the
      72             :    * processOuterCouplingCellBeforeReceivingMacroscopicSolverData() method
      73             :    *  @brief the method is called before the outer cells are processed, e.g.
      74             :    * general values might be set here */
      75           0 :   virtual void beginProcessOuterCouplingCellsBeforeReceivingMacroscopicSolverData() {}
      76             : 
      77             :   /** This method is only applied to coupling cells that are not part the
      78             :    * inner MD domain; it is not applied to the ghost layer Is called after the
      79             :    * processOuterCouplingCellBeforeReceivingMacroscopicSolverData() method
      80             :    *  @brief the method is called after the outer cells are processed, e.g.
      81             :    * general values might be set here */
      82           0 :   virtual void endProcessOuterCouplingCellsBeforeReceivingMacroscopicSolverData() {}
      83             : 
      84             :   /** These values might be manipulated within this function. Example: Mass and
      85             :    * momentum have been transferred from the macroscopic solver to MD, but only
      86             :    * the difference between MD and macroscopic solver shall be introduced to MD.
      87             :    * Then, this function determines this difference and stores the result again
      88             :    * in microscopicMass and -Momentum. This method is only applied to
      89             :    * coupling cells that cover parts of the MD domain; it is not applied in
      90             :    * the outer coupling cells.
      91             :    *  @brieff is called for every coupling cell after the microscopicMass and
      92             :    * -Momentum have been filled in with data from the macroscopic solver.
      93             :    *  @param cell the coupling cell to apply
      94             :    *  @param index the index of the coupling cell */
      95           0 :   virtual void processInnerCouplingCellAfterReceivingMacroscopicSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell,
      96           0 :                                                                            I02 index) {}
      97             : 
      98             :   /** This method is only applied to coupling cells that cover parts of the
      99             :    * MD domain; it is not applied the outer coupling cells. Is called before
     100             :    * the processInnerCouplingCellAfterReceivingMacroscopicSolverData() method
     101             :    *  @brief the method is called before the inner cells are processed, e.g.
     102             :    * general values might be set here */
     103           0 :   virtual void beginProcessInnerCouplingCellsAfterReceivingMacroscopicSolverData() {}
     104             : 
     105             :   /** This method is only applied to coupling cells that cover parts of the
     106             :    * MD domain; it is not applied the outer coupling cells. Is called after
     107             :    * the processInnerCouplingCellAfterReceivingMacroscopicSolverData() method
     108             :    *  @brief the method is called after the inner cells are processed, e.g.
     109             :    * general values might be set here */
     110           0 :   virtual void endProcessInnerCouplingCellsAfterReceivingMacroscopicSolverData() {}
     111             : 
     112             :   /** These values might be manipulated within this function. Example: Mass and
     113             :    * momentum have been transferred from the macroscopic solver to MD, but only
     114             :    * the difference between MD and macroscopic solver shall be introduced to MD.
     115             :    * Then, this function determines this difference and stores the result again
     116             :    * in microscopicMass and -Momentum. This method is only applied to
     117             :    * coupling cells in the outer parts of the MD domain; it is not applied in
     118             :    * the ghost layer.
     119             :    *  @brief is called for every coupling cell after the microscopicMass and
     120             :    * -Momentum have been filled in with data from the macroscopic solver.
     121             :    *  @param cell the coupling cell to apply
     122             :    *  @param index the index of the coupling cell */
     123           0 :   virtual void processOuterCouplingCellAfterReceivingMacroscopicSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell,
     124           0 :                                                                            I02 index) {}
     125             : 
     126             :   /** This method is only applied to coupling cells are part of the outer MD
     127             :    * domain; it is not applied the inner coupling cells. Is called before the
     128             :    * processOuterCouplingCellAfterReceivingMacroscopicSolverData() method
     129             :    *  @brief the method is called before the outer cells are processed, e.g.
     130             :    * general values might be set here */
     131           0 :   virtual void beginProcessOuterCouplingCellsAfterReceivingMacroscopicSolverData() {}
     132             : 
     133             :   /** This method is only applied to coupling cells are part of the outer MD
     134             :    * domain; it is not applied the inner coupling cells. Is called after the
     135             :    * processOuterCouplingCellAfterReceivingMacroscopicSolverData() method
     136             :    *  @brief the method is called after the outer cells are processed, e.g.
     137             :    * general values might be set here */
     138           0 :   virtual void endProcessOuterCouplingCellsAfterReceivingMacroscopicSolverData() {}
     139             : 
     140             :   /** Example: Compute mass and momentum and store the results in
     141             :    *  macroscopicMass and -Momentum. The total mass and momentum from the MD
     142             :    * system will then be sent to the macroscopic solver. This method is only
     143             :    * applied to coupling cells that cover parts of the MD domain; it is not
     144             :    * applied in the outer coupling cells.
     145             :    *  @brief is called for every coupling cell before sending the
     146             :    * macroscopicMass and -Momentum data to the macroscopic solver and before
     147             :    * noise reduction invocation.
     148             :    *  @param cell the coupling cell to apply
     149             :    *  @param index the index of the coupling cell */
     150           0 :   virtual void processInnerCouplingCellBeforeSendingMDSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell, I02 index) {}
     151             : 
     152             :   /** This method is only applied to coupling cells that cover parts of the
     153             :    * MD domain; it is not applied the outer coupling cells. Is called before
     154             :    * the processInnerCouplingCellBeforeSendingMDSolverData() method
     155             :    *  @brief the method is called before the inner cell data is send, e.g.
     156             :    * general values might be set here */
     157           0 :   virtual void beginProcessInnerCouplingCellsBeforeSendingMDSolverData() {}
     158             : 
     159             :   /** This method is only applied to coupling cells that cover parts of the
     160             :    * MD domain; it is not applied the outer coupling cells. Is called after
     161             :    * the processInnerCouplingCellBeforeSendingMDSolverData() method
     162             :    *  @brief the method is called after the inner cell data is send, e.g.
     163             :    * general values might be set here */
     164           0 :   virtual void endProcessInnerCouplingCellsBeforeSendingMDSolverData() {}
     165             : 
     166             :   /** is called for every coupling cell before sending the macroscopicMass
     167             :    * and -Momentum data to the macroscopic solver and before noise reduction
     168             :    * invocation. Example: Compute mass and momentum and store the results in
     169             :    *  macroscopicMass and -Momentum. The total mass and momentum from the MD
     170             :    * system will then be sent to the macroscopic solver. This method is only
     171             :    * applied to outer coupling cells, that is cells that are located outside
     172             :    * the MD domain.
     173             :    *  @brief is called for outer coupling cell before sending the
     174             :    * macroscopicMass and -Momentum data to the macroscopic solver and before
     175             :    * noise reduction invocation.
     176             :    *  @param cell the coupling cell to apply
     177             :    *  @param index the index of the coupling cell */
     178           0 :   virtual void processOuterCouplingCellBeforeSendingMDSolverData(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell, I02 index) {}
     179             : 
     180             :   /** This method is only applied to coupling cells are part of the outer MD
     181             :    * domain; it is not applied the inner coupling cells. Is called before the
     182             :    * processOuterCouplingCellBeforeSendingMDSolverData() method
     183             :    *  @brief the method is called before the outer cells are processed, e.g.
     184             :    * general values might be set here */
     185           0 :   virtual void beginProcessOuterCouplingCellsBeforeSendingMDSolverData() {}
     186             : 
     187             :   /** This method is only applied to coupling cells are part of the outer MD
     188             :    * domain; it is not applied the inner coupling cells. Is called after the
     189             :    * processOuterCouplingCellBeforeSendingMDSolverData() method
     190             :    *  @brief the method is called after the outer cells are processed, e.g.
     191             :    * general values might be set here */
     192           0 :   virtual void endProcessOuterCouplingCellsBeforeSendingMDSolverData() {}
     193             : 
     194             :   /** required to collect cell data during an MD simulation. For example, if we
     195             :    * need time-averaged data within a coupling cell, we can compute mass and
     196             :    * momentum in each timestep and add it to the microscopicMass and -Momentum
     197             :    * buffers. This method is only applied to coupling cells that cover parts
     198             :    * of the MD domain; it is not applied in the outer coupling cells.
     199             :    *  @param cell the coupling cell to apply
     200             :    *  @param index the index of the coupling cell */
     201           0 :   virtual void processInnerCouplingCellAfterMDTimestep(coupling::datastructures::CouplingCellWithLinkedCells<LinkedCell, dim>& cell, I02 index) {}
     202             : 
     203             :   /** This method is only applied to coupling cells that cover parts of the
     204             :    * MD domain; it is not applied the outer coupling cells. Is called before
     205             :    * the processInnerCouplingCellAfterMDTimestep() method
     206             :    *  @brief the method is called before the inner cell data is send, e.g.
     207             :    * general values might be set here */
     208           0 :   virtual void beginProcessInnerCouplingCellsAfterMDTimestep() {}
     209             : 
     210             :   /** This method is only applied to coupling cells that cover parts of the
     211             :    * MD domain; it is not applied the outer coupling cells. Is called after
     212             :    * the processInnerCouplingCellAfterMDTimestep() method
     213             :    *  @brief the method is called after the inner cell data is send, e.g.
     214             :    * general values might be set here */
     215           0 :   virtual void endProcessInnerCouplingCellsAfterMDTimestep() {}
     216             : 
     217             : protected:
     218             :   /** interface for the md solver */
     219             :   coupling::interface::MDSolverInterface<LinkedCell, dim>* const _mdSolverInterface;
     220             : };
     221             : #endif // _MOLECULARDYNAMICS_COUPLING_TRANSFERSTRATEGIES_STRATEGY_H_

Generated by: LCOV version 1.14