diff --git a/include/cantera/thermo/Phase.h b/include/cantera/thermo/Phase.h index 04d8ddf234..fb9be33c29 100644 --- a/include/cantera/thermo/Phase.h +++ b/include/cantera/thermo/Phase.h @@ -477,22 +477,9 @@ class Phase //! units = kg / kmol const vector_fp& molecularWeights() const; - //! Charge of species \c k. - //! @param k index of species \c k - //! @returns the charge of species \c k. - doublereal speciesCharge(size_t k) const; - - //! Copy the vector of species charges into vector charges. - //! @param charges Output vector of species charges (-) - void getSpeciesCharges(vector_fp& charges) const; - - //! Copy the vector of species charges into array weights. - //! @param weights Output array of species charges (-) - void getSpeciesCharges(doublereal* charges) const; - - //! Return a const reference to the internal vector of molecular weights. - //! units = (-) - const vector_fp& speciesCharges() const; + //! Copy the vector of species charges into array charges. + //! @param charges Output array of species charges (elem. charge) + const vector_fp& getSpeciesCharges(double* charges) const; /// @name Composition //@{ diff --git a/src/clib/ct.cpp b/src/clib/ct.cpp index 57ed446d50..3495ae6d27 100644 --- a/src/clib/ct.cpp +++ b/src/clib/ct.cpp @@ -289,8 +289,7 @@ extern "C" { try { ThermoPhase& p = ThermoCabinet::item(n); p.checkSpeciesArraySize(lenm); - const vector_fp& ch = p.speciesCharges(); - copy(ch.begin(), ch.end(), sc); + const vector_fp& ch = p.getSpeciesCharges(sc); return 0; } catch (...) { return handleAllExceptions(-1, ERR); diff --git a/src/thermo/Phase.cpp b/src/thermo/Phase.cpp index ad47b6fd0f..8be20df180 100644 --- a/src/thermo/Phase.cpp +++ b/src/thermo/Phase.cpp @@ -559,25 +559,10 @@ const vector_fp& Phase::molecularWeights() const return m_molwts; } -doublereal Phase::speciesCharge(size_t k) const -{ - checkSpeciesIndex(k); - return m_speciesCharge[k]; -} - -void Phase::getSpeciesCharges(vector_fp& charges) const -{ - charges = speciesCharges(); -} - -void Phase::getSpeciesCharges(doublereal* charges) const -{ - const vector_fp& sc = speciesCharges(); - copy(sc.begin(), sc.end(), charges); -} - -const vector_fp& Phase::speciesCharges() const +const vector_fp& Phase::getSpeciesCharges(double* charges) const { + const vector_fp& ch = m_speciesCharge; + copy(ch.begin(), ch.end(), charges); return m_speciesCharge; }