/[escript]/branches/domexper/dudley/src/ReferenceElements.c
ViewVC logotype

Diff of /branches/domexper/dudley/src/ReferenceElements.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3151 by jfenwick, Fri Sep 3 03:49:32 2010 UTC revision 3152 by jfenwick, Fri Sep 3 05:48:31 2010 UTC
# Line 25  Line 25 
25      this list has been generated by generateReferenceElementList.py:.      this list has been generated by generateReferenceElementList.py:.
26  */  */
27  Dudley_ReferenceElementInfo Dudley_ReferenceElement_InfoList[]={  Dudley_ReferenceElementInfo Dudley_ReferenceElement_InfoList[]={
28  { Point1, "Point1", 1, Point1,  { Point1, "Point1", 1,
29       PointQuad, Point1Shape, Point1Shape,       PointQuad, Point1Shape,
30    1,    1,
31      { 0 },      { 0 },
32      { -1 } },      { -1 } },
33  { Line2, "Line2", 2, Line2,  { Line2, "Line2", 2,
34      LineQuad, Line2Shape, Line2Shape,      LineQuad, Line2Shape,
35    2,    2,
36      { 1, 0 },      { 1, 0 },
37      { -1 } },      { -1 } },
38  { Tri3, "Tri3", 3, Tri3,  { Tri3, "Tri3", 3,
39      TriQuad, Tri3Shape, Tri3Shape,      TriQuad, Tri3Shape,
40    3,    3,
41      { 1, 2, 0 },      { 1, 2, 0 },
42      { 0, 2, 1 } },      { 0, 2, 1 } },
43  { Tet4, "Tet4", 4, Tet4,  { Tet4, "Tet4", 4,
44      TetQuad, Tet4Shape, Tet4Shape,      TetQuad, Tet4Shape,
45    4,    4,
46      { -1 },      { -1 },
47      { -1 } },      { -1 } },
48  { Line2Face, "Line2Face", 2, Line2Face,  { Line2Face, "Line2Face", 2,
49      PointQuad, Line2Shape, Line2Shape,      PointQuad, Line2Shape,
50    1,    1,
51      { 0, 1, 2 },      { 0, 1, 2 },
52      { -1 } },      { -1 } },
53  { Tri3Face, "Tri3Face", 3, Tri3Face,  { Tri3Face, "Tri3Face", 3,
54      LineQuad, Tri3Shape, Tri3Shape,      LineQuad, Tri3Shape,
55    2,    2,
56      { 1, 0, 2 },      { 1, 0, 2 },
57      { -1 } },      { -1 } },
58  { Tet4Face, "Tet4Face", 4, Tet4Face,  { Tet4Face, "Tet4Face", 4,
59      TriQuad, Tet4Shape, Tet4Shape,      TriQuad, Tet4Shape,
60    4,    4,
61      { 1, 2, 0, 3 },      { 1, 2, 0, 3 },
62      { 0, 2, 1, 3 } },      { 0, 2, 1, 3 } },
63  { NoRef, "noElement", 0, NoRef,  { NoRef, "noElement", 0,
64      NoQuad, NoShape, NoShape,      NoQuad, NoShape,
65    -1,    -1,
66      { 0 },      { 0 },
67      { 0 } }      { 0 } }
# Line 81  Dudley_ReferenceElement* Dudley_Referenc Line 81  Dudley_ReferenceElement* Dudley_Referenc
81      double *quadWeights=NULL, *quadNodes=NULL;      double *quadWeights=NULL, *quadNodes=NULL;
82      Dudley_ReferenceElement *out=NULL;      Dudley_ReferenceElement *out=NULL;
83      Dudley_QuadInfo* quadscheme;      Dudley_QuadInfo* quadscheme;
84      Dudley_ShapeFunctionInfo* parametrization, *basisfunction, *linearbasisfunction;      Dudley_ShapeFunctionInfo *basisfunction;
85      Dudley_ReferenceElementInfo *type, *linear_type;      Dudley_ReferenceElementInfo *type;
86    
87          type=Dudley_ReferenceElement_getInfo(id);          type=Dudley_ReferenceElement_getInfo(id);
88          if (type == NULL)          if (type == NULL)
# Line 90  Dudley_ReferenceElement* Dudley_Referenc Line 90  Dudley_ReferenceElement* Dudley_Referenc
90               Dudley_setError(VALUE_ERROR,"Dudley_ReferenceElement_alloc: unable to identify element type.");               Dudley_setError(VALUE_ERROR,"Dudley_ReferenceElement_alloc: unable to identify element type.");
91              return NULL;              return NULL;
92          }          }
         linear_type=Dudley_ReferenceElement_getInfo(type->LinearTypeId);  
         if (linear_type == NULL)  
     {  
             Dudley_setError(VALUE_ERROR,"Dudley_ReferenceElement_alloc: unable to identify linear element type.");  
             return NULL;  
         }  
