53 "Reads Tecplot dat file for FE block triangular format.")};
77 std::ifstream datFile;
80 string fname =
m_f->m_inputfiles[
"dat"][0];
82 datFile.open(fname.c_str());
85 cerr <<
"Error opening file: " << fname << endl;
92 vector<string> fieldNames;
93 while (!datFile.eof())
95 getline(datFile, line);
96 string linetest = line;
97 boost::to_upper(linetest);
98 if (linetest.find(
"VARIABLES") != string::npos)
100 std::size_t pos = line.find(
'=');
107 ASSERTL0(valid,
"Unable to process list of field variable in "
108 " VARIABLES list: " +
112 fieldNames.erase(fieldNames.begin(), fieldNames.begin() + dim);
119 int nfields = fieldNames.size();
120 int totvars = dim + nfields;
122 vector<Array<OneD, int>> ptsConn;
125 while (!datFile.eof())
127 getline(datFile, line);
128 string linetest = line;
129 boost::to_upper(linetest);
130 if ((linetest.find(
"ZONE") != string::npos))
139 dim, fieldNames, pts);
141 m_f->m_fieldPts->SetConnectivity(ptsConn);
144 m_f->m_variables = fieldNames;
154 ASSERTL0(line.find(
"FEBlock") != string::npos,
155 "Routine only set up for FEBLock format");
156 ASSERTL0(line.find(
"ET") != string::npos,
"Routine only set up TRIANLES");
169 start = tag.find(
"N=");
170 end = tag.find_first_of(
',', start);
171 int nvert = atoi(tag.substr(start + 2, end).c_str());
174 start = tag.find(
"E=");
175 end = tag.find_first_of(
',', start);
176 int nelmt = atoi(tag.substr(start + 2, end).c_str());
179 int norigpts = pts[0].size();
180 int totfields = pts.size();
182 for (
int i = 0; i < totfields; ++i)
189 for (
int n = 0; n < totfields; ++n)
192 for (
int i = 0; i < norigpts; ++i)
194 pts[n][i] = origpts[n][i];
196 for (
int i = 0; i < nvert; ++i)
199 pts[n][norigpts + i] = value;
206 for (
int i = 0; i < 3 * nelmt; ++i)
210 conn[i] = norigpts + intvalue;
212 ptsConn.push_back(conn);
214 getline(datFile, line);
#define ASSERTL0(condition, msg)
std::set< std::string > m_allowedFiles
List of allowed file formats.
FieldSharedPtr m_f
Field object.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
ModuleFactory & GetModuleFactory()