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

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

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

revision 616 by elspeth, Wed Mar 22 02:46:56 2006 UTC revision 782 by bcumming, Tue Jul 18 00:47:47 2006 UTC
# Line 31  Line 31 
31    
32  void Finley_ElementFile_allocTable(Finley_ElementFile* in,dim_t numElements) {  void Finley_ElementFile_allocTable(Finley_ElementFile* in,dim_t numElements) {
33    index_t *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;    index_t *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;
34    #ifdef PASO_MPI
35        index_t *Dom2=NULL;
36    #endif
37    dim_t numNodes,e,i;    dim_t numNodes,e,i;
38    Finley_resetError();    Finley_resetError();
39        
40    /*  allocate memory: */    /*  allocate memory: */
41      #ifdef PASO_MPI
42      Dom2=MEMALLOC(numElements,dim_t);
43    #endif
44    numNodes=(dim_t) in->ReferenceElement->Type->numNodes;    numNodes=(dim_t) in->ReferenceElement->Type->numNodes;
45    Id2=MEMALLOC(numElements,dim_t);    Id2=MEMALLOC(numElements,dim_t);
46    Nodes2=MEMALLOC(numElements*numNodes,dim_t);    Nodes2=MEMALLOC(numElements*numNodes,dim_t);
# Line 44  void Finley_ElementFile_allocTable(Finle Line 49  void Finley_ElementFile_allocTable(Finle
49        
50    /*  if fine, deallocate the old table and replace by new: */    /*  if fine, deallocate the old table and replace by new: */
51        
52    #ifdef PASO_MPI
53      if ( Finley_checkPtr(Dom2) || Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {
54          MEMFREE( Dom2 );  
55    #else
56    if (Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {    if (Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {
57      MEMFREE(Id2);  #endif
58      MEMFREE(Nodes2);      MEMFREE(Nodes2);
59        MEMFREE(Id2);
60      MEMFREE(Tag2);      MEMFREE(Tag2);
61      MEMFREE(Color2);      MEMFREE(Color2);
62    } else {    } else {
63      Finley_ElementFile_deallocTable(in);      Finley_ElementFile_deallocTable(in);
64    #ifdef PASO_MPI
65        in->Dom=Dom2;
66    #endif
67      in->numElements=numElements;      in->numElements=numElements;
68      in->Id=Id2;      in->Id=Id2;
69      in->Nodes=Nodes2;      in->Nodes=Nodes2;
# Line 62  void Finley_ElementFile_allocTable(Finle Line 75  void Finley_ElementFile_allocTable(Finle
75      #pragma omp parallel for private(e,i) schedule(static)      #pragma omp parallel for private(e,i) schedule(static)
76      for (e=0;e<numElements;e++) {      for (e=0;e<numElements;e++) {
77         for (i=0;i<numNodes;i++) in->Nodes[INDEX2(i,e,numNodes)]=-1;         for (i=0;i<numNodes;i++) in->Nodes[INDEX2(i,e,numNodes)]=-1;
78    #ifdef PASO_MPI
79           in->Dom[e]=-1;
80    #endif
81         in->Id[e]=-1;         in->Id[e]=-1;
82         in->Tag[e]=-1;         in->Tag[e]=-1;
83         in->Color[e]=-1;         in->Color[e]=-1;
# Line 75  void Finley_ElementFile_allocTable(Finle Line 91  void Finley_ElementFile_allocTable(Finle
91  /*  deallocates the element table within an element file: */  /*  deallocates the element table within an element file: */
92    
93  void Finley_ElementFile_deallocTable(Finley_ElementFile* in) {  void Finley_ElementFile_deallocTable(Finley_ElementFile* in) {
94    #ifdef PASO_MPI
95        MEMFREE(in->Dom);
96    #endif
97    MEMFREE(in->Id);    MEMFREE(in->Id);
98    MEMFREE(in->Nodes);    MEMFREE(in->Nodes);
99    MEMFREE(in->Tag);    MEMFREE(in->Tag);

Legend:
Removed from v.616  
changed lines
  Added in v.782

  ViewVC Help
Powered by ViewVC 1.1.26