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.
contact_properties_extensions.hpp
Go to the documentation of this file.
1 //
2 // Project Name: KratosContactMechanicsApplication $
3 // Created by: $Author: JMCarbonell $
4 // Last modified by: $Co-Author: $
5 // Date: $Date: August 2018 $
6 // Revision: $Revision: 0.0 $
7 //
8 //
9 
10 #if !defined(CONTACT_PROPERTIES_EXTENSIONS_H_INCLUDED)
11 #define CONTACT_PROPERTIES_EXTENSIONS_H_INCLUDED
12 
13 #if !defined(DECLARE_HAS_THIS_TYPE_PROPERTIES)
14 #define DECLARE_HAS_THIS_TYPE_PROPERTIES \
15  template<class TVariable> \
16  static bool HasProperty(TVariable const& rV, Properties::Pointer& p) \
17  { \
18  return p->Has(rV); \
19  }
20 
21 #define DECLARE_HAS_THIS_TYPE_PROPERTIES_PYTHON(TClassName) \
22  .def_static("HasProperty", &TClassName::HasProperty< Variable< TClassName > >)
23 
24 #define DECLARE_HAS_THIS_TYPE_PROPERTIES_PYTHON_AS_POINTER(TClassName) \
25  .def_static("HasProperty", &TClassName::HasProperty< Variable< TClassName::Pointer > >)
26 #endif
27 
28 #if !defined(DECLARE_ADD_THIS_TYPE_TO_PROPERTIES)
29 #define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES \
30  template<class TVariable> \
31  static void AddToProperties(TVariable const& rV, typename TVariable::Type const& rValue, Properties::Pointer& p) \
32  { \
33  p->SetValue(rV, rValue); \
34  }
35 
36 #define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES_PYTHON(TClassName) \
37  .def_static("AddToProperties", &TClassName::AddToProperties< Variable< TClassName > >)
38 
39 
40 #define DECLARE_ADD_THIS_TYPE_TO_PROPERTIES_PYTHON_AS_POINTER(TClassName) \
41  .def_static("AddToProperties", &TClassName::AddToProperties< Variable< TClassName::Pointer > >)
42 #endif
43 
44 #if !defined(DECLARE_GET_THIS_TYPE_FROM_PROPERTIES)
45 #define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES \
46  template<class TVariable> \
47  static typename TVariable::Type GetFromProperties(TVariable const& rV, Properties::Pointer& p) \
48  { \
49  return p->GetValue(rV); \
50  }
51 
52 #define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES_PYTHON(TClassName) \
53  .def_static("GetFromProperties", &TClassName::GetFromProperties< Variable< TClassName > >)
54 
55 #define DECLARE_GET_THIS_TYPE_FROM_PROPERTIES_PYTHON_AS_POINTER(TClassName) \
56  .def_static("GetFromProperties", &TClassName::GetFromProperties< Variable< TClassName::Pointer > >)
57 #endif
58 
59 
60 #endif // CONTACT_PROPERTIES_EXTENSIONS_H_INCLUDED