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 hierarchic mode shapes associated with a given mesh
11 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
E_modeShape(int p,double * L)21 double E_modeShape(int p, double *L) {
22 /* Return edge mode shape function evaluated along an edge at a point (Li,Lj)
23 for polynomial order p, note returned mode is of polynomial order p-2 */
24 if( p < 2 )
25 return 0.0;
26 else
27 return En(p-2,L[0],L[1]);
28 }
29
F_modeShapeTri(int p,int i,double * L)30 double F_modeShapeTri(int p, int i, double *L) {
31 int alpha,beta,found,count,nskip;
32 /* return i-th triangular face mode of polynomial order p
33 note: there are p-2 modes with polynomial order p */
34
35 if( p < 3 || i < 0 || i > p-3 )
36 return 0.0 ;
37
38 count = found = 0;
39 for(alpha=0; alpha <= p-3; alpha++) {
40 for(beta=0; beta <= p-3; beta++) {
41 if( alpha+beta == p-3 ) {
42 if( count == i )
43 found=1;
44 else
45 count++;
46 }
47 if( found )
48 break;
49 }
50 if( found )
51 break;
52 }
53 if( found )
54 return Fn(alpha, beta, L[0], L[1]);
55 else
56 return 0.0;
57 }
58
F_modeShapeQuad(int p,int i,double * L)59 double F_modeShapeQuad(int p, int i, double *L) {
60 /* return ith p-order quad face mode evaluated at L */
61 return 0.0;
62 }
63
R_modeShapeTet(int p,int i,double * L)64 double R_modeShapeTet(int p, int i, double *L) {
65 int alpha,beta,gamma,count,found;
66
67 /* return the i-th mode shape of polynomial order p for this region , there are
68 (p-2)*(p-3)/2 mode shapes of polynomial order p */
69 if( p < 4 || i < 0 || i > (((p-2)*(p-3)/2)-1) )
70 return 0.0;
71
72 count = 0;
73 found = 0;
74 for( alpha=0; alpha <= p-4; alpha++) {
75 for( beta=0; beta <= p-4; beta++) {
76 for( gamma=0; gamma <= p-4; gamma++) {
77 if( alpha+beta+gamma == p-4 ) {
78 if( count == i )
79 found = 1;
80 else
81 count++;
82 }
83 if( found )
84 break ;
85 }
86 if( found )
87 break ;
88 }
89 if( found )
90 break ;
91 }
92 if( found )
93 return Bn(alpha,beta,gamma,L[0],L[1],L[2]);
94 else
95 return 0.0;
96 }
97
R_modeShapeHex(int p,int i,double * L)98 double R_modeShapeHex(int p, int i, double *L) {
99 /* ith p-order mode shape for a hex element */
100 return 0.0;
101 }
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107
108
109
110
111
112