[cig-commits] r6087 - in long/3D/Gale/trunk/src/StGermain: . Discretisation/Mesh/src

walter at geodynamics.org walter at geodynamics.org
Fri Feb 23 10:02:27 PST 2007


Author: walter
Date: 2007-02-23 10:02:26 -0800 (Fri, 23 Feb 2007)
New Revision: 6087

Modified:
   long/3D/Gale/trunk/src/StGermain/
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.h
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c
   long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.h
Log:
 r3338 at earth (orig r4009):  LukeHodkinson | 2007-02-15 16:39:32 -0800
 Improvment to the speed of mesh generation.
 



Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
   - 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:4008
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899
   + 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/branches/decomp3d/StGermain:4009
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c	2007-02-23 18:02:23 UTC (rev 6086)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.c	2007-02-23 18:02:26 UTC (rev 6087)
@@ -103,6 +103,7 @@
 	stream = Journal_Register( Info_Type, self->type );
 	Stream_SetPrintingRank( stream, 0 );
 
+	self->commTopo = NULL;
 	self->regular = True;
 	self->maxDecompDims = 0;
 	self->minDecomp = NULL;
@@ -314,11 +315,11 @@
 
 	/* Set the parameters. */
 	self->elGrid = Grid_New();
-	Grid_SetNDims( self->elGrid, self->nDims );
+	Grid_SetNumDims( self->elGrid, self->nDims );
 	Grid_SetSizes( self->elGrid, sizes );
 
 	self->vertGrid = Grid_New();
-	Grid_SetNDims( self->vertGrid, self->nDims );
+	Grid_SetNumDims( self->vertGrid, self->nDims );
 	for( d_i = 0; d_i < self->nDims; d_i++ )
 		sizes[d_i]++;
 	Grid_SetSizes( self->vertGrid, sizes );
@@ -403,14 +404,14 @@
 	grid = (Grid**)ExtensionManager_Get( mesh->info, mesh, 
 					     ExtensionManager_GetHandle( mesh->info, "vertexGrid" ) );
 	*grid = Grid_New();
-	Grid_SetNDims( *grid, self->vertGrid->nDims );
+	Grid_SetNumDims( *grid, self->vertGrid->nDims );
 	Grid_SetSizes( *grid, self->vertGrid->sizes );
 
 	ExtensionManager_Add( mesh->info, "elementGrid", sizeof(Grid*) );
 	grid = (Grid**)ExtensionManager_Get( mesh->info, mesh, 
 					     ExtensionManager_GetHandle( mesh->info, "elementGrid" ) );
 	*grid = Grid_New();
-	Grid_SetNDims( *grid, self->elGrid->nDims );
+	Grid_SetNumDims( *grid, self->elGrid->nDims );
 	Grid_SetSizes( *grid, self->elGrid->sizes );
 
 	ExtensionManager_AddArray( mesh->info, "localOrigin", sizeof(unsigned), Mesh_GetDimSize( mesh ) );
@@ -436,7 +437,9 @@
 	unsigned*	tmpSubDomains;
 	double		bestRatio;
 	unsigned	bestPos;
-	unsigned	p_i, d_i;
+	unsigned	*myRankInds, *rankInds;
+	unsigned	nNbrs, *nbrs;
+	unsigned	p_i, d_i, r_i;
 
 	/* Sanity check. */
 	assert( self );
@@ -495,7 +498,7 @@
 
 	/* Build a sub-domain grid. */
 	self->procGrid = Grid_New();
-	Grid_SetNDims( self->procGrid, self->elGrid->nDims );
+	Grid_SetNumDims( self->procGrid, self->elGrid->nDims );
 	Grid_SetSizes( self->procGrid, posNSubDomains[bestPos] );
 
 	/* Free unneeded space. */
@@ -517,6 +520,39 @@
 		else
 			self->origin[d_i] += mod;
 	}
