Changeset 25537
- Timestamp:
- 09/05/20 19:00:40 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/branches/trunk-larour-SLPS2020/src/c/main/issm_post.cpp ¶
r25496 r25537 60 60 /*Retrieve fields:*/ 61 61 nfields=atoi(argv[5]); 62 fields=xNew<char*>(nfields); 62 63 for(int i=0;i<nfields;i++){ 63 fields=xNew<char*>(nfields);64 64 string= argv[6+i]; 65 65 field=xNew<char>(strlen(string)+1); … … 69 69 parameters->AddObject(new StringArrayParam(FieldsEnum,fields,nfields)); 70 70 offset=6+nfields; 71 72 /*free some memory: */ 73 for(int i=0;i<nfields;i++){ 74 char* field=fields[i]; 75 xDelete<char>(field); 76 } 77 xDelete<char*>(fields); 71 78 72 79 /*Retrieve time steps:*/ … … 86 93 for (int i=step1;i<=step2;i++)steps[i-step1]=i; 87 94 parameters->AddObject(new IntVecParam(StepsEnum,steps,nsteps)); 88 89 95 offset++; 96 97 /*free some memory:*/ 98 xDelete<int>(steps); 99 90 100 /*}}}*/ 91 101 … … 113 123 } 114 124 parameters->AddObject(new IntVecParam(IndicesEnum,indices,nindices)); 125 126 /*free some memory:*/ 127 xDelete<int>(indices); 115 128 116 129 ComputeSampleSeries(parameters,results); 117 130 } 118 119 120 131 121 132 else _error_("unknown method: " << method << "\n"); … … 124 135 ISSM_MPI_Barrier(ISSM_MPI_COMM_WORLD); _printf0_("Output file.\n"); 125 136 OutputStatistics(parameters,results); 137 138 /*Delete ressources:*/ 139 delete parameters; 140 delete results; 126 141 127 142 /*Finalize ISSM:*/ … … 190 205 _printf0_("reading file #: " << i << "\n"); 191 206 char file[1000]; 192 int length;207 long int length; 193 208 char* buffer=NULL; 194 209 … … 197 212 198 213 /*open file: */ 199 _printf0_(" opening file: \n");214 _printf0_(" opening file: " << file << "\n"); 200 215 FILE* fid=fopen(file,"rb"); 216 if(fid==NULL) _error_(" could not open file: " << file << "\n"); 201 217 202 218 /*figure out size of file, and read the whole thing:*/ … … 505 521 _printf0_("reading file #: " << i << "\n"); 506 522 char file[1000]; 507 int length;523 long int length; 508 524 char* buffer=NULL; 509 525 … … 668 684 _printf0_("reading file #: " << i << "\n"); 669 685 char file[1000]; 670 int length;686 long int length; 671 687 char* buffer=NULL; 672 688 … … 675 691 676 692 /*open file: */ 677 _printf0_(" opening file: \n");693 _printf0_(" opening file: " << file < "\n"); 678 694 FILE* fid=fopen(file,"rb"); 679 695 if(fid==NULL)_error_("cound not open file: " << file << "\n"); … … 715 731 xMemCpy<IssmDouble>(minxs[counter],doublemat,doublematsize); 716 732 xsize[counter]=doublematsize; 733 xDelete<IssmDouble>(doublemat); 717 734 } 718 735 else _error_("cannot carry out statistics on type " << xtype[counter]); … … 730 747 if(doublemat[k]<newmin[k])newmin[k]=doublemat[k]; 731 748 } 749 xDelete<IssmDouble>(doublemat); 732 750 } 733 751 else _error_("cannot carry out statistics on type " << xtype[counter]); … … 773 791 timemean[k]+=doublemat[k]/nsteps; 774 792 } 793 xDelete<IssmDouble>(doublemat); 775 794 } 776 795 … … 899 918 _printf0_("reading file #: " << i << "\n"); 900 919 char file[1000]; 901 int length;920 long int length; 902 921 char* buffer=NULL; 903 922 … … 952 971 } 953 972 histogram[counter]=localhistogram; 973 xDelete<IssmDouble>(doublemat); 954 974 } 955 975 else _error_("cannot carry out statistics on type " << xtype[counter]); … … 972 992 localhistogram[k*nbins+index]++; 973 993 } 994 xDelete<IssmDouble>(doublemat); 974 995 } 975 996 else _error_("cannot carry out statistics on type " << xtype[counter]); … … 1018 1039 timemean[k]+=doublemat[k]/nsteps; 1019 1040 } 1041 xDelete<IssmDouble>(doublemat); 1020 1042 } 1021 1043 … … 1051 1073 xDelete<char>(buffer); 1052 1074 } 1075 _printf0_("Start aggregating histogram:\n"); 1053 1076 1054 1077 /*We have agregated histograms across the cluster, now gather them across the cluster onto … … 1088 1111 /*we are broadcasting double arrays:*/ 1089 1112 IssmDouble* histo=histogram[counter]; 1090 IssmDouble* 1113 IssmDouble* allhisto=xNew<IssmDouble>(size*nbins); 1091 1114 1092 1115 ISSM_MPI_Allreduce(histo,allhisto,size*nbins,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,IssmComm::GetComm()); 1116 xDelete<IssmDouble>(histo); 1093 1117 1094 1118 /*add to results:*/ … … 1107 1131 } /*}}}*/ 1108 1132 } 1133 _printf0_("Start aggregating time mean histogram:\n"); 1109 1134 1110 1135 /*Now do the same for the time mean fields:*/ … … 1140 1165 1141 1166 ISSM_MPI_Allreduce(histo,allhisto,size*nbins,ISSM_MPI_PDOUBLE,ISSM_MPI_SUM,IssmComm::GetComm()); 1167 xDelete<IssmDouble>(histo); 1142 1168 /*add to results at step 1:*/ 1143 1169 if(my_rank==0){
Note:
See TracChangeset
for help on using the changeset viewer.