Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

PiecewiseFunction Class Reference

Piecewise function object. More...

#include <piecewiseFunction.h>

Inheritance diagram for PiecewiseFunction:

PiecewisePolynomial List of all members.

Public Member Functions

Constructors and Destructors
 PiecewiseFunction () throw ()
 Default constructor.
 PiecewiseFunction (const PiecewiseFunction &function) throw ()
 Copy constructor.
 PiecewiseFunction (const std::vector< Interval > &intervals, const std::vector< Coefficients > &coeffs) throw ()
 Detailed constructor.
virtual ~PiecewiseFunction () throw ()
 Destructor.
Assignment
PiecewiseFunctionoperator= (const PiecewiseFunction &function) throw ()
 Assignemnt operator.
void clear () throw ()
 Clear function.
Accessors
void setIntervals (const std::vector< Interval > &intervals) throw ()
 Set the intervals for the piecewise definition.
const std::vector< Interval > & getIntervals () const throw ()
 Get all the intervals.
const Interval & getInterval (double x) const throw (Exception::OutOfRange)
 Get the interval a given x belongs to.
const Interval & getInterval (Position index) const throw (Exception::IndexOverflow)
 Get interval limits by index.
Position getIntervalIndex (double x) const throw (Exception::OutOfRange)
 Get the interval index for a given x.
const Interval & getRange () const throw ()
 Return the range of the definition.
void setCoefficients (const vector< Coefficients > &coefficients) throw ()
 Set the coefficients.
const std::vector< Coefficients > & getCoefficients () const throw ()
const CoefficientsgetCoefficients (double x) const throw (Exception::OutOfRange)
 Get the coefficients for a given x.
const CoefficientsgetCoefficients (Position index) const throw (Exception::IndexOverflow)
 get coefficients from index
virtual double operator() (double x) const throw ()
 compute the value of the piecewise function data for a given x
void set (const std::vector< Interval > &intervals, const std::vector< Coefficients > &coeffs) throw ()
Predicates
bool isInRange (double x) const throw ()
 Check whether a given x is in the range of definition.
virtual bool isValid () const throw ()
 check validity of the definition
bool operator== (const PiecewiseFunction &function) const throw ()
 Equality operator.
Debugging and Diagnostics
virtual void dump (std::ostream &s=std::cout, Size depth=0) const throw ()
 Dumps the whole content of the object.

Protected Attributes

std::vector< Interval > intervals_
std::vector< Coefficientscoefficients_
bool valid_

Detailed Description

Piecewise function object.

This class provides the interface for piecewise functions needed as representation of radial distribution functions (

See also:
RadialDistributionFunction). It implements the Function interface.
Note that intervals must be disjunct and interval limits have to meet. We require the intervals to be sorted such that the lowest interval limit is the first interval of the vector.


Member Function Documentation

void PiecewiseFunction::setCoefficients const vector< Coefficients > &  coefficients  )  throw ()
 

Set the coefficients.

Note that this method does not check the vector of coefficients for sanity.

void PiecewiseFunction::setIntervals const std::vector< Interval > &  intervals  )  throw ()
 

Set the intervals for the piecewise definition.

Note that this method does not check the definition of the intervals for sanity.