Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# PotentialfieldFunction Class Reference

An abstract class representing a function in a potential field. More...

`#include <PotentialFunctions.h>`

Inheritance diagram for PotentialfieldFunction:

[legend]
List of all members.

## Public Member Functions
virtual double | computeValue (double x, bool smooth=true)
| Computes the value of the function for a given x including range checking and smoothing.
virtual double | computeDerivativeValue (double x, bool smooth=false)
| Computes the value of the derivative of the function for a given x including range checking and smoothing.
virtual PotentialfieldFunction * | clone ()=0
| Clones a function object.
double | getRange ()
| Returns the range of the function.
void | setParameters (double atZero, double range)
| Sets the two main parameters, recomputes smoothing parameters.
void | setSmoothingParameters (double smoothingAtObject, double smoothingAtBorder, double gradientAtObject, double gradientAtBorder)
| Sets parameters for smoothing at the end of the function's interval Both values have a range from 0.0 to 1.0.
## Protected Member Functions
double | computeSmoothedValue (double x1, double fx1, double dx1, double x2, double fx2, double dx2, double x)
| Generates a smooth curve between two points and computes function value of a given x.
virtual double | f (double x) const
| Computes the value of the function for a given x.
virtual double | d (double x) const
| Computes the value of the derivative of the function for a given x.
virtual double | dd (double x) const
| Computes the value of the second derivative of the function for a given x.
virtual void | init ()
| Computes the values of a and b.
void | getStandardParameters (PotentialfieldFunction *other)
| Sets standard parameters from other function.
## Protected Attributes
double | smoothingAtObjectPosition
| Last position of smoothing near object.
double | smoothingAtBorderPosition
| First position of smoothing near the end of the range.
double | gradientAtObject
| The gradient at the object (used together with smoothing).
double | gradientAtBorder
| The gradient at (range,0) (used together with smoothing).
double | smoothingAtObjectPercentage
| Smoothing near object [0.0, .., 1.0].
double | smoothingAtBorderPercentage
| Smoothing near the end of the range [0.0, .., 1.0].
double | atZero
| The value of f(0).
double | range
| f(range) = 0
double | a
| Internal variable for faster computation set by init().
double | b
| Internal variable for faster computation set by init().

## Detailed Description

An abstract class representing a function in a potential field.

Definition at line 38 of file PotentialFunctions.h.

## Member Function Documentation

double PotentialfieldFunction::computeValue | ( | double | x,
|  | bool | smooth = true
| ) | `[virtual]`

  | Computes the value of the function for a given x including range checking and smoothing. Parameters:
  x | The distance for which to compute the value of the function
  smooth | Flag: Use smoothing, if true
Returns: The value of the function Reimplemented in SocialFunction, and NoFunction. Definition at line 15 of file PotentialFunctions.cpp. References atZero, computeSmoothedValue(), d(), f(), gradientAtBorder, gradientAtObject, range, smoothingAtBorderPosition, and smoothingAtObjectPosition. Referenced by computeChargeForPointfield(), computeChargeForSectorfield(), computeChargeForShapefield(), and computeGradientForSectorfield().

Here is the call graph for this function:

double PotentialfieldFunction::computeDerivativeValue | ( | double | x,
|  | bool | smooth = false
| ) | `[virtual]`

  | Computes the value of the derivative of the function for a given x including range checking and smoothing. Parameters:
  x | The distance for which to compute the value of the function
  smooth | Flag: Use smoothing, if true
Returns: The value of the function Reimplemented in SocialFunction, and NoFunction. Definition at line 39 of file PotentialFunctions.cpp. References atZero, computeSmoothedValue(), d(), dd(), range, smoothingAtBorderPosition, and smoothingAtObjectPosition. Referenced by computeGradientForPointfield(), computeGradientForSectorfield(), and computeGradientForShapefield().

Here is the call graph for this function:

virtual PotentialfieldFunction* PotentialfieldFunction::clone | ( |  | ) | `[pure virtual]`

| Clones a function object. Returns: A pointer to a copy of the object Implemented in LinearFunction, ParabolicFunction, AsymptoticFunction, SocialFunction, and NoFunction. Referenced by PotentialFieldsObject::setField(), and PotentialFieldsObject::setFunction().

double PotentialfieldFunction::getRange | ( |  | ) | `[inline]`

| Returns the range of the function. Returns: The range Definition at line 65 of file PotentialFunctions.h. References range. Referenced by computeChargeForSectorfield(), and computeGradientForSectorfield().

void PotentialfieldFunction::setParameters | ( | double | atZero,
|  | double | range
| ) | `[inline]`

  | Sets the two main parameters, recomputes smoothing parameters. Parameters:
  atZero | The value of f(0)
  range | At range, f(range) is 0
Definition at line 72 of file PotentialFunctions.h. References init(), smoothingAtBorderPercentage, smoothingAtBorderPosition, smoothingAtObjectPercentage, and smoothingAtObjectPosition. Referenced by computeChargeForSectorfield(), and computeGradientForSectorfield().

Here is the call graph for this function:

void PotentialfieldFunction::setSmoothingParameters | ( | double | smoothingAtObject,
|  | double | smoothingAtBorder,
|  | double | gradientAtObject,
|  | double | gradientAtBorder
| ) | `[inline]`

  | Sets parameters for smoothing at the end of the function's interval Both values have a range from 0.0 to 1.0. Parameters:
  smoothingAtObject | Smoothing near the object
  smoothingAtBorder | Smoothing near the end of the range
  gradientAtObject | The gradient at the object
  gradientAtBorder | The gradient at (range,0)
