Changeset 5096
- Timestamp:
- 08/09/10 14:48:52 (15 years ago)
- Location:
- issm/trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp
r4919 r5096 126 126 *pmy_vertices=my_vertices; 127 127 } 128 129 -
issm/trunk/src/c/objects/DofIndexing.cpp
r5057 r5096 24 24 this->numberofdofs=UNDEF; 25 25 this->clone=0; 26 27 for (i=0;i<MAXDOFSPERNODE;i++){ 28 /*assume dof is free, no constraints, no rigid body constraint: */ 29 this->f_set[i]=1; 30 this->s_set[i]=0; 31 this->doflist[i]=UNDEF; 32 } 26 this->f_set=NULL; 27 this->s_set=NULL; 28 this->doflist=NULL; 33 29 } 34 30 /*}}}*/ … … 45 41 this->clone=in->clone; 46 42 47 for(i=0;i<MAXDOFSPERNODE;i++){ 43 this->f_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 44 this->s_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 45 this->doflist=(int*)xmalloc(this->numberofdofs*sizeof(int)); 46 47 for(i=0;i<this->numberofdofs;i++){ 48 48 this->f_set[i]=in->f_set[i]; 49 49 this->s_set[i]=in->s_set[i]; … … 63 63 this->clone=0; 64 64 65 for (i=0;i<MAXDOFSPERNODE;i++){ 65 /*allocate: */ 66 this->f_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 67 this->s_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 68 this->doflist=(int*)xmalloc(this->numberofdofs*sizeof(int)); 69 70 71 for (i=0;i<this->numberofdofs;i++){ 66 72 /*assume dof is free, no constraints, no rigid body constraint: */ 67 73 this->f_set[i]=1; … … 94 100 printf(" set membership: f,s sets \n"); 95 101 for(i=0;i<numberofdofs;i++){ 96 if(i>MAXDOFSPERNODE)break;97 102 printf(" dof %i: %i %i\n",i,f_set[i],s_set[i]); 98 103 } … … 101 106 printf(" doflist: |"); 102 107 for(i=0;i<numberofdofs;i++){ 103 if(i>MAXDOFSPERNODE)break;104 108 printf(" %i |",doflist[i]); 105 109 } … … 122 126 memcpy(&numberofdofs,marshalled_dataset,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs); 123 127 memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone); 124 memcpy(&f_set,marshalled_dataset,sizeof(f_set));marshalled_dataset+=sizeof(f_set); 125 memcpy(&s_set,marshalled_dataset,sizeof(s_set));marshalled_dataset+=sizeof(s_set); 126 memcpy(&doflist,marshalled_dataset,sizeof(doflist));marshalled_dataset+=sizeof(doflist); 128 129 /*Allocate: */ 130 this->f_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 131 this->s_set=(int*)xmalloc(this->numberofdofs*sizeof(int)); 132 this->doflist=(int*)xmalloc(this->numberofdofs*sizeof(int)); 133 134 memcpy(f_set,marshalled_dataset,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 135 memcpy(s_set,marshalled_dataset,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 136 memcpy(doflist,marshalled_dataset,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 127 137 128 138 /*return: */ … … 149 159 memcpy(marshalled_dataset,&numberofdofs,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs); 150 160 memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone); 151 memcpy(marshalled_dataset, &f_set,sizeof(f_set));marshalled_dataset+=sizeof(f_set);152 memcpy(marshalled_dataset, &s_set,sizeof(s_set));marshalled_dataset+=sizeof(s_set);153 memcpy(marshalled_dataset, &doflist,sizeof(doflist));marshalled_dataset+=sizeof(doflist);161 memcpy(marshalled_dataset,f_set,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 162 memcpy(marshalled_dataset,s_set,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 163 memcpy(marshalled_dataset,doflist,numberofdofs*sizeof(int));marshalled_dataset+=numberofdofs*sizeof(int); 154 164 155 165 *pmarshalled_dataset=marshalled_dataset; … … 162 172 return sizeof(numberofdofs)+ 163 173 sizeof(clone)+ 164 sizeof(f_set)+165 sizeof(s_set)+166 sizeof(doflist)+174 numberofdofs*sizeof(int)+ 175 numberofdofs*sizeof(int)+ 176 numberofdofs*sizeof(int)+ 167 177 sizeof(int); //sizeof(int) for enum type 168 178 } -
issm/trunk/src/c/objects/DofIndexing.h
r5057 r5096 6 6 #define _DOFINDEXING_H_ 7 7 8 #define MAXDOFSPERNODE 49 10 8 class DofIndexing{ 11 9 12 10 public: 13 11 14 int numberofdofs; //number of dofs for a node .12 int numberofdofs; //number of dofs for a node, variable 15 13 16 14 /*partitioning: */ … … 18 16 19 17 /*boundary conditions sets: */ 20 int f_set[MAXDOFSPERNODE];21 int s_set[MAXDOFSPERNODE];18 int* f_set; //set on which we solve 19 int* s_set; //set on which boundary conditions (dirichlet) are applied 22 20 23 21 /*list of degrees of freedom: */ 24 int doflist[MAXDOFSPERNODE]; //dof list on which we solve22 int* doflist; //dof list on which we solve 25 23 26 24 /*DofIndexing constructors, destructors {{{1*/ -
issm/trunk/src/c/objects/Elements/Penta.cpp
r5075 r5096 2048 2048 const int numdof=2*numgrids; 2049 2049 double xyz_list[numgrids][3]; 2050 int doflist[numdof]; 2051 int numberofdofspernode; 2050 int* doflist=NULL; 2052 2051 2053 2052 /* 3d gaussian points: */ … … 2172 2171 /* Get node coordinates and dof list: */ 2173 2172 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2174 GetDofList(&doflist [0],&numberofdofspernode);2173 GetDofList(&doflist); 2175 2174 2176 2175 /*Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore … … 2274 2273 xfree((void**)&third_gauss_area_coord2d); 2275 2274 xfree((void**)&gauss_weights2d); 2276 2275 xfree((void**)&doflist); 2277 2276 } 2278 2277 /*}}}*/ … … 2285 2284 const int NDOF2=2; 2286 2285 const int numdofs=NDOF2*numgrids; 2287 int doflist[numdofs];2286 int* doflist=NULL; 2288 2287 double Ke_gg[numdofs][numdofs]={0.0}; 2289 int numberofdofspernode;2290 2288 bool onbed; 2291 2289 bool onsurface; … … 2306 2304 inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum); 2307 2305 2308 GetDofList(&doflist [0],&numberofdofspernode);2306 GetDofList(&doflist); 2309 2307 2310 2308 /*Spawn 3 beam elements: */ … … 2357 2355 MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES); 2358 2356 2357 /*Free ressources:*/ 2358 xfree((void**)&doflist); 2359 2359 2360 } 2360 2361 /*}}}*/ … … 2367 2368 const int DOFPERGRID=4; 2368 2369 const int numdof=numgrids*DOFPERGRID; 2369 int doflist[numdof]; 2370 int numberofdofspernode; 2370 int* doflist=NULL; 2371 2371 2372 2372 const int numgrids2d=3; … … 2469 2469 /* Get node coordinates and dof list: */ 2470 2470 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2471 GetDofList(&doflist [0],&numberofdofspernode);2471 GetDofList(&doflist); 2472 2472 2473 2473 /* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore … … 2636 2636 xfree((void**)&vert_gauss_coord); 2637 2637 xfree((void**)&vert_gauss_weights); 2638 xfree((void**)&doflist); 2638 2639 2639 2640 return; … … 2651 2652 const int numdof=NDOF1*numgrids; 2652 2653 double xyz_list[numgrids][3]; 2653 int doflist[numdof]; 2654 int numberofdofspernode; 2654 int* doflist=NULL; 2655 2655 2656 2656 /* 3d gaussian points: */ … … 2704 2704 /* Get node coordinates and dof list: */ 2705 2705 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2706 GetDofList(&doflist [0],&numberofdofspernode);2706 GetDofList(&doflist); 2707 2707 2708 2708 /*Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore … … 2763 2763 xfree((void**)&area_gauss_weights); 2764 2764 xfree((void**)&vert_gauss_weights); 2765 xfree((void**)&doflist); 2765 2766 } 2766 2767 /*}}}*/ … … 2870 2871 const int NDOF1=1; 2871 2872 const int numdof=NDOF1*numgrids; 2872 double xyz_list[numgrids][3]; 2873 int doflist[numdof]; 2874 int numberofdofspernode; 2873 double xyz_list[numgrids][3]; 2874 int* doflist=NULL; 2875 2875 2876 2876 /* gaussian points: */ … … 2947 2947 /* Get node coordinates and dof list: */ 2948 2948 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2949 GetDofList(&doflist [0],&numberofdofspernode);2949 GetDofList(&doflist); 2950 2950 2951 2951 // /*recovre material parameters: */ … … 3088 3088 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)K_terms,ADD_VALUES); 3089 3089 3090 //Ice/ocean heat exchange flux on ice shelf base 3091 if(onbed && shelf){ 3092 3093 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. 3094 tria->CreateKMatrixThermal(Kgg); 3095 delete tria->matice; delete tria; 3096 } 3097 3098 /*Free ressources:*/ 3090 3099 xfree((void**)&first_gauss_area_coord); 3091 3100 xfree((void**)&second_gauss_area_coord); … … 3094 3103 xfree((void**)&vert_gauss_weights); 3095 3104 xfree((void**)&vert_gauss_coord); 3096 3097 //Ice/ocean heat exchange flux on ice shelf base 3098 if(onbed && shelf){ 3099 3100 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. 3101 tria->CreateKMatrixThermal(Kgg); 3102 delete tria->matice; delete tria; 3103 } 3105 xfree((void**)&doflist); 3106 3104 3107 } 3105 3108 /*}}}*/ … … 3186 3189 const int numdof=NDOF2*numgrids; 3187 3190 double xyz_list[numgrids][3]; 3188 int doflist[numdof]; 3189 int numberofdofspernode; 3191 int* doflist=NULL; 3190 3192 3191 3193 /* parameters: */ … … 3262 3264 /* Get node coordinates and dof list: */ 3263 3265 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3264 GetDofList(&doflist [0],&numberofdofspernode);3266 GetDofList(&doflist); 3265 3267 3266 3268 /*Get gaussian points and weights :*/ … … 3327 3329 xfree((void**)&area_gauss_weights); 3328 3330 xfree((void**)&vert_gauss_weights); 3329 3331 xfree((void**)&doflist); 3330 3332 } 3331 3333 /*}}}*/ … … 3383 3385 const int NDOF2=2; 3384 3386 const int numdofs=NDOF2*numgrids; 3385 int doflist[numdofs]; 3386 int numberofdofspernode; 3387 int* doflist=NULL; 3387 3388 double pe_g[numdofs]={0.0}; 3388 3389 double xyz_list[numgrids][3]; … … 3428 3429 3429 3430 /*recover doflist: */ 3430 GetDofList(&doflist [0],&numberofdofspernode);3431 GetDofList(&doflist); 3431 3432 3432 3433 /*recover some inputs: */ … … 3523 3524 xfree((void**)&gauss_weights); 3524 3525 xfree((void**)&segment_gauss_coord); 3526 xfree((void**)&doflist); 3525 3527 } 3526 3528 /*}}}*/ … … 3535 3537 const int numdof=numgrids*DOFPERGRID; 3536 3538 const int numgrids2d=3; 3537 int numdof2d=numgrids2d*DOFPERGRID; 3538 int doflist[numdof]; 3539 int numberofdofspernode; 3539 int numdof2d=numgrids2d*DOFPERGRID; 3540 int* doflist=NULL; 3540 3541 3541 3542 /*Material properties: */ … … 3627 3628 /* Get node coordinates and dof list: */ 3628 3629 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3629 GetDofList(&doflist [0],&numberofdofspernode);3630 GetDofList(&doflist); 3630 3631 3631 3632 /* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore … … 3777 3778 xfree((void**)&area_gauss_weights); 3778 3779 xfree((void**)&vert_gauss_coord); 3779 xfree((void**)&vert_gauss_weights); 3780 xfree((void**)&vert_gauss_weights); 3781 xfree((void**)&doflist); 3780 3782 3781 3783 } … … 3815 3817 const int numdof=NDOF1*numgrids; 3816 3818 double xyz_list[numgrids][3]; 3817 int doflist[numdof]; 3818 int numberofdofspernode; 3819 int* doflist=NULL; 3819 3820 3820 3821 /* gaussian points: */ … … 3876 3877 /* Get node coordinates and dof list: */ 3877 3878 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3878 GetDofList(&doflist [0],&numberofdofspernode);3879 GetDofList(&doflist); 3879 3880 3880 3881 /*Get gaussian points and weights :*/ … … 3935 3936 xfree((void**)&area_gauss_weights); 3936 3937 xfree((void**)&vert_gauss_weights); 3938 xfree((void**)&doflist); 3937 3939 } 3938 3940 /*}}}*/ … … 4015 4017 const int NDOF1=1; 4016 4018 const int numdof=numgrids*NDOF1; 4017 int doflist[numdof]; 4018 int numberofdofspernode; 4019 int* doflist=NULL; 4019 4020 4020 4021 /*Grid data: */ … … 4096 4097 /* Get node coordinates and dof list: */ 4097 4098 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 4098 GetDofList(&doflist [0],&numberofdofspernode);4099 GetDofList(&doflist); 4099 4100 4100 4101 /*recovre material parameters: */ … … 4191 4192 xfree((void**)&area_gauss_weights); 4192 4193 xfree((void**)&vert_gauss_weights); 4194 xfree((void**)&doflist); 4193 4195 4194 4196 } … … 4234 4236 /*}}}*/ 4235 4237 /*FUNCTION Penta::GetDofList {{{1*/ 4236 void Penta::GetDofList(int* doflist,int* pnumberofdofspernode){4238 void Penta::GetDofList(int** pdoflist){ 4237 4239 4238 4240 int i,j; 4239 int doflist_per_node[MAXDOFSPERNODE]; 4240 int numberofdofspernode; 4241 4241 int numberofdofs=0; 4242 int count=0; 4243 4244 /*output: */ 4245 int* doflist=NULL; 4246 4247 /*First, figure out size of doflist: */ 4242 4248 for(i=0;i<6;i++){ 4243 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 4244 for(j=0;j<numberofdofspernode;j++){ 4245 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 4246 } 4249 numberofdofs+=nodes[i]->GetNumberOfDofs(); 4250 } 4251 4252 /*Allocate: */ 4253 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 4254 4255 /*Populate: */ 4256 count=0; 4257 for(i=0;i<6;i++){ 4258 nodes[i]->GetDofList(doflist+count); 4259 count+=nodes[i]->GetNumberOfDofs(); 4247 4260 } 4248 4261 4249 4262 /*Assign output pointers:*/ 4250 *p numberofdofspernode=numberofdofspernode;4263 *pdoflist=doflist; 4251 4264 4252 4265 } … … 4440 4453 const int numdof=numdofpervertex*numvertices; 4441 4454 double gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4442 4443 int doflist[numdof]; 4455 int* doflist=NULL; 4444 4456 double values[numdof]; 4445 4457 double vx; 4446 4458 double vy; 4447 4459 4448 int dummy;4449 4450 4460 /*Get dof list: */ 4451 GetDofList(&doflist [0],&dummy);4461 GetDofList(&doflist); 4452 4462 4453 4463 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4465 4475 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 4466 4476 4477 /*Free ressources:*/ 4478 xfree((void**)&doflist); 4467 4479 } 4468 4480 /*}}}*/ … … 4476 4488 const int numdof=numdofpervertex*numvertices; 4477 4489 double gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4478 4479 int doflist[numdof]; 4490 int* doflist=NULL; 4480 4491 double values[numdof]; 4481 4492 double vx; 4482 4493 double vy; 4483 4494 4484 int dummy;4485 4486 4495 /*Get dof list: */ 4487 GetDofList(&doflist [0],&dummy);4496 GetDofList(&doflist); 4488 4497 4489 4498 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4501 4510 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 4502 4511 4512 /*Free ressources:*/ 4513 xfree((void**)&doflist); 4503 4514 } 4504 4515 /*}}}*/ … … 4512 4523 const int numdof=numdofpervertex*numvertices; 4513 4524 double gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4514 4515 int doflist[numdof]; 4525 int* doflist=NULL; 4516 4526 double values[numdof]; 4517 4527 double vz; 4518 4528 4519 int dummy;4520 4521 4529 /*Get dof list: */ 4522 GetDofList(&doflist [0],&dummy);4530 GetDofList(&doflist); 4523 4531 4524 4532 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4533 4541 /*Add value to global vector*/ 4534 4542 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 4543 4544 /*Free ressources:*/ 4545 xfree((void**)&doflist); 4535 4546 } 4536 4547 /*}}}*/ … … 4544 4555 const int numdof=numdofpervertex*numvertices; 4545 4556 double gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4546 4547 int doflist[numdof]; 4557 int* doflist=NULL; 4548 4558 double values[numdof]; 4549 4559 double vx,vy,vz,p; 4550 4551 int dummy;4552 4560 double stokesreconditioning; 4553 4561 4554 4562 /*Get dof list: */ 4555 GetDofList(&doflist [0],&dummy);4563 GetDofList(&doflist); 4556 4564 4557 4565 /*Recondition pressure: */ … … 4576 4584 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 4577 4585 4586 /*Free ressources:*/ 4587 xfree((void**)&doflist); 4578 4588 } 4579 4589 /*}}}*/ … … 4587 4597 const int numdof=numdofpervertex*numvertices; 4588 4598 double gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}}; 4589 4590 int doflist[numdof]; 4599 int* doflist=NULL; 4591 4600 double values[numdof]; 4592 4601 double vz; 4593 4602 4594 int dummy;4595 4603 4596 4604 /*Get dof list: */ 4597 GetDofList(&doflist [0],&dummy);4605 GetDofList(&doflist); 4598 4606 4599 4607 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 4608 4616 /*Add value to global vector*/ 4609 4617 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 4618 4619 /*Free ressources:*/ 4620 xfree((void**)&doflist); 4610 4621 } 4611 4622 /*}}}*/ … … 4907 4918 const int numdofpervertex=2; 4908 4919 const int numdof=numdofpervertex*numvertices; 4909 4910 int doflist[numdof]; 4920 int* doflist=NULL; 4911 4921 double values[numdof]; 4912 4922 double vx[numvertices]; … … 4928 4938 4929 4939 /*Get dof list: */ 4930 GetDofList(&doflist [0],&dummy);4940 GetDofList(&doflist); 4931 4941 4932 4942 /*Use the dof list to index into the solution vector: */ … … 4988 4998 penta=penta->GetUpperElement(); ISSMASSERT(penta->Id()!=this->id); 4989 4999 } 5000 5001 /*Free ressources:*/ 5002 xfree((void**)&doflist); 4990 5003 } 4991 5004 /*}}}*/ … … 4998 5011 const int numdofpervertex=2; 4999 5012 const int numdof=numdofpervertex*numvertices; 5000 5001 int doflist[numdof]; 5013 int* doflist=NULL; 5002 5014 double values[numdof]; 5003 5015 double vx[numvertices]; … … 5016 5028 5017 5029 /*Get dof list: */ 5018 GetDofList(&doflist [0],&dummy);5030 GetDofList(&doflist); 5019 5031 5020 5032 /*Get node data: */ … … 5068 5080 this->inputs->AddInput(new PentaVertexInput(VelEnum,vel)); 5069 5081 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 5082 5083 /*Free ressources:*/ 5084 xfree((void**)&doflist); 5070 5085 } 5071 5086 … … 5079 5094 const int numdofpervertex=2; 5080 5095 const int numdof=numdofpervertex*numvertices; 5081 5082 int doflist[numdof]; 5096 int* doflist=NULL; 5083 5097 double values[numdof]; 5084 5098 double vx[numvertices]; … … 5097 5111 5098 5112 /*Get dof list: */ 5099 GetDofList(&doflist [0],&dummy);5113 GetDofList(&doflist); 5100 5114 5101 5115 /*Get node data: */ … … 5149 5163 this->inputs->AddInput(new TriaVertexInput(VelEnum,vel)); 5150 5164 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 5165 5166 /*Free ressources:*/ 5167 xfree((void**)&doflist); 5151 5168 } 5152 5169 … … 5160 5177 const int numdofpervertex=1; 5161 5178 const int numdof=numdofpervertex*numvertices; 5162 5163 int doflist[numdof]; 5179 int* doflist=NULL; 5164 5180 double values[numdof]; 5165 5181 double vx[numvertices]; … … 5180 5196 5181 5197 /*Get dof list: */ 5182 GetDofList(&doflist [0],&dummy);5198 GetDofList(&doflist); 5183 5199 5184 5200 /*Get node data: */ … … 5233 5249 this->inputs->AddInput(new PentaVertexInput(VelEnum,vel)); 5234 5250 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 5235 } /*}}}*/ 5251 5252 /*Free ressources:*/ 5253 xfree((void**)&doflist); 5254 } 5255 /*}}}*/ 5236 5256 /*FUNCTION Penta::InputUpdateFromSolutionDiagnosticStokes {{{1*/ 5237 5257 void Penta::InputUpdateFromSolutionDiagnosticStokes(double* solution){ … … 5242 5262 const int numdofpervertex=4; 5243 5263 const int numdof=numdofpervertex*numvertices; 5244 5245 int doflist[numdof]; 5264 int* doflist=NULL; 5246 5265 double values[numdof]; 5247 5266 double vx[numvertices]; … … 5250 5269 double vel[numvertices]; 5251 5270 double pressure[numvertices]; 5252 int dummy;5253 5271 double stokesreconditioning; 5254 5272 5255 5273 /*Get dof list: */ 5256 GetDofList(&doflist [0],&dummy);5274 GetDofList(&doflist); 5257 5275 5258 5276 /*Use the dof list to index into the solution vector: */ … … 5291 5309 this->inputs->AddInput(new PentaVertexInput(VelEnum,vel)); 5292 5310 this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure)); 5311 5312 /*Free ressources:*/ 5313 xfree((void**)&doflist); 5293 5314 } 5294 5315 … … 5302 5323 const int numdofpervertex=4; 5303 5324 const int numdof=numdofpervertex*numvertices; 5304 5305 int doflist[numdof]; 5325 int* doflist=NULL; 5306 5326 double values[numdof]; 5307 5327 double lambdax[numvertices]; … … 5310 5330 double lambdap[numvertices]; 5311 5331 5312 int dummy;5313 5314 5332 /*Get dof list: */ 5315 GetDofList(&doflist [0],&dummy);5333 GetDofList(&doflist); 5316 5334 5317 5335 /*Use the dof list to index into the solution vector: */ … … 5334 5352 this->inputs->AddInput(new PentaVertexInput(AdjointpEnum,lambdap)); 5335 5353 5354 /*Free ressources:*/ 5355 xfree((void**)&doflist); 5336 5356 } 5337 5357 /*}}}*/ … … 5344 5364 const int numdofpervertex=2; 5345 5365 const int numdof=numdofpervertex*numvertices; 5346 5347 int doflist[numdof]; 5366 int* doflist=NULL; 5348 5367 double values[numdof]; 5349 5368 double lambdax[numvertices]; 5350 5369 double lambday[numvertices]; 5351 5370 5352 int dummy;5353 5354 5371 /*Get dof list: */ 5355 GetDofList(&doflist [0],&dummy);5372 GetDofList(&doflist); 5356 5373 5357 5374 /*Use the dof list to index into the solution vector: */ … … 5370 5387 this->inputs->AddInput(new PentaVertexInput(AdjointyEnum,lambday)); 5371 5388 5389 /*Free ressources:*/ 5390 xfree((void**)&doflist); 5372 5391 } 5373 5392 /*}}}*/ … … 5380 5399 const int numdofpervertex=1; 5381 5400 const int numdof=numdofpervertex*numvertices; 5382 5383 int doflist[numdof]; 5401 int* doflist=NULL; 5384 5402 double values[numdof]; 5385 5403 double B[numdof]; 5386 5404 double B_average; 5387 5405 5388 int dummy;5389 5390 5406 /*Get dof list: */ 5391 GetDofList(&doflist [0],&dummy);5407 GetDofList(&doflist); 5392 5408 5393 5409 /*Use the dof list to index into the solution vector: */ … … 5407 5423 this->matice->inputs->AddInput(new PentaVertexInput(RheologyBEnum,B)); 5408 5424 5425 /*Free ressources:*/ 5426 xfree((void**)&doflist); 5409 5427 } 5410 5428 /*}}}*/ … … 5415 5433 const int numdofpervertex = 1; 5416 5434 const int numdof = numdofpervertex *numvertices; 5417 int doflist[numdof];5435 int* doflist=NULL; 5418 5436 double values[numdof]; 5419 int dummy;5420 5437 5421 5438 /*Get dof list: */ 5422 GetDofList(&doflist [0],&dummy);5439 GetDofList(&doflist); 5423 5440 5424 5441 /*Use the dof list to index into the solution vector: */ … … 5429 5446 /*Add input to the element: */ 5430 5447 this->inputs->AddInput(new PentaVertexInput(enum_type,values)); 5448 5449 /*Free ressources:*/ 5450 xfree((void**)&doflist); 5431 5451 } 5432 5452 /*}}}*/ … … 5438 5458 const int numdof = numdofpervertex *numvertices; 5439 5459 const int numdof2d = numdof/2; 5440 int doflist[numdof];5460 int* doflist=NULL; 5441 5461 double values[numdof]; 5442 int dummy;5443 5462 Penta *penta = NULL; 5444 5463 bool onbed; … … 5451 5470 5452 5471 /*Get dof list: */ 5453 GetDofList(&doflist [0],&dummy);5472 GetDofList(&doflist); 5454 5473 5455 5474 /*Use the dof list to index into the solution vector and extrude it */ … … 5472 5491 penta=penta->GetUpperElement(); ISSMASSERT(penta->Id()!=this->id); 5473 5492 } 5493 5494 /*Free ressources:*/ 5495 xfree((void**)&doflist); 5474 5496 } 5475 5497 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Penta.h
r4995 r5096 135 135 void CreatePVectorSlope( Vec pg); 136 136 void CreatePVectorThermal( Vec pg); 137 double* GaussFromNode(Node* node);138 void GetDofList(int* doflist,int* pnumberofdofs);137 double* GaussFromNode(Node* node); 138 void GetDofList(int** pdoflist); 139 139 void GetDofList1(int* doflist); 140 int GetElementType(void);140 int GetElementType(void); 141 141 void GetNodalFunctions(double* l1l6, double* gauss_coord); 142 142 void GetNodalFunctionsDerivatives(double* dh1dh6,double* xyz_list, double* gauss_coord); … … 145 145 void GetNodalFunctionsDerivativesStokes(double* dh1dh7,double* xyz_list, double* gauss_coord); 146 146 void GetNodalFunctionsStokes(double* l1l7, double* gauss_coord); 147 void GetParameterValue(double* pvalue,Node* node,int enumtype);148 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,Input* input_in);147 void GetParameterValue(double* pvalue,Node* node,int enumtype); 148 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,Input* input_in); 149 149 void GetPhi(double* phi, double* epsilon, double viscosity); 150 150 void GetSolutionFromInputsDiagnosticHoriz(Vec solutiong); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r5038 r5096 1384 1384 const int numgrids=3; 1385 1385 const int numdofs=2; 1386 int numberofdofspernode;1387 1386 double mass_flux=0; 1388 1387 double xyz_list[numgrids][3]; … … 2328 2327 const int numdof=NDOF1*numgrids; 2329 2328 double xyz_list[numgrids][3]; 2330 int doflist[numdof]; 2331 int numberofdofspernode; 2329 int* doflist=NULL; 2332 2330 2333 2331 /* gaussian points: */ … … 2374 2372 /* Get node coordinates and dof list: */ 2375 2373 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2376 GetDofList(&doflist [0],&numberofdofspernode);2374 GetDofList(&doflist); 2377 2375 2378 2376 /*retrieve some parameters: */ … … 2482 2480 xfree((void**)&third_gauss_area_coord); 2483 2481 xfree((void**)&gauss_weights); 2484 2482 xfree((void**)&doflist); 2485 2483 } 2486 2484 /*}}}*/ … … 2496 2494 const int numdof=NDOF1*numgrids; 2497 2495 double xyz_list[numgrids][3]; 2498 int doflist[numdof]; 2499 int numberofdofspernode; 2496 int* doflist=NULL; 2500 2497 2501 2498 /* gaussian points: */ … … 2530 2527 /* Get node coordinates and dof list: */ 2531 2528 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2532 GetDofList(&doflist [0],&numberofdofspernode);2529 GetDofList(&doflist); 2533 2530 this->parameters->FindParam(&dim,DimEnum); 2534 2531 … … 2585 2582 xfree((void**)&third_gauss_area_coord); 2586 2583 xfree((void**)&gauss_weights); 2587 2584 xfree((void**)&doflist); 2588 2585 } 2589 2586 /*}}}*/ … … 2599 2596 const int numdof=NDOF1*numgrids; 2600 2597 double xyz_list[numgrids][3]; 2601 int doflist[numdof]; 2602 int numberofdofspernode; 2598 int* doflist=NULL; 2603 2599 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 2604 2600 … … 2652 2648 /* Get node coordinates and dof list: */ 2653 2649 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2654 GetDofList(&doflist [0],&numberofdofspernode);2650 GetDofList(&doflist); 2655 2651 2656 2652 /*Retrieve all inputs we will be needed*/ … … 2767 2763 xfree((void**)&third_gauss_area_coord); 2768 2764 xfree((void**)&gauss_weights); 2765 xfree((void**)&doflist); 2769 2766 } 2770 2767 /*}}}*/ … … 2779 2776 const int numdof=2*numgrids; 2780 2777 double xyz_list[numgrids][3]; 2781 int doflist[numdof]; 2782 int numberofdofspernode; 2778 int* doflist=NULL; 2783 2779 2784 2780 /* gaussian points: */ … … 2839 2835 /* Get node coordinates and dof list: */ 2840 2836 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 2841 GetDofList(&doflist [0],&numberofdofspernode);2837 GetDofList(&doflist); 2842 2838 2843 2839 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 2910 2906 xfree((void**)&third_gauss_area_coord); 2911 2907 xfree((void**)&gauss_weights); 2912 2908 xfree((void**)&doflist); 2913 2909 } 2914 2910 /*}}}*/ … … 2924 2920 const int numdof = 2 *numvertices; 2925 2921 double xyz_list[numvertices][3]; 2926 int doflist[numdof];2927 int numberofdofspernode ;2922 int* doflist=NULL; 2923 int numberofdofspernode=2; 2928 2924 2929 2925 /* gaussian points: */ … … 2981 2977 /* Get node coordinates and dof list: */ 2982 2978 GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices); 2983 GetDofList(&doflist [0],&numberofdofspernode);2979 GetDofList(&doflist); 2984 2980 2985 2981 if (shelf){ … … 3050 3046 xfree((void**)&third_gauss_area_coord); 3051 3047 xfree((void**)&gauss_weights); 3048 xfree((void**)&doflist); 3052 3049 delete friction; 3053 3054 3050 } 3055 3051 /*}}}*/ … … 3063 3059 const int NDOF2=2; 3064 3060 const int numdofs=numgrids*NDOF2; 3065 int doflist[numdofs]; 3066 int numberofdofspernode; 3061 int* doflist=NULL; 3067 3062 3068 3063 double Ke_gg[numdofs][numdofs]={0.0}; … … 3077 3072 if(onwater)return; 3078 3073 3079 GetDofList(&doflist [0],&numberofdofspernode);3074 GetDofList(&doflist); 3080 3075 3081 3076 /*Spawn 3 sing elements: */ … … 3088 3083 MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES); 3089 3084 3085 /*Free ressources:*/ 3086 xfree((void**)&doflist); 3090 3087 } 3091 3088 /*}}}*/ … … 3100 3097 const int numdof=NDOF1*numgrids; 3101 3098 double xyz_list[numgrids][3]; 3102 int doflist[numdof]; 3103 int numberofdofspernode; 3099 int* doflist=NULL; 3104 3100 3105 3101 /* gaussian points: */ … … 3134 3130 /* Get node coordinates and dof list: */ 3135 3131 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3136 GetDofList(&doflist [0],&numberofdofspernode);3132 GetDofList(&doflist); 3137 3133 3138 3134 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 3205 3201 xfree((void**)&third_gauss_area_coord); 3206 3202 xfree((void**)&gauss_weights); 3203 xfree((void**)&doflist); 3207 3204 } 3208 3205 /*}}}*/ … … 3216 3213 const int NDOF1=1; 3217 3214 const int numdof=numgrids*NDOF1; 3218 int doflist[numdof]; 3219 int numberofdofspernode; 3215 int* doflist=NULL; 3220 3216 3221 3217 /*Grid data: */ … … 3248 3244 /* Get node coordinates and dof list: */ 3249 3245 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3250 GetDofList(&doflist [0],&numberofdofspernode);3246 GetDofList(&doflist); 3251 3247 3252 3248 /* Get gaussian points and weights: */ … … 3287 3283 xfree((void**)&third_gauss_area_coord); 3288 3284 xfree((void**)&gauss_weights); 3289 3285 xfree((void**)&doflist); 3290 3286 } 3291 3287 /*}}}*/ … … 3301 3297 const int numdof=NDOF1*numgrids; 3302 3298 double xyz_list[numgrids][3]; 3303 int doflist[numdof];3304 int numberofdofspernode ;3299 int* doflist=NULL; 3300 int numberofdofspernode=1; 3305 3301 3306 3302 /* gaussian points: */ … … 3351 3347 /* Get node coordinates and dof list: */ 3352 3348 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3353 GetDofList(&doflist [0],&numberofdofspernode);3349 GetDofList(&doflist); 3354 3350 3355 3351 /*Retrieve all inputs we will be needing: */ … … 3469 3465 xfree((void**)&third_gauss_area_coord); 3470 3466 xfree((void**)&gauss_weights); 3471 3467 xfree((void**)&doflist); 3472 3468 } 3473 3469 /*}}}*/ … … 3483 3479 const int numdof=NDOF1*numgrids; 3484 3480 double xyz_list[numgrids][3]; 3485 int doflist[numdof];3486 int numberofdofspernode ;3481 int* doflist=NULL; 3482 int numberofdofspernode=1; 3487 3483 3488 3484 /* gaussian points: */ … … 3524 3520 /* Get node coordinates and dof list: */ 3525 3521 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3526 GetDofList(&doflist [0],&numberofdofspernode);3522 GetDofList(&doflist); 3527 3523 3528 3524 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 3595 3591 xfree((void**)&third_gauss_area_coord); 3596 3592 xfree((void**)&gauss_weights); 3597 3593 xfree((void**)&doflist); 3598 3594 } 3599 3595 /*}}}*/ … … 3609 3605 const int numdof=NDOF1*numgrids; 3610 3606 double xyz_list[numgrids][3]; 3611 int doflist[numdof]; 3612 int numberofdofspernode; 3607 int* doflist=NULL; 3613 3608 3614 3609 /* gaussian points: */ … … 3633 3628 /* Get node coordinates and dof list: */ 3634 3629 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3635 GetDofList(&doflist [0],&numberofdofspernode);3630 GetDofList(&doflist); 3636 3631 3637 3632 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 3672 3667 xfree((void**)&third_gauss_area_coord); 3673 3668 xfree((void**)&gauss_weights); 3669 xfree((void**)&doflist); 3674 3670 } 3675 3671 /*}}}*/ … … 3685 3681 const int numdof=NDOF1*numgrids; 3686 3682 double xyz_list[numgrids][3]; 3687 int doflist[numdof]; 3688 int numberofdofspernode; 3683 int* doflist=NULL; 3689 3684 3690 3685 double mixed_layer_capacity; … … 3718 3713 /* Get node coordinates and dof list: */ 3719 3714 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3720 GetDofList(&doflist [0],&numberofdofspernode);3715 GetDofList(&doflist); 3721 3716 3722 3717 //recover material parameters … … 3766 3761 xfree((void**)&third_gauss_area_coord); 3767 3762 xfree((void**)&gauss_weights); 3768 3763 xfree((void**)&doflist); 3769 3764 } 3770 3765 /*}}}*/ … … 3780 3775 const int numdof=NDOF1*numgrids; 3781 3776 double xyz_list[numgrids][3]; 3782 int doflist[numdof];3783 int numberofdofspernode ;3777 int* doflist=NULL; 3778 int numberofdofspernode=1; 3784 3779 3785 3780 /* gaussian points: */ … … 3807 3802 /* Get node coordinates and dof list: */ 3808 3803 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3809 GetDofList(&doflist [0],&numberofdofspernode);3804 GetDofList(&doflist); 3810 3805 3811 3806 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 3846 3841 xfree((void**)&third_gauss_area_coord); 3847 3842 xfree((void**)&gauss_weights); 3843 xfree((void**)&doflist); 3848 3844 } 3849 3845 /*}}}*/ … … 3859 3855 const int numdof=NDOF1*numgrids; 3860 3856 double xyz_list[numgrids][3]; 3861 int doflist[numdof];3862 int numberofdofspernode ;3857 int* doflist=NULL; 3858 int numberofdofspernode=1; 3863 3859 3864 3860 /* gaussian points: */ … … 3888 3884 /* Get node coordinates and dof list: */ 3889 3885 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3890 GetDofList(&doflist [0],&numberofdofspernode);3886 GetDofList(&doflist); 3891 3887 3892 3888 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 3929 3925 xfree((void**)&third_gauss_area_coord); 3930 3926 xfree((void**)&gauss_weights); 3927 xfree((void**)&doflist); 3931 3928 } 3932 3929 /*}}}*/ … … 3942 3939 const int numdof=NDOF1*numgrids; 3943 3940 double xyz_list[numgrids][3]; 3944 int doflist[numdof];3945 int numberofdofspernode ;3941 int* doflist=NULL; 3942 int numberofdofspernode=1; 3946 3943 3947 3944 /* gaussian points: */ … … 3969 3966 /* Get node coordinates and dof list: */ 3970 3967 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 3971 GetDofList(&doflist [0],&numberofdofspernode);3968 GetDofList(&doflist); 3972 3969 3973 3970 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 4004 4001 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4005 4002 4003 /*Free ressources:*/ 4006 4004 xfree((void**)&first_gauss_area_coord); 4007 4005 xfree((void**)&second_gauss_area_coord); 4008 4006 xfree((void**)&third_gauss_area_coord); 4009 4007 xfree((void**)&gauss_weights); 4010 4008 xfree((void**)&doflist); 4011 4009 } 4012 4010 /*}}}*/ … … 4021 4019 const int numdof=NDOF1*numgrids; 4022 4020 double xyz_list[numgrids][3]; 4023 int doflist[numdof]; 4024 int numberofdofspernode; 4021 int* doflist=NULL; 4025 4022 4026 4023 /* gaussian points: */ … … 4060 4057 /* Get node coordinates and dof list: */ 4061 4058 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 4062 GetDofList(&doflist [0],&numberofdofspernode);4059 GetDofList(&doflist); 4063 4060 4064 4061 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 4112 4109 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4113 4110 4111 /*Free ressources:*/ 4114 4112 xfree((void**)&first_gauss_area_coord); 4115 4113 xfree((void**)&second_gauss_area_coord); 4116 4114 xfree((void**)&third_gauss_area_coord); 4117 4115 xfree((void**)&gauss_weights); 4118 4116 xfree((void**)&doflist); 4119 4117 } 4120 4118 /*}}}*/ … … 4129 4127 const int NDOF2=2; 4130 4128 double xyz_list[numgrids][3]; 4131 int doflist[numdof]; 4132 int numberofdofspernode; 4129 int* doflist=NULL; 4133 4130 4134 4131 /* parameters: */ … … 4178 4175 /* Get node coordinates and dof list: */ 4179 4176 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 4180 GetDofList(&doflist [0],&numberofdofspernode);4177 GetDofList(&doflist); 4181 4178 4182 4179 … … 4235 4232 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4236 4233 4234 /*Free ressources:*/ 4237 4235 xfree((void**)&first_gauss_area_coord); 4238 4236 xfree((void**)&second_gauss_area_coord); 4239 4237 xfree((void**)&third_gauss_area_coord); 4240 4238 xfree((void**)&gauss_weights); 4241 4239 xfree((void**)&doflist); 4242 4240 } 4243 4241 /*}}}*/ … … 4252 4250 const int NDOF2=2; 4253 4251 double xyz_list[numgrids][3]; 4254 int doflist[numdof]; 4255 int numberofdofspernode; 4252 int* doflist=NULL; 4256 4253 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 4257 4254 … … 4302 4299 /* Get node coordinates and dof list: */ 4303 4300 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 4304 GetDofList(&doflist [0],&numberofdofspernode);4301 GetDofList(&doflist); 4305 4302 4306 4303 /* Recover input data: */ … … 4474 4471 VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4475 4472 4476 /* Clean up*/4473 /*Free ressources:*/ 4477 4474 xfree((void**)&first_gauss_area_coord); 4478 4475 xfree((void**)&second_gauss_area_coord); 4479 4476 xfree((void**)&third_gauss_area_coord); 4480 4477 xfree((void**)&gauss_weights); 4481 4478 xfree((void**)&doflist); 4482 4479 } 4483 4480 /*}}}*/ … … 4492 4489 const int numdof=NDOF4*numgrids; 4493 4490 double xyz_list[numgrids][3]; 4494 int doflist[numdof]; 4495 int numberofdofspernode; 4491 int* doflist=NULL; 4496 4492 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 4497 4493 … … 4541 4537 /* Get node coordinates and dof list: */ 4542 4538 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 4543 GetDofList(&doflist[0],&numberofdofspernode); 4544 ISSMASSERT(numberofdofspernode==4); 4539 GetDofList(&doflist); 4545 4540 4546 4541 /* Recover input data: */ … … 4709 4704 VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4710 4705 4711 /* Clean up*/4706 /*Free ressources:*/ 4712 4707 xfree((void**)&first_gauss_area_coord); 4713 4708 xfree((void**)&second_gauss_area_coord); 4714 4709 xfree((void**)&third_gauss_area_coord); 4715 4710 xfree((void**)&gauss_weights); 4716 4711 xfree((void**)&doflist); 4717 4712 } 4718 4713 /*}}}*/ … … 4725 4720 const int NDOF2=2; 4726 4721 const int numdofs=NDOF2*numgrids; 4727 int doflist[numdofs]; 4728 int numberofdofspernode; 4722 int* doflist=NULL; 4729 4723 double constant_part,ub,vb; 4730 4724 double rho_ice,gravity,n,B; … … 4748 4742 if(onwater)return; 4749 4743 4750 GetDofList(&doflist [0],&numberofdofspernode);4744 GetDofList(&doflist); 4751 4745 4752 4746 /* Get parameters */ … … 4783 4777 4784 4778 VecSetValues(pg,numdofs,doflist,(const double*)pe_g,ADD_VALUES); 4779 4780 /*Free ressources:*/ 4781 xfree((void**)&doflist); 4785 4782 } 4786 4783 /*}}}*/ … … 4797 4794 const int numdof=NDOF1*numgrids; 4798 4795 double xyz_list[numgrids][3]; 4799 int doflist[numdof];4800 int numberofdofspernode ;4796 int* doflist=NULL; 4797 int numberofdofspernode=1; 4801 4798 4802 4799 /* gaussian points: */ … … 4830 4827 /* Get node coordinates and dof list: */ 4831 4828 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 4832 GetDofList(&doflist [0],&numberofdofspernode);4829 GetDofList(&doflist); 4833 4830 4834 4831 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 4867 4864 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4868 4865 4866 /*Free ressources:*/ 4869 4867 xfree((void**)&first_gauss_area_coord); 4870 4868 xfree((void**)&second_gauss_area_coord); 4871 4869 xfree((void**)&third_gauss_area_coord); 4872 4870 xfree((void**)&gauss_weights); 4871 xfree((void**)&doflist); 4873 4872 4874 4873 } … … 4885 4884 const int numdof=NDOF1*numgrids; 4886 4885 double xyz_list[numgrids][3]; 4887 int doflist[numdof];4888 int numberofdofspernode ;4886 int* doflist=NULL; 4887 int numberofdofspernode=1; 4889 4888 4890 4889 /* gaussian points: */ … … 4916 4915 /* Get node coordinates and dof list: */ 4917 4916 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 4918 GetDofList(&doflist [0],&numberofdofspernode);4917 GetDofList(&doflist); 4919 4918 4920 4919 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 4953 4952 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 4954 4953 4954 /*Free ressources:*/ 4955 4955 xfree((void**)&first_gauss_area_coord); 4956 4956 xfree((void**)&second_gauss_area_coord); 4957 4957 xfree((void**)&third_gauss_area_coord); 4958 4958 xfree((void**)&gauss_weights); 4959 4959 xfree((void**)&doflist); 4960 4960 } 4961 4961 /*}}}*/ … … 4970 4970 const int numdof=NDOF1*numgrids; 4971 4971 double xyz_list[numgrids][3]; 4972 int doflist[numdof]; 4973 int numberofdofspernode; 4972 int* doflist=NULL; 4974 4973 4975 4974 /* gaussian points: */ … … 5002 5001 /* Get node coordinates and dof list: */ 5003 5002 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 5004 GetDofList(&doflist [0],&numberofdofspernode);5003 GetDofList(&doflist); 5005 5004 5006 5005 /* Get gaussian points and weights: */ … … 5047 5046 VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES); 5048 5047 5048 /*Free ressources:*/ 5049 5049 xfree((void**)&first_gauss_area_coord); 5050 5050 xfree((void**)&second_gauss_area_coord); 5051 5051 xfree((void**)&third_gauss_area_coord); 5052 5052 xfree((void**)&gauss_weights); 5053 5053 xfree((void**)&doflist); 5054 5054 } 5055 5055 /*}}}*/ … … 5062 5062 const int NDOF1=1; 5063 5063 const int numdof=numgrids*NDOF1; 5064 int doflist[numdof]; 5065 int numberofdofspernode; 5064 int* doflist=NULL; 5066 5065 double xyz_list[numgrids][3]; 5067 5066 … … 5101 5100 /* Get node coordinates and dof list: */ 5102 5101 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 5103 GetDofList(&doflist [0],&numberofdofspernode);5102 GetDofList(&doflist); 5104 5103 5105 5104 //recover material parameters … … 5153 5152 VecSetValues(pg,numdof,doflist,(const double*)P_terms,ADD_VALUES); 5154 5153 5154 /*Free ressources:*/ 5155 5155 xfree((void**)&first_gauss_area_coord); 5156 5156 xfree((void**)&second_gauss_area_coord); 5157 5157 xfree((void**)&third_gauss_area_coord); 5158 5158 xfree((void**)&gauss_weights); 5159 5159 xfree((void**)&doflist); 5160 5160 } 5161 5161 /*}}}*/ … … 5168 5168 const int NDOF1=1; 5169 5169 const int numdof=numgrids*NDOF1; 5170 int doflist[numdof]; 5171 int numberofdofspernode; 5172 double xyz_list[numgrids][3]; 5170 int* doflist=NULL; 5171 double xyz_list[numgrids][3]; 5173 5172 5174 5173 double rho_ice; … … 5218 5217 /* Get node coordinates and dof list: */ 5219 5218 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 5220 GetDofList(&doflist [0],&numberofdofspernode);5219 GetDofList(&doflist); 5221 5220 5222 5221 //recover material parameters … … 5286 5285 VecSetValues(pg,numdof,doflist,(const double*)P_terms,ADD_VALUES); 5287 5286 5287 /*Free ressources:*/ 5288 5288 xfree((void**)&first_gauss_area_coord); 5289 5289 xfree((void**)&second_gauss_area_coord); 5290 5290 xfree((void**)&third_gauss_area_coord); 5291 5291 xfree((void**)&gauss_weights); 5292 xfree((void**)&doflist); 5292 5293 delete friction; 5293 5294 5294 } 5295 5295 /*}}}*/ … … 5353 5353 /*}}}*/ 5354 5354 /*FUNCTION Tria::GetDofList {{{1*/ 5355 void Tria::GetDofList(int* doflist,int* pnumberofdofspernode){5355 void Tria::GetDofList(int** pdoflist){ 5356 5356 5357 5357 int i,j; 5358 int doflist_per_node[MAXDOFSPERNODE]; 5359 int numberofdofspernode; 5360 5361 /*Some checks for debugging*/ 5362 ISSMASSERT(doflist); 5363 ISSMASSERT(pnumberofdofspernode); 5364 ISSMASSERT(nodes); 5365 5366 /*Build doflist from nodes*/ 5358 int numberofdofs=0; 5359 int count=0; 5360 5361 /*output: */ 5362 int* doflist=NULL; 5363 5364 /*First, figure out size of doflist: */ 5367 5365 for(i=0;i<3;i++){ 5368 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 5369 for(j=0;j<numberofdofspernode;j++){ 5370 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 5371 } 5366 numberofdofs+=nodes[i]->GetNumberOfDofs(); 5367 } 5368 5369 /*Allocate: */ 5370 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 5371 5372 /*Populate: */ 5373 count=0; 5374 for(i=0;i<3;i++){ 5375 nodes[i]->GetDofList(doflist+count); 5376 count+=nodes[i]->GetNumberOfDofs(); 5372 5377 } 5373 5378 5374 5379 /*Assign output pointers:*/ 5375 *p numberofdofspernode=numberofdofspernode;5380 *pdoflist=doflist; 5376 5381 5377 5382 } … … 5549 5554 const int numdof=numdofpervertex*numvertices; 5550 5555 double gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}}; 5551 5552 int doflist[numdof]; 5556 int* doflist=NULL; 5553 5557 double values[numdof]; 5554 5558 double vx; 5555 5559 double vy; 5556 5560 5557 int dummy;5558 5559 5561 /*Get dof list: */ 5560 GetDofList(&doflist [0],&dummy);5562 GetDofList(&doflist); 5561 5563 5562 5564 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 5574 5576 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 5575 5577 5578 /*Free ressources:*/ 5579 xfree((void**)&doflist); 5580 5576 5581 } 5577 5582 /*}}}*/ … … 5585 5590 const int numdof=numdofpervertex*numvertices; 5586 5591 double gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}}; 5587 5588 int doflist[numdof]; 5592 int* doflist=NULL; 5589 5593 double values[numdof]; 5590 5594 double lambdax; 5591 5595 double lambday; 5592 5596 5593 int dummy;5594 5595 5597 /*Get dof list: */ 5596 GetDofList(&doflist [0],&dummy);5598 GetDofList(&doflist); 5597 5599 5598 5600 /*Ok, we have lambdax and lambday in values, fill in lambdax and lambday arrays: */ … … 5610 5612 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 5611 5613 5614 /*Free ressources:*/ 5615 xfree((void**)&doflist); 5616 5612 5617 } 5613 5618 /*}}}*/ … … 5621 5626 const int numdof=numdofpervertex*numvertices; 5622 5627 double gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}}; 5623 5624 int doflist[numdof]; 5628 int* doflist=NULL; 5625 5629 double values[numdof]; 5626 5630 double vx; 5627 5631 double vy; 5628 5629 5632 int dummy; 5630 5633 5631 5634 /*Get dof list: */ 5632 GetDofList(&doflist [0],&dummy);5635 GetDofList(&doflist); 5633 5636 5634 5637 /*Ok, we have vx and vy in values, fill in vx and vy arrays: */ … … 5645 5648 /*Add value to global vector*/ 5646 5649 VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES); 5650 5651 /*Free ressources:*/ 5652 xfree((void**)&doflist); 5647 5653 5648 5654 } … … 5854 5860 const int numdofpervertex=2; 5855 5861 const int numdof=numdofpervertex*numvertices; 5856 5857 int doflist[numdof]; 5862 int* doflist=NULL; 5858 5863 double values[numdof]; 5859 5864 double lambdax[numvertices]; 5860 5865 double lambday[numvertices]; 5861 5866 5862 int dummy;5863 5864 5867 /*Get dof list: */ 5865 GetDofList(&doflist [0],&dummy);5868 GetDofList(&doflist); 5866 5869 5867 5870 /*Use the dof list to index into the solution vector: */ … … 5880 5883 this->inputs->AddInput(new TriaVertexInput(AdjointyEnum,lambday)); 5881 5884 5885 /*Free ressources:*/ 5886 xfree((void**)&doflist); 5887 5882 5888 } 5883 5889 /*}}}*/ … … 5890 5896 const int numdofpervertex=2; 5891 5897 const int numdof=numdofpervertex*numvertices; 5892 5893 int doflist[numdof]; 5898 int* doflist=NULL; 5894 5899 double values[numdof]; 5895 5900 double vx[numvertices]; … … 5901 5906 double rho_ice,g; 5902 5907 double gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}}; 5903 5904 int dummy;5905 5908 Input* vz_input=NULL; 5906 5909 double* vz_ptr=NULL; 5910 int dummy; 5907 5911 5908 5912 /*Get dof list: */ 5909 GetDofList(&doflist [0],&dummy);5913 GetDofList(&doflist); 5910 5914 5911 5915 /*Use the dof list to index into the solution vector: */ … … 5958 5962 this->inputs->AddInput(new TriaVertexInput(PressureEnum,pressure)); 5959 5963 5964 /*Free ressources:*/ 5965 xfree((void**)&doflist); 5966 5960 5967 } 5961 5968 /*}}}*/ … … 5968 5975 const int numdofpervertex=2; 5969 5976 const int numdof=numdofpervertex*numvertices; 5970 5971 int doflist[numdof]; 5977 int* doflist=NULL; 5972 5978 double values[numdof]; 5973 5979 double vx[numvertices]; … … 5979 5985 double rho_ice,g; 5980 5986 double gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}}; 5981 5982 int dummy;5983 5987 Input* vz_input=NULL; 5984 5988 double* vz_ptr=NULL; 5989 int dummy; 5985 5990 5986 5991 /*Get dof list: */ 5987 GetDofList(&doflist [0],&dummy);5992 GetDofList(&doflist); 5988 5993 5989 5994 /*Use the dof list to index into the solution vector: */ … … 6036 6041 this->inputs->AddInput(new TriaVertexInput(PressureEnum,pressure)); 6037 6042 6043 /*Free ressources:*/ 6044 xfree((void**)&doflist); 6045 6038 6046 } 6039 6047 /*}}}*/ … … 6044 6052 const int numdofpervertex = 1; 6045 6053 const int numdof = numdofpervertex *numvertices; 6046 int doflist[numdof];6054 int* doflist=NULL; 6047 6055 double values[numdof]; 6048 int dummy;6049 6056 6050 6057 /*Get dof list: */ 6051 GetDofList(&doflist [0],&dummy);6058 GetDofList(&doflist); 6052 6059 6053 6060 /*Use the dof list to index into the solution vector: */ … … 6058 6065 /*Add input to the element: */ 6059 6066 this->inputs->AddInput(new TriaVertexInput(enum_type,values)); 6067 6068 /*Free ressources:*/ 6069 xfree((void**)&doflist); 6070 6060 6071 } 6061 6072 /*}}}*/ -
issm/trunk/src/c/objects/Elements/Tria.h
r4974 r5096 136 136 void CreatePVectorThermalSheet( Vec pg); 137 137 void CreatePVectorThermalShelf( Vec pg); 138 double GetArea(void);139 double GetAreaCoordinate(double x, double y, int which_one);140 int GetElementType(void);141 void GetDofList(int* doflist,int* pnumberofdofs);138 double GetArea(void); 139 double GetAreaCoordinate(double x, double y, int which_one); 140 int GetElementType(void); 141 void GetDofList(int** pdoflist); 142 142 void GetDofList1(int* doflist); 143 void GetParameterValue(double* pvalue,Node* node,int enumtype);144 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype);145 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,Input* input_in);143 void GetParameterValue(double* pvalue,Node* node,int enumtype); 144 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype); 145 void GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,Input* input_in); 146 146 void GetSolutionFromInputsDiagnosticHoriz(Vec solution); 147 147 void GetSolutionFromInputsAdjointHoriz(Vec solution); -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r4946 r5096 401 401 const int NDOF2 = 2; 402 402 const int numdofs = numgrids *NDOF2; 403 int numberofdofspernode; 404 int doflist[numdofs]; 403 int* doflist=NULL; 405 404 double xyz_list[numgrids][3]; 406 405 … … 453 452 454 453 /* Get dof list and node coordinates: */ 455 GetDofList(&doflist [0],&numberofdofspernode);454 GetDofList(&doflist); 456 455 GetVerticesCoordinates(&xyz_list[0][0],nodes,numgrids); 457 456 … … 511 510 } //for(ig=0;ig<num_gauss;ig++) 512 511 512 513 /*Plug pe_g into vector: */ 514 VecSetValues(pg,numdofs,doflist,pe_g,ADD_VALUES); 515 516 /*Free ressources:*/ 513 517 xfree((void**)&segment_gauss_coord); 514 518 xfree((void**)&gauss_weights); 515 516 /*Plug pe_g into vector: */ 517 VecSetValues(pg,numdofs,doflist,pe_g,ADD_VALUES); 519 xfree((void**)&doflist); 518 520 519 521 } … … 527 529 const int NDOF2=2; 528 530 const int numdofs=numgrids*NDOF2; 529 int numberofdofspernode; 530 int doflist[numdofs]; 531 int* doflist=NULL; 531 532 532 533 double xyz_list[numgrids][3]; … … 574 575 575 576 /* Get dof list and node coordinates: */ 576 GetDofList(&doflist [0],&numberofdofspernode);577 GetDofList(&doflist); 577 578 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 578 579 … … 654 655 /*Free ressources:*/ 655 656 xfree((void**)&element_nodes); 657 xfree((void**)&doflist); 656 658 657 659 } … … 665 667 const int NDOF4=4; 666 668 const int numdofs=numgrids*NDOF4; 667 int numberofdofspernode; 668 int doflist[numdofs]; 669 int* doflist=NULL; 669 670 670 671 double xyz_list[numgrids][3]; … … 714 715 715 716 /* Get dof list and node coordinates: */ 716 GetDofList(&doflist [0],&numberofdofspernode);717 GetDofList(&doflist); 717 718 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 718 719 … … 794 795 /*Free ressources:*/ 795 796 xfree((void**)&element_nodes); 796 797 } 798 /*}}}*/ 799 /* FUNCTION Icefront::GetDofList{{{1*/800 801 void Icefront::GetDofList(int* doflist,int* pnumberofdofspernode){797 xfree((void**)&doflist); 798 799 } 800 /*}}}*/ 801 /*FUNCTION Icefront::GetDofList {{{1*/ 802 void Icefront::GetDofList(int** pdoflist){ 802 803 803 804 int i,j; 804 int doflist_per_node[MAXDOFSPERNODE];805 int numberofdofspernode;805 int numberofdofs=0; 806 int count=0; 806 807 int type; 807 808 int numberofnodes=2; 809 810 /*output: */ 811 int* doflist=NULL; 812 813 /*pointers: */ 808 814 Node** nodes=NULL; 815 816 /*recover pointers: */ 809 817 nodes=(Node**)hnodes->deliverp(); 818 819 /*recover type: */ 810 820 inputs->GetParameterValue(&type,TypeEnum); 811 812 if(type==SegmentIcefrontEnum){ 813 for(i=0;i<2;i++){ 814 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 815 for(j=0;j<numberofdofspernode;j++){ 816 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 817 } 818 } 819 } 820 else{ 821 for(i=0;i<4;i++){ 822 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 823 for(j=0;j<numberofdofspernode;j++){ 824 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 825 } 826 } 827 } 828 821 822 /*Some checks for debugging*/ 823 ISSMASSERT(nodes); 824 825 /*How many nodes? :*/ 826 if(type==SegmentIcefrontEnum)numberofnodes=2; 827 else numberofnodes=4; 828 829 /*Figure out size of doflist: */ 830 for(i=0;i<numberofnodes;i++){ 831 numberofdofs+=nodes[i]->GetNumberOfDofs(); 832 } 833 834 /*Allocate: */ 835 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 836 837 /*Populate: */ 838 count=0; 839 for(i=0;i<numberofnodes;i++){ 840 nodes[i]->GetDofList(doflist+count); 841 count+=nodes[i]->GetNumberOfDofs(); 842 } 829 843 830 844 /*Assign output pointers:*/ 831 *pnumberofdofspernode=numberofdofspernode; 832 845 *pdoflist=doflist; 833 846 } 834 847 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Icefront.h
r4946 r5096 72 72 void CreatePVectorDiagnosticHorizQuad( Vec pg); 73 73 void CreatePVectorDiagnosticStokes( Vec pg); 74 void GetDofList(int* doflist,int* pnumberofdofs);74 void GetDofList(int** pdoflist); 75 75 void QuadPressureLoad(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, 76 76 double* normal1,double* normal2,double* normal3,double* normal4,double* xyz_list); -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r4942 r5096 377 377 double xyz_list[numgrids][3]; 378 378 double normal[2]; 379 int doflist[numdof]; 380 int numberofdofspernode; 379 int* doflist=NULL; 381 380 382 381 /* gaussian points: */ … … 431 430 /* Get node coordinates, dof list and normal vector: */ 432 431 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 433 GetDofList(&doflist [0],&numberofdofspernode);432 GetDofList(&doflist); 434 433 GetNormal(&normal[0],xyz_list); 435 434 … … 490 489 xfree((void**)&gauss_coords); 491 490 xfree((void**)&gauss_weights); 491 492 /*Free ressources:*/ 493 xfree((void**)&doflist); 494 492 495 } 493 496 /*}}}*/ … … 505 508 double xyz_list[numgrids][3]; 506 509 double normal[2]; 507 int doflist[numdof]; 508 int numberofdofspernode; 510 int* doflist=NULL; 509 511 510 512 /* gaussian points: */ … … 560 562 /* Get node coordinates, dof list and normal vector: */ 561 563 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 562 GetDofList(&doflist [0],&numberofdofspernode);564 GetDofList(&doflist); 563 565 GetNormal(&normal[0],xyz_list); 564 566 … … 621 623 xfree((void**)&gauss_weights); 622 624 625 /*Free ressources:*/ 626 xfree((void**)&doflist); 627 623 628 } 624 629 /*}}}*/ … … 644 649 double xyz_list[numgrids][3]; 645 650 double normal[2]; 646 int doflist[numdof]; 647 int numberofdofspernode; 651 int* doflist=NULL; 648 652 649 653 /* gaussian points: */ … … 707 711 /* Get node coordinates, dof list and normal vector: */ 708 712 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 709 GetDofList(&doflist [0],&numberofdofspernode);713 GetDofList(&doflist); 710 714 GetNormal(&normal[0],xyz_list); 711 715 … … 757 761 xfree((void**)&gauss_weights); 758 762 763 /*Free ressources:*/ 764 xfree((void**)&doflist); 765 759 766 } 760 767 /*}}}*/ … … 775 782 } 776 783 /*}}}*/ 777 /*FUNCTION Numericalflux::GetDofList{{{1*/ 778 779 void Numericalflux::GetDofList(int* doflist,int* pnumberofdofspernode){ 784 /*FUNCTION Numericalflux::GetDofList {{{1*/ 785 void Numericalflux::GetDofList(int** pdoflist){ 780 786 781 787 int i,j; 782 int doflist_per_node[MAXDOFSPERNODE]; 783 int numberofdofspernode; 784 785 /*dynamic objects pointed to by hooks: */ 786 Node** nodes=NULL; 788 int numberofdofs=0; 789 int count=0; 787 790 int type; 788 789 /*recover objects from hooks: */ 791 int numberofnodes=2; 792 793 /*output: */ 794 int* doflist=NULL; 795 796 /*pointers: */ 797 Node** nodes=NULL; 798 799 /*recover pointers: */ 790 800 nodes=(Node**)hnodes->deliverp(); 791 801 … … 793 803 inputs->GetParameterValue(&type,TypeEnum); 794 804 795 if (type==InternalEnum){ 796 for(i=0;i<4;i++){ 797 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 798 for(j=0;j<numberofdofspernode;j++){ 799 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 800 } 801 } 802 } 803 else if (type==BoundaryEnum){ 804 for(i=0;i<2;i++){ 805 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 806 for(j=0;j<numberofdofspernode;j++){ 807 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 808 } 809 } 810 } 805 /*Some checks for debugging*/ 806 ISSMASSERT(nodes); 807 808 /*How many nodes? :*/ 809 if(type==InternalEnum)numberofnodes=4; 810 else if(type==BoundaryEnum)numberofnodes=2; 811 811 else ISSMERROR("type %s not supported yet",type); 812 813 /*Figure out size of doflist: */ 814 for(i=0;i<numberofnodes;i++){ 815 numberofdofs+=nodes[i]->GetNumberOfDofs(); 816 } 817 818 /*Allocate: */ 819 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 820 821 /*Populate: */ 822 count=0; 823 for(i=0;i<numberofnodes;i++){ 824 nodes[i]->GetDofList(doflist+count); 825 count+=nodes[i]->GetNumberOfDofs(); 826 } 812 827 813 828 /*Assign output pointers:*/ 814 *p numberofdofspernode=numberofdofspernode;829 *pdoflist=doflist; 815 830 } 816 831 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Numericalflux.h
r4904 r5096 67 67 void GetB(double* B, double gauss_coord); 68 68 void GetL(double* L, double gauss_coord,int numdof); 69 void GetDofList(int* doflist,int* pnumberofdofs);69 void GetDofList(int** pdoflist); 70 70 void GetNormal(double* normal,double xyz_list[4][3]); 71 71 void GetParameterValue(double* pvalue, double gauss_coord,int enumtype); -
issm/trunk/src/c/objects/Loads/Pengrid.cpp
r4684 r5096 391 391 /*Pengrid management:*/ 392 392 /*FUNCTION Pengrid::GetDofList {{{1*/ 393 void Pengrid::GetDofList(int* doflist,int* pnumberofdofspernode){ 394 395 int i,j; 396 int doflist_per_node[MAXDOFSPERNODE]; 397 int numberofdofspernode; 393 void Pengrid::GetDofList(int** pdoflist){ 394 395 int i,j; 396 int numberofdofs=0; 397 398 /*output: */ 399 int* doflist=NULL; 398 400 399 401 /*dynamic objects pointed to by hooks: */ … … 402 404 /*recover objects from hooks: */ 403 405 node=(Node*)hnode->delivers(); 404 405 node->GetDofList(&doflist_per_node[0],&numberofdofspernode); 406 for(j=0;j<numberofdofspernode;j++){ 407 doflist[j]=doflist_per_node[j]; 408 } 406 407 /*Some checks for debugging*/ 408 ISSMASSERT(node); 409 410 /*First, figure out size of doflist: */ 411 numberofdofs=node->GetNumberOfDofs(); 412 413 /*Allocate: */ 414 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 415 416 /*Populate: */ 417 node->GetDofList(doflist); 409 418 410 419 /*Assign output pointers:*/ 411 *pnumberofdofspernode=numberofdofspernode; 412 420 *pdoflist=doflist; 413 421 } 414 422 /*}}}*/ … … 549 557 const int NDOF4=4; 550 558 const int numdof=numgrids*NDOF4; 551 int doflist[numdof]; 552 int numberofdofspernode; 559 int* doflist=NULL; 553 560 554 561 int dofs1[1]={0}; … … 565 572 566 573 /*Get dof list: */ 567 GetDofList(&doflist [0],&numberofdofspernode);574 GetDofList(&doflist); 568 575 569 576 /*recover pointers: */ … … 589 596 /*Add Ke to global matrix Kgg: */ 590 597 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES); 598 599 /*Free ressources:*/ 600 xfree((void**)&doflist); 601 591 602 } 592 603 /*}}}1*/ … … 599 610 const int numdof=numgrids*NDOF1; 600 611 double Ke[numdof][numdof]={0.0}; 601 int dofs1[1]={0}; 602 int doflist[numdof]; 603 int numberofdofspernode; 604 double meltingpoint; 605 double* gauss=NULL; 612 int dofs1[1]={0}; 613 int* doflist=NULL; 614 double meltingpoint; 615 double* gauss=NULL; 606 616 607 617 double pressure; … … 632 642 633 643 /*Get dof list: */ 634 GetDofList(&doflist [0],&numberofdofspernode);644 GetDofList(&doflist); 635 645 636 646 //Compute pressure melting point … … 648 658 /*Clean up*/ 649 659 xfree((void**)&gauss); 660 xfree((void**)&doflist); 650 661 } 651 662 /*}}}1*/ … … 659 670 const int numdof=numgrids*NDOF1; 660 671 double Ke[numdof][numdof]; 661 int doflist[numdof]; 662 int numberofdofspernode; 672 int* doflist=NULL; 663 673 double penalty_offset; 664 674 … … 669 679 670 680 /*Get dof list: */ 671 GetDofList(&doflist [0],&numberofdofspernode);681 GetDofList(&doflist); 672 682 673 683 Ke[0][0]=kmax*pow((double)10,penalty_offset); … … 675 685 /*Add Ke to global matrix Kgg: */ 676 686 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES); 687 688 /*Free ressources:*/ 689 xfree((void**)&doflist); 677 690 } 678 691 /*}}}1*/ … … 683 696 const int NDOF1=1; 684 697 const int numdof=numgrids*NDOF1; 685 int doflist[numdof];698 int* doflist=NULL; 686 699 double P_terms[numdof]={0.0}; 687 int numberofdofspernode;688 700 int found=0; 689 701 int dofs1[1]={0}; … … 712 724 713 725 /*Get dof list: */ 714 GetDofList(&doflist [0],&numberofdofspernode);726 GetDofList(&doflist); 715 727 716 728 //First recover pressure and temperature values, using the element: */ … … 751 763 /*Clean up*/ 752 764 xfree((void**)&gauss); 765 xfree((void**)&doflist); 766 753 767 } 754 768 /*}}}1*/ … … 759 773 const int NDOF1=1; 760 774 const int numdof=numgrids*NDOF1; 761 int doflist[numdof];775 int* doflist=NULL; 762 776 double P_terms[numdof]={0.0}; 763 int numberofdofspernode;764 777 int found=0; 765 778 double pressure; … … 784 797 785 798 /*Get dof list: */ 786 GetDofList(&doflist [0],&numberofdofspernode);799 GetDofList(&doflist); 787 800 788 801 //First recover pressure and penalty_offset … … 804 817 /*Clean up*/ 805 818 xfree((void**)&gauss); 819 xfree((void**)&doflist); 820 806 821 } 807 822 /*}}}1*/ -
issm/trunk/src/c/objects/Loads/Pengrid.h
r4575 r5096 70 70 /*Pengrid management {{{1*/ 71 71 void PenaltyCreateKMatrixDiagnosticStokes(Mat Kgg,double kmax); 72 void GetDofList(int* doflist,int* pnumberofdofspernode);72 void GetDofList(int** pdoflist); 73 73 void GetParameterValue(double* pvalue,int enumtype); 74 74 void PenaltyCreateKMatrixThermal(Mat Kgg,double kmax); -
issm/trunk/src/c/objects/Loads/Penpair.cpp
r4887 r5096 257 257 const int NDOF2=2; 258 258 const int numdof=numgrids*NDOF2; 259 int doflist[numdof];259 int* doflist=NULL; 260 260 int numberofdofspernode; 261 261 … … 267 267 268 268 /*Get dof list: */ 269 GetDofList(&doflist [0],&numberofdofspernode);269 GetDofList(&doflist); 270 270 271 271 /*recover pointers: */ … … 288 288 /*Add Ke to global matrix Kgg: */ 289 289 MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES); 290 291 /*Free ressources:*/ 292 xfree((void**)&doflist); 293 290 294 } 291 295 /*}}}1*/ 292 296 /*FUNCTION Penpair::GetDofList {{{1*/ 293 void Penpair::GetDofList(int* doflist,int* pnumberofdofspernode){297 void Penpair::GetDofList(int** pdoflist){ 294 298 295 299 int i,j; 296 int doflist_per_node[MAXDOFSPERNODE]; 297 int numberofdofspernode; 300 int numberofdofs=0; 301 int count=0; 302 303 /*output: */ 304 int* doflist=NULL; 298 305 299 306 /*pointers: */ … … 304 311 305 312 /*Some checks for debugging*/ 306 ISSMASSERT(doflist);307 ISSMASSERT(pnumberofdofspernode);308 313 ISSMASSERT(nodes); 309 314 310 /* Build doflist from nodes*/315 /*First, figure out size of doflist: */ 311 316 for(i=0;i<2;i++){ 312 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 313 for(j=0;j<numberofdofspernode;j++){ 314 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 315 } 317 numberofdofs+=nodes[i]->GetNumberOfDofs(); 316 318 } 317 319 320 /*Allocate: */ 321 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 322 323 /*Populate: */ 324 count=0; 325 for(i=0;i<2;i++){ 326 nodes[i]->GetDofList(doflist+count); 327 count+=nodes[i]->GetNumberOfDofs(); 328 } 329 318 330 /*Assign output pointers:*/ 319 *pnumberofdofspernode=numberofdofspernode; 320 321 } 322 /*}}}*/ 331 *pdoflist=doflist; 332 } 333 /*}}}*/ -
issm/trunk/src/c/objects/Loads/Penpair.h
r4887 r5096 62 62 /*Penpair management: {{{1*/ 63 63 void PenaltyCreateKMatrixDiagnosticHoriz(Mat Kgg,double kmax); 64 void GetDofList(int* doflist,int* pnumberofdofspernode);64 void GetDofList(int** pdoflist); 65 65 /*}}}*/ 66 66 }; -
issm/trunk/src/c/objects/Loads/Riftfront.cpp
r5016 r5096 336 336 double Ke_gg[4][4]; 337 337 const int numdof = 2 *numgrids; 338 int doflist[numdof]; 339 int numberofdofspernode; 338 int* doflist=NULL; 340 339 double thickness; 341 340 double h[2]; … … 362 361 363 362 /* Get node coordinates and dof list: */ 364 GetDofList(&doflist [0],&numberofdofspernode);363 GetDofList(&doflist); 365 364 366 365 /* Set Ke_gg to 0: */ … … 446 445 double pe_g[4]={0.0}; 447 446 const int numdof = 2 *numgrids; 448 int doflist[numdof]; 449 int numberofdofspernode; 447 int* doflist=NULL; 450 448 451 449 double rho_ice; … … 486 484 487 485 /* Get node coordinates and dof list: */ 488 GetDofList(&doflist [0],&numberofdofspernode);486 GetDofList(&doflist); 489 487 490 488 /*Get some inputs: */ … … 564 562 /*The penalty is active. No loads implied here.*/ 565 563 } 564 565 /*Free ressources:*/ 566 xfree((void**)&doflist); 567 566 568 } 567 569 /*}}}1*/ … … 669 671 /*}}}1*/ 670 672 /*FUNCTION Riftfront::GetDofList {{{1*/ 671 672 void Riftfront::GetDofList(int* doflist,int* pnumberofdofspernode){ 673 void Riftfront::GetDofList(int** pdoflist){ 673 674 674 675 int i,j; 675 int doflist_per_node[MAXDOFSPERNODE]; 676 int numberofdofspernode; 677 Node **nodes = NULL; 678 676 int numberofdofs=0; 677 int count=0; 678 679 /*output: */ 680 int* doflist=NULL; 681 682 /*pointers: */ 683 Node** nodes=NULL; 684 685 /*recover pointers: */ 679 686 nodes=(Node**)hnodes->deliverp(); 680 687 688 /*Some checks for debugging*/ 689 ISSMASSERT(nodes); 690 691 /*Figure out size of doflist: */ 681 692 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){ 682 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); 683 for(j=0;j<numberofdofspernode;j++){ 684 doflist[i*numberofdofspernode+j]=doflist_per_node[j]; 685 } 693 numberofdofs+=nodes[i]->GetNumberOfDofs(); 694 } 695 696 /*Allocate: */ 697 doflist=(int*)xmalloc(numberofdofs*sizeof(int)); 698 699 /*Populate: */ 700 count=0; 701 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){ 702 nodes[i]->GetDofList(doflist+count); 703 count+=nodes[i]->GetNumberOfDofs(); 686 704 } 687 705 688 706 /*Assign output pointers:*/ 689 *p numberofdofspernode=numberofdofspernode;690 } 691 /*}}} 1*/707 *pdoflist=doflist; 708 } 709 /*}}}*/ 692 710 /*FUNCTION Riftfront::IsFrozen{{{1*/ 693 711 bool Riftfront::IsFrozen(void){ -
issm/trunk/src/c/objects/Loads/Riftfront.h
r4575 r5096 78 78 /*}}}*/ 79 79 /*Riftfront management: {{{1*/ 80 void GetDofList(int* doflist,int* pnumberofdofs);80 void GetDofList(int** pdoflist); 81 81 bool PreStable(); 82 82 void SetPreStable(); -
issm/trunk/src/c/objects/Node.cpp
r5057 r5096 337 337 /*}}}*/ 338 338 /*FUNCTION Node::GetDofList{{{1*/ 339 void Node::GetDofList(int* outdoflist,int* pnumberofdofspernode){ 340 339 void Node::GetDofList(int* outdoflist){ 341 340 int i; 342 341 for(i=0;i<this->indexing.numberofdofs;i++){ 343 342 outdoflist[i]=indexing.doflist[i]; 344 343 } 345 /*Assign output pointers:*/346 *pnumberofdofspernode=this->indexing.numberofdofs;347 344 } 348 345 /*}}}*/ -
issm/trunk/src/c/objects/Node.h
r5057 r5096 75 75 void CreateVecSets(Vec pv_g,Vec pv_f,Vec pv_s); 76 76 int GetConnectivity(); 77 void GetDofList(int* outdoflist,int* pnumberofdofspernode);77 void GetDofList(int* poutdoflist); 78 78 int GetDofList1(void); 79 79 double GetX(); -
issm/trunk/src/m/solutions/NewFemModel.m
r5057 r5096 24 24 femmodel.results=struct([]); 25 25 26 27 28 29 30 26 %now, go through all analyses types and post-process datasets 27 for i=1:nummodels, 28 29 analysis_type=femmodel.analysis_type_list(i); 30 displaystring(md.verbose,'%s%s',' dealing with analysis type: ',EnumAsString(analysis_type)); 31 31 32 32 femmodel=SetCurrentConfiguration(femmodel,analysis_type); 33 33 34 34 displaystring(md.verbose,'%s',' generating degrees of freedom...'); 35 35 if ~isfield(femmodel,'part'), 36 36 [femmodel.vertices,femmodel.part,femmodel.tpart]=VerticesDof(femmodel.vertices, femmodel.parameters); %do not create partition vector twice! we only have one set of vertices! … … 49 49 displaystring(md.verbose,'%s',' configuring elements and loads...'); 50 50 [femmodel.elements,femmodel.loads,femmodel.nodes,femmodel.parameters] = ConfigureObjects( femmodel.elements, femmodel.loads, femmodel.nodes, femmodel.vertices,femmodel.materials,femmodel.parameters); 51 51 end -
issm/trunk/test/NightlyRun/test101.m
r5006 r5096 4 4 md=setelementstype(md,'macayeal','all'); 5 5 md.cluster='none'; 6 md.verbose=1; 6 7 md=solve(md,'analysis_type',DiagnosticSolutionEnum); 8
Note:
See TracChangeset
for help on using the changeset viewer.