Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
NeighCache.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
22
23namespace shammodels::sph::solvergraph {
24
26 public:
27 using IEdgeNamed::IEdgeNamed;
28
30
31 shamrock::tree::ObjectCache &get_cache(u64 id) { return neigh_cache.get(id); }
32 const shamrock::tree::ObjectCache &get_cache(u64 id) const { return neigh_cache.get(id); }
33
34 shamrock::tree::ObjectCache &get(u64 id) { return neigh_cache.get(id); }
35 const shamrock::tree::ObjectCache &get(u64 id) const { return neigh_cache.get(id); }
36
37 inline void check_sizes(const shambase::DistributedData<u32> &sizes) const {
38 on_distributeddata_diff(
39 neigh_cache,
40 sizes,
41 [](u64 id) {
43 "Missing neigh cache in distributed data at id " + std::to_string(id));
44 },
45 [](u64 id) {
46 // TODO
47 },
48 [](u64 id) {
50 "Extra neigh cache in distributed data at id " + std::to_string(id));
51 });
52 }
53
54 inline void free_alloc() { neigh_cache = {}; }
55 };
56
57} // namespace shammodels::sph::solvergraph
std::uint64_t u64
64 bit unsigned integer
Represents a collection of objects distributed across patches identified by a u64 id.
void free_alloc()
Free allocated memory.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.