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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 201 - (hide annotations)
Wed Nov 23 04:10:21 2005 UTC (14 years ago) by jgs
File MIME type: text/plain
File size: 3598 byte(s)
copy finleyC and CPPAdapter to finley and finley/CPPAdapter to
facilitate scons builds

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26