Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 10 additions & 10 deletions src/generatorprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
"#include <stdlib.h>\n";

mInterfaceVersionString = "extern const char VERSION[];\n";
mImplementationVersionString = "const char VERSION[] = \"0.7.0\";\n";
mImplementationVersionString = "const char VERSION[] = \"0.8.0\";\n";

mInterfaceLibcellmlVersionString = "extern const char LIBCELLML_VERSION[];\n";
mImplementationLibcellmlVersionString = "const char LIBCELLML_VERSION[] = \"[LIBCELLML_VERSION]\";\n";
Expand Down Expand Up @@ -489,14 +489,14 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
"[CODE]"
"}\n";

mInterfaceComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraic);\n";
mImplementationComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraic)\n"
mInterfaceComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables);\n";
mImplementationComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables)\n"
"{\n"
"[CODE]"
"}\n";

mInterfaceComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n";
mImplementationComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n"
mInterfaceComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);\n";
mImplementationComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)\n"
"{\n"
"[CODE]"
"}\n";
Expand Down Expand Up @@ -741,7 +741,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
"\n";

mInterfaceVersionString = "";
mImplementationVersionString = "__version__ = \"0.6.0\"\n";
mImplementationVersionString = "__version__ = \"0.8.0\"\n";

mInterfaceLibcellmlVersionString = "";
mImplementationLibcellmlVersionString = "LIBCELLML_VERSION = \"[LIBCELLML_VERSION]\"\n";
Expand Down Expand Up @@ -799,8 +799,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
mRatesArrayString = "rates";
mConstantsArrayString = "constants";
mComputedConstantsArrayString = "computed_constants";
mAlgebraicVariablesArrayString = "algebraicVariables";
mExternalVariablesArrayString = "externalVariables";
mAlgebraicVariablesArrayString = "algebraic_variables";
mExternalVariablesArrayString = "external_variables";

mExternalVariableMethodTypeDefinitionNonDiffString = "";
mExternalVariableMethodTypeDefinitionDiffString = "";
Expand Down Expand Up @@ -928,12 +928,12 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi

mInterfaceComputeComputedConstantsMethodNonDiffString = "";
mImplementationComputeComputedConstantsMethodNonDiffString = "\n"
"def compute_computed_constants(constants, computed_constants, algebraic):\n"
"def compute_computed_constants(constants, computed_constants, algebraic_variables):\n"
"[CODE]";

mInterfaceComputeComputedConstantsMethodDiffString = "";
mImplementationComputeComputedConstantsMethodDiffString = "\n"
"def compute_computed_constants(states, rates, constants, computed_constants, algebraic):\n"
"def compute_computed_constants(states, rates, constants, computed_constants, algebraic_variables ):\n"
"[CODE]";

mInterfaceComputeRatesMethodWoevString = "";
Expand Down
4 changes: 2 additions & 2 deletions src/generatorprofilesha1values.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace libcellml {
* The content of this file is generated, do not edit this file directly.
* See docs/dev_utilities.rst for further information.
*/
static const char C_GENERATOR_PROFILE_SHA1[] = "24b7a2f82510d2f79aeaee509a1b1b04ea1d749b";
static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "b117a2500aae147f477127f0bfb0e2c9e242c6c8";
static const char C_GENERATOR_PROFILE_SHA1[] = "4270b05a372c6224e650ca4efd193fb0f0838b14";
static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "143e1fe4a300b1b447fb8a2eda5144e7aca27e5e";

} // namespace libcellml
10 changes: 5 additions & 5 deletions tests/bindings/python/test_generator_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,12 @@ def test_implementation_compute_computed_constants_method_string(self):

g = GeneratorProfile()

