77 cout <<
"Processing input pts file" << endl;
80 string pts_ending =
"pts";
82 TiXmlDocument docInput;
83 ASSERTL0(docInput.LoadFile((
m_f->m_inputfiles[
"pts"][0]).c_str()),
84 "Unable to open file '" +
m_f->m_inputfiles[
"pts"][0] +
"'.");
86 TiXmlElement *nektar = docInput.FirstChildElement(
"NEKTAR");
87 TiXmlElement *points = nektar->FirstChildElement(
"POINTS");
89 int err = points->QueryIntAttribute(
"DIM", &dim);
91 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute DIM.");
94 std::string fields = points->Attribute(
"FIELDS");
99 fields.c_str(),
m_f->m_fieldPts->m_fields);
100 ASSERTL0(valid,
"Unable to process list of field variable in "
101 " FIELDS attribute: "+ fields);
104 nfields =
m_f->m_fieldPts->m_nFields =
m_f->m_fieldPts->m_fields.size();
106 int totvars = dim + nfields;
107 m_f->m_fieldPts->m_ptsDim = dim;
108 m_f->m_fieldPts->m_nFields = nfields;
109 m_f->m_fieldPts->m_pts = Array<OneD, Array<OneD, NekDouble> >(totvars);
111 TiXmlNode *pointsBody = points->FirstChild();
113 std::istringstream pointsDataStrm(pointsBody->ToText()->Value());
115 vector<NekDouble> pts;
119 while(!pointsDataStrm.fail())
121 pointsDataStrm >> in_pts;
123 pts.push_back(in_pts);
128 ASSERTL0(
false,
"Unable to read Points data.");
131 int npts = pts.size()/totvars;
135 cout <<
" Read " << npts <<
" points of dimension " << dim <<
" and "
136 << nfields <<
" field variables" << endl;
139 for(
int i = 0; i < totvars; ++i)
141 m_f->m_fieldPts->m_pts[i] = Array<OneD, NekDouble>(
npts);
144 for(
int i = 0; i <
npts; ++i)
146 for(
int j = 0; j < totvars; ++j)
148 m_f->m_fieldPts->m_pts[j][i] = pts[i*totvars +j];