Skip to content

Commit

Permalink
Generator: renamed the "external" array to "externals".
Browse files Browse the repository at this point in the history
Oversight on my part!
  • Loading branch information
agarny committed Aug 19, 2024
1 parent 40d3fb4 commit b32d169
Show file tree
Hide file tree
Showing 32 changed files with 152 additions and 152 deletions.
4 changes: 2 additions & 2 deletions src/generatorprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
mConstantsArrayString = "constants";
mComputedConstantsArrayString = "computedConstants";
mAlgebraicArrayString = "algebraic";
mExternalArrayString = "external";
mExternalArrayString = "externals";

mExternalVariableMethodTypeDefinitionFamString = "typedef double (* ExternalVariable)(double *variables, size_t index);\n";
mExternalVariableMethodTypeDefinitionFdmString = "typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n";
Expand Down Expand Up @@ -729,7 +729,7 @@ void GeneratorProfile::GeneratorProfileImpl::loadProfile(GeneratorProfile::Profi
mConstantsArrayString = "constants";
mComputedConstantsArrayString = "computed_constants";
mAlgebraicArrayString = "algebraic";
mExternalArrayString = "external";
mExternalArrayString = "externals";

mExternalVariableMethodTypeDefinitionFamString = "";
mExternalVariableMethodTypeDefinitionFdmString = "";
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[] = "323f0e5824d5c794c28f34dda5e7410efc836e62";
static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "3f6672212636b5179b23b9664cead525f54f665f";
static const char C_GENERATOR_PROFILE_SHA1[] = "ad23abd7fbd49d6b76113c14b0d2ec4c7df09d41";
static const char PYTHON_GENERATOR_PROFILE_SHA1[] = "cced8fe15a79248bc3902c9f45637b053243fc98";

} // namespace libcellml
2 changes: 1 addition & 1 deletion tests/bindings/python/test_generator_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ def test_external_array_string(self):

g = GeneratorProfile()

self.assertEqual('external', g.externalArrayString())
self.assertEqual('externals', g.externalArrayString())
g.setExternalArrayString(GeneratorProfileTestCase.VALUE)
self.assertEqual(GeneratorProfileTestCase.VALUE, g.externalArrayString())

Expand Down
2 changes: 1 addition & 1 deletion tests/generator/generatorprofile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ TEST(GeneratorProfile, defaultMiscellaneousValues)
EXPECT_EQ("constants", generatorProfile->constantsArrayString());
EXPECT_EQ("computedConstants", generatorProfile->computedConstantsArrayString());
EXPECT_EQ("algebraic", generatorProfile->algebraicArrayString());
EXPECT_EQ("external", generatorProfile->externalArrayString());
EXPECT_EQ("externals", generatorProfile->externalArrayString());

EXPECT_EQ("typedef double (* ExternalVariable)(double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(false));
EXPECT_EQ("typedef double (* ExternalVariable)(double voi, double *states, double *rates, double *variables, size_t index);\n", generatorProfile->externalVariableMethodTypeDefinitionString(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ void computeComputedConstants(double *constants, double *computedConstants)

void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[0] = externalVariable(variables, 0);
algebraic[0] = external[0];
externals[0] = externalVariable(variables, 0);
algebraic[0] = externals[0];
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ def compute_computed_constants(constants, computed_constants):


def compute_variables(constants, computed_constants, algebraic, external_variable):
external[0] = external_variable(variables, 0)
algebraic[0] = external[0]
externals[0] = external_variable(variables, 0)
algebraic[0] = externals[0]
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ void computeComputedConstants(double *constants, double *computedConstants)

void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[0] = externalVariable(variables, 0);
externals[0] = externalVariable(variables, 0);
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ def compute_computed_constants(constants, computed_constants):


def compute_variables(constants, computed_constants, algebraic, external_variable):
external[0] = external_variable(variables, 0)
externals[0] = external_variable(variables, 0)
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void computeComputedConstants(double *constants, double *computedConstants)

void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[0] = externalVariable(variables, 0);
external[1] = externalVariable(variables, 1);
external[2] = externalVariable(variables, 2);
externals[0] = externalVariable(variables, 0);
externals[1] = externalVariable(variables, 1);
externals[2] = externalVariable(variables, 2);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ def compute_computed_constants(constants, computed_constants):


def compute_variables(constants, computed_constants, algebraic, external_variable):
external[0] = external_variable(variables, 0)
external[1] = external_variable(variables, 1)
external[2] = external_variable(variables, 2)
externals[0] = external_variable(variables, 0)
externals[1] = external_variable(variables, 1)
externals[2] = external_variable(variables, 2)
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ void computeComputedConstants(double *constants, double *computedConstants)

void computeVariables(double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[0] = externalVariable(variables, 0);
external[1] = externalVariable(variables, 1);
algebraic[0] = 1000.0*3.14*external[1]*external[1]*external[0];
externals[0] = externalVariable(variables, 0);
externals[1] = externalVariable(variables, 1);
algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0];
algebraic[1] = 0.02*algebraic[0];
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def compute_computed_constants(constants, computed_constants):


def compute_variables(constants, computed_constants, algebraic, external_variable):
external[0] = external_variable(variables, 0)
external[1] = external_variable(variables, 1)
algebraic[0] = 1000.0*3.14*external[1]*external[1]*external[0]
externals[0] = external_variable(variables, 0)
externals[1] = external_variable(variables, 1)
algebraic[0] = 1000.0*3.14*externals[1]*externals[1]*externals[0]
algebraic[1] = 0.02*algebraic[0]
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ void computeComputedConstants(double *constants, double *computedConstants)

void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[0] = externalVariable(voi, states, rates, variables, 0);
externals[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[0] = constants[2]*(states[0]-computedConstants[0]);
algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]);
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]);
rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0];
rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0];
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0);
algebraic[4] = 4.0*exp(states[0]/18.0);
rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2];
Expand All @@ -153,7 +153,7 @@ void computeRates(double voi, double *states, double *rates, double *constants,

void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[0] = externalVariable(voi, states, rates, variables, 0);
externals[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[0] = constants[2]*(states[0]-computedConstants[0]);
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]);
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def compute_computed_constants(constants, computed_constants):


