Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ForwardEulerHost.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
17
21#include <vector>
22
23#define NODE_EDGES(X_RO, X_RW) \
24 X_RO(shamrock::solvergraph::IDataEdge<Tscal>, dt) \
25 X_RO(shamrock::solvergraph::IDataEdge<std::vector<T>>, field_dt) \
26 X_RW(shamrock::solvergraph::IDataEdge<std::vector<T>>, field)
27
28namespace shamrock::solvergraph {
29
38 template<class T, class Tscal = T>
39 class ForwardEulerHost : public INode {
40
41 public:
42 ForwardEulerHost() = default;
43
44 EXPAND_NODE_EDGES(NODE_EDGES)
45
48
49 auto edges = get_edges();
50
51 Tscal dt = edges.dt.data;
52 std::vector<T> &field = edges.field.data;
53 const std::vector<T> &field_dt = edges.field_dt.data;
54
55 for (size_t i = 0; i < field.size(); i++) {
56 field[i] += dt * field_dt[i];
57 }
58 }
59
60 inline virtual std::string _impl_get_label() const { return "ForwardEulerHost"; }
61
62 inline virtual std::string _impl_get_tex() const { return "TODO"; }
63 };
64
65} // namespace shamrock::solvergraph
66
67#undef NODE_EDGES
virtual std::string _impl_get_label() const
get the label of the node
void _impl_evaluate_internal()
evaluate 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.