Function< TYPE > Class Template Reference

Represents an arbitrary function defined on an element. More...

#include <function.h>

Inherits Transformable.

Inherited by MeshFunction, and PrecalcShapeset.

List of all members.

Classes

struct  Node

Public Member Functions

 Function ()
 Default constructor.
virtual ~Function ()
 Destructor.
int get_fn_order () const
 Returns the polynomial degree of the function being represented by the class.
int get_num_components () const
 Returns the number of components of the function being represented by the class.
void set_quad_order (int order, int mask=H2D_FN_DEFAULT)
 Activates an integration rule of the specified order. Subsequent calls to get_values(), get_dx_values() etc. will be returning function values at these points.
TYPE * get_fn_values (int component=0)
 Returns function values.
TYPE * get_dx_values (int component=0)
 Returns the x partial derivative.
TYPE * get_dy_values (int component=0)
 Returns the y partial derivative.
void get_dx_dy_values (TYPE *&dx, TYPE *&dy, int component=0)
 Returns both x and y partial derivatives. This function provides the both often-used dx and dy values in one call.
TYPE * get_dxx_values (int component=0)
 Returns the second x partial derivative.
TYPE * get_dyy_values (int component=0)
 Returns the second y partial derivative.
TYPE * get_dxy_values (int component=0)
 Returns the second mixed derivative.
TYPE * get_values (int a, int b)
 For internal use.
virtual void set_quad_2d (Quad2D *quad_2d)
 Selects the quadrature points in which the function will be evaluated.
Quad2Dget_quad_2d () const
 Returns the current quadrature points.
virtual void push_transform (int son)
 See Transformable::push_transform().
virtual void pop_transform ()
 See Transformable::pop_transform().
virtual void free ()=0
 Frees all precalculated tables.

Protected Member Functions

virtual void precalculate (int order, int mask)=0
 precalculates the current function at the current integration points.
void update_nodes_ptr ()
void force_transform (uint64_t sub_idx, Trf *ctm)
 For internal use only.
Nodenew_node (int mask, int num_points)
 allocates a new Node structure
void free_nodes (void **nodes)
void free_sub_tables (void **sub)
void handle_overflow_idx ()
void replace_cur_node (Node *node)
void H2D_CHECK_ORDER (Quad2D *quad, int order)

Protected Attributes

int order
 current function polynomial order
int num_components
 number of vector components
void ** sub_tables
 pointer to the current secondary Judy array
void ** nodes
 pointer to the current tertiary Judy array FIXME
void ** pp_cur_node
void * overflow_nodes
Nodecur_node
Quad2Dquads [4]
 list of available quadratures
int cur_quad
 active quadrature (index into 'quads')
int total_mem
 total memory in bytes used by the tables
int max_mem
 peak memory usage

Static Protected Attributes

static int idx2mask [6][2]
 index to mask table

Detailed Description

template<typename TYPE>
class Function< TYPE >

Represents an arbitrary function defined on an element.

The Function class is an abstraction of a function defined in integration points on an element. You first specify what quadrature tables you want to use (set_quad_2d()) and select an element (Transformable::set_active_element()). Then you select concrete integration points (set_quad_order()) and obtain the function values by calling one of the functions get_fn_values(), get_dx_values(), etc.

This class is a template for RealFunction and ScalarFunction, depending of which type the function values are. For example, shape functions are always real (see PrecalcShapeset), while the solution can be complex (see Solution).

The design goal for this class is to define a single common interface for functions used as integrands in the weak formulation. It should not matter whether you are integrating a shape function or, for example, a previous solution of the PDE in time-dependent problems. Ideally, you should also be able to apply the bilinear form not only to shape functions during assembling, but also to the solution when calculating energy norms etc. The last feature is unfortunately limited to real code, because a PDE solution can be complex (hence Solution inherits from ScalarFunction), but shape functions are real and for efficiency the bilinear form only takes RealFunction arguments.

Since this class inherits from Transformable, you can obtain function values in integration points transformed to sub-areas of the current element (see push_transform(), pop_transform()).


Constructor & Destructor Documentation

template<typename TYPE >
Function< TYPE >::Function (  )  [inline]

Default constructor.

template<typename TYPE >
Function< TYPE >::~Function (  )  [inline, virtual]

Destructor.


Member Function Documentation

template<typename TYPE>
void Function< TYPE >::force_transform ( uint64_t  sub_idx,
Trf ctm 
) [inline, protected]

For internal use only.

Reimplemented in PrecalcShapeset, and MeshFunction.

template<typename TYPE>
virtual void Function< TYPE >::free (  )  [pure virtual]

Frees all precalculated tables.

Implemented in Filter, PrecalcShapeset, and Solution.

template<typename TYPE >
void Function< TYPE >::free_nodes ( void **  nodes  )  [inline, protected]
template<typename TYPE >
void Function< TYPE >::free_sub_tables ( void **  sub  )  [inline, protected]
template<typename TYPE>
void Function< TYPE >::get_dx_dy_values ( TYPE *&  dx,
TYPE *&  dy,
int  component = 0 
) [inline]

Returns both x and y partial derivatives. This function provides the both often-used dx and dy values in one call.

Parameters:
dx [out] Variable which receives the pointer to the first partial derivatives by x
dy [out] Variable which receives the pointer to the first partial derivatives by y
component [in] The component of the function (0 or 1).
template<typename TYPE>
TYPE* Function< TYPE >::get_dx_values ( int  component = 0  )  [inline]

Returns the x partial derivative.

Parameters:
component [in] The component of the function (0 or 1).
Returns:
The x partial derivative of the function at all points of the current integration rule.
template<typename TYPE>
TYPE* Function< TYPE >::get_dxx_values ( int  component = 0  )  [inline]

