MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
postprocessingcontroller.h
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#ifndef POSTPROCESSINGCONTROLLER_H_
8#define POSTPROCESSINGCONTROLLER_H_
9
10#include "postprocessing.h"
11
12template <MInt nDim>
14 public:
15 PostProcessingController(std::vector<PostProcessingInterface*> pp);
16
17 void init();
18 void preSolve();
19 void inSolve(MBool finalTimeStep);
20 void ppSolution();
21 void postSolve();
22
23 void setStep(const MInt step) {
24 m_step = (step < 0) ? 0 : step;
25 }
26
27 private:
28 std::vector<PostProcessingInterface*> m_PP;
29
32 std::vector<std::vector<MBool>> m_ppOrder{};
33
34 MInt noPP() { return (signed)m_PP.size(); };
35};
36
37template <MInt nDim>
38PostProcessingController<nDim>::PostProcessingController(std::vector<PostProcessingInterface*> pp) : m_PP(pp) {
39 m_maxNoSteps = 1;
40 if(Context::propertyExists("recipeMaxNoSteps")) {
41 m_maxNoSteps = Context::getBasicProperty<MInt>("recipeMaxNoSteps", AT_, &m_maxNoSteps);
42 }
43}
44
45template <MInt nDim>
47 TRACE();
48
49 m_log << "##################################################################" << std::endl;
50 m_log << "## Postprocessing ##" << std::endl;
51 m_log << "##################################################################" << std::endl << std::endl;
52
53 // read callOrder
54 m_ppOrder.resize(m_maxNoSteps, std::vector<MBool>(noPP(), true));
55 if(m_maxNoSteps > 1) {
56 for(MInt p = 0; p < noPP(); p++) {
57 const MString propName = "postprocessingOrder_" + std::to_string(p);
58 for(MInt step = 0; step < m_maxNoSteps; step++) {
59 m_ppOrder[step][p] = (MBool)Context::getBasicProperty<MInt>(propName, AT_, step);
60 }
61 }
62 }
63
64 // init Postprocessing instances
65 for(auto&& pp : m_PP) {
66 pp->mSolver()->startLoadTimer(AT_);
67 pp->initPostProcessing();
68 pp->mSolver()->stopLoadTimer(AT_);
69 }
70}
71
72template <MInt nDim>
74 TRACE();
75
76 for(auto&& pp : m_PP) {
77 pp->mSolver()->startLoadTimer(AT_);
78 pp->postprocessPreSolve();
79 pp->mSolver()->stopLoadTimer(AT_);
80 }
81}
82
83
84template <MInt nDim>
86 TRACE();
87
88 for(auto&& pp : m_PP) {
89 if(m_ppOrder[m_step][pp->a_postprocessingId()]) {
90 pp->mSolver()->startLoadTimer(AT_);
91 pp->postprocessInSolve(finalTimeStep);
92 pp->mSolver()->stopLoadTimer(AT_);
93 }
94 }
95}
96
97template <MInt nDim>
99 TRACE();
100
101 for(auto&& pp : m_PP) {
102 pp->mSolver()->disableDlbTimers();
103 pp->postprocessSolution();
104 pp->mSolver()->enableDlbTimers();
105 }
106}
107
108template <MInt nDim>
110 TRACE();
111
112 for(auto&& pp : m_PP) {
113 pp->mSolver()->startLoadTimer(AT_);
114 pp->postprocessPostSolve();
115 pp->mSolver()->stopLoadTimer(AT_);
116 }
117}
118
119
120#endif // POSTPROCESSINGCONTROLLER_H_
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
Definition: context.cpp:494
MInt m_step
void ppSolution()
void init()
void setStep(const MInt step)
void preSolve()
PostProcessingController(std::vector< PostProcessingInterface * > pp)
void postSolve()
std::vector< std::vector< MBool > > m_ppOrder
MInt m_maxNoSteps
MInt noPP()
void inSolve(MBool finalTimeStep)
std::vector< PostProcessingInterface * > m_PP
InfoOutFile m_log
int32_t MInt
Definition: maiatypes.h:62
std::basic_string< char > MString
Definition: maiatypes.h:55
bool MBool
Definition: maiatypes.h:58