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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 989 - (show annotations)
Wed Feb 21 00:26:26 2007 UTC (13 years, 3 months ago) by ksteube
File MIME type: text/plain
File size: 1536 byte(s)
Branch for parallelization of implicit solutions.

This is a work in progress and should not yet be used by anyone.

The parallelization of explicit solutions was done by Ben and is
already incorporated into the main branch of trunk.


1 #include "Distribution.h"
2
3 #ifdef PASO_MPI
4 void Finley_NodeDistribution_calculateIndexExternal( Finley_NodeDistribution *Distribution, Paso_CommBuffer *CommBuffer )
5 {
6 index_t i, n, thisDom=Distribution->MPIInfo->rank;
7 index_t *buffer=NULL;
8 dim_t bufferLength=0;
9
10 for( n=0; n<Distribution->numNeighbours; n++ ) {
11 if( Distribution->edges[n]->numForward>bufferLength )
12 bufferLength = Distribution->edges[n]->numForward;
13 if( Distribution->edges[n]->numBackward>bufferLength )
14 bufferLength = Distribution->edges[n]->numBackward;
15 }
16
17 buffer = TMPMEMALLOC( bufferLength, index_t );
18
19 /* send updated global indices for local DOF that are to neighbours for whom they are external */
20 for( n=0; n<Distribution->numNeighbours; n++ ){
21 for( i=0; i<Distribution->edges[n]->numForward; i++ )
22 buffer[i] = Distribution->vtxdist[thisDom] + Distribution->edges[n]->indexForward[i];
23 Paso_CommBuffer_pack( CommBuffer, Distribution->neighbours[n], NULL, buffer, sizeof(index_t), 0 );
24 Paso_CommBuffer_send( CommBuffer, Distribution->neighbours[n], sizeof(index_t) );
25 }
26
27 /* receive updated global indices for external DOF from neighbours */
28 for( n=0; n<Distribution->numNeighbours; n++ ){
29 Paso_CommBuffer_recv( CommBuffer, Distribution->neighbours[n], sizeof(index_t) );
30 Paso_CommBuffer_unpack( CommBuffer, Distribution->neighbours[n], Distribution->edges[n]->indexBackward, Distribution->indexExternal, sizeof(index_t), -Distribution->numLocal );
31 }
32
33 TMPMEMFREE( buffer );
34 }
35 #endif
36

  ViewVC Help
Powered by ViewVC 1.1.26