Sandia Home Sandia Home
Main Page | Publications | Downloads | Configuration | Running the Code | Solver Parameters | FAQ | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

APPSPACK::Evaluator::SystemCall Class Reference

#include <APPSPACK_Evaluator_SystemCall.hpp>

Inheritance diagram for APPSPACK::Evaluator::SystemCall:

Inheritance graph
[legend]
Collaboration diagram for APPSPACK::Evaluator::SystemCall:

Collaboration graph
[legend]
List of all members.

Detailed Description

SystemCall for (serial) function evaluation.

Default method for handling evaluations. The user provides an executable that takes an input file with the point to be evaluated and creates an output file with the result.

See Using the APPSPACK Executables for more information on using APPSPACK with this object.

Evaluator.gif

Basic system call mode of evaluation

Definition at line 66 of file APPSPACK_Evaluator_SystemCall.hpp.

Public Member Functions

 SystemCall (const string &executableName_in, const string &inputPrefix_in, const string &outputPrefix_in)
 Constructor.
 SystemCall (const Parameter::List &params)
 Constructor (via parameter list).
virtual ~SystemCall ()
 Destructor.
virtual void operator() (int tag_in, const Vector &x_in, Vector &f_out, string &msg_out)
 Do the function evaluation for the point x_in, and fill int he results.
virtual void print () const
 Prints out the name of the executable, and the input and output file prefixes.

Private Member Functions

void createStrings (int tag_in)
 Create the strings tag, inputFileName, outputFileName, and execString.
void writeInputFile (const Vector &x)
 Write the parameter file.
void runProgram ()
 Run the function evaluation using a system command.
void readOutputFile ()
 Read the result file containing the function value.
void deleteFiles ()
 Delete the input and output files.

Private Attributes

const string executableName
 Executable name.
const string inputPrefix
 Prefix for name of parameters file.
const string outputPrefix
 Prefix for name of output file.
string tag
 Tag for this function evaluation.
string inputFileName
 Name of parameters file for this function evaluation.
string outputFileName
 Name of output file for this function evaluation.
bool isInputFile
 Is there currently an input file (that will need to be deleted)?
bool isOutputFile
 Is there currently an output file (that will need to be deleted)?
string execString
 Executable string for this function evaluation.
Vector f
 The function value.
string msg
 Any message about the function value.


Constructor & Destructor Documentation

APPSPACK::Evaluator::SystemCall::SystemCall const string &  executableName_in,
const string &  inputPrefix_in,
const string &  outputPrefix_in
 

Constructor.

Definition at line 43 of file APPSPACK_Evaluator_SystemCall.cpp.

APPSPACK::Evaluator::SystemCall::SystemCall const Parameter::List params  ) 
 

Constructor (via parameter list).

Reads "Executable Name", "Input Prefix", and "Output Prefix" from the give parameter list.

See Using the APPSPACK Executables for more information.

Definition at line 54 of file APPSPACK_Evaluator_SystemCall.cpp.

virtual APPSPACK::Evaluator::SystemCall::~SystemCall  )  [inline, virtual]
 

Destructor.

Definition at line 86 of file APPSPACK_Evaluator_SystemCall.hpp.


Member Function Documentation

void APPSPACK::Evaluator::SystemCall::operator() int  tag_in,
const Vector x_in,
Vector f_out,
string &  msg_out
[virtual]
 

Do the function evaluation for the point x_in, and fill int he results.

Parameters:
tag_in - Contains a unique tag which can be used to name files, etc.
x_in - The point to be evaluated
f_out - On output, this should contain the function value. An empty vector indicates that the function value did not exist. Or, set individual entries of the function to APPSPACK::dne();
msg_out - On output, this should contain a message about the function evaluation

Implements APPSPACK::Evaluator::Interface.

Definition at line 63 of file APPSPACK_Evaluator_SystemCall.cpp.

References createStrings(), deleteFiles(), readOutputFile(), runProgram(), and writeInputFile().

void APPSPACK::Evaluator::SystemCall::print  )  const [virtual]
 

Prints out the name of the executable, and the input and output file prefixes.

Reimplemented from APPSPACK::Evaluator::Interface.

Definition at line 187 of file APPSPACK_Evaluator_SystemCall.cpp.

References executableName, inputPrefix, and outputPrefix.

void APPSPACK::Evaluator::SystemCall::createStrings int  tag_in  )  [private]
 

