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_Utils.hpp File Reference


Detailed Description

No classes - just some utility functions in the APPSPACK namespace.

Definition in file APPSPACK_Utils.hpp.

#include "APPSPACK_Common.hpp"
#include "APPSPACK_Parameter_List.hpp"

Include dependency graph for APPSPACK_Utils.hpp:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  APPSPACK

Functions

bool getNextQuotedString (const string &line, string::size_type &pos, string &value)
bool getNextString (const string &line, string::size_type &pos, string &value)
bool getNextDouble (const string &line, string::size_type &pos, double &value)
bool getNextInt (const string &line, string::size_type &pos, int &value)
bool parseTextInputFile (const string filename, Parameter::List &params)
 Parse an APPSPACK input file and store the data in the given parameter list.
bool processTextInputFileLine (const string &line, Parameter::List &params, Parameter::List *&subPtr, ifstream &fin)
 Process a single line of the text input file.
void tokenize (const string &line, vector< string > &linesplit)


Function Documentation

bool APPSPACK::getNextQuotedString const string &  line,
string::size_type &  pos,
string &  value
 

Get the next quoted string on the given line, starting at position pos.

Parameters:
line - Line of text from which to read
pos - On input, the starting position in the line. On output, the next position after the quoted string (which may be std::string::npos). If there is any sort of error, this is set to std::string::npos upon return.
value - On output, filled in with the quoted string (without the quotes). This is an empty string if no quoted string is found.
Return values:
Returns true if the quoted string is successfully found, false otherwise.

Definition at line 45 of file APPSPACK_Utils.cpp.

Referenced by APPSPACK::processTextInputFileLine().

bool APPSPACK::getNextString const string &  line,
string::size_type &  pos,
string &  value
 

Get the next string on the given line, starting at position pos.

Parameters:
line - Line of text from which to read
pos - On input, the starting position in the line. On output, the next position after the string (which may be std::string::npos). If there is any sort of error, this is set to std::string::npos upon return.
value - On output, filled in with the next string (i.e., the next contiguous block of non-space characters). This is an empty string if no string is found.
Return values:
Returns true if the string is successfully found, false otherwise.

Definition at line 89 of file APPSPACK_Utils.cpp.

Referenced by APPSPACK::getNextDouble(), APPSPACK::getNextInt(), APPSPACK::Cache::Manager::processInputLine(), APPSPACK::processTextInputFileLine(), and APPSPACK::Evaluator::SystemCall::readOutputFile().

bool APPSPACK::getNextDouble const string &  line,
string::size_type &  pos,
double &  value
 

Get the next string on the given line, starting at position pos, and convert it to a double.

Parameters:
line - Line of text from which to read
pos - On input, the starting position in the line. On output, the next position after the string (which may be std::string::npos). If there is any sort of error in reading the next string, this is set to std::string::npos upon return.
value - On output, filled in with the double value constrained in the next string (i.e., the next contiguous block of non-space characters).
Return values:
Returns true if the next string contains a double, false otherwise.

Definition at line 132 of file APPSPACK_Utils.cpp.

References APPSPACK::getNextString().

Referenced by APPSPACK::Cache::Manager::processInputLine(), and APPSPACK::processTextInputFileLine().

bool APPSPACK::getNextInt const string &  line,
string::size_type &  pos,
int &  value
 

Get the next string on the given line, starting at position pos, and convert it to a int.

Parameters:
line - Line of text from which to read
pos - On input, the starting position in the line. On output, the next position after the string (which may be std::string::npos). If there is any sort of error in reading the next string, this is set to std::string::npos upon return.
value - On output, filled in with the int value constrained in the next string (i.e., the next contguous block of non-space characters).
Return values:
Returns true if the next string contains a int, false otherwise.

Definition at line 123 of file APPSPACK_Utils.cpp.

References APPSPACK::getNextString().

Referenced by APPSPACK::processTextInputFileLine().

bool APPSPACK::parseTextInputFile const string  filename,
Parameter::List &  params
 

Parse an APPSPACK input file and store the data in the given parameter list.

Parameters:
filename - The file name. See Step 2: Create an APPSPACK input file for details on the structure of the input file.
params - The parameter list that is to be filled in by this function
Returns:
Returns false if there are any problems parsing the input file, true otherwise.

Definition at line 344 of file APPSPACK_Utils.cpp.

References APPSPACK::processTextInputFileLine().

Referenced by main().

bool APPSPACK::processTextInputFileLine const string &  line,
Parameter::List &  params,
Parameter::List *&  subPtr,
ifstream &  fin
 

Process a single line of the text input file.

Definition at line 141 of file APPSPACK_Utils.cpp.

References APPSPACK::Matrix::addRow(), APPSPACK::dne(), APPSPACK::getNextDouble(), APPSPACK::getNextInt(), APPSPACK::getNextQuotedString(), APPSPACK::getNextString(), APPSPACK::Vector::resize(), APPSPACK::Parameter::List::setParameter(), APPSPACK::Parameter::List::sublist(), and APPSPACK::tokenize().

Referenced by APPSPACK::parseTextInputFile().

void APPSPACK::tokenize const string &  line,
vector< string > &  linesplit
 

Splits line into a vector of strings based upon whitespace delimiter.

Example
The following code segment
string line("one two three");
vector<string> linesplit;
tokenize(line,linesplit);
for (int i = 0; i < linesplit.size(); i++)
  cout << linesplit[i] << endl;
will output
one
two
three

Definition at line 376 of file APPSPACK_Utils.cpp.

Referenced by APPSPACK::processTextInputFileLine().

 

© Sandia Corporation | Site Contact | Privacy and Security

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