[cig-commits] commit: merging changes from 1.4.x
Mercurial
hg at geodynamics.org
Mon Feb 1 15:33:34 PST 2010
changeset: 762:89f60a2c093c
branch: pcu_rejig
parent: 759:f04e3cbd0deb
parent: 761:ee50858f535d
user: JulianGiordani
date: Mon Jan 11 14:33:16 2010 +1100
description:
merging changes from 1.4.x
diff -r f04e3cbd0deb -r 89f60a2c093c Base/Context/tests/VariableSuite.c
--- a/Base/Context/tests/VariableSuite.c Fri Jan 08 16:00:57 2010 +1100
+++ b/Base/Context/tests/VariableSuite.c Mon Jan 11 14:33:16 2010 +1100
@@ -112,6 +112,8 @@ void VariableSuite_Teardown( VariableSui
void VariableSuite_TestGetValueDouble( VariableSuiteData* data ) {
Index ii;
+ double tmp;
+ Variable* var = Variable_Register_GetByName( data->vr, "temperature" );
/* Test the Get and Set of a scalar double....................................................................... */
/* Fill the temperature array with a known pattern of kinda random (bit filling) numbers. */
@@ -121,29 +123,29 @@ void VariableSuite_TestGetValueDouble( V
/* Check that Variable_GetValueDouble on the temperature Variable returns the right numbers */
for( ii = 0; ii < data->aSize[0]; ii++ ) {
- Variable* var = Variable_Register_GetByName( data->vr, "temperature" );
- const double tmp = 1.0f / (data->aSize[0]+2) * (ii+1);
-
- pcu_check_true( Variable_GetValueDouble( var, ii ) == tmp );
+ tmp = 1.0f / (data->aSize[0]+2) * (ii+1);
+
+ pcu_check_true( fabs(Variable_GetValueDouble( var, ii ) - tmp ) < 1e-12);
}
}
void VariableSuite_TestSetValueDouble( VariableSuiteData* data ) {
Index ii;
+ double tmp;
+ Variable* var = Variable_Register_GetByName( data->vr, "temperature" );
/* Fill the temperature Variable with another known pattern of kinda random (bit filling) numbers */
for( ii = 0; ii < data->aSize[0]; ii++ ) {
- Variable* var = Variable_Register_GetByName( data->vr, "temperature" );
Variable_SetValueDouble( var, ii, 1.0f - ( 1.0f / (data->aSize[0]+2) * (ii+1) ) );
}
/* Check that Variable_SetValueDouble on the temperature Variable set the right numbers */
for( ii = 0; ii < data->aSize[0]; ii++ ) {
- const double tmp = 1.0f - 1.0f / (data->aSize[0]+2) * (ii+1);
+ tmp = 1.0f - 1.0f / (data->aSize[0]+2) * (ii+1);
- pcu_check_true( data->temperature[ii] == tmp );
+ pcu_check_true( fabs(data->temperature[ii] - tmp ) < 1e-12);
}
}
@@ -151,6 +153,8 @@ void VariableSuite_TestSetValueDouble( V
/* Test the Get and Set of a vector double....................................................................... */
void VariableSuite_TestGetValueAtDouble( VariableSuiteData* data ) {
Index ii;
+ double tmp;
+ Variable* var = Variable_Register_GetByName( data->vr, "velocity" );
/* Fill the velocity array with a known pattern of kinda random (bit filling) numbers. */
for( ii = 0; ii < data->aSize[1]; ii++ ) {
@@ -163,13 +167,12 @@ void VariableSuite_TestGetValueAtDouble(
/* Check that Variable_GetPtrDouble on the velocity Variable returns the right numbers */
for( ii = 0; ii < data->aSize[1]; ii++ ) {
- Variable* var = Variable_Register_GetByName( data->vr, "velocity" );
int d;
for( d = 0; d < 3; d++ ) {
- const double tmp = 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1);
+ tmp = 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1);
- pcu_check_true( Variable_GetValueAtDouble( var, ii, d ) == tmp );
+ pcu_check_true( fabs(Variable_GetValueAtDouble(var, ii, d ) - tmp) < 1e-12);
}
}
}
@@ -177,25 +180,25 @@ void VariableSuite_TestGetValueAtDouble(
void VariableSuite_TestSetValueAtDouble( VariableSuiteData* data ) {
Index ii;
+ double tmp;
+ int d;
+ Variable* var = Variable_Register_GetByName( data->vr, "velocity" );
/* Fill the variable Variable with another known pattern of kinda random (bit filling) numbers */
for( ii = 0; ii < data->aSize[1]; ii++ ) {
- Variable* var = Variable_Register_GetByName( data->vr, "velocity" );
- int d;
for( d = 0; d < 3; d++ ) {
- Variable_SetValueAtDouble( var, ii, d, 1.0f - ( 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1) ) );
+ Variable_SetValueAtDouble( var, ii, d, 1.0 - ( 1.0 / ((data->aSize[1]*3)+2) * (ii*3+d+1) ) );
}
}
- /* Check that Variable_SetValueDouble on the temperature Variable set the right numbers */
+ /* Check that Variable_SetValueDouble on the velocity Variable set the right numbers */
for( ii = 0; ii < data->aSize[1]; ii++ ) {
- int d;
for( d = 0; d < 3; d++ ) {
- const double tmp = 1.0f - ( 1.0f / ((data->aSize[1]*3)+2) * (ii*3+d+1) );
+ tmp = 1.0 - ( 1.0 / ((data->aSize[1]*3)+2) * (ii*3+d+1) );
- pcu_check_true( data->velocity[ii][d] == tmp );
+ pcu_check_true( data->velocity[ii][d]-tmp < 1e-12 );
}
}
}
diff -r f04e3cbd0deb -r 89f60a2c093c Base/IO/src/XML_IO_Handler.c
--- a/Base/IO/src/XML_IO_Handler.c Fri Jan 08 16:00:57 2010 +1100
+++ b/Base/IO/src/XML_IO_Handler.c Mon Jan 11 14:33:16 2010 +1100
@@ -691,40 +691,42 @@ Bool _XML_IO_Handler_ReadAllFromBuffer(
* \return a pointer to the root node if the file is valid, NULL otherwise. */
static xmlNodePtr _XML_IO_Handler_OpenCheckFile( XML_IO_Handler* self, const char* filename )
{
- xmlChar absolute[1024];
- xmlNodePtr cur = NULL;
- Bool status = False;
+ xmlChar absolute[1024];
+ xmlNodePtr cur = NULL;
+ Bool status = False;
- if ( FindFileInPathList(
- (char*)absolute,
- (char*)filename,
- self->searchPaths,
- self->searchPathsSize ) )
- {
- _XML_IO_Handler_OpenFile( self, (char*)absolute );
- }
+ if ( FindFileInPathList(
+ (char*)absolute,
+ (char*)filename,
+ self->searchPaths,
+ self->searchPathsSize ) )
+ {
+ _XML_IO_Handler_OpenFile( self, (char*)absolute );
+ }
- Journal_Firewall( self->currDoc != NULL,
- Journal_Register( Error_Type, XML_IO_Handler_Type ),
- "Error: File %s doesn't exist, not readable, or not valid.\n",
- filename );
-
- if( self->currDoc != NULL ) {
- cur = xmlDocGetRootElement( self->currDoc );
- status = _XML_IO_Handler_Check( self, self->currDoc );
+ if( self->currDoc == NULL ) {
+ Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
+ "Error: File %s doesn't exist, not readable, or not valid.\n", filename );
+ exit(EXIT_FAILURE);
+ }
- Journal_Firewall( status,
- Journal_Register( Error_Type, XML_IO_Handler_Type ),
- "Error: File %s not valid/readable.\n",
- filename );
+ if( self->currDoc != NULL ) {
+ cur = xmlDocGetRootElement( self->currDoc );
+ status = _XML_IO_Handler_Check( self, self->currDoc );
- if( status == True )
- return cur;
- else
- return NULL;
- }
- else
- return NULL;
+ if( !status ) {
+ Journal_RPrintf( Journal_Register( Error_Type, XML_IO_Handler_Type ),
+ "Error: File %s not valid/readable.\n", filename );
+ exit(EXIT_FAILURE);
+ }
+
+ if( status == True )
+ return cur;
+ else
+ return NULL;
+ }
+ else
+ return NULL;
}
static xmlNodePtr _XML_IO_Handler_OpenCheckBuffer( XML_IO_Handler* self, const char* buffer ) {
More information about the CIG-COMMITS
mailing list