Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ForwardEulerHost2Deriv.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
18
22#include <vector>
23
24#define NODE_EDGES(X_RO, X_RW) \
25 X_RO(shamrock::solvergraph::IDataEdge<Tscal>, dt) \
26 X_RO(shamrock::solvergraph::IDataEdge<std::vector<T>>, field_dt1) \
27 X_RO(shamrock::solvergraph::IDataEdge<std::vector<T>>, field_dt2) \
28 X_RW(shamrock::solvergraph::IDataEdge<std::vector<T>>, field)
29
30namespace shamrock::solvergraph {
31
41 template<class T, class Tscal = T>
42 class ForwardEulerHost2Deriv : public INode {
43
44 public:
45 ForwardEulerHost2Deriv() = default;
46
47 EXPAND_NODE_EDGES(NODE_EDGES)
48
51
52 auto edges = get_edges();
53
54 Tscal dt = edges.dt.data;
55 std::vector<T> &field = edges.field.data;
56 const std::vector<T> &field_dt1 = edges.field_dt1.data;
57 const std::vector<T> &field_dt2 = edges.field_dt2.data;
58
59 for (size_t i = 0; i < field.size(); i++) {
60 field[i] += dt * (field_dt1[i] + field_dt2[i]);
61 }
62 }
63
64 inline virtual std::string _impl_get_label() const { return "ForwardEulerHost2Deriv"; }
65
66 inline virtual std::string _impl_get_tex() const { return "TODO"; }
67 };
68
69} // namespace shamrock::solvergraph
70
71#undef NODE_EDGES
virtual std::string _impl_get_label() const
get the label of the node
virtual std::string _impl_get_tex() const
get the tex of the node
This file contains the definition for the stacktrace related functionality.
#define __shamrock_stack_entry()
Macro to create a stack entry.