Data Structures | |
| class | PrefixPrinter |
Functions | |
| bool | beginning_of_dataset (std::istream &in_file, const std::string &ds_name) |
| double | D_to_e (std::string &number) |
Method for converting exponential notation from "D" to "e", for example 3.141592654D+00 --> 3.141592654e+00 in order to make it readable for C++. | |
| bool | check_file (const std::string theFileName) |
| bool UNV.beginning_of_dataset | ( | std::istream & | in_file, |
| const std::string & | ds_name | ||
| ) |
false when error occured, true otherwise. Adjusts the in_stream to the beginning of the dataset ds_name. Definition at line 53 of file UNV_Utilities.hxx.
Referenced by UNV2412.Read(), and UNV2411.Read().
{
assert (in_file.good());
assert (!ds_name.empty());
std::string olds, news;
while(true){
in_file >> olds >> news;
/*
* a "-1" followed by a number means the beginning of a dataset
* stop combing at the end of the file
*/
while( ((olds != "-1") || (news == "-1") ) && !in_file.eof() ){
olds = news;
in_file >> news;
}
if(in_file.eof())
return false;
if (news == ds_name)
return true;
}
// should never end up here
return false;
}
| bool UNV.check_file | ( | const std::string | theFileName | ) |
false when file is incorrect, true otherwise. Check file with name theFileName for correct terminate string, i.e. the next to the last line is equal to " -1", Definition at line 103 of file UNV_Utilities.hxx.
Referenced by DriverUNV_W_SMDS_Mesh.Perform().
{
std::ifstream in_stream(theFileName.c_str());
if (!in_stream)
return false;
std::string olds, news;
while (!in_stream.eof()){
olds = news;
std::getline(in_stream, news, '\n');
}
return (olds == " -1");
}
| double UNV.D_to_e | ( | std::string & | number | ) |
Method for converting exponential notation from "D" to "e", for example 3.141592654D+00 --> 3.141592654e+00 in order to make it readable for C++.
Definition at line 85 of file UNV_Utilities.hxx.
Referenced by UNV2411.Read().
{
/* find "D" in string, start looking at
* 6th element, to improve speed.
* We dont expect a "D" earlier
*/
const int position = number.find("D",6);
if(position != std::string::npos){
number.replace(position, 1, "e");
}
return atof (number.c_str());
}