C++

Some support for export to C++ is provided.

Limitations:

  • No import or export functions.

API

The standard interface for exporting and accessing expression writers is provided:

myokit.formats.cpp.ewriters()

Returns a dict of all expression writers available in this module.

class myokit.formats.cpp.CppExpressionWriter

This ExpressionWriter translates myokit expressions to their C++ equivalent.

eq(q)

Converts an equation to a string

ex(e)

Converts an Expression to a string.

set_condition_function(func=None)

Sets a function name to use for if statements

By setting func to None you can revert back to the default behavior
(the ternary operator). Any other value will be interpreted as the name of a C function taking arguments (condition, value_if_true, value_if_false).
set_lhs_function(f)
Sets a naming function, will be called to get the variable name from a
myokit.LhsExpression object.

The argument f should be a function that takes an LhsExpression as input and returns a string.