LCOV - code coverage report
Current view: top level - coupling/filtering/filters - ReadFromFile.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 5 0.0 %
Date: 2025-06-25 11:26:37 Functions: 0 3 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             : #pragma once
       6             : #include "coupling/filtering/interfaces/FilterInterface.h"
       7             : 
       8             : #include <fstream>
       9             : #include <string>
      10             : #include <vector>
      11             : 
      12             : // #define DEBUG_READ_FROM_FILE
      13             : 
      14             : namespace coupling {
      15             : namespace filtering {
      16             : template <unsigned int dim> class ReadFromFile;
      17             : }
      18             : } // namespace coupling
      19             : 
      20             : /*
      21             :  * Filter that reads cell data from a specified file in .csv format and then
      22             :  * writes that data to its output cells.
      23             :  *
      24             :  * Input format must be compliant to the usual MaMiCo CSV format (using ';' as
      25             :  * separator). The following order is assumed:
      26             :  * - current iteration
      27             :  * - scalar cell properties
      28             :  * - vector cell properties
      29             :  *
      30             :  * The input file must contain one separate line per cell.
      31             :  *
      32             :  * @Author Felix Maurer
      33             :  */
      34             : template <unsigned int dim> class coupling::filtering::ReadFromFile : public coupling::filtering::FilterInterface<dim> {
      35             : public:
      36           0 :   ReadFromFile(const std::vector<coupling::datastructures::CouplingCell<dim>*>& inputCellVector,
      37             :                const std::vector<coupling::datastructures::CouplingCell<dim>*>& outputCellVector, const std::array<bool, 7> filteredValues,
      38             :                std::string location)
      39           0 :       : coupling::filtering::FilterInterface<dim>(inputCellVector, outputCellVector, filteredValues, "RFF"), _location(location), _iteration(0) {
      40             : #ifdef DEBUG_READ_FROM_FILE
      41             :     std::cout << "           RFF: Read from file instance created. Will read from: " << _location << "." << std::endl;
      42             : #endif
      43           0 :   }
      44             : 
      45           0 :   ~ReadFromFile() {
      46             : #ifdef DEBUG_READ_FROM_FILE
      47             :     std::cout << "           RFF: Read from file instance deconstructed." << std::endl;
      48             : #endif
      49           0 :   }
      50             : 
      51             :   void operator()();
      52             : 
      53             : private:
      54             :   std::string _location;
      55             :   unsigned int _iteration;
      56             : 
      57             :   std::ifstream _file;
      58             : };
      59             : 
      60             : // include implementation of header
      61             : #include "ReadFromFile.cpph"

Generated by: LCOV version 1.14