35 #ifndef NEKTAR_LIB_UTILITIES_BASIC_UTILS_FIELDIOXML_H 36 #define NEKTAR_LIB_UTILITIES_BASIC_UTILS_FIELDIOXML_H 38 #include <boost/algorithm/string/predicate.hpp> 45 namespace LibUtilities
60 m_doc =
new TiXmlDocument(fn);
61 bool loadOkay =
m_doc->LoadFile();
62 std::stringstream errstr;
63 errstr <<
"Unable to load file: " << fn << std::endl;
64 errstr <<
"Reason: " <<
m_doc->ErrorDesc() << std::endl;
65 errstr <<
"Position: Line " <<
m_doc->ErrorRow() <<
", Column " 66 <<
m_doc->ErrorCol() << std::endl;
86 const TiXmlDocument &
Get()
const 123 TiXmlElement *child =
new TiXmlElement(name.c_str());
124 m_El->LinkEndChild(child);
129 virtual void SetAttr(
const std::string &key,
const std::string &val)
131 if (boost::starts_with(key,
"XML_"))
134 std::string elmtName = key.substr(4);
135 TiXmlElement *child =
new TiXmlElement(elmtName.c_str());
139 doc.Parse(val.c_str());
141 TiXmlElement *e = doc.FirstChildElement();
145 child->LinkEndChild(e->Clone());
146 e = e->NextSiblingElement();
149 m_El->LinkEndChild(child);
153 TiXmlElement *child =
new TiXmlElement(key.c_str());
154 child->LinkEndChild(
new TiXmlText(val.c_str()));
155 m_El->LinkEndChild(child);
217 bool sharedFilesystem);
225 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
230 const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
231 std::vector<std::vector<NekDouble> > &fielddata);
234 const std::string &outfile,
235 const std::vector<std::string> fileNames,
236 std::vector<std::vector<unsigned int> > &elementList,
240 const std::string &outname,
241 const std::vector<FieldDefinitionsSharedPtr> &fielddefs,
245 const std::string &inFile,
246 std::vector<std::string> &fileNames,
247 std::vector<std::vector<unsigned int> > &elementList,
251 const std::string &infilename,
252 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
253 std::vector<std::vector<NekDouble> > &fielddata =
266 const std::string &outFile,
267 std::vector<FieldDefinitionsSharedPtr> &fielddefs,
268 std::vector<std::vector<NekDouble> > &fielddata,
270 const bool backup =
false);
#define ASSERTL0(condition, msg)
bool m_needsFree
Boolean dictating whether document needs to be freed or not.
std::shared_ptr< XmlDataSource > XmlDataSourceSharedPtr
TiXmlElement * m_El
Internal TinyXML document storage.
static DataSourceSharedPtr create(TiXmlDocument &fn)
Create a new XML data source based on a TiXmlDocument.
virtual TagWriterSharedPtr AddChild(const std::string &name)
Add a child node.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
TiXmlDocument & Get()
Return the TinyXML document of this source.
static std::string className
Name of class.
std::map< std::string, std::string > FieldMetaDataMap
Base class for writing hierarchical data (XML or HDF5).
std::shared_ptr< TagWriter > TagWriterSharedPtr
std::shared_ptr< DataSource > DataSourceSharedPtr
static DataSourceSharedPtr create(const std::string &fn)
Create a new XML data source based on the filename.
#define LIB_UTILITIES_EXPORT
static std::vector< std::vector< NekDouble > > NullVectorNekDoubleVector
static FieldIOSharedPtr create(LibUtilities::CommSharedPtr pComm, bool sharedFilesystem)
Creates an instance of this class.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
const TiXmlDocument & Get() const
Return the TinyXML document of this source.
TiXmlDocument * m_doc
Internal TinyXML document storage.
XmlTagWriter(TiXmlElement *elem)
Default constructor.
virtual const std::string & GetClassName() const
Returns the class name.
virtual void SetAttr(const std::string &key, const std::string &val)
Set an attribute key/value pair on this tag.
std::shared_ptr< XmlTagWriter > XmlTagWriterSharedPtr
~XmlDataSource()
Destructor cleans up memory usage.
XmlDataSource(const std::string &fn)
Constructor based on filename.
Class for operating on Nektar++ input/output files.
static Array< OneD, int > NullInt1DArray
std::shared_ptr< FieldIO > FieldIOSharedPtr
static FieldMetaDataMap NullFieldMetaDataMap
XmlDataSource(TiXmlDocument &doc)
Default constructor.