Changeset 16377


Ignore:
Timestamp:
10/10/13 21:14:16 (11 years ago)
Author:
Mathieu Morlighem
Message:

NEW: added more capabilities to SegRef

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

Legend:

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

    r16343 r16377  
    4848
    4949/*Reference Element numerics*/
     50/*FUNCTION SegRef::GetNodalFunctions{{{*/
     51void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){
     52        /*This routine returns the values of the nodal functions  at the gaussian point.*/
    5053
     54        _assert_(basis);
     55
     56        switch(this->element_type){
     57                case P1Enum: case P1DGEnum:
     58                        basis[0]=(1.-gauss->coord1)/2.;
     59                        basis[1]=(1.+gauss->coord1)/2.;
     60                        return;
     61                default:
     62                        _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
     63        }
     64}
     65/*}}}*/
     66/*FUNCTION SegRef::GetJacobian{{{*/
     67void SegRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussSeg* gauss){
     68        /*The Jacobian is constant over the element, discard the gaussian points.
     69         * J is assumed to have been allocated of size 1*/
     70
     71        IssmDouble x1=xyz_list[3*0+0];
     72        IssmDouble y1=xyz_list[3*0+1];
     73        IssmDouble z1=xyz_list[3*0+2];
     74        IssmDouble x2=xyz_list[3*1+0];
     75        IssmDouble y2=xyz_list[3*1+1];
     76        IssmDouble z2=xyz_list[3*1+2];
     77
     78        *Jdet=.5*sqrt(pow(x2-x1,2) + pow(y2-y1,2) + pow(z2-z1,2));
     79        if(*Jdet<0) _error_("negative jacobian determinant!");
     80}
     81/*}}}*/
     82/*FUNCTION SegRef::GetJacobianDeterminant{{{*/
     83void SegRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussSeg* gauss){
     84        /*The Jacobian determinant is constant over the element, discard the gaussian points.
     85         * J is assumed to have been allocated of size NDOF2xNDOF2.*/
     86
     87        /*Call Jacobian routine to get the jacobian:*/
     88        GetJacobian(&Jdet, xyz_list, gauss);
     89
     90}
     91/*}}}*/
     92/*FUNCTION SegRef::GetJacobianInvert {{{*/
     93void SegRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussSeg* gauss){
     94
     95        /*Jacobian*/
     96        IssmDouble J;
     97
     98        /*Call Jacobian routine to get the jacobian:*/
     99        GetJacobian(&J, xyz_list, gauss);
     100
     101        /*Invert Jacobian matrix: */
     102        *Jinv = 1./J;
     103}
     104/*}}}*/
  • TabularUnified issm/trunk-jpl/src/c/classes/Elements/SegRef.h

    r16343 r16377  
    2222                /*Management*/
    2323                void SetElementType(int type,int type_counter);
     24                void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussSeg* gauss);
     25                void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussSeg* gauss);
     26                void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussSeg* gauss);
     27                void GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss);
    2428};
    2529#endif
Note: See TracChangeset for help on using the changeset viewer.