Skip to content

Commit

Permalink
- remove unnecessary if(ACTIVE_STREAM(..)) statements
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20780 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed May 23, 2014
1 parent 8183b05 commit 6c73059
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 22 deletions.
3 changes: 2 additions & 1 deletion SimulationRuntime/c/optimization/DataManagement/MoveData.c
Expand Up @@ -49,7 +49,8 @@ static inline void printSomeModelInfos(OptDataBounds * bounds, OptDataDim * dim,
/* pick up model data
* author: Vitalij Ruge
*/
int pickUpModelData(DATA* data, SOLVER_INFO* solverInfo){
int pickUpModelData(DATA* data, SOLVER_INFO* solverInfo)
{
const int nReal = data->modelData.nVariablesReal;
int i, j;
OptData *optData = (OptData*) solverInfo->solverData;
Expand Down
15 changes: 8 additions & 7 deletions SimulationRuntime/c/simulation/simulation_input_xml.cpp
Expand Up @@ -397,7 +397,7 @@ void read_input_xml(MODEL_DATA* modelData,

read_value(mi.md["OPENMODELICAHOME"], &simulationInfo->OPENMODELICAHOME);
infoStreamPrint(LOG_SIMULATION, 0, "OPENMODELICAHOME: %s", simulationInfo->OPENMODELICAHOME);
if (ACTIVE_STREAM(LOG_SIMULATION)) messageClose(LOG_SIMULATION);
messageClose(LOG_SIMULATION);

modelica_integer nxchk, nychk, npchk;
modelica_integer nyintchk, npintchk;
Expand Down Expand Up @@ -427,7 +427,8 @@ void read_input_xml(MODEL_DATA* modelData,
|| npstrchk != modelData->nParametersString
|| nystrchk != modelData->nVariablesString)
{
if (ACTIVE_WARNING_STREAM(LOG_SIMULATION)) {
if (ACTIVE_WARNING_STREAM(LOG_SIMULATION))
{
warningStreamPrint(LOG_SIMULATION, 1, "Error, input data file does not match model.");
warningStreamPrint(LOG_SIMULATION, 0, "nx in setup file: %ld from model code: %d", nxchk, (int)modelData->nStates);
warningStreamPrint(LOG_SIMULATION, 0, "ny in setup file: %ld from model code: %ld", nychk, modelData->nVariablesReal - 2*modelData->nStates);
Expand Down Expand Up @@ -465,7 +466,7 @@ void read_input_xml(MODEL_DATA* modelData,
mapAlias[info.name] = j; /* create a mapping for Alias variable to get the correct index */ \
debugStreamPrint(LOG_DEBUG, 0, "real %s: mapAlias[%s] = %ld", debugName, info.name, j); \
} \
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
messageClose(LOG_DEBUG);

READ_VARIABLES(modelData->realVarsData,mi.rSta,REAL_ATTRIBUTE,"real states",0,modelData->nStates,mapAlias);
READ_VARIABLES(modelData->realVarsData,mi.rDer,REAL_ATTRIBUTE,"real state derivatives",modelData->nStates,modelData->nStates,mapAlias);
Expand Down Expand Up @@ -528,7 +529,7 @@ void read_input_xml(MODEL_DATA* modelData,
modelData->realAlias[i].nameID,
modelData->realAlias[i].aliasType ? ((modelData->realAlias[i].aliasType==2) ? "time" : "real parameters") : "real variables");
}
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
messageClose(LOG_DEBUG);

/*
* integer all alias vars
Expand Down Expand Up @@ -576,7 +577,7 @@ void read_input_xml(MODEL_DATA* modelData,
modelData->integerAlias[i].nameID,
modelData->integerAlias[i].aliasType?"integer parameters":"integer variables");
}
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
messageClose(LOG_DEBUG);

/*
* boolean all alias vars
Expand Down Expand Up @@ -624,7 +625,7 @@ void read_input_xml(MODEL_DATA* modelData,
modelData->booleanAlias[i].nameID,
modelData->booleanAlias[i].aliasType ? "boolean parameters" : "boolean variables");
}
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
messageClose(LOG_DEBUG);

/*
* string all alias vars
Expand Down Expand Up @@ -672,7 +673,7 @@ void read_input_xml(MODEL_DATA* modelData,
modelData->stringAlias[i].nameID,
modelData->stringAlias[i].aliasType ? "string parameters" : "string variables");
}
if (ACTIVE_STREAM(LOG_DEBUG)) messageClose(LOG_DEBUG);
messageClose(LOG_DEBUG);

XML_ParserFree(parser);
}
Expand Down
13 changes: 9 additions & 4 deletions SimulationRuntime/c/simulation/solver/events.c
Expand Up @@ -383,14 +383,19 @@ void findRoot(DATA* data, LIST *eventList, double *eventTime)

listClear(eventList);

if(ACTIVE_STREAM(LOG_EVENTS)) {
if(listLen(tmpEventList) > 0) {
if(ACTIVE_STREAM(LOG_EVENTS))
{
if(listLen(tmpEventList) > 0)
{
debugStreamPrint(LOG_EVENTS, 0, "found events: ");
} else {
}
else
{
debugStreamPrint(LOG_EVENTS, 0, "found event: ");
}
}
while(listLen(tmpEventList) > 0) {
while(listLen(tmpEventList) > 0)
{
event_id = *((long*)listFirstData(tmpEventList));
listPopFront(tmpEventList);

Expand Down
3 changes: 2 additions & 1 deletion SimulationRuntime/c/simulation/solver/external_input.c
Expand Up @@ -102,7 +102,8 @@ int externalInputallocate(DATA* data)
data->simulationInfo.external_input.n = i;
}

if(ACTIVE_STREAM(LOG_SIMULATION)){
if(ACTIVE_STREAM(LOG_SIMULATION))
{
printf("\nExternal Input");
printf("\n========================================================");
for(i = 0; i < data->simulationInfo.external_input.n; ++i){
Expand Down
Expand Up @@ -73,7 +73,8 @@ int reportResidualValue(INIT_DATA *initData)

if(1e-5 < funcValue)
{
if (ACTIVE_STREAM(LOG_INIT)) {
if (ACTIVE_STREAM(LOG_INIT))
{
infoStreamPrint(LOG_INIT, 1, "error in initialization. System of initial equations are not consistent\n(least square function value is %g)", funcValue);
for(i=0; i<initData->nInitResiduals; i++) {
if(1e-5 < fabs(initData->initialResiduals[i])) {
Expand Down Expand Up @@ -594,7 +595,7 @@ static int initialize(DATA *data, int optiMethod, int lambda_steps)
infoStreamPrint(LOG_INIT, 1, "### FINAL INITIALIZATION RESULTS ###");
dumpInitialization(data,initData);
retVal = reportResidualValue(initData);
if (ACTIVE_STREAM(LOG_INIT)) messageClose(LOG_INIT);
messageClose(LOG_INIT);
freeInitData(initData);

return retVal;
Expand Down
Expand Up @@ -215,7 +215,8 @@
*
*/
infoStreamPrint(LOG_INIT, 0, "ipopt using symbolic sparse jacobian G");
if(ACTIVE_STREAM(LOG_INIT)) {
if(ACTIVE_STREAM(LOG_INIT))
{
infoStreamPrint(LOG_INIT, 0, "sparsity pattern");
for(i=0; i<n; ++i) {
printf(" | | column %3d: [ ", i+1);
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/simulation/solver/kinsolSolver.c
Expand Up @@ -259,7 +259,7 @@
infoStreamPrint(LOG_NLS, 0, "KINGetNumFuncEvals = %5ld", nfe);
infoStreamPrint(LOG_NLS, 0, "KINDlsGetNumJacEvals = %5ld", nje);
infoStreamPrint(LOG_NLS, 0, "KINDlsGetNumFuncEvals = %5ld", nfeD);
if (ACTIVE_STREAM(LOG_NLS)) messageClose(LOG_NLS);
messageClose(LOG_NLS);

/* free memory */
N_VDestroy_Serial(z);
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/simulation/solver/mixedSearchSolver.c
Expand Up @@ -302,7 +302,7 @@ int solveMixedSearch(DATA *data, int sysNumber)

}while(!found_solution);

if(ACTIVE_STREAM(LOG_NLS)) messageClose(LOG_NLS);
messageClose(LOG_NLS);
debugStreamPrint(LOG_NLS, 0, "#### Finished mixed equation system in steps %d.\n", stepCount);
return success;
}
Expand Up @@ -380,7 +380,7 @@ int solveNewton(DATA *data, int sysNumber)
}
}

if (ACTIVE_STREAM(LOG_NLS)) messageClose(LOG_NLS);
messageClose(LOG_NLS);

return success;
}
Expand Down
4 changes: 2 additions & 2 deletions SimulationRuntime/c/simulation/solver/perform_simulation.c
Expand Up @@ -194,7 +194,7 @@ int prefixedName_performSimulation(DATA* data, SOLVER_INFO* solverInfo)
updateContinuousSystem(data);

saveZeroCrossings(data);
if (ACTIVE_STREAM(LOG_SOLVER)) messageClose(LOG_SOLVER);
messageClose(LOG_SOLVER);


/***** Event handling *****/
Expand All @@ -209,7 +209,7 @@ int prefixedName_performSimulation(DATA* data, SOLVER_INFO* solverInfo)
if (!(omc_flag[FLAG_NOEVENTEMIT])) /* output left limit */
sim_result.emit(&sim_result,data);
handleEvents(data, solverInfo->eventLst, &(solverInfo->currentTime), solverInfo);
if (ACTIVE_STREAM(LOG_EVENTS)) messageClose(LOG_EVENTS);
messageClose(LOG_EVENTS);
threadData->currentErrorStage = ERROR_SIMULATION;

solverInfo->didEventStep = 1;
Expand Down
2 changes: 1 addition & 1 deletion SimulationRuntime/c/simulation/solver/stateset.c
Expand Up @@ -280,7 +280,7 @@ static int comparePivot(modelica_integer *oldPivot, modelica_integer *newPivot,
{
infoStreamPrint(LOG_DSS, 1, "select new states at time %f", data->localData[0]->timeValue);
setAMatrix(newEnable, nCandidates, nStates, A, states, statecandidates, data);
if (ACTIVE_STREAM(LOG_DSS)) messageClose(LOG_DSS);
messageClose(LOG_DSS);
}
ret = -1;
break;
Expand Down

0 comments on commit 6c73059

Please sign in to comment.