Search in sources :

Example 6 with FilamentRegionVariable

use of cbit.vcell.math.FilamentRegionVariable in project vcell by virtualcell.

the class MathTestingUtilities method substituteWithExactSolution.

/**
 * Insert the method's description here.
 * Creation date: (1/24/2003 10:18:14 AM)
 * @return cbit.vcell.parser.Expression
 * @param origExp cbit.vcell.parser.Expression
 * @param subDomain cbit.vcell.math.SubDomain
 */
private static Expression substituteWithExactSolution(Expression origExp, MembraneSubDomain subDomain, MathDescription exactMathDesc) throws ExpressionException {
    Expression substitutedExp = new Expression(origExp);
    substitutedExp.bindExpression(exactMathDesc);
    substitutedExp = MathUtilities.substituteFunctions(substitutedExp, exactMathDesc);
    substitutedExp.bindExpression(null);
    substitutedExp = substitutedExp.flatten();
    substitutedExp.bindExpression(exactMathDesc);
    String[] symbols = substitutedExp.getSymbols();
    for (int i = 0; symbols != null && i < symbols.length; i++) {
        Variable var = (Variable) substitutedExp.getSymbolBinding(symbols[i]);
        if (var instanceof MemVariable) {
            String exactVarName = var.getName() + "_" + subDomain.getName() + "_exact";
            substitutedExp.substituteInPlace(new Expression(var.getName()), new Expression(exactVarName));
        } else if (var instanceof InsideVariable) {
            String exactVarName = var.getName() + "_" + subDomain.getInsideCompartment().getName() + "_exact";
            substitutedExp.substituteInPlace(new Expression(var.getName()), new Expression(exactVarName));
        } else if (var instanceof OutsideVariable) {
            String exactVarName = var.getName() + "_" + subDomain.getOutsideCompartment().getName() + "_exact";
            substitutedExp.substituteInPlace(new Expression(var.getName()), new Expression(exactVarName));
        } else if (var instanceof VolumeRegionVariable || var instanceof MemVariable || var instanceof MembraneRegionVariable || var instanceof FilamentVariable || var instanceof FilamentRegionVariable) {
            throw new RuntimeException("variable substitution not yet implemented for Variable type " + var.getClass().getName() + "(" + var.getName() + ")");
        }
    }
    substitutedExp.bindExpression(null);
    return substitutedExp;
}
Also used : MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) InsideVariable(cbit.vcell.math.InsideVariable) SensVariable(cbit.vcell.solver.ode.SensVariable) FilamentVariable(cbit.vcell.math.FilamentVariable) VolVariable(cbit.vcell.math.VolVariable) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) ReservedVariable(cbit.vcell.math.ReservedVariable) MemVariable(cbit.vcell.math.MemVariable) OutsideVariable(cbit.vcell.math.OutsideVariable) FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) Variable(cbit.vcell.math.Variable) MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) InsideVariable(cbit.vcell.math.InsideVariable) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) MemVariable(cbit.vcell.math.MemVariable) Expression(cbit.vcell.parser.Expression) FilamentVariable(cbit.vcell.math.FilamentVariable) OutsideVariable(cbit.vcell.math.OutsideVariable)

Example 7 with FilamentRegionVariable

use of cbit.vcell.math.FilamentRegionVariable in project vcell by virtualcell.

the class MathTestingUtilities method substituteWithExactSolution.

/**
 * Insert the method's description here.
 * Creation date: (1/24/2003 10:18:14 AM)
 * @return cbit.vcell.parser.Expression
 * @param origExp cbit.vcell.parser.Expression
 * @param subDomain cbit.vcell.math.SubDomain
 */
