Main Page | Namespace List | Class Hierarchy | Alphabetical List | 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:

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

[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.

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, bool &isF_out, double &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.
bool | isF
| Does a function value exist for this function evaluation?
double | 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 42 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 53 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,
|  | bool & | isF_out,
|  | double & | 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
  | isF_out | - On output, this should contain true if there is a valid function value
  | f_out | - On output, this should contain the function value
  | msg_out | - On output, this should contain a message about the function evaluation
Implements APPSPACK::Evaluator::Interface. Definition at line 62 of file APPSPACK_Evaluator_SystemCall.cpp. References createStrings(), deleteFiles(), f, isF, msg, readOutputFile(), runProgram(), APPSPACK::Vector, 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 175 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 82 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 . The first line of the file contains a single integer defining the size of . This is followed by each entry of 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 93 of file APPSPACK_Evaluator_SystemCall.cpp. References inputFileName, isInputFile, and APPSPACK::Vector. 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 a single double value in scientific format. Return false and set isF to false if we cannot read the result file or encounter any other problems. Otherwise isF will be set to true and f will contain the function value for this task. Definition at line 120 of file APPSPACK_Evaluator_SystemCall.cpp. References f, APPSPACK::getNextDouble(), isF, isOutputFile, msg, outputFileName, and tag. Referenced by operator()().

void APPSPACK::Evaluator::SystemCall::deleteFiles | ( |  | ) | `[private]`

| Delete the input and output files. Definition at line 162 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 136 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 139 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 142 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 145 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 148 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 151 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 154 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 157 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 160 of file APPSPACK_Evaluator_SystemCall.hpp. Referenced by createStrings(), and runProgram().

bool APPSPACK::Evaluator::SystemCall::isF`[private]`

| Does a function value exist for this function evaluation? Definition at line 163 of file APPSPACK_Evaluator_SystemCall.hpp. Referenced by operator()(), and readOutputFile().

double APPSPACK::Evaluator::SystemCall::f`[private]`

| The function value. Definition at line 166 of file APPSPACK_Evaluator_SystemCall.hpp. Referenced by operator()(), and readOutputFile().

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

| Any message about the function value. Definition at line 169 of file APPSPACK_Evaluator_SystemCall.hpp. Referenced by operator()(), and readOutputFile().

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

- APPSPACK_Evaluator_SystemCall.hpp
- APPSPACK_Evaluator_SystemCall.cpp

© Sandia Corporation | Site Contact | Privacy and Security

Generated on Wed Dec 14 18:41:05 2005 for APPSPACK 4.0.2 by 1.3.8 written by Dimitri van Heesch, © 1997-2002