diff --git a/include/cantera/thermo/VPSSMgr_Water_HKFT.h b/include/cantera/thermo/VPSSMgr_Water_HKFT.h index 570282940..c5a7ee156 100644 --- a/include/cantera/thermo/VPSSMgr_Water_HKFT.h +++ b/include/cantera/thermo/VPSSMgr_Water_HKFT.h @@ -120,6 +120,16 @@ public: const XML_Node* const phaseNode_ptr); //@} + //! Initialize the internal shallow pointers in this object + /*! + * There are a bunch of internal shallow pointers that point to the owning + * VPStandardStateTP and SpeciesThermo objects. This function reinitializes + * them. This function is called like an onion. + * + * @param vp_ptr Pointer to the VPStandardStateTP standard state + * @param sp_ptr Pointer to the SpeciesThermo standard state + */ + virtual void initAllPtrs(VPStandardStateTP* vp_ptr, SpeciesThermo* sp_ptr); private: //! Shallow pointer to the water object PDSS_Water* m_waterSS; diff --git a/src/thermo/MetalSHEelectrons.cpp b/src/thermo/MetalSHEelectrons.cpp index 23323d163..b6e011a91 100644 --- a/src/thermo/MetalSHEelectrons.cpp +++ b/src/thermo/MetalSHEelectrons.cpp @@ -81,7 +81,8 @@ MetalSHEelectrons::MetalSHEelectrons(XML_Node& xmlphase, const std::string& id_) } MetalSHEelectrons::MetalSHEelectrons(const MetalSHEelectrons& right) : - SingleSpeciesTP() + SingleSpeciesTP(), + xdef_(0) { operator=(right); } @@ -99,7 +100,10 @@ MetalSHEelectrons::operator=(const MetalSHEelectrons& right) } delete xdef_; - xdef_ = new XML_Node(*right.xdef_); + if(right.xdef_) + { + xdef_ = new XML_Node(*right.xdef_); + } return *this; } diff --git a/src/thermo/VPSSMgr_Water_HKFT.cpp b/src/thermo/VPSSMgr_Water_HKFT.cpp index 361ef6815..6f46a3493 100644 --- a/src/thermo/VPSSMgr_Water_HKFT.cpp +++ b/src/thermo/VPSSMgr_Water_HKFT.cpp @@ -299,6 +299,18 @@ VPSSMgr_Water_HKFT::createInstallPDSS(size_t k, const XML_Node& speciesNode, return kPDSS; } +void +VPSSMgr_Water_HKFT::initAllPtrs(VPStandardStateTP* vp_ptr, + SpeciesThermo* sp_ptr) +{ + VPSSMgr::initAllPtrs(vp_ptr, sp_ptr); + m_waterSS = dynamic_cast(m_vptp_ptr->providePDSS(0)); + if (!m_waterSS) { + throw CanteraError("VPSSMgr_Water_ConstVol::initAllPtrs", + "bad dynamic cast"); + } +} + PDSS_enumType VPSSMgr_Water_HKFT::reportPDSSType(int k) const { return cPDSS_UNDEF;