OpenFCST: The open-source Fuel Cell Simulation Toolbox
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
AppFrame::Random Class Reference

An application class solving the same problem with a set of random start vectors. More...

#include <random.h>

Inheritance diagram for AppFrame::Random:
Inheritance graph
[legend]
Collaboration diagram for AppFrame::Random:
Collaboration graph
[legend]

Public Member Functions

 Random (ApplicationBase &app, bool store_vectors=false)
 Constructor, receiving the application solving the problem.
 
 ~Random ()
 Clean up allocated vectors in destructor.
 
virtual void declare_parameters (ParameterHandler &param)
 Declare parameters for a parameter file.
 
void _initialize (ParameterHandler &param)
 Read the parameters.
 
virtual void initialize (ParameterHandler &param)
 Pure virtual initialization function.
 
double amplitude () const
 The amplitude of the random distribution.
 
virtual void solve (FEVector &start, const FEVectors &rhs)
 Solve the problem a lot of times.
 
- Public Member Functions inherited from AppFrame::ApplicationCopy
 ApplicationCopy (ApplicationBase &ex_app)
 Constructor for a derived application.
 
 ~ApplicationCopy ()
 
virtual void remesh ()
 Generates the next mesh depending on the mesh generation parameters.
 
virtual void init_vector (FEVector &dst) const
 Initialize vector to problem size.
 
virtual void start_vector (FEVector &dst, std::string caller) const
 Initialize vector to problem size.
 
virtual double residual (FEVector &dst, const FEVectors &src)
 
virtual void Tsolve (FEVector &start, const FEVectors &rhs)
 Solve the dual system assembled with right hand side rhs and return the result in start.
 
virtual double estimate (const FEVectors &src)
 Error estimation.
 
virtual double evaluate (const FEVectors &src)
 Evaluate whatever the simulation was made for.
 
virtual void grid_out (const std::string &filename) const
 Write the mesh in the format specified by the ParameterHandler.
 
virtual void data_out (const std::string &filename, const FEVectors &src)
 Write data in the format specified by the ParameterHandler.
 
virtual std::string id () const
 Return a unique identification string for this application.
 
virtual void notify (const Event &reason)
 Add a reason for assembling.
 
- Public Member Functions inherited from AppFrame::ApplicationBase
 ApplicationBase (boost::shared_ptr< ApplicationData > ex_data=boost::shared_ptr< ApplicationData >())
 Constructor for an application.
 
 ApplicationBase (const ApplicationBase &other)
 Copy constructor.
 
virtual ~ApplicationBase ()
 Virtual destructor.
 
void print_parameters_to_file (ParameterHandler &param, const std::string &file_name, const ParameterHandler::OutputStyle &style)
 Print default parameters for the application to a file.
 
virtual double residual (FEVector &dst, const FEVectors &src, bool apply_boundaries=true)
 Compute residual of src and store it into dst.
 
virtual void data_out (const std::string &filename, const FEVectors &src, const std::vector< std::string >)
 
boost::shared_ptr
< ApplicationData
get_data ()
 Get access to the protected variable data.
 
const boost::shared_ptr
< ApplicationData
get_data () const
 Get read-only access to the protected variable data.
 
virtual void clear ()
 Reset the application class such that a call to initialize() is possible again and will produce the same result as if the object was fresh.
 
void clear_events ()
 Clear all notifications.
 

Static Public Attributes

static const Event new_value
 This Event is raised whenever Random picked a new value.
 

Protected Attributes

std::vector< SmartPointer
< FEVector > > 
results
 A vector storing the results of all the runs.
 
double scaled_amplitude
 The amplitude of the sample around the start value scaled by the maximum random number.
 
bool store_vectors
 If this is false, don't store the vectors after each sample but rather call evaluate.
 
- Protected Attributes inherited from AppFrame::ApplicationCopy
SmartPointer< ApplicationBaseapp
 Pointer to the application this one depends upon.
 
- Protected Attributes inherited from AppFrame::ApplicationBase
boost::shared_ptr
< ApplicationData
data
 Object for auxiliary data.
 
Event notifications
 Accumulate reasons for reassembling here.
 

Additional Inherited Members

- Protected Member Functions inherited from AppFrame::ApplicationBase
void print_caller_name (const std::string &caller_name) const
 Print caller name.
 

Detailed Description

An application class solving the same problem with a set of random start vectors.

Author
Guido Kanschat, 2006

Constructor & Destructor Documentation

AppFrame::Random::Random ( ApplicationBase app,
bool  store_vectors = false 
)

Constructor, receiving the application solving the problem.

If store_vectors is false, then call evaluate() after every sample. Else, store all results in results and leave the call of evaluate() to the enclosing function; in this case, you should derive a class with a function evaluate() in order to have access to results.

AppFrame::Random::~Random ( )

Clean up allocated vectors in destructor.

Member Function Documentation

void AppFrame::Random::_initialize ( ParameterHandler &  param)

Read the parameters.

double AppFrame::Random::amplitude ( ) const

The amplitude of the random distribution.

virtual void AppFrame::Random::declare_parameters ( ParameterHandler &  param)
virtual

Declare parameters for a parameter file.

Pure virtual function MUST be redeclared in derived classes.

Reimplemented from AppFrame::ApplicationCopy.

virtual void AppFrame::Random::initialize ( ParameterHandler &  param)
virtual

Pure virtual initialization function.

Here, the parameters declared in the constructor are actually read from ParameterHandler.

This function must be overloaded in any derived class using its own values from the parameter file.

Initialization functions of derived classes must make sure to call all functions _initialize() of the base classes.

Reimplemented from AppFrame::ApplicationCopy.

virtual void AppFrame::Random::solve ( FEVector start,
const FEVectors rhs 
)
virtual

Solve the problem a lot of times.

If the vectors are not stored (store_vectors is false), then the function evaluate of the underlying application may accumulate results in a named vector "Random", which will then be returned as the value of start.

Todo:
The return value does not differ from the input right now.

Reimplemented from AppFrame::ApplicationCopy.

Member Data Documentation

const Event AppFrame::Random::new_value
static

This Event is raised whenever Random picked a new value.

std::vector<SmartPointer<FEVector > > AppFrame::Random::results
protected

A vector storing the results of all the runs.

This can be used by the function evaluate() of a derived class to do some statistical analysis of these results.

double AppFrame::Random::scaled_amplitude
protected

The amplitude of the sample around the start value scaled by the maximum random number.

bool AppFrame::Random::store_vectors
protected

If this is false, don't store the vectors after each sample but rather call evaluate.


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