Skip to content

Commit

Permalink
Implemented change requests from PR #863
Browse files Browse the repository at this point in the history
Change requests were made for Phase.cpp, ct.cpp, and Phase.h.
These were mostly simplification changes to streamline the code.
  • Loading branch information
[korffdm] authored and speth committed Jun 19, 2020
1 parent ec389f0 commit 8306d08
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 36 deletions.
19 changes: 3 additions & 16 deletions include/cantera/thermo/Phase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//@{
Expand Down
3 changes: 1 addition & 2 deletions src/clib/ct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
21 changes: 3 additions & 18 deletions src/thermo/Phase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8306d08

Please sign in to comment.