-
Notifications
You must be signed in to change notification settings - Fork 248
/
process.h
265 lines (212 loc) · 6.16 KB
/
process.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Pooyan Dadvand
// Riccardo Rossi
//
#pragma once
// System includes
// External includes
// Project includes
#include "includes/define.h"
#include "includes/kratos_flags.h"
#include "includes/kratos_parameters.h"
#include "includes/define_registry.h"
namespace Kratos
{
///@name Kratos Classes
///@{
// Some forward declarations to avoid increase a lot the compilation time
class Model;
/**
* @class Process
* @ingroup KratosCore
* @brief The base class for all processes in Kratos.
* @details The process is the base class for all processes and defines a simple interface for them.
Execute method is used to execute the Process algorithms. While the parameters of this method
can be very different from one Process to other there is no way to create enough overridden
versions of it. For this reason this method takes no argument and all Process parameters must
be passed at construction time. The reason is that each constructor can take different set of
argument without any dependency to other processes or the base Process class.
@author Pooyan Dadvand
@author Riccardo Rossi
*/
class Process : public Flags
{
public:
///@name Type Definitions
///@{
/// Pointer definition of Process
KRATOS_CLASS_POINTER_DEFINITION(Process);
///@}
///@name Life Cycle
///@{
/// Default constructor.
Process() : Flags() {}
explicit Process(const Flags options) : Flags( options ) {}
/// Destructor.
~Process() override {}
///@}
///@name Operators
///@{
/// This operator is provided to call the process as a function and simply calls the Execute method.
void operator()()
{
Execute();
}
///@}
///@name Operations
///@{
/**
* @brief This method creates an pointer of the process
* @details We consider as input a Model and a set of Parameters for the sake of generality
* @warning Must be overrided in each process implementation
* @param rModel The model to be consider
* @param ThisParameters The configuration parameters
*/
virtual Process::Pointer Create(
Model& rModel,
Parameters ThisParameters
)
{
KRATOS_ERROR << "Calling base class create. Please override this method in the corresonding Process" << std::endl;
return nullptr;
}
/**
* @brief Execute method is used to execute the Process algorithms.
*/
virtual void Execute() {}
/**
* @brief This function is designed for being called at the beginning of the computations
* right after reading the model and the groups
*/
virtual void ExecuteInitialize()
{
}
/**
* @brief This function is designed for being execute once before the solution loop but after
* all of the solvers where built
*/
virtual void ExecuteBeforeSolutionLoop()
{
}
/**
* @brief This function will be executed at every time step BEFORE performing the solve phase
*/
virtual void ExecuteInitializeSolutionStep()
{
}
/**
* @brief This function will be executed at every time step AFTER performing the solve phase
*/
virtual void ExecuteFinalizeSolutionStep()
{
}
/**
* @brief This function will be executed at every time step BEFORE writing the output
*/
virtual void ExecuteBeforeOutputStep()
{
}
/**
* @brief This function will be executed at every time step AFTER writing the output
*/
virtual void ExecuteAfterOutputStep()
{
}
/**
* @brief This function is designed for being called at the end of the computations
*/
virtual void ExecuteFinalize()
{
}
/**
* @brief This function is designed for being called after ExecuteInitialize ONCE
* to verify that the input is correct.
*/
virtual int Check()
{
return 0;
}
/**
* @brief This method clears the assignation of the conditions
*/
virtual void Clear()
{
}
/**
* @brief This method provides the defaults parameters to avoid conflicts between the different constructors
*/
virtual const Parameters GetDefaultParameters() const
{
KRATOS_ERROR << "Calling the base Process class GetDefaultParameters. Please implement the GetDefaultParameters in your derived process class." << std::endl;
const Parameters default_parameters = Parameters(R"({})" );
return default_parameters;
}
///@}
///@name Access
///@{
///@}
///@name Inquiry
///@{
///@}
///@name Input and output
///@{
/// Turn back information as a string.
std::string Info() const override
{
return "Process";
}
/// Print information about this object.
void PrintInfo(std::ostream& rOStream) const override
{
rOStream << Info();
}
/// Print object's data.
void PrintData(std::ostream& rOStream) const override
{
}
///@}
///@name Friends
///@{
///@}
private:
///@name Static Member Variables
///@{
KRATOS_REGISTRY_ADD_PROTOTYPE("Processes.KratosMultiphysics", Process, Process)
KRATOS_REGISTRY_ADD_PROTOTYPE("Processes.All", Process, Process)
///@}
///@name Un accessible methods
///@{
/// Assignment operator.
Process& operator=(Process const& rOther);
/// Copy constructor.
//Process(Process const& rOther);
///@}
}; // Class Process
///@}
///@name Type Definitions
///@{
///@}
///@name Input and output
///@{
/// input stream function
inline std::istream& operator >> (std::istream& rIStream,
Process& rThis);
/// output stream function
inline std::ostream& operator << (std::ostream& rOStream,
const Process& rThis)
{
rThis.PrintInfo(rOStream);
rOStream << std::endl;
rThis.PrintData(rOStream);
return rOStream;
}
///@}
} // namespace Kratos.