1 |
|
2 |
/******************************************************* |
3 |
* |
4 |
* Copyright (c) 2003-2008 by University of Queensland |
5 |
* Earth Systems Science Computational Center (ESSCC) |
6 |
* http://www.uq.edu.au/esscc |
7 |
* |
8 |
* Primary Business: Queensland, Australia |
9 |
* Licensed under the Open Software License version 3.0 |
10 |
* http://www.opensource.org/licenses/osl-3.0.php |
11 |
* |
12 |
*******************************************************/ |
13 |
|
14 |
|
15 |
/**************************************************************/ |
16 |
/* */ |
17 |
/* Finley: Mesh : NodeFile */ |
18 |
/* */ |
19 |
/* allocates and freeates node files */ |
20 |
/* */ |
21 |
/**************************************************************/ |
22 |
|
23 |
#include "NodeFile.h" |
24 |
|
25 |
/**************************************************************/ |
26 |
|
27 |
/* allocates a node file to hold nodes */ |
28 |
/* use Finley_NodeFile_allocTable to allocate the node table (Id,Coordinatess). */ |
29 |
|
30 |
Finley_NodeFile* Finley_NodeFile_alloc(dim_t numDim, Paso_MPIInfo *MPIInfo) |
31 |
{ |
32 |
Finley_NodeFile *out; |
33 |
|
34 |
/* allocate the return value */ |
35 |
|
36 |
out=MEMALLOC(1,Finley_NodeFile); |
37 |
if (Finley_checkPtr(out)) return NULL; |
38 |
out->numNodes=0; |
39 |
out->numDim=numDim; |
40 |
out->numTagsInUse=0; |
41 |
out->Id=NULL; |
42 |
out->globalDegreesOfFreedom=NULL; |
43 |
out->Tag=NULL; |
44 |
out->Coordinates=NULL; |
45 |
out->status=FINLEY_INITIAL_STATUS; |
46 |
|
47 |
out->nodesMapping=NULL; |
48 |
out->reducedNodesMapping=NULL; |
49 |
out->degreesOfFreedomMapping=NULL; |
50 |
out->reducedDegreesOfFreedomMapping=NULL; |
51 |
|
52 |
out->globalReducedDOFIndex=NULL; |
53 |
out->globalReducedNodesIndex=NULL; |
54 |
out->globalNodesIndex=NULL; |
55 |
out->reducedNodesId=NULL; |
56 |
out->degreesOfFreedomId=NULL; |
57 |
out->reducedDegreesOfFreedomId=NULL; |
58 |
out->nodesDistribution=NULL; |
59 |
out->reducedNodesDistribution=NULL; |
60 |
out->degreesOfFreedomDistribution=NULL; |
61 |
out->reducedDegreesOfFreedomDistribution=NULL; |
62 |
out->degreesOfFreedomConnector=NULL; |
63 |
out->reducedDegreesOfFreedomConnector=NULL; |
64 |
out->tagsInUse=NULL; |
65 |
|
66 |
out->MPIInfo = Paso_MPIInfo_getReference( MPIInfo ); |
67 |
return out; |
68 |
} |
69 |
|
70 |
/* frees a node file: */ |
71 |
|
72 |
void Finley_NodeFile_free(Finley_NodeFile* in) { |
73 |
if (in!=NULL) { |
74 |
Finley_NodeFile_freeTable(in); |
75 |
Paso_MPIInfo_free( in->MPIInfo ); |
76 |
MEMFREE(in); |
77 |
} |
78 |
} |
79 |
|
80 |
index_t Finley_NodeFile_getFirstReducedNode(Finley_NodeFile* in) { |
81 |
if (in!=NULL) { |
82 |
return Paso_Distribution_getFirstComponent(in->reducedNodesDistribution); |
83 |
} else { |
84 |
return 0; |
85 |
} |
86 |
} |
87 |
index_t Finley_NodeFile_getLastReducedNode(Finley_NodeFile* in){ |
88 |
if (in!=NULL) { |
89 |
return Paso_Distribution_getLastComponent(in->reducedNodesDistribution); |
90 |
} else { |
91 |
return 0; |
92 |
} |
93 |
|
94 |
} |
95 |
|
96 |
dim_t Finley_NodeFile_getGlobalNumReducedNodes(Finley_NodeFile* in){ |
97 |
if (in!=NULL) { |
98 |
return Paso_Distribution_getGlobalNumComponents(in->reducedNodesDistribution); |
99 |
} else { |
100 |
return 0; |
101 |
} |
102 |
|
103 |
} |
104 |
index_t* Finley_NodeFile_borrowGlobalReducedNodesIndex(Finley_NodeFile* in){ |
105 |
if (in!=NULL) { |
106 |
return in->globalReducedNodesIndex; |
107 |
} else { |
108 |
return NULL; |
109 |
} |
110 |
} |
111 |
index_t Finley_NodeFile_getFirstNode(Finley_NodeFile* in) { |
112 |
if (in!=NULL) { |
113 |
return Paso_Distribution_getFirstComponent(in->nodesDistribution); |
114 |
} else { |
115 |
return 0; |
116 |
} |
117 |
} |
118 |
index_t Finley_NodeFile_getLastNode(Finley_NodeFile* in){ |
119 |
if (in!=NULL) { |
120 |
return Paso_Distribution_getLastComponent(in->nodesDistribution); |
121 |
} else { |
122 |
return 0; |
123 |
} |
124 |
|
125 |
} |
126 |
dim_t Finley_NodeFile_getGlobalNumNodes(Finley_NodeFile* in){ |
127 |
if (in!=NULL) { |
128 |
return Paso_Distribution_getGlobalNumComponents(in->nodesDistribution); |
129 |
} else { |
130 |
return 0; |
131 |
} |
132 |
|
133 |
} |
134 |
index_t* Finley_NodeFile_borrowGlobalNodesIndex(Finley_NodeFile* in){ |
135 |
if (in!=NULL) { |
136 |
return in->globalNodesIndex; |
137 |
} else { |
138 |
return NULL; |
139 |
} |
140 |
} |
141 |
|
142 |
dim_t Finley_NodeFile_getNumReducedNodes(Finley_NodeFile* in) { |
143 |
if (in!=NULL) { |
144 |
return in->reducedNodesMapping->numTargets; |
145 |
} else { |
146 |
return 0; |
147 |
} |
148 |
|
149 |
} |
150 |
dim_t Finley_NodeFile_getNumDegreesOfFreedom(Finley_NodeFile* in) { |
151 |
if (in!=NULL) { |
152 |
return Paso_Distribution_getMyNumComponents(in->degreesOfFreedomDistribution); |
153 |
} else { |
154 |
return 0; |
155 |
} |
156 |
} |
157 |
dim_t Finley_NodeFile_getNumNodes(Finley_NodeFile* in) { |
158 |
if (in!=NULL) { |
159 |
return in->nodesMapping->numNodes; |
160 |
} else { |
161 |
return 0; |
162 |
} |
163 |
} |
164 |
dim_t Finley_NodeFile_getNumReducedDegreesOfFreedom(Finley_NodeFile* in) { |
165 |
if (in!=NULL) { |
166 |
return Paso_Distribution_getMyNumComponents(in->reducedDegreesOfFreedomDistribution); |
167 |
} else { |
168 |
return 0; |
169 |
} |
170 |
} |
171 |
|
172 |
|
173 |
index_t* Finley_NodeFile_borrowTargetReducedNodes(Finley_NodeFile* in){ |
174 |
if (in!=NULL) { |
175 |
return in->reducedNodesMapping->target; |
176 |
} else { |
177 |
return NULL; |
178 |
} |
179 |
} |
180 |
|
181 |
index_t* Finley_NodeFile_borrowTargetDegreesOfFreedom(Finley_NodeFile* in){ |
182 |
if (in!=NULL) { |
183 |
return in->degreesOfFreedomMapping->target; |
184 |
} else { |
185 |
return NULL; |
186 |
} |
187 |
} |
188 |
|
189 |
index_t* Finley_NodeFile_borrowTargetNodes(Finley_NodeFile* in){ |
190 |
if (in!=NULL) { |
191 |
return in->nodesMapping->target; |
192 |
} else { |
193 |
return NULL; |
194 |
} |
195 |
} |
196 |
|
197 |
index_t* Finley_NodeFile_borrowTargetReducedDegreesOfFreedom(Finley_NodeFile* in){ |
198 |
if (in!=NULL) { |
199 |
return in->reducedDegreesOfFreedomMapping->target; |
200 |
} else { |
201 |
return NULL; |
202 |
} |
203 |
} |
204 |
|
205 |
index_t* Finley_NodeFile_borrowReducedNodesTarget(Finley_NodeFile* in){ |
206 |
if (in!=NULL) { |
207 |
return in->reducedNodesMapping->map; |
208 |
} else { |
209 |
return NULL; |
210 |
} |
211 |
} |
212 |
|
213 |
index_t* Finley_NodeFile_borrowDegreesOfFreedomTarget(Finley_NodeFile* in){ |
214 |
if (in!=NULL) { |
215 |
return in->degreesOfFreedomMapping->map; |
216 |
} else { |
217 |
return NULL; |
218 |
} |
219 |
} |
220 |
|
221 |
index_t* Finley_NodeFile_borrowNodesTarget(Finley_NodeFile* in){ |
222 |
if (in!=NULL) { |
223 |
return in->nodesMapping->map; |
224 |
} else { |
225 |
return NULL; |
226 |
} |
227 |
} |
228 |
|
229 |
index_t* Finley_NodeFile_borrowReducedDegreesOfFreedomTarget(Finley_NodeFile* in){ |
230 |
if (in!=NULL) { |
231 |
return in->reducedDegreesOfFreedomMapping->map; |
232 |
} else { |
233 |
return NULL; |
234 |
} |
235 |
} |
236 |
|
237 |
|