Search in sources :

Example 1 with FilamentRegionEquation

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

the class ModelOptimizationSpec method fromMath.

/**
 * Insert the method's description here.
 * Creation date: (11/1/2005 8:11:32 PM)
 * @return cbit.vcell.mapping.MathSystemHash
 * @param mathDesc cbit.vcell.math.MathDescription
 */
private static MathSystemHash fromMath(cbit.vcell.math.MathDescription mathDesc) {
    MathSystemHash hash = new MathSystemHash();
    hash.addSymbol(new MathSystemHash.IndependentVariable("t"));
    hash.addSymbol(new MathSystemHash.IndependentVariable("x"));
    hash.addSymbol(new MathSystemHash.IndependentVariable("y"));
    hash.addSymbol(new MathSystemHash.IndependentVariable("z"));
    Variable[] vars = (Variable[]) BeanUtils.getArray(mathDesc.getVariables(), Variable.class);
    for (int i = 0; i < vars.length; i++) {
        hash.addSymbol(new MathSystemHash.Variable(vars[i].getName(), vars[i].getExpression()));
    }
    SubDomain[] subDomains = (SubDomain[]) BeanUtils.getArray(mathDesc.getSubDomains(), SubDomain.class);
    for (int i = 0; i < subDomains.length; i++) {
        Equation[] equations = (Equation[]) BeanUtils.getArray(subDomains[i].getEquations(), Equation.class);
        for (int j = 0; j < equations.length; j++) {
            MathSystemHash.Variable var = (MathSystemHash.Variable) hash.getSymbol(equations[j].getVariable().getName());
            hash.addSymbol(new MathSystemHash.VariableInitial(var, equations[j].getInitialExpression()));
            if (equations[j] instanceof PdeEquation) {
                // hash.addSymbol(new MathSystemHash.VariableDerivative(var,pde.getRateExpression()));
                throw new RuntimeException("MathSystemHash doesn't yet support spatial models");
            } else if (equations[j] instanceof VolumeRegionEquation) {
                // hash.addSymbol(new MathSystemHash.VariableDerivative(var,vre.getRateExpression()));
                throw new RuntimeException("MathSystemHash doesn't yet support spatial models");
            } else if (equations[j] instanceof MembraneRegionEquation) {
                // hash.addSymbol(new MathSystemHash.VariableDerivative(var,mre.getRateExpression()));
                throw new RuntimeException("MathSystemHash doesn't yet support spatial models");
            } else if (equations[j] instanceof FilamentRegionEquation) {
                // hash.addSymbol(new MathSystemHash.VariableDerivative(var,fre.getRateExpression()));
                throw new RuntimeException("MathSystemHash doesn't yet support spatial models");
            } else if (equations[j] instanceof OdeEquation) {
                OdeEquation ode = (OdeEquation) equations[j];
                hash.addSymbol(new MathSystemHash.VariableDerivative(var, ode.getRateExpression()));
            }
        }
    }
    return hash;
}
Also used : MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) FilamentVariable(cbit.vcell.math.FilamentVariable) VolVariable(cbit.vcell.math.VolVariable) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) MemVariable(cbit.vcell.math.MemVariable) FilamentRegionVariable(cbit.vcell.math.FilamentRegionVariable) Variable(cbit.vcell.math.Variable) VolumeRegionEquation(cbit.vcell.math.VolumeRegionEquation) OdeEquation(cbit.vcell.math.OdeEquation) FilamentRegionEquation(cbit.vcell.math.FilamentRegionEquation) MembraneRegionEquation(cbit.vcell.math.MembraneRegionEquation) PdeEquation(cbit.vcell.math.PdeEquation) Equation(cbit.vcell.math.Equation) SubDomain(cbit.vcell.math.SubDomain) PdeEquation(cbit.vcell.math.PdeEquation) FilamentRegionEquation(cbit.vcell.math.FilamentRegionEquation) OdeEquation(cbit.vcell.math.OdeEquation) VolumeRegionEquation(cbit.vcell.math.VolumeRegionEquation) MembraneRegionEquation(cbit.vcell.math.MembraneRegionEquation)

Aggregations

Equation (cbit.vcell.math.Equation)1 FilamentRegionEquation (cbit.vcell.math.FilamentRegionEquation)1 FilamentRegionVariable (cbit.vcell.math.FilamentRegionVariable)1 FilamentVariable (cbit.vcell.math.FilamentVariable)1 MemVariable (cbit.vcell.math.MemVariable)1 MembraneRegionEquation (cbit.vcell.math.MembraneRegionEquation)1 MembraneRegionVariable (cbit.vcell.math.MembraneRegionVariable)1 OdeEquation (cbit.vcell.math.OdeEquation)1 PdeEquation (cbit.vcell.math.PdeEquation)1 SubDomain (cbit.vcell.math.SubDomain)1 Variable (cbit.vcell.math.Variable)1 VolVariable (cbit.vcell.math.VolVariable)1 VolumeRegionEquation (cbit.vcell.math.VolumeRegionEquation)1 VolumeRegionVariable (cbit.vcell.math.VolumeRegionVariable)1