20 #ifndef __mast_simp_penalized_scalar_h__ 21 #define __mast_simp_penalized_scalar_h__ 28 namespace Optimization {
32 template <
typename ScalarType,
typename PenalizedDensityType>
50 const ScalarType vmin) {
55 template <
typename ContextType>
56 inline ScalarType
value(
const ContextType& c)
const {
58 Assert0(
_d,
"Density field not initialized");
63 template <
typename ContextType,
typename ScalarFieldType>
65 const ScalarFieldType& f)
const {
67 Assert0(
_d,
"Density field not initialized");
69 return _v0 *
_d->derivative(c, f);
77 const PenalizedDensityType *
_d;
84 #endif // __mast_simp_penalized_scalar_h__ ScalarType value(const ContextType &c) const
virtual ~PenalizedScalar()
void set_scalar(const ScalarType v0, const ScalarType vmin)
void set_density(const PenalizedDensityType &d)
const PenalizedDensityType * _d
ScalarType derivative(const ContextType &c, const ScalarFieldType &f) const
#define Assert0(cond, msg)