LCOV - code coverage report
Current view: top level - simplemd/configurations - DomainConfiguration.h Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-08-21 15:14:06 Functions: - 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_CONFIGURATIONS_DOMAINCONFIGURATION_H_
       6              : #define _MOLECULARDYNAMICS_CONFIGURATIONS_DOMAINCONFIGURATION_H_
       7              : 
       8              : #include "simplemd/MolecularDynamicsDefinitions.h"
       9              : #include "tarch/configuration/Configuration.h"
      10              : #include "tarch/la/Vector.h"
      11              : #include <fstream>
      12              : #include <iostream>
      13              : 
      14              : namespace simplemd {
      15              : namespace configurations {
      16              : class DomainConfiguration;
      17              : }
      18              : } // namespace simplemd
      19              : 
      20              : /** configuration input for domain description, including domain offset, domain
      21              :  * size, boundary types etc.
      22              :  *  @author Philipp Neumann
      23              :  */
      24              : class simplemd::configurations::DomainConfiguration : public tarch::configuration::Configuration {
      25              : public:
      26              :   DomainConfiguration();
      27          408 :   virtual ~DomainConfiguration() {}
      28              : 
      29              :   void parseSubtag(tinyxml2::XMLElement* node);
      30              : 
      31              :   /**
      32              :    * Return name of xml tag that is associated to the configuration.
      33              :    */
      34              :   std::string getTag() const;
      35              : 
      36              :   /**
      37              :    * Is config valid?
      38              :    *
      39              :    * This operation usually fails, if
      40              :    *
      41              :    * - parseSubtag() hasn't been called, i.e. configuration has not been
      42              :    *   used, or
      43              :    * - parseSubtag() failed due to a wrong file.
      44              :    *
      45              :    * If a tag ain't optional and parseSubtag() was not called (first case)
      46              :    */
      47              :   bool isValid() const;
      48              : 
      49              :   /** getters for all parsed and computed quantities */
      50              :   const tarch::la::Vector<MD_DIM, unsigned int>& getMoleculesPerDirection() const { return _moleculesPerDirection; }
      51              :   const tarch::la::Vector<MD_DIM, double>& getGlobalDomainSize() const { return _domainSize; }
      52              :   const tarch::la::Vector<MD_DIM, double>& getGlobalDomainOffset() const { return _domainOffset; }
      53              :   const double& getCutoffRadius() const { return _cutoffRadius; }
      54              :   const tarch::la::Vector<MD_DIM, double>& getMeshWidth() const { return _meshWidth; }
      55              :   const double& getKB() const { return _kB; }
      56              :   const double& getCapacityFactor() const { return _capacityFactor; }
      57              :   const unsigned int& getBlockSize() const { return _blockSize; }
      58              :   const tarch::la::Vector<MD_LINKED_CELL_NEIGHBOURS, simplemd::BoundaryType>& getBoundary() const { return _boundary; }
      59              :   const std::string& getCheckpointFilestem() const { return _checkpointFilestem; }
      60              :   const bool& initFromCheckpoint() const { return _initFromCheckpoint; }
      61              :   const bool& initFromSequentialCheckpoint() const { return _initFromSequentialCheckpoint; }
      62              : 
      63              :   void setCheckpointFilestem(const std::string& filestem) { _checkpointFilestem = filestem; }
      64              :   void setInitFromCheckpoint(const bool& initFromCheckpoint) { _initFromCheckpoint = initFromCheckpoint; }
      65              :   void setInitFromSequentialCheckpoint(const bool& initFromSequentialCheckpoint) { _initFromSequentialCheckpoint = initFromSequentialCheckpoint; }
      66              : 
      67              :   unsigned int getNumberOfMolecules() const;
      68              : 
      69              : private:
      70              :   static const std::string MOLECULES_PER_DIRECTION;
      71              :   static const std::string DOMAIN_SIZE;
      72              :   static const std::string DOMAIN_OFFSET;
      73              :   static const std::string CUTOFF_RADIUS;
      74              :   static const std::string LINKED_CELL_SIZE;
      75              :   static const std::string K_B;
      76              :   static const std::string CAPACITY_FACTOR;
      77              :   static const std::string BLOCK_SIZE;
      78              :   static const std::string BOUNDARY[MD_LINKED_CELL_NEIGHBOURS];
      79              :   static const std::string PERIODIC_BOUNDARY;
      80              :   static const std::string GEOMETRY_BOUNDARY;
      81              :   static const std::string OPEN_BOUNDARY;
      82              :   static const std::string REFLECTING_BOUNDARY;
      83              :   static const std::string RDF_FILENAME;
      84              :   static const std::string CELLS_PER_LINKED_CELL;
      85              :   static const std::string INIT_FROM_CHECKPOINT;
      86              :   static const std::string INIT_FROM_SEQUENTIAL_CHECKPOINT;
      87              :   static const std::string LINKED_CELLS_PER_NUMBER_DENSITY_EVALUATION;
      88              : 
      89              :   /** number of molecules in each direction */
      90              :   tarch::la::Vector<MD_DIM, unsigned int> _moleculesPerDirection;
      91              : 
      92              :   /** global domain size */
      93              :   tarch::la::Vector<MD_DIM, double> _domainSize;
      94              : 
      95              :   /** global domain offset */
      96              :   tarch::la::Vector<MD_DIM, double> _domainOffset;
      97              : 
      98              :   /** cut off radius for lennard jones potential. Determines the meshsize in the
      99              :    * simulation. */
     100              :   double _cutoffRadius;
     101              : 
     102              :   /** size of linked cells. If not handed over in the config, this parameter
     103              :    * will be determined automatically */
     104              :   tarch::la::Vector<MD_DIM, double> _meshWidth;
     105              : 
     106              :   /** dimensionless Boltzmann's constant */
     107              :   double _kB;
     108              : 
     109              :   /** capacity factor, used to compute the maximum number of molecules that can be present in a linked cell by multiplication with the average number of
     110              :    * molecules per cell*/
     111              :   double _capacityFactor;
     112              : 
     113              :   /** blocksize to be used for molecule storage */
     114              :   unsigned int _blockSize;
     115              : 
     116              :   /** boundary types for all outer boundaries */
     117              :   tarch::la::Vector<MD_LINKED_CELL_NEIGHBOURS, simplemd::BoundaryType> _boundary;
     118              : 
     119              :   std::string _checkpointFilestem;
     120              :   bool _initFromCheckpoint;
     121              :   bool _initFromSequentialCheckpoint;
     122              : 
     123              :   /** isValid flag */
     124              :   bool _isValid;
     125              : };
     126              : #endif // _MOLECULARDYNAMICS_CONFIGURATIONS_DOMAINCONFIGURATION_H_
        

Generated by: LCOV version 2.0-1