20 #ifndef __mast_simp_heaviside_filter_h__ 21 #define __mast_simp_heaviside_filter_h__ 28 namespace Optimization {
36 template <
typename ScalarType,
typename FieldType>
60 inline ScalarType
filter(ScalarType s)
const {
71 ScalarType ds)
const {
81 template <
typename ContextType>
82 inline ScalarType
value(
const ContextType& c)
const {
84 Assert0(
_v,
"Scalar field not initialized");
93 template <
typename ContextType,
typename ScalarFieldType>
95 const ScalarFieldType& f)
const {
97 Assert0(
_v,
"Scalar field not initialized");
99 return ((1.-pow(tanh(
_beta*(
_v->value(c)-
_eta)),2))*
116 #endif // __mast_simp_heaviside_filter_h__
ScalarType value(const ContextType &c) const
This class implements the Heaviside filter defined as .
void set_field(const FieldType &v)
ScalarType filter_derivative(ScalarType s, ScalarType ds) const
a function to compute the filtered value for given scalar s
ScalarType filter(ScalarType s) const
a function to compute the filtered value for given scalar s
ScalarType derivative(const ContextType &c, const ScalarFieldType &f) const
virtual ~HeavisideFilter()
#define Assert0(cond, msg)
void set_parameters(const real_t beta, const real_t eta)