/[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 1223 - (show annotations)
Fri Aug 3 02:40:39 2007 UTC (11 years, 8 months ago) by gross
File MIME type: text/plain
File size: 2620 byte(s)
first attemt towards an improved MPI version.  

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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26