Skip to content

Commit

Permalink
- some minor changes
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14391 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Dec 14, 2012
1 parent 4347c65 commit c717b69
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 71 deletions.
8 changes: 4 additions & 4 deletions SimulationRuntime/c/simulation/simulation_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ void setGlobalVerboseLevel(int argc, char**argv)
WARNING1(LOG_STDOUT, "unrecognized option -lv %s", flags->c_str());
WARNING(LOG_STDOUT, "current options are:");
INDENT(LOG_STDOUT);
for(i=1; i<LOG_MAX; ++i)
WARNING2(LOG_STDOUT, "%-18s [%s]", LOG_STREAM_NAME[i], LOG_STREAM_DETAILED_DESC[i]);
for(i=firstOMCErrorStream; i<LOG_MAX; ++i)
WARNING2(LOG_STDOUT, "%-18s [%s]", LOG_STREAM_NAME[i], LOG_STREAM_DESC[i]);
RELEASE(LOG_STDOUT);
THROW("see last warning");
}
Expand Down Expand Up @@ -598,8 +598,8 @@ int initRuntimeAndSimulation(int argc, char**argv, DATA *data)
INFO(LOG_STDOUT, "\tspecify the output format of the measure time functionality");
INFO(LOG_STDOUT, "<-lv [flag1][,flags2][,...]>");
INFO(LOG_STDOUT, "\tspecify the logging level");
for(i=1; i<LOG_MAX; ++i)
INFO2(LOG_STDOUT, "\t%-18s [%s]", LOG_STREAM_NAME[i], LOG_STREAM_DETAILED_DESC[i]);
for(i=firstOMCErrorStream; i<LOG_MAX; ++i)
INFO2(LOG_STDOUT, "\t%-18s [%s]", LOG_STREAM_NAME[i], LOG_STREAM_DESC[i]);
RELEASE(LOG_STDOUT);
EXIT(0);
}
Expand Down
7 changes: 3 additions & 4 deletions SimulationRuntime/c/simulation/solver/kinsolSolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@
{
NLS_KINSOL_DATA *kinsolData = (NLS_KINSOL_DATA*) user_data;
int eqSystemNumber = kinsolData->data->modelData.equationInfo_reverse_prof_index[kinsolData->nlsData->simProfEqNr];
int i;

if(DEBUG_STREAM(LOG_NLS))
{
Expand Down Expand Up @@ -257,7 +256,7 @@
for(i=0; i<size; ++i)
{
kinsolData->nlsData->nlsx[i] = NV_Ith_S(z, i);
INFO3(LOG_NLS, "[%d] %s = %g", i+1, kinsolData->data->modelData.equationInfo[eqSystemNumber].vars[i]->name, kinsolData->nlsData->nlsx[i]);
INFO3(LOG_NLS, "[%ld] %s = %g", i+1, kinsolData->data->modelData.equationInfo[eqSystemNumber].vars[i]->name, kinsolData->nlsData->nlsx[i]);
}

INFO1(LOG_NLS, "KINGetNumNonlinSolvIters = %5ld", nni);
Expand All @@ -266,7 +265,7 @@
INFO1(LOG_NLS, "KINDlsGetNumFuncEvals = %5ld", nfeD);
RELEASE(LOG_NLS);

/* Free memory */
/* free memory */
N_VDestroy_Serial(z);
N_VDestroy_Serial(sVars);
N_VDestroy_Serial(sEqns);
Expand All @@ -275,7 +274,7 @@

if(error_code < 0)
{
INFO(LOG_STDOUT, "kinsol failed. see last warning. use [-lv LOG_NLS] for more output.");
WARNING1(LOG_STDOUT, "kinsol failed [error_code=%d]. see last warning. use [-lv LOG_NLS] for more output.", error_code);
return 0;
}

Expand Down
87 changes: 35 additions & 52 deletions SimulationRuntime/c/util/omc_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,67 +38,50 @@
/* Global JumpBuffer */
jmp_buf globalJmpbuf;

const int firstOMCErrorStream = 3;

const char *LOG_STREAM_NAME[LOG_MAX] = {
"LOG_UNKNOWN",
"LOG_STDOUT",
"LOG_UTIL",
"LOG_SIMULATION",
"LOG_STATS",
"LOG_INIT",
"LOG_SOTI", /* LOG_INIT_SOLUTION */
"LOG_RES_INIT",
"LOG_SOLVER",
"stdout",
"assert",

"LOG_DDASRT",
"LOG_JAC",
"LOG_DEBUG",
"LOG_ENDJAC",
"LOG_EVENTS",
"LOG_INIT",
"LOG_JAC",
"LOG_NLS",
"LOG_NLS_V",
"LOG_EVENTS",
"LOG_ZEROCROSSINGS",
"LOG_DEBUG",
"LOG_ASSERT",
"LOG_RES_INIT",
"LOG_SIMULATION",
"LOG_SOLVER",
"LOG_SOTI",
"LOG_STATS",
"LOG_UTIL",
"LOG_ZEROCROSSINGS"
};

const char *LOG_STREAM_DESC[LOG_MAX] = {
"unknown",
"stdout",
"util",
"simulation",
"stats",
"init",
"init solution",
"res_init",
"solver",
"ddasrt",
"jac",
"endjac",
"nls",
"nls (verbose)",
"events",
"zerocrossings",
"debug",
"|"
};

const char *LOG_STREAM_DETAILED_DESC[LOG_MAX] = {
"unknown",
"this stream is alway active",
"util",
"simulation",
"stats",
"additional information during initialization",
"final solution of the initialization",
"res_init",
"solver",
"ddasrt",
"jac",
"endjac",
"logging for nonlinear systems",
"verbose logging of nonlinear systems",
"additional information during event iteration",
"zerocrossings",
"debug",
"this stream is alway active"
"this stream is always active", /* LOG_STDOUT */
"this stream is always active", /* LOG_ASSERT */

"???", /* LOG_DDASRT */
"???", /* LOG_DEBUG */
"???", /* LOG_ENDJAC */
"additional information during event iteration", /* LOG_EVENTS */
"additional information during initialization", /* LOG_INIT */
"???", /* LOG_JAC */
"logging for nonlinear systems", /* LOG_NLS */
"verbose logging of nonlinear systems", /* LOG_NLS_V */
"???", /* LOG_RES_INIT */
"???", /* LOG_SIMULATION */
"???", /* LOG_SOLVER */
"final solution of the initialization", /* LOG_SOTI */
"???", /* LOG_STATS */
"???", /* LOG_UTIL*/
"???" /* LOG_ZEROCROSSINGS */
};

static const char *LOG_TYPE_DESC[LOG_TYPE_MAX] = {
Expand Down Expand Up @@ -171,7 +154,7 @@ void Message(int type, int stream, char *msg, int subline)
if((type != LOG_TYPE_ERROR) && !useStream[stream])
return;

printf("%-13s | ", (subline || (lastStream == stream && level[stream] > 0)) ? "|" : LOG_STREAM_DESC[stream]);
printf("%-17s | ", (subline || (lastStream == stream && level[stream] > 0)) ? "|" : LOG_STREAM_NAME[stream]);
printf("%-7s | ", (subline || (lastStream == stream && lastType[stream] == type && level[stream] > 0)) ? "|" : LOG_TYPE_DESC[type]);
lastType[stream] = type;
lastStream = stream;
Expand Down
26 changes: 15 additions & 11 deletions SimulationRuntime/c/util/omc_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,28 @@ enum LOG_STREAM
{
LOG_UNKNOWN = 0,
LOG_STDOUT,
LOG_UTIL,
LOG_SIMULATION,
LOG_STATS,
LOG_INIT,
LOG_SOTI, /* LOG_INIT_SOLUTION */
LOG_RES_INIT,
LOG_SOLVER,
LOG_ASSERT,

LOG_DDASRT,
LOG_JAC,
LOG_DEBUG,
LOG_ENDJAC,
LOG_EVENTS,
LOG_INIT,
LOG_JAC,
LOG_NLS,
LOG_NLS_V,
LOG_EVENTS,
LOG_RES_INIT,
LOG_SIMULATION,
LOG_SOLVER,
LOG_SOTI,
LOG_STATS,
LOG_UTIL,
LOG_ZEROCROSSINGS,
LOG_DEBUG,
LOG_ASSERT,

LOG_MAX
};

extern const int firstOMCErrorStream;
extern const char *LOG_STREAM_NAME[LOG_MAX];
extern const char *LOG_STREAM_DESC[LOG_MAX];
extern const char *LOG_STREAM_DETAILED_DESC[LOG_MAX];
Expand Down

0 comments on commit c717b69

Please sign in to comment.