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.
vertex_impl.h
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ `
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // license: HDF5Application/license.txt
9 //
10 // Main author: Máté Kelemen
11 //
12 
13 #ifndef KRATOS_HDF5_APPLICATION_VERTEX_IMPL_H
14 #define KRATOS_HDF5_APPLICATION_VERTEX_IMPL_H
15 
16 // Application includes
18 
19 
20 namespace Kratos
21 {
22 namespace HDF5
23 {
24 namespace Detail
25 {
26 
27 
28 template <class TValue>
30 {
31  static TValue Get()
32  {
33  return TValue(0);
34  }
35 };
36 
37 
38 template <class TValue, std::size_t ArraySize>
39 struct ZeroInitialized<array_1d<TValue, ArraySize>>
40 {
42  {
43  return ZeroVector(ArraySize);
44  }
45 };
46 
47 
48 template <class TValue>
49 struct ZeroInitialized<Matrix<TValue>>
50 {
52  {
53  return ZeroMatrix();
54  }
55 };
56 
57 
58 inline std::size_t Vertex::GetID() const
59 {
60  return mID;
61 }
62 
63 
64 template <class TValue>
65 inline TValue Vertex::GetValue(const Variable<TValue>& rVariable) const
66 {
68 
69  KRATOS_ERROR_IF(!mpContainingElement.get()) << "attempt to interpolate on a non-located vertex";
70 
71  const auto& r_geometry = mpContainingElement->GetGeometry();
72  auto value = ZeroInitialized<TValue>::Get();
73 
74  // Interpolate variable
75  for (std::size_t i_node=0; i_node<r_geometry.size(); ++i_node) {
76  value += mShapeFunctionValues[i_node] * mpVariableGetter->GetValue(r_geometry.GetPoint(i_node), rVariable);
77  }
78 
79  return value;
80 
81  KRATOS_CATCH("");
82 }
83 
84 
85 } // namespace Detail
86 } // namespace HDF5
87 } // namespace Kratos
88 
89 
90 #endif
std::size_t GetID() const
Definition: vertex_impl.h:58
TValue GetValue(const Variable< TValue > &rVariable) const
Definition: vertex_impl.h:65
Definition: amatrix_interface.h:41
Short class definition.
Definition: array_1d.h:61
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
static Matrix< TValue > Get()
Definition: vertex_impl.h:51
static array_1d< TValue, ArraySize > Get()
Definition: vertex_impl.h:41
Definition: vertex_impl.h:30
static TValue Get()
Definition: vertex_impl.h:31