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 : 7 : #define DEBUG_ASYM_JUNCTOR_INTERFACE 8 : 9 : #include "coupling/filtering/interfaces/FilterInterface.h" 10 : 11 : namespace coupling { 12 : namespace filtering { 13 : template <unsigned int dim> class AsymmetricalJunctorInterface; 14 : } 15 : } // namespace coupling 16 : 17 : /** 18 : * Interface for Junctors in Asymmetrical Filter Junctions. 19 : * Cf. filtering/sequencing/AsymmetricalFilterJunction.h 20 : * 21 : * Implemenents FI. The underlying FI has the junctor's first cell data set. 22 : * @author Felix Maurer 23 : */ 24 : template <unsigned int dim> class coupling::filtering::AsymmetricalJunctorInterface : public coupling::filtering::FilterInterface<dim> { 25 : public: 26 0 : AsymmetricalJunctorInterface( 27 : // first cell data set 28 : const std::vector<coupling::datastructures::CouplingCell<dim>*> inputCellVector1, 29 : const std::vector<coupling::datastructures::CouplingCell<dim>*> outputCellVector1, 30 : 31 : // first cell data set 32 : const std::vector<coupling::datastructures::CouplingCell<dim>*> inputCellVector2, 33 : // no output 34 : 35 : // parameters not specific to either 1 or 2 36 : const std::array<bool, 7> filteredValues, const char* type) 37 : : // The first cell data set in stored in FI's member variables... 38 : coupling::filtering::FilterInterface<dim>(inputCellVector1, outputCellVector1, filteredValues, type), 39 : //...while the second cell data set is stored within this class 40 0 : _inputCellVector2(inputCellVector2) {} 41 : 42 0 : virtual void operator()() { 43 0 : (*_filter1)(); 44 0 : (*_filter2)(); 45 0 : } 46 : 47 0 : ~AsymmetricalJunctorInterface() { 48 : // TODO: check for corrupt/memory leaks here 49 0 : delete _filter1; 50 0 : delete _filter2; 51 0 : }; 52 : 53 : // TODO: make FI's updateCellData function unusable 54 : void updateCellData(std::vector<coupling::datastructures::CouplingCell<dim>*>& new_inputCellVector1, 55 : std::vector<coupling::datastructures::CouplingCell<dim>*>& new_outputCellVector1, 56 : std::vector<coupling::datastructures::CouplingCell<dim>*>& new_inputCellVector2) { 57 : std::cout << " AJI: Updating cell data." << std::endl; 58 : _inputCellVector2 = new_inputCellVector2; 59 : 60 : // Assumes the input c-style vectors to be nonempty. May be problematic. 61 : coupling::filtering::FilterInterface<dim>::updateCellData(new_inputCellVector1, new_outputCellVector1); 62 : } 63 : 64 : protected: 65 : /** 66 : * The first data set is stored in FilterInstance, the second one in here. 67 : * Note that the second set contains no output vector. Confer interface 68 : * comment above. 69 : */ 70 : std::vector<coupling::datastructures::CouplingCell<dim>*> _inputCellVector2; 71 : 72 : /* 73 : * The first cell data set should be fed to _filter1 and the second one to 74 : * _filter2. Note that you have to do this manually in your implementation of 75 : * this interface. For an example, cf. filters/WriteToFileJunctor.h 76 : */ 77 : coupling::filtering::FilterInterface<dim>* _filter1; 78 : coupling::filtering::FilterInterface<dim>* _filter2; 79 : };