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 a myokit.Equation to a string.

ex(e)

Converts a myokit.Expression to a string.

set_condition_function(func=None)

Sets a function name to use for myokit.If; if not set the ternary operatur will be used.

If given, the function arguments should be (condition, value_if_true, value_if_false). To revert to using the ternary operator, call with func=None.

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.