use of cbit.vcell.math.PseudoConstant in project vcell by virtualcell.
the class DefaultODESolver method createIdentifiers.
/**
* This method was created in VisualAge.
*/
private Vector<Variable> createIdentifiers() throws MathException, ExpressionException {
SimulationSymbolTable simSymbolTable = simTask.getSimulationJob().getSimulationSymbolTable();
// create list of possible identifiers (including reserved x,y,z,t)
Vector<Variable> identifiers = new Vector<Variable>();
// add reserved variables x,y,z,t
identifiers.addElement(ReservedVariable.TIME);
identifiers.addElement(ReservedVariable.X);
identifiers.addElement(ReservedVariable.Y);
identifiers.addElement(ReservedVariable.Z);
// add regular variables
Variable[] variables = simSymbolTable.getVariables();
for (int i = 0; i < variables.length; i++) {
if (variables[i] instanceof VolVariable) {
identifiers.addElement(variables[i]);
}
}
// Add sensitivity variables (for sensitivity equations)...
fieldSensVariables = new Vector<SensVariable>();
if (getSensitivityParameter() != null) {
for (int i = 0; i < variables.length; i++) {
if (variables[i] instanceof VolVariable) {
VolVariable volVariable = (VolVariable) variables[i];
SensVariable sv = new SensVariable(volVariable, getSensitivityParameter());
identifiers.addElement(sv);
}
}
}
// Add pseudoConstants for fast system (if necessary)...
if (getFastAlgebraicSystem() != null) {
Enumeration<PseudoConstant> enum1 = fieldFastAlgebraicSystem.getPseudoConstants();
while (enum1.hasMoreElements()) {
identifiers.addElement(enum1.nextElement());
}
}
// Assign indices...
for (int i = 0; i < identifiers.size(); i++) {
Variable variable = (Variable) identifiers.elementAt(i);
variable.setIndex(i);
}
return (identifiers);
}
use of cbit.vcell.math.PseudoConstant in project vcell by virtualcell.
the class FastAlgebraicSystem method initVars.
/**
* initVars method comment.
*/
public void initVars(double[] oldValues, double[] newValues) throws ExpressionException, MathException {
//
// calculate C's for invariants
//
Enumeration<PseudoConstant> enum_pc = fs_analyzer.getPseudoConstants();
while (enum_pc.hasMoreElements()) {
PseudoConstant pc = enum_pc.nextElement();
int index = pc.getIndex();
oldValues[index] = pc.getPseudoExpression().evaluateVector(oldValues);
newValues[index] = oldValues[index];
}
}
Aggregations