Tatooine
vorticity_field.h
Go to the documentation of this file.
1#ifndef TATOOINE_VORTICITY_FIELD_H
2#define TATOOINE_VORTICITY_FIELD_H
3
4#include "field.h"
5#include "diff.h"
6
7//==============================================================================
8namespace tatooine {
9//==============================================================================
10
11template <typename V>
13 : public field<vorticity_field<V>, typename V::real_type, 3, 3> {
14 //============================================================================
15 // typedefs
16 //============================================================================
17 public:
18 using real_type = typename V::real_type;
20 using parent_t =
21 field<this_type, real_type, V::num_dimensions(), V::tensor_type::dimension(0)>;
22 using typename parent_t::tensor_type;
23 using typename parent_t::pos_type;
24 //============================================================================
25 // fields
26 //============================================================================
27 private:
29
30 //============================================================================
31 // ctor
32 //============================================================================
33 public:
34 template <typename Real>
36
37 //============================================================================
38 // methods
39 //============================================================================
40 public:
41 constexpr tensor_type evaluate(const pos_type& x, real_type t) const {
42 const auto Jf = diff(m_vf);
43 const auto J = Jf(x, t);
44 return {J(2, 1) - J(1, 2), J(0, 2) - J(2, 0), J(1, 0) - J(0, 1)};
45 }
46 //----------------------------------------------------------------------------
47 constexpr bool in_domain(const pos_type& x, real_type t) const {
48 return m_vf.in_domain(x, t);
49 }
50};
51//==============================================================================
52template <typename V, typename Real>
54 return vorticity_field<V>{vf.as_derived()};
55}
56//==============================================================================
57} // namespace tatooine
58//==============================================================================
59
60#endif
Definition: vorticity_field.h:13
V m_vf
Definition: vorticity_field.h:28
vorticity_field< V > this_type
Definition: vorticity_field.h:19
constexpr tensor_type evaluate(const pos_type &x, real_type t) const
Definition: vorticity_field.h:41
constexpr bool in_domain(const pos_type &x, real_type t) const
Definition: vorticity_field.h:47
vorticity_field(const field< V, Real, 3, 3 > &v)
Definition: vorticity_field.h:35
typename V::real_type real_type
Definition: vorticity_field.h:18
Definition: algorithm.h:6
auto vorticity(const field< V, Real, 3, 3 > &vf)
Definition: vorticity_field.h:53
constexpr auto diff(polynomial< Real, Degree > const &f)
Definition: polynomial.h:179
Definition: field.h:134
vec< real_type, NumDimensions > pos_type
Definition: field.h:20
Tensor tensor_type
Definition: field.h:18
auto as_derived() -> auto &
Definition: field.h:161
constexpr auto in_domain(const pos_type &, double) const
Definition: symbolic_field.h:50
Definition: vec.h:12