Changeset 15338
- Timestamp:
- 2013-02-26T16:43:56+01:00 (11 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/runtime/SimulationResults.c
r15115 r15338 31 31 } SimulationResult_Globals; 32 32 33 void SimulationResultsImpl__close(SimulationResult_Globals* simresglob)33 static void SimulationResultsImpl__close(SimulationResult_Globals* simresglob) 34 34 { 35 35 switch (simresglob->curFormat) { -
trunk/Compiler/runtime/SimulationResultsCmp.c
r15023 r15338 117 117 } 118 118 119 double absdouble(double d)119 static inline double absdouble(double d) 120 120 { 121 121 if (d > 0.0) … … 125 125 } 126 126 127 char ** getVars(void *vars, unsigned int* nvars)127 static char ** getVars(void *vars, unsigned int* nvars) 128 128 { 129 129 char **cmpvars=NULL; … … 170 170 } 171 171 172 DataField getData(const char *varname,const char *filename, unsigned int size, SimulationResult_Globals* srg)172 static DataField getData(const char *varname,const char *filename, unsigned int size, SimulationResult_Globals* srg) 173 173 { 174 174 DataField res; … … 221 221 222 222 /* see http://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ */ 223 char AlmostEqualRelativeAndAbs(double A, double B)223 static char AlmostEqualRelativeAndAbs(double A, double B) 224 224 { 225 225 /* Check if the numbers are really close -- needed … … 238 238 } 239 239 240 unsigned int cmpData(char* varname, DataField *time, DataField *reftime, DataField *data, DataField *refdata, double reltol, double abstol, DiffDataField *ddf, char **cmpdiffvars, unsigned int vardiffindx)240 static unsigned int cmpData(char* varname, DataField *time, DataField *reftime, DataField *data, DataField *refdata, double reltol, double abstol, DiffDataField *ddf, char **cmpdiffvars, unsigned int vardiffindx) 241 241 { 242 242 unsigned int i,j,k,j_event; … … 541 541 } 542 542 543 int writeLogFile(const char *filename,DiffDataField *ddf,const char *f,const char *reff,double reltol,double abstol)543 static int writeLogFile(const char *filename,DiffDataField *ddf,const char *f,const char *reff,double reltol,double abstol) 544 544 { 545 545 FILE* fout; -
trunk/Compiler/runtime/System_rml.c
r15269 r15338 329 329 330 330 if(fileSize1 != fileSize2) 331 { 331 332 res=-1; 333 } 332 334 else 335 { 333 336 for(i=0;i<fileSize1;++i) 337 { 334 338 if(fgetc(fp1) != fgetc(fp2)) 339 { 335 340 res=-1; 341 break; 342 } 343 } 344 } 336 345 fclose(fp1);fclose(fp2); 337 346 … … 1232 1241 * helper function for getSymbolicLinkPath 1233 1242 **/ 1234 char *mergePathWithLink(char *path,char *linkPath)1243 static char *mergePathWithLink(char *path,char *linkPath) 1235 1244 { 1236 1245 char *lastSlash; … … 1255 1264 * 1256 1265 * */ 1257 char *getSymbolicLinkPath(char* path)1266 static char *getSymbolicLinkPath(char* path) 1258 1267 { 1259 1268 int err,readChars; … … 1299 1308 * 4) isLink(/home/bjozac/newDir/a.mo) 1300 1309 **/ 1301 char* findSymbolicLinks(char* path)1302 { 1303 1304 1305 1306 1307 1308 1309 1310 curRes = strcat(curRes,"/");1311 1312 1313 1314 1315 1316 1310 static char* findSymbolicLinks(char* path) 1311 { 1312 int i; 1313 char *curRes = (char *) malloc(sizeof(char)*MAXPATHLEN); 1314 char *curPos; 1315 char *endPos; 1316 curRes[0]='\0'; 1317 curPos = path; 1318 if(path[0]=='/'){ 1319 curRes = strcat(curRes,"/"); 1320 curPos = &path[1]; // skip first slash, will add when finished. 1321 } 1322 1323 for(i=0;i<100;++i){ 1324 endPos = strchr(curPos,'/'); 1325 if(endPos==NULL){ // End OF String 1317 1326 endPos = strrchr(curPos,'\0'); 1318 1327 strncat(curRes,curPos,endPos-curPos); // add filename … … 1321 1330 //printf("\tbecame: %s\n",curRes); 1322 1331 free(path); 1323 return curRes; 1324 } 1325 strncat(curRes,curPos,endPos-curPos); 1326 curRes = getSymbolicLinkPath(curRes); 1327 if(curRes[strlen(curRes)-1] != '/') 1328 strcat(curRes,"/"); 1329 //printf("path: %s\n",curRes); 1330 curPos = endPos+1; 1332 return curRes; 1331 1333 } 1334 strncat(curRes,curPos,endPos-curPos); 1335 curRes = getSymbolicLinkPath(curRes); 1336 if(curRes[strlen(curRes)-1] != '/') 1337 { 1338 strcat(curRes,"/"); 1339 } 1340 //printf("path: %s\n",curRes); 1341 curPos = endPos+1; 1342 } 1332 1343 if(strchr(path,'/')!=NULL) 1333 1344 fprintf(stderr,"possible error in save-function\n"); 1334 1335 1345 free(path); 1346 return curRes; 1336 1347 } 1337 1348 … … 1341 1352 1342 1353 */ 1343 char* normalizePath(const char* src)1354 static char* normalizePath(const char* src) 1344 1355 { 1345 1356 const char* srcEnd = src + strlen(src); … … 1541 1552 /* adrpo added 2004-10-28 */ 1542 1553 //free(files[i]->d_name); 1543 free(files[i]);1554 free(files[i]); 1544 1555 } 1545 1556 rmlA0 = (void*) res; -
trunk/Compiler/runtime/errorext.h
r11994 r15338 66 66 char* ErrorImpl__rollBackAndPrint(const char* id); // Returns the error string that we rolled back. free this resource 67 67 68 extern int showErrorMessages; 69 68 70 #ifdef __cplusplus 69 71 } … … 80 82 const char* message, 81 83 std::list<std::string> tokens); 82 84 83 85 void add_source_message(int errorID, 84 86 const char* type, … … 93 95 const char* filename); 94 96 95 extern int showErrorMessages;96 97 97 #endif 98 98 -
trunk/Compiler/runtime/printimpl.c
r15318 r15338 36 36 #include "systemimpl.h" 37 37 38 /* adrpo: this is defined in errorext. (enabled with omc +showErrorMessages) */ 39 extern int showErrorMessages; 38 /* adrpo: "int showErrorMessages" is defined in errorext. (enabled with omc +showErrorMessages) */ 40 39 41 40 #define GROWTH_FACTOR 1.4 /* According to some rumors of buffer growth */ … … 50 49 #define errorCursize Print_var_errorCursize 51 50 52 char *buf = NULL;53 char *errorBuf = NULL;54 55 int nfilled=0;56 int cursize=0;57 58 int errorNfilled=0;59 int errorCursize=0;60 61 char** savedBuffers=0;62 long* savedCurSize;63 long* savedNfilled;51 static char *buf = NULL; 52 static char *errorBuf = NULL; 53 54 static int nfilled=0; 55 static int cursize=0; 56 57 static int errorNfilled=0; 58 static int errorCursize=0; 59 60 static char** savedBuffers=0; 61 static long* savedCurSize; 62 static long* savedNfilled; 64 63 65 64 static int increase_buffer(void) … … 136 135 } 137 136 138 int print_error_buf_impl(const char *str)137 static int print_error_buf_impl(const char *str) 139 138 { 140 139 /* printf("cursize: %d, nfilled %d, strlen: %d\n",cursize,nfilled,strlen(str));*/ … … 242 241 243 242 /* returns NULL on failure */ 244 const char* PrintImpl__getString(void)243 static const char* PrintImpl__getString(void) 245 244 { 246 245 if(buf == NULL || buf[0]=='\0' || cursize==0){ … … 360 359 savedCurSize[handle] = 0; 361 360 savedNfilled[handle] = 0; 362 if (buf == 0) { 361 if (buf == 0) { 363 362 fprintf(stderr,"Internal error, handle %d does not contain a valid buffer pointer\n",handle); 364 363 return 1; … … 372 371 long freeHandle,foundHandle=0; 373 372 374 if (! savedBuffers) { 373 if (! savedBuffers) { 375 374 savedBuffers = (char**)malloc(MAXSAVEDBUFFERS*sizeof(char*)); 376 if (!savedBuffers) { 375 if (!savedBuffers) { 377 376 fprintf(stderr, "Internal error allocating savedBuffers in Print.saveAndClearBuf\n"); 378 377 return -1; … … 380 379 memset(savedBuffers,0,MAXSAVEDBUFFERS); 381 380 } 382 if (! savedCurSize) { 381 if (! savedCurSize) { 383 382 savedCurSize = (long*)malloc(MAXSAVEDBUFFERS*sizeof(long*)); 384 if (!savedCurSize) { 383 if (!savedCurSize) { 385 384 fprintf(stderr, "Internal error allocating savedCurSize in Print.saveAndClearBuf\n"); 386 385 return -1; … … 388 387 memset(savedCurSize,0,MAXSAVEDBUFFERS); 389 388 } 390 if (! savedNfilled) { 389 if (! savedNfilled) { 391 390 savedNfilled = (long*)malloc(MAXSAVEDBUFFERS*sizeof(long*)); 392 if (!savedNfilled) { 391 if (!savedNfilled) { 393 392 fprintf(stderr, "Internal error allocating savedNfilled in Print.saveAndClearBuf\n"); 394 393 return -1; -
trunk/Compiler/runtime/settingsimpl.c
r13235 r15338 66 66 extern int SystemImpl__directoryExists(const char*); 67 67 68 char* winPath = NULL;68 static char* winPath = NULL; 69 69 70 70 // Do not free or modify the returned variable. It's part of the environment! … … 93 93 i++; 94 94 } 95 /* set the termination */96 winPath[i] = '\0';97 95 return (const char*)winPath; 98 96 #endif … … 100 98 } 101 99 102 char* winLibPath = NULL;100 static char* winLibPath = NULL; 103 101 104 102 // Do not free the returned variable. It's malloc'ed … … 132 130 133 131 #if defined(__MINGW32__) || defined(_MSC_VER) 132 /* already set, set it only once! */ 133 if (winLibPath != NULL) 134 return winLibPath; 135 134 136 /* adrpo: translate this to forward slashes! */ 135 137 /* duplicate the path */ … … 146 148 i++; 147 149 } 148 /* set the termination */149 winLibPath[i] = '\0';150 150 return winLibPath; 151 151 #endif -
trunk/SimulationRuntime/c/simulation/solver/radau.c
r15313 r15338 33 33 */ 34 34 35 #include <string.h> 36 35 37 #include "radau.h" 36 38 #ifdef WITH_SUNDIALS 37 39 38 int allocateNlpOde(KINODE *kinOde); 39 int allocateKINSOLODE(KINODE *kinOde); 40 41 int boundsVars(KINODE *kinOde); 42 43 int radau1Coeff(KINODE *kinOd); 44 int radau3Coeff(KINODE *kinOde); 45 int radau5Coeff(KINODE *kinOd); 46 int lobatto4Coeff(KINODE *kinOd); 47 int lobatto6Coeff(KINODE *kinOd); 48 49 int radau1Res(N_Vector z, N_Vector f, void* user_data); 50 int radau3Res(N_Vector z, N_Vector f, void* user_data); 51 int radau5Res(N_Vector z, N_Vector f, void* user_data); 52 int lobatto2Res(N_Vector z, N_Vector f, void* user_data); 53 int lobatto4Res(N_Vector z, N_Vector f, void* user_data); 54 int lobatto6Res(N_Vector z, N_Vector f, void* user_data); 40 static int allocateNlpOde(KINODE *kinOde); 41 static int allocateKINSOLODE(KINODE *kinOde); 42 43 static int freeImOde(void *nlpode, int N); 44 static int freeKinsol(void * kOde); 45 46 static int boundsVars(KINODE *kinOde); 47 48 static int radau1Coeff(KINODE *kinOd); 49 static int radau3Coeff(KINODE *kinOde); 50 static int radau5Coeff(KINODE *kinOd); 51 static int lobatto4Coeff(KINODE *kinOd); 52 static int lobatto6Coeff(KINODE *kinOd); 53 54 static int radau1Res(N_Vector z, N_Vector f, void* user_data); 55 static int radau3Res(N_Vector z, N_Vector f, void* user_data); 56 static int radau5Res(N_Vector z, N_Vector f, void* user_data); 57 static int lobatto2Res(N_Vector z, N_Vector f, void* user_data); 58 static int lobatto4Res(N_Vector z, N_Vector f, void* user_data); 59 static int lobatto6Res(N_Vector z, N_Vector f, void* user_data); 55 60 56 61 int allocateKinOde(DATA* data, SOLVER_INFO* solverInfo, int flag, int N) … … 68 73 } 69 74 70 int allocateNlpOde(KINODE *kinOde)75 static int allocateNlpOde(KINODE *kinOde) 71 76 { 72 77 NLPODE * nlp = (NLPODE*) kinOde->nlp; … … 105 110 } 106 111 107 int boundsVars(KINODE *kinOde)112 static int boundsVars(KINODE *kinOde) 108 113 { 109 114 int i; … … 127 132 } 128 133 129 int radau5Coeff(KINODE *kinOde)134 static int radau5Coeff(KINODE *kinOde) 130 135 { 131 136 int i, N; … … 160 165 } 161 166 162 int radau3Coeff(KINODE *kinOde)167 static int radau3Coeff(KINODE *kinOde) 163 168 { 164 169 int i, N; … … 185 190 } 186 191 187 int radau1Coeff(KINODE *kinOde)192 static int radau1Coeff(KINODE *kinOde) 188 193 { 189 194 NLPODE * nlp = (NLPODE*) kinOde->nlp; … … 193 198 } 194 199 195 int lobatto4Coeff(KINODE *kinOde)200 static int lobatto4Coeff(KINODE *kinOde) 196 201 { 197 202 NLPODE * nlp = (NLPODE*) kinOde->nlp; … … 203 208 } 204 209 205 int lobatto6Coeff(KINODE *kinOde)210 static int lobatto6Coeff(KINODE *kinOde) 206 211 { 207 212 int i, N; … … 239 244 } 240 245 241 int allocateKINSOLODE(KINODE *kinOde)246 static int allocateKINSOLODE(KINODE *kinOde) 242 247 { 243 248 int N = kinOde->N; … … 289 294 } 290 295 291 int freeImOde(void *nlpode, int N)296 static int freeImOde(void *nlpode, int N) 292 297 { 293 298 int i; … … 307 312 } 308 313 309 int freeKinsol(void * kOde)314 static int freeKinsol(void * kOde) 310 315 { 311 316 KDATAODE *kData = (KDATAODE*) kOde; … … 317 322 } 318 323 319 int initKinsol(KINODE *kinOde)324 static int initKinsol(KINODE *kinOde) 320 325 { 321 326 int i,j,k; … … 407 412 } 408 413 409 int refreshModell(DATA* data, double* x, double time)414 static int refreshModell(DATA* data, double* x, double time) 410 415 { 411 416 int i; … … 419 424 } 420 425 421 int radau5Res(N_Vector x, N_Vector f, void* user_data)426 static int radau5Res(N_Vector x, N_Vector f, void* user_data) 422 427 { 423 428 int i,sub2,sub3; … … 490 495 } 491 496 492 int radau3Res(N_Vector x, N_Vector f, void* user_data)497 static int radau3Res(N_Vector x, N_Vector f, void* user_data) 493 498 { 494 499 int i,sub2, N; … … 545 550 546 551 547 int radau1Res(N_Vector x, N_Vector f, void* user_data)552 static int radau1Res(N_Vector x, N_Vector f, void* user_data) 548 553 { 549 554 int i,sub2, N; … … 584 589 } 585 590 586 int lobatto2Res(N_Vector x, N_Vector f, void* user_data)591 static int lobatto2Res(N_Vector x, N_Vector f, void* user_data) 587 592 { 588 593 int i, N; … … 625 630 } 626 631 627 int lobatto4Res(N_Vector x, N_Vector f, void* user_data)632 static int lobatto4Res(N_Vector x, N_Vector f, void* user_data) 628 633 { 629 634 int i,sub2, N; … … 677 682 } 678 683 679 int lobatto6Res(N_Vector x, N_Vector f, void* user_data)684 static int lobatto6Res(N_Vector x, N_Vector f, void* user_data) 680 685 { 681 686 int i,sub2, N;
Note: See TracChangeset
for help on using the changeset viewer.