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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1388 - (show annotations)
Fri Jan 11 07:45:58 2008 UTC (11 years, 9 months ago) by trankine
File MIME type: text/plain
File size: 3913 byte(s)
And get the *(&(*&(* name right
1
2 /* $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 /**************************************************************/
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 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 Finley_NodeFile_setIdRange(&min_id_local, &max_id_local,in);
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 }
49
50 void Finley_NodeFile_setIdRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
51 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);
52 *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
53 }
54 void Finley_NodeFile_setGlobalDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
55 index_t min_id_local, max_id_local;
56 #ifdef PASO_MPI
57 index_t global_id_range[2], id_range[2];
58 #endif
59
60 Finley_NodeFile_setDOFRange(&min_id_local, &max_id_local,in);
61
62 #ifdef PASO_MPI
63 id_range[0]=-min_id_local;
64 id_range[1]=max_id_local;
65 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
66 *min_id=-global_id_range[0];
67 *max_id=global_id_range[1];
68 #else
69 *min_id=min_id_local;
70 *max_id=max_id_local;
71 #endif
72 }
73
74 void Finley_NodeFile_setDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
75 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
76 *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
77 }
78 void Finley_NodeFile_setReducedDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
79 *min_id=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
80 *max_id=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
81 }
82
83 index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {
84 index_t loc_out, out;
85 loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);
86 #ifdef PASO_MPI
87 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
88 #else
89 out=loc_out;
90 #endif
91 return out;
92 }
93 index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
94 index_t loc_out, out;
95 loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
96 #ifdef PASO_MPI
97 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
98 #else
99 out=loc_out;
100 #endif
101 return out;
102
103 }
104
105 index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {
106 index_t loc_out, out;
107 loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);
108 #ifdef PASO_MPI
109 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
110 #else
111 out=loc_out;
112 #endif
113 return out;
114 }
115 index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
116 index_t loc_out, out;
117 loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedNodesIndex,-1);
118 #ifdef PASO_MPI
119 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
120 #else
121 out=loc_out;
122 #endif
123 return out;
124 }

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26