Create the strings tag, inputFileName, outputFileName, and execString.

Definition at line 81 of file APPSPACK_Evaluator_SystemCall.cpp.

References execString, executableName, inputFileName, inputPrefix, outputFileName, outputPrefix, and tag.

Referenced by operator()().

void APPSPACK::Evaluator::SystemCall::writeInputFile const Vector x  )  [private]
 

Write the parameter file.

Create the file named inputFileName containing the input vector $x$. The first line of the file contains a single integer defining the size of $x$. This is followed by each entry of $x$ on its own line in scientific format. For example, the file might appear as follows.

3
1.23547e-5
2.00000e-3
4.55000e+10

Definition at line 92 of file APPSPACK_Evaluator_SystemCall.cpp.

References inputFileName, isInputFile, and APPSPACK::Vector::size().

Referenced by operator()().

void APPSPACK::Evaluator::SystemCall::runProgram  )  [private]
 

Run the function evaluation using a system command.

Definition at line 115 of file APPSPACK_Evaluator_SystemCall.cpp.

References execString.

Referenced by operator()().

void APPSPACK::Evaluator::SystemCall::readOutputFile  )  [private]
 

Read the result file containing the function value.

Read the file of the name specified by outputFileName. The file is expected to contain one of the following types of outputs:

  • An error message on a single line.
  • A sequence of output values, one per line. Typically, this will be a single output value. Each value should be a value in scientific format or the string "DNE" (without quotes) to indicate that a value does not exist.

An empty function vector will be returned if we cannot read the result file or encounter any other problems. Otherwise f will contain the function value for this task.

Definition at line 120 of file APPSPACK_Evaluator_SystemCall.cpp.

References APPSPACK::dne(), f, APPSPACK::getNextString(), isOutputFile, msg, outputFileName, APPSPACK::Vector::push_back(), APPSPACK::Vector::resize(), APPSPACK::Vector::size(), and tag.

Referenced by operator()().

void APPSPACK::Evaluator::SystemCall::deleteFiles  )  [private]
 

Delete the input and output files.

Definition at line 174 of file APPSPACK_Evaluator_SystemCall.cpp.

References inputFileName, isInputFile, isOutputFile, and outputFileName.

Referenced by operator()().


Member Data Documentation

const string APPSPACK::Evaluator::SystemCall::executableName [private]
 

Executable name.

Definition at line 146 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by createStrings(), and print().

const string APPSPACK::Evaluator::SystemCall::inputPrefix [private]
 

Prefix for name of parameters file.

Definition at line 149 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by createStrings(), and print().

const string APPSPACK::Evaluator::SystemCall::outputPrefix [private]
 

Prefix for name of output file.

Definition at line 152 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by createStrings(), and print().

string APPSPACK::Evaluator::SystemCall::tag [private]
 

Tag for this function evaluation.

Definition at line 155 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by createStrings(), and readOutputFile().

string APPSPACK::Evaluator::SystemCall::inputFileName [private]
 

Name of parameters file for this function evaluation.

Definition at line 158 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by createStrings(), deleteFiles(), and writeInputFile().

string APPSPACK::Evaluator::SystemCall::outputFileName [private]
 

Name of output file for this function evaluation.

Definition at line 161 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by createStrings(), deleteFiles(), and readOutputFile().

bool APPSPACK::Evaluator::SystemCall::isInputFile [private]
 

Is there currently an input file (that will need to be deleted)?

Definition at line 164 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by deleteFiles(), and writeInputFile().

bool APPSPACK::Evaluator::SystemCall::isOutputFile [private]
 

Is there currently an output file (that will need to be deleted)?

Definition at line 167 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by deleteFiles(), and readOutputFile().

string APPSPACK::Evaluator::SystemCall::execString [private]
 

Executable string for this function evaluation.

Definition at line 170 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by createStrings(), and runProgram().

Vector APPSPACK::Evaluator::SystemCall::f [private]
 

The function value.

Definition at line 173 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by readOutputFile().

string APPSPACK::Evaluator::SystemCall::msg [private]
 

Any message about the function value.

Definition at line 176 of file APPSPACK_Evaluator_SystemCall.hpp.

Referenced by readOutputFile().


The documentation for this class was generated from the following files:

 

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Fri Feb 16 10:33:36 2007 for APPSPACK 5.0.1 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2002