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

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

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

temp/finley/src/NodeFile_setIdRange.c revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC trunk/finley/src/NodeFile_setIdRange.c revision 2881 by jfenwick, Thu Jan 28 02:03:15 2010 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2010 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 33  void Finley_NodeFile_setGlobalIdRange(in Line 32  void Finley_NodeFile_setGlobalIdRange(in
32     index_t global_id_range[2], id_range[2];     index_t global_id_range[2], id_range[2];
33     #endif     #endif
34    
35     Finley_NodeFile_setIdRange(&min_id_local, &max_id_local,in);     min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->Id);
36       max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
37    
38     #ifdef PASO_MPI     #ifdef PASO_MPI
39     id_range[0]=-min_id_local;     id_range[0]=-min_id_local;
# Line 45  void Finley_NodeFile_setGlobalIdRange(in Line 45  void Finley_NodeFile_setGlobalIdRange(in
45     *min_id=min_id_local;     *min_id=min_id_local;
46     *max_id=max_id_local;     *max_id=max_id_local;
47     #endif     #endif
48       if (*max_id <*min_id) {
49           *max_id=0;
50           *min_id=-1;
51       }
52  }  }
53    
54  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) {
55     *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);     *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);
56     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
57       if (*max_id <*min_id) {
58           *max_id=0;
59           *min_id=-1;
60       }
61  }  }
62  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) {
63     index_t min_id_local, max_id_local;     index_t min_id_local, max_id_local;
# Line 57  void Finley_NodeFile_setGlobalDOFRange(i Line 65  void Finley_NodeFile_setGlobalDOFRange(i
65     index_t global_id_range[2], id_range[2];     index_t global_id_range[2], id_range[2];
66     #endif     #endif
67    
68     Finley_NodeFile_setDOFRange(&min_id_local, &max_id_local,in);     min_id_local=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
69       max_id_local=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
70    
71     #ifdef PASO_MPI     #ifdef PASO_MPI
72     id_range[0]=-min_id_local;     id_range[0]=-min_id_local;
# Line 69  void Finley_NodeFile_setGlobalDOFRange(i Line 78  void Finley_NodeFile_setGlobalDOFRange(i
78     *min_id=min_id_local;     *min_id=min_id_local;
79     *max_id=max_id_local;     *max_id=max_id_local;
80     #endif     #endif
81       if (*max_id <*min_id) {
82           *max_id=0;
83           *min_id=-1;
84       }
85  }  }
86    
87  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) {
88     *min_id=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);     *min_id=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
89     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);     *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
90       if (*max_id <*min_id) {
91           *max_id=0;
92           *min_id=-1;
93       }
94  }  }
95  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) {
96     *min_id=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedDOFIndex,-1);     *min_id=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
97     *max_id=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);     *max_id=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
98       if (*max_id <*min_id) {
99           *max_id=0;
100           *min_id=-1;
101       }
102  }  }
103    
104    
105  index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {  index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {
106    index_t loc_out, out;    index_t min_id,max_id;
107    loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);    Finley_NodeFile_setGlobalDOFRange(&min_id,&max_id,in);
108    #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;  
109  }  }
110    
111  index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {  index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
112    index_t loc_out, out;    index_t min_id,max_id;
113    loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);    Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(&min_id,&max_id,in);
114    #ifdef PASO_MPI    return max_id;
115    MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );  }
   #else  
   out=loc_out;  
   #endif  
   return out;  
116    
117    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  }  }
141    
142  index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {  index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {
143    index_t loc_out, out;    index_t min_id,max_id;
144    loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);    Finley_NodeFile_setGlobalNodeIDIndexRange(&min_id,&max_id,in);
145    #ifdef PASO_MPI    return max_id;
146    MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );  }
147    #else  
148    out=loc_out;  void Finley_NodeFile_setGlobalNodeIDIndexRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
149    #endif     index_t min_id_local, max_id_local;
150    return out;     #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  index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {  index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
174    index_t loc_out, out;    index_t min_id,max_id;
175    loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedNodesIndex,-1);    Finley_NodeFile_setGlobalReducedNodeIDIndexRange(&min_id,&max_id,in);
176    #ifdef PASO_MPI    return max_id;
177    MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );  }
178    #else  
179    out=loc_out;  void Finley_NodeFile_setGlobalReducedNodeIDIndexRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
180    #endif     index_t min_id_local, max_id_local;
181    return out;     #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  }  }

Legend:
Removed from v.1387  
changed lines
  Added in v.2881

  ViewVC Help
Powered by ViewVC 1.1.26