/[escript]/trunk/finley/src/ElementFile.c
ViewVC logotype

Diff of /trunk/finley/src/ElementFile.c

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

revision 1061 by gross, Tue Feb 13 05:10:26 2007 UTC revision 1062 by gross, Mon Mar 26 06:17:53 2007 UTC
# Line 29  Line 29 
29  /**************************************************************/  /**************************************************************/
30    
31  #ifndef PASO_MPI  #ifndef PASO_MPI
32  Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id,index_t order)  Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order)
33  #else  #else
34  Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id,index_t order, Paso_MPIInfo *MPIInfo)  Finley_ElementFile* Finley_ElementFile_alloc(ElementTypeId id, index_t order, index_t reduced_order, Paso_MPIInfo *MPIInfo)
35  #endif  #endif
36  {  {
37    extern Finley_RefElementInfo Finley_RefElement_InfoList[];    extern Finley_RefElementInfo Finley_RefElement_InfoList[];
38    dim_t NQ;    dim_t NQ, reduced_NQ;
39    Finley_ElementFile *out;    Finley_ElementFile *out;
40        
41    /*   get the number of quadrature nodes needed to achieve integration order order: */    /*   get the number of quadrature nodes needed to achieve integration order order: */
42        
43    if (order<0) order=2*Finley_RefElement_InfoList[id].numOrder;    if (order<0) order=MAX(2*Finley_RefElement_InfoList[id].numOrder,0);
44      if (reduced_order<0) reduced_order=MAX(2*(Finley_RefElement_InfoList[id].numOrder-1),0);
45    NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);    NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(order);
46      reduced_NQ= Finley_RefElement_InfoList[id].getNumQuadNodes(reduced_order);
47    if (! Finley_noError()) return NULL;    if (! Finley_noError()) return NULL;
48        
49    /*  allocate the return value */    /*  allocate the return value */
50        
51    out=MEMALLOC(1,Finley_ElementFile);    out=MEMALLOC(1,Finley_ElementFile);
52    if (Finley_checkPtr(out)) return NULL;    if (Finley_checkPtr(out)) return NULL;
53      out->order = order;
54      out->reduced_order = reduced_order;
55    out->ReferenceElement=NULL;    out->ReferenceElement=NULL;
56    out->LinearReferenceElement=NULL;    out->LinearReferenceElement=NULL;
57      out->ReferenceElementReducedOrder=NULL;
58      out->LinearReferenceElementReducedOrder=NULL;
59    out->isPrepared=FINLEY_UNKNOWN;    out->isPrepared=FINLEY_UNKNOWN;
60    out->numElements=0;    out->numElements=0;
61    out->Id=NULL;    out->Id=NULL;
# Line 58  Finley_ElementFile* Finley_ElementFile_a Line 64  Finley_ElementFile* Finley_ElementFile_a
64    out->Color=NULL;    out->Color=NULL;
65    out->minColor=0;    out->minColor=0;
66    out->maxColor=-1;    out->maxColor=-1;
   out->order = order;  
67    out->jacobeans=NULL;    out->jacobeans=NULL;
68    out->jacobeans_reducedQ=NULL;    out->jacobeans_reducedQ=NULL;
69    out->jacobeans_reducedS=NULL;    out->jacobeans_reducedS=NULL;
# Line 74  Finley_ElementFile* Finley_ElementFile_a Line 79  Finley_ElementFile* Finley_ElementFile_a
79        
80    out->ReferenceElement=Finley_RefElement_alloc(id,NQ);    out->ReferenceElement=Finley_RefElement_alloc(id,NQ);
81    out->jacobeans=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElement);    out->jacobeans=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElement);
82    out->jacobeans_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElement);    out->ReferenceElementReducedOrder=Finley_RefElement_alloc(id,reduced_NQ);
83      out->jacobeans_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->ReferenceElementReducedOrder);
84    
85    out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);    out->LinearReferenceElement=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,NQ);
86    out->jacobeans_reducedS=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElement);    out->jacobeans_reducedS=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElement);
87    out->jacobeans_reducedS_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElement);    out->LinearReferenceElementReducedOrder=Finley_RefElement_alloc(Finley_RefElement_InfoList[id].LinearTypeId,reduced_NQ);
88      out->jacobeans_reducedS_reducedQ=Finley_ElementFile_Jacobeans_alloc(out->LinearReferenceElementReducedOrder);
89    if (! Finley_noError()) {    if (! Finley_noError()) {
90       Finley_ElementFile_dealloc(out);       Finley_ElementFile_dealloc(out);
91       return NULL;       return NULL;
# Line 94  void Finley_ElementFile_dealloc(Finley_E Line 101  void Finley_ElementFile_dealloc(Finley_E
101       if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);       if (in->ReferenceElement!=NULL) printf("element file for %s is deallocated.\n",in->ReferenceElement->Type->Name);
102       #endif       #endif
103       Finley_RefElement_dealloc(in->ReferenceElement);       Finley_RefElement_dealloc(in->ReferenceElement);
104         Finley_RefElement_dealloc(in->ReferenceElementReducedOrder);
105       Finley_RefElement_dealloc(in->LinearReferenceElement);       Finley_RefElement_dealloc(in->LinearReferenceElement);
106         Finley_RefElement_dealloc(in->LinearReferenceElementReducedOrder);
107       Finley_ElementFile_deallocTable(in);         Finley_ElementFile_deallocTable(in);  
108       Finley_ElementFile_Jacobeans_dealloc(in->jacobeans);       Finley_ElementFile_Jacobeans_dealloc(in->jacobeans);
109       Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS);       Finley_ElementFile_Jacobeans_dealloc(in->jacobeans_reducedS);

Legend:
Removed from v.1061  
changed lines
  Added in v.1062

  ViewVC Help
Powered by ViewVC 1.1.26