Memosa-FVM  0.2
Limiters.h
Go to the documentation of this file.
1 // This file os part of FVM
2 // Copyright (c) 2012 FVM Authors
3 // See LICENSE file for terms.
4 
5 #ifndef _LIMITERS_H_
6 #define _LIMITERS_H_
7 
8 #include <math.h>
9 
11 {
12  template<class T>
13  T operator()(const T& a, const T& b) const
14  {
15  /*
16  if (b < T(2.0)*a)
17  return (NumTypeTraits<T>::getUnity());
18 
19  const T eps(1e-16);
20  const T c = b*b + T(4.)*a*a;
21  return ((b*c+eps) / (b*b*b + a*c + eps));
22  */
23  }
24 };
25 
27 {
28  template<class T>
29  T operator()(const T a, const T b) const
30  {
31  if(b!=0.)
32  {
33  //T r = (4.*(a/b))-1.;
34  //return max(0., max(min(1., 2.*a/b), min(2., a/b)));
35  //return max(0., max(min(1., a/b), min(2., a/(2.*b))));
36  //return max(0., max(min(1., 2.*r), min(2., r)));
37  //if (b < T(2.0)*a)
38  //return (NumTypeTraits<T>::getUnity());
39 
40  const T eps(1e-16);
41  const T c = b*b + T(4.)*a*a;
42  return ((b*c+eps) / (b*b*b + a*c + eps));
43  }
44  }
45 };
46 
47 /*
48 template<class T, class LimitFunc>
49  void computeLimitCoeff(T& lc, const T x,
50  const T& dx, const T& min, const T& max, const LimitFunc& f)
51 {
52  T thislc = NumTypeTraits<T>::getUnity();
53  if (dx>0)
54  thislc = f(dx,max-x);
55  else
56  thislc = f(-dx,x-min);
57  if (thislc < lc)
58  lc = thislc;
59 }
60 */
61 
62 
63 
64 #endif
T operator()(const T a, const T b) const
Definition: Limiters.h:29
T operator()(const T &a, const T &b) const
Definition: Limiters.h:13