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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 123 - (hide annotations)
Fri Jul 8 04:08:13 2005 UTC (14 years, 4 months ago) by jgs
Original Path: trunk/esys2/finley/src/finleyC/ElementFile_allocTable.c
File MIME type: text/plain
File size: 2576 byte(s)
Merge of development branch back to main trunk on 2005-07-08

1 jgs 82 /* $Id$ */
2     /**************************************************************/
3    
4     /* Finley: ElementFile */
5    
6     /* allocates and deallocates element table */
7    
8     /**************************************************************/
9    
10     /* Copyrights by ACcESS Australia 2003 */
11     /* Author: gross@access.edu.au */
12     /* Version: $Id$ */
13    
14     /**************************************************************/
15    
16     #include "Finley.h"
17     #include "ElementFile.h"
18    
19     /****************************************************************************/
20    
21     /* allocates the element table within an element file to hold numElements: */
22    
23 jgs 123 void Finley_ElementFile_allocTable(Finley_ElementFile* in,dim_t numElements) {
24     index_t *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;
25     dim_t numNodes,e,i;
26 jgs 82
27     /* allocate memory: */
28    
29 jgs 123 numNodes=(dim_t) in->ReferenceElement->Type->numNodes;
30     Id2=MEMALLOC(numElements,dim_t);
31     Nodes2=MEMALLOC(numElements*numNodes,dim_t);
32     Tag2=MEMALLOC(numElements,dim_t);
33     Color2=MEMALLOC(numElements,dim_t);
34 jgs 82
35     /* if fine, deallocate the old table and replace by new: */
36    
37     if (Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {
38     MEMFREE(Id2);
39     MEMFREE(Nodes2);
40     MEMFREE(Tag2);
41     MEMFREE(Color2);
42     } else {
43     Finley_ElementFile_deallocTable(in);
44     in->numElements=numElements;
45     in->Id=Id2;
46     in->Nodes=Nodes2;
47     in->Tag=Tag2;
48     in->Color=Color2;
49    
50     /* this initialization makes sure that data are located on the right processor */
51    
52     #pragma omp parallel for private(e,i) schedule(static)
53     for (e=0;e<numElements;e++) {
54     for (i=0;i<numNodes;i++) in->Nodes[INDEX2(i,e,numNodes)]=-1;
55     in->Id[e]=-1;
56     in->Tag[e]=-1;
57     in->Color[e]=-1;
58     }
59 jgs 123 in->maxColor=-1;
60     in->minColor=0;
61 jgs 82 }
62     return;
63     }
64    
65     /* deallocates the element table within an element file: */
66    
67     void Finley_ElementFile_deallocTable(Finley_ElementFile* in) {
68     MEMFREE(in->Id);
69     MEMFREE(in->Nodes);
70     MEMFREE(in->Tag);
71     MEMFREE(in->Color);
72     in->numElements=0;
73 jgs 123 in->maxColor=-1;
74     in->minColor=0;
75 jgs 82 }
76    
77     /*
78     * $Log$
79 jgs 123 * Revision 1.5 2005/07/08 04:07:49 jgs
80     * Merge of development branch back to main trunk on 2005-07-08
81     *
82 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
83 jgs 97 * *** empty log message ***
84 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
85     * some changes towards 64 integers in finley
86 jgs 82 *
87 jgs 123 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
88     * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
89 jgs 97 *
90 jgs 82 *
91 jgs 123 *
92 jgs 82 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26