Changeset 16145


Ignore:
Timestamp:
09/17/13 12:28:19 (12 years ago)
Author:
seroussi
Message:

BUG: fixed problem with normal orientation initialization

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

Legend:

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

    r16144 r16145  
    16991699        /*Computeportion of the element that is grounded*/
    17001700
    1701         int         normal_orientation;
     1701        int         normal_orientation=0;
    17021702        IssmDouble  s1,s2;
    17031703        IssmDouble  levelset[NUMVERTICES];
     
    17061706        GetInputListOnVertices(&levelset[0],levelsetenum);
    17071707
    1708         if(levelset[0]*levelset[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
     1708        if(levelset[0]*levelset[1]>0.){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
    17091709                /*Portion of the segments*/
    17101710                s1=levelset[2]/(levelset[2]-levelset[1]);
    17111711                s2=levelset[2]/(levelset[2]-levelset[0]);
    17121712
    1713                 if(levelset[2]>0) normal_orientation=1;
     1713                if(levelset[2]>0.) normal_orientation=1;
    17141714                /*New point 1*/
    17151715                xyz_zero[3*normal_orientation+0]=xyz_list[2][0]+s1*(xyz_list[1][0]-xyz_list[2][0]);
     
    17321732                xyz_zero[3*(2+normal_orientation)+2]=xyz_list[5][2]+s2*(xyz_list[3][2]-xyz_list[5][2]);
    17331733        }
    1734         else if(levelset[1]*levelset[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
     1734        else if(levelset[1]*levelset[2]>0.){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
    17351735                /*Portion of the segments*/
    17361736                s1=levelset[0]/(levelset[0]-levelset[2]);
    17371737                s2=levelset[0]/(levelset[0]-levelset[1]);
    17381738
    1739                 if(levelset[0]>0) normal_orientation=1;
     1739                if(levelset[0]>0.) normal_orientation=1;
    17401740                /*New point 1*/
    17411741                xyz_zero[3*normal_orientation+0]=xyz_list[0][0]+s1*(xyz_list[2][0]-xyz_list[0][0]);
     
    17581758                xyz_zero[3*(2+normal_orientation)+2]=xyz_list[3][2]+s2*(xyz_list[4][2]-xyz_list[3][2]);
    17591759        }
    1760         else if(levelset[0]*levelset[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
     1760        else if(levelset[0]*levelset[2]>0.){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
    17611761                /*Portion of the segments*/
    17621762                s1=levelset[1]/(levelset[1]-levelset[0]);
    17631763                s2=levelset[1]/(levelset[1]-levelset[2]);
    17641764
    1765                 if(levelset[1]>0) normal_orientation=1;
     1765                if(levelset[1]>0.) normal_orientation=1;
    17661766                /*New point 0*/
    17671767                xyz_zero[3*normal_orientation+0]=xyz_list[1][0]+s1*(xyz_list[0][0]-xyz_list[1][0]);
     
    17841784                xyz_zero[3*(2+normal_orientation)+2]=xyz_list[4][2]+s2*(xyz_list[5][2]-xyz_list[4][2]);
    17851785        }
    1786         else if(levelset[0]==0 && levelset[1]==0){ //front is on point 0 and 1
     1786        else if(levelset[0]==0. && levelset[1]==0.){ //front is on point 0 and 1
    17871787                xyz_zero[3*0+0]=xyz_list[0][0];
    17881788                xyz_zero[3*0+1]=xyz_list[0][1];
     
    18041804                xyz_zero[3*3+2]=xyz_list[3][2];
    18051805        }
    1806         else if(levelset[0]==0 && levelset[2]==0){ //front is on point 0 and 1
     1806        else if(levelset[0]==0. && levelset[2]==0.){ //front is on point 0 and 1
    18071807                xyz_zero[3*0+0]=xyz_list[2][0];
    18081808                xyz_zero[3*0+1]=xyz_list[2][1];
     
    18241824                xyz_zero[3*3+2]=xyz_list[5][2];
    18251825        }
    1826         else if(levelset[1]==0 && levelset[2]==0){ //front is on point 0 and 1
     1826        else if(levelset[1]==0. && levelset[2]==0.){ //front is on point 0 and 1
    18271827                xyz_zero[3*0+0]=xyz_list[1][0];
    18281828                xyz_zero[3*0+1]=xyz_list[1][1];
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r16144 r16145  
    10061006        /*Computeportion of the element that is grounded*/
    10071007
    1008         int         normal_orientation;
     1008        int         normal_orientation=0;
    10091009        IssmDouble  s1,s2;
    10101010        IssmDouble  levelset[NUMVERTICES];
     
    10131013        GetInputListOnVertices(&levelset[0],levelsetenum);
    10141014
    1015         if(levelset[0]*levelset[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
     1015        if(levelset[0]*levelset[1]>0.){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
    10161016                /*Portion of the segments*/
    10171017                s1=levelset[2]/(levelset[2]-levelset[1]);
    10181018                s2=levelset[2]/(levelset[2]-levelset[0]);
    10191019
    1020                 if(levelset[2]>0) normal_orientation=1;
     1020                if(levelset[2]>0.) normal_orientation=1;
    10211021                /*New point 1*/
    10221022                xyz_zero[3*normal_orientation+0]=xyz_list[2][0]+s1*(xyz_list[1][0]-xyz_list[2][0]);
     
    10291029                xyz_zero[3*(1-normal_orientation)+2]=xyz_list[2][2]+s2*(xyz_list[0][2]-xyz_list[2][2]);
    10301030        }
    1031         else if(levelset[1]*levelset[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
     1031        else if(levelset[1]*levelset[2]>0.){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
    10321032                /*Portion of the segments*/
    10331033                s1=levelset[0]/(levelset[0]-levelset[2]);
    10341034                s2=levelset[0]/(levelset[0]-levelset[1]);
    10351035
    1036                 if(levelset[0]>0) normal_orientation=1;
     1036                if(levelset[0]>0.) normal_orientation=1;
    10371037                /*New point 1*/
    10381038                xyz_zero[3*normal_orientation+0]=xyz_list[0][0]+s1*(xyz_list[2][0]-xyz_list[0][0]);
     
    10451045                xyz_zero[3*(1-normal_orientation)+2]=xyz_list[0][2]+s2*(xyz_list[1][2]-xyz_list[0][2]);
    10461046        }
    1047         else if(levelset[0]*levelset[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
     1047        else if(levelset[0]*levelset[2]>0.){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
    10481048                /*Portion of the segments*/
    10491049                s1=levelset[1]/(levelset[1]-levelset[0]);
    10501050                s2=levelset[1]/(levelset[1]-levelset[2]);
    10511051
    1052                 if(levelset[1]>0) normal_orientation=1;
     1052                if(levelset[1]>0.) normal_orientation=1;
    10531053                /*New point 0*/
    10541054                xyz_zero[3*normal_orientation+0]=xyz_list[1][0]+s1*(xyz_list[0][0]-xyz_list[1][0]);
     
    10611061                xyz_zero[3*(1-normal_orientation)+2]=xyz_list[1][2]+s2*(xyz_list[2][2]-xyz_list[1][2]);
    10621062        }
    1063         else if(levelset[0]==0 && levelset[1]==0){ //front is on point 0 and 1
     1063        else if(levelset[0]==0. && levelset[1]==0.){ //front is on point 0 and 1
    10641064                xyz_zero[3*0+0]=xyz_list[0][0];
    10651065                xyz_zero[3*0+1]=xyz_list[0][1];
     
    10711071                xyz_zero[3*1+2]=xyz_list[1][2];
    10721072        }
    1073         else if(levelset[0]==0 && levelset[2]==0){ //front is on point 0 and 1
     1073        else if(levelset[0]==0. && levelset[2]==0.){ //front is on point 0 and 1
    10741074                xyz_zero[3*0+0]=xyz_list[2][0];
    10751075                xyz_zero[3*0+1]=xyz_list[2][1];
     
    10811081                xyz_zero[3*1+2]=xyz_list[0][2];
    10821082        }
    1083         else if(levelset[1]==0 && levelset[2]==0){ //front is on point 0 and 1
     1083        else if(levelset[1]==0. && levelset[2]==0.){ //front is on point 0 and 1
    10841084                xyz_zero[3*0+0]=xyz_list[1][0];
    10851085                xyz_zero[3*0+1]=xyz_list[1][1];
Note: See TracChangeset for help on using the changeset viewer.