Changeset 4770


Ignore:
Timestamp:
07/22/10 16:18:31 (15 years ago)
Author:
Mathieu Morlighem
Message:

moved stuff from Tria to TriaRef

Location:
issm/trunk/src/c/objects/Elements
Files:
4 edited

Legend:

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

    r4769 r4770  
    48634863}
    48644864/*}}}*/
    4865 /*FUNCTION Tria::GetB_prog {{{1*/
    4866 
    4867 void Tria::GetB_prog(double* B_prog, double* xyz_list, double* gauss_l1l2l3){
    4868 
    4869         /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
    4870          * For grid i, Bi can be expressed in the actual coordinate system
    4871          * by:
    4872          *       Bi=[ h ]
    4873          *                [ h ]
    4874          * where h is the interpolation function for grid i.
    4875          *
    4876          * We assume B_prog has been allocated already, of size: 2x(NDOF1*numgrids)
    4877          */
    4878 
    4879         int i;
    4880         const int NDOF1=1;
    4881         const int numgrids=3;
    4882 
    4883         double l1l2l3[numgrids];
    4884 
    4885 
    4886         /*Get dh1dh2dh3 in actual coordinate system: */
    4887         GetNodalFunctions(&l1l2l3[0],gauss_l1l2l3);
    4888 
    4889         /*Build B_prog: */
    4890         for (i=0;i<numgrids;i++){
    4891                 *(B_prog+NDOF1*numgrids*0+NDOF1*i)=l1l2l3[i];
    4892                 *(B_prog+NDOF1*numgrids*1+NDOF1*i)=l1l2l3[i];
    4893         }
    4894 }
    4895 /*}}}*/
    4896 /*FUNCTION Tria::GetBPrime {{{1*/
    4897 
    4898 void Tria::GetBPrime(double* Bprime, double* xyz_list, double* gauss_l1l2l3){
    4899 
    4900         /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
    4901          * For grid i, Bi' can be expressed in the actual coordinate system
    4902          * by:
    4903          *       Bi_prime=[ 2*dh/dx dh/dy ]
    4904          *                       [ dh/dx  2*dh/dy]
    4905          *                       [dh/dy dh/dx]
    4906          * where h is the interpolation function for grid i.
    4907          *
    4908          * We assume B' has been allocated already, of size: 3x(NDOF2*numgrids)
    4909          */
    4910        
    4911         int i;
    4912         const int NDOF2=2;
    4913         const int numgrids=3;
    4914 
    4915         /*Same thing in the actual coordinate system: */
    4916         double dh1dh3[NDOF2][numgrids];
    4917 
    4918 
    4919         /*Get dh1dh2dh3 in actual coordinates system : */
    4920         GetNodalFunctionsDerivatives(&dh1dh3[0][0],xyz_list,gauss_l1l2l3);
    4921 
    4922         /*Build B': */
    4923         for (i=0;i<numgrids;i++){
    4924                 *(Bprime+NDOF2*numgrids*0+NDOF2*i)=2*dh1dh3[0][i];
    4925                 *(Bprime+NDOF2*numgrids*0+NDOF2*i+1)=dh1dh3[1][i];
    4926                 *(Bprime+NDOF2*numgrids*1+NDOF2*i)=dh1dh3[0][i];
    4927                 *(Bprime+NDOF2*numgrids*1+NDOF2*i+1)=2*dh1dh3[1][i];
    4928                 *(Bprime+NDOF2*numgrids*2+NDOF2*i)=dh1dh3[1][i];
    4929                 *(Bprime+NDOF2*numgrids*2+NDOF2*i+1)=dh1dh3[0][i];
    4930         }
    4931 }
    4932 /*}}}*/
    4933 /*FUNCTION Tria::GetBPrime_prog {{{1*/
    4934 
    4935 void Tria::GetBPrime_prog(double* Bprime_prog, double* xyz_list, double* gauss_l1l2l3){
    4936 
    4937         /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
    4938          * For grid i, Bi' can be expressed in the actual coordinate system
    4939          * by:
    4940          *       Bi_prime=[ dh/dx ]
    4941          *                       [ dh/dy ]
    4942          * where h is the interpolation function for grid i.
    4943          *
    4944          * We assume B' has been allocated already, of size: 3x(NDOF2*numgrids)
    4945          */
    4946 
    4947         int i;
    4948         const int NDOF1=1;
    4949         const int NDOF2=2;
    4950         const int numgrids=3;
    4951 
    4952         /*Same thing in the actual coordinate system: */
    4953         double dh1dh3[NDOF2][numgrids];
    4954 
    4955         /*Get dh1dh2dh3 in actual coordinates system : */
    4956         GetNodalFunctionsDerivatives(&dh1dh3[0][0],xyz_list,gauss_l1l2l3);
    4957 
    4958         /*Build B': */
    4959         for (i=0;i<numgrids;i++){
    4960                 *(Bprime_prog+NDOF1*numgrids*0+NDOF1*i)=dh1dh3[0][i];
    4961                 *(Bprime_prog+NDOF1*numgrids*1+NDOF1*i)=dh1dh3[1][i];
    4962         }
    4963 }
    4964 /*}}}*/
    49654865/*FUNCTION Tria::GetElementType {{{1*/
    49664866int Tria::GetElementType(){
     
    50044904        }
    50054905
    5006 }
    5007 /*}}}*/
    5008 /*FUNCTION Tria::GetL {{{1*/
    5009 
    5010 void Tria::GetL(double* L, double* xyz_list, double* gauss_l1l2l3,int numdof){
    5011 
    5012         /*Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof.
    5013          * For grid i, Li can be expressed in the actual coordinate system
    5014          * by:
    5015          *       numdof=1:
    5016          *       Li=h;
    5017          *       numdof=2:
    5018          *       Li=[ h    0    ]
    5019          *                [   0   h  ]
    5020          * where h is the interpolation function for grid i.
    5021          *
    5022          * We assume L has been allocated already, of size: numgrids (numdof=1), or numdofx(numdof*numgrids) (numdof=2)
    5023          */
    5024 
    5025         int i;
    5026         const int NDOF2=2;
    5027         const int numgrids=3;
    5028 
    5029         double l1l2l3[3];
    5030 
    5031 
    5032         /*Get l1l2l3 in actual coordinate system: */
    5033         GetNodalFunctions(l1l2l3, gauss_l1l2l3);
    5034 
    5035 #ifdef _DELUG_
    5036         for (i=0;i<3;i++){
    5037                 printf("Node %i  h=%lf \n",i,l1l2l3[i]);
    5038         }
    5039 #endif
    5040 
    5041         /*Build L: */
    5042         if(numdof==1){
    5043                 for (i=0;i<numgrids;i++){
    5044                         L[i]=l1l2l3[i];
    5045                 }
    5046         }
    5047         else{
    5048                 for (i=0;i<numgrids;i++){
    5049                         *(L+numdof*numgrids*0+numdof*i)=l1l2l3[i]; //L[0][NDOF2*i]=dh1dh3[0][i];
    5050                         *(L+numdof*numgrids*0+numdof*i+1)=0;
    5051                         *(L+numdof*numgrids*1+numdof*i)=0;
    5052                         *(L+numdof*numgrids*1+numdof*i+1)=l1l2l3[i];
    5053                 }
    5054         }
    50554906}
    50564907/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r4769 r4770  
    136136                double  GetArea(void);
    137137                double  GetAreaCoordinate(double x, double y, int which_one);
    138                 void      GetBPrime(double* Bprime, double* xyz_list, double* gauss_l1l2l3);
    139                 void      GetBPrime_prog(double* Bprime_prog, double* xyz_list, double* gauss_l1l2l3);
    140                 void      GetB_prog(double* B_prog, double* xyz_list, double* gauss_l1l2l3);
    141138                int     GetElementType(void);
    142139                void      GetDofList(int* doflist,int* pnumberofdofs);
    143140                void      GetDofList1(int* doflist);
    144                 void      GetL(double* L, double* xyz_list, double* gauss_l1l2l3,int numdof);
    145141                void      GetParameterDerivativeValue(double* p, double* plist,double* xyz_list, double* gauss_l1l2l3);
    146142                void      GetParameterValue(double* pp, double* plist, double* gauss_l1l2l3);
    147                 void      GetParameterValue(double* pvalue,Node* node,int enumtype);
    148                 void      GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype);
     143                void    GetParameterValue(double* pvalue,Node* node,int enumtype);
     144                void    GetParameterValue(double* pvalue,Node* node1,Node* node2,double gauss_seg,int enumtype);
    149145                void      GetSolutionFromInputsDiagnosticHoriz(Vec solution);
    150146                void      GetSolutionFromInputsAdjointHoriz(Vec solution);
    151147                void      GetSolutionFromInputsDiagnosticHutter(Vec solution);
    152                 void      GetStrainRate2d(double* epsilon,double* xyz_list, double* gauss, Input* vx_input, Input* vy_input);
     148                void    GetStrainRate2d(double* epsilon,double* xyz_list, double* gauss, Input* vx_input, Input* vy_input);
    153149                void      GradjDragStokes(Vec gradient);
    154150                void      InputUpdateFromSolutionAdjointHoriz( double* solution);
  • issm/trunk/src/c/objects/Elements/TriaRef.cpp

    r4769 r4770  
    8383                *(B+NDOF2*numgrids*2+NDOF2*i)=(float).5*dh1dh3[1][i];
    8484                *(B+NDOF2*numgrids*2+NDOF2*i+1)=(float).5*dh1dh3[0][i];
     85        }
     86}
     87/*}}}*/
     88/*FUNCTION TriaRef::GetB_prog {{{1*/
     89void TriaRef::GetB_prog(double* B_prog, double* xyz_list, double* gauss){
     90        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
     91         * For grid i, Bi can be expressed in the actual coordinate system
     92         * by:
     93         *       Bi=[ h ]
     94         *          [ h ]
     95         * where h is the interpolation function for grid i.
     96         *
     97         * We assume B_prog has been allocated already, of size: 2x(NDOF1*numgrids)
     98         */
     99
     100        int i;
     101        const int NDOF1=1;
     102        const int numgrids=3;
     103
     104        double l1l2l3[numgrids];
     105
     106
     107        /*Get dh1dh2dh3 in actual coordinate system: */
     108        GetNodalFunctions(&l1l2l3[0],gauss);
     109
     110        /*Build B_prog: */
     111        for (i=0;i<numgrids;i++){
     112                *(B_prog+NDOF1*numgrids*0+NDOF1*i)=l1l2l3[i];
     113                *(B_prog+NDOF1*numgrids*1+NDOF1*i)=l1l2l3[i];
     114        }
     115}
     116/*}}}*/
     117/*FUNCTION TriaRef::GetBPrime {{{1*/
     118void TriaRef::GetBPrime(double* Bprime, double* xyz_list, double* gauss){
     119
     120        /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
     121         * For grid i, Bi' can be expressed in the actual coordinate system
     122         * by:
     123         *       Bi_prime=[ 2*dh/dx    dh/dy ]
     124         *                [   dh/dx  2*dh/dy ]
     125         *                [   dh/dy    dh/dx ]
     126         * where h is the interpolation function for grid i.
     127         *
     128         * We assume B' has been allocated already, of size: 3x(NDOF2*numgrids)
     129         */
     130
     131        int i;
     132        const int NDOF2=2;
     133        const int numgrids=3;
     134
     135        /*Same thing in the actual coordinate system: */
     136        double dh1dh3[NDOF2][numgrids];
     137
     138        /*Get dh1dh2dh3 in actual coordinates system : */
     139        GetNodalFunctionsDerivatives(&dh1dh3[0][0],xyz_list,gauss);
     140
     141        /*Build B': */
     142        for (i=0;i<numgrids;i++){
     143                *(Bprime+NDOF2*numgrids*0+NDOF2*i)=2*dh1dh3[0][i];
     144                *(Bprime+NDOF2*numgrids*0+NDOF2*i+1)=dh1dh3[1][i];
     145                *(Bprime+NDOF2*numgrids*1+NDOF2*i)=dh1dh3[0][i];
     146                *(Bprime+NDOF2*numgrids*1+NDOF2*i+1)=2*dh1dh3[1][i];
     147                *(Bprime+NDOF2*numgrids*2+NDOF2*i)=dh1dh3[1][i];
     148                *(Bprime+NDOF2*numgrids*2+NDOF2*i+1)=dh1dh3[0][i];
     149        }
     150}
     151/*}}}*/
     152/*FUNCTION TriaRef::GetBPrime_prog {{{1*/
     153void TriaRef::GetBPrime_prog(double* Bprime_prog, double* xyz_list, double* gauss){
     154        /*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2.
     155         * For grid i, Bi' can be expressed in the actual coordinate system
     156         * by:
     157         *       Bi_prime=[ dh/dx ]
     158         *                       [ dh/dy ]
     159         * where h is the interpolation function for grid i.
     160         *
     161         * We assume B' has been allocated already, of size: 3x(NDOF2*numgrids)
     162         */
     163
     164        int i;
     165        const int NDOF1=1;
     166        const int NDOF2=2;
     167        const int numgrids=3;
     168
     169        /*Same thing in the actual coordinate system: */
     170        double dh1dh3[NDOF2][numgrids];
     171
     172        /*Get dh1dh2dh3 in actual coordinates system : */
     173        GetNodalFunctionsDerivatives(&dh1dh3[0][0],xyz_list,gauss);
     174
     175        /*Build B': */
     176        for (i=0;i<numgrids;i++){
     177                *(Bprime_prog+NDOF1*numgrids*0+NDOF1*i)=dh1dh3[0][i];
     178                *(Bprime_prog+NDOF1*numgrids*1+NDOF1*i)=dh1dh3[1][i];
     179        }
     180}
     181/*}}}*/
     182/*FUNCTION TriaRef::GetL {{{1*/
     183void TriaRef::GetL(double* L, double* xyz_list, double* gauss,int numdof){
     184        /*Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof.
     185         * For grid i, Li can be expressed in the actual coordinate system
     186         * by:
     187         *       numdof=1:
     188         *       Li=h;
     189         *       numdof=2:
     190         *       Li=[ h    0    ]
     191         *                [   0   h  ]
     192         * where h is the interpolation function for grid i.
     193         *
     194         * We assume L has been allocated already, of size: numgrids (numdof=1), or numdofx(numdof*numgrids) (numdof=2)
     195         */
     196
     197        int i;
     198        const int NDOF2=2;
     199        const int numgrids=3;
     200
     201        double l1l2l3[3];
     202
     203
     204        /*Get l1l2l3 in actual coordinate system: */
     205        GetNodalFunctions(l1l2l3, gauss);
     206
     207        /*Build L: */
     208        if(numdof==1){
     209                for (i=0;i<numgrids;i++){
     210                        L[i]=l1l2l3[i];
     211                }
     212        }
     213        else{
     214                for (i=0;i<numgrids;i++){
     215                        *(L+numdof*numgrids*0+numdof*i)=l1l2l3[i]; //L[0][NDOF2*i]=dh1dh3[0][i];
     216                        *(L+numdof*numgrids*0+numdof*i+1)=0;
     217                        *(L+numdof*numgrids*1+numdof*i)=0;
     218                        *(L+numdof*numgrids*1+numdof*i+1)=l1l2l3[i];
     219                }
    85220        }
    86221}
  • issm/trunk/src/c/objects/Elements/TriaRef.h

    r4769 r4770  
    2424                /*Numerics*/
    2525                void GetB(double* B, double* xyz_list, double* gauss);
     26                void GetBPrime(double* Bprime, double* xyz_list, double* gauss);
     27                void GetBPrime_prog(double* Bprime_prog, double* xyz_list, double* gauss);
     28                void GetB_prog(double* B_prog, double* xyz_list, double* gauss);
     29                void GetL(double* L, double* xyz_list, double* gauss,int numdof);
    2630                void GetJacobian(double* J, double* xyz_list,double* gauss);
    2731                void GetJacobianDeterminant2d(double* Jdet, double* xyz_list,double* gauss);
Note: See TracChangeset for help on using the changeset viewer.