[cig-commits] commit: Fix compile warnings

Mercurial hg at geodynamics.org
Thu Mar 15 12:51:56 PDT 2012


changeset:   826:773cc6558f7f
user:        Walter Landry <wlandry at caltech.edu>
date:        Thu Mar 15 12:50:40 2012 -0700
files:       Discretisation/src/FeVariable.cxx Discretisation/src/FieldTest.cxx Discretisation/src/OperatorFeVariable.cxx Discretisation/src/ShapeFeVariable.cxx SLE/SystemSetup/src/Assembler.cxx SLE/SystemSetup/src/FiniteElementContext.cxx
description:
Fix compile warnings


diff -r 22b3e3497e17 -r 773cc6558f7f Discretisation/src/FeVariable.cxx
--- a/Discretisation/src/FeVariable.cxx	Thu Jan 12 09:33:31 2012 -0800
+++ b/Discretisation/src/FeVariable.cxx	Thu Mar 15 12:50:40 2012 -0700
@@ -1949,9 +1949,9 @@ void FeVariable_SaveToFile( void* feVari
    Stream*           errorStr = Journal_Register( Error_Type, (Name)self->type  );
    const int         FINISHED_WRITING_TAG = 100;
    int               confirmation = 0;
-   MeshGenerator*    theGenerator;
    
 #ifdef WRITE_HDF5
+   MeshGenerator*    theGenerator;
    hid_t             file, fileSpace, fileData;
    hid_t             memSpace;
    hsize_t           start[2], count[2], size[2];
@@ -2198,9 +2198,9 @@ void FeVariable_ReadFromFile( void* feVa
 	unsigned		       nRanks;
 	Bool               savedCoords = False;
 	Stream*            errorStr = Journal_Register( Error_Type, (Name)self->type  );
-   MeshGenerator*    theGenerator;
 	
 #ifdef READ_HDF5
+   MeshGenerator*    theGenerator;
    hid_t                   file, fileSpace, fileData, error;
    unsigned                totalNodes, ii, noffset;
    hid_t                   memSpace;
@@ -2211,10 +2211,9 @@ void FeVariable_ReadFromFile( void* feVa
 #else
    unsigned          uTemp;  
    double            temp[3];  
-   int               count = 0;     
    char               lineString[MAX_LINE_LENGTH_DEFINE];
-	const unsigned int MAX_LINE_LENGTH = MAX_LINE_LENGTH_DEFINE;
-   int               offset, n;
+   const unsigned int MAX_LINE_LENGTH = MAX_LINE_LENGTH_DEFINE;
+   unsigned int               offset, n;
 #endif   	
 
 	MPI_Comm_rank( comm, (int*)&rank );
@@ -2426,6 +2425,7 @@ void FeVariable_ReadFromFile( void* feVa
    fgets( lineString, MAX_LINE_LENGTH, inputFile );
    
    sscanf( lineString, "%u%n ", &uTemp, &offset );
+   unsigned int count = 0;     
    while( sscanf( lineString + offset, "%lf%n ", &temp[0], &n ) )
    {
       offset += n;
@@ -2439,9 +2439,9 @@ void FeVariable_ReadFromFile( void* feVa
     
    rewind( inputFile );
       
-	/** Need to re-set the geometry here, in case we're loading from a checkpoint that had compression/squashing BCs,
-		and hence ended up with a smaller mesh than the original */
-	unsigned int nDims = Mesh_GetDimSize( self->feMesh );
+	/** Need to re-set the geometry here, in case we're loading
+            from a checkpoint that had compression/squashing BCs, and
+            hence ended up with a smaller mesh than the original */
 	while ( !feof(inputFile) ) {
 		fscanf( inputFile, "%u ", &gNode_I );
 		
diff -r 22b3e3497e17 -r 773cc6558f7f Discretisation/src/FieldTest.cxx
--- a/Discretisation/src/FieldTest.cxx	Thu Jan 12 09:33:31 2012 -0800
+++ b/Discretisation/src/FieldTest.cxx	Thu Mar 15 12:50:40 2012 -0700
@@ -629,10 +629,10 @@ void FieldTest_BuildErrField( void* fiel
 }
 
 void FieldTest_LoadReferenceSolutionFromFile( FeVariable* feVariable, Name referenceSolnName, Name referenceSolnPath, DomainContext* context ) {
+#ifdef READ_HDF5
 	FeMesh*			feMesh			= feVariable->feMesh;
 	char*			filename;
 	unsigned		nx = 0, ny = 0, nz = 0, total;
-	unsigned		lineNum = 0;
 	double			resolution[3];
 	double*			coord;
 	Index			node_I, dim_I;
@@ -653,14 +653,11 @@ void FieldTest_LoadReferenceSolutionFrom
 	double 			a1, b1, c1;
 	double 			a2, b2, c2;
 	double 			m0, m1, m2, m3, m4, m5, m6;
-#ifdef READ_HDF5
 	hid_t			inputFile;
 	hid_t 			dataSet, memSpace, dataSpace;
 	hsize_t 		start[2], count[2], hSize;
-#endif
 	int 			sizes[3];
 	double* 		data;
-	int 			dataPos = 0;
 
 	Stg_Component_Initialise( feMesh,     context, False );
 	Stg_Component_Initialise( feVariable, context, False );
@@ -669,7 +666,6 @@ void FieldTest_LoadReferenceSolutionFrom
 													  /* .  h5  \0 */
 	filename = Memory_Alloc_Array_Unnamed( char, strlen(referenceSolnPath) + strlen(referenceSolnName) + 1 + 2 + 1 );
 	sprintf( filename, "%s%s.h5", referenceSolnPath, referenceSolnName );
-#ifdef READ_HDF5
 	inputFile = H5Fopen( filename, H5F_ACC_RDONLY, H5P_DEFAULT );
 #if H5_VERS_MAJOR == 1 && H5_VERS_MINOR < 8
 	dataSet = H5Dopen( inputFile, "/size" );
@@ -706,12 +702,12 @@ void FieldTest_LoadReferenceSolutionFrom
 	count[0] = 1;
 	count[1] = nDims + dofAtEachNodeCount;
 	H5Sselect_hyperslab( dataSpace, H5S_SELECT_SET, start, NULL, count, NULL );
-	for( lineNum = 0; lineNum < total; lineNum++ ) {
+	for( unsigned lineNum = 0; lineNum < total; lineNum++ ) {
 		start[0] = lineNum;
 		H5Sselect_hyperslab( dataSpace, H5S_SELECT_SET, start, NULL, count, NULL );
 		H5Dread( dataSet, H5T_NATIVE_DOUBLE, memSpace, dataSpace, H5P_DEFAULT, data );
 
-      dataPos  = 0;
+                int dataPos  = 0;
 		posx[lineNum] = data[dataPos++];
 		posy[lineNum] = data[dataPos++];
 		if( nDims == 3 ) posz[lineNum] = data[dataPos++];
@@ -723,7 +719,6 @@ void FieldTest_LoadReferenceSolutionFrom
 	H5Sclose( memSpace );
 	H5Sclose( dataSpace );
 	H5Dclose( dataSet );
-#endif
 	Memory_Free( data );
 
 	resolution[0] = posx[1]  - posx[0];
@@ -854,7 +849,6 @@ void FieldTest_LoadReferenceSolutionFrom
 	if( nDims == 3 ) Memory_Free( posz );
 	Memory_Free( variables );
 
-#ifdef READ_HDF5
 	H5Fclose( inputFile );
 #endif
 }
diff -r 22b3e3497e17 -r 773cc6558f7f Discretisation/src/OperatorFeVariable.cxx
--- a/Discretisation/src/OperatorFeVariable.cxx	Thu Jan 12 09:33:31 2012 -0800
+++ b/Discretisation/src/OperatorFeVariable.cxx	Thu Mar 15 12:50:40 2012 -0700
@@ -658,11 +658,23 @@ void OperatorFeVariable_BinaryValueAtNod
 	/* field variables are using different meshes, so interpolate the values of each based on the global coord */
 	else {  
 		coord = Mesh_GetVertex( self->feMesh, dNode_I );
-		assert( Mesh_SearchElements( field0->feMesh, coord, &field0Element ) );
+#ifndef NDEBUG
+                Bool found=
+#endif
+		Mesh_SearchElements( field0->feMesh, coord, &field0Element);
+#ifndef NDEBUG
+                assert(found);
+#endif
 		FeMesh_CoordGlobalToLocal( field0->feMesh, field0Element, coord, field0LocalCoord );
 		FeVariable_InterpolateWithinElement( field0, field0Element, field0LocalCoord, fieldValue0 );
 		
-		assert( Mesh_SearchElements( field1->feMesh, coord, &field1Element ) ); 
+#ifndef NDEBUG
+		found=
+#endif
+                Mesh_SearchElements( field1->feMesh, coord, &field1Element);
+#ifndef NDEBUG
+                assert(found);
+#endif
 		FeMesh_CoordGlobalToLocal( field1->feMesh, field1Element, coord, field1LocalCoord );
 		FeVariable_InterpolateWithinElement( field1, field1Element, field1LocalCoord, fieldValue1 );
 	}
diff -r 22b3e3497e17 -r 773cc6558f7f Discretisation/src/ShapeFeVariable.cxx
--- a/Discretisation/src/ShapeFeVariable.cxx	Thu Jan 12 09:33:31 2012 -0800
+++ b/Discretisation/src/ShapeFeVariable.cxx	Thu Mar 15 12:50:40 2012 -0700
@@ -121,11 +121,8 @@ void _ShapeFeVariable_Print( void* _shap
 }
 
 void* _ShapeFeVariable_Copy( const void* shapeFeVariable, void* dest, Bool deep, Name nameExt, PtrMap* ptrMap ) {
-	/* ShapeFeVariable*	self = (ShapeFeVariable*)shapeFeVariable; */
-	ShapeFeVariable* newShapeFeVariable;
-	
-	assert(0);
-	return (void*)newShapeFeVariable;
+	abort();
+	return NULL;
 }
 
 void _ShapeFeVariable_AssignFromXML( void* shapeFeVariable, Stg_ComponentFactory* cf, void* data ) {
diff -r 22b3e3497e17 -r 773cc6558f7f SLE/SystemSetup/src/Assembler.cxx
--- a/SLE/SystemSetup/src/Assembler.cxx	Thu Jan 12 09:33:31 2012 -0800
+++ b/SLE/SystemSetup/src/Assembler.cxx	Thu Mar 15 12:50:40 2012 -0700
@@ -321,7 +321,6 @@ void Assembler_LoopMatrixElement( void* 
 
 void Assembler_LoopMatrixDiagonal( void* assembler ) {
 	Assembler*		self = (Assembler*)assembler;
-	unsigned		nDims;
 	FeVariable		*rowVar;
 	FeMesh			*rowMesh;
 	FeEquationNumber	*rowEqNum;
@@ -339,7 +338,7 @@ void Assembler_LoopMatrixDiagonal( void*
 	rowEqNum = rowVar->eqNum;			assert( rowEqNum );
 	rowMesh = rowVar->feMesh;
 	rowDofs = rowVar->dofLayout;			assert( rowDofs );
-	nDims = Mesh_GetDimSize( rowMesh );		assert( nDims );
+	assert(Mesh_GetDimSize( rowMesh ));
 	nRowNodes = FeMesh_GetNodeLocalSize( rowMesh );
 	assert( rowEqNum->destinationArray );
 	assert( rowDofs->dofCounts );
diff -r 22b3e3497e17 -r 773cc6558f7f SLE/SystemSetup/src/FiniteElementContext.cxx
--- a/SLE/SystemSetup/src/FiniteElementContext.cxx	Thu Jan 12 09:33:31 2012 -0800
+++ b/SLE/SystemSetup/src/FiniteElementContext.cxx	Thu Mar 15 12:50:40 2012 -0700
@@ -487,8 +487,6 @@ void _FiniteElementContext_SaveMesh( voi
 #ifndef WRITE_HDF5
 void _FiniteElementContext_DumpMeshAscii( void* context, FeMesh* feMesh ) {
    FiniteElementContext*   self = (FiniteElementContext*) context;
-   FieldVariable*    fieldVar = NULL;
-	FeVariable*       feVar = NULL;
 	Mesh* 			   mesh;
 	int 			      rank, nRanks;  
 	FILE*			      outputFile;



More information about the CIG-COMMITS mailing list