LoggingFunction< FunctionType, ScalarType > Class Template Reference

#include <LoggingFunction.h>

List of all members.

Public Member Functions

 LoggingFunction (FunctionType f)
 ~LoggingFunction ()
ScalarType operator() (ScalarType x)
void reset ()
void enable_plot (std::string filename)
ScalarType get_y_min () const
ScalarType get_y_max () const
int get_num_eval () const

Private Attributes

ScalarType y_min_
ScalarType y_max_
int num_eval_
FunctionType function_
bool plot_enabled_
std::ofstream of_


Detailed Description

template<typename FunctionType, typename ScalarType>
class LoggingFunction< FunctionType, ScalarType >

Class template implementing a function object which wraps around an existing function object and add statistics and logging functionality to it. Usable e.g. for debugging purposes.

Definition at line 22 of file LoggingFunction.h.


Constructor & Destructor Documentation

template<typename FunctionType, typename ScalarType>
LoggingFunction< FunctionType, ScalarType >::LoggingFunction ( FunctionType  f  )  [inline]

Create a LoggingFunction from an existing function object f.

Parameters:
f function object, implementing ScalarType operator()(ScalarType)

Definition at line 28 of file LoggingFunction.h.

References LoggingFunction< FunctionType, ScalarType >::reset().

Here is the call graph for this function:

template<typename FunctionType, typename ScalarType>
LoggingFunction< FunctionType, ScalarType >::~LoggingFunction (  )  [inline]

Destructor

Definition at line 38 of file LoggingFunction.h.

References LoggingFunction< FunctionType, ScalarType >::reset().

Here is the call graph for this function:


Member Function Documentation

template<typename FunctionType, typename ScalarType>
void LoggingFunction< FunctionType, ScalarType >::enable_plot ( std::string  filename  )  [inline]

Enable logging of function evaluations to a text file.

Parameters:
filename Name of log file to write to.

Definition at line 73 of file LoggingFunction.h.

References LoggingFunction< FunctionType, ScalarType >::of_, and LoggingFunction< FunctionType, ScalarType >::plot_enabled_.

Referenced by eval_gap_voltage().

template<typename FunctionType, typename ScalarType>
int LoggingFunction< FunctionType, ScalarType >::get_num_eval (  )  const [inline]

Return number of function evaluations.

Returns:
number of function evaluations

Definition at line 97 of file LoggingFunction.h.

References LoggingFunction< FunctionType, ScalarType >::num_eval_.

Referenced by eval_gap_voltage().

template<typename FunctionType, typename ScalarType>
ScalarType LoggingFunction< FunctionType, ScalarType >::get_y_max (  )  const [inline]

Return maximum of evaluated function values.

Returns:
maximum of evaluated function values

Definition at line 90 of file LoggingFunction.h.

References LoggingFunction< FunctionType, ScalarType >::y_max_.

Referenced by eval_gap_voltage().

template<typename FunctionType, typename ScalarType>
ScalarType LoggingFunction< FunctionType, ScalarType >::get_y_min (  )  const [inline]

Return minimum of evaluated function values.

Returns:
minimum of evaluated function values

Definition at line 83 of file LoggingFunction.h.

References LoggingFunction< FunctionType, ScalarType >::y_min_.

Referenced by eval_gap_voltage().

template<typename FunctionType, typename ScalarType>
ScalarType LoggingFunction< FunctionType, ScalarType >::operator() ( ScalarType  x  )  [inline]

Call f(x) and update statistics.

Parameters:
x 
Returns:
return f(x)

Definition at line 47 of file LoggingFunction.h.

References LoggingFunction< FunctionType, ScalarType >::function_, LoggingFunction< FunctionType, ScalarType >::num_eval_, LoggingFunction< FunctionType, ScalarType >::of_, LoggingFunction< FunctionType, ScalarType >::plot_enabled_, y, LoggingFunction< FunctionType, ScalarType >::y_max_, and LoggingFunction< FunctionType, ScalarType >::y_min_.

template<typename FunctionType, typename ScalarType>
void LoggingFunction< FunctionType, ScalarType >::reset (  )  [inline]

Reset statistics and close log file, if one was created.

Definition at line 61 of file LoggingFunction.h.

References max, LoggingFunction< FunctionType, ScalarType >::num_eval_, LoggingFunction< FunctionType, ScalarType >::of_, LoggingFunction< FunctionType, ScalarType >::plot_enabled_, LoggingFunction< FunctionType, ScalarType >::y_max_, and LoggingFunction< FunctionType, ScalarType >::y_min_.

Referenced by eval_gap_voltage(), LoggingFunction< FunctionType, ScalarType >::LoggingFunction(), and LoggingFunction< FunctionType, ScalarType >::~LoggingFunction().


Member Data Documentation

template<typename FunctionType, typename ScalarType>
FunctionType LoggingFunction< FunctionType, ScalarType >::function_ [private]

Definition at line 104 of file LoggingFunction.h.

Referenced by LoggingFunction< FunctionType, ScalarType >::operator()().

template<typename FunctionType, typename ScalarType>
int LoggingFunction< FunctionType, ScalarType >::num_eval_ [private]

Definition at line 103 of file LoggingFunction.h.

Referenced by LoggingFunction< FunctionType, ScalarType >::get_num_eval(), LoggingFunction< FunctionType, ScalarType >::operator()(), and LoggingFunction< FunctionType, ScalarType >::reset().

template<typename FunctionType, typename ScalarType>
std::ofstream LoggingFunction< FunctionType, ScalarType >::of_ [private]

Definition at line 106 of file LoggingFunction.h.

Referenced by LoggingFunction< FunctionType, ScalarType >::enable_plot(), LoggingFunction< FunctionType, ScalarType >::operator()(), and LoggingFunction< FunctionType, ScalarType >::reset().

template<typename FunctionType, typename ScalarType>
bool LoggingFunction< FunctionType, ScalarType >::plot_enabled_ [private]

Definition at line 105 of file LoggingFunction.h.

Referenced by LoggingFunction< FunctionType, ScalarType >::enable_plot(), LoggingFunction< FunctionType, ScalarType >::operator()(), and LoggingFunction< FunctionType, ScalarType >::reset().

template<typename FunctionType, typename ScalarType>
ScalarType LoggingFunction< FunctionType, ScalarType >::y_max_ [private]

Definition at line 102 of file LoggingFunction.h.

Referenced by LoggingFunction< FunctionType, ScalarType >::get_y_max(), LoggingFunction< FunctionType, ScalarType >::operator()(), and LoggingFunction< FunctionType, ScalarType >::reset().

template<typename FunctionType, typename ScalarType>
ScalarType LoggingFunction< FunctionType, ScalarType >::y_min_ [private]

Definition at line 101 of file LoggingFunction.h.

Referenced by LoggingFunction< FunctionType, ScalarType >::get_y_min(), LoggingFunction< FunctionType, ScalarType >::operator()(), and LoggingFunction< FunctionType, ScalarType >::reset().


The documentation for this class was generated from the following file:
Generated on Fri Oct 26 13:35:16 2007 for FEMAXX (Finite Element Maxwell Eigensolver) by  doxygen 1.4.7