mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-01-22 20:38:01 -05:00
Fix CAS parsing for REFPROP strings
This commit is contained in:
@@ -341,17 +341,22 @@ std::string REFPROPMixtureBackend::fluid_param_string(const std::string &ParamNa
|
||||
// c hnam--component name [character*12]
|
||||
// c hn80--component name--long form [character*80]
|
||||
// c hcasn--CAS (Chemical Abstracts Service) number [character*12]
|
||||
long icomp = 1L;
|
||||
char hnam[13], hn80[81], hcasn[13];
|
||||
NAMEdll(&icomp, hnam, hn80, hcasn, 12, 80, 12);
|
||||
std::string casn = hcasn;
|
||||
strstrip(casn);
|
||||
return casn;
|
||||
std::vector<std::string> CASvec;
|
||||
for (long icomp = 1L; icomp <= fluid_names.size(); ++icomp){
|
||||
char hnam[13], hn80[81], hcasn[13];
|
||||
NAMEdll(&icomp, hnam, hn80, hcasn, 12, 80, 12);
|
||||
hcasn[12]='\0';
|
||||
std::string casn = hcasn;
|
||||
strstrip(casn);
|
||||
CASvec.push_back(casn);
|
||||
}
|
||||
return strjoin(CASvec, "&");
|
||||
}
|
||||
else if (ParamName == "name"){
|
||||
long icomp = 1L;
|
||||
char hnam[13], hn80[81], hcasn[13];
|
||||
NAMEdll(&icomp, hnam, hn80, hcasn, 12, 80, 12);
|
||||
hnam[12] = '\0';
|
||||
std::string name = hnam;
|
||||
strstrip(name);
|
||||
return name;
|
||||
@@ -360,6 +365,7 @@ std::string REFPROPMixtureBackend::fluid_param_string(const std::string &ParamNa
|
||||
long icomp = 1L;
|
||||
char hnam[13], hn80[81], hcasn[13];
|
||||
NAMEdll(&icomp, hnam, hn80, hcasn, 12, 80, 12);
|
||||
hn80[80] = '\0';
|
||||
std::string n80 = hn80;
|
||||
strstrip(n80);
|
||||
return n80;
|
||||
@@ -372,6 +378,7 @@ long REFPROPMixtureBackend::match_CAS(const std::string &CAS){
|
||||
for (long icomp = 1L; icomp <= static_cast<long>(fluid_names.size()); ++icomp){
|
||||
char hnam[13], hn80[81], hcasn[13];
|
||||
NAMEdll(&icomp, hnam, hn80, hcasn, 12, 80, 12);
|
||||
hcasn[12] = '\0';
|
||||
std::string casn = hcasn;
|
||||
strstrip(casn);
|
||||
if (casn == CAS){
|
||||
|
||||
Reference in New Issue
Block a user