From 8edb731f9ca96fd2f673cb5c90c9a709b5be2ede Mon Sep 17 00:00:00 2001 From: Raymond Speth Date: Thu, 18 Feb 2021 10:46:46 -0500 Subject: [PATCH] [Thermo] Combine file-based and default constructors For classes derived from ThermoPhase, instead of having separate constructors for the default constructor and the constructor which takes an input file and phase id, we can use the case where both arguments are the default (empty string) to construct a phase without using an input file. This eliminates the need to repeat any initialization that takes place in the constructor. --- .../thermo/BinarySolutionTabulatedThermo.h | 7 ++-- include/cantera/thermo/DebyeHuckel.h | 9 +++-- include/cantera/thermo/HMWSoln.h | 7 ++-- include/cantera/thermo/IdealGasPhase.h | 9 +++-- include/cantera/thermo/IdealMolalSoln.h | 8 ++--- include/cantera/thermo/IdealSolidSolnPhase.h | 6 ++-- include/cantera/thermo/IdealSolnGasVPSS.h | 9 +---- .../cantera/thermo/IonsFromNeutralVPSSTP.h | 12 +++---- include/cantera/thermo/LatticePhase.h | 9 +++-- include/cantera/thermo/MargulesVPSSTP.h | 8 ++--- include/cantera/thermo/RedlichKisterVPSSTP.h | 12 +++---- include/cantera/thermo/RedlichKwongMFTP.h | 12 +++---- include/cantera/thermo/StoichSubstance.h | 9 +++-- include/cantera/thermo/ThermoPhase.h | 3 +- include/cantera/thermo/WaterSSTP.h | 6 ++-- src/thermo/BinarySolutionTabulatedThermo.cpp | 6 ---- src/thermo/DebyeHuckel.cpp | 14 -------- src/thermo/HMWSoln.cpp | 34 ------------------- src/thermo/IdealGasPhase.cpp | 5 --- src/thermo/IdealMolalSoln.cpp | 20 ----------- src/thermo/IdealSolidSolnPhase.cpp | 3 ++ src/thermo/IdealSolnGasVPSS.cpp | 19 ++--------- src/thermo/IonsFromNeutralVPSSTP.cpp | 9 ----- src/thermo/LatticePhase.cpp | 11 ++---- src/thermo/MargulesVPSSTP.cpp | 7 ---- src/thermo/RedlichKisterVPSSTP.cpp | 7 ---- src/thermo/RedlichKwongMFTP.cpp | 11 ------ src/thermo/SurfPhase.cpp | 3 ++ src/thermo/ThermoPhase.cpp | 4 +++ src/thermo/WaterSSTP.cpp | 9 ----- 30 files changed, 64 insertions(+), 224 deletions(-) diff --git a/include/cantera/thermo/BinarySolutionTabulatedThermo.h b/include/cantera/thermo/BinarySolutionTabulatedThermo.h index b754dcd9260..b967921bc0e 100644 --- a/include/cantera/thermo/BinarySolutionTabulatedThermo.h +++ b/include/cantera/thermo/BinarySolutionTabulatedThermo.h @@ -113,20 +113,17 @@ namespace Cantera class BinarySolutionTabulatedThermo : public IdealSolidSolnPhase { public: - //! Default constructor for BinarySolutionTabulatedThermo - BinarySolutionTabulatedThermo(); - //! Construct and initialize an BinarySolutionTabulatedThermo ThermoPhase object //! directly from an input file /*! * This constructor will also fully initialize the object. * * @param infile File name for the input file containing information - * for this phase + * for this phase. If not specified, and empty phase will be created. * @param id The name of this phase. This is used to look up * the phase in the input file. */ - BinarySolutionTabulatedThermo(const std::string& infile, const std::string& id=""); + explicit BinarySolutionTabulatedThermo(const std::string& infile="", const std::string& id=""); //! Construct and initialize an BinarySolutionTabulatedThermo ThermoPhase object //! directly from an XML database diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index e826f40a5cf..d9a81c9673a 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -558,17 +558,16 @@ class PDSS_Water; class DebyeHuckel : public MolalityVPSSTP { public: - //! Default Constructor - DebyeHuckel(); - virtual ~DebyeHuckel(); //! Full constructor for creating the phase. /*! - * @param inputFile File name containing the definition of the phase + * @param inputFile File name containing the definition of the phase. + * If blank, an empty phase will be created. * @param id id attribute containing the name of the phase. */ - DebyeHuckel(const std::string& inputFile, const std::string& id = ""); + explicit DebyeHuckel(const std::string& inputFile="", + const std::string& id=""); //! Full constructor for creating the phase. /*! diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index 2aeb7e7efa3..4b9a509af3b 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -1038,8 +1038,6 @@ class WaterProps; class HMWSoln : public MolalityVPSSTP { public: - //! Default Constructor - HMWSoln(); ~HMWSoln(); //! Construct and initialize an HMWSoln ThermoPhase object @@ -1049,11 +1047,12 @@ class HMWSoln : public MolalityVPSSTP * a reference to the parsed input file to get the info for the phase. * * @param inputFile Name of the input file containing the phase definition - * to set up the object + * to set up the object. If blank, an empty phase will be + * created. * @param id ID of the phase in the input file. Defaults to the * empty string. */ - HMWSoln(const std::string& inputFile, const std::string& id = ""); + explicit HMWSoln(const std::string& inputFile="", const std::string& id=""); //! Construct and initialize an HMWSoln ThermoPhase object //! directly from an XML database diff --git a/include/cantera/thermo/IdealGasPhase.h b/include/cantera/thermo/IdealGasPhase.h index a74e84e4033..c5fe4eb2dda 100644 --- a/include/cantera/thermo/IdealGasPhase.h +++ b/include/cantera/thermo/IdealGasPhase.h @@ -287,18 +287,17 @@ namespace Cantera class IdealGasPhase: public ThermoPhase { public: - //! Default empty Constructor - IdealGasPhase(); - //! Construct and initialize an IdealGasPhase ThermoPhase object //! directly from an ASCII input file /*! * @param inputFile Name of the input file containing the phase definition - * to set up the object + * to set up the object. If blank, an empty phase will be + * created. * @param id ID of the phase in the input file. Defaults to the * empty string. */ - IdealGasPhase(const std::string& inputFile, const std::string& id = ""); + explicit IdealGasPhase(const std::string& inputFile="", + const std::string& id=""); //! Construct and initialize an IdealGasPhase ThermoPhase object //! directly from an XML database diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index 7120b12b10d..03c3457b4e7 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -78,19 +78,17 @@ namespace Cantera class IdealMolalSoln : public MolalityVPSSTP { public: - /// Constructor - IdealMolalSoln(); - //! Constructor for phase initialization /*! * This constructor will initialize a phase, by reading the required * information from an input file. * * @param inputFile Name of the Input file that contains information - * about the phase + * about the phase. If blank, an empty phase will be created. * @param id id of the phase within the input file */ - IdealMolalSoln(const std::string& inputFile, const std::string& id = ""); + explicit IdealMolalSoln(const std::string& inputFile="", + const std::string& id=""); //! Constructor for phase initialization /*! diff --git a/include/cantera/thermo/IdealSolidSolnPhase.h b/include/cantera/thermo/IdealSolidSolnPhase.h index e3f5fd26c48..2a991402df6 100644 --- a/include/cantera/thermo/IdealSolidSolnPhase.h +++ b/include/cantera/thermo/IdealSolidSolnPhase.h @@ -60,14 +60,16 @@ class IdealSolidSolnPhase : public ThermoPhase * is supplied in the constructor or read from the input file. * * @param infile File name for the input file containing information - * for this phase + * for this phase. If blank, an empty phase will be + * created. * @param id The name of this phase. This is used to look up * the phase in the input file. * @param formCG This parameter initializes the #m_formGC variable. * @deprecated the formGC argument is deprecated and will be removed after * Cantera 2.6. Use the setStandardConcentrationModel method instead. */ - IdealSolidSolnPhase(const std::string& infile, const std::string& id="", int formCG=-1); + explicit IdealSolidSolnPhase(const std::string& infile, + const std::string& id="", int formCG=-1); //! Construct and initialize an IdealSolidSolnPhase ThermoPhase object //! directly from an XML database diff --git a/include/cantera/thermo/IdealSolnGasVPSS.h b/include/cantera/thermo/IdealSolnGasVPSS.h index 96d158cdfe9..3deae06b0c5 100644 --- a/include/cantera/thermo/IdealSolnGasVPSS.h +++ b/include/cantera/thermo/IdealSolnGasVPSS.h @@ -27,15 +27,8 @@ namespace Cantera class IdealSolnGasVPSS : public VPStandardStateTP { public: - /*! - * @name Constructors and Duplicators for IdealSolnGasVPSS - */ - //! @{ - - IdealSolnGasVPSS(); - /// Create an object from an input file - IdealSolnGasVPSS(const std::string& infile, std::string id=""); + explicit IdealSolnGasVPSS(const std::string& infile="", std::string id=""); //@} //! @name Utilities (IdealSolnGasVPSS) diff --git a/include/cantera/thermo/IonsFromNeutralVPSSTP.h b/include/cantera/thermo/IonsFromNeutralVPSSTP.h index c16afbab40a..1526b110b26 100644 --- a/include/cantera/thermo/IonsFromNeutralVPSSTP.h +++ b/include/cantera/thermo/IonsFromNeutralVPSSTP.h @@ -70,19 +70,15 @@ class IonsFromNeutralVPSSTP : public GibbsExcessVPSSTP //! @name Constructors //! @{ - /*! - * Default constructor - */ - IonsFromNeutralVPSSTP(); - //! Construct an IonsFromNeutralVPSSTP object from an input file /*! - * @param inputFile Name of the input file containing the phase definition + * @param inputFile Name of the input file containing the phase definition. + * If blank, an empty phase will be created. * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - IonsFromNeutralVPSSTP(const std::string& inputFile, - const std::string& id = ""); + explicit IonsFromNeutralVPSSTP(const std::string& inputFile="", + const std::string& id=""); //! Construct and initialize an IonsFromNeutralVPSSTP object //! directly from an XML database diff --git a/include/cantera/thermo/LatticePhase.h b/include/cantera/thermo/LatticePhase.h index adc08a445ea..725d7726166 100644 --- a/include/cantera/thermo/LatticePhase.h +++ b/include/cantera/thermo/LatticePhase.h @@ -230,15 +230,14 @@ namespace Cantera class LatticePhase : public ThermoPhase { public: - //! Base Empty constructor - LatticePhase(); - //! Full constructor for a lattice phase /*! - * @param inputFile String name of the input file + * @param inputFile String name of the input file. If blank, + * an empty phase will be created. * @param id string id of the phase name */ - LatticePhase(const std::string& inputFile, const std::string& id = ""); + explicit LatticePhase(const std::string& inputFile="", + const std::string& id=""); //! Full constructor for a water phase /*! diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index 72d6e952d94..def54ea821c 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -214,15 +214,15 @@ namespace Cantera class MargulesVPSSTP : public GibbsExcessVPSSTP { public: - MargulesVPSSTP(); - //! Construct a MargulesVPSSTP object from an input file /*! - * @param inputFile Name of the input file containing the phase definition + * @param inputFile Name of the input file containing the phase definition. + * If blank, an empty phase will be created. * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - MargulesVPSSTP(const std::string& inputFile, const std::string& id = ""); + explicit MargulesVPSSTP(const std::string& inputFile="", + const std::string& id=""); //! Construct and initialize a MargulesVPSSTP ThermoPhase object directly //! from an XML database diff --git a/include/cantera/thermo/RedlichKisterVPSSTP.h b/include/cantera/thermo/RedlichKisterVPSSTP.h index 229916155ec..c0a49fe2894 100644 --- a/include/cantera/thermo/RedlichKisterVPSSTP.h +++ b/include/cantera/thermo/RedlichKisterVPSSTP.h @@ -216,19 +216,15 @@ namespace Cantera class RedlichKisterVPSSTP : public GibbsExcessVPSSTP { public: - //! Constructor - /*! - * This doesn't do much more than initialize constants with default values. - */ - RedlichKisterVPSSTP(); - //! Construct a RedlichKisterVPSSTP object from an input file /*! - * @param inputFile Name of the input file containing the phase definition + * @param inputFile Name of the input file containing the phase definition. + * If blank, an empty phase will be created. * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - RedlichKisterVPSSTP(const std::string& inputFile, const std::string& id = ""); + explicit RedlichKisterVPSSTP(const std::string& inputFile="", + const std::string& id=""); //! Construct and initialize a RedlichKisterVPSSTP ThermoPhase object //! directly from an XML database diff --git a/include/cantera/thermo/RedlichKwongMFTP.h b/include/cantera/thermo/RedlichKwongMFTP.h index fa5e4f0eb54..d6317e33d9d 100644 --- a/include/cantera/thermo/RedlichKwongMFTP.h +++ b/include/cantera/thermo/RedlichKwongMFTP.h @@ -19,19 +19,15 @@ namespace Cantera class RedlichKwongMFTP : public MixtureFugacityTP { public: - //! @name Constructors and Duplicators - //! @{ - - //! Base constructor. - RedlichKwongMFTP(); - //! Construct a RedlichKwongMFTP object from an input file /*! - * @param inputFile Name of the input file containing the phase definition + * @param inputFile Name of the input file containing the phase definition. + * If blank, an empty phase will be created. * @param id name (ID) of the phase in the input file. If empty, the * first phase definition in the input file will be used. */ - RedlichKwongMFTP(const std::string& infile, const std::string& id=""); + explicit RedlichKwongMFTP(const std::string& infile="", + const std::string& id=""); //! Construct and initialize a RedlichKwongMFTP object directly from an //! XML database diff --git a/include/cantera/thermo/StoichSubstance.h b/include/cantera/thermo/StoichSubstance.h index ead757b3d7b..06f4ad71450 100644 --- a/include/cantera/thermo/StoichSubstance.h +++ b/include/cantera/thermo/StoichSubstance.h @@ -149,17 +149,16 @@ namespace Cantera class StoichSubstance : public SingleSpeciesTP { public: - //! Default constructor for the StoichSubstance class - StoichSubstance() {} - //! Construct and initialize a StoichSubstance ThermoPhase object directly //! from an ASCII input file /*! - * @param infile name of the input file + * @param infile name of the input file. If blank, an empty phase will be + * created. * @param id name of the phase id in the file. * If this is blank, the first phase in the file is used. */ - StoichSubstance(const std::string& infile, const std::string& id = ""); + explicit StoichSubstance(const std::string& infile="", + const std::string& id=""); //! Construct and initialize a StoichSubstance ThermoPhase object directly //! from an XML database diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 09d63ff20a1..639c5ed9601 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -1624,7 +1624,8 @@ class ThermoPhase : public Phase * Used to implement constructors for derived classes which take a * file name and phase name as arguments. * - * @param inputFile Input file containing the description of the phase + * @param inputFile Input file containing the description of the phase. If blank, + * no setup will be performed. * @param id Optional parameter identifying the name of the phase. If * blank, the first phase definition encountered will be used. */ diff --git a/include/cantera/thermo/WaterSSTP.h b/include/cantera/thermo/WaterSSTP.h index e6850d5a9a7..19ffa58f546 100644 --- a/include/cantera/thermo/WaterSSTP.h +++ b/include/cantera/thermo/WaterSSTP.h @@ -119,15 +119,13 @@ class WaterProps; class WaterSSTP : public SingleSpeciesTP { public: - //! Base constructor - WaterSSTP(); - //! Full constructor for a water phase /*! * @param inputFile String name of the input file * @param id string id of the phase name */ - explicit WaterSSTP(const std::string& inputFile, const std::string& id = ""); + explicit WaterSSTP(const std::string& inputFile="", + const std::string& id=""); //! Full constructor for a water phase /*! diff --git a/src/thermo/BinarySolutionTabulatedThermo.cpp b/src/thermo/BinarySolutionTabulatedThermo.cpp index aa7da5af5ce..1312a1dfdde 100644 --- a/src/thermo/BinarySolutionTabulatedThermo.cpp +++ b/src/thermo/BinarySolutionTabulatedThermo.cpp @@ -19,12 +19,6 @@ namespace Cantera { -BinarySolutionTabulatedThermo::BinarySolutionTabulatedThermo() - : m_kk_tab(npos) - , m_xlast(-1) -{ -} - BinarySolutionTabulatedThermo::BinarySolutionTabulatedThermo(const std::string& inputFile, const std::string& id_) : m_kk_tab(npos) diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index 02640678ef6..b3a610ac0e7 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -27,20 +27,6 @@ using namespace std; namespace Cantera { -DebyeHuckel::DebyeHuckel() : - m_formDH(DHFORM_DILUTE_LIMIT), - m_IionicMolality(0.0), - m_maxIionicStrength(30.0), - m_useHelgesonFixedForm(false), - m_IionicMolalityStoich(0.0), - m_form_A_Debye(A_DEBYE_CONST), - m_A_Debye(1.172576), // units = sqrt(kg/gmol) - m_B_Debye(3.28640E9), // units = sqrt(kg/gmol) / m - m_waterSS(0), - m_densWaterSS(1000.) -{ -} - DebyeHuckel::DebyeHuckel(const std::string& inputFile, const std::string& id_) : m_formDH(DHFORM_DILUTE_LIMIT), diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index fb5d992542f..a3bb53b57ef 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -27,40 +27,6 @@ using namespace std; namespace Cantera { -HMWSoln::HMWSoln() : - m_formPitzerTemp(PITZER_TEMP_CONSTANT), - m_IionicMolality(0.0), - m_maxIionicStrength(100.0), - m_TempPitzerRef(298.15), - m_form_A_Debye(A_DEBYE_CONST), - m_A_Debye(1.172576), // units = sqrt(kg/gmol) - m_waterSS(0), - m_molalitiesAreCropped(false), - IMS_X_o_cutoff_(0.2), - IMS_cCut_(0.05), - IMS_slopegCut_(0.0), - IMS_dfCut_(0.0), - IMS_efCut_(0.0), - IMS_afCut_(0.0), - IMS_bfCut_(0.0), - IMS_dgCut_(0.0), - IMS_egCut_(0.0), - IMS_agCut_(0.0), - IMS_bgCut_(0.0), - MC_X_o_cutoff_(0.0), - MC_dpCut_(0.0), - MC_epCut_(0.0), - MC_apCut_(0.0), - MC_bpCut_(0.0), - MC_cpCut_(0.0), - CROP_ln_gamma_o_min(-6.0), - CROP_ln_gamma_o_max(3.0), - CROP_ln_gamma_k_min(-5.0), - CROP_ln_gamma_k_max(15.0), - m_last_is(-1.0) -{ -} - HMWSoln::~HMWSoln() { } diff --git a/src/thermo/IdealGasPhase.cpp b/src/thermo/IdealGasPhase.cpp index 3ea372821e0..bbc18f746e6 100644 --- a/src/thermo/IdealGasPhase.cpp +++ b/src/thermo/IdealGasPhase.cpp @@ -17,11 +17,6 @@ using namespace std; namespace Cantera { -IdealGasPhase::IdealGasPhase() : - m_p0(-1.0) -{ -} - IdealGasPhase::IdealGasPhase(const std::string& inputFile, const std::string& id_) : m_p0(-1.0) { diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index 30217197a57..d6016322894 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -24,26 +24,6 @@ namespace Cantera { -IdealMolalSoln::IdealMolalSoln() : - m_formGC(2), - IMS_typeCutoff_(0), - IMS_X_o_cutoff_(0.20), - IMS_gamma_o_min_(0.00001), - IMS_gamma_k_min_(10.0), - IMS_slopefCut_(0.6), - IMS_slopegCut_(0.0), - IMS_cCut_(.05), - IMS_dfCut_(0.0), - IMS_efCut_(0.0), - IMS_afCut_(0.0), - IMS_bfCut_(0.0), - IMS_dgCut_(0.0), - IMS_egCut_(0.0), - IMS_agCut_(0.0), - IMS_bgCut_(0.0) -{ -} - IdealMolalSoln::IdealMolalSoln(const std::string& inputFile, const std::string& id_) : MolalityVPSSTP(), diff --git a/src/thermo/IdealSolidSolnPhase.cpp b/src/thermo/IdealSolidSolnPhase.cpp index 30f53617c9f..79ccb7fc68b 100644 --- a/src/thermo/IdealSolidSolnPhase.cpp +++ b/src/thermo/IdealSolidSolnPhase.cpp @@ -25,6 +25,9 @@ IdealSolidSolnPhase::IdealSolidSolnPhase(int formGC) : m_Pref(OneAtm), m_Pcurrent(OneAtm) { + // @TODO: After Cantera 2.6, this constructor can be deleted and the default + // construction option can be provided by adding "" as the default argument + // to the constructor from input file name and phase id. if (formGC == -1) { formGC = 0; } else { diff --git a/src/thermo/IdealSolnGasVPSS.cpp b/src/thermo/IdealSolnGasVPSS.cpp index 141da4fde3f..f73f21e5e63 100644 --- a/src/thermo/IdealSolnGasVPSS.cpp +++ b/src/thermo/IdealSolnGasVPSS.cpp @@ -12,34 +12,19 @@ #include "cantera/thermo/IdealSolnGasVPSS.h" #include "cantera/thermo/PDSS.h" -#include "cantera/thermo/ThermoFactory.h" #include "cantera/base/stringUtils.h" #include "cantera/base/utilities.h" +#include "cantera/base/xml.h" using namespace std; namespace Cantera { -IdealSolnGasVPSS::IdealSolnGasVPSS() : - m_formGC(0) -{ -} - IdealSolnGasVPSS::IdealSolnGasVPSS(const std::string& infile, std::string id_) : m_formGC(0) { - XML_Node* root = get_XML_File(infile); - if (id_ == "-") { - id_ = ""; - } - XML_Node* xphase = get_XML_NameID("phase", std::string("#")+id_, root); - if (!xphase) { - throw CanteraError("IdealSolnGasVPSS::IdealSolnGasVPSS", - "Couldn't find phase named '{} in file '{}'", - id_, infile); - } - importPhase(*xphase, this); + initThermoFile(infile, id_); } void IdealSolnGasVPSS::setStandardConcentrationModel(const std::string& model) diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index dbf463d0e3c..93220c2370c 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -27,15 +27,6 @@ using namespace std; namespace Cantera { -IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP() : - ionSolnType_(cIonSolnType_SINGLEANION), - numNeutralMoleculeSpecies_(0), - indexSpecialSpecies_(npos), - neutralMoleculePhase_(0), - geThermo(0) -{ -} - IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const std::string& inputFile, const std::string& id_) : ionSolnType_(cIonSolnType_SINGLEANION), diff --git a/src/thermo/LatticePhase.cpp b/src/thermo/LatticePhase.cpp index 57b4786c28a..ee81249ecad 100644 --- a/src/thermo/LatticePhase.cpp +++ b/src/thermo/LatticePhase.cpp @@ -19,15 +19,10 @@ namespace Cantera { -LatticePhase::LatticePhase() : - m_Pref(OneAtm), - m_Pcurrent(OneAtm), - m_speciesMolarVolume(0), - m_site_density(0.0) -{ -} - LatticePhase::LatticePhase(const std::string& inputFile, const std::string& id_) + : m_Pref(OneAtm) + , m_Pcurrent(OneAtm) + , m_site_density(0.0) { initThermoFile(inputFile, id_); } diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index f1ddfbabb8b..b86ed83d08c 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -18,13 +18,6 @@ using namespace std; namespace Cantera { -MargulesVPSSTP::MargulesVPSSTP() : - numBinaryInteractions_(0), - formMargules_(0), - formTempModel_(0) -{ -} - MargulesVPSSTP::MargulesVPSSTP(const std::string& inputFile, const std::string& id_) : numBinaryInteractions_(0), formMargules_(0), diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 5c1c8fa1a97..de093c7d0a1 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -18,13 +18,6 @@ using namespace std; namespace Cantera { -RedlichKisterVPSSTP::RedlichKisterVPSSTP() : - numBinaryInteractions_(0), - formRedlichKister_(0), - formTempModel_(0) -{ -} - RedlichKisterVPSSTP::RedlichKisterVPSSTP(const std::string& inputFile, const std::string& id_) : numBinaryInteractions_(0), diff --git a/src/thermo/RedlichKwongMFTP.cpp b/src/thermo/RedlichKwongMFTP.cpp index 4404b13f707..50ca1998557 100644 --- a/src/thermo/RedlichKwongMFTP.cpp +++ b/src/thermo/RedlichKwongMFTP.cpp @@ -23,17 +23,6 @@ const doublereal RedlichKwongMFTP::omega_a = 4.27480233540E-01; const doublereal RedlichKwongMFTP::omega_b = 8.66403499650E-02; const doublereal RedlichKwongMFTP::omega_vc = 3.33333333333333E-01; -RedlichKwongMFTP::RedlichKwongMFTP() : - m_formTempParam(0), - m_b_current(0.0), - m_a_current(0.0), - NSolns_(0), - dpdV_(0.0), - dpdT_(0.0) -{ - fill_n(Vroot_, 3, 0.0); -} - RedlichKwongMFTP::RedlichKwongMFTP(const std::string& infile, const std::string& id_) : m_formTempParam(0), m_b_current(0.0), diff --git a/src/thermo/SurfPhase.cpp b/src/thermo/SurfPhase.cpp index ab1e6ab324f..8bbb30ee502 100644 --- a/src/thermo/SurfPhase.cpp +++ b/src/thermo/SurfPhase.cpp @@ -24,6 +24,9 @@ namespace Cantera SurfPhase::SurfPhase(doublereal n0): m_press(OneAtm) { + // @TODO After Cantera 2.6, this constructor can be deleted and a + // default value of "" can be added to for the infile argument of + // the other constructor to make this class default constructible. if (n0 != -1.0) { warn_deprecated("SurfPhase(double)", "The 'n0' argument to the " "SurfPhase constructor is deprecated and will be removed after " diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 9501a2e63a9..614b7ec789f 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -1066,6 +1066,10 @@ const MultiSpeciesThermo& ThermoPhase::speciesThermo(int k) const void ThermoPhase::initThermoFile(const std::string& inputFile, const std::string& id) { + if (inputFile.empty()) { + // No input file specified - nothing to set up + return; + } size_t dot = inputFile.find_last_of("."); string extension; if (dot != npos) { diff --git a/src/thermo/WaterSSTP.cpp b/src/thermo/WaterSSTP.cpp index 85926fcfd38..689a9175a52 100644 --- a/src/thermo/WaterSSTP.cpp +++ b/src/thermo/WaterSSTP.cpp @@ -15,15 +15,6 @@ using namespace std; namespace Cantera { -WaterSSTP::WaterSSTP() : - m_mw(0.0), - EW_Offset(0.0), - SW_Offset(0.0), - m_ready(false), - m_allowGasPhase(false) -{ -} - WaterSSTP::WaterSSTP(const std::string& inputFile, const std::string& id) : m_mw(0.0), EW_Offset(0.0),