Changeset 9374
- Timestamp:
- 08/23/11 08:55:48 (14 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r9370 r9374 20 20 int numberofelements; 21 21 int numberofvertices; 22 bool control_analysis; 22 23 23 24 /*DataSets: */ … … 30 31 iomodel->constants->FindParam(&numberofelements,NumberOfElementsEnum); 31 32 iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum); 33 iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum); 32 34 33 35 /*Did we already create the elements? : */ … … 43 45 44 46 /*Fetch data needed: */ 45 iomodel->FetchData(9,ElementsEnum,ElementconnectivityEnum,UpperelementsEnum,LowerelementsEnum, 46 RheologyBEnum,RheologyNEnum,ControlTypeEnum,CmMinEnum,CmMaxEnum); 47 iomodel->FetchData(4,ElementsEnum,ElementconnectivityEnum,RheologyBEnum,RheologyNEnum); 48 if(dim==3) iomodel->FetchData(2,UpperelementsEnum,LowerelementsEnum); 49 if(control_analysis)iomodel->FetchData(3,ControlTypeEnum,CmMinEnum,CmMaxEnum); 47 50 48 51 /*Create elements and materials: */ 49 52 for (i=0;i<numberofelements;i++){ 50 51 53 if(iomodel->my_elements[i]){ 52 54 -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r9370 r9374 39 39 double *nodeonstokes = NULL; 40 40 double *nodeonicesheet = NULL; 41 double *elements = NULL;42 double *spcvx = NULL;43 double *spcvy = NULL;44 double *spcvz = NULL;45 41 double *vertices_type = NULL; 46 42 double *penalties = NULL; … … 52 48 iomodel->constants->FindParam(&isstokes,IsstokesEnum); 53 49 iomodel->constants->FindParam(&ismacayealpattyn,IsmacayealpattynEnum); 50 iomodel->constants->FindParam(&numrifts,NumRiftsEnum); 51 iomodel->constants->FindParam(&numrifts,NumRiftsEnum); 54 52 55 53 /*Recover pointer: */ … … 136 134 iomodel->FetchData(&nodeonicesheet,NULL,NULL,NodeOnIceSheetEnum); 137 135 iomodel->FetchData(&nodeonstokes,NULL,NULL,NodeOnStokesEnum); 138 iomodel->FetchData(&elements,NULL,NULL,ElementsEnum);139 iomodel->FetchData(&spcvx,NULL,NULL,SpcvxEnum);140 iomodel->FetchData(&spcvy,NULL,NULL,SpcvyEnum);141 iomodel->FetchData(&spcvz,NULL,NULL,SpcvzEnum);142 136 iomodel->FetchData(&vertices_type,NULL,NULL,VerticesTypeEnum); 137 iomodel->FetchData(1,ElementsEnum); 143 138 CreateSingleNodeToElementConnectivity(iomodel); 144 139 145 140 for (i=0;i<numberofvertices;i++){ 146 147 141 if(iomodel->my_vertices[i]==1 && iomodel->singlenodetoelementconnectivity[i]!=0){ 148 142 … … 153 147 count++; 154 148 } 155 } //if((iomodel->my_vertices[i]==1))149 } 156 150 } 157 158 151 xfree((void**)&nodeonbed); 159 152 xfree((void**)&nodeonstokes); 160 153 xfree((void**)&nodeonicesheet); 161 xfree((void**)&elements);162 xfree((void**)&spcvx);163 xfree((void**)&spcvy);164 xfree((void**)&spcvz);165 154 xfree((void**)&vertices_type); 155 iomodel->DeleteData(1,ElementsEnum); 166 156 167 157 /*Create Penpair for penalties: */ … … 189 179 190 180 /*Create Riffront loads for rifts: */ 191 iomodel->FetchData(&riftinfo,&numrifts,NULL,RiftinfoEnum); 192 iomodel->FetchData(&thickness,NULL,NULL,ThicknessEnum); 193 iomodel->FetchData(&bed,NULL,NULL,BedEnum); 194 iomodel->FetchData(&surface,NULL,NULL,SurfaceEnum); 195 iomodel->FetchData(&nodeoniceshelf,NULL,NULL,NodeOnIceShelfEnum); 196 197 for(i=0;i<numrifts;i++){ 198 if(iomodel->my_elements[(int)*(riftinfo+RIFTINFOSIZE*i+2)-1]){ 199 loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum)); 200 count++; 181 if(numrifts){ 182 iomodel->FetchData(5,RiftinfoEnum,ThicknessEnum,BedEnum,SurfaceEnum,NodeOnIceShelfEnum); 183 for(i=0;i<numrifts;i++){ 184 if(iomodel->my_elements[(int)(iomodel->f(RiftinfoEnum)[RIFTINFOSIZE*i+2])-1]){ 185 loads->AddObject(new Riftfront(iomodel->loadcounter+count+1,i,iomodel,DiagnosticHorizAnalysisEnum)); 186 count++; 187 } 201 188 } 189 iomodel->DeleteData(5,RiftinfoEnum,ThicknessEnum,BedEnum,SurfaceEnum,NodeOnIceShelfEnum); 202 190 } 203 204 /*free ressources: */205 xfree((void**)&riftinfo);206 xfree((void**)&thickness);207 xfree((void**)&bed);208 xfree((void**)&surface);209 xfree((void**)&nodeoniceshelf);210 191 211 192 /*Assign output pointer: */ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateNodesDiagnosticHoriz.cpp
r9370 r9374 25 25 26 26 /*Fetch parameters: */ 27 printf("-------------- file: CreateNodesDiagnosticHoriz.cpp line: %i\n",__LINE__); 27 28 iomodel->constants->FindParam(&numberofvertices,NumberOfVerticesEnum); 29 printf("-------------- file: CreateNodesDiagnosticHoriz.cpp line: %i\n",__LINE__); 28 30 iomodel->constants->FindParam(&isstokes,IsstokesEnum); 31 printf("-------------- file: CreateNodesDiagnosticHoriz.cpp line: %i\n",__LINE__); 29 32 iomodel->constants->FindParam(&ismacayealpattyn,IsmacayealpattynEnum); 33 printf("-------------- file: CreateNodesDiagnosticHoriz.cpp line: %i\n",__LINE__); 30 34 31 35 /*Recover pointer: */ … … 42 46 43 47 /*Continuous Galerkin partition of nodes: */ 48 printf("-------------- file: CreateNodesDiagnosticHoriz.cpp line: %i\n",__LINE__); 44 49 NodesPartitioning(&iomodel->my_nodes,iomodel->my_elements,iomodel->my_vertices,iomodel,continuous_galerkin); 50 printf("-------------- file: CreateNodesDiagnosticHoriz.cpp line: %i\n",__LINE__); 45 51 46 52 /*Create nodes: */ 47 53 iomodel->FetchData(10,NodeOnBedEnum,NodeOnSurfaceEnum,NodeOnHutterEnum,NodeOnMacayealEnum,NodeOnStokesEnum, 48 54 NodeOnIceSheetEnum,NodeOnIceShelfEnum,NodeOnWaterEnum,VerticesTypeEnum,DiagnosticRefEnum); 55 printf("-------------- file: CreateNodesDiagnosticHoriz.cpp line: %i\n",__LINE__); 49 56 50 57 for (i=0;i<numberofvertices;i++){ -
issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
r9362 r9374 86 86 87 87 /*Deal with rifts, they have to be included into one partition only, not several: */ 88 iomodel->FetchData(&riftinfo,&numrifts,NULL,RiftinfoEnum); 89 90 for(i=0;i<numrifts;i++){ 91 el1=(int)*(riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing 92 el2=(int)*(riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing 93 epart[el2]=epart[el1]; //ensures that this pair of elements will be in the same partition, as well as the corresponding vertices; 88 if(numrifts){ 89 iomodel->FetchData(&riftinfo,&numrifts,NULL,RiftinfoEnum); 90 for(i=0;i<numrifts;i++){ 91 el1=(int)*(riftinfo+RIFTINFOSIZE*i+2)-1; //matlab indexing to c indexing 92 el2=(int)*(riftinfo+RIFTINFOSIZE*i+3)-1; //matlab indexing to c indexing 93 epart[el2]=epart[el1]; //ensures that this pair of elements will be in the same partition, as well as the corresponding vertices; 94 } 95 xfree((void**)&riftinfo); 94 96 } 95 96 /*Free rifts: */97 xfree((void**)&riftinfo);98 97 99 98 /*Used later on: */ -
issm/trunk/src/c/objects/Elements/Penta.cpp
r9362 r9374 5163 5163 5164 5164 double yts; 5165 intcontrol_analysis;5165 bool control_analysis; 5166 5166 int num_control_type; 5167 5167 int num_cm_responses; … … 5183 5183 } 5184 5184 5185 5186 5185 /*Control Inputs*/ 5187 5186 if (control_analysis && iomodel->f(ControlTypeEnum)){ -
issm/trunk/src/c/objects/Elements/Tria.cpp
r9362 r9374 3276 3276 int num_cm_responses; 3277 3277 3278 3279 /*Checks if debuging*/3280 /*{{{2*/3281 _assert_(iomodel->f(ElementEnum));3282 /*}}}*/3283 3284 3278 /*Get parameters: */ 3285 3279 iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum); -
issm/trunk/src/c/objects/IoModel.cpp
r9370 r9374 92 92 fid=this->SetFilePointerToData(&code,NULL,data_enum); 93 93 94 if(code!=1)_error_(" %s%s","IoModel::FetchData expecting a boolean for enum",EnumToStringx(data_enum));94 if(code!=1)_error_("expecting a boolean for enum %s",EnumToStringx(data_enum)); 95 95 96 96 /*We have to read a boolean from disk. */ … … 120 120 fid=this->SetFilePointerToData(&code,NULL,data_enum); 121 121 122 if(code!=2)_error_(" %s%s","IoModel::FetchData expecting an integer for enum",EnumToStringx(data_enum));122 if(code!=2)_error_("expecting an integer for enum %s",EnumToStringx(data_enum)); 123 123 124 124 /*We have to read a integer from disk. First read the dimensions of the integer, then the integer: */ … … 149 149 fid=this->SetFilePointerToData(&code,NULL,data_enum); 150 150 151 if(code!=3)_error_(" %s%s","IoModel::FetchData expecting a double for enum",EnumToStringx(data_enum));151 if(code!=3)_error_("expecting a double for enum %s",EnumToStringx(data_enum)); 152 152 153 153 /*We have to read a scalar from disk. First read the dimensions of the scalar, then the scalar: */ … … 177 177 fid=this->SetFilePointerToData(&code,NULL,data_enum); 178 178 179 if(code!=4)_error_(" %s%s","IoModel::FetchData expecting a string for enum",EnumToStringx(data_enum));179 if(code!=4)_error_("expecting a string for enum %s",EnumToStringx(data_enum)); 180 180 181 181 /*Now fetch: */ … … 227 227 fid=this->SetFilePointerToData(&code,&vector_type,data_enum); 228 228 229 if((code!=5) && (code!=6) && (code!=7))_error_(" %s%s","IoModel::FetchData expecting a double, integer or boolean matrix for enum",EnumToStringx(data_enum));229 if((code!=5) && (code!=6) && (code!=7))_error_("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum)); 230 230 231 231 /*Now fetch: */ … … 290 290 int vector_type=0; 291 291 292 293 294 292 /*Set file pointer to beginning of the data: */ 295 293 fid=this->SetFilePointerToData(&code,&vector_type,data_enum); 296 297 if((code!=5) && (code!=6) && (code!=7))_error_("%s%s","IoModel::FetchData expecting a double, integer or boolean matrix for enum ",EnumToStringx(data_enum)); 294 if((code!=5) && (code!=6) && (code!=7))_error_("expecting a double, integer or boolean matrix for enum %s",EnumToStringx(data_enum)); 298 295 299 296 /*Now fetch: */ … … 304 301 if(fread(&M,sizeof(int),1,fid)!=1) _error_("could not read number of rows for matrix "); 305 302 } 306 307 303 MPI_Bcast(&M,1,MPI_INT,0,MPI_COMM_WORLD); 308 304 … … 320 316 if(fread(matrix,M*N*sizeof(double),1,fid)!=1) _error_("could not read matrix "); 321 317 } 322 323 318 MPI_Bcast(matrix,M*N,MPI_DOUBLE,0,MPI_COMM_WORLD); 324 319 } … … 328 323 if (pM)*pM=M; 329 324 if (pN)*pN=N; 330 331 325 } 332 326 /*}}}*/ … … 351 345 fid=this->SetFilePointerToData(&code,NULL,data_enum); 352 346 353 if(code!=9)_error_(" %s%s","IoModel::FetchData expecting a string array for enum",EnumToStringx(data_enum));347 if(code!=9)_error_("expecting a string array for enum %s",EnumToStringx(data_enum)); 354 348 355 349 /*We have to read a bunch of strings from disk. First read the number of strings, and allocate: */ … … 410 404 411 405 /*intermediary: */ 412 int M,N; 413 double* matrix=NULL; 414 415 416 int code; 406 int M, N; 407 double *matrix = NULL; 408 int code; 417 409 418 410 /*Set file pointer to beginning of the data: */ 419 411 fid=this->SetFilePointerToData(&code,NULL,data_enum); 420 421 if(code!=8)_error_("%s%s","IoModel::FetchData expecting a double mat array for enum ",EnumToStringx(data_enum)); 412 if(code!=8)_error_("expecting a double mat array for enum %s",EnumToStringx(data_enum)); 422 413 423 414 /*Now fetch: */ … … 496 487 dataenum=va_arg(ap, int); _assert_(this->data->Exist(dataenum)==false); 497 488 this->FetchData(&matrix,&M,&N,dataenum); 489 if(M*N==0){ 490 _error_("Cannot add %s to Iomodel->data because the matrix found is empty",EnumToStringx(dataenum)); 491 } 492 498 493 499 494 /*Add to this->data: */ -
issm/trunk/src/c/objects/Materials/Matice.cpp
r9362 r9374 656 656 657 657 int dim; 658 intcontrol_analysis;658 bool control_analysis; 659 659 int num_control_type; 660 660 … … 663 663 iomodel->constants->FindParam(&control_analysis,ControlAnalysisEnum); 664 664 iomodel->constants->FindParam(&num_control_type,NumControlTypeEnum); 665 666 665 667 666 /*if 2d*/
Note:
See TracChangeset
for help on using the changeset viewer.