private static Expression substituteWithExactSolution(Expression origExp, CompartmentSubDomain subDomain, MathDescription exactMathDesc) throws ExpressionException {
    Expression substitutedExp = new Expression(origExp);
    substitutedExp.bindExpression(exactMathDesc);
    substitutedExp = MathUtilities.substituteFunctions(substitutedExp, exactMathDesc);
    substitutedExp.bindExpression(null);
    substitutedExp = substitutedExp.flatten();
    substitutedExp.bindExpression(exactMathDesc);
    String[] symbols = substitutedExp.getSymbols();
    for (int i = 0; i < symbols.length; i++) {
        Variable var = (Variable) substitutedExp.getSymbolBinding(symbols[i]);
        if (var instanceof VolVariable) {
            String exactVarName = var.getName() + "_" + subDomain.getName() + "_exact";
            substitutedExp.substituteInPlace(new Expression(var.getName()), new Expression(exactVarName));
        } else if (var instanceof VolumeRegionVariable || var instanceof MemVariable || var instanceof MembraneRegionVariable || var instanceof FilamentVariable || var instanceof FilamentRegionVariable) {
            throw new RuntimeException("variable substitution not yet implemented for Variable type " + var.getClass().getName() + "(" + var.getName() + ")");
        }
    }
    substitutedExp.bindExpression(null);
    return substitutedExp;
}
Also used : VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) InsideVariable(cbit.vcell.math.InsideVariable) SensVariable(cbit.vcell.solver.ode.SensVariable) FilamentVariable(cbit.vcell.math.FilamentVariable) VolVariable(cbit.vcell.math.VolVariable) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) ReservedVariable(cbit.vcell.math.ReservedVariable) MemVariable(cbit.vcell.math.MemVariable) OutsideVariable(cbit.vcell.math.OutsideVariable) FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) Variable(cbit.vcell.math.Variable) MemVariable(cbit.vcell.math.MemVariable) MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) Expression(cbit.vcell.parser.Expression) VolVariable(cbit.vcell.math.VolVariable) FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) FilamentVariable(cbit.vcell.math.FilamentVariable)

Example 8 with FilamentRegionVariable

use of cbit.vcell.math.FilamentRegionVariable in project vcell by virtualcell.

the class XmlReader method getFilamentRegionVariable.

/**
 * This method returns a FilamentRegionVariable object from a XML Element.
 * Creation date: (5/16/2001 2:56:34 PM)
 * @return cbit.vcell.math.FilamentRegionVariable
 * @param param org.jdom.Element
 */
private FilamentRegionVariable getFilamentRegionVariable(Element param) {
    String name = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
    String domainStr = unMangle(param.getAttributeValue(XMLTags.DomainAttrTag));
    Domain domain = null;
    if (domainStr != null) {
        domain = new Domain(domainStr);
    }
    // -- create new FilamentRegionVariable object
    FilamentRegionVariable filRegVariable = new FilamentRegionVariable(name, domain);
    transcribeComments(param, filRegVariable);
    return filRegVariable;
}
Also used : FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) MembraneSubDomain(cbit.vcell.math.MembraneSubDomain) CompartmentSubDomain(cbit.vcell.math.CompartmentSubDomain) FilamentSubDomain(cbit.vcell.math.FilamentSubDomain) PointSubDomain(cbit.vcell.math.PointSubDomain) Domain(cbit.vcell.math.Variable.Domain)

Aggregations

FilamentRegionVariable (cbit.vcell.math.FilamentRegionVariable)8 FilamentVariable (cbit.vcell.math.FilamentVariable)7 MemVariable (cbit.vcell.math.MemVariable)7 MembraneRegionVariable (cbit.vcell.math.MembraneRegionVariable)7 Variable (cbit.vcell.math.Variable)7 VolVariable (cbit.vcell.math.VolVariable)7 VolumeRegionVariable (cbit.vcell.math.VolumeRegionVariable)7 InsideVariable (cbit.vcell.math.InsideVariable)5 OutsideVariable (cbit.vcell.math.OutsideVariable)5 ReservedVariable (cbit.vcell.math.ReservedVariable)4 Expression (cbit.vcell.parser.Expression)4 SensVariable (cbit.vcell.solver.ode.SensVariable)4 CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)3 Constant (cbit.vcell.math.Constant)3 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)3 FilamentSubDomain (cbit.vcell.math.FilamentSubDomain)2 Function (cbit.vcell.math.Function)2 MathDescription (cbit.vcell.math.MathDescription)2 ParticleVariable (cbit.vcell.math.ParticleVariable)2 PointSubDomain (cbit.vcell.math.PointSubDomain)2