Changeset 25934


Ignore:
Timestamp:
01/07/21 19:54:55 (4 years ago)
Author:
Mathieu Morlighem
Message:

CHG: trying to remove some dynamic memory allocation of Gauss points

Location:
issm/trunk-jpl/src/c/classes/Elements
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r25839 r25934  
    299299
    300300        /* Start looping on the number of vertices: */
    301         GaussPenta* gauss=new GaussPenta();
     301        GaussPenta gauss;
    302302        for(int iv=0;iv<3;iv++){
    303                 gauss->GaussVertex(iv);
     303                gauss.GaussVertex(iv);
    304304
    305305                /*Get velocity components and thickness*/
    306                 B_input->GetInputValue(&B,gauss);
    307                 n_input->GetInputValue(&n,gauss);
    308                 vx_input->GetInputValue(&vx,gauss);
    309                 vy_input->GetInputValue(&vy,gauss);
    310                 gr_input->GetInputValue(&groundedice,gauss);
    311                 bs_input->GetInputValue(&bed,gauss);
    312                 smax_fl_input->GetInputValue(&sigma_max_floating,gauss);
    313                 smax_gr_input->GetInputValue(&sigma_max_grounded,gauss);
     306                B_input->GetInputValue(&B,&gauss);
     307                n_input->GetInputValue(&n,&gauss);
     308                vx_input->GetInputValue(&vx,&gauss);
     309                vy_input->GetInputValue(&vy,&gauss);
     310                gr_input->GetInputValue(&groundedice,&gauss);
     311                bs_input->GetInputValue(&bed,&gauss);
     312                smax_fl_input->GetInputValue(&sigma_max_floating,&gauss);
     313                smax_gr_input->GetInputValue(&sigma_max_grounded,&gauss);
    314314                vel=sqrt(vx*vx+vy*vy)+1.e-14;
    315                 sl_input->GetInputValue(&sealevel,gauss);
     315                sl_input->GetInputValue(&sealevel,&gauss);
    316316
    317317                /*Compute strain rate and viscosity: */
    318                 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
     318                this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
    319319
    320320                /*Get Eigen values*/
     
    359359        this->InputExtrude(CalvingCalvingrateEnum,-1);
    360360        this->InputExtrude(SigmaVMEnum,-1);
    361 
    362         /*Clean up and return*/
    363         delete gauss;
    364361}
    365362/*}}}*/
     
    382379
    383380        /* Start looping on the number of vertices: */
    384         GaussPenta* gauss=new GaussPenta();
    385         for (int iv=0;iv<NUMVERTICES;iv++){
    386                 gauss->GaussVertex(iv);
     381        GaussPenta gauss;
     382        for(int iv=0;iv<NUMVERTICES;iv++){
     383                gauss.GaussVertex(iv);
    387384
    388385                /* Get the value we need*/
    389                 vx_input->GetInputValue(&vx,gauss);
    390                 vy_input->GetInputValue(&vy,gauss);
     386                vx_input->GetInputValue(&vx,&gauss);
     387                vy_input->GetInputValue(&vy,&gauss);
    391388                vel=vx*vx+vy*vy;
    392                 strainparallel_input->GetInputValue(&strainparallel,gauss);
    393                 strainperpendicular_input->GetInputValue(&strainperpendicular,gauss);
    394                 levermanncoeff_input->GetInputValue(&propcoeff,gauss);
     389                strainparallel_input->GetInputValue(&strainparallel,&gauss);
     390                strainperpendicular_input->GetInputValue(&strainperpendicular,&gauss);
     391                levermanncoeff_input->GetInputValue(&propcoeff,&gauss);
    395392
    396393                /*Calving rate proportionnal to the positive product of the strain rate along the ice flow direction and the strain rate perpendicular to the ice flow */
     
    407404        this->AddBasalInput(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
    408405        this->AddBasalInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
    409 
    410         /*Clean up and return*/
    411         delete gauss;
    412406}/*}}}*/
    413407void       Penta::CalvingFluxLevelset(){/*{{{*/
     
    761755        IssmDouble      tau_yz[NUMVERTICES];
    762756        IssmDouble      tau_eff[NUMVERTICES];
    763         GaussPenta* gauss=NULL;
    764757
    765758        /* Get node coordinates and dof list: */
     
    772765
    773766        /* Start looping on the number of vertices: */
    774         gauss=new GaussPenta();
     767        GaussPenta gauss;
    775768        for (int iv=0;iv<NUMVERTICES;iv++){
    776                 gauss->GaussVertex(iv);
     769                gauss.GaussVertex(iv);
    777770
    778771                /*Compute strain rate viscosity and pressure: */
    779                 this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
    780                 this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
     772                this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
     773                this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
    781774
    782775                /*Compute Stress*/
     
    802795        this->AddInput(DeviatoricStresszzEnum,&tau_zz[0],P1DGEnum);
    803796        this->AddInput(DeviatoricStresseffectiveEnum,&tau_eff[0],P1DGEnum);
    804 
    805         /*Clean up and return*/
    806         delete gauss;
    807797}
    808798/*}}}*/
     
    818808        IssmDouble      sigma_xz[NUMVERTICES];
    819809        IssmDouble      sigma_yz[NUMVERTICES];
    820         GaussPenta* gauss=NULL;
    821810
    822811        /* Get node coordinates and dof list: */
     
    830819
    831820        /* Start looping on the number of vertices: */
    832         gauss=new GaussPenta();
    833         for (int iv=0;iv<NUMVERTICES;iv++){
    834                 gauss->GaussVertex(iv);
     821        GaussPenta gauss;
     822        for(int iv=0;iv<NUMVERTICES;iv++){
     823                gauss.GaussVertex(iv);
    835824
    836825                /*Compute strain rate viscosity and pressure: */
    837                 this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
    838                 this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
    839                 pressure_input->GetInputValue(&pressure,gauss);
     826                this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
     827                this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
     828                pressure_input->GetInputValue(&pressure,&gauss);
    840829
    841830                /*Compute Stress*/
     
    855844        this->AddInput(StressTensoryzEnum,&sigma_yz[0],P1DGEnum);
    856845        this->AddInput(StressTensorzzEnum,&sigma_zz[0],P1DGEnum);
    857 
    858         /*Clean up and return*/
    859         delete gauss;
    860846}
    861847/*}}}*/
     
    952938                control_gradient->Serve(NUMVERTICES,&lidlist[0]);
    953939
    954                 GaussPenta* gauss=new GaussPenta();
     940                GaussPenta gauss;
    955941                for (int iv=0;iv<NUMVERTICES;iv++){
    956                         gauss->GaussVertex(iv);
    957 
    958                         control_value->GetInputValue(&value,gauss);
    959                         control_gradient->GetInputValue(&gradient,gauss);
     942                        gauss.GaussVertex(iv);
     943
     944                        control_value->GetInputValue(&value,&gauss);
     945                        control_gradient->GetInputValue(&gradient,&gauss);
    960946
    961947                        values[iv]    = reCast<IssmPDouble>(value)/reCast<IssmPDouble>(connectivity[iv]);
    962948                        gradients[iv] = reCast<IssmPDouble>(gradient)/reCast<IssmPDouble>(connectivity[iv]);
    963949                }
    964                 delete gauss;
    965950
    966951                vector_control->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
     
    11391124
    11401125        /*1. Recover stresses at the base*/
    1141         GaussPenta* gauss=new GaussPenta();
     1126        GaussPenta gauss;
    11421127        for (int iv=0;iv<NUMVERTICES;iv++){
    1143                 gauss->GaussVertex(iv);
     1128                gauss.GaussVertex(iv);
    11441129
    11451130                /*Compute strain rate viscosity and pressure: */
    1146                 this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
    1147                 this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
     1131                this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
     1132                this->material->ViscosityFS(&viscosity,3,&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
    11481133                /*FIXME: this is for Hongju only*/
    11491134                //pressureice[iv]=gravity*rho_ice*(surface[iv]-base[iv]);
     
    11801165                }
    11811166        }
    1182 
    1183         /*clean up*/
    1184         delete gauss;
    11851167}
    11861168/*}}}*/
     
    16311613        int index = this->GetNodeIndex(node);
    16321614
    1633         GaussPenta* gauss=new GaussPenta();
    1634         gauss->GaussNode(this->element_type,index);
    1635 
    1636         input->GetInputValue(pvalue,gauss);
    1637         delete gauss;
     1615        GaussPenta gauss;
     1616        gauss.GaussNode(this->element_type,index);
     1617        input->GetInputValue(pvalue,&gauss);
    16381618}
    16391619/*}}}*/
     
    16451625        int index = this->GetVertexIndex(vertex);
    16461626
    1647         GaussPenta* gauss=new GaussPenta();
    1648         gauss->GaussVertex(index);
    1649 
    1650         input->GetInputValue(pvalue,gauss);
    1651         delete gauss;
     1627        GaussPenta gauss;
     1628        gauss.GaussVertex(index);
     1629        input->GetInputValue(pvalue,&gauss);
    16521630}
    16531631/*}}}*/
     
    28512829
    28522830        /* Start looping on the number of vertices: */
    2853         GaussPenta* gauss=new GaussPenta();
     2831        GaussPenta gauss;
    28542832        for(int iv=0;iv<NUMVERTICES;iv++){
    2855                 gauss->GaussVertex(iv);
     2833                gauss.GaussVertex(iv);
    28562834
    28572835                /* Advection */
    2858                 vx_input->GetInputValue(&v[0],gauss);
    2859                 vy_input->GetInputValue(&v[1],gauss);
    2860                 gr_input->GetInputValue(&groundedice,gauss);
     2836                vx_input->GetInputValue(&v[0],&gauss);
     2837                vy_input->GetInputValue(&v[1],&gauss);
     2838                gr_input->GetInputValue(&groundedice,&gauss);
    28612839
    28622840                /*Get calving speed*/
     
    28642842                        case DefaultCalvingEnum:
    28652843                        case CalvingVonmisesEnum:
    2866                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    2867                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    2868                                 calvingrate_input->GetInputValue(&calvingrate,gauss);
    2869                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     2844                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     2845                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     2846                                calvingrate_input->GetInputValue(&calvingrate,&gauss);
     2847                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    28702848
    28712849                                if(groundedice<0) meltingrate = 0.;
     
    28862864
    28872865                        case CalvingLevermannEnum:
    2888                                 calvingratex_input->GetInputValue(&c[0],gauss);
    2889                                 if(dim==2) calvingratey_input->GetInputValue(&c[1],gauss);
    2890                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     2866                                calvingratex_input->GetInputValue(&c[0],&gauss);
     2867                                if(dim==2) calvingratey_input->GetInputValue(&c[1],&gauss);
     2868                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    28912869                                norm_calving=0.;
    28922870                                for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
     
    28962874
    28972875                        case CalvingMinthicknessEnum:
    2898                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    2899                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    2900                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     2876                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     2877                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     2878                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    29012879
    29022880                                norm_dlsf=0.;
     
    29172895
    29182896                        case CalvingHabEnum:
    2919                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    2920                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    2921                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     2897                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     2898                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     2899                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    29222900
    29232901                                norm_dlsf=0.;
     
    29382916
    29392917                        case CalvingCrevasseDepthEnum:
    2940                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    2941                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    2942                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     2918                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     2919                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     2920                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    29432921
    29442922                                if(groundedice<0) meltingrate = 0.;
     
    29622940                        case CalvingDev2Enum:
    29632941                                  {
    2964                                         lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    2965                                         if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    2966                                         calvingrate_input->GetInputValue(&calvingrate,gauss);
    2967                                         meltingrate_input->GetInputValue(&meltingrate,gauss);
    2968                                         gr_input->GetInputValue(&groundedice,gauss);
     2942                                        lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     2943                                        if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     2944                                        calvingrate_input->GetInputValue(&calvingrate,&gauss);
     2945                                        meltingrate_input->GetInputValue(&meltingrate,&gauss);
     2946                                        gr_input->GetInputValue(&groundedice,&gauss);
    29692947
    29702948                                        //idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
     
    30212999        this->InputExtrude(MovingFrontalVxEnum,-1);
    30223000        this->InputExtrude(MovingFrontalVyEnum,-1);
    3023         /*Clean up and return*/
    3024         delete gauss;
    30253001}
    30263002/*}}}*/
     
    31423118        int found=0;
    31433119        IssmDouble value;
    3144         GaussPenta* gauss=NULL;
     3120        GaussPenta gauss;
    31453121
    31463122        /*First, serarch the input: */
     
    31543130                        if(data){
    31553131                                /*ok, we are good. retrieve value of input at vertex :*/
    3156                                 gauss=new GaussPenta(); gauss->GaussVertex(i);
    3157                                 data->GetInputValue(&value,gauss);
     3132                                gauss.GaussVertex(i);
     3133                                data->GetInputValue(&value,&gauss);
    31583134                                found=1;
    31593135                                break;
     
    31623138        }
    31633139
    3164         delete gauss;
    31653140        if(found)*pvalue=value;
    31663141        return found;
     
    33693344
    33703345        /*Loop over basal nodes and update their CS*/
    3371         GaussPenta* gauss = new GaussPenta();
     3346        GaussPenta gauss;
    33723347        for(int i=0;i<numindices;i++){//FIXME
    3373                 gauss->GaussNode(this->VelocityInterpolation(),indices[i]);
    3374 
    3375                 slopex_input->GetInputValue(&slopex,gauss);
    3376                 slopey_input->GetInputValue(&slopey,gauss);
    3377                 groundedicelevelset_input->GetInputValue(&groundedice,gauss);
     3348                gauss.GaussNode(this->VelocityInterpolation(),indices[i]);
     3349
     3350                slopex_input->GetInputValue(&slopex,&gauss);
     3351                slopey_input->GetInputValue(&slopey,&gauss);
     3352                groundedicelevelset_input->GetInputValue(&groundedice,&gauss);
    33783353
    33793354                /*New X axis          New Z axis*/
     
    34063381        /*cleanup*/
    34073382        xDelete<int>(indices);
    3408         delete gauss;
    34093383}
    34103384/*}}}*/
     
    34553429
    34563430        /* Start looping on the number of vertices: */
    3457         GaussPenta* gauss=new GaussPenta();
     3431        GaussPenta gauss;
    34583432        for(int iv=0;iv<NUMVERTICES2D;iv++){
    3459                 gauss->GaussVertex(iv);
     3433                gauss.GaussVertex(iv);
    34603434
    34613435                /* Get variables */
    3462                 bed_input->GetInputValue(&bed,gauss);
    3463                 qsg_input->GetInputValue(&qsg,gauss);
    3464                 TF_input->GetInputValue(&TF,gauss);
     3436                bed_input->GetInputValue(&bed,&gauss);
     3437                qsg_input->GetInputValue(&qsg,&gauss);
     3438                TF_input->GetInputValue(&TF,&gauss);
    34653439
    34663440                if(basinid[iv]==0 || basin_icefront_area[reCast<int>(basinid[iv])-1]==0.) meltrates[iv]=0.;
     
    34843458        /*Cleanup and return*/
    34853459        xDelete<IssmDouble>(basin_icefront_area);
    3486         delete gauss;
    34873460}
    34883461/*}}}*/
     
    36923665
    36933666        IssmDouble  epsilon[6];
    3694         GaussPenta* gauss=NULL;
    36953667        IssmDouble  vx,vy,vel;
    36963668        IssmDouble  strainxx;
     
    37093681
    37103682        /* Start looping on the number of vertices: */
    3711         gauss=new GaussPenta();
     3683        GaussPenta gauss;
    37123684        for (int iv=0;iv<NUMVERTICES;iv++){
    3713                 gauss->GaussVertex(iv);
     3685                gauss.GaussVertex(iv);
    37143686
    37153687                /* Get the value we need*/
    3716                 vx_input->GetInputValue(&vx,gauss);
    3717                 vy_input->GetInputValue(&vy,gauss);
     3688                vx_input->GetInputValue(&vx,&gauss);
     3689                vy_input->GetInputValue(&vy,&gauss);
    37183690                vel=vx*vx+vy*vy;
    37193691
    37203692                /*Compute strain rate and viscosity: */
    3721                 this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
     3693                this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
    37223694                strainxx=epsilon[0];
    37233695                strainyy=epsilon[1];
     
    37303702        /*Add input*/
    37313703        this->AddInput(StrainRateparallelEnum,&strainparallel[0],P1DGEnum);
    3732 
    3733         /*Clean up and return*/
    3734         delete gauss;
    37353704}
    37363705/*}}}*/
     
    37383707
    37393708        IssmDouble  epsilon[6];
    3740         GaussPenta* gauss=NULL;
    37413709        IssmDouble  vx,vy,vel;
    37423710        IssmDouble  strainxx;
     
    37553723
    37563724        /* Start looping on the number of vertices: */
    3757         gauss=new GaussPenta();
     3725        GaussPenta gauss;
    37583726        for (int iv=0;iv<NUMVERTICES;iv++){
    3759                 gauss->GaussVertex(iv);
     3727                gauss.GaussVertex(iv);
    37603728
    37613729                /* Get the value we need*/
    3762                 vx_input->GetInputValue(&vx,gauss);
    3763                 vy_input->GetInputValue(&vy,gauss);
     3730                vx_input->GetInputValue(&vx,&gauss);
     3731                vy_input->GetInputValue(&vy,&gauss);
    37643732                vel=vx*vx+vy*vy;
    37653733
    37663734                /*Compute strain rate and viscosity: */
    3767                 this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
     3735                this->StrainRateFS(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input,vz_input);
    37683736                strainxx=epsilon[0];
    37693737                strainyy=epsilon[1];
     
    37763744        /*Add input*/
    37773745        this->AddInput(StrainRateperpendicularEnum,&strainperpendicular[0],P1DGEnum);
    3778 
    3779         /*Clean up and return*/
    3780         delete gauss;
    37813746}
    37823747/*}}}*/
     
    47794744        Input* onbase = this->GetInput(MeshVertexonbaseEnum); _assert_(onbase);
    47804745
    4781         GaussPenta* gauss=new GaussPenta();
     4746        GaussPenta gauss;
    47824747        for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
    4783                 gauss->GaussNode(this->element_type,iv);
    4784                 onbase->GetInputValue(&isonbase,gauss);
     4748                gauss.GaussNode(this->element_type,iv);
     4749                onbase->GetInputValue(&isonbase,&gauss);
    47854750                if(isonbase==1.){
    4786                         input->GetInputValue(&value,gauss);
     4751                        input->GetInputValue(&value,&gauss);
    47874752                        this->nodes[iv]->ApplyConstraint(0,value);
    47884753                }
    47894754        }
    4790         delete gauss;
    4791 
    4792 }
    4793 /*}}}*/
     4755}/*}}}*/
    47944756void       Penta::UpdateConstraintsExtrudeFromTop(void){/*{{{*/
    47954757
     
    48034765        Input* input = this->GetInput(extrusioninput); _assert_(extrusioninput);
    48044766
    4805         GaussPenta* gauss=new GaussPenta();
     4767        GaussPenta gauss;
    48064768        for(int i=0;i<3;i++){
    4807                 gauss->GaussNode(P1Enum,indices[i]);
    4808                 input->GetInputValue(&value,gauss);
     4769                gauss.GaussNode(P1Enum,indices[i]);
     4770                input->GetInputValue(&value,&gauss);
    48094771                this->nodes[indices[i]]->ApplyConstraint(0,value);
    48104772        }
    4811         delete gauss;
    48124773
    48134774}
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r25905 r25934  
    339339
    340340        /* Start looping on the number of vertices: */
    341         GaussTria* gauss=new GaussTria();
     341        GaussTria gauss;
    342342        for(int iv=0;iv<NUMVERTICES;iv++){
    343                 gauss->GaussVertex(iv);
     343                gauss.GaussVertex(iv);
    344344
    345345                /*Get velocity components and thickness*/
    346                 B_input->GetInputValue(&B,gauss);
    347                 n_input->GetInputValue(&n,gauss);
    348                 vx_input->GetInputValue(&vx,gauss);
    349                 vy_input->GetInputValue(&vy,gauss);
    350                 gr_input->GetInputValue(&groundedice,gauss);
    351                 bs_input->GetInputValue(&bed,gauss);
    352                 smax_fl_input->GetInputValue(&sigma_max_floating,gauss);
    353                 smax_gr_input->GetInputValue(&sigma_max_grounded,gauss);
     346                B_input->GetInputValue(&B,&gauss);
     347                n_input->GetInputValue(&n,&gauss);
     348                vx_input->GetInputValue(&vx,&gauss);
     349                vy_input->GetInputValue(&vy,&gauss);
     350                gr_input->GetInputValue(&groundedice,&gauss);
     351                bs_input->GetInputValue(&bed,&gauss);
     352                smax_fl_input->GetInputValue(&sigma_max_floating,&gauss);
     353                smax_gr_input->GetInputValue(&sigma_max_grounded,&gauss);
    354354                vel=sqrt(vx*vx+vy*vy)+1.e-14;
    355                 sl_input->GetInputValue(&sealevel,gauss);
     355                sl_input->GetInputValue(&sealevel,&gauss);
    356356
    357357                /*Compute strain rate and viscosity: */
    358                 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
     358                this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
    359359
    360360                /*Get Eigen values*/
     
    399399        this->AddInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
    400400        this->AddInput(SigmaVMEnum,&sigma_vm[0],P1DGEnum);
    401 
    402         /*Clean up and return*/
    403         delete gauss;
    404401}
    405402/*}}}*/
     
    437434
    438435        /*Loop over all elements of this partition*/
    439         GaussTria* gauss=new GaussTria();
     436        GaussTria gauss;
    440437        for (int iv=0;iv<NUMVERTICES;iv++){
    441                 gauss->GaussVertex(iv);
    442 
    443                 H_input->GetInputValue(&thickness,gauss);
    444                 bed_input->GetInputValue(&bed,gauss);
    445                 surface_input->GetInputValue(&surface,gauss);
    446                 strainrateparallel_input->GetInputValue(&strainparallel,gauss);
    447                 strainrateeffective_input->GetInputValue(&straineffective,gauss);
    448                 vx_input->GetInputValue(&vx,gauss);
    449                 vy_input->GetInputValue(&vy,gauss);
    450                 waterheight_input->GetInputValue(&water_height,gauss);
    451                 s_xx_input->GetInputValue(&s_xx,gauss);
    452                 s_xy_input->GetInputValue(&s_xy,gauss);
    453                 s_yy_input->GetInputValue(&s_yy,gauss);
    454                 B_input->GetInputValue(&B,gauss);
    455                 n_input->GetInputValue(&n,gauss);
     438                gauss.GaussVertex(iv);
     439
     440                H_input->GetInputValue(&thickness,&gauss);
     441                bed_input->GetInputValue(&bed,&gauss);
     442                surface_input->GetInputValue(&surface,&gauss);
     443                strainrateparallel_input->GetInputValue(&strainparallel,&gauss);
     444                strainrateeffective_input->GetInputValue(&straineffective,&gauss);
     445                vx_input->GetInputValue(&vx,&gauss);
     446                vy_input->GetInputValue(&vy,&gauss);
     447                waterheight_input->GetInputValue(&water_height,&gauss);
     448                s_xx_input->GetInputValue(&s_xx,&gauss);
     449                s_xy_input->GetInputValue(&s_xy,&gauss);
     450                s_yy_input->GetInputValue(&s_yy,&gauss);
     451                B_input->GetInputValue(&B,&gauss);
     452                n_input->GetInputValue(&n,&gauss);
    456453
    457454                vel=sqrt(vx*vx+vy*vy)+1.e-14;
     
    494491        this->AddInput(BasalCrevasseEnum,&basal_crevasse[0],P1DGEnum);
    495492        this->AddInput(CrevasseDepthEnum,&crevasse_depth[0],P1DGEnum);
    496 
    497         delete gauss;
    498493}
    499494/*}}}*/
     
    517512
    518513        /* Start looping on the number of vertices: */
    519         GaussTria* gauss=new GaussTria();
     514        GaussTria gauss;
    520515        for (int iv=0;iv<NUMVERTICES;iv++){
    521                 gauss->GaussVertex(iv);
     516                gauss.GaussVertex(iv);
    522517
    523518                /* Get the value we need*/
    524                 vx_input->GetInputValue(&vx,gauss);
    525                 vy_input->GetInputValue(&vy,gauss);
     519                vx_input->GetInputValue(&vx,&gauss);
     520                vy_input->GetInputValue(&vy,&gauss);
    526521                vel=vx*vx+vy*vy;
    527                 strainparallel_input->GetInputValue(&strainparallel,gauss);
    528                 strainperpendicular_input->GetInputValue(&strainperpendicular,gauss);
    529                 levermanncoeff_input->GetInputValue(&propcoeff,gauss);
    530                 bs_input->GetInputValue(&bed,gauss);
     522                strainparallel_input->GetInputValue(&strainparallel,&gauss);
     523                strainperpendicular_input->GetInputValue(&strainperpendicular,&gauss);
     524                levermanncoeff_input->GetInputValue(&propcoeff,&gauss);
     525                bs_input->GetInputValue(&bed,&gauss);
    531526
    532527                /*Calving rate proportionnal to the positive product of the strain rate along the ice flow direction and the strain rate perpendicular to the ice flow */
     
    545540        this->AddInput(CalvingrateyEnum,&calvingratey[0],P1DGEnum);
    546541        this->AddInput(CalvingCalvingrateEnum,&calvingrate[0],P1DGEnum);
    547 
    548         /*Clean up and return*/
    549         delete gauss;
    550542}/*}}}*/
    551543void       Tria::CalvingFluxLevelset(){/*{{{*/
     
    852844        IssmDouble  tau_1[NUMVERTICES];
    853845        IssmDouble  tau_2[NUMVERTICES];
    854         GaussTria*  gauss=NULL;
    855846        int domaintype,dim=2;
    856847
     
    868859
    869860        /* Start looping on the number of vertices: */
    870         gauss=new GaussTria();
     861        GaussTria gauss;
    871862        for (int iv=0;iv<NUMVERTICES;iv++){
    872                 gauss->GaussVertex(iv);
     863                gauss.GaussVertex(iv);
    873864
    874865                /*Compute strain rate and viscosity: */
    875                 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
     866                this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
    876867                switch(approximation){
    877868                        case SSAApproximationEnum:
    878                                 this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
     869                                this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input);
    879870                                break;
    880871                        case HOApproximationEnum:
    881                                 this->material->ViscosityHO(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
     872                                this->material->ViscosityHO(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input);
    882873                                break;
    883874                        case FSApproximationEnum:
    884                                 this->material->ViscosityFS(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input,NULL);
     875                                this->material->ViscosityFS(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input,NULL);
    885876                                break;
    886877                        default:
     
    908899        this->AddInput(DeviatoricStress1Enum,&tau_1[0],P1DGEnum);
    909900        this->AddInput(DeviatoricStress2Enum,&tau_2[0],P1DGEnum);
    910 
    911         /*Clean up and return*/
    912         delete gauss;
    913901}
    914902/*}}}*/
     
    921909        IssmDouble  strain_xy[NUMVERTICES];
    922910        IssmDouble  vorticity_xy[NUMVERTICES];
    923         GaussTria*  gauss=NULL;
    924911
    925912        /* Get node coordinates and dof list: */
     
    931918
    932919        /* Start looping on the number of vertices: */
    933         gauss=new GaussTria();
     920        GaussTria gauss;
    934921        for (int iv=0;iv<NUMVERTICES;iv++){
    935                 gauss->GaussVertex(iv);
     922                gauss.GaussVertex(iv);
    936923
    937924                /*Compute strain rate and vorticity rate: */
    938                 this->StrainRateESA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
     925                this->StrainRateESA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
    939926
    940927                /*Compute Stress*/
     
    950937        this->AddInput(EsaStrainratexyEnum,&strain_xy[0],P1DGEnum);
    951938        this->AddInput(EsaRotationrateEnum,&vorticity_xy[0],P1DGEnum);
    952 
    953         /*Clean up and return*/
    954         delete gauss;
    955939}
    956940/*}}}*/
     
    10261010        IssmDouble      sigma_xz[NUMVERTICES]={0,0,0};
    10271011        IssmDouble      sigma_yz[NUMVERTICES]={0,0,0};
    1028         GaussTria*  gauss=NULL;
    10291012        int domaintype,dim=2;
    10301013
     
    10401023
    10411024        /* Start looping on the number of vertices: */
    1042         gauss=new GaussTria();
     1025        GaussTria gauss;
    10431026        for (int iv=0;iv<NUMVERTICES;iv++){
    1044                 gauss->GaussVertex(iv);
     1027                gauss.GaussVertex(iv);
    10451028
    10461029                /*Compute strain rate viscosity and pressure: */
    1047                 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
    1048                 this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],gauss,vx_input,vy_input);
    1049                 pressure_input->GetInputValue(&pressure,gauss);
     1030                this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
     1031                this->material->ViscositySSA(&viscosity,dim,&xyz_list[0][0],&gauss,vx_input,vy_input);
     1032                pressure_input->GetInputValue(&pressure,&gauss);
    10501033
    10511034                /*Compute Stress*/
     
    10621045        this->AddInput(StressTensoryzEnum,&sigma_yz[0],P1DGEnum);
    10631046        this->AddInput(StressTensorzzEnum,&sigma_zz[0],P1DGEnum);
    1064 
    1065         /*Clean up and return*/
    1066         delete gauss;
    10671047}
    10681048/*}}}*/
     
    11761156                control_gradient->Serve(NUMVERTICES,&lidlist[0]);
    11771157
    1178                 GaussTria* gauss=new GaussTria();
     1158                GaussTria gauss;
    11791159                for (int iv=0;iv<NUMVERTICES;iv++){
    1180                         gauss->GaussVertex(iv);
    1181 
    1182                         control_value->GetInputValue(&value,gauss);
    1183                         control_gradient->GetInputValue(&gradient,gauss);
     1160                        gauss.GaussVertex(iv);
     1161
     1162                        control_value->GetInputValue(&value,&gauss);
     1163                        control_gradient->GetInputValue(&gradient,&gauss);
    11841164
    11851165                        values[iv]    = reCast<IssmPDouble>(value)/reCast<IssmPDouble>(connectivity[iv]);
    11861166                        gradients[iv] = reCast<IssmPDouble>(gradient)/reCast<IssmPDouble>(connectivity[iv]);
    11871167                }
    1188                 delete gauss;
    11891168
    11901169                vector_control->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
     
    14141393
    14151394        /*1. Recover stresses at the base*/
    1416         GaussTria* gauss=new GaussTria();
     1395        GaussTria gauss;
    14171396        for (int iv=0;iv<NUMVERTICES;iv++){
    1418                 gauss->GaussVertex(iv);
     1397                gauss.GaussVertex(iv);
    14191398
    14201399                /*Compute strain rate viscosity and pressure: */
    1421                 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
    1422                 this->material->ViscosityFS(&viscosity,2,&xyz_list[0][0],gauss,vx_input,vy_input,NULL);
     1400                this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
     1401                this->material->ViscosityFS(&viscosity,2,&xyz_list[0][0],&gauss,vx_input,vy_input,NULL);
    14231402                /*FIXME: this is for Hongju only*/
    1424         //      pressureice[iv]=gravity*rho_ice*(surface[iv]-base[iv]);
    1425         //      if (pressure[iv]/pressureice[iv]>1) pressure[iv]=pressureice[iv];
     1403                //      pressureice[iv]=gravity*rho_ice*(surface[iv]-base[iv]);
     1404                //      if (pressure[iv]/pressureice[iv]>1) pressure[iv]=pressureice[iv];
    14261405
    14271406                /*Compute Stress*/
     
    14501429                }
    14511430        }
    1452 
    1453         /*clean up*/
    1454         delete gauss;
    14551431}
    14561432/*}}}*/
     
    21552131        int index = this->GetNodeIndex(node);
    21562132
    2157         GaussTria* gauss=new GaussTria();
    2158         gauss->GaussNode(this->element_type,index);
    2159 
    2160         input->GetInputValue(pvalue,gauss);
    2161         delete gauss;
     2133        GaussTria gauss;
     2134        gauss.GaussNode(this->element_type,index);
     2135        input->GetInputValue(pvalue,&gauss);
    21622136}
    21632137/*}}}*/
     
    21692143        int index = this->GetVertexIndex(vertex);
    21702144
    2171         GaussTria* gauss=new GaussTria();
    2172         gauss->GaussVertex(index);
    2173 
    2174         input->GetInputValue(pvalue,gauss);
    2175         delete gauss;
     2145        GaussTria gauss;
     2146        gauss.GaussVertex(index);
     2147        input->GetInputValue(pvalue,&gauss);
    21762148}
    21772149/*}}}*/
     
    33163288
    33173289        /*get area coordinates of 0 and 1 locations: */
    3318         GaussTria* gauss_1=new GaussTria();
    3319         gauss_1->GaussFromCoords(x1,y1,&xyz_list[0][0]);
    3320         GaussTria* gauss_2=new GaussTria();
    3321         gauss_2->GaussFromCoords(x2,y2,&xyz_list[0][0]);
     3290        GaussTria gauss_1;
     3291        gauss_1.GaussFromCoords(x1,y1,&xyz_list[0][0]);
     3292        GaussTria gauss_2;
     3293        gauss_2.GaussFromCoords(x2,y2,&xyz_list[0][0]);
    33223294
    33233295        /*Get segment length and normal (needs to be properly oriented)*/
     
    33403312        }
    33413313
    3342         thickness_input->GetInputValue(&h1, gauss_1);
    3343         thickness_input->GetInputValue(&h2, gauss_2);
    3344         vx_input->GetInputValue(&vx1,gauss_1);
    3345         vx_input->GetInputValue(&vx2,gauss_2);
    3346         vy_input->GetInputValue(&vy1,gauss_1);
    3347         vy_input->GetInputValue(&vy2,gauss_2);
     3314        thickness_input->GetInputValue(&h1, &gauss_1);
     3315        thickness_input->GetInputValue(&h2, &gauss_2);
     3316        vx_input->GetInputValue(&vx1,&gauss_1);
     3317        vx_input->GetInputValue(&vx2,&gauss_2);
     3318        vy_input->GetInputValue(&vy1,&gauss_1);
     3319        vy_input->GetInputValue(&vy2,&gauss_2);
    33483320
    33493321        mass_flux= rho_ice*length*(
     
    33533325
    33543326        /*clean up and return:*/
    3355         delete gauss_1;
    3356         delete gauss_2;
    33573327        return mass_flux;
    33583328}
     
    35403510
    35413511        /* Start looping on the number of vertices: */
    3542         GaussTria* gauss=new GaussTria();
     3512        GaussTria gauss;
    35433513        for(int iv=0;iv<NUMVERTICES;iv++){
    3544                 gauss->GaussVertex(iv);
     3514                gauss.GaussVertex(iv);
    35453515
    35463516                /* Advection */
    3547                 vx_input->GetInputValue(&v[0],gauss);
    3548                 vy_input->GetInputValue(&v[1],gauss);
    3549                 gr_input->GetInputValue(&groundedice,gauss);
     3517                vx_input->GetInputValue(&v[0],&gauss);
     3518                vy_input->GetInputValue(&v[1],&gauss);
     3519                gr_input->GetInputValue(&groundedice,&gauss);
    35503520
    35513521                /*Get calving speed*/
     
    35533523                        case DefaultCalvingEnum:
    35543524                        case CalvingVonmisesEnum:
    3555                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    3556                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    3557                                 calvingrate_input->GetInputValue(&calvingrate,gauss);
    3558                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     3525                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     3526                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     3527                                calvingrate_input->GetInputValue(&calvingrate,&gauss);
     3528                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    35593529                                if(groundedice<0) meltingrate = 0.;
    35603530
     
    35743544
    35753545                        case CalvingLevermannEnum:
    3576                                 calvingratex_input->GetInputValue(&c[0],gauss);
    3577                                 if(dim==2) calvingratey_input->GetInputValue(&c[1],gauss);
    3578                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     3546                                calvingratex_input->GetInputValue(&c[0],&gauss);
     3547                                if(dim==2) calvingratey_input->GetInputValue(&c[1],&gauss);
     3548                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    35793549                                norm_calving=0.;
    35803550                                for(i=0;i<dim;i++) norm_calving+=pow(c[i],2);
     
    35843554
    35853555                        case CalvingMinthicknessEnum:
    3586                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    3587                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    3588                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     3556                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     3557                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     3558                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    35893559
    35903560                                norm_dlsf=0.;
     
    36053575
    36063576                        case CalvingHabEnum:
    3607                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    3608                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    3609                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     3577                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     3578                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     3579                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    36103580
    36113581                                norm_dlsf=0.;
     
    36263596
    36273597                        case CalvingCrevasseDepthEnum:
    3628                                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    3629                                 if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    3630                                 meltingrate_input->GetInputValue(&meltingrate,gauss);
     3598                                lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     3599                                if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     3600                                meltingrate_input->GetInputValue(&meltingrate,&gauss);
    36313601
    36323602                                if(groundedice<0) meltingrate = 0.;
     
    36503620                        case CalvingDev2Enum:
    36513621                                  {
    3652                                         lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    3653                                         if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    3654                                         calvingrate_input->GetInputValue(&calvingrate,gauss);
    3655                                         meltingrate_input->GetInputValue(&meltingrate,gauss);
    3656                                         gr_input->GetInputValue(&groundedice,gauss);
     3622                                        lsf_slopex_input->GetInputValue(&dlsf[0],&gauss);
     3623                                        if(dim==2) lsf_slopey_input->GetInputValue(&dlsf[1],&gauss);
     3624                                        calvingrate_input->GetInputValue(&calvingrate,&gauss);
     3625                                        meltingrate_input->GetInputValue(&meltingrate,&gauss);
     3626                                        gr_input->GetInputValue(&groundedice,&gauss);
    36573627
    36583628                                        //idea: no retreat on ice above critical calving height "calvinghaf" . Limit using regularized Heaviside function.
     
    37053675        this->AddInput(MovingFrontalVxEnum,&movingfrontvx[0],P1DGEnum);
    37063676        this->AddInput(MovingFrontalVyEnum,&movingfrontvy[0],P1DGEnum);
    3707 
    3708         /*Clean up and return*/
    3709         delete gauss;
    37103677}
    37113678/*}}}*/
     
    38283795        int         found = 0;
    38293796        IssmDouble  value;
    3830         GaussTria  *gauss = NULL;
     3797        GaussTria   gauss;
    38313798
    38323799        /*First, serarch the input: */
     
    38403807                        if(data){
    38413808                                /*ok, we are good. retrieve value of input at vertex :*/
    3842                                 gauss=new GaussTria(); gauss->GaussVertex(i);
    3843                                 data->GetInputValue(&value,gauss);
     3809                                gauss.GaussVertex(i);
     3810                                data->GetInputValue(&value,&gauss);
    38443811                                found=1;
    38453812                                break;
     
    38473814                }
    38483815        }
    3849 
    3850         /*clean-up*/
    3851         delete gauss;
    38523816
    38533817        if(found)*pvalue=value;
     
    40063970
    40073971        /*Loop over basal nodes and update their CS*/
    4008         GaussTria* gauss = new GaussTria();
     3972        GaussTria gauss;
    40093973        for(int i=0;i<this->NumberofNodesVelocity();i++){
    40103974
    40113975                if(vertexonbase[i]==1){
    4012                         gauss->GaussNode(this->VelocityInterpolation(),i);
    4013                         slope_input->GetInputValue(&slope,gauss);
    4014                         groundedicelevelset_input->GetInputValue(&groundedice,gauss);
     3976                        gauss.GaussNode(this->VelocityInterpolation(),i);
     3977                        slope_input->GetInputValue(&slope,&gauss);
     3978                        groundedicelevelset_input->GetInputValue(&groundedice,&gauss);
    40153979                        IssmDouble theta = atan(slope);
    40163980
     
    40333997        /*cleanup*/
    40343998        xDelete<IssmDouble>(vertexonbase);
    4035         delete gauss;
    40363999}
    40374000/*}}}*/
     
    40794042
    40804043        /* Start looping on the number of vertices: */
    4081         GaussTria* gauss=new GaussTria();
     4044        GaussTria gauss;
    40824045        for(int iv=0;iv<NUMVERTICES;iv++){
    4083                 gauss->GaussVertex(iv);
     4046                gauss.GaussVertex(iv);
    40844047
    40854048                /* Get variables */
    4086                 bed_input->GetInputValue(&bed,gauss);
    4087                 qsg_input->GetInputValue(&qsg,gauss);
    4088                 TF_input->GetInputValue(&TF,gauss);
     4049                bed_input->GetInputValue(&bed,&gauss);
     4050                qsg_input->GetInputValue(&qsg,&gauss);
     4051                TF_input->GetInputValue(&TF,&gauss);
    40894052
    40904053                if(basin_icefront_area[reCast<int>(basinid[iv])-1]==0.) meltrates[iv]=0.;
     
    41064069        /*Cleanup and return*/
    41074070        xDelete<IssmDouble>(basin_icefront_area);
    4108         delete gauss;
    41094071}
    41104072/*}}}*/
     
    42944256
    42954257        IssmDouble  epsilon[3];
    4296         GaussTria* gauss=NULL;
    42974258        IssmDouble  vx,vy,vel;
    42984259        IssmDouble  strainxx;
     
    43104271
    43114272        /* Start looping on the number of vertices: */
    4312         gauss=new GaussTria();
     4273        GaussTria gauss;
    43134274        for (int iv=0;iv<NUMVERTICES;iv++){
    4314                 gauss->GaussVertex(iv);
     4275                gauss.GaussVertex(iv);
    43154276
    43164277                /* Get the value we need*/
    4317                 vx_input->GetInputValue(&vx,gauss);
    4318                 vy_input->GetInputValue(&vy,gauss);
     4278                vx_input->GetInputValue(&vx,&gauss);
     4279                vy_input->GetInputValue(&vy,&gauss);
    43194280                vel=vx*vx+vy*vy;
    43204281
    43214282                /*Compute strain rate viscosity and pressure: */
    4322                 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
     4283                this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
    43234284                strainxx=epsilon[0];
    43244285                strainyy=epsilon[1];
     
    43314292        /*Add input*/
    43324293        this->AddInput(StrainRateparallelEnum,&strainparallel[0],P1DGEnum);
    4333 
    4334         /*Clean up and return*/
    4335         delete gauss;
    43364294}
    43374295/*}}}*/
    43384296void       Tria::StrainRateperpendicular(){/*{{{*/
    43394297
    4340         GaussTria* gauss=NULL;
    43414298        IssmDouble  epsilon[3];
    43424299        IssmDouble  vx,vy,vel;
     
    43554312
    43564313        /* Start looping on the number of vertices: */
    4357         gauss=new GaussTria();
     4314        GaussTria gauss;
    43584315        for (int iv=0;iv<NUMVERTICES;iv++){
    4359                 gauss->GaussVertex(iv);
     4316                gauss.GaussVertex(iv);
    43604317
    43614318                /* Get the value we need*/
    4362                 vx_input->GetInputValue(&vx,gauss);
    4363                 vy_input->GetInputValue(&vy,gauss);
     4319                vx_input->GetInputValue(&vx,&gauss);
     4320                vy_input->GetInputValue(&vy,&gauss);
    43644321                vel=vx*vx+vy*vy;
    43654322
    43664323                /*Compute strain rate viscosity and pressure: */
    4367                 this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
     4324                this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],&gauss,vx_input,vy_input);
    43684325                strainxx=epsilon[0];
    43694326                strainyy=epsilon[1];
     
    43764333        /*Add input*/
    43774334        this->AddInput(StrainRateperpendicularEnum,&strainperpendicular[0],P1DGEnum);
    4378 
    4379         /*Clean up and return*/
    4380         delete gauss;
    43814335}
    43824336/*}}}*/
     
    49964950        Input* onbase = this->GetInput(MeshVertexonbaseEnum); _assert_(onbase);
    49974951
    4998         GaussTria* gauss=new GaussTria();
     4952        GaussTria gauss;
    49994953        for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
    5000                 gauss->GaussNode(this->element_type,iv);
    5001                 onbase->GetInputValue(&isonbase,gauss);
     4954                gauss.GaussNode(this->element_type,iv);
     4955                onbase->GetInputValue(&isonbase,&gauss);
    50024956                if(isonbase==1.){
    5003                         input->GetInputValue(&value,gauss);
     4957                        input->GetInputValue(&value,&gauss);
    50044958                        this->nodes[iv]->ApplyConstraint(0,value);
    50054959                }
    50064960        }
    5007         delete gauss;
    50084961
    50094962}
     
    50204973        Input* onsurf = this->GetInput(MeshVertexonsurfaceEnum); _assert_(onsurf);
    50214974
    5022         GaussTria* gauss=new GaussTria();
     4975        GaussTria gauss;
    50234976        for(int iv=0;iv<this->NumberofNodes(this->element_type);iv++){
    5024                 gauss->GaussNode(this->element_type,iv);
    5025                 onsurf->GetInputValue(&isonsurface,gauss);
     4977                gauss.GaussNode(this->element_type,iv);
     4978                onsurf->GetInputValue(&isonsurface,&gauss);
    50264979                if(isonsurface==1.){
    5027                         input->GetInputValue(&value,gauss);
     4980                        input->GetInputValue(&value,&gauss);
    50284981                        this->nodes[iv]->ApplyConstraint(0,value);
    50294982                }
    50304983        }
    5031         delete gauss;
    50324984}
    50334985/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.