def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable):
external[0] = external_variable(voi, states, rates, variables, 0)
externals[0] = external_variable(voi, states, rates, variables, 0)
algebraic[0] = constants[2]*(states[0]-computed_constants[0])
algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2])
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1])
rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]
rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)
algebraic[4] = 4.0*exp(states[0]/18.0)
rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2]
Expand All @@ -121,7 +121,7 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic,


def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable):
external[0] = external_variable(voi, states, rates, variables, 0)
externals[0] = external_variable(voi, states, rates, variables, 0)
algebraic[0] = constants[2]*(states[0]-computed_constants[0])
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1])
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ void computeComputedConstants(double *constants, double *computedConstants)
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0;
external[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[1] = constants[2]*(states[0]-external[0]);
externals[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[1] = constants[2]*(states[0]-externals[0]);
algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[1]);
algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]);
rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0];
Expand All @@ -153,8 +153,8 @@ void computeRates(double voi, double *states, double *rates, double *constants,

void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[1] = constants[2]*(states[0]-external[0]);
externals[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[1] = constants[2]*(states[0]-externals[0]);
algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[0]);
algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0);
algebraic[5] = 4.0*exp(states[0]/18.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def compute_computed_constants(constants, computed_constants):

def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable):
algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0
external[0] = external_variable(voi, states, rates, variables, 0)
algebraic[1] = constants[2]*(states[0]-external[0])
externals[0] = external_variable(voi, states, rates, variables, 0)
algebraic[1] = constants[2]*(states[0]-externals[0])
algebraic[2] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[1])
algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0])
rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/constants[0]
Expand All @@ -121,8 +121,8 @@ def compute_rates(voi, states, rates, constants, computed_constants, algebraic,


def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable):
external[0] = external_variable(voi, states, rates, variables, 0)
algebraic[1] = constants[2]*(states[0]-external[0])
externals[0] = external_variable(voi, states, rates, variables, 0)
algebraic[1] = constants[2]*(states[0]-externals[0])
algebraic[3] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[0])
algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)
algebraic[5] = 4.0*exp(states[0]/18.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ void computeComputedConstants(double *constants, double *computedConstants)
void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
algebraic[0] = ((voi >= 10.0) && (voi <= 10.5))?-20.0:0.0;
external[0] = externalVariable(voi, states, rates, variables, 0);
externals[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[1] = constants[1]*(states[0]-computedConstants[0]);
algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]);
algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]);
rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0];
rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/externals[0];
algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0);
algebraic[5] = 4.0*exp(states[0]/18.0);
rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2];
Expand All @@ -162,5 +162,5 @@ void computeVariables(double voi, double *states, double *rates, double *constan
algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computedConstants[2]);
algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0);
algebraic[9] = 0.125*exp(states[0]/80.0);
external[0] = externalVariable(voi, states, rates, variables, 0);
externals[0] = externalVariable(voi, states, rates, variables, 0);
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def compute_computed_constants(constants, computed_constants):

