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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1750 - (hide annotations)
Wed Sep 3 23:09:29 2008 UTC (11 years, 4 months ago) by gross
File MIME type: text/plain
File size: 6190 byte(s)
small bug fixed
1 jgs 150
2 ksteube 1312 /* $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 jgs 82 /**************************************************************/
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 ksteube 1312 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 gross 1738 min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->Id);
37     max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
38 ksteube 1312
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 gross 1738 if (*max_id <*min_id) {
50     *max_id=0;
51     *min_id=-1;
52     }
53 ksteube 1312 }
54    
55 jgs 123 void Finley_NodeFile_setIdRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
56 jgs 82 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);
57     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
58 gross 1738 if (*max_id <*min_id) {
59     *max_id=0;
60     *min_id=-1;
61     }
62 jgs 82 }
63 ksteube 1312 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 gross 1738 min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
70     max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
71 ksteube 1312
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 gross 1738 if (*max_id <*min_id) {
83     *max_id=0;
84     *min_id=-1;
85     }
86 ksteube 1312 }
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 gross 1738 if (*max_id <*min_id) {
92     *max_id=0;
93     *min_id=-1;
94     }
95 ksteube 1312 }
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 gross 1738 if (*max_id <*min_id) {
100     *max_id=0;
101     *min_id=-1;
102     }
103 ksteube 1312 }
104    
105 gross 1738
106 ksteube 1312 index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {
107 gross 1750 index_t min_id,max_id;
108     Finley_NodeFile_setGlobalDOFRange(&min_id,&max_id,in);
109     return max_id;
110 ksteube 1312 }
111 gross 1738
112 ksteube 1312 index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
113 gross 1750 index_t min_id,max_id;
114     Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(&min_id,&max_id,in);
115     return max_id;
116 gross 1738 }
117 ksteube 1312
118 gross 1738 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 ksteube 1312 }
142    
143     index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {
144 gross 1750 index_t min_id,max_id;
145     Finley_NodeFile_setGlobalNodeIDIndexRange(&min_id,&max_id,in);
146     return max_id;
147 ksteube 1312 }
148 gross 1738
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 ksteube 1312 index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
175 gross 1750 index_t min_id,max_id;
176     Finley_NodeFile_setGlobalReducedNodeIDIndexRange(&min_id,&max_id,in);
177     return max_id;
178 ksteube 1312 }
179 gross 1738
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