Ignore:
Timestamp:
07/30/10 09:00:31 (15 years ago)
Author:
Mathieu Morlighem
Message:

Use Matrix utils to compute determinant and matrix invert. Simple routines for 2x2 and 3x3 matrices have been added (speeds up)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/TriaRef.cpp

    r4885 r4898  
    249249        /*The Jacobian determinant is constant over the element, discard the gaussian points.
    250250         * J is assumed to have been allocated of size NDOF2xNDOF2.*/
    251 
    252         double x1,x2,x3,y1,y2,y3;
    253 
    254         x1=*(xyz_list+3*0+0);
    255         y1=*(xyz_list+3*0+1);
    256         x2=*(xyz_list+3*1+0);
    257         y2=*(xyz_list+3*1+1);
    258         x3=*(xyz_list+3*2+0);
    259         y3=*(xyz_list+3*2+1);
    260 
    261         *Jdet=SQRT3/6.0*((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1));
    262 
    263         if(Jdet<0){
    264                 ISSMERROR("negative jacobian determinant!");
    265         }
     251        double J[2][2];
     252
     253        /*Get Jacobian*/
     254        GetJacobian(&J[0][0],xyz_list,gauss);
     255
     256        /*Get Determinant*/
     257        Matrix2x2Determinant(Jdet,&J[0][0]);
     258        if(Jdet<0) ISSMERROR("negative jacobian determinant!");
    266259
    267260}
     
    296289void TriaRef::GetJacobianInvert(double*  Jinv, double* xyz_list,double* gauss){
    297290
    298         double Jdet;
    299         const int NDOF2=2;
    300         const int numgrids=3;
     291        /*Jacobian*/
     292        double J[2][2];
    301293
    302294        /*Call Jacobian routine to get the jacobian:*/
    303         GetJacobian(Jinv, xyz_list, gauss);
     295        GetJacobian(&J[0][0], xyz_list, gauss);
    304296
    305297        /*Invert Jacobian matrix: */
    306         MatrixInverse(Jinv,NDOF2,NDOF2,NULL,0,&Jdet);
     298        Matrix2x2Invert(Jinv,&J[0][0]);
    307299
    308300}
Note: See TracChangeset for help on using the changeset viewer.