Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to interpret a model (initially algebraic and ODE models) #1220

Open
wants to merge 94 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
99672cd
Interpreter: skeleton code.
agarny Apr 7, 2024
d6f5b87
Interpreter: added some (empty) methods to compute a model.
agarny Apr 8, 2024
b67ea7d
Interpreter: added methods to retrieve the VOI, states, rates, and va…
agarny Apr 8, 2024
7f97aa4
Interpreter: allocate the different arrays.
agarny Apr 8, 2024
412d8d4
Merge branch 'main' into issue1218.
agarny Apr 8, 2024
0488b1b
Interpreter tests: make sure that all our arrays are initialised with…
agarny Apr 9, 2024
c3690ea
Some minor cleaning up.
agarny Apr 9, 2024
3d6552b
Interpreter: added the skeleton of the InterpreterInstruction class.
agarny Apr 9, 2024
d93b7d8
Interpreter: added the skeleton of a GeneratorInterpreter class.
agarny Apr 9, 2024
907da52
Generator: extracted the code that generates the code to compute the …
agarny Apr 9, 2024
5412941
Tests: simplified the use of some arrays.
agarny Apr 10, 2024
d9e4258
Interpreter: simplified the construction of our arrays.
agarny Apr 10, 2024
a9914f6
Interpreter: can evaluate generateZeroInitialisationCode().
agarny Apr 11, 2024
d408b5f
Renamed interpreterinstruction[_p].[cpp|h] to interpreterstatement[_p…
agarny Apr 11, 2024
09fe513
Renamed the InterpreterInstruction class to InterpreterStatement.
agarny Apr 11, 2024
38b608a
Address coverage issues.
agarny Apr 11, 2024
4dbd96d
Interpreter: some minor cleaning up.
agarny Apr 11, 2024
ac65d8a
InterpreterStatement: reworked its create() methods.
agarny Apr 11, 2024
32eedd1
GeneratorInterpreter: merged generateDoubleOrConstantVariableNameCode…
agarny Apr 11, 2024
db0665f
GeneratorProfile: don't define the min() and max() functions for the …
agarny Apr 16, 2024
d959235
GeneratorProfile: use the M_E constant rather than exp(1.0).
agarny Apr 16, 2024
9a96766
Interpreter: can evaluate generateInitialisationCode().
agarny Apr 11, 2024
cab734a
Interpreter: can evaluate generateEquationCode().
agarny Apr 15, 2024
9341694
Debug: print an InterpreterStatement object as a tree.
agarny Apr 16, 2024
52219db
InterpreterStatement: keep track of calls to externalVariable().
agarny Apr 16, 2024
4a6c420
Generator/Interpreter: improved our tracking of rates.
agarny Apr 17, 2024
fb67039
Debug: some minor improvements to the printing of an AST / Interprete…
agarny Apr 16, 2024
743b33e
InterpreterStatement: temporarily disable some code to get full code …
agarny Apr 17, 2024
c0e0525
InterpreterStatement: re-enable some code.
agarny Apr 17, 2024
b38dc48
Debug: make it easier to check the name of CI elements when printing …
agarny Apr 17, 2024
f01ef9d
GeneratorInterpreter: have InterpreterStatement track piecewise state…
agarny Apr 17, 2024
07b99d2
AnalyserVariable: removed an unneeded class member.
agarny Apr 17, 2024
a08fec0
Debug: improved the printing of an AST as a tree.
agarny Apr 17, 2024
34ab752
CMake: give our utilities access to libxml2.
agarny Apr 17, 2024
c139ced
Windows: added a header file that is needed on Windows.
agarny Apr 17, 2024
2a9415e
Linux: prevent clashes with the TRUE and FALSE macros.
agarny Apr 17, 2024
c3c8c45
CMake: account for debug.cpp and debug.h in the format_code target.
agarny Apr 17, 2024
03607ef
Debug: refactoring of code.
agarny Apr 17, 2024
1204fb1
InterpreterStatement: temporarily disable some code to get full code …
agarny Apr 17, 2024
a97ac29
Coverage: removed unneeded tests.
agarny Apr 17, 2024
e0f1dbc
Coverage: make sure that we have full coverage in InterpreterStatement.
agarny Apr 17, 2024
9373065
InterpreterStatement: removed the DIFF type.
agarny Apr 18, 2024
0b31297
InterpreterStatement: re-enabled the evaluation of some types.
agarny Apr 18, 2024
7d48ea0
InterpreterStatement: added the evaluation of trigonometric functions.
agarny Apr 18, 2024
b6aa691
GeneratorProfile: simplified the definition of some trigonometric fun…
agarny Apr 18, 2024
9460678
Analyser: allow a `piecewise` element to have no children or only an …
agarny Apr 18, 2024
290beda
InterpreterStatement: don't need the `OTHERWISE` type.
agarny Apr 18, 2024
3f0be73
GeneratorInterpreter: the default profile doesn't have an `XOR` opera…
agarny Apr 18, 2024
3c3df21
InterpreterStatement: can now evaluate a piecewise statement.
agarny Apr 18, 2024
532efc1
Interpreter: allow the evaluation of computeComputedConstants().
agarny Apr 18, 2024
5cd4a41
Utils: moved areNearlyEqual() to src/commonutils.cpp.
agarny Apr 18, 2024
3126a0e
Linux: added a needed header file.
agarny Apr 18, 2024
f835aa5
Interpreter: added support for VOI.
agarny Apr 19, 2024
1148d08
InterpreterStatement: renamed/improved some types
agarny Apr 19, 2024
8077ffa
Analyser: improved code readability.
agarny Apr 19, 2024
6bbb036
Tests: updated the expected values from our InterpreterStatement class.
agarny Apr 18, 2024
a94e396
Interpreter: enable the computation of rates.
agarny Apr 19, 2024
6614251
Interpreter: enable the computation of variables.
agarny Apr 19, 2024
ce7570f
InterpreterStatement: cache a variable's index.
agarny Apr 19, 2024
62dd985
Linux: added the header file for memcpy().
agarny Apr 19, 2024
262608e
Tests: updated our bindings tests for the interpreter.
agarny Apr 19, 2024
53e262a
Linux: added a needed header file for math functions.
agarny Apr 19, 2024
dc51437
InterpreterStatement: use the ternary operator to evaluate a piecewis…
agarny Apr 21, 2024
63f8333
Interpreter: return the states, rates, and variables by reference.
agarny Apr 21, 2024
acb462b
Common utils: export areNearlyEqual().
agarny Apr 21, 2024
265759b
Tests: have a couple of models integrated using computed and interpre…
agarny Apr 21, 2024
208157f
Tests: updated the expected values for the generator tests.
agarny Apr 22, 2024
dcecc8d
GeneratorInterpreter: removed NLA system statements.
agarny Apr 22, 2024
5755083
InterpretStatement: renamed to InterpretAstStatement.
agarny Apr 22, 2024
76e743c
Debug: some minor cleaning up.
agarny Apr 22, 2024
fa196e4
Interpreter: added an RPN-based statement class.
agarny Apr 22, 2024
50a4923
Debug: added a way to print RPN statements.
agarny Apr 22, 2024
cf5da30
Interpreter: removed the RPN-based interpreter.
agarny Apr 23, 2024
03d6043
Interpreter: renamed InterpreterAstStatement to InterpreterStatement.
agarny Apr 23, 2024
960472a
Generator tests: don't compare the compiled and interpreted models.
agarny Apr 23, 2024
0e40acd
Coverage tests: check the values we get from the interpreter.
agarny Apr 23, 2024
91595e1
Clarified some comments and improved our API documentation.
agarny Apr 24, 2024
f2884bc
Some minor cleaning up and improvement to the code.
agarny Apr 24, 2024
d81efdf
GeneratorProfile: updated the version of our C and Python profiles.
agarny Apr 24, 2024
50ef61a
C++: removed some assert() calls.
agarny Apr 24, 2024
f87c44d
GeneratorInterpreter: addressed some coverage issues.
agarny Apr 24, 2024
9900f4e
InterpreterStatement: addressed some coverage issues.
agarny Apr 24, 2024
519faa2
Interpreter: directly use `double *`.
agarny Apr 25, 2024
107fb7b
SWIG: cleaned up the Interpreter interface.
agarny Apr 26, 2024
2bcc1ca
Interpreter: don't keep track of the VOI, states, rates, and variables.
agarny Apr 25, 2024
c922a79
Python bindings: added support for NumPy for Interpreter.
agarny Apr 26, 2024
8fe2e97
Interpreter: temporarily disabled bindings.
agarny Apr 26, 2024
987b3db
Make gcc happy.
agarny Apr 30, 2024
160d855
Merge branch 'main' into issue1218
hsorby May 11, 2024
584ebb5
Merge branch 'main' into issue1218
nickerso May 16, 2024
33a527a
Merge branch 'issue1240' into issue1218.
agarny Jul 3, 2024
83fe400
Updated a generator test as a result of commit 33a527a4.
agarny Jul 3, 2024
4966bad
Some minor cleaning up.
agarny Jul 3, 2024
d51df65
Merge branch 'main' into issue1218.
agarny Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,10 @@ if(CLANG_FORMAT_AVAILABLE)
${SOURCE_FILES}
${HEADER_FILES}
${CONFIG_FILES}
${TESTS_HEADER_FILES}
${DEBUG_SOURCE_FILES}
${DEBUG_HEADER_FILES}
${TESTS_SOURCE_FILES}
${TESTS_HEADER_FILES}
)

