KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
process.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Kratos default license: kratos/license.txt
9 //
10 // Main authors: Pooyan Dadvand
11 // Riccardo Rossi
12 //
13 
14 #pragma once
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "includes/define.h"
22 #include "includes/kratos_flags.h"
25 
26 namespace Kratos
27 {
28 
31 
32 // Some forward declarations to avoid increase a lot the compilation time
33 class Model;
34 
48 class Process : public Flags
49 {
50 public:
53 
56 
60 
62  Process() : Flags() {}
63  explicit Process(const Flags options) : Flags( options ) {}
64 
66  ~Process() override {}
67 
71 
73  void operator()()
74  {
75  Execute();
76  }
77 
81 
89  virtual Process::Pointer Create(
90  Model& rModel,
91  Parameters ThisParameters
92  )
93  {
94  KRATOS_ERROR << "Calling base class create. Please override this method in the corresonding Process" << std::endl;
95  return nullptr;
96  }
97 
101  virtual void Execute() {}
102 
107  virtual void ExecuteInitialize()
108  {
109  }
110 
116  {
117  }
118 
119 
124  {
125  }
126 
131  {
132  }
133 
134 
138  virtual void ExecuteBeforeOutputStep()
139  {
140  }
141 
142 
146  virtual void ExecuteAfterOutputStep()
147  {
148  }
149 
150 
154  virtual void ExecuteFinalize()
155  {
156  }
157 
162  virtual int Check()
163  {
164  return 0;
165  }
166 
170  virtual void Clear()
171  {
172  }
173 
177  virtual const Parameters GetDefaultParameters() const
178  {
179  KRATOS_ERROR << "Calling the base Process class GetDefaultParameters. Please implement the GetDefaultParameters in your derived process class." << std::endl;
180  const Parameters default_parameters = Parameters(R"({})" );
181 
182  return default_parameters;
183  }
184 
188 
192 
196 
198  std::string Info() const override
199  {
200  return "Process";
201  }
202 
204  void PrintInfo(std::ostream& rOStream) const override
205  {
206  rOStream << Info();
207  }
208 
210  void PrintData(std::ostream& rOStream) const override
211  {
212  }
213 
217 
219 private:
222 
223  KRATOS_REGISTRY_ADD_PROTOTYPE("Processes.KratosMultiphysics", Process, Process)
225 
226 
229 
231  Process& operator=(Process const& rOther);
232 
234  //Process(Process const& rOther);
235 
237 
238 }; // Class Process
239 
241 
244 
248 
250 inline std::istream& operator >> (std::istream& rIStream,
251  Process& rThis);
252 
254 inline std::ostream& operator << (std::ostream& rOStream,
255  const Process& rThis)
256 {
257  rThis.PrintInfo(rOStream);
258  rOStream << std::endl;
259  rThis.PrintData(rOStream);
260 
261  return rOStream;
262 }
264 
265 } // namespace Kratos.
Definition: flags.h:58
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
The base class for all processes in Kratos.
Definition: process.h:49
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: process.h:73
virtual int Check()
This function is designed for being called after ExecuteInitialize ONCE to verify that the input is c...
Definition: process.h:162
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: process.h:204
virtual void Clear()
This method clears the assignation of the conditions.
Definition: process.h:170
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: process.h:210
virtual void ExecuteFinalizeSolutionStep()
This function will be executed at every time step AFTER performing the solve phase.
Definition: process.h:130
virtual Process::Pointer Create(Model &rModel, Parameters ThisParameters)
This method creates an pointer of the process.
Definition: process.h:89
Process(const Flags options)
Definition: process.h:63
virtual void ExecuteFinalize()
This function is designed for being called at the end of the computations.
Definition: process.h:154
~Process() override
Destructor.
Definition: process.h:66
virtual void ExecuteInitializeSolutionStep()
This function will be executed at every time step BEFORE performing the solve phase.
Definition: process.h:123
Process()
Default constructor.
Definition: process.h:62
virtual void ExecuteBeforeSolutionLoop()
This function is designed for being execute once before the solution loop but after all of the solver...
Definition: process.h:115
KRATOS_CLASS_POINTER_DEFINITION(Process)
Pointer definition of Process.
virtual const Parameters GetDefaultParameters() const
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: process.h:177
virtual void ExecuteAfterOutputStep()
This function will be executed at every time step AFTER writing the output.
Definition: process.h:146
std::string Info() const override
Turn back information as a string.
Definition: process.h:198
virtual void ExecuteBeforeOutputStep()
This function will be executed at every time step BEFORE writing the output.
Definition: process.h:138
virtual void Execute()
Execute method is used to execute the Process algorithms.
Definition: process.h:101
virtual void ExecuteInitialize()
This function is designed for being called at the beginning of the computations right after reading t...
Definition: process.h:107
#define KRATOS_REGISTRY_ADD_PROTOTYPE(NAME, X, Y)
Macro to register class prototypes This macro creates a static bool in the class (which value is not ...
Definition: define_registry.h:43
#define KRATOS_ERROR
Definition: exception.h:161
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
dictionary Model
TODO replace this "model" for real one once available in kratos core.
Definition: script.py:94