Skip to content

Commit 7b34e82

Browse files
committed
Generator: have our computedConstants() method use algebraicVariables rather than algebraic.
1 parent 7cc5bea commit 7b34e82

File tree

243 files changed

+2115
-2115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+2115
-2115
lines changed

src/generatorprofile.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
225225
"#include <stdlib.h>\n";
226226

227227
mInterfaceVersionString = "extern const char VERSION[];\n";
228-
mImplementationVersionString = "const char VERSION[] = \"0.7.0\";\n";
228+
mImplementationVersionString = "const char VERSION[] = \"0.8.0\";\n";
229229

230230
mInterfaceLibcellmlVersionString = "extern const char LIBCELLML_VERSION[];\n";
231231
mImplementationLibcellmlVersionString = "const char LIBCELLML_VERSION[] = \"[LIBCELLML_VERSION]\";\n";
@@ -489,14 +489,14 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
489489
"[CODE]"
490490
"}\n";
491491

492-
mInterfaceComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraic);\n";
493-
mImplementationComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraic)\n"
492+
mInterfaceComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables);\n";
493+
mImplementationComputeComputedConstantsMethodNonDiffString = "void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables)\n"
494494
"{\n"
495495
"[CODE]"
496496
"}\n";
497497

498-
mInterfaceComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n";
499-
mImplementationComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n"
498+
mInterfaceComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);\n";
499+
mImplementationComputeComputedConstantsMethodDiffString = "void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)\n"
500500
"{\n"
501501
"[CODE]"
502502
"}\n";
@@ -741,7 +741,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
741741
"\n";
742742

743743
mInterfaceVersionString = "";
744-
mImplementationVersionString = "__version__ = \"0.6.0\"\n";
744+
mImplementationVersionString = "__version__ = \"0.8.0\"\n";
745745

746746
mInterfaceLibcellmlVersionString = "";
747747
mImplementationLibcellmlVersionString = "LIBCELLML_VERSION = \"[LIBCELLML_VERSION]\"\n";
@@ -799,8 +799,8 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
799799
mRatesArrayString = "rates";
800800
mConstantsArrayString = "constants";
801801
mComputedConstantsArrayString = "computed_constants";
802-
mAlgebraicVariablesArrayString = "algebraicVariables";
803-
mExternalVariablesArrayString = "externalVariables";
802+
mAlgebraicVariablesArrayString = "algebraic_variables";
803+
mExternalVariablesArrayString = "external_variables";
804804

805805
mExternalVariableMethodTypeDefinitionNonDiffString = "";
806806
mExternalVariableMethodTypeDefinitionDiffString = "";
@@ -928,12 +928,12 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
928928

929929
mInterfaceComputeComputedConstantsMethodNonDiffString = "";
930930
mImplementationComputeComputedConstantsMethodNonDiffString = "\n"
931-
"def compute_computed_constants(constants, computed_constants, algebraic):\n"
931+
"def compute_computed_constants(constants, computed_constants, algebraic_variables):\n"
932932
"[CODE]";
933933

934934
mInterfaceComputeComputedConstantsMethodDiffString = "";
935935
mImplementationComputeComputedConstantsMethodDiffString = "\n"
936-
"def compute_computed_constants(states, rates, constants, computed_constants, algebraic):\n"
936+
"def compute_computed_constants(states, rates, constants, computed_constants, algebraic_variables ):\n"
937937
"[CODE]";
938938

939939
mInterfaceComputeRatesMethodWoevString = "";

src/generatorprofilesha1values.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace libcellml {
2424
* The content of this file is generated, do not edit this file directly.
2525
* See docs/dev_utilities.rst for further information.
2626
*/
27-
static const char C_GENERATOR_PROFILE_SHA1[] = "24b7a2f82510d2f79aeaee509a1b1b04ea1d749b";
28-
static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "b117a2500aae147f477127f0bfb0e2c9e242c6c8";
27+
static const char C_GENERATOR_PROFILE_SHA1[] = "4270b05a372c6224e650ca4efd193fb0f0838b14";
28+
static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "143e1fe4a300b1b447fb8a2eda5144e7aca27e5e";
2929

3030
} // namespace libcellml

tests/generator/generatorprofile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,17 +574,17 @@ TEST(GeneratorProfile, defaultMiscellaneousValues)
574574
"}\n",
575575
generatorProfile->implementationInitialiseArraysMethodString(true));
576576

577-
EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraic);\n",
577+
EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables);\n",
578578
generatorProfile->interfaceComputeComputedConstantsMethodString(false));
579-
EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraic)\n"
579+
EXPECT_EQ("void computeComputedConstants(double *constants, double *computedConstants, double *algebraicVariables)\n"
580580
"{\n"
581581
"[CODE]"
582582
"}\n",
583583
generatorProfile->implementationComputeComputedConstantsMethodString(false));
584584

