Changeset 15814


Ignore:
Timestamp:
08/13/13 10:24:55 (12 years ago)
Author:
Mathieu Morlighem
Message:

BUG: fixing seg fault in 3d GL migration module

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

Legend:

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

    r15792 r15814  
    10241024        const IssmPDouble  epsilon= 1.e-15;
    10251025        IssmDouble         phi,s1,s2,area_init,area_grounded;
    1026         IssmDouble         gl[3];
    1027         IssmDouble         xyz_bis[3][3];
     1026        IssmDouble         gl[NUMVERTICES];
     1027        IssmDouble         xyz_bis[NUMVERTICES2D][3];
    10281028
    10291029        /*Recover parameters and values*/
     
    10311031
    10321032        /*Be sure that values are not zero*/
    1033         if(gl[0]==0) gl[0]=gl[0]+epsilon;
    1034         if(gl[1]==0) gl[1]=gl[1]+epsilon;
    1035         if(gl[2]==0) gl[2]=gl[2]+epsilon;
     1033        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     1034        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     1035        if(gl[2]==0.) gl[2]=gl[2]+epsilon;
    10361036
    10371037        /*Check that not all nodes are grounded or floating*/
     
    10481048                if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
    10491049                        /*Coordinates of point 2: same as initial point 2*/
    1050                         xyz_bis[2][0]=*(xyz_list+3*2+0);
    1051                         xyz_bis[2][1]=*(xyz_list+3*2+1);
    1052                         xyz_bis[2][2]=*(xyz_list+3*2+2);
     1050                        xyz_bis[2][0]=xyz_list[3*2+0];
     1051                        xyz_bis[2][1]=xyz_list[3*2+1];
     1052                        xyz_bis[2][2]=xyz_list[3*2+2];
    10531053
    10541054                        /*Portion of the segments*/
     
    10571057
    10581058                        /*New point 1*/
    1059                         xyz_bis[1][0]=*(xyz_list+3*2+0)+s1*(*(xyz_list+3*1+0)-*(xyz_list+3*2+0));
    1060                         xyz_bis[1][1]=*(xyz_list+3*2+1)+s1*(*(xyz_list+3*1+1)-*(xyz_list+3*2+1));
    1061                         xyz_bis[1][2]=*(xyz_list+3*2+2)+s1*(*(xyz_list+3*1+2)-*(xyz_list+3*2+2));
     1059                        xyz_bis[1][0]=xyz_list[3*2+0]+s1*(xyz_list[3*1+0]-xyz_list[3*2+0]);
     1060                        xyz_bis[1][1]=xyz_list[3*2+1]+s1*(xyz_list[3*1+1]-xyz_list[3*2+1]);
     1061                        xyz_bis[1][2]=xyz_list[3*2+2]+s1*(xyz_list[3*1+2]-xyz_list[3*2+2]);
    10621062
    10631063                        /*New point 0*/
    1064                         xyz_bis[0][0]=*(xyz_list+3*2+0)+s2*(*(xyz_list+3*0+0)-*(xyz_list+3*2+0));
    1065                         xyz_bis[0][1]=*(xyz_list+3*2+1)+s2*(*(xyz_list+3*0+1)-*(xyz_list+3*2+1));
    1066                         xyz_bis[0][2]=*(xyz_list+3*2+2)+s2*(*(xyz_list+3*0+2)-*(xyz_list+3*2+2));
     1064                        xyz_bis[0][0]=xyz_list[3*2+0]+s2*(xyz_list[3*0+0]-xyz_list[3*2+0]);
     1065                        xyz_bis[0][1]=xyz_list[3*2+1]+s2*(xyz_list[3*0+1]-xyz_list[3*2+1]);
     1066                        xyz_bis[0][2]=xyz_list[3*2+2]+s2*(xyz_list[3*0+2]-xyz_list[3*2+2]);
    10671067                }
    10681068                else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
     
    11081108
    11091109                /*Compute fraction of grounded element*/
    1110                 GetJacobianDeterminant(&area_init, xyz_list,NULL);
    1111                 GetJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);
     1110                GetTriaJacobianDeterminant(&area_init, xyz_list,NULL);
     1111                GetTriaJacobianDeterminant(&area_grounded, &xyz_bis[0][0],NULL);
    11121112                if(mainlyfloating==true) area_grounded=area_init-area_grounded;
    11131113                phi=area_grounded/area_init;
    11141114        }
    11151115
    1116         if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
     1116        if(phi>1. || phi<0.) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
    11171117
    11181118        return phi;
     
    76607660        int         analysis_type,migration_style;
    76617661        IssmDouble  xyz_list[NUMVERTICES][3];
    7662         IssmDouble  xyz_list_tria[NUMVERTICES2D][3]={0.};
     7662        IssmDouble  xyz_list_tria[NUMVERTICES2D][3];
    76637663        IssmDouble  alpha2,Jdet;
    76647664        IssmDouble  phi=1.0;
     
    76937693
    76947694        /*Recover portion of element that is grounded*/
    7695         if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list[0][0]);
     7695        if(migration_style==SubelementMigrationEnum) phi=this->GetGroundedPortion(&xyz_list_tria[0][0]);
    76967696
    76977697        /* Start  looping on the number of gaussian points: */
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r15771 r15814  
    818818        int                point;
    819819        const IssmPDouble  epsilon= 1.e-15;
    820         IssmDouble         gl[3];
     820        IssmDouble         gl[NUMVERTICES];
    821821        IssmDouble         f1,f2;
    822822
     
    825825
    826826        /*Be sure that values are not zero*/
    827         if(gl[0]==0) gl[0]=gl[0]+epsilon;
    828         if(gl[1]==0) gl[1]=gl[1]+epsilon;
    829         if(gl[2]==0) gl[2]=gl[2]+epsilon;
     827        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     828        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     829        if(gl[2]==0.) gl[2]=gl[2]+epsilon;
    830830
    831831        /*Check that not all nodes are grounded or floating*/
     
    869869        /*Computeportion of the element that is grounded*/
    870870
    871         bool               mainlyfloating = true;
    872         const IssmPDouble  epsilon= 1.e-15;
     871        bool              mainlyfloating = true;
     872        const IssmPDouble epsilon        = 1.e-15;
    873873        IssmDouble         phi,s1,s2,area_init,area_grounded;
    874         IssmDouble         gl[3];
     874        IssmDouble         gl[NUMVERTICES];
    875875        IssmDouble         xyz_bis[3][3];
    876876
     
    879879
    880880        /*Be sure that values are not zero*/
    881         if(gl[0]==0) gl[0]=gl[0]+epsilon;
    882         if(gl[1]==0) gl[1]=gl[1]+epsilon;
    883         if(gl[2]==0) gl[2]=gl[2]+epsilon;
     881        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     882        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     883        if(gl[2]==0.) gl[2]=gl[2]+epsilon;
    884884
    885885        /*Check that not all nodes are grounded or floating*/
Note: See TracChangeset for help on using the changeset viewer.