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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (10 years, 8 months ago) by ksteube
File MIME type: text/plain
File size: 6155 byte(s)
Copyright updated in all files

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 /* returns the maximum and minimum node id number of nodes: */
20
21 /**************************************************************/
22
23 #include "NodeFile.h"
24 #include "Util.h"
25
26 /**************************************************************/
27
28
29 void Finley_NodeFile_setGlobalIdRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
30 index_t min_id_local, max_id_local;
31 #ifdef PASO_MPI
32 index_t global_id_range[2], id_range[2];
33 #endif
34
35 min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->Id);
36 max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
37
38 #ifdef PASO_MPI
39 id_range[0]=-min_id_local;
40 id_range[1]=max_id_local;
41 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
42 *min_id=-global_id_range[0];
43 *max_id=global_id_range[1];
44 #else
45 *min_id=min_id_local;
46 *max_id=max_id_local;
47 #endif
48 if (*max_id <*min_id) {
49 *max_id=0;
50 *min_id=-1;
51 }
52 }
53
54 void Finley_NodeFile_setIdRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
55 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);
56 *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
57 if (*max_id <*min_id) {
58 *max_id=0;
59 *min_id=-1;
60 }
61 }
62 void Finley_NodeFile_setGlobalDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
63 index_t min_id_local, max_id_local;
64 #ifdef PASO_MPI
65 index_t global_id_range[2], id_range[2];
66 #endif
67
68 min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
69 max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
70
71 #ifdef PASO_MPI
72 id_range[0]=-min_id_local;
73 id_range[1]=max_id_local;
74 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
75 *min_id=-global_id_range[0];
76 *max_id=global_id_range[1];
77 #else
78 *min_id=min_id_local;
79 *max_id=max_id_local;
80 #endif
81 if (*max_id <*min_id) {
82 *max_id=0;
83 *min_id=-1;
84 }
85 }
86
87 void Finley_NodeFile_setDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
88 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
89 *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
90 if (*max_id <*min_id) {
91 *max_id=0;
92 *min_id=-1;
93 }
94 }
95 void Finley_NodeFile_setReducedDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
96 *min_id=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
97 *max_id=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
98 if (*max_id <*min_id) {
99 *max_id=0;
100 *min_id=-1;
101 }
102 }
103
104
105 index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {
106 index_t min_id,max_id;
107 Finley_NodeFile_setGlobalDOFRange(&min_id,&max_id,in);
108 return max_id;
109 }
110
111 index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
112 index_t min_id,max_id;
113 Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(&min_id,&max_id,in);
114 return max_id;
115 }
116
117 void Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
118 index_t min_id_local, max_id_local;
119 #ifdef PASO_MPI
120 index_t global_id_range[2], id_range[2];
121 #endif
122
123 min_id_local=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
124 max_id_local=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
125
126 #ifdef PASO_MPI
127 id_range[0]=-min_id_local;
128 id_range[1]=max_id_local;
129 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
130 *min_id=-global_id_range[0];
131 *max_id=global_id_range[1];
132 #else
133 *min_id=min_id_local;
134 *max_id=max_id_local;
135 #endif
136 if (*max_id <*min_id) {
137 *max_id=0;
138 *min_id=-1;
139 }
140 }
141
142 index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {
143 index_t min_id,max_id;
144 Finley_NodeFile_setGlobalNodeIDIndexRange(&min_id,&max_id,in);
145 return max_id;
146 }
147
148 void Finley_NodeFile_setGlobalNodeIDIndexRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
149 index_t min_id_local, max_id_local;
150 #ifdef PASO_MPI
151 index_t global_id_range[2], id_range[2];
152 #endif
153
154 max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);
155 min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->globalNodesIndex);
156
157 #ifdef PASO_MPI
158 id_range[0]=-min_id_local;
159 id_range[1]=max_id_local;
160 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
161 *min_id=-global_id_range[0];
162 *max_id=global_id_range[1];
163 #else
164 *min_id=min_id_local;
165 *max_id=max_id_local;
166 #endif
167 if (*max_id <*min_id) {
168 *max_id=0;
169 *min_id=-1;
170 }
171 }
172
173 index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
174 index_t min_id,max_id;
175 Finley_NodeFile_setGlobalReducedNodeIDIndexRange(&min_id,&max_id,in);
176 return max_id;
177 }
178
179 void Finley_NodeFile_setGlobalReducedNodeIDIndexRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
180 index_t min_id_local, max_id_local;
181 #ifdef PASO_MPI
182 index_t global_id_range[2], id_range[2];
183 #endif
184
185 max_id_local=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedNodesIndex,-1);
186 min_id_local=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedNodesIndex,-1);
187
188 #ifdef PASO_MPI
189 id_range[0]=-min_id_local;
190 id_range[1]=max_id_local;
191 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
192 *min_id=-global_id_range[0];
193 *max_id=global_id_range[1];
194 #else
195 *min_id=min_id_local;
196 *max_id=max_id_local;
197 #endif
198 if (*max_id <*min_id) {
199 *max_id=0;
200 *min_id=-1;
201 }
202 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26