Definition at line 88 of file PotentialFunctions.h. References range, smoothingAtBorderPercentage, smoothingAtBorderPosition, smoothingAtObjectPercentage, and smoothingAtObjectPosition. Referenced by Parser::parseFunction(), and Parser::parseObject().

double PotentialfieldFunction::computeSmoothedValue | ( | double | x1,
|  | double | fx1,
|  | double | dx1,
|  | double | x2,
|  | double | fx2,
|  | double | dx2,
|  | double | x
| ) | `[protected]`

  | Generates a smooth curve between two points and computes function value of a given x. Parameters:
  x1 | x component of the left end of the curve
  fx1 | y component of the left end of the curve
  dx1 | Gradient at (x1,fx1)
  x2 | x component of the right end of the curve
  fx2 | y component of the right end of the curve
  dx2 | Gradient at (x2,fx22)
  x | The position for which f(x) is computed
Returns: A smoothed f(x) Definition at line 64 of file PotentialFunctions.cpp. Referenced by computeDerivativeValue(), and computeValue().

virtual double PotentialfieldFunction::f | ( | double | x | ) | const`[inline, protected, virtual]`

  | Computes the value of the function for a given x. Parameters:
  x | The distance for which to compute the value of the function
Returns: The value of the function Reimplemented in LinearFunction, ParabolicFunction, and AsymptoticFunction. Definition at line 142 of file PotentialFunctions.h. Referenced by computeValue().

virtual double PotentialfieldFunction::d | ( | double | x | ) | const`[inline, protected, virtual]`

  | Computes the value of the derivative of the function for a given x. Parameters:
  x | The distance for which to compute the value of the function
Returns: The value of the function Reimplemented in LinearFunction, ParabolicFunction, and AsymptoticFunction. Definition at line 149 of file PotentialFunctions.h. Referenced by computeDerivativeValue(), and computeValue().

virtual double PotentialfieldFunction::dd | ( | double | x | ) | const`[inline, protected, virtual]`

  | Computes the value of the second derivative of the function for a given x. Parameters:
  x | The distance for which to compute the value of the function
Returns: The value of the function Reimplemented in LinearFunction, ParabolicFunction, and AsymptoticFunction. Definition at line 156 of file PotentialFunctions.h. Referenced by computeDerivativeValue().

virtual void PotentialfieldFunction::init | ( |  | ) | `[inline, protected, virtual]`

| Computes the values of a and b. Reimplemented in LinearFunction, ParabolicFunction, and AsymptoticFunction. Definition at line 160 of file PotentialFunctions.h. Referenced by setParameters().

void PotentialfieldFunction::getStandardParameters | ( | PotentialfieldFunction * | other | ) | `[inline, protected]`

  | Sets standard parameters from other function. Parameters:
  other | The other function
Definition at line 165 of file PotentialFunctions.h. References gradientAtBorder, gradientAtObject, smoothingAtBorderPercentage, smoothingAtBorderPosition, smoothingAtObjectPercentage, and smoothingAtObjectPosition. Referenced by SocialFunction::clone(), AsymptoticFunction::clone(), ParabolicFunction::clone(), and LinearFunction::clone().

## Member Data Documentation

double PotentialfieldFunction::smoothingAtObjectPosition`[protected]`

| Last position of smoothing near object. Definition at line 103 of file PotentialFunctions.h. Referenced by computeDerivativeValue(), computeValue(), getStandardParameters(), setParameters(), and setSmoothingParameters().

double PotentialfieldFunction::smoothingAtBorderPosition`[protected]`

| First position of smoothing near the end of the range. Definition at line 105 of file PotentialFunctions.h. Referenced by computeDerivativeValue(), computeValue(), getStandardParameters(), setParameters(), and setSmoothingParameters().

double PotentialfieldFunction::gradientAtObject`[protected]`

| The gradient at the object (used together with smoothing). Definition at line 107 of file PotentialFunctions.h. Referenced by computeValue(), and getStandardParameters().

double PotentialfieldFunction::gradientAtBorder`[protected]`

| The gradient at (range,0) (used together with smoothing). Definition at line 109 of file PotentialFunctions.h. Referenced by computeValue(), and getStandardParameters().

double PotentialfieldFunction::smoothingAtObjectPercentage`[protected]`

| Smoothing near object [0.0, .., 1.0]. Definition at line 111 of file PotentialFunctions.h. Referenced by getStandardParameters(), setParameters(), and setSmoothingParameters().

double PotentialfieldFunction::smoothingAtBorderPercentage`[protected]`

| Smoothing near the end of the range [0.0, .., 1.0]. Definition at line 113 of file PotentialFunctions.h. Referenced by getStandardParameters(), setParameters(), and setSmoothingParameters().

double PotentialfieldFunction::atZero`[protected]`

| The value of f(0). Definition at line 115 of file PotentialFunctions.h. Referenced by computeDerivativeValue(), and computeValue().

double PotentialfieldFunction::range`[protected]`

| f(range) = 0 Definition at line 117 of file PotentialFunctions.h. Referenced by computeDerivativeValue(), computeValue(), getRange(), and setSmoothingParameters().

double PotentialfieldFunction::a`[protected]`

| Internal variable for faster computation set by init(). Definition at line 119 of file PotentialFunctions.h.

double PotentialfieldFunction::b`[protected]`

| Internal variable for faster computation set by init(). Definition at line 121 of file PotentialFunctions.h.

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

- Tools/PotentialFields/PotentialFunctions.h
- Tools/PotentialFields/PotentialFunctions.cpp