[cig-commits] commit: Fix a number of compiler warnings

Mercurial hg at geodynamics.org
Fri Oct 7 23:43:20 PDT 2011


changeset:   883:64ca21dfcaed
user:        Walter Landry <wlandry at caltech.edu>
date:        Fri Oct 07 23:40:49 2011 -0700
files:       plugins/DensityChangeAtDepth/DensityChangeAtDepth.cxx plugins/MeshAdvectionCorrection/MeshAdvectionCorrection.cxx plugins/Output/VTKOutput/VTKOutput.cxx
description:
Fix a number of compiler warnings


diff -r a7f5dabc0334 -r 64ca21dfcaed plugins/DensityChangeAtDepth/DensityChangeAtDepth.cxx
--- a/plugins/DensityChangeAtDepth/DensityChangeAtDepth.cxx	Fri Oct 07 23:40:11 2011 -0700
+++ b/plugins/DensityChangeAtDepth/DensityChangeAtDepth.cxx	Fri Oct 07 23:40:49 2011 -0700
@@ -65,7 +65,6 @@ void Underworld_DensityChange_Check( Und
 void Underworld_DensityChange_Check( UnderworldContext* context ) {
 	/* Function runs each timestep to check if centroid is at certain height */
 
-	double volume;
 	double centroid[3];
 	static int densityChangeIsDone = 0;
 
@@ -77,7 +76,7 @@ void Underworld_DensityChange_Check( Und
 	Underworld_DensityChange* self = (Underworld_DensityChange*)LiveComponentRegister_Get( context->CF->LCRegister, (Name)Underworld_DensityChange_Type  );
 
 	/* get centroid coordinate */
-	volume = Material_Volume( self->material, (IntegrationPointsSwarm*)self->swarm, centroid );
+	Material_Volume( self->material, (IntegrationPointsSwarm*)self->swarm, centroid );
 
 	/* test if centroid height (y-coord) is >= input height
 	 * 	Note following code is only run once */
@@ -96,7 +95,6 @@ void Underworld_DensityChange_Setup( Und
 	BuoyancyForceTerm_MaterialExt* materialExt = NULL;;
 	Stream* stream = Journal_Register( Info_Type, (Name)"cows" );
 	Name   materialName = NULL;
-	int materialIndex;
 
 	/* Get self (the plugin) */
 	Underworld_DensityChange* self = (Underworld_DensityChange* )LiveComponentRegister_Get( context->CF->LCRegister, (Name)Underworld_DensityChange_Type  ); 
@@ -120,7 +118,7 @@ void Underworld_DensityChange_Setup( Und
 
 	/* check if material index exists */
 	if( self->material==NULL ) {
-		printf("Error\nCounld find the material with index %d\n", materialIndex ); exit(0);
+		printf("Error\nCounld find the material with name %s\n", materialName ); exit(0);
 	}
 	materialExt = (BuoyancyForceTerm_MaterialExt*)ExtensionManager_Get( self->material->extensionMgr, self->material, bft->materialExtHandle );
 	Journal_RPrintf( stream, "Will change %s's density at height %g from %g to %g\n", 
diff -r a7f5dabc0334 -r 64ca21dfcaed plugins/MeshAdvectionCorrection/MeshAdvectionCorrection.cxx
--- a/plugins/MeshAdvectionCorrection/MeshAdvectionCorrection.cxx	Fri Oct 07 23:40:11 2011 -0700
+++ b/plugins/MeshAdvectionCorrection/MeshAdvectionCorrection.cxx	Fri Oct 07 23:40:49 2011 -0700
@@ -124,7 +124,7 @@ void MeshAdvectionCorrection_EulerDeform
 	FeMesh*      mesh = artDField->feMesh;
 	Dof_Index    dof  = artDField->fieldComponentCount;
 	double       artV[3], artD[3];
-	int numLocalNodes = FeMesh_GetNodeLocalSize( mesh );
+	uint numLocalNodes = FeMesh_GetNodeLocalSize( mesh );
 	Dof_Index    dof_I, lNode_I;
 
 		/* INITIAL CONDITION: artV = 0 */
diff -r a7f5dabc0334 -r 64ca21dfcaed plugins/Output/VTKOutput/VTKOutput.cxx
--- a/plugins/Output/VTKOutput/VTKOutput.cxx	Fri Oct 07 23:40:11 2011 -0700
+++ b/plugins/Output/VTKOutput/VTKOutput.cxx	Fri Oct 07 23:40:49 2011 -0700
@@ -149,7 +149,7 @@ void VTKOutput_particles(Swarm* swarm,
                          int stepping, char *outputPath,
                          const int timeStep, int dim, int myRank, int nprocs) {
   double *coord;
-  int iteration, i;
+  int iteration;
   Particle_Index          num_particles = swarm->particleLocalCount;
   Particle_Index          lParticle_I;
   
@@ -222,8 +222,6 @@ void VTKOutput_particles(Swarm* swarm,
         int currently_yielding;
         Material_Index material_index;
         SymmetricTensor stress;
-        BuoyancyForceTerm_MaterialExt*   materialExt;
-        Material *extension_info;
         XYZ normal;
         
         if(Stg_Class_IsInstance(swarm,IntegrationPointsSwarm_Type))
@@ -445,7 +443,7 @@ void VTKOutput_particles(Swarm* swarm,
           fprintf(fp,"      </CellData>\n");
           fprintf(fp,"      <Cells>\n");
           fprintf(fp,"        <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n");
-          for(i=0;i<(num_particles-1)/stepping+1;++i)
+          for(uint i=0;i<(num_particles-1)/stepping+1;++i)
             fprintf(fp,"%d ",i);
           fprintf(fp,"\n        </DataArray>\n");
           fprintf(fp,"        <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n");
@@ -464,7 +462,7 @@ void VTKOutput_particles(Swarm* swarm,
   if(myRank==0)
     {
       fprintf(pfp,"        </PPointData>\n");
-      for(i=0;i<nprocs;++i)
+      for(int i=0;i<nprocs;++i)
         fprintf(pfp,"    <Piece Source=\"%s.%d.%05d.vtu\"/>\n",
                 swarm->name,i,timeStep);
       fprintf(pfp,"  </PUnstructuredGrid>\n\
@@ -476,7 +474,7 @@ void VTKOutput_particles(Swarm* swarm,
 /* Print out the coordinates of the mesh. */
 
 void VTKOutput_print_coords(FILE *fp, FeMesh *feMesh, Grid *grid, int nDims,
-                            int lower[3], int upper[3]) {
+                            uint lower[3], uint upper[3]) {
   IJK ijk;
 
   fprintf(fp,"      <Points>\n");
@@ -507,7 +505,7 @@ void VTKOutput_fields(void *context, int
   Index var_I;
   int header_printed=0;
   int nDims, i;
-  int lower[3], upper[3];
+  uint lower[3], upper[3];
 
   HydrostaticTerm *hydrostaticTerm;
   char* field_filename;
@@ -518,7 +516,7 @@ void VTKOutput_fields(void *context, int
 
   /* We need to save the grids to map between 1D and 3D indices for
      the values. */
-  Grid *elGrid, *vertGrid;
+  Grid *vertGrid;
 
   hydrostaticTerm =
     (HydrostaticTerm*)LiveComponentRegister_Get(self->CF->LCRegister,
@@ -591,8 +589,6 @@ void VTKOutput_fields(void *context, int
         && ((FeVariable*)fieldVar)->feMesh->feElFamily!=std::string("linear-inner")) {
       FeVariable* feVar;
       Dof_Index          dofAtEachNodeCount;
-      int *low, *up;
-      Grid *grid;
       IJK ijk;
 
       feVar=(FeVariable*)fieldVar;
@@ -609,7 +605,6 @@ void VTKOutput_fields(void *context, int
           if(!strcmp(gen->type,"SurfaceAdaptor"))
             gen=(CartesianGenerator *)((SurfaceAdaptor *)(gen))->generator;
 
-          elGrid=gen->elGrid;
           vertGrid=gen->vertGrid;
           nDims=gen->nDims;
 
@@ -749,9 +744,8 @@ void VTKOutput_fields(void *context, int
                     {
                       double p;
                       /* First add the trace of the stress */
-                      int stress_I;
 
-                      for(stress_I = 0;
+                      for(uint stress_I = 0;
                           stress_I<self->fieldVariable_Register->objects->count;
                           stress_I++ ) {
                         FieldVariable* stressVar;



More information about the CIG-COMMITS mailing list