[cig-commits] r5528 - in long/3D/Gale/trunk/src/StGermain: .
Discretisation/Utils/src
walter at geodynamics.org
walter at geodynamics.org
Thu Dec 7 14:16:40 PST 2006
Author: walter
Date: 2006-12-07 14:16:38 -0800 (Thu, 07 Dec 2006)
New Revision: 5528
Modified:
long/3D/Gale/trunk/src/StGermain/
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/DiscretisationContext.c
long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FieldVariable.c
Log:
r3196 at earth: boo | 2006-12-07 14:10:39 -0800
r3192 at earth (orig r3899): JulianGiordani | 2006-11-28 22:42:28 -0800
Fixed some half-baked logic in FieldVariable.c and DiscretisationContext.c that was causing problems restarting from checkpoint when only certain FieldVariables had been specified to checkpoint.
List of FieldVariables to checkpoint is still centrally controlled through the dictionary list "fieldVariablesToCheckpoint".
Thorough testing still required - will follow soon.
-- Pat, Jules & Kathleen.
Property changes on: long/3D/Gale/trunk/src/StGermain
___________________________________________________________________
Name: svk:merge
- 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3195
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3898
+ 1ef209d2-b310-0410-a72d-e20c9eb0015c:/cig:3196
afb6c753-b9d0-0310-b4e7-dbd8d91cdd35:/trunk/StGermain:3899
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/DiscretisationContext.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/DiscretisationContext.c 2006-12-07 22:16:35 UTC (rev 5527)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/DiscretisationContext.c 2006-12-07 22:16:38 UTC (rev 5528)
@@ -133,54 +133,12 @@
void _DiscretisationContext_Init( DiscretisationContext* self ) {
- Dictionary_Entry_Value* feVarsList = NULL;
- FieldVariable* fieldVar = NULL;
-
self->isConstructed = True;
self->fieldVariable_Register = FieldVariable_Register_New();
- self->dim = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "dim", 2 );
- /* Case insensitive search */
- feVarsList = Dictionary_Get( self->dictionary, "fieldVariablesToCheckpoint" );
- if ( NULL == feVarsList ) {
- feVarsList = Dictionary_Get( self->dictionary, "FieldVariablesToCheckpoint" );
- }
-
- if (feVarsList != NULL ) {
- /* Dump the requested subset of feVars */
- Index listLength = Dictionary_Entry_Value_GetCount( feVarsList );
- Index var_I = 0;
- Dictionary_Entry_Value* feVarDictValue = NULL;
-
- /* Initially set all in register to False since they were created
- as true by default */
- for ( var_I = 0; var_I < self->fieldVariable_Register->objects->count; var_I++ ) {
- fieldVar = FieldVariable_Register_GetByIndex( self->fieldVariable_Register, var_I );
- fieldVar->isCheckpointedAndReloaded = False;
- }
-
-
- for ( var_I = 0; var_I < listLength; var_I++ ) {
- feVarDictValue = Dictionary_Entry_Value_GetElement( feVarsList, var_I );
- fieldVar = FieldVariable_Register_GetByName( self->fieldVariable_Register,
- Dictionary_Entry_Value_AsString( feVarDictValue ) );
-
- if ( NULL == fieldVar ) {
- Stream* errorStr = Journal_Register( Error_Type, self->type );
- Journal_Printf( errorStr, "WARNING - in %s: can't find requested feVariable "
- " \"%s\" in fieldVariable_Register. Skipping.\n",
-
- __func__, Dictionary_Entry_Value_AsString( feVarDictValue ) );
- continue;
- }
- else {
- fieldVar->isCheckpointedAndReloaded = True;
- }
- }
- }
-
Stg_ObjectList_ClassAppend( self->register_Register, (void*)self->fieldVariable_Register, "FieldVariable_Register" );
+ self->dim = Dictionary_GetUnsignedInt_WithDefault( self->dictionary, "dim", 2 );
}
Modified: long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FieldVariable.c
===================================================================
--- long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FieldVariable.c 2006-12-07 22:16:35 UTC (rev 5527)
+++ long/3D/Gale/trunk/src/StGermain/Discretisation/Utils/src/FieldVariable.c 2006-12-07 22:16:38 UTC (rev 5528)
@@ -265,6 +265,7 @@
Dimension_Index dim;
Index fieldComponentCount;
Bool isCheckpointedAndReloaded;
+ Dictionary_Entry_Value* feVarsList = NULL;
fV_Register = (FieldVariable_Register*) Stg_ObjectList_Get( cf->registerRegister, "FieldVariable_Register" );
assert( fV_Register );
@@ -272,12 +273,43 @@
dim = Stg_ComponentFactory_GetRootDictUnsignedInt( cf, "dim", 0 );
fieldComponentCount = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, "fieldComponentCount", 0 );
- /* DiscretisationContext will be setting isCheckpointedAndReloaded later
- depending on the contents of the list "FieldVariablesToCheckpoint".
- May want to change this later so it is set individually in each
- FeVariable's component xml entry.
- --PatrickSunter & KathleenHumble, 27/09/06 */
- isCheckpointedAndReloaded = True;
+
+ /* Decide whether this FieldVariable will be checkpointed & reloaded, based on the dictionary list
+ "fieldVariableToCheckpoint". NB may want to put this in the XML component definintion of a
+ FieldVariable itself, but for now prefer list so it can be centrally set.
+ -- Pat, Jules, Kath - 29 November 2006
+ */
+
+ /* Case insensitive search */
+ feVarsList = Dictionary_Get( cf->rootDict, "fieldVariablesToCheckpoint" );
+ if ( NULL == feVarsList ) {
+ feVarsList = Dictionary_Get( cf->rootDict, "FieldVariablesToCheckpoint" );
+ }
+
+ if (feVarsList != NULL ) {
+ Index listLength = Dictionary_Entry_Value_GetCount( feVarsList );
+ Index var_I = 0;
+ Dictionary_Entry_Value* feVarDictValue = NULL;
+ char* fieldVariableName;
+
+ isCheckpointedAndReloaded = False;
+ for ( var_I = 0; var_I < listLength; var_I++ ) {
+ feVarDictValue = Dictionary_Entry_Value_GetElement( feVarsList, var_I );
+ fieldVariableName = Dictionary_Entry_Value_AsString( feVarDictValue );
+ if ( 0 == strcmp( self->name, fieldVariableName ) ) {
+ isCheckpointedAndReloaded = True;
+ break;
+ }
+ else {
+ continue;
+ }
+ }
+ }
+ else {
+ /* If there's no special list, just checkpoint/reload everything. */
+ isCheckpointedAndReloaded = True;
+ }
+
_FieldVariable_Init( self, fieldComponentCount, dim, isCheckpointedAndReloaded,
MPI_COMM_WORLD, fV_Register );
More information about the cig-commits
mailing list