/[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

trunk/finley/src/finley/NodeFile_setIdRange.c revision 201 by jgs, Wed Nov 23 04:10:21 2005 UTC trunk/finley/src/NodeFile_setIdRange.c revision 2881 by jfenwick, Thu Jan 28 02:03:15 2010 UTC
# Line 1  Line 1 
1  /*  
2   ******************************************************************************  /*******************************************************
3   *                                                                            *  *
4   *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *  * Copyright (c) 2003-2010 by University of Queensland
5   *                                                                            *  * Earth Systems Science Computational Center (ESSCC)
6   * This software is the property of ACcESS. No part of this code              *  * http://www.uq.edu.au/esscc
7   * may be copied in any form or by any means without the expressed written    *  *
8   * consent of ACcESS.  Copying, use or modification of this software          *  * Primary Business: Queensland, Australia
9   * by any unauthorised person is illegal unless that person has a software    *  * Licensed under the Open Software License version 3.0
10   * license agreement with ACcESS.                                             *  * http://www.opensource.org/licenses/osl-3.0.php
11   *                                                                            *  *
12   ******************************************************************************  *******************************************************/
13  */  
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 20  Line 20 
20    
21  /**************************************************************/  /**************************************************************/
22    
 /*   Author: gross@access.edu.au */  
 /*   Version: $Id$ */  
   
 /**************************************************************/  
   
23  #include "NodeFile.h"  #include "NodeFile.h"
24  #include "Util.h"  #include "Util.h"
25    
26  /**************************************************************/  /**************************************************************/
27    
28    
29    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       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
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       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) {
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       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
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       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) {
88       *min_id=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
89       *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) {
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       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) {
106      index_t min_id,max_id;
107      Finley_NodeFile_setGlobalDOFRange(&min_id,&max_id,in);
108      return max_id;
109    }
110    
111    index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
112      index_t min_id,max_id;
113      Finley_NodeFile_setGlobalReducedDegreeOfFreedomRange(&min_id,&max_id,in);
114      return max_id;
115    }
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) {
143      index_t min_id,max_id;
144      Finley_NodeFile_setGlobalNodeIDIndexRange(&min_id,&max_id,in);
145      return max_id;
146    }
147    
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    index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
174      index_t min_id,max_id;
175      Finley_NodeFile_setGlobalReducedNodeIDIndexRange(&min_id,&max_id,in);
176      return max_id;
177    }
178    
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  }  }
 /*  
 * $Log$  
 * Revision 1.3  2005/09/15 03:44:23  jgs  
 * Merge of development branch dev-02 back to main trunk on 2005-09-15  
 *  
 * Revision 1.2.2.1  2005/09/07 06:26:20  gross  
 * the solver from finley are put into the standalone package paso now  
 *  
 * Revision 1.2  2005/07/08 04:07:56  jgs  
 * Merge of development branch back to main trunk on 2005-07-08  
 *  
 * Revision 1.1.1.1.2.1  2005/06/29 02:34:54  gross  
 * some changes towards 64 integers in finley  
 *  
 * Revision 1.1.1.1  2004/10/26 06:53:57  jgs  
 * initial import of project esys2  
 *  
 * Revision 1.1.1.1  2004/06/24 04:00:40  johng  
 * Initial version of eys using boost-python.  
 *  
 *  
 */  

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

  ViewVC Help
Powered by ViewVC 1.1.26