Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
PatchtreeFieldEdge.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
18
22#include <stdexcept>
23
24namespace shamrock::solvergraph {
25
32 template<class T>
33 class PatchtreeFieldEdge : public IEdgeNamed {
34 public:
35 using IEdgeNamed::IEdgeNamed;
36
39
41 inline sycl::buffer<T> &get_buf() const {
42 if (!bool(patchtree_field.internal_buf)) {
43 shambase::throw_with_loc<std::runtime_error>("Patch tree field not set");
44 }
45 return *patchtree_field.internal_buf;
46 }
47
48 inline void free_alloc() { patchtree_field.reset(); };
49 };
50
51} // namespace shamrock::solvergraph
Edge holding a value per node of the serial patch tree (e.g. a max reduction of a per patch value ove...
sycl::buffer< T > & get_buf() const
Get the underlying tree field buffer, throws if it is not allocated.
shamrock::patch::PatchtreeField< T > patchtree_field
The field on the patch tree nodes.
This header file contains utility functions related to exception handling in the code.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.