Skip to content

Commit

Permalink
- get rid of unnecessary "Not Enough Time Points Warning"
Browse files Browse the repository at this point in the history
- initialize rand for cheap matching (this could be done better once at the begining of omc's life)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14327 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Dec 11, 2012
1 parent c9b6462 commit 7f13b68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions Compiler/runtime/SimulationResultsCmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

#include "systemimpl.h"

/* Size of the buffer for warnings and other messages */
#define WARNINGBUFFSIZE 250

typedef struct {
double *data;
Expand Down Expand Up @@ -628,15 +630,15 @@ void* SimulationResultsCmp_compareResults(const char *filename, const char *reff
}
/* check if reftime is larger or equal time */
res = mk_nil();
if (time.data[time.n] > timeref.data[timeref.n]) {
char buf[250];
if (time.data[time.n-1] > timeref.data[timeref.n-1]) {
char buf[WARNINGBUFFSIZE];
#ifdef DEBUGOUTPUT
fprintf(stderr, "max time value=%.6g ref max time value: %.6g\n",time.data[time.n],timeref.data[timeref.n]);
fprintf(stderr, "max time value=%.6g ref max time value: %.6g\n",time.data[time.n-1],timeref.data[timeref.n-1]);
#endif
res = mk_cons(mk_scon("Reference file has not enough time points!\n"),res);
snprintf(buf,250,"Reffile[%d]=%f\n",timeref.n,timeref.data[timeref.n]);
snprintf(buf,WARNINGBUFFSIZE,"Reffile[%d]=%f\n",timeref.n,timeref.data[timeref.n-1]);
res = mk_cons(mk_scon(buf),res);
snprintf(buf,250,"File[%d]=%f\n",time.n,time.data[time.n]);
snprintf(buf,WARNINGBUFFSIZE,"File[%d]=%f\n",time.n,time.data[time.n-1]);
res = mk_cons(mk_scon(buf),res);
}
var1=NULL;
Expand Down
3 changes: 2 additions & 1 deletion Compiler/runtime/matching_cheap.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ void sk_cheap(int* col_ptrs, int* col_ids, int* row_ptrs, int* row_ids,
void sk_cheap_rand(int* col_ptrs, int* col_ids, int* row_ptrs, int* row_ids,
int* match, int* row_match, int n, int m) {
int i;

/* initialize seed */
srand(1);
int* col_stack = (int*)malloc(n * sizeof(int));
int* col_degrees = (int*)malloc(n * sizeof(int));
memset(col_degrees, 0, n * sizeof(int));
Expand Down

0 comments on commit 7f13b68

Please sign in to comment.