Changeset 21898


Ignore:
Timestamp:
07/30/17 20:13:36 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added Max function for Seg

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

Legend:

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

    r19395 r21898  
    168168        *pxyz_front=xyz_front;
    169169}/*}}}*/
     170IssmDouble Seg::GetGroundedPortion(IssmDouble* xyz_list){/*{{{*/
     171        /*Computeportion of the element that is grounded*/
     172
     173        bool              mainlyfloating = true;
     174        const IssmPDouble epsilon        = 1.e-15;
     175        IssmDouble        phi;
     176        IssmDouble        gl[NUMVERTICES];
     177
     178        /*Recover parameters and values*/
     179        parameters->FindParam(&domaintype,DomainTypeEnum);
     180        GetInputListOnVertices(&gl[0],MaskGroundediceLevelsetEnum);
     181
     182        /*Be sure that values are not zero*/
     183        if(gl[0]==0.) gl[0]=gl[0]+epsilon;
     184        if(gl[1]==0.) gl[1]=gl[1]+epsilon;
     185
     186        if(gl[0]>0 && gl[1]>0) phi=1; // All grounded
     187        else if(gl[0]<0 && gl[1]<0) phi=0; // All floating
     188        else if(gl[0]<0 && gl[1]>0){ //1 grounded
     189                phi=1./(1.-gl[0]/gl[1]);
     190        }
     191        else if(gl[1]<0 && gl[0]>0){ //0 grounded
     192                phi=1./(1.-gl[1]/gl[0]);
     193        }
     194
     195        if(phi>1 || phi<0) _error_("Error. Problem with portion of grounded element: value should be between 0 and 1");
     196
     197        return phi;
     198}
     199/*}}}*/
    170200int        Seg::GetNumberOfNodes(void){/*{{{*/
    171201        return this->NumberofNodes(this->element_type);
  • issm/trunk-jpl/src/c/classes/Elements/Seg.h

    r21892 r21898  
    6262                int         GetElementType(void){_error_("not implemented yet");};
    6363                void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
    64                 IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
     64                IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
    6565                void               GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
    6666                void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
Note: See TracChangeset for help on using the changeset viewer.