[cig-commits] commit:

Mercurial hg at geodynamics.org
Mon Nov 24 11:58:34 PST 2008


changeset:   55:742275e58eb9
user:        LukeHodkinson
date:        Tue Mar 11 01:05:34 2008 +0000
files:       Mesh/src/CartesianGenerator.c Mesh/src/CartesianGenerator.h
description:
Adding some support for periodic BCs in the mesh
generation code.


diff -r 8de55d2549aa -r 742275e58eb9 Mesh/src/CartesianGenerator.c
--- a/Mesh/src/CartesianGenerator.c	Thu Mar 06 07:11:46 2008 +0000
+++ b/Mesh/src/CartesianGenerator.c	Tue Mar 11 01:05:34 2008 +0000
@@ -129,6 +129,7 @@ void _CartesianGenerator_Init( Cartesian
 
 	self->comm = NULL;
 	self->regular = True;
+	memset( self->periodic, 0, 3 * sizeof(Bool) );
 	self->maxDecompDims = 0;
 	self->minDecomp = NULL;
 	self->maxDecomp = NULL;
@@ -325,6 +326,14 @@ void _CartesianGenerator_Construct( void
 	/* Read regular flag. */
 	self->regular = Stg_ComponentFactory_GetBool( cf, self->name, "regular", True );
 
+	/* Read periodic flags. */
+	self->periodic[0] = Stg_ComponentFactory_GetBool( cf, self->name,
+							  "periodic_x", False );
+	self->periodic[1] = Stg_ComponentFactory_GetBool( cf, self->name,
+							  "periodic_y", False );
+	self->periodic[2] = Stg_ComponentFactory_GetBool( cf, self->name,
+							  "periodic_z", False );
+
 	/* Read a general dictionary flag for which processor to watch. */
 	stream = Journal_Register( Info_Type, self->type );
 	Stream_SetPrintingRank( stream, Dictionary_GetUnsignedInt_WithDefault( cf->rootDict, "rankToWatch", 0 ) );
@@ -367,6 +376,7 @@ void CartesianGenerator_Generate( void* 
 	Mesh*			mesh = (Mesh*)_mesh;
 	Grid**			grid;
 	unsigned		*localRange, *localOrigin;
+	Bool			*periodic;
 	
 	/* Sanity check. */
 	assert( self );
@@ -432,6 +442,12 @@ void CartesianGenerator_Generate( void* 
 	localRange = (unsigned*)ExtensionManager_Get( mesh->info, mesh, 
 						      ExtensionManager_GetHandle( mesh->info, "localRange" ) );
 	memcpy( localRange, self->range, Mesh_GetDimSize( mesh ) * sizeof(unsigned) );
+
+	ExtensionManager_AddArray( mesh->info, "periodic", sizeof(Bool), 3 );
+	periodic = (int*)ExtensionManager_Get(
+		mesh->info, mesh, ExtensionManager_GetHandle( mesh->info, "periodic" )
+		);
+	memcpy( periodic, self->periodic, 3 * sizeof(Bool) );
 
 	Stream_UnIndent( stream );
 }
diff -r 8de55d2549aa -r 742275e58eb9 Mesh/src/CartesianGenerator.h
--- a/Mesh/src/CartesianGenerator.h	Thu Mar 06 07:11:46 2008 +0000
+++ b/Mesh/src/CartesianGenerator.h	Tue Mar 11 01:05:34 2008 +0000
@@ -81,6 +81,7 @@
 		/* CartesianGenerator info */							\
 		Comm*		comm;								\
 		Bool		regular;							\
+		Bool		periodic[3];							\
 		unsigned	maxDecompDims;							\
 		unsigned*	minDecomp;							\
 		unsigned*	maxDecomp;							\



More information about the CIG-COMMITS mailing list