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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 969 - (hide annotations)
Tue Feb 13 23:02:23 2007 UTC (12 years, 11 months ago) by ksteube
File MIME type: text/plain
File size: 1536 byte(s)
Parallelization using MPI for solution of implicit problems.

Parallelization for explicit problems has already been accomplished in
the main SVN branch.

This is incomplete and is not ready for use.


1 bcumming 751 #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 ksteube 969 for( n=0; n<Distribution->numNeighbours; n++ ) {
11 bcumming 751 if( Distribution->edges[n]->numForward>bufferLength )
12     bufferLength = Distribution->edges[n]->numForward;
13 ksteube 969 if( Distribution->edges[n]->numBackward>bufferLength )
14 bcumming 751 bufferLength = Distribution->edges[n]->numBackward;
15 ksteube 969 }
16 bcumming 751
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