#include <fileselect.h>
|
static datafile * | detectFiletype (ifstream &infile, ofstream &outfile, bool loud, string infile_name, int dim, std::vector< std::vector< int > > rFieldMappings, std::vector< index_order > rIndexOrder, std::vector< adj_map > conv_factor, std::vector< adj_map > norm_val) |
| Use test functions to determine the filetype and to create a new file object for the input file. More...
|
|
static bool | testTecplot (ifstream &infile, string datapacking) |
| Test if a file is a tecplot file. More...
|
|
static void | printFiletypes () |
| Print list valid filetypes to stdout. More...
|
|
Definition at line 21 of file fileselect.h.
datafile * detectFiletype |
( |
ifstream & |
infile, |
|
|
ofstream & |
outfile, |
|
|
bool |
loud, |
|
|
string |
infile_name, |
|
|
int |
dim, |
|
|
std::vector< std::vector< int > > |
rFieldMappings, |
|
|
std::vector< index_order > |
rIndexOrder, |
|
|
std::vector< adj_map > |
conv_factor, |
|
|
std::vector< adj_map > |
norm_val |
|
) |
| |
|
static |
Use test functions to determine the filetype and to create a new file object for the input file.
- Parameters
-
infile | Open file stream for the input data file |
outfile | Open file stream for the log file |
loud | Logging verbosity |
infile_name | Name of the data file |
dim | Number of dimensions in the input data file |
rFieldMappings | Variables mappings that specify which file variables are mapped to which storage variables when the file is read in |
rIndexOrder | Order of variables for index creation |
conv_factor | Collection of values that are multiplied with corresponding variables from the data file in order to convert between units |
norm_val | Collection of values that are multiplied with corresponding variables from the data file in order to undo normalization of the data |
Definition at line 3 of file fileselect.cpp.
References testTecplot().
Referenced by openAndParseFiles().
11 ret =
new tecplot_data(infile, outfile, loud, infile_name, dim, rFieldMappings, rIndexOrder, conv_factor, norm_val);
15 outfile <<
"ERROR | File \"" << infile_name <<
"\": ";
16 outfile <<
"Unsupported file format" <<
"\n";
18 cout <<
"ERROR | File \"" << infile_name <<
"\": ";
19 cout <<
"Unsupported file format" <<
"\n";
Base class for file parsing.
static bool testTecplot(ifstream &infile, string datapacking)
Test if a file is a tecplot file.
Base class for tecplot files Implements useful functions for tecplot file parsing.
Print list valid filetypes to stdout.
Definition at line 193 of file fileselect.cpp.
Referenced by printUsage().
194 cout <<
"\t" <<
"Tecplot ASCII Block Datafile - Ordered Data" << endl;
195 cout <<
"\t" <<
"Tecplot ASCII Block Datafile - FEQuadrilateral" << endl;
bool testTecplot |
( |
ifstream & |
infile, |
|
|
string |
datapacking |
|
) |
| |
|
static |
Test if a file is a tecplot file.
- Parameters
-
infile | Open file stream |
datapacking | Type of datapacking used by the file |
- Returns
- True if the file is a tecplot file, otherwise false
Definition at line 28 of file fileselect.cpp.
References BUFFER_SIZE, check_bool_arr(), check_non_numeric_str(), i, offset(), and readCommaExpression().
Referenced by detectFiletype().
32 infile.seekg(0, std::ios::beg);
37 bool zone_found =
false;
38 bool zonetype_found =
false;
39 bool datapacking_found =
false;
43 bool ijk[3] = {
false,
false,
false};
44 bool nodes_elements[2] = {
false,
false};
60 while(fdstr.c_str()[
offset] ==
' ' && offset < fdstr.length())
65 char tmp[fdstr.length()-
offset];
66 memset(tmp,
'\0', fdstr.length()-
offset);
68 for(
int i=0;
i<fdstr.length();
i++)
82 if(fdstr.find(
"ZONE") != string::npos){
87 if(fdstr.find(
"I=") != string::npos){
90 if(i_val.size() == 1){
98 if(fdstr.find(
"J=") != string::npos){
101 if(j_val.size() == 1){
109 if(fdstr.find(
"K=") != string::npos){
112 if(k_val.size() == 1){
120 if(fdstr.find(
"Nodes=") != string::npos){
123 if(node_val.size() == 1){
124 if(atoi(node_val[0].c_str()) >= 0){
125 nodes_elements[0] =
true;
131 if(fdstr.find(
"Elements=") != string::npos){
134 if(elem_val.size() == 1){
135 if(atoi(elem_val[0].c_str()) >= 0){
136 nodes_elements[1] =
true;
144 if(fdstr.find(
"ZONETYPE=Ordered") != string::npos){
145 zonetype_found =
true;
148 else if(fdstr.find(
"ZONETYPE=FEQuadrilateral") != string::npos){
149 zonetype_found =
true;
155 if(fdstr.find(
"DATAPACKING=") != string::npos){
159 sscanf(fdstr.c_str(),
"DATAPACKING=%255s", type);
161 if(
string(type).compare(datapacking) == 0)
162 datapacking_found =
true;
172 if(zone_found && zonetype_found && datapacking_found){
static const int BUFFER_SIZE
real *8 function offset(vNorm, x2, y2, z2)
bool check_bool_arr(bool test[], int size)
std::vector< string > readCommaExpression(string rStack, string rNeedle)
bool check_non_numeric_str(string test_str)
const int BUFFER_SIZE = 512 |
|
staticprivate |
The documentation for this class was generated from the following files: