Diffpack Documentation


Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

FieldFunc Class Reference

scalar field defined as a C/C++ function or functor. More...

#include <FieldFunc.h>

Inheritance diagram for FieldFunc::

Field HandleId BellFunc DomainFunctor List of all members.

Public Methods

 FieldFunc (const char *name=NULL)
 FieldFunc (fxtFieldFunc f_ptr_)
 FieldFunc (const FieldFunc &f)
 ~FieldFunc ()
void operator= (fxtFieldFunc funct)
void operator= (const FieldFunc &f)
virtual bool ok () const
virtual NUMT valuePt (const Ptv(real) &x, real t=DUMMY)
virtual NUMT operator() (const Ptv(real) &x, real t) const
virtual Ptv(NUMT) derivativePt (const Ptv(real) &x, real t=DUMMY)
virtual void hessianPt (Ptv(NUMT) &, const Ptv(real) &x, real=DUMMY)
virtual NUMT valueFEM (const FiniteElement &fe, real t=DUMMY)
virtual void derivativeFEM (Ptv(NUMT) &d, const FiniteElement &fe, real t=DUMMY)
virtual void hessianFEM (Ptv(NUMT) &, const FiniteElement &fe, real=DUMMY)
virtual NUMT divergenceFEM (const FiniteElement &fe, real t=DUMMY)
void minmax (NUMT &min, NUMT &max, GridWithPts &grid, real t=DUMMY) const
virtual void minmax (NUMT &min, NUMT &max, GridWithPts *grid=NULL) const

Detailed Description

scalar field defined as a C/C++ function or functor.

NAME: FieldFunc - scalar field defined as a C/C++ function or functor

DESCRIPTION:

The class implements a scalar field defined in terms of an explicit function.

There are two ways to implement a function field in terms of a "FieldFunc" object:

1) Create a standard C or C++ function of same type as the pointer "fxtFieldFunc" which has a "typedef" definition in the "FieldFunc" header file. The function can be a static member function of some class, but not an ordinary (non-static) member function. There is automatic type conversion from an "fxtFieldFunc" function to a "FieldFunc" object.

2) Derive a new class from "FieldFunc" (use the constructor in "FieldFunc" with no arguments when initializing the base class). In the derived class one implements the virtual function "valuePt", or both "valuePt" and "operator()". Both these functions perform the same task, the only difference is that "operator()" is a const-function. If "operator()" is missing, one inherits a default "operator()" which just calls "valuePt". This type of "FieldFunc" is actually a so called functor. In the user''s class one may have references to other problem dependent classes such that data on other classes, reflecting e.g. parameters in the function, can be accessed.

One of the purposes of "FieldFunc" is to support an interface to user defined functions such that all scalar fields, whether they are explicit functions or complicated finite element functions, have a common interface. Another purpose is to offer a base class for problem dependent functors reflecting `{\em` fields`}`.

The "FieldFunc" class enables computation of the derivative of the explicit function using finite differences.

Note that there are some predefined "FieldFunc" functors: "BellFunc" for Gaussian bell functions. See the "FieldFunc.h" file.


Constructor & Destructor Documentation

FieldFunc::FieldFunc ( const char * name = NULL ) [inline]
 

FieldFunc::FieldFunc ( fxtFieldFunc f_ptr_ ) [inline]
 

See documentation of one of the overloaded constructor.

FieldFunc::FieldFunc ( const FieldFunc & f )
 

See documentation of one of the overloaded constructor.

FieldFunc::~FieldFunc ( )
 


Member Function Documentation

void FieldFunc::derivativeFEM ( Ptv(NUMT) & d,
const FiniteElement & fe,
real t = DUMMY ) [virtual]
 

Reimplemented from Field.

Ptv(NUMT) FieldFunc::derivativePt ( const Ptv(real) & x,
real t = DUMMY ) [virtual]
 

evaluates the derivative of the field at a point in space and time.

Reimplemented from Field.

NUMT FieldFunc::divergenceFEM ( const FiniteElement & fe,
real t = DUMMY ) [virtual]
 

Reimplemented from Field.

void FieldFunc::hessianFEM ( Ptv(NUMT) &,
const FiniteElement & fe,
real = DUMMY ) [virtual]
 

Reimplemented from Field.

void FieldFunc::hessianPt ( Ptv(NUMT) &,
const Ptv(real) & x,
real = DUMMY ) [virtual]
 

evaluates the hessian (2nd derivatives) of the field at a point in space and time, i.e. f,xx for nsd=1, {f,xx f,yy f,xy} for nsd=2 and {f,xx f,yy f,zz f,xy f,xz f,yz} for nsd=3.

Reimplemented from Field.

void FieldFunc::minmax ( NUMT & min,
NUMT & max,
GridWithPts * grid = NULL ) const [virtual]
 

finds the minimum and maximum values of the field. Most of the subclass fields have an internal grid and will find the extreme values over this grid. The "minmax" function has an optional argument "grid" that can be supplied. This grid is not used if the field has an internal grid. However, some fields, like "FieldFunc", do not have internal grids and in that case the "grid" argument is required in order to compute the extreme values.

Reimplemented from Field.

void FieldFunc::minmax ( NUMT & min,
NUMT & max,
GridWithPts & grid,
real t = DUMMY ) const
 

bool FieldFunc::ok ( ) const [inline, virtual]
 

returns true if the object is initialized, for the base class "Field" it just writes an error messages such that if a derived class fails to define an "ok" function, an error message will be written.

Reimplemented from Field.

NUMT FieldFunc::operator() ( const Ptv(real) & x,
real t ) const [virtual]
 

Reimplemented in BellFunc.

void FieldFunc::operator= ( const FieldFunc & f )
 

void FieldFunc::operator= ( fxtFieldFunc funct )
 

NUMT FieldFunc::valueFEM ( const FiniteElement & fe,
real t = DUMMY ) [virtual]
 

evaluates the field at a point in space and time, but the argument is a "FiniteElement" object which means that the evaluation process in a finite element context will be very efficient (since "FiniteElement" knows the element number and the local coordinates of the spatial point). The function is virtual and offers a unified interface to the evaluation of all types of fields in a finite element based simulator.

Reimplemented from Field.

NUMT FieldFunc::valuePt ( const Ptv(real) & x,
real t = DUMMY ) [virtual]
 

evaluates the function. This is a non-const function and it is also virtual in the "Field" base class.

Reimplemented from Field.

Reimplemented in BellFunc.


The documentation for this class was generated from the following file:
Copyright © 2003 inuTech GmbH. All rights reserved.