Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamrock
include
shamrock
solvergraph
SerialPatchTreeEdge.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
19
#include "
shambase/DistributedData.hpp
"
20
#include "
shambase/exception.hpp
"
21
#include "
shamrock/scheduler/SerialPatchTree.hpp
"
22
#include "
shamrock/solvergraph/IEdgeNamed.hpp
"
23
#include <optional>
24
#include <stdexcept>
25
26
namespace
shamrock::solvergraph {
27
28
template
<
class
Tvec>
29
class
SerialPatchTreeRefEdge
:
public
IEdgeNamed
{
30
public
:
31
using
IEdgeNamed::IEdgeNamed;
32
37
std::optional<std::reference_wrapper<SerialPatchTree<Tvec>>>
patch_tree
;
38
39
inline
SerialPatchTree<Tvec>
&get_patch_tree()
const
{
40
if
(!
patch_tree
.has_value()) {
41
shambase::throw_with_loc<std::runtime_error>
(
"Patch tree not set"
);
42
}
43
return
patch_tree
.value().get();
44
}
45
46
inline
void
free_alloc
() {
patch_tree
= std::nullopt; };
47
};
48
49
}
// namespace shamrock::solvergraph
DistributedData.hpp
IEdgeNamed.hpp
SerialPatchTree.hpp
SerialPatchTree
Definition
SerialPatchTree.hpp:35
shamrock::solvergraph::IEdgeNamed
Definition
IEdgeNamed.hpp:23
shamrock::solvergraph::SerialPatchTreeRefEdge
Definition
SerialPatchTreeEdge.hpp:29
shamrock::solvergraph::SerialPatchTreeRefEdge::patch_tree
std::optional< std::reference_wrapper< SerialPatchTree< Tvec > > > patch_tree
The patch tree.
Definition
SerialPatchTreeEdge.hpp:37
shamrock::solvergraph::SerialPatchTreeRefEdge::free_alloc
void free_alloc()
Free allocated memory.
Definition
SerialPatchTreeEdge.hpp:46
exception.hpp
This header file contains utility functions related to exception handling in the code.
shambase::throw_with_loc
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
Definition
exception.hpp:132
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8