NAME
FieldConst - constant scalar field
INCLUDE
include "FieldConst.h"
SYNTAX
class FieldConst : public Field
{
NUMT constvalue;
public:
FieldConst (const char* name = NULL);
FieldConst (NUMT value, const char* name = NULL);
~FieldConst () {}
virtual bool ok () const;
virtual void minmax (NUMT& min, NUMT& max, GridWithPts* grid =NULL) const;
NUMT& value () { return constvalue; }
NUMT value () const { return constvalue; }
virtual NUMT valuePt (const Ptv(real)& x, real t = DUMMY);
virtual NUMT valueFEM (const FiniteElement& fe, real t = DUMMY);
virtual Ptv(NUMT) derivativePt (const Ptv(real)& x, real t);
virtual void derivativeFEM (Ptv(NUMT)& d, const FiniteElement& fe,
real t = DUMMY);
virtual void fill (NUMT value);
virtual void add (NUMT value);
virtual void mult (NUMT value);
virtual void apply (Func(NUMT) f);
virtual void add (Field& field, int power, NUMT front_factor);
virtual void print (Os os) const;
virtual Field& scale ();
virtual Field& unscale ();
CLASS_INFO
VIRTUAL_CAST(FieldConst)
};
KEYWORDS
scalar field, constant
DESCRIPTION
The class implements a scalar field that is simply a constant.
It may seem as an overkill to have a special field class with
lots of virtual functions to represent a constant value. However,
the purpose is to offer a complete scalar field hierarchy such
that the programmer can work with a general Field without knowing
whether the field is actually a complicated finite element, an
explicit function or a constant. The FieldConst ensures that con
stant fields has the same interface as all other fields. At the
same time, the FieldConst gives (nearly) optimal efficiency when
the field is constant.
With the class Field documentation, the functions and the data
should be self-explanatory.
SEE ALSO
class Field.
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Hans Petter Langtangen, SINTEF/UiO