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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1780 by jfenwick, Mon Aug 11 03:33:40 2008 UTC revision 1781 by jfenwick, Thu Sep 11 05:03:14 2008 UTC
# Line 33  void Finley_NodeFile_setGlobalIdRange(in Line 33  void Finley_NodeFile_setGlobalIdRange(in
33     index_t global_id_range[2], id_range[2];     index_t global_id_range[2], id_range[2];
34     #endif     #endif
35    
36     Finley_NodeFile_setIdRange(&min_id_local, &max_id_local,in);     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     #ifdef PASO_MPI
40     id_range[0]=-min_id_local;     id_range[0]=-min_id_local;
# Line 45  void Finley_NodeFile_setGlobalIdRange(in Line 46  void Finley_NodeFile_setGlobalIdRange(in
46     *min_id=min_id_local;     *min_id=min_id_local;
47     *max_id=max_id_local;     *max_id=max_id_local;
48     #endif     #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) {  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);     *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);
57     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);     *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) {  void Finley_NodeFile_setGlobalDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
64     index_t min_id_local, max_id_local;     index_t min_id_local, max_id_local;
# Line 57  void Finley_NodeFile_setGlobalDOFRange(i Line 66  void Finley_NodeFile_setGlobalDOFRange(i
66     index_t global_id_range[2], id_range[2];     index_t global_id_range[2], id_range[2];
67     #endif     #endif
68    
69     Finley_NodeFile_setDOFRange(&min_id_local, &max_id_local,in);     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     #ifdef PASO_MPI
73     id_range[0]=-min_id_local;     id_range[0]=-min_id_local;
# Line 69  void Finley_NodeFile_setGlobalDOFRange(i Line 79  void Finley_NodeFile_setGlobalDOFRange(i
79     *min_id=min_id_local;     *min_id=min_id_local;
80     *max_id=max_id_local;     *max_id=max_id_local;
81     #endif     #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) {  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);     *min_id=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
90     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);     *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) {  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);     *min_id=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
98     *max_id=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);     *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) {  index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {
107    index_t loc_out, out;    index_t min_id,max_id;
108    loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);    Finley_NodeFile_setGlobalDOFRange(&min_id,&max_id,in);
109    #ifdef PASO_MPI    return max_id;
   MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );  
   #else  
   out=loc_out;  
   #endif  
   return out;  
110  }  }
111    
112  index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {  index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
113    index_t loc_out, out;    index_t min_id,max_id;
114    loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);    Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(&min_id,&max_id,in);
115    #ifdef PASO_MPI    return max_id;
116    MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );  }
117    #else  
118    out=loc_out;  void Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
119    #endif     index_t min_id_local, max_id_local;
120    return out;     #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) {  index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {
144    index_t loc_out, out;    index_t min_id,max_id;
145    loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);    Finley_NodeFile_setGlobalNodeIDIndexRange(&min_id,&max_id,in);
146    #ifdef PASO_MPI    return max_id;
147    MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );  }
148    #else  
149    out=loc_out;  void Finley_NodeFile_setGlobalNodeIDIndexRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
150    #endif     index_t min_id_local, max_id_local;
151    return out;     #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) {  index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
175    index_t loc_out, out;    index_t min_id,max_id;
176    loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedNodesIndex,-1);    Finley_NodeFile_setGlobalReducedNodeIDIndexRange(&min_id,&max_id,in);
177    #ifdef PASO_MPI    return max_id;
178    MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );  }
179    #else  
180    out=loc_out;  void Finley_NodeFile_setGlobalReducedNodeIDIndexRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
181    #endif     index_t min_id_local, max_id_local;
182    return out;     #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  }  }

Legend:
Removed from v.1780  
changed lines
  Added in v.1781

  ViewVC Help
Powered by ViewVC 1.1.26