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.
temporal_method_utilities.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: Suneth Warnakulasuriya (https://github.com/sunethwarna)
11 //
12 
13 #if !defined(KRATOS_TEMPORAL_METHOD_UTILITIES_H_INCLUDED)
14 #define KRATOS_TEMPORAL_METHOD_UTILITIES_H_INCLUDED
15 
16 // System includes
17 
18 // External includes
19 
20 // Project includes
21 
22 // Application includes
24 
25 namespace Kratos
26 {
29 
32 
33 namespace TemporalMethodUtilities
34 {
35 template <class TContainerType, class TContainerItemType, template <class T> class TDataRetrievalFunctor, template <class T> class TDataStorageFunctor, class TDataType>
37  TContainerType& rContainer,
38  const Variable<TDataType>& rOutputVariable,
39  const Variable<TDataType>& rReferenceVariable)
40 {
41  if (rContainer.size() > 0)
42  {
43  const int number_of_items = rContainer.size();
44 #pragma omp parallel for
45  for (int i = 0; i < number_of_items; ++i)
46  {
47  TContainerItemType& r_item = *(rContainer.begin() + i);
48 
49  const TDataType& r_reference_value =
50  TDataRetrievalFunctor<TContainerItemType>()(r_item, rReferenceVariable);
51  TDataType output_value = rOutputVariable.Zero();
52  MethodUtilities::DataTypeSizeInitializer<TDataType>(output_value, r_reference_value);
53  TDataStorageFunctor<TContainerItemType>()(r_item, rOutputVariable, output_value);
54  }
55  }
56 }
57 
58 template <class TContainerType, class TContainerItemType, template <class T> class TDataStorageFunctor>
59 void InitializeVariables(TContainerType& rContainer, const Variable<double>& rOutputVariable, const double InitializerValue)
60 {
61  if (rContainer.size() > 0)
62  {
63  const int number_of_items = rContainer.size();
64 #pragma omp parallel for
65  for (int i = 0; i < number_of_items; ++i)
66  {
67  TContainerItemType& r_item = *(rContainer.begin() + i);
68  TDataStorageFunctor<TContainerItemType>()(r_item, rOutputVariable, InitializerValue);
69  }
70  }
71 }
72 
73 } // namespace TemporalMethodUtilities
74 } // namespace Kratos
75 #endif // KRATOS_TEMPORAL_METHOD_UTILITIES_H_INCLUDED
Variable class contains all information needed to store and retrive data from a data container.
Definition: variable.h:63
const TDataType & Zero() const
This method returns the zero value of the variable type.
Definition: variable.h:346
void InitializeVariables(TContainerType &rContainer, const Variable< TDataType > &rOutputVariable, const Variable< TDataType > &rReferenceVariable)
Definition: temporal_method_utilities.h:36
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
integer i
Definition: TensorModule.f:17