self.assertEqual('void computeComputedConstants(double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n',
self.assertEqual('void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables)\n{\n[CODE]}\n',
g.implementationComputeComputedConstantsMethodString(False))
g.setImplementationComputeComputedConstantsMethodString(False, GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeComputedConstantsMethodString(False))

self.assertEqual('void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n{\n[CODE]}\n',
self.assertEqual('void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)\n{\n[CODE]}\n',
g.implementationComputeComputedConstantsMethodString(True))
g.setImplementationComputeComputedConstantsMethodString(True, GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationComputeComputedConstantsMethodString(True))
Expand Down Expand Up @@ -949,7 +949,7 @@ def test_implementation_version_string(self):

g = GeneratorProfile()

self.assertEqual('const char VERSION[] = "0.7.0";\n', g.implementationVersionString())
self.assertEqual('const char VERSION[] = "0.8.0";\n', g.implementationVersionString())
g.setImplementationVersionString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.implementationVersionString())

Expand Down Expand Up @@ -985,12 +985,12 @@ def test_interface_compute_computed_constants_method_string(self):

g = GeneratorProfile()

self.assertEqual('void computeComputedConstants(double *constants, double *computedConstants, double *algebraic);\n',
self.assertEqual('void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables);\n',
g.interfaceComputeComputedConstantsMethodString(False))
g.setInterfaceComputeComputedConstantsMethodString(False, GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeComputedConstantsMethodString(False))

self.assertEqual('void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n',
self.assertEqual('void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);\n',
g.interfaceComputeComputedConstantsMethodString(True))
g.setInterfaceComputeComputedConstantsMethodString(True, GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.interfaceComputeComputedConstantsMethodString(True))
Expand Down
10 changes: 5 additions & 5 deletions tests/generator/generatorprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ TEST(GeneratorProfile, defaultMiscellaneousValues)
generatorProfile->implementationHeaderString());

EXPECT_EQ("extern const char VERSION[];\n", generatorProfile->interfaceVersionString());
EXPECT_EQ("const char VERSION[] = \"0.7.0\";\n", generatorProfile->implementationVersionString());
EXPECT_EQ("const char VERSION[] = \"0.8.0\";\n", generatorProfile->implementationVersionString());

EXPECT_EQ("extern const char LIBCELLML_VERSION[];\n", generatorProfile->interfaceLibcellmlVersionString());
EXPECT_EQ("const char LIBCELLML_VERSION[] = \"[LIBCELLML_VERSION]\";\n", generatorProfile->implementationLibcellmlVersionString());
Expand Down Expand Up @@ -574,17 +574,17 @@ TEST(GeneratorProfile, defaultMiscellaneousValues)
"}\n",
generatorProfile->implementationInitialiseArraysMethodString(true));

EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraic);\n",
EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables);\n",
generatorProfile->interfaceComputeComputedConstantsMethodString(false));
EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraic)\n"
EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables)\n"
"{\n"
"[CODE]"
"}\n",
generatorProfile->implementationComputeComputedConstantsMethodString(false));

EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n",
EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);\n",
generatorProfile->interfaceComputeComputedConstantsMethodString(true));
EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n"
EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)\n"
"{\n"
"[CODE]"
"}\n",
Expand Down
4 changes: 2 additions & 2 deletions tests/resources/coverage/generator/model.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <math.h>
#include <stdlib.h>

const char VERSION[] = "0.7.0";
const char VERSION[] = "0.8.0";
const char LIBCELLML_VERSION[] = "0.6.3";

const size_t STATE_COUNT = 1;
Expand Down Expand Up @@ -452,7 +452,7 @@ void initialiseArrays(double *states, double *rates, double *constants, double *
algebraicVariables[1] = 1.0;
}

void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)
{
computedConstants[0] = constants[1] == constants[0];
computedConstants[1] = constants[1]/(constants[0] == constants[0]);
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/coverage/generator/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ void deleteArray(double *array);
typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, size_t index);

void initialiseArrays(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void initialiseArrays(double *states, double *rates, double *constants, double *
algebraicVariables[1] = 1.0;
}

void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)
{
computedConstants[0] = eq(constants[1], constants[0]);
computedConstants[1] = constants[1]/eq(constants[0], constants[0]);
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/coverage/generator/model.interface.out
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ void deleteArray(double *array);
typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, size_t index);

