Search in sources :

Example 6 with ParticleInitialConditionCount

use of cbit.vcell.math.ParticleProperties.ParticleInitialConditionCount in project vcell by virtualcell.

the class Xmlproducer method getXML.

private org.jdom.Element getXML(ParticleProperties param) throws XmlParseException {
    org.jdom.Element particleProperties = new org.jdom.Element(XMLTags.ParticlePropertiesTag);
    particleProperties.setAttribute(XMLTags.NameAttrTag, mangle(param.getVariable().getName()));
    for (ParticleInitialCondition pic : param.getParticleInitialConditions()) {
        org.jdom.Element particleInitial = null;
        if (pic instanceof ParticleInitialConditionCount) {
            particleInitial = new org.jdom.Element(XMLTags.ParticleInitialCountTag);
            ParticleInitialConditionCount ppic = (ParticleInitialConditionCount) pic;
            Element e = new Element(XMLTags.ParticleCountTag);
            e.setText(mangleExpression(ppic.getCount()));
            particleInitial.addContent(e);
            if (ppic.getLocationX() != null) {
                e = new Element(XMLTags.ParticleLocationXTag);
                e.setText(mangleExpression(ppic.getLocationX()));
                particleInitial.addContent(e);
            }
            if (ppic.getLocationY() != null) {
                e = new Element(XMLTags.ParticleLocationYTag);
                e.setText(mangleExpression(ppic.getLocationY()));
                particleInitial.addContent(e);
            }
            if (ppic.getLocationZ() != null) {
                e = new Element(XMLTags.ParticleLocationZTag);
                e.setText(mangleExpression(ppic.getLocationZ()));
                particleInitial.addContent(e);
            }
        } else if (pic instanceof ParticleInitialConditionConcentration) {
            particleInitial = new org.jdom.Element(XMLTags.ParticleInitialConcentrationTag);
            ParticleInitialConditionConcentration ppic = (ParticleInitialConditionConcentration) pic;
            Element e = new Element(XMLTags.ParticleDistributionTag);
            e.setText(mangleExpression(ppic.getDistribution()));
            particleInitial.addContent(e);
        }
        particleProperties.addContent(particleInitial);
    }
    Element diff = new Element(XMLTags.ParticleDiffusionTag);
    diff.setText(mangleExpression(param.getDiffusion()));
    particleProperties.addContent(diff);
    if (param.getDriftX() != null) {
        Element driftX = new Element(XMLTags.ParticleDriftXTag);
        driftX.setText(mangleExpression(param.getDriftX()));
        particleProperties.addContent(driftX);
    }
    if (param.getDriftY() != null) {
        Element driftY = new Element(XMLTags.ParticleDriftYTag);
        driftY.setText(mangleExpression(param.getDriftY()));
        particleProperties.addContent(driftY);
    }
    if (param.getDriftZ() != null) {
        Element driftZ = new Element(XMLTags.ParticleDriftZTag);
        driftZ.setText(mangleExpression(param.getDriftZ()));
        particleProperties.addContent(driftZ);
    }
    return particleProperties;
}
Also used : ParticleInitialConditionConcentration(cbit.vcell.math.ParticleProperties.ParticleInitialConditionConcentration) ParticleInitialCondition(cbit.vcell.math.ParticleProperties.ParticleInitialCondition) Element(org.jdom.Element) ParticleInitialConditionCount(cbit.vcell.math.ParticleProperties.ParticleInitialConditionCount) Element(org.jdom.Element)

Aggregations

ParticleInitialConditionCount (cbit.vcell.math.ParticleProperties.ParticleInitialConditionCount)6 ParticleInitialCondition (cbit.vcell.math.ParticleProperties.ParticleInitialCondition)5 CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)4 ParticleProperties (cbit.vcell.math.ParticleProperties)4 MathException (cbit.vcell.math.MathException)3 ParticleInitialConditionConcentration (cbit.vcell.math.ParticleProperties.ParticleInitialConditionConcentration)3 SubDomain (cbit.vcell.math.SubDomain)3 Expression (cbit.vcell.parser.Expression)3 ExpressionException (cbit.vcell.parser.ExpressionException)3 GeometryClass (cbit.vcell.geometry.GeometryClass)2 SubVolume (cbit.vcell.geometry.SubVolume)2 Constant (cbit.vcell.math.Constant)2 MacroscopicRateConstant (cbit.vcell.math.MacroscopicRateConstant)2 MathDescription (cbit.vcell.math.MathDescription)2 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)2 ParticleVariable (cbit.vcell.math.ParticleVariable)2 Variable (cbit.vcell.math.Variable)2 Domain (cbit.vcell.math.Variable.Domain)2 VariableHash (cbit.vcell.math.VariableHash)2 VolumeParticleSpeciesPattern (cbit.vcell.math.VolumeParticleSpeciesPattern)2