56 "Reads Tecplot dat file for FE block triangular format."),
83 if (
m_f->m_comm->TreatAsRankZero())
85 cout <<
"Processing input dat file" << endl;
89 string line, word, tag;
90 std::ifstream datFile;
94 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);
110 string linetest = line;
111 boost::to_upper(linetest);
112 if (linetest.find(
"VARIABLES") != string::npos)
114 std::size_t pos = line.find(
'=');
120 line.substr(pos).c_str(), fieldNames);
121 ASSERTL0(valid,
"Unable to process list of field variable in "
122 " VARIABLES list: " +
126 fieldNames.erase(fieldNames.begin(), fieldNames.begin() + dim);
133 int nfields = fieldNames.size();
134 int totvars = dim + nfields;
136 vector<Array<OneD, int> > ptsConn;
139 while (!datFile.eof())
141 getline(datFile, line);
142 string linetest = line;
143 boost::to_upper(linetest);
144 if ((linetest.find(
"ZONE") != string::npos))
153 dim, fieldNames, pts);
155 m_f->m_fieldPts->SetConnectivity(ptsConn);
166 ASSERTL0(line.find(
"FEBlock") != string::npos,
167 "Routine only set up for FEBLock format");
168 ASSERTL0(line.find(
"ET") != string::npos,
"Routine only set up TRIANLES");
181 start = tag.find(
"N=");
182 end = tag.find_first_of(
',', start);
183 int nvert = atoi(tag.substr(start + 2, end).c_str());
186 start = tag.find(
"E=");
187 end = tag.find_first_of(
',', start);
188 int nelmt = atoi(tag.substr(start + 2, end).c_str());
191 int norigpts = pts[0].num_elements();
192 int totfields = pts.num_elements();
194 for (
int i = 0; i < totfields; ++i)
201 for (
int n = 0; n < totfields; ++n)
204 for (
int i = 0; i < norigpts; ++i)
206 pts[n][i] = origpts[n][i];
208 for (
int i = 0; i < nvert; ++i)
211 pts[n][norigpts + i] = value;
218 for (
int i = 0; i < 3 * nelmt; ++i)
222 conn[i] = norigpts + intvalue;
224 ptsConn.push_back(conn);
226 getline(datFile, line);
#define ASSERTL0(condition, msg)
static bool GenerateOrderedStringVector(const char *const str, std::vector< std::string > &vec)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
pair< ModuleType, string > ModuleKey
boost::shared_ptr< Field > FieldSharedPtr
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.