aboutsummaryrefslogtreecommitdiff
path: root/src/Schwarzschild.c
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 /src/Schwarzschild.c
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
Diffstat (limited to 'src/Schwarzschild.c')
-rw-r--r--src/Schwarzschild.c33
1 files changed, 25 insertions, 8 deletions
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 */