LCOV - code coverage report
Current view: top level - coupling/configurations - CouplingCellConfiguration.cpph (source / functions) Hit Total Coverage
Test: coverage.info Lines: 20 34 58.8 %
Date: 2025-06-25 11:26:37 Functions: 2 2 100.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             : #include "tarch/configuration/ParseConfiguration.h"
       6             : 
       7             : template <unsigned int dim> const std::string coupling::configurations::CouplingCellConfiguration<dim>::COUPLING_CELL_SIZE("cell-size");
       8             : 
       9             : template <unsigned int dim>
      10             : const std::string coupling::configurations::CouplingCellConfiguration<dim>::LINKED_CELLS_PER_COUPLING_CELL("linked-cells-per-coupling-cell");
      11             : 
      12             : template <unsigned int dim>
      13             : const std::string coupling::configurations::CouplingCellConfiguration<dim>::WRITE_EVERY_MICROSCOPIC_TIMESTEP("write-every-microscopic-timestep");
      14             : template <unsigned int dim> const std::string coupling::configurations::CouplingCellConfiguration<dim>::MICROSCOPIC_FILENAME("microscopic-filename");
      15             : 
      16             : template <unsigned int dim>
      17             : const std::string coupling::configurations::CouplingCellConfiguration<dim>::WRITE_EVERY_MACROSCOPIC_TIMESTEP("write-every-macroscopic-timestep");
      18             : template <unsigned int dim> const std::string coupling::configurations::CouplingCellConfiguration<dim>::MACROSCOPIC_FILENAME("macroscopic-filename");
      19             : 
      20           4 : template <unsigned int dim> void coupling::configurations::CouplingCellConfiguration<dim>::parseSubtag(tinyxml2::XMLElement* node) {
      21           4 :   tarch::la::Vector<dim, int> getCells(-1);
      22           4 :   int buffer = -1;
      23             : 
      24             :   // parse coupling cell size
      25           4 :   tarch::configuration::ParseConfiguration::readVectorMandatory<dim, double>(_couplingCellSize, node, COUPLING_CELL_SIZE);
      26          16 :   for (unsigned int d = 0; d < dim; d++) {
      27          12 :     if (_couplingCellSize[d] <= 0.0) {
      28           0 :       std::cout << "ERROR coupling::configurations::CouplingCellConfiguration: ";
      29           0 :       std::cout << "Coupling cell size " << d << " is smaller than or equal zero!" << std::endl;
      30           0 :       _isValid = false;
      31           0 :       exit(EXIT_FAILURE);
      32             :     }
      33             :   }
      34             : 
      35             :   // parse linked cells per coupling cell
      36           4 :   tarch::configuration::ParseConfiguration::readVectorMandatory<dim, int>(getCells, node, LINKED_CELLS_PER_COUPLING_CELL);
      37          16 :   for (unsigned int d = 0; d < dim; d++) {
      38          12 :     if (getCells[d] <= 0) {
      39           0 :       std::cout << "ERROR coupling::configurations::CouplingCellConfiguration: ";
      40           0 :       std::cout << LINKED_CELLS_PER_COUPLING_CELL << " is smaller or equal zero in component " << d << "!" << std::endl;
      41           0 :       _isValid = false;
      42           0 :       exit(EXIT_FAILURE);
      43             :     }
      44          12 :     _linkedCellsPerCouplingCell[d] = (unsigned int)getCells[d];
      45             :   }
      46             : 
      47             :   // parse write-every-microscopic-timestep
      48           4 :   tarch::configuration::ParseConfiguration::readIntMandatory(buffer, node, WRITE_EVERY_MICROSCOPIC_TIMESTEP);
      49           4 :   if (buffer < 0) {
      50           0 :     std::cout << WRITE_EVERY_MICROSCOPIC_TIMESTEP << " is smaller than zero: " << buffer << std::endl;
      51           0 :     _isValid = false;
      52           0 :     exit(EXIT_FAILURE);
      53             :   }
      54           4 :   _writeEveryMicroscopicTimestep = (unsigned int)(buffer);
      55             : 
      56             :   // parse microscopic file stem
      57           4 :   tarch::configuration::ParseConfiguration::readStringMandatory(_microscopicFilename, node, MICROSCOPIC_FILENAME);
      58             : 
      59             :   // parse write-every-macroscopic-timestep
      60           4 :   tarch::configuration::ParseConfiguration::readIntMandatory(buffer, node, WRITE_EVERY_MACROSCOPIC_TIMESTEP);
      61           4 :   if (buffer < 0) {
      62           0 :     std::cout << WRITE_EVERY_MACROSCOPIC_TIMESTEP << " is smaller than zero: " << buffer << std::endl;
      63           0 :     _isValid = false;
      64           0 :     exit(EXIT_FAILURE);
      65             :   }
      66           4 :   _writeEveryMacroscopicTimestep = (unsigned int)(buffer);
      67             : 
      68             :   // parse macroscopic file stem
      69           4 :   tarch::configuration::ParseConfiguration::readStringMandatory(_macroscopicFilename, node, MACROSCOPIC_FILENAME);
      70           4 : }
      71             : 
      72          28 : template <unsigned int dim> std::string coupling::configurations::CouplingCellConfiguration<dim>::getTag() const { return "coupling-cell-configuration"; }

Generated by: LCOV version 1.14