LCOV - code coverage report
Current view: top level - coupling/interface - MacroscopicSolverInterface.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 4 25.0 %
Date: 2025-06-25 11:26:37 Functions: 0 2 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_INTERFACE_MACROSCOPICSOLVERINTERFACE_H_
       6             : #define _MOLECULARDYNAMICS_COUPLING_INTERFACE_MACROSCOPICSOLVERINTERFACE_H_
       7             : 
       8             : #include "coupling/CouplingMDDefinitions.h"
       9             : #include "tarch/la/Vector.h"
      10             : #include <vector>
      11             : 
      12             : namespace coupling {
      13             : namespace interface {
      14             : template <unsigned int dim> class MacroscopicSolverInterface;
      15             : }
      16             : } // namespace coupling
      17             : 
      18             : /** This class provides
      19             :  *      @brief interface for the macroscopic, i.e. continuum solver
      20             :  *      @tparam dim Number of dimensions; it can be 1, 2 or 3
      21             :  *  @author Philipp Neumann
      22             :  */
      23             : template <unsigned int dim> class coupling::interface::MacroscopicSolverInterface {
      24             : 
      25             : public:
      26             :   /** Costructor */
      27           4 :   MacroscopicSolverInterface() {}
      28             :   /** Destructor */
      29           0 :   virtual ~MacroscopicSolverInterface() {}
      30             : 
      31             :   /* This function defines an offset of cells which is considered to be the outer region.
      32             :    * It replaces the legacy functions 'receiveMacroscopicQuantityFromMDSolver' and 'sendMacroscopicQuantityToMDSolver'
      33             :    * from older versions of MaMiCo. Data are sent to MD solver for cells that are not in the ghost layer
      34             :    * and not part of the inner region. Data needs so be send from micro to macro solver for all inner cells.
      35             :    *  @return number of cells in outer region per direction at each boundary, e.g. 3
      36             :    */
      37             :   virtual unsigned int getOuterRegion() = 0;
      38             : 
      39             :   /** This function determines all the ranks on which the macroscopic solver
      40             :    *holds data of the coupling cell at index idx. By default,
      41             :    *this method is used for send/recv operations. However, there are situations
      42             :    *where the target and source rank definitions (target rank=rank of
      43             :    *macroscopic solver that shall receive data from MD; source rank=rank of
      44             :    *macroscopic solver that shall send data to MD) may differ. For example,
      45             :    *assume a domain decomposition using ghost layers. You may want to send data
      46             :    *from cells inside a process-local domain and want to receive data in all
      47             :    *copies of a given coupling cell (incl. ghost cells), but you may not be
      48             :    *able to provide valid data on every process for each cell instance (e.g., if
      49             :    *this cell is part of a ghost layer). For this case, the method
      50             :    *getSourceRanks() and getTargetRanks() can be implemented accordingly.
      51             :    *    @param idx
      52             :    *    @return all the ranks on which the macroscopic solver holds data of the
      53             :    *coupling cell at index idx.
      54             :    */
      55             :   virtual std::vector<unsigned int> getRanks(I01 idx) = 0;
      56             : 
      57             :   /** This function determines the source ranks for the global coupling cell
      58             :    *at index idx. A "source rank" is defined as a rank of the
      59             :    *macroscopic solver that provides a valid copy of the cell at idx
      60             :    *to the coupling tool. You may have multiple source ranks; however, each
      61             :    *source rank should hold a valid copy. Default: return all ranks that the
      62             :    *cell at idx is associated to.
      63             :    *    @param idx
      64             :    *    @return the source ranks for the global coupling cell at index
      65             :    *idx.
      66             :    */
      67           0 :   virtual std::vector<unsigned int> getSourceRanks(I01 idx) { return getRanks(idx); }
      68             : 
      69             :   /** This function determines the target ranks for the global coupling cell
      70             :    *at index idx. A "target rank" is defined as a rank of the
      71             :    *macroscopic solver that obtains a valid copy of the cell at idx
      72             :    *from the coupling tool. You may have multiple target ranks. Default: return
      73             :    *all ranks that the cell at idx is associated to.
      74             :    *    @param idx
      75             :    *    @return the target ranks for the global coupling cell at index
      76             :    *idx
      77             :    */
      78           0 :   virtual std::vector<unsigned int> getTargetRanks(I01 idx) { return getRanks(idx); }
      79             : };
      80             : #endif // _MOLECULARDYNAMICS_COUPLING_INTERFACE_MACROSCOPICSOLVERINTERFACE_H_

Generated by: LCOV version 1.14