ConstantFunction< dim > Class Template Reference
[Functions]

Inheritance diagram for ConstantFunction< dim >:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ConstantFunction (const double value, const unsigned int n_components=1)
virtual ~ConstantFunction ()
virtual double value (const Point< dim > &p, const unsigned int component) const
virtual void vector_value (const Point< dim > &p, Vector< double > &return_value) const
virtual void value_list (const std::vector< Point< dim > > &points, std::vector< double > &values, const unsigned int component=0) const
virtual void vector_value_list (const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
unsigned int memory_consumption () const

Protected Attributes

const double function_value


Detailed Description

template<int dim>
class ConstantFunction< dim >

Provide a function which always returns the constant value handed to the constructor.

Obviously, the derivates of this function are zero, which is why we derive this class from ZeroFunction: we then only have to overload the value functions, not all the derivatives. In some way, it would be more obvious to do the derivation in the opposite direction, i.e. let ZeroFunction be a more specialized version of ConstantFunction; however, this would be less efficient, since we could not make use of the fact that the function value of the ZeroFunction is known at compile time and need not be looked up somewhere in memory.

You can pass to the constructor an integer denoting the number of components this function shall have. It defaults to one. If it is greater than one, then the function will return the constant value in all its components, which might not be overly useful a feature in most cases, however.

Author:
Wolfgang Bangerth, 1998, 1999

Constructor & Destructor Documentation

template<int dim>
ConstantFunction< dim >::ConstantFunction ( const double  value,
const unsigned int  n_components = 1 
)

Constructor; takes the constant function value as an argument. The number of components is preset to one.

template<int dim>
virtual ConstantFunction< dim >::~ConstantFunction (  )  [virtual]

Virtual destructor; absolutely necessary in this case.


Member Function Documentation

template<int dim>
virtual double ConstantFunction< dim >::value ( const Point< dim > &  p,
const unsigned int  component 
) const [virtual]

Return the value of the function at the given point for one component.

Reimplemented from ZeroFunction< dim >.

template<int dim>
virtual void ConstantFunction< dim >::vector_value ( const Point< dim > &  p,
Vector< double > &  return_value 
) const [virtual]

Return the value of the function at the given point for all components.

Reimplemented from ZeroFunction< dim >.

Reimplemented in ComponentSelectFunction< dim >.

template<int dim>
virtual void ConstantFunction< dim >::value_list ( const std::vector< Point< dim > > &  points,
std::vector< double > &  values,
const unsigned int  component = 0 
) const [virtual]

Set values to the point values of the function at the points, for the given component. It is assumed that values already has the right size, i.e. the same size as the points array.

Reimplemented from ZeroFunction< dim >.

template<int dim>
virtual void ConstantFunction< dim >::vector_value_list ( const std::vector< Point< dim > > &  points,
std::vector< Vector< double > > &  values 
) const [virtual]

Set values to the point values of the function at the points, for all components. It is assumed that values already has the right size, i.e. the same size as the points array.

Reimplemented from ZeroFunction< dim >.

Reimplemented in ComponentSelectFunction< dim >.

template<int dim>
unsigned int ConstantFunction< dim >::memory_consumption (  )  const

Determine an estimate for the memory consumption (in bytes) of this object. Since sometimes the size of objects can not be determined exactly (for example: what is the memory consumption of an STL std::map type with a certain number of elements?), this is only an estimate. however often quite close to the true value.

Reimplemented from Function< dim >.

Reimplemented in ComponentSelectFunction< dim >.


Member Data Documentation

template<int dim>
const double ConstantFunction< dim >::function_value [protected]

Store the constant function value.


The documentation for this class was generated from the following file:

deal.II documentation generated on Sat Aug 15 16:51:44 2009 by doxygen 1.5.9