LCOV - code coverage report
Current view: top level - coupling/filtering/interfaces - FilterInterfaceReadOnly.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 12 0
Test Date: 2026-08-21 15:14:06 Functions: 0.0 % 1 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 "FilterInterface.h"
       7              : 
       8              : namespace coupling {
       9              : namespace filtering {
      10              : template <unsigned int dim> class FilterInterfaceReadOnly;
      11              : }
      12              : } // namespace coupling
      13              : 
      14              : /*
      15              :  * Extension of FilterInterface.h for cases in which the filter itself does not
      16              :  * produce any output data. For such filters, you want to make use of
      17              :  * copyInputToOutput() (see below) in every filter step.
      18              :  *
      19              :  * @author Felix Maurer
      20              :  */
      21              : 
      22            0 : template <unsigned int dim> class coupling::filtering::FilterInterfaceReadOnly : public coupling::filtering::FilterInterface<dim> {
      23              : public:
      24            0 :   FilterInterfaceReadOnly(const std::vector<coupling::datastructures::CouplingCell<dim>*>& inputCellVector,
      25              :                           const std::vector<coupling::datastructures::CouplingCell<dim>*>& outputCellVector, const std::array<bool, 7> filteredValues,
      26              :                           const char* type)
      27            0 :       : coupling::filtering::FilterInterface<dim>(inputCellVector, outputCellVector, filteredValues, type) {}
      28              : 
      29              : protected:
      30              :   /*
      31              :    * Copies all filtered data from input to output. You always want to call this
      32              :    * as part of any implementation of coupling::FilterInterface<dim>::operator()
      33              :    *    when implementing this interface, that is implementing a read-only
      34              :    * filter (e.g WriteToFile, Storuhal) If you would not do that, the successors
      35              :    * of the implementing filter in a sequence would get faulty input data.
      36              :    */
      37            0 :   void copyInputToOutput() {
      38              :     /*
      39              :      * In certain cases, e.g. read-only filters that operate on secondary cells
      40              :      * of an AsymmetricalFilterJunction, we don't want the filter to produce any
      41              :      * output. Then, and only then, the output cells vector will be empty.
      42              :      */
      43            0 :     if (coupling::filtering::FilterInterface<dim>::_outputCells.empty())
      44              :       return;
      45              : 
      46            0 :     for (unsigned int ci = 0; ci < coupling::filtering::FilterInterface<dim>::_outputCells.size(); ci++) {
      47            0 :       for (const auto scalarProperty : coupling::filtering::FilterInterface<dim>::_scalarAccessFunctionPairs) {
      48            0 :         (coupling::filtering::FilterInterface<dim>::_outputCells[ci]->*scalarProperty.set)(
      49            0 :             (coupling::filtering::FilterInterface<dim>::_inputCells[ci]->*scalarProperty.get)()); // call setter from output cell
      50              :                                                                                                   // using getter from input cell.
      51              :       }
      52            0 :       for (const auto vectorProperty : coupling::filtering::FilterInterface<dim>::_vectorAccessFunctionPairs) {
      53            0 :         (coupling::filtering::FilterInterface<dim>::_outputCells[ci]->*vectorProperty.set)(
      54            0 :             (coupling::filtering::FilterInterface<dim>::_inputCells[ci]->*vectorProperty.get)()); // call setter from output cell
      55              :                                                                                                   // using getter from input cell.
      56              :       }
      57              :     }
      58              :   }
      59              : };
        

Generated by: LCOV version 2.0-1