Changeset 1834
- Timestamp:
- 08/24/09 17:53:59 (15 years ago)
- Location:
- issm/trunk/src/c/ModelProcessorx
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp
r586 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateConstraintsDiagnosticStokes(DataSet** pconstraints, Model* model,ConstDataHandlemodel_handle){16 void CreateConstraintsDiagnosticStokes(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 int i; … … 34 34 35 35 /*Now, is the flag ishutter on? otherwise, do nothing: */ 36 if (! model->isstokes)goto cleanup_and_return;36 if (!iomodel->isstokes)goto cleanup_and_return; 37 37 38 38 /*Fetch data: */ 39 ModelFetchData((void**)&gridonstokes,NULL,NULL,model_handle,"gridonstokes","Matrix","Mat");39 IoModelFetchData((void**)&gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes","Matrix","Mat"); 40 40 41 41 count=0; 42 42 /*Create spcs from x,y,z, as well as the spc values on those spcs: */ 43 for (i=0;i< model->numberofnodes;i++){43 for (i=0;i<iomodel->numberofnodes;i++){ 44 44 #ifdef _PARALLEL_ 45 45 /*keep only this partition's nodes:*/ 46 if(( model->my_grids[i]==1)){46 if((iomodel->my_grids[i]==1)){ 47 47 #endif 48 48 -
issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp
r1651 r1834 12 12 #include "../../shared/shared.h" 13 13 #include "../../MeshPartitionx/MeshPartitionx.h" 14 #include "../ Model.h"15 16 17 void CreateElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, Model* model,ConstDataHandlemodel_handle){14 #include "../IoModel.h" 15 16 17 void CreateElementsNodesAndMaterialsDiagnosticStokes(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){ 18 18 19 19 … … 124 124 125 125 /*Now, is the flag ishutter on? otherwise, do nothing: */ 126 if (! model->isstokes)goto cleanup_and_return;126 if (!iomodel->isstokes)goto cleanup_and_return; 127 127 128 128 /*Width of elements: */ 129 if(strcmp( model->meshtype,"2d")==0){129 if(strcmp(iomodel->meshtype,"2d")==0){ 130 130 elements_width=3; //tria elements 131 131 } … … 137 137 #ifdef _PARALLEL_ 138 138 /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/ 139 if(strcmp( model->meshtype,"2d")==0){139 if(strcmp(iomodel->meshtype,"2d")==0){ 140 140 /*load elements: */ 141 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");141 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 142 142 } 143 143 else{ 144 144 /*load elements2d: */ 145 ModelFetchData((void**)&model->elements2d,NULL,NULL,model_handle,"elements2d","Matrix","Mat");146 } 147 148 149 MeshPartitionx(&epart, &npart, model->numberofelements,model->numberofnodes,model->elements, model->numberofelements2d,model->numberofnodes2d,model->elements2d,model->numlayers,elements_width,model->meshtype,num_procs);145 IoModelFetchData((void**)&iomodel->elements2d,NULL,NULL,iomodel_handle,"elements2d","Matrix","Mat"); 146 } 147 148 149 MeshPartitionx(&epart, &npart,iomodel->numberofelements,iomodel->numberofnodes,iomodel->elements, iomodel->numberofelements2d,iomodel->numberofnodes2d,iomodel->elements2d,iomodel->numlayers,elements_width, iomodel->meshtype,num_procs); 150 150 151 151 /*Free elements and elements2d: */ 152 xfree((void**)& model->elements);153 xfree((void**)& model->elements2d);152 xfree((void**)&iomodel->elements); 153 xfree((void**)&iomodel->elements2d); 154 154 155 155 /*Used later on: */ 156 my_grids=(int*)xcalloc( model->numberofnodes,sizeof(int));156 my_grids=(int*)xcalloc(iomodel->numberofnodes,sizeof(int)); 157 157 #endif 158 158 … … 161 161 162 162 /*2d mesh: */ 163 if (strcmp( model->meshtype,"2d")==0){163 if (strcmp(iomodel->meshtype,"2d")==0){ 164 164 165 165 throw ErrorException(__FUNCT__," stokes elements only supported in 3d!"); … … 169 169 170 170 /*Fetch data needed: */ 171 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");172 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");173 ModelFetchData((void**)&model->surface,NULL,NULL,model_handle,"surface","Matrix","Mat");174 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");175 ModelFetchData((void**)&model->drag,NULL,NULL,model_handle,"drag","Matrix","Mat");176 ModelFetchData((void**)&model->p,NULL,NULL,model_handle,"p","Matrix","Mat");177 ModelFetchData((void**)&model->q,NULL,NULL,model_handle,"q","Matrix","Mat");178 ModelFetchData((void**)&model->elementoniceshelf,NULL,NULL,model_handle,"elementoniceshelf","Matrix","Mat");179 ModelFetchData((void**)&model->elementonbed,NULL,NULL,model_handle,"elementonbed","Matrix","Mat");180 ModelFetchData((void**)&model->elementonsurface,NULL,NULL,model_handle,"elementonsurface","Matrix","Mat");181 ModelFetchData((void**)&model->elements_type,NULL,NULL,model_handle,"elements_type","Matrix","Mat");182 ModelFetchData((void**)&model->B,NULL,NULL,model_handle,"B","Matrix","Mat");183 ModelFetchData((void**)&model->n,NULL,NULL,model_handle,"n","Matrix","Mat");184 ModelFetchData((void**)&model->accumulation,NULL,NULL,model_handle,"accumulation","Matrix","Mat");185 ModelFetchData((void**)&model->melting,NULL,NULL,model_handle,"melting","Matrix","Mat");186 ModelFetchData((void**)&model->elementonwater,NULL,NULL,model_handle,"elementonwater","Matrix","Mat");187 188 for (i=0;i< model->numberofelements;i++){171 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 172 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 173 IoModelFetchData((void**)&iomodel->surface,NULL,NULL,iomodel_handle,"surface","Matrix","Mat"); 174 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 175 IoModelFetchData((void**)&iomodel->drag,NULL,NULL,iomodel_handle,"drag","Matrix","Mat"); 176 IoModelFetchData((void**)&iomodel->p,NULL,NULL,iomodel_handle,"p","Matrix","Mat"); 177 IoModelFetchData((void**)&iomodel->q,NULL,NULL,iomodel_handle,"q","Matrix","Mat"); 178 IoModelFetchData((void**)&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf","Matrix","Mat"); 179 IoModelFetchData((void**)&iomodel->elementonbed,NULL,NULL,iomodel_handle,"elementonbed","Matrix","Mat"); 180 IoModelFetchData((void**)&iomodel->elementonsurface,NULL,NULL,iomodel_handle,"elementonsurface","Matrix","Mat"); 181 IoModelFetchData((void**)&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type","Matrix","Mat"); 182 IoModelFetchData((void**)&iomodel->B,NULL,NULL,iomodel_handle,"B","Matrix","Mat"); 183 IoModelFetchData((void**)&iomodel->n,NULL,NULL,iomodel_handle,"n","Matrix","Mat"); 184 IoModelFetchData((void**)&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation","Matrix","Mat"); 185 IoModelFetchData((void**)&iomodel->melting,NULL,NULL,iomodel_handle,"melting","Matrix","Mat"); 186 IoModelFetchData((void**)&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater","Matrix","Mat"); 187 188 for (i=0;i<iomodel->numberofelements;i++){ 189 189 #ifdef _PARALLEL_ 190 190 /*We are using our element partition to decide which elements will be created on this node: */ … … 196 196 penta_id=i+1; //matlab indexing. 197 197 penta_mid=i+1; //refers to the corresponding material property card 198 penta_mparid= model->numberofelements+1;//refers to the corresponding parmat property card198 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card 199 199 200 200 /*vertices,thickness,surface,bed and drag: */ 201 201 for(j=0;j<6;j++){ 202 penta_g[j]=(int)*( model->elements+elements_width*i+j);203 penta_h[j]=*( model->thickness+ ((int)*(model->elements+elements_width*i+j)-1));204 penta_s[j]=*( model->surface+ ((int)*(model->elements+elements_width*i+j)-1));205 penta_b[j]=*( model->bed+ ((int)*(model->elements+elements_width*i+j)-1));206 penta_k[j]=*( model->drag+ ((int)*(model->elements+elements_width*i+j)-1));207 penta_melting[j]=*( model->melting+ ((int)*(model->elements+elements_width*i+j)-1));208 penta_accumulation[j]=*( model->accumulation+ ((int)*(model->elements+elements_width*i+j)-1));202 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j); 203 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 204 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 205 penta_b[j]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 206 penta_k[j]=*(iomodel->drag+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 207 penta_melting[j]=*(iomodel->melting+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 208 penta_accumulation[j]=*(iomodel->accumulation+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 209 209 } 210 210 211 211 /*basal drag:*/ 212 penta_friction_type=(int) model->drag_type;213 214 penta_p= model->p[i];215 penta_q= model->q[i];212 penta_friction_type=(int)iomodel->drag_type; 213 214 penta_p=iomodel->p[i]; 215 penta_q=iomodel->q[i]; 216 216 217 217 /*diverse: */ 218 penta_shelf=(int)*( model->elementoniceshelf+i);219 penta_onbed=(int)*( model->elementonbed+i);220 penta_onsurface=(int)*( model->elementonsurface+i);221 penta_meanvel= model->meanvel;222 penta_epsvel= model->epsvel;223 penta_onwater=(bool)*( model->elementonwater+i);218 penta_shelf=(int)*(iomodel->elementoniceshelf+i); 219 penta_onbed=(int)*(iomodel->elementonbed+i); 220 penta_onsurface=(int)*(iomodel->elementonsurface+i); 221 penta_meanvel=iomodel->meanvel; 222 penta_epsvel=iomodel->epsvel; 223 penta_onwater=(bool)*(iomodel->elementonwater+i); 224 224 225 225 /*viscosity_overshoot*/ 226 penta_viscosity_overshoot= model->viscosity_overshoot;226 penta_viscosity_overshoot=iomodel->viscosity_overshoot; 227 227 228 228 /*stokesreconditioning: */ 229 penta_stokesreconditioning= model->stokesreconditioning;230 231 232 if (*( model->elements_type+2*i+1)==StokesFormulationEnum()){229 penta_stokesreconditioning=iomodel->stokesreconditioning; 230 231 232 if (*(iomodel->elements_type+2*i+1)==StokesFormulationEnum()){ 233 233 234 234 /*Create Penta using its constructor:*/ … … 248 248 B_avg=0; 249 249 for(j=0;j<6;j++){ 250 B_avg+=*( model->B+((int)*(model->elements+elements_width*i+j)-1));250 B_avg+=*(iomodel->B+((int)*(iomodel->elements+elements_width*i+j)-1)); 251 251 } 252 252 B_avg=B_avg/6; 253 253 matice_B= B_avg; 254 matice_n=(double)*( model->n+i);255 256 if (*( model->elements_type+2*i+1)==StokesFormulationEnum()){254 matice_n=(double)*(iomodel->n+i); 255 256 if (*(iomodel->elements_type+2*i+1)==StokesFormulationEnum()){ 257 257 258 258 /*Create matice using its constructor:*/ … … 268 268 into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids 269 269 will hold which grids belong to this partition*/ 270 my_grids[(int)*( model->elements+elements_width*i+0)-1]=1;271 my_grids[(int)*( model->elements+elements_width*i+1)-1]=1;272 my_grids[(int)*( model->elements+elements_width*i+2)-1]=1;273 my_grids[(int)*( model->elements+elements_width*i+3)-1]=1;274 my_grids[(int)*( model->elements+elements_width*i+4)-1]=1;275 my_grids[(int)*( model->elements+elements_width*i+5)-1]=1;270 my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1; 271 my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1; 272 my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1; 273 my_grids[(int)*(iomodel->elements+elements_width*i+3)-1]=1; 274 my_grids[(int)*(iomodel->elements+elements_width*i+4)-1]=1; 275 my_grids[(int)*(iomodel->elements+elements_width*i+5)-1]=1; 276 276 #endif 277 277 … … 283 283 284 284 /*Free data: */ 285 xfree((void**)& model->elements);286 xfree((void**)& model->thickness);287 xfree((void**)& model->surface);288 xfree((void**)& model->bed);289 xfree((void**)& model->drag);290 xfree((void**)& model->p);291 xfree((void**)& model->q);292 xfree((void**)& model->elementoniceshelf);293 xfree((void**)& model->elementonbed);294 xfree((void**)& model->elementonsurface);295 xfree((void**)& model->elements_type);296 xfree((void**)& model->n);297 xfree((void**)& model->B);298 xfree((void**)& model->accumulation);299 xfree((void**)& model->melting);300 xfree((void**)& model->elementonwater);285 xfree((void**)&iomodel->elements); 286 xfree((void**)&iomodel->thickness); 287 xfree((void**)&iomodel->surface); 288 xfree((void**)&iomodel->bed); 289 xfree((void**)&iomodel->drag); 290 xfree((void**)&iomodel->p); 291 xfree((void**)&iomodel->q); 292 xfree((void**)&iomodel->elementoniceshelf); 293 xfree((void**)&iomodel->elementonbed); 294 xfree((void**)&iomodel->elementonsurface); 295 xfree((void**)&iomodel->elements_type); 296 xfree((void**)&iomodel->n); 297 xfree((void**)&iomodel->B); 298 xfree((void**)&iomodel->accumulation); 299 xfree((void**)&iomodel->melting); 300 xfree((void**)&iomodel->elementonwater); 301 301 302 302 } //if (strcmp(meshtype,"2d")==0) 303 303 304 304 /*Add one constant material property to materials: */ 305 matpar_mid= model->numberofelements+1; //put it at the end of the materials306 matpar_g= model->g;307 matpar_rho_ice= model->rho_ice;308 matpar_rho_water= model->rho_water;309 matpar_thermalconductivity= model->thermalconductivity;310 matpar_heatcapacity= model->heatcapacity;311 matpar_latentheat= model->latentheat;312 matpar_beta= model->beta;313 matpar_meltingpoint= model->meltingpoint;314 matpar_mixed_layer_capacity= model->mixed_layer_capacity;315 matpar_thermal_exchange_velocity= model->thermal_exchange_velocity;305 matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials 306 matpar_g=iomodel->g; 307 matpar_rho_ice=iomodel->rho_ice; 308 matpar_rho_water=iomodel->rho_water; 309 matpar_thermalconductivity=iomodel->thermalconductivity; 310 matpar_heatcapacity=iomodel->heatcapacity; 311 matpar_latentheat=iomodel->latentheat; 312 matpar_beta=iomodel->beta; 313 matpar_meltingpoint=iomodel->meltingpoint; 314 matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity; 315 matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity; 316 316 317 317 /*Create matpar object using its constructor: */ … … 326 326 /*From the element partitioning, we can determine which grids are on the inside of this cpu's 327 327 *element partition, and which are on its border with other nodes:*/ 328 gridborder=NewVec( model->numberofnodes);329 330 for (i=0;i< model->numberofnodes;i++){328 gridborder=NewVec(iomodel->numberofnodes); 329 330 for (i=0;i<iomodel->numberofnodes;i++){ 331 331 if(my_grids[i])VecSetValue(gridborder,i,1,ADD_VALUES); 332 332 } … … 342 342 #ifdef _DEBUG_ 343 343 if(my_rank==0){ 344 for (i=0;i< model->numberofnodes;i++){344 for (i=0;i<iomodel->numberofnodes;i++){ 345 345 printf("Grid id %i Border grid %lf\n",i+1,my_bordergrids[i]); 346 346 } … … 350 350 351 351 /*Partition penalties in 3d: */ 352 if(strcmp( model->meshtype,"3d")==0){352 if(strcmp(iomodel->meshtype,"3d")==0){ 353 353 354 354 /*Get penalties: */ 355 ModelFetchData((void**)&model->penalties,&model->numpenalties,NULL,model_handle,"penalties","Matrix","Mat");356 357 if( model->numpenalties){358 359 model->penaltypartitioning=(int*)xmalloc(model->numpenalties*sizeof(int));355 IoModelFetchData((void**)&iomodel->penalties,&iomodel->numpenalties,NULL,iomodel_handle,"penalties","Matrix","Mat"); 356 357 if(iomodel->numpenalties){ 358 359 iomodel->penaltypartitioning=(int*)xmalloc(iomodel->numpenalties*sizeof(int)); 360 360 #ifdef _SERIAL_ 361 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=1;361 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=1; 362 362 #else 363 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=-1;364 365 for(i=0;i< model->numpenalties;i++){366 first_grid_index=(int)(*( model->penalties+i*model->numlayers+0)-1);363 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=-1; 364 365 for(i=0;i<iomodel->numpenalties;i++){ 366 first_grid_index=(int)(*(iomodel->penalties+i*iomodel->numlayers+0)-1); 367 367 if((my_grids[first_grid_index]==1) && (my_bordergrids[first_grid_index]<=1.0) ) { //this grid belongs to this node's internal partition grids 368 368 /*All grids that are being penalised belong to this node's internal grid partition.:*/ 369 model->penaltypartitioning[i]=1;369 iomodel->penaltypartitioning[i]=1; 370 370 } 371 371 if(my_bordergrids[first_grid_index]>1.0) { //this grid belongs to a partition border 372 model->penaltypartitioning[i]=0;372 iomodel->penaltypartitioning[i]=0; 373 373 } 374 374 } … … 377 377 378 378 /*Free penalties: */ 379 xfree((void**)& model->penalties);379 xfree((void**)&iomodel->penalties); 380 380 } 381 381 … … 388 388 389 389 /*First fetch data: */ 390 if (strcmp( model->meshtype,"3d")==0){391 ModelFetchData((void**)&model->deadgrids,NULL,NULL,model_handle,"deadgrids","Matrix","Mat");392 ModelFetchData((void**)&model->uppernodes,NULL,NULL,model_handle,"uppergrids","Matrix","Mat");393 } 394 ModelFetchData((void**)&model->x,NULL,NULL,model_handle,"x","Matrix","Mat");395 ModelFetchData((void**)&model->y,NULL,NULL,model_handle,"y","Matrix","Mat");396 ModelFetchData((void**)&model->z,NULL,NULL,model_handle,"z","Matrix","Mat");397 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");398 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");399 ModelFetchData((void**)&model->gridonbed,NULL,NULL,model_handle,"gridonbed","Matrix","Mat");400 ModelFetchData((void**)&model->gridonsurface,NULL,NULL,model_handle,"gridonsurface","Matrix","Mat");401 ModelFetchData((void**)&model->gridonicesheet,NULL,NULL,model_handle,"gridonicesheet","Matrix","Mat");402 ModelFetchData((void**)&model->gridoniceshelf,NULL,NULL,model_handle,"gridoniceshelf","Matrix","Mat");403 ModelFetchData((void**)&model->gridonstokes,NULL,NULL,model_handle,"gridonstokes","Matrix","Mat");404 ModelFetchData((void**)&model->borderstokes,NULL,NULL,model_handle,"borderstokes","Matrix","Mat");390 if (strcmp(iomodel->meshtype,"3d")==0){ 391 IoModelFetchData((void**)&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids","Matrix","Mat"); 392 IoModelFetchData((void**)&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids","Matrix","Mat"); 393 } 394 IoModelFetchData((void**)&iomodel->x,NULL,NULL,iomodel_handle,"x","Matrix","Mat"); 395 IoModelFetchData((void**)&iomodel->y,NULL,NULL,iomodel_handle,"y","Matrix","Mat"); 396 IoModelFetchData((void**)&iomodel->z,NULL,NULL,iomodel_handle,"z","Matrix","Mat"); 397 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 398 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 399 IoModelFetchData((void**)&iomodel->gridonbed,NULL,NULL,iomodel_handle,"gridonbed","Matrix","Mat"); 400 IoModelFetchData((void**)&iomodel->gridonsurface,NULL,NULL,iomodel_handle,"gridonsurface","Matrix","Mat"); 401 IoModelFetchData((void**)&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet","Matrix","Mat"); 402 IoModelFetchData((void**)&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf","Matrix","Mat"); 403 IoModelFetchData((void**)&iomodel->gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes","Matrix","Mat"); 404 IoModelFetchData((void**)&iomodel->borderstokes,NULL,NULL,iomodel_handle,"borderstokes","Matrix","Mat"); 405 405 406 406 407 407 /*Get number of dofs per node: */ 408 DistributeNumDofs(&node_numdofs, model->analysis_type,model->sub_analysis_type);409 410 for (i=0;i< model->numberofnodes;i++){408 DistributeNumDofs(&node_numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); 409 410 for (i=0;i<iomodel->numberofnodes;i++){ 411 411 #ifdef _PARALLEL_ 412 412 /*keep only this partition's nodes:*/ … … 429 429 #endif 430 430 431 node_x[0]= model->x[i];432 node_x[1]= model->y[i];433 node_x[2]= model->z[i];434 node_sigma=( model->z[i]-model->bed[i])/(model->thickness[i]);435 436 node_onbed=(int) model->gridonbed[i];437 node_onsurface=(int) model->gridonsurface[i];438 node_onshelf=(int) model->gridoniceshelf[i];439 node_onsheet=(int) model->gridonicesheet[i];440 441 if (strcmp( model->meshtype,"3d")==0){442 if (isnan( model->uppernodes[i])){431 node_x[0]=iomodel->x[i]; 432 node_x[1]=iomodel->y[i]; 433 node_x[2]=iomodel->z[i]; 434 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]); 435 436 node_onbed=(int)iomodel->gridonbed[i]; 437 node_onsurface=(int)iomodel->gridonsurface[i]; 438 node_onshelf=(int)iomodel->gridoniceshelf[i]; 439 node_onsheet=(int)iomodel->gridonicesheet[i]; 440 441 if (strcmp(iomodel->meshtype,"3d")==0){ 442 if (isnan(iomodel->uppernodes[i])){ 443 443 node_upper_node_id=node_id; //nodes on surface do not have upper nodes, only themselves. 444 444 } 445 445 else{ 446 node_upper_node_id=(int) model->uppernodes[i];446 node_upper_node_id=(int)iomodel->uppernodes[i]; 447 447 } 448 448 } … … 457 457 /*set single point constraints.: */ 458 458 /*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */ 459 if ( model->borderstokes[i]){459 if (iomodel->borderstokes[i]){ 460 460 //freeze everything except pressure 461 461 node->FreezeDof(1); … … 463 463 node->FreezeDof(3); 464 464 } 465 else if ( model->gridonstokes[i]==0){465 else if (iomodel->gridonstokes[i]==0){ 466 466 for(k=1;k<=node_numdofs;k++){ 467 467 node->FreezeDof(k); … … 485 485 486 486 /*Clean fetched data: */ 487 xfree((void**)& model->deadgrids);488 xfree((void**)& model->x);489 xfree((void**)& model->y);490 xfree((void**)& model->z);491 xfree((void**)& model->thickness);492 xfree((void**)& model->bed);493 xfree((void**)& model->gridonbed);494 xfree((void**)& model->gridonsurface);495 xfree((void**)& model->uppernodes);496 xfree((void**)& model->gridonstokes);497 xfree((void**)& model->borderstokes);498 xfree((void**)& model->gridonicesheet);499 xfree((void**)& model->gridoniceshelf);500 501 502 /*Keep partitioning information into model*/503 model->epart=epart;504 model->my_grids=my_grids;505 model->my_bordergrids=my_bordergrids;487 xfree((void**)&iomodel->deadgrids); 488 xfree((void**)&iomodel->x); 489 xfree((void**)&iomodel->y); 490 xfree((void**)&iomodel->z); 491 xfree((void**)&iomodel->thickness); 492 xfree((void**)&iomodel->bed); 493 xfree((void**)&iomodel->gridonbed); 494 xfree((void**)&iomodel->gridonsurface); 495 xfree((void**)&iomodel->uppernodes); 496 xfree((void**)&iomodel->gridonstokes); 497 xfree((void**)&iomodel->borderstokes); 498 xfree((void**)&iomodel->gridonicesheet); 499 xfree((void**)&iomodel->gridoniceshelf); 500 501 502 /*Keep partitioning information into iomodel*/ 503 iomodel->epart=epart; 504 iomodel->my_grids=my_grids; 505 iomodel->my_bordergrids=my_bordergrids; 506 506 507 507 /*Free ressources:*/ -
issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp
r1767 r1834 11 11 #include "../../shared/shared.h" 12 12 #include "../../include/macros.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateLoadsDiagnosticStokes(DataSet** ploads, Model* model,ConstDataHandlemodel_handle){16 void CreateLoadsDiagnosticStokes(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 int i,j,counter; … … 58 58 59 59 /*Now, is the flag ishutter on? otherwise, do nothing: */ 60 if (! model->isstokes)goto cleanup_and_return;60 if (!iomodel->isstokes)goto cleanup_and_return; 61 61 62 62 /*Create pressure loads as boundary conditions. Pay attention to the partitioning if we are running in parallel (the grids 63 63 * referenced by a certain load must belong to the cluster node): */ 64 ModelFetchData((void**)&model->pressureload_stokes,&numberofpressureloads_stokes,NULL,model_handle,"pressureload_stokes","Matrix","Mat");65 ModelFetchData((void**)&model->elements_type,NULL,NULL,model_handle,"elements_type","Matrix","Mat");66 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");67 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");64 IoModelFetchData((void**)&iomodel->pressureload_stokes,&numberofpressureloads_stokes,NULL,iomodel_handle,"pressureload_stokes","Matrix","Mat"); 65 IoModelFetchData((void**)&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type","Matrix","Mat"); 66 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 67 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 68 68 69 69 count=0; … … 74 74 segment_width=5; 75 75 76 element=(int)(*( model->pressureload_stokes+segment_width*i+segment_width-1)-1); //element is in the last column76 element=(int)(*(iomodel->pressureload_stokes+segment_width*i+segment_width-1)-1); //element is in the last column 77 77 78 78 #ifdef _PARALLEL_ 79 if ( model->epart[element]!=my_rank){79 if (iomodel->epart[element]!=my_rank){ 80 80 /*This load does not belong to this cluster node, as it references an element 81 81 *that does not belong to this node's partition. Drop this 'i':*/ … … 84 84 #endif 85 85 86 icefront_mparid= model->numberofelements+1; //matlab indexing86 icefront_mparid=iomodel->numberofelements+1; //matlab indexing 87 87 icefront_sid=count+1; //matlab indexing 88 icefront_eid=(int)*( model->pressureload_stokes+segment_width*i+segment_width-1); //matlab indexing88 icefront_eid=(int)*(iomodel->pressureload_stokes+segment_width*i+segment_width-1); //matlab indexing 89 89 icefront_element_type=PentaEnum(); 90 90 91 i1=(int)*( model->pressureload_stokes+segment_width*i+0);92 i2=(int)*( model->pressureload_stokes+segment_width*i+1);93 i3=(int)*( model->pressureload_stokes+segment_width*i+2);94 i4=(int)*( model->pressureload_stokes+segment_width*i+3);91 i1=(int)*(iomodel->pressureload_stokes+segment_width*i+0); 92 i2=(int)*(iomodel->pressureload_stokes+segment_width*i+1); 93 i3=(int)*(iomodel->pressureload_stokes+segment_width*i+2); 94 i4=(int)*(iomodel->pressureload_stokes+segment_width*i+3); 95 95 96 96 icefront_node_ids[0]=i1; … … 99 99 icefront_node_ids[3]=i4; 100 100 101 icefront_h[0]= model->thickness[i1-1];102 icefront_h[1]= model->thickness[i2-1];103 icefront_h[2]= model->thickness[i3-1];104 icefront_h[3]= model->thickness[i4-1];101 icefront_h[0]=iomodel->thickness[i1-1]; 102 icefront_h[1]=iomodel->thickness[i2-1]; 103 icefront_h[2]=iomodel->thickness[i3-1]; 104 icefront_h[3]=iomodel->thickness[i4-1]; 105 105 106 icefront_b[0]= model->bed[i1-1];107 icefront_b[1]= model->bed[i2-1];108 icefront_b[2]= model->bed[i3-1];109 icefront_b[3]= model->bed[i4-1];106 icefront_b[0]=iomodel->bed[i1-1]; 107 icefront_b[1]=iomodel->bed[i2-1]; 108 icefront_b[2]=iomodel->bed[i3-1]; 109 icefront_b[3]=iomodel->bed[i4-1]; 110 110 111 111 icefront = new Icefront(icefront_type,icefront_sid,icefront_mparid,icefront_eid,icefront_element_type,icefront_node_ids,icefront_h,icefront_b); … … 116 116 } 117 117 /*Free data: */ 118 xfree((void**)& model->pressureload_stokes);119 xfree((void**)& model->elements_type);120 xfree((void**)& model->thickness);121 xfree((void**)& model->bed);118 xfree((void**)&iomodel->pressureload_stokes); 119 xfree((void**)&iomodel->elements_type); 120 xfree((void**)&iomodel->thickness); 121 xfree((void**)&iomodel->bed); 122 122 123 123 … … 126 126 //create penalties for grids on the base of icesheet. We must have wb=ub*db/dx+vb*db/dy 127 127 128 ModelFetchData((void**)&model->gridonbed,NULL,NULL,model_handle,"gridonbed","Matrix","Mat");129 ModelFetchData((void**)&model->gridonicesheet,NULL,NULL,model_handle,"gridonicesheet","Matrix","Mat");130 ModelFetchData((void**)&model->gridonstokes,NULL,NULL,model_handle,"gridonstokes","Matrix","Mat");128 IoModelFetchData((void**)&iomodel->gridonbed,NULL,NULL,iomodel_handle,"gridonbed","Matrix","Mat"); 129 IoModelFetchData((void**)&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet","Matrix","Mat"); 130 IoModelFetchData((void**)&iomodel->gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes","Matrix","Mat"); 131 131 132 for (i=0;i< model->numberofnodes;i++){132 for (i=0;i<iomodel->numberofnodes;i++){ 133 133 #ifdef _PARALLEL_ 134 134 /*keep only this partition's nodes:*/ 135 if(( model->my_grids[i]==1)){135 if((iomodel->my_grids[i]==1)){ 136 136 #endif 137 137 138 if (( model->gridonbed[i]) && (model->gridonicesheet[i]) && (model->gridonstokes[i])){138 if ((iomodel->gridonbed[i]) && (iomodel->gridonicesheet[i]) && (iomodel->gridonstokes[i])){ 139 139 140 140 pengrid_id=count+1; //matlab indexing 141 141 pengrid_node_id=i+1; 142 142 pengrid_dof=1; 143 pengrid_penalty_offset= model->penalty_offset;144 pengrid_mparid= model->numberofelements+1;//refers to the corresponding parmat property card143 pengrid_penalty_offset=iomodel->penalty_offset; 144 pengrid_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card 145 145 146 146 pengrid= new Pengrid(pengrid_id, pengrid_node_id,pengrid_mparid,pengrid_dof, pengrid_active, pengrid_penalty_offset,pengrid_thermal_steadystate); … … 150 150 } 151 151 #ifdef _PARALLEL_ 152 } //if(( model->my_grids[i]==1))152 } //if((iomodel->my_grids[i]==1)) 153 153 #endif 154 154 } … … 156 156 157 157 158 xfree((void**)& model->gridonbed);159 xfree((void**)& model->gridonstokes);160 xfree((void**)& model->gridonicesheet);158 xfree((void**)&iomodel->gridonbed); 159 xfree((void**)&iomodel->gridonstokes); 160 xfree((void**)&iomodel->gridonicesheet); 161 161 162 162 /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these -
issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateConstraintsDiagnosticVert.cpp
r300 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateConstraintsDiagnosticVert(DataSet** pconstraints, Model* model,ConstDataHandlemodel_handle){16 void CreateConstraintsDiagnosticVert(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 … … 22 22 constraints = new DataSet(ConstraintsEnum()); 23 23 24 /*Now, is the model running in 3d? : */25 if (strcmp( model->meshtype,"2d")==0)goto cleanup_and_return;24 /*Now, is the iomodel running in 3d? : */ 25 if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return; 26 26 27 27 cleanup_and_return: -
issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp
r1648 r1834 12 12 #include "../../shared/shared.h" 13 13 #include "../../MeshPartitionx/MeshPartitionx.h" 14 #include "../ Model.h"15 16 17 void CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, Model* model,ConstDataHandlemodel_handle){14 #include "../IoModel.h" 15 16 17 void CreateElementsNodesAndMaterialsDiagnosticVert(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){ 18 18 19 19 … … 132 132 materials = new DataSet(MaterialsEnum()); 133 133 134 /*Now, is the model running in 3d? : */135 if (strcmp( model->meshtype,"2d")==0)goto cleanup_and_return;134 /*Now, is the iomodel running in 3d? : */ 135 if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return; 136 136 137 137 #ifdef _PARALLEL_ 138 138 /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/ 139 if(strcmp( model->meshtype,"2d")==0){139 if(strcmp(iomodel->meshtype,"2d")==0){ 140 140 /*load elements: */ 141 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");141 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 142 142 } 143 143 else{ 144 144 /*load elements2d: */ 145 ModelFetchData((void**)&model->elements2d,NULL,NULL,model_handle,"elements2d","Matrix","Mat");145 IoModelFetchData((void**)&iomodel->elements2d,NULL,NULL,iomodel_handle,"elements2d","Matrix","Mat"); 146 146 } 147 147 148 MeshPartitionx(&epart, &npart, model->numberofelements,model->numberofnodes,model->elements, model->numberofelements2d,model->numberofnodes2d,model->elements2d,model->numlayers,elements_width,model->meshtype,num_procs);148 MeshPartitionx(&epart, &npart,iomodel->numberofelements,iomodel->numberofnodes,iomodel->elements, iomodel->numberofelements2d,iomodel->numberofnodes2d,iomodel->elements2d,iomodel->numlayers,elements_width, iomodel->meshtype,num_procs); 149 149 150 150 /*Free elements and elements2d: */ 151 xfree((void**)& model->elements);152 xfree((void**)& model->elements2d);151 xfree((void**)&iomodel->elements); 152 xfree((void**)&iomodel->elements2d); 153 153 154 154 /*Used later on: */ 155 my_grids=(int*)xcalloc( model->numberofnodes,sizeof(int));155 my_grids=(int*)xcalloc(iomodel->numberofnodes,sizeof(int)); 156 156 #endif 157 157 … … 159 159 /*Create 3d elements: */ 160 160 /*Fetch data needed: */ 161 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");162 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");163 ModelFetchData((void**)&model->surface,NULL,NULL,model_handle,"surface","Matrix","Mat");164 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");165 ModelFetchData((void**)&model->elementoniceshelf,NULL,NULL,model_handle,"elementoniceshelf","Matrix","Mat");166 ModelFetchData((void**)&model->elementonbed,NULL,NULL,model_handle,"elementonbed","Matrix","Mat");167 ModelFetchData((void**)&model->elementonsurface,NULL,NULL,model_handle,"elementonsurface","Matrix","Mat");168 ModelFetchData((void**)&model->elements_type,NULL,NULL,model_handle,"elements_type","Matrix","Mat");169 ModelFetchData((void**)&model->melting,NULL,NULL,model_handle,"melting","Matrix","Mat");170 ModelFetchData((void**)&model->accumulation,NULL,NULL,model_handle,"accumulation","Matrix","Mat");171 ModelFetchData((void**)&model->elementonwater,NULL,NULL,model_handle,"elementonwater","Matrix","Mat");172 173 for (i=0;i< model->numberofelements;i++){161 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 162 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 163 IoModelFetchData((void**)&iomodel->surface,NULL,NULL,iomodel_handle,"surface","Matrix","Mat"); 164 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 165 IoModelFetchData((void**)&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf","Matrix","Mat"); 166 IoModelFetchData((void**)&iomodel->elementonbed,NULL,NULL,iomodel_handle,"elementonbed","Matrix","Mat"); 167 IoModelFetchData((void**)&iomodel->elementonsurface,NULL,NULL,iomodel_handle,"elementonsurface","Matrix","Mat"); 168 IoModelFetchData((void**)&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type","Matrix","Mat"); 169 IoModelFetchData((void**)&iomodel->melting,NULL,NULL,iomodel_handle,"melting","Matrix","Mat"); 170 IoModelFetchData((void**)&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation","Matrix","Mat"); 171 IoModelFetchData((void**)&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater","Matrix","Mat"); 172 173 for (i=0;i<iomodel->numberofelements;i++){ 174 174 #ifdef _PARALLEL_ 175 175 /*We are using our element partition to decide which elements will be created on this node: */ … … 181 181 penta_id=i+1; //matlab indexing. 182 182 penta_mid=i+1; //refers to the corresponding material property card 183 penta_mparid= model->numberofelements+1;//refers to the corresponding parmat property card183 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card 184 184 185 185 /*vertices,thickness,surface,bed and drag: */ 186 186 for(j=0;j<6;j++){ 187 penta_g[j]=(int)*( model->elements+elements_width*i+j);188 penta_h[j]=*( model->thickness+ ((int)*(model->elements+elements_width*i+j)-1));189 penta_s[j]=*( model->surface+ ((int)*(model->elements+elements_width*i+j)-1));190 penta_b[j]=*( model->bed+ ((int)*(model->elements+elements_width*i+j)-1));191 penta_melting[j]=*( model->melting+ ((int)*(model->elements+elements_width*i+j)-1))/model->yts;192 penta_accumulation[j]=*( model->accumulation+ ((int)*(model->elements+elements_width*i+j)-1))/model->yts;187 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j); 188 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 189 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 190 penta_b[j]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 191 penta_melting[j]=*(iomodel->melting+ ((int)*(iomodel->elements+elements_width*i+j)-1))/iomodel->yts; 192 penta_accumulation[j]=*(iomodel->accumulation+ ((int)*(iomodel->elements+elements_width*i+j)-1))/iomodel->yts; 193 193 } 194 194 195 195 /*diverse: */ 196 penta_shelf=(int)*( model->elementoniceshelf+i);197 penta_onbed=(int)*( model->elementonbed+i);198 penta_onsurface=(int)*( model->elementonsurface+i);196 penta_shelf=(int)*(iomodel->elementoniceshelf+i); 197 penta_onbed=(int)*(iomodel->elementonbed+i); 198 penta_onsurface=(int)*(iomodel->elementonsurface+i); 199 199 penta_collapse=1; 200 penta_onwater=(bool)*( model->elementonwater+i);200 penta_onwater=(bool)*(iomodel->elementonwater+i); 201 201 202 202 /*Create Penta using its constructor:*/ … … 224 224 into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids 225 225 will hold which grids belong to this partition*/ 226 my_grids[(int)*( model->elements+elements_width*i+0)-1]=1;227 my_grids[(int)*( model->elements+elements_width*i+1)-1]=1;228 my_grids[(int)*( model->elements+elements_width*i+2)-1]=1;229 my_grids[(int)*( model->elements+elements_width*i+3)-1]=1;230 my_grids[(int)*( model->elements+elements_width*i+4)-1]=1;231 my_grids[(int)*( model->elements+elements_width*i+5)-1]=1;226 my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1; 227 my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1; 228 my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1; 229 my_grids[(int)*(iomodel->elements+elements_width*i+3)-1]=1; 230 my_grids[(int)*(iomodel->elements+elements_width*i+4)-1]=1; 231 my_grids[(int)*(iomodel->elements+elements_width*i+5)-1]=1; 232 232 #endif 233 233 … … 239 239 240 240 /*Free data: */ 241 xfree((void**)& model->elements);242 xfree((void**)& model->thickness);243 xfree((void**)& model->surface);244 xfree((void**)& model->bed);245 xfree((void**)& model->elementoniceshelf);246 xfree((void**)& model->elementonbed);247 xfree((void**)& model->elementonsurface);248 xfree((void**)& model->elements_type);249 xfree((void**)& model->melting);250 xfree((void**)& model->accumulation);251 xfree((void**)& model->elementonwater);241 xfree((void**)&iomodel->elements); 242 xfree((void**)&iomodel->thickness); 243 xfree((void**)&iomodel->surface); 244 xfree((void**)&iomodel->bed); 245 xfree((void**)&iomodel->elementoniceshelf); 246 xfree((void**)&iomodel->elementonbed); 247 xfree((void**)&iomodel->elementonsurface); 248 xfree((void**)&iomodel->elements_type); 249 xfree((void**)&iomodel->melting); 250 xfree((void**)&iomodel->accumulation); 251 xfree((void**)&iomodel->elementonwater); 252 252 253 253 254 254 /*Add one constant material property to materials: */ 255 matpar_mid= model->numberofelements+1; //put it at the end of the materials256 matpar_g= model->g;257 matpar_rho_ice= model->rho_ice;258 matpar_rho_water= model->rho_water;259 matpar_thermalconductivity= model->thermalconductivity;260 matpar_heatcapacity= model->heatcapacity;261 matpar_latentheat= model->latentheat;262 matpar_beta= model->beta;263 matpar_meltingpoint= model->meltingpoint;264 matpar_mixed_layer_capacity= model->mixed_layer_capacity;265 matpar_thermal_exchange_velocity= model->thermal_exchange_velocity;255 matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials 256 matpar_g=iomodel->g; 257 matpar_rho_ice=iomodel->rho_ice; 258 matpar_rho_water=iomodel->rho_water; 259 matpar_thermalconductivity=iomodel->thermalconductivity; 260 matpar_heatcapacity=iomodel->heatcapacity; 261 matpar_latentheat=iomodel->latentheat; 262 matpar_beta=iomodel->beta; 263 matpar_meltingpoint=iomodel->meltingpoint; 264 matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity; 265 matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity; 266 266 267 267 /*Create matpar object using its constructor: */ … … 276 276 /*From the element partitioning, we can determine which grids are on the inside of this cpu's 277 277 *element partition, and which are on its border with other nodes:*/ 278 gridborder=NewVec( model->numberofnodes);279 280 for (i=0;i< model->numberofnodes;i++){278 gridborder=NewVec(iomodel->numberofnodes); 279 280 for (i=0;i<iomodel->numberofnodes;i++){ 281 281 if(my_grids[i])VecSetValue(gridborder,i,1,ADD_VALUES); 282 282 } … … 292 292 #ifdef _DEBUG_ 293 293 if(my_rank==0){ 294 for (i=0;i< model->numberofnodes;i++){294 for (i=0;i<iomodel->numberofnodes;i++){ 295 295 printf("Grid id %i Border grid %lf\n",i+1,my_bordergrids[i]); 296 296 } … … 308 308 309 309 /*First fetch data: */ 310 if (strcmp( model->meshtype,"3d")==0){311 ModelFetchData((void**)&model->deadgrids,NULL,NULL,model_handle,"deadgrids","Matrix","Mat");312 ModelFetchData((void**)&model->uppernodes,NULL,NULL,model_handle,"uppergrids","Matrix","Mat");310 if (strcmp(iomodel->meshtype,"3d")==0){ 311 IoModelFetchData((void**)&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids","Matrix","Mat"); 312 IoModelFetchData((void**)&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids","Matrix","Mat"); 313 313 } 314 ModelFetchData((void**)&model->x,NULL,NULL,model_handle,"x","Matrix","Mat");315 ModelFetchData((void**)&model->y,NULL,NULL,model_handle,"y","Matrix","Mat");316 ModelFetchData((void**)&model->z,NULL,NULL,model_handle,"z","Matrix","Mat");317 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");318 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");319 ModelFetchData((void**)&model->gridonbed,NULL,NULL,model_handle,"gridonbed","Matrix","Mat");320 ModelFetchData((void**)&model->gridonsurface,NULL,NULL,model_handle,"gridonsurface","Matrix","Mat");321 ModelFetchData((void**)&model->gridonicesheet,NULL,NULL,model_handle,"gridonicesheet","Matrix","Mat");322 ModelFetchData((void**)&model->gridoniceshelf,NULL,NULL,model_handle,"gridoniceshelf","Matrix","Mat");314 IoModelFetchData((void**)&iomodel->x,NULL,NULL,iomodel_handle,"x","Matrix","Mat"); 315 IoModelFetchData((void**)&iomodel->y,NULL,NULL,iomodel_handle,"y","Matrix","Mat"); 316 IoModelFetchData((void**)&iomodel->z,NULL,NULL,iomodel_handle,"z","Matrix","Mat"); 317 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 318 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 319 IoModelFetchData((void**)&iomodel->gridonbed,NULL,NULL,iomodel_handle,"gridonbed","Matrix","Mat"); 320 IoModelFetchData((void**)&iomodel->gridonsurface,NULL,NULL,iomodel_handle,"gridonsurface","Matrix","Mat"); 321 IoModelFetchData((void**)&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet","Matrix","Mat"); 322 IoModelFetchData((void**)&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf","Matrix","Mat"); 323 323 324 324 325 325 /*Get number of dofs per node: */ 326 DistributeNumDofs(&node_numdofs, model->analysis_type,model->sub_analysis_type);327 328 for (i=0;i< model->numberofnodes;i++){326 DistributeNumDofs(&node_numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); 327 328 for (i=0;i<iomodel->numberofnodes;i++){ 329 329 #ifdef _PARALLEL_ 330 330 /*keep only this partition's nodes:*/ … … 347 347 #endif 348 348 349 node_x[0]= model->x[i];350 node_x[1]= model->y[i];351 node_x[2]= model->z[i];352 node_sigma=( model->z[i]-model->bed[i])/(model->thickness[i]);353 354 node_onbed=(int) model->gridonbed[i];355 node_onsurface=(int) model->gridonsurface[i];356 node_onshelf=(int) model->gridoniceshelf[i];357 node_onsheet=(int) model->gridonicesheet[i];358 359 if (isnan( model->uppernodes[i])){349 node_x[0]=iomodel->x[i]; 350 node_x[1]=iomodel->y[i]; 351 node_x[2]=iomodel->z[i]; 352 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]); 353 354 node_onbed=(int)iomodel->gridonbed[i]; 355 node_onsurface=(int)iomodel->gridonsurface[i]; 356 node_onshelf=(int)iomodel->gridoniceshelf[i]; 357 node_onsheet=(int)iomodel->gridonicesheet[i]; 358 359 if (isnan(iomodel->uppernodes[i])){ 360 360 node_upper_node_id=node_id; //nodes on surface do not have upper nodes, only themselves. 361 361 } 362 362 else{ 363 node_upper_node_id=(int) model->uppernodes[i];363 node_upper_node_id=(int)iomodel->uppernodes[i]; 364 364 } 365 365 … … 382 382 383 383 /*Clean fetched data: */ 384 xfree((void**)& model->deadgrids);385 xfree((void**)& model->x);386 xfree((void**)& model->y);387 xfree((void**)& model->z);388 xfree((void**)& model->thickness);389 xfree((void**)& model->bed);390 xfree((void**)& model->gridonbed);391 xfree((void**)& model->gridonsurface);392 xfree((void**)& model->uppernodes);393 xfree((void**)& model->gridonicesheet);394 xfree((void**)& model->gridoniceshelf);395 396 397 /*Keep partitioning information into model*/398 model->epart=epart;399 model->my_grids=my_grids;400 model->my_bordergrids=my_bordergrids;384 xfree((void**)&iomodel->deadgrids); 385 xfree((void**)&iomodel->x); 386 xfree((void**)&iomodel->y); 387 xfree((void**)&iomodel->z); 388 xfree((void**)&iomodel->thickness); 389 xfree((void**)&iomodel->bed); 390 xfree((void**)&iomodel->gridonbed); 391 xfree((void**)&iomodel->gridonsurface); 392 xfree((void**)&iomodel->uppernodes); 393 xfree((void**)&iomodel->gridonicesheet); 394 xfree((void**)&iomodel->gridoniceshelf); 395 396 397 /*Keep partitioning information into iomodel*/ 398 iomodel->epart=epart; 399 iomodel->my_grids=my_grids; 400 iomodel->my_bordergrids=my_bordergrids; 401 401 402 402 /*Free ressources:*/ -
issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateLoadsDiagnosticVert.cpp
r300 r1834 11 11 #include "../../shared/shared.h" 12 12 #include "../../include/macros.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateLoadsDiagnosticVert(DataSet** ploads, Model* model,ConstDataHandlemodel_handle){16 void CreateLoadsDiagnosticVert(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 DataSet* loads = NULL; … … 21 21 loads = new DataSet(LoadsEnum()); 22 22 23 /*Now, is the model running in 3d? : */24 if (strcmp( model->meshtype,"2d")==0)goto cleanup_and_return;23 /*Now, is the iomodel running in 3d? : */ 24 if (strcmp(iomodel->meshtype,"2d")==0)goto cleanup_and_return; 25 25 26 26 cleanup_and_return: -
issm/trunk/src/c/ModelProcessorx/Melting/CreateConstraintsMelting.cpp
r483 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateConstraintsMelting(DataSet** pconstraints, Model* model,ConstDataHandlemodel_handle){16 void CreateConstraintsMelting(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 -
issm/trunk/src/c/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp
r1648 r1834 12 12 #include "../../shared/shared.h" 13 13 #include "../../MeshPartitionx/MeshPartitionx.h" 14 #include "../ Model.h"15 16 17 void CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, Model* model,ConstDataHandlemodel_handle){14 #include "../IoModel.h" 15 16 17 void CreateElementsNodesAndMaterialsMelting(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){ 18 18 19 19 … … 123 123 124 124 /*Width of elements: */ 125 if(strcmp( model->meshtype,"2d")==0)throw ErrorException(__FUNCT__," error message: 2d temperature computations not supported yet!");125 if(strcmp(iomodel->meshtype,"2d")==0)throw ErrorException(__FUNCT__," error message: 2d temperature computations not supported yet!"); 126 126 elements_width=6; //penta elements 127 127 … … 129 129 #ifdef _PARALLEL_ 130 130 /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/ 131 ModelFetchData((void**)&model->elements2d,NULL,NULL,model_handle,"elements2d","Matrix","Mat");132 133 134 MeshPartitionx(&epart, &npart, model->numberofelements,model->numberofnodes,model->elements, model->numberofelements2d,model->numberofnodes2d,model->elements2d,model->numlayers,elements_width,model->meshtype,num_procs);131 IoModelFetchData((void**)&iomodel->elements2d,NULL,NULL,iomodel_handle,"elements2d","Matrix","Mat"); 132 133 134 MeshPartitionx(&epart, &npart,iomodel->numberofelements,iomodel->numberofnodes,iomodel->elements, iomodel->numberofelements2d,iomodel->numberofnodes2d,iomodel->elements2d,iomodel->numlayers,elements_width, iomodel->meshtype,num_procs); 135 135 136 136 /*Free elements and elements2d: */ 137 xfree((void**)& model->elements2d);137 xfree((void**)&iomodel->elements2d); 138 138 139 139 /*Used later on: */ 140 my_grids=(int*)xcalloc( model->numberofnodes,sizeof(int));140 my_grids=(int*)xcalloc(iomodel->numberofnodes,sizeof(int)); 141 141 #endif 142 142 … … 146 146 147 147 /*Fetch data needed: */ 148 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");149 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");150 ModelFetchData((void**)&model->surface,NULL,NULL,model_handle,"surface","Matrix","Mat");151 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");152 ModelFetchData((void**)&model->drag,NULL,NULL,model_handle,"drag","Matrix","Mat");153 ModelFetchData((void**)&model->p,NULL,NULL,model_handle,"p","Matrix","Mat");154 ModelFetchData((void**)&model->q,NULL,NULL,model_handle,"q","Matrix","Mat");155 ModelFetchData((void**)&model->elementoniceshelf,NULL,NULL,model_handle,"elementoniceshelf","Matrix","Mat");156 ModelFetchData((void**)&model->elementonbed,NULL,NULL,model_handle,"elementonbed","Matrix","Mat");157 ModelFetchData((void**)&model->elementonsurface,NULL,NULL,model_handle,"elementonsurface","Matrix","Mat");158 ModelFetchData((void**)&model->elements_type,NULL,NULL,model_handle,"elements_type","Matrix","Mat");159 ModelFetchData((void**)&model->B,NULL,NULL,model_handle,"B","Matrix","Mat");160 ModelFetchData((void**)&model->n,NULL,NULL,model_handle,"n","Matrix","Mat");161 ModelFetchData((void**)&model->accumulation,NULL,NULL,model_handle,"accumulation","Matrix","Mat");162 ModelFetchData((void**)&model->melting,NULL,NULL,model_handle,"melting","Matrix","Mat");163 ModelFetchData((void**)&model->elementonwater,NULL,NULL,model_handle,"elementonwater","Matrix","Mat");164 165 for (i=0;i< model->numberofelements;i++){148 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 149 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 150 IoModelFetchData((void**)&iomodel->surface,NULL,NULL,iomodel_handle,"surface","Matrix","Mat"); 151 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 152 IoModelFetchData((void**)&iomodel->drag,NULL,NULL,iomodel_handle,"drag","Matrix","Mat"); 153 IoModelFetchData((void**)&iomodel->p,NULL,NULL,iomodel_handle,"p","Matrix","Mat"); 154 IoModelFetchData((void**)&iomodel->q,NULL,NULL,iomodel_handle,"q","Matrix","Mat"); 155 IoModelFetchData((void**)&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf","Matrix","Mat"); 156 IoModelFetchData((void**)&iomodel->elementonbed,NULL,NULL,iomodel_handle,"elementonbed","Matrix","Mat"); 157 IoModelFetchData((void**)&iomodel->elementonsurface,NULL,NULL,iomodel_handle,"elementonsurface","Matrix","Mat"); 158 IoModelFetchData((void**)&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type","Matrix","Mat"); 159 IoModelFetchData((void**)&iomodel->B,NULL,NULL,iomodel_handle,"B","Matrix","Mat"); 160 IoModelFetchData((void**)&iomodel->n,NULL,NULL,iomodel_handle,"n","Matrix","Mat"); 161 IoModelFetchData((void**)&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation","Matrix","Mat"); 162 IoModelFetchData((void**)&iomodel->melting,NULL,NULL,iomodel_handle,"melting","Matrix","Mat"); 163 IoModelFetchData((void**)&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater","Matrix","Mat"); 164 165 for (i=0;i<iomodel->numberofelements;i++){ 166 166 #ifdef _PARALLEL_ 167 167 /*We are using our element partition to decide which elements will be created on this node: */ … … 173 173 penta_id=i+1; //matlab indexing. 174 174 penta_mid=i+1; //refers to the corresponding material property card 175 penta_mparid= model->numberofelements+1;//refers to the corresponding parmat property card175 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card 176 176 177 177 /*vertices,thickness,surface,bed and drag: */ 178 178 for(j=0;j<6;j++){ 179 penta_g[j]=(int)*( model->elements+elements_width*i+j);180 penta_h[j]=*( model->thickness+ ((int)*(model->elements+elements_width*i+j)-1));181 penta_s[j]=*( model->surface+ ((int)*(model->elements+elements_width*i+j)-1));182 penta_b[j]=*( model->bed+ ((int)*(model->elements+elements_width*i+j)-1));183 penta_k[j]=*( model->drag+ ((int)*(model->elements+elements_width*i+j)-1));184 penta_melting[j]=*( model->melting+ ((int)*(model->elements+elements_width*i+j)-1));185 penta_accumulation[j]=*( model->accumulation+ ((int)*(model->elements+elements_width*i+j)-1));179 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j); 180 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 181 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 182 penta_b[j]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 183 penta_k[j]=*(iomodel->drag+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 184 penta_melting[j]=*(iomodel->melting+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 185 penta_accumulation[j]=*(iomodel->accumulation+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 186 186 } 187 187 188 188 /*basal drag:*/ 189 penta_friction_type=(int) model->drag_type;190 191 penta_p= model->p[i];192 penta_q= model->q[i];189 penta_friction_type=(int)iomodel->drag_type; 190 191 penta_p=iomodel->p[i]; 192 penta_q=iomodel->q[i]; 193 193 194 194 /*diverse: */ 195 penta_shelf=(int)*( model->elementoniceshelf+i);196 penta_onbed=(int)*( model->elementonbed+i);197 penta_onsurface=(int)*( model->elementonsurface+i);198 penta_meanvel= model->meanvel;199 penta_epsvel= model->epsvel;200 penta_onwater=(bool)*( model->elementonwater+i);195 penta_shelf=(int)*(iomodel->elementoniceshelf+i); 196 penta_onbed=(int)*(iomodel->elementonbed+i); 197 penta_onsurface=(int)*(iomodel->elementonsurface+i); 198 penta_meanvel=iomodel->meanvel; 199 penta_epsvel=iomodel->epsvel; 200 penta_onwater=(bool)*(iomodel->elementonwater+i); 201 201 202 202 /*viscosity_overshoot*/ 203 penta_viscosity_overshoot= model->viscosity_overshoot;203 penta_viscosity_overshoot=iomodel->viscosity_overshoot; 204 204 penta_collapse=1; 205 205 … … 219 219 B_avg=0; 220 220 for(j=0;j<6;j++){ 221 B_avg+=*( model->B+((int)*(model->elements+elements_width*i+j)-1));221 B_avg+=*(iomodel->B+((int)*(iomodel->elements+elements_width*i+j)-1)); 222 222 } 223 223 B_avg=B_avg/6; 224 224 matice_B= B_avg; 225 matice_n=(double)*( model->n+i);225 matice_n=(double)*(iomodel->n+i); 226 226 227 227 /*Create matice using its constructor:*/ … … 236 236 into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids 237 237 will hold which grids belong to this partition*/ 238 my_grids[(int)*( model->elements+elements_width*i+0)-1]=1;239 my_grids[(int)*( model->elements+elements_width*i+1)-1]=1;240 my_grids[(int)*( model->elements+elements_width*i+2)-1]=1;241 my_grids[(int)*( model->elements+elements_width*i+3)-1]=1;242 my_grids[(int)*( model->elements+elements_width*i+4)-1]=1;243 my_grids[(int)*( model->elements+elements_width*i+5)-1]=1;238 my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1; 239 my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1; 240 my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1; 241 my_grids[(int)*(iomodel->elements+elements_width*i+3)-1]=1; 242 my_grids[(int)*(iomodel->elements+elements_width*i+4)-1]=1; 243 my_grids[(int)*(iomodel->elements+elements_width*i+5)-1]=1; 244 244 #endif 245 245 … … 251 251 252 252 /*Free data: */ 253 xfree((void**)& model->elements);254 xfree((void**)& model->thickness);255 xfree((void**)& model->surface);256 xfree((void**)& model->bed);257 xfree((void**)& model->drag);258 xfree((void**)& model->p);259 xfree((void**)& model->q);260 xfree((void**)& model->elementoniceshelf);261 xfree((void**)& model->elementonbed);262 xfree((void**)& model->elementonsurface);263 xfree((void**)& model->elements_type);264 xfree((void**)& model->n);265 xfree((void**)& model->B);266 xfree((void**)& model->accumulation);267 xfree((void**)& model->melting);268 xfree((void**)& model->elementonwater);253 xfree((void**)&iomodel->elements); 254 xfree((void**)&iomodel->thickness); 255 xfree((void**)&iomodel->surface); 256 xfree((void**)&iomodel->bed); 257 xfree((void**)&iomodel->drag); 258 xfree((void**)&iomodel->p); 259 xfree((void**)&iomodel->q); 260 xfree((void**)&iomodel->elementoniceshelf); 261 xfree((void**)&iomodel->elementonbed); 262 xfree((void**)&iomodel->elementonsurface); 263 xfree((void**)&iomodel->elements_type); 264 xfree((void**)&iomodel->n); 265 xfree((void**)&iomodel->B); 266 xfree((void**)&iomodel->accumulation); 267 xfree((void**)&iomodel->melting); 268 xfree((void**)&iomodel->elementonwater); 269 269 270 270 271 271 /*Add one constant material property to materials: */ 272 matpar_mid= model->numberofelements+1; //put it at the end of the materials273 matpar_g= model->g;274 matpar_rho_ice= model->rho_ice;275 matpar_rho_water= model->rho_water;276 matpar_thermalconductivity= model->thermalconductivity;277 matpar_heatcapacity= model->heatcapacity;278 matpar_latentheat= model->latentheat;279 matpar_beta= model->beta;280 matpar_meltingpoint= model->meltingpoint;281 matpar_mixed_layer_capacity= model->mixed_layer_capacity;282 matpar_thermal_exchange_velocity= model->thermal_exchange_velocity;272 matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials 273 matpar_g=iomodel->g; 274 matpar_rho_ice=iomodel->rho_ice; 275 matpar_rho_water=iomodel->rho_water; 276 matpar_thermalconductivity=iomodel->thermalconductivity; 277 matpar_heatcapacity=iomodel->heatcapacity; 278 matpar_latentheat=iomodel->latentheat; 279 matpar_beta=iomodel->beta; 280 matpar_meltingpoint=iomodel->meltingpoint; 281 matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity; 282 matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity; 283 283 284 284 /*Create matpar object using its constructor: */ … … 293 293 /*From the element partitioning, we can determine which grids are on the inside of this cpu's 294 294 *element partition, and which are on its border with other nodes:*/ 295 gridborder=NewVec( model->numberofnodes);296 297 for (i=0;i< model->numberofnodes;i++){295 gridborder=NewVec(iomodel->numberofnodes); 296 297 for (i=0;i<iomodel->numberofnodes;i++){ 298 298 if(my_grids[i])VecSetValue(gridborder,i,1,ADD_VALUES); 299 299 } … … 309 309 #ifdef _DEBUG_ 310 310 if(my_rank==0){ 311 for (i=0;i< model->numberofnodes;i++){311 for (i=0;i<iomodel->numberofnodes;i++){ 312 312 printf("Grid id %i Border grid %lf\n",i+1,my_bordergrids[i]); 313 313 } … … 317 317 318 318 /*Partition penalties in 3d: */ 319 if(strcmp( model->meshtype,"3d")==0){319 if(strcmp(iomodel->meshtype,"3d")==0){ 320 320 321 321 /*Get penalties: */ 322 ModelFetchData((void**)&model->penalties,&model->numpenalties,NULL,model_handle,"penalties","Matrix","Mat");323 324 if( model->numpenalties){325 326 model->penaltypartitioning=(int*)xmalloc(model->numpenalties*sizeof(int));322 IoModelFetchData((void**)&iomodel->penalties,&iomodel->numpenalties,NULL,iomodel_handle,"penalties","Matrix","Mat"); 323 324 if(iomodel->numpenalties){ 325 326 iomodel->penaltypartitioning=(int*)xmalloc(iomodel->numpenalties*sizeof(int)); 327 327 #ifdef _SERIAL_ 328 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=1;328 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=1; 329 329 #else 330 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=-1;331 332 for(i=0;i< model->numpenalties;i++){333 first_grid_index=(int)(*( model->penalties+i*model->numlayers+0)-1);330 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=-1; 331 332 for(i=0;i<iomodel->numpenalties;i++){ 333 first_grid_index=(int)(*(iomodel->penalties+i*iomodel->numlayers+0)-1); 334 334 if((my_grids[first_grid_index]==1) && (my_bordergrids[first_grid_index]<=1.0) ) { //this grid belongs to this node's internal partition grids 335 335 /*All grids that are being penalised belong to this node's internal grid partition.:*/ 336 model->penaltypartitioning[i]=1;336 iomodel->penaltypartitioning[i]=1; 337 337 } 338 338 if(my_bordergrids[first_grid_index]>1.0) { //this grid belongs to a partition border 339 model->penaltypartitioning[i]=0;339 iomodel->penaltypartitioning[i]=0; 340 340 } 341 341 } … … 344 344 345 345 /*Free penalties: */ 346 xfree((void**)& model->penalties);346 xfree((void**)&iomodel->penalties); 347 347 } 348 348 … … 355 355 356 356 /*First fetch data: */ 357 if (strcmp( model->meshtype,"3d")==0){358 ModelFetchData((void**)&model->deadgrids,NULL,NULL,model_handle,"deadgrids","Matrix","Mat");359 ModelFetchData((void**)&model->uppernodes,NULL,NULL,model_handle,"uppergrids","Matrix","Mat");357 if (strcmp(iomodel->meshtype,"3d")==0){ 358 IoModelFetchData((void**)&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids","Matrix","Mat"); 359 IoModelFetchData((void**)&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids","Matrix","Mat"); 360 360 } 361 ModelFetchData((void**)&model->x,NULL,NULL,model_handle,"x","Matrix","Mat");362 ModelFetchData((void**)&model->y,NULL,NULL,model_handle,"y","Matrix","Mat");363 ModelFetchData((void**)&model->z,NULL,NULL,model_handle,"z","Matrix","Mat");364 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");365 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");366 ModelFetchData((void**)&model->gridonbed,NULL,NULL,model_handle,"gridonbed","Matrix","Mat");367 ModelFetchData((void**)&model->gridonsurface,NULL,NULL,model_handle,"gridonsurface","Matrix","Mat");368 ModelFetchData((void**)&model->gridonicesheet,NULL,NULL,model_handle,"gridonicesheet","Matrix","Mat");369 ModelFetchData((void**)&model->gridoniceshelf,NULL,NULL,model_handle,"gridoniceshelf","Matrix","Mat");361 IoModelFetchData((void**)&iomodel->x,NULL,NULL,iomodel_handle,"x","Matrix","Mat"); 362 IoModelFetchData((void**)&iomodel->y,NULL,NULL,iomodel_handle,"y","Matrix","Mat"); 363 IoModelFetchData((void**)&iomodel->z,NULL,NULL,iomodel_handle,"z","Matrix","Mat"); 364 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 365 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 366 IoModelFetchData((void**)&iomodel->gridonbed,NULL,NULL,iomodel_handle,"gridonbed","Matrix","Mat"); 367 IoModelFetchData((void**)&iomodel->gridonsurface,NULL,NULL,iomodel_handle,"gridonsurface","Matrix","Mat"); 368 IoModelFetchData((void**)&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet","Matrix","Mat"); 369 IoModelFetchData((void**)&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf","Matrix","Mat"); 370 370 371 371 372 372 /*Get number of dofs per node: */ 373 DistributeNumDofs(&node_numdofs, model->analysis_type,model->sub_analysis_type);374 375 for (i=0;i< model->numberofnodes;i++){373 DistributeNumDofs(&node_numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); 374 375 for (i=0;i<iomodel->numberofnodes;i++){ 376 376 #ifdef _PARALLEL_ 377 377 /*keep only this partition's nodes:*/ … … 394 394 #endif 395 395 396 node_x[0]= model->x[i];397 node_x[1]= model->y[i];398 node_x[2]= model->z[i];399 node_sigma=( model->z[i]-model->bed[i])/(model->thickness[i]);400 401 node_onbed=(int) model->gridonbed[i];402 node_onsurface=(int) model->gridonsurface[i];403 node_onshelf=(int) model->gridoniceshelf[i];404 node_onsheet=(int) model->gridonicesheet[i];405 406 if (strcmp( model->meshtype,"3d")==0){407 if (isnan( model->uppernodes[i])){396 node_x[0]=iomodel->x[i]; 397 node_x[1]=iomodel->y[i]; 398 node_x[2]=iomodel->z[i]; 399 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]); 400 401 node_onbed=(int)iomodel->gridonbed[i]; 402 node_onsurface=(int)iomodel->gridonsurface[i]; 403 node_onshelf=(int)iomodel->gridoniceshelf[i]; 404 node_onsheet=(int)iomodel->gridonicesheet[i]; 405 406 if (strcmp(iomodel->meshtype,"3d")==0){ 407 if (isnan(iomodel->uppernodes[i])){ 408 408 node_upper_node_id=node_id; //nodes on surface do not have upper nodes, only themselves. 409 409 } 410 410 else{ 411 node_upper_node_id=(int) model->uppernodes[i];411 node_upper_node_id=(int)iomodel->uppernodes[i]; 412 412 } 413 413 } … … 421 421 422 422 /*set single point constraints.: */ 423 if (! model->gridonbed[i]){423 if (!iomodel->gridonbed[i]){ 424 424 for(k=1;k<=node_numdofs;k++){ 425 425 node->FreezeDof(k); … … 441 441 442 442 /*Clean fetched data: */ 443 xfree((void**)& model->deadgrids);444 xfree((void**)& model->x);445 xfree((void**)& model->y);446 xfree((void**)& model->z);447 xfree((void**)& model->thickness);448 xfree((void**)& model->bed);449 xfree((void**)& model->gridonbed);450 xfree((void**)& model->gridonsurface);451 xfree((void**)& model->uppernodes);452 xfree((void**)& model->gridonicesheet);453 xfree((void**)& model->gridoniceshelf);454 455 /*Keep partitioning information into model*/456 model->epart=epart;457 model->my_grids=my_grids;458 model->my_bordergrids=my_bordergrids;443 xfree((void**)&iomodel->deadgrids); 444 xfree((void**)&iomodel->x); 445 xfree((void**)&iomodel->y); 446 xfree((void**)&iomodel->z); 447 xfree((void**)&iomodel->thickness); 448 xfree((void**)&iomodel->bed); 449 xfree((void**)&iomodel->gridonbed); 450 xfree((void**)&iomodel->gridonsurface); 451 xfree((void**)&iomodel->uppernodes); 452 xfree((void**)&iomodel->gridonicesheet); 453 xfree((void**)&iomodel->gridoniceshelf); 454 455 /*Keep partitioning information into iomodel*/ 456 iomodel->epart=epart; 457 iomodel->my_grids=my_grids; 458 iomodel->my_bordergrids=my_bordergrids; 459 459 460 460 /*Free ressources:*/ -
issm/trunk/src/c/ModelProcessorx/Melting/CreateLoadsMelting.cpp
r483 r1834 11 11 #include "../../shared/shared.h" 12 12 #include "../../include/macros.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateLoadsMelting(DataSet** ploads, Model* model,ConstDataHandlemodel_handle){16 void CreateLoadsMelting(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 int i,j,counter; … … 46 46 47 47 //create penalties for grids: no grid can have a temperature over the melting point 48 ModelFetchData((void**)&model->gridonbed,NULL,NULL,model_handle,"gridonbed","Matrix","Mat");48 IoModelFetchData((void**)&iomodel->gridonbed,NULL,NULL,iomodel_handle,"gridonbed","Matrix","Mat"); 49 49 50 for (i=0;i< model->numberofnodes;i++){50 for (i=0;i<iomodel->numberofnodes;i++){ 51 51 #ifdef _PARALLEL_ 52 52 /*keep only this partition's nodes:*/ 53 if(( model->my_grids[i]==1)){53 if((iomodel->my_grids[i]==1)){ 54 54 #endif 55 55 56 if ( model->gridonbed[i]){56 if (iomodel->gridonbed[i]){ 57 57 58 58 pengrid_id=count+1; //matlab indexing 59 59 pengrid_node_id=i+1; 60 60 pengrid_dof=1; 61 pengrid_penalty_offset= model->penalty_offset;61 pengrid_penalty_offset=iomodel->penalty_offset; 62 62 pengrid_active=0; 63 pengrid_mparid= model->numberofelements+1;//refers to the corresponding parmat property card63 pengrid_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card 64 64 65 65 pengrid= new Pengrid(pengrid_id, pengrid_node_id,pengrid_mparid,pengrid_dof, pengrid_active, pengrid_penalty_offset,pengrid_thermal_steadystate); … … 69 69 } 70 70 #ifdef _PARALLEL_ 71 } //if(( model->my_grids[i]==1))71 } //if((iomodel->my_grids[i]==1)) 72 72 #endif 73 73 } 74 xfree((void**)& model->gridonbed);74 xfree((void**)&iomodel->gridonbed); 75 75 76 76 /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these -
issm/trunk/src/c/ModelProcessorx/Melting/CreateParametersMelting.cpp
r1648 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 void CreateParametersMelting(DataSet** pparameters, Model* model,ConstDataHandlemodel_handle){15 void CreateParametersMelting(DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle){ 16 16 17 17 Param* param = NULL; … … 28 28 29 29 /* get initial melting if transient*/ 30 if( model->sub_analysis_type==TransientAnalysisEnum()){30 if(iomodel->sub_analysis_type==TransientAnalysisEnum()){ 31 31 32 32 /*Get melting: */ 33 ModelFetchData((void**)&melting,NULL,NULL,model_handle,"melting","Matrix","Mat");33 IoModelFetchData((void**)&melting,NULL,NULL,iomodel_handle,"melting","Matrix","Mat"); 34 34 if(melting) { 35 for(i=0;i< model->numberofnodes;i++)melting[i]=melting[i]/model->yts; //m/s instead of m/yr35 for(i=0;i<iomodel->numberofnodes;i++)melting[i]=melting[i]/iomodel->yts; //m/s instead of m/yr 36 36 } 37 37 else{ 38 for(i=0;i< model->numberofnodes;i++)melting[i]=0;38 for(i=0;i<iomodel->numberofnodes;i++)melting[i]=0; 39 39 } 40 40 41 41 count++; 42 42 param= new Param(count,"m_g",DOUBLEVEC); 43 if(melting) param->SetDoubleVec(melting, model->numberofnodes);43 if(melting) param->SetDoubleVec(melting,iomodel->numberofnodes); 44 44 else param->SetDoubleVec(melting,0); 45 45 parameters->AddObject(param); -
issm/trunk/src/c/ModelProcessorx/Prognostic/CreateConstraintsPrognostic.cpp
r1763 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateConstraintsPrognostic(DataSet** pconstraints, Model* model,ConstDataHandlemodel_handle){16 void CreateConstraintsPrognostic(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 … … 35 35 36 36 /*Fetch data: */ 37 ModelFetchData((void**)&spcthickness,NULL,NULL,model_handle,"spcthickness","Matrix","Mat");37 IoModelFetchData((void**)&spcthickness,NULL,NULL,iomodel_handle,"spcthickness","Matrix","Mat"); 38 38 39 39 count=0; 40 40 41 41 /*Create spcs from x,y,z, as well as the spc values on those spcs: */ 42 for (i=0;i< model->numberofnodes;i++){42 for (i=0;i<iomodel->numberofnodes;i++){ 43 43 #ifdef _PARALLEL_ 44 44 /*keep only this partition's nodes:*/ 45 if(( model->my_grids[i]==1)){45 if((iomodel->my_grids[i]==1)){ 46 46 #endif 47 47 -
issm/trunk/src/c/ModelProcessorx/Prognostic/CreateElementsNodesAndMaterialsPrognostic.cpp
r1648 r1834 12 12 #include "../../shared/shared.h" 13 13 #include "../../MeshPartitionx/MeshPartitionx.h" 14 #include "../ Model.h"15 16 17 void CreateElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, Model* model,ConstDataHandlemodel_handle){14 #include "../IoModel.h" 15 16 17 void CreateElementsNodesAndMaterialsPrognostic(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){ 18 18 19 19 … … 146 146 147 147 /*Width of elements: */ 148 if(strcmp( model->meshtype,"2d")==0){148 if(strcmp(iomodel->meshtype,"2d")==0){ 149 149 elements_width=3; //tria elements 150 150 } … … 155 155 #ifdef _PARALLEL_ 156 156 /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/ 157 if(strcmp( model->meshtype,"2d")==0){157 if(strcmp(iomodel->meshtype,"2d")==0){ 158 158 /*load elements: */ 159 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");159 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 160 160 } 161 161 else{ 162 162 /*load elements2d: */ 163 ModelFetchData((void**)&model->elements2d,NULL,NULL,model_handle,"elements2d","Matrix","Mat");164 } 165 166 167 MeshPartitionx(&epart, &npart, model->numberofelements,model->numberofnodes,model->elements, model->numberofelements2d,model->numberofnodes2d,model->elements2d,model->numlayers,elements_width,model->meshtype,num_procs);163 IoModelFetchData((void**)&iomodel->elements2d,NULL,NULL,iomodel_handle,"elements2d","Matrix","Mat"); 164 } 165 166 167 MeshPartitionx(&epart, &npart,iomodel->numberofelements,iomodel->numberofnodes,iomodel->elements, iomodel->numberofelements2d,iomodel->numberofnodes2d,iomodel->elements2d,iomodel->numlayers,elements_width, iomodel->meshtype,num_procs); 168 168 169 169 /*Free elements and elements2d: */ 170 xfree((void**)& model->elements);171 xfree((void**)& model->elements2d);170 xfree((void**)&iomodel->elements); 171 xfree((void**)&iomodel->elements2d); 172 172 173 173 /*Used later on: */ 174 my_grids=(int*)xcalloc( model->numberofnodes,sizeof(int));174 my_grids=(int*)xcalloc(iomodel->numberofnodes,sizeof(int)); 175 175 #endif 176 176 … … 180 180 181 181 /*2d mesh: */ 182 if (strcmp( model->meshtype,"2d")==0){182 if (strcmp(iomodel->meshtype,"2d")==0){ 183 183 184 184 /*Fetch data needed: */ 185 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");186 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");187 ModelFetchData((void**)&model->surface,NULL,NULL,model_handle,"surface","Matrix","Mat");188 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");189 ModelFetchData((void**)&model->elementoniceshelf,NULL,NULL,model_handle,"elementoniceshelf","Matrix","Mat");190 ModelFetchData((void**)&model->elementonwater,NULL,NULL,model_handle,"elementonwater","Matrix","Mat");191 192 for (i=0;i< model->numberofelements;i++){185 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 186 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 187 IoModelFetchData((void**)&iomodel->surface,NULL,NULL,iomodel_handle,"surface","Matrix","Mat"); 188 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 189 IoModelFetchData((void**)&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf","Matrix","Mat"); 190 IoModelFetchData((void**)&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater","Matrix","Mat"); 191 192 for (i=0;i<iomodel->numberofelements;i++){ 193 193 194 194 #ifdef _PARALLEL_ … … 204 204 205 205 /*vertices offsets: */ 206 tria_g[0]=(int)*( model->elements+elements_width*i+0);207 tria_g[1]=(int)*( model->elements+elements_width*i+1);208 tria_g[2]=(int)*( model->elements+elements_width*i+2);206 tria_g[0]=(int)*(iomodel->elements+elements_width*i+0); 207 tria_g[1]=(int)*(iomodel->elements+elements_width*i+1); 208 tria_g[2]=(int)*(iomodel->elements+elements_width*i+2); 209 209 210 210 /*thickness,surface and bed:*/ 211 tria_h[0]= *( model->thickness+ ((int)*(model->elements+elements_width*i+0)-1)); //remember, elements is an index of vertices offsets, in matlab indexing.212 tria_h[1]=*( model->thickness+ ((int)*(model->elements+elements_width*i+1)-1));213 tria_h[2]=*( model->thickness+ ((int)*(model->elements+elements_width*i+2)-1)) ;214 215 tria_s[0]=*( model->surface+ ((int)*(model->elements+elements_width*i+0)-1));216 tria_s[1]=*( model->surface+ ((int)*(model->elements+elements_width*i+1)-1));217 tria_s[2]=*( model->surface+ ((int)*(model->elements+elements_width*i+2)-1));218 219 tria_b[0]=*( model->bed+ ((int)*(model->elements+elements_width*i+0)-1));220 tria_b[1]=*( model->bed+ ((int)*(model->elements+elements_width*i+1)-1));221 tria_b[2]=*( model->bed+ ((int)*(model->elements+elements_width*i+2)-1));211 tria_h[0]= *(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+0)-1)); //remember, elements is an index of vertices offsets, in matlab indexing. 212 tria_h[1]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+1)-1)); 213 tria_h[2]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+2)-1)) ; 214 215 tria_s[0]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+0)-1)); 216 tria_s[1]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+1)-1)); 217 tria_s[2]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+2)-1)); 218 219 tria_b[0]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+0)-1)); 220 tria_b[1]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+1)-1)); 221 tria_b[2]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+2)-1)); 222 222 223 223 /*element on iceshelf?:*/ 224 tria_shelf=(int)*( model->elementoniceshelf+i);225 tria_onwater=(bool)*( model->elementonwater+i);226 tria_artdiff= model->artificial_diffusivity;224 tria_shelf=(int)*(iomodel->elementoniceshelf+i); 225 tria_onwater=(bool)*(iomodel->elementonwater+i); 226 tria_artdiff=iomodel->artificial_diffusivity; 227 227 228 228 /*Create tria element using its constructor:*/ … … 237 237 into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids 238 238 will hold which grids belong to this partition*/ 239 my_grids[(int)*( model->elements+elements_width*i+0)-1]=1;240 my_grids[(int)*( model->elements+elements_width*i+1)-1]=1;241 my_grids[(int)*( model->elements+elements_width*i+2)-1]=1;239 my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1; 240 my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1; 241 my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1; 242 242 #endif 243 243 … … 250 250 251 251 /*Free data : */ 252 xfree((void**)& model->elements);253 xfree((void**)& model->thickness);254 xfree((void**)& model->surface);255 xfree((void**)& model->bed);256 xfree((void**)& model->elementoniceshelf);257 xfree((void**)& model->elementonwater);252 xfree((void**)&iomodel->elements); 253 xfree((void**)&iomodel->thickness); 254 xfree((void**)&iomodel->surface); 255 xfree((void**)&iomodel->bed); 256 xfree((void**)&iomodel->elementoniceshelf); 257 xfree((void**)&iomodel->elementonwater); 258 258 259 259 } … … 261 261 262 262 /*Fetch data needed: */ 263 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");264 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");265 ModelFetchData((void**)&model->surface,NULL,NULL,model_handle,"surface","Matrix","Mat");266 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");267 ModelFetchData((void**)&model->elementoniceshelf,NULL,NULL,model_handle,"elementoniceshelf","Matrix","Mat");268 ModelFetchData((void**)&model->elementonbed,NULL,NULL,model_handle,"elementonbed","Matrix","Mat");269 ModelFetchData((void**)&model->elementonsurface,NULL,NULL,model_handle,"elementonsurface","Matrix","Mat");270 ModelFetchData((void**)&model->elementonwater,NULL,NULL,model_handle,"elementonwater","Matrix","Mat");271 272 for (i=0;i< model->numberofelements;i++){263 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 264 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 265 IoModelFetchData((void**)&iomodel->surface,NULL,NULL,iomodel_handle,"surface","Matrix","Mat"); 266 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 267 IoModelFetchData((void**)&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf","Matrix","Mat"); 268 IoModelFetchData((void**)&iomodel->elementonbed,NULL,NULL,iomodel_handle,"elementonbed","Matrix","Mat"); 269 IoModelFetchData((void**)&iomodel->elementonsurface,NULL,NULL,iomodel_handle,"elementonsurface","Matrix","Mat"); 270 IoModelFetchData((void**)&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater","Matrix","Mat"); 271 272 for (i=0;i<iomodel->numberofelements;i++){ 273 273 #ifdef _PARALLEL_ 274 274 /*We are using our element partition to decide which elements will be created on this node: */ … … 284 284 /*vertices,thickness,surface,bed and drag: */ 285 285 for(j=0;j<6;j++){ 286 penta_g[j]=(int)*( model->elements+elements_width*i+j);287 penta_h[j]=*( model->thickness+ ((int)*(model->elements+elements_width*i+j)-1));288 penta_s[j]=*( model->surface+ ((int)*(model->elements+elements_width*i+j)-1));289 penta_b[j]=*( model->bed+ ((int)*(model->elements+elements_width*i+j)-1));286 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j); 287 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 288 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 289 penta_b[j]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 290 290 } 291 291 292 292 /*diverse: */ 293 penta_shelf=(int)*( model->elementoniceshelf+i);294 penta_onbed=(int)*( model->elementonbed+i);295 penta_onsurface=(int)*( model->elementonsurface+i);293 penta_shelf=(int)*(iomodel->elementoniceshelf+i); 294 penta_onbed=(int)*(iomodel->elementonbed+i); 295 penta_onsurface=(int)*(iomodel->elementonsurface+i); 296 296 penta_collapse=1; 297 penta_artdiff= model->artificial_diffusivity;298 penta_onwater=(bool)*( model->elementonwater+i);297 penta_artdiff=iomodel->artificial_diffusivity; 298 penta_onwater=(bool)*(iomodel->elementonwater+i); 299 299 300 300 … … 313 313 into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids 314 314 will hold which grids belong to this partition*/ 315 my_grids[(int)*( model->elements+elements_width*i+0)-1]=1;316 my_grids[(int)*( model->elements+elements_width*i+1)-1]=1;317 my_grids[(int)*( model->elements+elements_width*i+2)-1]=1;318 my_grids[(int)*( model->elements+elements_width*i+3)-1]=1;319 my_grids[(int)*( model->elements+elements_width*i+4)-1]=1;320 my_grids[(int)*( model->elements+elements_width*i+5)-1]=1;315 my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1; 316 my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1; 317 my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1; 318 my_grids[(int)*(iomodel->elements+elements_width*i+3)-1]=1; 319 my_grids[(int)*(iomodel->elements+elements_width*i+4)-1]=1; 320 my_grids[(int)*(iomodel->elements+elements_width*i+5)-1]=1; 321 321 #endif 322 322 … … 328 328 329 329 /*Free data: */ 330 xfree((void**)& model->elements);331 xfree((void**)& model->thickness);332 xfree((void**)& model->surface);333 xfree((void**)& model->bed);334 xfree((void**)& model->elementoniceshelf);335 xfree((void**)& model->elementonbed);336 xfree((void**)& model->elementonsurface);337 xfree((void**)& model->elementonwater);330 xfree((void**)&iomodel->elements); 331 xfree((void**)&iomodel->thickness); 332 xfree((void**)&iomodel->surface); 333 xfree((void**)&iomodel->bed); 334 xfree((void**)&iomodel->elementoniceshelf); 335 xfree((void**)&iomodel->elementonbed); 336 xfree((void**)&iomodel->elementonsurface); 337 xfree((void**)&iomodel->elementonwater); 338 338 339 339 } //if (strcmp(meshtype,"2d")==0) … … 342 342 /*From the element partitioning, we can determine which grids are on the inside of this cpu's 343 343 *element partition, and which are on its border with other nodes:*/ 344 gridborder=NewVec( model->numberofnodes);345 346 for (i=0;i< model->numberofnodes;i++){344 gridborder=NewVec(iomodel->numberofnodes); 345 346 for (i=0;i<iomodel->numberofnodes;i++){ 347 347 if(my_grids[i])VecSetValue(gridborder,i,1,ADD_VALUES); 348 348 } … … 358 358 #ifdef _DEBUG_ 359 359 if(my_rank==0){ 360 for (i=0;i< model->numberofnodes;i++){360 for (i=0;i<iomodel->numberofnodes;i++){ 361 361 printf("Grid id %i Border grid %lf\n",i+1,my_bordergrids[i]); 362 362 } … … 367 367 /*Add one constant material property to materials: */ 368 368 matpar_mid=1; //put it at the end of the materials 369 matpar_g= model->g;370 matpar_rho_ice= model->rho_ice;371 matpar_rho_water= model->rho_water;372 matpar_thermalconductivity= model->thermalconductivity;373 matpar_heatcapacity= model->heatcapacity;374 matpar_latentheat= model->latentheat;375 matpar_beta= model->beta;376 matpar_meltingpoint= model->meltingpoint;377 matpar_mixed_layer_capacity= model->mixed_layer_capacity;378 matpar_thermal_exchange_velocity= model->thermal_exchange_velocity;369 matpar_g=iomodel->g; 370 matpar_rho_ice=iomodel->rho_ice; 371 matpar_rho_water=iomodel->rho_water; 372 matpar_thermalconductivity=iomodel->thermalconductivity; 373 matpar_heatcapacity=iomodel->heatcapacity; 374 matpar_latentheat=iomodel->latentheat; 375 matpar_beta=iomodel->beta; 376 matpar_meltingpoint=iomodel->meltingpoint; 377 matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity; 378 matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity; 379 379 380 380 /*Create matpar object using its constructor: */ … … 387 387 388 388 /*Partition penalties in 3d: */ 389 if(strcmp( model->meshtype,"3d")==0){389 if(strcmp(iomodel->meshtype,"3d")==0){ 390 390 391 391 /*Get penalties: */ 392 ModelFetchData((void**)&model->penalties,&model->numpenalties,NULL,model_handle,"penalties","Matrix","Mat");393 394 if( model->numpenalties){395 396 model->penaltypartitioning=(int*)xmalloc(model->numpenalties*sizeof(int));392 IoModelFetchData((void**)&iomodel->penalties,&iomodel->numpenalties,NULL,iomodel_handle,"penalties","Matrix","Mat"); 393 394 if(iomodel->numpenalties){ 395 396 iomodel->penaltypartitioning=(int*)xmalloc(iomodel->numpenalties*sizeof(int)); 397 397 #ifdef _SERIAL_ 398 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=1;398 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=1; 399 399 #else 400 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=-1;401 402 for(i=0;i< model->numpenalties;i++){403 first_grid_index=(int)(*( model->penalties+i*model->numlayers+0)-1);400 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=-1; 401 402 for(i=0;i<iomodel->numpenalties;i++){ 403 first_grid_index=(int)(*(iomodel->penalties+i*iomodel->numlayers+0)-1); 404 404 if((my_grids[first_grid_index]==1) && (my_bordergrids[first_grid_index]<=1.0) ) { //this grid belongs to this node's internal partition grids 405 405 /*All grids that are being penalised belong to this node's internal grid partition.:*/ 406 model->penaltypartitioning[i]=1;406 iomodel->penaltypartitioning[i]=1; 407 407 } 408 408 if(my_bordergrids[first_grid_index]>1.0) { //this grid belongs to a partition border 409 model->penaltypartitioning[i]=0;409 iomodel->penaltypartitioning[i]=0; 410 410 } 411 411 } … … 414 414 415 415 /*Free penalties: */ 416 xfree((void**)& model->penalties);416 xfree((void**)&iomodel->penalties); 417 417 } 418 418 … … 425 425 426 426 /*First fetch data: */ 427 if (strcmp( model->meshtype,"3d")==0){428 ModelFetchData((void**)&model->deadgrids,NULL,NULL,model_handle,"deadgrids","Matrix","Mat");429 ModelFetchData((void**)&model->uppernodes,NULL,NULL,model_handle,"uppergrids","Matrix","Mat");430 } 431 ModelFetchData((void**)&model->x,NULL,NULL,model_handle,"x","Matrix","Mat");432 ModelFetchData((void**)&model->y,NULL,NULL,model_handle,"y","Matrix","Mat");433 ModelFetchData((void**)&model->z,NULL,NULL,model_handle,"z","Matrix","Mat");434 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");435 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");436 ModelFetchData((void**)&model->gridonbed,NULL,NULL,model_handle,"gridonbed","Matrix","Mat");437 ModelFetchData((void**)&model->gridonsurface,NULL,NULL,model_handle,"gridonsurface","Matrix","Mat");438 ModelFetchData((void**)&model->gridonicesheet,NULL,NULL,model_handle,"gridonicesheet","Matrix","Mat");439 ModelFetchData((void**)&model->gridoniceshelf,NULL,NULL,model_handle,"gridoniceshelf","Matrix","Mat");427 if (strcmp(iomodel->meshtype,"3d")==0){ 428 IoModelFetchData((void**)&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids","Matrix","Mat"); 429 IoModelFetchData((void**)&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids","Matrix","Mat"); 430 } 431 IoModelFetchData((void**)&iomodel->x,NULL,NULL,iomodel_handle,"x","Matrix","Mat"); 432 IoModelFetchData((void**)&iomodel->y,NULL,NULL,iomodel_handle,"y","Matrix","Mat"); 433 IoModelFetchData((void**)&iomodel->z,NULL,NULL,iomodel_handle,"z","Matrix","Mat"); 434 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 435 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 436 IoModelFetchData((void**)&iomodel->gridonbed,NULL,NULL,iomodel_handle,"gridonbed","Matrix","Mat"); 437 IoModelFetchData((void**)&iomodel->gridonsurface,NULL,NULL,iomodel_handle,"gridonsurface","Matrix","Mat"); 438 IoModelFetchData((void**)&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet","Matrix","Mat"); 439 IoModelFetchData((void**)&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf","Matrix","Mat"); 440 440 441 441 442 442 /*Get number of dofs per node: */ 443 DistributeNumDofs(&node_numdofs, model->analysis_type,model->sub_analysis_type);444 445 for (i=0;i< model->numberofnodes;i++){443 DistributeNumDofs(&node_numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); 444 445 for (i=0;i<iomodel->numberofnodes;i++){ 446 446 #ifdef _PARALLEL_ 447 447 /*keep only this partition's nodes:*/ … … 464 464 #endif 465 465 466 node_x[0]= model->x[i];467 node_x[1]= model->y[i];468 node_x[2]= model->z[i];469 node_sigma=( model->z[i]-model->bed[i])/(model->thickness[i]);470 471 node_onbed=(int) model->gridonbed[i];472 node_onsurface=(int) model->gridonsurface[i];473 node_onshelf=(int) model->gridoniceshelf[i];474 node_onsheet=(int) model->gridonicesheet[i];475 476 if (strcmp( model->meshtype,"3d")==0){477 if (isnan( model->uppernodes[i])){466 node_x[0]=iomodel->x[i]; 467 node_x[1]=iomodel->y[i]; 468 node_x[2]=iomodel->z[i]; 469 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]); 470 471 node_onbed=(int)iomodel->gridonbed[i]; 472 node_onsurface=(int)iomodel->gridonsurface[i]; 473 node_onshelf=(int)iomodel->gridoniceshelf[i]; 474 node_onsheet=(int)iomodel->gridonicesheet[i]; 475 476 if (strcmp(iomodel->meshtype,"3d")==0){ 477 if (isnan(iomodel->uppernodes[i])){ 478 478 node_upper_node_id=node_id; //nodes on surface do not have upper nodes, only themselves. 479 479 } 480 480 else{ 481 node_upper_node_id=(int) model->uppernodes[i];481 node_upper_node_id=(int)iomodel->uppernodes[i]; 482 482 } 483 483 } … … 491 491 492 492 /*set single point constraints.: */ 493 if (strcmp( model->meshtype,"3d")==0){493 if (strcmp(iomodel->meshtype,"3d")==0){ 494 494 /*On a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */ 495 if (! model->gridonbed[i]){495 if (!iomodel->gridonbed[i]){ 496 496 for(k=1;k<=node_numdofs;k++){ 497 497 node->FreezeDof(k); … … 514 514 515 515 /*Clean fetched data: */ 516 xfree((void**)& model->deadgrids);517 xfree((void**)& model->x);518 xfree((void**)& model->y);519 xfree((void**)& model->z);520 xfree((void**)& model->thickness);521 xfree((void**)& model->bed);522 xfree((void**)& model->gridonbed);523 xfree((void**)& model->gridonsurface);524 xfree((void**)& model->uppernodes);525 xfree((void**)& model->gridonicesheet);526 xfree((void**)& model->gridoniceshelf);527 528 529 /*Keep partitioning information into model*/530 model->epart=epart;531 model->my_grids=my_grids;532 model->my_bordergrids=my_bordergrids;516 xfree((void**)&iomodel->deadgrids); 517 xfree((void**)&iomodel->x); 518 xfree((void**)&iomodel->y); 519 xfree((void**)&iomodel->z); 520 xfree((void**)&iomodel->thickness); 521 xfree((void**)&iomodel->bed); 522 xfree((void**)&iomodel->gridonbed); 523 xfree((void**)&iomodel->gridonsurface); 524 xfree((void**)&iomodel->uppernodes); 525 xfree((void**)&iomodel->gridonicesheet); 526 xfree((void**)&iomodel->gridoniceshelf); 527 528 529 /*Keep partitioning information into iomodel*/ 530 iomodel->epart=epart; 531 iomodel->my_grids=my_grids; 532 iomodel->my_bordergrids=my_bordergrids; 533 533 534 534 /*Free ressources:*/ -
issm/trunk/src/c/ModelProcessorx/Prognostic/CreateLoadsPrognostic.cpp
r586 r1834 11 11 #include "../../shared/shared.h" 12 12 #include "../../include/macros.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateLoadsPrognostic(DataSet** ploads, Model* model,ConstDataHandlemodel_handle){16 void CreateLoadsPrognostic(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 DataSet* loads = NULL; -
issm/trunk/src/c/ModelProcessorx/Prognostic/CreateParametersPrognostic.cpp
r1096 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 void CreateParametersPrognostic(DataSet** pparameters, Model* model,ConstDataHandlemodel_handle){15 void CreateParametersPrognostic(DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle){ 16 16 17 17 Param* param = NULL; … … 39 39 40 40 /*Get vx and vy: */ 41 ModelFetchData((void**)&vx,NULL,NULL,model_handle,"vx","Matrix","Mat");42 ModelFetchData((void**)&vy,NULL,NULL,model_handle,"vy","Matrix","Mat");43 ModelFetchData((void**)&vz,NULL,NULL,model_handle,"vz","Matrix","Mat");41 IoModelFetchData((void**)&vx,NULL,NULL,iomodel_handle,"vx","Matrix","Mat"); 42 IoModelFetchData((void**)&vy,NULL,NULL,iomodel_handle,"vy","Matrix","Mat"); 43 IoModelFetchData((void**)&vz,NULL,NULL,iomodel_handle,"vz","Matrix","Mat"); 44 44 45 u_g=(double*)xcalloc( model->numberofnodes*3,sizeof(double));45 u_g=(double*)xcalloc(iomodel->numberofnodes*3,sizeof(double)); 46 46 47 if(vx) for(i=0;i< model->numberofnodes;i++)u_g[3*i+0]=vx[i]/model->yts;48 if(vy) for(i=0;i< model->numberofnodes;i++)u_g[3*i+1]=vy[i]/model->yts;49 if(vz) for(i=0;i< model->numberofnodes;i++)u_g[3*i+2]=vz[i]/model->yts;47 if(vx) for(i=0;i<iomodel->numberofnodes;i++)u_g[3*i+0]=vx[i]/iomodel->yts; 48 if(vy) for(i=0;i<iomodel->numberofnodes;i++)u_g[3*i+1]=vy[i]/iomodel->yts; 49 if(vz) for(i=0;i<iomodel->numberofnodes;i++)u_g[3*i+2]=vz[i]/iomodel->yts; 50 50 51 51 count++; 52 52 param= new Param(count,"u_g",DOUBLEVEC); 53 param->SetDoubleVec(u_g,3* model->numberofnodes,3);53 param->SetDoubleVec(u_g,3*iomodel->numberofnodes,3); 54 54 parameters->AddObject(param); 55 55 … … 60 60 xfree((void**)&u_g); 61 61 62 /*Get pressure if 3d model: */62 /*Get pressure if 3d iomodel: */ 63 63 parameters->FindParam((void*)&dim,"dim"); 64 64 if (dim==3){ 65 ModelFetchData((void**)&pressure,NULL,NULL,model_handle,"pressure","Matrix","Mat");65 IoModelFetchData((void**)&pressure,NULL,NULL,iomodel_handle,"pressure","Matrix","Mat"); 66 66 67 67 count++; 68 68 param= new Param(count,"p_g",DOUBLEVEC); 69 if(pressure) param->SetDoubleVec(pressure, model->numberofnodes,1);69 if(pressure) param->SetDoubleVec(pressure,iomodel->numberofnodes,1); 70 70 else param->SetDoubleVec(pressure,0,0); 71 71 parameters->AddObject(param); … … 75 75 } 76 76 77 /*Get temperature if 3d model: */77 /*Get temperature if 3d iomodel: */ 78 78 parameters->FindParam((void*)&dim,"dim"); 79 79 if (dim==3){ 80 ModelFetchData((void**)&temperature,NULL,NULL,model_handle,"temperature","Matrix","Mat");80 IoModelFetchData((void**)&temperature,NULL,NULL,iomodel_handle,"temperature","Matrix","Mat"); 81 81 82 82 count++; 83 83 param= new Param(count,"t_g",DOUBLEVEC); 84 if(temperature) param->SetDoubleVec(temperature, model->numberofnodes,1);84 if(temperature) param->SetDoubleVec(temperature,iomodel->numberofnodes,1); 85 85 else param->SetDoubleVec(temperature,0,0); 86 86 parameters->AddObject(param); … … 91 91 92 92 /*Get thickness: */ 93 ModelFetchData((void**)&thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");93 IoModelFetchData((void**)&thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 94 94 95 95 count++; 96 96 param= new Param(count,"h_g",DOUBLEVEC); 97 if(thickness) param->SetDoubleVec(thickness, model->numberofnodes,1);97 if(thickness) param->SetDoubleVec(thickness,iomodel->numberofnodes,1); 98 98 else param->SetDoubleVec(thickness,0,0); 99 99 parameters->AddObject(param); … … 103 103 104 104 /*Get surface: */ 105 ModelFetchData((void**)&surface,NULL,NULL,model_handle,"surface","Matrix","Mat");105 IoModelFetchData((void**)&surface,NULL,NULL,iomodel_handle,"surface","Matrix","Mat"); 106 106 107 107 count++; 108 108 param= new Param(count,"s_g",DOUBLEVEC); 109 if(surface) param->SetDoubleVec(surface, model->numberofnodes,1);109 if(surface) param->SetDoubleVec(surface,iomodel->numberofnodes,1); 110 110 else param->SetDoubleVec(surface,0,0); 111 111 parameters->AddObject(param); … … 115 115 116 116 /*Get bed: */ 117 ModelFetchData((void**)&bed,NULL,NULL,model_handle,"bed","Matrix","Mat");117 IoModelFetchData((void**)&bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 118 118 119 119 count++; 120 120 param= new Param(count,"b_g",DOUBLEVEC); 121 if(bed) param->SetDoubleVec(bed, model->numberofnodes,1);121 if(bed) param->SetDoubleVec(bed,iomodel->numberofnodes,1); 122 122 else param->SetDoubleVec(bed,0,0); 123 123 parameters->AddObject(param); … … 127 127 128 128 /*Get melting: */ 129 ModelFetchData((void**)&melting,NULL,NULL,model_handle,"melting","Matrix","Mat");130 if(melting) for(i=0;i< model->numberofnodes;i++)melting[i]=melting[i]/model->yts;129 IoModelFetchData((void**)&melting,NULL,NULL,iomodel_handle,"melting","Matrix","Mat"); 130 if(melting) for(i=0;i<iomodel->numberofnodes;i++)melting[i]=melting[i]/iomodel->yts; 131 131 132 132 count++; 133 133 param= new Param(count,"m_g",DOUBLEVEC); 134 if(melting) param->SetDoubleVec(melting, model->numberofnodes,1);134 if(melting) param->SetDoubleVec(melting,iomodel->numberofnodes,1); 135 135 else param->SetDoubleVec(melting,0,1); 136 136 parameters->AddObject(param); … … 140 140 141 141 /*Get accumulation: */ 142 ModelFetchData((void**)&accumulation,NULL,NULL,model_handle,"accumulation","Matrix","Mat");143 if(accumulation) for(i=0;i< model->numberofnodes;i++)accumulation[i]=accumulation[i]/model->yts;142 IoModelFetchData((void**)&accumulation,NULL,NULL,iomodel_handle,"accumulation","Matrix","Mat"); 143 if(accumulation) for(i=0;i<iomodel->numberofnodes;i++)accumulation[i]=accumulation[i]/iomodel->yts; 144 144 145 145 count++; 146 146 param= new Param(count,"a_g",DOUBLEVEC); 147 if(accumulation) param->SetDoubleVec(accumulation, model->numberofnodes,1);147 if(accumulation) param->SetDoubleVec(accumulation,iomodel->numberofnodes,1); 148 148 else param->SetDoubleVec(accumulation,0,0); 149 149 parameters->AddObject(param); -
issm/trunk/src/c/ModelProcessorx/Thermal/CreateConstraintsThermal.cpp
r1765 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateConstraintsThermal(DataSet** pconstraints, Model* model,ConstDataHandlemodel_handle){16 void CreateConstraintsThermal(DataSet** pconstraints, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 … … 35 35 36 36 /*Fetch data: */ 37 ModelFetchData((void**)&spctemperature,NULL,NULL,model_handle,"spctemperature","Matrix","Mat");37 IoModelFetchData((void**)&spctemperature,NULL,NULL,iomodel_handle,"spctemperature","Matrix","Mat"); 38 38 39 39 count=0; 40 40 41 41 /*Create spcs from x,y,z, as well as the spc values on those spcs: */ 42 for (i=0;i< model->numberofnodes;i++){42 for (i=0;i<iomodel->numberofnodes;i++){ 43 43 #ifdef _PARALLEL_ 44 44 /*keep only this partition's nodes:*/ 45 if(( model->my_grids[i]==1)){45 if((iomodel->my_grids[i]==1)){ 46 46 #endif 47 47 -
issm/trunk/src/c/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp
r1676 r1834 12 12 #include "../../shared/shared.h" 13 13 #include "../../MeshPartitionx/MeshPartitionx.h" 14 #include "../ Model.h"14 #include "../IoModel.h" 15 15 16 16 #undef __FUNCT__ 17 17 #define __FUNCT__ "CreateElementsNodesAndMaterialsThermal" 18 void CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, Model* model,ConstDataHandlemodel_handle){18 void CreateElementsNodesAndMaterialsThermal(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){ 19 19 20 20 … … 124 124 125 125 /*Width of elements: */ 126 if(strcmp( model->meshtype,"2d")==0){126 if(strcmp(iomodel->meshtype,"2d")==0){ 127 127 throw ErrorException(__FUNCT__," 2d temperature computation not supported yet!"); 128 128 } … … 132 132 #ifdef _PARALLEL_ 133 133 /*Determine parallel partitioning of elements: we use Metis for now. First load the data, then partition*/ 134 ModelFetchData((void**)&model->elements2d,NULL,NULL,model_handle,"elements2d","Matrix","Mat");135 136 MeshPartitionx(&epart, &npart, model->numberofelements,model->numberofnodes,model->elements, model->numberofelements2d,model->numberofnodes2d,model->elements2d,model->numlayers,elements_width,model->meshtype,num_procs);134 IoModelFetchData((void**)&iomodel->elements2d,NULL,NULL,iomodel_handle,"elements2d","Matrix","Mat"); 135 136 MeshPartitionx(&epart, &npart,iomodel->numberofelements,iomodel->numberofnodes,iomodel->elements, iomodel->numberofelements2d,iomodel->numberofnodes2d,iomodel->elements2d,iomodel->numlayers,elements_width, iomodel->meshtype,num_procs); 137 137 138 138 /*Free elements and elements2d: */ 139 xfree((void**)& model->elements2d);139 xfree((void**)&iomodel->elements2d); 140 140 141 141 /*Used later on: */ 142 my_grids=(int*)xcalloc( model->numberofnodes,sizeof(int));142 my_grids=(int*)xcalloc(iomodel->numberofnodes,sizeof(int)); 143 143 #endif 144 144 … … 147 147 148 148 /*Fetch data needed: */ 149 ModelFetchData((void**)&model->elements,NULL,NULL,model_handle,"elements","Matrix","Mat");150 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");151 ModelFetchData((void**)&model->surface,NULL,NULL,model_handle,"surface","Matrix","Mat");152 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");153 ModelFetchData((void**)&model->drag,NULL,NULL,model_handle,"drag","Matrix","Mat");154 ModelFetchData((void**)&model->p,NULL,NULL,model_handle,"p","Matrix","Mat");155 ModelFetchData((void**)&model->q,NULL,NULL,model_handle,"q","Matrix","Mat");156 ModelFetchData((void**)&model->elementoniceshelf,NULL,NULL,model_handle,"elementoniceshelf","Matrix","Mat");157 ModelFetchData((void**)&model->elementonbed,NULL,NULL,model_handle,"elementonbed","Matrix","Mat");158 ModelFetchData((void**)&model->elementonsurface,NULL,NULL,model_handle,"elementonsurface","Matrix","Mat");159 ModelFetchData((void**)&model->elements_type,NULL,NULL,model_handle,"elements_type","Matrix","Mat");160 ModelFetchData((void**)&model->geothermalflux,NULL,NULL,model_handle,"geothermalflux","Matrix","Mat");161 ModelFetchData((void**)&model->B,NULL,NULL,model_handle,"B","Matrix","Mat");162 ModelFetchData((void**)&model->n,NULL,NULL,model_handle,"n","Matrix","Mat");163 ModelFetchData((void**)&model->elementonwater,NULL,NULL,model_handle,"elementonwater","Matrix","Mat");164 165 for (i=0;i< model->numberofelements;i++){149 IoModelFetchData((void**)&iomodel->elements,NULL,NULL,iomodel_handle,"elements","Matrix","Mat"); 150 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 151 IoModelFetchData((void**)&iomodel->surface,NULL,NULL,iomodel_handle,"surface","Matrix","Mat"); 152 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 153 IoModelFetchData((void**)&iomodel->drag,NULL,NULL,iomodel_handle,"drag","Matrix","Mat"); 154 IoModelFetchData((void**)&iomodel->p,NULL,NULL,iomodel_handle,"p","Matrix","Mat"); 155 IoModelFetchData((void**)&iomodel->q,NULL,NULL,iomodel_handle,"q","Matrix","Mat"); 156 IoModelFetchData((void**)&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf","Matrix","Mat"); 157 IoModelFetchData((void**)&iomodel->elementonbed,NULL,NULL,iomodel_handle,"elementonbed","Matrix","Mat"); 158 IoModelFetchData((void**)&iomodel->elementonsurface,NULL,NULL,iomodel_handle,"elementonsurface","Matrix","Mat"); 159 IoModelFetchData((void**)&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type","Matrix","Mat"); 160 IoModelFetchData((void**)&iomodel->geothermalflux,NULL,NULL,iomodel_handle,"geothermalflux","Matrix","Mat"); 161 IoModelFetchData((void**)&iomodel->B,NULL,NULL,iomodel_handle,"B","Matrix","Mat"); 162 IoModelFetchData((void**)&iomodel->n,NULL,NULL,iomodel_handle,"n","Matrix","Mat"); 163 IoModelFetchData((void**)&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater","Matrix","Mat"); 164 165 for (i=0;i<iomodel->numberofelements;i++){ 166 166 #ifdef _PARALLEL_ 167 167 /*We are using our element partition to decide which elements will be created on this node: */ … … 173 173 penta_id=i+1; //matlab indexing. 174 174 penta_mid=i+1; //refers to the corresponding material property card 175 penta_mparid= model->numberofelements+1;//refers to the corresponding parmat property card175 penta_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card 176 176 177 177 /*vertices,thickness,surface,bed and drag: */ 178 178 for(j=0;j<6;j++){ 179 penta_g[j]=(int)*( model->elements+elements_width*i+j);180 penta_h[j]=*( model->thickness+ ((int)*(model->elements+elements_width*i+j)-1));181 penta_s[j]=*( model->surface+ ((int)*(model->elements+elements_width*i+j)-1));182 penta_b[j]=*( model->bed+ ((int)*(model->elements+elements_width*i+j)-1));183 penta_k[j]=*( model->drag+ ((int)*(model->elements+elements_width*i+j)-1));184 penta_geothermalflux[j]=*( model->geothermalflux+ ((int)*(model->elements+elements_width*i+j)-1));179 penta_g[j]=(int)*(iomodel->elements+elements_width*i+j); 180 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 181 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 182 penta_b[j]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 183 penta_k[j]=*(iomodel->drag+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 184 penta_geothermalflux[j]=*(iomodel->geothermalflux+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 185 185 } 186 186 187 187 /*basal drag:*/ 188 penta_friction_type=(int) model->drag_type;189 190 penta_p= model->p[i];191 penta_q= model->q[i];188 penta_friction_type=(int)iomodel->drag_type; 189 190 penta_p=iomodel->p[i]; 191 penta_q=iomodel->q[i]; 192 192 193 193 /*diverse: */ 194 penta_shelf=(int)*( model->elementoniceshelf+i);195 penta_onbed=(int)*( model->elementonbed+i);196 penta_onsurface=(int)*( model->elementonsurface+i);197 penta_meanvel= model->meanvel;198 penta_epsvel= model->epsvel;199 penta_onwater=(bool)*( model->elementonwater+i);200 penta_artdiff= model->artificial_diffusivity;194 penta_shelf=(int)*(iomodel->elementoniceshelf+i); 195 penta_onbed=(int)*(iomodel->elementonbed+i); 196 penta_onsurface=(int)*(iomodel->elementonsurface+i); 197 penta_meanvel=iomodel->meanvel; 198 penta_epsvel=iomodel->epsvel; 199 penta_onwater=(bool)*(iomodel->elementonwater+i); 200 penta_artdiff=iomodel->artificial_diffusivity; 201 201 202 202 /*We need the field collapse for transient, so that we can use compute B with the average temperature*/ 203 if (*( model->elements_type+2*i+0)==MacAyealFormulationEnum()){ //elements of type 3 are MacAyeal type Penta. We collapse the formulation on their base.203 if (*(iomodel->elements_type+2*i+0)==MacAyealFormulationEnum()){ //elements of type 3 are MacAyeal type Penta. We collapse the formulation on their base. 204 204 penta_collapse=1; 205 205 } … … 224 224 B_avg=0; 225 225 for(j=0;j<6;j++){ 226 B_avg+=*( model->B+((int)*(model->elements+elements_width*i+j)-1));226 B_avg+=*(iomodel->B+((int)*(iomodel->elements+elements_width*i+j)-1)); 227 227 } 228 228 B_avg=B_avg/6; 229 229 matice_B= B_avg; 230 matice_n=(double)*( model->n+i);230 matice_n=(double)*(iomodel->n+i); 231 231 232 232 /*Create matice using its constructor:*/ … … 241 241 into the grid coordinates. If we start plugging 1 into my_grids for each index[n][i] (i=0:2), then my_grids 242 242 will hold which grids belong to this partition*/ 243 my_grids[(int)*( model->elements+elements_width*i+0)-1]=1;244 my_grids[(int)*( model->elements+elements_width*i+1)-1]=1;245 my_grids[(int)*( model->elements+elements_width*i+2)-1]=1;246 my_grids[(int)*( model->elements+elements_width*i+3)-1]=1;247 my_grids[(int)*( model->elements+elements_width*i+4)-1]=1;248 my_grids[(int)*( model->elements+elements_width*i+5)-1]=1;243 my_grids[(int)*(iomodel->elements+elements_width*i+0)-1]=1; 244 my_grids[(int)*(iomodel->elements+elements_width*i+1)-1]=1; 245 my_grids[(int)*(iomodel->elements+elements_width*i+2)-1]=1; 246 my_grids[(int)*(iomodel->elements+elements_width*i+3)-1]=1; 247 my_grids[(int)*(iomodel->elements+elements_width*i+4)-1]=1; 248 my_grids[(int)*(iomodel->elements+elements_width*i+5)-1]=1; 249 249 #endif 250 250 … … 256 256 257 257 /*Free data: */ 258 xfree((void**)& model->elements);259 xfree((void**)& model->thickness);260 xfree((void**)& model->surface);261 xfree((void**)& model->bed);262 xfree((void**)& model->drag);263 xfree((void**)& model->p);264 xfree((void**)& model->q);265 xfree((void**)& model->elementoniceshelf);266 xfree((void**)& model->elementonbed);267 xfree((void**)& model->elementonsurface);268 xfree((void**)& model->elements_type);269 xfree((void**)& model->geothermalflux);270 xfree((void**)& model->n);271 xfree((void**)& model->B);272 xfree((void**)& model->elementonwater);258 xfree((void**)&iomodel->elements); 259 xfree((void**)&iomodel->thickness); 260 xfree((void**)&iomodel->surface); 261 xfree((void**)&iomodel->bed); 262 xfree((void**)&iomodel->drag); 263 xfree((void**)&iomodel->p); 264 xfree((void**)&iomodel->q); 265 xfree((void**)&iomodel->elementoniceshelf); 266 xfree((void**)&iomodel->elementonbed); 267 xfree((void**)&iomodel->elementonsurface); 268 xfree((void**)&iomodel->elements_type); 269 xfree((void**)&iomodel->geothermalflux); 270 xfree((void**)&iomodel->n); 271 xfree((void**)&iomodel->B); 272 xfree((void**)&iomodel->elementonwater); 273 273 274 274 /*Add one constant material property to materials: */ 275 matpar_mid= model->numberofelements+1; //put it at the end of the materials276 matpar_g= model->g;277 matpar_rho_ice= model->rho_ice;278 matpar_rho_water= model->rho_water;279 matpar_thermalconductivity= model->thermalconductivity;280 matpar_heatcapacity= model->heatcapacity;281 matpar_latentheat= model->latentheat;282 matpar_beta= model->beta;283 matpar_meltingpoint= model->meltingpoint;284 matpar_mixed_layer_capacity= model->mixed_layer_capacity;285 matpar_thermal_exchange_velocity= model->thermal_exchange_velocity;275 matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials 276 matpar_g=iomodel->g; 277 matpar_rho_ice=iomodel->rho_ice; 278 matpar_rho_water=iomodel->rho_water; 279 matpar_thermalconductivity=iomodel->thermalconductivity; 280 matpar_heatcapacity=iomodel->heatcapacity; 281 matpar_latentheat=iomodel->latentheat; 282 matpar_beta=iomodel->beta; 283 matpar_meltingpoint=iomodel->meltingpoint; 284 matpar_mixed_layer_capacity=iomodel->mixed_layer_capacity; 285 matpar_thermal_exchange_velocity=iomodel->thermal_exchange_velocity; 286 286 287 287 /*Create matpar object using its constructor: */ … … 296 296 /*From the element partitioning, we can determine which grids are on the inside of this cpu's 297 297 *element partition, and which are on its border with other nodes:*/ 298 gridborder=NewVec( model->numberofnodes);299 300 for (i=0;i< model->numberofnodes;i++){298 gridborder=NewVec(iomodel->numberofnodes); 299 300 for (i=0;i<iomodel->numberofnodes;i++){ 301 301 if(my_grids[i])VecSetValue(gridborder,i,1,ADD_VALUES); 302 302 } … … 312 312 #ifdef _DEBUG_ 313 313 if(my_rank==0){ 314 for (i=0;i< model->numberofnodes;i++){314 for (i=0;i<iomodel->numberofnodes;i++){ 315 315 printf("Grid id %i Border grid %lf\n",i+1,my_bordergrids[i]); 316 316 } … … 320 320 321 321 /*Partition penalties in 3d: */ 322 if(strcmp( model->meshtype,"3d")==0){322 if(strcmp(iomodel->meshtype,"3d")==0){ 323 323 324 324 /*Get penalties: */ 325 ModelFetchData((void**)&model->penalties,&model->numpenalties,NULL,model_handle,"penalties","Matrix","Mat");326 327 if( model->numpenalties){328 329 model->penaltypartitioning=(int*)xmalloc(model->numpenalties*sizeof(int));325 IoModelFetchData((void**)&iomodel->penalties,&iomodel->numpenalties,NULL,iomodel_handle,"penalties","Matrix","Mat"); 326 327 if(iomodel->numpenalties){ 328 329 iomodel->penaltypartitioning=(int*)xmalloc(iomodel->numpenalties*sizeof(int)); 330 330 #ifdef _SERIAL_ 331 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=1;331 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=1; 332 332 #else 333 for(i=0;i< model->numpenalties;i++)model->penaltypartitioning[i]=-1;334 335 for(i=0;i< model->numpenalties;i++){336 first_grid_index=(int)(*( model->penalties+i*model->numlayers+0)-1);333 for(i=0;i<iomodel->numpenalties;i++)iomodel->penaltypartitioning[i]=-1; 334 335 for(i=0;i<iomodel->numpenalties;i++){ 336 first_grid_index=(int)(*(iomodel->penalties+i*iomodel->numlayers+0)-1); 337 337 if((my_grids[first_grid_index]==1) && (my_bordergrids[first_grid_index]<=1.0) ) { //this grid belongs to this node's internal partition grids 338 338 /*All grids that are being penalised belong to this node's internal grid partition.:*/ 339 model->penaltypartitioning[i]=1;339 iomodel->penaltypartitioning[i]=1; 340 340 } 341 341 if(my_bordergrids[first_grid_index]>1.0) { //this grid belongs to a partition border 342 model->penaltypartitioning[i]=0;342 iomodel->penaltypartitioning[i]=0; 343 343 } 344 344 } … … 347 347 348 348 /*Free penalties: */ 349 xfree((void**)& model->penalties);349 xfree((void**)&iomodel->penalties); 350 350 } 351 351 … … 358 358 359 359 /*First fetch data: */ 360 if (strcmp( model->meshtype,"3d")==0){361 ModelFetchData((void**)&model->deadgrids,NULL,NULL,model_handle,"deadgrids","Matrix","Mat");362 ModelFetchData((void**)&model->uppernodes,NULL,NULL,model_handle,"uppergrids","Matrix","Mat");360 if (strcmp(iomodel->meshtype,"3d")==0){ 361 IoModelFetchData((void**)&iomodel->deadgrids,NULL,NULL,iomodel_handle,"deadgrids","Matrix","Mat"); 362 IoModelFetchData((void**)&iomodel->uppernodes,NULL,NULL,iomodel_handle,"uppergrids","Matrix","Mat"); 363 363 } 364 ModelFetchData((void**)&model->x,NULL,NULL,model_handle,"x","Matrix","Mat");365 ModelFetchData((void**)&model->y,NULL,NULL,model_handle,"y","Matrix","Mat");366 ModelFetchData((void**)&model->z,NULL,NULL,model_handle,"z","Matrix","Mat");367 ModelFetchData((void**)&model->thickness,NULL,NULL,model_handle,"thickness","Matrix","Mat");368 ModelFetchData((void**)&model->bed,NULL,NULL,model_handle,"bed","Matrix","Mat");369 ModelFetchData((void**)&model->gridonbed,NULL,NULL,model_handle,"gridonbed","Matrix","Mat");370 ModelFetchData((void**)&model->gridonsurface,NULL,NULL,model_handle,"gridonsurface","Matrix","Mat");371 ModelFetchData((void**)&model->gridonicesheet,NULL,NULL,model_handle,"gridonicesheet","Matrix","Mat");372 ModelFetchData((void**)&model->gridoniceshelf,NULL,NULL,model_handle,"gridoniceshelf","Matrix","Mat");364 IoModelFetchData((void**)&iomodel->x,NULL,NULL,iomodel_handle,"x","Matrix","Mat"); 365 IoModelFetchData((void**)&iomodel->y,NULL,NULL,iomodel_handle,"y","Matrix","Mat"); 366 IoModelFetchData((void**)&iomodel->z,NULL,NULL,iomodel_handle,"z","Matrix","Mat"); 367 IoModelFetchData((void**)&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness","Matrix","Mat"); 368 IoModelFetchData((void**)&iomodel->bed,NULL,NULL,iomodel_handle,"bed","Matrix","Mat"); 369 IoModelFetchData((void**)&iomodel->gridonbed,NULL,NULL,iomodel_handle,"gridonbed","Matrix","Mat"); 370 IoModelFetchData((void**)&iomodel->gridonsurface,NULL,NULL,iomodel_handle,"gridonsurface","Matrix","Mat"); 371 IoModelFetchData((void**)&iomodel->gridonicesheet,NULL,NULL,iomodel_handle,"gridonicesheet","Matrix","Mat"); 372 IoModelFetchData((void**)&iomodel->gridoniceshelf,NULL,NULL,iomodel_handle,"gridoniceshelf","Matrix","Mat"); 373 373 374 374 /*Get number of dofs per node: */ 375 DistributeNumDofs(&node_numdofs, model->analysis_type,model->sub_analysis_type);376 377 for (i=0;i< model->numberofnodes;i++){375 DistributeNumDofs(&node_numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); 376 377 for (i=0;i<iomodel->numberofnodes;i++){ 378 378 #ifdef _PARALLEL_ 379 379 /*keep only this partition's nodes:*/ … … 394 394 #endif 395 395 396 node_x[0]= model->x[i];397 node_x[1]= model->y[i];398 node_x[2]= model->z[i];399 node_sigma=( model->z[i]-model->bed[i])/(model->thickness[i]);400 401 node_onbed=(int) model->gridonbed[i];402 node_onsurface=(int) model->gridonsurface[i];403 node_onshelf=(int) model->gridoniceshelf[i];404 node_onsheet=(int) model->gridonicesheet[i];405 406 if (strcmp( model->meshtype,"3d")==0){407 if (isnan( model->uppernodes[i])){396 node_x[0]=iomodel->x[i]; 397 node_x[1]=iomodel->y[i]; 398 node_x[2]=iomodel->z[i]; 399 node_sigma=(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]); 400 401 node_onbed=(int)iomodel->gridonbed[i]; 402 node_onsurface=(int)iomodel->gridonsurface[i]; 403 node_onshelf=(int)iomodel->gridoniceshelf[i]; 404 node_onsheet=(int)iomodel->gridonicesheet[i]; 405 406 if (strcmp(iomodel->meshtype,"3d")==0){ 407 if (isnan(iomodel->uppernodes[i])){ 408 408 node_upper_node_id=node_id; //nodes on surface do not have upper nodes, only themselves. 409 409 } 410 410 else{ 411 node_upper_node_id=(int) model->uppernodes[i];411 node_upper_node_id=(int)iomodel->uppernodes[i]; 412 412 } 413 413 } … … 435 435 436 436 /*Clean fetched data: */ 437 xfree((void**)& model->deadgrids);438 xfree((void**)& model->x);439 xfree((void**)& model->y);440 xfree((void**)& model->z);441 xfree((void**)& model->thickness);442 xfree((void**)& model->bed);443 xfree((void**)& model->gridonbed);444 xfree((void**)& model->gridonsurface);445 xfree((void**)& model->uppernodes);446 xfree((void**)& model->gridonicesheet);447 xfree((void**)& model->gridoniceshelf);437 xfree((void**)&iomodel->deadgrids); 438 xfree((void**)&iomodel->x); 439 xfree((void**)&iomodel->y); 440 xfree((void**)&iomodel->z); 441 xfree((void**)&iomodel->thickness); 442 xfree((void**)&iomodel->bed); 443 xfree((void**)&iomodel->gridonbed); 444 xfree((void**)&iomodel->gridonsurface); 445 xfree((void**)&iomodel->uppernodes); 446 xfree((void**)&iomodel->gridonicesheet); 447 xfree((void**)&iomodel->gridoniceshelf); 448 448 449 449 cleanup_and_return: … … 454 454 *pmaterials=materials; 455 455 456 /*Keep partitioning information into model*/457 model->epart=epart;458 model->my_grids=my_grids;459 model->my_bordergrids=my_bordergrids;456 /*Keep partitioning information into iomodel*/ 457 iomodel->epart=epart; 458 iomodel->my_grids=my_grids; 459 iomodel->my_bordergrids=my_bordergrids; 460 460 461 461 /*Free ressources:*/ -
issm/trunk/src/c/ModelProcessorx/Thermal/CreateLoadsThermal.cpp
r1765 r1834 11 11 #include "../../shared/shared.h" 12 12 #include "../../include/macros.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 15 16 void CreateLoadsThermal(DataSet** ploads, Model* model,ConstDataHandlemodel_handle){16 void CreateLoadsThermal(DataSet** ploads, IoModel* iomodel,ConstDataHandle iomodel_handle){ 17 17 18 18 int i,j,counter; … … 47 47 48 48 //create penalties for grids: no grid can have a temperature over the melting point 49 ModelFetchData((void**)&model->spctemperature,NULL,NULL,model_handle,"spctemperature","Matrix","Mat");49 IoModelFetchData((void**)&iomodel->spctemperature,NULL,NULL,iomodel_handle,"spctemperature","Matrix","Mat"); 50 50 51 for (i=0;i< model->numberofnodes;i++){51 for (i=0;i<iomodel->numberofnodes;i++){ 52 52 #ifdef _PARALLEL_ 53 53 /*keep only this partition's nodes:*/ 54 if(( model->my_grids[i]==1)){54 if((iomodel->my_grids[i]==1)){ 55 55 #endif 56 56 57 if (! model->spctemperature[2*i]){ //No penalty applied on spc grids!57 if (!iomodel->spctemperature[2*i]){ //No penalty applied on spc grids! 58 58 59 59 pengrid_id=count+1; //matlab indexing 60 60 pengrid_node_id=i+1; 61 pengrid_mparid= model->numberofelements+1;//refers to the corresponding parmat property card61 pengrid_mparid=iomodel->numberofelements+1;//refers to the corresponding parmat property card 62 62 pengrid_dof=1; 63 pengrid_penalty_offset= model->penalty_offset;63 pengrid_penalty_offset=iomodel->penalty_offset; 64 64 pengrid_active=0; 65 65 … … 70 70 } 71 71 #ifdef _PARALLEL_ 72 } //if(( model->my_grids[i]==1))72 } //if((iomodel->my_grids[i]==1)) 73 73 #endif 74 74 } 75 xfree((void**)& model->spctemperature);75 xfree((void**)&iomodel->spctemperature); 76 76 77 77 /*All our datasets are already order by ids. Set presort flag so that later on, when sorting is requested on these -
issm/trunk/src/c/ModelProcessorx/Thermal/CreateParametersThermal.cpp
r1648 r1834 11 11 #include "../../objects/objects.h" 12 12 #include "../../shared/shared.h" 13 #include "../ Model.h"13 #include "../IoModel.h" 14 14 15 void CreateParametersThermal(DataSet** pparameters, Model* model,ConstDataHandlemodel_handle){15 void CreateParametersThermal(DataSet** pparameters,IoModel* iomodel,ConstDataHandle iomodel_handle){ 16 16 17 17 Param* param = NULL; … … 33 33 34 34 /*Get vx vy and vz: */ 35 ModelFetchData((void**)&vx,NULL,NULL,model_handle,"vx","Matrix","Mat");36 ModelFetchData((void**)&vy,NULL,NULL,model_handle,"vy","Matrix","Mat");37 ModelFetchData((void**)&vz,NULL,NULL,model_handle,"vz","Matrix","Mat");35 IoModelFetchData((void**)&vx,NULL,NULL,iomodel_handle,"vx","Matrix","Mat"); 36 IoModelFetchData((void**)&vy,NULL,NULL,iomodel_handle,"vy","Matrix","Mat"); 37 IoModelFetchData((void**)&vz,NULL,NULL,iomodel_handle,"vz","Matrix","Mat"); 38 38 39 u_g=(double*)xcalloc( model->numberofnodes*3,sizeof(double));39 u_g=(double*)xcalloc(iomodel->numberofnodes*3,sizeof(double)); 40 40 41 if(vx) for(i=0;i< model->numberofnodes;i++)u_g[3*i+0]=vx[i]/model->yts;42 if(vy) for(i=0;i< model->numberofnodes;i++)u_g[3*i+1]=vy[i]/model->yts;43 if(vz) for(i=0;i< model->numberofnodes;i++)u_g[3*i+2]=vz[i]/model->yts;41 if(vx) for(i=0;i<iomodel->numberofnodes;i++)u_g[3*i+0]=vx[i]/iomodel->yts; 42 if(vy) for(i=0;i<iomodel->numberofnodes;i++)u_g[3*i+1]=vy[i]/iomodel->yts; 43 if(vz) for(i=0;i<iomodel->numberofnodes;i++)u_g[3*i+2]=vz[i]/iomodel->yts; 44 44 45 45 count++; 46 46 param= new Param(count,"u_g",DOUBLEVEC); 47 param->SetDoubleVec(u_g,3* model->numberofnodes,3);47 param->SetDoubleVec(u_g,3*iomodel->numberofnodes,3); 48 48 parameters->AddObject(param); 49 49 … … 54 54 55 55 /*Get pressure: */ 56 ModelFetchData((void**)&pressure,NULL,NULL,model_handle,"pressure","Matrix","Mat");56 IoModelFetchData((void**)&pressure,NULL,NULL,iomodel_handle,"pressure","Matrix","Mat"); 57 57 58 58 count++; 59 59 param= new Param(count,"p_g",DOUBLEVEC); 60 if(pressure) param->SetDoubleVec(pressure, model->numberofnodes,1);60 if(pressure) param->SetDoubleVec(pressure,iomodel->numberofnodes,1); 61 61 else param->SetDoubleVec(pressure,0,0); 62 62 parameters->AddObject(param); … … 66 66 67 67 /* get initial temperature and melting if transient*/ 68 if( model->sub_analysis_type==TransientAnalysisEnum()){68 if(iomodel->sub_analysis_type==TransientAnalysisEnum()){ 69 69 70 70 /*Get melting and temperature: */ 71 ModelFetchData((void**)&temperature,NULL,NULL,model_handle,"temperature","Matrix","Mat");71 IoModelFetchData((void**)&temperature,NULL,NULL,iomodel_handle,"temperature","Matrix","Mat"); 72 72 73 73 count++; 74 74 param= new Param(count,"t_g",DOUBLEVEC); 75 if(temperature) param->SetDoubleVec(temperature, model->numberofnodes,1);75 if(temperature) param->SetDoubleVec(temperature,iomodel->numberofnodes,1); 76 76 else throw ErrorException(__FUNCT__,exprintf("Missing initial temperature")); 77 77 parameters->AddObject(param);
Note:
See TracChangeset
for help on using the changeset viewer.