/[escript]/branches/trilinos_from_5897/dudley/src/NodeFile_setIdRange.cpp
ViewVC logotype

Contents of /branches/trilinos_from_5897/dudley/src/NodeFile_setIdRange.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6009 - (show annotations)
Wed Mar 2 04:13:26 2016 UTC (2 years, 11 months ago) by caltinay
File size: 6609 byte(s)
Much needed sync with trunk...

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 /****************************************************************************/
18
19 /* Dudley: Mesh: NodeFile */
20
21 /* returns the maximum and minimum node id number of nodes: */
22
23 /****************************************************************************/
24
25 #include "NodeFile.h"
26 #include "Util.h"
27
28 namespace dudley {
29
30 void Dudley_NodeFile_setGlobalIdRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
31 {
32 index_t min_id_local, max_id_local;
33 #ifdef ESYS_MPI
34 index_t global_id_range[2], id_range[2];
35 #endif
36
37 min_id_local = Dudley_Util_getMinInt(1, in->numNodes, in->Id);
38 max_id_local = Dudley_Util_getMaxInt(1, in->numNodes, in->Id);
39
40 #ifdef ESYS_MPI
41 id_range[0] = -min_id_local;
42 id_range[1] = max_id_local;
43 MPI_Allreduce(id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm);
44 *min_id = -global_id_range[0];
45 *max_id = global_id_range[1];
46 #else
47 *min_id = min_id_local;
48 *max_id = max_id_local;
49 #endif
50 if (*max_id < *min_id) {
51 *max_id = 0;
52 *min_id = -1;
53 }
54 }
55
56 void Dudley_NodeFile_setIdRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
57 {
58 *min_id = Dudley_Util_getMinInt(1, in->numNodes, in->Id);
59 *max_id = Dudley_Util_getMaxInt(1, in->numNodes, in->Id);
60 if (*max_id < *min_id) {
61 *max_id = 0;
62 *min_id = -1;
63 }
64 }
65
66 void Dudley_NodeFile_setGlobalDOFRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
67 {
68 index_t min_id_local, max_id_local;
69 #ifdef ESYS_MPI
70 index_t global_id_range[2], id_range[2];
71 #endif
72
73 min_id_local = Dudley_Util_getMinInt(1, in->numNodes, in->globalDegreesOfFreedom);
74 max_id_local = Dudley_Util_getMaxInt(1, in->numNodes, in->globalDegreesOfFreedom);
75
76 #ifdef ESYS_MPI
77 id_range[0] = -min_id_local;
78 id_range[1] = max_id_local;
79 MPI_Allreduce(id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm);
80 *min_id = -global_id_range[0];
81 *max_id = global_id_range[1];
82 #else
83 *min_id = min_id_local;
84 *max_id = max_id_local;
85 #endif
86 if (*max_id < *min_id) {
87 *max_id = 0;
88 *min_id = -1;
89 }
90 }
91
92 void Dudley_NodeFile_setDOFRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
93 {
94 *min_id = Dudley_Util_getMinInt(1, in->numNodes, in->globalDegreesOfFreedom);
95 *max_id = Dudley_Util_getMaxInt(1, in->numNodes, in->globalDegreesOfFreedom);
96 if (*max_id < *min_id) {
97 *max_id = 0;
98 *min_id = -1;
99 }
100 }
101
102 void Dudley_NodeFile_setReducedDOFRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
103 {
104 *min_id = Dudley_Util_getFlaggedMinInt(1, in->numNodes, in->globalReducedDOFIndex, -1);
105 *max_id = Dudley_Util_getFlaggedMaxInt(1, in->numNodes, in->globalReducedDOFIndex, -1);
106 if (*max_id < *min_id) {
107 *max_id = 0;
108 *min_id = -1;
109 }
110 }
111
112 index_t Dudley_NodeFile_maxGlobalDegreeOfFreedomIndex(Dudley_NodeFile * in)
113 {
114 index_t min_id, max_id;
115 Dudley_NodeFile_setGlobalDOFRange(&min_id, &max_id, in);
116 return max_id;
117 }
118
119 index_t Dudley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Dudley_NodeFile * in)
120 {
121 index_t min_id, max_id;
122 Dudley_NodeFile_setGlobalReducedDegreeOfFreedomRange(&min_id, &max_id, in);
123 return max_id;
124 }
125
126 void Dudley_NodeFile_setGlobalReducedDegreeOfFreedomRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
127 {
128 index_t min_id_local, max_id_local;
129 #ifdef ESYS_MPI
130 index_t global_id_range[2], id_range[2];
131 #endif
132
133 min_id_local = Dudley_Util_getFlaggedMaxInt(1, in->numNodes, in->globalReducedDOFIndex, -1);
134 max_id_local = Dudley_Util_getFlaggedMinInt(1, in->numNodes, in->globalReducedDOFIndex, -1);
135
136 #ifdef ESYS_MPI
137 id_range[0] = -min_id_local;
138 id_range[1] = max_id_local;
139 MPI_Allreduce(id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm);
140 *min_id = -global_id_range[0];
141 *max_id = global_id_range[1];
142 #else
143 *min_id = min_id_local;
144 *max_id = max_id_local;
145 #endif
146 if (*max_id < *min_id) {
147 *max_id = 0;
148 *min_id = -1;
149 }
150 }
151
152 index_t Dudley_NodeFile_maxGlobalNodeIDIndex(Dudley_NodeFile * in)
153 {
154 index_t min_id, max_id;
155 Dudley_NodeFile_setGlobalNodeIDIndexRange(&min_id, &max_id, in);
156 return max_id;
157 }
158
159 void Dudley_NodeFile_setGlobalNodeIDIndexRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
160 {
161 index_t min_id_local, max_id_local;
162 #ifdef ESYS_MPI
163 index_t global_id_range[2], id_range[2];
164 #endif
165
166 max_id_local = Dudley_Util_getMaxInt(1, in->numNodes, in->globalNodesIndex);
167 min_id_local = Dudley_Util_getMinInt(1, in->numNodes, in->globalNodesIndex);
168
169 #ifdef ESYS_MPI
170 id_range[0] = -min_id_local;
171 id_range[1] = max_id_local;
172 MPI_Allreduce(id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm);
173 *min_id = -global_id_range[0];
174 *max_id = global_id_range[1];
175 #else
176 *min_id = min_id_local;
177 *max_id = max_id_local;
178 #endif
179 if (*max_id < *min_id) {
180 *max_id = 0;
181 *min_id = -1;
182 }
183 }
184
185 index_t Dudley_NodeFile_maxGlobalReducedNodeIDIndex(Dudley_NodeFile * in)
186 {
187 index_t min_id, max_id;
188 Dudley_NodeFile_setGlobalReducedNodeIDIndexRange(&min_id, &max_id, in);
189 return max_id;
190 }
191
192 void Dudley_NodeFile_setGlobalReducedNodeIDIndexRange(index_t * min_id, index_t * max_id, Dudley_NodeFile * in)
193 {
194 index_t min_id_local, max_id_local;
195 #ifdef ESYS_MPI
196 index_t global_id_range[2], id_range[2];
197 #endif
198
199 max_id_local = Dudley_Util_getFlaggedMaxInt(1, in->numNodes, in->globalReducedNodesIndex, -1);
200 min_id_local = Dudley_Util_getFlaggedMinInt(1, in->numNodes, in->globalReducedNodesIndex, -1);
201
202 #ifdef ESYS_MPI
203 id_range[0] = -min_id_local;
204 id_range[1] = max_id_local;
205 MPI_Allreduce(id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm);
206 *min_id = -global_id_range[0];
207 *max_id = global_id_range[1];
208 #else
209 *min_id = min_id_local;
210 *max_id = max_id_local;
211 #endif
212 if (*max_id < *min_id) {
213 *max_id = 0;
214 *min_id = -1;
215 }
216 }
217
218 } // namespace dudley
219

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mergeinfo /branches/4.0fordebian/dudley/src/NodeFile_setIdRange.cpp:5567-5588 /branches/lapack2681/finley/src/NodeFile_setIdRange.cpp:2682-2741 /branches/pasowrap/dudley/src/NodeFile_setIdRange.cpp:3661-3674 /branches/py3_attempt2/dudley/src/NodeFile_setIdRange.cpp:3871-3891 /branches/restext/finley/src/NodeFile_setIdRange.cpp:2610-2624 /branches/ripleygmg_from_3668/dudley/src/NodeFile_setIdRange.cpp:3669-3791 /branches/stage3.0/finley/src/NodeFile_setIdRange.cpp:2569-2590 /branches/symbolic_from_3470/dudley/src/NodeFile_setIdRange.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/dudley/src/NodeFile_setIdRange.cpp:3517-3974 /release/3.0/finley/src/NodeFile_setIdRange.cpp:2591-2601 /release/4.0/dudley/src/NodeFile_setIdRange.cpp:5380-5406 /trunk/dudley/src/NodeFile_setIdRange.cpp:4257-4344,5898-6007 /trunk/ripley/test/python/dudley/src/NodeFile_setIdRange.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26