コード例 #1
0
ファイル: WaterTransport.cpp プロジェクト: athlonshi/cantera
// Routine to do some common initializations at the start of using
// this routine.
void WaterTransport::initTP()
{
    // The expectation is that we have a VPStandardStateTP derived object
    VPStandardStateTP* vpthermo = dynamic_cast<VPStandardStateTP*>(m_thermo);
    if (!vpthermo) {

        WaterSSTP* wsstp = dynamic_cast<WaterSSTP*>(m_thermo);
        if (!wsstp) {
            throw CanteraError("WaterTransport::initTP()",
                               "Expectation is that ThermoPhase be a VPStandardStateTP");
        } else {

            m_sub = wsstp->getWater();
            AssertTrace(m_sub != 0);
            // Get a pointer to a changeable WaterProps object
            m_waterProps = wsstp->getWaterProps();
            AssertTrace(m_waterProps != 0);
        }
    } else {
        m_waterPDSS = dynamic_cast<PDSS_Water*>(vpthermo->providePDSS(0));
        if (!m_waterPDSS) {
            throw CanteraError("WaterTransport::initTP()",
                               "Expectation is that first species be water with a PDSS_Water object");
        }
        // Get a pointer to a changeable WaterPropsIAPWS object
        m_sub = m_waterPDSS->getWater();
        AssertTrace(m_sub != 0);
        // Get a pointer to a changeable WaterProps object
        m_waterProps = m_waterPDSS->getWaterProps();
        AssertTrace(m_waterProps != 0);
    }
}