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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 971 - (show annotations)
Wed Feb 14 04:40:49 2007 UTC (12 years, 8 months ago) by ksteube
File MIME type: text/plain
File size: 1535 byte(s)
Had to undo commit to new MPI branch. The changes went into the original and
not the branch. The files committed here are exactly the same as revision 969.


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 else if( Distribution->edges[n]->numBackward>bufferLength )
14 bufferLength = Distribution->edges[n]->numBackward;
15
16 buffer = TMPMEMALLOC( bufferLength, index_t );
17
18 /* send updated global indices for local DOF that are to neighbours for whom they are external */
19 for( n=0; n<Distribution->numNeighbours; n++ ){
20 for( i=0; i<Distribution->edges[n]->numForward; i++ )
21 buffer[i] = Distribution->vtxdist[thisDom] + Distribution->edges[n]->indexForward[i];
22 Paso_CommBuffer_pack( CommBuffer, Distribution->neighbours[n], NULL, buffer, sizeof(index_t), 0 );
23 Paso_CommBuffer_send( CommBuffer, Distribution->neighbours[n], sizeof(index_t) );
24 }
25
26 /* receive updated global indices for external DOF from neighbours */
27 for( n=0; n<Distribution->numNeighbours; n++ ){
28 Paso_CommBuffer_recv( CommBuffer, Distribution->neighbours[n], sizeof(index_t) );
29 Paso_CommBuffer_unpack( CommBuffer, Distribution->neighbours[n], Distribution->edges[n]->indexBackward, Distribution->indexExternal, sizeof(index_t), -Distribution->numLocal );
30 }
31
32 TMPMEMFREE( buffer );
33 }
34 #endif
35

  ViewVC Help
Powered by ViewVC 1.1.26