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.
container_properties_data_io.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // license: OptimizationApplication/license.txt
9 //
10 // Main author: Suneth Warnakulasuriya
11 //
12 
13 #pragma once
14 
15 // System includes
16 
17 // Project includes
18 #include "containers/variable.h"
20 #include "includes/model_part.h"
21 
22 // Application includes
23 
24 namespace Kratos {
25 
28 
29 namespace ContainerDataIOTags {
30  struct Properties {};
31 } // namespace Tags
32 
33 template <>
34 struct ContainerDataIO<ContainerDataIOTags::Properties>
35 {
36  static constexpr std::string_view mInfo = "Properties";
37 
38  template<class TDataType, class TEntityType>
39  static const TDataType& GetValue(
40  const TEntityType& rEntity,
41  const Variable<TDataType>& rVariable)
42  {
43  static_assert(!(std::is_same_v<TEntityType, ModelPart::NodeType>), "Properties retrieval is only supported for element and conditions.");
44  return rEntity.GetProperties().GetValue(rVariable);
45  }
46 
47  template<class TDataType, class TEntityType>
48  static void SetValue(
49  TEntityType& rEntity,
50  const Variable<TDataType>& rVariable,
51  const TDataType& rValue)
52  {
53  static_assert(!(std::is_same_v<TEntityType, ModelPart::NodeType>), "Properties setter is only supported for element and conditions.");
54  rEntity.GetProperties().SetValue(rVariable, rValue);
55  }
56 };
57 
58 } // namespace Kratos
Properties encapsulates data shared by different Elements or Conditions. It can store any type of dat...
Definition: properties.h:69
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
static void SetValue(TEntityType &rEntity, const Variable< TDataType > &rVariable, const TDataType &rValue)
Definition: container_properties_data_io.h:48
static const TDataType & GetValue(const TEntityType &rEntity, const Variable< TDataType > &rVariable)
Definition: container_properties_data_io.h:39
Definition: container_data_io.h:34
Definition: container_properties_data_io.h:30