56 "Reads Tecplot dat file for FE block triangular format."),
85 if(
m_f->m_comm->TreatAsRankZero())
87 cout <<
"Processing input dat file" << endl;
91 string line, word, tag;
92 std::ifstream datFile;
96 string fname =
m_f->m_inputfiles[
"dat"][0];
99 datFile.open(fname.c_str());
102 cerr <<
"Error opening file: " << fname << endl;
109 vector<string> fieldNames;
110 while (!datFile.eof())
112 getline(datFile, line);
114 if(line.find(
"VARIABLES") != string::npos)
116 std::size_t pos = line.find(
'=');
122 line.substr(pos).c_str(), fieldNames);
123 ASSERTL0(valid,
"Unable to process list of field variable in "
124 " VARIABLES list: "+ line.substr(pos));
127 fieldNames.erase(fieldNames.begin(), fieldNames.begin() + dim);
134 int nfields = fieldNames.size();
135 int totvars = dim + nfields;
137 vector<Array<OneD, int> > ptsConn;
140 while (!datFile.eof())
142 getline(datFile, line);
144 if((line.find(
"ZONE") != string::npos)||
145 (line.find(
"Zone") != string::npos)||
146 (line.find(
"zone") != string::npos))
156 dim, fieldNames, pts);
158 m_f->m_fieldPts->SetConnectivity(ptsConn);
166 std::ifstream &datFile,
171 ASSERTL0(line.find(
"FEBlock") != string::npos,
172 "Routine only set up for FEBLock format");
173 ASSERTL0(line.find(
"ET") != string::npos,
174 "Routine only set up TRIANLES");
187 start = tag.find(
"N=");
188 end = tag.find_first_of(
',',start);
189 int nvert = atoi(tag.substr(start+2,end).c_str());
192 start = tag.find(
"E=");
193 end = tag.find_first_of(
',',start);
194 int nelmt = atoi(tag.substr(start+2,end).c_str());
197 int norigpts = pts[0].num_elements();
198 int totfields = pts.num_elements();
200 for(
int i = 0; i < totfields; ++i)
207 for(
int n = 0; n < totfields; ++n)
210 for(
int i = 0; i < norigpts; ++i)
212 pts[n][i] = origpts[n][i];
214 for(
int i = 0; i < nvert; ++i)
217 pts[n][norigpts+i] = value;
224 for(
int i = 0; i < 3*nelmt; ++i)
228 conn[i] = norigpts + intvalue;
230 ptsConn.push_back(conn);
232 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.