585-
EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);\n",
585+
EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);\n",
586586
generatorProfile->interfaceComputeComputedConstantsMethodString(true));
587-
EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)\n"
587+
EXPECT_EQ("void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)\n"
588588
"{\n"
589589
"[CODE]"
590590
"}\n",

tests/resources/coverage/generator/model.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <math.h>
66
#include <stdlib.h>
77

8-
const char VERSION[] = "0.7.0";
8+
const char VERSION[] = "0.8.0";
99
const char LIBCELLML_VERSION[] = "0.6.3";
1010

1111
const size_t STATE_COUNT = 1;
@@ -452,7 +452,7 @@ void initialiseArrays(double *states, double *rates, double *constants, double *
452452
algebraicVariables[1] = 1.0;
453453
}
454454

455-
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
455+
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)
456456
{
457457
computedConstants[0] = constants[1] == constants[0];
458458
computedConstants[1] = constants[1]/(constants[0] == constants[0]);

tests/resources/coverage/generator/model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ void deleteArray(double *array);
3737
typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, size_t index);
3838

3939
void initialiseArrays(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
40-
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);
40+
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
4141
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
4242
void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);

tests/resources/coverage/generator/model.implementation.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ void initialiseArrays(double *states, double *rates, double *constants, double *
211211
algebraicVariables[1] = 1.0;
212212
}
213213

214-
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
214+
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)
215215
{
216216
computedConstants[0] = eq(constants[1], constants[0]);
217217
computedConstants[1] = constants[1]/eq(constants[0], constants[0]);

tests/resources/coverage/generator/model.interface.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ void deleteArray(double *array);
1515
typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, size_t index);
1616

1717
void initialiseArrays(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
18-
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);
18+
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
1919
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
2020
void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);

tests/resources/coverage/generator/model.modified.profile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <math.h>
66
#include <stdlib.h>
77

8-
const char VERSION[] = "0.7.0.post0";
8+
const char VERSION[] = "0.8.0.post0";
99
const char LIBCELLML_VERSION[] = "0.6.3";
1010

1111
const size_t STATE_COUNT = 1;
@@ -452,7 +452,7 @@ void initialiseArrays(double *states, double *rates, double *constants, double *
452452
algebraicVariables[1] = 1.0;
453453
}
454454

455-
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic)
455+
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables)
456456
{
457457
computedConstants[0] = constants[1] == constants[0];
458458
computedConstants[1] = constants[1]/(constants[0] == constants[0]);

tests/resources/coverage/generator/model.modified.profile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ void deleteArray(double *array);
3737
typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, size_t index);
3838

3939
void initialiseArrays(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
40-
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraic);
40+
void computeComputedConstants(double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables);
4141
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);
4242
void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraicVariables, double *externalVariables, ExternalVariable externalVariable);

tests/resources/coverage/generator/model.modified.profile.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from math import *
55

66

7-
__version__ = "0.6.0.post0"
7+
__version__ = "0.8.0.post0"
88
LIBCELLML_VERSION = "0.6.3"
99

1010
STATE_COUNT = 1
@@ -375,23 +375,23 @@ def objective_function_0(u, f, data):
375375
algebraic_variables = data[5]
376376
external_variables = data[6]
377377

378-
algebraicVariables[0] = u[0]
379-
algebraicVariables[1] = u[1]
378+
algebraic_variables[0] = u[0]
379+
algebraic_variables[1] = u[1]
380380

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

384384

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

388-
u[0] = algebraicVariables[0]
389-
u[1] = algebraicVariables[1]
388+
u[0] = algebraic_variables[0]
389+
u[1] = algebraic_variables[1]
390390

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

393-
algebraicVariables[0] = u[0]
394-
algebraicVariables[1] = u[1]
393+
algebraic_variables[0] = u[0]
394+
algebraic_variables[1] = u[1]
395395

396396

397397
def initialise_arrays(states, rates, constants, computed_constants, algebraic_variables):
@@ -415,11 +415,11 @@ def initialise_arrays(states, rates, constants, computed_constants, algebraic_va
415415
computed_constants[186] = nan
416416
computed_constants[198] = 1.0
417417
computed_constants[197] = 3.0
418-
algebraicVariables[0] = 2.0
419-
algebraicVariables[1] = 1.0
418+
algebraic_variables[0] = 2.0
419+
algebraic_variables[1] = 1.0
420420

421421

422-
def compute_computed_constants(states, rates, constants, computed_constants, algebraic):
422+
def compute_computed_constants(states, rates, constants, computed_constants, algebraic_variables ):
423423
computed_constants[0] = eq_func(constants[1], constants[0])
424424
computed_constants[1] = constants[1]/eq_func(constants[0], constants[0])
425425
computed_constants[2] = neq_func(constants[1], constants[0])
@@ -614,5 +614,5 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic_v
614614

615615

616616
def compute_variables(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables, external_variable):
617-
externalVariables[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables, 0)
617+
external_variables[0] = external_variable(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables, 0)
618618
find_root_0(voi, states, rates, constants, computed_constants, algebraic_variables, external_variables)

0 commit comments

Comments
 (0)