[Equil/Test] Fix failures involving use of global variables

Direct use of "global" variables defined in the shared library results in
inconsistent behavior.
This commit is contained in:
Ray Speth 2016-07-05 18:02:33 -04:00
parent 72d8bb014a
commit 62524e8820
5 changed files with 12 additions and 2 deletions

View file

@ -370,6 +370,8 @@ protected:
* Default is to allow printing. But, you can assign this to zero globally to
* turn off all time printing. This is helpful for test suite purposes where
* you are interested in differences in text files.
* @deprecated Call `VCS_SOLVE::disable_timing()` instead. To be removed after
* Cantera 2.3.
*/
extern int vcs_timing_print_lvl;

View file

@ -1866,6 +1866,10 @@ public:
*/
int m_timing_print_lvl;
//! Disable printing of timing information. Used to generate consistent
//! output for tests.
static void disableTiming();
friend class vcs_phaseStabilitySolve;
};

View file

@ -825,4 +825,8 @@ double VCS_SOLVE::vcs_VolTotal(const double tkelvin, const double pres,
return VolTot;
}
void VCS_SOLVE::disableTiming() {
vcs_timing_print_lvl = 0;
}
}

View file

@ -12,7 +12,7 @@ using namespace Cantera;
void testProblem(int printLvl)
{
double T = 273.15 + 352.0;
vcs_timing_print_lvl = 0;
VCS_SOLVE::disableTiming();
// Create the phases
std::unique_ptr<ThermoPhase> LiSi_solid(newPhase("Li7Si3_ls.xml",

View file

@ -33,7 +33,7 @@ int main(int argc, char** argv)
int numFail = 0;
int printLvl = 1;
string inputFile = "HMW_NaCl.xml";
vcs_timing_print_lvl = 0;
VCS_SOLVE::disableTiming();
/*
* Process the command line arguments