Public Member Functions | Protected Attributes | List of all members

Allows to export code of an ACADO function. More...

#include <export_acado_function.hpp>

Inheritance diagram for ExportAcadoFunction:
Inheritance graph
[legend]

Public Member Functions

virtual ExportStatementclone () const
 
 ExportAcadoFunction ()
 
 ExportAcadoFunction (const Function &_f, const std::string &_name="acadoFcn")
 
 ExportAcadoFunction (const std::string &_name)
 
virtual returnValue exportCode (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
 
virtual returnValue exportDataDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
 
virtual returnValue exportForwardDeclaration (std::ostream &stream, const std::string &_realString="real_t", const std::string &_intString="int", int _precision=16) const
 
unsigned getFunctionDim (void)
 
ExportVariable getGlobalExportVariable () const
 
returnValue init (const Function &_f, const std::string &_name="acadoFcn", const uint _numX=0, const uint _numXA=0, const uint _numU=0, const uint _numP=0, const uint _numDX=0, const uint _numOD=0)
 
virtual bool isDefined () const
 
bool isExternal () const
 
returnValue setGlobalExportVariable (const ExportVariable &var)
 
virtual ~ExportAcadoFunction ()
 
- Public Member Functions inherited from ExportFunction
virtual ExportFunctionacquire (ExportIndex &obj)
 
returnValue addArgument (const ExportArgument &_argument1, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 
ExportFunctionaddIndex (const ExportIndex &_index)
 
ExportFunctionaddVariable (const ExportVariable &_var)
 
virtual ExportFunctiondoc (const std::string &_doc)
 
 ExportFunction (const std::string &_name="defaultFunctionName", const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 
std::string getName () const
 
unsigned getNumArguments () const
 
returnValue init (const std::string &_name="defaultFunctionName", const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 
virtual bool isPrivate () const
 
virtual ExportFunctionrelease (const ExportIndex &obj)
 
ExportFunctionsetName (const std::string &_name)
 
virtual ExportFunctionsetPrivate (bool _set=true)
 
ExportFunctionsetReturnValue (const ExportVariable &_functionReturnValue, bool _returnAsPointer=false)
 
ExportFunctionsetup (const std::string &_name="defaultFunctionName", const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 
virtual ~ExportFunction ()
 
- Public Member Functions inherited from ExportStatementBlock
returnValue addComment (const std::string &_comment)
 
returnValue addComment (uint _nBlanks, const std::string &_comment)
 
returnValue addDeclaration (const ExportVariable &_data, ExportStruct _dataStruct=ACADO_ANY)
 
returnValue addDeclaration (const ExportIndex &_data, ExportStruct _dataStruct=ACADO_ANY)
 
returnValue addDeclaration (const ExportFunction &_f)
 
returnValue addDeclaration (const ExportAcadoFunction &_f)
 
returnValue addFunction (const ExportFunction &_function)
 
returnValue addFunctionCall (const std::string &_fName, const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 
returnValue addFunctionCall (const ExportFunction &_f, const ExportArgument &_argument1=emptyConstExportArgument, const ExportArgument &_argument2=emptyConstExportArgument, const ExportArgument &_argument3=emptyConstExportArgument, const ExportArgument &_argument4=emptyConstExportArgument, const ExportArgument &_argument5=emptyConstExportArgument, const ExportArgument &_argument6=emptyConstExportArgument, const ExportArgument &_argument7=emptyConstExportArgument, const ExportArgument &_argument8=emptyConstExportArgument, const ExportArgument &_argument9=emptyConstExportArgument)
 
returnValue addLinebreak (uint num=1)
 
returnValue addStatement (const ExportStatement &_statement)
 
returnValue addStatement (const std::string &_statementString)
 
returnValue clear ()
 
 ExportStatementBlock ()
 
 ExportStatementBlock (const ExportStatementBlock &arg)
 
uint getNumStatements () const
 
ExportStatementBlockoperator= (const ExportStatementBlock &rhs)
 
virtual ~ExportStatementBlock ()
 
- Public Member Functions inherited from ExportStatement
virtual ExportStatementallocate (MemoryAllocatorPtr)
 
 ExportStatement ()
 
 ExportStatement (const ExportStatement &arg)
 
ExportStatementoperator= (const ExportStatement &arg)
 
virtual ~ExportStatement ()
 

Protected Attributes

bool external
 
std::shared_ptr< Functionf
 
ExportVariable globalVar
 
unsigned numDX
 
unsigned numOD
 
unsigned numP
 
unsigned numU
 
unsigned numX
 
unsigned numXA
 
- Protected Attributes inherited from ExportFunction
std::string description
 
bool flagPrivate
 
ExportArgumentList functionArguments
 
std::vector< ExportVariablelocalVariables
 
MemoryAllocatorPtr memAllocator
 
std::string name
 
bool returnAsPointer
 
ExportVariable retVal
 
- Protected Attributes inherited from ExportStatementBlock
StatementPtrArray statements
 

Additional Inherited Members

- Public Types inherited from ExportStatement
typedef std::shared_ptr< MemoryAllocatorMemoryAllocatorPtr
 
typedef std::shared_ptr< ExportStatementStatementPtr
 
typedef std::vector< StatementPtrStatementPtrArray
 
- Static Public Attributes inherited from ExportStatement
static std::string fcnPrefix = "acado"
 
static std::string varPrefix = "ACADO"
 
- Protected Member Functions inherited from ExportFunction
returnValue clear ()
 

Detailed Description

Allows to export code of an ACADO function.

The class ExportAcadoFunction allows to export code of an ACADO function.

Author
Hans Joachim Ferreau, Boris Houska, Milan Vukov

Definition at line 50 of file export_acado_function.hpp.

Constructor & Destructor Documentation

BEGIN_NAMESPACE_ACADO ExportAcadoFunction::ExportAcadoFunction ( )

Default constructor.

Definition at line 45 of file export_acado_function.cpp.

ExportAcadoFunction::ExportAcadoFunction ( const Function _f,
const std::string &  _name = "acadoFcn" 
)

Constructor which takes the differential equation to be exported as well as the name of the exported ODE.

Parameters
[in]_fDifferential equation to be exported.
[in]_nameName of exported ODE function.

Definition at line 60 of file export_acado_function.cpp.

ExportAcadoFunction::ExportAcadoFunction ( const std::string &  _name)

Constructor which takes name of a function only.

This way, we can define an "external symbolic function" with the following prototype:

*  void (const real_t* in, real_t* out);
*  
Parameters
[in]_nameName of exported ODE function.

Definition at line 67 of file export_acado_function.cpp.

ExportAcadoFunction::~ExportAcadoFunction ( )
virtual

Destructor.

Definition at line 74 of file export_acado_function.cpp.

Member Function Documentation

ExportStatement * ExportAcadoFunction::clone ( ) const
virtual

Clone constructor (deep copy).

\return Pointer to cloned object.

Reimplemented from ExportFunction.

Definition at line 78 of file export_acado_function.cpp.

returnValue ExportAcadoFunction::exportCode ( std::ostream &  stream,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) const
virtual

Exports source code of the ODE function into given file. Its appearance can can be adjusted by various options.

@param[in] string                   Name of file to be used to export function.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Reimplemented from ExportFunction.

Definition at line 148 of file export_acado_function.cpp.

returnValue ExportAcadoFunction::exportDataDeclaration ( std::ostream &  stream,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) const
virtual

Exports data declaration of the ODE function into given file. Its appearance can can be adjusted by various options.

@param[in] stream                   Name of file to be used to export function.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Reimplemented from ExportFunction.

Definition at line 111 of file export_acado_function.cpp.

returnValue ExportAcadoFunction::exportForwardDeclaration ( std::ostream &  stream,
const std::string &  _realString = "real_t",
const std::string &  _intString = "int",
int  _precision = 16 
) const
virtual

Exports forward declaration of the ODE function into given file. Its appearance can can be adjusted by various options.

@param[in] file                             Name of file to be used to export statement.
@param[in] _realString              std::string to be used to declare real variables.
@param[in] _intString               std::string to be used to declare integer variables.
@param[in] _precision               Number of digits to be used for exporting real values.

\return SUCCESSFUL_RETURN

Reimplemented from ExportFunction.

Definition at line 126 of file export_acado_function.cpp.

unsigned ExportAcadoFunction::getFunctionDim ( void  )

Get output dimension of the ACADO function.

Definition at line 173 of file export_acado_function.cpp.

ExportVariable ExportAcadoFunction::getGlobalExportVariable ( ) const

Set global export variable - a variable that holds intermediate values.

Definition at line 180 of file export_acado_function.cpp.

returnValue ExportAcadoFunction::init ( const Function _f,
const std::string &  _name = "acadoFcn",
const uint  _numX = 0,
const uint  _numXA = 0,
const uint  _numU = 0,
const uint  _numP = 0,
const uint  _numDX = 0,
const uint  _numOD = 0 
)

Initializes ODE function export by taking the differential equation to be exported as well as the name of the exported ODE.

Parameters
[in]_fDifferential equation to be exported.
[in]_nameName of exported ODE function.
[in]_numXThe number of states that are needed to evaluate the system of differential equations (needed when the number of equations is not equal to the number of given states).
[in]_numXAThe number of algebraic states in the input for the evaluation of the system of equations.
[in]_numUThe number of control inputs given for the evaluation of the system of equations.
[in]_numPThe number of parameters given for the evaluation of the system of equations.
[in]_numDXThe number of differential state derivatives given for the evaluation of the system of equations.

Definition at line 83 of file export_acado_function.cpp.

bool ExportAcadoFunction::isDefined ( ) const
virtual

Returns whether function has been defined.

\return true  iff function has been defined, \n
        false otherwise

Reimplemented from ExportFunction.

Definition at line 164 of file export_acado_function.cpp.

bool ExportAcadoFunction::isExternal ( ) const

A helper function to check whether a function is external.

Definition at line 203 of file export_acado_function.cpp.

returnValue ExportAcadoFunction::setGlobalExportVariable ( const ExportVariable var)

Get global export variable - a variable that holds intermediate values.

Definition at line 185 of file export_acado_function.cpp.

Member Data Documentation

bool ExportAcadoFunction::external
protected

Flag indicating whether the symbolic function is external or not.

Definition at line 200 of file export_acado_function.hpp.

std::shared_ptr< Function > ExportAcadoFunction::f
protected

ACADO function to be exported.

Definition at line 196 of file export_acado_function.hpp.

ExportVariable ExportAcadoFunction::globalVar
protected

A variable that holds intermediate values.

Definition at line 198 of file export_acado_function.hpp.

unsigned ExportAcadoFunction::numDX
protected

The number of differential state derivatives given for the evaluation of the system of equations.

Definition at line 192 of file export_acado_function.hpp.

unsigned ExportAcadoFunction::numOD
protected

The number of "online data" objects.

Definition at line 194 of file export_acado_function.hpp.

unsigned ExportAcadoFunction::numP
protected

The number of parameters given for the evaluation of the system of equations.

Definition at line 189 of file export_acado_function.hpp.

unsigned ExportAcadoFunction::numU
protected

The number of control inputs given for the evaluation of the system of equations (similar to numX).

Definition at line 187 of file export_acado_function.hpp.

unsigned ExportAcadoFunction::numX
protected

The number of states that are needed to evaluate the system of differential equations. If this number isn't specified, then it will be set to the number of equations (minus the number of algebraic states).

Definition at line 181 of file export_acado_function.hpp.

unsigned ExportAcadoFunction::numXA
protected

The number of algebraic states in the input for the evaluation of the system of equations (similar to numX).

Definition at line 184 of file export_acado_function.hpp.


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


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:23