/[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

trunk/esys2/finley/src/finleyC/ElementFile_allocTable.c revision 97 by jgs, Tue Dec 14 05:39:33 2004 UTC trunk/finley/src/ElementFile_allocTable.c revision 782 by bcumming, Tue Jul 18 00:47:47 2006 UTC
# Line 1  Line 1 
1  /* $Id$ */  /*
2     ************************************************************
3     *          Copyright 2006 by ACcESS MNRF                   *
4     *                                                          *
5     *              http://www.access.edu.au                    *
6     *       Primary Business: Queensland, Australia            *
7     *  Licensed under the Open Software License version 3.0    *
8     *     http://www.opensource.org/licenses/osl-3.0.php       *
9     *                                                          *
10     ************************************************************
11    */
12    
13  /**************************************************************/  /**************************************************************/
14    
15  /*   Finley: ElementFile */  /*   Finley: ElementFile */
# Line 7  Line 18 
18    
19  /**************************************************************/  /**************************************************************/
20    
21  /*   Copyrights by ACcESS Australia 2003 */  /*  Author: gross@access.edu.au */
22  /*   Author: gross@access.edu.au */  /*  Version: $Id$ */
 /*   Version: $Id$                                            */  
23    
24  /**************************************************************/  /**************************************************************/
25    
 #include "Finley.h"  
26  #include "ElementFile.h"  #include "ElementFile.h"
27    
28  /****************************************************************************/  /****************************************************************************/
29    
30  /*  allocates the element table within an element file to hold numElements: */  /*  allocates the element table within an element file to hold numElements: */
31    
32  void Finley_ElementFile_allocTable(Finley_ElementFile* in,int numElements) {  void Finley_ElementFile_allocTable(Finley_ElementFile* in,dim_t numElements) {
33    maybelong *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;    index_t *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;
34    maybelong numNodes,e,i;  #ifdef PASO_MPI
35        index_t *Dom2=NULL;
36    #endif
37      dim_t numNodes,e,i;
38      Finley_resetError();
39        
40    /*  allocate memory: */    /*  allocate memory: */
41      #ifdef PASO_MPI
42    numNodes=(maybelong) in->ReferenceElement->Type->numNodes;    Dom2=MEMALLOC(numElements,dim_t);
43    Id2=MEMALLOC(numElements,maybelong);  #endif
44    Nodes2=MEMALLOC(numElements*numNodes,maybelong);    numNodes=(dim_t) in->ReferenceElement->Type->numNodes;
45    Tag2=MEMALLOC(numElements,maybelong);    Id2=MEMALLOC(numElements,dim_t);
46    Color2=MEMALLOC(numElements,maybelong);    Nodes2=MEMALLOC(numElements*numNodes,dim_t);
47      Tag2=MEMALLOC(numElements,dim_t);
48      Color2=MEMALLOC(numElements,dim_t);
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 52  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;
84      }      }
85      in->numColors=0;      in->maxColor=-1;
86        in->minColor=0;
87    }    }
88    return;    return;
89  }  }
# Line 64  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);
100    MEMFREE(in->Color);    MEMFREE(in->Color);
101    in->numElements=0;    in->numElements=0;
102    in->numColors=0;    in->maxColor=-1;
103      in->minColor=0;
104  }  }
105    
106  /*  /*
107  * $Log$  * $Log$
108  * Revision 1.2  2004/12/14 05:39:30  jgs  * Revision 1.6  2005/09/15 03:44:22  jgs
109    * Merge of development branch dev-02 back to main trunk on 2005-09-15
110    *
111    * Revision 1.5.2.1  2005/09/07 06:26:18  gross
112    * the solver from finley are put into the standalone package paso now
113    *
114    * Revision 1.5  2005/07/08 04:07:49  jgs
115    * Merge of development branch back to main trunk on 2005-07-08
116    *
117    * Revision 1.4  2004/12/15 07:08:32  jgs
118  * *** empty log message ***  * *** empty log message ***
119    * Revision 1.1.1.1.2.2  2005/06/29 02:34:49  gross
120    * some changes towards 64 integers in finley
121  *  *
122  * Revision 1.1.1.1.2.1  2004/11/24 01:37:13  gross  * Revision 1.1.1.1.2.1  2004/11/24 01:37:13  gross
123  * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now  * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
124  *  *
 * Revision 1.1.1.1  2004/10/26 06:53:57  jgs  
 * initial import of project esys2  
 *  
 * Revision 1.1.1.1  2004/06/24 04:00:40  johng  
 * Initial version of eys using boost-python.  
125  *  *
126  *  *
127  */  */

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

  ViewVC Help
Powered by ViewVC 1.1.26