Changeset 774 for trunk/AGRIF/LIB/toamr.c
- Timestamp:
- 2007-12-18T17:45:53+01:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/AGRIF/LIB/toamr.c
r663 r774 31 31 /* knowledge of the CeCILL-C license and that you accept its terms. */ 32 32 /******************************************************************************/ 33 /* version 1. 6*/33 /* version 1.7 */ 34 34 /******************************************************************************/ 35 35 #include <stdlib.h> … … 37 37 #include <string.h> 38 38 #include "decl.h" 39 char lvargridname[LONG NOM];40 char lvargridname2[LONG NOM];39 char lvargridname[LONG_4C]; 40 char lvargridname2[LONG_4C]; 41 41 42 42 … … 54 54 char *ligne; 55 55 56 ligne = (char *) malloc (LONG LIGNE* sizeof (char));56 ligne = (char *) malloc (LONG_C * sizeof (char)); 57 57 sprintf (ligne, "Agrif_Mygrid %% tabvars(%d) %% var ", var->v_indicetabvars); 58 58 return ligne; … … 75 75 char *ligne; 76 76 77 ligne = (char *) malloc (LONG LIGNE* sizeof (char));77 ligne = (char *) malloc (LONG_C * sizeof (char)); 78 78 if ( iorindice == 0 ) sprintf (ligne, " Agrif_Gr %% tabvars(%d)%% var", 79 79 var->v_indicetabvars); … … 95 95 char *ligne; 96 96 97 ligne = (char *) malloc (LONG LIGNE* sizeof (char));97 ligne = (char *) malloc (LONG_C * sizeof (char)); 98 98 if ( ParentOrCurgrid == 0 ) sprintf (ligne, " Agrif_tabvars(%d) %% var", 99 99 var->v_indicetabvars); … … 112 112 } 113 113 114 void WARNING_CharSize(variable *var) 115 { 116 if ( var->v_nbdim == 0 ) 117 { 118 if ( convert2int(var->v_dimchar) > 2050 ) 119 { 120 printf("WARNING : The dimension of the character %s \n", 121 var->v_nomvar); 122 printf(" is upper than 2050. You must change \n"); 123 printf(" the dimension of carray0 \n"); 124 printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); 125 printf(" line 247. Replace 300 with %d. \n", 126 convert2int(var->v_dimchar)+100); 127 } 128 Save_Length_int(convert2int(var->v_dimchar),1); 129 } 130 else if ( var->v_nbdim == 1 ) 131 { 132 if ( convert2int(var->v_dimchar) > 300 ) 133 { 134 printf("WARNING : The dimension of the character %s \n", 135 var->v_nomvar); 136 printf(" is upper than 300. You must change \n"); 137 printf(" the dimension of carray1 \n"); 138 printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); 139 printf(" line 247. Replace 300 with %d. \n", 140 convert2int(var->v_dimchar)+100); 141 } 142 Save_Length_int(convert2int(var->v_dimchar),2); 143 } 144 else if ( var->v_nbdim == 2 ) 145 { 146 if ( convert2int(var->v_dimchar) > 300 ) 147 { 148 printf("WARNING : The dimension of the character %s \n", 149 var->v_nomvar); 150 printf(" is upper than 300. You must change \n"); 151 printf(" the dimension of carray2 \n"); 152 printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); 153 printf(" line 247. Replace 300 with %d. \n", 154 convert2int(var->v_dimchar)+100); 155 } 156 Save_Length_int(convert2int(var->v_dimchar),3); 157 } 158 else if ( var->v_nbdim == 3 ) 159 { 160 if ( convert2int(var->v_dimchar) > 300 ) 161 { 162 printf("WARNING : The dimension of the character %s \n", 163 var->v_nomvar); 164 printf(" is upper than 300. You must change \n"); 165 printf(" the dimension of carray3 \n"); 166 printf(" in the file AGRIF/AGRIF_FILES/modtypes.F \n"); 167 printf(" line 247. Replace 300 with %d. \n", 168 convert2int(var->v_dimchar)+100); 169 } 170 Save_Length_int(convert2int(var->v_dimchar),4); 171 } 172 } 114 173 /******************************************************************************/ 115 174 /* vargridnametabvars */ … … 126 185 { 127 186 char *tmp; 128 char tmp1[LONG NOM];187 char tmp1[LONG_C]; 129 188 130 189 tmp = variablenametabvars (var,iorindice); … … 151 210 else if (!strcasecmp (var->v_typevar, "CHARACTER")) 152 211 { 212 WARNING_CharSize(var); 153 213 sprintf (lvargridname2, "%% carray%d", var->v_nbdim); 154 214 } … … 156 216 strcat (lvargridname, lvargridname2); 157 217 218 Save_Length(lvargridname,42); 219 Save_Length(lvargridname2,42); 158 220 return lvargridname; 159 221 } … … 175 237 { 176 238 char *tmp; 177 char tmp1[LONG NOM];239 char tmp1[LONG_C]; 178 240 179 241 tmp = variablecurgridtabvars (var,ParentOrCurgrid); … … 200 262 else if (!strcasecmp (var->v_typevar, "CHARACTER")) 201 263 { 264 WARNING_CharSize(var); 202 265 sprintf (lvargridname2, "%% carray%d", var->v_nbdim); 203 266 } … … 205 268 strcat (lvargridname, lvargridname2); 206 269 270 Save_Length(lvargridname,42); 271 Save_Length(lvargridname2,42); 207 272 return lvargridname; 208 273 } … … 238 303 else if (!strcasecmp (var->v_typevar, "CHARACTER")) 239 304 { 305 WARNING_CharSize(var); 240 306 sprintf (lvargridname2, "%% carray%d", var->v_nbdim); 241 307 } … … 243 309 strcat (lvargridname, lvargridname2); 244 310 311 Save_Length(lvargridname,42); 312 Save_Length(lvargridname2,42); 245 313 return lvargridname; 246 314 } … … 260 328 typedim dim; 261 329 listdim *newdim; 262 char newname[LONG NOM];330 char newname[LONG_4C]; 263 331 264 332 newdim = v->v_dimension; … … 305 373 (dim.last, List_ModuleUsed_Var,whichone)); 306 374 } 375 Save_Length(tmpvargridname,46); 307 376 strcat (tmpvargridname, newname); 308 377 newdim = newdim->suiv; … … 311 380 strcat (tmpvargridname, ")"); 312 381 strcat (tmpvargridname, "\0"); 382 Save_Length(tmpvargridname,40); 313 383 return tmpvargridname; 314 384 } … … 328 398 { 329 399 FILE *probdim; 330 char ligne[LONG LIGNE*100];400 char ligne[LONG_C]; 331 401 332 402 probdim = associate("probdim_agrif.h"); … … 376 446 void write_modtypeagrif_file() 377 447 { 378 char ligne[LONG LIGNE*100];448 char ligne[LONG_C]; 379 449 FILE *typedata; 380 450 … … 398 468 int *InitEmpty) 399 469 { 400 char ligne[LONG LIGNE*100];470 char ligne[LONG_C]; 401 471 char *tmp; 402 char temp1[LONG LIGNE];472 char temp1[LONG_C]; 403 473 404 474 tmp = variablenametabvars(v,0); … … 420 490 /* */ 421 491 /******************************************************************************/ 422 void write_Setnumberofcells_file( )423 { 424 char ligne[LONG LIGNE*100];492 void write_Setnumberofcells_file(char *name) 493 { 494 char ligne[LONG_C]; 425 495 FILE *setnumberofcells; 426 496 427 497 if ( IndicenbmaillesX != 0 ) 428 498 { 429 setnumberofcells=associate( "SetNumberofcells.h");499 setnumberofcells=associate(name); 430 500 431 501 if (onlyfixedgrids != 1 ) … … 489 559 /* */ 490 560 /******************************************************************************/ 491 void write_Getnumberofcells_file( )492 { 493 char ligne[LONG LIGNE*100];561 void write_Getnumberofcells_file(char *name) 562 { 563 char ligne[LONG_C]; 494 564 FILE *getnumberofcells; 495 565 496 566 if ( IndicenbmaillesX != 0 ) 497 567 { 498 getnumberofcells=associate( "GetNumberofcells.h");568 getnumberofcells=associate(name); 499 569 sprintf (ligne, 500 570 "Agrif_Curgrid %% tabvars(%d) %% var %% iarray0 = Agrif_Gr %% nb(1)", … … 533 603 int *VarnameEmpty) 534 604 { 535 char ligne[LONG LIGNE*100];536 char temp1[LONG LIGNE];605 char ligne[LONG_C]; 606 char temp1[LONG_C]; 537 607 char *tmp; 538 608 … … 605 675 int indiceprec; 606 676 int ValeurMax; 607 char initialvalue[LONG NOM];677 char initialvalue[LONG_4C]; 608 678 listindice *list_indic; 609 679 listindice *parcoursindic; 610 680 int i; 611 681 682 parcoursprec = (listvar *)NULL; 612 683 parcours_nom = List_NameOfCommon; 613 684 ValeurMax = 2; … … 652 723 strcat (ligne, vargridnametabvars(v,0)); 653 724 strcat (ligne, ")) then"); 725 Save_Length(ligne,48); 654 726 tofich (allocationagrif, ligne,1); 655 727 } … … 700 772 strcat (ligne, vargridparam(v,0)); 701 773 strcat (ligne, ")"); 774 Save_Length(ligne,48); 702 775 tofich (allocationagrif, ligne,1); 703 776 fprintf(allocationagrif," end do\n"); … … 721 794 strcat (ligne, vargridparam(v,0)); 722 795 strcat (ligne, ")"); 796 Save_Length(ligne,48); 723 797 tofich (allocationagrif, ligne,1); 724 798 /* */ … … 759 833 strcat (ligne,initialvalue); 760 834 /* */ 835 Save_Length(ligne,48); 761 836 tofich (allocationagrif, ligne,1); 762 837 } … … 801 876 int indiceprec; 802 877 int ValeurMax; 803 char initialvalue[LONGNOM]; 804 878 char initialvalue[LONG_4C]; 879 880 parcoursprec = (listvar *)NULL; 805 881 parcours_nom = List_NameOfModule; 806 882 ValeurMax = 2; … … 849 925 strcat (ligne, vargridnametabvars(v,0)); 850 926 strcat (ligne, ")) then"); 927 Save_Length(ligne,48); 851 928 tofich (allocationagrif, ligne,1); 852 929 } … … 896 973 strcat (ligne, vargridparam(v,0)); 897 974 strcat (ligne, ")"); 975 Save_Length(ligne,48); 898 976 tofich (allocationagrif, ligne,1); 899 977 fprintf(allocationagrif," end do\n"); … … 907 985 strcat (ligne, vargridparam(v,0)); 908 986 strcat (ligne, ")"); 987 Save_Length(ligne,48); 909 988 tofich (allocationagrif, ligne,1); 910 989 } … … 936 1015 strcat (ligne,initialvalue); 937 1016 /* */ 1017 Save_Length(ligne,48); 938 1018 tofich (allocationagrif, ligne,1); 939 1019 } … … 982 1062 variable *v; 983 1063 int erreur; 984 char filefich[LONGNOM]; 985 char ligne[LONGNOM]; 986 char ligne1[LONGNOM]; 1064 char filefich[LONG_C]; 1065 char ligne[LONG_C]; 987 1066 int IndiceMax; 988 1067 int IndiceMin; … … 995 1074 FILE *createvarname; 996 1075 FILE *createvarnameglobal; 997 FILE *modulealloc;998 FILE *dependfileoutput;999 1076 1000 1077 if ( todebug == 1 ) printf("Enter in creefichieramr\n"); … … 1085 1162 write_keysagrif_file(); 1086 1163 write_modtypeagrif_file(); 1087 write_Setnumberofcells_file(); 1088 write_Getnumberofcells_file(); 1164 if ( NbMailleXDefined == 1 ) 1165 write_Setnumberofcells_file("SetNumberofcells.h"); 1166 if ( NbMailleXDefined == 1 ) 1167 write_Getnumberofcells_file("GetNumberofcells.h"); 1168 retour77 = 0; 1169 if ( NbMailleXDefined == 1 ) 1170 write_Setnumberofcells_file("SetNumberofcellsFree.h"); 1171 if ( NbMailleXDefined == 1 ) 1172 write_Getnumberofcells_file("GetNumberofcellsFree.h"); 1173 retour77 = 1; 1174 if ( NbMailleXDefined == 1 ) 1175 write_Setnumberofcells_file("SetNumberofcellsFixed.h"); 1176 if ( NbMailleXDefined == 1 ) 1177 write_Getnumberofcells_file("GetNumberofcellsFixed.h"); 1089 1178 if ( todebug == 1 ) printf("Out of creefichieramr\n"); 1090 1179 }
Note: See TracChangeset
for help on using the changeset viewer.