Skip to content

Commit

Permalink
Eliminate debug_verbose option and DEBUG_MODE macro
Browse files Browse the repository at this point in the history
Vebose printing can always be enabled at runtime by setting flags on various
classes.
  • Loading branch information
speth committed Nov 18, 2015
1 parent ee95c60 commit e58bd09
Show file tree
Hide file tree
Showing 31 changed files with 483 additions and 726 deletions.
7 changes: 0 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -390,11 +390,6 @@ config_options = [
('FORTRANFLAGS',
'Compilation options for the Fortran (90) compiler.',
'-O3'),
BoolVariable(
'debug_verbose',
"""Enable extra printing to aid in debugging. This code is marked
by the preprocessor macros DEBUG_MODE and DEBUG_MODE_ENABLED.""",
False),
BoolVariable(
'coverage',
"""Enable collection of code coverage information with gcov.
Expand Down Expand Up @@ -1201,8 +1196,6 @@ def cdefine(definevar, configvar, comp=True, value=1):
else:
configh[definevar] = None

cdefine('DEBUG_MODE', 'debug_verbose')

# Need to test all of these to see what platform.system() returns
configh['SOLARIS'] = 1 if env['OS'] == 'Solaris' else None
configh['DARWIN'] = 1 if env['OS'] == 'Darwin' else None
Expand Down
5 changes: 0 additions & 5 deletions doc/sphinx/scons-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ running 'scons build'. The format of this file is:
Compilation options for the Fortran (90) compiler.
- default: '-O3'

* debug_verbose: [ yes | no ]
Enable extra printing to aid in debugging. This code is marked by
the preprocessor macros DEBUG_MODE and DEBUG_MODE_ENABLED.
- default: 'no'

* coverage: [ yes | no ]
Enable collection of code coverage information with gcov. Available
only when compiling with gcc.
Expand Down
13 changes: 0 additions & 13 deletions include/cantera/base/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@
// Just the major + minor version (i.e. 2.2 instead of 2.2.0)
%(CANTERA_SHORT_VERSION)s

//------------------------ Development flags ------------------//
//
// Compile in additional debug printing where available.
// Note, the printing may need to be turned on via a switch.
// This just compiles in the code.
%(DEBUG_MODE)s

#ifdef DEBUG_MODE
#define DEBUG_MODE_ENABLED 1
#else
#define DEBUG_MODE_ENABLED 0
#endif

//------------------------ Fortran settings -------------------//

// define types doublereal, integer, and ftnlen to match the
Expand Down
8 changes: 1 addition & 7 deletions include/cantera/equil/vcs_solve.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,8 @@ class VCS_SOLVE
* flags with total moles in each phase.
*/
double vcs_tmoles();
#ifdef DEBUG_MODE

void check_tmoles() const;
#endif

//! This subroutine calculates reaction free energy changes for
//! all noncomponent formation reactions.
Expand Down Expand Up @@ -1291,11 +1290,8 @@ class VCS_SOLVE
*/
double l2normdg(double dg[]) const;

#ifdef DEBUG_MODE

//! Print out and check the elemental abundance vector
void prneav() const;
#endif

void checkDelta1(double* const ds, double* const delTPhMoles, size_t kspec);

Expand Down Expand Up @@ -1895,8 +1891,6 @@ class VCS_SOLVE
* * 5 each iteration in solve_TP gets a report with one line per species
* * 6 Each decision in solve_TP gets a line per species in addition to 4
* * 10 Additionally Hessian matrix is printed out
*
* Levels of printing above 4 are only accessible when DEBUG_MODE is turned on
*/
int m_debug_print_lvl;

Expand Down
8 changes: 1 addition & 7 deletions include/cantera/thermo/HMWSoln.h
Original file line number Diff line number Diff line change
Expand Up @@ -2789,16 +2789,10 @@ class HMWSoln : public MolalityVPSSTP
static int interp_est(const std::string& estString);

public:
/*!
* Turn on copious debug printing when this
* is true and DEBUG_MODE is turned on.
*/
//! Turn on copious debug printing when this is true
mutable int m_debugCalc;

//! Return int specifying the amount of debug printing
/*!
* This will return 0 if DEBUG_MODE is not turned on
*/
int debugPrinting();
};

Expand Down
4 changes: 0 additions & 4 deletions include/cantera/thermo/PDSS_HKFT.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class PDSS_HKFT : public PDSS_Molar

virtual doublereal enthalpy_mole() const;

#ifdef DEBUG_MODE
//! Return the molar enthalpy in units of J kmol-1
/*!
* Returns the species standard state enthalpy in J kmol-1 at the
Expand All @@ -97,7 +96,6 @@ class PDSS_HKFT : public PDSS_Molar
* @return returns the species standard state enthalpy in J kmol-1
*/
doublereal enthalpy_mole2() const;
#endif

virtual doublereal intEnergy_mole() const;
virtual doublereal entropy_mole() const;
Expand Down Expand Up @@ -221,14 +219,12 @@ class PDSS_HKFT : public PDSS_Molar
*/
doublereal deltaS() const;

#ifdef DEBUG_MODE
//! Routine that actually calculates the enthalpy difference
//! between the reference state at Tr, Pr and T,P
/*!
* This is an extra routine that was added to check the arithmetic
*/
doublereal deltaH() const;
#endif

//! Internal formula for the calculation of a_g()
/*!
Expand Down
2 changes: 0 additions & 2 deletions include/cantera/thermo/RedlichKisterVPSSTP.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ class RedlichKisterVPSSTP : public GibbsExcessVPSSTP
*/
void s_update_dlnActCoeff_dX_() const;

#ifdef DEBUG_MODE
public:
//! Utility routine that calculates a literature expression
/*!
Expand All @@ -442,7 +441,6 @@ class RedlichKisterVPSSTP : public GibbsExcessVPSSTP
* nonideal term and mf term
*/
void Vint(double& VintOut, double& voltsOut);
#endif

protected:
//! number of binary interaction expressions
Expand Down
10 changes: 0 additions & 10 deletions src/base/ctml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,18 +214,8 @@ doublereal getFloatCurrent(const XML_Node& node, const std::string& type)
fctr = toSI(units);
} else if (type != "" && units != "") {
fctr = toSI(units);
#ifdef DEBUG_MODE
writelog("\nWarning: conversion toSI() was done on node value " + node.name() +
"but wasn't explicitly requested. Type was \"" + type + "\"\n");
#endif
#ifdef DEBUG_MODE_MORE
} else if (type == "" && units != "") {
// Note, below currently produces a lot of output due to transport blocks.
// This needs to be addressed.
writelog("\nWarning: XML node " + node.name() +
"has a units attribute, \"" + units + "\","
"but no conversion was done because the getFloat() command didn't have a type\n");
#endif
}
return fctr*x;
}
Expand Down
18 changes: 7 additions & 11 deletions src/equil/BasisOptimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,
}
}

if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl >= 1) {
if (BasisOptimize_print_lvl >= 1) {
writelog(" ");
for (i=0; i<77; i++) {
writelog("-");
Expand Down Expand Up @@ -118,9 +118,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,

// For debugging purposes keep an unmodified copy of the array.
vector_fp molNumBase;
if (DEBUG_MODE_ENABLED) {
molNumBase = molNum;
}
molNumBase = molNum;
double molSave = 0.0;

size_t jr = 0;
Expand Down Expand Up @@ -157,9 +155,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,

// Assign a small negative number to the component that we have
// just found, in order to take it out of further consideration.
#ifdef DEBUG_MODE
molSave = molNum[kk];
#endif
molNum[kk] = USEDBEFORE;

// CHECK LINEAR INDEPENDENCE WITH PREVIOUS SPECIES
Expand Down Expand Up @@ -208,7 +204,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,

// REARRANGE THE DATA
if (jr != k) {
if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl >= 1) {
if (BasisOptimize_print_lvl >= 1) {
kk = orderVectorSpecies[k];
writelogf(" --- %-12.12s", mphase->speciesName(kk));
jj = orderVectorSpecies[jr];
Expand Down Expand Up @@ -283,7 +279,7 @@ size_t BasisOptimize(int* usedZeroedSpecies, bool doFormRxn, MultiPhase* mphase,
ct_dgetrs(ctlapack::NoTranspose, nComponents, nNonComponents, &sm[0], ne,
&ipiv[0], &formRxnMatrix[0], ne, info);

if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl >= 1) {
if (BasisOptimize_print_lvl >= 1) {
writelog(" ---\n");
writelogf(" --- Number of Components = %d\n", nComponents);
writelog(" --- Formula Matrix:\n");
Expand Down Expand Up @@ -379,7 +375,7 @@ void ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
size_t nspecies = mphase->nSpecies();

double test = -1.0E10;
if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl > 0) {
if (BasisOptimize_print_lvl > 0) {
writelog(" ");
for (i=0; i<77; i++) {
writelog("-");
Expand Down Expand Up @@ -456,7 +452,7 @@ void ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
if (k == nelements) {
// When we are here, there is an error usually.
// We haven't found the number of elements necessary.
if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl > 0) {
if (BasisOptimize_print_lvl > 0) {
writelogf("Error exit: returning with nComponents = %d\n", jr);
}
throw CanteraError("ElemRearrange", "Required number of elements not found.");
Expand Down Expand Up @@ -517,7 +513,7 @@ void ElemRearrange(size_t nComponents, const vector_fp& elementAbundances,
}
// REARRANGE THE DATA
if (jr != k) {
if (DEBUG_MODE_ENABLED && BasisOptimize_print_lvl > 0) {
if (BasisOptimize_print_lvl > 0) {
kk = orderVectorElements[k];
writelog(" --- ");
writelogf("%-2.2s", mphase->elementName(kk));
Expand Down
Loading

0 comments on commit e58bd09

Please sign in to comment.