diff --git a/src/clib/Cabinet.h b/src/clib/Cabinet.h index 3e0d0e256d..29957a1016 100644 --- a/src/clib/Cabinet.h +++ b/src/clib/Cabinet.h @@ -180,18 +180,6 @@ class SharedCabinet throw CanteraError("SharedCabinet::as", "Item is not of the correct type."); } - /** - * Return a reference to object n, cast to a reference of the specified type. - */ - template - static T& get(int n) { - auto obj = std::dynamic_pointer_cast(at(n)); - if (obj) { - return *obj; - } - throw CanteraError("SharedCabinet::get", "Item is not of the correct type."); - } - /** * Return the index in the SharedCabinet to the specified object, or -1 if the * object is not in the SharedCabinet. If multiple indices reference the same diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index 89b2670ad8..60c6a0948e 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -1075,7 +1075,7 @@ extern "C" { double thermo_vaporFraction(int n) { try { - return ThermoCabinet::get(n).vaporFraction(); + return ThermoCabinet::as(n)->vaporFraction(); } catch (...) { return handleAllExceptions(DERR, DERR); } @@ -1102,7 +1102,7 @@ extern "C" { int thermo_setState_Psat(int n, double p, double x) { try { - ThermoCabinet::get(n).setState_Psat(p, x); + ThermoCabinet::as(n)->setState_Psat(p, x); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -1112,7 +1112,7 @@ extern "C" { int thermo_setState_Tsat(int n, double t, double x) { try { - ThermoCabinet::get(n).setState_Tsat(t, x); + ThermoCabinet::as(n)->setState_Tsat(t, x); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -1459,7 +1459,7 @@ extern "C" { int kin_advanceCoverages(int n, double tstep) { try { - KineticsCabinet::get(n).advanceCoverages(tstep); + KineticsCabinet::as(n)->advanceCoverages(tstep); return 0; } catch (...) { return handleAllExceptions(-1, ERR); diff --git a/src/clib/ctonedim.cpp b/src/clib/ctonedim.cpp index fd5cc0c657..5da90015bd 100644 --- a/src/clib/ctonedim.cpp +++ b/src/clib/ctonedim.cpp @@ -298,7 +298,7 @@ extern "C" { double bdry_massFraction(int i, int k) { try { - return DomainCabinet::get(i).massFraction(k); + return DomainCabinet::as(i)->massFraction(k); } catch (...) { return handleAllExceptions(DERR, DERR); } @@ -307,7 +307,7 @@ extern "C" { double bdry_mdot(int i) { try { - return DomainCabinet::get(i).mdot(); + return DomainCabinet::as(i)->mdot(); } catch (...) { return handleAllExceptions(DERR, DERR); } @@ -316,7 +316,7 @@ extern "C" { int reactingsurf_enableCoverageEqs(int i, int onoff) { try { - DomainCabinet::get(i).enableCoverageEquations(onoff != 0); + DomainCabinet::as(i)->enableCoverageEquations(onoff != 0); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -348,7 +348,7 @@ extern "C" { int flow1D_setTransport(int i, int itr) { try { - DomainCabinet::get(i).setTransport(TransportCabinet::at(itr)); + DomainCabinet::as(i)->setTransport(TransportCabinet::at(itr)); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -359,7 +359,7 @@ extern "C" { { try { bool withSoret = (iSoret > 0); - DomainCabinet::get(i).enableSoret(withSoret); + DomainCabinet::as(i)->enableSoret(withSoret); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -369,7 +369,7 @@ extern "C" { int flow1D_setPressure(int i, double p) { try { - DomainCabinet::get(i).setPressure(p); + DomainCabinet::as(i)->setPressure(p); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -379,7 +379,7 @@ extern "C" { double flow1D_pressure(int i) { try { - return DomainCabinet::get(i).pressure(); + return DomainCabinet::as(i)->pressure(); } catch (...) { return handleAllExceptions(DERR, DERR); } @@ -394,7 +394,7 @@ extern "C" { vpos[j] = pos[j]; vtemp[j] = temp[j]; } - DomainCabinet::get(i).setFixedTempProfile(vpos, vtemp); + DomainCabinet::as(i)->setFixedTempProfile(vpos, vtemp); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -405,9 +405,9 @@ extern "C" { { try { if (flag > 0) { - DomainCabinet::get(i).solveEnergyEqn(npos); + DomainCabinet::as(i)->solveEnergyEqn(npos); } else { - DomainCabinet::get(i).fixTemperature(npos); + DomainCabinet::as(i)->fixTemperature(npos); } return 0; } catch (...) { diff --git a/src/clib/ctreactor.cpp b/src/clib/ctreactor.cpp index bb8fbc07e6..7f19fad0cc 100644 --- a/src/clib/ctreactor.cpp +++ b/src/clib/ctreactor.cpp @@ -92,7 +92,7 @@ extern "C" { int reactor_insert(int i, int n) { try { - ReactorCabinet::get(i).insert(SolutionCabinet::at(n)); + ReactorCabinet::as(i)->insert(SolutionCabinet::at(n)); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -174,7 +174,7 @@ extern "C" { int reactor_setChemistry(int i, int cflag) { try { - ReactorCabinet::get(i).setChemistry(cflag != 0); + ReactorCabinet::as(i)->setChemistry(cflag != 0); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -184,7 +184,7 @@ extern "C" { int reactor_setEnergy(int i, int eflag) { try { - ReactorCabinet::get(i).setEnergy(eflag); + ReactorCabinet::as(i)->setEnergy(eflag); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -194,7 +194,7 @@ extern "C" { int reactor_setMassFlowRate(int i, double mdot) { try { - ReactorCabinet::get(i).setMassFlowRate(mdot); + ReactorCabinet::as(i)->setMassFlowRate(mdot); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -204,7 +204,7 @@ extern "C" { size_t reactor_nSensParams(int i) { try { - return ReactorCabinet::get(i).nSensParams(); + return ReactorCabinet::as(i)->nSensParams(); } catch (...) { return handleAllExceptions(npos, npos); } @@ -213,7 +213,7 @@ extern "C" { int reactor_addSensitivityReaction(int i, int rxn) { try { - ReactorCabinet::get(i).addSensitivityReaction(rxn); + ReactorCabinet::as(i)->addSensitivityReaction(rxn); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -386,7 +386,7 @@ extern "C" { int flowdev_setPrimary(int i, int n) { try { - FlowDeviceCabinet::get(i).setPrimary( + FlowDeviceCabinet::as(i)->setPrimary( FlowDeviceCabinet::at(n).get()); return 0; } catch (...) { @@ -406,7 +406,7 @@ extern "C" { int flowdev_setMassFlowCoeff(int i, double v) { try { - FlowDeviceCabinet::get(i).setMassFlowCoeff(v); + FlowDeviceCabinet::as(i)->setMassFlowCoeff(v); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -416,7 +416,7 @@ extern "C" { int flowdev_setValveCoeff(int i, double v) { try { - FlowDeviceCabinet::get(i).setValveCoeff(v); + FlowDeviceCabinet::as(i)->setValveCoeff(v); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -426,7 +426,7 @@ extern "C" { int flowdev_setPressureCoeff(int i, double v) { try { - FlowDeviceCabinet::get(i).setPressureCoeff(v); + FlowDeviceCabinet::as(i)->setPressureCoeff(v); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -525,7 +525,7 @@ extern "C" { int wall_setThermalResistance(int i, double rth) { try { - WallCabinet::get(i).setThermalResistance(rth); + WallCabinet::as(i)->setThermalResistance(rth); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -535,7 +535,7 @@ extern "C" { int wall_setHeatTransferCoeff(int i, double u) { try { - WallCabinet::get(i).setHeatTransferCoeff(u); + WallCabinet::as(i)->setHeatTransferCoeff(u); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -545,7 +545,7 @@ extern "C" { int wall_setHeatFlux(int i, int n) { try { - WallCabinet::get(i).setHeatFlux(FuncCabinet::at(n).get()); + WallCabinet::as(i)->setHeatFlux(FuncCabinet::at(n).get()); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -555,7 +555,7 @@ extern "C" { int wall_setExpansionRateCoeff(int i, double k) { try { - WallCabinet::get(i).setExpansionRateCoeff(k); + WallCabinet::as(i)->setExpansionRateCoeff(k); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -565,7 +565,7 @@ extern "C" { int wall_setVelocity(int i, int n) { try { - WallCabinet::get(i).setVelocity(FuncCabinet::at(n).get()); + WallCabinet::as(i)->setVelocity(FuncCabinet::at(n).get()); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -575,7 +575,7 @@ extern "C" { int wall_setEmissivity(int i, double epsilon) { try { - WallCabinet::get(i).setEmissivity(epsilon); + WallCabinet::as(i)->setEmissivity(epsilon); return 0; } catch (...) { return handleAllExceptions(-1, ERR); diff --git a/src/clib/ctsurf.cpp b/src/clib/ctsurf.cpp index 46d281d82f..11e866c2d8 100644 --- a/src/clib/ctsurf.cpp +++ b/src/clib/ctsurf.cpp @@ -23,7 +23,7 @@ extern "C" { int surf_setSiteDensity(int i, double s0) { try { - ThermoCabinet::get(i).setSiteDensity(s0); + ThermoCabinet::as(i)->setSiteDensity(s0); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -33,7 +33,7 @@ extern "C" { double surf_siteDensity(int i) { try { - return ThermoCabinet::get(i).siteDensity(); + return ThermoCabinet::as(i)->siteDensity(); } catch (...) { return handleAllExceptions(DERR, DERR); } @@ -43,9 +43,9 @@ extern "C" { { try { if(norm){ - ThermoCabinet::get(i).setCoverages(c); + ThermoCabinet::as(i)->setCoverages(c); } else { - ThermoCabinet::get(i).setCoveragesNoNorm(c); + ThermoCabinet::as(i)->setCoveragesNoNorm(c); } return 0; } catch (...) { @@ -56,7 +56,7 @@ extern "C" { int surf_setCoveragesByName(int i, const char* c) { try { - ThermoCabinet::get(i).setCoveragesByName(c); + ThermoCabinet::as(i)->setCoveragesByName(c); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -66,7 +66,7 @@ extern "C" { int surf_getCoverages(int i, double* c) { try { - ThermoCabinet::get(i).getCoverages(c); + ThermoCabinet::as(i)->getCoverages(c); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -76,7 +76,7 @@ extern "C" { int surf_setConcentrations(int i, const double* c) { try { - ThermoCabinet::get(i).setConcentrations(c); + ThermoCabinet::as(i)->setConcentrations(c); return 0; } catch (...) { return handleAllExceptions(-1, ERR); @@ -86,7 +86,7 @@ extern "C" { int surf_getConcentrations(int i, double* c) { try { - ThermoCabinet::get(i).getConcentrations(c); + ThermoCabinet::as(i)->getConcentrations(c); return 0; } catch (...) { return handleAllExceptions(-1, ERR);