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

Contents of /trunk-mpi-branch/finley/src/NodeFile_setIdRange.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1272 - (show annotations)
Fri Aug 24 00:40:43 2007 UTC (11 years, 8 months ago) by gross
File MIME type: text/plain
File size: 4163 byte(s)
some bugs in the node-node interpolation fixed
1 /*
2 ************************************************************
3 * Copyright 2006 by ACcESS MNRF *
4 * *
5 * http://www.access.edu.au *
6 * Primary Business: Queensland, Australia *
7 * Licensed under the Open Software License version 3.0 *
8 * http://www.opensource.org/licenses/osl-3.0.php *
9 * *
10 ************************************************************
11 */
12
13 /**************************************************************/
14
15 /* Finley: Mesh: NodeFile */
16
17 /* returns the maximum and minimum node id number of nodes: */
18
19 /**************************************************************/
20
21 /* Author: gross@access.edu.au */
22 /* Version: $Id$ */
23
24 /**************************************************************/
25
26 #include "NodeFile.h"
27 #include "Util.h"
28
29 /**************************************************************/
30
31
32 void Finley_NodeFile_setGlobalIdRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
33 index_t min_id_local, max_id_local;
34 #ifdef PASO_MPI
35 index_t global_id_range[2], id_range[2];
36 #endif
37
38 Finley_NodeFile_setIdRange(&min_id_local, &max_id_local,in);
39
40 #ifdef PASO_MPI
41 id_range[0]=-min_id_local;
42 id_range[1]=max_id_local;
43 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
44 *min_id=-global_id_range[0];
45 *max_id=global_id_range[1];
46 #else
47 *min_id=min_id_local;
48 *max_id=max_id_local;
49 #endif
50 }
51
52 void Finley_NodeFile_setIdRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
53 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->Id);
54 *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->Id);
55 }
56 void Finley_NodeFile_setGlobalDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
57 index_t min_id_local, max_id_local;
58 #ifdef PASO_MPI
59 index_t global_id_range[2], id_range[2];
60 #endif
61
62 Finley_NodeFile_setDOFRange(&min_id_local, &max_id_local,in);
63
64 #ifdef PASO_MPI
65 id_range[0]=-min_id_local;
66 id_range[1]=max_id_local;
67 MPI_Allreduce( id_range, global_id_range, 2, MPI_INT, MPI_MAX, in->MPIInfo->comm );
68 *min_id=-global_id_range[0];
69 *max_id=global_id_range[1];
70 #else
71 *min_id=min_id_local;
72 *max_id=max_id_local;
73 #endif
74 }
75
76 void Finley_NodeFile_setDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
77 *min_id=Finley_Util_getMinInt(1,in->numNodes,in->globalDegreesOfFreedom);
78 *max_id=Finley_Util_getMaxInt(1,in->numNodes,in->globalDegreesOfFreedom);
79 }
80 void Finley_NodeFile_setReducedDOFRange(index_t* min_id,index_t* max_id,Finley_NodeFile* in) {
81 *min_id=Finley_Util_getFlaggedMinInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
82 *max_id=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
83 }
84
85 index_t Finley_NodeFile_maxGlobalDegreeOfFreedomIndex(Finley_NodeFile* in) {
86 index_t loc_out, out;
87 loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);
88 #ifdef PASO_MPI
89 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
90 #else
91 out=loc_out;
92 #endif
93 return out;
94 }
95 index_t Finley_NodeFile_maxGlobalReducedDegreeOfFreedomIndex(Finley_NodeFile* in) {
96 index_t loc_out, out;
97 loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedDOFIndex,-1);
98 #ifdef PASO_MPI
99 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
100 #else
101 out=loc_out;
102 #endif
103 return out;
104
105 }
106
107 index_t Finley_NodeFile_maxGlobalNodeIDIndex(Finley_NodeFile* in) {
108 index_t loc_out, out;
109 loc_out=Finley_Util_getMaxInt(1,in->numNodes,in->globalNodesIndex);
110 #ifdef PASO_MPI
111 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
112 #else
113 out=loc_out;
114 #endif
115 return out;
116 }
117 index_t Finley_NodeFile_maxGlobalReducedNodeIDIndex(Finley_NodeFile* in) {
118 index_t loc_out, out;
119 loc_out=Finley_Util_getFlaggedMaxInt(1,in->numNodes,in->globalReducedNodesIndex,-1);
120 #ifdef PASO_MPI
121 MPI_Allreduce(&loc_out, &out, 1, MPI_INT, MPI_MAX, in->MPIInfo->comm );
122 #else
123 out=loc_out;
124 #endif
125 return out;
126 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26