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");
97 fields.c_str(),
m_f->m_fieldPts->m_fields);
98 ASSERTL0(valid,
"Unable to process list of field variable in "
99 " FIELDS attribute: "+ fields);
101 nfields =
m_f->m_fieldPts->m_nFields =
m_f->m_fieldPts->m_fields.size();
103 int totvars = dim + nfields;
104 m_f->m_fieldPts->m_ptsDim = dim;
105 m_f->m_fieldPts->m_nFields = nfields;
106 m_f->m_fieldPts->m_pts = Array<OneD, Array<OneD, NekDouble> >(totvars);
108 TiXmlNode *pointsBody = points->FirstChild();
110 std::istringstream pointsDataStrm(pointsBody->ToText()->Value());
112 vector<NekDouble> pts;
116 while(!pointsDataStrm.fail())
118 pointsDataStrm >> in_pts;
120 pts.push_back(in_pts);
125 ASSERTL0(
false,
"Unable to read Points data.");
128 int npts = pts.size()/totvars;
132 cout <<
" Read " << npts <<
" points of dimension " << dim <<
" and "
133 << nfields <<
" field variables" << endl;
136 for(
int i = 0; i < totvars; ++i)
138 m_f->m_fieldPts->m_pts[i] = Array<OneD, NekDouble>(
npts);
141 for(
int i = 0; i <
npts; ++i)
143 for(
int j = 0; j < totvars; ++j)
145 m_f->m_fieldPts->m_pts[j][i] = pts[i*totvars +j];