1#ifndef TATOOINE_STAGGERED_FLOWMAP_DISCRETIZATION_H
2#define TATOOINE_STAGGERED_FLOWMAP_DISCRETIZATION_H
8template <
typename InternalFlowmapDiscretization>
11 using real_type =
typename internal_flowmap_discretization_type::real_type;
13 return internal_flowmap_discretization_type::num_dimensions();
18 mutable std::vector<std::unique_ptr<internal_flowmap_discretization_type>>
35 :
m_steps{std::move(other.m_steps)},
51 m_steps = std::move(other.m_steps);
57 template <
typename Flowmap,
typename... InternalFlowmapArgs>
61 InternalFlowmapArgs &&...args) {
64 m_steps.reserve(
static_cast<std::size_t
>((t_end - t0) / delta_t) + 2);
66 auto cnt = std::size_t{};
68 while (cur_t0 + eps < t0 + tau) {
69 std::cout <<
"begin of while\n";
70 auto cur_tau =
static_cast<real_type>(delta_t);
71 if (cur_t0 + cur_tau > t_end) {
75 std::cout <<
"cur_tau: " << cur_tau <<
'\n';
76 std::cout <<
"generating path\n";
79 std::cout <<
"advecting " << path <<
'\n';
81 std::forward<Flowmap>(
flowmap), cur_t0, cur_tau,
82 std::forward<InternalFlowmapArgs>(args)...});
86 std::cout <<
"writing " << path <<
'\n';
88 std::cout <<
"resetting " << path <<
'\n';
91 std::cout <<
"done with " << path <<
'\n';
99 auto step(std::size_t
const i)
const ->
auto const & {
112 auto step(std::size_t
const i) ->
auto & {
117 if (
step !=
nullptr) {
122 m_steps[i] = std::make_unique<internal_flowmap_discretization_type>(
133 for (std::size_t i = 0; i <
num_steps(); ++i) {
134 x =
step(i).sample(x, tag);
144 for (std::int64_t i =
static_cast<std::int64_t
>(
num_steps() - 1); i >= 0;
146 x =
step(i).sample(x, tag);
Definition: concepts.h:33
auto alpha_numeric_string(std::size_t const size)
Definition: random.h:83
Definition: algorithm.h:6
auto flowmap(vectorfield< V, Real, NumDimensions > const &v, tag::numerical_t)
Definition: numerical_flowmap.h:412
Definition: staggered_flowmap_discretization.h:9
staggered_flowmap_discretization(staggered_flowmap_discretization &&other) noexcept
Definition: staggered_flowmap_discretization.h:33
std::mutex m_deletion_mutex
Definition: staggered_flowmap_discretization.h:22
std::vector< filesystem::path > m_filepaths_to_steps
Definition: staggered_flowmap_discretization.h:20
auto num_steps() const
Definition: staggered_flowmap_discretization.h:97
std::vector< std::unique_ptr< internal_flowmap_discretization_type > > m_steps
Definition: staggered_flowmap_discretization.h:19
InternalFlowmapDiscretization internal_flowmap_discretization_type
Definition: staggered_flowmap_discretization.h:10
auto operator=(staggered_flowmap_discretization &&other) -> staggered_flowmap_discretization &
Definition: staggered_flowmap_discretization.h:49
auto step(std::size_t const i) -> auto &
Definition: staggered_flowmap_discretization.h:112
vec< real_type, num_dimensions()> vec_type
Definition: staggered_flowmap_discretization.h:15
staggered_flowmap_discretization(Flowmap &&flowmap, arithmetic auto const t0, arithmetic auto const tau, arithmetic auto const delta_t, InternalFlowmapArgs &&...args)
Definition: staggered_flowmap_discretization.h:58
auto sample(pos_type x, backward_tag const tag) const
Definition: staggered_flowmap_discretization.h:143
auto operator=(staggered_flowmap_discretization const &other) -> staggered_flowmap_discretization &
Definition: staggered_flowmap_discretization.h:39
bool m_write_to_disk
Definition: staggered_flowmap_discretization.h:21
auto write_to_disk(bool const w=true)
Definition: staggered_flowmap_discretization.h:95
static auto constexpr num_dimensions() -> std::size_t
Definition: staggered_flowmap_discretization.h:12
auto sample(pos_type x, forward_tag const tag) const
Definition: staggered_flowmap_discretization.h:132
typename internal_flowmap_discretization_type::real_type real_type
Definition: staggered_flowmap_discretization.h:11
staggered_flowmap_discretization(staggered_flowmap_discretization const &other)
Definition: staggered_flowmap_discretization.h:24
auto step(std::size_t const i) const -> auto const &
Definition: staggered_flowmap_discretization.h:99