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.
operation.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: Carlos Roig
11 // Ruben Zorrilla
12 //
13 
14 #pragma once
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 #include "containers/model.h"
23 #include "includes/kratos_flags.h"
25 #include "includes/registry.h"
26 
27 namespace Kratos
28 {
29 
32 
42 class Operation
43 {
44 public:
47 
50 
54 
56  explicit Operation() = default;
57 
59  virtual ~Operation() {}
60 
62  //TODO: Check. It is required by the registry
63  Operation(Operation const& rOther) {}
64 
68 
70  Operation& operator=(Operation const& rOther) = delete;
71 
73  void operator()()
74  {
75  Execute();
76  }
77 
81 
89  virtual Operation::Pointer Create(
90  Model& rModel,
91  Parameters ThisParameters) const
92  {
93  KRATOS_ERROR << "Calling base class Create. Please override this method in the corresonding Operation" << std::endl;
94  return nullptr;
95  }
96 
100  virtual void Execute()
101  {
102  KRATOS_ERROR << "Calling base class Execute. Please override this method in the corresonding Operation" << std::endl;
103  }
104 
108  virtual const Parameters GetDefaultParameters() const
109  {
110  KRATOS_ERROR << "Calling the base Operation class GetDefaultParameters. Please implement the GetDefaultParameters in your derived process class." << std::endl;
111  const Parameters default_parameters = Parameters(R"({})" );
112 
113  return default_parameters;
114  }
115 
119 
120 
124 
125 
129 
131  std::string Info() const
132  {
133  return "Operation";
134  }
135 
137  void PrintInfo(std::ostream& rOStream) const
138  {
139  rOStream << "Operation";
140  }
141 
143  void PrintData(std::ostream& rOStream) const
144  {
145  }
146 
148 private:
151 
152  KRATOS_REGISTRY_ADD_PROTOTYPE("Operations.KratosMultiphysics", Operation, Operation)
154 
155 
156 }; // Class Operation
157 
160 
161 
165 
167 inline std::istream& operator >> (std::istream& rIStream, Operation& rThis);
168 
170 inline std::ostream& operator << (std::ostream& rOStream, const Operation& rThis)
171 {
172  rThis.PrintInfo(rOStream);
173  rOStream << std::endl;
174  rThis.PrintData(rOStream);
175 
176  return rOStream;
177 }
178 
180 } // namespace Kratos.
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
The base class for all operations in Kratos.
Definition: operation.h:43
virtual Operation::Pointer Create(Model &rModel, Parameters ThisParameters) const
This method creates an pointer of the process.
Definition: operation.h:89
Operation()=default
Default constructor.
Operation & operator=(Operation const &rOther)=delete
Assignment operator.
virtual const Parameters GetDefaultParameters() const
This method provides the defaults parameters to avoid conflicts between the different constructors.
Definition: operation.h:108
void PrintInfo(std::ostream &rOStream) const
Print information about this object.
Definition: operation.h:137
virtual ~Operation()
Destructor.
Definition: operation.h:59
virtual void Execute()
Execute method is used to execute the Operation algorithms.
Definition: operation.h:100
KRATOS_CLASS_POINTER_DEFINITION(Operation)
Pointer definition of Operation.
void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: operation.h:143
void operator()()
This operator is provided to call the process as a function and simply calls the Execute method.
Definition: operation.h:73
Operation(Operation const &rOther)
Copy constructor.
Definition: operation.h:63
std::string Info() const
Turn back information as a string.
Definition: operation.h:131
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
#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