Changeset 5096


Ignore:
Timestamp:
08/09/10 14:48:52 (15 years ago)
Author:
Eric.Larour
Message:

Number of dofs is now allowed to vary per cpu

Location:
issm/trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/ModelProcessorx/ElementsAndVerticesPartitioning.cpp

    r4919 r5096  
    126126        *pmy_vertices=my_vertices;
    127127}
    128 
    129 
  • issm/trunk/src/c/objects/DofIndexing.cpp

    r5057 r5096  
    2424        this->numberofdofs=UNDEF;
    2525        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;
    3329}
    3430/*}}}*/
     
    4541        this->clone=in->clone;
    4642
    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++){
    4848                this->f_set[i]=in->f_set[i];
    4949                this->s_set[i]=in->s_set[i];
     
    6363        this->clone=0;
    6464
    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++){
    6672                /*assume dof is free, no constraints, no rigid body constraint: */
    6773                this->f_set[i]=1;
     
    94100        printf("   set membership: f,s sets \n");
    95101        for(i=0;i<numberofdofs;i++){
    96                 if(i>MAXDOFSPERNODE)break;
    97102                printf("      dof %i: %i %i\n",i,f_set[i],s_set[i]);
    98103        }
     
    101106        printf("   doflist: |");
    102107        for(i=0;i<numberofdofs;i++){
    103                 if(i>MAXDOFSPERNODE)break;
    104108                printf(" %i |",doflist[i]);
    105109        }
     
    122126        memcpy(&numberofdofs,marshalled_dataset,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs);
    123127        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);
    127137       
    128138        /*return: */
     
    149159        memcpy(marshalled_dataset,&numberofdofs,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs);
    150160        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);
    154164
    155165        *pmarshalled_dataset=marshalled_dataset;
     
    162172        return sizeof(numberofdofs)+
    163173                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)+
    167177                sizeof(int); //sizeof(int) for enum type
    168178}
  • issm/trunk/src/c/objects/DofIndexing.h

    r5057 r5096  
    66#define  _DOFINDEXING_H_
    77
    8 #define MAXDOFSPERNODE 4
    9 
    108class DofIndexing{
    119       
    1210        public:
    1311
    14                 int numberofdofs; //number of dofs for a node.
     12                int numberofdofs; //number of dofs for a node, variable
    1513
    1614                /*partitioning: */
     
    1816
    1917                /*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
    2220
    2321                /*list of degrees of freedom: */
    24                 int     doflist[MAXDOFSPERNODE]; //dof list on which we solve
     22                int*     doflist; //dof list on which we solve
    2523
    2624                /*DofIndexing constructors, destructors {{{1*/
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r5075 r5096  
    20482048        const int    numdof=2*numgrids;
    20492049        double       xyz_list[numgrids][3];
    2050         int          doflist[numdof];
    2051         int          numberofdofspernode;
     2050        int*         doflist=NULL;
    20522051
    20532052        /* 3d gaussian points: */
     
    21722171                /* Get node coordinates and dof list: */
    21732172                GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2174                 GetDofList(&doflist[0],&numberofdofspernode);
     2173                GetDofList(&doflist);
    21752174
    21762175                /*Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore
     
    22742273        xfree((void**)&third_gauss_area_coord2d);
    22752274        xfree((void**)&gauss_weights2d);
    2276 
     2275        xfree((void**)&doflist);
    22772276}
    22782277/*}}}*/
     
    22852284        const int NDOF2=2;
    22862285        const int numdofs=NDOF2*numgrids;
    2287         int       doflist[numdofs];
     2286        int*      doflist=NULL;
    22882287        double    Ke_gg[numdofs][numdofs]={0.0};
    2289         int       numberofdofspernode;
    22902288        bool      onbed;
    22912289        bool      onsurface;
     
    23062304        inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
    23072305
    2308         GetDofList(&doflist[0],&numberofdofspernode);
     2306        GetDofList(&doflist);
    23092307
    23102308        /*Spawn 3 beam elements: */
     
    23572355        MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES);
    23582356
     2357        /*Free ressources:*/
     2358        xfree((void**)&doflist);
     2359
    23592360}
    23602361/*}}}*/
     
    23672368        const int DOFPERGRID=4;
    23682369        const int numdof=numgrids*DOFPERGRID;
    2369         int doflist[numdof];
    2370         int numberofdofspernode;
     2370        int*      doflist=NULL;
    23712371
    23722372        const int numgrids2d=3;
     
    24692469        /* Get node coordinates and dof list: */
    24702470        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2471         GetDofList(&doflist[0],&numberofdofspernode);
     2471        GetDofList(&doflist);
    24722472
    24732473        /* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore
     
    26362636        xfree((void**)&vert_gauss_coord);
    26372637        xfree((void**)&vert_gauss_weights);
     2638        xfree((void**)&doflist);
    26382639
    26392640        return;
     
    26512652        const int    numdof=NDOF1*numgrids;
    26522653        double       xyz_list[numgrids][3];
    2653         int          doflist[numdof];
    2654         int          numberofdofspernode;
     2654        int*         doflist=NULL;
    26552655
    26562656        /* 3d gaussian points: */
     
    27042704        /* Get node coordinates and dof list: */
    27052705        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2706         GetDofList(&doflist[0],&numberofdofspernode);
     2706        GetDofList(&doflist);
    27072707
    27082708        /*Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore
     
    27632763        xfree((void**)&area_gauss_weights);
    27642764        xfree((void**)&vert_gauss_weights);
     2765        xfree((void**)&doflist);
    27652766}
    27662767/*}}}*/
     
    28702871        const int    NDOF1=1;
    28712872        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;
    28752875
    28762876        /* gaussian points: */
     
    29472947        /* Get node coordinates and dof list: */
    29482948        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2949         GetDofList(&doflist[0],&numberofdofspernode);
     2949        GetDofList(&doflist);
    29502950
    29512951        // /*recovre material parameters: */
     
    30883088        MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)K_terms,ADD_VALUES);
    30893089
     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:*/
    30903099        xfree((void**)&first_gauss_area_coord);
    30913100        xfree((void**)&second_gauss_area_coord);
     
    30943103        xfree((void**)&vert_gauss_weights);
    30953104        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
    31043107}
    31053108/*}}}*/
     
    31863189        const int    numdof=NDOF2*numgrids;
    31873190        double       xyz_list[numgrids][3];
    3188         int          doflist[numdof];
    3189         int          numberofdofspernode;
     3191        int*         doflist=NULL;
    31903192
    31913193        /* parameters: */
     
    32623264                /* Get node coordinates and dof list: */
    32633265                GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3264                 GetDofList(&doflist[0],&numberofdofspernode);
     3266                GetDofList(&doflist);
    32653267
    32663268                /*Get gaussian points and weights :*/
     
    33273329        xfree((void**)&area_gauss_weights);
    33283330        xfree((void**)&vert_gauss_weights);
    3329 
     3331        xfree((void**)&doflist);
    33303332}
    33313333/*}}}*/
     
    33833385        const int NDOF2=2;
    33843386        const int numdofs=NDOF2*numgrids;
    3385         int       doflist[numdofs];
    3386         int       numberofdofspernode;
     3387        int*      doflist=NULL;
    33873388        double    pe_g[numdofs]={0.0};
    33883389        double    xyz_list[numgrids][3];
     
    34283429
    34293430        /*recover doflist: */
    3430         GetDofList(&doflist[0],&numberofdofspernode);
     3431        GetDofList(&doflist);
    34313432
    34323433        /*recover some inputs: */
     
    35233524        xfree((void**)&gauss_weights);
    35243525        xfree((void**)&segment_gauss_coord);
     3526        xfree((void**)&doflist);
    35253527}
    35263528/*}}}*/
     
    35353537        const int numdof=numgrids*DOFPERGRID;
    35363538        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;
    35403541
    35413542        /*Material properties: */
     
    36273628        /* Get node coordinates and dof list: */
    36283629        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3629         GetDofList(&doflist[0],&numberofdofspernode);
     3630        GetDofList(&doflist);
    36303631
    36313632        /* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore
     
    37773778        xfree((void**)&area_gauss_weights);
    37783779        xfree((void**)&vert_gauss_coord);
    3779         xfree((void**)&vert_gauss_weights);
     3780        xfree((void**)&vert_gauss_weights);
     3781        xfree((void**)&doflist);
    37803782
    37813783}
     
    38153817        const int    numdof=NDOF1*numgrids;
    38163818        double       xyz_list[numgrids][3];
    3817         int          doflist[numdof];
    3818         int          numberofdofspernode;
     3819        int*         doflist=NULL;
    38193820
    38203821        /* gaussian points: */
     
    38763877        /* Get node coordinates and dof list: */
    38773878        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3878         GetDofList(&doflist[0],&numberofdofspernode);
     3879        GetDofList(&doflist);
    38793880
    38803881        /*Get gaussian points and weights :*/
     
    39353936        xfree((void**)&area_gauss_weights);
    39363937        xfree((void**)&vert_gauss_weights);
     3938        xfree((void**)&doflist);
    39373939}
    39383940/*}}}*/
     
    40154017        const int  NDOF1=1;
    40164018        const int  numdof=numgrids*NDOF1;
    4017         int        doflist[numdof];
    4018         int        numberofdofspernode;
     4019        int*       doflist=NULL;
    40194020
    40204021        /*Grid data: */
     
    40964097        /* Get node coordinates and dof list: */
    40974098        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    4098         GetDofList(&doflist[0],&numberofdofspernode);
     4099        GetDofList(&doflist);
    40994100
    41004101        /*recovre material parameters: */
     
    41914192        xfree((void**)&area_gauss_weights);
    41924193        xfree((void**)&vert_gauss_weights);
     4194        xfree((void**)&doflist);
    41934195
    41944196}
     
    42344236/*}}}*/
    42354237/*FUNCTION Penta::GetDofList {{{1*/
    4236 void  Penta::GetDofList(int* doflist,int* pnumberofdofspernode){
     4238void  Penta::GetDofList(int** pdoflist){
    42374239
    42384240        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: */
    42424248        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();
    42474260        }
    42484261
    42494262        /*Assign output pointers:*/
    4250         *pnumberofdofspernode=numberofdofspernode;
     4263        *pdoflist=doflist;
    42514264
    42524265}
     
    44404453        const int    numdof=numdofpervertex*numvertices;
    44414454        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;
    44444456        double       values[numdof];
    44454457        double       vx;
    44464458        double       vy;
    44474459
    4448         int          dummy;
    4449 
    44504460        /*Get dof list: */
    4451         GetDofList(&doflist[0],&dummy);
     4461        GetDofList(&doflist);
    44524462
    44534463        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     
    44654475        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
    44664476
     4477        /*Free ressources:*/
     4478        xfree((void**)&doflist);
    44674479}
    44684480/*}}}*/
     
    44764488        const int    numdof=numdofpervertex*numvertices;
    44774489        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;
    44804491        double       values[numdof];
    44814492        double       vx;
    44824493        double       vy;
    44834494
    4484         int          dummy;
    4485 
    44864495        /*Get dof list: */
    4487         GetDofList(&doflist[0],&dummy);
     4496        GetDofList(&doflist);
    44884497
    44894498        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     
    45014510        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
    45024511
     4512        /*Free ressources:*/
     4513        xfree((void**)&doflist);
    45034514}
    45044515/*}}}*/
     
    45124523        const int    numdof=numdofpervertex*numvertices;
    45134524        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;
    45164526        double       values[numdof];
    45174527        double       vz;
    45184528
    4519         int          dummy;
    4520 
    45214529        /*Get dof list: */
    4522         GetDofList(&doflist[0],&dummy);
     4530        GetDofList(&doflist);
    45234531
    45244532        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     
    45334541        /*Add value to global vector*/
    45344542        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
     4543
     4544        /*Free ressources:*/
     4545        xfree((void**)&doflist);
    45354546}
    45364547/*}}}*/
     
    45444555        const int    numdof=numdofpervertex*numvertices;
    45454556        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;
    45484558        double       values[numdof];
    45494559        double       vx,vy,vz,p;
    4550 
    4551         int          dummy;
    45524560        double       stokesreconditioning;
    45534561
    45544562        /*Get dof list: */
    4555         GetDofList(&doflist[0],&dummy);
     4563        GetDofList(&doflist);
    45564564
    45574565        /*Recondition pressure: */
     
    45764584        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
    45774585
     4586        /*Free ressources:*/
     4587        xfree((void**)&doflist);
    45784588}
    45794589/*}}}*/
     
    45874597        const int    numdof=numdofpervertex*numvertices;
    45884598        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;
    45914600        double       values[numdof];
    45924601        double       vz;
    45934602
    4594         int          dummy;
    45954603
    45964604        /*Get dof list: */
    4597         GetDofList(&doflist[0],&dummy);
     4605        GetDofList(&doflist);
    45984606
    45994607        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     
    46084616        /*Add value to global vector*/
    46094617        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
     4618       
     4619        /*Free ressources:*/
     4620        xfree((void**)&doflist);
    46104621}
    46114622/*}}}*/
     
    49074918        const int    numdofpervertex=2;
    49084919        const int    numdof=numdofpervertex*numvertices;
    4909 
    4910         int          doflist[numdof];
     4920        int*         doflist=NULL;
    49114921        double       values[numdof];
    49124922        double       vx[numvertices];
     
    49284938
    49294939        /*Get dof list: */
    4930         GetDofList(&doflist[0],&dummy);
     4940        GetDofList(&doflist);
    49314941
    49324942        /*Use the dof list to index into the solution vector: */
     
    49884998                penta=penta->GetUpperElement(); ISSMASSERT(penta->Id()!=this->id);
    49894999        }
     5000       
     5001        /*Free ressources:*/
     5002        xfree((void**)&doflist);
    49905003}
    49915004/*}}}*/
     
    49985011        const int    numdofpervertex=2;
    49995012        const int    numdof=numdofpervertex*numvertices;
    5000        
    5001         int          doflist[numdof];
     5013        int*         doflist=NULL;
    50025014        double       values[numdof];
    50035015        double       vx[numvertices];
     
    50165028
    50175029        /*Get dof list: */
    5018         GetDofList(&doflist[0],&dummy);
     5030        GetDofList(&doflist);
    50195031
    50205032        /*Get node data: */
     
    50685080        this->inputs->AddInput(new PentaVertexInput(VelEnum,vel));
    50695081        this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure));
     5082
     5083        /*Free ressources:*/
     5084        xfree((void**)&doflist);
    50705085}
    50715086
     
    50795094        const int    numdofpervertex=2;
    50805095        const int    numdof=numdofpervertex*numvertices;
    5081        
    5082         int          doflist[numdof];
     5096        int*         doflist=NULL;
    50835097        double       values[numdof];
    50845098        double       vx[numvertices];
     
    50975111
    50985112        /*Get dof list: */
    5099         GetDofList(&doflist[0],&dummy);
     5113        GetDofList(&doflist);
    51005114
    51015115        /*Get node data: */
     
    51495163        this->inputs->AddInput(new TriaVertexInput(VelEnum,vel));
    51505164        this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure));
     5165
     5166        /*Free ressources:*/
     5167        xfree((void**)&doflist);
    51515168}
    51525169
     
    51605177        const int    numdofpervertex=1;
    51615178        const int    numdof=numdofpervertex*numvertices;
    5162 
    5163         int          doflist[numdof];
     5179        int*         doflist=NULL;
    51645180        double       values[numdof];
    51655181        double       vx[numvertices];
     
    51805196
    51815197        /*Get dof list: */
    5182         GetDofList(&doflist[0],&dummy);
     5198        GetDofList(&doflist);
    51835199
    51845200        /*Get node data: */
     
    52335249        this->inputs->AddInput(new PentaVertexInput(VelEnum,vel));
    52345250        this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure));
    5235 } /*}}}*/
     5251
     5252        /*Free ressources:*/
     5253        xfree((void**)&doflist);
     5254}
     5255/*}}}*/
    52365256/*FUNCTION Penta::InputUpdateFromSolutionDiagnosticStokes {{{1*/
    52375257void  Penta::InputUpdateFromSolutionDiagnosticStokes(double* solution){
     
    52425262        const int    numdofpervertex=4;
    52435263        const int    numdof=numdofpervertex*numvertices;
    5244        
    5245         int          doflist[numdof];
     5264        int*         doflist=NULL;
    52465265        double       values[numdof];
    52475266        double       vx[numvertices];
     
    52505269        double       vel[numvertices];
    52515270        double       pressure[numvertices];
    5252         int          dummy;
    52535271        double       stokesreconditioning;
    52545272
    52555273        /*Get dof list: */
    5256         GetDofList(&doflist[0],&dummy);
     5274        GetDofList(&doflist);
    52575275
    52585276        /*Use the dof list to index into the solution vector: */
     
    52915309        this->inputs->AddInput(new PentaVertexInput(VelEnum,vel));
    52925310        this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure));
     5311
     5312        /*Free ressources:*/
     5313        xfree((void**)&doflist);
    52935314}
    52945315
     
    53025323        const int    numdofpervertex=4;
    53035324        const int    numdof=numdofpervertex*numvertices;
    5304 
    5305         int          doflist[numdof];
     5325        int*         doflist=NULL;
    53065326        double       values[numdof];
    53075327        double       lambdax[numvertices];
     
    53105330        double       lambdap[numvertices];
    53115331
    5312         int          dummy;
    5313 
    53145332        /*Get dof list: */
    5315         GetDofList(&doflist[0],&dummy);
     5333        GetDofList(&doflist);
    53165334
    53175335        /*Use the dof list to index into the solution vector: */
     
    53345352        this->inputs->AddInput(new PentaVertexInput(AdjointpEnum,lambdap));
    53355353
     5354        /*Free ressources:*/
     5355        xfree((void**)&doflist);
    53365356}
    53375357/*}}}*/
     
    53445364        const int    numdofpervertex=2;
    53455365        const int    numdof=numdofpervertex*numvertices;
    5346 
    5347         int          doflist[numdof];
     5366        int*         doflist=NULL;
    53485367        double       values[numdof];
    53495368        double       lambdax[numvertices];
    53505369        double       lambday[numvertices];
    53515370
    5352         int          dummy;
    5353 
    53545371        /*Get dof list: */
    5355         GetDofList(&doflist[0],&dummy);
     5372        GetDofList(&doflist);
    53565373
    53575374        /*Use the dof list to index into the solution vector: */
     
    53705387        this->inputs->AddInput(new PentaVertexInput(AdjointyEnum,lambday));
    53715388
     5389        /*Free ressources:*/
     5390        xfree((void**)&doflist);
    53725391}
    53735392/*}}}*/
     
    53805399        const int    numdofpervertex=1;
    53815400        const int    numdof=numdofpervertex*numvertices;
    5382 
    5383         int          doflist[numdof];
     5401        int*         doflist=NULL;
    53845402        double       values[numdof];
    53855403        double       B[numdof];
    53865404        double       B_average;
    53875405
    5388         int          dummy;
    5389 
    53905406        /*Get dof list: */
    5391         GetDofList(&doflist[0],&dummy);
     5407        GetDofList(&doflist);
    53925408
    53935409        /*Use the dof list to index into the solution vector: */
     
    54075423        this->matice->inputs->AddInput(new PentaVertexInput(RheologyBEnum,B));
    54085424
     5425        /*Free ressources:*/
     5426        xfree((void**)&doflist);
    54095427}
    54105428/*}}}*/
     
    54155433        const int numdofpervertex = 1;
    54165434        const int numdof          = numdofpervertex *numvertices;
    5417         int       doflist[numdof];
     5435        int*         doflist=NULL;
    54185436        double    values[numdof];
    5419         int       dummy;
    54205437
    54215438        /*Get dof list: */
    5422         GetDofList(&doflist[0],&dummy);
     5439        GetDofList(&doflist);
    54235440
    54245441        /*Use the dof list to index into the solution vector: */
     
    54295446        /*Add input to the element: */
    54305447        this->inputs->AddInput(new PentaVertexInput(enum_type,values));
     5448       
     5449        /*Free ressources:*/
     5450        xfree((void**)&doflist);
    54315451}
    54325452/*}}}*/
     
    54385458        const int  numdof          = numdofpervertex *numvertices;
    54395459        const int  numdof2d        = numdof/2;
    5440         int        doflist[numdof];
     5460        int*         doflist=NULL;
    54415461        double     values[numdof];
    5442         int        dummy;
    54435462        Penta     *penta           = NULL;
    54445463        bool       onbed;
     
    54515470
    54525471        /*Get dof list: */
    5453         GetDofList(&doflist[0],&dummy);
     5472        GetDofList(&doflist);
    54545473
    54555474        /*Use the dof list to index into the solution vector and extrude it */
     
    54725491                penta=penta->GetUpperElement(); ISSMASSERT(penta->Id()!=this->id);
    54735492        }
     5493       
     5494        /*Free ressources:*/
     5495        xfree((void**)&doflist);
    54745496}
    54755497/*}}}*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r4995 r5096  
    135135                void      CreatePVectorSlope( Vec pg);
    136136                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);
    139139                void      GetDofList1(int* doflist);
    140                 int     GetElementType(void);
     140                int       GetElementType(void);
    141141                void      GetNodalFunctions(double* l1l6, double* gauss_coord);
    142142                void      GetNodalFunctionsDerivatives(double* dh1dh6,double* xyz_list, double* gauss_coord);
     
    145145                void      GetNodalFunctionsDerivativesStokes(double* dh1dh7,double* xyz_list, double* gauss_coord);
    146146                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);
    149149                void      GetPhi(double* phi, double*  epsilon, double viscosity);
    150150                void      GetSolutionFromInputsDiagnosticHoriz(Vec solutiong);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r5038 r5096  
    13841384        const int    numgrids=3;
    13851385        const int    numdofs=2;
    1386         int          numberofdofspernode;
    13871386        double mass_flux=0;
    13881387        double xyz_list[numgrids][3];
     
    23282327        const int    numdof=NDOF1*numgrids;
    23292328        double       xyz_list[numgrids][3];
    2330         int          doflist[numdof];
    2331         int          numberofdofspernode;
     2329        int*         doflist=NULL;
    23322330
    23332331        /* gaussian points: */
     
    23742372        /* Get node coordinates and dof list: */
    23752373        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2376         GetDofList(&doflist[0],&numberofdofspernode);
     2374        GetDofList(&doflist);
    23772375
    23782376        /*retrieve some parameters: */
     
    24822480        xfree((void**)&third_gauss_area_coord);
    24832481        xfree((void**)&gauss_weights);
    2484 
     2482        xfree((void**)&doflist);
    24852483}
    24862484/*}}}*/
     
    24962494        const int    numdof=NDOF1*numgrids;
    24972495        double       xyz_list[numgrids][3];
    2498         int          doflist[numdof];
    2499         int          numberofdofspernode;
     2496        int*         doflist=NULL;
    25002497
    25012498        /* gaussian points: */
     
    25302527        /* Get node coordinates and dof list: */
    25312528        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2532         GetDofList(&doflist[0],&numberofdofspernode);
     2529        GetDofList(&doflist);
    25332530        this->parameters->FindParam(&dim,DimEnum);
    25342531
     
    25852582        xfree((void**)&third_gauss_area_coord);
    25862583        xfree((void**)&gauss_weights);
    2587 
     2584        xfree((void**)&doflist);
    25882585}
    25892586/*}}}*/
     
    25992596        const int    numdof=NDOF1*numgrids;
    26002597        double       xyz_list[numgrids][3];
    2601         int          doflist[numdof];
    2602         int          numberofdofspernode;
     2598        int*         doflist=NULL;
    26032599        double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
    26042600
     
    26522648        /* Get node coordinates and dof list: */
    26532649        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2654         GetDofList(&doflist[0],&numberofdofspernode);
     2650        GetDofList(&doflist);
    26552651
    26562652        /*Retrieve all inputs we will be needed*/
     
    27672763        xfree((void**)&third_gauss_area_coord);
    27682764        xfree((void**)&gauss_weights);
     2765        xfree((void**)&doflist);
    27692766}
    27702767/*}}}*/
     
    27792776        const int    numdof=2*numgrids;
    27802777        double       xyz_list[numgrids][3];
    2781         int          doflist[numdof];
    2782         int          numberofdofspernode;
     2778        int*         doflist=NULL;
    27832779
    27842780        /* gaussian points: */
     
    28392835        /* Get node coordinates and dof list: */
    28402836        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    2841         GetDofList(&doflist[0],&numberofdofspernode);
     2837        GetDofList(&doflist);
    28422838
    28432839        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    29102906        xfree((void**)&third_gauss_area_coord);
    29112907        xfree((void**)&gauss_weights);
    2912 
     2908        xfree((void**)&doflist);
    29132909}
    29142910/*}}}*/
     
    29242920        const int numdof   = 2 *numvertices;
    29252921        double    xyz_list[numvertices][3];
    2926         int       doflist[numdof];
    2927         int       numberofdofspernode;
     2922        int*      doflist=NULL;
     2923        int       numberofdofspernode=2;
    29282924
    29292925        /* gaussian points: */
     
    29812977        /* Get node coordinates and dof list: */
    29822978        GetVerticesCoordinates(&xyz_list[0][0], nodes, numvertices);
    2983         GetDofList(&doflist[0],&numberofdofspernode);
     2979        GetDofList(&doflist);
    29842980
    29852981        if (shelf){
     
    30503046        xfree((void**)&third_gauss_area_coord);
    30513047        xfree((void**)&gauss_weights);
     3048        xfree((void**)&doflist);
    30523049        delete friction;
    3053 
    30543050}       
    30553051/*}}}*/
     
    30633059        const int NDOF2=2;
    30643060        const int numdofs=numgrids*NDOF2;
    3065         int    doflist[numdofs];
    3066         int    numberofdofspernode;
     3061        int*         doflist=NULL;
    30673062
    30683063        double Ke_gg[numdofs][numdofs]={0.0};
     
    30773072        if(onwater)return;
    30783073
    3079         GetDofList(&doflist[0],&numberofdofspernode);
     3074        GetDofList(&doflist);
    30803075
    30813076        /*Spawn 3 sing elements: */
     
    30883083        MatSetValues(Kgg,numdofs,doflist,numdofs,doflist,(const double*)Ke_gg,ADD_VALUES);
    30893084
     3085        /*Free ressources:*/
     3086        xfree((void**)&doflist);
    30903087}
    30913088/*}}}*/
     
    31003097        const int    numdof=NDOF1*numgrids;
    31013098        double       xyz_list[numgrids][3];
    3102         int          doflist[numdof];
    3103         int          numberofdofspernode;
     3099        int*         doflist=NULL;
    31043100
    31053101        /* gaussian points: */
     
    31343130        /* Get node coordinates and dof list: */
    31353131        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3136         GetDofList(&doflist[0],&numberofdofspernode);
     3132        GetDofList(&doflist);
    31373133
    31383134        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    32053201        xfree((void**)&third_gauss_area_coord);
    32063202        xfree((void**)&gauss_weights);
     3203        xfree((void**)&doflist);
    32073204}
    32083205/*}}}*/
     
    32163213        const int  NDOF1=1;
    32173214        const int  numdof=numgrids*NDOF1;
    3218         int        doflist[numdof];
    3219         int        numberofdofspernode;
     3215        int*       doflist=NULL;
    32203216
    32213217        /*Grid data: */
     
    32483244        /* Get node coordinates and dof list: */
    32493245        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3250         GetDofList(&doflist[0],&numberofdofspernode);
     3246        GetDofList(&doflist);
    32513247
    32523248        /* Get gaussian points and weights: */
     
    32873283        xfree((void**)&third_gauss_area_coord);
    32883284        xfree((void**)&gauss_weights);
    3289 
     3285        xfree((void**)&doflist);
    32903286}
    32913287/*}}}*/
     
    33013297        const int    numdof=NDOF1*numgrids;
    33023298        double       xyz_list[numgrids][3];
    3303         int          doflist[numdof];
    3304         int          numberofdofspernode;
     3299        int*         doflist=NULL;
     3300        int          numberofdofspernode=1;
    33053301
    33063302        /* gaussian points: */
     
    33513347        /* Get node coordinates and dof list: */
    33523348        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3353         GetDofList(&doflist[0],&numberofdofspernode);
     3349        GetDofList(&doflist);
    33543350
    33553351        /*Retrieve all inputs we will be needing: */
     
    34693465        xfree((void**)&third_gauss_area_coord);
    34703466        xfree((void**)&gauss_weights);
    3471 
     3467        xfree((void**)&doflist);
    34723468}
    34733469/*}}}*/
     
    34833479        const int    numdof=NDOF1*numgrids;
    34843480        double       xyz_list[numgrids][3];
    3485         int          doflist[numdof];
    3486         int          numberofdofspernode;
     3481        int*         doflist=NULL;
     3482        int          numberofdofspernode=1;
    34873483
    34883484        /* gaussian points: */
     
    35243520        /* Get node coordinates and dof list: */
    35253521        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3526         GetDofList(&doflist[0],&numberofdofspernode);
     3522        GetDofList(&doflist);
    35273523
    35283524        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    35953591        xfree((void**)&third_gauss_area_coord);
    35963592        xfree((void**)&gauss_weights);
    3597 
     3593        xfree((void**)&doflist);
    35983594}
    35993595/*}}}*/
     
    36093605        const int    numdof=NDOF1*numgrids;
    36103606        double       xyz_list[numgrids][3];
    3611         int          doflist[numdof];
    3612         int          numberofdofspernode;
     3607        int*         doflist=NULL;
    36133608       
    36143609        /* gaussian points: */
     
    36333628        /* Get node coordinates and dof list: */
    36343629        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3635         GetDofList(&doflist[0],&numberofdofspernode);
     3630        GetDofList(&doflist);
    36363631
    36373632        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    36723667        xfree((void**)&third_gauss_area_coord);
    36733668        xfree((void**)&gauss_weights);
     3669        xfree((void**)&doflist);
    36743670}
    36753671/*}}}*/
     
    36853681        const int    numdof=NDOF1*numgrids;
    36863682        double       xyz_list[numgrids][3];
    3687         int          doflist[numdof];
    3688         int          numberofdofspernode;
     3683        int*         doflist=NULL;
    36893684
    36903685        double mixed_layer_capacity;
     
    37183713        /* Get node coordinates and dof list: */
    37193714        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3720         GetDofList(&doflist[0],&numberofdofspernode);
     3715        GetDofList(&doflist);
    37213716
    37223717        //recover material parameters
     
    37663761        xfree((void**)&third_gauss_area_coord);
    37673762        xfree((void**)&gauss_weights);
    3768 
     3763        xfree((void**)&doflist);
    37693764}
    37703765/*}}}*/
     
    37803775        const int    numdof=NDOF1*numgrids;
    37813776        double       xyz_list[numgrids][3];
    3782         int          doflist[numdof];
    3783         int          numberofdofspernode;
     3777        int*         doflist=NULL;
     3778        int          numberofdofspernode=1;
    37843779
    37853780        /* gaussian points: */
     
    38073802        /* Get node coordinates and dof list: */
    38083803        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3809         GetDofList(&doflist[0],&numberofdofspernode);
     3804        GetDofList(&doflist);
    38103805
    38113806        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    38463841        xfree((void**)&third_gauss_area_coord);
    38473842        xfree((void**)&gauss_weights);
     3843        xfree((void**)&doflist);
    38483844}
    38493845/*}}}*/
     
    38593855        const int    numdof=NDOF1*numgrids;
    38603856        double       xyz_list[numgrids][3];
    3861         int          doflist[numdof];
    3862         int          numberofdofspernode;
     3857        int*         doflist=NULL;
     3858        int          numberofdofspernode=1;
    38633859
    38643860        /* gaussian points: */
     
    38883884        /* Get node coordinates and dof list: */
    38893885        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3890         GetDofList(&doflist[0],&numberofdofspernode);
     3886        GetDofList(&doflist);
    38913887
    38923888        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    39293925        xfree((void**)&third_gauss_area_coord);
    39303926        xfree((void**)&gauss_weights);
     3927        xfree((void**)&doflist);
    39313928}
    39323929/*}}}*/
     
    39423939        const int    numdof=NDOF1*numgrids;
    39433940        double       xyz_list[numgrids][3];
    3944         int          doflist[numdof];
    3945         int          numberofdofspernode;
     3941        int*         doflist=NULL;
     3942        int          numberofdofspernode=1;
    39463943
    39473944        /* gaussian points: */
     
    39693966        /* Get node coordinates and dof list: */
    39703967        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    3971         GetDofList(&doflist[0],&numberofdofspernode);
     3968        GetDofList(&doflist);
    39723969
    39733970        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    40044001        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    40054002
     4003        /*Free ressources:*/
    40064004        xfree((void**)&first_gauss_area_coord);
    40074005        xfree((void**)&second_gauss_area_coord);
    40084006        xfree((void**)&third_gauss_area_coord);
    40094007        xfree((void**)&gauss_weights);
    4010 
     4008        xfree((void**)&doflist);
    40114009}
    40124010/*}}}*/
     
    40214019        const int    numdof=NDOF1*numgrids;
    40224020        double       xyz_list[numgrids][3];
    4023         int          doflist[numdof];
    4024         int          numberofdofspernode;
     4021        int*         doflist=NULL;
    40254022
    40264023        /* gaussian points: */
     
    40604057        /* Get node coordinates and dof list: */
    40614058        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    4062         GetDofList(&doflist[0],&numberofdofspernode);
     4059        GetDofList(&doflist);
    40634060
    40644061        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    41124109        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    41134110
     4111        /*Free ressources:*/
    41144112        xfree((void**)&first_gauss_area_coord);
    41154113        xfree((void**)&second_gauss_area_coord);
    41164114        xfree((void**)&third_gauss_area_coord);
    41174115        xfree((void**)&gauss_weights);
    4118 
     4116        xfree((void**)&doflist);
    41194117}
    41204118/*}}}*/
     
    41294127        const int    NDOF2=2;
    41304128        double       xyz_list[numgrids][3];
    4131         int          doflist[numdof];
    4132         int          numberofdofspernode;
     4129        int*         doflist=NULL;
    41334130       
    41344131        /* parameters: */
     
    41784175        /* Get node coordinates and dof list: */
    41794176        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    4180         GetDofList(&doflist[0],&numberofdofspernode);
     4177        GetDofList(&doflist);
    41814178
    41824179
     
    42354232        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    42364233
     4234        /*Free ressources:*/
    42374235        xfree((void**)&first_gauss_area_coord);
    42384236        xfree((void**)&second_gauss_area_coord);
    42394237        xfree((void**)&third_gauss_area_coord);
    42404238        xfree((void**)&gauss_weights);
    4241 
     4239        xfree((void**)&doflist);
    42424240}
    42434241/*}}}*/
     
    42524250        const int    NDOF2=2;
    42534251        double       xyz_list[numgrids][3];
    4254         int          doflist[numdof];
    4255         int          numberofdofspernode;
     4252        int*         doflist=NULL;
    42564253        double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
    42574254
     
    43024299        /* Get node coordinates and dof list: */
    43034300        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    4304         GetDofList(&doflist[0],&numberofdofspernode);
     4301        GetDofList(&doflist);
    43054302
    43064303        /* Recover input data: */
     
    44744471        VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    44754472
    4476         /*Clean up*/
     4473        /*Free ressources:*/
    44774474        xfree((void**)&first_gauss_area_coord);
    44784475        xfree((void**)&second_gauss_area_coord);
    44794476        xfree((void**)&third_gauss_area_coord);
    44804477        xfree((void**)&gauss_weights);
    4481 
     4478        xfree((void**)&doflist);
    44824479}
    44834480/*}}}*/
     
    44924489        const int    numdof=NDOF4*numgrids;
    44934490        double       xyz_list[numgrids][3];
    4494         int          doflist[numdof];
    4495         int          numberofdofspernode;
     4491        int*         doflist=NULL;
    44964492        double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
    44974493
     
    45414537        /* Get node coordinates and dof list: */
    45424538        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    4543         GetDofList(&doflist[0],&numberofdofspernode);
    4544         ISSMASSERT(numberofdofspernode==4);
     4539        GetDofList(&doflist);
    45454540
    45464541        /* Recover input data: */
     
    47094704        VecSetValues(p_g,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    47104705
    4711         /*Clean up*/
     4706        /*Free ressources:*/
    47124707        xfree((void**)&first_gauss_area_coord);
    47134708        xfree((void**)&second_gauss_area_coord);
    47144709        xfree((void**)&third_gauss_area_coord);
    47154710        xfree((void**)&gauss_weights);
    4716 
     4711        xfree((void**)&doflist);
    47174712}
    47184713/*}}}*/
     
    47254720        const int NDOF2=2;
    47264721        const int numdofs=NDOF2*numgrids;
    4727         int       doflist[numdofs];
    4728         int       numberofdofspernode;
     4722        int*         doflist=NULL;
    47294723        double    constant_part,ub,vb;
    47304724        double    rho_ice,gravity,n,B;
     
    47484742        if(onwater)return;
    47494743
    4750         GetDofList(&doflist[0],&numberofdofspernode);
     4744        GetDofList(&doflist);
    47514745       
    47524746        /* Get parameters */
     
    47834777
    47844778        VecSetValues(pg,numdofs,doflist,(const double*)pe_g,ADD_VALUES);
     4779       
     4780        /*Free ressources:*/
     4781        xfree((void**)&doflist);
    47854782}
    47864783/*}}}*/
     
    47974794        const int    numdof=NDOF1*numgrids;
    47984795        double       xyz_list[numgrids][3];
    4799         int          doflist[numdof];
    4800         int          numberofdofspernode;
     4796        int*         doflist=NULL;
     4797        int          numberofdofspernode=1;
    48014798
    48024799        /* gaussian points: */
     
    48304827        /* Get node coordinates and dof list: */
    48314828        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    4832         GetDofList(&doflist[0],&numberofdofspernode);
     4829        GetDofList(&doflist);
    48334830
    48344831        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    48674864        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    48684865
     4866        /*Free ressources:*/
    48694867        xfree((void**)&first_gauss_area_coord);
    48704868        xfree((void**)&second_gauss_area_coord);
    48714869        xfree((void**)&third_gauss_area_coord);
    48724870        xfree((void**)&gauss_weights);
     4871        xfree((void**)&doflist);
    48734872
    48744873}
     
    48854884        const int    numdof=NDOF1*numgrids;
    48864885        double       xyz_list[numgrids][3];
    4887         int          doflist[numdof];
    4888         int          numberofdofspernode;
     4886        int*         doflist=NULL;
     4887        int          numberofdofspernode=1;
    48894888
    48904889        /* gaussian points: */
     
    49164915        /* Get node coordinates and dof list: */
    49174916        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    4918         GetDofList(&doflist[0],&numberofdofspernode);
     4917        GetDofList(&doflist);
    49194918
    49204919        /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
     
    49534952        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    49544953
     4954        /*Free ressources:*/
    49554955        xfree((void**)&first_gauss_area_coord);
    49564956        xfree((void**)&second_gauss_area_coord);
    49574957        xfree((void**)&third_gauss_area_coord);
    49584958        xfree((void**)&gauss_weights);
    4959 
     4959        xfree((void**)&doflist);
    49604960}
    49614961/*}}}*/
     
    49704970        const int    numdof=NDOF1*numgrids;
    49714971        double       xyz_list[numgrids][3];
    4972         int          doflist[numdof];
    4973         int          numberofdofspernode;
     4972        int*         doflist=NULL;
    49744973       
    49754974        /* gaussian points: */
     
    50025001        /* Get node coordinates and dof list: */
    50035002        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    5004         GetDofList(&doflist[0],&numberofdofspernode);
     5003        GetDofList(&doflist);
    50055004
    50065005        /* Get gaussian points and weights: */
     
    50475046        VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
    50485047
     5048        /*Free ressources:*/
    50495049        xfree((void**)&first_gauss_area_coord);
    50505050        xfree((void**)&second_gauss_area_coord);
    50515051        xfree((void**)&third_gauss_area_coord);
    50525052        xfree((void**)&gauss_weights);
    5053 
     5053        xfree((void**)&doflist);
    50545054}
    50555055/*}}}*/
     
    50625062        const int  NDOF1=1;
    50635063        const int  numdof=numgrids*NDOF1;
    5064         int        doflist[numdof];
    5065         int        numberofdofspernode;
     5064        int*         doflist=NULL;
    50665065        double       xyz_list[numgrids][3];
    50675066
     
    51015100        /* Get node coordinates and dof list: */
    51025101        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    5103         GetDofList(&doflist[0],&numberofdofspernode);
     5102        GetDofList(&doflist);
    51045103
    51055104        //recover material parameters
     
    51535152        VecSetValues(pg,numdof,doflist,(const double*)P_terms,ADD_VALUES);
    51545153
     5154        /*Free ressources:*/
    51555155        xfree((void**)&first_gauss_area_coord);
    51565156        xfree((void**)&second_gauss_area_coord);
    51575157        xfree((void**)&third_gauss_area_coord);
    51585158        xfree((void**)&gauss_weights);
    5159 
     5159        xfree((void**)&doflist);
    51605160}
    51615161/*}}}*/
     
    51685168        const int  NDOF1=1;
    51695169        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];
    51735172
    51745173        double rho_ice;
     
    52185217        /* Get node coordinates and dof list: */
    52195218        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    5220         GetDofList(&doflist[0],&numberofdofspernode);
     5219        GetDofList(&doflist);
    52215220
    52225221        //recover material parameters
     
    52865285        VecSetValues(pg,numdof,doflist,(const double*)P_terms,ADD_VALUES);
    52875286
     5287        /*Free ressources:*/
    52885288        xfree((void**)&first_gauss_area_coord);
    52895289        xfree((void**)&second_gauss_area_coord);
    52905290        xfree((void**)&third_gauss_area_coord);
    52915291        xfree((void**)&gauss_weights);
     5292        xfree((void**)&doflist);
    52925293        delete friction;
    5293 
    52945294}
    52955295/*}}}*/
     
    53535353/*}}}*/
    53545354/*FUNCTION Tria::GetDofList {{{1*/
    5355 void  Tria::GetDofList(int* doflist,int* pnumberofdofspernode){
     5355void  Tria::GetDofList(int** pdoflist){
    53565356
    53575357        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: */
    53675365        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();
    53725377        }
    53735378
    53745379        /*Assign output pointers:*/
    5375         *pnumberofdofspernode=numberofdofspernode;
     5380        *pdoflist=doflist;
    53765381
    53775382}
     
    55495554        const int    numdof=numdofpervertex*numvertices;
    55505555        double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
    5551 
    5552         int          doflist[numdof];
     5556        int*         doflist=NULL;
    55535557        double       values[numdof];
    55545558        double       vx;
    55555559        double       vy;
    55565560
    5557         int          dummy;
    5558 
    55595561        /*Get dof list: */
    5560         GetDofList(&doflist[0],&dummy);
     5562        GetDofList(&doflist);
    55615563
    55625564        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     
    55745576        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
    55755577
     5578        /*Free ressources:*/
     5579        xfree((void**)&doflist);
     5580
    55765581}
    55775582/*}}}*/
     
    55855590        const int    numdof=numdofpervertex*numvertices;
    55865591        double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
    5587 
    5588         int          doflist[numdof];
     5592        int*         doflist=NULL;
    55895593        double       values[numdof];
    55905594        double       lambdax;
    55915595        double       lambday;
    55925596
    5593         int          dummy;
    5594 
    55955597        /*Get dof list: */
    5596         GetDofList(&doflist[0],&dummy);
     5598        GetDofList(&doflist);
    55975599
    55985600        /*Ok, we have lambdax and lambday in values, fill in lambdax and lambday arrays: */
     
    56105612        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
    56115613
     5614        /*Free ressources:*/
     5615        xfree((void**)&doflist);
     5616
    56125617}
    56135618/*}}}*/
     
    56215626        const int    numdof=numdofpervertex*numvertices;
    56225627        double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
    5623 
    5624         int          doflist[numdof];
     5628        int*         doflist=NULL;
    56255629        double       values[numdof];
    56265630        double       vx;
    56275631        double       vy;
    5628 
    56295632        int          dummy;
    56305633
    56315634        /*Get dof list: */
    5632         GetDofList(&doflist[0],&dummy);
     5635        GetDofList(&doflist);
    56335636
    56345637        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     
    56455648        /*Add value to global vector*/
    56465649        VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
     5650
     5651        /*Free ressources:*/
     5652        xfree((void**)&doflist);
    56475653
    56485654}
     
    58545860        const int    numdofpervertex=2;
    58555861        const int    numdof=numdofpervertex*numvertices;
    5856 
    5857         int          doflist[numdof];
     5862        int*         doflist=NULL;
    58585863        double       values[numdof];
    58595864        double       lambdax[numvertices];
    58605865        double       lambday[numvertices];
    58615866
    5862         int          dummy;
    5863 
    58645867        /*Get dof list: */
    5865         GetDofList(&doflist[0],&dummy);
     5868        GetDofList(&doflist);
    58665869
    58675870        /*Use the dof list to index into the solution vector: */
     
    58805883        this->inputs->AddInput(new TriaVertexInput(AdjointyEnum,lambday));
    58815884
     5885        /*Free ressources:*/
     5886        xfree((void**)&doflist);
     5887
    58825888}
    58835889/*}}}*/
     
    58905896        const int    numdofpervertex=2;
    58915897        const int    numdof=numdofpervertex*numvertices;
    5892        
    5893         int          doflist[numdof];
     5898        int*         doflist=NULL;
    58945899        double       values[numdof];
    58955900        double       vx[numvertices];
     
    59015906        double       rho_ice,g;
    59025907        double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
    5903 
    5904         int          dummy;
    59055908        Input*       vz_input=NULL;
    59065909        double*      vz_ptr=NULL;
     5910        int          dummy;
    59075911       
    59085912        /*Get dof list: */
    5909         GetDofList(&doflist[0],&dummy);
     5913        GetDofList(&doflist);
    59105914
    59115915        /*Use the dof list to index into the solution vector: */
     
    59585962        this->inputs->AddInput(new TriaVertexInput(PressureEnum,pressure));
    59595963
     5964        /*Free ressources:*/
     5965        xfree((void**)&doflist);
     5966
    59605967}
    59615968/*}}}*/
     
    59685975        const int    numdofpervertex=2;
    59695976        const int    numdof=numdofpervertex*numvertices;
    5970        
    5971         int          doflist[numdof];
     5977        int*         doflist=NULL;
    59725978        double       values[numdof];
    59735979        double       vx[numvertices];
     
    59795985        double       rho_ice,g;
    59805986        double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
    5981 
    5982         int          dummy;
    59835987        Input*       vz_input=NULL;
    59845988        double*      vz_ptr=NULL;
     5989        int          dummy;
    59855990       
    59865991        /*Get dof list: */
    5987         GetDofList(&doflist[0],&dummy);
     5992        GetDofList(&doflist);
    59885993
    59895994        /*Use the dof list to index into the solution vector: */
     
    60366041        this->inputs->AddInput(new TriaVertexInput(PressureEnum,pressure));
    60376042
     6043        /*Free ressources:*/
     6044        xfree((void**)&doflist);
     6045
    60386046}
    60396047/*}}}*/
     
    60446052        const int numdofpervertex = 1;
    60456053        const int numdof          = numdofpervertex *numvertices;
    6046         int       doflist[numdof];
     6054        int*         doflist=NULL;
    60476055        double    values[numdof];
    6048         int       dummy;
    60496056
    60506057        /*Get dof list: */
    6051         GetDofList(&doflist[0],&dummy);
     6058        GetDofList(&doflist);
    60526059
    60536060        /*Use the dof list to index into the solution vector: */
     
    60586065        /*Add input to the element: */
    60596066        this->inputs->AddInput(new TriaVertexInput(enum_type,values));
     6067
     6068        /*Free ressources:*/
     6069        xfree((void**)&doflist);
     6070
    60606071}
    60616072/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r4974 r5096  
    136136                void      CreatePVectorThermalSheet( Vec pg);
    137137                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);
    142142                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);
    146146                void      GetSolutionFromInputsDiagnosticHoriz(Vec solution);
    147147                void      GetSolutionFromInputsAdjointHoriz(Vec solution);
  • issm/trunk/src/c/objects/Loads/Icefront.cpp

    r4946 r5096  
    401401        const int NDOF2    = 2;
    402402        const int numdofs = numgrids *NDOF2;
    403         int       numberofdofspernode;
    404         int       doflist[numdofs];
     403        int*      doflist=NULL;
    405404        double    xyz_list[numgrids][3];
    406405
     
    453452
    454453        /* Get dof list and node coordinates: */
    455         GetDofList(&doflist[0],&numberofdofspernode);
     454        GetDofList(&doflist);
    456455        GetVerticesCoordinates(&xyz_list[0][0],nodes,numgrids);
    457456       
     
    511510        } //for(ig=0;ig<num_gauss;ig++)
    512511
     512                       
     513        /*Plug pe_g into vector: */
     514        VecSetValues(pg,numdofs,doflist,pe_g,ADD_VALUES);
     515
     516        /*Free ressources:*/
    513517        xfree((void**)&segment_gauss_coord);
    514518        xfree((void**)&gauss_weights);
    515                
    516         /*Plug pe_g into vector: */
    517         VecSetValues(pg,numdofs,doflist,pe_g,ADD_VALUES);
     519        xfree((void**)&doflist);
    518520
    519521}
     
    527529        const int NDOF2=2;
    528530        const int numdofs=numgrids*NDOF2;
    529         int   numberofdofspernode;
    530         int   doflist[numdofs];
     531        int*      doflist=NULL;
    531532
    532533        double xyz_list[numgrids][3];
     
    574575
    575576        /* Get dof list and node coordinates: */
    576         GetDofList(&doflist[0],&numberofdofspernode);
     577        GetDofList(&doflist);
    577578        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    578579       
     
    654655        /*Free ressources:*/
    655656        xfree((void**)&element_nodes);
     657        xfree((void**)&doflist);
    656658
    657659}
     
    665667        const int NDOF4=4;
    666668        const int numdofs=numgrids*NDOF4;
    667         int   numberofdofspernode;
    668         int   doflist[numdofs];
     669        int*      doflist=NULL;
    669670
    670671        double xyz_list[numgrids][3];
     
    714715
    715716        /* Get dof list and node coordinates: */
    716         GetDofList(&doflist[0],&numberofdofspernode);
     717        GetDofList(&doflist);
    717718        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    718719       
     
    794795        /*Free ressources:*/
    795796        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*/
     802void  Icefront::GetDofList(int** pdoflist){
    802803
    803804        int i,j;
    804         int doflist_per_node[MAXDOFSPERNODE];
    805         int numberofdofspernode;
     805        int numberofdofs=0;
     806        int count=0;
    806807        int type;
    807 
     808        int numberofnodes=2;
     809
     810        /*output: */
     811        int* doflist=NULL;
     812
     813        /*pointers: */
    808814        Node**   nodes=NULL;
     815       
     816        /*recover pointers: */
    809817        nodes=(Node**)hnodes->deliverp();
     818       
     819        /*recover type: */
    810820        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        }
    829843
    830844        /*Assign output pointers:*/
    831         *pnumberofdofspernode=numberofdofspernode;
    832 
     845        *pdoflist=doflist;
    833846}
    834847/*}}}*/
  • issm/trunk/src/c/objects/Loads/Icefront.h

    r4946 r5096  
    7272                void  CreatePVectorDiagnosticHorizQuad( Vec pg);
    7373                void  CreatePVectorDiagnosticStokes( Vec pg);
    74                 void  GetDofList(int* doflist,int* pnumberofdofs);
     74                void  GetDofList(int** pdoflist);
    7575                void  QuadPressureLoad(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list,
    7676                                              double* normal1,double* normal2,double* normal3,double* normal4,double* xyz_list);
  • issm/trunk/src/c/objects/Loads/Numericalflux.cpp

    r4942 r5096  
    377377        double    xyz_list[numgrids][3];
    378378        double    normal[2];
    379         int       doflist[numdof];
    380         int       numberofdofspernode;
     379        int*        doflist=NULL;
    381380
    382381        /* gaussian points: */
     
    431430        /* Get node coordinates, dof list and normal vector: */
    432431        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    433         GetDofList(&doflist[0],&numberofdofspernode);
     432        GetDofList(&doflist);
    434433        GetNormal(&normal[0],xyz_list);
    435434
     
    490489        xfree((void**)&gauss_coords);
    491490        xfree((void**)&gauss_weights);
     491       
     492        /*Free ressources:*/
     493        xfree((void**)&doflist);
     494
    492495}
    493496/*}}}*/
     
    505508        double    xyz_list[numgrids][3];
    506509        double    normal[2];
    507         int       doflist[numdof];
    508         int       numberofdofspernode;
     510        int*      doflist=NULL;
    509511
    510512        /* gaussian points: */
     
    560562        /* Get node coordinates, dof list and normal vector: */
    561563        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    562         GetDofList(&doflist[0],&numberofdofspernode);
     564        GetDofList(&doflist);
    563565        GetNormal(&normal[0],xyz_list);
    564566
     
    621623        xfree((void**)&gauss_weights);
    622624
     625        /*Free ressources:*/
     626        xfree((void**)&doflist);
     627
    623628}
    624629/*}}}*/
     
    644649        double    xyz_list[numgrids][3];
    645650        double    normal[2];
    646         int       doflist[numdof];
    647         int       numberofdofspernode;
     651        int*      doflist=NULL;
    648652
    649653        /* gaussian points: */
     
    707711        /* Get node coordinates, dof list and normal vector: */
    708712        GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
    709         GetDofList(&doflist[0],&numberofdofspernode);
     713        GetDofList(&doflist);
    710714        GetNormal(&normal[0],xyz_list);
    711715
     
    757761        xfree((void**)&gauss_weights);
    758762
     763        /*Free ressources:*/
     764        xfree((void**)&doflist);
     765
    759766}
    760767/*}}}*/
     
    775782}
    776783/*}}}*/
    777 /*FUNCTION Numericalflux::GetDofList{{{1*/
    778 
    779 void  Numericalflux::GetDofList(int* doflist,int* pnumberofdofspernode){
     784/*FUNCTION Numericalflux::GetDofList {{{1*/
     785void  Numericalflux::GetDofList(int** pdoflist){
    780786
    781787        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;
    787790        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: */
    790800        nodes=(Node**)hnodes->deliverp();
    791801       
     
    793803        inputs->GetParameterValue(&type,TypeEnum);
    794804
    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;
    811811        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        }
    812827
    813828        /*Assign output pointers:*/
    814         *pnumberofdofspernode=numberofdofspernode;
     829        *pdoflist=doflist;
    815830}
    816831/*}}}*/
  • issm/trunk/src/c/objects/Loads/Numericalflux.h

    r4904 r5096  
    6767                void  GetB(double* B, double gauss_coord);
    6868                void  GetL(double* L, double gauss_coord,int numdof);
    69                 void  GetDofList(int* doflist,int* pnumberofdofs);
     69                void  GetDofList(int** pdoflist);
    7070                void  GetNormal(double* normal,double xyz_list[4][3]);
    7171                void  GetParameterValue(double* pvalue, double gauss_coord,int enumtype);
  • issm/trunk/src/c/objects/Loads/Pengrid.cpp

    r4684 r5096  
    391391/*Pengrid management:*/
    392392/*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;
     393void  Pengrid::GetDofList(int** pdoflist){
     394
     395        int  i,j;
     396        int  numberofdofs=0;
     397
     398        /*output: */
     399        int* doflist=NULL;
    398400
    399401        /*dynamic objects pointed to by hooks: */
     
    402404        /*recover objects from hooks: */
    403405        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);
    409418
    410419        /*Assign output pointers:*/
    411         *pnumberofdofspernode=numberofdofspernode;
    412 
     420        *pdoflist=doflist;
    413421}
    414422/*}}}*/
     
    549557        const int NDOF4=4;
    550558        const int numdof=numgrids*NDOF4;
    551         int       doflist[numdof];
    552         int       numberofdofspernode;
     559        int*         doflist=NULL;
    553560
    554561        int dofs1[1]={0};
     
    565572
    566573        /*Get dof list: */
    567         GetDofList(&doflist[0],&numberofdofspernode);
     574        GetDofList(&doflist);
    568575
    569576        /*recover pointers: */
     
    589596        /*Add Ke to global matrix Kgg: */
    590597        MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES);
     598       
     599        /*Free ressources:*/
     600        xfree((void**)&doflist);
     601
    591602}
    592603/*}}}1*/
     
    599610        const int numdof=numgrids*NDOF1;
    600611        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;
    606616
    607617        double pressure;
     
    632642
    633643        /*Get dof list: */
    634         GetDofList(&doflist[0],&numberofdofspernode);
     644        GetDofList(&doflist);
    635645       
    636646        //Compute pressure melting point
     
    648658        /*Clean up*/
    649659        xfree((void**)&gauss);
     660        xfree((void**)&doflist);
    650661}
    651662/*}}}1*/
     
    659670        const int numdof=numgrids*NDOF1;
    660671        double Ke[numdof][numdof];
    661         int       doflist[numdof];
    662         int       numberofdofspernode;
     672        int*         doflist=NULL;
    663673        double    penalty_offset;
    664674
     
    669679
    670680        /*Get dof list: */
    671         GetDofList(&doflist[0],&numberofdofspernode);
     681        GetDofList(&doflist);
    672682
    673683        Ke[0][0]=kmax*pow((double)10,penalty_offset);
     
    675685        /*Add Ke to global matrix Kgg: */
    676686        MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES);
     687
     688        /*Free ressources:*/
     689        xfree((void**)&doflist);
    677690}
    678691/*}}}1*/
     
    683696        const int NDOF1=1;
    684697        const int numdof=numgrids*NDOF1;
    685         int    doflist[numdof];
     698        int*   doflist=NULL;
    686699        double P_terms[numdof]={0.0};
    687         int    numberofdofspernode;
    688700        int    found=0;
    689701        int    dofs1[1]={0};
     
    712724
    713725        /*Get dof list: */
    714         GetDofList(&doflist[0],&numberofdofspernode);
     726        GetDofList(&doflist);
    715727
    716728        //First recover pressure and temperature values, using the element: */
     
    751763        /*Clean up*/
    752764        xfree((void**)&gauss);
     765        xfree((void**)&doflist);
     766
    753767}
    754768/*}}}1*/
     
    759773        const int NDOF1=1;
    760774        const int numdof=numgrids*NDOF1;
    761         int       doflist[numdof];
     775        int*      doflist=NULL;
    762776        double  P_terms[numdof]={0.0};
    763         int    numberofdofspernode;
    764777        int    found=0;
    765778        double pressure;
     
    784797
    785798        /*Get dof list: */
    786         GetDofList(&doflist[0],&numberofdofspernode);
     799        GetDofList(&doflist);
    787800
    788801        //First recover pressure  and penalty_offset
     
    804817        /*Clean up*/
    805818        xfree((void**)&gauss);
     819        xfree((void**)&doflist);
     820
    806821}
    807822/*}}}1*/
  • issm/trunk/src/c/objects/Loads/Pengrid.h

    r4575 r5096  
    7070                /*Pengrid management {{{1*/
    7171                void  PenaltyCreateKMatrixDiagnosticStokes(Mat Kgg,double kmax);
    72                 void  GetDofList(int* doflist,int* pnumberofdofspernode);
     72                void  GetDofList(int** pdoflist);
    7373                void  GetParameterValue(double* pvalue,int enumtype);
    7474                void  PenaltyCreateKMatrixThermal(Mat Kgg,double kmax);
  • issm/trunk/src/c/objects/Loads/Penpair.cpp

    r4887 r5096  
    257257        const int NDOF2=2;
    258258        const int numdof=numgrids*NDOF2;
    259         int       doflist[numdof];
     259        int*         doflist=NULL;
    260260        int       numberofdofspernode;
    261261
     
    267267
    268268        /*Get dof list: */
    269         GetDofList(&doflist[0],&numberofdofspernode);
     269        GetDofList(&doflist);
    270270
    271271        /*recover pointers: */
     
    288288        /*Add Ke to global matrix Kgg: */
    289289        MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES);
     290       
     291        /*Free ressources:*/
     292        xfree((void**)&doflist);
     293
    290294}
    291295/*}}}1*/
    292296/*FUNCTION Penpair::GetDofList {{{1*/
    293 void  Penpair::GetDofList(int* doflist,int* pnumberofdofspernode){
     297void  Penpair::GetDofList(int** pdoflist){
    294298
    295299        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;
    298305
    299306        /*pointers: */
     
    304311
    305312        /*Some checks for debugging*/
    306         ISSMASSERT(doflist);
    307         ISSMASSERT(pnumberofdofspernode);
    308313        ISSMASSERT(nodes);
    309314
    310         /*Build doflist from nodes*/
     315        /*First, figure out size of doflist: */
    311316        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();
    316318        }
    317319
     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
    318330        /*Assign output pointers:*/
    319         *pnumberofdofspernode=numberofdofspernode;
    320 
    321 }
    322 /*}}}*/
     331        *pdoflist=doflist;
     332}
     333/*}}}*/
  • issm/trunk/src/c/objects/Loads/Penpair.h

    r4887 r5096  
    6262                        /*Penpair management: {{{1*/
    6363                void  PenaltyCreateKMatrixDiagnosticHoriz(Mat Kgg,double kmax);
    64                 void  GetDofList(int* doflist,int* pnumberofdofspernode);
     64                void  GetDofList(int** pdoflist);
    6565                /*}}}*/
    6666};
  • issm/trunk/src/c/objects/Loads/Riftfront.cpp

    r5016 r5096  
    336336        double      Ke_gg[4][4];
    337337        const int   numdof              = 2 *numgrids;
    338         int         doflist[numdof];
    339         int         numberofdofspernode;
     338        int*        doflist=NULL;
    340339        double      thickness;
    341340        double      h[2];
     
    362361       
    363362        /* Get node coordinates and dof list: */
    364         GetDofList(&doflist[0],&numberofdofspernode);
     363        GetDofList(&doflist);
    365364
    366365        /* Set Ke_gg to 0: */
     
    446445        double      pe_g[4]={0.0};
    447446        const int   numdof              = 2 *numgrids;
    448         int         doflist[numdof];
    449         int         numberofdofspernode;
     447        int*        doflist=NULL;
    450448
    451449        double      rho_ice;
     
    486484
    487485        /* Get node coordinates and dof list: */
    488         GetDofList(&doflist[0],&numberofdofspernode);
     486        GetDofList(&doflist);
    489487
    490488        /*Get some inputs: */
     
    564562                /*The penalty is active. No loads implied here.*/
    565563        }
     564       
     565        /*Free ressources:*/
     566        xfree((void**)&doflist);
     567
    566568}
    567569/*}}}1*/
     
    669671/*}}}1*/
    670672/*FUNCTION Riftfront::GetDofList {{{1*/
    671 
    672 void  Riftfront::GetDofList(int* doflist,int* pnumberofdofspernode){
     673void  Riftfront::GetDofList(int** pdoflist){
    673674
    674675        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: */
    679686        nodes=(Node**)hnodes->deliverp();
    680 
     687       
     688        /*Some checks for debugging*/
     689        ISSMASSERT(nodes);
     690               
     691        /*Figure out size of doflist: */
    681692        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();
    686704        }
    687705
    688706        /*Assign output pointers:*/
    689         *pnumberofdofspernode=numberofdofspernode;
    690 }
    691 /*}}}1*/
     707        *pdoflist=doflist;
     708}
     709/*}}}*/
    692710/*FUNCTION Riftfront::IsFrozen{{{1*/
    693711bool   Riftfront::IsFrozen(void){
  • issm/trunk/src/c/objects/Loads/Riftfront.h

    r4575 r5096  
    7878                /*}}}*/
    7979                /*Riftfront management: {{{1*/
    80                 void  GetDofList(int* doflist,int* pnumberofdofs);
     80                void  GetDofList(int** pdoflist);
    8181                bool  PreStable();
    8282                void  SetPreStable();
  • issm/trunk/src/c/objects/Node.cpp

    r5057 r5096  
    337337/*}}}*/
    338338/*FUNCTION Node::GetDofList{{{1*/
    339 void  Node::GetDofList(int* outdoflist,int* pnumberofdofspernode){
    340 
     339void  Node::GetDofList(int* outdoflist){
    341340        int i;
    342341        for(i=0;i<this->indexing.numberofdofs;i++){
    343342                outdoflist[i]=indexing.doflist[i];
    344343        }
    345         /*Assign output pointers:*/
    346         *pnumberofdofspernode=this->indexing.numberofdofs;
    347344}
    348345/*}}}*/
  • issm/trunk/src/c/objects/Node.h

    r5057 r5096  
    7575                void  CreateVecSets(Vec pv_g,Vec pv_f,Vec pv_s);
    7676                int   GetConnectivity();
    77                 void  GetDofList(int* outdoflist,int* pnumberofdofspernode);
     77                void  GetDofList(int* poutdoflist);
    7878                int   GetDofList1(void);
    7979                double GetX();
  • issm/trunk/src/m/solutions/NewFemModel.m

    r5057 r5096  
    2424        femmodel.results=struct([]);
    2525
    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));
     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));
    3131
    3232                femmodel=SetCurrentConfiguration(femmodel,analysis_type);
    3333
    34            displaystring(md.verbose,'%s','      generating degrees of freedom...');
     34                displaystring(md.verbose,'%s','      generating degrees of freedom...');
    3535                if ~isfield(femmodel,'part'),
    3636                        [femmodel.vertices,femmodel.part,femmodel.tpart]=VerticesDof(femmodel.vertices, femmodel.parameters); %do not create partition vector twice! we only have one set of vertices!
     
    4949                displaystring(md.verbose,'%s','      configuring elements and loads...');
    5050                [femmodel.elements,femmodel.loads,femmodel.nodes,femmodel.parameters] = ConfigureObjects( femmodel.elements, femmodel.loads, femmodel.nodes, femmodel.vertices,femmodel.materials,femmodel.parameters);
    51    end
     51        end
  • issm/trunk/test/NightlyRun/test101.m

    r5006 r5096  
    44md=setelementstype(md,'macayeal','all');
    55md.cluster='none';
     6md.verbose=1;
    67md=solve(md,'analysis_type',DiagnosticSolutionEnum);
     8
Note: See TracChangeset for help on using the changeset viewer.