vcs_VolPhase: Made more members private

This commit is contained in:
Harry Moffat 2008-07-31 22:33:19 +00:00
parent a04b9570ac
commit 681a4aea6a
4 changed files with 69 additions and 33 deletions

View file

@ -975,7 +975,7 @@ namespace VCSnonideal {
/*
* Tell the vcs_VolPhase pointer about cantera
*/
VolPhase->m_VCS_UnitsFormat = vprob->m_VCS_UnitsFormat;
VolPhase->p_VCS_UnitsFormat = vprob->m_VCS_UnitsFormat;
VolPhase->setPtrThermoPhase(tPhase);
VolPhase->setTotalMoles(0.0);
/*
@ -1127,7 +1127,7 @@ namespace VCSnonideal {
* vprob->SpeciesThermo[]
*/
ts_ptr->UseCanteraCalls = VolPhase->usingCanteraCalls();
ts_ptr->m_VCS_UnitsFormat = VolPhase->m_VCS_UnitsFormat;
ts_ptr->m_VCS_UnitsFormat = VolPhase->p_VCS_UnitsFormat;
/*
* Add lookback connectivity into the thermo object first
*/

View file

@ -48,7 +48,7 @@ namespace VCSnonideal {
m_MFStartIndex(0),
IndSpecies(0),
//IndSpeciesContig(true),
m_VCS_UnitsFormat(VCS_UNITS_MKS),
p_VCS_UnitsFormat(VCS_UNITS_MKS),
m_useCanteraCalls(false),
TP_ptr(0),
v_totalMoles(0.0),
@ -107,7 +107,7 @@ namespace VCSnonideal {
m_isIdealSoln(b.m_isIdealSoln),
m_existence(b.m_existence),
m_MFStartIndex(b.m_MFStartIndex),
m_VCS_UnitsFormat(b.m_VCS_UnitsFormat),
p_VCS_UnitsFormat(b.p_VCS_UnitsFormat),
m_useCanteraCalls(b.m_useCanteraCalls),
TP_ptr(b.TP_ptr),
v_totalMoles(b.v_totalMoles),
@ -158,13 +158,13 @@ namespace VCSnonideal {
ChargeNeutralityElement = b.ChargeNeutralityElement;
ElName.resize(b.m_numElemConstraints);
m_elementNames.resize(b.m_numElemConstraints);
for (int e = 0; e < b.m_numElemConstraints; e++) {
ElName[e] = b.ElName[e];
m_elementNames[e] = b.m_elementNames[e];
}
ElActive = b.ElActive;
m_elType = b.m_elType;
m_elementType = b.m_elementType;
FormulaMatrix.resize(m_numElemConstraints, NVolSpecies, 0.0);
for (int e = 0; e < m_numElemConstraints; e++) {
@ -201,7 +201,7 @@ namespace VCSnonideal {
new vcs_SpeciesProperties(*(b.ListSpeciesPtr[k]));
}
m_VCS_UnitsFormat = b.m_VCS_UnitsFormat;
p_VCS_UnitsFormat = b.p_VCS_UnitsFormat;
m_useCanteraCalls = b.m_useCanteraCalls;
/*
* Do a shallow copy of the ThermoPhase object pointer.
@ -337,13 +337,13 @@ namespace VCSnonideal {
void vcs_VolPhase::elemResize(const int numElemConstraints) {
ElName.resize(numElemConstraints);
m_elementNames.resize(numElemConstraints);
ElActive.resize(numElemConstraints+1, 1);
m_elType.resize(numElemConstraints, VCS_ELEM_TYPE_ABSPOS);
m_elementType.resize(numElemConstraints, VCS_ELEM_TYPE_ABSPOS);
FormulaMatrix.resize(numElemConstraints, NVolSpecies, 0.0);
ElName.resize(numElemConstraints, "");
m_elementNames.resize(numElemConstraints, "");
m_elemGlobalIndex.resize(numElemConstraints, -1);
m_numElemConstraints = numElemConstraints;
@ -392,7 +392,7 @@ namespace VCSnonideal {
if (m_useCanteraCalls) {
TP_ptr->getGibbs_ref(VCS_DATA_PTR(SS0ChemicalPotential));
} else {
double R = vcsUtil_gasConstant(m_VCS_UnitsFormat);
double R = vcsUtil_gasConstant(p_VCS_UnitsFormat);
for (int k = 0; k < NVolSpecies; k++) {
int kglob = IndSpecies[k];
vcs_SpeciesProperties *sProp = ListSpeciesPtr[k];
@ -433,7 +433,7 @@ namespace VCSnonideal {
if (m_useCanteraCalls) {
TP_ptr->getStandardChemPotentials(VCS_DATA_PTR(StarChemicalPotential));
} else {
double R = vcsUtil_gasConstant(m_VCS_UnitsFormat);
double R = vcsUtil_gasConstant(p_VCS_UnitsFormat);
for (int k = 0; k < NVolSpecies; k++) {
int kglob = IndSpecies[k];
vcs_SpeciesProperties *sProp = ListSpeciesPtr[k];
@ -1028,7 +1028,7 @@ namespace VCSnonideal {
Temp = TP_ptr->temperature();
Pres = TP_ptr->pressure();
setState_TP(Temp, Pres);
m_VCS_UnitsFormat = VCS_UNITS_MKS;
p_VCS_UnitsFormat = VCS_UNITS_MKS;
m_phi = TP_ptr->electricPotential();
int nsp = TP_ptr->nSpecies();
int nelem = TP_ptr->nElements();
@ -1333,7 +1333,7 @@ namespace VCSnonideal {
}
std::string vcs_VolPhase::elementName(const int e) const {
return ElName[e];
return m_elementNames[e];
}
/*!
@ -1396,8 +1396,7 @@ namespace VCSnonideal {
if (ChargeNeutralityElement >= 0) {
m_elType[ChargeNeutralityElement] =
VCS_ELEM_TYPE_CHARGENEUTRALITY;
m_elementType[ChargeNeutralityElement] = VCS_ELEM_TYPE_CHARGENEUTRALITY;
}
if (hasChargedSpecies(tPhase)) {
@ -1416,7 +1415,7 @@ namespace VCSnonideal {
if (ename == "E") {
eFound = eT;
ElActive[eT] = 0;
m_elType[eT] = VCS_ELEM_TYPE_ELECTRONCHARGE;
m_elementType[eT] = VCS_ELEM_TYPE_ELECTRONCHARGE;
}
}
} else {
@ -1424,16 +1423,16 @@ namespace VCSnonideal {
ename = tPhase->elementName(eT);
if (ename == "E") {
eFound = eT;
m_elType[eT] = VCS_ELEM_TYPE_ELECTRONCHARGE;
m_elementType[eT] = VCS_ELEM_TYPE_ELECTRONCHARGE;
}
}
}
if (eFound == -2) {
eFound = ne;
m_elType[ne] = VCS_ELEM_TYPE_ELECTRONCHARGE;
m_elementType[ne] = VCS_ELEM_TYPE_ELECTRONCHARGE;
ElActive[ne] = 0;
std::string ename = "E";
ElName[ne] = ename;
m_elementNames[ne] = ename;
ne++;
elemResize(ne);
}
@ -1451,7 +1450,7 @@ namespace VCSnonideal {
e = 0;
for (eT = 0; eT < nebase; eT++) {
ename = tPhase->elementName(eT);
ElName[e] = ename;
m_elementNames[e] = ename;
e++;
}
@ -1464,7 +1463,7 @@ namespace VCSnonideal {
}
ename = "cn_" + pname;
e = ChargeNeutralityElement;
ElName[e] = ename;
m_elementNames[e] = ename;
}
double * const * const fm = FormulaMatrix.baseDataAddr();
@ -1500,5 +1499,22 @@ namespace VCSnonideal {
return ne;
}
// Type of the element constraint with index \c e.
/*
* @param e Element index.
*/
int vcs_VolPhase::elementType(const int e) const {
return m_elementType[e];
}
// Set the element Type of the element constraint with index \c e.
/*
* @param e Element index
* @param eType type of the element.
*/
void vcs_VolPhase::setElementType(const int e, const int eType) {
m_elementType[e] = eType;
}
}

View file

@ -478,12 +478,28 @@ namespace VCSnonideal {
*/
void setElemGlobalIndex(const int eLocal, const int eGlobal);
//! Returns the number of element constraints
int nElemConstraints() const;
//! Name of the element constraint with index \c e.
/*!
* @param e Element index.
*/
std::string elementName(const int e) const;
//! Type of the element constraint with index \c e.
/*!
* @param e Element index.
*/
int elementType(const int e) const;
//! Set the element Type of the element constraint with index \c e.
/*!
* @param e Element index
* @param eType type of the element.
*/
void setElementType(const int e, const int eType);
//! Transfer all of the element information from the
//! ThermoPhase object to the vcs_VolPhase object.
/*!
@ -495,7 +511,6 @@ namespace VCSnonideal {
*/
int transferElementsFM(const Cantera::ThermoPhase * const tPhase);
private:
//! Evaluate the activity coefficients at the current conditions
@ -620,7 +635,7 @@ namespace VCSnonideal {
int m_numElemConstraints;
public:
//! This is the element number for the charge neutrality
//! This is the element number for the charge neutrality
//! condition of the phase
/*!
* If it has one. If it does not have a charge neutrality
@ -629,17 +644,19 @@ namespace VCSnonideal {
int ChargeNeutralityElement;
private:
//! vector of strings containing the element names
//! vector of strings containing the element constraint names
/*!
* Length = nElemConstraints
*/
std::vector<std::string> ElName;
std::vector<std::string> m_elementNames;
public:
//! boolean indicating whether an element constraint is active
//! for the current problem
std::vector<int> ElActive;
//! Type of the element
private:
//! Type of the element constraint
/*!
* m_elType[j] = type of the element
* 0 VCS_ELEM_TYPE_ABSPOS Normal element that is positive
@ -650,8 +667,9 @@ namespace VCSnonideal {
* mean that a species has neg 0 or pos value
* of that constraint (other than charge)
*/
std::vector<int> m_elType;
std::vector<int> m_elementType;
public:
//! Formula Matrix for the phase
/*!
* FormulaMatrix[j][kspec]
@ -713,7 +731,6 @@ namespace VCSnonideal {
*/
int m_existence;
// Index of the first MF species in the list of unknowns for this phase
/*!
* This is always equal to zero.
@ -759,8 +776,11 @@ namespace VCSnonideal {
*
* Currently, this value should be the same as the owning VCS_PROB or
* VCS_SOLVE object. There is no code for handling anything else atm.
*
* (This variable is needed for the vcsc code, where it is not equal
* to VCS_UNITS_MKS).
*/
int m_VCS_UnitsFormat;
int p_VCS_UnitsFormat;
private:
//! If this is true, then calculations are actually performed within

View file

@ -383,7 +383,7 @@ namespace VCSnonideal {
}
}
if (foundPos == -1) {
int elType = volPhase->m_elType[eVP];
int elType = volPhase->elementType(eVP);
int elactive = volPhase->ElActive[eVP];
e = addElement(enVP.c_str(), elType, elactive);
volPhase->setElemGlobalIndex(eVP, e);