set(CHECK_CODE_FORMATTING_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/cmake_command_check_code_formatting.cmake)
Expand Down
10 changes: 10 additions & 0 deletions cmake/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,13 @@ function(redhat_based _RESULT)
endif()
set(${_RESULT} ${_REDHAT_BASED} PARENT_SCOPE)
endfunction()

function(link_libxml2 _TARGET)
if(HAVE_LIBXML2_CONFIG)
target_link_libraries(${_TARGET} PUBLIC ${LIBXML2_TARGET_NAME})
else()
target_include_directories(${_TARGET} PUBLIC ${LIBXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
target_link_libraries(${_TARGET} PUBLIC ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
target_compile_definitions(${_TARGET} PUBLIC ${LIBXML2_DEFINITIONS})
endif()
endfunction()
22 changes: 15 additions & 7 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/entity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/enums.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generatorinterpreter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofiletools.cpp
${CMAKE_CURRENT_SOURCE_DIR}/importedentity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/importer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/importsource.cpp
${CMAKE_CURRENT_SOURCE_DIR}/internaltypes.cpp
${CMAKE_CURRENT_SOURCE_DIR}/interpreter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/interpreterstatement.cpp
${CMAKE_CURRENT_SOURCE_DIR}/issue.cpp
${CMAKE_CURRENT_SOURCE_DIR}/logger.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mathmldtd.cpp
Expand Down Expand Up @@ -94,6 +97,7 @@ set(GIT_API_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/importedentity.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/importer.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/importsource.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/interpreter.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/issue.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/logger.h
${CMAKE_CURRENT_SOURCE_DIR}/api/libcellml/model.h
Expand Down Expand Up @@ -133,9 +137,14 @@ set(GIT_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/debug.h
${CMAKE_CURRENT_SOURCE_DIR}/entity_p.h
${CMAKE_CURRENT_SOURCE_DIR}/generator_p.h
${CMAKE_CURRENT_SOURCE_DIR}/generatorinterpreter_p.h
${CMAKE_CURRENT_SOURCE_DIR}/generatorinterpreter.h
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofilesha1values.h
${CMAKE_CURRENT_SOURCE_DIR}/generatorprofiletools.h
${CMAKE_CURRENT_SOURCE_DIR}/internaltypes.h
${CMAKE_CURRENT_SOURCE_DIR}/interpreter_p.h
${CMAKE_CURRENT_SOURCE_DIR}/interpreterstatement_p.h
${CMAKE_CURRENT_SOURCE_DIR}/interpreterstatement.h
${CMAKE_CURRENT_SOURCE_DIR}/issue_p.h
${CMAKE_CURRENT_SOURCE_DIR}/logger_p.h
${CMAKE_CURRENT_SOURCE_DIR}/mathmldtd.h
Expand Down Expand Up @@ -193,13 +202,7 @@ else()
target_include_directories(cellml PUBLIC ${ZLIB_INCLUDE_DIRS})
endif()

if(HAVE_LIBXML2_CONFIG)
target_link_libraries(cellml PUBLIC ${LIBXML2_TARGET_NAME})
else()
target_include_directories(cellml PUBLIC ${LIBXML2_INCLUDE_DIR} ${ZLIB_INCLUDE_DIRS})
target_link_libraries(cellml PUBLIC ${LIBXML2_LIBRARIES} ${ZLIB_LIBRARIES})
target_compile_definitions(cellml PUBLIC ${LIBXML2_DEFINITIONS})
endif()
link_libxml2(cellml)

# Use target compile features to propagate features to consuming projects.
target_compile_features(cellml PUBLIC cxx_std_17)
Expand All @@ -223,6 +226,8 @@ set(DEBUG_HEADER_FILES

add_library(cellml_debug_utilities STATIC ${DEBUG_SOURCE_FILES} ${DEBUG_HEADER_FILES})

link_libxml2(cellml_debug_utilities)

target_compile_features(cellml_debug_utilities PUBLIC cxx_std_17)

target_include_directories(cellml_debug_utilities
Expand Down Expand Up @@ -382,3 +387,6 @@ set(CONFIG_FILES
${LIBCELLML_VERSIONCONFIG_H_IN}
PARENT_SCOPE
)

set(DEBUG_SOURCE_FILES ${DEBUG_SOURCE_FILES} PARENT_SCOPE)
set(DEBUG_HEADER_FILES ${DEBUG_HEADER_FILES} PARENT_SCOPE)
42 changes: 23 additions & 19 deletions src/analyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ limitations under the License.
#include "analyservariable_p.h"
#include "anycellmlelement_p.h"
#include "commonutils.h"
#include "generator_p.h"
#include "generatorinterpreter_p.h"
#include "issue_p.h"
#include "logger_p.h"
#include "utilities.h"
Expand Down Expand Up @@ -635,6 +635,8 @@ Analyser::AnalyserImpl::AnalyserImpl()
mGeneratorProfile->setAbsoluteValueString("abs");
mGeneratorProfile->setNaturalLogarithmString("ln");
mGeneratorProfile->setCommonLogarithmString("log");
mGeneratorProfile->setMinString("min");
mGeneratorProfile->setMaxString("max");
mGeneratorProfile->setRemString("rem");
mGeneratorProfile->setAsinString("arcsin");
mGeneratorProfile->setAcosString("arccos");
Expand Down Expand Up @@ -945,30 +947,32 @@ void Analyser::AnalyserImpl::analyseNode(const XmlNodePtr &node,

ast->mPimpl->populate(AnalyserEquationAst::Type::PIECEWISE, astParent);

analyseNode(mathmlChildNode(node, 0), ast->mPimpl->mOwnedLeftChild, ast, component, equation);
if (childCount >= 1) {
analyseNode(mathmlChildNode(node, 0), ast->mPimpl->mOwnedLeftChild, ast, component, equation);

if (childCount >= 2) {
AnalyserEquationAstPtr astRight;
AnalyserEquationAstPtr tempAst;
if (childCount >= 2) {
AnalyserEquationAstPtr astRight;
AnalyserEquationAstPtr tempAst;

analyseNode(mathmlChildNode(node, childCount - 1), astRight, nullptr, component, equation);
analyseNode(mathmlChildNode(node, childCount - 1), astRight, nullptr, component, equation);

for (auto i = childCount - 2; i > 0; --i) {
tempAst = AnalyserEquationAst::create();
for (auto i = childCount - 2; i > 0; --i) {
tempAst = AnalyserEquationAst::create();

tempAst->mPimpl->populate(AnalyserEquationAst::Type::PIECEWISE, astParent);
tempAst->mPimpl->populate(AnalyserEquationAst::Type::PIECEWISE, astParent);

analyseNode(mathmlChildNode(node, i), tempAst->mPimpl->mOwnedLeftChild, tempAst, component, equation);
analyseNode(mathmlChildNode(node, i), tempAst->mPimpl->mOwnedLeftChild, tempAst, component, equation);

astRight->mPimpl->mParent = tempAst;
astRight->mPimpl->mParent = tempAst;

tempAst->mPimpl->mOwnedRightChild = astRight;
astRight = tempAst;
}
tempAst->mPimpl->mOwnedRightChild = astRight;
astRight = tempAst;
}

astRight->mPimpl->mParent = ast;
astRight->mPimpl->mParent = ast;

ast->mPimpl->mOwnedRightChild = astRight;
ast->mPimpl->mOwnedRightChild = astRight;
}
}
} else if (node->isMathmlElement("piece")) {
ast->mPimpl->populate(AnalyserEquationAst::Type::PIECE, astParent);
Expand Down Expand Up @@ -2686,9 +2690,9 @@ void Analyser::AnalyserImpl::analyseModel(const ModelPtr &model)
+ "' is";
description += hasPrimaryVariable ?
" the" :
(equivalentVariableCount == 1) ?
" its corresponding" :
" their corresponding";
((equivalentVariableCount == 1) ?
" its corresponding" :
" their corresponding");
description += " primary variable and will therefore be the one used as an external variable.";

referenceRule = Issue::ReferenceRule::ANALYSER_EXTERNAL_VARIABLE_USE_PRIMARY_VARIABLE;
Expand Down
1 change: 0 additions & 1 deletion src/analyservariable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ void AnalyserVariable::AnalyserVariableImpl::populate(AnalyserVariable::Type typ
mIndex = index;
mInitialisingVariable = initialisingVariable;
mVariable = variable;
mComponent = owningComponent(mVariable);

std::copy(equations.begin(), equations.end(), back_inserter(mEquations));
}
Expand Down
1 change: 0 additions & 1 deletion src/analyservariable_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ struct AnalyserVariable::AnalyserVariableImpl
size_t mIndex = 0;
VariablePtr mInitialisingVariable;
VariablePtr mVariable;
ComponentPtr mComponent;
std::vector<AnalyserEquationWeakPtr> mEquations;

static AnalyserVariablePtr create();
Expand Down
4 changes: 2 additions & 2 deletions src/api/libcellml/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ class LIBCELLML_EXPORT Generator
* Return the equation code for the given @ref AnalyserEquationAst using @ref GeneratorProfile.
*
* @param ast The @ref AnalyserEquationAst for which we want to generate some code.
* @param generatorProfile The @ref GeneratorProfile, if any, to use to generate the equation code. If no
* @param profile The @ref GeneratorProfile, if any, to use to generate the equation code. If no
* @ref GeneratorProfile is provided then the default @ref GeneratorProfile is used.
*
* @return The equation code as a @c std::string.
*/
static std::string equationCode(const AnalyserEquationAstPtr &ast,
const GeneratorProfilePtr &generatorProfile);
const GeneratorProfilePtr &profile);

/**
* @brief Get the equation code for the given @ref AnalyserEquationAst using a default @ref GeneratorProfile.
Expand Down
142 changes: 142 additions & 0 deletions src/api/libcellml/interpreter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/*
Copyright libCellML Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#pragma once

#include "libcellml/exportdefinitions.h"
#include "libcellml/types.h"

#include <vector>

namespace libcellml {

/**
* @brief The Interpreter class.
*
* The Interpreter class is for representing a CellML Interpreter.
*
* @warning The Interpreter class currently supports pure algebraic models and ODE models. NLA and DAE models are not
* currently supported and neither are models with external variables.
*/
class LIBCELLML_EXPORT Interpreter
{
public:
~Interpreter(); /**< Destructor, @private. */
Interpreter(const Interpreter &rhs) = delete; /**< Copy constructor, @private. */
Interpreter(Interpreter &&rhs) noexcept = delete; /**< Move constructor, @private. */
Interpreter &operator=(Interpreter rhs) = delete; /**< Assignment operator, @private. */

/**
* @brief Create an @ref Interpreter object.
*
* Factory method to create an @ref Interpreter. Create an interpreter with::
*
* @code
* auto interpreter = libcellml::Interpreter::create();
* @endcode
*
* @return A smart pointer to an @ref Interpreter object.
*/
static InterpreterPtr create() noexcept;

/**
* @brief Get the @ref AnalyserModel.
*
* Get the @ref AnalyserModel used by this @ref Interpreter.
*
* @return The @ref AnalyserModel used.
*/
AnalyserModelPtr model();

/**
* @brief Set the @ref AnalyserModel.
*
* Set the @ref AnalyserModel to be used by this @ref Interpreter.
*
* @param model The @ref AnalyserModel to set.
*/
void setModel(const AnalyserModelPtr &model);

/**
* @brief Initialise the model's variables.
*
* Initialise the model's variables. This method is only relevant for algebraic models.
*
* @param pVariables The array of variables to initialise.
*/
void initialiseVariablesForAlgebraicModel(double *pVariables) const;

/**
* @brief Initialise the model's variables.
*
* Initialise the model's variables. This method is only relevant for differential models.
*
* @param pStates The array of states to initialise.
* @param pRates The array of rates to initialise.
* @param pVariables The array of variables to initialise.
*/
void initialiseVariablesForDifferentialModel(double *pStates, double *pRates, double *pVariables) const;

/**
* @brief Compute the model's computed constants.
*
* Compute the model's computed constants.
*
* @param pVariables The array of variables to compute.
*/
void computeComputedConstants(double *pVariables) const;

/**
* @brief Compute the model's rates.
*
* Compute the model's rates. This method is only relevant for differential models.
*
* @param pVoi The value of the variable of integration.
* @param pStates The array of states.
* @param pRates The array of rates to compute.
* @param pVariables The array of variables.
*/
void computeRates(double pVoi, double *pStates, double *pRates, double *pVariables) const;

/**
* @brief Compute the model's variables.
*
* Compute the model's variables. This method is only relevant for algebraic models.
*
* @param pVariables The array of variables to compute.
*/
void computeVariablesForAlgebraicModel(double *pVariables) const;

/**
* @brief Compute the model's variables.
*
* Compute the model's variables. This method is only relevant for differential models.
*
* @param pVoi The value of the variable of integration.
* @param pStates The array of states.
* @param pRates The array of rates.
* @param pVariables The array of variables to compute.
*/
void computeVariablesForDifferentialModel(double pVoi, double *pStates, double *pRates, double *pVariables) const;

private:
Interpreter(); /**< Constructor, @private. */

struct InterpreterImpl;
InterpreterImpl *mPimpl; /**< Private member to implementation pointer, @private. */
};

} // namespace libcellml
1 change: 1 addition & 0 deletions src/api/libcellml/module/libcellml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ limitations under the License.
#include "libcellml/generatorprofile.h"
#include "libcellml/importer.h"
#include "libcellml/importsource.h"
#include "libcellml/interpreter.h"
#include "libcellml/issue.h"
#include "libcellml/logger.h"
#include "libcellml/model.h"
Expand Down
2 changes: 2 additions & 0 deletions src/api/libcellml/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class GeneratorProfile; /**< Forward declaration of GeneratorProfile class. */
using GeneratorProfilePtr = std::shared_ptr<GeneratorProfile>; /**< Type definition for shared generator variable pointer. */
class Importer; /**< Forward declaration of Importer class. */
using ImporterPtr = std::shared_ptr<Importer>; /**< Type definition for shared importer pointer. */
class Interpreter; /**< Forward declaration of Interpreter class. */
using InterpreterPtr = std::shared_ptr<Interpreter>; /**< Type definition for shared Interpreter pointer. */
class Issue; /**< Forward declaration of Issue class. */
using IssuePtr = std::shared_ptr<Issue>; /**< Type definition for shared issue pointer. */
class Logger; /**< Forward declaration of Parser class. */
Expand Down
Loading