/usr/include/dune/pdelab/function/scalarscaled.hh is in libdune-pdelab-dev 2.5.0~20170124g7cf9f47a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=8 sw=2 sts=2:
#ifndef DUNE_PDELAB_FUNCTION_SCALARSCALED_HH
#define DUNE_PDELAB_FUNCTION_SCALARSCALED_HH
#include <dune/pdelab/common/function.hh>
namespace Dune {
namespace PDELab {
//! Scale a GridFunction by a constant
/**
* \tparam GF The type of the GridFunction to scale
*/
template<typename GF>
class ScalarScaledGridFunctionAdapter
: public GridFunctionBase<typename GF::Traits,
ScalarScaledGridFunctionAdapter<GF> >
{
typedef typename GF::Traits T;
typedef GridFunctionBase<T, ScalarScaledGridFunctionAdapter<GF> >
Base;
typedef typename T::RangeFieldType RF;
RF factor;
GF& gf;
public:
typedef typename Base::Traits Traits;
ScalarScaledGridFunctionAdapter(RF factor_, GF& gf_)
: factor(factor_), gf(gf_)
{ }
void evaluate(const typename Traits::ElementType &e,
const typename Traits::DomainType &x,
typename Traits::RangeType &y) const {
gf.evaluate(e,x,y);
y *= factor;
}
const typename Traits::GridViewType& getGridView() const {
return gf.getGridView();
}
template<typename Time>
void setTime(Time time) { gf.setTime(time); }
};
} // namspace PDELab
} // namspace Dune
#endif // DUNE_PDELAB_FUNCTION_SCALARSCALED_HH
|