Skip to content

Commit

Permalink
- msvc friendly implementation
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24999 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Mar 9, 2015
1 parent 2826f4e commit 96fb6d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion SimulationRuntime/c/simulation/solver/model_help.c
Expand Up @@ -349,12 +349,14 @@ void printSparseStructure(DATA *data, int stream)
const int index = data->callback->INDEX_JAC_A;
unsigned int row, col, i, j;
/* Will crash with a static size array */
char buffer[2*data->simulationInfo.analyticJacobians[index].sizeCols + 4];
char *buffer = NULL;

if (!ACTIVE_STREAM(stream)) {
return;
}

buffer = (char*)GC_malloc(sizeof(char)* 2*data->simulationInfo.analyticJacobians[index].sizeCols + 4);

infoStreamPrint(stream, 1, "sparse structure of jacobian A [size: %ux%u]", data->simulationInfo.analyticJacobians[index].sizeRows, data->simulationInfo.analyticJacobians[index].sizeCols);
infoStreamPrint(stream, 0, "%u nonzero elements", data->simulationInfo.analyticJacobians[index].sparsePattern.numberOfNoneZeros);
/*
Expand Down Expand Up @@ -389,6 +391,7 @@ void printSparseStructure(DATA *data, int stream)
}
messageClose(stream);
messageClose(stream);
GC_free(buffer);
}

#ifdef USE_DEBUG_OUTPUT
Expand Down

0 comments on commit 96fb6d9

Please sign in to comment.