From 10aea028352ee24488742bea562ee4daab5cb7f1 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 8 Aug 2012 22:16:55 +0000 Subject: [PATCH] Removed constructPhaseFile and constructPhaseXML methods from WaterSSTP --- include/cantera/thermo/WaterSSTP.h | 29 ----------- src/thermo/WaterSSTP.cpp | 79 +----------------------------- 2 files changed, 2 insertions(+), 106 deletions(-) diff --git a/include/cantera/thermo/WaterSSTP.h b/include/cantera/thermo/WaterSSTP.h index b48da1d53..c990d0ec3 100644 --- a/include/cantera/thermo/WaterSSTP.h +++ b/include/cantera/thermo/WaterSSTP.h @@ -418,35 +418,6 @@ public: */ virtual void setDensity(const doublereal dens); - - //! Initialization of a pure water phase using an - //! xml file. - /*! - * This routine is a precursor to constructPhaseXML(XML_Node*) - * routine, which does most of the work. - * - * @param inputFile String name of the file. - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ - void constructPhaseFile(std::string inputFile, std::string id); - - - //! Initialization of a pure water phase using an xml file. - /*! - * This calls importPhase() to do the work. - * - * @param phaseNode XML file containing the description of the - * phase - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ - void constructPhaseXML(XML_Node& phaseNode, std::string id); - //!Import and initialize a ThermoPhase object using an XML tree. /*! * @internal diff --git a/src/thermo/WaterSSTP.cpp b/src/thermo/WaterSSTP.cpp index 7abf6c89e..ccfd14ada 100644 --- a/src/thermo/WaterSSTP.cpp +++ b/src/thermo/WaterSSTP.cpp @@ -37,7 +37,6 @@ WaterSSTP::WaterSSTP() : m_ready(false), m_allowGasPhase(false) { - //constructPhase(); } @@ -51,7 +50,7 @@ WaterSSTP::WaterSSTP(std::string inputFile, std::string id) : m_ready(false), m_allowGasPhase(false) { - constructPhaseFile(inputFile, id); + initThermoFile(inputFile, id); } @@ -65,11 +64,10 @@ WaterSSTP::WaterSSTP(XML_Node& phaseRoot, std::string id) : m_ready(false), m_allowGasPhase(false) { - constructPhaseXML(phaseRoot, id) ; + importPhase(*findXMLPhase(&phaseRoot, id), this); } - WaterSSTP::WaterSSTP(const WaterSSTP& b) : SingleSpeciesTP(b), m_sub(0), @@ -125,79 +123,6 @@ WaterSSTP::~WaterSSTP() delete m_waterProps; } - - - -/* - * @param infile XML file containing the description of the - * phase - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ -void WaterSSTP::constructPhaseXML(XML_Node& phaseNode, std::string id) -{ - - /* - * Call the Cantera importPhase() function. This will import - * all of the species into the phase. This will also handle - * all of the solvent and solute standard states. - */ - bool m_ok = importPhase(phaseNode, this); - if (!m_ok) { - throw CanteraError("initThermo","importPhase failed "); - } - -} - -/* - * constructPhaseFile - * - * - * This routine is a precursor to constructPhaseXML(XML_Node*) - * routine, which does most of the work. - * - * @param inputFile XML file containing the description of the - * phase - * - * @param id Optional parameter identifying the name of the - * phase. If none is given, the first XML - * phase element will be used. - */ -void WaterSSTP::constructPhaseFile(std::string inputFile, std::string id) -{ - - if (inputFile.size() == 0) { - throw CanteraError("WaterSSTP::constructPhaseFile", - "input file is null"); - } - std::string path = findInputFile(inputFile); - std::ifstream fin(path.c_str()); - if (!fin) { - throw CanteraError("WaterSSTP::constructPhaseFile","could not open " - +path+" for reading."); - } - /* - * The phase object automatically constructs an XML object. - * Use this object to store information. - */ - XML_Node& phaseNode_XML = xml(); - XML_Node* fxml = new XML_Node(); - fxml->build(fin); - XML_Node* fxml_phase = findXMLPhase(fxml, id); - if (!fxml_phase) { - throw CanteraError("WaterSSTP::constructPhaseFile", - "ERROR: Can not find phase named " + - id + " in file named " + inputFile); - } - fxml_phase->copy(&phaseNode_XML); - constructPhaseXML(*fxml_phase, id); - delete fxml; -} - - - void WaterSSTP::initThermo() { SingleSpeciesTP::initThermo();