[cig-commits] r4325 - in long/3D/Gale/trunk/src/StGermain: .
Discretisation/Utils/src
walter at geodynamics.org
walter at geodynamics.org
Thu Aug 17 17:17:09 PDT 2006
Author: walter
Date: 2006-08-17 17:17:09 -0700 (Thu, 17 Aug 2006)
New Revision: 4325
Modified:
long/3D/Gale/trunk/src/StGermain/
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.h
Log:
r2703 at earth: boo | 2006-08-17 17:14:18 -0700
r2657 at earth (orig r3738): LukeHodkinson | 2006-08-01 21:43:05 -0700
Modified the Sync class to use the MPI helper
routines now located in Base/Container.
Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
- 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2702
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3737
+ 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:2703
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3738
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.c 2006-08-18 00:17:05 UTC (rev 4324)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.c 2006-08-18 00:17:09 UTC (rev 4325)
@@ -1251,7 +1251,7 @@
Memory_Free( tmpSizes );
/* Unpack the 1D array into the 2D destination. */
- Array_1DTo2D( nProcs, *dstSizes, sizeof(unsigned), tmpArray1D, dstArray );
+ Array_1DTo2D( nProcs, *dstSizes, tmpArray1D, dstArray, sizeof(unsigned) );
/* Free resources. */
if( tmpArray1D ) {
@@ -1330,7 +1330,7 @@
void* tmpSrcArray1D;
unsigned* disps;
- Array_2DTo1D( nProcs, sizes, sizeof(unsigned), array, &tmpSrcArray1D, &disps );
+ Array_2DTo1D( nProcs, sizes, array, &tmpSrcArray1D, &disps, sizeof(unsigned) );
/* Generate a temporary set of sizes to include 'itemSize'. Modify 'dists' while we're at it. */
tmpSizes = Memory_Alloc_Array_Unnamed( unsigned, nProcs );
@@ -1363,7 +1363,7 @@
}
/* Unpack the 1D array into the 2D destination. */
- Array_1DTo2D( nProcs, *dstSizes, sizeof(unsigned), tmpDstArray1D, dstArray );
+ Array_1DTo2D( nProcs, *dstSizes, tmpDstArray1D, dstArray, sizeof(unsigned) );
/* Free resources. */
if( tmpDstArray1D ) {
@@ -1371,96 +1371,3 @@
}
}
}
-
-
-void Array_1DTo2D( unsigned nBlocks,
- unsigned* sizes,
- size_t itemSize,
- void* srcArray,
- void*** dstArray )
-{
- if( nBlocks == 0 ) {
- *dstArray = NULL;
- return;
- }
-
-
- /*
- ** Dump a 1D array of definite block sizes into a 2D equivalent for easy access.
- */
-
- {
- void** tmp;
- unsigned curPos = 0;
- unsigned block_i;
-
- tmp = Memory_Alloc_Array_Unnamed( void*, nBlocks );
- for( block_i = 0; block_i < nBlocks; block_i++ ) {
- if( sizes[block_i] == 0 ) {
- tmp[block_i] = NULL;
- continue;
- }
-
- tmp[block_i] = Memory_Alloc_Array_Bytes_Unnamed( itemSize, sizes[block_i], "unknown" );
- memcpy( tmp[block_i], (byte_t*)srcArray + curPos * itemSize, itemSize * sizes[block_i] );
- curPos += sizes[block_i];
- }
-
- *dstArray = tmp;
- }
-}
-
-
-void Array_2DTo1D( unsigned nBlocks,
- unsigned* sizes,
- size_t itemSize,
- void** srcArray,
- void** dstArray,
- unsigned** disps )
-{
- if( nBlocks == 0 ) {
- dstArray = NULL;
- disps = NULL;
- return;
- }
-
-
- /*
- ** Dump a 2D array into a 1D array and build a displacement array to accompany it.
- */
-
- {
- unsigned netSize;
- unsigned block_i;
- unsigned* tmpDisps;
-
- tmpDisps = Memory_Alloc_Array_Unnamed( unsigned, nBlocks );
-
- tmpDisps[0] = 0;
- netSize = sizes[0];
- for( block_i = 1; block_i < nBlocks; block_i++ ) {
- tmpDisps[block_i] = tmpDisps[block_i - 1] + sizes[block_i - 1];
- netSize += sizes[block_i];
- }
-
- if( netSize > 0 ) {
- void* tmpArray;
- char* dest;
-
- tmpArray = Memory_Alloc_Array_Bytes_Unnamed( itemSize, netSize, "unknown" );
-
- for( block_i = 0; block_i < nBlocks; block_i++ ) {
- dest = tmpArray;
- dest += (tmpDisps[block_i] * itemSize);
- memcpy( dest, srcArray[block_i], itemSize * sizes[block_i] );
- }
-
- *dstArray = tmpArray;
- }
- else {
- *dstArray = NULL;
- }
-
- *disps = tmpDisps;
- }
-}
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.h 2006-08-18 00:17:05 UTC (rev 4324)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/Sync.h 2006-08-18 00:17:09 UTC (rev 4325)
@@ -248,20 +248,6 @@
void MPI_Array2DAlltoall( unsigned* sizes, size_t itemSize, void** array,
unsigned** dstSizes, void*** dstArray,
MPI_Comm comm );
-
- void Array_1DTo2D( unsigned nBlocks,
- unsigned* sizes,
- size_t itemSize,
- void* srcArray,
- void*** dstArray );
- void Array_2DTo1D( unsigned nBlocks,
- unsigned* sizes,
- size_t itemSize,
- void** srcArray,
- void** dstArray,
- unsigned** disps );
-
-
#endif /* __Discretisaton_Utils_Sync_h__ */
More information about the cig-commits
mailing list