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

Annotation of /trunk/dudley/src/NodeFile_setIdRange.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1811 - (hide annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years, 1 month ago) by ksteube
Original Path: trunk/finley/src/NodeFile_setIdRange.c
File MIME type: text/plain
File size: 6155 byte(s)
Copyright updated in all files

1 jgs 150
2 ksteube 1312 /*******************************************************
3 ksteube 1811 *
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 ksteube 1312
14 ksteube 1811
15 jgs 82 /**************************************************************/
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 ksteube 1312 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 gross 1738 min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->Id);
36     max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
37 ksteube 1312
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 gross 1738 if (*max_id <*min_id) {
49     *max_id=0;
50     *min_id=-1;
51     }
52 ksteube 1312 }
53    
54 jgs 123 void Finley_NodeFile_setIdRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
55 jgs 82 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);
56     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
57 gross 1738 if (*max_id <*min_id) {
58     *max_id=0;
59     *min_id=-1;
60     }
61 jgs 82 }
62 ksteube 1312 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 gross 1738 min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
69     max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
70 ksteube 1312
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 gross 1738 if (*max_id <*min_id) {
82     *max_id=0;
83     *min_id=-1;
84     }
85 ksteube 1312 }
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 gross 1738 if (*max_id <*min_id) {
91     *max_id=0;
92     *min_id=-1;
93     }
94 ksteube 1312 }
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 gross 1738 if (*max_id <*min_id) {
99     *max_id=0;
100     *min_id=-1;
101     }
102 ksteube 1312 }
103    
104 gross 1738
105 ksteube 1312 index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {
106 gross 1750 index_t min_id,max_id;
107     Finley_NodeFile_setGlobalDOFRange(&min_id,&max_id,in);
108     return max_id;
109 ksteube 1312 }
110 gross 1738
111 ksteube 1312 index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
112 gross 1750 index_t min_id,max_id;
113     Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(&min_id,&max_id,in);
114     return max_id;
115 gross 1738 }
116 ksteube 1312
117 gross 1738 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 ksteube 1312 }
141    
142     index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {
143 gross 1750 index_t min_id,max_id;
144     Finley_NodeFile_setGlobalNodeIDIndexRange(&min_id,&max_id,in);
145     return max_id;
146 ksteube 1312 }
147 gross 1738
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 ksteube 1312 index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
174 gross 1750 index_t min_id,max_id;
175     Finley_NodeFile_setGlobalReducedNodeIDIndexRange(&min_id,&max_id,in);
176     return max_id;
177 ksteube 1312 }
178 gross 1738
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