Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
OrientedAMRGraphEdge.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
20#include "shambase/memory.hpp"
23
24namespace shammodels::basegodunov::solvergraph {
25
26 template<class Tvec, class TgridVec>
28 public:
29 using IEdgeNamed::IEdgeNamed;
31
33
34 inline virtual void free_alloc() { graph = {}; }
35
37 modules::Direction dir) {
38 return graph.template map<std::reference_wrapper<modules::AMRGraph>>(
39 [&](u64 id,
40 OrientedAMRGraph &neigh_graph) -> std::reference_wrapper<modules::AMRGraph> {
41 return std::ref(shambase::get_check_ref(neigh_graph.graph_links[dir]));
42 });
43 }
45 modules::Direction dir) const {
46 return graph.template map<std::reference_wrapper<modules::AMRGraph>>(
47 [&](u64 id, const OrientedAMRGraph &neigh_graph)
48 -> std::reference_wrapper<modules::AMRGraph> {
49 return std::ref(shambase::get_check_ref(neigh_graph.graph_links[dir]));
50 });
51 }
52 };
53
54} // namespace shammodels::basegodunov::solvergraph
std::uint64_t u64
64 bit unsigned integer
Represents a collection of objects distributed across patches identified by a u64 id.
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...
Definition memory.hpp:110