Provided by: librheolef-dev_6.7-6_amd64

**NAME**

field_functor- a functor wrapper suitable for field expressions (obsolete)

**DESCRIPTION**

This class is now obsolete, from Rheolef version 6.7 and is maintained for backward compatibility purpose only. Until Rheolef version 6.6, this class was used to mark functors with profil compatible with fields, i.e. that acceptspointas parameter and returns a field value (scalar, vector, tensor). This mark was used to filter field expression arguments ininterpolateandintegrate. From version 6.7, this mark is no more required, and any function or functor that is callable with apointas argument is valid in a field expression. A functor is a class-function, i.e. a class that defines theoperator(). A variablefof a class-function can be used asf(arg)and when its argument is of typepointsee point(2), the functionfinterprets as a continuous field field. Thus, it can be interpolated see interpolate(4) and it can be combined within field expressions see field(2) that appears in arguments of see integrate(4).

**EXAMPLE**

struct f : field_functor<f,Float> { Float operator() (const point& x) const { return 1-norm(x); } }; // ... geo omega ("square"); space Xh (omega, "P1"); field fh = interpolate (Xh, f); test (Xh); field lh = integrate (f*v);

**IMPLEMENTATION** **NOTE**

The current implementation of afield_functorclass bases on the curiously recurring template pattern (CRTP) C++ idiom: the definition of the classfderives fromfield_functor<f,Float> that depend itself uponf. So, be carrefull when using copy-paste, as there is no checks if you write e.g.field_functor<g,Float> with another functionginstead off.

**IMPLEMENTATION**

template <class Function, class Result> struct field_functor : std::unary_function<point_basic<float_traits<Result> >,Result> { const Function& get_ref() const { return static_cast<const Function&>(*this); } operator Function() const { return get_ref(); } Result operator() (const point& x) const { return get_ref().operator()(x); } };

**SEE** **ALSO**

point(2), interpolate(4), field(2), integrate(4)