use of cbit.vcell.solver.server.SolverStatus in project vcell by virtualcell.
the class CVodeSolverStandalone method initialize.
/**
* This method takes the place of the old runUnsteady()...
*/
protected void initialize() throws SolverException {
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INIT);
super.initialize();
String inputFilename = getInputFilename();
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_INPUT_FILE));
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INPUT_FILE);
PrintWriter pw = null;
try {
pw = new java.io.PrintWriter(inputFilename);
CVodeFileWriter cvodeFileWriter = new CVodeFileWriter(pw, simTask, bMessaging);
cvodeFileWriter.write();
} catch (Exception e) {
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, SimulationMessage.solverAborted("CVODE solver could not generate input file: " + e.getMessage())));
e.printStackTrace(System.out);
throw new SolverException("CVODE solver could not generate input file: " + e.getMessage());
} finally {
if (pw != null) {
pw.close();
}
}
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_START));
setMathExecutable(new MathExecutable(getMathExecutableCommand(), getSaveDirectory()));
}
use of cbit.vcell.solver.server.SolverStatus in project vcell by virtualcell.
the class AbstractJavaSolver method runSolver.
/**
* Insert the method's description here.
* Creation date: (6/26/2001 3:08:31 PM)
*/
public void runSolver() {
try {
fieldRunning = true;
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_STARTING, SimulationMessage.MESSAGE_SOLVER_STARTING_INIT));
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INIT);
initialize();
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_START));
fireSolverProgress(getProgress());
integrate();
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_FINISHED, SimulationMessage.MESSAGE_SOLVER_FINISHED));
fireSolverFinished();
} catch (SolverException integratorException) {
lg.error(integratorException.getMessage(), integratorException);
SimulationMessage simulationMessage = SimulationMessage.solverAborted(integratorException.getMessage());
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, simulationMessage));
fireSolverAborted(simulationMessage);
} catch (IOException ioException) {
lg.error(ioException.getMessage(), ioException);
SimulationMessage simulationMessage = SimulationMessage.solverAborted(ioException.getMessage());
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, simulationMessage));
fireSolverAborted(simulationMessage);
} catch (UserStopException userStopException) {
lg.error(userStopException.getMessage(), userStopException);
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_STOPPED, SimulationMessage.solverStopped(userStopException.getMessage())));
fireSolverStopped();
} catch (Exception e) {
lg.error("AbstractJavaSolver.runSolver() : Caught Throwable instead of SolverException -- THIS EXCEPTION SHOULD NOT HAPPEN!", e);
SimulationMessage simulationMessage = SimulationMessage.solverAborted(e.getMessage());
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, simulationMessage));
fireSolverAborted(simulationMessage);
} finally {
fieldRunning = false;
}
}
use of cbit.vcell.solver.server.SolverStatus in project vcell by virtualcell.
the class IDASolverStandalone method initialize.
/**
* This method takes the place of the old runUnsteady()...
*/
protected void initialize() throws SolverException {
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INIT);
super.initialize();
String inputFilename = getInputFilename();
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_INPUT_FILE));
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INPUT_FILE);
PrintWriter pw = null;
try {
pw = new PrintWriter(inputFilename);
IDAFileWriter idaFileWriter = new IDAFileWriter(pw, simTask, bMessaging);
idaFileWriter.write();
} catch (Exception e) {
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, SimulationMessage.solverAborted("Could not generate input file: " + e.getMessage())));
e.printStackTrace(System.out);
throw new SolverException("IDA solver could not generate input file: " + e.getMessage());
} finally {
if (pw != null) {
pw.close();
}
}
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_START));
setMathExecutable(new MathExecutable(getMathExecutableCommand(), getSaveDirectory()));
}
use of cbit.vcell.solver.server.SolverStatus in project vcell by virtualcell.
the class MovingBoundarySolver method initialize.
/**
* This method was created by a SmartGuide.
*/
protected void initialize() throws SolverException {
writeFunctionsFile();
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_INIT));
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INIT);
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_START));
try (PrintWriter pw = new PrintWriter(inputFilename)) {
MovingBoundaryFileWriter mbfw = new MovingBoundaryFileWriter(pw, simTask, resampledGeometry, bMessaging, getBaseName());
mbfw.write();
} catch (Exception e) {
throw new SolverException("Can't open input file " + inputFilename, e);
}
setMathExecutable(new MathExecutable(getMathExecutableCommand(), getSaveDirectory()));
}
use of cbit.vcell.solver.server.SolverStatus in project vcell by virtualcell.
the class GibsonSolver method initialize.
/**
* This method takes the place of the old runUnsteady()...
*/
protected void initialize() throws SolverException {
if (lg.isTraceEnabled())
lg.trace("StochSolver.initialize()");
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INIT);
writeFunctionsFile();
writeLogFile();
String inputFilename = getInputFilename();
if (lg.isTraceEnabled())
lg.trace("StochSolver.initialize() baseName = " + getBaseName());
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_INPUT_FILE));
fireSolverStarting(SimulationMessage.MESSAGE_SOLVEREVENT_STARTING_INPUT_FILE);
PrintWriter pw = null;
try {
pw = new PrintWriter(inputFilename);
StochFileWriter stFileWriter = new StochFileWriter(pw, simTask, bMessaging);
stFileWriter.write();
} catch (Exception e) {
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_ABORTED, SimulationMessage.solverAborted("Could not generate input file: " + e.getMessage())));
e.printStackTrace(System.out);
throw new SolverException("solver input file exception: " + e.getMessage());
} finally {
if (pw != null) {
pw.close();
}
}
setSolverStatus(new SolverStatus(SolverStatus.SOLVER_RUNNING, SimulationMessage.MESSAGE_SOLVER_RUNNING_START));
// get executable path+name.
setMathExecutable(new MathExecutable(getMathExecutableCommand(), getSaveDirectory()));
// setMathExecutable(new cbit.vcell.solvers.MathExecutable(executableName + " gibson " + getBaseName() + ".stochInput" + " " + getBaseName() + ".stoch"));
}
Aggregations