Fixed a memory leak.
The gastran object is now officially owned by the dusty gas tran object.
This commit is contained in:
parent
aa623afbd3
commit
b80d34b66e
3 changed files with 20 additions and 9 deletions
|
|
@ -114,14 +114,19 @@ namespace Cantera {
|
|||
m_diam = right.m_diam;
|
||||
m_perm = right.m_perm;
|
||||
|
||||
// Warning -> This is a shallow pointer copy. gastran may not point to the correct object
|
||||
// Warning -> gastran may not point to the correct object
|
||||
// after this copy. The routine initialize() must be called
|
||||
m_gastran = right.m_gastran;
|
||||
if (m_gastran) {
|
||||
delete m_gastran;
|
||||
}
|
||||
m_gastran = right.duplMyselfAsTransport();
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
//====================================================================================================================
|
||||
DustyGasTransport::~DustyGasTransport() {
|
||||
delete m_gastran;
|
||||
}
|
||||
//====================================================================================================================
|
||||
// Duplication routine for objects which inherit from %Transport
|
||||
|
|
@ -182,7 +187,12 @@ namespace Cantera {
|
|||
// constant mixture attributes
|
||||
m_thermo = phase;
|
||||
m_nsp = m_thermo->nSpecies();
|
||||
m_gastran = gastr;
|
||||
if (m_gastran != gastr) {
|
||||
if (m_gastran) {
|
||||
delete m_gastran;
|
||||
}
|
||||
m_gastran = gastr;
|
||||
}
|
||||
|
||||
// make a local copy of the molecular weights
|
||||
m_mw.resize(m_nsp);
|
||||
|
|
|
|||
|
|
@ -378,6 +378,9 @@ namespace Cantera {
|
|||
doublereal m_perm;
|
||||
|
||||
//! Pointer to the transport object for the gas phase
|
||||
/*!
|
||||
* Note, this object owns the gastran object
|
||||
*/
|
||||
Transport* m_gastran;
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -746,10 +746,9 @@ namespace Cantera {
|
|||
|
||||
//! Set model parameters for derived classes
|
||||
/*!
|
||||
* This method may be
|
||||
* overloaded in subclasses to set model-specific parameters.
|
||||
* The primary use of this class is to set parameters while in the
|
||||
* middle of a calculation.
|
||||
* This method may be derived in subclasses to set model-specific parameters.
|
||||
* The primary use of this class is to set parameters while in the middle of a calculation
|
||||
* without actually having to dynamically cast the base Transport pointer.
|
||||
*
|
||||
* @param type Specifies the type of parameters to set
|
||||
* 0 : Diffusion coefficient
|
||||
|
|
@ -759,8 +758,7 @@ namespace Cantera {
|
|||
* @param p Vector of parameters. The length of the vector
|
||||
* varies with the parameterization
|
||||
*/
|
||||
virtual void setParameters(const int type, const int k,
|
||||
const doublereal* const p);
|
||||
virtual void setParameters(const int type, const int k, const doublereal* const p);
|
||||
|
||||
//! Sets the velocity basis
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue