General
General information on user defined history and response result extraction
LS-OPT provides a user-defined interface to extract response and history results, respectively. Any user-defined program, e.g. C, Fortran or Perl programs, or any post-processor, e.g. LS-PREPOST may be used to extract results.
User-defined Responses
The user-defined program has to output a single floating-point number to standard output.
Example
In this example, a Perl program is used to extract a response.
response 'Response' 1 0 "../../extract_response.pl"
An example for a Perl program extracting a response result is given below.
#!/usr/bin/perl
# open file
open(IN,"results.txt");
$i = 0; # variable to count line number
# read file
while(<IN>){
# first value in 10th line is response value
if ($i == 10){
@output = split;
last;
}
$i++;
}
# print value to standard output
print ("$output[0]\n");
# close file
close(IN);
User-defined Histories
The user-defined program is used to produce a file named LsoptHistory containing xy data.
Example
In this example, the post-processor LS-PREPOST is used to extract a history result.
history 'Force' "lspp c=../../get_force -nographics"

The LS-PREPOST command file get_force is given below.
open d3plot d3plot ascii rcforc open rcforc 0 ascii rcforc plot 4 Ma-1 xyplot 1 savefile xypair LsoptHistory 1 deletewin 1 quit
To create the LS-PREPOST command file, execute the appropriate commands in LS-PREPOST. LS-PREPOST saves the executed steps in the command file lspost.cfile.
