diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 8beb6e3ea..ef7c506b3 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -119,7 +119,12 @@ public: Kinetics(); virtual ~Kinetics(); + + //! @deprecated Copy constructor to be removed after Cantera 2.3 for all + //! classes derived from Kinetics. Kinetics(const Kinetics&); + //! @deprecated Assignment operator to be removed after Cantera 2.3 for all + //! classes derived from Kinetics. Kinetics& operator=(const Kinetics& right); //! Duplication routine for objects which inherit from Kinetics @@ -132,6 +137,8 @@ public: * * @param tpVector Vector of pointers to ThermoPhase objects. this is the * #m_thermo vector within this object + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * Kinetics. */ virtual Kinetics* duplMyselfAsKinetics(const std::vector & tpVector) const; @@ -151,6 +158,8 @@ public: * * @param tpVector Vector of pointers to ThermoPhase objects. this is the * #m_thermo vector within this object + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * Kinetics. */ virtual void assignShallowPointers(const std::vector & tpVector); diff --git a/include/cantera/numerics/ResidJacEval.h b/include/cantera/numerics/ResidJacEval.h index 0c548dd07..786d93904 100644 --- a/include/cantera/numerics/ResidJacEval.h +++ b/include/cantera/numerics/ResidJacEval.h @@ -57,7 +57,9 @@ public: */ ResidJacEval(doublereal atol = 1.0e-13); + //! @deprecated To be removed after Cantera 2.3. ResidJacEval(const ResidJacEval& right); + //! @deprecated To be removed after Cantera 2.3. ResidJacEval& operator=(const ResidJacEval& right); //! Duplication routine for objects derived from residJacEval @@ -68,6 +70,7 @@ public: * * These routines are basically wrappers around the derived copy * constructor. + * @deprecated To be removed after Cantera 2.3. */ virtual ResidJacEval* duplMyselfAsResidJacEval() const; diff --git a/include/cantera/numerics/RootFind.h b/include/cantera/numerics/RootFind.h index 3e0f26d2b..36bba96e6 100644 --- a/include/cantera/numerics/RootFind.h +++ b/include/cantera/numerics/RootFind.h @@ -140,8 +140,10 @@ public: */ RootFind(ResidEval* resid); + //! @deprecated To be removed after Cantera 2.3. RootFind(const RootFind& r); ~RootFind() {} + //! @deprecated To be removed after Cantera 2.3. RootFind& operator=(const RootFind& right); private: diff --git a/include/cantera/thermo/MultiSpeciesThermo.h b/include/cantera/thermo/MultiSpeciesThermo.h index b49d7da51..30928bf3c 100644 --- a/include/cantera/thermo/MultiSpeciesThermo.h +++ b/include/cantera/thermo/MultiSpeciesThermo.h @@ -45,7 +45,9 @@ public: //! Constructor MultiSpeciesThermo(); + //! @deprecated To be removed after Cantera 2.3. MultiSpeciesThermo(const MultiSpeciesThermo& b); + //! @deprecated To be removed after Cantera 2.3. MultiSpeciesThermo& operator=(const MultiSpeciesThermo& b); virtual ~MultiSpeciesThermo() {} diff --git a/include/cantera/thermo/PDSS.h b/include/cantera/thermo/PDSS.h index 2eaeef3d4..89c35be35 100644 --- a/include/cantera/thermo/PDSS.h +++ b/include/cantera/thermo/PDSS.h @@ -193,7 +193,11 @@ public: */ PDSS(VPStandardStateTP* tp, size_t spindex); + //! @deprecated Copy constructor to be removed after Cantera 2.3 for all + //! classes derived from PDSS. PDSS(const PDSS& b); + //! @deprecated Assignment operator to be removed after Cantera 2.3 for all + //! classes derived from PDSS. PDSS& operator=(const PDSS& b); virtual ~PDSS() {} @@ -203,6 +207,8 @@ public: * if the application only has a pointer to PDSS to work with. * * @return A pointer to the base PDSS object type + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * PDSS. */ virtual PDSS* duplMyselfAsPDSS() const; @@ -520,6 +526,8 @@ public: * @param spthermo_ptr Pointer to the optional MultiSpeciesThermo object * that will handle the calculation of the reference * state thermodynamic coefficients. + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * PDSS. */ virtual void initAllPtrs(VPStandardStateTP* vptp_ptr, VPSSMgr* vpssmgr_ptr, MultiSpeciesThermo* spthermo_ptr); diff --git a/include/cantera/thermo/Species.h b/include/cantera/thermo/Species.h index f12773e18..549b109f4 100644 --- a/include/cantera/thermo/Species.h +++ b/include/cantera/thermo/Species.h @@ -26,7 +26,9 @@ public: Species(const std::string& name, const compositionMap& comp, double charge=0.0, double size=1.0); + //! @deprecated To be removed after Cantera 2.3. Species(const Species& other); + //! @deprecated To be removed after Cantera 2.3. Species& operator=(const Species& other); ~Species(); diff --git a/include/cantera/thermo/SpeciesThermoInterpType.h b/include/cantera/thermo/SpeciesThermoInterpType.h index 86b7da06b..1d003db92 100644 --- a/include/cantera/thermo/SpeciesThermoInterpType.h +++ b/include/cantera/thermo/SpeciesThermoInterpType.h @@ -123,10 +123,17 @@ public: SpeciesThermoInterpType(double tlow, double thigh, double pref); + //! @deprecated Copy constructor to be removed after Cantera 2.3 for all + //! classes derived from SpeciesThermoInterpType. SpeciesThermoInterpType(const SpeciesThermoInterpType& b); + //! @deprecated Assignment operator to be removed after Cantera 2.3 for all + //! classes derived from SpeciesThermoInterpType. + SpeciesThermoInterpType& operator=(const SpeciesThermoInterpType& b); virtual ~SpeciesThermoInterpType() {} + //! @deprecated To be removed after Cantera 2.3 for all classes derived + //! from SpeciesThermoInterpType. virtual SpeciesThermoInterpType* duplMyselfAsSpeciesThermoInterpType() const = 0; diff --git a/include/cantera/thermo/ThermoPhase.h b/include/cantera/thermo/ThermoPhase.h index 5f4a230ec..0a3dbc690 100644 --- a/include/cantera/thermo/ThermoPhase.h +++ b/include/cantera/thermo/ThermoPhase.h @@ -97,7 +97,12 @@ public: ThermoPhase(); virtual ~ThermoPhase(); + + //! @deprecated Copy constructor to be removed after Cantera 2.3 for all + //! classes derived from ThermoPhase. ThermoPhase(const ThermoPhase& right); + //! @deprecated Assignment operator to be removed after Cantera 2.3 for all + //! classes derived from ThermoPhase. ThermoPhase& operator=(const ThermoPhase& right); //! Duplication routine for objects which inherit from ThermoPhase. @@ -108,6 +113,8 @@ public: * * These routines are basically wrappers around the derived copy * constructor. + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * ThermoPhase. */ virtual ThermoPhase* duplMyselfAsThermoPhase() const; diff --git a/include/cantera/thermo/VPSSMgr.h b/include/cantera/thermo/VPSSMgr.h index 11ac8fe14..4dd2c3761 100644 --- a/include/cantera/thermo/VPSSMgr.h +++ b/include/cantera/thermo/VPSSMgr.h @@ -240,13 +240,20 @@ public: VPSSMgr(VPStandardStateTP* vptp_ptr, MultiSpeciesThermo* spth = 0); virtual ~VPSSMgr() {} + + //! @deprecated Copy constructor to be removed after Cantera 2.3 for all + //! classes derived from VPSSMgr. VPSSMgr(const VPSSMgr& right); + //! @deprecated Assignment operator to be removed after Cantera 2.3 for all + //! classes derived from VPSSMgr. VPSSMgr& operator=(const VPSSMgr& right); //! Duplication routine for objects which derive from VPSSMgr /*! * This function can be used to duplicate objects derived from VPSSMgr * even if the application only has a pointer to VPSSMgr to work with. + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * VPSSMgr. */ virtual VPSSMgr* duplMyselfAsVPSSMgr() const; @@ -687,6 +694,8 @@ public: * * @param vp_ptr Pointer to the VPStandardStateTP standard state * @param sp_ptr Pointer to the MultiSpeciesThermo standard state + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * VPSSMgr. */ virtual void initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr); diff --git a/include/cantera/transport/TransportBase.h b/include/cantera/transport/TransportBase.h index a33dafbcf..d6b073421 100644 --- a/include/cantera/transport/TransportBase.h +++ b/include/cantera/transport/TransportBase.h @@ -162,7 +162,11 @@ public: Transport(thermo_t* thermo=0, size_t ndim = 1); virtual ~Transport() {} + //! @deprecated Copy constructor to be removed after Cantera 2.3 for all + //! classes derived from Transport. Transport(const Transport& right); + //! @deprecated Assignment operator to be removed after Cantera 2.3 for all + //! classes derived from Transport. Transport& operator=(const Transport& right); //! Duplication routine for objects which inherit from Transport @@ -173,6 +177,8 @@ public: * * These routines are basically wrappers around the derived copy * constructor. + * @deprecated To be removed after Cantera 2.3 for all classes derived from + * Transport. */ // Note ->need working copy constructors and operator=() functions for all first virtual Transport* duplMyselfAsTransport() const; diff --git a/src/kinetics/Kinetics.cpp b/src/kinetics/Kinetics.cpp index 880245f53..6b41971be 100644 --- a/src/kinetics/Kinetics.cpp +++ b/src/kinetics/Kinetics.cpp @@ -30,12 +30,16 @@ Kinetics::~Kinetics() {} Kinetics::Kinetics(const Kinetics& right) { + warn_deprecated("Kinetics copy constructor", "To be removed after" + " Cantera 2.3 for all classes derived from Kinetics."); // Call the assignment operator *this = right; } Kinetics& Kinetics::operator=(const Kinetics& right) { + warn_deprecated("Kinetics assignment operator", "To be removed after" + " Cantera 2.3 for all classes derived from Kinetics."); // Check for self assignment. if (this == &right) { return *this; @@ -67,6 +71,8 @@ Kinetics& Kinetics::operator=(const Kinetics& right) Kinetics* Kinetics::duplMyselfAsKinetics(const std::vector & tpVector) const { + warn_deprecated("Kinetics::duplMyselfAsKinetics", + "To be removed after Cantera 2.3."); Kinetics* ko = new Kinetics(*this); ko->assignShallowPointers(tpVector); return ko; diff --git a/src/numerics/ResidJacEval.cpp b/src/numerics/ResidJacEval.cpp index a9ad2c8c3..ea291ce5b 100644 --- a/src/numerics/ResidJacEval.cpp +++ b/src/numerics/ResidJacEval.cpp @@ -21,11 +21,15 @@ ResidJacEval::ResidJacEval(doublereal atol) : ResidJacEval::ResidJacEval(const ResidJacEval& right) { + warn_deprecated("ResidJacEval copy constructor", + "To be removed after Cantera 2.3."); *this = right; } ResidJacEval& ResidJacEval::operator=(const ResidJacEval& right) { + warn_deprecated("ResidJacEval assignment operator", + "To be removed after Cantera 2.3."); if (this == &right) { return *this; } diff --git a/src/numerics/RootFind.cpp b/src/numerics/RootFind.cpp index 761e1f37b..e8b8aaa9b 100644 --- a/src/numerics/RootFind.cpp +++ b/src/numerics/RootFind.cpp @@ -80,11 +80,15 @@ RootFind::RootFind(const RootFind& r) : x_minTried_(1.0E300), fx_minTried_(0.0) { + warn_deprecated("RootFind copy constructor", + "To be removed after Cantera 2.3."); *this = r; } RootFind& RootFind::operator=(const RootFind& right) { + warn_deprecated("RootFind assignment operator", + "To be removed after Cantera 2.3."); if (this == &right) { return *this; } diff --git a/src/thermo/MultiSpeciesThermo.cpp b/src/thermo/MultiSpeciesThermo.cpp index 6c74bbebe..8d2a66b05 100644 --- a/src/thermo/MultiSpeciesThermo.cpp +++ b/src/thermo/MultiSpeciesThermo.cpp @@ -28,6 +28,8 @@ MultiSpeciesThermo::MultiSpeciesThermo(const MultiSpeciesThermo& b) : m_thigh_min(b.m_thigh_min), m_p0(b.m_p0) { + warn_deprecated("MultiSpeciesThermo copy constructor", + "To be removed after Cantera 2.3"); m_sp.clear(); // Copy SpeciesThermoInterpTypes from 'b' for (const auto& sp : b.m_sp) { @@ -43,6 +45,8 @@ MultiSpeciesThermo::MultiSpeciesThermo(const MultiSpeciesThermo& b) : MultiSpeciesThermo& MultiSpeciesThermo::operator=(const MultiSpeciesThermo& b) { + warn_deprecated("MultiSpeciesThermo assignment operator", + "To be removed after Cantera 2.3"); if (&b == this) { return *this; } diff --git a/src/thermo/PDSS.cpp b/src/thermo/PDSS.cpp index b05c38f66..0d65f74fd 100644 --- a/src/thermo/PDSS.cpp +++ b/src/thermo/PDSS.cpp @@ -94,6 +94,8 @@ PDSS::PDSS(const PDSS& b) : m_gss_RT_ptr(b.m_gss_RT_ptr), m_Vss_ptr(b.m_Vss_ptr) { + warn_deprecated("PDSS copy constructor", "To be removed after" + " Cantera 2.3 for all classes derived from PDSS."); // Use the assignment operator to do the brunt of the work for the copy // constructor. *this = b; @@ -101,6 +103,8 @@ PDSS::PDSS(const PDSS& b) : PDSS& PDSS::operator=(const PDSS& b) { + warn_deprecated("PDSS assignment operator", "To be removed after" + " Cantera 2.3 for all classes derived from PDSS."); if (&b == this) { return *this; } @@ -150,6 +154,8 @@ PDSS& PDSS::operator=(const PDSS& b) PDSS* PDSS::duplMyselfAsPDSS() const { + warn_deprecated("PDSS::duplMyselfAsPDSS", + "To be removed after Cantera 2.3."); return new PDSS(*this); } @@ -179,6 +185,8 @@ void PDSS::initThermo() void PDSS::initAllPtrs(VPStandardStateTP* tp, VPSSMgr* vpssmgr_ptr, MultiSpeciesThermo* spthermo) { + warn_deprecated("PDSS::initAllPtrs", "To be removed after Cantera 2.3 " + "for all classes derived from PDSS."); m_tp = tp; m_vpssmgr_ptr = vpssmgr_ptr; m_spthermo = spthermo; diff --git a/src/thermo/Species.cpp b/src/thermo/Species.cpp index 82a9847a3..acdaca7f1 100644 --- a/src/thermo/Species.cpp +++ b/src/thermo/Species.cpp @@ -36,6 +36,8 @@ Species::Species(const Species& other) , size(other.size) , transport(other.transport) { + warn_deprecated("Species copy constructor", + "To be removed after Cantera 2.3."); if (other.thermo) { thermo.reset(other.thermo->duplMyselfAsSpeciesThermoInterpType()); } @@ -43,6 +45,8 @@ Species::Species(const Species& other) Species& Species::operator=(const Species& other) { + warn_deprecated("Species assignment operator", + "To be removed after Cantera 2.3."); if (this == &other) { return *this; } diff --git a/src/thermo/SpeciesThermoInterpType.cpp b/src/thermo/SpeciesThermoInterpType.cpp index 50ca29e8d..ee5d2df7a 100644 --- a/src/thermo/SpeciesThermoInterpType.cpp +++ b/src/thermo/SpeciesThermoInterpType.cpp @@ -31,6 +31,20 @@ SpeciesThermoInterpType::SpeciesThermoInterpType(const SpeciesThermoInterpType & m_highT(b.m_highT), m_Pref(b.m_Pref) { + warn_deprecated("SpeciesThermoInterpType copy constructor", + "To be removed after Cantera 2.3."); +} + +SpeciesThermoInterpType& SpeciesThermoInterpType::operator=(const SpeciesThermoInterpType& b) +{ + warn_deprecated("SpeciesThermoInterpType assignment operator", + "To be removed after Cantera 2.3."); + if (&b != this) { + m_lowT = b.m_lowT; + m_highT = b.m_highT; + m_Pref = b.m_Pref; + } + return *this; } void SpeciesThermoInterpType::updateProperties(const doublereal* tempPoly, diff --git a/src/thermo/ThermoPhase.cpp b/src/thermo/ThermoPhase.cpp index 8da3ac243..d8a681cbd 100644 --- a/src/thermo/ThermoPhase.cpp +++ b/src/thermo/ThermoPhase.cpp @@ -49,12 +49,16 @@ ThermoPhase::ThermoPhase(const ThermoPhase& right) : m_chargeNeutralityNecessary(false), m_ssConvention(cSS_CONVENTION_TEMPERATURE) { + warn_deprecated("ThermoPhase copy constructor", "To be removed after" + " Cantera 2.3 for all classes derived from ThermoPhase."); // Call the assignment operator *this = right; } ThermoPhase& ThermoPhase::operator=(const ThermoPhase& right) { + warn_deprecated("ThermoPhase assignment operator", "To be removed after" + " Cantera 2.3 for all classes derived from ThermoPhase."); // Check for self assignment. if (this == &right) { return *this; @@ -90,6 +94,8 @@ ThermoPhase& ThermoPhase::operator=(const ThermoPhase& right) ThermoPhase* ThermoPhase::duplMyselfAsThermoPhase() const { + warn_deprecated("ThermoPhase::duplMyselfAsThermoPhase", + "To be removed after Cantera 2.3."); return new ThermoPhase(*this); } diff --git a/src/thermo/VPSSMgr.cpp b/src/thermo/VPSSMgr.cpp index 8c961c548..4f95137e3 100644 --- a/src/thermo/VPSSMgr.cpp +++ b/src/thermo/VPSSMgr.cpp @@ -54,11 +54,15 @@ VPSSMgr::VPSSMgr(const VPSSMgr& right) : m_useTmpRefStateStorage(false), m_useTmpStandardStateStorage(false) { + warn_deprecated("VPSSMgr copy constructor", "To be removed after" + " Cantera 2.3 for all classes derived from VPSSMgr."); *this = right; } VPSSMgr& VPSSMgr::operator=(const VPSSMgr& right) { + warn_deprecated("VPSSMgr assignment operator", "To be removed after" + " Cantera 2.3 for all classes derived from VPSSMgr."); if (&right == this) { return *this; } @@ -111,12 +115,16 @@ VPSSMgr& VPSSMgr::operator=(const VPSSMgr& right) VPSSMgr* VPSSMgr::duplMyselfAsVPSSMgr() const { + warn_deprecated("VPSSMgr::duplMyselfAsVPSSMgr", "To be removed after" + " Cantera 2.3 for all classes derived from VPSSMgr."); return new VPSSMgr(*this); } void VPSSMgr::initAllPtrs(VPStandardStateTP* vp_ptr, MultiSpeciesThermo* sp_ptr) { + warn_deprecated("VPSSMgr::initAllPtrs", "To be removed after Cantera 2.3 " + "for all classes derived from VPSSMgr."); m_vptp_ptr = vp_ptr; m_spthermo = sp_ptr; diff --git a/src/transport/TransportBase.cpp b/src/transport/TransportBase.cpp index d862611c2..bed4377ca 100644 --- a/src/transport/TransportBase.cpp +++ b/src/transport/TransportBase.cpp @@ -19,6 +19,8 @@ Transport::Transport(thermo_t* thermo, size_t ndim) : Transport::Transport(const Transport& right) { + warn_deprecated("Transport copy constructor", "To be removed after" + " Cantera 2.3 for all classes derived from Transport."); m_thermo = right.m_thermo; m_ready = right.m_ready; m_nsp = right.m_nsp; @@ -28,6 +30,8 @@ Transport::Transport(const Transport& right) Transport& Transport::operator=(const Transport& right) { + warn_deprecated("Transport assignment operator", "To be removed after" + " Cantera 2.3 for all classes derived from Transport."); if (&right != this) { return *this; } @@ -41,6 +45,8 @@ Transport& Transport::operator=(const Transport& right) Transport* Transport::duplMyselfAsTransport() const { + warn_deprecated("Transport::duplMyselfAsTransport", + "To be removed after Cantera 2.3."); return new Transport(*this); } diff --git a/test/thermo/nasapoly.cpp b/test/thermo/nasapoly.cpp index e71b9e726..89c2f5bb3 100644 --- a/test/thermo/nasapoly.cpp +++ b/test/thermo/nasapoly.cpp @@ -58,20 +58,6 @@ TEST_F(NasaPoly1Test, Initialization) EXPECT_EQ(poly.refPressure(), 101325.0); } -TEST_F(NasaPoly1Test, Copy) -{ - NasaPoly1 q(poly); - testEquivalent(poly, q); -} - -TEST_F(NasaPoly1Test, Assignment) -{ - double c[] = {1, 2, 3, 4 ,5 ,6, 7}; - NasaPoly1 q(0, 0, 0, c); - q = poly; - testEquivalent(poly, q); -} - TEST_F(NasaPoly1Test, updateProperties) { double cp_R, h_RT, s_R; diff --git a/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp b/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp index d3bbe3b12..e23786252 100644 --- a/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp +++ b/test_problems/cathermo/HMW_dupl_test/HMW_dupl_test.cpp @@ -14,6 +14,7 @@ using namespace Cantera; int main(int argc, char** argv) { + suppress_deprecation_warnings(); int retn = 0; size_t i;