Skip to content

Commit

Permalink
- rename LOG_NONLIN_SYS to LOG_NLS
Browse files Browse the repository at this point in the history
- rename LOG_NONLIN_SYS_V to LOG_NLS_V
- add brief description for both flags


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14386 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Dec 14, 2012
1 parent 9f394d1 commit 0e5818c
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 137 deletions.
28 changes: 14 additions & 14 deletions SimulationRuntime/c/math-support/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ integer info = 0; /* output */ \
assert(ipiv != 0); \
_omc_dgesv_(&n,&nrhs,&A[0],&lda,ipiv,&b[0],&ldb,&info); \
if(info < 0) { \
INFO3(LOG_NONLIN_SYS,"Error solving linear system of equations (no. %d) at time %f. Argument %d illegal.\n",id,data->localData[0]->timeValue,info); \
INFO3(LOG_NLS,"Error solving linear system of equations (no. %d) at time %f. Argument %d illegal.\n",id,data->localData[0]->timeValue,info); \
data->simulationInfo.found_solution = -1; \
} \
else if(info > 0) { \
INFO2(LOG_NONLIN_SYS,"Error solving linear system of equations (no. %d) at time %f, system is singular.\n",id,data->localData[0]->timeValue); \
INFO2(LOG_NLS,"Error solving linear system of equations (no. %d) at time %f, system is singular.\n",id,data->localData[0]->timeValue); \
data->simulationInfo.found_solution = -1; \
} \
free(ipiv); \
Expand All @@ -115,8 +115,8 @@ free(ipiv); \
#define mixed_equation_system_end(size) \
stepCount++; \
hybridIterations++; \
INFO1(LOG_NONLIN_SYS," #### hybrid equation system solver step %d.", stepCount); \
INFO1(LOG_NONLIN_SYS," #### SOLUTION = %d",data->simulationInfo.found_solution); \
INFO1(LOG_NLS," #### hybrid equation system solver step %d.", stepCount); \
INFO1(LOG_NLS," #### SOLUTION = %d",data->simulationInfo.found_solution); \
} while(!data->simulationInfo.found_solution); \
} while(0)

