LCOV - code coverage report
Current view: top level - coupling/filtering/filters - WriteToFile.cpph (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 20 0.0 %
Date: 2025-06-25 11:26:37 Functions: 0 1 0.0 %

          Line data    Source code
       1             : // This file is part of the Mamico project. For conditions of distribution
       2             : // and use, please see the copyright notice in Mamico's main folder, or at
       3             : // www5.in.tum.de/mamico
       4             : 
       5             : /** Implementation of WriteToFile.h
       6             :  *  @author Felix Maurer
       7             :  */
       8             : 
       9             : // Member functions of WriteToFile.h:
      10           0 : template <unsigned int dim> void coupling::filtering::WriteToFile<dim>::operator()() {
      11             : #ifdef DEBUG_WRITE_TO_FILE
      12             :   std::cout << "             WTF: Now writing data to: " << _location;
      13             : #endif
      14             : 
      15           0 :   if (!_overwrite)
      16           0 :     _file.open(_location, std::ios_base::app);
      17             :   else {
      18           0 :     _file.open(_location);
      19             :   }
      20             : 
      21           0 :   for (unsigned int ic_index = 0; ic_index < coupling::filtering::FilterInterface<dim>::_inputCells.size(); ic_index++) {
      22             :     // case: only one cell
      23           0 :     if (_oneCellOnly != -1)
      24           0 :       ic_index = (unsigned int)_oneCellOnly;
      25             : 
      26           0 :     _file << _iteration << " ; ";
      27             : 
      28             :     // printing all scalar values
      29           0 :     for (const auto scalarProperty : coupling::filtering::FilterInterface<dim>::_scalarAccessFunctionPairs)
      30           0 :       _file << (coupling::filtering::FilterInterface<dim>::_inputCells[ic_index]->*scalarProperty.get)() << " ; ";
      31             : 
      32             :     // printing all vectorized values
      33           0 :     for (const auto vectorProperty : coupling::filtering::FilterInterface<dim>::_vectorAccessFunctionPairs)
      34           0 :       for (unsigned int d = 0; d < dim; d++)
      35           0 :         _file << (coupling::filtering::FilterInterface<dim>::_inputCells[ic_index]->*vectorProperty.get)()[d] << " ; ";
      36             : 
      37             :     // case: only one cell
      38           0 :     if (_oneCellOnly != -1)
      39             :       break;
      40             :     else
      41           0 :       _file << std::endl; // spatial distinction between iteration in output
      42             :                           // file. Unneccesary if OCO.
      43             :   }
      44             : 
      45           0 :   _file << std::endl;
      46           0 :   _file.close();
      47             : 
      48           0 :   coupling::filtering::FilterInterfaceReadOnly<dim>::copyInputToOutput();
      49             : 
      50           0 :   _iteration++;
      51             : #ifdef DEBUG_WRITE_TO_FILE
      52             :   std::cout << " ... done" << std::endl;
      53             : #endif
      54           0 : }

Generated by: LCOV version 1.14