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

Annotation of /trunk/finley/src/NodeFile_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: 4506 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: Mesh: NodeFile */
16    
17     /**************************************************************/
18    
19     /* Author: gross@access.edu.au */
20     /* Version: $Id$ */
21    
22     /**************************************************************/
23    
24     #include "NodeFile.h"
25    
26     /**************************************************************/
27    
28     /* allocates the node table within an node file to hold numNodes of nodes. The LinearTo mapping, if it exists, */
29     /* is deallocated. use Finley_Mesh_setLinearMesh to create a new one. */
30    
31 bcumming 730 void Finley_NodeFile_allocTable(Finley_NodeFile* in ,dim_t numNodes)
32     {
33 jgs 123 index_t *Id2=NULL, *Tag2=NULL, *degreeOfFreedom2=NULL, *reducedDegreeOfFreedom2=NULL, *toReduced2=NULL;
34 bcumming 782 #ifdef PASO_MPI
35     index_t *Dom2=NULL;
36     #endif
37 jgs 82 double *Coordinates2=NULL;
38 jgs 123 dim_t n,i;
39 jgs 82
40     /* allocate memory: */
41 bcumming 782 #ifdef PASO_MPI
42     Dom2=MEMALLOC(numNodes,index_t);
43     #endif
44 jgs 123 Id2=MEMALLOC(numNodes,index_t);
45 jgs 102 Coordinates2=MEMALLOC(numNodes*in->numDim,double);
46 jgs 123 Tag2=MEMALLOC(numNodes,index_t);
47     degreeOfFreedom2=MEMALLOC(numNodes,index_t);
48     reducedDegreeOfFreedom2=MEMALLOC(numNodes,index_t);
49     toReduced2=MEMALLOC(numNodes,index_t);
50 jgs 82
51     /* if fine, deallocate the old table and replace by new: */
52 bcumming 782 #ifdef PASO_MPI
53     if (Finley_checkPtr(Id2) || Finley_checkPtr(Coordinates2) || Finley_checkPtr(Tag2) || Finley_checkPtr(Dom2) ||
54     Finley_checkPtr(degreeOfFreedom2) || Finley_checkPtr(reducedDegreeOfFreedom2) || Finley_checkPtr(toReduced2) ) {
55     MEMFREE( Dom2 );
56     #else
57 jgs 82 if (Finley_checkPtr(Id2) || Finley_checkPtr(Coordinates2) || Finley_checkPtr(Tag2) ||
58     Finley_checkPtr(degreeOfFreedom2) || Finley_checkPtr(reducedDegreeOfFreedom2) || Finley_checkPtr(toReduced2) ) {
59 bcumming 782 #endif
60 jgs 82 MEMFREE(Id2);
61     MEMFREE(Coordinates2);
62     MEMFREE(Tag2);
63     MEMFREE(degreeOfFreedom2);
64     MEMFREE(reducedDegreeOfFreedom2);
65     MEMFREE(toReduced2);
66     } else {
67     Finley_NodeFile_deallocTable(in);
68 bcumming 782 #ifdef PASO_MPI
69     in->Dom=Dom2;
70     #endif
71 jgs 82 in->Id=Id2;
72     in->Coordinates=Coordinates2;
73     in->Tag=Tag2;
74     in->degreeOfFreedom=degreeOfFreedom2;
75     in->reducedDegreeOfFreedom=reducedDegreeOfFreedom2;
76     in->toReduced=toReduced2;
77     in->numNodes=numNodes;
78     in->numDegreesOfFreedom=numNodes;
79     in->reducedNumDegreesOfFreedom=numNodes;
80     in->reducedNumNodes=numNodes;
81     /* this initialization makes sure that data are located on the right processor */
82     #pragma omp parallel for private(n,i) schedule(static)
83     for (n=0;n<numNodes;n++) {
84     for (i=0;i<in->numDim;i++) in->Coordinates[INDEX2(i,n,in->numDim)]=0.;
85 bcumming 782 #ifdef PASO_MPI
86     in->Dom[n]=-1;
87     #endif
88 jgs 82 in->Id[n]=-1;
89     in->Tag[n]=-1;
90     in->degreeOfFreedom[n]=n;
91     in->reducedDegreeOfFreedom[n]=n;
92     in->toReduced[n]=n;
93     }
94     }
95     return;
96     }
97    
98     /* deallocates the node table within an node file: */
99    
100     void Finley_NodeFile_deallocTable(Finley_NodeFile* in) {
101     if (in!=NULL) {
102 bcumming 782 #ifdef PASO_MPI
103     MEMFREE(in->Dom);
104     #endif
105 jgs 82 MEMFREE(in->Id);
106     MEMFREE(in->Coordinates);
107     MEMFREE(in->Tag);
108     MEMFREE(in->degreeOfFreedom);
109     MEMFREE(in->reducedDegreeOfFreedom);
110     MEMFREE(in->toReduced);
111     in->numNodes=0;
112     in->numDegreesOfFreedom=0;
113     in->reducedNumDegreesOfFreedom=0;
114     in->reducedNumNodes=0;
115     }
116     }
117     /*
118     * $Log$
119 jgs 150 * Revision 1.6 2005/09/15 03:44:23 jgs
120     * Merge of development branch dev-02 back to main trunk on 2005-09-15
121     *
122     * Revision 1.5.2.1 2005/09/07 06:26:20 gross
123     * the solver from finley are put into the standalone package paso now
124     *
125 jgs 123 * Revision 1.5 2005/07/08 04:07:55 jgs
126     * Merge of development branch back to main trunk on 2005-07-08
127     *
128 jgs 102 * Revision 1.4 2004/12/15 07:08:33 jgs
129 jgs 97 * *** empty log message ***
130 jgs 123 * Revision 1.1.1.1.2.2 2005/06/29 02:34:54 gross
131     * some changes towards 64 integers in finley
132 jgs 82 *
133 jgs 123 * Revision 1.1.1.1.2.1 2004/11/24 01:37:15 gross
134     * some changes dealing with the integer overflow in memory allocation. Finley solves 4M unknowns now
135 jgs 97 *
136 jgs 82 *
137 jgs 123 *
138 jgs 82 */

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26