/[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 616 - (hide annotations)
Wed Mar 22 02:46:56 2006 UTC (13 years, 7 months ago) by elspeth
File MIME type: text/plain
File size: 3276 byte(s)
Copyright added to more source files.

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26