/[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 782 - (hide annotations)
Tue Jul 18 00:47:47 2006 UTC (13 years, 7 months ago) by bcumming
File MIME type: text/plain
File size: 3690 byte(s)
Large number of changes to Finley for meshing in MPI.

- optimisation and neatening up of rectcanglular mesh generation code
- first and second order 1D, 2D and 3D rectangular meshes are now
  available in finley and escript using MPI.
- reduced meshes now generated in MPI, and interpolation to and from 
  reduced data types now supported.  

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 bcumming 782 #ifdef PASO_MPI
35     index_t *Dom2=NULL;
36     #endif
37 jgs 123 dim_t numNodes,e,i;
38 jgs 150 Finley_resetError();
39 jgs 82
40     /* allocate memory: */
41 bcumming 782 #ifdef PASO_MPI
42     Dom2=MEMALLOC(numElements,dim_t);
43     #endif
44 jgs 123 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 jgs 82
50     /* if fine, deallocate the old table and replace by new: */
51    
52 bcumming 782 #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 jgs 82 if (Finley_checkPtr(Id2) || Finley_checkPtr(Nodes2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Color2)) {
57 bcumming 782 #endif
58     MEMFREE(Nodes2);
59 jgs 82 MEMFREE(Id2);
60     MEMFREE(Tag2);
61     MEMFREE(Color2);
62     } else {
63     Finley_ElementFile_deallocTable(in);
64 bcumming 782 #ifdef PASO_MPI
65     in->Dom=Dom2;
66     #endif
67 jgs 82 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 bcumming 782 #ifdef PASO_MPI
79     in->Dom[e]=-1;
80     #endif
81 jgs 82 in->Id[e]=-1;
82     in->Tag[e]=-1;
83     in->Color[e]=-1;
84     }
85 jgs 123 in->maxColor=-1;
86     in->minColor=0;
87 jgs 82 }
88     return;
89     }
90    
91     /* deallocates the element table within an element file: */
92    
93     void Finley_ElementFile_deallocTable(Finley_ElementFile* in) {
94 bcumming 782 #ifdef PASO_MPI
95     MEMFREE(in->Dom);
96     #endif
97 jgs 82 MEMFREE(in->Id);
98     MEMFREE(in->Nodes);
99     MEMFREE(in->Tag);
100     MEMFREE(in->Color);
101     in->numElements=0;
102 jgs 123 in->maxColor=-1;
103     in->minColor=0;
104 jgs 82 }
105    
106     /*
107     * $Log$
108 jgs 150 * 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 jgs 123 * 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 jgs 102 * Revision 1.4 2004/12/15 07:08:32 jgs
118 jgs 97 * *** empty log message ***
119 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:49 gross
120     * some changes towards 64 integers in finley
121 jgs 82 *
122 jgs 123 * 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 jgs 97 *
125 jgs 82 *
126 jgs 123 *
127 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26