MaMiCo 1.2
Loading...
Searching...
No Matches
AsymmetricalFilterJunction.h
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
25namespace coupling {
26namespace filtering {
27template <unsigned int dim> class AsymmetricalFilterJunction;
28}
29} // namespace coupling
30
32public:
33 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 _inputCellVector_secondary(secondaryInputCellVector) {
47#ifdef DEBUG_FILTER_JUNCTION_ASYM
48 std::cout << PRINT_PREFIX() << "Begin initialization." << std::endl;
49#endif
50
51 // allocate and init secondary cell vectors
52 for (auto cell : _inputCellVector_secondary) {
53 _cellVector1_secondary.push_back(new coupling::datastructures::CouplingCell<dim>(*cell));
54 _cellVector2_secondary.push_back(new coupling::datastructures::CouplingCell<dim>(*cell));
55 }
56#ifdef DEBUG_FILTER_JUNCTION_ASYM
57 std::cout << PRINT_PREFIX() << "Initialized secondary cell vectors." << std::endl;
58 std::cout << PRINT_PREFIX() << "First element of _cellVector1_secondary after init: " << _cellVector1_secondary[0] << std::endl;
59 std::cout << PRINT_PREFIX() << "First element of _cellVector2_secondary after init: " << _cellVector2_secondary[0] << std::endl;
60#endif
61
62 coupling::filtering::FilterSequence<dim>::_isModifiable = false; // Dynamic filters are not yet supported. TODO
63 }
64
65 ~AsymmetricalFilterJunction() {
66 for (auto secondarycell : _cellVector1_secondary)
67 delete secondarycell;
68 for (auto secondarycell : _cellVector2_secondary)
69 delete secondarycell;
70 }
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 void printFilters() override {
79 std::cout << "Junctors in asymmetrical junction " << coupling::filtering::FilterSequence<dim>::_name << ": ";
80 for (auto f : coupling::filtering::FilterSequence<dim>::_filters)
81 std::cout << f->getType() << " ";
82 std::cout << std::endl;
83 }
84
85 std::string PRINT_PREFIX() const override {
86 return std::string(" AFJ(").std::string::append(coupling::filtering::FilterSequence<dim>::_name).std::string::append("): ");
87 }
88
89private:
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"
defines the cell type with cell-averaged quantities only (no linked cells).
Definition CouplingCell.h:29
Definition AsymmetricalFilterJunction.h:31
Definition FilterSequence.h:51
Definition tinyxml2.h:1268
Definition FilterPipeline.h:21
everything necessary for coupling operations, is defined in here
Definition AdditiveMomentumInsertion.h:15