xref: /phasta/shapeFunction/src/blend.c (revision 43c56ca5a35722d85cb4464ff0683d63f8eb4a00)
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              evaluate the blend funtion for a given mesh entity over another
11              mesh entity
12 -------------------------------------------------------------------------*/
13 
14 #include <math.h>
15 #include "shapeFuncInternals.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 double V_blendOnEntity(int vid, int etype, double *L) {
22   /* blend a vertex mode on a mesh entity */
23   /* vid = local vertex index
24      etype = entity type
25      L = par. coords
26   */
27   if( etype == Sedge )
28     return V_blendIndexedOnEdge(vid,L);
29   else if(etype == Stri || etype == Stet)
30     return V_blendIndexed(vid,L);
31   else
32     return 0.0e0;
33 }
34 
35 double V_blendIndexed(int i, double *L) {
36   return L[i] ;
37 }
38 
39 double V_blendIndexedOnEdge(int i, double *L) {
40   if( i == 0 )
41     return 0.5*(1.0-L[0]);
42   else
43     return 0.5*(1.0+L[0]);
44 }
45 
46 double E_blendOnFace(int eindex[], int etype, double *L) {
47   /* blend a vertex mode on a mesh face */
48   /* vid = local vertex index
49      etype = entity type
50      L = par. coords
51   */
52   if( etype == Stri)
53     return F_edgeBlendTri(eindex, L);
54   else if(etype == Squad)
55     return F_edgeBlendQuad(eindex, L);
56   else
57     return 0.0e0;
58 }
59 
60 double F_edgeBlendTri(int index[2], double *L) {
61   return -2.0*L[index[0]]*L[index[1]];
62 }
63 
64 double F_edgeBlendQuad(int *index, double *L) {
65   return 0.0;
66 }
67 
68 double E_blendOnRegion(int eindex[], int etype, double *L) {
69   /* blend a mesh edge mode on a tetra. region */
70  if( etype == Stet )
71     return R_edgeBlendTet(eindex, L);
72  else
73   return 0.0;
74 }
75 
76 double R_edgeBlendTet(int index[2], double *L) {
77   return -2.0*L[index[0]]*L[index[1]];
78 }
79 
80 double F_blendOnRegion(int index[], int etype, double *L) {
81   /* blend a face mode on a tet. region */
82   if( etype == Stet ) {
83     return L[index[0]]*L[index[1]]*L[index[2]] ;
84   } else
85     return 0.0;
86 }
87 
88 #ifdef __cplusplus
89 }
90 #endif
91