Peano
Loading...
Searching...
No Matches
VariableShortcuts.template.h
Go to the documentation of this file.
1// **********************************************************************************************
2// *** Generated by Peano's Python API: www.peano-framework.org ***
3// **********************************************************************************************
4#pragma once
5
6{% for item in NAMESPACE -%}
7 namespace {{ item }} {
8{%- endfor %}
10{% for item in NAMESPACE -%}
11 }
12{%- endfor %}
13
23#if defined(GPUOffloadingOMP)
24#pragma omp declare target
25#endif
26class {{NAMESPACE | join("::")}}::VariableShortcuts {
27public:
28 static constexpr int NumberOfDistinctVariables = {{VARIABLE_NAMES|length}};
29
30 // Positions of fields inside the unknown vector (solution vector) Q
31 static constexpr int Q[NumberOfDistinctVariables + 1] = { {% for VARIABLE_NO in range(0, VARIABLE_NAMES|length-1) -%}
32 {{VARIABLE_POSITIONS[VARIABLE_NO]}},
33{%- endfor %} {{VARIABLE_POSITIONS[VARIABLE_NAMES|length-1]}} };
34
35 {% for VARIABLE_NO in range(0, VARIABLE_NAMES|length) %}
36 static constexpr int {{VARIABLE_NAMES[VARIABLE_NO]}} = {{VARIABLE_POSITIONS[VARIABLE_NO]}};
37 {% endfor %}
38
39 constexpr int operator [] (const int index) const noexcept { return Q[index]; }
40 constexpr int operator () (const int index) const noexcept { return Q[index]; }
41};
42#if defined(GPUOffloadingOMP)
43#pragma omp end declare target
44#endif
45
46using VariableShortcuts = {{NAMESPACE | join("::")}}::VariableShortcuts;
{{NAMESPACE|join("::")}}::VariableShortcuts VariableShortcuts