Copy k_ij matrix in one shot

This commit is contained in:
Ian Bell
2016-08-21 13:15:44 -06:00
parent 3e9ca1fbf4
commit bb15763f60
2 changed files with 5 additions and 7 deletions

View File

@@ -460,13 +460,7 @@ double CoolProp::AbstractCubicBackend::get_binary_interaction_double(const std::
};
void CoolProp::AbstractCubicBackend::copy_k(AbstractCubicBackend *donor){
std::size_t N = mole_fractions.size();
for (std::size_t i = 0; i < N; ++i){
for (std::size_t j = i+1; j < N; ++j){
double val = donor->get_binary_interaction_double(i, j, "kij");
this->set_binary_interaction_double(i, j, "kij", val);
}
}
get_cubic()->set_kmat(donor->get_cubic()->get_kmat());
for (std::vector<shared_ptr<HelmholtzEOSMixtureBackend> >::iterator it = linked_states.begin(); it != linked_states.end(); ++it) {
AbstractCubicBackend *ACB = static_cast<AbstractCubicBackend *>(it->get());
ACB->copy_k(this);

View File

@@ -60,6 +60,10 @@ public:
/// If no Mathias-Copeman coefficients are passed in (all empty vectors), use the predictive scheme for m_ii
simple_aii = (C1.empty() && C2.empty() && C3.empty() && L_Twu.empty() && M_Twu.empty() && N_Twu.empty());
};
/// Get the entire kij matrix in one shot
const std::vector< std::vector<double> > & get_kmat(){return k;};
/// Set the entire kij matrix in one shot
void set_kmat(const std::vector< std::vector<double> > &k){ this->k = k; };
/// Set the kij factor for the ij pair
void set_kij(std::size_t i, std::size_t j, double val){ k[i][j] = val; k[j][i] = val;}
/// Get the kij factor for the ij pair