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.
properties_extensions.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosConstitutiveModelsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: October 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(PROPERTIES_EXTENSIONS_H_INCLUDED)
11 #define PROPERTIES_EXTENSIONS_H_INCLUDED
12 
13 #if !defined(DECLARE_ADD_THIS_TYPE_TO_PROPERTIES)
14 #define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES \
15  template<class TVariable> \
16  static void AddToProperties(TVariable const& rV, typename TVariable::Type const& rValue, Properties::Pointer& p) \
17  { \
18  p->SetValue(rV, rValue); \
19  }
20 
21 #define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES_PYTHON(TClassName) \
22  .def_static("AddToProperties", &TClassName::AddToProperties< Variable< TClassName > >)
23 
24 #define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES_PYTHON_AS_POINTER(TClassName) \
25  .def_static("AddToProperties", &TClassName::AddToProperties< Variable< TClassName::Pointer > >)
26 #endif
27 
28 #if !defined(DECLARE_GET_THIS_TYPE_FROM_PROPERTIES)
29 #define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES \
30  template<class TVariable> \
31  static typename TVariable::Type GetFromProperties(TVariable const& rV, Properties::Pointer& p) \
32  { \
33  return p->GetValue(rV); \
34  }
35 
36 #define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES_PYTHON(TClassName) \
37  .def_static("GetFromProperties", &TClassName::GetFromProperties< Variable< TClassName > >)
38 
39 #define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES_PYTHON_AS_POINTER(TClassName) \
40  .def_static("GetFromProperties", &TClassName::GetFromProperties< Variable< TClassName::Pointer > >)
41 #endif
42 
43 
44 #endif // PROPERTIES_EXTENSIONS_H_INCLUDED