Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
IDataEdge.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
20#include <memory>
21#include <string>
22#include <utility>
23
24namespace shamrock::solvergraph {
25
26 template<class T>
27 class IDataEdge : public IEdgeNamed {
28
29 static_assert(std::is_default_constructible_v<T>, "T must be default constructible");
30
31 public:
32 T data = {};
33
34 using IEdgeNamed::IEdgeNamed;
35
36 inline virtual void free_alloc() { data = {}; }
37
38 // No destructor here on purpose: IEdge's is already virtual, and declaring one would
39 // suppress implicit move generation, leaving IDataEdge neither movable nor copyable.
40
41 static std::shared_ptr<IDataEdge<T>> make_shared(std::string name, std::string texsymbol) {
42 return std::make_shared<IDataEdge<T>>(name, texsymbol);
43 }
44 };
45
46} // namespace shamrock::solvergraph
virtual void free_alloc()
Free allocated memory.
Definition IDataEdge.hpp:36