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

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

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

revision 3080 by jfenwick, Tue Aug 3 04:28:03 2010 UTC revision 3086 by jfenwick, Thu Aug 5 05:07:58 2010 UTC
# Line 14  Line 14 
14    
15  /***************************************************************************************************************  /***************************************************************************************************************
16    
17      Finley: Reference elements set managing the reference elements for the full and reduced intergation order      Dudley: Reference elements set managing the reference elements for the full and reduced intergation order
18    
19  **************************************************************************************************************/  **************************************************************************************************************/
20    
# Line 23  Line 23 
23  /**************************************************************/  /**************************************************************/
24    
25    
26  Finley_ReferenceElementSet* Finley_ReferenceElementSet_alloc(ElementTypeId id, index_t order, index_t reduced_order) {  Dudley_ReferenceElementSet* Dudley_ReferenceElementSet_alloc(ElementTypeId id, index_t order, index_t reduced_order) {
27          Finley_ReferenceElementInfo* id_info=NULL;          Dudley_ReferenceElementInfo* id_info=NULL;
28          Finley_ShapeFunctionInfo* bf_info=NULL;          Dudley_ShapeFunctionInfo* bf_info=NULL;
29      Finley_ReferenceElementSet *out=NULL;      Dudley_ReferenceElementSet *out=NULL;
30          id_info=Finley_ReferenceElement_getInfo(id);          id_info=Dudley_ReferenceElement_getInfo(id);
31      if (! Finley_noError()) return NULL;      if (! Dudley_noError()) return NULL;
32          bf_info=Finley_ShapeFunction_getInfo(id_info->BasisFunctions);          bf_info=Dudley_ShapeFunction_getInfo(id_info->BasisFunctions);
33      if (! Finley_noError()) return NULL;      if (! Dudley_noError()) return NULL;
34    
35      out=MEMALLOC(1,Finley_ReferenceElementSet);      out=MEMALLOC(1,Dudley_ReferenceElementSet);
36      if (Finley_checkPtr(out)) return NULL;      if (Dudley_checkPtr(out)) return NULL;
37      out->reference_counter=0;      out->reference_counter=0;
38          out->referenceElement =NULL;          out->referenceElement =NULL;
39          out->referenceElementReducedQuadrature =NULL;          out->referenceElementReducedQuadrature =NULL;
40    
41      if (Finley_noError()) {      if (Dudley_noError()) {
42              if (order<0) order=MAX(2*(bf_info->numOrder),0);              if (order<0) order=MAX(2*(bf_info->numOrder),0);
43          out->referenceElement                 =Finley_ReferenceElement_alloc(id,  order);          out->referenceElement                 =Dudley_ReferenceElement_alloc(id,  order);
44          }          }
45          if (Finley_noError())  {          if (Dudley_noError())  {
46                 if (reduced_order<0) reduced_order=MAX(2*(bf_info->numOrder-1),0);                 if (reduced_order<0) reduced_order=MAX(2*(bf_info->numOrder-1),0);
47             out->referenceElementReducedQuadrature=Finley_ReferenceElement_alloc(id,  reduced_order);             out->referenceElementReducedQuadrature=Dudley_ReferenceElement_alloc(id,  reduced_order);
48          }          }
49    
50      if (Finley_noError()) {      if (Dudley_noError()) {
51           if (! (Finley_ReferenceElement_getNumNodes(out->referenceElement) == Finley_ReferenceElement_getNumNodes(out->referenceElementReducedQuadrature) ) ) {           if (! (Dudley_ReferenceElement_getNumNodes(out->referenceElement) == Dudley_ReferenceElement_getNumNodes(out->referenceElementReducedQuadrature) ) ) {
52          Finley_setError(VALUE_ERROR,"Finley_ReferenceElementSet_alloc: numNodes in referenceElement  and referenceElementReducedQuadrature don't match.");          Dudley_setError(VALUE_ERROR,"Dudley_ReferenceElementSet_alloc: numNodes in referenceElement  and referenceElementReducedQuadrature don't match.");
53               }               }
54          }          }
55    
56      if (! Finley_noError()) {      if (! Dudley_noError()) {
57          Finley_ReferenceElementSet_dealloc(out);          Dudley_ReferenceElementSet_dealloc(out);
58          return NULL;          return NULL;
59      } else {      } else {
60          out->numNodes=Finley_ReferenceElement_getNumNodes(out->referenceElement);          out->numNodes=Dudley_ReferenceElement_getNumNodes(out->referenceElement);
61          return Finley_ReferenceElementSet_reference(out);          return Dudley_ReferenceElementSet_reference(out);
62      }      }
63  }  }
64    
65  /**************************************************************/  /**************************************************************/
66    
67  void Finley_ReferenceElementSet_dealloc(Finley_ReferenceElementSet* in) {  void Dudley_ReferenceElementSet_dealloc(Dudley_ReferenceElementSet* in) {
68      if (in!=NULL) {      if (in!=NULL) {
69          in->reference_counter--;          in->reference_counter--;
70          if (in->reference_counter<1) {          if (in->reference_counter<1) {
71              Finley_ReferenceElement_dealloc(in->referenceElement);              Dudley_ReferenceElement_dealloc(in->referenceElement);
72              Finley_ReferenceElement_dealloc(in->referenceElementReducedQuadrature);              Dudley_ReferenceElement_dealloc(in->referenceElementReducedQuadrature);
73          }          }
74      }      }
75  }  }
76  Finley_ReferenceElementSet* Finley_ReferenceElementSet_reference(Finley_ReferenceElementSet* in) {  Dudley_ReferenceElementSet* Dudley_ReferenceElementSet_reference(Dudley_ReferenceElementSet* in) {
77       if (in!=NULL) ++(in->reference_counter);       if (in!=NULL) ++(in->reference_counter);
78       return in;       return in;
79  }  }
80    
81  Finley_ReferenceElement* Finley_ReferenceElementSet_borrowReferenceElement(Finley_ReferenceElementSet* in, bool_t reducedIntegrationOrder) {  Dudley_ReferenceElement* Dudley_ReferenceElementSet_borrowReferenceElement(Dudley_ReferenceElementSet* in, bool_t reducedIntegrationOrder) {
82          Finley_ReferenceElement* out=NULL;          Dudley_ReferenceElement* out=NULL;
83      if (in !=NULL) {                    if (in !=NULL) {              
84           if (reducedIntegrationOrder) {           if (reducedIntegrationOrder) {
85               out=in->referenceElementReducedQuadrature;               out=in->referenceElementReducedQuadrature;
# Line 90  Finley_ReferenceElement* Finley_Referenc Line 90  Finley_ReferenceElement* Finley_Referenc
90      return out;      return out;
91  }  }
92            
93  Finley_ShapeFunction* Finley_ReferenceElementSet_borrowBasisFunctions(Finley_ReferenceElementSet* in, bool_t reducedShapefunction, bool_t reducedIntegrationOrder) {  Dudley_ShapeFunction* Dudley_ReferenceElementSet_borrowBasisFunctions(Dudley_ReferenceElementSet* in, bool_t reducedShapefunction, bool_t reducedIntegrationOrder) {
94      Finley_ShapeFunction* basis=NULL;      Dudley_ShapeFunction* basis=NULL;
95      if (in !=NULL) {          if (in !=NULL) {    
96        if (reducedShapefunction) {        if (reducedShapefunction) {
97            if (reducedIntegrationOrder) {            if (reducedIntegrationOrder) {
# Line 110  Finley_ShapeFunction* Finley_ReferenceEl Line 110  Finley_ShapeFunction* Finley_ReferenceEl
110      return basis;      return basis;
111  }  }
112    
113  Finley_ShapeFunction* Finley_ReferenceElementSet_borrowParametrization(Finley_ReferenceElementSet* in, bool_t reducedIntegrationOrder) {  Dudley_ShapeFunction* Dudley_ReferenceElementSet_borrowParametrization(Dudley_ReferenceElementSet* in, bool_t reducedIntegrationOrder) {
114      Finley_ShapeFunction* shape=NULL;      Dudley_ShapeFunction* shape=NULL;
115      if (in !=NULL) {              if (in !=NULL) {        
116            if (reducedIntegrationOrder) {            if (reducedIntegrationOrder) {
117               shape=in->referenceElementReducedQuadrature->Parametrization;               shape=in->referenceElementReducedQuadrature->Parametrization;

Legend:
Removed from v.3080  
changed lines
  Added in v.3086

  ViewVC Help
Powered by ViewVC 1.1.26