OGS
VariableTransformation.h
Go to the documentation of this file.
1 
14 #pragma once
15 
16 #include <cmath>
17 
18 namespace ProcessLib
19 {
20 
28 struct TrafoLog
29 {
30  static const bool constrained = true;
31 
34  static double x(const double y) { return std::exp(y); }
35 
38  static double dxdy(const double x) { return x; }
39 };
40 
42 {
43  static const bool constrained = false;
44 
47  static double x(const double y) { return y; }
48 
51  static double dxdy(const double /*x*/) { return 1.0; }
52 };
53 
54 struct TrafoTanh
55 {
56  static const bool constrained = true;
57 
60  static double x(const double y) { return 0.5 * std::tanh(y) + 0.5; }
61 
64  static double dxdy(const double x) { return 2.0*x*(1.0-x); }
65 };
66 
67 struct TrafoScale
68 {
69  explicit TrafoScale(const double factor) : _factor{factor} {}
70 
71  static const bool constrained = false;
72 
75  double x(const double y) const { return y * _factor; }
76 
77  double y(const double x) const { return x / _factor; }
78 
81  double dxdy(const double /*x*/) const { return _factor; }
82 
83 private:
84  double _factor;
85 };
86 
88 } // namespace ProcessLib
static double x(const double y)
static double dxdy(const double)
static const bool constrained
static double dxdy(const double x)
static double x(const double y)
double y(const double x) const
double dxdy(const double) const
double x(const double y) const
TrafoScale(const double factor)
static double x(const double y)
static double dxdy(const double x)
static const bool constrained