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

Base class for applications. More...

#include <application_base.h>

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

Public Member Functions

 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.
 
virtual void declare_parameters (ParameterHandler &param)=0
 Declare parameters for a parameter file.
 
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 void initialize (ParameterHandler &param)=0
 Pure virtual initialization function.
 
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, bool apply_boundaries=true)
 Compute residual of src and store it into dst.
 
virtual void solve (FEVector &start, const FEVectors &rhs)
 Solve the system assembled with right hand side rhs and return the result in start.
 
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 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 std::string id () const
 Return a unique identification string for this application.
 
virtual void notify (const Event &reason)
 Add a reason for assembling.
 
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.
 

Protected Member Functions

void print_caller_name (const std::string &caller_name) const
 Print caller name.
 

Protected Attributes

boost::shared_ptr
< ApplicationData
data
 Object for auxiliary data.
 
Event notifications
 Accumulate reasons for reassembling here.
 

Detailed Description

Base class for applications.

get_application()

Use of applications

Application chains

The idea of these application classes is the possibility to build a chain out of these in order to have several predefined nested solvers. For this, we distinguish applications roughly in two classes, both derived from ApplicationBase:

  1. Terminal applications, which implement the real finite element code like computing residuals on mesh cells, assembling matrices and solving linear systems.

  2. Non-terminal applications derived from ApplicationCopy; these usually implement a new solve() function as an iterative solver around another application. They implement all functions of the ApplicationBase interface, either forwarding them to the next inner application by ApplicationCopy or by providing their own implementation.

Usually an class in a chain communicates values with its next outer class through function arguments. Nevertheless, at least the terminal application will require values from even outer applications in the chain in order to compute residuals and matrices correctly. For these, the mechanism of named data provided by ApplicationData was introduced. Each class can store auxiliary data under a unique name there for use in inner iterations.

Note
This class declares a lot of virtual functions, which will issue a warning to deallog if not overloaded. It does not provide implementations.
Author
Guido Kanschat, 2006

Constructor & Destructor Documentation

AppFrame::ApplicationBase::ApplicationBase ( boost::shared_ptr< ApplicationData ex_data = boost::shared_ptr<ApplicationData>())
inline

Constructor for an application.

One task of the constructor is declaring parameters for an application. Since this is done consecutively for derived classes, all parameters may be declared in a modular way. Derived classes should create unique subsections in the ParameterHandler.

Note
Actually, this constructor does nothing, since the base class declares no parameters.

References AppFrame::Event::all(), data, and notifications.

Here is the call graph for this function:

AppFrame::ApplicationBase::ApplicationBase ( const ApplicationBase other)
inline

Copy constructor.

Generate a new application sharing the same ApplicationData with another one.

References AppFrame::Event::all(), and notifications.

Here is the call graph for this function:

virtual AppFrame::ApplicationBase::~ApplicationBase ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

virtual void AppFrame::ApplicationBase::clear ( )
inlinevirtual

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 AppFrame::ApplicationBase::clear_events ( )
inline

Clear all notifications.

void AppFrame::ApplicationBase::data_out ( const std::string &  filename,
const FEVectors src 
)
inlinevirtual
void AppFrame::ApplicationBase::data_out ( const std::string &  filename,
const FEVectors src,
const std::vector< std::string >   
)
inlinevirtual

References print_caller_name().

Here is the call graph for this function:

virtual void AppFrame::ApplicationBase::declare_parameters ( ParameterHandler &  param)
pure virtual
double AppFrame::ApplicationBase::estimate ( const FEVectors src)
inlinevirtual
double AppFrame::ApplicationBase::evaluate ( const FEVectors src)
inlinevirtual

Evaluate whatever the simulation was made for.

Reimplemented in AppFrame::DoFApplication< dim >, FuelCell::Application::AppPemfc< dim >, FuelCell::Application::AppLaplace< dim >, FuelCell::Application::AppCathode< dim >, and AppFrame::ApplicationCopy.

References print_caller_name().

Here is the call graph for this function:

boost::shared_ptr<ApplicationData> AppFrame::ApplicationBase::get_data ( )
inline

Get access to the protected variable data.

const boost::shared_ptr<ApplicationData> AppFrame::ApplicationBase::get_data ( ) const
inline

Get read-only access to the protected variable data.

void AppFrame::ApplicationBase::grid_out ( const std::string &  filename) const
inlinevirtual

Write the mesh in the format specified by the ParameterHandler.

Reimplemented in AppFrame::ApplicationCopy.

