From 7ebb090a5bc6c7d4205733018dd3c93a115fd58f Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 7 Jul 2003 14:54:03 +0000 Subject: Fixed loads of int/CCTK_INT variable type mismatches. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@239 6a38eb6e-646e-4a02-a296-d141613ad6c4 --- src/Boundary.c | 675 ++++++++++++++++++++++++------------------------ src/Boundary.h | 1 + src/CopyBoundary.c | 164 ++++++------ src/FlatBoundary.c | 118 ++++----- src/NoneBoundary.c | 30 +-- src/RadiationBoundary.c | 185 ++++++------- src/RobinBoundary.c | 119 ++++----- src/ScalarBoundary.c | 116 ++++----- src/StaticBoundary.c | 134 +++++----- 9 files changed, 773 insertions(+), 769 deletions(-) (limited to 'src') diff --git a/src/Boundary.c b/src/Boundary.c index 3006faf..8598cb8 100644 --- a/src/Boundary.c +++ b/src/Boundary.c @@ -2,9 +2,9 @@ @file Boundary.c @date Sat Oct 26 22:39:40 CEST 2002 @author David Rideout - @desc + @desc Implements the new boundary specification. - @enddesc + @enddesc @version $Header$ @@*/ @@ -27,7 +27,7 @@ CCTK_FILEVERSION(CactusBase_Boundary_Boundary_c); ********************************************************************/ /* #define DEBUG 1 */ -/* Linked list, called a var list, for holding variables selected for a bc: +/* Linked list, called a var list, for holding variables selected for a bc: * Entries are sorted in the order they appear in struct BCVAR, * i.e. the var index varies more rapidly that table handle. * (Currently no sorting is done on faces specification.) @@ -77,39 +77,39 @@ static void print_selected_faces(void); ***************** Aliased Routine Prototypes *********************** ********************************************************************/ -CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, - CCTK_FPOINTER fn_pointer, - CCTK_STRING bc_name); +CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, + CCTK_FPOINTER fn_pointer, + CCTK_STRING bc_name); CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT boundary_width, - CCTK_INT table_handle, - CCTK_STRING var_name, - CCTK_STRING bc_name); -CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT boundary_width, - CCTK_INT table_handle, - CCTK_INT var_index, - CCTK_STRING bc_name); + CCTK_INT faces, + CCTK_INT boundary_width, + CCTK_INT table_handle, + CCTK_STRING var_name, + CCTK_STRING bc_name); +CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, + CCTK_INT faces, + CCTK_INT boundary_width, + CCTK_INT table_handle, + CCTK_INT var_index, + CCTK_STRING bc_name); CCTK_INT Bdry_Boundary_SelectGroupForBC(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT boundary_width, - CCTK_INT table_handle, - CCTK_STRING group_name, - CCTK_STRING bc_name); -CCTK_INT Bdry_Boundary_SelectGroupForBCI(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT boundary_width, - CCTK_INT table_handle, - CCTK_INT group_index, - CCTK_STRING bc_name); + CCTK_INT faces, + CCTK_INT boundary_width, + CCTK_INT table_handle, + CCTK_STRING group_name, + CCTK_STRING bc_name); +CCTK_INT Bdry_Boundary_SelectGroupForBCI(CCTK_POINTER GH, + CCTK_INT faces, + CCTK_INT boundary_width, + CCTK_INT table_handle, + CCTK_INT group_index, + CCTK_STRING bc_name); CCTK_INT Bdry_Boundary_SelectedGVs(CCTK_POINTER GH, CCTK_INT array_size, - CCTK_POINTER var_indices, - CCTK_POINTER faces, - CCTK_POINTER boundary_widths, - CCTK_POINTER table_handles, - CCTK_STRING bc_name); + CCTK_POINTER var_indices, + CCTK_POINTER faces, + CCTK_POINTER boundary_widths, + CCTK_POINTER table_handles, + CCTK_STRING bc_name); /******************************************************************** ***************** Scheduled Routine Prototypes ********************* @@ -124,8 +124,8 @@ void Boundary_ClearSelection(void); /* Table for holding function pointers associated with each boundary condition: * This table has - * key = boundary condition name (eg "Radiation") - * value = a CCTK_FPOINTER pointing to a function to implement that BC + * key = boundary condition name (eg "Radiation") + * value = a CCTK_FPOINTER pointing to a function to implement that BC */ static int physbc_table_handle = -1; @@ -150,7 +150,7 @@ static CCTK_POINTER theGH; @author David Rideout @desc Used to register physical boundary conditions with the boundary - thorn. + thorn. @enddesc @calls @history @@ -174,13 +174,13 @@ static CCTK_POINTER theGH; @returndesc 0 success -1 error creating table to hold bcs - -2 duplicate registration of bc_name - -3 error adding bc to table + -2 duplicate registration of bc_name + -3 error adding bc to table @endreturndesc @@*/ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, - CCTK_FPOINTER fn_pointer, - CCTK_STRING bc_name) + CCTK_FPOINTER fn_pointer, + CCTK_STRING bc_name) { int retval; @@ -192,13 +192,13 @@ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER 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."); + "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 */ @@ -213,19 +213,19 @@ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, if (!fn_pointer) { CCTK_VWarn(2, __LINE__, __FILE__, CCTK_THORNSTRING, - "Null pointer passed to Boundary_RegisterPhysicalBC. " - "Is this intentional?"); + "Null pointer passed to Boundary_RegisterPhysicalBC. " + "Is this intentional?"); } /* Create the registered routines table if necessary */ - if (physbc_table_handle == -1) + if (physbc_table_handle == -1) { physbc_table_handle = Util_TableCreate(UTIL_TABLE_FLAGS_CASE_INSENSITIVE); - if (physbc_table_handle<0) + if (physbc_table_handle<0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error creating table to hold registered physical boundary " - "conditions"); + "Error creating table to hold registered physical boundary " + "conditions"); retval = -1; } } @@ -234,17 +234,17 @@ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, if (Util_TableGetFnPointer(physbc_table_handle, NULL, bc_name)>=0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "There already exists a physical boundary condition " - "registered under the name \"%s\"", bc_name); + "There already exists a physical boundary condition " + "registered under the name \"%s\"", bc_name); retval = -2; - } - else + } + else { /* Add boundary condition to table */ - if (Util_TableSetFnPointer(physbc_table_handle, fn_pointer, bc_name)<0) + if (Util_TableSetFnPointer(physbc_table_handle, fn_pointer, bc_name)<0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error adding boundary condition to table"); + "Error adding boundary condition to table"); retval = -3; } retval = 0; @@ -257,9 +257,9 @@ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, @routine Bdry_Boundary_SelectVarForBC @date Sun Nov 3 19:51:37 CET 2002 @author David Rideout - @desc - Used to select a Cactus variable to have boundary - conditions applied, using its variable name. + @desc + Used to select a Cactus variable to have boundary + conditions applied, using its variable name. @enddesc @calls @history @@ -301,34 +301,34 @@ CCTK_INT Bdry_Boundary_RegisterPhysicalBC(CCTK_POINTER GH, or the returncode of @seeroutine Bdry_Boundary_SelectVarForBCI @endreturndesc @@*/ -CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT width, - CCTK_INT table_handle, - CCTK_STRING var_name, - CCTK_STRING bc_name) +CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH, + CCTK_INT faces, + CCTK_INT width, + CCTK_INT table_handle, + CCTK_STRING var_name, + CCTK_STRING bc_name) { int retval, var_index; #ifdef DEBUG printf("Boundary_SelectVarForBC:\n"); printf(" called with faces=%d, width=%d, table_handle=%d, var_name=%s, " - "bc_name=%s\n", faces, width, table_handle, var_name, bc_name); + "bc_name=%s\n", faces, width, table_handle, var_name, bc_name); #endif retval = 0; var_index = CCTK_VarIndex(var_name); - if (var_index<0) + if (var_index<0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid variable name"); + "Invalid variable name"); retval = -11; - } - else + } + else { - retval = Bdry_Boundary_SelectVarForBCI(GH, faces, width, table_handle, - var_index, bc_name); + retval = Bdry_Boundary_SelectVarForBCI(GH, faces, width, table_handle, + var_index, bc_name); } return retval; @@ -339,13 +339,13 @@ CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH, @routine Bdry_Boundary_SelectVarForBCI @date Sun Nov 3 19:51:37 CET 2002 @author David Rideout - @desc - Used to select a Cactus variable to have boundary - conditions applied, using its var index. - @enddesc - @calls - @history - @endhistory + @desc + Used to select a Cactus variable to have boundary + conditions applied, using its var index. + @enddesc + @calls + @history + @endhistory @var GH @vdesc cctkGH * @vtype CCTK_POINTER @@ -385,11 +385,11 @@ CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH, @endreturndesc @@*/ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT width, - CCTK_INT table_handle, - CCTK_INT var_index, - CCTK_STRING bc_name) + CCTK_INT faces, + CCTK_INT width, + CCTK_INT table_handle, + CCTK_INT var_index, + CCTK_STRING bc_name) { int retval; struct BCVAR *new_entry; @@ -407,8 +407,8 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, #ifdef DEBUG printf("Boundary_SelectVarForBCI:\n"); 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); + "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 @@ -416,13 +416,13 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER 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."); + "New GH passed to Boundary_SelectVarForBCI. " + "Thorn CactusBase/Boundary does not yet handle multiple GHs " + "properly."); retval = -5; } @@ -433,8 +433,8 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, if (!Util_TableQueryValueInfo(physbc_table_handle, NULL, NULL, bc_name)) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "There is no function implementing the physical boundary " - "condition %s", bc_name); + "There is no function implementing the physical boundary " + "condition %s", bc_name); retval = -2; } @@ -445,8 +445,8 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, if (selected_faces && selected_faces[var_index]&faces) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "%s has already been selected for a bc", - CCTK_VarName(var_index)); + "%s has already been selected for a bc", + CCTK_VarName(var_index)); retval = -3; } @@ -457,45 +457,45 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, { /* allocate memory for new entry in database */ - new_entry = (struct BCVAR *) malloc(sizeof(struct BCVAR)); + new_entry = malloc(sizeof(struct BCVAR)); if (!new_entry) { CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, - "Unable to allocate memory for entry into " - "'selected for bcs' database"); + "Unable to allocate memory for entry into " + "'selected for bcs' database"); /*retval = -1;*/ } - + /* populate new entry with data */ new_entry -> faces = faces; new_entry -> width = width; new_entry -> table = table_handle; new_entry -> var = var_index; /* new_entry -> next will be filled in later */ - + /* Into which of bcdata's lists should this variable be placed? */ - for (current_bcdata = bcdata_list; - current_bcdata; - previous_bcdata=current_bcdata, current_bcdata = current_bcdata->next) + for (current_bcdata = bcdata_list; + current_bcdata; + previous_bcdata=current_bcdata, current_bcdata = current_bcdata->next) { #ifdef DEBUG printf("Boundary_SelectVarForBCI: looping through bcdata list, at " - "current_bcdata for %s\n",current_bcdata->bc_name); + "current_bcdata for %s\n",current_bcdata->bc_name); #endif - + if (CCTK_Equals(current_bcdata->bc_name,bc_name)) { - current = current_bcdata->var_list; - current_bcdata->num++; + current = current_bcdata->var_list; + current_bcdata->num++; #ifdef DEBUG - printf("Boundary_SelectVarForBCI: var %s brings bc %s to %d vars\n", - CCTK_VarName(var_index),bc_name, current_bcdata->num); + printf("Boundary_SelectVarForBCI: var %s brings bc %s to %d vars\n", + CCTK_VarName(var_index),bc_name, current_bcdata->num); #endif - break; /* now that current is set we don't need to look at any - more bcdata entries */ + break; /* now that current is set we don't need to look at any + more bcdata entries */ } } - + /* If current_bcdata is NULL, we got to the end of the above loop, this is * a new bc_name that does not appear in the bcdata list. */ @@ -504,73 +504,73 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, #ifdef DEBUG printf("Boundary_SelectVarForBCI: adding new entry to bcdata list\n"); #endif - + /* new bc_name. Create new entry for bcdata list. */ - new_bcdata = (struct BCDATA *) malloc(sizeof(struct BCDATA)); + new_bcdata = malloc(sizeof(struct BCDATA)); if (!new_bcdata) { - CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, - "Unable to allocate memory for internal 'bcdata' list"); - /*retval = -4;*/ + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Unable to allocate memory for internal 'bcdata' list"); + /*retval = -4;*/ } /* new_bcdata->next is set below, when inserting into bcdata_list */ new_bcdata->var_list = NULL; new_bcdata->bc_name = Util_Strdup(bc_name); - /* new_bcdata->num is set further below, when adding first entry to - var_list */ - + /* new_bcdata->num is set further below, when adding first entry to + var_list */ + /* Place new entry into bcdata list, maintaining case independent sort */ - for (current_bcdata = bcdata_list, previous_bcdata = NULL; - current_bcdata; - previous_bcdata=current_bcdata, - current_bcdata = current_bcdata->next) + for (current_bcdata = bcdata_list, previous_bcdata = NULL; + current_bcdata; + previous_bcdata=current_bcdata, + current_bcdata = current_bcdata->next) { #ifdef DEBUG - printf(" looping through bcdata list, to insert new entry; at %s\n", - current_bcdata->bc_name); + printf(" looping through bcdata list, to insert new entry; at %s\n", + current_bcdata->bc_name); #endif - if (Util_StrCmpi(bc_name, current_bcdata->bc_name) < 0) - { - /* bc_name precedes current->bc_name; place new entry here */ - if (!previous_bcdata) /* goes at start of bcdata list */ - { + if (Util_StrCmpi(bc_name, current_bcdata->bc_name) < 0) + { + /* bc_name precedes current->bc_name; place new entry here */ + if (!previous_bcdata) /* goes at start of bcdata list */ + { #ifdef DEBUG - printf(" new entry goes at beginning of bcdata list\n"); + printf(" new entry goes at beginning of bcdata list\n"); #endif - bcdata_list = new_bcdata; - new_bcdata->next = current_bcdata; - } else - { - new_bcdata->next = current_bcdata; - previous_bcdata->next = new_bcdata; - } - break; - } + bcdata_list = new_bcdata; + new_bcdata->next = current_bcdata; + } else + { + new_bcdata->next = current_bcdata; + previous_bcdata->next = new_bcdata; + } + break; + } } - + /* If current_bcdata still NULL, this is the last entry in the list */ - if (!current_bcdata) + if (!current_bcdata) { - if (!bcdata_list) /* list is empty */ - { - bcdata_list = new_bcdata; - } else - { - previous_bcdata->next = new_bcdata; - } - new_bcdata->next = NULL; + if (!bcdata_list) /* list is empty */ + { + bcdata_list = new_bcdata; + } else + { + previous_bcdata->next = new_bcdata; + } + new_bcdata->next = NULL; } - + /* Set current_bcdata to new_bcdata, so the new bcdata entry will be - filled in below */ + filled in below */ current_bcdata = new_bcdata; } - + #ifdef DEBUG printf(" Finished sorting out which bcdata to use. Now add entry to var list.\n"); printf(" Preparing to loop through elements of var list. current is %p" - " previous is %p\n", current, previous); + " previous is %p\n", current, previous); #endif - + if (!current) /* This is the first element in the var_list */ { #ifdef DEBUG @@ -580,60 +580,60 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, new_entry->next = NULL; current_bcdata->num = 1; } - + /* Enter new_entry into correct location in linked list. * Note that this loop is skipped if new_entry was already inserted as * first element of a new var list above (since in that case current will * be NULL) */ for (; /* starting value for current is selected using the bcdata - list, above */ - current && entry_greater_than(new_entry,current) > 0; - /* continue if not at end of list, and new_entry is greater than - current entry */ - previous = current, current = current->next) + list, above */ + current && entry_greater_than(new_entry,current) > 0; + /* continue if not at end of list, and new_entry is greater than + current entry */ + previous = current, current = current->next) /* store previous value for later use */ { } - + /* The possibilities: * 1 nothing NULL: new_entry goes between previous and current - * 2 previous NULL, but current non-null : new_entry goes at the start of + * 2 previous NULL, but current non-null : new_entry goes at the start of * the list * 3 current NULL, previous non-NULL : new_entry goes at the end of list * 4 both NULL: selections list is empty, case already caught above - */ + */ if (previous) /* case 1 or 3 */ { if (current) /* case 1 : goes in middle of list */ { - previous->next = new_entry; - new_entry->next = current; - } else /* case 3 : goes at end of list */ + previous->next = new_entry; + new_entry->next = current; + } else /* case 3 : goes at end of list */ { - previous->next = new_entry; - new_entry->next = NULL; + previous->next = new_entry; + new_entry->next = NULL; } - } else /* case 2 or 4 */ + } else /* case 2 or 4 */ { if (current) /* case 2 : goes at start of list */ { - current_bcdata->var_list = new_entry; - new_entry->next = current; + current_bcdata->var_list = new_entry; + new_entry->next = current; } /* case 4 : starts list, this case has already been handled above */ } - - + + /* Record that this variable has been selected for a bc on these faces, for duplicate physical bc checking */ if (!selected_faces) { num_cctk_vars = CCTK_NumVars(); - selected_faces = (CCTK_INT *) calloc(num_cctk_vars, sizeof(CCTK_INT)); + selected_faces = calloc(num_cctk_vars, sizeof(CCTK_INT)); if (!selected_faces) { - CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, - "Unable to allocate memory for internal 'selected_faces' " - "array"); + CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, + "Unable to allocate memory for internal 'selected_faces' " + "array"); } } selected_faces[var_index] |= faces; @@ -651,14 +651,14 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, @date Thu Dec 26 21:45:34 CET 2002 @author David Rideout @desc - Used to select a Cactus variable group to have boundary - conditions applied, using the group name. - Table handle and faces must be the same for each member of the - group. - @enddesc - @calls - @history - @endhistory + Used to select a Cactus variable group to have boundary + conditions applied, using the group name. + Table handle and faces must be the same for each member of the + group. + @enddesc + @calls + @history + @endhistory @var GH @vdesc cctkGH * @vtype CCTK_POINTER @@ -697,11 +697,11 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH, @endreturndesc @@*/ CCTK_INT Bdry_Boundary_SelectGroupForBC(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT width, - CCTK_INT table_handle, - CCTK_STRING group_name, - CCTK_STRING bc_name) + CCTK_INT faces, + CCTK_INT width, + CCTK_INT table_handle, + CCTK_STRING group_name, + CCTK_STRING bc_name) { int retval, gi; @@ -711,17 +711,17 @@ CCTK_INT Bdry_Boundary_SelectGroupForBC(CCTK_POINTER GH, /* get group index */ gi = CCTK_GroupIndex(group_name); - if (gi<0) + if (gi<0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid group name %s\n", group_name); + "Invalid group name %s\n", group_name); retval = -6; - } + } else { /* call Bdry_Boundary_SelectGroupForBCI() */ - retval = Bdry_Boundary_SelectGroupForBCI(GH, faces, width, table_handle, gi, - bc_name); + retval = Bdry_Boundary_SelectGroupForBCI(GH, faces, width, table_handle, gi, + bc_name); } return retval; @@ -731,13 +731,13 @@ CCTK_INT Bdry_Boundary_SelectGroupForBC(CCTK_POINTER GH, @routine Bdry_Boundary_SelectGroupForBCI @date Thu Dec 26 21:45:34 CET 2002 @author David Rideout - @desc - Used to select a Cactus variable group to have boundary - conditions applied, using the group index. - @enddesc - @calls - @history - @endhistory + @desc + Used to select a Cactus variable group to have boundary + conditions applied, using the group index. + @enddesc + @calls + @history + @endhistory @var GH @vdesc cctkGH * @vtype CCTK_POINTER @@ -777,11 +777,11 @@ CCTK_INT Bdry_Boundary_SelectGroupForBC(CCTK_POINTER GH, @endreturndesc @@*/ CCTK_INT Bdry_Boundary_SelectGroupForBCI(CCTK_POINTER GH, - CCTK_INT faces, - CCTK_INT width, - CCTK_INT table_handle, - CCTK_INT group_index, - CCTK_STRING bc_name) + CCTK_INT faces, + CCTK_INT width, + CCTK_INT table_handle, + CCTK_INT group_index, + CCTK_STRING bc_name) { int num_vars, vi, max_vi, retval; @@ -789,25 +789,25 @@ CCTK_INT Bdry_Boundary_SelectGroupForBCI(CCTK_POINTER GH, /* Get var indices from group name */ num_vars = CCTK_NumVarsInGroupI(group_index); - if (num_vars<0) + if (num_vars<0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Invalid variable index"); + "Invalid variable index"); retval = -7; } #ifdef DEBUG - printf("Boundary_SelectGroupForBCI: group %s has %d vars\n", - CCTK_GroupName(group_index), num_vars); + printf("Boundary_SelectGroupForBCI: group %s has %d vars\n", + CCTK_GroupName(group_index), num_vars); #endif - + /* loop over variables in group */ vi = CCTK_FirstVarIndexI(group_index); max_vi = vi + num_vars; for (; vinext) + current_bcdata = current_bcdata->next) { #ifdef DEBUG - printf(" looping through bcdata list, at bcdata entry for %s bc\n", - current_bcdata->bc_name); + printf(" looping through bcdata list, at bcdata entry for %s bc\n", + current_bcdata->bc_name); #endif if (!bc_name || CCTK_Equals(current_bcdata->bc_name,bc_name)) @@ -923,50 +923,50 @@ CCTK_INT Bdry_Boundary_SelectedGVs(CCTK_POINTER GH, /* Loop through var list */ for (i=0; /* i indexes the location in the returned arrays */ - inext, ++i) + inext, ++i) { #ifdef DEBUG - printf(" looping through selected vars, at current->var_index = " - "%d\n",current->var); - printf(" current->next is %p\n",current->next); + printf(" looping through selected vars, at current->var_index = " + "%d\n",current->var); + printf(" current->next is %p\n",current->next); #endif - if (faces) - { - ((int *) faces)[i] = current->faces; - } - if (widths) - { - ((int *) widths)[i] = current->width; - } - if (table_handles) - { - ((int *) table_handles)[i] = current->table; - } - if (var_indices) - { - ((int *) var_indices)[i] = current->var; - } + if (faces) + { + ((int *) faces)[i] = current->faces; + } + if (widths) + { + ((int *) widths)[i] = current->width; + } + if (table_handles) + { + ((int *) table_handles)[i] = current->table; + } + if (var_indices) + { + ((int *) var_indices)[i] = current->var; + } } } } /* Warn is there is no bc registered under this name */ - if (bc_name && + if (bc_name && !Util_TableQueryValueInfo(physbc_table_handle, NULL, NULL, bc_name)) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "There is no boundary condition registered under the name %s", - bc_name); + "There is no boundary condition registered under the name %s", + bc_name); retval = -1; } return retval; } - + /******************************************************************** ********************* Scheduled Routines ********************** ********************************************************************/ @@ -975,12 +975,12 @@ CCTK_INT Bdry_Boundary_SelectedGVs(CCTK_POINTER GH, @routine Boundary_ApplyPhysicalBCs @date Sun Nov 3 19:51:37 CET 2002 @author David Rideout - @desc + @desc This will apply all requested physical boundary conditions. - @enddesc - @calls - @history - @endhistory + @enddesc + @calls + @history + @endhistory @var CCTK_ARGUMENTS @vdesc Cactus argument list @vtype CCTK_* @@ -991,11 +991,12 @@ CCTK_INT Bdry_Boundary_SelectedGVs(CCTK_POINTER GH, @endreturndesc @@*/ -void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) +void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; phys_bc_fn_ptr bc_fn; - int num_vars, *vars, *faces, *widths, *tables, err, max_num_vars; + int num_vars, max_num_vars, err; + CCTK_INT *vars, *faces, *widths, *tables; struct BCDATA *current_bcdata; max_num_vars = 0; @@ -1010,7 +1011,7 @@ void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) /* Step through each requested physical boundary condition */ for (current_bcdata = bcdata_list; current_bcdata; - current_bcdata = current_bcdata->next) + current_bcdata = current_bcdata->next) { #ifdef DEBUG printf("Boundary_ApplyPhysicalBCs: looping through bcdata list, at bcdata entry for %s bc\n", current_bcdata->bc_name); @@ -1022,59 +1023,59 @@ void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) #ifdef DEBUG printf(" num_vars is %d\n", num_vars); #endif - if (num_vars > max_num_vars) + if (num_vars > max_num_vars) { max_num_vars = num_vars; /* store new maximum */ - vars = (int *) realloc(vars, num_vars*sizeof(int)); - faces = (int *) realloc(faces, num_vars*sizeof(int)); - widths = (int *) realloc(widths, num_vars*sizeof(int)); - tables = (int *) realloc(tables, num_vars*sizeof(int)); + vars = realloc(vars, num_vars*sizeof(CCTK_INT)); + faces = realloc(faces, num_vars*sizeof(CCTK_INT)); + widths = realloc(widths, num_vars*sizeof(CCTK_INT)); + tables = realloc(tables, num_vars*sizeof(CCTK_INT)); } /* get selected vars for this bc_name */ err = Bdry_Boundary_SelectedGVs(cctkGH, num_vars, vars, faces, widths, tables, - current_bcdata->bc_name); - if (err<0) /* This is a redundant test for now, - Bdry_Boundary_SelectedGVs never returns <0 */ + current_bcdata->bc_name); + if (err<0) /* This is a redundant test for now, + Bdry_Boundary_SelectedGVs never returns <0 */ { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error in Boundary_SelectedGVs for %s boundary condition", - current_bcdata->bc_name); + "Error in Boundary_SelectedGVs for %s boundary condition", + current_bcdata->bc_name); } else if (err != num_vars) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary_SelectedGVs returned %d selected variables for " - "\"%s\" boundary condition, but %d expected\n", err, - current_bcdata->bc_name, num_vars); + "Boundary_SelectedGVs returned %d selected variables for " + "\"%s\" boundary condition, but %d expected\n", err, + current_bcdata->bc_name, num_vars); } /* Get the fn ptr for the bc */ #ifdef DEBUG printf("Boundary_ApplyPhysicalBCs: current_bcdata->bc_name=\"%s\"\n", - current_bcdata->bc_name); + current_bcdata->bc_name); #endif err = Util_TableGetFnPointer(physbc_table_handle, (CCTK_FPOINTER *)&bc_fn, - current_bcdata->bc_name); + current_bcdata->bc_name); if (err<0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary_ApplyPhysicalBCs: Util_TableGetFnPointer " - "returned %d", err); + "Boundary_ApplyPhysicalBCs: Util_TableGetFnPointer " + "returned %d", err); } /* Apply bc to vi */ #ifdef DEBUG printf("Boundary_ApplyPhysicalBCs: Attempting to call boundary condition\n" - " Using function pointer %p with arguments\n" - " cctkGH %p, num_vars %d, vars, tables\n", - (void *) bc_fn, (const void *) cctkGH, num_vars); + " Using function pointer %p with arguments\n" + " cctkGH %p, num_vars %d, vars, tables\n", + (void *) bc_fn, (const void *) cctkGH, num_vars); #endif err = (*bc_fn)(cctkGH, num_vars, vars, faces, widths, tables); - if (err<0) + if (err<0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Function associated with boundary condition %s returned %d", - current_bcdata->bc_name, err); + "Function associated with boundary condition %s returned %d", + current_bcdata->bc_name, err); } } @@ -1090,9 +1091,9 @@ void Boundary_ApplyPhysicalBCs(CCTK_ARGUMENTS) @date Sun Nov 3 19:51:37 CET 2002 @author David Rideout @desc - Clears all boundary condition selections. + Clears all boundary condition selections. @enddesc - @calls + @calls @history @endhistory @@*/ @@ -1109,7 +1110,7 @@ void Boundary_ClearSelection(void) #ifdef DEBUG printf("Boundary_ClearSelection: looping through bcdata list for freeing\n"); #endif - for (current_bcdata = bcdata_list; current_bcdata; + for (current_bcdata = bcdata_list; current_bcdata; current_bcdata = current_bcdata->next) { #ifdef DEBUG @@ -1140,12 +1141,12 @@ void Boundary_ClearSelection(void) @routine entry_greater_than @date Sun Nov 3 19:51:37 CET 2002 @author David Rideout - @desc + @desc Sorts entries in selections list. - Returns non-zero value if new > current. - @enddesc - @calls - @history + Returns non-zero value if new > current. + @enddesc + @calls + @history @endhistory @var new @vdesc new entry to be inserted into selections list @@ -1160,38 +1161,38 @@ void Boundary_ClearSelection(void) @returntype CCTK_INT @returndesc -1 new equals current - 0 new 'less than' current + 0 new 'less than' current 1 new->table_handle > current->table_handle - 2 new and current have same table_handle, but new has greater - var_index + 2 new and current have same table_handle, but new has greater + var_index @endreturndesc @@*/ -static int entry_greater_than(struct BCVAR *new, struct BCVAR *current) +static int entry_greater_than(struct BCVAR *new, struct BCVAR *current) { int retval; /* can assume both arguments are valid (non-null) */ - if (new->table > current->table) + if (new->table > current->table) { retval = 1; - } - else if (new->table < current->table) + } + else if (new->table < current->table) { retval = 0; - } - else if (new->var > current->var) + } + else if (new->var > current->var) { retval = 2; - } - else if (new->var < current->var) + } + else if (new->var < current->var) { retval = 0; - } - else + } + else { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "%s has already been selected for this boundary condition!", - CCTK_VarName(new->var)); + "%s has already been selected for this boundary condition!", + CCTK_VarName(new->var)); retval = -1; } @@ -1202,11 +1203,11 @@ static int entry_greater_than(struct BCVAR *new, struct BCVAR *current) @routine print_selections_database @date 13 March 2003 @author David Rideout - @desc + @desc Prints selected variables database, for debugging only - @enddesc - @calls - @history + @enddesc + @calls + @history @endhistory @@*/ @@ -1218,18 +1219,18 @@ static void print_selections_database(void) struct BCVAR *current; printf("Current list of selected vars:\n"); - for (current_bcdata = bcdata_list; current_bcdata; + for (current_bcdata = bcdata_list; current_bcdata; current_bcdata = current_bcdata->next) { - printf("%d entries for %s:\n", current_bcdata->num, - current_bcdata->bc_name); + printf("%d entries for %s:\n", current_bcdata->num, + current_bcdata->bc_name); printf(" vi gi var name table handle\n"); - for (current = current_bcdata->var_list; current; - current = current->next) + for (current = current_bcdata->var_list; current; + current = current->next) { - printf("%3d %2d %12s %2d\n", current->var, - CCTK_GroupIndexFromVarI(current->var), CCTK_VarName(current->var), - current->table); + printf("%3d %2d %12s %2d\n", current->var, + CCTK_GroupIndexFromVarI(current->var), CCTK_VarName(current->var), + current->table); } } } @@ -1240,11 +1241,11 @@ static void print_selections_database(void) @routine print_selected_faces @date 13 May 2003 @author David Rideout - @desc + @desc Prints selected faces database, for debugging only - @enddesc - @calls - @history + @enddesc + @calls + @history @endhistory @@*/ diff --git a/src/Boundary.h b/src/Boundary.h index c9b0056..1a7073f 100644 --- a/src/Boundary.h +++ b/src/Boundary.h @@ -5,6 +5,7 @@ @desc Prototypes for boundary routines @enddesc + @version $Header$ @@*/ diff --git a/src/CopyBoundary.c b/src/CopyBoundary.c index e8a60b2..cc266de 100644 --- a/src/CopyBoundary.c +++ b/src/CopyBoundary.c @@ -31,7 +31,7 @@ CCTK_FILEVERSION(CactusBase_Boundary_CopyBoundary_c); static int ApplyBndCopy (const cGH *GH, int stencil_dir, - const int *stencil_alldirs, + const CCTK_INT *stencil_alldirs, int dir, int first_var_to, int first_var_from, @@ -46,17 +46,17 @@ static int ApplyBndCopy (const cGH *GH, @date 13 Feb 2003 @author David Rideout @desc - Top level function which is registered as handling - the Copy boundary condition + Top level function which is registered as handling + the Copy boundary condition @enddesc @calls ApplyBndCopy CCTK_GroupDimFromVarI - Util_TableGetIntArray - Util_TableQueryValueInfo - CCTK_VWarn - Util_TableGetString - CCTK_VarIndex - Util_TableGetInt + Util_TableGetIntArray + Util_TableQueryValueInfo + CCTK_VWarn + Util_TableGetString + CCTK_VarIndex + Util_TableGetInt @var GH @vdesc Pointer to CCTK grid hierarchy @@ -65,51 +65,50 @@ static int ApplyBndCopy (const cGH *GH, @endvar @var num_vars @vdesc number of variables passed in through var_indices[] - @vtype int + @vtype CCTK_INT @vio in @endvar @var var_indices - @vdesc array of variable indicies to which to apply this boundary + @vdesc array of variable indicies to which to apply this boundary condition - @vtype int * + @vtype CCTK_INT * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc - @vtype int + @vtype CCTK_INT @vio in @endvar @var widths @vdesc array of boundary widths for each variable - @vtype int + @vtype CCTK_INT @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments - @vtype int + @vtype CCTK_INT @vio in @endvar - @returntype int + @returntype CCTK_INT @returndesc return code of @seeroutine ApplyBndCopy - -11 invalid table handle - -12 no "COPY FROM" key in table + -11 invalid table handle + -12 no "COPY FROM" key in table -21 error reading boundary width array from table - -22 wrong size boundary width array in table + -22 wrong size boundary width array in table @endreturndesc @@*/ - -int BndCopy(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, - int *tables) +CCTK_INT BndCopy(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars, + CCTK_INT *faces, CCTK_INT *widths, CCTK_INT *tables) { - int i, j, k, gi, gdim, max_gdim, err, value_type, value_size, retval; + int i, j, k, gi, gdim, max_gdim, err, retval; + CCTK_INT value_type, value_size; char *copy_from_name; /* variables to pass to ApplyBndCopy */ - int *width_alldirs; /* width of boundary on each face */ + CCTK_INT *width_alldirs; /* width of boundary on each face */ int dir; /* direction in which to apply bc */ - int copy_from; /* variable (index) from which to copy the boundary - data */ + CCTK_INT copy_from; /* variable (index) from which to copy the boundary data */ retval = 0; width_alldirs = NULL; max_gdim = 0; @@ -121,10 +120,10 @@ int BndCopy(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, can do is find variables of the same group which are selected for identical bcs. If all GFs had the same staggering then we could groups many GFs together. */ - gi = CCTK_GroupIndexFromVarI (vars[i]); - while (i+j max_gdim) { - width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int)); + width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(CCTK_INT)); max_gdim = gdim; } - /* fill it with values, either from table or the boundary_width + /* fill it with values, either from table or the boundary_width parameter */ if (widths[i]<0) { - err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, - "BOUNDARY WIDTH"); + err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, + "BOUNDARY WIDTH"); if (err<0) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error %d when reading boundary width array from table " - "for %s", err, CCTK_VarName(vars[i])); - return -21; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error %d when reading boundary width array from table " + "for %s", err, CCTK_VarName(vars[i])); + return -21; } else if (err!=2*gdim) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary width array for %s has %d elements, but %d " - "expected", CCTK_VarName(vars[i]), err, 2*gdim); - return -22; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Boundary width array for %s has %d elements, but %d " + "expected", CCTK_VarName(vars[i]), err, 2*gdim); + return -22; } } else { for (k=0; k<2*gdim; ++k) { - width_alldirs[k] = widths[i]; + width_alldirs[k] = widths[i]; } } /* Apply the boundary condition */ - if (!retval && (retval = ApplyBndCopy(GH, 0, width_alldirs, dir, - vars[i], copy_from, j)) < 0) + if (!retval && (retval = ApplyBndCopy(GH, 0, width_alldirs, dir, + vars[i], copy_from, j)) < 0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "ApplyBndCopy() returned %d", retval); + "ApplyBndCopy() returned %d", retval); } } free(width_alldirs); @@ -406,11 +404,11 @@ int BndCopyVI (const cGH *GH, int vi_from) { int retval, num_vars, dim, i; - int *boundary_widths; /* boundary widths as expected by ApplyBndCopy */ + CCTK_INT *boundary_widths; /* boundary widths as expected by ApplyBndCopy */ /* Set up boundary_widths array */ dim = CCTK_GroupDimFromVarI (vi_to); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(CCTK_INT)); for (i=0; i<2*dim; i+=2) { boundary_widths[i] = stencil[i/2]; @@ -569,11 +567,12 @@ int BndCopyGI (const cGH *GH, int gi_from) { int first_vi_to, first_vi_from, retval; - int i, dim, *boundary_widths; + int i, dim; + CCTK_INT *boundary_widths; /* Set up boundary_widths array */ dim = CCTK_GroupDimI (gi_to); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(CCTK_INT)); for (i=0; i<2*dim; i+=2) { boundary_widths[i] = stencil[i/2]; @@ -583,8 +582,8 @@ int BndCopyGI (const cGH *GH, first_vi_from = CCTK_FirstVarIndexI (gi_from); if (first_vi_to >= 0 && first_vi_from >= 0) { - retval = ApplyBndCopy (GH, -1, boundary_widths, 0, first_vi_to, - first_vi_from, CCTK_NumVarsInGroupI (gi_to)); + retval = ApplyBndCopy (GH, -1, boundary_widths, 0, first_vi_to, + first_vi_from, CCTK_NumVarsInGroupI (gi_to)); } else { @@ -745,7 +744,7 @@ int BndCopyGN (const cGH *GH, /* Set up boundary_widths array */ dim = CCTK_GroupDimI (gi_to); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(int)); for (i=0; i<2*dim; i+=2) { boundary_widths[i] = stencil[i/2]; @@ -908,7 +907,8 @@ int BndCopyVN (const cGH *GH, const char *vname_from) { int vi_to, vi_from, num_vars, retval; - int i, dim, *boundary_widths; + int i, dim; + int *boundary_widths; vi_to = CCTK_VarIndex (vname_to); vi_from = CCTK_VarIndex (vname_from); @@ -916,7 +916,7 @@ int BndCopyVN (const cGH *GH, /* Set up boundary_widths array */ dim = CCTK_GroupDimFromVarI(vi_to); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(int)); for (i=0; i<2*dim; i+=2) { boundary_widths[i] = stencil[i/2]; @@ -1039,7 +1039,7 @@ void CCTK_FCALL CCTK_FNAME (BndCopyVN) @endvar @var stencil_alldirs @vdesc stencil widths for all directions - @vtype int [ dimension of variable(s) ] + @vtype CCTK_INT [ dimension of variable(s) ] @vio in @endvar @var dir @@ -1085,7 +1085,7 @@ void CCTK_FCALL CCTK_FNAME (BndCopyVN) @@*/ static int ApplyBndCopy (const cGH *GH, int width_dir, - const int *in_widths, + const CCTK_INT *in_widths, int dir, int first_var_to, int first_var_from, @@ -1136,7 +1136,7 @@ static int ApplyBndCopy (const cGH *GH, else { CCTK_WARN (1, "ApplyBndCopy: NULL pointer passed for boundary width " - "array"); + "array"); return (-3); } diff --git a/src/FlatBoundary.c b/src/FlatBoundary.c index be758b3..4f9e9e3 100644 --- a/src/FlatBoundary.c +++ b/src/FlatBoundary.c @@ -34,16 +34,16 @@ CCTK_FILEVERSION(CactusBase_Boundary_FlatBoundary_c); static int ApplyBndFlat (const cGH *GH, int stencil_dir, - const int *stencil_alldirs, + const CCTK_INT *stencil_alldirs, int dir, int first_var, int num_vars); static int OldApplyBndFlat (const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - int first_var, - int num_vars); + int stencil_dir, + const int *stencil_alldirs, + int dir, + int first_var, + int num_vars); /******************************************************************** ******************** External Routines ************************ @@ -53,8 +53,8 @@ static int OldApplyBndFlat (const cGH *GH, @date 13 Feb 2003 @author David Rideout @desc - Top level function which is registered as handling - the Flat boundary condition + Top level function which is registered as handling + the Flat boundary condition @enddesc @calls ApplyBndFlat @@ -65,45 +65,44 @@ static int OldApplyBndFlat (const cGH *GH, @endvar @var num_vars @vdesc number of variables passed in through var_indices[] - @vtype int + @vtype CCTK_INT @vio in @endvar @var var_indices - @vdesc array of variable indicies to which to apply this boundary + @vdesc array of variable indicies to which to apply this boundary condition - @vtype int * + @vtype CCTK_INT * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc - @vtype int + @vtype CCTK_INT @vio in @endvar @var widths @vdesc array of boundary widths for each variable - @vtype int + @vtype CCTK_INT @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments - @vtype int + @vtype CCTK_INT @vio in @endvar - @returntype int + @returntype CCTK_INT @returndesc return code of @seeroutine ApplyBndFlat -21 error reading boundary width array from table - -22 wrong size boundary width array in table + -22 wrong size boundary width array in table @endreturndesc @@*/ - -int BndFlat(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, - int *tables) +CCTK_INT BndFlat(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars, + CCTK_INT *faces, CCTK_INT *widths, CCTK_INT *tables) { int i, j, k, gi, gdim, max_gdim, err, retval; /* variables to pass to ApplyBndFlat */ - int *width_alldirs; /* width of boundary in all directions */ + CCTK_INT *width_alldirs; /* width of boundary in all directions */ int dir; /* direction in which to apply bc */ retval = 0; width_alldirs = NULL; max_gdim = 0; @@ -116,10 +115,10 @@ int BndFlat(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, can do is find variables of the same group which are selected for identical bcs. If all GFs had the same staggering then we could groups many GFs together. */ - gi = CCTK_GroupIndexFromVarI (vars[i]); - while (i+j max_gdim) { - width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int)); + width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(CCTK_INT)); max_gdim = gdim; } - /* fill it with values, either from table or the boundary_width + /* fill it with values, either from table or the boundary_width parameter */ if (widths[i]<0) { - err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, - "BOUNDARY WIDTH"); + err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, + "BOUNDARY WIDTH"); if (err<0) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error %d when reading boundary width array from table " - "for %s", err, CCTK_VarName(vars[i])); - return -21; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error %d when reading boundary width array from table " + "for %s", err, CCTK_VarName(vars[i])); + return -21; } else if (err!=2*gdim) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary width array for %s has %d elements, but %d " - "expected", CCTK_VarName(vars[i]), err, 2*gdim); - return -22; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Boundary width array for %s has %d elements, but %d " + "expected", CCTK_VarName(vars[i]), err, 2*gdim); + return -22; } } else { for (k=0; k<2*gdim; ++k) { - width_alldirs[k] = widths[i]; + width_alldirs[k] = widths[i]; } } @@ -175,7 +174,7 @@ int BndFlat(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, if ((retval = ApplyBndFlat(GH, 0, width_alldirs, dir, vars[i], j)) < 0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "ApplyBndFlat() returned %d", retval); + "ApplyBndFlat() returned %d", retval); } } free(width_alldirs); @@ -876,7 +875,7 @@ void CCTK_FCALL CCTK_FNAME (BndFlatVN) @endvar @var in_widths @vdesc boundary widths for all directions - @vtype int [ dimension of variable(s) ] + @vtype CCTK_INT [ dimension of variable(s) ] @vio in @endvar @var dir @@ -917,14 +916,14 @@ void CCTK_FCALL CCTK_FNAME (BndFlatVN) @@*/ static int ApplyBndFlat (const cGH *GH, int width_dir, - const int *in_widths, + const CCTK_INT *in_widths, int dir, int first_var, int num_vars) { int i, j, k; int var, vtypesize, gindex, gdim, timelvl; - int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM], + int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM], widths[2*MAXDIM]; SymmetryGHex *sGHex; @@ -966,7 +965,7 @@ static int ApplyBndFlat (const cGH *GH, else { CCTK_WARN (1, "ApplyBndFlat: NULL pointer passed for boundary width " - "array"); + "array"); return (-3); } @@ -1023,11 +1022,11 @@ static int ApplyBndFlat (const cGH *GH, #ifdef DEBUG_BOUNDARY if (doBC[0]) { - printf("Boundary: Applying lower x flat boundary condition\n"); + printf("Boundary: Applying lower x flat boundary condition\n"); } if (doBC[1]) { - printf("Boundary: Applying upper x flat boundary condition\n"); + printf("Boundary: Applying upper x flat boundary condition\n"); } #endif /* DEBUG_BOUNDARY */ /* lower x */ @@ -1043,11 +1042,11 @@ static int ApplyBndFlat (const cGH *GH, #ifdef DEBUG_BOUNDARY if (doBC[2]) { - printf("Boundary: Applying lower y flat boundary condition\n"); + printf("Boundary: Applying lower y flat boundary condition\n"); } if (doBC[3]) { - printf("Boundary: Applying upper y flat boundary condition\n"); + printf("Boundary: Applying upper y flat boundary condition\n"); } #endif /* DEBUG_BOUNDARY */ /* lower y */ @@ -1062,11 +1061,11 @@ static int ApplyBndFlat (const cGH *GH, #ifdef DEBUG_BOUNDARY if (doBC[4]) { - printf("Boundary: Applying lower z flat boundary condition\n"); + printf("Boundary: Applying lower z flat boundary condition\n"); } if (doBC[5]) { - printf("Boundary: Applying upper z flat boundary condition\n"); + printf("Boundary: Applying upper z flat boundary condition\n"); } #endif /* DEBUG_BOUNDARY */ /* lower z */ @@ -1134,14 +1133,15 @@ static int ApplyBndFlat (const cGH *GH, @@*/ int OldApplyBndFlat(const cGH *GH, int stencil_dir, const int *stencil_alldirs, - int dir, int first_var, int num_vars) + int dir, int first_var, int num_vars) { - int retval, *boundary_widths, dim, i; + int dim, i, retval; + CCTK_INT *boundary_widths; static int warned; /* Convert stencil_alldirs to new format */ dim = CCTK_GroupDimFromVarI(first_var); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(CCTK_INT)); for (i=0; i<2*dim; ++i) { boundary_widths[i] = stencil_alldirs[i/2]; @@ -1152,14 +1152,14 @@ int OldApplyBndFlat(const cGH *GH, int stencil_dir, const int *stencil_alldirs, { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "Copied older d-element array of boundary widths into the " - "newer 2d-element format. Please use the new boundary " - "interface to avoid this."); + "newer 2d-element format. Please use the new boundary " + "interface to avoid this."); warned = 1; } /* Call ApplyBnd... with new boundary width array */ - retval = ApplyBndFlat(GH, stencil_dir, boundary_widths, dir, first_var, - num_vars); + retval = ApplyBndFlat(GH, stencil_dir, boundary_widths, dir, first_var, + num_vars); free(boundary_widths); return retval; diff --git a/src/NoneBoundary.c b/src/NoneBoundary.c index ab2f294..907b260 100644 --- a/src/NoneBoundary.c +++ b/src/NoneBoundary.c @@ -11,13 +11,13 @@ some other manner, but the symmetry boundaries should be updated normally. - BndNone is also used as a dummy local physical boundary - condition, when the true physical bc is non-local. + BndNone is also used as a dummy local physical boundary + condition, when the true physical bc is non-local. @enddesc @history - @hdate - @hauthor - @hdesc + @hdate + @hauthor + @hdesc @endhistory @version $Header$ @@*/ @@ -40,7 +40,7 @@ CCTK_FILEVERSION(CactusBase_Boundary_NoneBoundary_c); @desc Function which handles 'None' boundary condition @enddesc - @calls + @calls @history @endhistory @var GH @@ -50,38 +50,38 @@ CCTK_FILEVERSION(CactusBase_Boundary_NoneBoundary_c); @endvar @var num_vars @vdesc number of variables passed in through var_indices[] - @vtype int + @vtype CCTK_INT @vio in @endvar @var var_indices - @vdesc array of variable indicies to which to apply this boundary + @vdesc array of variable indicies to which to apply this boundary condition - @vtype int * + @vtype CCTK_INT * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc - @vtype int + @vtype CCTK_INT @vio in @endvar @var widths @vdesc array of boundary widths for each variable - @vtype int + @vtype CCTK_INT @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments - @vtype int + @vtype CCTK_INT @vio in @endvar - @returntype int + @returntype CCTK_INT @returndesc 0 success @endreturndesc @@*/ -int BndNone(const cGH *GH, int num_vars, int *var_indices, int *faces, int *widths, - int *table_handles) +CCTK_INT BndNone(const cGH *GH, CCTK_INT num_vars, CCTK_INT *var_indices, + CCTK_INT *faces, CCTK_INT *widths, CCTK_INT *table_handles) { #ifdef DEBUG printf("BndNone(): got passed GH=%p, num_vars=%d, var_indices[0]=%d, table_handles[0]=%d\n", (const void *) GH, num_vars, var_indices[0], table_handles[0]); diff --git a/src/RadiationBoundary.c b/src/RadiationBoundary.c index 6436f85..ffa3014 100644 --- a/src/RadiationBoundary.c +++ b/src/RadiationBoundary.c @@ -86,7 +86,7 @@ CCTK_FILEVERSION(CactusBase_Boundary_RadiationBoundary_c); static int ApplyBndRadiative (const cGH *GH, int stencil_dir, - const int *stencil_alldirs, + const CCTK_INT *stencil_alldirs, int dir, CCTK_REAL var0, CCTK_REAL speed, @@ -94,14 +94,14 @@ static int ApplyBndRadiative (const cGH *GH, int first_var_from, int num_vars); static int OldApplyBndRadiative (const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - CCTK_REAL var0, - CCTK_REAL speed, - int first_var_to, - int first_var_from, - int num_vars); + int stencil_dir, + const int *stencil_alldirs, + int dir, + CCTK_REAL var0, + CCTK_REAL speed, + int first_var_to, + int first_var_from, + int num_vars); /******************************************************************** ******************** External Routines ************************ @@ -112,8 +112,8 @@ static int OldApplyBndRadiative (const cGH *GH, @date 6 Nov 2002 @author David Rideout @desc - Top level function which is registered as handling - the Radiative boundary condition + Top level function which is registered as handling + the Radiative boundary condition @enddesc @calls ApplyBndRadiative @@ -124,53 +124,54 @@ static int OldApplyBndRadiative (const cGH *GH, @endvar @var num_vars @vdesc number of variables passed in through var_indices[] - @vtype int + @vtype CCTK_INT @vio in @endvar @var var_indices - @vdesc array of variable indicies to which to apply this boundary + @vdesc array of variable indicies to which to apply this boundary condition - @vtype int * + @vtype CCTK_INT * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc - @vtype int + @vtype CCTK_INT @vio in @endvar @var widths @vdesc array of boundary widths for each variable - @vtype int + @vtype CCTK_INT @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments - @vtype int + @vtype CCTK_INT @vio in @endvar - @returntype int + @returntype CCTK_INT @returndesc return code of @seeroutine ApplyBndRadiative -21 error reading boundary width array from table - -22 wrong size boundary width array in table + -22 wrong size boundary width array in table @endreturndesc @@*/ -int BndRadiative(const cGH *GH, int num_vars, int *vars, int *faces, - int *widths, int *tables) +CCTK_INT BndRadiative(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars, + CCTK_INT *faces, CCTK_INT *widths, CCTK_INT *tables) { - int i, j, k, gi, gdim, max_gdim, value_type, value_size, err, retval; + int i, j, k, gi, gdim, max_gdim, err, retval; + CCTK_INT value_type, value_size; char *prev_time_level_name; /* variables to pass to ApplyBndRadiative */ - int *width_alldirs; /* width of boundary in all directions */ + CCTK_INT *width_alldirs; /* width of boundary in all directions */ int dir; /* direction in which to apply bc */ CCTK_REAL limit, speed; - int prev_time_level; /* variable index which holds the previous time level */ + CCTK_INT prev_time_level; /* variable index which holds the previous time level */ #ifdef DEBUG printf("BndRadiative() got passed: GH=%p, num_vars=%d:\n", (const void *) GH, - num_vars); + num_vars); printf("var index var name table handle\n"); for (i=0; i max_gdim) { - width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int)); + width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(CCTK_INT)); max_gdim = gdim; } - /* fill it with values, either from table or the boundary_width + /* fill it with values, either from table or the boundary_width parameter */ if (widths[i]<0) { - err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, - "BOUNDARY WIDTH"); + err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, + "BOUNDARY WIDTH"); if (err<0) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error %d when reading boundary width array from table " - "for %s", err, CCTK_VarName(vars[i])); - return -21; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error %d when reading boundary width array from table " + "for %s", err, CCTK_VarName(vars[i])); + return -21; } else if (err!=2*gdim) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary width array for %s has %d elements, but %d " - "expected", CCTK_VarName(vars[i]), err, 2*gdim); - return -22; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Boundary width array for %s has %d elements, but %d " + "expected", CCTK_VarName(vars[i]), err, 2*gdim); + return -22; } } else { for (k=0; k<2*gdim; ++k) { - width_alldirs[k] = widths[i]; + width_alldirs[k] = widths[i]; } } /* Apply the boundary condition */ if ((retval = ApplyBndRadiative(GH, 0, width_alldirs, dir, limit, speed, - vars[i], prev_time_level, j)) < 0) + vars[i], prev_time_level, j)) < 0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "ApplyBndRadiative() returned %d", retval); + "ApplyBndRadiative() returned %d", retval); } } #ifdef DEBUG @@ -1570,7 +1570,7 @@ void CCTK_FCALL CCTK_FNAME (BndRadiativeVN) @@*/ static int ApplyBndRadiative (const cGH *GH, int width_dir, - const int *in_widths, + const CCTK_INT *in_widths, int dir, CCTK_REAL var0, CCTK_REAL speed, @@ -1652,7 +1652,7 @@ static int ApplyBndRadiative (const cGH *GH, if (indx < 0) { CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING, - "Coordinate for system %s not found",coord_system_name); + "Coordinate for system %s not found",coord_system_name); return (-6); } coords[i] = GH->data[indx][0]; @@ -1672,7 +1672,7 @@ static int ApplyBndRadiative (const cGH *GH, if (indx < 0) { CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING, - "Coordinate for system %s not found",coord_system_name); + "Coordinate for system %s not found",coord_system_name); return (-6); } coords[MAXDIM] = GH->data[indx][0]; @@ -1858,21 +1858,22 @@ static int ApplyBndRadiative (const cGH *GH, @@*/ int OldApplyBndRadiative(const cGH *GH, - int width_dir, - const int *stencil_alldirs, - int dir, - CCTK_REAL var0, - CCTK_REAL speed, - int first_var_to, - int first_var_from, - int num_vars) + int width_dir, + const int *stencil_alldirs, + int dir, + CCTK_REAL var0, + CCTK_REAL speed, + int first_var_to, + int first_var_from, + int num_vars) { - int retval, *boundary_widths, dim, i; + int i, dim, retval; + CCTK_INT *boundary_widths; static int warned; /* Convert stencil_alldirs to new format */ dim = CCTK_GroupDimFromVarI(first_var_to); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(CCTK_INT)); for (i=0; i<2*dim; ++i) { boundary_widths[i] = stencil_alldirs[i/2]; @@ -1883,14 +1884,14 @@ int OldApplyBndRadiative(const cGH *GH, { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "Copied older d-element array of boundary widths into the " - "newer 2d-element format. Please use the new boundary " - "interface to avoid this."); + "newer 2d-element format. Please use the new boundary " + "interface to avoid this."); warned = 1; } /* Call ApplyBnd... with new boundary width array */ - retval = ApplyBndRadiative(GH, width_dir, boundary_widths, dir, var0, speed, - first_var_to, first_var_from, num_vars); + retval = ApplyBndRadiative(GH, width_dir, boundary_widths, dir, var0, speed, + first_var_to, first_var_from, num_vars); free(boundary_widths); return retval; diff --git a/src/RobinBoundary.c b/src/RobinBoundary.c index 7c0caa5..d8e309b 100644 --- a/src/RobinBoundary.c +++ b/src/RobinBoundary.c @@ -32,17 +32,17 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusBase_Boundary_RobinBoundary_c); static int ApplyBndRobin (const cGH *GH, - const int *stencil, + const CCTK_INT *stencil, CCTK_REAL finf, int npow, int first_var, int num_vars); static int OldApplyBndRobin (const cGH *GH, - const int *stencil, - CCTK_REAL finf, - int npow, - int first_var, - int num_vars); + const int *stencil, + CCTK_REAL finf, + int npow, + int first_var, + int num_vars); /******************************************************************** @@ -53,8 +53,8 @@ static int OldApplyBndRobin (const cGH *GH, @date 14 Feb 2003 @author David Rideout @desc - Top level function which is registered as handling - this boundary condition + Top level function which is registered as handling + this boundary condition @enddesc @calls ApplyBndRobin @var GH @@ -64,47 +64,47 @@ static int OldApplyBndRobin (const cGH *GH, @endvar @var num_vars @vdesc number of variables passed in through var_indices[] - @vtype int + @vtype CCTK_INT @vio in @endvar @var var_indices - @vdesc array of variable indicies to which to apply this boundary + @vdesc array of variable indicies to which to apply this boundary condition - @vtype int * + @vtype CCTK_INT * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc - @vtype int + @vtype CCTK_INT @vio in @endvar @var widths @vdesc array of boundary widths for each variable - @vtype int + @vtype CCTK_INT @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments - @vtype int + @vtype CCTK_INT @vio in @endvar - @returntype int + @returntype CCTK_INT @returndesc return code of @seeroutine ApplyBndRobin -21 error reading boundary width array from table - -22 wrong size boundary width array in table + -22 wrong size boundary width array in table @endreturndesc @@*/ -int BndRobin(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, - int *tables) +CCTK_INT BndRobin(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars, + CCTK_INT *faces, CCTK_INT *widths, CCTK_INT *tables) { int i, j, k, gi, err, gdim, max_gdim, retval; /* variables to pass to ApplyBndRobin */ - int *width_alldirs; /* width of boundary in all directions */ + CCTK_INT *width_alldirs; /* width of boundary in all directions */ CCTK_REAL finf; /* value of function at infinity */ - int npow; /* decay rate */ + CCTK_INT npow; /* decay rate */ #ifdef DEBUG printf("BndRobin(): got passed GH=%p, num_vars=%d, var_indices[0]=%d, table_handles[0]=%d\n", (const void *) GH, num_vars, var_indices[0], table_handles[0]); @@ -120,10 +120,10 @@ int BndRobin(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, can do is find variables of the same group which are selected for identical bcs. If all GFs had the same staggering then we could groups many GFs together. */ - gi = CCTK_GroupIndexFromVarI (vars[i]); - while (i+j max_gdim) { - width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int)); + width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(CCTK_INT)); max_gdim = gdim; } - /* fill it with values, either from table or the boundary_width + /* fill it with values, either from table or the boundary_width parameter */ if (widths[i]<0) { - err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, - "BOUNDARY WIDTH"); + err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, + "BOUNDARY WIDTH"); if (err<0) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error %d when reading boundary width array from table " - "for %s", err, CCTK_VarName(vars[i])); - return -21; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error %d when reading boundary width array from table " + "for %s", err, CCTK_VarName(vars[i])); + return -21; } else if (err!=2*gdim) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary width array for %s has %d elements, but %d " - "expected", CCTK_VarName(vars[i]), err, 2*gdim); - return -22; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Boundary width array for %s has %d elements, but %d " + "expected", CCTK_VarName(vars[i]), err, 2*gdim); + return -22; } } else { for (k=0; k<2*gdim; ++k) { - width_alldirs[k] = widths[i]; + width_alldirs[k] = widths[i]; } } @@ -200,7 +200,7 @@ int BndRobin(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, if ((retval = ApplyBndRobin(GH, width_alldirs, finf, npow, vars[i], j)) < 0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "ApplyBndRobin() returned %d", retval); + "ApplyBndRobin() returned %d", retval); } } #ifdef DEBUG @@ -751,7 +751,7 @@ void CCTK_FCALL CCTK_FNAME (BndRobinVN) @endvar @var in_widths @vdesc boundary width array - @vtype int [ dimension of variable ] + @vtype CCTK_INT [ dimension of variable ] @vio in @endvar @var finf @@ -797,7 +797,7 @@ void CCTK_FCALL CCTK_FNAME (BndRobinVN) @endreturndesc @@*/ static int ApplyBndRobin (const cGH *GH, - const int *in_widths, + const CCTK_INT *in_widths, CCTK_REAL finf, int npow, int first_var, @@ -828,7 +828,7 @@ static int ApplyBndRobin (const cGH *GH, if (! in_widths) { CCTK_WARN (1, "ApplyBndRobin: NULL pointer passed for boundary width " - "array"); + "array"); return (-2); } @@ -1007,18 +1007,19 @@ static int ApplyBndRobin (const cGH *GH, @endreturndesc @@*/ static int OldApplyBndRobin (const cGH *GH, - const int *in_widths, - CCTK_REAL finf, - int npow, - int first_var, - int num_vars) + const int *in_widths, + CCTK_REAL finf, + int npow, + int first_var, + int num_vars) { - int retval, *boundary_widths, dim, i; + int i, dim, retval; + CCTK_INT *boundary_widths; static int warned; /* Convert stencil_alldirs to new format */ dim = CCTK_GroupDimFromVarI(first_var); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(CCTK_INT)); for (i=0; i<2*dim; ++i) { boundary_widths[i] = in_widths[i/2]; @@ -1029,8 +1030,8 @@ static int OldApplyBndRobin (const cGH *GH, { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "Copied older d-element array of boundary widths into the " - "newer 2d-element format. Please use the new boundary " - "interface to avoid this."); + "newer 2d-element format. Please use the new boundary " + "interface to avoid this."); warned = 1; } diff --git a/src/ScalarBoundary.c b/src/ScalarBoundary.c index 0dba2af..59f1e8a 100644 --- a/src/ScalarBoundary.c +++ b/src/ScalarBoundary.c @@ -32,18 +32,18 @@ CCTK_FILEVERSION(CactusBase_Boundary_ScalarBoundary_c); static int ApplyBndScalar (const cGH *GH, int stencil_dir, - const int *stencil_alldirs, + const CCTK_INT *stencil_alldirs, int dir, CCTK_REAL scalar, int first_var, int num_vars); static int OldApplyBndScalar (const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - CCTK_REAL scalar, - int first_var, - int num_vars); + int stencil_dir, + const int *stencil_alldirs, + int dir, + CCTK_REAL scalar, + int first_var, + int num_vars); /******************************************************************** ******************** External Routines ************************ @@ -54,8 +54,8 @@ static int OldApplyBndScalar (const cGH *GH, @date 13 Feb 2003 @author David Rideout @desc - Top level function which is registered as handling - the Scalar boundary condition + Top level function which is registered as handling + the Scalar boundary condition @enddesc @calls ApplyBndScalar @@ -70,7 +70,7 @@ static int OldApplyBndScalar (const cGH *GH, @vio in @endvar @var var_indices - @vdesc array of variable indicies to which to apply this boundary + @vdesc array of variable indicies to which to apply this boundary condition @vtype int * @vio in @@ -94,17 +94,16 @@ static int OldApplyBndScalar (const cGH *GH, @returndesc return code of @seeroutine ApplyBndScalar -21 error reading boundary width array from table - -22 wrong size boundary width array in table + -22 wrong size boundary width array in table @endreturndesc @@*/ - -int BndScalar(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, - int *tables) +CCTK_INT BndScalar(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars, CCTK_INT *faces, + CCTK_INT *widths, CCTK_INT *tables) { int i, j, k, gi, gdim, max_gdim, err, retval; /* variables to pass to ApplyBndScalar */ - int *width_alldirs; /* width of stencil in all directions */ + CCTK_INT *width_alldirs; /* width of stencil in all directions */ int dir; /* direction in which to apply bc */ CCTK_REAL scalar; @@ -118,10 +117,10 @@ int BndScalar(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, can do is find variables of the same group which are selected for identical bcs. If all GFs had the same staggering then we could groups many GFs together. */ - gi = CCTK_GroupIndexFromVarI (vars[i]); - while (i+j max_gdim) { - width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int)); + width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(CCTK_INT)); max_gdim = gdim; } - /* fill it with values, either from table or the boundary_width + /* fill it with values, either from table or the boundary_width parameter */ if (widths[i]<0) { - err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, - "BOUNDARY WIDTH"); + err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, + "BOUNDARY WIDTH"); if (err<0) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error %d when reading boundary width array from table " - "for %s", - err, CCTK_VarName(vars[i])); - return -21; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error %d when reading boundary width array from table " + "for %s", + err, CCTK_VarName(vars[i])); + return -21; } else if (err!=2*gdim) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary width array for %s has %d elements, but %d " - "expected", CCTK_VarName(vars[i]), err, 2*gdim); - return -22; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Boundary width array for %s has %d elements, but %d " + "expected", CCTK_VarName(vars[i]), err, 2*gdim); + return -22; } } else { for (k=0; k<2*gdim; ++k) { - width_alldirs[k] = widths[i]; + width_alldirs[k] = widths[i]; } } /* Apply the boundary condition */ if ((retval = ApplyBndScalar(GH, 0, width_alldirs, dir, scalar, vars[i], - j)) < 0) + j)) < 0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "ApplyBndScalar() returned %d", retval); + "ApplyBndScalar() returned %d", retval); } } free(width_alldirs); @@ -1012,7 +1011,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) @endvar @var in_widths @vdesc boundary widths for all directions - @vtype int [ dimension of variable(s) ] + @vtype CCTK_INT [ dimension of variable(s) ] @vio in @endvar @var dir @@ -1054,7 +1053,7 @@ void CCTK_FCALL CCTK_FNAME (BndScalarVN) @@*/ static int ApplyBndScalar (const cGH *GH, int width_dir, - const int *in_widths, + const CCTK_INT *in_widths, int dir, CCTK_REAL scalar, int first_var, @@ -1063,7 +1062,7 @@ static int ApplyBndScalar (const cGH *GH, int i, j, k; int gindex, gdim; int var, timelvl; - int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM], + int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM], widths[2*MAXDIM]; SymmetryGHex *sGHex; @@ -1274,19 +1273,20 @@ static int ApplyBndScalar (const cGH *GH, @@*/ static int OldApplyBndScalar(const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - CCTK_REAL scalar, - int first_var, - int num_vars) + int stencil_dir, + const int *stencil_alldirs, + int dir, + CCTK_REAL scalar, + int first_var, + int num_vars) { - int retval, *boundary_widths, dim, i; + int retval, dim, i; + CCTK_INT *boundary_widths; static int warned; /* Convert stencil_alldirs to new format */ dim = CCTK_GroupDimFromVarI (first_var); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(CCTK_INT)); for (i=0; i<2*dim; ++i) { boundary_widths[i] = stencil_alldirs[i/2]; @@ -1297,14 +1297,14 @@ static int OldApplyBndScalar(const cGH *GH, { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "Copied older d-element array of boundary widths into the " - "newer 2d-element format. Please use the new boundary " - "interface to avoid this."); + "newer 2d-element format. Please use the new boundary " + "interface to avoid this."); warned = 1; } /* Call ApplyBnd... with new boundary width array */ - retval = ApplyBndScalar(GH, stencil_dir, boundary_widths, dir, scalar, - first_var, num_vars); + retval = ApplyBndScalar(GH, stencil_dir, boundary_widths, dir, scalar, + first_var, num_vars); free(boundary_widths); return retval; diff --git a/src/StaticBoundary.c b/src/StaticBoundary.c index e4615b3..ecc72d5 100644 --- a/src/StaticBoundary.c +++ b/src/StaticBoundary.c @@ -25,17 +25,17 @@ static const char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusBase_Boundary_StaticBoundary_c); static int ApplyBndStatic (const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - int first_var, - int num_vars); + int stencil_dir, + const CCTK_INT *stencil_alldirs, + int dir, + int first_var, + int num_vars); static int OldApplyBndStatic (const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - int first_var, - int num_vars); + int stencil_dir, + const int *stencil_alldirs, + int dir, + int first_var, + int num_vars); /******************************************************************** ******************** External Routines ************************ @@ -45,8 +45,8 @@ static int OldApplyBndStatic (const cGH *GH, @date 14 Feb 2003 @author David Rideout @desc - Top level function which is registered as handling - this boundary condition + Top level function which is registered as handling + this boundary condition @enddesc @calls ApplyBndStatic @var GH @@ -56,45 +56,44 @@ static int OldApplyBndStatic (const cGH *GH, @endvar @var num_vars @vdesc number of variables passed in through var_indices[] - @vtype int + @vtype CCTK_INT @vio in @endvar @var var_indices - @vdesc array of variable indicies to which to apply this boundary + @vdesc array of variable indicies to which to apply this boundary condition - @vtype int * + @vtype CCTK_INT * @vio in @endvar @var faces @vdesc array of set of faces to which to apply the bc - @vtype int + @vtype CCTK_INT @vio in @endvar @var widths @vdesc array of boundary widths for each variable - @vtype int + @vtype CCTK_INT @vio in @endvar @var table_handles @vdesc array of table handles which hold extra arguments - @vtype int + @vtype CCTK_INT @vio in @endvar - @returntype int + @returntype CCTK_INT @returndesc return code of @seeroutine ApplyBndStatic -21 error reading boundary width array from table - -22 wrong size boundary width array in table + -22 wrong size boundary width array in table @endreturndesc @@*/ - -int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, - int *tables) +CCTK_INT BndStatic(const cGH *GH, CCTK_INT num_vars, CCTK_INT *vars, + CCTK_INT *faces, CCTK_INT *widths, CCTK_INT *tables) { int i, j, k, gi, err, gdim, max_gdim, retval; /* variables to pass to ApplyBndStatic */ - int *width_alldirs; /* width of boundary in all directions */ + CCTK_INT *width_alldirs; /* width of boundary in all directions */ int dir; /* direction in which to apply bc */ #ifdef DEBUG @@ -111,10 +110,10 @@ int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, can do is find variables of the same group which are selected for identical bcs. If all GFs had the same staggering then we could groups many GFs together. */ - gi = CCTK_GroupIndexFromVarI (vars[i]); - while (i+j max_gdim) { - width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(int)); + width_alldirs = realloc(width_alldirs, 2*gdim*sizeof(CCTK_INT)); max_gdim = gdim; } - /* fill it with values, either from table or the boundary_width + /* fill it with values, either from table or the boundary_width parameter */ if (widths[i]<0) { - err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, - "BOUNDARY WIDTH"); + err = Util_TableGetIntArray(tables[i], gdim, width_alldirs, + "BOUNDARY WIDTH"); if (err<0) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Error %d when reading boundary width array from table " - "for %s", - err, CCTK_VarName(vars[i])); - return -21; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Error %d when reading boundary width array from table " + "for %s", + err, CCTK_VarName(vars[i])); + return -21; } else if (err!=2*gdim) { - CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Boundary width array for %s has %d elements, but %d " - "expected", CCTK_VarName(vars[i]), err, 2*gdim); - return -22; + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Boundary width array for %s has %d elements, but %d " + "expected", CCTK_VarName(vars[i]), err, 2*gdim); + return -22; } } else { for (k=0; k<2*gdim; ++k) { - width_alldirs[k] = widths[i]; + width_alldirs[k] = widths[i]; } } @@ -171,7 +170,7 @@ int BndStatic(const cGH *GH, int num_vars, int *vars, int *faces, int *widths, if ((retval = ApplyBndStatic(GH, 0, width_alldirs, dir, vars[i], j)) < 0) { CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, - "ApplyBndStatic() returned %d", retval); + "ApplyBndStatic() returned %d", retval); } } #ifdef DEBUG @@ -885,7 +884,7 @@ void CCTK_FCALL CCTK_FNAME (BndStaticVN) @endvar @var in_widths @vdesc boundary widths for all directions - @vtype int [ dimension of variable(s) ] + @vtype CCTK_INT [ dimension of variable(s) ] @vio in @endvar @var dir @@ -927,7 +926,7 @@ void CCTK_FCALL CCTK_FNAME (BndStaticVN) @@*/ static int ApplyBndStatic (const cGH *GH, int width_dir, - const int *in_widths, + const CCTK_INT *in_widths, int dir, int first_var, int num_vars) @@ -936,7 +935,7 @@ static int ApplyBndStatic (const cGH *GH, int timelvl_to, timelvl_from; int gindex, gdim; int var, vtypesize; - int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM], + int doBC[2*MAXDIM], dstag[MAXDIM], lsh[MAXDIM], lssh[MAXDIM], widths[2*MAXDIM]; SymmetryGHex *sGHex; @@ -983,7 +982,7 @@ static int ApplyBndStatic (const cGH *GH, else { CCTK_WARN (1, "ApplyBndStatic: NULL pointer passed for boundary width " - "array"); + "array"); return (-3); } @@ -1003,7 +1002,7 @@ static int ApplyBndStatic (const cGH *GH, timelvl_from = 1; /* see if we have a symmetry array */ - sGHex = (SymmetryGHex *) CCTK_GHExtension (GH, "Symmetry"); + sGHex = CCTK_GHExtension (GH, "Symmetry"); /* now loop over all variables */ for (var = first_var; @@ -1043,24 +1042,24 @@ static int ApplyBndStatic (const cGH *GH, /* lower x */ STATIC_BOUNDARY (doBC[0], widths[0], lssh[1], lssh[2], i, j, k); /* upper x */ - STATIC_BOUNDARY (doBC[1], widths[1], lssh[1], lssh[2], lssh[0]-i-1, j, - k); + STATIC_BOUNDARY (doBC[1], widths[1], lssh[1], lssh[2], lssh[0]-i-1, j, + k); } if (gdim > 1) { /* lower y */ STATIC_BOUNDARY (doBC[2], lssh[0], widths[2], lssh[2], i, j, k); /* upper y */ - STATIC_BOUNDARY (doBC[3], lssh[0], widths[3], lssh[2], i, lssh[1]-j-1, - k); + STATIC_BOUNDARY (doBC[3], lssh[0], widths[3], lssh[2], i, lssh[1]-j-1, + k); } if (gdim > 2) { /* lower z */ STATIC_BOUNDARY (doBC[4], lssh[0], lssh[1], widths[4], i, j, k); /* upper z */ - STATIC_BOUNDARY (doBC[5], lssh[0], lssh[1], widths[5], i, j, - lssh[2]-k-1); + STATIC_BOUNDARY (doBC[5], lssh[0], lssh[1], widths[5], i, j, + lssh[2]-k-1); } } @@ -1119,18 +1118,19 @@ static int ApplyBndStatic (const cGH *GH, @@*/ static int OldApplyBndStatic (const cGH *GH, - int stencil_dir, - const int *stencil_alldirs, - int dir, - int first_var, - int num_vars) + int stencil_dir, + const int *stencil_alldirs, + int dir, + int first_var, + int num_vars) { - int retval, *boundary_widths, dim, i; + int retval, dim, i; + CCTK_INT *boundary_widths; static int warned; /* Convert stencil_alldirs to new format */ dim = CCTK_GroupDimFromVarI (first_var); - boundary_widths = (int *) malloc(2*dim*sizeof(int)); + boundary_widths = malloc(2*dim*sizeof(CCTK_INT)); for (i=0; i<2*dim; ++i) { boundary_widths[i] = stencil_alldirs[i/2]; @@ -1141,8 +1141,8 @@ static int OldApplyBndStatic (const cGH *GH, { CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING, "Copied older d-element array of boundary widths into the " - "newer 2d-element format. Please use the new boundary " - "interface to avoid this."); + "newer 2d-element format. Please use the new boundary " + "interface to avoid this."); warned = 1; } -- cgit v1.2.3