[Getdp] Launching GetDP from another program
John_V
jvillar.john at gmail.com
Fri Nov 26 20:25:37 CET 2010
Has anyone successfully launched GetDP from another program?
I have a Java program that writes problem specification files for GetDP and
then attempts to launch it. I don't understand GetDP's ""Missing number""
error message.
Here's the SHORT VERSION of my story. GetD itself reports:
Running 'getdp_sparskit sample -pre EleSta_v -cal'
Info : Started on Fri Nov 26 13:29:57 2010
Then it produces error output as follows:
Error : Missing number
Does anyone know what is the "Missing number" to which GetDP is referring?
The reported command, 'getdp_sparskit sample -pre EleSta_v -cal', does run
properly if I type it manually at a DOS prompt or put it in a batch file.
(getdp_sparskit is my renamed getdp executable after compiling with the
sparskit library.)
If instead I change the command line to 'getdp_sparskit sample -pre EleSta_v
-cal 1>output.txt 2>errout.txt' there is more progress before it fails. I
get the following normal output followed by error message:
Info : Started on Fri Nov 26 13:28:24 2010
Info : Unknown option: '2>errout.txt'
Info : Loading problem definition 'sample.pro'
Info : Loading problem definition 'Jacobian_Lib.pro'
Info : Loading problem definition 'Integration_Lib.pro'
Info : Loading problem definition 'EleSta_v.pro'
Info : Selected Resolution 'EleSta_v'
Info : Loaded Geometric data 'sample.msh'
Info : System 'Sys_Ele' : Real
P r e - P r o c e s s i n g . . .
Info : Loding Pre-Processing data 'sample.pre'
Info : (CPU = 10.4375s)
E n d P r e - P r o c e s s i n g
P r o c e s s i n g . . .
Info : Generate[Sys_Ele]
Info : Loading parameter file 'solver.par'
Error : Unknown solver parameter 'pre EleSta_v'
The solver.par file in my working directory works OK when I run from the
command line, and it does not contain the characters EleSta_v, so this error
message is also mysterious.
I would appreciate any insights.
John
DETAILED VERSION. Below is one version of the code I use to launch GetDP
from my Java program and the resulting output. (I wrote a second version,
using Java's ProcessBuilder class in hopes of seeing a different result, but
the output was identical.)
My Java code:
String[] command = new String[] {
"getdp_sparskit",
"sample",
"-pre EleSta_v",
"-cal"
};
Runtime runtime = Runtime.getRuntime();
Process child = runtime.exec(command, null, new File(feaFolder));
/* feaFolder is working directory with sample.pro, etc.*/
InputStream is = child.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
BufferedReader brErr = new BufferedReader(new
InputStreamReader(child.getErrorStream()));
String line;
System.out.printf("Output of running %s is:",
Arrays.toString(command));
while ((line = br.readLine()) != null) {
System.out.println(line);
}
System.out.printf("Error output of running %s is:",
Arrays.toString(command));
while((line = brErr.readLine()) != null) {
System.out.println(line);
}
int exitVal = child.waitFor();
The exitVal = 1 indicates a not-normal exit.
Output and error message:
Output of running [getdp_sparskit, sample, -pre EleSta_v, -cal] is:
Info : Running 'getdp_sparskit sample -pre EleSta_v -cal'
Info : Started on Fri Nov 26 13:29:57 2010
Error output of running [getdp_sparskit, sample, -pre EleSta_v, -cal]
is:Error : Missing number
The longer, more successful message reported above resulted from changing
the definition of command to
String[] command = new String[] {
"getdp_sparskit",
"sample",
"-solve EleSta_v",
"1>output.txt",
"2>errout.txt"
};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/getdp/attachments/20101126/f6d9a336/attachment.html>