/[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/finley/src/ElementFile_allocTable.c revision 616 by elspeth, Wed Mar 22 02:46:56 2006 UTC temp_trunk_copy/finley/src/ElementFile_allocTable.c revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC
# Line 1  Line 1 
1  /*  
2   ************************************************************  /* $Id$ */
3   *          Copyright 2006 by ACcESS MNRF                   *  
4   *                                                          *  /*******************************************************
5   *              http://www.access.edu.au                    *   *
6   *       Primary Business: Queensland, Australia            *   *           Copyright 2003-2007 by ACceSS MNRF
7   *  Licensed under the Open Software License version 3.0    *   *       Copyright 2007 by University of Queensland
8   *     http://www.opensource.org/licenses/osl-3.0.php       *   *
9   *                                                          *   *                http://esscc.uq.edu.au
10   ************************************************************   *        Primary Business: Queensland, Australia
11  */   *  Licensed under the Open Software License version 3.0
12     *     http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15    
16  /**************************************************************/  /**************************************************************/
17    
# Line 18  Line 21 
21    
22  /**************************************************************/  /**************************************************************/
23    
 /*  Author: gross@access.edu.au */  
 /*  Version: $Id$ */  
   
 /**************************************************************/  
   
24  #include "ElementFile.h"  #include "ElementFile.h"
25    
26  /****************************************************************************/  /****************************************************************************/
27    
28  /*  allocates the element table within an element file to hold numElements: */  /*  allocates the element table within an element file to hold numElements: */
29    
30  void Finley_ElementFile_allocTable(Finley_ElementFile* in,dim_t numElements) {  void Finley_ElementFile_allocTable(Finley_ElementFile* in,dim_t numElements)
31    {
32    index_t *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;    index_t *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;
33      Paso_MPI_rank *Owner2=NULL;
34    dim_t numNodes,e,i;    dim_t numNodes,e,i;
35    
36    Finley_resetError();    Finley_resetError();
37        /*  allocate memory: */
38    /*  allocate memory: */    numNodes=in->numNodes;
39        Owner2=MEMALLOC(numElements,Paso_MPI_rank);
40    numNodes=(dim_t) in->ReferenceElement->Type->numNodes;    Id2=MEMALLOC(numElements,index_t);
41    Id2=MEMALLOC(numElements,dim_t);    Nodes2=MEMALLOC(numElements*in->numNodes,index_t);
42    Nodes2=MEMALLOC(numElements*numNodes,dim_t);    Tag2=MEMALLOC(numElements,index_t);
43    Tag2=MEMALLOC(numElements,dim_t);    Color2=MEMALLOC(numElements,index_t);
   Color2=MEMALLOC(numElements,dim_t);  
44        
45    /*  if fine, deallocate the old table and replace by new: */    /*  if fine, deallocate the old table and replace by new: */
46        
47    if (Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {    if ( Finley_checkPtr(Owner2) || Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) ||
48      MEMFREE(Id2);                                                         Finley_checkPtr(Tag2) || Finley_checkPtr(Color2) ) {
49        MEMFREE(Owner2);    
50      MEMFREE(Nodes2);      MEMFREE(Nodes2);
51        MEMFREE(Id2);
52      MEMFREE(Tag2);      MEMFREE(Tag2);
53      MEMFREE(Color2);      MEMFREE(Color2);
54    } else {    } else {
55      Finley_ElementFile_deallocTable(in);      Finley_ElementFile_freeTable(in);
56        in->Owner=Owner2;
57      in->numElements=numElements;      in->numElements=numElements;
58      in->Id=Id2;      in->Id=Id2;
59      in->Nodes=Nodes2;      in->Nodes=Nodes2;
# Line 62  void Finley_ElementFile_allocTable(Finle Line 65  void Finley_ElementFile_allocTable(Finle
65      #pragma omp parallel for private(e,i) schedule(static)      #pragma omp parallel for private(e,i) schedule(static)
66      for (e=0;e<numElements;e++) {      for (e=0;e<numElements;e++) {
67         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;
68           in->Owner[e]=-1;
69         in->Id[e]=-1;         in->Id[e]=-1;
70         in->Tag[e]=-1;         in->Tag[e]=-1;
71         in->Color[e]=-1;         in->Color[e]=-1;
# Line 74  void Finley_ElementFile_allocTable(Finle Line 78  void Finley_ElementFile_allocTable(Finle
78    
79  /*  deallocates the element table within an element file: */  /*  deallocates the element table within an element file: */
80    
81  void Finley_ElementFile_deallocTable(Finley_ElementFile* in) {  void Finley_ElementFile_freeTable(Finley_ElementFile* in) {
82      MEMFREE(in->Owner);
83    MEMFREE(in->Id);    MEMFREE(in->Id);
84    MEMFREE(in->Nodes);    MEMFREE(in->Nodes);
85    MEMFREE(in->Tag);    MEMFREE(in->Tag);
# Line 83  void Finley_ElementFile_deallocTable(Fin Line 88  void Finley_ElementFile_deallocTable(Fin
88    in->maxColor=-1;    in->maxColor=-1;
89    in->minColor=0;    in->minColor=0;
90  }  }
   
 /*  
 * $Log$  
 * Revision 1.6  2005/09/15 03:44:22  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-15  
 *  
 * Revision 1.5.2.1  2005/09/07 06:26:18  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.5  2005/07/08 04:07:49  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.4  2004/12/15 07:08:32  jgs  
 * *** empty log message ***  
 * Revision 1.1.1.1.2.2  2005/06/29 02:34:49  gross  
 * some changes towards 64 integers in finley  
 *  
 * Revision 1.1.1.1.2.1  2004/11/24 01:37:13  gross  
 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now  
 *  
 *  
 *  
 */  

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

  ViewVC Help
Powered by ViewVC 1.1.26