void initialiseArrays(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
4 changes: 2 additions & 2 deletions tests/resources/coverage/generator/model.modified.profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <math.h>
#include <stdlib.h>

const char VERSION[] = "0.7.0.post0";
const char VERSION[] = "0.8.0.post0";
const char LIBCELLML_VERSION[] = "0.6.3";

const size_t STATE_COUNT = 1;
Expand Down Expand Up @@ -452,7 +452,7 @@ void initialiseArrays(double *states, double *rates, double *constants, double *
algebraicVariables[1] = 1.0;
}

void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)
{
computedConstants[0] = constants[1] == constants[0];
computedConstants[1] = constants[1]/(constants[0] == constants[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ void deleteArray(double *array);
typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, size_t index);

void initialiseArrays(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
26 changes: 13 additions & 13 deletions tests/resources/coverage/generator/model.modified.profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from math import *


__version__ = "0.6.0.post0"
__version__ = "0.8.0.post0"
LIBCELLML_VERSION = "0.6.3"

STATE_COUNT = 1
Expand Down Expand Up @@ -375,23 +375,23 @@ def objective_function_0(u, f, data):
algebraic_variables = data[5]
external_variables = data[6]

algebraicVariables[0] = u[0]
algebraicVariables[1] = u[1]
algebraic_variables[0] = u[0]
algebraic_variables[1] = u[1]

f[0] = algebraicVariables[1]+algebraicVariables[0]+states[0]-0.0
f[1] = algebraicVariables[1]-algebraicVariables[0]-(computed_constants[198]+computed_constants[197])
f[0] = algebraic_variables[1]+algebraic_variables[0]+states[0]-0.0
f[1] = algebraic_variables[1]-algebraic_variables[0]-(computed_constants[198]+computed_constants[197])


def find_root_0(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables):
u = [nan]*2

u[0] = algebraicVariables[0]
u[1] = algebraicVariables[1]
u[0] = algebraic_variables[0]
u[1] = algebraic_variables[1]

u = nla_solve(objective_function_0, u, 2, [voi, states, rates, constants, computed_constants, algebraic_variables, external_variables])

algebraicVariables[0] = u[0]
algebraicVariables[1] = u[1]
algebraic_variables[0] = u[0]
algebraic_variables[1] = u[1]


def initialise_arrays(states, rates, constants, computed_constants, algebraic_variables):
Expand All @@ -415,11 +415,11 @@ def initialise_arrays(states, rates, constants, computed_constants, algebraic_va
computed_constants[186] = nan
computed_constants[198] = 1.0
computed_constants[197] = 3.0
algebraicVariables[0] = 2.0
algebraicVariables[1] = 1.0
algebraic_variables[0] = 2.0
algebraic_variables[1] = 1.0


def compute_computed_constants(states, rates, constants, computed_constants, algebraic):
def compute_computed_constants(states, rates, constants, computed_constants, algebraic_variables ):
computed_constants[0] = eq_func(constants[1], constants[0])
computed_constants[1] = constants[1]/eq_func(constants[0], constants[0])
computed_constants[2] = neq_func(constants[1], constants[0])
Expand Down Expand Up @@ -614,5 +614,5 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic_v


def compute_variables(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables, external_variable):
externalVariables[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables, 0)
external_variables[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables, 0)
find_root_0(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables)
4 changes: 2 additions & 2 deletions tests/resources/coverage/generator/model.no.tracking.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <math.h>
#include <stdlib.h>

const char VERSION[] = "0.7.0";
const char VERSION[] = "0.8.0";
const char LIBCELLML_VERSION[] = "0.6.3";

const size_t STATE_COUNT = 1;
Expand Down Expand Up @@ -221,7 +221,7 @@ void initialiseArrays(double *states, double *rates, double *constants, double *
algebraicVariables[1] = 1.0;
}

void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)
{
}

Expand Down
Loading
Loading