From 294746db1a2b5e6d25dfa243d7ad5cef49800d59 Mon Sep 17 00:00:00 2001 From: rideout Date: Wed, 4 Jun 2003 14:57:40 +0000 Subject: Check to see that the value of the GH never changes. Thorn Boundary will need some (I think not terribly difficult) modification to work properly with multi-models. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@237 6a38eb6e-646e-4a02-a296-d141613ad6c4 --- src/Boundary.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/Boundary.c b/src/Boundary.c index 5573be0..3c73a03 100644 --- a/src/Boundary.c +++ b/src/Boundary.c @@ -137,6 +137,9 @@ static struct BCDATA *bcdata_list = NULL; static CCTK_INT *selected_faces; static int num_cctk_vars; +/* 'The' GH, i.e. to check that there is not more than one... */ +static CCTK_POINTER theGH; + /******************************************************************** ********************* Aliased Routines ********************** ********************************************************************/ @@ -181,8 +184,21 @@ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, { int retval; - /* Ignore GH for now */ - GH = GH; +#ifdef DEBUG + printf("Boundary_RegisterPhysicalBC: called with GH=%p\n", GH); +#endif + + /* Check to see if this is a new GH */ + if (!theGH) /* This is the first valid GH passed to a Boundary routine */ + { + theGH = GH; + } else if (GH != theGH) + { + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "New GH passed to Boundary_RegisterPhysicalBC. " + "Thorn CactusBase/Boundary does not yet handle multiple GHs " + "properly."); + } /* Check if NULL has been passed for fn_pointer */ if (!fn_pointer) @@ -279,7 +295,7 @@ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, @returntype CCTK_INT @returndesc 0 success - -3 invalid variable name + -11 invalid variable name or the returncode of @seeroutine Bdry_Boundary_SelectVarForBCI @endreturndesc @@*/ @@ -305,7 +321,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH, { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, "Invalid variable name"); - retval = -3; + retval = -11; } else { retval = Bdry_Boundary_SelectVarForBCI(GH, faces, width, table_handle, @@ -362,6 +378,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH, 0 success -2 no such physical boundary condition registered -3 faces already selected for bc + -5 new value for GH passed in @endreturndesc @@*/ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, @@ -386,13 +403,24 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, #ifdef DEBUG printf("Boundary_SelectVarForBCI:\n"); - printf(" called with faces=%d, width=%d, table_handle=%d, var_index=%d, " - "bc_name=%s\n", faces, width, table_handle, var_index, bc_name); + printf(" called with GH=%p, faces=%d, width=%d, table_handle=%d, " + "var_index=%d, bc_name=%s\n", GH, faces, width, table_handle, + var_index, bc_name); printf(" vi %d corresponds to %s\n", var_index, CCTK_VarName(var_index)); #endif - /* Ignore GH */ - GH = GH; + /* Check to see if this is a new GH */ + if (!theGH) /* This is the first valid GH passed to a Boundary routine */ + { + theGH = GH; + } else if (GH != theGH) + { + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "New GH passed to Boundary_SelectVarForBCI. " + "Thorn CactusBase/Boundary does not yet handle multiple GHs " + "properly."); + retval = -5; + } /* Check that this request is allowed ---------------------------------- */ @@ -431,7 +459,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Unable to allocate memory for entry into " "'selected for bcs' database"); - retval = -1; + /*retval = -1;*/ } /* populate new entry with data */ @@ -478,7 +506,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, if (!new_bcdata) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "Unable to allocate memory for internal 'bcdata' list"); - retval = -4; + /*retval = -4;*/ } /* new_bcdata->next is set below, when inserting into bcdata_list */ new_bcdata->var_list = NULL; @@ -833,6 +861,7 @@ CCTK_INT Bdry_Boundary_SelectGroupForBCI(CCTK_POINTER GH, @returntype CCTK_INT @returndesc -1 no boundary condition registered under bc_name + -5 new value passed for GH number of variables selected for bc_name @endreturndesc @@*/ @@ -851,8 +880,18 @@ CCTK_INT Bdry_Boundary_SelectedGVs(CCTK_POINTER GH, current = NULL; retval = 0; - /* Ignore GH */ - GH = GH; + /* Check to see if this is a new GH */ + if (!theGH) /* This is the first valid GH passed to a Boundary routine */ + { + theGH = GH; + } else if (GH != theGH) + { + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "New GH passed to Boundary_SelectedGVs. " + "Thorn CactusBase/Boundary does not yet handle multiple GHs " + "properly."); + retval = -5; + } #ifdef DEBUG printf("Boundary_SelectedGVs: called with bc_name=\"%s\" array_size=%d\n", @@ -959,6 +998,9 @@ void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) widths = NULL; /* avoids a compiler warning */ tables = NULL; /* avoids a compiler warning */ + /* Warning: This function does not consider which GH it is called on, which + will be a bug in Cactus 4.1. */ + /* Step through each requested physical boundary condition */ for (current_bcdata = bcdata_list; current_bcdata; @@ -1054,6 +1096,9 @@ void Boundary_ClearSelection(void) struct BCVAR *current, *next; struct BCDATA *current_bcdata; + /* Warning: This function does not consider which GH it is called on, which + will be a bug in Cactus 4.1. */ + /* Step through bcdata list */ #ifdef DEBUG printf("Boundary_ClearSelection: looping through bcdata list for freeing\n"); -- cgit v1.2.3