def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable):
algebraic[0] = -20.0 if and_func(geq_func(voi, 10.0), leq_func(voi, 10.5)) else 0.0
external[0] = external_variable(voi, states, rates, variables, 0)
externals[0] = external_variable(voi, states, rates, variables, 0)
algebraic[1] = constants[1]*(states[0]-computed_constants[0])
algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2])
algebraic[3] = constants[2]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1])
rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/external[0]
rates[0] = -(-algebraic[0]+algebraic[3]+algebraic[2]+algebraic[1])/externals[0]
algebraic[4] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)
algebraic[5] = 4.0*exp(states[0]/18.0)
rates[2] = algebraic[4]*(1.0-states[2])-algebraic[5]*states[2]
Expand All @@ -130,4 +130,4 @@ def compute_variables(voi, states, rates, constants, computed_constants, algebra
algebraic[2] = constants[3]*pow(states[3], 4.0)*(states[0]-computed_constants[2])
algebraic[8] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)
algebraic[9] = 0.125*exp(states[0]/80.0)
external[0] = external_variable(voi, states, rates, variables, 0)
externals[0] = external_variable(voi, states, rates, variables, 0)
Original file line number Diff line number Diff line change
Expand Up @@ -135,26 +135,26 @@ void computeComputedConstants(double *constants, double *computedConstants)

void computeRates(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[1] = externalVariable(voi, states, rates, variables, 1);
external[0] = externalVariable(voi, states, rates, variables, 0);
externals[1] = externalVariable(voi, states, rates, variables, 1);
externals[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[0] = constants[2]*(states[0]-computedConstants[0]);
algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computedConstants[2]);
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]);
rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0];
rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0];
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0);
algebraic[4] = 4.0*exp(states[0]/18.0);
rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2];
algebraic[5] = 0.07*exp(states[0]/20.0);
algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0);
rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1];
algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0);
rates[3] = algebraic[7]*(1.0-states[3])-external[1]*states[3];
rates[3] = algebraic[7]*(1.0-states[3])-externals[1]*states[3];
}

void computeVariables(double voi, double *states, double *rates, double *constants, double *computedConstants, double *algebraic, ExternalVariable externalVariable)
{
external[1] = externalVariable(voi, states, rates, variables, 1);
external[0] = externalVariable(voi, states, rates, variables, 0);
externals[1] = externalVariable(voi, states, rates, variables, 1);
externals[0] = externalVariable(voi, states, rates, variables, 0);
algebraic[0] = constants[2]*(states[0]-computedConstants[0]);
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computedConstants[1]);
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,25 +104,25 @@ def compute_computed_constants(constants, computed_constants):


def compute_rates(voi, states, rates, constants, computed_constants, algebraic, external_variable):
external[1] = external_variable(voi, states, rates, variables, 1)
external[0] = external_variable(voi, states, rates, variables, 0)
externals[1] = external_variable(voi, states, rates, variables, 1)
externals[0] = external_variable(voi, states, rates, variables, 0)
algebraic[0] = constants[2]*(states[0]-computed_constants[0])
algebraic[1] = constants[4]*pow(states[3], 4.0)*(states[0]-computed_constants[2])
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1])
rates[0] = -(-external[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]
rates[0] = -(-externals[0]+algebraic[2]+algebraic[1]+algebraic[0])/constants[0]
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)
algebraic[4] = 4.0*exp(states[0]/18.0)
rates[2] = algebraic[3]*(1.0-states[2])-algebraic[4]*states[2]
algebraic[5] = 0.07*exp(states[0]/20.0)
algebraic[6] = 1.0/(exp((states[0]+30.0)/10.0)+1.0)
rates[1] = algebraic[5]*(1.0-states[1])-algebraic[6]*states[1]
algebraic[7] = 0.01*(states[0]+10.0)/(exp((states[0]+10.0)/10.0)-1.0)
rates[3] = algebraic[7]*(1.0-states[3])-external[1]*states[3]
rates[3] = algebraic[7]*(1.0-states[3])-externals[1]*states[3]


def compute_variables(voi, states, rates, constants, computed_constants, algebraic, external_variable):
external[1] = external_variable(voi, states, rates, variables, 1)
external[0] = external_variable(voi, states, rates, variables, 0)
externals[1] = external_variable(voi, states, rates, variables, 1)
externals[0] = external_variable(voi, states, rates, variables, 0)
algebraic[0] = constants[2]*(states[0]-computed_constants[0])
algebraic[2] = constants[3]*pow(states[2], 3.0)*states[1]*(states[0]-computed_constants[1])
algebraic[3] = 0.1*(states[0]+25.0)/(exp((states[0]+25.0)/10.0)-1.0)
Expand Down
Loading

0 comments on commit b32d169

Please sign in to comment.