mirror of https://github.com/QMCPACK/qmcpack.git
Add parse function.
git-svn-id: https://subversion.assembla.com/svn/qmcdev/trunk@334 e5b18d87-469d-4833-9cc0-8cdfa06e9491
This commit is contained in:
parent
0c2f456b1d
commit
dbcf37bd1c
|
@ -46,6 +46,33 @@ namespace ohmmsqmc {
|
|||
DEBUGMSG("QMCApps::~QMCApps")
|
||||
}
|
||||
|
||||
int QMCApp::parse(const string& infile) {
|
||||
|
||||
//already has documentation open. Remove it.
|
||||
if(m_doc != NULL) {
|
||||
xmlXPathFreeContext(m_context);
|
||||
xmlFreeDoc(m_doc);
|
||||
}
|
||||
|
||||
// build an XML tree from a the file;
|
||||
m_doc = xmlParseFile(infile.c_str());
|
||||
if (m_doc == NULL) {
|
||||
ERRORMSG("File " << infile << " is invalid")
|
||||
xmlFreeDoc(m_doc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Check the document is of the right kind
|
||||
xmlNodePtr cur = xmlDocGetRootElement(m_doc);
|
||||
if (cur == NULL) {
|
||||
ERRORMSG("Empty document");
|
||||
xmlFreeDoc(m_doc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return !run(cur);
|
||||
}
|
||||
|
||||
bool QMCApps::setMCWalkers(xmlNodePtr aroot) {
|
||||
|
||||
bool foundconfig=false;
|
||||
|
|
|
@ -38,11 +38,17 @@ namespace ohmmsqmc {
|
|||
///destructor
|
||||
virtual ~QMCApps();
|
||||
|
||||
/**process input xml file
|
||||
* @param infile input xml file
|
||||
* @return 1 for any failed execution
|
||||
*/
|
||||
int parse(const string& infile);
|
||||
|
||||
///initialization with a file
|
||||
virtual bool init() = 0;
|
||||
|
||||
///run it
|
||||
bool run(xmlNodePtr aroot);
|
||||
virtual bool run(xmlNodePtr aroot);
|
||||
|
||||
void saveXml();
|
||||
|
||||
|
|
Loading…
Reference in New Issue