Skip to content

Commit

Permalink
Check for ACTIVE_STREAM vs. DEBUG_STREAM with LOG_DEBUG (used as both…
Browse files Browse the repository at this point in the history
… infoStream and debugStream; one is removed by the preprocessor)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18678 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Jan 17, 2014
1 parent 7968689 commit cd1847b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 37 deletions.
28 changes: 14 additions & 14 deletions SimulationRuntime/c/simulation/simulation_input_xml.cpp
Expand Up @@ -404,7 +404,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file", modelData->realVarsData[i].info.name, modelData->realVarsData[i].info.info.colEnd);
read_value(mi.rSta[i]["fileWritable"], (modelica_integer*)&(modelData->realVarsData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file", modelData->realVarsData[i].info.name, modelData->realVarsData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.rSta[i]["useStart"], (modelica_boolean*)&(modelData->realVarsData[i].attribute.useStart));
Expand Down Expand Up @@ -451,7 +451,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->realVarsData[modelData->nStates+i].info.name,modelData->realVarsData[modelData->nStates+i].info.info.colEnd);
read_value(mi.rDer[i]["fileWritable"], (modelica_integer*) &(modelData->realVarsData[modelData->nStates+i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->realVarsData[modelData->nStates+i].info.name,modelData->realVarsData[modelData->nStates+i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.rDer[i]["useStart"], (modelica_boolean*)&(modelData->realVarsData[modelData->nStates+i].attribute.useStart));
Expand Down Expand Up @@ -500,7 +500,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->realVarsData[j].info.name,modelData->realVarsData[j].info.info.colEnd);
read_value(mi.rAlg[i]["fileWritable"], (modelica_integer*) &(modelData->realVarsData[j].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->realVarsData[j].info.name,modelData->realVarsData[j].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.rAlg[i]["useStart"], (modelica_boolean*)&(modelData->realVarsData[j].attribute.useStart));
Expand Down Expand Up @@ -547,7 +547,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->integerVarsData[i].info.name,modelData->integerVarsData[i].info.info.colEnd);
read_value(mi.iAlg[i]["fileWritable"], (modelica_integer*) &(modelData->integerVarsData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->integerVarsData[i].info.name,modelData->integerVarsData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.iAlg[i]["useStart"], &(modelData->integerVarsData[i].attribute.useStart));
Expand Down Expand Up @@ -592,7 +592,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->booleanVarsData[i].info.name,modelData->booleanVarsData[i].info.info.colEnd);
read_value(mi.bAlg[i]["fileWritable"], (modelica_integer*) &(modelData->booleanVarsData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->booleanVarsData[i].info.name,modelData->booleanVarsData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.bAlg[i]["useStart"], &(modelData->booleanVarsData[i].attribute.useStart));
Expand Down Expand Up @@ -635,7 +635,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->stringVarsData[i].info.name,modelData->stringVarsData[i].info.info.colEnd);
read_value(mi.sAlg[i]["fileWritable"], (modelica_integer*) &(modelData->stringVarsData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->stringVarsData[i].info.name,modelData->stringVarsData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.sAlg[i]["useStart"], &(modelData->stringVarsData[i].attribute.useStart));
Expand Down Expand Up @@ -680,7 +680,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->realParameterData[i].info.name,modelData->realParameterData[i].info.info.colEnd);
read_value(mi.rPar[i]["fileWritable"], (modelica_integer*) &(modelData->realParameterData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->realParameterData[i].info.name,modelData->realParameterData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.rPar[i]["useStart"], &(modelData->realParameterData[i].attribute.useStart));
Expand Down Expand Up @@ -727,7 +727,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->integerParameterData[i].info.name,modelData->integerParameterData[i].info.info.colEnd);
read_value(mi.iPar[i]["fileWritable"], (modelica_integer*) &(modelData->integerParameterData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->integerParameterData[i].info.name,modelData->integerParameterData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.iPar[i]["useStart"], (modelica_boolean*)&(modelData->integerParameterData[i].attribute.useStart));
Expand Down Expand Up @@ -771,7 +771,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file", modelData->booleanParameterData[i].info.name, modelData->booleanParameterData[i].info.info.colEnd);
read_value(mi.bPar[i]["fileWritable"], (modelica_integer*)&(modelData->booleanParameterData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file", modelData->booleanParameterData[i].info.name, modelData->booleanParameterData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.bPar[i]["useStart"], &(modelData->booleanParameterData[i].attribute.useStart));
Expand Down Expand Up @@ -813,7 +813,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->stringParameterData[i].info.name,modelData->stringParameterData[i].info.info.colEnd);
read_value(mi.sPar[i]["fileWritable"], (modelica_integer*) &(modelData->stringParameterData[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->stringParameterData[i].info.name,modelData->stringParameterData[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

/* read var attribute */
read_value(mi.sPar[i]["useStart"], &(modelData->stringParameterData[i].attribute.useStart));
Expand Down Expand Up @@ -856,7 +856,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->realAlias[i].info.name,modelData->realAlias[i].info.info.colEnd);
read_value(mi.rAli[i]["fileWritable"], (modelica_integer*) &(modelData->realAlias[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->realAlias[i].info.name,modelData->realAlias[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

string aliasTmp;
read_value(mi.rAli[i]["alias"], &aliasTmp);
Expand Down Expand Up @@ -926,7 +926,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->integerAlias[i].info.name,modelData->integerAlias[i].info.info.colEnd);
read_value(mi.iAli[i]["fileWritable"], (modelica_integer*) &(modelData->integerAlias[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->integerAlias[i].info.name,modelData->integerAlias[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

string aliasTmp;
read_value(mi.iAli[i]["alias"], &aliasTmp);
Expand Down Expand Up @@ -994,7 +994,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->booleanAlias[i].info.name,modelData->booleanAlias[i].info.info.colEnd);
read_value(mi.bAli[i]["fileWritable"], (modelica_boolean*) &(modelData->booleanAlias[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->booleanAlias[i].info.name,modelData->booleanAlias[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

std::string aliasTmp;
read_value(mi.bAli[i]["alias"], &aliasTmp);
Expand Down Expand Up @@ -1062,7 +1062,7 @@ void read_input_xml(MODEL_DATA* modelData,
debugStreamPrint(LOG_DEBUG, 0, "read for %s colEnd %d from setup file",modelData->stringAlias[i].info.name,modelData->stringAlias[i].info.info.colEnd);
read_value(mi.sAli[i]["fileWritable"], (modelica_string*) &(modelData->stringAlias[i].info.info.readonly));
debugStreamPrint(LOG_DEBUG, 0, "read for %s readonly %d from setup file",modelData->stringAlias[i].info.name,modelData->stringAlias[i].info.info.readonly);
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
if (DEBUG_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);

std::string aliasTmp;
read_value(mi.sAli[i]["alias"], &aliasTmp);
Expand Down
8 changes: 3 additions & 5 deletions SimulationRuntime/c/simulation/solver/dassl.c
Expand Up @@ -628,9 +628,8 @@ int functionJacASym(DATA* data, double* jac)

data->simulationInfo.analyticJacobians[index].seedVars[i] = 0.0;
}
/*
// debug output
if(ACTIVE_STREAM(LOG_DEBUG))
// debug output; would be optimized away if the code compiled
/* if(DEBUG_STREAM(LOG_DEBUG))
{
infoStreamPrint("Print jac:");
for(i=0; i < data->simulationInfo.analyticJacobians[index].sizeRows;i++)
Expand All @@ -639,8 +638,7 @@ int functionJacASym(DATA* data, double* jac)
printf("% .5e ",jac[i+j*data->simulationInfo.analyticJacobians[index].sizeCols]);
printf("\n");
}
}
*/
} */
return 0;
}

Expand Down
Expand Up @@ -273,7 +273,7 @@
{
functionJacG_sparse(ipopt_data->initData->simData, values);

if(ACTIVE_STREAM(LOG_DEBUG))
if(ACTIVE_STREAM(LOG_DEBUG)) /* TODO: This is not XML data, is it? */
{
int i, j;
int idx = 0;
Expand Down
42 changes: 25 additions & 17 deletions SimulationRuntime/c/simulation/solver/model_help.c
Expand Up @@ -297,29 +297,37 @@ void printParameters(DATA *data, int stream)

infoStreamPrint(stream, 1, "parameter values");

infoStreamPrint(stream, 1, "real parameters");
for(i=0; i<mData->nParametersReal; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %g", i+1, mData->realParameterData[i].info.name, data->simulationInfo.realParameter[i]);
if (mData->nParametersReal) {
infoStreamPrint(stream, 1, "real parameters");
for(i=0; i<mData->nParametersReal; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %g", i+1, mData->realParameterData[i].info.name, data->simulationInfo.realParameter[i]);
}
messageClose(stream);
}
messageClose(stream);

infoStreamPrint(stream, 1, "integer parameters");
for(i=0; i<mData->nParametersInteger; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %ld", i+1, mData->integerParameterData[i].info.name, data->simulationInfo.integerParameter[i]);
if (mData->nParametersInteger) {
infoStreamPrint(stream, 1, "integer parameters");
for(i=0; i<mData->nParametersInteger; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %ld", i+1, mData->integerParameterData[i].info.name, data->simulationInfo.integerParameter[i]);
}
messageClose(stream);
}
messageClose(stream);

infoStreamPrint(stream, 1, "boolean parameters");
for(i=0; i<mData->nParametersBoolean; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %s", i+1, mData->booleanParameterData[i].info.name, data->simulationInfo.booleanParameter[i] ? "true" : "false");
if (mData->nParametersBoolean) {
infoStreamPrint(stream, 1, "boolean parameters");
for(i=0; i<mData->nParametersBoolean; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %s", i+1, mData->booleanParameterData[i].info.name, data->simulationInfo.booleanParameter[i] ? "true" : "false");
}
messageClose(stream);
}
messageClose(stream);

infoStreamPrint(stream, 1, "string parameters");
for(i=0; i<mData->nParametersString; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %s", i+1, mData->stringParameterData[i].info.name, data->simulationInfo.stringParameter[i]);
if (mData->nParametersString) {
infoStreamPrint(stream, 1, "string parameters");
for(i=0; i<mData->nParametersString; ++i) {
infoStreamPrint(stream, 0, "%ld: %s = %s", i+1, mData->stringParameterData[i].info.name, data->simulationInfo.stringParameter[i]);
}
messageClose(stream);
}
messageClose(stream);

messageClose(stream);
}
Expand Down Expand Up @@ -489,7 +497,7 @@ void setAllStartToVars(DATA *data)
mData->stringVarsData[i].attribute.start = sData->stringVars[i];
debugStreamPrint(LOG_DEBUG, 0, "String var %s(start=%s)", mData->stringVarsData[i].info.name, sData->stringVars[i]);
}
if (ACTIVE_STREAM(LOG_DEBUG)) {
if (DEBUG_STREAM(LOG_DEBUG)) {
messageClose(LOG_DEBUG);
}
}
Expand Down

0 comments on commit cd1847b

Please sign in to comment.