Changeset 4854
- Timestamp:
- 07/28/10 18:36:07 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/ModelProcessorx/Qmu/CreateParametersQmu.cpp
r4853 r4854 27 27 char** variabledescriptors=NULL; 28 28 char* descriptor=NULL; 29 char* tag=NULL;30 29 double* dakota_parameter=NULL; 31 30 … … 35 34 char* qmuoutname=NULL; 36 35 extern int my_rank; 37 36 37 //tags 38 char variabledescriptors_tag[30]; //strlen("variabledescriptor"+number)+1 39 char responsedescriptors_tag[30]; //strlen("responsedescriptors"+number)+1 40 char massflux_tag[35]; //strlen("qmu_mass_flux_segments"+number)+1 38 41 39 42 /*parameters for mass flux: */ 40 43 bool qmu_mass_flux_present=false; 41 double* qmu_mass_flux_segments=NULL; 42 double* my_qmu_mass_flux_segments=NULL; 43 double* qmu_mass_flux_num_segments=NULL; 44 double* my_qmu_mass_flux_num_segments=NULL; 45 int tot_qmu_mass_flux_segments=0; 46 int my_tot_qmu_mass_flux_segments=0; 47 int tot_qmu_mass_flux_num_segments=0; 48 int my_tot_qmu_mass_flux_num_segments=0; 44 double** array=NULL; 45 double* matrix=NULL; 46 int* mdims_array=NULL; 47 int* ndims_array=NULL; 48 int M; 49 49 50 50 #ifdef _SERIAL_ … … 90 90 } 91 91 #else 92 tag=(char*)xmalloc((strlen("variabledescriptori")+1)*sizeof(char)); 93 for(i=0;i<iomodel->numberofvariables;i++){ 94 sprintf(tag,"%s%i","variabledescriptor",i); 95 IoModelFetchData(&descriptor,iomodel_handle,tag); 92 for(i=0;i<iomodel->numberofvariables;i++){ 93 sprintf(variabledescriptors_tag,"%s%i","variabledescriptor",i); 94 IoModelFetchData(&descriptor,iomodel_handle,variabledescriptors_tag); 96 95 variabledescriptors[i]=descriptor; 97 96 } … … 115 114 } 116 115 #else 117 xfree((void**)&tag); 118 tag=(char*)xmalloc((strlen("responsedescriptori")+1)*sizeof(char)); 119 120 for(i=0;i<iomodel->numberofresponses;i++){ 121 sprintf(tag,"%s%i","responsedescriptor",i); 122 IoModelFetchData(&descriptor,iomodel_handle,tag); 116 for(i=0;i<iomodel->numberofresponses;i++){ 117 sprintf(responsedescriptors_tag,"%s%i","responsedescriptor",i); 118 IoModelFetchData(&descriptor,iomodel_handle,responsedescriptors_tag); 123 119 responsedescriptors[i]=descriptor; 124 120 } … … 186 182 *responses. Let's build a DoubleMatArrayParam object with the array of segments: */ 187 183 184 if(iomodel->qmu_mass_flux_num_profiles==0)ISSMERROR(" qmu_mass_flux_num_profiles is 0, when MassFlux computations were requested!"); 185 array=(double**)xmalloc(iomodel->qmu_mass_flux_num_profiles*sizeof(double*)); 186 mdims_array=(int*)xmalloc(iomodel->qmu_mass_flux_num_profiles*sizeof(int)); 187 ndims_array=(int*)xmalloc(iomodel->qmu_mass_flux_num_profiles*sizeof(int)); 188 M=iomodel->qmu_mass_flux_num_profiles; 189 190 #ifdef _SERIAL_ 191 pfield=mxGetField(iomodel_handle,0,"qmu_mass_flux_segments"); 192 for(i=0;i<iomodel->qmu_mass_flux_num_profiles;i++){ 193 pfield2=mxGetCell(pfield,i); 194 FetchData(&matrix,mdims_array+i,ndims_array+i,pfield2); 195 array[i]=matrix; 196 } 197 #else 198 for(i=0;i<iomodel->qmu_mass_flux_num_profiles;i++){ 199 sprintf(massflux_tag,"%s%i","qmu_mass_flux_segmentsi",i); 200 IoModelFetchData(&tot_matrix,tot_mdims_array+i,NULL,iomodel_handle,"qmu_mass_flux_segments"); 201 variabledescriptors[i]=descriptor; 202 } 203 #endif 204 188 205 #ifdef _PARALLEL_ 189 206 IoModelFetchData(&qmu_mass_flux_segments,&tot_qmu_mass_flux_segments,NULL,iomodel_handle,"qmu_mass_flux_segments"); … … 234 251 235 252 /*Free data: {{{1*/ 236 xfree((void**)&tag);237 253 for(i=0;i<iomodel->numberofresponses;i++){ 238 254 char* descriptor=responsedescriptors[i]; -
issm/trunk/src/c/objects/IoModel.cpp
r4739 r4854 216 216 IoModelFetchData(&this->numberofresponses,iomodel_handle,"numberofresponses"); 217 217 IoModelFetchData(&this->qmu_npart,iomodel_handle,"npart"); 218 IoModelFetchData(&this->qmu_mass_flux_num_profiles,iomodel_handle,"qmu_mass_flux_num_profiles"); 218 219 } 219 220 -
issm/trunk/src/c/objects/IoModel.h
r4739 r4854 179 179 int numoutput; 180 180 181 /*qmu: */ 182 int qmu_mass_flux_num_profiles; 183 181 184 /*exterior partitioning data, to be carried around: */ 182 185 bool* my_elements; -
issm/trunk/src/m/qmu/qmumarshall.m
r4852 r4854 88 88 WriteData(fid,md.qmu_mass_flux_segments{i},'Mat',['qmu_mass_flux_segments' num2str(i)]); 89 89 end 90 else 91 md.qmu_mass_flux_num_profiles=0; 92 WriteData(fid,md.qmu_mass_flux_num_profiles,'Integer','qmu_mass_flux_num_profiles'); 90 93 end 94 91 95 92 96 %write part and npart to disk
Note:
See TracChangeset
for help on using the changeset viewer.