39#include <boost/core/ignore_unused.hpp>
57 "Reads Tecplot dat file for FE block triangular format.")};
80 boost::ignore_unused(vm);
83 std::ifstream datFile;
86 string fname =
m_f->m_inputfiles[
"dat"][0];
88 datFile.open(fname.c_str());
91 cerr <<
"Error opening file: " << fname << endl;
98 vector<string> fieldNames;
99 while (!datFile.eof())
101 getline(datFile, line);
102 string linetest = line;
103 boost::to_upper(linetest);
104 if (linetest.find(
"VARIABLES") != string::npos)
106 std::size_t pos = line.find(
'=');
113 ASSERTL0(valid,
"Unable to process list of field variable in "
114 " VARIABLES list: " +
118 fieldNames.erase(fieldNames.begin(), fieldNames.begin() + dim);
125 int nfields = fieldNames.size();
126 int totvars = dim + nfields;
128 vector<Array<OneD, int>> ptsConn;
131 while (!datFile.eof())
133 getline(datFile, line);
134 string linetest = line;
135 boost::to_upper(linetest);
136 if ((linetest.find(
"ZONE") != string::npos))
145 dim, fieldNames, pts);
147 m_f->m_fieldPts->SetConnectivity(ptsConn);
150 m_f->m_variables = fieldNames;
160 ASSERTL0(line.find(
"FEBlock") != string::npos,
161 "Routine only set up for FEBLock format");
162 ASSERTL0(line.find(
"ET") != string::npos,
"Routine only set up TRIANLES");
175 start = tag.find(
"N=");
176 end = tag.find_first_of(
',', start);
177 int nvert = atoi(tag.substr(start + 2, end).c_str());
180 start = tag.find(
"E=");
181 end = tag.find_first_of(
',', start);
182 int nelmt = atoi(tag.substr(start + 2, end).c_str());
185 int norigpts = pts[0].size();
186 int totfields = pts.size();
188 for (
int i = 0; i < totfields; ++i)
195 for (
int n = 0; n < totfields; ++n)
198 for (
int i = 0; i < norigpts; ++i)
200 pts[n][i] = origpts[n][i];
202 for (
int i = 0; i < nvert; ++i)
205 pts[n][norigpts + i] = value;
212 for (
int i = 0; i < 3 * nelmt; ++i)
216 conn[i] = norigpts + intvalue;
218 ptsConn.push_back(conn);
220 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()
The above copyright notice and this permission notice shall be included.