Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ResetExtForceAcc.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
17
18#include "shambase/string.hpp"
23
25
26 template<class Tvec>
28 auto edges = get_edges();
29
30 // (only reallocated if the block counts have changed)
31 edges.spans_a_ext.ensure_sizes(edges.sizes.indexes);
32
34 = edges.sizes.indexes.template map<u32>([&](u64 id, u32 block_count) {
35 return block_count * block_size;
36 });
37
39 shamsys::instance::get_compute_scheduler_ptr(),
41 sham::DDMultiRef{edges.spans_a_ext.get_spans()},
42 cell_counts,
43 [](u32 i, Tvec *__restrict a_ext) {
44 a_ext[i] = Tvec{};
45 });
46 }
47
48 template<class Tvec>
50 auto a_ext = get_rw_edge_base(0).get_tex_symbol();
51
52 std::string tex = R"tex(
53 Reset external forces acceleration
54
55 \begin{align}
56 {a_ext}_i &= 0
57 \end{align}
58 )tex";
59
60 shambase::replace_all(tex, "{a_ext}", a_ext);
61
62 return tex;
63 }
64
65} // namespace shammodels::basegodunov::modules
66
Header file describing a Node Instance.
Node resetting the external forces acceleration field to zero.
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.
Resize the external forces acceleration field to the block counts and set it to zero,...
virtual std::string _impl_get_tex() const
get the tex of the node
IEdge & get_rw_edge_base(int slot)
Get a reference to a read write edge and cast it to the type IEdge.
Definition INode.hpp:147
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.
void replace_all(std::string &inout, std::string_view what, std::string_view with)
replace all occurence of a search string with another
Definition string.hpp:106
namespace for the basegodunov model modules
A variant of sham::MultiRef for distributed data.