Changed the method model() to be a const function.

Moved Transport methods back into the file TransportBase.cpp
Defined err() functions for LiquidTransport object so that
the code will link again.
This commit is contained in:
Harry Moffat 2009-09-28 16:09:58 +00:00
parent fd245bb194
commit 431f167c0f
11 changed files with 58 additions and 35 deletions

View file

@ -135,7 +135,7 @@ namespace Cantera {
virtual ~AqueousTransport() {}
//! Return the model id for this transport parameterization
virtual int model() { return cAqueousTransport; }
virtual int model() const { return cAqueousTransport; }
//! overloaded base class methods

View file

@ -40,7 +40,7 @@ namespace Cantera {
//---------------------------------------------------------
// overloaded base class methods
virtual int model() { return cDustyGasTransport; }
virtual int model() const { return cDustyGasTransport; }
virtual void setParameters(const int type, const int k, const doublereal* const p);

View file

@ -926,4 +926,20 @@ namespace Cantera {
}
}
}
/**
* Throw an exception if this method is invoked.
* This probably indicates something is not yet implemented.
*/
doublereal LiquidTransport::err(std::string msg) const {
throw CanteraError("Liquid Transport 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;
}
}

View file

@ -193,7 +193,7 @@ namespace Cantera {
//! Return the model id for this transport parameterization
virtual int model() {
virtual int model() const {
return cLiquidTransport;
}

View file

@ -51,7 +51,7 @@ namespace Cantera {
virtual ~MixTransport() {}
virtual int model() { return cMixtureAveraged; }
virtual int model() const { return cMixtureAveraged; }
//! Viscosity of the mixture
/*!

View file

@ -85,7 +85,7 @@ namespace Cantera {
virtual ~MultiTransport();
// overloaded base class methods
virtual int model() {
virtual int model() const {
if (m_mode == CK_Mode)
return CK_Multicomponent;
else

View file

@ -46,7 +46,7 @@ namespace Cantera {
public:
virtual ~SolidTransport() {}
virtual int model() { return cSolidTransport; }
virtual int model() const { return cSolidTransport; }
virtual doublereal thermalConductivity();
virtual void getMixDiffCoeffs(doublereal* const d);

View file

@ -9,10 +9,12 @@
#include "ThermoPhase.h"
#include "LiquidTransport.h"
#include "ctexceptions.h"
#include "utilities.h"
#include "LiquidTransportParams.h"
#include "TransportFactory.h"
#include "stringUtils.h"
#include "ctlapack.h"
@ -31,8 +33,6 @@ namespace Cantera {
//////////////////// class LiquidTransport methods //////////////
Transport::Transport(thermo_t* thermo, int ndim) :
m_thermo(thermo),
m_ready(false),
@ -109,5 +109,37 @@ namespace Cantera {
{
err("setParameters");
}
void Transport::setThermo(thermo_t& thermo) {
if (!ready()) {
m_thermo = &thermo;
m_nmin = m_thermo->nSpecies();
}
else
throw CanteraError("Transport::setThermo",
"the phase object cannot be changed after "
"the transport manager has been constructed.");
}
doublereal Transport::err(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())
m_ready = true;
else
throw CanteraError("Transport::finalize",
"finalize has already been called.");
}
}

View file

@ -109,7 +109,7 @@ namespace Cantera {
* virtual method returns an integer flag that identifies the
* transport model implemented. The base class returns 0.
*/
virtual int model() {return 0;}
virtual int model() const {return 0;}
/**
* Phase object. Every transport manager is designed to compute

View file

@ -95,31 +95,6 @@ namespace Cantera {
#endif
};
//////////////////// class Transport methods /////////////////////
void Transport::setThermo(thermo_t& thermo) {
if (!ready()) {
m_thermo = &thermo;
m_nmin = m_thermo->nSpecies();
}
else
throw CanteraError("Transport::setThermo",
"the phase object cannot be changed after "
"the transport manager has been constructed.");
}
void Transport::finalize() {
if (!ready())
m_ready = true;
else
throw CanteraError("Transport::finalize",
"finalize has already been called.");
}
doublereal Transport::err(string msg) const {
throw NotImplemented(msg);
//return 0.0;
}
//////////////////// class TransportFactory methods //////////////

View file

@ -81,7 +81,7 @@ namespace Cantera {
virtual ~WaterTransport();
//! Return the model id for this transport parameterization
virtual int model() {
virtual int model() const {
return cWaterTransport;
}