Search in sources :

Example 1 with MeasureEquation

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

the class FiniteVolumeFileWriter method writeCompartment_VarContext.

/**
 * Insert the method's description here.
 * Creation date: (5/9/2005 2:52:48 PM)
 * @throws ExpressionException
 */
private void writeCompartment_VarContext(CompartmentSubDomain volSubDomain) throws ExpressionException {
    Simulation simulation = simTask.getSimulation();
    // 
    // get list of volVariables participating in PDEs (anywhere).
    // 
    Vector<VolVariable> pdeVolVariableList = new Vector<VolVariable>();
    Variable[] variables = simTask.getSimulationJob().getSimulationSymbolTable().getVariables();
    for (int i = 0; i < variables.length; i++) {
        if (variables[i] instanceof VolVariable && simulation.getMathDescription().isPDE((VolVariable) variables[i])) {
            pdeVolVariableList.add((VolVariable) variables[i]);
        }
    }
    Enumeration<Equation> enum_equ = volSubDomain.getEquations();
    while (enum_equ.hasMoreElements()) {
        Equation equation = enum_equ.nextElement();
        // for chombo solver, only write equations for variables that are defined in this compartment
        if (!bChomboSolver || equation.getVariable().getDomain().getName().equals(volSubDomain.getName())) {
            if (equation instanceof VolumeRegionEquation) {
                writeCompartmentRegion_VarContext_Equation(volSubDomain, (VolumeRegionEquation) equation);
            } else if (equation instanceof MeasureEquation) {
                throw new RuntimeException("Measure Equation " + equation.getClass().getSimpleName() + " not yet supported in FiniteVolume solvers");
            } else {
                writeCompartment_VarContext_Equation(volSubDomain, equation);
            }
        }
        if (equation instanceof PdeEquation) {
            pdeVolVariableList.remove(equation.getVariable());
        }
    }
    // 
    if (!bChomboSolver) {
        for (int i = 0; i < pdeVolVariableList.size(); i++) {
            VolVariable volVar = pdeVolVariableList.elementAt(i);
            boolean bSteady = simulation.getMathDescription().isPdeSteady(volVar);
            PdeEquation dummyPdeEquation = new PdeEquation(volVar, bSteady, new Expression(0.0), new Expression(0.0), new Expression(0.0));
            writeCompartment_VarContext_Equation(volSubDomain, dummyPdeEquation);
        }
    }
}
Also used : FilamentVariable(cbit.vcell.math.FilamentVariable) VolVariable(cbit.vcell.math.VolVariable) ReservedVariable(cbit.vcell.math.ReservedVariable) ParameterVariable(cbit.vcell.math.ParameterVariable) RandomVariable(cbit.vcell.math.RandomVariable) VolumeRandomVariable(cbit.vcell.math.VolumeRandomVariable) MembraneRegionVariable(cbit.vcell.math.MembraneRegionVariable) VolumeParticleVariable(cbit.vcell.math.VolumeParticleVariable) MembraneRandomVariable(cbit.vcell.math.MembraneRandomVariable) VolumeRegionVariable(cbit.vcell.math.VolumeRegionVariable) MembraneParticleVariable(cbit.vcell.math.MembraneParticleVariable) MemVariable(cbit.vcell.math.MemVariable) Variable(cbit.vcell.math.Variable) VolVariable(cbit.vcell.math.VolVariable) MeasureEquation(cbit.vcell.math.MeasureEquation) PdeEquation(cbit.vcell.math.PdeEquation) VolumeRegionEquation(cbit.vcell.math.VolumeRegionEquation) MembraneRegionEquation(cbit.vcell.math.MembraneRegionEquation) Equation(cbit.vcell.math.Equation) PdeEquation(cbit.vcell.math.PdeEquation) Simulation(cbit.vcell.solver.Simulation) Expression(cbit.vcell.parser.Expression) VolumeRegionEquation(cbit.vcell.math.VolumeRegionEquation) MeasureEquation(cbit.vcell.math.MeasureEquation) Vector(java.util.Vector)

Aggregations

Equation (cbit.vcell.math.Equation)1 FilamentVariable (cbit.vcell.math.FilamentVariable)1 MeasureEquation (cbit.vcell.math.MeasureEquation)1 MemVariable (cbit.vcell.math.MemVariable)1 MembraneParticleVariable (cbit.vcell.math.MembraneParticleVariable)1 MembraneRandomVariable (cbit.vcell.math.MembraneRandomVariable)1 MembraneRegionEquation (cbit.vcell.math.MembraneRegionEquation)1 MembraneRegionVariable (cbit.vcell.math.MembraneRegionVariable)1 ParameterVariable (cbit.vcell.math.ParameterVariable)1 PdeEquation (cbit.vcell.math.PdeEquation)1 RandomVariable (cbit.vcell.math.RandomVariable)1 ReservedVariable (cbit.vcell.math.ReservedVariable)1 Variable (cbit.vcell.math.Variable)1 VolVariable (cbit.vcell.math.VolVariable)1 VolumeParticleVariable (cbit.vcell.math.VolumeParticleVariable)1 VolumeRandomVariable (cbit.vcell.math.VolumeRandomVariable)1 VolumeRegionEquation (cbit.vcell.math.VolumeRegionEquation)1 VolumeRegionVariable (cbit.vcell.math.VolumeRegionVariable)1 Expression (cbit.vcell.parser.Expression)1 Simulation (cbit.vcell.solver.Simulation)1