dune-pdelab  2.5-dev
dgparameter.hh
Go to the documentation of this file.
1 #ifndef DUNE_PDELAB_LOCALOPERATOR_DGPARAMETER_HH
2 #define DUNE_PDELAB_LOCALOPERATOR_DGPARAMETER_HH
3 
4 #warning This file is deprecated and will be removed. Use dune/pdelab/localoperator/dginteriorpenaltyparameter.hh instead!
5 
6 #include <dune/common/parametertreeparser.hh>
7 
8 namespace Dune {
9  namespace PDELab {
10 
21  template <typename RF>
22  class DUNE_DEPRECATED_MSG("DefaultInteriorPenalty is deprecated. Please use the implementation from dune/pdelab/localoperator/dginteriorpenaltyparameter.hh instead!") DefaultInteriorPenalty
23  {
24  private:
25  RF beta;
26  RF sigma;
27  RF mu;
28  public:
29 
30  DefaultInteriorPenalty(const std::string method, const RF mu_)
31  : mu(mu_)
32  {
33  std::string s = method;
34  std::transform(s.begin(), s.end(), s.begin(), tolower);
35 
36  // nipg (epsilon=1) 2d p1 -> Klaus sagt sollte auch sigma 1 klappen
37  if (s.find("nipg") != std::string::npos)
38  {
39  beta = 1;
40  if (sscanf(s.c_str(), "nipg %lg", &sigma) != 1)
41  sigma = 3.9;
42  return;
43  }
44  // sipg (epsilon=-1) 2d p1 -> Klaus sagt sigma=3.9irgendwas
45  if (s.find("sipg") != std::string::npos)
46  {
47  beta = 1;
48  if (sscanf(s.c_str(), "sipg %lg", &sigma) != 1)
49  sigma = 3.9;
50  return;
51  }
52  // obb sigma = 0, epsilon =
53  if (s == "obb")
54  {
55  beta = 1;
56  sigma = 0;
57  return;
58  }
59  // extract parameters
60  {
61  int epsilon;
62  if (3 == sscanf(s.c_str(), "%d %lg %lg", &epsilon, &sigma, &beta))
63  return;
64  }
65  DUNE_THROW(Dune::Exception, "Unknown DG type " << method);
66  }
67 
68  DefaultInteriorPenalty(const Dune::ParameterTree & config, const RF mu_)
69  : mu(mu_)
70  {
71  beta = config.get<double>("beta");
72  sigma = config.get<double>("ip_sigma");
73  }
74 
75  template<typename I>
76  RF getFaceIP(const I & ig) const
77  {
78  return mu * sigma / std::pow(ig.geometry().volume(),beta);
79  }
80  };
81 
82  } // end namespace PDELab
83 } // end namespace Dune
84 
85 #endif // DUNE_PDELAB_LOCALOPERATOR_DGPARAMETER_HH
const IG & ig
Definition: constraints.hh:148
RF getFaceIP(const I &ig) const
Definition: dgparameter.hh:76
const std::string s
Definition: function.hh:1101
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
DefaultInteriorPenalty(const std::string method, const RF mu_)
Definition: dgparameter.hh:30
DefaultInteriorPenalty(const Dune::ParameterTree &config, const RF mu_)
Definition: dgparameter.hh:68