[cig-commits] commit:

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


changeset:   12:1ddec1d7b6cc
user:        LukeHodkinson
date:        Wed Dec 05 04:45:00 2007 +0000
files:       Swarm/src/GlobalParticleLayout.c Swarm/src/SwarmClass.c
description:
Adding a couple of progress meters to the particle
ownership calculation.


diff -r 70e7515704d2 -r 1ddec1d7b6cc Swarm/src/GlobalParticleLayout.c
--- a/Swarm/src/GlobalParticleLayout.c	Mon Dec 03 02:52:45 2007 +0000
+++ b/Swarm/src/GlobalParticleLayout.c	Wed Dec 05 04:45:00 2007 +0000
@@ -248,6 +248,7 @@ void _GlobalParticleLayout_InitialisePar
 	Particle_Index		newParticle_I=0;
 	Cell_Index		cell_I;
 	Particle_Index          globalParticlesInitialisedCount=0;
+	Progress*		prog;
 	Stream*                 errorStream = Journal_Register( Error_Type, self->type );
 
 	Journal_DPrintf( self->debug, "In %s(): for ParticleLayout \"%s\" (of type %s):\n",
@@ -258,6 +259,14 @@ void _GlobalParticleLayout_InitialisePar
 		"generating a particle, and checking if it's in this processor's domain. If so, "
 		"adding it to the appropriate local cell.\n", self->totalInitialParticles );
 	Stream_IndentBranch( Swarm_Debug );
+
+	/* Use a progress meter. */
+	prog = Progress_New();
+	Progress_SetStream( prog, self->debug );
+	Progress_SetTitle( prog, "Generating global particles" );
+	Progress_SetPrefix( prog, "\t" );
+	Progress_SetRange( prog, 0, self->totalInitialParticles );
+	Progress_Update( prog );
 
 	while( newParticle_I < self->totalInitialParticles ) {
 		
@@ -291,7 +300,12 @@ void _GlobalParticleLayout_InitialisePar
 		}		
 				
 		newParticle_I++;
-	}
+
+		Progress_Increment( prog );
+	}
+
+	/* Delete progress meter. */
+	Stg_Class_Delete( prog );
 
 	Stream_UnIndentBranch( Swarm_Debug );
 
diff -r 70e7515704d2 -r 1ddec1d7b6cc Swarm/src/SwarmClass.c
--- a/Swarm/src/SwarmClass.c	Mon Dec 03 02:52:45 2007 +0000
+++ b/Swarm/src/SwarmClass.c	Wed Dec 05 04:45:00 2007 +0000
@@ -932,6 +932,7 @@ void Swarm_UpdateAllParticleOwners( void
 void Swarm_UpdateAllParticleOwners( void* swarm ) {
 	Swarm*			self = (Swarm*)swarm;
 	Particle_Index		lParticle_I;
+	Progress*		prog;
 
 	/* TODO: need to reconsideer - gauss particle layout should be allowed, but not swarms that have no local
 	 * co-ordinates */
@@ -939,12 +940,21 @@ void Swarm_UpdateAllParticleOwners( void
 		/* Assumption: Local coord layouts don't go through advection so no need to update */
 		return;
 	}
+
+	prog = Progress_New();
+	Progress_SetTitle( prog, "Updating particle owners" );
+	Progress_SetPrefix( prog, "\t" );
+	Progress_SetRange( prog, 0, self->particleLocalCount );
+	Progress_Update( prog );
 	
 	Journal_DPrintfL( self->debug, 1, "In %s() for Swarm \"%s\"\n", __func__, self->name );
 	Stream_IndentBranch( Swarm_Debug );	
 	for ( lParticle_I=0; lParticle_I < self->particleLocalCount; lParticle_I++ ) {
 		Swarm_UpdateParticleOwner( self, lParticle_I );
-	}
+		Progress_Increment( prog );
+	}
+
+	Stg_Class_Delete( prog );
 
 	/* UpdateAllParticleOwners is called during initialisation,to set up initial
 	 * ownership relationships, and if that's the case we don't want to invoke



More information about the CIG-COMMITS mailing list