use of cbit.vcell.math.FastRate in project vcell by virtualcell.
the class FastSystemAnalyzer method refreshFastVarList.
/**
* @return java.util.Vector
*/
private void refreshFastVarList() throws MathException, ExpressionException {
fastVarList.clear();
//
// get list of unique (VolVariables and MemVariables) in fastRate expressions
//
Enumeration<FastRate> fastRatesEnum = fastSystem.getFastRates();
while (fastRatesEnum.hasMoreElements()) {
FastRate fr = fastRatesEnum.nextElement();
Expression exp = fr.getFunction();
Enumeration<Variable> enum1 = MathUtilities.getRequiredVariables(exp, this);
while (enum1.hasMoreElements()) {
Variable var = enum1.nextElement();
if (var instanceof VolVariable || var instanceof MemVariable) {
if (!fastVarList.contains(var)) {
fastVarList.addElement(var);
// System.out.println("FastSystemImplicit.refreshFastVarList(), FAST RATE VARIABLE: "+var.getName());
}
}
}
}
//
// get list of all variables used in invariant expressions that are not used in fast rates
//
Enumeration<FastInvariant> fastInvariantsEnum = fastSystem.getFastInvariants();
while (fastInvariantsEnum.hasMoreElements()) {
FastInvariant fi = (FastInvariant) fastInvariantsEnum.nextElement();
Expression exp = fi.getFunction();
// System.out.println("FastSystemImplicit.refreshFastVarList(), ORIGINAL FAST INVARIANT: "+exp);
Enumeration<Variable> enum1 = MathUtilities.getRequiredVariables(exp, this);
while (enum1.hasMoreElements()) {
Variable var = enum1.nextElement();
if (var instanceof VolVariable || var instanceof MemVariable) {
if (!fastVarList.contains(var)) {
fastVarList.addElement(var);
}
}
}
}
//
// verify that there are N equations (rates+invariants) and N unknowns (fastVariables)
//
int numBoundFunctions = fastSystem.getNumFastInvariants() + fastSystem.getNumFastRates();
if (fastVarList.size() != numBoundFunctions) {
throw new MathException("FastSystem.checkDimension(), there are " + fastVarList.size() + " variables and " + numBoundFunctions + " FastInvariant's & FastRates");
}
}
use of cbit.vcell.math.FastRate in project vcell by virtualcell.
the class Xmlproducer method getXML.
/**
* This method returns a XML representation of a FastSystemImplicit object.
* Creation date: (3/2/2001 4:05:28 PM)
* @return Element
* @param param cbit.vcell.math.FastSystemImplicit
*/
private Element getXML(FastSystem param) {
Element fastsystem = new Element(XMLTags.FastSystemTag);
// Add Fast Invariant subelements
Element fastinvariant;
Enumeration<FastInvariant> enum_fi = param.getFastInvariants();
while (enum_fi.hasMoreElements()) {
fastinvariant = new Element(XMLTags.FastInvariantTag);
FastInvariant fi = enum_fi.nextElement();
fastinvariant.addContent(mangleExpression(fi.getFunction()));
fastsystem.addContent(fastinvariant);
}
// Add FastRate subelements
Element fastrate;
Enumeration<FastRate> enum_fr = param.getFastRates();
while (enum_fr.hasMoreElements()) {
FastRate fr = (FastRate) enum_fr.nextElement();
fastrate = new Element(XMLTags.FastRateTag);
fastrate.addContent(mangleExpression(fr.getFunction()));
fastsystem.addContent(fastrate);
}
return fastsystem;
}
use of cbit.vcell.math.FastRate in project vcell by virtualcell.
the class ITextWriter method writeFastSystem.
protected void writeFastSystem(Section container, FastSystem fs) throws DocumentException {
Table eqTable = getTable(2, 100, 1, 2, 2);
eqTable.addCell(createCell(VCML.FastSystem, getBold(DEF_HEADER_FONT_SIZE), 2, 1, Element.ALIGN_CENTER, true));
eqTable.endHeaders();
Enumeration<FastInvariant> enum_fi = fs.getFastInvariants();
while (enum_fi.hasMoreElements()) {
FastInvariant fi = enum_fi.nextElement();
eqTable.addCell(createCell(VCML.FastInvariant, getFont()));
eqTable.addCell(createCell(fi.getFunction().infix(), getFont()));
}
Enumeration<FastRate> enum_fr = fs.getFastRates();
while (enum_fr.hasMoreElements()) {
FastRate fr = enum_fr.nextElement();
eqTable.addCell(createCell(VCML.FastRate, getFont()));
eqTable.addCell(createCell(fr.getFunction().infix(), getFont()));
}
container.add(eqTable);
}
Aggregations