+
+	/* Build the comm topology. */
+	myRankInds = AllocArray( unsigned, Grid_GetNumDims( self->procGrid ) );
+	rankInds = AllocArray( unsigned, Grid_GetNumDims( self->procGrid ) );
+	Grid_Lift( self->procGrid, rank, myRankInds );
+	nNbrs = 0;
+	nbrs = NULL;
+	for( r_i = 0; r_i < Grid_GetNumPoints( self->procGrid ); r_i++ ) {
+		if( r_i == rank )
+			continue;
+
+		Grid_Lift( self->procGrid, r_i, rankInds );
+		for( d_i = 0; d_i < Grid_GetNumDims( self->procGrid ); d_i++ ) {
+			if( (myRankInds[d_i] > 0 && rankInds[d_i] < myRankInds[d_i] - 1) || 
+			    myRankInds[d_i] < self->procGrid->sizes[d_i] - 1 && rankInds[d_i] > myRankInds[d_i] + 1 )
+			{
+				break;
+			}
+		}
+		if( d_i == Grid_GetNumDims( self->procGrid ) ) {
+			nbrs = ReallocArray( nbrs, unsigned, nNbrs + 1 );
+			nbrs[nNbrs++] = r_i;
+		}
+	}
+
+	FreeArray( myRankInds );
+	FreeArray( rankInds );
+
+	self->commTopo = CommTopology_New();
+	CommTopology_SetComm( self->commTopo, self->comm );
+	CommTopology_SetIncidence( self->commTopo, nNbrs, nbrs );
+
+	FreeArray( nbrs );
 }
 
 void CartesianGenerator_RecurseDecomps( CartesianGenerator* self, 
@@ -602,7 +638,7 @@
 	grids[topo->nDims][0] = self->elGrid;
 
 	grids[0][0] = Grid_New();
-	Grid_SetNDims( grids[0][0], topo->nDims );
+	Grid_SetNumDims( grids[0][0], topo->nDims );
 	for( d_i = 0; d_i < topo->nDims; d_i++ )
 		self->elGrid->sizes[d_i]++;
 	Grid_SetSizes( grids[0][0], self->elGrid->sizes );
@@ -610,27 +646,27 @@
 		self->elGrid->sizes[d_i]--;
 
 	grids[1][0] = Grid_New();
-	Grid_SetNDims( grids[1][0], topo->nDims );
+	Grid_SetNumDims( grids[1][0], topo->nDims );
 	grids[0][0]->sizes[0]--;
 	Grid_SetSizes( grids[1][0], grids[0][0]->sizes );
 	grids[0][0]->sizes[0]++;
 
 	if( topo->nDims >= 2 ) {
 		grids[1][1] = Grid_New();
-		Grid_SetNDims( grids[1][1], topo->nDims );
+		Grid_SetNumDims( grids[1][1], topo->nDims );
 		grids[0][0]->sizes[1]--;
 		Grid_SetSizes( grids[1][1], grids[0][0]->sizes );
 		grids[0][0]->sizes[1]++;
 
 		if( topo->nDims >= 3 ) {
 			grids[1][2] = Grid_New();
-			Grid_SetNDims( grids[1][2], topo->nDims );
+			Grid_SetNumDims( grids[1][2], topo->nDims );
 			grids[0][0]->sizes[2]--;
 			Grid_SetSizes( grids[1][2], grids[0][0]->sizes );
 			grids[0][0]->sizes[2]++;
 
 			grids[2][0] = Grid_New();
-			Grid_SetNDims( grids[2][0], topo->nDims );
+			Grid_SetNumDims( grids[2][0], topo->nDims );
 			grids[0][0]->sizes[0]--;
 			grids[0][0]->sizes[1]--;
 			Grid_SetSizes( grids[2][0], grids[0][0]->sizes );
@@ -638,7 +674,7 @@
 			grids[0][0]->sizes[1]++;
 
 			grids[2][1] = Grid_New();
-			Grid_SetNDims( grids[2][1], topo->nDims );
+			Grid_SetNumDims( grids[2][1], topo->nDims );
 			grids[0][0]->sizes[0]--;
 			grids[0][0]->sizes[2]--;
 			Grid_SetSizes( grids[2][1], grids[0][0]->sizes );
@@ -646,7 +682,7 @@
 			grids[0][0]->sizes[2]++;
 
 			grids[2][2] = Grid_New();
-			Grid_SetNDims( grids[2][2], topo->nDims );
+			Grid_SetNumDims( grids[2][2], topo->nDims );
 			grids[0][0]->sizes[1]--;
 			grids[0][0]->sizes[2]--;
 			Grid_SetSizes( grids[2][2], grids[0][0]->sizes );
@@ -750,7 +786,7 @@
 	Stream_Indent( stream );
 
 	grid = Grid_New();
-	Grid_SetNDims( grid, self->elGrid->nDims );
+	Grid_SetNumDims( grid, self->elGrid->nDims );
 	Grid_SetSizes( grid, self->range );
 
 	nEls = grid->sizes[0];
@@ -781,11 +817,16 @@
 
 void CartesianGenerator_GenVertices( CartesianGenerator* self, MeshTopology* topo, Grid*** grids ) {
 	Stream*		stream = Journal_Register( Info_Type, self->type );
+	unsigned	rank;
 	Grid*		globalGrid;
 	Grid*		grid;
 	unsigned	nEls;
-	unsigned*	els;
-	unsigned*	dimInds;
+	unsigned	nLocals, *locals;
+	unsigned	nRemotes, *remotes;
+	unsigned	*dstArray, *dstCount;
+	unsigned	*dimInds, *rankInds;
+	Decomp*		decomp;
+	Decomp_Sync*	sync;
 	unsigned	d_i, e_i;
 
 	assert( self );
@@ -796,8 +837,10 @@
 	Journal_Printf( stream, "Generating vertices...\n" );
 	Stream_Indent( stream );
 
+	MPI_Comm_rank( CommTopology_GetComm( self->commTopo ), (int*)&rank );
+
 	globalGrid = Grid_New();
-	Grid_SetNDims( globalGrid, self->elGrid->nDims );
+	Grid_SetNumDims( globalGrid, self->elGrid->nDims );
 	for( d_i = 0; d_i < globalGrid->nDims; d_i++ )
 		self->elGrid->sizes[d_i]++;
 	Grid_SetSizes( globalGrid, self->elGrid->sizes );
@@ -805,7 +848,7 @@
 		self->elGrid->sizes[d_i]--;
 
 	grid = Grid_New();
-	Grid_SetNDims( grid, self->elGrid->nDims );
+	Grid_SetNumDims( grid, self->elGrid->nDims );
 	for( d_i = 0; d_i < grid->nDims; d_i++ )
 		self->range[d_i]++;
 	Grid_SetSizes( grid, self->range );
@@ -815,21 +858,50 @@
 	nEls = grid->sizes[0];
 	for( d_i = 1; d_i < grid->nDims; d_i++ )
 		nEls *= grid->sizes[d_i];
-	els = Memory_Alloc_Array_Unnamed( unsigned, nEls );
+	locals = Memory_Alloc_Array_Unnamed( unsigned, nEls );
+	remotes = Memory_Alloc_Array_Unnamed( unsigned, nEls );
 
 	dimInds = Memory_Alloc_Array_Unnamed( unsigned, self->elGrid->nDims );
+	rankInds = Memory_Alloc_Array_Unnamed( unsigned, self->elGrid->nDims );
+	Grid_Lift( self->procGrid, rank, rankInds );
 
+	nLocals = 0;
+	nRemotes = 0;
 	for( e_i = 0; e_i < nEls; e_i++ ) {
 		Grid_Lift( grid, e_i, dimInds );
+		for( d_i = 0; d_i < grid->nDims; d_i++ ) {
+			if( dimInds[d_i] == 0 && rankInds[d_i] > 0 )
+				break;
+		}
+		if( d_i < grid->nDims ) {
+			dstArray = remotes;
+			dstCount = &nRemotes;
+		}
+		else {
+			dstArray = locals;
+			dstCount = &nLocals;
+		}
+
 		for( d_i = 0; d_i < grid->nDims; d_i++ )
 			dimInds[d_i] += self->origin[d_i];
-		els[e_i] = Grid_Project( globalGrid, dimInds );
+
+		dstArray[(*dstCount)++] = Grid_Project( globalGrid, dimInds );
 	}
 
-	MeshTopology_SetElements( topo, MT_VERTEX, nEls, els );
+	decomp = Decomp_New();
+	Decomp_SetLocals( decomp, nLocals, locals );
+	FreeArray( locals );
 
+	sync = Decomp_Sync_New();
+	Decomp_Sync_SetDecomp( sync, decomp );
+	Decomp_Sync_SetCommTopology( sync, self->commTopo );
+	Decomp_Sync_SetRemotes( sync, nRemotes, remotes );
+	FreeArray( remotes );
+
+	MeshTopology_SetSync( topo, MT_VERTEX, sync );
+
 	FreeArray( dimInds );
-	FreeArray( els );
+	FreeArray( rankInds );
 	FreeObject( grid );
 	FreeObject( globalGrid );
 
@@ -877,13 +949,13 @@
 	assert( self->elGrid->nDims == 2 );
 
 	globalGrid = Grid_New();
-	Grid_SetNDims( globalGrid, self->elGrid->nDims );
+	Grid_SetNumDims( globalGrid, self->elGrid->nDims );
 	self->elGrid->sizes[1]++;
 	Grid_SetSizes( globalGrid, self->elGrid->sizes );
 	self->elGrid->sizes[1]--;
 
 	grid = Grid_New();
-	Grid_SetNDims( grid, self->elGrid->nDims );
+	Grid_SetNumDims( grid, self->elGrid->nDims );
 	self->range[1]++;
 	Grid_SetSizes( grid, self->range );
 	self->range[1]--;
@@ -948,7 +1020,7 @@
 	assert( self->elGrid->nDims == 3 );
 
 	globalGrid = Grid_New();
-	Grid_SetNDims( globalGrid, self->elGrid->nDims );
+	Grid_SetNumDims( globalGrid, self->elGrid->nDims );
 	self->elGrid->sizes[1]++;
 	self->elGrid->sizes[2]++;
 	Grid_SetSizes( globalGrid, self->elGrid->sizes );
@@ -956,7 +1028,7 @@
 	self->elGrid->sizes[2]--;
 
 	grid = Grid_New();
-	Grid_SetNDims( grid, self->elGrid->nDims );
+	Grid_SetNumDims( grid, self->elGrid->nDims );
 	self->range[1]++;
 	self->range[2]++;
 	Grid_SetSizes( grid, self->range );
@@ -1059,13 +1131,13 @@
 	Stream_Indent( stream );
 
 	globalGrid = Grid_New();
-	Grid_SetNDims( globalGrid, self->elGrid->nDims );
+	Grid_SetNumDims( globalGrid, self->elGrid->nDims );
 	self->elGrid->sizes[2]++;
 	Grid_SetSizes( globalGrid, self->elGrid->sizes );
 	self->elGrid->sizes[2]--;
 
 	grid = Grid_New();
-	Grid_SetNDims( grid, self->elGrid->nDims );
+	Grid_SetNumDims( grid, self->elGrid->nDims );
 	self->range[2]++;
 	Grid_SetSizes( grid, self->range );
 	self->range[2]--;
@@ -1746,7 +1818,7 @@
 
 	/* Build grid and space for indices. */
 	grid = Grid_New();
-	Grid_SetNDims( grid, mesh->topo->nDims );
+	Grid_SetNumDims( grid, mesh->topo->nDims );
 	for( d_i = 0; d_i < mesh->topo->nDims; d_i++ )
 		self->elGrid->sizes[d_i]++;
 	Grid_SetSizes( grid, self->elGrid->sizes );
@@ -1842,6 +1914,7 @@
 	KillObject( self->procGrid );
 	KillArray( self->origin );
 	KillArray( self->range );
+	KillObject( self->commTopo );
 }
 
 void CartesianGenerator_DestructGeometry( CartesianGenerator* self ) {

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.h	2007-02-23 18:02:23 UTC (rev 6086)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/CartesianGenerator.h	2007-02-23 18:02:26 UTC (rev 6087)
@@ -54,6 +54,7 @@
 		/* Virtual info */		\
 						\
 		/* CartesianGenerator info */	\
+		CommTopology*	commTopo;	\
 		Bool		regular;	\
 		unsigned	maxDecompDims;	\
 		unsigned*	minDecomp;	\
@@ -74,10 +75,10 @@
 	** Constructors
 	*/
 
-	#define CARTESIANGENERATOR_DEFARGS	\
+	#define CARTESIANGENERATOR_DEFARGS \
 		MESHGENERATOR_DEFARGS
 
-	#define CARTESIANGENERATOR_PASSARGS	\
+	#define CARTESIANGENERATOR_PASSARGS \
 		MESHGENERATOR_PASSARGS
 
 	CartesianGenerator* CartesianGenerator_New( Name name );

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c	2007-02-23 18:02:23 UTC (rev 6086)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.c	2007-02-23 18:02:26 UTC (rev 6087)
@@ -32,10 +32,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#include <mpi.h>
 
-#include <mpi.h>
 #include "Base/Base.h"
-
 #include "Discretisation/Geometry/Geometry.h"
 #include "Discretisation/Shape/Shape.h"
 
@@ -56,12 +55,12 @@
 			  Grid_Type, 
 			  _Grid_Delete, 
 			  _Grid_Print, 
-			  _Grid_Copy );
+			  NULL );
 }
 
 Grid* _Grid_New( GRID_DEFARGS ) {
-	Grid* self;
-	
+	Grid*	self;
+
 	/* Allocate memory */
 	assert( sizeOfSelf >= sizeof(Grid) );
 	self = (Grid*)_Stg_Class_New( STG_CLASS_PASSARGS );
@@ -79,6 +78,9 @@
 	self->sizes = NULL;
 	self->basis = NULL;
 	self->nPoints = 0;
+
+	self->map = NULL;
+	self->invMap = NULL;
 }
 
 
@@ -95,7 +97,7 @@
 
 void _Grid_Print( void* grid, Stream* stream ) {
 	Grid*	self = (Grid*)grid;
-	
+
 	/* Set the Journal for printing informations */
 	Stream* gridStream;
 	gridStream = Journal_Register( InfoStream_Type, "GridStream" );
@@ -105,45 +107,12 @@
 	_Stg_Class_Print( self, stream );
 }
 
-void* _Grid_Copy( void* grid, void* destProc_I, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-#if 0
-	Grid*	self = (Grid*)grid;
-	Grid*	newGrid;
-	PtrMap*	map = ptrMap;
-	Bool	ownMap = False;
 
-	/* Damn me for making copying so difficult... what was I thinking? */
-	
-	/* We need to create a map if it doesn't already exist. */
-	if( !map ) {
-		map = PtrMap_New( 10 );
-		ownMap = True;
-	}
-	
-	newGrid = (Grid*)_Mesh_Copy( self, destProc_I, deep, nameExt, map );
-	
-	/* Copy the virtual methods here. */
-
-	/* Deep or shallow? */
-	if( deep ) {
-	}
-	else {
-	}
-	
-	/* If we own the map, get rid of it here. */
-	if( ownMap ) Stg_Class_Delete( map );
-	
-	return (void*)newGrid;
-#endif
-
-	return NULL;
-}
-
 /*--------------------------------------------------------------------------------------------------------------------------
 ** Public Functions
 */
 
-void Grid_SetNDims( void* grid, unsigned nDims ) {
+void Grid_SetNumDims( void* grid, unsigned nDims ) {
 	Grid*	self = (Grid*)grid;
 
 	/* Sanity check. */
@@ -190,6 +159,48 @@
 	}
 }
 
+void Grid_SetMapping( void* grid, HashTable* mapping, HashTable* inverse ) {
+	Grid*	self = (Grid*)grid;
+
+	assert( self );
+
+	self->map = mapping;
+	self->invMap = inverse;
+}
+
+unsigned Grid_GetNumDims( void* grid ) {
+	Grid*	self = (Grid*)grid;
+
+	assert( self );
+
+	return self->nDims;
+}
+
+unsigned* Grid_GetSizes( void* grid ) {
+	Grid*	self = (Grid*)grid;
+
+	assert( self );
+
+	return self->sizes;
+}
+
+unsigned Grid_GetNumPoints( void* grid ) {
+	Grid*	self = (Grid*)grid;
+
+	assert( self );
+
+	return self->nPoints;
+}
+
+void Grid_GetMapping( void* grid, HashTable** mapping, HashTable** inverse ) {
+	Grid*	self = (Grid*)grid;
+
+	assert( self );
+
+	*mapping = self->map;
+	*inverse = self->invMap;
+}
+
 void Grid_Lift( void* grid, unsigned ind, unsigned* params ) {
 	Grid*		self = (Grid*)grid;
 	unsigned	rem;
@@ -206,7 +217,19 @@
 	** space.
 	*/
 
-	rem = ind;
+	if( self->map ) {
+#ifndef NDEBUG
+		unsigned*	remPtr;
+
+		assert( remPtr = HashTable_FindEntry( self->map, &ind, sizeof(unsigned), unsigned ) );
+		rem = *remPtr;
+#else
+		rem = *HashTable_FindEntry( self->map, &ind, sizeof(unsigned), unsigned );
+#endif
+	}
+	else
+		rem = ind;
+
 	for( d_i = self->nDims; d_i > 0; d_i-- ) {
 		unsigned	dimInd = d_i - 1;
 		div_t		divRes;
@@ -240,6 +263,17 @@
 		ind += params[d_i] * self->basis[d_i];
 	}
 
+	if( self->invMap ) {
+#ifndef NDEBUG
+		unsigned*	indPtr;
+
+		assert( indPtr = HashTable_FindEntry( self->invMap, &ind, sizeof(unsigned), unsigned ) );
+		ind = *indPtr;
+#else
+		ind = *HashTable_FindEntry( self->invMap, &ind, sizeof(unsigned), unsigned );
+#endif
+	}
+
 	return ind;
 }
 

Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.h
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.h	2007-02-23 18:02:23 UTC (rev 6086)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Mesh/src/Grid.h	2007-02-23 18:02:26 UTC (rev 6087)
@@ -47,17 +47,20 @@
 	/** Virtual function types */
 
 	/** Grid class contents */
-	#define __Grid			\
-		/* General info */	\
-		__Stg_Class		\
-					\
-		/* Virtual info */	\
-					\
-		/* Grid info */		\
-		unsigned	nDims;	\
-		unsigned*	sizes;	\
-		unsigned*	basis;	\
-		unsigned	nPoints;
+	#define __Grid				\
+		/* General info */		\
+		__Stg_Class			\
+						\
+		/* Virtual info */		\
+						\
+		/* Grid info */			\
+		unsigned	nDims;		\
+		unsigned*	sizes;		\
+		unsigned*	basis;		\
+		unsigned	nPoints;	\
+						\
+		HashTable*	map;		\
+		HashTable*	invMap;
 
 	struct Grid { __Grid };
 
@@ -65,10 +68,10 @@
 	** Constructors
 	*/
 
-	#define GRID_DEFARGS		\
+	#define GRID_DEFARGS \
 		STG_CLASS_DEFARGS
 
-	#define GRID_PASSARGS		\
+	#define GRID_PASSARGS \
 		STG_CLASS_PASSARGS
 
 	Grid* Grid_New();
@@ -82,19 +85,19 @@
 	void _Grid_Delete( void* grid );
 	void _Grid_Print( void* grid, Stream* stream );
 
-	#define Grid_Copy( self ) \
-		(Mesh*)Stg_Class_Copy( self, NULL, False, NULL, NULL )
-	#define Grid_DeepCopy( self ) \
-		(Mesh*)Stg_Class_Copy( self, NULL, True, NULL, NULL )
-	void* _Grid_Copy( void* grid, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap );
-
 	/*--------------------------------------------------------------------------------------------------------------------------
 	** Public functions
 	*/
 
-	void Grid_SetNDims( void* grid, unsigned nDims );
+	void Grid_SetNumDims( void* grid, unsigned nDims );
 	void Grid_SetSizes( void* grid, unsigned* sizes );
+	void Grid_SetMapping( void* grid, HashTable* mapping, HashTable* inverse );
 
+	unsigned Grid_GetNumDims( void* grid );
+	unsigned* Grid_GetSizes( void* grid );
+	unsigned Grid_GetNumPoints( void* grid );
+	void Grid_GetMapping( void* grid, HashTable** mapping, HashTable** inverse );
+
 	void Grid_Lift( void* grid, unsigned ind, unsigned* params );
 	unsigned Grid_Project( void* grid, unsigned* params );
 



More information about the cig-commits mailing list