/[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 1028 - (show annotations)
Wed Mar 14 00:15:24 2007 UTC (12 years, 6 months ago) by gross
File MIME type: text/plain
File size: 3688 byte(s)
modifications to be compliant with _WIN32. The substitutes for asinh, acosh, atanh are still missing (erf will through an exception)
1 /*
2 ************************************************************
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 */
12
13 /**************************************************************/
14
15 /* Finley: ElementFile */
16
17 /* allocates and deallocates element table */
18
19 /**************************************************************/
20
21 /* Author: gross@access.edu.au */
22 /* Version: $Id$ */
23
24 /**************************************************************/
25
26 #include "ElementFile.h"
27
28 /****************************************************************************/
29
30 /* allocates the element table within an element file to hold numElements: */
31
32 void Finley_ElementFile_allocTable(Finley_ElementFile* in,dim_t numElements) {
33 index_t *Id2=NULL,*Nodes2=NULL,*Tag2=NULL,*Color2=NULL;
34 #ifdef PASO_MPI
35 index_t *Dom2=NULL;
36 #endif
37 dim_t numNodes,e,i;
38
39 Finley_resetError();
40 /* allocate memory: */
41 #ifdef PASO_MPI
42 Dom2=MEMALLOC(numElements,dim_t);
43 #endif
44 numNodes=(dim_t) in->ReferenceElement->Type->numNodes;
45 Id2=MEMALLOC(numElements,dim_t);
46 Nodes2=MEMALLOC(numElements*numNodes,dim_t);
47 Tag2=MEMALLOC(numElements,dim_t);
48 Color2=MEMALLOC(numElements,dim_t);
49
50 /* if fine, deallocate the old table and replace by new: */
51
52 #ifdef PASO_MPI
53 if ( Finley_checkPtr(Dom2) || Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {
54 MEMFREE( Dom2 );
55 #else
56 if (Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {
57 #endif
58 MEMFREE(Nodes2);
59 MEMFREE(Id2);
60 MEMFREE(Tag2);
61 MEMFREE(Color2);
62 } else {
63 Finley_ElementFile_deallocTable(in);
64 #ifdef PASO_MPI
65 in->Dom=Dom2;
66 #endif
67 in->numElements=numElements;
68 in->Id=Id2;
69 in->Nodes=Nodes2;
70 in->Tag=Tag2;
71 in->Color=Color2;
72
73 /* this initialization makes sure that data are located on the right processor */
74
75 #pragma omp parallel for private(e,i) schedule(static)
76 for (e=0;e<numElements;e++) {
77 for (i=0;i<numNodes;i++) in->Nodes[INDEX2(i,e,numNodes)]=-1;
78 #ifdef PASO_MPI
79 in->Dom[e]=-1;
80 #endif
81 in->Id[e]=-1;
82 in->Tag[e]=-1;
83 in->Color[e]=-1;
84 }
85 in->maxColor=-1;
86 in->minColor=0;
87 }
88 return;
89 }
90
91 /* deallocates the element table within an element file: */
92
93 void Finley_ElementFile_deallocTable(Finley_ElementFile* in) {
94 #ifdef PASO_MPI
95 MEMFREE(in->Dom);
96 #endif
97 MEMFREE(in->Id);
98 MEMFREE(in->Nodes);
99 MEMFREE(in->Tag);
100 MEMFREE(in->Color);
101 in->numElements=0;
102 in->maxColor=-1;
103 in->minColor=0;
104 }
105
106 /*
107 * $Log$
108 * Revision 1.6 2005/09/15 03:44:22 jgs
109 * Merge of development branch dev-02 back to main trunk on 2005-09-15
110 *
111 * Revision 1.5.2.1 2005/09/07 06:26:18 gross
112 * the solver from finley are put into the standalone package paso now
113 *
114 * Revision 1.5 2005/07/08 04:07:49 jgs
115 * Merge of development branch back to main trunk on 2005-07-08
116 *
117 * Revision 1.4 2004/12/15 07:08:32 jgs
118 * *** empty log message ***
119 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
120 * some changes towards 64 integers in finley
121 *
122 * Revision 1.1.1.1.2.1 2004/11/24 01:37:13 gross
123 * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
124 *
125 *
126 *
127 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26