56 "Reads Tecplot dat file for FE block triangular format."),
85 cout <<
"Processing input dat file" << endl;
88 string line, word, tag;
89 std::ifstream datFile;
93 string fname =
m_f->m_inputfiles[
"dat"][0];
96 datFile.open(fname.c_str());
99 cerr <<
"Error opening file: " << fname << endl;
106 vector<string> fieldNames;
107 while (!datFile.eof())
109 getline(datFile, line);
111 if(line.find(
"VARIABLES") != string::npos)
113 std::size_t pos = line.find(
'=');
119 line.substr(pos).c_str(), fieldNames);
120 ASSERTL0(valid,
"Unable to process list of field variable in "
121 " VARIABLES list: "+ line.substr(pos));
124 fieldNames.erase(fieldNames.begin(), fieldNames.begin() + dim);
131 int nfields = fieldNames.size();
132 int totvars = dim + nfields;
134 vector<Array<OneD, int> > ptsConn;
137 while (!datFile.eof())
139 getline(datFile, line);
141 if((line.find(
"ZONE") != string::npos)||
142 (line.find(
"Zone") != string::npos)||
143 (line.find(
"zone") != string::npos))
153 dim, fieldNames, pts);
155 m_f->m_fieldPts->SetConnectivity(ptsConn);
163 std::ifstream &datFile,
168 ASSERTL0(line.find(
"FEBlock") != string::npos,
169 "Routine only set up for FEBLock format");
170 ASSERTL0(line.find(
"ET") != string::npos,
171 "Routine only set up TRIANLES");
184 start = tag.find(
"N=");
185 end = tag.find_first_of(
',',start);
186 int nvert = atoi(tag.substr(start+2,end).c_str());
189 start = tag.find(
"E=");
190 end = tag.find_first_of(
',',start);
191 int nelmt = atoi(tag.substr(start+2,end).c_str());
194 int norigpts = pts[0].num_elements();
195 int totfields = pts.num_elements();
197 for(
int i = 0; i < totfields; ++i)
204 for(
int n = 0; n < totfields; ++n)
207 for(
int i = 0; i < norigpts; ++i)
209 pts[n][i] = origpts[n][i];
211 for(
int i = 0; i < nvert; ++i)
214 pts[n][norigpts+i] = value;
221 for(
int i = 0; i < 3*nelmt; ++i)
225 conn[i] = norigpts + intvalue;
227 ptsConn.push_back(conn);
229 getline(datFile, line);
#define ASSERTL0(condition, msg)
static bool GenerateOrderedStringVector(const char *const str, std::vector< std::string > &vec)
pair< ModuleType, string > ModuleKey
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
FieldSharedPtr m_f
Field object.
boost::shared_ptr< Field > FieldSharedPtr
ModuleFactory & GetModuleFactory()
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.