use of cbit.vcell.mapping.EventDummyReactionStep in project vcell by virtualcell.
the class StructureAnalyzer method refreshTotalSpeciesContextMappings.
/**
* This method was created in VisualAge.
*/
private void refreshTotalSpeciesContextMappings() throws java.beans.PropertyVetoException {
if (structures == null) {
return;
}
// System.out.println("StructureAnalyzer.refreshSpeciesContextMappings()");
// GeometryContext geoContext = mathMapping.getSimulationContext().getGeometryContext();
Model model = mathMapping_4_8.getSimulationContext().getReactionContext().getModel();
//
// note, the order of species is specified such that the first species have priority
// when the null space is solved for dependent variables. So the order of priority
// for elimination are as follows:
//
// 1) Species involved with fast reactions.
// 2) Species not involved with fast reactions.
//
Vector<SpeciesContextMapping> scmList = new Vector<SpeciesContextMapping>();
//
for (int i = 0; i < structures.length; i++) {
SpeciesContext[] speciesContexts = model.getSpeciesContexts(structures[i]);
for (int j = 0; j < speciesContexts.length; j++) {
SpeciesContext sc = speciesContexts[j];
SpeciesContextMapping scm = mathMapping_4_8.getSpeciesContextMapping(sc);
SpeciesContextSpec scs = mathMapping_4_8.getSimulationContext().getReactionContext().getSpeciesContextSpec(sc);
if (scm.isFastParticipant() && !scs.isConstant()) {
scmList.addElement(scm);
}
}
}
//
for (int i = 0; i < structures.length; i++) {
SpeciesContext[] speciesContexts = model.getSpeciesContexts(structures[i]);
for (int j = 0; j < speciesContexts.length; j++) {
SpeciesContext sc = speciesContexts[j];
SpeciesContextMapping scm = mathMapping_4_8.getSpeciesContextMapping(sc);
SpeciesContextSpec scs = mathMapping_4_8.getSimulationContext().getReactionContext().getSpeciesContextSpec(sc);
if (!scm.isFastParticipant() && !scs.isConstant()) {
scmList.addElement(scm);
}
}
}
if (scmList.size() > 0) {
speciesContextMappings = new SpeciesContextMapping[scmList.size()];
scmList.copyInto(speciesContextMappings);
for (int i = 0; i < speciesContextMappings.length; i++) {
speciesContextMappings[i].setRate(new Expression(0.0));
// System.out.println("speciesContextMappings["+i+"] = "+speciesContextMappings[i].getSpeciesContext().getName());
}
} else {
speciesContextMappings = null;
}
// System.out.println("StructureAnalyzer.refreshTotalSpeciesContextMapping(), speciesContextMappings.length = "+scmList.size());
//
// get all reactionSteps associated with these structures
//
Vector<ReactionStep> rsList = new Vector<ReactionStep>();
ReactionSpec[] allReactionSpecs = mathMapping_4_8.getSimulationContext().getReactionContext().getReactionSpecs();
for (int i = 0; i < allReactionSpecs.length; i++) {
if (allReactionSpecs[i].isExcluded()) {
continue;
}
ReactionStep rs = allReactionSpecs[i].getReactionStep();
for (int j = 0; j < structures.length; j++) {
if (rs.getStructure() == structures[j]) {
rsList.addElement(rs);
}
}
}
//
for (int i = 0; i < scmList.size(); i++) {
SpeciesContextMapping scm = (SpeciesContextMapping) scmList.elementAt(i);
if (scm.isPDERequired()) {
rsList.addElement(new DiffusionDummyReactionStep("DiffusionDummyReactionStep" + i, model, scm.getSpeciesContext().getStructure(), scm.getSpeciesContext()));
}
if (scm.hasEventAssignment()) {
rsList.addElement(new EventDummyReactionStep("EventDummyReactionStep" + i, model, scm.getSpeciesContext().getStructure(), scm.getSpeciesContext()));
}
if (scm.hasHybridReaction()) {
rsList.addElement(new HybridDummyReactionStep("HybridDummyReactionStep" + i, model, scm.getSpeciesContext().getStructure(), scm.getSpeciesContext()));
}
SimulationContext simContext = mathMapping_4_8.getSimulationContext();
if (simContext.isStoch() && simContext.getGeometry().getDimension() > 0 && !simContext.getReactionContext().getSpeciesContextSpec(scm.getSpeciesContext()).isForceContinuous()) {
rsList.addElement(new ParticleDummyReactionStep("ParticleDummyReactionStep" + i, model, scm.getSpeciesContext().getStructure(), scm.getSpeciesContext()));
}
}
if (rsList.size() > 0) {
reactionSteps = new ReactionStep[rsList.size()];
rsList.copyInto(reactionSteps);
} else {
reactionSteps = null;
}
// System.out.println("StructureAnalyzer.refreshTotalSpeciesContextMapping(), reactionSteps.length = "+scmList.size());
}
Aggregations