Expand All @@ -130,11 +130,11 @@ do { \
data->simulationInfo.found_solution = -1; \
} \
}\
INFO1(LOG_NONLIN_SYS," #### Check VAR (system %d)", index); \
INFO1(LOG_NLS," #### Check VAR (system %d)", index); \
if(data->simulationInfo.found_solution == -1) { \
/*system of equations failed */ \
data->simulationInfo.found_solution = 0; \
INFO(LOG_NONLIN_SYS," #### NO SOLUTION "); \
INFO(LOG_NLS," #### NO SOLUTION "); \
} else { \
data->simulationInfo.found_solution = 1; \
for(i = 0; i < size; i++) { \
Expand All @@ -143,24 +143,24 @@ do { \
break;\
}\
}\
INFO1(LOG_NONLIN_SYS," #### SOLUTION = %c",data->simulationInfo.found_solution?'T':'F'); \
INFO1(LOG_NLS," #### SOLUTION = %c",data->simulationInfo.found_solution?'T':'F'); \
}\
if(!data->simulationInfo.found_solution ) { \
/* try next set of values*/ \
INFO(LOG_NONLIN_SYS," #### old STATE "); \
INFO(LOG_NLS," #### old STATE "); \
for(i = 0; i < size; i++) { \
int ix = (loc_ptrs[i]-data->localData[0]->booleanVars); \
const char *__name = data->modelData.booleanVarsData[ix].info.name; \
INFO4(LOG_NONLIN_SYS, "%s = %d pre(%s)= %d",__name, *loc_ptrs[i], __name, *loc_prePtrs[i]); \
INFO4(LOG_NLS, "%s = %d pre(%s)= %d",__name, *loc_ptrs[i], __name, *loc_prePtrs[i]); \
} \
if(nextVar(boolVar,size)) { \
/* try next set of values*/ \
INFO(LOG_NONLIN_SYS," #### next STATE "); \
INFO(LOG_NLS," #### next STATE "); \
for(i = 0; i < size; i++) { \
*loc_ptrs[i] = *loc_prePtrs[i] != boolVar[i]; \
int ix = (loc_ptrs[i]-data->localData[0]->booleanVars); \
const char *__name = data->modelData.booleanVarsData[ix].info.name; \
INFO4(LOG_NONLIN_SYS, "%s = %d pre(%s)= %d",__name, *loc_ptrs[i], __name, *loc_prePtrs[i]); \
INFO4(LOG_NLS, "%s = %d pre(%s)= %d",__name, *loc_ptrs[i], __name, *loc_prePtrs[i]); \
} \
} else {\
/* while the initialization it's okay not a solution */ \
Expand All @@ -173,13 +173,13 @@ do { \
} \
} \
/* we found a solution*/ \
if(data->simulationInfo.found_solution == 1 && DEBUG_STREAM(LOG_NONLIN_SYS)){ \
if(data->simulationInfo.found_solution == 1 && DEBUG_STREAM(LOG_NLS)){ \
int i = 0; \
INFO1(LOG_NONLIN_SYS," #### SOLUTION FOUND! (system %d)", index); \
INFO1(LOG_NLS," #### SOLUTION FOUND! (system %d)", index); \
for(i = 0; i < size; i++) { \
int ix = (loc_ptrs[i]-data->localData[0]->booleanVars); \
const char *__name = data->modelData.booleanVarsData[ix].info.name; \
INFO4(LOG_NONLIN_SYS, "%s = %d pre(%s)= %d",__name, *loc_ptrs[i], __name, data->simulationInfo.booleanVarsPre[ix]); \
INFO4(LOG_NLS, "%s = %d pre(%s)= %d",__name, *loc_ptrs[i], __name, data->simulationInfo.booleanVarsPre[ix]); \
} \
} \
} while(0)
Expand Down
6 changes: 3 additions & 3 deletions SimulationRuntime/c/simulation/simulation_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void setTermMsg(const char *msg)
/* \brief determine verboselevel by investigating flag -lv flags
*
* Flags are or'ed to a returnvalue.
* Valid flags: LOG_EVENTS, LOG_NONLIN_SYS
* Valid flags: LOG_EVENTS, LOG_NLS
*/
void setGlobalVerboseLevel(int argc, char**argv)
{
Expand Down Expand Up @@ -214,8 +214,8 @@ void setGlobalVerboseLevel(int argc, char**argv)
if(useStream[LOG_SOLVER] == 1)
useStream[LOG_STATS] = 1;

if(useStream[LOG_NONLIN_SYS_V])
useStream[LOG_NONLIN_SYS] = 1;
if(useStream[LOG_NLS_V])
useStream[LOG_NLS] = 1;

if(error)
{
Expand Down
38 changes: 19 additions & 19 deletions SimulationRuntime/c/simulation/solver/kinsolSolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@
int eqSystemNumber = data->modelData.equationInfo_reverse_prof_index[nlsData->simProfEqNr];
NLS_KINSOL_DATA *kinsolData;

INFO1(LOG_NONLIN_SYS, "allocate memory for %s", data->modelData.equationInfo[eqSystemNumber].name);
INDENT(LOG_NONLIN_SYS);
INFO1(LOG_NLS, "allocate memory for %s", data->modelData.equationInfo[eqSystemNumber].name);
INDENT(LOG_NLS);
for(i=0; i<size; ++i)
INFO2(LOG_NONLIN_SYS, "[%d] %s", i+1, data->modelData.equationInfo[eqSystemNumber].vars[i]->name);
RELEASE(LOG_NONLIN_SYS);
INFO2(LOG_NLS, "[%d] %s", i+1, data->modelData.equationInfo[eqSystemNumber].vars[i]->name);
RELEASE(LOG_NLS);

/* allocate system data */
nlsData->solverData = malloc(sizeof(NLS_KINSOL_DATA));
Expand Down Expand Up @@ -151,15 +151,15 @@
int eqSystemNumber = kinsolData->data->modelData.equationInfo_reverse_prof_index[kinsolData->nlsData->simProfEqNr];
int i;

if(DEBUG_STREAM(LOG_NONLIN_SYS))
if(DEBUG_STREAM(LOG_NLS))
{
WARNING1(LOG_NONLIN_SYS, "kinsol failed for %s", kinsolData->data->modelData.equationInfo[eqSystemNumber].name);
INDENT(LOG_NONLIN_SYS);
WARNING1(LOG_NLS, "kinsol failed for %s", kinsolData->data->modelData.equationInfo[eqSystemNumber].name);
INDENT(LOG_NLS);

WARNING3(LOG_NONLIN_SYS, "[module] %s | [function] %s | [error_code] %d", module, function, error_code);
WARNING1(LOG_NONLIN_SYS, "%s", msg);
WARNING3(LOG_NLS, "[module] %s | [function] %s | [error_code] %d", module, function, error_code);
WARNING1(LOG_NLS, "%s", msg);

RELEASE(LOG_NONLIN_SYS);
RELEASE(LOG_NLS);
}
}

Expand Down Expand Up @@ -252,19 +252,19 @@
KINDlsGetNumFuncEvals(kmem, &nfeD);

/* solution */
INFO2(LOG_NONLIN_SYS, "solution for %s at t=%g", kinsolData->data->modelData.equationInfo[eqSystemNumber].name, kinsolData->data->localData[0]->timeValue);
INDENT(LOG_NONLIN_SYS);
INFO2(LOG_NLS, "solution for %s at t=%g", kinsolData->data->modelData.equationInfo[eqSystemNumber].name, kinsolData->data->localData[0]->timeValue);
INDENT(LOG_NLS);
for(i=0; i<size; ++i)
{
kinsolData->nlsData->nlsx[i] = NV_Ith_S(z, i);
INFO3(LOG_NONLIN_SYS, "[%d] %s = %g", i+1, kinsolData->data->modelData.equationInfo[eqSystemNumber].vars[i]->name, kinsolData->nlsData->nlsx[i]);
INFO3(LOG_NLS, "[%d] %s = %g", i+1, kinsolData->data->modelData.equationInfo[eqSystemNumber].vars[i]->name, kinsolData->nlsData->nlsx[i]);
}

INFO1(LOG_NONLIN_SYS, "KINGetNumNonlinSolvIters = %5ld", nni);
INFO1(LOG_NONLIN_SYS, "KINGetNumFuncEvals = %5ld", nfe);
INFO1(LOG_NONLIN_SYS, "KINDlsGetNumJacEvals = %5ld", nje);
INFO1(LOG_NONLIN_SYS, "KINDlsGetNumFuncEvals = %5ld", nfeD);
RELEASE(LOG_NONLIN_SYS);
INFO1(LOG_NLS, "KINGetNumNonlinSolvIters = %5ld", nni);
INFO1(LOG_NLS, "KINGetNumFuncEvals = %5ld", nfe);
INFO1(LOG_NLS, "KINDlsGetNumJacEvals = %5ld", nje);
INFO1(LOG_NLS, "KINDlsGetNumFuncEvals = %5ld", nfeD);
RELEASE(LOG_NLS);

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

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

Expand Down

0 comments on commit 0e5818c

Please sign in to comment.