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_factory_utility.h
Go to the documentation of this file.
1 // KRATOS ______ __ __ _____ __ __ __
2 // / ____/___ ____ / /_____ ______/ /_/ ___// /________ _______/ /___ ___________ _/ /
3 // / / / __ \/ __ \/ __/ __ `/ ___/ __/\__ \/ __/ ___/ / / / ___/ __/ / / / ___/ __ `/ /
4 // / /___/ /_/ / / / / /_/ /_/ / /__/ /_ ___/ / /_/ / / /_/ / /__/ /_/ /_/ / / / /_/ / /
5 // \____/\____/_/ /_/\__/\__,_/\___/\__//____/\__/_/ \__,_/\___/\__/\__,_/_/ \__,_/_/ MECHANICS
6 //
7 // License: BSD License
8 // license: ContactStructuralMechanicsApplication/license.txt
9 //
10 // Main authors: Vicente Mataix Ferrandiz
11 //
12 
13 #pragma once
14 
15 // System includes
16 #include <iostream>
17 #include <vector>
18 #include <pybind11/pybind11.h>
19 
20 // External includes
21 
22 // Project includes
23 #include "includes/serializer.h"
24 
25 namespace Kratos
26 {
29 
33 
37 
41 
45 
54 {
55 public:
56 
59 
62 
64  using ObjectType = pybind11::object;
65 
67  using ListType = pybind11::list;
68 
72 
75 
80  ProcessFactoryUtility(ListType& ProcessesList);
81 
88 
90  virtual ~ProcessFactoryUtility()= default;
91 
95 
97 
99  = default;
100 
104 
110  void AddProcess(ObjectType& rProcess);
111 
117  void AddProcesses(ListType& ProcessesList);
118 
124  void ExecuteMethod(const std::string& rNameMethod);
125 
130  void ExecuteInitialize();
131 
137 
143 
149 
155 
160  void ExecuteAfterOutputStep();
161 
166  void ExecuteFinalize();
167 
172  void IsOutputStep();
173 
178  void PrintOutput();
179 
184  void Clear();
185 
189 
193 
197 
201 
203 
204  virtual std::string Info() const
205  {
206  std::stringstream buffer;
207  buffer << "ProcessFactoryUtility. Number of processes:" << mProcesses.size();
208  return buffer.str();
209  }
210 
212 
213  virtual void PrintInfo(std::ostream& rOStream) const
214  {
215  rOStream << "ProcessFactoryUtility. Number of processes:" << mProcesses.size();
216  }
217 
219 
220  virtual void PrintData(std::ostream& rOStream) const
221  {
222  rOStream << "ProcessFactoryUtility. Number of processes:" << mProcesses.size();
223  }
224 
225 private:
231 
232  std::vector<ObjectType> mProcesses;
233 
237 
241 
246 
250 
251  friend class Serializer;
252 
253  virtual void save(Serializer& rSerializer) const
254  {
255  // TODO: Fill if necessary
256 // rSerializer.save("Processes", mProcesses);
257  }
258 
259  virtual void load(Serializer& rSerializer)
260  {
261  // TODO: Fill if necessary
262 // rSerializer.load("Processes", mProcesses);
263  }
264 
268 
272 }; // Class ProcessFactoryUtility
273 
275 
278 
279 
283 
285 inline std::istream & operator >>(std::istream& rIStream,
286  ProcessFactoryUtility& rThis);
287 
289 
290 inline std::ostream & operator <<(std::ostream& rOStream,
291  const ProcessFactoryUtility& rThis)
292 {
293  rThis.PrintInfo(rOStream);
294  rOStream << " : " << std::endl;
295  rThis.PrintData(rOStream);
296 
297  return rOStream;
298 }
299 
301 
302 } // namespace Kratos.
This is a experimental process factory utility.
Definition: process_factory_utility.h:54
void ExecuteInitializeSolutionStep()
It executes the ExecuteInitializeSolutionStep() from the list of processes.
Definition: process_factory_utility.cpp:85
pybind11::object ObjectType
The object type in python.
Definition: process_factory_utility.h:64
KRATOS_CLASS_POINTER_DEFINITION(ProcessFactoryUtility)
Counted pointer of ProcessFactoryUtility.
void Clear()
It executes the Clear() from the list of processes.
Definition: process_factory_utility.cpp:141
void ExecuteFinalizeSolutionStep()
It executes the ExecuteFinalizeSolutionStep() from the list of processes.
Definition: process_factory_utility.cpp:93
void ExecuteMethod(const std::string &rNameMethod)
It executes the method considered in the input.
Definition: process_factory_utility.cpp:60
void PrintOutput()
It executes the PrintOutput() from the list of processes.
Definition: process_factory_utility.cpp:133
pybind11::list ListType
The list [] of python.
Definition: process_factory_utility.h:67
void ExecuteInitialize()
It executes the ExecuteInitialize() from the list of processes.
Definition: process_factory_utility.cpp:69
void ExecuteBeforeOutputStep()
It executes the ExecuteBeforeOutputStep() from the list of processes.
Definition: process_factory_utility.cpp:101
virtual void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: process_factory_utility.h:213
void ExecuteBeforeSolutionLoop()
It executes the ExecuteBeforeSolutionLoop() from the list of processes.
Definition: process_factory_utility.cpp:77
virtual std::string Info() const
Turn back information as a string.
Definition: process_factory_utility.h:204
void AddProcesses(ListType &ProcessesList)
It add new processes to the existing process list.
Definition: process_factory_utility.cpp:50
void IsOutputStep()
It executes the IsOutputStep() from the list of processes.
Definition: process_factory_utility.cpp:125
void ExecuteFinalize()
It executes the ExecuteFinalize() from the list of processes.
Definition: process_factory_utility.cpp:117
ProcessFactoryUtility & operator=(ProcessFactoryUtility const &rOther)=default
Assignment operator.
virtual ~ProcessFactoryUtility()=default
Destructor.
ProcessFactoryUtility()=default
Default constructors.
void ExecuteAfterOutputStep()
It executes the ExecuteAfterOutputStep() from the list of processes.
Definition: process_factory_utility.cpp:109
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: process_factory_utility.h:220
void AddProcess(ObjectType &rProcess)
It add new process to the existing process list.
Definition: process_factory_utility.cpp:42
The serialization consists in storing the state of an object into a storage format like data file or ...
Definition: serializer.h:123
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
def load(f)
Definition: ode_solve.py:307