Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
NodeOverwrite.cpp
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
18
19#include "shambase/string.hpp"
24
25namespace shamrock::solvergraph {
26
27 template<class T>
29 auto edges = get_edges();
30
31 edges.spans_x.check_sizes(edges.sizes.indexes);
32 edges.spans_y.ensure_sizes(edges.sizes.indexes);
33
35 = edges.sizes.indexes.template map<u32>([&](u64 id, u32 obj_cnt) {
36 return obj_cnt * nvar;
37 });
38
40 shamsys::instance::get_compute_scheduler_ptr(),
41 sham::DDMultiRef{edges.spans_x.get_spans()},
42 sham::DDMultiRef{edges.spans_y.get_spans()},
43 val_cnts,
44 [](u32 i, const T *__restrict x, T *__restrict y) {
45 y[i] = x[i];
46 });
47 }
48
49 template<class T>
50 std::string NodeOverwrite<T>::_impl_get_tex() const {
51 std::string tex = R"tex(
52 Overwrite a field with another one
53 \begin{equation}
54 {spans_y}_i = {spans_x}_i
55 \end{equation}
56 )tex";
57
58 replace_edges_tex_symbols(tex);
59
60 return tex;
61 }
62
63} // namespace shamrock::solvergraph
64
Header file describing a Node Instance.
Node copying a field into another one (y <- x).
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
Represents a collection of objects distributed across patches identified by a u64 id.
Copy x into y on every value of every patch.
virtual std::string _impl_get_tex() const
get the tex of the node
void _impl_evaluate_internal()
evaluate the node
void distributed_data_kernel_call(sham::DeviceScheduler_ptr dev_sched, RefIn in, RefOut in_out, const shambase::DistributedData< index_t > &thread_counts, Functor &&func)
A variant of sham::kernel_call for distributed data.
A variant of sham::MultiRef for distributed data.