LCOV - code coverage report
Current view: top level - coupling/filtering/interfaces - JunctorInterface.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 8 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 <vector>
       7              : 
       8              : #define DEBUG_JUNCTOR_INTERFACE
       9              : 
      10              : namespace coupling {
      11              : namespace filtering {
      12              : template <unsigned int dim, std::size_t inputc, std::size_t outputc> class JunctorInterface;
      13              : }
      14              : } // namespace coupling
      15              : 
      16              : /**
      17              :  * Junctors are a generalization of Filters, in the sense that they can harbour
      18              :  * multi in- and/or outputs. This allows for filters needing multiple sets of
      19              :  * input data (e.g. unfiltered/prefiltered) or comparing read-only-filters.
      20              :  * //TODO: implement FilterJunctorReadOnly? Junctors are stored in
      21              :  * FilterJunctions, which generalize FilterSequences in a similar way. You can
      22              :  * currently not add Junctors dynamically via FFF.
      23              :  *
      24              :  * Implemenents FI. The underlying FI has the junctor's main partition's (i.e
      25              :  * [0] of the corresponding std::array) input/output data. (cf. lines 35, 67.)
      26              :  * @author Felix Maurer
      27              :  */
      28              : template <unsigned int dim, std::size_t inputc, std::size_t outputc>
      29              : class coupling::filtering::JunctorInterface : public coupling::filtering::FilterInterface<dim> {
      30              : public:
      31            0 :   JunctorInterface(const std::array<std::vector<coupling::datastructures::CouplingCell<dim>*>, inputc> inputCellVectors,
      32              :                    const std::array<std::vector<coupling::datastructures::CouplingCell<dim>*>, outputc> outputCellVectors,
      33              :                    const std::array<bool, 7> filteredValues, const char* type)
      34              :       : // This assumes the array of cell vectors to be nonempty. Suboptimal.
      35              :         // NOTE: Avoid using FI's cell vectors. Use
      36              :         // _inputCellVectors/_outputCellVectors instead.
      37            0 :         coupling::filtering::FilterInterface<dim>(inputCellVectors[0], outputCellVectors[0], filteredValues, type), _inputCellVectors(inputCellVectors),
      38            0 :         _outputCellVectors(outputCellVectors) {
      39              : #ifdef DEBUG_JUNCTOR_INTERFACE
      40              :     // check input partition sizes
      41            0 :     for (unsigned int i = 0; i < inputc; i++)
      42            0 :       std::cout << "                 FJ: Size of input cell vector at index " << i << ": " << inputCellVectors[i].size() << std::endl;
      43            0 :     for (unsigned int i = 0; i < outputc; i++)
      44            0 :       std::cout << "                 FJ: Size of output cell vector at index " << i << ": " << outputCellVectors[i].size() << std::endl;
      45              : 
      46              : #endif
      47            0 :   }
      48              : 
      49              :   void updateCellData(std::vector<coupling::datastructures::CouplingCell<dim>*> new_inputCellVectors[inputc],
      50              :                       std::vector<coupling::datastructures::CouplingCell<dim>*> new_outputCellVectors[outputc],
      51              :                       std::vector<tarch::la::Vector<dim, unsigned int>>& new_cellIndices) {
      52              :     std::cout << "           JI: Updating cell data." << std::endl;
      53              :     _inputCellVectors = new_inputCellVectors;
      54              :     _outputCellVectors = new_outputCellVectors;
      55              : 
      56              :     // Assumes the input c-style vectors to be nonempty. May be problematic.
      57              :     coupling::filtering::FilterInterface<dim>::updateCellData(new_inputCellVectors[0], new_outputCellVectors[0]);
      58              :   }
      59              : 
      60              : protected:
      61              :   /**
      62              :    * Unlike regular filters, junctors allow for multiple input- and output-sets
      63              :    */
      64              :   std::array<std::vector<coupling::datastructures::CouplingCell<dim>*>, inputc> _inputCellVectors;
      65              :   std::array<std::vector<coupling::datastructures::CouplingCell<dim>*>, outputc> _outputCellVectors;
      66              : };
        

Generated by: LCOV version 2.0-1