References print_caller_name().

Here is the call graph for this function:

virtual std::string AppFrame::ApplicationBase::id ( ) const
inlinevirtual

Return a unique identification string for this application.

In particular, it returns the name of the class in which the object you requested id() from belongs to. For example: cBase* a = new cBase cBase* b = new cDerived then, a->id() will return cBase and b->id() will return cDerived

Reimplemented in AppFrame::ApplicationCopy.

void AppFrame::ApplicationBase::init_vector ( FEVector dst) const
inlinevirtual

Initialize vector to problem size.

Reimplemented in AppFrame::DoFApplication< dim >, and AppFrame::ApplicationCopy.

References print_caller_name().

Referenced by start_vector().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void AppFrame::ApplicationBase::initialize ( ParameterHandler &  param)
pure 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.

Implemented in AppFrame::DoFApplication< dim >, FuelCell::Application::AppCathode< dim >, FuelCell::Application::AppPemfc< dim >, AppFrame::MatrixApplication< dim >, FuelCell::Application::AppLaplace< dim >, FuelCell::Application::AppReadMesh< dim >, AppFrame::OptimizationBlockMatrixApplication< dim >, AppFrame::DoFMeshLoop< dim >, AppFrame::BlockMatrixApplication< dim >, AppFrame::ThetaTimestepping, AppFrame::newtonBase, AppFrame::Newton, AppFrame::Random, AppFrame::MeshLoop, AppFrame::NewtonBasic, AppFrame::NewtonLineSearch, AppFrame::ApplicationCopy, and AppFrame::RungeKuttaExplicit.

virtual void AppFrame::ApplicationBase::notify ( const Event reason)
inlinevirtual

Add a reason for assembling.

The new reason is binary or'd with the previous ones.

Reimplemented in AppFrame::ApplicationCopy.

void AppFrame::ApplicationBase::print_caller_name ( const std::string &  caller_name) const
inlineprotected

Print caller name.

Referenced by data_out(), estimate(), evaluate(), grid_out(), init_vector(), remesh(), residual(), solve(), start_vector(), and Tsolve().

Here is the caller graph for this function:

void AppFrame::ApplicationBase::print_parameters_to_file ( ParameterHandler &  param,
const std::string &  file_name,
const ParameterHandler::OutputStyle &  style 
)
inline

Print default parameters for the application to a file.

Note that this member function MUST be called after declare_parameters. For example:

ParamterHandler param;
app.declare_parameters(param);
app.print_parameters_to_file(param, "default_parameters.txt", ParameterHandler::XML);
void AppFrame::ApplicationBase::remesh ( )
inlinevirtual

Generates the next mesh depending on the mesh generation parameters.

Reimplemented in AppFrame::DoFApplication< dim >, AppFrame::MatrixApplication< dim >, AppFrame::BlockMatrixApplication< dim >, and AppFrame::ApplicationCopy.

References print_caller_name().

Here is the call graph for this function:

double AppFrame::ApplicationBase::residual ( FEVector dst,
const FEVectors src,
bool  apply_boundaries = true 
)
inlinevirtual

Compute residual of src and store it into dst.

The bool variable is used to specify if boundary conditions should be applied using FilteredMatrix.

Reimplemented in AppFrame::DoFApplication< dim >.

References print_caller_name().

Here is the call graph for this function:

void AppFrame::ApplicationBase::solve ( FEVector start,
const FEVectors rhs 
)
inlinevirtual
void AppFrame::ApplicationBase::start_vector ( FEVector dst,
std::string  caller 
) const
inlinevirtual

Initialize vector to problem size.

Reimplemented in AppFrame::ApplicationCopy.

References init_vector(), and print_caller_name().

Here is the call graph for this function:

void AppFrame::ApplicationBase::Tsolve ( FEVector start,
const FEVectors rhs 
)
inlinevirtual

Solve the dual system assembled with right hand side rhs and return the result in start.

Reimplemented in AppFrame::ApplicationCopy.

References print_caller_name().

Here is the call graph for this function:

Member Data Documentation

boost::shared_ptr<ApplicationData> AppFrame::ApplicationBase::data
protected

Object for auxiliary data.

This object is always valid, since it is either handed to the constructor or created there.

Referenced by ApplicationBase().

Event AppFrame::ApplicationBase::notifications
protected

Accumulate reasons for reassembling here.

If any of those is set, the function solve() of a terminal application must take care of reassembling the matrix.

Referenced by ApplicationBase().


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