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
3 :
4 : #pragma once
5 :
6 : #define DEBUG_WTF_JUNCTION
7 :
8 : #include "coupling/filtering/filters/WriteToFile.h"
9 : #include "coupling/filtering/interfaces/AsymmetricalJunctorInterface.h"
10 :
11 : namespace coupling {
12 : namespace filtering {
13 : template <unsigned int dim> class WriteToFileJunctor;
14 : }
15 : } // namespace coupling
16 :
17 : /**
18 : * Combines two WriteToFile objects into one asymmetrical FilterJunctor.
19 : * Used to output both primary and secondary cell data in an
20 : * AsymmetricalFilterJunction.
21 : *
22 : * @author Felix Maurer
23 : */
24 : template <unsigned int dim> class coupling::filtering::WriteToFileJunctor : public coupling::filtering::AsymmetricalJunctorInterface<dim> {
25 : public:
26 0 : WriteToFileJunctor(
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 : // second cell data set
32 : const std::vector<coupling::datastructures::CouplingCell<dim>*> inputCellVector2,
33 : // no secondary output cells
34 :
35 : //"global" parameters for both WriteToFile instances
36 : const std::array<bool, 7> filteredValues,
37 :
38 : // WriteToFile-specific parameters. [0] is for the first WriteToFile
39 : // instance and [1] for the second one respectively.
40 : std::array<std::string, 2> location, std::array<bool, 2> overwrite = {false}, std::array<int, 2> oneCellOnly = {-1})
41 0 : : coupling::filtering::AsymmetricalJunctorInterface<dim>(inputCellVector1, outputCellVector1, inputCellVector2, filteredValues, "WTF-J") {
42 : // write to file instance covering first cell data set
43 0 : coupling::filtering::AsymmetricalJunctorInterface<dim>::_filter1 =
44 0 : new coupling::filtering::WriteToFile<dim>(inputCellVector1, outputCellVector1, filteredValues, location[0], overwrite[0], oneCellOnly[0]);
45 :
46 : // write to file instance covering second cell data set
47 0 : coupling::filtering::AsymmetricalJunctorInterface<dim>::_filter2 =
48 0 : new coupling::filtering::WriteToFile<dim>(inputCellVector2, {}, // no output
49 : filteredValues, location[1], overwrite[1], oneCellOnly[1]);
50 0 : }
51 :
52 0 : ~WriteToFileJunctor() {
53 : #ifdef DEBUG_WTF_JUNCTION
54 0 : std::cout << " WTF-J: Destroyed WriteToFileJunctor instance." << std::endl;
55 : #endif
56 0 : }
57 : };
|