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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 471 - (show annotations)
Fri Jan 27 01:33:02 2006 UTC (13 years, 8 months ago) by jgs
File MIME type: text/plain
File size: 3598 byte(s)
reorganise finley src tree to remove inc dir and src/finley directory

1 /*
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 /**************************************************************/
16
17 /* Finley: ElementFile */
18
19 /* allocates and deallocates element table */
20
21 /**************************************************************/
22
23 /* Author: gross@access.edu.au */
24 /* Version: $Id$ */
25
26 /**************************************************************/
27
28 #include "ElementFile.h"
29
30 /****************************************************************************/
31
32 /* allocates the element table within an element file to hold numElements: */
33
34 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 Finley_resetError();
38
39 /* allocate memory: */
40
41 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
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 in->maxColor=-1;
72 in->minColor=0;
73 }
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 in->maxColor=-1;
86 in->minColor=0;
87 }
88
89 /*
90 * $Log$
91 * 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 * 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 * Revision 1.4 2004/12/15 07:08:32 jgs
101 * *** empty log message ***
102 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
103 * some changes towards 64 integers in finley
104 *
105 * 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 *
108 *
109 *
110 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26