/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/data/output_path.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/data/output_path.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
output_path.hh
Go to the documentation of this file.
1#pragma once
2
4
5#include <filesystem>
6#include <memory>
7#include <string>
8#include <string_view>
9
10namespace DiFfRG
11{
13
16 {
17 public:
18 OutputPath() = delete;
19 OutputPath(std::filesystem::path root, std::string run_name, std::filesystem::path field_directory = "output");
20 explicit OutputPath(const ConfigTree &config);
21
23 std::string run_name = "output", std::filesystem::path field_directory = "output");
24
25 OutputPath(const OutputPath &) = default;
26 OutputPath &operator=(const OutputPath &) = default;
27 OutputPath(OutputPath &&) noexcept = default;
28 OutputPath &operator=(OutputPath &&) noexcept = default;
29
30 const std::filesystem::path &root() const noexcept { return root_path; }
31 const std::string &run_name() const noexcept { return output_name; }
32 const std::filesystem::path &field_directory() const noexcept { return fields_path; }
33
34 std::filesystem::path resolve(std::filesystem::path relative) const;
35 std::filesystem::path run_file(std::string_view extension) const;
37 std::filesystem::path run_file(std::string_view name_suffix, std::string_view extension) const;
38 OutputPath child(std::filesystem::path directory, std::string run_name,
39 std::filesystem::path field_directory = "output") const;
40 void copy_tree_from(const std::filesystem::path &source) const;
41
42 static std::filesystem::path checked_relative(std::filesystem::path path, std::string_view kind = "output path");
43
44 private:
45 class OutputRoot;
46 OutputPath(std::filesystem::path root, std::string run_name, std::filesystem::path field_directory,
47 std::shared_ptr<const OutputRoot> output_root);
48
49 std::filesystem::path root_path;
50 std::string output_name;
51 std::filesystem::path fields_path;
52 std::shared_ptr<const OutputRoot> output_root;
53 };
54} // namespace DiFfRG
A hierarchical configuration tree, readable from JSON and TOML files.
Definition config_tree.hh:32
Definition output_path.hh:16
const std::string & run_name() const noexcept
Definition output_path.hh:31
std::string output_name
Definition output_path.hh:50
static std::filesystem::path checked_relative(std::filesystem::path path, std::string_view kind="output path")
OutputPath(std::filesystem::path root, std::string run_name, std::filesystem::path field_directory, std::shared_ptr< const OutputRoot > output_root)
std::filesystem::path root_path
Definition output_path.hh:49
OutputPath(std::filesystem::path root, std::string run_name, std::filesystem::path field_directory="output")
std::filesystem::path run_file(std::string_view extension) const
OutputPath child(std::filesystem::path directory, std::string run_name, std::filesystem::path field_directory="output") const
OutputPath & operator=(const OutputPath &)=default
std::filesystem::path fields_path
Definition output_path.hh:51
const std::filesystem::path & root() const noexcept
Definition output_path.hh:30
OutputPath(OutputPath &&) noexcept=default
std::filesystem::path run_file(std::string_view name_suffix, std::string_view extension) const
std::shared_ptr< const OutputRoot > output_root
Definition output_path.hh:52
void copy_tree_from(const std::filesystem::path &source) const
const std::filesystem::path & field_directory() const noexcept
Definition output_path.hh:32
std::filesystem::path resolve(std::filesystem::path relative) const
OutputPath(const ConfigTree &config)
OutputPath(const OutputPath &)=default
static OutputPath temporary(TemporaryRetention retention=TemporaryRetention::remove_on_destruction, std::string run_name="output", std::filesystem::path field_directory="output")
Definition complex_math.hh:10
TemporaryRetention
Definition output_path.hh:12
@ config
/discretization/threads.