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