39 #include <boost/core/ignore_unused.hpp> 58 "Reads Tecplot dat file for FE block triangular format.")
82 boost::ignore_unused(vm);
85 std::ifstream datFile;
88 string fname =
m_f->m_inputfiles[
"dat"][0];
90 datFile.open(fname.c_str());
93 cerr <<
"Error opening file: " << fname << endl;
100 vector<string> fieldNames;
101 while (!datFile.eof())
103 getline(datFile, line);
104 string linetest = line;
105 boost::to_upper(linetest);
106 if (linetest.find(
"VARIABLES") != string::npos)
108 std::size_t pos = line.find(
'=');
114 line.substr(pos), fieldNames);
115 ASSERTL0(valid,
"Unable to process list of field variable in " 116 " VARIABLES list: " +
120 fieldNames.erase(fieldNames.begin(), fieldNames.begin() + dim);
127 int nfields = fieldNames.size();
128 int totvars = dim + nfields;
130 vector<Array<OneD, int> > ptsConn;
133 while (!datFile.eof())
135 getline(datFile, line);
136 string linetest = line;
137 boost::to_upper(linetest);
138 if ((linetest.find(
"ZONE") != string::npos))
147 dim, fieldNames, pts);
149 m_f->m_fieldPts->SetConnectivity(ptsConn);
152 m_f->m_variables = fieldNames;
163 ASSERTL0(line.find(
"FEBlock") != string::npos,
164 "Routine only set up for FEBLock format");
165 ASSERTL0(line.find(
"ET") != string::npos,
"Routine only set up TRIANLES");
178 start = tag.find(
"N=");
179 end = tag.find_first_of(
',', start);
180 int nvert = atoi(tag.substr(start + 2, end).c_str());
183 start = tag.find(
"E=");
184 end = tag.find_first_of(
',', start);
185 int nelmt = atoi(tag.substr(start + 2, end).c_str());
188 int norigpts = pts[0].num_elements();
189 int totfields = pts.num_elements();
191 for (
int i = 0; i < totfields; ++i)
198 for (
int n = 0; n < totfields; ++n)
201 for (
int i = 0; i < norigpts; ++i)
203 pts[n][i] = origpts[n][i];
205 for (
int i = 0; i < nvert; ++i)
208 pts[n][norigpts + i] = value;
215 for (
int i = 0; i < 3 * nelmt; ++i)
219 conn[i] = norigpts + intvalue;
221 ptsConn.push_back(conn);
223 getline(datFile, line);
#define ASSERTL0(condition, msg)
std::shared_ptr< Field > FieldSharedPtr
std::pair< ModuleType, std::string > ModuleKey
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.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
ModuleFactory & GetModuleFactory()
FieldSharedPtr m_f
Field object.