aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjthorn <jthorn@6a3ddf76-46e1-4315-99d9-bc56cac1ef84>2003-05-06 10:26:16 +0000
committerjthorn <jthorn@6a3ddf76-46e1-4315-99d9-bc56cac1ef84>2003-05-06 10:26:16 +0000
commit093134b1e65456a387b9edad8cad7921ac533957 (patch)
treea6dbe47b112ef5a9347826d77dab06d424f5459a
parent5ec98007b99725ad730f536d7db8c9a89630eea8 (diff)
fix a bug where setting
ADMBase::metric_type = "static conformal" StaticConformal::conformal_storage = "factor" led to the local flag make_conformal_derivs never being initialized. Alas, later code then tested this flag, and if the random garbage that's in uninitialized memory happened to be nonzero, the later code would then proceed to try to initialize the 1st derivatives of the conformal factor. Since these don't have storage allocated, this core-dumps. :( :( The bug is fixed by changing the logic to always set make_conformal_derivs . git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinInitialData/IDAnalyticBH/trunk@128 6a3ddf76-46e1-4315-99d9-bc56cac1ef84
-rw-r--r--src/BrillLindquist.c17
-rw-r--r--src/Kerr.c17
-rw-r--r--src/Misner_multiple.c17
-rw-r--r--src/Schwarzschild.c33
4 files changed, 64 insertions, 20 deletions
diff --git a/src/BrillLindquist.c b/src/BrillLindquist.c
index 74b56e6..6793fb3 100644
--- a/src/BrillLindquist.c
+++ b/src/BrillLindquist.c
@@ -57,18 +57,27 @@ void BrillLindquist(CCTK_ARGUMENTS)
/* Check if we should create and store conformal factor stuff */
if(CCTK_EQUALS(metric_type, "static conformal"))
{
- *conformal_state = 1;
-
- if(CCTK_EQUALS(conformal_storage,"factor+derivs"))
+ if (CCTK_EQUALS(conformal_storage,"factor"))
+ {
+ *conformal_state = 1;
+ make_conformal_derivs = 0;
+ }
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs"))
{
*conformal_state = 2;
make_conformal_derivs = 1;
}
- else if(CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
{
*conformal_state = 3;
make_conformal_derivs = 1;
}
+ else
+ {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+"BrillLindquist(): impossible value for conformal_storage=\"%s\"!");
+ /*NOTREACHED*/
+ }
}
else
{
diff --git a/src/Kerr.c b/src/Kerr.c
index 7527552..b1c7ee9 100644
--- a/src/Kerr.c
+++ b/src/Kerr.c
@@ -81,24 +81,33 @@ void KerrID(CCTK_ARGUMENTS)
/* Check if we should create and store conformal factor stuff */
if(CCTK_EQUALS(metric_type, "static conformal"))
{
- *conformal_state = 1;
-
- if(CCTK_EQUALS(conformal_storage,"factor+derivs"))
+ if (CCTK_EQUALS(conformal_storage,"factor"))
+ {
+ *conformal_state = 1;
+ make_conformal_derivs = 0;
+ }
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs"))
{
*conformal_state = 2;
make_conformal_derivs = 1;
}
- else if(CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
{
*conformal_state = 3;
make_conformal_derivs = 1;
}
+ else
+ {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+"KerrID(): impossible value for conformal_storage=\"%s\"!"); /*NOTREACHED*/
+ }
}
else
{
make_conformal_derivs = 0;
}
+
/* printf("npoints: %i\n",npoints); */
for(i = 0; i < npoints; i++)
{
diff --git a/src/Misner_multiple.c b/src/Misner_multiple.c
index ebb7c34..bac6ea0 100644
--- a/src/Misner_multiple.c
+++ b/src/Misner_multiple.c
@@ -58,18 +58,27 @@ void Misner_multiple(CCTK_ARGUMENTS)
/* Check if we should create and store conformal factor stuff */
if(CCTK_EQUALS(metric_type, "static conformal"))
{
- *conformal_state = 1;
-
- if(CCTK_EQUALS(conformal_storage,"factor+derivs"))
+ if (CCTK_EQUALS(conformal_storage,"factor"))
+ {
+ *conformal_state = 1;
+ make_conformal_derivs = 0;
+ }
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs"))
{
*conformal_state = 2;
make_conformal_derivs = 1;
}
- else if(CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
{
*conformal_state = 3;
make_conformal_derivs = 1;
}
+ else
+ {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+"Misner_multiple(): impossible value for conformal_storage=\"%s\"!");
+ /*NOTREACHED*/
+ }
}
else
{
diff --git a/src/Schwarzschild.c b/src/Schwarzschild.c
index a29d4b7..0c7f0e2 100644
--- a/src/Schwarzschild.c
+++ b/src/Schwarzschild.c
@@ -30,28 +30,45 @@ void Schwarzschild(CCTK_ARGUMENTS)
const CCTK_REAL zero = 0.0, one = 1.0, two = 2.0, three = 3.0;
CCTK_REAL tmp, r_squared, r_cubed;
+ int make_conformal_derivs;
int i, npoints;
- npoints = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2];
- /* conformal metric flag */
+ /* Check if we should create and store conformal factor stuff */
if(CCTK_EQUALS(metric_type, "static conformal"))
{
- int make_conformal_derivs;
-
- *conformal_state = 1;
-
- if(CCTK_EQUALS(conformal_storage,"factor+derivs"))
+ if (CCTK_EQUALS(conformal_storage,"factor"))
+ {
+ *conformal_state = 1;
+ make_conformal_derivs = 0;
+ }
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs"))
{
*conformal_state = 2;
make_conformal_derivs = 1;
}
- else if(CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
+ else if (CCTK_EQUALS(conformal_storage,"factor+derivs+2nd derivs"))
{
*conformal_state = 3;
make_conformal_derivs = 1;
}
+ else
+ {
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
+"Schwarzschild(): impossible value for conformal_storage=\"%s\"!");
+ /*NOTREACHED*/
+ }
+ }
+ else
+ {
+ make_conformal_derivs = 0;
+ }
+
+ npoints = cctk_lsh[0] * cctk_lsh[1] * cctk_lsh[2];
+
+ if(CCTK_EQUALS(metric_type, "static conformal"))
+ {
for (i = 0; i < npoints; i++)
{
/* Compute conformal factor */