Tatooine
steady_field.h
Go to the documentation of this file.
1#ifndef TATOOINE_STEADY_FIELD_H
2#define TATOOINE_STEADY_FIELD_H
3//==============================================================================
4#include <tatooine/field.h>
5//==============================================================================
6namespace tatooine {
7//==============================================================================
8template <typename Field>
10 : field<steady_field<Field>, typename Field::real_type,
11 Field::num_dimensions(), typename Field::tensor_type> {
12 using field_t = Field;
15 field<this_type, typename Field::real_type, Field::num_dimensions(),
16 typename Field::tensor_type>;
17 using typename parent_type::pos_type;
18 using typename parent_type::real_type;
19 using typename parent_type::tensor_type;
20 //============================================================================
21 private:
24 //============================================================================
25 public:
26 steady_field(steady_field const& other) = default;
27 steady_field(steady_field&& other) noexcept = default;
28 //----------------------------------------------------------------------------
29 auto operator=(steady_field const& other) -> steady_field& = default;
30 auto operator=(steady_field&& other) noexcept -> steady_field& = default;
31 //----------------------------------------------------------------------------
32 ~steady_field() = default;
33 //============================================================================
34 constexpr steady_field(convertible_to<Field> auto&& f, arithmetic auto fixed_time)
35 : m_internal_field{std::forward<decltype(f)>(f)},
36 m_fixed_time{static_cast<real_type>(fixed_time)} {}
37 //----------------------------------------------------------------------------
38 constexpr auto evaluate(pos_type const& x, real_type const /*t*/) const
39 -> tensor_type {
41 }
42 //----------------------------------------------------------------------------
43 constexpr auto internal() -> auto& { return m_internal_field; }
44 constexpr auto internal() const -> auto const& { return m_internal_field; }
45};
46//------------------------------------------------------------------------------
47template <typename F, typename T>
48auto steady(F const& f, T const t) {
49 return steady_field<F const&>{f, t};
50}
51//------------------------------------------------------------------------------
52template <typename F, typename T>
53auto steady(F&& f, T const t) {
54 return steady_field<std::decay_t<F>>{std::forward<F>(f), t};
55}
56//==============================================================================
57} // namespace tatooine
58//==============================================================================
59#endif
Definition: concepts.h:33
Definition: concepts.h:39
Definition: algorithm.h:6
auto steady(F const &f, T const t)
Definition: steady_field.h:48
static constexpr forward_tag forward
Definition: tags.h:9
Definition: field.h:134
Real real_type
Definition: field.h:17
vec< real_type, NumDimensions > pos_type
Definition: field.h:20
Tensor tensor_type
Definition: field.h:18
Definition: steady_field.h:11
steady_field(steady_field &&other) noexcept=default
steady_field< Field > this_type
Definition: steady_field.h:13
constexpr auto internal() const -> auto const &
Definition: steady_field.h:44
steady_field(steady_field const &other)=default
constexpr steady_field(convertible_to< Field > auto &&f, arithmetic auto fixed_time)
Definition: steady_field.h:34
Field field_t
Definition: steady_field.h:12
real_type m_fixed_time
Definition: steady_field.h:23
constexpr auto evaluate(pos_type const &x, real_type const) const -> tensor_type
Definition: steady_field.h:38
Real real_type
Definition: field.h:17
auto operator=(steady_field &&other) noexcept -> steady_field &=default
Field m_internal_field
Definition: steady_field.h:22
auto operator=(steady_field const &other) -> steady_field &=default
constexpr auto internal() -> auto &
Definition: steady_field.h:43
Definition: vec.h:12