Returns the second x partial derivative.

Parameters:
component [in] The component of the function (0 or 1).
Returns:
The x second partial derivative of the function at all points of the current integration rule.
template<typename TYPE>
TYPE* Function< TYPE >::get_dxy_values ( int  component = 0  )  [inline]

Returns the second mixed derivative.

Parameters:
component [in] The component of the function (0 or 1).
Returns:
The second mixed derivative of the function at all points of the current integration rule.
template<typename TYPE>
TYPE* Function< TYPE >::get_dy_values ( int  component = 0  )  [inline]

Returns the y partial derivative.

Parameters:
component [in] The component of the function (0 or 1).
Returns:
The y partial derivative of the function at all points of the current integration rule.
template<typename TYPE>
TYPE* Function< TYPE >::get_dyy_values ( int  component = 0  )  [inline]

Returns the second y partial derivative.

Parameters:
component [in] The component of the function (0 or 1).
Returns:
The y second partial derivative of the function at all points of the current integration rule.
template<typename TYPE>
int Function< TYPE >::get_fn_order (  )  const [inline]

Returns the polynomial degree of the function being represented by the class.

template<typename TYPE>
TYPE* Function< TYPE >::get_fn_values ( int  component = 0  )  [inline]

Returns function values.

Parameters:
component [in] The component of the function (0 or 1).
Returns:
The values of the function at all points of the current integration rule.
template<typename TYPE>
int Function< TYPE >::get_num_components (  )  const [inline]

Returns the number of components of the function being represented by the class.

template<typename TYPE>
Quad2D* Function< TYPE >::get_quad_2d (  )  const [inline]

Returns the current quadrature points.

template<typename TYPE>
TYPE* Function< TYPE >::get_values ( int  a,
int  b 
) [inline]

For internal use.

template<typename TYPE>
void Function< TYPE >::H2D_CHECK_ORDER ( Quad2D quad,
int  order 
) [inline, protected]
template<typename TYPE >
void Function< TYPE >::handle_overflow_idx (  )  [inline, protected]
template<typename TYPE >
Function< TYPE >::Node * Function< TYPE >::new_node ( int  mask,
int  num_points 
) [inline, protected]

allocates a new Node structure

template<typename TYPE >
void Function< TYPE >::pop_transform (  )  [inline, virtual]

See Transformable::pop_transform().

Reimplemented from Transformable.

Reimplemented in Filter.

template<typename TYPE>
virtual void Function< TYPE >::precalculate ( int  order,
int  mask 
) [protected, pure virtual]

precalculates the current function at the current integration points.

Implemented in SimpleFilter, DXDYFilter, VonMisesFilter, LinearFilter, PrecalcShapeset, and Solution.

template<typename TYPE >
void Function< TYPE >::push_transform ( int  son  )  [inline, virtual]

See Transformable::push_transform().

Reimplemented from Transformable.

Reimplemented in Filter.

template<typename TYPE>
void Function< TYPE >::replace_cur_node ( Node node  )  [inline, protected]
template<typename TYPE >
void Function< TYPE >::set_quad_2d ( Quad2D quad_2d  )  [inline, virtual]

Selects the quadrature points in which the function will be evaluated.

It is possible to switch back and forth between different quadrature points: no precalculated values are freed. The standard quadrature is always selected by default already.

Parameters:
quad_2d [in] The quadrature points.

Reimplemented in Filter, PrecalcShapeset, and MeshFunction.

template<typename TYPE>
void Function< TYPE >::set_quad_order ( int  order,
int  mask = H2D_FN_DEFAULT 
) [inline]

Activates an integration rule of the specified order. Subsequent calls to get_values(), get_dx_values() etc. will be returning function values at these points.

Parameters:
order [in] Integration rule order.
mask [in] A combination of one or more of the constants H2D_FN_VAL, H2D_FN_DX, H2D_FN_DY, H2D_FN_DXX, H2D_FN_DYY, H2D_FN_DXY specifying the values which should be precalculated. The default is H2D_FN_VAL | H2D_FN_DX | H2D_FN_DY. You can also use H2D_FN_ALL to precalculate everything.
template<typename TYPE>
void Function< TYPE >::update_nodes_ptr (  )  [inline, protected]

Member Data Documentation

template<typename TYPE>
Node* Function< TYPE >::cur_node [protected]
template<typename TYPE>
int Function< TYPE >::cur_quad [protected]

active quadrature (index into 'quads')

template<typename TYPE>
int Function< TYPE >::idx2mask [inline, static, protected]
template<typename TYPE>
int Function< TYPE >::max_mem [protected]

peak memory usage

template<typename TYPE>
void** Function< TYPE >::nodes [protected]

pointer to the current tertiary Judy array FIXME

template<typename TYPE>
int Function< TYPE >::num_components [protected]

number of vector components

template<typename TYPE>
int Function< TYPE >::order [protected]

current function polynomial order

template<typename TYPE>
void* Function< TYPE >::overflow_nodes [protected]
template<typename TYPE>
void** Function< TYPE >::pp_cur_node [protected]
template<typename TYPE>
Quad2D* Function< TYPE >::quads[4] [protected]

list of available quadratures

template<typename TYPE>
void** Function< TYPE >::sub_tables [protected]

pointer to the current secondary Judy array

template<typename TYPE>
int Function< TYPE >::total_mem [protected]

total memory in bytes used by the tables


The documentation for this class was generated from the following file:
Generated on Sat Jun 5 15:17:43 2010 for Hermes2D Library: Real Version by  doxygen 1.6.3