aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrideout <rideout@6a38eb6e-646e-4a02-a296-d141613ad6c4>2003-05-12 16:14:39 +0000
committerrideout <rideout@6a38eb6e-646e-4a02-a296-d141613ad6c4>2003-05-12 16:14:39 +0000
commitbbfdf7d24e4ec6cf878a5f251f1bd4736c12fa83 (patch)
treec29a7a64b73153c57936e0540689423ffb7999aa
parent1779a717ac10598ffe7088b9178c541f9cc7c51e (diff)
Fixed bug in adding new bcname to selected vars database.
Cleaned up some formatting. Set some warning levels to 0. Partially fixes CactusBase/1508. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@229 6a38eb6e-646e-4a02-a296-d141613ad6c4
-rw-r--r--src/Boundary.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/Boundary.c b/src/Boundary.c
index 0091942..eccb73a 100644
--- a/src/Boundary.c
+++ b/src/Boundary.c
@@ -289,8 +289,8 @@ CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH,
#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);
+ 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);
#endif
retval = 0;
@@ -303,8 +303,8 @@ CCTK_INT Bdry_Boundary_SelectVarForBC(CCTK_POINTER GH,
retval = -3;
} 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;
@@ -382,8 +382,8 @@ 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 faces=%d, width=%d, table_handle=%d, var_index=%d, "
+ "bc_name=%s\n", faces, width, table_handle, var_index, bc_name);
printf(" vi %d corresponds to %s\n", var_index, CCTK_VarName(var_index));
#endif
@@ -403,7 +403,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH,
new_entry = (struct BCVAR *) malloc(sizeof(struct BCVAR));
if (!new_entry)
{
- CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
"Unable to allocate memory for entry into "
"'selected for bcs' database");
retval = -1;
@@ -439,8 +439,8 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH,
}
}
- /* 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.
+ /* 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.
*/
if (!current_bcdata) /* bc_name was not found in bcdata_list */
{
@@ -451,7 +451,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH,
/* new bc_name. Create new entry for bcdata list. */
new_bcdata = (struct BCDATA *) malloc(sizeof(struct BCDATA));
if (!new_bcdata) {
- CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
"Unable to allocate memory for internal 'bcdata' list");
retval = -4;
}
@@ -470,6 +470,9 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH,
/* 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");
+#endif
bcdata_list = new_bcdata;
new_bcdata->next = current_bcdata;
} else
@@ -481,11 +484,17 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH,
}
}
- /* If current_bcdata is still NULL, then this is the first entry */
+ /* If current_bcdata still NULL, this is the last entry in the list */
if (!current_bcdata)
{
- bcdata_list = 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 */
@@ -493,6 +502,7 @@ CCTK_INT Bdry_Boundary_SelectVarForBCI(CCTK_POINTER GH,
}
#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);
#endif