Skip to content

Commit

Permalink
Deprecate unused methods of class Transport
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Mar 14, 2023
1 parent 2657886 commit 9224025
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
15 changes: 14 additions & 1 deletion include/cantera/transport/Transport.h
Expand Up @@ -146,9 +146,12 @@ class Transport
* @param thermo Pointer to the ThermoPhase class representing this phase.
* @param ndim Dimension of the flux vector used in the calculation.
*
* @deprecated The `thermo` and `ndim` parameters will be removed after Cantera 3.0.
* The ThermoPhase object should be specifed when calling the `init` method.
*
* @see TransportFactory
*/
Transport(ThermoPhase* thermo=0, size_t ndim = 1);
Transport(ThermoPhase* thermo=0, size_t ndim=npos);

virtual ~Transport() {}

Expand Down Expand Up @@ -184,16 +187,19 @@ class Transport

/*!
* Returns true if the transport manager is ready for use.
* @deprecated To be removed after Cantera 3.0.
*/
bool ready();

//! Set the number of dimensions to be expected in flux expressions
/*!
* @param ndim Number of dimensions in flux expressions
* @deprecated Unused. To be removed after Cantera 3.0.
*/
void setNDim(const int ndim);

//! Return the number of dimensions in flux expressions
//! @deprecated Unused. To be removed after Cantera 3.0.
size_t nDim() const {
return m_nDim;
}
Expand Down Expand Up @@ -753,10 +759,13 @@ class Transport
*
* @param thermo Reference to the ThermoPhase object that the transport
* object will use
* @deprecated To be removed after Cantera 3.0. The ThermoPhase object should be
* set as part of the call to `init`.
*/
virtual void setThermo(ThermoPhase& thermo);

//! Set root Solution holding all phase information
//! @deprecated Unused. To be removed after Cantera 3.0.
virtual void setRoot(std::shared_ptr<Solution> root);

//! Boolean indicating the form of the transport properties polynomial fits.
Expand All @@ -772,6 +781,7 @@ class Transport
* Once finalize() has been called, the transport manager should be ready to
* compute any supported transport property, and no further modifications to
* the model parameters should be made.
* @deprecated To be removed after Cantera 3.0.
*/
void finalize();

Expand All @@ -781,19 +791,22 @@ class Transport
ThermoPhase* m_thermo;

//! true if finalize has been called
//! @deprecated To be removed after Cantera 3.0
bool m_ready = false;

//! Number of species
size_t m_nsp = 0;

//! Number of dimensions used in flux expressions
//! @deprecated To be removed after Cantera 3.0
size_t m_nDim;

//! Velocity basis from which diffusion velocities are computed.
//! Defaults to the mass averaged basis = -2
int m_velocityBasis = VB_MASSAVG;

//! reference to Solution
//! @deprecated To be removed after Cantera 3.0
std::weak_ptr<Solution> m_root;
};

Expand Down
5 changes: 4 additions & 1 deletion include/cantera/transport/WaterTransport.h
Expand Up @@ -25,8 +25,11 @@ class WaterTransport : public Transport
* Defaults to zero
* @param ndim Number of dimensions of the flux expressions.
* Defaults to a value of one.
*
* @deprecated The `thermo` and `ndim` parameters will be removed after Cantera 3.0.
* The ThermoPhase object should be specifed when calling the `init` method.
*/
WaterTransport(ThermoPhase* thermo = 0, int ndim = 1);
WaterTransport(ThermoPhase* thermo = 0, int ndim = -1);

virtual std::string transportModel() const {
return "Water";
Expand Down
16 changes: 16 additions & 0 deletions src/transport/Transport.cpp
Expand Up @@ -16,15 +16,28 @@ Transport::Transport(ThermoPhase* thermo, size_t ndim) :
m_thermo(thermo),
m_nDim(ndim)
{
if (thermo != nullptr) {
warn_deprecated("Transport::Transport", "Specifying the ThermoPhase object "
"in the Transport constructor is deprecated and will be removed after "
"Cantera 3.0");
}
if (ndim != npos) {
warn_deprecated("Transport::Transport", "The 'ndim' argument to the Transport "
"constructor is deprecated and will be removed after Cantera 3.0");
} else {
m_nDim = 1;
}
}

bool Transport::ready()
{
warn_deprecated("Transport::ready", "To be removed after Cantera 3.0");
return m_ready;
}

void Transport::setNDim(const int ndim)
{
warn_deprecated("Transport::setNDim", "To be removed after Cantera 3.0");
m_nDim = ndim;
}

Expand Down Expand Up @@ -54,6 +67,7 @@ AnyMap Transport::parameters() const

void Transport::setThermo(ThermoPhase& thermo)
{
warn_deprecated("Transport::setThermo", "To be removed after Cantera 3.0");
if (!ready()) {
m_thermo = &thermo;
m_nsp = m_thermo->nSpecies();
Expand All @@ -80,11 +94,13 @@ void Transport::setThermo(ThermoPhase& thermo)

void Transport::setRoot(std::shared_ptr<Solution> root)
{
warn_deprecated("Transport::setRoot", "To be removed after Cantera 3.0");
m_root = root;
}

void Transport::finalize()
{
warn_deprecated("Transport::finalize", "To be removed after Cantera 3.0");
if (!ready()) {
m_ready = true;
} else {
Expand Down

0 comments on commit 9224025

Please sign in to comment.