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

#include <VectorialFunction.hpp>

Inherited by ProtoEvaluatedFunction.

Public Types

typedef std::vector< Real > VariablesT
 Variable storage. More...
 

Public Member Functions

 VectorialFunction ()
 Empty constructor. More...
 
 VectorialFunction (const std::string &functions, const std::string &vars)
 Constructor. More...
 
 ~VectorialFunction ()
 Destructor. More...
 
template<typename var_t , typename ret_t >
void evaluate (const var_t &var_values, ret_t &ret_value) const
 
RealVectoroperator() (const VariablesT &var_values)
 
RealVectoroperator() (const RealVector &var_values)
 
bool is_parsed () const
 
void functions (const std::vector< std::string > &functions)
 sets the function strings to be parsed More...
 
void functions (const std::string &functions)
 sets the function strings to be parsed More...
 
void variables (const std::vector< std::string > &vars)
 sets the variable strings to be parsed More...
 
void variables (const std::string &vars)
 sets the variable strings to be parsed More...
 
void parse ()
 
Uint nbvars () const
 
Uint nbfuncs () const
 

Protected Member Functions

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

Private Attributes

bool m_is_parsed
 flag to indicate if the functions have been parsed More...
 
std::string m_vars
 vector holding the names of the variables More...
 
Uint m_nbvars
 number of variables More...
 
std::vector< std::string > m_functions
 a vector of string to hold the functions More...
 
std::vector< FunctionParser * > m_parsers
 vector holding the parsers, one for each entry in the vector More...
 
RealVector m_result
 storage of the result for using the class as functor More...
 

Detailed Description

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

Author
Tiago Quintino

Definition at line 30 of file VectorialFunction.hpp.

Member Typedef Documentation

typedef std::vector<Real> VariablesT

Variable storage.

Definition at line 35 of file VectorialFunction.hpp.

Constructor & Destructor Documentation

Empty constructor.

Definition at line 28 of file VectorialFunction.cpp.

VectorialFunction ( const std::string &  functions,
const std::string &  vars 
)

Constructor.

Definition at line 38 of file VectorialFunction.cpp.

Destructor.

Definition at line 54 of file VectorialFunction.cpp.

Member Function Documentation

void clear ( )
protected

Clears the m_parsers deallocating the memory.

Definition at line 61 of file VectorialFunction.cpp.

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

Evaluate the Vectorial 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 133 of file VectorialFunction.hpp.

void functions ( const std::vector< std::string > &  functions)

sets the function strings to be parsed

Definition at line 145 of file VectorialFunction.cpp.

void functions ( const std::string &  functions)

sets the function strings to be parsed

Definition at line 124 of file VectorialFunction.cpp.

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

Definition at line 75 of file VectorialFunction.hpp.

Uint nbfuncs ( ) const

Gets the number of variables

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

Definition at line 79 of file VectorialFunction.cpp.

Uint nbvars ( ) const

Gets the number of variables

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

Definition at line 73 of file VectorialFunction.cpp.

RealVector & operator() ( const VariablesT var_values)

Evaluate the Vectorial Function given the values of the variables and return it in the stored result. This function allows this class to work as a functor.

Parameters
var_valuesvalues of the variables to substitute in the function.

Definition at line 182 of file VectorialFunction.cpp.

RealVector & operator() ( const RealVector var_values)

Evaluate the Vectorial Function given the values of the variables and return it in the stored result. This function allows this class to work as a functor.

Parameters
var_valuesvalues of the variables to substitute in the function.

Definition at line 199 of file VectorialFunction.cpp.

void parse ( )

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

Exceptions
ParsingFailedif there is an error while parsing

Definition at line 153 of file VectorialFunction.cpp.

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

sets the variable strings to be parsed

Definition at line 87 of file VectorialFunction.cpp.

void variables ( const std::string &  vars)

sets the variable strings to be parsed

Definition at line 103 of file VectorialFunction.cpp.

Member Data Documentation

std::vector<std::string> m_functions
private

a vector of string to hold the functions

Definition at line 120 of file VectorialFunction.hpp.

bool m_is_parsed
private

flag to indicate if the functions have been parsed

Definition at line 111 of file VectorialFunction.hpp.

Uint m_nbvars
private

number of variables

Definition at line 117 of file VectorialFunction.hpp.

std::vector<FunctionParser*> m_parsers
private

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

Definition at line 123 of file VectorialFunction.hpp.

RealVector m_result
private

storage of the result for using the class as functor

Definition at line 126 of file VectorialFunction.hpp.

std::string m_vars
private

vector holding the names of the variables

Definition at line 114 of file VectorialFunction.hpp.


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