From 2a9ab966091837f6c3ffec9e3384da1580afa795 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Tue, 6 May 2014 14:39:13 +0000 Subject: [PATCH] Use NotImplementedError instead of 'err' member functions --- include/cantera/kinetics/Kinetics.h | 68 +++++------ include/cantera/oneD/Inlet1D.h | 13 +-- include/cantera/thermo/DebyeHuckel.h | 7 +- include/cantera/thermo/GibbsExcessVPSSTP.h | 16 +-- include/cantera/thermo/HMWSoln.h | 8 +- include/cantera/thermo/IdealMolalSoln.h | 13 +-- .../cantera/thermo/IonsFromNeutralVPSSTP.h | 11 -- include/cantera/thermo/LatticeSolidPhase.h | 25 ++-- include/cantera/thermo/MargulesVPSSTP.h | 9 -- .../cantera/thermo/MixedSolventElectrolyte.h | 8 -- include/cantera/thermo/MixtureFugacityTP.h | 9 +- include/cantera/thermo/MolalityVPSSTP.h | 10 -- include/cantera/thermo/MolarityIonicVPSSTP.h | 9 -- include/cantera/thermo/PDSS.h | 8 -- .../cantera/thermo/PhaseCombo_Interaction.h | 9 -- include/cantera/thermo/PseudoBinaryVPSSTP.h | 8 -- include/cantera/thermo/RedlichKisterVPSSTP.h | 9 -- include/cantera/thermo/SingleSpeciesTP.h | 17 +-- include/cantera/thermo/ThermoPhase.h | 110 ++++++++---------- include/cantera/thermo/VPSSMgr.h | 6 - include/cantera/thermo/VPStandardStateTP.h | 10 +- include/cantera/transport/LiquidTransport.h | 8 -- include/cantera/transport/SimpleTransport.h | 11 -- include/cantera/transport/TransportBase.h | 78 +++++-------- src/kinetics/Kinetics.cpp | 8 -- src/thermo/DebyeHuckel.cpp | 10 +- src/thermo/GibbsExcessVPSSTP.cpp | 7 -- src/thermo/HMWSoln.cpp | 7 -- src/thermo/IdealMolalSoln.cpp | 13 +-- src/thermo/IonsFromNeutralVPSSTP.cpp | 7 -- src/thermo/LatticeSolidPhase.cpp | 6 - src/thermo/MargulesVPSSTP.cpp | 7 -- src/thermo/MixedSolventElectrolyte.cpp | 7 -- src/thermo/MixtureFugacityTP.cpp | 14 +-- src/thermo/MolalityVPSSTP.cpp | 20 +--- src/thermo/MolarityIonicVPSSTP.cpp | 11 -- src/thermo/PDSS.cpp | 63 ++++------ src/thermo/PhaseCombo_Interaction.cpp | 7 -- src/thermo/PseudoBinaryVPSSTP.cpp | 10 +- src/thermo/RedlichKisterVPSSTP.cpp | 7 -- src/thermo/SingleSpeciesTP.cpp | 11 +- src/thermo/ThermoPhase.cpp | 7 -- src/thermo/VPSSMgr.cpp | 43 +++---- src/thermo/VPStandardStateTP.cpp | 10 +- src/transport/LiquidTransport.cpp | 9 -- src/transport/SimpleTransport.cpp | 10 -- src/transport/TortuosityBase.cpp | 11 +- src/transport/TransportBase.cpp | 15 +-- 48 files changed, 181 insertions(+), 619 deletions(-) diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 57a561f86..67d7c27f3 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -403,7 +403,7 @@ public: * of progress of the reactions. Length: m_ii. */ virtual void getFwdRatesOfProgress(doublereal* fwdROP) { - err("getFwdRatesOfProgress"); + throw NotImplementedError("Kinetics::getFwdRatesOfProgress"); } //! Return the Reverse rates of progress of the reactions @@ -415,7 +415,7 @@ public: * of progress of the reactions. Length: m_ii. */ virtual void getRevRatesOfProgress(doublereal* revROP) { - err("getRevRatesOfProgress"); + throw NotImplementedError("Kinetics::getRevRatesOfProgress"); } /** @@ -426,7 +426,7 @@ public: * @param netROP Output vector of the net ROP. Length: m_ii. */ virtual void getNetRatesOfProgress(doublereal* netROP) { - err("getNetRatesOfProgress"); + throw NotImplementedError("Kinetics::getNetRatesOfProgress"); } //! Return a vector of Equilibrium constants. @@ -439,7 +439,7 @@ public: * Length: m_ii. */ virtual void getEquilibriumConstants(doublereal* kc) { - err("getEquilibriumConstants"); + throw NotImplementedError("Kinetics::getEquilibriumConstants"); } /** @@ -460,7 +460,7 @@ public: */ virtual void getReactionDelta(const doublereal* property, doublereal* deltaProperty) { - err("getReactionDelta"); + throw NotImplementedError("Kinetics::getReactionDelta"); } //! Return the vector of values for the reaction gibbs free energy change. @@ -472,7 +472,7 @@ public: * @param deltaG Output vector of deltaG's for reactions Length: m_ii. */ virtual void getDeltaGibbs(doublereal* deltaG) { - err("getDeltaGibbs"); + throw NotImplementedError("Kinetics::getDeltaGibbs"); } //! Return the vector of values for the reaction electrochemical free @@ -486,7 +486,7 @@ public: * @param deltaM Output vector of deltaM's for reactions Length: m_ii. */ virtual void getDeltaElectrochemPotentials(doublereal* deltaM) { - err("getDeltaElectrochemPotentials"); + throw NotImplementedError("Kinetics::getDeltaElectrochemPotentials"); } /** @@ -498,7 +498,7 @@ public: * @param deltaH Output vector of deltaH's for reactions Length: m_ii. */ virtual void getDeltaEnthalpy(doublereal* deltaH) { - err("getDeltaEnthalpy"); + throw NotImplementedError("Kinetics::getDeltaEnthalpy"); } /** @@ -510,7 +510,7 @@ public: * @param deltaS Output vector of deltaS's for reactions Length: m_ii. */ virtual void getDeltaEntropy(doublereal* deltaS) { - err("getDeltaEntropy"); + throw NotImplementedError("Kinetics::getDeltaEntropy"); } /** @@ -523,7 +523,7 @@ public: * @param deltaG Output vector of ss deltaG's for reactions Length: m_ii. */ virtual void getDeltaSSGibbs(doublereal* deltaG) { - err("getDeltaSSGibbs"); + throw NotImplementedError("Kinetics::getDeltaSSGibbs"); } /** @@ -536,7 +536,7 @@ public: * @param deltaH Output vector of ss deltaH's for reactions Length: m_ii. */ virtual void getDeltaSSEnthalpy(doublereal* deltaH) { - err("getDeltaSSEnthalpy"); + throw NotImplementedError("Kinetics::getDeltaSSEnthalpy"); } /** @@ -549,7 +549,7 @@ public: * @param deltaS Output vector of ss deltaS's for reactions Length: m_ii. */ virtual void getDeltaSSEntropy(doublereal* deltaS) { - err("getDeltaSSEntropy"); + throw NotImplementedError("Kinetics::getDeltaSSEntropy"); } //! @} @@ -564,7 +564,7 @@ public: * @param cdot Output vector of creation rates. Length: m_kk. */ virtual void getCreationRates(doublereal* cdot) { - err("getCreationRates"); + throw NotImplementedError("Kinetics::getCreationRates"); } /** @@ -575,7 +575,7 @@ public: * @param ddot Output vector of destruction rates. Length: m_kk. */ virtual void getDestructionRates(doublereal* ddot) { - err("getDestructionRates"); + throw NotImplementedError("Kinetics::getDestructionRates"); } /** @@ -587,7 +587,7 @@ public: * @param wdot Output vector of net production rates. Length: m_kk. */ virtual void getNetProductionRates(doublereal* wdot) { - err("getNetProductionRates"); + throw NotImplementedError("Kinetics::getNetProductionRates"); } //! @} @@ -601,8 +601,7 @@ public: * @param i reaction index */ virtual doublereal reactantStoichCoeff(size_t k, size_t i) const { - err("reactantStoichCoeff"); - return -1.0; + throw NotImplementedError("Kinetics::reactantStoichCoeff"); } /** @@ -612,8 +611,7 @@ public: * @param i reaction index */ virtual doublereal productStoichCoeff(size_t k, size_t i) const { - err("productStoichCoeff"); - return -1.0; + throw NotImplementedError("Kinetics::productStoichCoeff"); } //! Reactant order of species k in reaction i. @@ -625,8 +623,7 @@ public: * @param i reaction index */ virtual doublereal reactantOrder(size_t k, size_t i) const { - err("reactantOrder"); - return -1.0; + throw NotImplementedError("Kinetics::reactantOrder"); } //! product Order of species k in reaction i. @@ -640,8 +637,7 @@ public: * @param i reaction index */ virtual doublereal productOrder(int k, int i) const { - err("productOrder"); - return -1.0; + throw NotImplementedError("Kinetics::productOrder"); } //! Get the vector of activity concentrations used in the kinetics object @@ -650,7 +646,7 @@ public: * to the number of species in the kinetics object */ virtual void getActivityConcentrations(doublereal* const conc) { - err("getActivityConcentrations"); + throw NotImplementedError("Kinetics::getActivityConcentrations"); } /** @@ -681,8 +677,7 @@ public: * @param i reaction index */ virtual int reactionType(size_t i) const { - err("reactionType"); - return -1; + throw NotImplementedError("Kinetics::reactionType"); } /** @@ -693,8 +688,7 @@ public: * @param i reaction index */ virtual bool isReversible(size_t i) { - err("isReversible"); - return false; + throw NotImplementedError("Kinetics::isReversible"); } /** @@ -703,8 +697,7 @@ public: * @param i reaction index */ virtual std::string reactionString(size_t i) const { - err("reactionStd::String"); - return ""; + throw NotImplementedError("Kinetics::reactionStd::String"); } /** @@ -716,7 +709,7 @@ public: * constants. Length: m_ii. */ virtual void getFwdRateConstants(doublereal* kfwd) { - err("getFwdRateConstants"); + throw NotImplementedError("Kinetics::getFwdRateConstants"); } /** @@ -732,7 +725,7 @@ public: */ virtual void getRevRateConstants(doublereal* krev, bool doIrreversible = false) { - err("getFwdRateConstants"); + throw NotImplementedError("Kinetics::getFwdRateConstants"); } //! @} @@ -785,16 +778,14 @@ public: * to be added. */ virtual void addReaction(ReactionData& r) { - err("addReaction"); + throw NotImplementedError("Kinetics::addReaction"); } virtual const std::vector& reactantGroups(size_t i) { - //err("reactantGroups"); return m_dummygroups; } virtual const std::vector& productGroups(size_t i) { - //err("productGroups"); return m_dummygroups; } @@ -947,13 +938,6 @@ protected: private: //! Vector of group lists std::vector m_dummygroups; - - //! Function indicating that a function inherited from the base class - //! hasn't had a definition assigned to it - /*! - * @param m String message - */ - void err(const std::string& m) const; }; } diff --git a/include/cantera/oneD/Inlet1D.h b/include/cantera/oneD/Inlet1D.h index e776ad276..f443018b8 100644 --- a/include/cantera/oneD/Inlet1D.h +++ b/include/cantera/oneD/Inlet1D.h @@ -63,18 +63,17 @@ public: /// Set the mole fractions by specifying a std::string. virtual void setMoleFractions(const std::string& xin) { - err("setMoleFractions"); + throw NotImplementedError("Bdry1D::setMoleFractions"); } /// Set the mole fractions by specifying an array. virtual void setMoleFractions(doublereal* xin) { - err("setMoleFractions"); + throw NotImplementedError("Bdry1D::setMoleFractions"); } /// Mass fraction of species k. virtual doublereal massFraction(size_t k) { - err("massFraction"); - return 0.0; + throw NotImplementedError("Bdry1D::massFraction"); } /// Set the total mass flow rate. @@ -105,12 +104,6 @@ protected: size_t m_start_left, m_start_right; ThermoPhase* m_phase_left, *m_phase_right; doublereal m_temp, m_mdot; - -private: - void err(const std::string& method) { - throw CanteraError("Bdry1D::"+method, - "attempt to call base class method "+method); - } }; diff --git a/include/cantera/thermo/DebyeHuckel.h b/include/cantera/thermo/DebyeHuckel.h index 58b455e6c..cb18aded7 100644 --- a/include/cantera/thermo/DebyeHuckel.h +++ b/include/cantera/thermo/DebyeHuckel.h @@ -1027,7 +1027,7 @@ protected: */ public: virtual void setToEquilState(const doublereal* lambda_RT) { - err("setToEquilState"); + throw NotImplementedError("DebyeHuckel::setToEquilState"); } //@} @@ -1484,10 +1484,6 @@ protected: mutable vector_fp m_dlnActCoeffMolaldP; private: - - //! Bail out of functions with an error exit if they are not implemented. - doublereal err(const std::string& msg) const; - //! Initialize the internal lengths. /*! * This internal function adjusts the lengths of arrays based on @@ -1495,7 +1491,6 @@ private: */ void initLengths(); -private: //! Calculate the log activity coefficients /*! * This function updates the internally stored natural logarithm of the diff --git a/include/cantera/thermo/GibbsExcessVPSSTP.h b/include/cantera/thermo/GibbsExcessVPSSTP.h index bf68ab01f..c88ee7820 100644 --- a/include/cantera/thermo/GibbsExcessVPSSTP.h +++ b/include/cantera/thermo/GibbsExcessVPSSTP.h @@ -288,7 +288,7 @@ public: * log Activity Coefficients. length = m_kk */ virtual void getdlnActCoeffdT(doublereal* dlnActCoeffdT) const { - err("getdlnActCoeffdT"); + throw NotImplementedError("GibbsExcessVPSSTP::getdlnActCoeffdT"); } //! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers @@ -311,7 +311,8 @@ public: * log Activity Coefficients. length = m_kk * m_kk */ virtual void getdlnActCoeffdlnN(const size_t ld, doublereal* const dlnActCoeffdlnN) { - err(" getdlnActCoeffdlnN: nonzero and nonimplemented"); + throw NotImplementedError("GibbsExcessVPSSTP::getdlnActCoeffdlnN: " + "nonzero and nonimplemented"); } //! Get the array of log concentration-like derivatives of the @@ -333,7 +334,7 @@ public: * log Activity Coefficients. length = m_kk */ virtual void getdlnActCoeffdlnX(doublereal* dlnActCoeffdlnX) const { - err("getdlnActCoeffdlnX"); + throw NotImplementedError("GibbsExcessVPSSTP::getdlnActCoeffdlnX"); } //@} @@ -464,14 +465,6 @@ private: //! been identified. void initLengths(); - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: //! utility routine to check mole fraction sum /*! @@ -479,7 +472,6 @@ protected: */ double checkMFSum(const doublereal* const x) const; -protected: //! Storage for the current values of the mole fractions of the species /*! * This vector is kept up-to-date when the setState functions are called. diff --git a/include/cantera/thermo/HMWSoln.h b/include/cantera/thermo/HMWSoln.h index ca2162722..3234a9d1a 100644 --- a/include/cantera/thermo/HMWSoln.h +++ b/include/cantera/thermo/HMWSoln.h @@ -1853,7 +1853,7 @@ public: */ virtual void setToEquilState(const doublereal* lambda_RT) { updateStandardStateThermo(); - err("setToEquilState"); + throw NotImplementedError("HMWSoln::setToEquilState"); } //@} @@ -3062,12 +3062,6 @@ private: mutable std::vector CROP_speciesCropped_; //! @} - //! Local error routine - /*! - * @param msg print out a message and error exit - */ - doublereal err(const std::string& msg) const; - //! Initialize all of the species-dependent lengths in the object void initLengths(); diff --git a/include/cantera/thermo/IdealMolalSoln.h b/include/cantera/thermo/IdealMolalSoln.h index f684ba7e7..482715fae 100644 --- a/include/cantera/thermo/IdealMolalSoln.h +++ b/include/cantera/thermo/IdealMolalSoln.h @@ -339,7 +339,7 @@ public: * @param pe Input potential energy. */ virtual void setPotentialEnergy(int k, doublereal pe) { - err("setPotentialEnergy"); + throw NotImplementedError("IdealMolalSoln::setPotentialEnergy"); } /** @@ -349,7 +349,7 @@ public: * @param k Species index */ virtual doublereal potentialEnergy(int k) const { - return err("potentialEnergy"); + throw NotImplementedError("IdealMolalSoln::potentialEnergy"); } /** @@ -576,7 +576,7 @@ public: * @param lambda_RT vector of Nondimensional element potentials. */ virtual void setToEquilState(const doublereal* lambda_RT) { - err("setToEquilState"); + throw NotImplementedError("IdealMolalSoln::setToEquilState"); } //@} @@ -744,13 +744,6 @@ public: //! @} private: - - //! Internal error message - /*! - * @param msg message to be printed - */ - doublereal err(const std::string& msg) const; - //! This function will be called to update the internally stored //! natural logarithm of the molality activity coefficients /*! diff --git a/include/cantera/thermo/IonsFromNeutralVPSSTP.h b/include/cantera/thermo/IonsFromNeutralVPSSTP.h index 3238d3d97..b28beefd2 100644 --- a/include/cantera/thermo/IonsFromNeutralVPSSTP.h +++ b/include/cantera/thermo/IonsFromNeutralVPSSTP.h @@ -615,18 +615,7 @@ private: */ void s_update_dlnActCoeff_dlnN() const; - -private: - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: - //! Ion solution type /*! * There is either mixing on the anion, cation, or both lattices. diff --git a/include/cantera/thermo/LatticeSolidPhase.h b/include/cantera/thermo/LatticeSolidPhase.h index de79d6a4d..79c8adafd 100644 --- a/include/cantera/thermo/LatticeSolidPhase.h +++ b/include/cantera/thermo/LatticeSolidPhase.h @@ -338,7 +338,7 @@ public: * @param k species index */ doublereal moleFraction(const int k) const { - return err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::moleFraction"); } //! Get the species mass fractions. @@ -347,7 +347,7 @@ public: * greater than or equal to the number of species. */ void getMassFractions(doublereal* const y) const { - err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::getMassFractions"); } //! Mass fraction of species k. @@ -358,7 +358,7 @@ public: * @param k species index */ doublereal massFraction(const int k) const { - return err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::massFraction"); } //! Set the mass fractions to the specified values, and then @@ -373,7 +373,7 @@ public: * Length is m_kk. */ virtual void setMassFractions(const doublereal* const y) { - err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::setMassFractions"); } //! Set the mass fractions to the specified values without normalizing. @@ -386,19 +386,19 @@ public: * Length is m_kk. */ virtual void setMassFractions_NoNorm(const doublereal* const y) { - err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::setMassFractions_NoNorm"); } void getConcentrations(doublereal* const c) const { - err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::getConcentrations"); } doublereal concentration(int k) const { - return err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::concentration"); } virtual void setConcentrations(const doublereal* const conc) { - err("not implemented"); + throw NotImplementedError("LatticeSolidPhase::setConcentrations"); } //! This method returns an array of generalized activity concentrations @@ -634,15 +634,6 @@ public: */ virtual void modifyOneHf298SS(const size_t k, const doublereal Hf298New); -private: - //! error routine - /*! - * @param msg Message - * - * @return nothing - */ - doublereal err(const std::string& msg) const; - protected: //! Current value of the pressure doublereal m_press; diff --git a/include/cantera/thermo/MargulesVPSSTP.h b/include/cantera/thermo/MargulesVPSSTP.h index 22d98d4e7..c1cd8a251 100644 --- a/include/cantera/thermo/MargulesVPSSTP.h +++ b/include/cantera/thermo/MargulesVPSSTP.h @@ -665,15 +665,6 @@ private: */ void s_update_dlnActCoeff_dlnN() const; -private: - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: //! number of binary interaction expressions size_t numBinaryInteractions_; diff --git a/include/cantera/thermo/MixedSolventElectrolyte.h b/include/cantera/thermo/MixedSolventElectrolyte.h index 04d50e6fa..17acc5af6 100644 --- a/include/cantera/thermo/MixedSolventElectrolyte.h +++ b/include/cantera/thermo/MixedSolventElectrolyte.h @@ -656,14 +656,6 @@ private: */ void s_update_dlnActCoeff_dlnN() const; - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: //! number of binary interaction expressions size_t numBinaryInteractions_; diff --git a/include/cantera/thermo/MixtureFugacityTP.h b/include/cantera/thermo/MixtureFugacityTP.h index 32b9e9e75..ba4783cdb 100644 --- a/include/cantera/thermo/MixtureFugacityTP.h +++ b/include/cantera/thermo/MixtureFugacityTP.h @@ -159,7 +159,7 @@ public: * log Activity Coefficients. length = m_kk */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { - err("getdlnActCoeffdlnN_diag"); + throw NotImplementedError("MixtureFugacityTP::getdlnActCoeffdlnN_diag"); } //@} @@ -850,13 +850,6 @@ protected: mutable vector_fp m_s0_R; spinodalFunc* fdpdv_; - -private: - //! MixtureFugacityTP has its own err routine - /*! - * @param msg Error message string - */ - doublereal err(const std::string& msg) const; }; } diff --git a/include/cantera/thermo/MolalityVPSSTP.h b/include/cantera/thermo/MolalityVPSSTP.h index 174d9db72..cd6da08c9 100644 --- a/include/cantera/thermo/MolalityVPSSTP.h +++ b/include/cantera/thermo/MolalityVPSSTP.h @@ -802,16 +802,6 @@ protected: * units are (kg/kmol) */ mutable vector_fp m_molalities; - -private: - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - }; diff --git a/include/cantera/thermo/MolarityIonicVPSSTP.h b/include/cantera/thermo/MolarityIonicVPSSTP.h index 18d4382f6..fc35b9d6b 100644 --- a/include/cantera/thermo/MolarityIonicVPSSTP.h +++ b/include/cantera/thermo/MolarityIonicVPSSTP.h @@ -321,15 +321,6 @@ private: */ void s_update_dlnActCoeff_dX_() const; -private: - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: // Pseudobinary type /*! diff --git a/include/cantera/thermo/PDSS.h b/include/cantera/thermo/PDSS.h index 51ce6ebb7..4294fec76 100644 --- a/include/cantera/thermo/PDSS.h +++ b/include/cantera/thermo/PDSS.h @@ -245,14 +245,6 @@ public: */ PDSS_enumType reportPDSSType() const; -private: - //! Set an error within this object for an unhandled capability - /*! - * @param msg Message string for this error - */ - void err(const std::string& msg) const; - -public: //! @} //! @name Molar Thermodynamic Properties of the Species Standard State in the Solution //! @{ diff --git a/include/cantera/thermo/PhaseCombo_Interaction.h b/include/cantera/thermo/PhaseCombo_Interaction.h index 15afa2044..19fa1860f 100644 --- a/include/cantera/thermo/PhaseCombo_Interaction.h +++ b/include/cantera/thermo/PhaseCombo_Interaction.h @@ -741,15 +741,6 @@ private: */ void s_update_dlnActCoeff_dlnN() const; -private: - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: //! number of binary interaction expressions size_t numBinaryInteractions_; diff --git a/include/cantera/thermo/PseudoBinaryVPSSTP.h b/include/cantera/thermo/PseudoBinaryVPSSTP.h index 55075575b..b7e4108b5 100644 --- a/include/cantera/thermo/PseudoBinaryVPSSTP.h +++ b/include/cantera/thermo/PseudoBinaryVPSSTP.h @@ -194,14 +194,6 @@ private: //! been identified. void initLengths(); - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: int PBType_; diff --git a/include/cantera/thermo/RedlichKisterVPSSTP.h b/include/cantera/thermo/RedlichKisterVPSSTP.h index 12a64346e..fd8a673d8 100644 --- a/include/cantera/thermo/RedlichKisterVPSSTP.h +++ b/include/cantera/thermo/RedlichKisterVPSSTP.h @@ -645,15 +645,6 @@ public: void Vint(double& VintOut, double& voltsOut) ; #endif -private: - //! Error function - /*! - * Print an error string and exit - * - * @param msg Message to be printed - */ - doublereal err(const std::string& msg) const; - protected: //! number of binary interaction expressions size_t numBinaryInteractions_; diff --git a/include/cantera/thermo/SingleSpeciesTP.h b/include/cantera/thermo/SingleSpeciesTP.h index 9bd49d912..4728507b0 100644 --- a/include/cantera/thermo/SingleSpeciesTP.h +++ b/include/cantera/thermo/SingleSpeciesTP.h @@ -187,11 +187,7 @@ public: * @param ac Output vector of activity coefficients. Length: 1. */ virtual void getActivityCoefficients(doublereal* ac) const { - if (m_kk == 1) { - ac[0] = 1.0; - } else { - err("getActivityCoefficients"); - } + ac[0] = 1.0; } //@} @@ -532,17 +528,6 @@ protected: * S0 whenever the temperature has changed. */ void _updateThermo() const; - -private: - - //! Error return for unhandled cases. - /*! - * It's used when this class doesn't have an answer for the question given - * to it, because the derived class isn't overriding a function. - * - * @param msg String message - */ - doublereal err(const std::string& msg) const; }; } diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index a38b59327..3f4636b0f 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -227,7 +227,7 @@ public: /// Molar enthalpy. Units: J/kmol. virtual doublereal enthalpy_mole() const { - return err("enthalpy_mole"); + throw NotImplementedError("ThermoPhase::enthalpy_mole"); } /// Molar internal energy. Units: J/kmol. @@ -237,7 +237,7 @@ public: /// Molar entropy. Units: J/kmol/K. virtual doublereal entropy_mole() const { - return err("entropy_mole"); + throw NotImplementedError("ThermoPhase::entropy_mole"); } /// Molar Gibbs function. Units: J/kmol. @@ -247,12 +247,12 @@ public: /// Molar heat capacity at constant pressure. Units: J/kmol/K. virtual doublereal cp_mole() const { - return err("cp_mole"); + throw NotImplementedError("ThermoPhase::cp_mole"); } /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_mole() const { - return err("cv_mole"); + throw NotImplementedError("ThermoPhase::cv_mole"); } /** @@ -261,7 +261,7 @@ public: */ /// Molar heat capacity at constant volume. Units: J/kmol/K. virtual doublereal cv_vib(int, double) const { - return err("cv_vib"); + throw NotImplementedError("ThermoPhase::cv_vib"); } //! @} @@ -277,7 +277,7 @@ public: * Y_K) \f$. */ virtual doublereal pressure() const { - return err("pressure"); + throw NotImplementedError("ThermoPhase::pressure"); } //! Set the internally stored pressure (Pa) at constant @@ -294,7 +294,7 @@ public: * @param p input Pressure (Pa) */ virtual void setPressure(doublereal p) { - err("setPressure"); + throw NotImplementedError("ThermoPhase::setPressure"); } //! Returns the isothermal compressibility. Units: 1/Pa. @@ -309,8 +309,7 @@ public: * \f] */ virtual doublereal isothermalCompressibility() const { - err("isothermalCompressibility"); - return -1.0; + throw NotImplementedError("ThermoPhase::isothermalCompressibility"); } //! Return the volumetric thermal expansion coefficient. Units: 1/K. @@ -321,8 +320,7 @@ public: * \f] */ virtual doublereal thermalExpansionCoeff() const { - err("thermalExpansionCoeff()"); - return -1.0; + throw NotImplementedError("ThermoPhase::thermalExpansionCoeff()"); } /** @@ -426,7 +424,7 @@ public: * reaction rate expressions within the phase. */ virtual void getActivityConcentrations(doublereal* c) const { - err("getActivityConcentrations"); + throw NotImplementedError("ThermoPhase::getActivityConcentrations"); } //! Return the standard concentration for the kth species @@ -448,8 +446,7 @@ public: * dependent on the ThermoPhase and kinetics manager representation. */ virtual doublereal standardConcentration(size_t k=0) const { - err("standardConcentration"); - return -1.0; + throw NotImplementedError("ThermoPhase::standardConcentration"); } //! Natural logarithm of the standard concentration of the kth species. @@ -516,7 +513,7 @@ public: if (m_kk == 1) { ac[0] = 1.0; } else { - err("getActivityCoefficients"); + throw NotImplementedError("ThermoPhase::getActivityCoefficients"); } } @@ -541,7 +538,7 @@ public: * Length: m_kk. */ virtual void getChemPotentials_RT(doublereal* mu) const { - err("getChemPotentials_RT"); + throw NotImplementedError("ThermoPhase::getChemPotentials_RT"); } @@ -555,7 +552,7 @@ public: * potentials. Length: m_kk. Units: J/kmol */ virtual void getChemPotentials(doublereal* mu) const { - err("getChemPotentials"); + throw NotImplementedError("ThermoPhase::getChemPotentials"); } //! Get the species electrochemical potentials. @@ -588,7 +585,7 @@ public: * Length: m_kk. units are J/kmol. */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const { - err("getPartialMolarEnthalpies"); + throw NotImplementedError("ThermoPhase::getPartialMolarEnthalpies"); } //! Returns an array of partial molar entropies of the species in the @@ -598,7 +595,7 @@ public: * Length = m_kk. units are J/kmol/K. */ virtual void getPartialMolarEntropies(doublereal* sbar) const { - err("getPartialMolarEntropies"); + throw NotImplementedError("ThermoPhase::getPartialMolarEntropies"); } //! Return an array of partial molar internal energies for the @@ -608,7 +605,7 @@ public: * Length = m_kk. units are J/kmol. */ virtual void getPartialMolarIntEnergies(doublereal* ubar) const { - err("getPartialMolarIntEnergies"); + throw NotImplementedError("ThermoPhase::getPartialMolarIntEnergies"); } //! Return an array of partial molar heat capacities for the @@ -619,7 +616,7 @@ public: * Length = m_kk. units are J/kmol/K. */ virtual void getPartialMolarCp(doublereal* cpbar) const { - err("getPartialMolarCp"); + throw NotImplementedError("ThermoPhase::getPartialMolarCp"); } //! Return an array of partial molar volumes for the @@ -629,7 +626,7 @@ public: * Length = m_kk. units are m^3/kmol. */ virtual void getPartialMolarVolumes(doublereal* vbar) const { - err("getPartialMolarVolumes"); + throw NotImplementedError("ThermoPhase::getPartialMolarVolumes"); } //! Return an array of derivatives of partial molar volumes wrt temperature for the @@ -641,7 +638,7 @@ public: * Length = m_kk. units are m^3/kmol/K. */ virtual void getdPartialMolarVolumes_dT(doublereal* d_vbar_dT) const { - err("getdPartialMolarVolumes_dT"); + throw NotImplementedError("ThermoPhase::getdPartialMolarVolumes_dT"); } //! Return an array of derivatives of partial molar volumes wrt pressure for the @@ -653,7 +650,7 @@ public: * Length = m_kk. units are m^3/kmol/Pa. */ virtual void getdPartialMolarVolumes_dP(doublereal* d_vbar_dP) const { - err("getdPartialMolarVolumes_dP"); + throw NotImplementedError("ThermoPhase::getdPartialMolarVolumes_dP"); } //@} @@ -671,7 +668,7 @@ public: * Length: m_kk. */ virtual void getStandardChemPotentials(doublereal* mu) const { - err("getStandardChemPotentials"); + throw NotImplementedError("ThermoPhase::getStandardChemPotentials"); } //! Get the nondimensional Enthalpy functions for the species @@ -681,7 +678,7 @@ public: * Length: m_kk. */ virtual void getEnthalpy_RT(doublereal* hrt) const { - err("getEnthalpy_RT"); + throw NotImplementedError("ThermoPhase::getEnthalpy_RT"); } //! Get the array of nondimensional Entropy functions for the @@ -691,7 +688,7 @@ public: * Length: m_kk. */ virtual void getEntropy_R(doublereal* sr) const { - err("getEntropy_R"); + throw NotImplementedError("ThermoPhase::getEntropy_R"); } //! Get the nondimensional Gibbs functions for the species @@ -701,7 +698,7 @@ public: * Length: m_kk. */ virtual void getGibbs_RT(doublereal* grt) const { - err("getGibbs_RT"); + throw NotImplementedError("ThermoPhase::getGibbs_RT"); } //! Get the Gibbs functions for the standard @@ -712,7 +709,7 @@ public: * Length: m_kk. */ virtual void getPureGibbs(doublereal* gpure) const { - err("getPureGibbs"); + throw NotImplementedError("ThermoPhase::getPureGibbs"); } //! Returns the vector of nondimensional Internal Energies of the standard @@ -722,7 +719,7 @@ public: * of the species. Length: m_kk. */ virtual void getIntEnergy_RT(doublereal* urt) const { - err("getIntEnergy_RT"); + throw NotImplementedError("ThermoPhase::getIntEnergy_RT"); } //! Get the nondimensional Heat Capacities at constant @@ -733,7 +730,7 @@ public: * Length: m_kk. */ virtual void getCp_R(doublereal* cpr) const { - err("getCp_R"); + throw NotImplementedError("ThermoPhase::getCp_R"); } //! Get the molar volumes of the species standard states at the current @@ -745,7 +742,7 @@ public: * Length: m_kk. */ virtual void getStandardVolumes(doublereal* vol) const { - err("getStandardVolumes"); + throw NotImplementedError("ThermoPhase::getStandardVolumes"); } //! Get the derivative of the molar volumes of the species standard states wrt temperature at the current @@ -758,7 +755,7 @@ public: * Length: m_kk. */ virtual void getdStandardVolumes_dT(doublereal* d_vol_dT) const { - err("getdStandardVolumes_dT"); + throw NotImplementedError("ThermoPhase::getdStandardVolumes_dT"); } //! Get the derivative molar volumes of the species standard states wrt pressure at the current @@ -771,7 +768,7 @@ public: * Length: m_kk. */ virtual void getdStandardVolumes_dP(doublereal* d_vol_dP) const { - err("getdStandardVolumes_dP"); + throw NotImplementedError("ThermoPhase::getdStandardVolumes_dP"); } //@} @@ -790,7 +787,7 @@ public: * Length: m_kk. */ virtual void getEnthalpy_RT_ref(doublereal* hrt) const { - err("getEnthalpy_RT_ref"); + throw NotImplementedError("ThermoPhase::getEnthalpy_RT_ref"); } //! Returns the vector of nondimensional @@ -801,7 +798,7 @@ public: * Gibbs Free energies. Length: m_kk. */ virtual void getGibbs_RT_ref(doublereal* grt) const { - err("getGibbs_RT_ref"); + throw NotImplementedError("ThermoPhase::getGibbs_RT_ref"); } //! Returns the vector of the @@ -814,7 +811,7 @@ public: * Gibbs Free energies. Length: m_kk. Units: J/kmol. */ virtual void getGibbs_ref(doublereal* g) const { - err("getGibbs_ref"); + throw NotImplementedError("ThermoPhase::getGibbs_ref"); } //! Returns the vector of nondimensional @@ -825,7 +822,7 @@ public: * entropies. Length: m_kk. */ virtual void getEntropy_R_ref(doublereal* er) const { - err("getEntropy_R_ref"); + throw NotImplementedError("ThermoPhase::getEntropy_R_ref"); } //! Returns the vector of nondimensional @@ -837,7 +834,7 @@ public: * Length: m_kk */ virtual void getIntEnergy_RT_ref(doublereal* urt) const { - err("getIntEnergy_RT_ref"); + throw NotImplementedError("ThermoPhase::getIntEnergy_RT_ref"); } //! Returns the vector of nondimensional @@ -850,7 +847,7 @@ public: * Length: m_kk */ virtual void getCp_R_ref(doublereal* cprt) const { - err("getCp_R_ref()"); + throw NotImplementedError("ThermoPhase::getCp_R_ref()"); } //! Get the molar volumes of the species reference states at the current @@ -862,7 +859,7 @@ public: * Length: m_kk. */ virtual void getStandardVolumes_ref(doublereal* vol) const { - err("getStandardVolumes_ref"); + throw NotImplementedError("ThermoPhase::getStandardVolumes_ref"); } //! Sets the reference composition @@ -1155,7 +1152,7 @@ public: * The length is equal to nElements(). */ virtual void setToEquilState(const doublereal* lambda_RT) { - err("setToEquilState"); + throw NotImplementedError("ThermoPhase::setToEquilState"); } //! Stores the element potentials in the ThermoPhase object @@ -1197,17 +1194,17 @@ public: /// Critical temperature (K). virtual doublereal critTemperature() const { - return err("critTemperature"); + throw NotImplementedError("ThermoPhase::critTemperature"); } /// Critical pressure (Pa). virtual doublereal critPressure() const { - return err("critPressure"); + throw NotImplementedError("ThermoPhase::critPressure"); } /// Critical density (kg/m3). virtual doublereal critDensity() const { - return err("critDensity"); + throw NotImplementedError("ThermoPhase::critDensity"); } //@} @@ -1225,7 +1222,7 @@ public: * @param p Pressure (Pa) */ virtual doublereal satTemperature(doublereal p) const { - return err("satTemperature"); + throw NotImplementedError("ThermoPhase::satTemperature"); } //! Return the saturation pressure given the temperature @@ -1233,12 +1230,12 @@ public: * @param t Temperature (Kelvin) */ virtual doublereal satPressure(doublereal t) { - return err("satPressure"); + throw NotImplementedError("ThermoPhase::satPressure"); } //! Return the fraction of vapor at the current conditions virtual doublereal vaporFraction() const { - return err("vaprFraction"); + throw NotImplementedError("ThermoPhase::vaprFraction"); } //! Set the state to a saturated system at a particular temperature @@ -1247,7 +1244,7 @@ public: * @param x Fraction of vapor */ virtual void setState_Tsat(doublereal t, doublereal x) { - err("setState_sat"); + throw NotImplementedError("ThermoPhase::setState_sat"); } //! Set the state to a saturated system at a particular pressure @@ -1256,7 +1253,7 @@ public: * @param x Fraction of vapor */ virtual void setState_Psat(doublereal p, doublereal x) { - err("setState_sat"); + throw NotImplementedError("ThermoPhase::setState_sat"); } //@} @@ -1462,7 +1459,7 @@ public: */ virtual void getdlnActCoeffds(const doublereal dTds, const doublereal* const dXds, doublereal* dlnActCoeffds) const { - err("getdlnActCoeffds"); + throw NotImplementedError("ThermoPhase::getdlnActCoeffds"); } //! Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component only @@ -1483,7 +1480,7 @@ public: * log Activity Coefficients wrt the mole fractions. length = m_kk */ virtual void getdlnActCoeffdlnX_diag(doublereal* dlnActCoeffdlnX_diag) const { - err("getdlnActCoeffdlnX_diag"); + throw NotImplementedError("ThermoPhase::getdlnActCoeffdlnX_diag"); } //! Get the array of log species mole number derivatives of the log activity coefficients @@ -1504,7 +1501,7 @@ public: * log Activity Coefficients. length = m_kk */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { - err("getdlnActCoeffdlnN_diag"); + throw NotImplementedError("ThermoPhase::getdlnActCoeffdlnN_diag"); } //! Get the array of derivatives of the log activity coefficients with respect to the log of the species mole numbers @@ -1614,13 +1611,6 @@ protected: //! last value of the temperature processed by reference state mutable doublereal m_tlast; - -private: - //! Error function that gets called for unhandled cases - /*! - * @param msg String containing the message. - */ - doublereal err(const std::string& msg) const; }; //! typedef for the ThermoPhase class diff --git a/include/cantera/thermo/VPSSMgr.h b/include/cantera/thermo/VPSSMgr.h index 5b0d8482a..733c057bc 100644 --- a/include/cantera/thermo/VPSSMgr.h +++ b/include/cantera/thermo/VPSSMgr.h @@ -882,12 +882,6 @@ protected: mutable vector_fp mPDSS_Vss; friend class PDSS; -private: - //! Error message to indicate an unimplemented feature - /*! - * @param msg Error message string - */ - void err(const std::string& msg) const; }; //@} } diff --git a/include/cantera/thermo/VPStandardStateTP.h b/include/cantera/thermo/VPStandardStateTP.h index c77ad7a0a..d7d61982e 100644 --- a/include/cantera/thermo/VPStandardStateTP.h +++ b/include/cantera/thermo/VPStandardStateTP.h @@ -118,7 +118,7 @@ public: * log Activity Coefficients. length = m_kk */ virtual void getdlnActCoeffdlnN_diag(doublereal* dlnActCoeffdlnN_diag) const { - err("getdlnActCoeffdlnN_diag"); + throw NotImplementedError("VPStandardStateTP::getdlnActCoeffdlnN_diag"); } //@} @@ -578,14 +578,6 @@ protected: * Copy operations are deep. */ std::vector m_PDSS_storage; - -private: - //! VPStandardStateTP has its own err routine - /*! - * @param msg Error message string - */ - doublereal err(const std::string& msg) const; - }; } diff --git a/include/cantera/transport/LiquidTransport.h b/include/cantera/transport/LiquidTransport.h index 0d0554b2b..bfbc87837 100644 --- a/include/cantera/transport/LiquidTransport.h +++ b/include/cantera/transport/LiquidTransport.h @@ -1312,14 +1312,6 @@ private: * Turn on to get debugging information */ bool m_debug; - - //! Throw an exception if this method is invoked. - /*! - * This probably indicates something is not yet implemented. - * - * @param msg Indicates the member function which is not implemented - */ - doublereal err(const std::string& msg) const; }; } #endif diff --git a/include/cantera/transport/SimpleTransport.h b/include/cantera/transport/SimpleTransport.h index dcc83e0a2..5a26c7c43 100644 --- a/include/cantera/transport/SimpleTransport.h +++ b/include/cantera/transport/SimpleTransport.h @@ -727,17 +727,6 @@ private: //! Temporary variable that stores the rho Vc value double rhoVc[3]; - -private: - - //! Throw an exception if this method is invoked. - /*! - * This probably indicates something is not yet implemented. - * - * @param msg Indicates the member function which is not implemented - */ - doublereal err(const std::string& msg) const; - }; } #endif diff --git a/include/cantera/transport/TransportBase.h b/include/cantera/transport/TransportBase.h index 77f22230b..6d990a06f 100644 --- a/include/cantera/transport/TransportBase.h +++ b/include/cantera/transport/TransportBase.h @@ -248,7 +248,7 @@ public: * The viscosity in Pa-s. */ virtual doublereal viscosity() { - return err("viscosity"); + throw NotImplementedError("Transport::viscosity"); } //! Returns the pure species viscosities @@ -258,7 +258,7 @@ public: * @param visc Vector of viscosities */ virtual void getSpeciesViscosities(doublereal* const visc) { - err("getSpeciesViscosities"); + throw NotImplementedError("Transport::getSpeciesViscosities"); } /** @@ -268,14 +268,14 @@ public: * it, in which case an exception is thrown if called. */ virtual doublereal bulkViscosity() { - return err("bulkViscosity"); + throw NotImplementedError("Transport::bulkViscosity"); } /** * The ionic conductivity in 1/ohm/m. */ virtual doublereal ionConductivity() { - return err("ionConductivity"); + throw NotImplementedError("Transport::ionConductivity"); } //! Returns the pure species ionic conductivity @@ -285,7 +285,7 @@ public: * @param ionCond Vector of ionic conductivities */ virtual void getSpeciesIonConductivity(doublereal* const ionCond) { - err("getSpeciesIonConductivity"); + throw NotImplementedError("Transport::getSpeciesIonConductivity"); } //! Returns the pointer to the mobility ratios of the species in the phase @@ -303,7 +303,7 @@ public: * The size of mobRat must be at least equal to nsp*nsp */ virtual void mobilityRatio(double* mobRat) { - err("mobilityRatio"); + throw NotImplementedError("Transport::mobilityRatio"); } //! Returns the pure species limit of the mobility ratios @@ -313,7 +313,7 @@ public: * @param mobRat Vector of mobility ratios */ virtual void getSpeciesMobilityRatio(double** mobRat) { - err("getSpeciesMobilityRatio"); + throw NotImplementedError("Transport::getSpeciesMobilityRatio"); } //! Returns the self diffusion coefficients of the species in the phase @@ -342,7 +342,7 @@ public: * of species in phase. units = m**2 s-1. */ virtual void selfDiffusion(doublereal* const selfDiff) { - err("selfDiffusion"); + throw NotImplementedError("Transport::selfDiffusion"); } //! Returns the pure species self diffusion in solution of each species @@ -354,7 +354,7 @@ public: * to hold returned self diffusion coeffs. */ virtual void getSpeciesSelfDiffusion(double** selfDiff) { - err("getSpeciesSelfDiffusion"); + throw NotImplementedError("Transport::getSpeciesSelfDiffusion"); } //! Returns the mixture thermal conductivity in W/m/K. @@ -364,14 +364,14 @@ public: * @return returns thermal conductivity in W/m/K. */ virtual doublereal thermalConductivity() { - return err("thermalConductivity"); + throw NotImplementedError("Transport::thermalConductivity"); } /*! * The electrical conductivity (Siemens/m). */ virtual doublereal electricalConductivity() { - return err("electricalConductivity"); + throw NotImplementedError("Transport::electricalConductivity"); } //! Get the Electrical mobilities (m^2/V/s). @@ -391,7 +391,7 @@ public: * the number of species. */ virtual void getMobilities(doublereal* const mobil_e) { - err("getMobilities"); + throw NotImplementedError("Transport::getMobilities"); } //! Get the fluid mobilities (s kmol/kg). @@ -412,7 +412,7 @@ public: * number of species. */ virtual void getFluidMobilities(doublereal* const mobil_f) { - err("getFluidMobilities"); + throw NotImplementedError("Transport::getFluidMobilities"); } //@} @@ -435,8 +435,7 @@ public: * The units are Siemens m-1, where 1 S = 1 A / volt = 1 s^3 A^2 /kg /m^2 */ virtual doublereal getElectricConduct() { - err("getElectricConduct"); - return 0.0; + throw NotImplementedError("Transport::getElectricConduct"); } //! Compute the electric current density in A/m^2 @@ -459,7 +458,7 @@ public: int ldf, const doublereal* grad_V, doublereal* current) { - err("getElectricCurrent"); + throw NotImplementedError("Transport::getElectricCurrent"); } //! Get the species diffusive mass fluxes wrt to the specified solution @@ -537,7 +536,7 @@ public: const doublereal* grad_X, int ldf, doublereal* Vdiff) { - err("getSpeciesVdiff"); + throw NotImplementedError("Transport::getSpeciesVdiff"); } //! Get the species diffusive velocities wrt to the mass averaged velocity, @@ -584,7 +583,7 @@ public: virtual void getMolarFluxes(const doublereal* const state1, const doublereal* const state2, const doublereal delta, doublereal* const cfluxes) { - err("getMolarFluxes"); + throw NotImplementedError("Transport::getMolarFluxes"); } //! Get the mass fluxes [kg/m^2/s], given the thermodynamic state at two @@ -603,7 +602,7 @@ public: virtual void getMassFluxes(const doublereal* state1, const doublereal* state2, doublereal delta, doublereal* mfluxes) { - err("getMassFluxes"); + throw NotImplementedError("Transport::getMassFluxes"); } //! Return a vector of Thermal diffusion coefficients [kg/m/sec]. @@ -623,7 +622,7 @@ public: * species. Units are kg/m/s. */ virtual void getThermalDiffCoeffs(doublereal* const dt) { - err("getThermalDiffCoeffs"); + throw NotImplementedError("Transport::getThermalDiffCoeffs"); } //! Returns the matrix of binary diffusion coefficients [m^2/s]. @@ -634,7 +633,7 @@ public: * in length. */ virtual void getBinaryDiffCoeffs(const size_t ld, doublereal* const d) { - err("getBinaryDiffCoeffs"); + throw NotImplementedError("Transport::getBinaryDiffCoeffs"); } //! Return the Multicomponent diffusion coefficients. Units: [m^2/s]. @@ -649,7 +648,7 @@ public: * coefficient for species i due to species j). */ virtual void getMultiDiffCoeffs(const size_t ld, doublereal* const d) { - err("getMultiDiffCoeffs"); + throw NotImplementedError("Transport::getMultiDiffCoeffs"); } //! Returns a vector of mixture averaged diffusion coefficients @@ -663,17 +662,17 @@ public: * Units = m2/s. Length = n_sp */ virtual void getMixDiffCoeffs(doublereal* const d) { - err("getMixDiffCoeffs"); + throw NotImplementedError("Transport::getMixDiffCoeffs"); } //! Returns a vector of mixture averaged diffusion coefficients virtual void getMixDiffCoeffsMole(doublereal* const d) { - err("getMixDiffCoeffsMole"); + throw NotImplementedError("Transport::getMixDiffCoeffsMole"); } //! Returns a vector of mixture averaged diffusion coefficients virtual void getMixDiffCoeffsMass(doublereal* const d) { - err("getMixDiffCoeffsMass"); + throw NotImplementedError("Transport::getMixDiffCoeffsMass"); } //! Set model parameters for derived classes @@ -737,8 +736,7 @@ protected: * to initialize the class */ virtual bool initGas(GasTransportParams& tr) { - err("initGas"); - return false; + throw NotImplementedError("Transport::initGas"); } //! Called by TransportFactory to set parameters. @@ -750,8 +748,7 @@ protected: * to initialize the class */ virtual bool initLiquid(LiquidTransportParams& tr) { - err("initLiquid"); - return false; + throw NotImplementedError("Transport::initLiquid"); } public: @@ -764,8 +761,7 @@ public: * to initialize the class */ virtual bool initSolid(SolidTransportData& tr) { - err("initSolid"); - return false; + throw NotImplementedError("Transport::initSolid"); } //! Specifies the ThermoPhase object. @@ -810,26 +806,6 @@ protected: //! Velocity basis from which diffusion velocities are computed. //! Defaults to the mass averaged basis = -2 int m_velocityBasis; - -private: - - //! Error routine - /*! - * Throw an exception if a method of this class is invoked. This probably - * indicates that a transport manager is being used that does not implement - * all virtual methods, and one of those methods was called by the - * application program. For example, a transport manager that computes the - * thermal conductivity of a solid may not define the viscosity() method, - * since the viscosity is in this case meaningless. If the application - * invokes the viscosity() method, the base class method will be called, - * resulting in an exception being thrown. - * - * @param msg Descriptive message string to add to the error report - * - * @return returns a double, though we will never get there - */ - doublereal err(const std::string& msg) const; - }; } diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 56364db88..f52cee605 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -295,12 +295,4 @@ void Kinetics::finalize() } } -void Kinetics::err(const std::string& m) const -{ - throw CanteraError("Kinetics::" + m, - "The default Base class method was called, when " - "the inherited class's method should " - "have been called"); -} - } diff --git a/src/thermo/DebyeHuckel.cpp b/src/thermo/DebyeHuckel.cpp index 08fe1f922..567ac0853 100644 --- a/src/thermo/DebyeHuckel.cpp +++ b/src/thermo/DebyeHuckel.cpp @@ -219,10 +219,9 @@ doublereal DebyeHuckel::cp_mole() const doublereal DebyeHuckel::cv_mole() const { + throw NotImplementedError("DebyeHuckel::cv_mole"); //getPartialMolarCv(m_tmpV.begin()); //return mean_X(m_tmpV.begin()); - err("not implemented"); - return 0.0; } // @@ -1213,13 +1212,6 @@ double DebyeHuckel::AionicRadius(int k) const * ------------ Private and Restricted Functions ------------------ */ -doublereal DebyeHuckel::err(const std::string& msg) const -{ - throw CanteraError("DebyeHuckel", - "Unfinished func called: " + msg); - return 0.0; -} - void DebyeHuckel::initLengths() { m_kk = nSpecies(); diff --git a/src/thermo/GibbsExcessVPSSTP.cpp b/src/thermo/GibbsExcessVPSSTP.cpp index 14cab7628..de5bfb21c 100644 --- a/src/thermo/GibbsExcessVPSSTP.cpp +++ b/src/thermo/GibbsExcessVPSSTP.cpp @@ -222,13 +222,6 @@ const vector_fp& GibbsExcessVPSSTP::getPartialMolarVolumesVector() const return getStandardVolumes(); } -doublereal GibbsExcessVPSSTP::err(const std::string& msg) const -{ - throw CanteraError("GibbsExcessVPSSTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - double GibbsExcessVPSSTP::checkMFSum(const doublereal* const x) const { doublereal norm = accumulate(x, x + m_kk, 0.0); diff --git a/src/thermo/HMWSoln.cpp b/src/thermo/HMWSoln.cpp index 4421631ca..3c7668258 100644 --- a/src/thermo/HMWSoln.cpp +++ b/src/thermo/HMWSoln.cpp @@ -1169,13 +1169,6 @@ double HMWSoln::AionicRadius(int k) const * ------------ Private and Restricted Functions ------------------ */ -doublereal HMWSoln::err(const std::string& msg) const -{ - throw CanteraError("HMWSoln", - "Unfinished func called: " + msg); - return 0.0; -} - void HMWSoln::initLengths() { m_kk = nSpecies(); diff --git a/src/thermo/IdealMolalSoln.cpp b/src/thermo/IdealMolalSoln.cpp index 7fd9e6651..713ea63ce 100644 --- a/src/thermo/IdealMolalSoln.cpp +++ b/src/thermo/IdealMolalSoln.cpp @@ -167,7 +167,7 @@ doublereal IdealMolalSoln::cp_mole() const doublereal IdealMolalSoln::cv_mole() const { - return err("not implemented"); + throw NotImplementedError("IdealMolalSoln::cv_mole"); } // @@ -678,17 +678,6 @@ void IdealMolalSoln::setParametersFromXML(const XML_Node& eosdata) * ------------ Private and Restricted Functions ------------------ */ -/* - * Bail out of functions with an error exit if they are not - * implemented. - */ -doublereal IdealMolalSoln::err(const std::string& msg) const -{ - throw CanteraError("IdealMolalSoln", - "Unfinished func called: " + msg); - return 0.0; -} - void IdealMolalSoln::s_updateIMS_lnMolalityActCoeff() const { double tmp; diff --git a/src/thermo/IonsFromNeutralVPSSTP.cpp b/src/thermo/IonsFromNeutralVPSSTP.cpp index c1e58c93a..16b9393ab 100644 --- a/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -847,13 +847,6 @@ void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c) * ------------ Partial Molar Properties of the Solution ------------ */ -doublereal IonsFromNeutralVPSSTP::err(const std::string& msg) const -{ - throw CanteraError("IonsFromNeutralVPSSTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void IonsFromNeutralVPSSTP::initThermo() { initLengths(); diff --git a/src/thermo/LatticeSolidPhase.cpp b/src/thermo/LatticeSolidPhase.cpp index e716585ed..593b515d4 100644 --- a/src/thermo/LatticeSolidPhase.cpp +++ b/src/thermo/LatticeSolidPhase.cpp @@ -523,10 +523,4 @@ void LatticeSolidPhase::modifyOneHf298SS(const size_t k, const doublereal Hf298N _updateThermo(); } -doublereal LatticeSolidPhase::err(const std::string& msg) const -{ - throw CanteraError("LatticeSolidPhase","Unimplemented " + msg); - return 0.0; -} - } // End namespace Cantera diff --git a/src/thermo/MargulesVPSSTP.cpp b/src/thermo/MargulesVPSSTP.cpp index 565c41e0e..8ac208855 100644 --- a/src/thermo/MargulesVPSSTP.cpp +++ b/src/thermo/MargulesVPSSTP.cpp @@ -349,13 +349,6 @@ void MargulesVPSSTP::getPartialMolarVolumes(doublereal* vbar) const } } -doublereal MargulesVPSSTP::err(const std::string& msg) const -{ - throw CanteraError("MargulesVPSSTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void MargulesVPSSTP::initThermo() { initLengths(); diff --git a/src/thermo/MixedSolventElectrolyte.cpp b/src/thermo/MixedSolventElectrolyte.cpp index e2e544560..09020ebb4 100644 --- a/src/thermo/MixedSolventElectrolyte.cpp +++ b/src/thermo/MixedSolventElectrolyte.cpp @@ -359,13 +359,6 @@ void MixedSolventElectrolyte::getPartialMolarVolumes(doublereal* vbar) const } } -doublereal MixedSolventElectrolyte::err(const std::string& msg) const -{ - throw CanteraError("MixedSolventElectrolyte","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void MixedSolventElectrolyte::initThermo() { initLengths(); diff --git a/src/thermo/MixtureFugacityTP.cpp b/src/thermo/MixtureFugacityTP.cpp index dcbd5601e..a744ccc15 100644 --- a/src/thermo/MixtureFugacityTP.cpp +++ b/src/thermo/MixtureFugacityTP.cpp @@ -103,17 +103,6 @@ int MixtureFugacityTP::reportSolnBranchActual() const return iState_; } -/* - * ------------Molar Thermodynamic Properties ------------------------- - */ - -doublereal MixtureFugacityTP::err(const std::string& msg) const -{ - throw CanteraError("MixtureFugacityTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - /* * ---- Partial Molar Properties of the Solution ----------------- */ @@ -369,7 +358,8 @@ void MixtureFugacityTP::setMoleFractions_NoState(const doublereal* const x) void MixtureFugacityTP::calcDensity() { - err("MixtureFugacityTP::calcDensity() called, but EOS for phase is not known"); + throw NotImplementedError("MixtureFugacityTP::calcDensity() " + "called, but EOS for phase is not known"); } void MixtureFugacityTP::setState_TP(doublereal t, doublereal pres) diff --git a/src/thermo/MolalityVPSSTP.cpp b/src/thermo/MolalityVPSSTP.cpp index e6d060626..8c43a0b6b 100644 --- a/src/thermo/MolalityVPSSTP.cpp +++ b/src/thermo/MolalityVPSSTP.cpp @@ -277,18 +277,17 @@ int MolalityVPSSTP::activityConvention() const void MolalityVPSSTP::getActivityConcentrations(doublereal* c) const { - err("getActivityConcentrations"); + throw NotImplementedError("MolalityVPSSTP::getActivityConcentrations"); } doublereal MolalityVPSSTP::standardConcentration(size_t k) const { - err("standardConcentration"); - return -1.0; + throw NotImplementedError("MolalityVPSSTP::standardConcentration"); } void MolalityVPSSTP::getActivities(doublereal* ac) const { - err("getActivities"); + throw NotImplementedError("MolalityVPSSTP::getActivities"); } void MolalityVPSSTP::getActivityCoefficients(doublereal* ac) const @@ -341,13 +340,6 @@ void MolalityVPSSTP::getElectrochemPotentials(doublereal* mu) const } } -doublereal MolalityVPSSTP::err(const std::string& msg) const -{ - throw CanteraError("MolalityVPSSTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void MolalityVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) const { for (int i = 0; i < sizeUA; i++) { @@ -375,7 +367,7 @@ void MolalityVPSSTP::getUnitsStandardConc(double* uA, int k, int sizeUA) const void MolalityVPSSTP::setToEquilState(const doublereal* lambda_RT) { updateStandardStateThermo(); - err("setToEquilState"); + throw NotImplementedError("MolalityVPSSTP::setToEquilState"); } void MolalityVPSSTP::setStateFromXML(const XML_Node& state) @@ -428,12 +420,12 @@ void MolalityVPSSTP::initThermo() void MolalityVPSSTP::getUnscaledMolalityActivityCoefficients(doublereal* acMolality) const { - err("getUnscaledMolalityActivityCoefficients"); + throw NotImplementedError("MolalityVPSSTP::getUnscaledMolalityActivityCoefficients"); } void MolalityVPSSTP::applyphScale(doublereal* acMolality) const { - err("applyphScale"); + throw NotImplementedError("MolalityVPSSTP::applyphScale"); } size_t MolalityVPSSTP::findCLMIndex() const diff --git a/src/thermo/MolarityIonicVPSSTP.cpp b/src/thermo/MolarityIonicVPSSTP.cpp index d2c1a027d..64e76bbf1 100644 --- a/src/thermo/MolarityIonicVPSSTP.cpp +++ b/src/thermo/MolarityIonicVPSSTP.cpp @@ -348,17 +348,6 @@ void MolarityIonicVPSSTP::s_update_dlnActCoeff_dX_() const } -/* - * ------------ Partial Molar Properties of the Solution ------------ - */ - -doublereal MolarityIonicVPSSTP::err(const std::string& msg) const -{ - throw CanteraError("MolarityIonicVPSSTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void MolarityIonicVPSSTP::initThermo() { GibbsExcessVPSSTP::initThermo(); diff --git a/src/thermo/PDSS.cpp b/src/thermo/PDSS.cpp index 105d81ba2..b09989d31 100644 --- a/src/thermo/PDSS.cpp +++ b/src/thermo/PDSS.cpp @@ -216,8 +216,7 @@ void PDSS::initPtrs() doublereal PDSS::enthalpy_mole() const { - err("enthalpy_mole()"); - return 0.0; + throw NotImplementedError("PDSS::enthalpy_mole()"); } doublereal PDSS::enthalpy_RT() const @@ -228,14 +227,12 @@ doublereal PDSS::enthalpy_RT() const doublereal PDSS::intEnergy_mole() const { - err("intEnergy_mole()"); - return 0.0; + throw NotImplementedError("PDSS::intEnergy_mole()"); } doublereal PDSS::entropy_mole() const { - err("entropy_mole()"); - return 0.0; + throw NotImplementedError("PDSS::entropy_mole()"); } doublereal PDSS::entropy_R() const @@ -245,8 +242,7 @@ doublereal PDSS::entropy_R() const doublereal PDSS::gibbs_mole() const { - err("gibbs_mole()"); - return 0.0; + throw NotImplementedError("PDSS::gibbs_mole()"); } doublereal PDSS::gibbs_RT() const @@ -257,8 +253,7 @@ doublereal PDSS::gibbs_RT() const doublereal PDSS::cp_mole() const { - err("cp_mole()"); - return 0.0; + throw NotImplementedError("PDSS::cp_mole()"); } doublereal PDSS::cp_R() const @@ -268,50 +263,42 @@ doublereal PDSS::cp_R() const doublereal PDSS::molarVolume() const { - err("molarVolume()"); - return 0.0; + throw NotImplementedError("PDSS::molarVolume()"); } doublereal PDSS::density() const { - err("density()"); - return 0.0; + throw NotImplementedError("PDSS::density()"); } doublereal PDSS::cv_mole() const { - err("cv_mole()"); - return 0.0; + throw NotImplementedError("PDSS::cv_mole()"); } doublereal PDSS::gibbs_RT_ref() const { - err("gibbs_RT_ref()"); - return 0.0; + throw NotImplementedError("PDSS::gibbs_RT_ref()"); } doublereal PDSS::enthalpy_RT_ref() const { - err("enthalpy_RT_ref()"); - return 0.0; + throw NotImplementedError("PDSS::enthalpy_RT_ref()"); } doublereal PDSS::entropy_R_ref() const { - err("entropy_RT_ref()"); - return 0.0; + throw NotImplementedError("PDSS::entropy_RT_ref()"); } doublereal PDSS::cp_R_ref() const { - err("entropy_RT_ref()"); - return 0.0; + throw NotImplementedError("PDSS::entropy_RT_ref()"); } doublereal PDSS::molarVolume_ref() const { - err("molarVolume_ref()"); - return 0.0; + throw NotImplementedError("PDSS::molarVolume_ref()"); } doublereal PDSS::enthalpyDelp_mole() const @@ -348,26 +335,22 @@ doublereal PDSS::pressure() const doublereal PDSS::thermalExpansionCoeff() const { - throw CanteraError("PDSS::thermalExpansionCoeff()", "unimplemented"); - return 0.0; + throw NotImplementedError("PDSS::thermalExpansionCoeff()"); } doublereal PDSS::critTemperature() const { - err("critTemperature()"); - return 0.0; + throw NotImplementedError("PDSS::critTemperature()"); } doublereal PDSS::critPressure() const { - err("critPressure()"); - return 0.0; + throw NotImplementedError("PDSS::critPressure()"); } doublereal PDSS::critDensity() const { - err("critDensity()"); - return 0.0; + throw NotImplementedError("PDSS::critDensity()"); } void PDSS::setPressure(doublereal pres) @@ -396,23 +379,17 @@ void PDSS::setMolecularWeight(doublereal mw) void PDSS::setState_TP(doublereal temp, doublereal pres) { - err("setState_TP()"); + throw NotImplementedError("PDSS::setState_TP()"); } void PDSS::setState_TR(doublereal temp, doublereal rho) { - err("setState_TR()"); + throw NotImplementedError("PDSS::setState_TR()"); } doublereal PDSS::satPressure(doublereal t) { - err("satPressure()"); - return 0.0; -} - -void PDSS::err(const std::string& msg) const -{ - throw CanteraError("PDSS::" + msg, "unimplemented"); + throw NotImplementedError("PDSS::satPressure()"); } void PDSS::reportParams(size_t& kindex, int& type, diff --git a/src/thermo/PhaseCombo_Interaction.cpp b/src/thermo/PhaseCombo_Interaction.cpp index b8c401b61..5fd1bbb73 100644 --- a/src/thermo/PhaseCombo_Interaction.cpp +++ b/src/thermo/PhaseCombo_Interaction.cpp @@ -367,13 +367,6 @@ void PhaseCombo_Interaction::getPartialMolarVolumes(doublereal* vbar) const } } -doublereal PhaseCombo_Interaction::err(const std::string& msg) const -{ - throw CanteraError("PhaseCombo_Interaction","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void PhaseCombo_Interaction::initThermo() { initLengths(); diff --git a/src/thermo/PseudoBinaryVPSSTP.cpp b/src/thermo/PseudoBinaryVPSSTP.cpp index b7d733be7..078834720 100644 --- a/src/thermo/PseudoBinaryVPSSTP.cpp +++ b/src/thermo/PseudoBinaryVPSSTP.cpp @@ -86,8 +86,7 @@ PseudoBinaryVPSSTP::duplMyselfAsThermoPhase() const doublereal PseudoBinaryVPSSTP::standardConcentration(size_t k) const { - err("standardConcentration"); - return -1.0; + throw NotImplementedError("PseudoBinaryVPSSTP::standardConcentration"); } void PseudoBinaryVPSSTP::getElectrochemPotentials(doublereal* mu) const @@ -159,13 +158,6 @@ void PseudoBinaryVPSSTP::calcPseudoBinaryMoleFractions() const } } -doublereal PseudoBinaryVPSSTP::err(const std::string& msg) const -{ - throw CanteraError("PseudoBinaryVPSSTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void PseudoBinaryVPSSTP::initThermo() { initLengths(); diff --git a/src/thermo/RedlichKisterVPSSTP.cpp b/src/thermo/RedlichKisterVPSSTP.cpp index 2ce87ae99..f5edcee58 100644 --- a/src/thermo/RedlichKisterVPSSTP.cpp +++ b/src/thermo/RedlichKisterVPSSTP.cpp @@ -344,13 +344,6 @@ void RedlichKisterVPSSTP::getPartialMolarVolumes(doublereal* vbar) const } } -doublereal RedlichKisterVPSSTP::err(const std::string& msg) const -{ - throw CanteraError("RedlichKisterVPSSTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void RedlichKisterVPSSTP::initThermo() { initLengths(); diff --git a/src/thermo/SingleSpeciesTP.cpp b/src/thermo/SingleSpeciesTP.cpp index 6411590ca..4f243286c 100644 --- a/src/thermo/SingleSpeciesTP.cpp +++ b/src/thermo/SingleSpeciesTP.cpp @@ -52,8 +52,7 @@ ThermoPhase* SingleSpeciesTP::duplMyselfAsThermoPhase() const int SingleSpeciesTP::eosType() const { - err("eosType"); - return -1; + throw NotImplementedError("SingleSpeciesTP::eosType"); } /* @@ -329,14 +328,6 @@ void SingleSpeciesTP::setState_SV(doublereal s, doublereal v, throw CanteraError("setState_SV","no convergence. dt = " + fp2str(dt)); } -doublereal SingleSpeciesTP::err(const std::string& msg) const -{ - throw CanteraError("SingleSpeciesTP","Base class method " - +msg+" called. Equation of state type: " - +int2str(eosType())); - return 0; -} - void SingleSpeciesTP::initThermo() { /* diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index deca79b55..edfebc5b4 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -583,13 +583,6 @@ void ThermoPhase::setState_SPorSV(doublereal Starget, doublereal p, } } -doublereal ThermoPhase::err(const std::string& msg) const -{ - throw CanteraError("ThermoPhase","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0.0; -} - void ThermoPhase::getUnitsStandardConc(double* uA, int k, int sizeUA) const { for (int i = 0; i < sizeUA; i++) { diff --git a/src/thermo/VPSSMgr.cpp b/src/thermo/VPSSMgr.cpp index 8434a11c5..ddae62e46 100644 --- a/src/thermo/VPSSMgr.cpp +++ b/src/thermo/VPSSMgr.cpp @@ -155,7 +155,7 @@ VPSSMgr::getStandardChemPotentials(doublereal* mu) const doublereal _rt = GasConstant * m_tlast; scale(mu, mu+m_kk, mu, _rt); } else { - err("getStandardChemPotentials"); + throw NotImplementedError("VPSSMgr::getStandardChemPotentials"); } } @@ -165,7 +165,7 @@ VPSSMgr::getGibbs_RT(doublereal* grt) const if (m_useTmpStandardStateStorage) { std::copy(m_gss_RT.begin(), m_gss_RT.end(), grt); } else { - err("getGibbs_RT"); + throw NotImplementedError("VPSSMgr::getGibbs_RT"); } } @@ -175,7 +175,7 @@ VPSSMgr::getEnthalpy_RT(doublereal* hrt) const if (m_useTmpStandardStateStorage) { std::copy(m_hss_RT.begin(), m_hss_RT.end(), hrt); } else { - err("getEnthalpy_RT"); + throw NotImplementedError("VPSSMgr::getEnthalpy_RT"); } } @@ -185,7 +185,7 @@ VPSSMgr::getEntropy_R(doublereal* sr) const if (m_useTmpStandardStateStorage) { std::copy(m_sss_R.begin(), m_sss_R.end(), sr); } else { - err("getEntropy_RT"); + throw NotImplementedError("VPSSMgr::getEntropy_RT"); } } @@ -199,7 +199,7 @@ VPSSMgr::getIntEnergy_RT(doublereal* urt) const urt[k] -= pRT * m_Vss[k]; } } else { - err("getEntropy_RT"); + throw NotImplementedError("VPSSMgr::getEntropy_RT"); } } @@ -209,7 +209,7 @@ VPSSMgr::getCp_R(doublereal* cpr) const if (m_useTmpStandardStateStorage) { std::copy(m_cpss_R.begin(), m_cpss_R.end(), cpr); } else { - err("getCp_R"); + throw NotImplementedError("VPSSMgr::getCp_R"); } } @@ -219,14 +219,14 @@ VPSSMgr::getStandardVolumes(doublereal* vol) const if (m_useTmpStandardStateStorage) { std::copy(m_Vss.begin(), m_Vss.end(), vol); } else { - err("getStandardVolumes"); + throw NotImplementedError("VPSSMgr::getStandardVolumes"); } } const vector_fp& VPSSMgr::getStandardVolumes() const { if (!m_useTmpStandardStateStorage) { - err("getStandardVolumes"); + throw NotImplementedError("VPSSMgr::getStandardVolumes"); } return m_Vss; } @@ -238,7 +238,7 @@ VPSSMgr::getEnthalpy_RT_ref(doublereal* hrt) const if (m_useTmpRefStateStorage) { std::copy(m_h0_RT.begin(), m_h0_RT.end(), hrt); } else { - err("getEnthalpy_RT_ref"); + throw NotImplementedError("VPSSMgr::getEnthalpy_RT_ref"); } } @@ -248,7 +248,7 @@ VPSSMgr::getGibbs_RT_ref(doublereal* grt) const if (m_useTmpRefStateStorage) { std::copy(m_g0_RT.begin(), m_g0_RT.end(), grt); } else { - err("getGibbs_RT_ref"); + throw NotImplementedError("VPSSMgr::getGibbs_RT_ref"); } } @@ -260,7 +260,7 @@ VPSSMgr::getGibbs_ref(doublereal* g) const doublereal _rt = GasConstant * m_tlast; scale(g, g+m_kk, g, _rt); } else { - err("getGibbs_ref"); + throw NotImplementedError("VPSSMgr::getGibbs_ref"); } } @@ -270,7 +270,7 @@ VPSSMgr::getEntropy_R_ref(doublereal* sr) const if (m_useTmpRefStateStorage) { std::copy(m_s0_R.begin(), m_s0_R.end(), sr); } else { - err("getEntropy_R_ref"); + throw NotImplementedError("VPSSMgr::getEntropy_R_ref"); } } @@ -280,7 +280,7 @@ VPSSMgr::getCp_R_ref(doublereal* cpr) const if (m_useTmpRefStateStorage) { std::copy(m_cp0_R.begin(), m_cp0_R.end(), cpr); } else { - err("getCp_R_ref"); + throw NotImplementedError("VPSSMgr::getCp_R_ref"); } } @@ -339,7 +339,7 @@ void VPSSMgr::_updateStandardStateThermo() PDSS* kPDSS = m_vptp_ptr->providePDSS(k); kPDSS->setState_TP(m_tlast, m_plast); } - err("_updateStandardStateThermo()"); + throw NotImplementedError("VPSSMgr::_updateStandardStateThermo()"); } void VPSSMgr::_updateRefStateThermo() const @@ -450,8 +450,7 @@ void VPSSMgr::installSTSpecies(size_t k, const XML_Node& s, PDSS* VPSSMgr::createInstallPDSS(size_t k, const XML_Node& s, const XML_Node* phaseNode_ptr) { - err("VPSSMgr::createInstallPDSS"); - return (PDSS*) 0; + throw NotImplementedError("VPSSMgr::VPSSMgr::createInstallPDSS"); } /*****************************************************************/ @@ -484,21 +483,13 @@ doublereal VPSSMgr::refPressure(size_t k) const PDSS_enumType VPSSMgr::reportPDSSType(int index) const { - err("reportPDSSType()"); - return cPDSS_UNDEF; + throw NotImplementedError("VPSSMgr::reportPDSSType()"); } VPSSMgr_enumType VPSSMgr::reportVPSSMgrType() const { - err("reportVPSSType()"); - return cVPSSMGR_UNDEF; + throw NotImplementedError("VPSSMgr::reportVPSSType()"); } -/*****************************************************************/ - -void VPSSMgr::err(const std::string& msg) const -{ - throw CanteraError("VPSSMgr::" + msg, "unimplemented"); -} } diff --git a/src/thermo/VPStandardStateTP.cpp b/src/thermo/VPStandardStateTP.cpp index d48704e96..37e12d349 100644 --- a/src/thermo/VPStandardStateTP.cpp +++ b/src/thermo/VPStandardStateTP.cpp @@ -126,13 +126,6 @@ int VPStandardStateTP::standardStateConvention() const return cSS_CONVENTION_VPSS; } -doublereal VPStandardStateTP::err(const std::string& msg) const -{ - throw CanteraError("VPStandardStateTP","Base class method " - +msg+" called. Equation of state type: "+int2str(eosType())); - return 0; -} - void VPStandardStateTP::getChemPotentials_RT(doublereal* muRT) const { getChemPotentials(muRT); @@ -300,7 +293,8 @@ void VPStandardStateTP::setPressure(doublereal p) void VPStandardStateTP::calcDensity() { - err("VPStandardStateTP::calcDensity() called, but EOS for phase is not known"); + throw NotImplementedError("VPStandardStateTP::calcDensity() called, " + "but EOS for phase is not known"); } diff --git a/src/transport/LiquidTransport.cpp b/src/transport/LiquidTransport.cpp index 71a498b91..b2c75ebd5 100644 --- a/src/transport/LiquidTransport.cpp +++ b/src/transport/LiquidTransport.cpp @@ -1222,13 +1222,4 @@ void LiquidTransport::stefan_maxwell_solve() } } -doublereal LiquidTransport::err(const std::string& msg) const -{ - throw CanteraError("LiquidTransport::err()", - "\n\n\n**** Method "+ msg +" not implemented in model " - + int2str(model()) + " ****\n" - "(Did you forget to specify a transport model?)\n\n\n"); - return 0.0; -} - } diff --git a/src/transport/SimpleTransport.cpp b/src/transport/SimpleTransport.cpp index 038d16365..dca6dca18 100644 --- a/src/transport/SimpleTransport.cpp +++ b/src/transport/SimpleTransport.cpp @@ -752,14 +752,4 @@ bool SimpleTransport::update_T() return true; } -doublereal SimpleTransport::err(const std::string& msg) const -{ - throw CanteraError("SimpleTransport Class", - "\n\n\n**** Method "+ msg +" not implemented in model " - + int2str(model()) + " ****\n" - "(Did you forget to specify a transport model?)\n\n\n"); - - return 0.0; -} - } diff --git a/src/transport/TortuosityBase.cpp b/src/transport/TortuosityBase.cpp index be1536952..febf872c8 100644 --- a/src/transport/TortuosityBase.cpp +++ b/src/transport/TortuosityBase.cpp @@ -16,11 +16,6 @@ namespace Cantera { //==================================================================================================================== -static void err(const std::string& r) -{ - throw Cantera::CanteraError("TortuosityBase", "Error calling base class " + r); -} -//==================================================================================================================== // Default constructor TortuosityBase::TortuosityBase() { @@ -73,8 +68,7 @@ TortuosityBase* TortuosityBase::duplMyselfAsTortuosityBase() const */ doublereal TortuosityBase::tortuosityFactor(doublereal porosity) { - err("tortuosityFactor"); - return 0.0; + throw NotImplementedError("TortuosityBase::tortuosityFactor"); } //==================================================================================================================== // The McMillan number is the ratio of the flux-like variable to the value it would have without porous flow. @@ -88,8 +82,7 @@ doublereal TortuosityBase::tortuosityFactor(doublereal porosity) */ doublereal TortuosityBase::McMillanFactor(doublereal porosity) { - err("McMillanFactor"); - return 0.0; + throw NotImplementedError("TortuosityBase::McMillanFactor"); } //==================================================================================================================== } diff --git a/src/transport/TransportBase.cpp b/src/transport/TransportBase.cpp index 0b446cbc1..7ebbec067 100644 --- a/src/transport/TransportBase.cpp +++ b/src/transport/TransportBase.cpp @@ -83,7 +83,7 @@ void Transport::checkSpeciesArraySize(size_t kk) const void Transport::setParameters(const int type, const int k, const doublereal* const p) { - err("setParameters"); + throw NotImplementedError("Transport::setParameters"); } void Transport::setThermo(thermo_t& thermo) @@ -112,17 +112,6 @@ void Transport::setThermo(thermo_t& thermo) } } -doublereal Transport::err(const std::string& msg) const -{ - - throw CanteraError("Transport Base Class", - "\n\n\n**** Method "+ msg +" not implemented in model " - + int2str(model()) + " ****\n" - "(Did you forget to specify a transport model?)\n\n\n"); - - return 0.0; -} - void Transport::finalize() { if (!ready()) { @@ -136,6 +125,6 @@ void Transport::getSpeciesFluxes(size_t ndim, const doublereal* const grad_T, size_t ldx, const doublereal* const grad_X, size_t ldf, doublereal* const fluxes) { - err("getSpeciesFluxes"); + throw NotImplementedError("Transport::getSpeciesFluxes"); } }