1 /*------------------------------------------------------------------------- 2 Scientific Computation Research Center, RPI, Troy NY 3 (C) Copyright 1995, RPI-SCOREC 4 5 Project : shapeFuntions 6 Author(s): Saikat Dey 7 Creation : Oct., 95 8 Modifi. : 9 Function : 10 return derivative hierarchic mode shapes associated with 11 a given mesh entity of a specified polynomial order. 12 -------------------------------------------------------------------------*/ 13 14 #include <math.h> 15 #include "shapeFuncInternals.h" 16 17 #ifdef __cplusplus 18 extern "C" { 19 #endif 20 21 int E_modeShapeDrv(int p, double *L, double drv[2]) { 22 /* Return derivative edge mode shape function evaluated along an edge at 23 a point for spectral interpolation order p L[0,1] in [0,1] r+s <= 1 24 */ 25 return EnDrv(p-2,L[0],L[1],drv); 26 } 27 28 int F_modeShapeTriDrv(int p, int i, double *L, double mdrv[2]) { 29 int alpha,beta,found,count; 30 double rs,rst2,P1P2,t,P1,P2,dP1,dP2,t1,t2; 31 /* return i-th triangular face mode derivative of polynomial order p 32 note: there are p-2 modes with polynomial order p */ 33 34 if( p < 3 || i < 0 || i > p-3 ) 35 return 0.0 ; 36 37 count = found = 0; 38 for(alpha=0; alpha <= p-3; alpha++) { 39 for(beta=0; beta <= p-3; beta++) { 40 if( alpha+beta == p-3 ) { 41 if( count == i ) 42 found=1; 43 else 44 count++; 45 } 46 if(found) 47 break ; 48 } 49 if(found) 50 break; 51 } 52 if( found ) { 53 return FnDrv(alpha,beta,L[0],L[1],mdrv); 54 } else 55 return 0; 56 } 57 58 int F_modeShapeQuadDrv(int p, int i, double *L, double mdrv[2]) { 59 return 0; 60 } 61 62 int R_modeShapeTetDrv(int p, int i, double *L, double mdrv[3]) { 63 int alpha,beta,gamma,count,found ; 64 double Pr,Ps,Pt,dPr,dPs,dPt,w,rst,rstw2,PrPsPt,t1; 65 66 /* return the i-th mode shape of polynomial order p for this region , there are 67 (p-2)*(p-3)/2 mode shapes of polynomial order p */ 68 if( p < 4 || i < 0 || i > (((p-2)*(p-3)/2)-1) ) 69 return 0.0; 70 71 count = 0; 72 found = 0; 73 for( alpha=0; alpha <= p-4; alpha++) { 74 for( beta=0; beta <= p-4; beta++) { 75 for( gamma=0; gamma <= p-4; gamma++) { 76 if( alpha+beta+gamma == p-4 ) { 77 if( count == i ) 78 found = 1; 79 else 80 count++; 81 } 82 if(found) break; 83 } 84 if(found) break; 85 } 86 if(found) break; 87 } 88 if( found ) { 89 return BnDrv(alpha,beta,gamma,L[0],L[1],L[2],mdrv); 90 } else 91 return 0; 92 } 93 94 int R_modeShapeHexDrv(int p, int i, double *L, double mdrv[3]) { 95 return 0; 96 } 97 98 #ifdef __cplusplus 99 } 100 #endif 101 102 103 104 105 106 107