NAME
FieldWithPtValues - base class for fields having point values
INCLUDE
include "FieldWithPtValues.h"
SYNTAX
class FieldWithPtValues : public Field
{
protected:
FieldWithPtValues (const char* name = NULL) : Field(name) {}
public:
~FieldWithPtValues () {}
virtual NUMT& valuePoint (int point_no) =0;
virtual NUMT valuePoint (int point_no) const =0;
virtual Ptv(real) getPt (int point_no) const =0;
virtual int getNoPoints () const =0;
virtual int getNoValues () const =0;
virtual GridWithPts& getGridWithPts () =0;
virtual const GridWithPts& getGridWithPts () const =0;
virtual Vec(NUMT)& valuesVec () =0;
virtual const Vec(NUMT)& valuesVec () const =0;
CLASS_INFO
VIRTUAL_CAST(FieldWithPtValues)
};
KEYWORDS
scalar field, base class, point values
DESCRIPTION
The class serves as base class for all field classes where it is
meaningful to consider the field as a grid, containing grid
points, and an array with the field values at the grid points.
Most fields used for numerical computations are of this type.
However, there are important exceptions. Galerkin or collocation
methods utilizing global test and trial functions (for example,
sine/cosine) give rise to a field abstraction where the basis
functions can be viewed as the grid and the coefficients in the
expansion is naturally collected in an array. However, this array
does not reflect the field values at grid points.
The purpose of the class is to offer a unified interface to some
important field representations. One very convenient application
is the generation of stochastic fields. Most algorithms for such
problems are based on manipulating field values at discrete
points in space. Representing the field as a FieldWithPtValues
handle (or reference or pointer) makes it easy to code an algo
rithm that applies to finite difference fields over regular uni
form grids (FieldLattice), scattered point fields (FieldScatPt)
and finite element fields (FieldFE).
CONSTRUCTORS AND INITIALIZATION
There is no data in the class so there is no specific initializa
tion requirement. The only constructor takes no arguments, or a
field name, and has an empty body.
MEMBER FUNCTIONS
valuePoint - returns access to the field value at a spatial
point. The point is given by its point number. (If the point is
known by its coordinates and not the point number, one can use
the valuePt function, see class Field).
getPt - returns the coordinate of a point. The point is given by
its point number in the grid.
getNoPoints - returns the number of points in the grid.
getNoValues - returns the number of field values (usually equal
to the number of points).In a GridLattice grid one can think of a
finite difference field defined at the cell centers. Then the
number of grid points does not coincide with the number of field
values. However, the field is typically characterized as being
defined at a finite number of spatial points.
getGridWithPts - gives access to the grid object associated with
the FieldWithPtValues object. The corresponding base class for
grid with discrete points is GridWithPts.
SEE ALSO
class Fields
DEVELOPED BY
SINTEF Applied Mathematics, Oslo, Norway, and University of Oslo,
Dept. of Mathematics, Norway
AUTHOR
Hans Petter Langtangen, SINTEF/UiO