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_FILTER_JUNCTION_ASYM 8 : 9 : #include "coupling/filtering/sequencing/FilterSequence.h" 10 : 11 : // INCLUDE ALL RELEVANT JUNCTOR HEADERS HERE 12 : #include "coupling/filtering/filters/WriteToFileJunctor.h" 13 : 14 : /* 15 : * Filtering junction which does not use multiple identical input domains, but 16 : * rather uses one primary input partition to filter on while having access to a 17 : * secondary input data set. As no filtering is conducted on that secondary 18 : * input cell data set, it may be of any shape or size. The primary input 19 : * partition has to follow the restrictions to input data sets of 20 : * FilterSequences and FilterJunctions. 21 : * 22 : * @author Felix Maurer 23 : */ 24 : 25 : namespace coupling { 26 : namespace filtering { 27 : template <unsigned int dim> class AsymmetricalFilterJunction; 28 : } 29 : } // namespace coupling 30 : 31 : template <unsigned int dim> class coupling::filtering::AsymmetricalFilterJunction : public coupling::filtering::FilterSequence<dim> { 32 : public: 33 0 : AsymmetricalFilterJunction(const char* name, 34 : const std::vector<coupling::datastructures::CouplingCell<dim>*> primaryInputCellVector, // primary input of sequence. 35 : const std::vector<coupling::datastructures::CouplingCell<dim>*> secondaryInputCellVector, // additional data, presented as 36 : // macro cells as well 37 : #if (COUPLING_MD_PARALLEL == COUPLING_MD_YES) 38 : MPI_Comm comm, 39 : #endif 40 : std::array<bool, 7> filteredValues) 41 : : coupling::filtering::FilterSequence<dim>(name, primaryInputCellVector, 42 : #if (COUPLING_MD_PARALLEL == COUPLING_MD_YES) 43 : comm, 44 : #endif 45 : filteredValues), 46 0 : _inputCellVector_secondary(secondaryInputCellVector) { 47 : #ifdef DEBUG_FILTER_JUNCTION_ASYM 48 0 : std::cout << PRINT_PREFIX() << "Begin initialization." << std::endl; 49 : #endif 50 : 51 : // allocate and init secondary cell vectors 52 0 : for (auto cell : _inputCellVector_secondary) { 53 0 : _cellVector1_secondary.push_back(new coupling::datastructures::CouplingCell<dim>(*cell)); 54 0 : _cellVector2_secondary.push_back(new coupling::datastructures::CouplingCell<dim>(*cell)); 55 : } 56 : #ifdef DEBUG_FILTER_JUNCTION_ASYM 57 0 : std::cout << PRINT_PREFIX() << "Initialized secondary cell vectors." << std::endl; 58 0 : std::cout << PRINT_PREFIX() << "First element of _cellVector1_secondary after init: " << _cellVector1_secondary[0] << std::endl; 59 0 : std::cout << PRINT_PREFIX() << "First element of _cellVector2_secondary after init: " << _cellVector2_secondary[0] << std::endl; 60 : #endif 61 : 62 0 : coupling::filtering::FilterSequence<dim>::_isModifiable = false; // Dynamic filters are not yet supported. TODO 63 0 : } 64 : 65 0 : ~AsymmetricalFilterJunction() { 66 0 : for (auto secondarycell : _cellVector1_secondary) 67 0 : delete secondarycell; 68 0 : for (auto secondarycell : _cellVector2_secondary) 69 0 : delete secondarycell; 70 0 : } 71 : 72 : /* 73 : * This function is very similar to the interface's. Check 74 : * coupling::FilterSequence for more details. 75 : */ 76 : int loadFiltersFromXML(tinyxml2::XMLElement* sequenceNode) override; 77 : 78 0 : void printFilters() override { 79 0 : std::cout << "Junctors in asymmetrical junction " << coupling::filtering::FilterSequence<dim>::_name << ": "; 80 0 : for (auto f : coupling::filtering::FilterSequence<dim>::_filters) 81 0 : std::cout << f->getType() << " "; 82 0 : std::cout << std::endl; 83 0 : } 84 : 85 0 : std::string PRINT_PREFIX() const override { 86 0 : return std::string(" AFJ(").std::string::append(coupling::filtering::FilterSequence<dim>::_name).std::string::append("): "); 87 : } 88 : 89 : private: 90 : std::vector<coupling::datastructures::CouplingCell<dim>*> _inputCellVector_secondary; 91 : 92 : std::vector<coupling::datastructures::CouplingCell<dim>*> _cellVector1_secondary; 93 : std::vector<coupling::datastructures::CouplingCell<dim>*> _cellVector2_secondary; 94 : }; 95 : 96 : // inlcude implementation 97 : #include "coupling/filtering/sequencing/AsymmetricalFilterJunction.cpph"