COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
AnalyticalFunction Class Reference

#include <AnalyticalFunction.hpp>

Public Member Functions

 AnalyticalFunction ()
 Empty constructor. More...
 
 AnalyticalFunction (const std::string &function, const std::string &vars, const std::string &separator=",")
 Constructor. More...
 
 AnalyticalFunction (const std::string &function, const std::vector< std::string > &vars)
 Constructor. More...
 
 ~AnalyticalFunction ()
 Destructor. More...
 
void set_variables (const std::string &vars, const std::string &separator=",")
 Define the parameters of the function. More...
 
void set_variables (const std::vector< std::string > &vars)
 Define the parameters of the function. More...
 
void parse (const std::string &function)
 
void parse (const std::string &function, const std::string &vars, const std::string &separator=",")
 
void parse (const std::string &function, const std::vector< std::string > &vars)
 
void parse_and_deduce_variables (const std::string &function, std::vector< std::string > &vars)
 
bool is_parsed () const
 
Uint nbvars () const
 
const std::string & function () const
 The analytical function that is parsed. More...
 
const std::vector< std::string > & variables () const
 The variables. More...
 
template<typename var_t , typename ret_t >
void evaluate (const var_t &var_values, ret_t &ret_value) const
 
template<typename var_t >
Real operator() (const var_t &var_values) const
 

Protected Member Functions

void clear ()
 Clears the m_parser deallocating the memory. More...
 

Private Attributes

bool m_is_parsed
 flag to indicate if the functions have been parsed More...
 
std::vector< std::string > m_vars
 vector holding the names of the variables More...
 
std::string m_function
 a vector of string to hold the functions More...
 
boost::shared_ptr< FunctionParser > m_parser
 vector holding the parsers, one for each entry in the vector More...
 

Detailed Description

This class represents an analytical function that defines the values for a vector field

Author
Tiago Quintino

Definition at line 28 of file AnalyticalFunction.hpp.

Constructor & Destructor Documentation

Empty constructor.

Definition at line 28 of file AnalyticalFunction.cpp.

AnalyticalFunction ( const std::string &  function,
const std::string &  vars,
const std::string &  separator = "," 
)

Constructor.

Definition at line 35 of file AnalyticalFunction.cpp.

AnalyticalFunction ( const std::string &  function,
const std::vector< std::string > &  vars 
)

Constructor.

Definition at line 43 of file AnalyticalFunction.cpp.

Destructor.

Definition at line 53 of file AnalyticalFunction.cpp.

Member Function Documentation

void clear ( )
protected

Clears the m_parser deallocating the memory.

Definition at line 60 of file AnalyticalFunction.cpp.

void evaluate ( const var_t &  var_values,
ret_t &  ret_value 
) const

Evaluate the Analytical Function given the values of the variables.

Parameters
varsvalues of the variables to substitute in the function.
ret_valuethe placeholder vector for the result

Definition at line 116 of file AnalyticalFunction.hpp.

const std::string& function ( ) const
inline

The analytical function that is parsed.

Definition at line 75 of file AnalyticalFunction.hpp.

bool is_parsed ( ) const
inline
Returns
if the AnalyticalFunctionParser has been parsed yet.

Definition at line 67 of file AnalyticalFunction.hpp.

Uint nbvars ( ) const

Gets the number of variables

Precondition
only call this function if already parsed
Returns
the number of varibles

Definition at line 68 of file AnalyticalFunction.cpp.

Real operator() ( const var_t &  var_values) const

Evaluate the Analytical Function given the values of the variables. This function allows this class to work as a functor.

Parameters
var_valuesvalues of the variables to substitute in the function.

Definition at line 128 of file AnalyticalFunction.hpp.

void parse ( const std::string &  function)

Parse the strings to extract the functions for each line of the vector.

Exceptions
ParsingFailedif there is an error while parsing

Definition at line 99 of file AnalyticalFunction.cpp.

void parse ( const std::string &  function,
const std::string &  vars,
const std::string &  separator = "," 
)

Parse the strings to extract the functions for each line of the vector.

Exceptions
ParsingFailedif there is an error while parsing

Definition at line 165 of file AnalyticalFunction.cpp.

void parse ( const std::string &  function,
const std::vector< std::string > &  vars 
)

Parse the strings to extract the functions for each line of the vector.

Exceptions
ParsingFailedif there is an error while parsing

Definition at line 157 of file AnalyticalFunction.cpp.

void parse_and_deduce_variables ( const std::string &  function,
std::vector< std::string > &  vars 
)

Parse a function and return the variables found in the expression

Exceptions
ParsingFailedif there is an error while parsing

Definition at line 127 of file AnalyticalFunction.cpp.

void set_variables ( const std::string &  vars,
const std::string &  separator = "," 
)

Define the parameters of the function.

Definition at line 76 of file AnalyticalFunction.cpp.

void set_variables ( const std::vector< std::string > &  vars)

Define the parameters of the function.

Definition at line 91 of file AnalyticalFunction.cpp.

const std::vector<std::string>& variables ( ) const
inline

The variables.

Definition at line 78 of file AnalyticalFunction.hpp.

Member Data Documentation

std::string m_function
private

a vector of string to hold the functions

Definition at line 106 of file AnalyticalFunction.hpp.

bool m_is_parsed
private

flag to indicate if the functions have been parsed

Definition at line 100 of file AnalyticalFunction.hpp.

boost::shared_ptr<FunctionParser> m_parser
private

vector holding the parsers, one for each entry in the vector

Definition at line 109 of file AnalyticalFunction.hpp.

std::vector<std::string> m_vars
private

vector holding the names of the variables

Definition at line 103 of file AnalyticalFunction.hpp.


The documentation for this class was generated from the following files:
Send comments to:
COOLFluiD Web Admin