use of cbit.vcell.solver.SolverDescription.SolverFeature in project vcell by virtualcell.
the class Simulation method getRequiredFeatures.
// public void gatherIssues(IssueContext issueContext, List<Issue> issueList) {
//
// getMathOverrides().gatherIssues(issueContext, issueList);
//
// //
// // Check if the math corresponding to this simulation has fast systems and if the solverTaskDescription contains a non-null sensitivity parameter.
// // If so, the simulation is invalid.
// //
// if (fieldMathDescription != null && getSolverTaskDescription() != null) {
// if (getMathDescription().hasFastSystems() && (getSolverTaskDescription().getSensitivityParameter() != null)) {
// Issue issue = new Issue(this, issueContext, IssueCategory.Simulation_SensAnal_And_FastSystem,
// VCellErrorMessages.getErrorMessage(VCellErrorMessages.SIMULATION_SENSANAL_FASTSYSTEM,getName()),
// Issue.SEVERITY_ERROR);
// issueList.add(issue);
// }
// }
// if (fieldMathDescription==null || !fieldMathDescription.isValid()){
// Issue issue = new Issue(this, issueContext, IssueCategory.MathDescription_MathException,fieldMathDescription.getWarning(),Issue.SEVERITY_ERROR);
// issueList.add(issue);
// }
//
// Set<SolverFeature> supportedFeatures = getSolverTaskDescription().getSolverDescription().getSupportedFeatures();
// Set<SolverFeature> missingFeatures = getRequiredFeatures();
// missingFeatures.removeAll(supportedFeatures);
//
// String text = "The selected Solver does not support the following required features: \n";
// for (SolverFeature sf : missingFeatures) {
// text += sf.getName() + "\n";
// }
//
// if (!missingFeatures.isEmpty()) {
// System.out.println(this.getKey());
// String tooltip = "The selected Solver " + getSolverTaskDescription().getSolverDescription().getDisplayLabel() +
// " does not support the following required features: <br>";
// for (SolverFeature sf : missingFeatures) {
// tooltip += " " + sf.getName() + "<br>";
// }
// Collection<SolverDescription >goodSolvers = SolverDescription.getSolverDescriptions(getRequiredFeatures());
// assert goodSolvers != null;
// if (!goodSolvers.isEmpty()) {
// tooltip += "Please choose one of the solvers : <br>";
// for (SolverDescription sd : goodSolvers) {
// tooltip += " " + sd.getDisplayLabel() + "<br>";
// }
// }
// Issue issue = new Issue(this,issueContext, IssueCategory.MathDescription_MathException, text, tooltip, Issue.SEVERITY_ERROR);
// issueList.add(issue);
// }
// }
public Set<SolverFeature> getRequiredFeatures() {
Set<SolverFeature> requiredFeatures = new HashSet<SolverFeature>();
final MathDescription md = getMathDescription();
if (isSpatial()) {
requiredFeatures.add(SolverFeature.Feature_Spatial);
} else {
requiredFeatures.add(SolverFeature.Feature_NonSpatial);
}
final boolean hybrid = md.isSpatialHybrid();
final boolean stoch = md.isNonSpatialStoch() || md.isSpatialStoch();
final boolean ruleBased = md.isRuleBased();
if (hybrid) {
requiredFeatures.add(SolverFeature.Feature_Hybrid);
}
if (stoch && !hybrid) {
requiredFeatures.add(SolverFeature.Feature_Stochastic);
}
if (!stoch && !ruleBased) {
requiredFeatures.add(SolverFeature.Feature_Deterministic);
}
if (md.hasFastSystems()) {
requiredFeatures.add(SolverFeature.Feature_FastSystem);
}
if (md.hasPeriodicBoundaryCondition()) {
requiredFeatures.add(SolverFeature.Feature_PeriodicBoundaryCondition);
}
if (md.hasEvents()) {
requiredFeatures.add(SolverFeature.Feature_Events);
}
if (md.hasRandomVariables()) {
requiredFeatures.add(SolverFeature.Feature_RandomVariables);
}
if (getSolverTaskDescription().getStopAtSpatiallyUniformErrorTolerance() != null) {
requiredFeatures.add(SolverFeature.Feature_StopAtSpatiallyUniform);
}
if (getDataProcessingInstructions() != null) {
requiredFeatures.add(SolverFeature.Feature_DataProcessingInstructions);
}
if (md.getVariable(PSF_FUNCTION_NAME) != null) {
requiredFeatures.add(SolverFeature.Feature_PSF);
}
if (isSerialParameterScan()) {
requiredFeatures.add(SolverFeature.Feature_SerialParameterScans);
}
if (md.hasVolumeRegionEquations()) {
requiredFeatures.add(SolverFeature.Feature_VolumeRegionEquations);
}
if (md.hasRegionSizeFunctions()) {
requiredFeatures.add(SolverFeature.Feature_RegionSizeFunctions);
}
if (md.hasGradient()) {
requiredFeatures.add(SolverFeature.Feature_GradientSourceTerm);
}
if (md.getPostProcessingBlock().getNumDataGenerators() > 0) {
requiredFeatures.add(SolverFeature.Feature_PostProcessingBlock);
}
if (md.isRuleBased()) {
requiredFeatures.add(SolverFeature.Feature_Rulebased);
}
return requiredFeatures;
}
use of cbit.vcell.solver.SolverDescription.SolverFeature in project vcell by virtualcell.
the class SolverTaskDescriptionAdvancedPanel method refresh.
/**
* Comment
*/
private void refresh() {
if (getSolverTaskDescription() == null) {
return;
}
SolverDescription solverDescription = getSolverTaskDescription().getSolverDescription();
if (solverDescription == null) {
getSolverComboBox().setEnabled(false);
} else {
getSolverComboBox().setEnabled(true);
//
if (getSolverComboBox().getSelectedItem() == null || !getSolverComboBox().getSelectedItem().equals(solverDescription.getDisplayLabel())) {
if (getSolverComboBox().getModel().getSize() > 0) {
getSolverComboBox().setSelectedItem(solverDescription.getDisplayLabel());
}
}
}
Set<SolverFeature> supportedFeatures = ivjTornOffSolverTaskDescription.getSolverDescription().getSupportedFeatures();
if (supportedFeatures.contains(SolverFeature.Feature_SerialParameterScans)) {
serialParameterScanCheckBox.setVisible(true);
boolean bSerialParameterScan = ivjTornOffSolverTaskDescription.isSerialParameterScan();
if (bSerialParameterScan) {
serialParameterScanCheckBox.setSelected(bSerialParameterScan);
}
} else {
serialParameterScanCheckBox.setVisible(false);
}
// sensitivity panel's visibility
managePanels();
getMiscPanel().setVisible(supportedFeatures.contains(SolverFeature.Feature_SerialParameterScans) || supportedFeatures.contains(SolverFeature.Feature_StopAtSpatiallyUniform) || supportedFeatures.contains(SolverFeature.Feature_DataProcessingInstructions));
if (getSolverTaskDescription().getSolverDescription().isChomboSolver()) {
getTimeBoundsPanel().setVisible(false);
getTimeStepPanel().setVisible(false);
getChomboTimeBoundsPanel().setVisible(true);
getChomboDeveloperToolsPanel().setVisible(true);
} else {
getTimeBoundsPanel().setVisible(true);
getTimeStepPanel().setVisible(true);
getChomboTimeBoundsPanel().setVisible(false);
getChomboDeveloperToolsPanel().setVisible(false);
}
movingBoundarySolverOptionsPanel.setVisible(getSolverTaskDescription().getSolverDescription().isMovingBoundarySolver());
}
Aggregations