/[escript]/branches/arrayview_from_1695_trunk/finley/src/NodeFile_setIdRange.c
ViewVC logotype

Contents of /branches/arrayview_from_1695_trunk/finley/src/NodeFile_setIdRange.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1781 - (show annotations)
Thu Sep 11 05:03:14 2008 UTC (10 years, 7 months ago) by jfenwick
File MIME type: text/plain
File size: 6190 byte(s)
Branch commit

Merged changes from trunk version 1695 up to and including version 1779.


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26