41 namespace LibUtilities
47 p.
Import(inFile, ptsField);
54 p.
Write(outFile, ptsField);
66 TiXmlDocument docInput;
67 ASSERTL0(docInput.LoadFile(inFile),
"Unable to open file '" + inFile +
"'.");
69 TiXmlElement *nektar = docInput.FirstChildElement(
"NEKTAR");
70 TiXmlElement *points = nektar->FirstChildElement(
"POINTS");
72 int err = points->QueryIntAttribute(
"DIM", &dim);
74 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute DIM.");
76 std::string fields = points->Attribute(
"FIELDS");
78 vector<string> fieldNames;
82 fields.c_str(), fieldNames);
84 "Unable to process list of field variable in FIELDS attribute: " + fields);
87 int nfields = fieldNames.size();
88 int totvars = dim + nfields;
90 TiXmlNode *pointsBody = points->FirstChild();
92 std::istringstream pointsDataStrm(pointsBody->ToText()->Value());
94 vector<NekDouble> ptsSerial;
100 while (!pointsDataStrm.fail())
102 pointsDataStrm >> ptsStream;
104 ptsSerial.push_back(ptsStream);
109 ASSERTL0(
false,
"Unable to read Points data.");
112 int npts = ptsSerial.size() / totvars;
114 for (
int i = 0; i < totvars; ++i)
119 for (
int i = 0; i <
npts; ++i)
121 for (
int j = 0; j < totvars; ++j)
123 pts[j][i] = ptsSerial[i * totvars + j];
140 ASSERTL0(
false,
"Not implemented yet");
#define ASSERTL0(condition, msg)
static bool GenerateOrderedStringVector(const char *const str, std::vector< std::string > &vec)
void Write(const string &outFile, const LibUtilities::PtsFieldSharedPtr &ptsField)
Save a pts field to a file.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< PtsField > PtsFieldSharedPtr
void Import(const std::string &infilename, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, FieldMetaDataMap &fieldinfomap, const Array< OneD, int > ElementiDs)
Imports an FLD file.
void Import(const string &inFile, LibUtilities::PtsFieldSharedPtr &ptsField)
Import a pts field from file.
void Write(const std::string &outFile, std::vector< FieldDefinitionsSharedPtr > &fielddefs, std::vector< std::vector< NekDouble > > &fielddata, const FieldMetaDataMap &fieldinfomap)
Write a field file in serial only.