LCOV - code coverage report
Current view: top level - coupling/configurations - CouplingCellConfiguration.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 14 14
Test Date: 2026-08-21 15:14:06 Functions: 75.0 % 4 3

            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_CONFIGURATIONS_COUPLINGCELLCONFIGURATION_H_
       6              : #define _MOLECULARDYNAMICS_COUPLING_CONFIGURATIONS_COUPLINGCELLCONFIGURATION_H_
       7              : 
       8              : #include "tarch/configuration/Configuration.h"
       9              : #include "tarch/la/Vector.h"
      10              : #include <iostream>
      11              : 
      12              : namespace coupling {
      13              : namespace configurations {
      14              : template <unsigned int dim> class CouplingCellConfiguration;
      15              : }
      16              : } // namespace coupling
      17              : 
      18              : /** configuration for output of coupling cell data to vtk files. Derive from
      19              :  *the class tarch::configuration::Configuration
      20              :  *      @brief configuration for output of coupling cell data to vtk files.
      21              :  *      @tparam dim Number of dimensions; it can be 1, 2 or 3
      22              :  *  @author Philipp Neumann
      23              :  */
      24              : template <unsigned int dim> class coupling::configurations::CouplingCellConfiguration : public tarch::configuration::Configuration {
      25              : public:
      26              :   /** Constructor, initializes the class  */
      27          408 :   CouplingCellConfiguration()
      28         1224 :       : _isValid(true), _couplingCellSize(0.0), _linkedCellsPerCouplingCell(0), _writeEveryMicroscopicTimestep(0), _microscopicFilename(""),
      29          816 :         _writeEveryMacroscopicTimestep(0), _macroscopicFilename("") {}
      30              : 
      31              :   /** Destructor */
      32          412 :   ~CouplingCellConfiguration() {}
      33              : 
      34              :   /** parseSubtag
      35              :    *    @param node
      36              :    */
      37              :   void parseSubtag(tinyxml2::XMLElement* node);
      38              : 
      39              :   /** Returns name of xml tag that is associated to the configuration.
      40              :    *    @return name of xml tag that is associated to the configuration
      41              :    */
      42              :   std::string getTag() const;
      43              : 
      44              :   /** checks if the configuration is valid. This operation usually fails, if
      45              :    *e.g.
      46              :    *    1. parseSubtag() hasn't been called, i.e. configuration has not been
      47              :    *used, or
      48              :    *  2. parseSubtag() failed due to a wrong file.
      49              :    *    @return _isValid
      50              :    */
      51            4 :   bool isValid() const { return _isValid; }
      52              : 
      53              :   /** Returns the coupling cell size
      54              :    *    @return _couplingCellSize
      55              :    */
      56              :   tarch::la::Vector<dim, double> getCouplingCellSize() const { return _couplingCellSize; }
      57              : 
      58              :   /** Returns the number of linked cell encapsulated within a coupling cell
      59              :    *    @return _linkedCellsPerCouplingCell
      60              :    */
      61           16 :   tarch::la::Vector<dim, unsigned int> getNumberLinkedCellsPerCouplingCell() const { return _linkedCellsPerCouplingCell; }
      62              : 
      63              :   /** Returns step interval, at which the micro infos is to be written out
      64              :    *    @return _writeEveryMicroscopicTimestep
      65              :    */
      66            4 :   unsigned int getWriteEveryMicroscopicTimestep() const { return _writeEveryMicroscopicTimestep; }
      67              :   /** Returns the microscopic file name
      68              :    *    @return _microscopicFilename
      69              :    */
      70            8 :   std::string getMicroscopicFilename() const { return _microscopicFilename; }
      71              : 
      72              :   /** Returns step interval, at which the macro infos is to be written out
      73              :    *    @return _writeEveryMacroscopicTimestep
      74              :    */
      75            4 :   unsigned int getWriteEveryMacroscopicTimestep() const { return _writeEveryMacroscopicTimestep; }
      76              :   /** Returns the macroscopic file name
      77              :    *    @return _maroscopicFilename
      78              :    */
      79            8 :   std::string getMacroscopicFilename() const { return _macroscopicFilename; }
      80              : 
      81              : protected:
      82            4 :   CouplingCellConfiguration(tarch::la::Vector<dim, double> couplingCellSize, tarch::la::Vector<dim, unsigned int> linkedCellsPerCouplingCell,
      83              :                             unsigned int writeEveryMicroscopicTimestep, std::string microscopicFilename, unsigned int writeEveryMacroscopicTimestep,
      84              :                             std::string macroscopicFilename)
      85            8 :       : _isValid(true), _couplingCellSize(couplingCellSize), _linkedCellsPerCouplingCell(linkedCellsPerCouplingCell),
      86            4 :         _writeEveryMicroscopicTimestep(writeEveryMicroscopicTimestep), _microscopicFilename(microscopicFilename),
      87           12 :         _writeEveryMacroscopicTimestep(writeEveryMacroscopicTimestep), _macroscopicFilename(macroscopicFilename) {}
      88              : 
      89              : private:
      90              :   static const std::string COUPLING_CELL_SIZE;
      91              :   static const std::string LINKED_CELLS_PER_COUPLING_CELL;
      92              :   static const std::string WRITE_EVERY_MICROSCOPIC_TIMESTEP;
      93              :   static const std::string WRITE_EVERY_MACROSCOPIC_TIMESTEP;
      94              :   static const std::string MICROSCOPIC_FILENAME;
      95              :   static const std::string MACROSCOPIC_FILENAME;
      96              : 
      97              :   bool _isValid;
      98              :   tarch::la::Vector<dim, double> _couplingCellSize;
      99              :   tarch::la::Vector<dim, unsigned int> _linkedCellsPerCouplingCell;
     100              :   unsigned int _writeEveryMicroscopicTimestep;
     101              :   std::string _microscopicFilename;
     102              :   unsigned int _writeEveryMacroscopicTimestep;
     103              :   std::string _macroscopicFilename;
     104              : };
     105              : #include "coupling/configurations/CouplingCellConfiguration.cpph"
     106              : 
     107              : #endif // _MOLECULARDYNAMICS_COUPLING_CONFIGURATIONS_COUPLINGCELLCONFIGURATION_H_
        

Generated by: LCOV version 2.0-1