93      out=MEMALLOC(1,Dudley_ReferenceElement);      out=MEMALLOC(1,Dudley_ReferenceElement);
94      if (Dudley_checkPtr(out)) return NULL;      if (Dudley_checkPtr(out)) return NULL;
95      out->reference_counter=0;      out->reference_counter=0;
     out->Parametrization=NULL;  
96      out->BasisFunctions=NULL;      out->BasisFunctions=NULL;
     out->LinearBasisFunctions=NULL;  
97      out->Type=type;      out->Type=type;
98      out->numNodes=out->Type->numNodes;      out->numNodes=out->Type->numNodes;
     out->LinearType=linear_type;  
     out->numLinearNodes=out->LinearType->numNodes;  
99          out->integrationOrder=-1;          out->integrationOrder=-1;
100          out->DBasisFunctionDv=NULL;          out->DBasisFunctionDv=NULL;
101          out->DBasisFunctionDvShared=TRUE;          out->DBasisFunctionDvShared=TRUE;
102    
103      quadscheme=Dudley_QuadInfo_getInfo(out->Type->Quadrature);      quadscheme=Dudley_QuadInfo_getInfo(out->Type->Quadrature);
     parametrization=Dudley_ShapeFunction_getInfo(out->Type->Parametrization);  
104      basisfunction=Dudley_ShapeFunction_getInfo(out->Type->BasisFunctions);      basisfunction=Dudley_ShapeFunction_getInfo(out->Type->BasisFunctions);
     linearbasisfunction=Dudley_ShapeFunction_getInfo(Dudley_ReferenceElement_InfoList[out->Type->LinearTypeId].BasisFunctions);  
105          out->numLocalDim=quadscheme->numDim;          out->numLocalDim=quadscheme->numDim;
106            
107      /*  set up the basic integration scheme      /*  set up the basic integration scheme
# Line 138  Dudley_ReferenceElement* Dudley_Referenc Line 126  Dudley_ReferenceElement* Dudley_Referenc
126               * before we can set the shape function for the parametrization the quadrature scheme needs to be replicated :               * before we can set the shape function for the parametrization the quadrature scheme needs to be replicated :
127           */           */
128            
         out->Parametrization=Dudley_ShapeFunction_alloc(parametrization->TypeId, quadscheme->numDim, numQuadNodes, quadNodes, quadWeights);  
129          out->BasisFunctions=Dudley_ShapeFunction_alloc(basisfunction->TypeId, quadscheme->numDim, numQuadNodes, quadNodes, quadWeights);          out->BasisFunctions=Dudley_ShapeFunction_alloc(basisfunction->TypeId, quadscheme->numDim, numQuadNodes, quadNodes, quadWeights);
         out->LinearBasisFunctions=Dudley_ShapeFunction_alloc(linearbasisfunction->TypeId, quadscheme->numDim, numQuadNodes, quadNodes, quadWeights);  
130          out->DBasisFunctionDv=out->BasisFunctions->dSdv;          out->DBasisFunctionDv=out->BasisFunctions->dSdv;
131          out->DBasisFunctionDvShared=TRUE;          out->DBasisFunctionDvShared=TRUE;
132      }      }
# Line 162  void Dudley_ReferenceElement_dealloc(Dud Line 148  void Dudley_ReferenceElement_dealloc(Dud
148      if (in!=NULL) {      if (in!=NULL) {
149          in->reference_counter--;          in->reference_counter--;
150          if (in->reference_counter<1) {          if (in->reference_counter<1) {
             Dudley_ShapeFunction_dealloc(in->Parametrization);  
151              Dudley_ShapeFunction_dealloc(in->BasisFunctions);              Dudley_ShapeFunction_dealloc(in->BasisFunctions);
             Dudley_ShapeFunction_dealloc(in->LinearBasisFunctions);  
152                          if (! in->DBasisFunctionDvShared) MEMFREE(in->DBasisFunctionDv);                          if (! in->DBasisFunctionDvShared) MEMFREE(in->DBasisFunctionDv);
153              MEMFREE(in);              MEMFREE(in);
154          }          }

Legend:
Removed from v.3151  
changed lines
  Added in v.3152

  ViewVC Help
Powered by ViewVC 1.1.26