aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsvnadmin <svnadmin@f88db872-0e4f-0410-b76b-b9085cfa78c5>2008-06-26 13:51:26 +0000
committersvnadmin <svnadmin@f88db872-0e4f-0410-b76b-b9085cfa78c5>2008-06-26 13:51:26 +0000
commit9716af1598ddfd2ab8ee7198b35cca1df312c4fd (patch)
tree5f903e795434362f0360ee2e3e65a27e6c6601c3 /src
parent8cb0df53b3d5d615624b9bffdcc11cf13905cfc0 (diff)
Make "Erik" branch the default trunk for AHFinderDirect.
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1526 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r--src/CODESTYLE57
-rw-r--r--src/README6
-rw-r--r--src/driver/BH_diagnostics.cc521
-rw-r--r--src/driver/BH_diagnostics.hh97
-rw-r--r--src/driver/Newton.cc694
-rw-r--r--src/driver/README36
-rw-r--r--src/driver/README.parallel8
-rw-r--r--src/driver/aliased_functions.cc122
-rw-r--r--src/driver/announce.cc119
-rw-r--r--src/driver/driver.hh99
-rw-r--r--src/driver/find_horizons.cc258
-rw-r--r--src/driver/horizon_sequence.cc14
-rw-r--r--src/driver/initial_guess.cc5
-rw-r--r--src/driver/io.cc249
-rw-r--r--src/driver/make.code.defn16
-rw-r--r--src/driver/mask.cc23
-rw-r--r--src/driver/misc-driver.cc3
-rw-r--r--src/driver/setup.cc392
-rw-r--r--src/driver/spherical_surface.cc264
-rw-r--r--src/driver/state.cc3
-rw-r--r--src/elliptic/Jacobian.cc3
-rw-r--r--src/elliptic/Jacobian.hh2
-rw-r--r--src/elliptic/dense_Jacobian.cc3
-rw-r--r--src/elliptic/make.code.defn14
-rw-r--r--src/elliptic/row_sparse_Jacobian.cc5
-rw-r--r--src/gr.cg/expansion.c349
-rw-r--r--src/gr.cg/expansion_Jacobian.c1253
-rw-r--r--src/gr/Schwarzschild_EF.cc3
-rw-r--r--src/gr/cg.hh3
-rw-r--r--src/gr/expansion.cc491
-rw-r--r--src/gr/expansion_Jacobian.cc415
-rw-r--r--src/gr/gfns.hh17
-rw-r--r--src/gr/gr.hh75
-rw-r--r--src/gr/gr_gfas.minc6
-rw-r--r--src/gr/horizon.maple34
-rw-r--r--src/gr/make.code.defn9
-rw-r--r--src/gr/maple.log265
-rw-r--r--src/gr/misc-gr.cc1
-rw-r--r--src/gr/setup_gr_gfas.maple7
-rw-r--r--src/include/config.h3
-rw-r--r--src/include/stdc.h15
-rw-r--r--src/jtutil/README6
-rw-r--r--src/jtutil/array.cc67
-rw-r--r--src/jtutil/array.hh21
-rw-r--r--src/jtutil/cpm_map.cc27
-rw-r--r--src/jtutil/cpm_map.hh12
-rw-r--r--src/jtutil/error_exit.cc17
-rw-r--r--src/jtutil/fuzzy.cc33
-rw-r--r--src/jtutil/linear_map.cc36
-rw-r--r--src/jtutil/linear_map.hh12
-rw-r--r--src/jtutil/make.code.defn14
-rw-r--r--src/jtutil/miscfp.cc39
-rw-r--r--src/jtutil/norm.cc31
-rw-r--r--src/jtutil/round.cc26
-rw-r--r--src/jtutil/test_array.cc2
-rw-r--r--src/jtutil/test_array2.cc2
-rw-r--r--src/jtutil/test_cpm_map.cc3
-rw-r--r--src/jtutil/test_error_exit.cc2
-rw-r--r--src/jtutil/test_fuzzy.cc3
-rw-r--r--src/jtutil/test_linear_map.cc3
-rw-r--r--src/jtutil/test_modulo.cc3
-rw-r--r--src/jtutil/test_norm.cc3
-rw-r--r--src/jtutil/test_round.cc2
-rw-r--r--src/jtutil/util.hh5
-rw-r--r--src/maple/Makefile4
-rw-r--r--src/misc/README4
-rwxr-xr-xsrc/misc/select.patch7
-rw-r--r--src/patch/coords.cc80
-rw-r--r--src/patch/coords.hh5
-rw-r--r--src/patch/fd_grid.cc2
-rw-r--r--src/patch/fd_grid.hh2
-rw-r--r--src/patch/ghost_zone.cc2
-rw-r--r--src/patch/ghost_zone.hh3
-rw-r--r--src/patch/make.code.defn14
-rw-r--r--src/patch/patch.cc57
-rw-r--r--src/patch/patch.hh9
-rw-r--r--src/patch/patch_info.cc2
-rw-r--r--src/patch/patch_interp.cc8
-rw-r--r--src/patch/patch_system.cc702
-rw-r--r--src/patch/patch_system.hh119
-rw-r--r--src/patch/test_coords.cc6
-rw-r--r--src/patch/test_coords2.cc6
-rw-r--r--src/patch/test_patch_system.cc2
-rw-r--r--src/sparse-matrix/umfpack/make.code.deps1
84 files changed, 4921 insertions, 2442 deletions
diff --git a/src/CODESTYLE b/src/CODESTYLE
index 1488481..d0233eb 100644
--- a/src/CODESTYLE
+++ b/src/CODESTYLE
@@ -1,6 +1,6 @@
AHFinderDirect Code Style
=========================
-$Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/CODESTYLE,v 1.10 2005-05-02 16:18:25 jthorn Exp $
+$Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/CODESTYLE,v 1.6 2003-08-18 10:01:01 jthorn Exp $
This file documents some general programming conventions used in this
thorn.
@@ -31,38 +31,6 @@ Only a few options are configured at compile-time; these use #defines
in src/include/config.h.
-Variable Names
-==============
-
-Most of the code uses the generic floating-point data type
- typedef CCTK_REAL fp;
-
-The code uses a number of standard variable names, which reference
-data structures in the ./patch/ subdirectory:
- patch_system& ps; // patch_system.{cc,hh}
- patch& p; // patch.{cc,hh}, fd_grid.{cc,hh}, grid.{cc,hh}
- int pn; // 0-origin patch number,
- // cf. patch_system.{cc,hh}
- ghost_zone& gz; // ghost_zone.{cc,hh}
- interpatch_ghost_zone& ipgz; // ghost_zone.{cc,hh}
- symmetry_ghost_zone& sgz; // ghost_zone.{cc,hh}
- int gfn; // small-integer gridfn number, cf. grid.hh
- // and the definitions in ../gr/gfns.hh
- int iwr; // integer gridfn-array indices
- // in the wr (radial) direction
- int irho, isigma; // integer gridfn-array indices
- // in the (rho,sigma) directions
- int iperp, ipar; // integer gridfn-array indices in the
- // (perpendicular,parallel) directions along a
- // given min/max rho/sigma side of a patch,
- // cf. patch_edge.{cc,hh}
- bool want_min, want_rho; // Boolean flags to specify a single min/max
- // rho/sigma side of a patch
-In the ./driver/ subdirectory, the code also uses
- int hn; // horizon number
- // (runs from 1 to N_horizons inclusive)
-
-
Code Layout/Indentation
========================
@@ -75,6 +43,9 @@ so I use
#define then /* empty */
with usage as shown below.
+A lot of the code uses the generic floating-point data type
+ typedef CCTK_REAL fp;
+
Almost (but not quite) all the code fits into 80 columns.
The indentation style is a bit unusual, and is best described by the
@@ -187,23 +158,6 @@ printf()-style printing, eg
}
-C++ Namespaces
-==============
-
-All this thorn's C++ code is in the AHFinderDirect:: C++ namespace.
-Alas, the C and Fortran code under ./sparse-matrix/*/ doesn't enjoy
-such protection. :(
-
-
-C++ Exceptions
-==============
-
-This thorn doesn't explicitly use C++ exceptions: no code in this thorn
-explicitly throws or catches an exception, and no function has an exception
-specification. However, this thorn does use new and new[] , which may
-throw an exception to report out-of-memory.
-
-
Error Handling
==============
@@ -257,8 +211,7 @@ C++ Templates
=============
I use C++ templates, but not for anything fancy, just simple containers.
-I instantiate all templates explicitly. I'm not (yet) using any of the
-STL containers in this thorn.
+I instantiate all templates explicitly.
Some C++ compilers offer "automatic" template instantiation. In practice
this often causes compilation to fail when the compiler can't find .cc
diff --git a/src/README b/src/README
index 3830f6a..d491526 100644
--- a/src/README
+++ b/src/README
@@ -46,12 +46,12 @@ include/ contains common header files which don't live in any other
source directory; all compile-time options for this thorn
are configured here
-All the C++ code in the directories
+All the code in the directories
driver/
gr/
gr.cg/
elliptic/
patch/
-is in namespace AHFinderDirect:: . All the code in the directories
+is in namespace AHFinderDirect. All the code in the directories
jtutil/
-is in namespace AHFinderDirect::jtutil:: .
+is in namespace jtutil.
diff --git a/src/driver/BH_diagnostics.cc b/src/driver/BH_diagnostics.cc
index 125177c..dde7d5c 100644
--- a/src/driver/BH_diagnostics.cc
+++ b/src/driver/BH_diagnostics.cc
@@ -12,15 +12,22 @@
// print - print a line or two summarizing the diagnostics
// setup_output_file - create/open output file, write header describing fields
// output - write a (long) line of all the diagnostics
+// store - copy the surface and the diagnostics into the SphericalSurface
+// variables
+// save - copy the surface and the diagnostics into the Cactus variables
+// load - set the surface and the diagnostics from the Cactus variables
//
#include <stdio.h>
#include <assert.h>
#include <math.h>
+#include <vector>
+
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -28,6 +35,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -50,7 +58,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
@@ -67,17 +74,28 @@ extern struct state state;
// This function initializes a struct BH_diagnostics to all zeros.
//
BH_diagnostics::BH_diagnostics()
- : centroid_x(0.0), centroid_y(0.0), centroid_z(0.0),
- quadrupole_xx(0.0), quadrupole_xy(0.0), quadrupole_xz(0.0),
- quadrupole_yy(0.0), quadrupole_yz(0.0),
- quadrupole_zz(0.0),
- min_radius(0.0), max_radius(0.0),
- mean_radius(0.0),
+ : origin_x(0.0), origin_y(0.0), origin_z(0.0),
+ centroid_x(0.0), centroid_y(0.0), centroid_z(0.0),
+ quadrupole_xx(0.0), quadrupole_xy(0.0), quadrupole_xz(0.0),
+ quadrupole_yy(0.0), quadrupole_yz(0.0), quadrupole_zz(0.0),
+ min_radius(0.0), max_radius(0.0), mean_radius(0.0),
min_x(0.0), max_x(0.0),
min_y(0.0), max_y(0.0),
min_z(0.0), max_z(0.0),
circumference_xy(0.0), circumference_xz(0.0), circumference_yz(0.0),
- area(0.0), irreducible_mass(0.0), areal_radius(0.0) // no comma
+ area(1.0),
+ expansion(0.0),
+ inner_expansion(0.0),
+ product_expansion(0.0),
+ mean_curvature(0.0),
+ area_gradient(0.0),
+ expansion_gradient(0.0),
+ inner_expansion_gradient(0.0),
+ product_expansion_gradient(0.0),
+ mean_curvature_gradient(0.0),
+ mean_curvature_minimum(0.0),
+ mean_curvature_maximum(0.0),
+ mean_curvature_integral(0.0)
{ }
//******************************************************************************
@@ -90,6 +108,10 @@ BH_diagnostics::BH_diagnostics()
void BH_diagnostics::copy_to_buffer(CCTK_REAL buffer[N_buffer])
const
{
+buffer[posn__origin_x] = this->origin_x;
+buffer[posn__origin_y] = this->origin_y;
+buffer[posn__origin_z] = this->origin_z;
+
buffer[posn__centroid_x] = centroid_x;
buffer[posn__centroid_y] = centroid_y;
buffer[posn__centroid_z] = centroid_z;
@@ -112,13 +134,24 @@ buffer[posn__max_y] = max_y;
buffer[posn__min_z] = min_z;
buffer[posn__max_z] = max_z;
-buffer[posn__circumference_xy] = circumference_xy;
-buffer[posn__circumference_xz] = circumference_xz;
-buffer[posn__circumference_yz] = circumference_yz;
-
-buffer[posn__area] = area;
-buffer[posn__irreducible_mass] = irreducible_mass;
-buffer[posn__areal_radius] = areal_radius;
+buffer[posn__circumference_xy] = circumference_xy;
+buffer[posn__circumference_xz] = circumference_xz;
+buffer[posn__circumference_yz] = circumference_yz;
+buffer[posn__area] = area;
+buffer[posn__expansion] = expansion;
+buffer[posn__inner_expansion] = inner_expansion;
+buffer[posn__product_expansion] = product_expansion;
+buffer[posn__mean_curvature] = mean_curvature;
+
+buffer[posn__area_gradient] = area_gradient;
+buffer[posn__expansion_gradient] = expansion_gradient;
+buffer[posn__inner_expansion_gradient] = inner_expansion_gradient;
+buffer[posn__product_expansion_gradient] = product_expansion_gradient;
+buffer[posn__mean_curvature_gradient] = mean_curvature_gradient;
+
+buffer[posn__mean_curvature_minimum] = mean_curvature_minimum;
+buffer[posn__mean_curvature_maximum] = mean_curvature_maximum;
+buffer[posn__mean_curvature_integral] = mean_curvature_integral;
}
//******************************************************************************
@@ -128,6 +161,10 @@ buffer[posn__areal_radius] = areal_radius;
//
void BH_diagnostics::copy_from_buffer(const CCTK_REAL buffer[N_buffer])
{
+this->origin_x = buffer[posn__origin_x];
+this->origin_y = buffer[posn__origin_y];
+this->origin_z = buffer[posn__origin_z];
+
centroid_x = buffer[posn__centroid_x];
centroid_y = buffer[posn__centroid_y];
centroid_z = buffer[posn__centroid_z];
@@ -150,13 +187,24 @@ max_y = buffer[posn__max_y];
min_z = buffer[posn__min_z];
max_z = buffer[posn__max_z];
-circumference_xy = buffer[posn__circumference_xy];
-circumference_xz = buffer[posn__circumference_xz];
-circumference_yz = buffer[posn__circumference_yz];
-
- area = buffer[posn__area];
- irreducible_mass = buffer[posn__irreducible_mass];
- areal_radius = buffer[posn__areal_radius];
+ circumference_xy = buffer[posn__circumference_xy];
+ circumference_xz = buffer[posn__circumference_xz];
+ circumference_yz = buffer[posn__circumference_yz];
+ area = buffer[posn__area];
+ expansion = buffer[posn__expansion];
+ inner_expansion = buffer[posn__inner_expansion];
+product_expansion = buffer[posn__product_expansion];
+ mean_curvature = buffer[posn__mean_curvature];
+
+ area_gradient = buffer[posn__area_gradient];
+ expansion_gradient = buffer[posn__expansion_gradient];
+ inner_expansion_gradient = buffer[posn__inner_expansion_gradient];
+product_expansion_gradient = buffer[posn__product_expansion_gradient];
+ mean_curvature_gradient = buffer[posn__mean_curvature_gradient];
+
+ mean_curvature_minimum = buffer[posn__mean_curvature_minimum];
+ mean_curvature_maximum = buffer[posn__mean_curvature_maximum];
+ mean_curvature_integral = buffer[posn__mean_curvature_integral];
}
//******************************************************************************
@@ -165,13 +213,12 @@ circumference_yz = buffer[posn__circumference_yz];
//
// Given that an apparent horizon has been found, this function computes
-// the black hole diagnostics.
+// various black hole diagnostics.
//
// Inputs (gridfns)
-// h # ghosted
-// one # nominal
-// global_[xyz] # nominal
-// global_{xx,xy,xz,yy,yz,zz} # nominal
+// h # ghosted
+// one # nominal
+// global_[xyz] # nominal
//
// Bugs:
// The computation is rather inefficient -- we make many passes over the
@@ -179,6 +226,16 @@ circumference_yz = buffer[posn__circumference_yz];
//
void BH_diagnostics::compute
(const patch_system& ps,
+ const fp the_area,
+ const fp mean_expansion,
+ const fp mean_inner_expansion,
+ const fp mean_product_expansion,
+ const fp mean_mean_curvature,
+ const fp the_area_gradient,
+ const fp mean_expansion_gradient,
+ const fp mean_inner_expansion_gradient,
+ const fp mean_product_expansion_gradient,
+ const fp mean_mean_curvature_gradient,
const struct BH_diagnostics_info& BH_diagnostics_info)
{
//
@@ -194,19 +251,20 @@ max_radius = h_norms.max_abs_value();
// xyz bounding box of horizon
//
-// compute bounding box of nominal grid (for stored part of the horizon only)
+// compute bounding box of nominal grid
+// ... this is only the stored part of the horizon if there are symmetries
jtutil::norm<fp> x_norms;
-jtutil::norm<fp> y_norms;
-jtutil::norm<fp> z_norms;
-
ps.gridfn_norms(gfns::gfn__global_x, x_norms);
-ps.gridfn_norms(gfns::gfn__global_y, y_norms);
-ps.gridfn_norms(gfns::gfn__global_z, z_norms);
-
min_x = x_norms.min_value();
max_x = x_norms.max_value();
+
+jtutil::norm<fp> y_norms;
+ps.gridfn_norms(gfns::gfn__global_y, y_norms);
min_y = y_norms.min_value();
max_y = y_norms.max_value();
+
+jtutil::norm<fp> z_norms;
+ps.gridfn_norms(gfns::gfn__global_z, z_norms);
min_z = z_norms.min_value();
max_z = z_norms.max_value();
@@ -262,23 +320,31 @@ const fp integral_z = surface_integral(ps,
gfns::gfn__global_z, false, true, true,
BH_diagnostics_info.integral_method);
const fp integral_xx = surface_integral(ps,
- gfns::gfn__global_xx, true, true, true,
- BH_diagnostics_info.integral_method);
+ gfns::gfn__global_xx, true, true, true,
+ BH_diagnostics_info.integral_method);
const fp integral_xy = surface_integral(ps,
- gfns::gfn__global_xy, true, false, false,
- BH_diagnostics_info.integral_method);
+ gfns::gfn__global_xy, true, false, false,
+ BH_diagnostics_info.integral_method);
const fp integral_xz = surface_integral(ps,
- gfns::gfn__global_xz, false, true, false,
- BH_diagnostics_info.integral_method);
+ gfns::gfn__global_xz, false, true, false,
+ BH_diagnostics_info.integral_method);
const fp integral_yy = surface_integral(ps,
- gfns::gfn__global_yy, true, true, true,
- BH_diagnostics_info.integral_method);
+ gfns::gfn__global_yy, true, true, true,
+ BH_diagnostics_info.integral_method);
const fp integral_yz = surface_integral(ps,
- gfns::gfn__global_yz, false, false, true,
- BH_diagnostics_info.integral_method);
+ gfns::gfn__global_yz, false, false, true,
+ BH_diagnostics_info.integral_method);
const fp integral_zz = surface_integral(ps,
- gfns::gfn__global_zz, true, true, true,
- BH_diagnostics_info.integral_method);
+ gfns::gfn__global_zz, true, true, true,
+ BH_diagnostics_info.integral_method);
+
+
+//
+// originds
+//
+this->origin_x = ps.origin_x();
+this->origin_y = ps.origin_y();
+this->origin_z = ps.origin_z();
//
@@ -290,32 +356,52 @@ centroid_z = integral_z / integral_one;
//
-// quadrupoles (taken about centroid position)
+// quadrupoles
//
-quadrupole_xx = integral_xx / integral_one - centroid_x * centroid_x;
-quadrupole_xy = integral_xy / integral_one - centroid_x * centroid_y;
-quadrupole_xz = integral_xz / integral_one - centroid_x * centroid_z;
-quadrupole_yy = integral_yy / integral_one - centroid_y * centroid_y;
-quadrupole_yz = integral_yz / integral_one - centroid_y * centroid_z;
-quadrupole_zz = integral_zz / integral_one - centroid_z * centroid_z;
+quadrupole_xx = integral_xx / integral_one;
+quadrupole_xy = integral_xy / integral_one;
+quadrupole_xz = integral_xz / integral_one;
+quadrupole_yy = integral_yy / integral_one;
+quadrupole_yz = integral_yz / integral_one;
+quadrupole_zz = integral_zz / integral_one;
//
-// mean radius of horizon
+// area, mean radius, and mass
//
mean_radius = integral_h / integral_one;
//
-// surface area and quantities derived from it
+// expansion
+//
+area = the_area;
+expansion = mean_expansion;
+inner_expansion = mean_inner_expansion;
+product_expansion = mean_product_expansion;
+mean_curvature = mean_mean_curvature;
+
+area_gradient = the_area_gradient;
+expansion_gradient = mean_expansion_gradient;
+inner_expansion_gradient = mean_inner_expansion_gradient;
+product_expansion_gradient = mean_product_expansion_gradient;
+mean_curvature_gradient = mean_mean_curvature_gradient;
+
+//
+// minimum, maximum and the integral of the mean curvature
//
-area = integral_one;
-irreducible_mass = sqrt(area / (16.0*PI));
-areal_radius = sqrt(area / ( 4.0*PI));
+jtutil::norm<fp> mean_curvature_norms;
+ps.gridfn_norms(gfns::gfn__mean_curvature, mean_curvature_norms);
+mean_curvature_minimum = mean_curvature_norms.min_value();
+mean_curvature_maximum = mean_curvature_norms.max_value();
+mean_curvature_integral = surface_integral(ps,
+ gfns::gfn__mean_curvature,
+ true, true, true,
+ BH_diagnostics_info.integral_method);
//
-// proper circumferences
+// circumferences
//
circumference_xy
= ps.circumference("xy", gfns::gfn__h,
@@ -373,15 +459,16 @@ return ps.integrate_gridfn
void BH_diagnostics::print(int N_horizons, int hn)
const
{
+const fp m_irreducible = sqrt(area / (16*PI));
CCTK_VInfo(CCTK_THORNSTRING,
"AH %d/%d: r=%g at (%f,%f,%f)",
hn, N_horizons,
double(mean_radius),
double(centroid_x), double(centroid_y), double(centroid_z));
CCTK_VInfo(CCTK_THORNSTRING,
- "AH %d/%d: area=%.10g irreducible_mass=%.10g",
+ "AH %d/%d: area=%.10g m_irreducible=%.10g",
hn, N_horizons,
- double(area), double(irreducible_mass));
+ double(area), double(m_irreducible));
}
//******************************************************************************
@@ -419,10 +506,13 @@ snprintf(file_name_buffer, IO_info::file_name_buffer_size,
directory, IO_info.BH_diagnostics_base_file_name,
hn, IO_info.BH_diagnostics_file_name_extension);
-const char *const file_open_mode = IO_TruncateOutputFiles(state.cgi.GH)
- ? "w" : "a";
+const char *openMode;
+if (IO_TruncateOutputFiles(state.cgi.GH) == 1)
+ openMode = "w";
+else
+ openMode = "a";
-FILE *fileptr = fopen(file_name_buffer, file_open_mode);
+FILE *fileptr = fopen(file_name_buffer, openMode);
if (fileptr == NULL)
then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
"\n"
@@ -460,17 +550,20 @@ fprintf(fileptr, "# column 23 = yz-plane circumference\n");
fprintf(fileptr, "# column 24 = ratio of xz/xy-plane circumferences\n");
fprintf(fileptr, "# column 25 = ratio of yz/xy-plane circumferences\n");
fprintf(fileptr, "# column 26 = area\n");
-fprintf(fileptr, "# column 27 = irreducible mass\n");
+fprintf(fileptr, "# column 27 = m_irreducible\n");
fprintf(fileptr, "# column 28 = areal radius\n");
-fprintf(fileptr, "# column 29 = [not implemented yet] (outer) expansion Theta_(l)\n");
-fprintf(fileptr, "# column 30 = [not implemented yet] inner expansion Theta_(n)\n");
-fprintf(fileptr, "# column 31 = [not implemented yet] product of inner and outer expansions\n");
-fprintf(fileptr, "# column 32 = [not implemented yet] mean curvature\n");
-fprintf(fileptr, "# column 33 = [not implemented yet] d/d(coordinate radius) of area\n");
-fprintf(fileptr, "# column 34 = [not implemented yet] d/d(coordinate radius) of (outer) expansion Theta_(l)\n");
-fprintf(fileptr, "# column 35 = [not implemented yet] d/d(coordinate radius) of inner expansion Theta_(n)\n");
-fprintf(fileptr, "# column 36 = [not implemented yet] d/d(coordinate radius) of product of inner and outer expansions\n");
-fprintf(fileptr, "# column 37 = [not implemented yet] d/d(coordinate radius) of mean curvature\n");
+fprintf(fileptr, "# column 29 = expansion Theta_(l)\n");
+fprintf(fileptr, "# column 30 = inner expansion Theta_(n)\n");
+fprintf(fileptr, "# column 31 = product of the expansions\n");
+fprintf(fileptr, "# column 32 = mean curvature\n");
+fprintf(fileptr, "# column 33 = gradient of the areal radius\n");
+fprintf(fileptr, "# column 34 = gradient of the expansion Theta_(l)\n");
+fprintf(fileptr, "# column 35 = gradient of the inner expansion Theta_(n)\n");
+fprintf(fileptr, "# column 36 = gradient of the product of the expansions\n");
+fprintf(fileptr, "# column 37 = gradient of the mean curvature\n");
+fprintf(fileptr, "# column 38 = minimum of the mean curvature\n");
+fprintf(fileptr, "# column 39 = maximum of the mean curvature\n");
+fprintf(fileptr, "# column 40 = integral of the mean curvature\n");
fflush(fileptr);
return fileptr;
@@ -493,22 +586,25 @@ void BH_diagnostics::output(FILE*fileptr, const struct IO_info& IO_info)
assert(fileptr != NULL);
fprintf(fileptr,
- // cctk_iteration min radius mean radius
- // == cctk_time ====== max radius
- // == == centroid_[xyz] ====== ======
- // == == ========== ====== ====== ======
- "%d\t%f\t%f\t%f\t%f\t%#.10g\t%#.10g\t%#.10g\t",
+ // cctk_iteration min radius mean radius
+ // == cctk_time ====== max radius
+ // == ==== centroid_[xyz] ====== ======
+ // == ==== ========== ====== ====== ======
+ "%d\t%.3f\t%f\t%f\t%f\t%#.10g\t%#.10g\t%#.10g\t",
IO_info.time_iteration, double(IO_info.time),
double(centroid_x), double(centroid_y), double(centroid_z),
double(min_radius), double(max_radius), double(mean_radius));
fprintf(fileptr,
// quadrupole_{xx,xy,xz,yy,yz,zz}
- // ====== ====== ====== ====== ====== ======
+ // ================================================
"%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t",
- double(quadrupole_xx), double(quadrupole_xy), double(quadrupole_xz),
- double(quadrupole_yy), double(quadrupole_yz),
- double(quadrupole_zz));
+ double(quadrupole_xx - centroid_x*centroid_x),
+ double(quadrupole_xy - centroid_x*centroid_y),
+ double(quadrupole_xz - centroid_x*centroid_z),
+ double(quadrupole_yy - centroid_y*centroid_y),
+ double(quadrupole_yz - centroid_y*centroid_z),
+ double(quadrupole_zz - centroid_z*centroid_z));
fprintf(fileptr,
// {min,max}_x {min,max}_y {min,max}_z
@@ -530,35 +626,248 @@ fprintf(fileptr,
double(circumference_xz / circumference_xy),
double(circumference_yz / circumference_xy));
+const fp m_irreducible = sqrt(area / (16*PI));;
+const fp areal_radius = sqrt(area / (4*PI));
+const fp areal_radius_gradient = sqrt(1 / (16*PI*area)) * area_gradient;
fprintf(fileptr,
- // area areal_radius
- // ====== irreducible_mass
- // ====== ====== ======
- "%#.10g\t%#.10g\t%#.10g\t",
- double(area), double(irreducible_mass), double(areal_radius));
-
-// these diagnostics aren't implemented yet :(
-fprintf(fileptr,
- // expansion product_expansion
- // ====== inner_expansion
- // ====== ====== ====== mean_curvature
- // ====== ====== ====== ======
- "%#.10g\t%#.10g\t%#.10g\t%#.10g\t",
- 0.0, 0.0, 0.0, 0.0);
-
-// these diagnostics aren't implemented yet :(
-fprintf(fileptr,
- // dr_area dr_inner_expansion
- // ====== dr_expansion dr_product_expansion
- // ====== ====== ====== ====== dr_mean_curvature
- // ====== ====== ====== ====== ======
- "%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\n",
- 0.0, 0.0, 0.0, 0.0, 0.0);
+ // area m_irre- areal expan- inner prod. mean areal expan- inner prod. mean mean mean mean
+ // ducible radius sion expan- of the curva- radius sion expan- of the curva- curva- curva- curva-
+ // sion expan- ture grad. grad. sion exp.s ture ture ture ture
+ // sions grad. grad. grad. min. max. integ.
+ // ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ======
+ //
+ // ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ====== ======
+ "%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\t%#.10g\n",
+ double(area), double(m_irreducible), double(areal_radius),
+ double(expansion), double(inner_expansion), double(product_expansion), double(mean_curvature),
+ double(areal_radius_gradient),
+ double(expansion_gradient), double(inner_expansion_gradient), double(product_expansion_gradient), double(mean_curvature_gradient),
+ double(mean_curvature_minimum), double(mean_curvature_maximum), double(mean_curvature_integral));
fflush(fileptr);
}
//******************************************************************************
+
+//
+// This function copies the BH-diagnostics into the SphericalSurface variables.
+//
+// Arguments:
+// CCTK_ARGUMENTS
+//
+void BH_diagnostics::store(CCTK_ARGUMENTS,
+ const int horizon_number, const int surface_number)
+ const
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ assert (surface_number >= 0 && surface_number < nsurfaces);
+
+ assert(state.AH_data_array[horizon_number] != NULL);
+ const struct AH_data& AH_data = *state.AH_data_array[horizon_number];
+
+ // tell the world if we don't look for this horizon any more
+ const int my_dont_find_after = dont_find_after_individual[horizon_number];
+ const fp my_find_after_time = find_after_individual_time[horizon_number];
+ const fp my_dont_find_after_time = dont_find_after_individual_time[horizon_number];
+ if ((my_dont_find_after >= 0 and cctk_iteration > my_dont_find_after) or
+ (my_dont_find_after_time > my_find_after_time and cctk_time > my_dont_find_after_time))
+ {
+ assert (! AH_data.search_flag);
+ sf_active[surface_number] = 0;
+ }
+
+ // only try to copy AH info if we've found AHs at this time level
+ if (! AH_data.search_flag) {
+ sf_valid[surface_number] = 0;
+ return;
+ }
+
+ // did we actually *find* this horizon?
+ if (! AH_data.found_flag) {
+ sf_valid[surface_number] = -1;
+ return;
+ }
+
+ sf_active [surface_number] = 1;
+ sf_valid [surface_number] = 1;
+ sf_origin_x [surface_number] = this->origin_x;
+ sf_origin_y [surface_number] = this->origin_y;
+ sf_origin_z [surface_number] = this->origin_z;
+ sf_mean_radius [surface_number] = mean_radius;
+ sf_min_radius [surface_number] = min_radius;
+ sf_max_radius [surface_number] = max_radius;
+ sf_centroid_x [surface_number] = centroid_x;
+ sf_centroid_y [surface_number] = centroid_y;
+ sf_centroid_z [surface_number] = centroid_z;
+ sf_quadrupole_xx[surface_number] = quadrupole_xx - centroid_x*centroid_x;
+ sf_quadrupole_xy[surface_number] = quadrupole_xy - centroid_x*centroid_y;
+ sf_quadrupole_xz[surface_number] = quadrupole_xz - centroid_x*centroid_z;
+ sf_quadrupole_yy[surface_number] = quadrupole_yy - centroid_y*centroid_y;
+ sf_quadrupole_yz[surface_number] = quadrupole_yz - centroid_y*centroid_z;
+ sf_quadrupole_zz[surface_number] = quadrupole_zz - centroid_z*centroid_z;
+ sf_min_x [surface_number] = min_x;
+ sf_max_x [surface_number] = max_x;
+ sf_min_y [surface_number] = min_y;
+ sf_max_y [surface_number] = max_y;
+ sf_min_z [surface_number] = min_z;
+ sf_max_z [surface_number] = max_z;
+ sf_area [surface_number] = area;
+
+ std::vector<CCTK_REAL> xx, yy, zz, rr;
+ xx.resize (sf_ntheta[surface_number] * sf_nphi[surface_number]);
+ yy.resize (sf_ntheta[surface_number] * sf_nphi[surface_number]);
+ zz.resize (sf_ntheta[surface_number] * sf_nphi[surface_number]);
+ rr.resize (sf_ntheta[surface_number] * sf_nphi[surface_number]);
+ size_t n;
+ n = 0;
+ for (int j=0; j<sf_nphi[surface_number]; ++j) {
+ for (int i=0; i<sf_ntheta[surface_number]; ++i) {
+ const CCTK_REAL theta
+ = sf_origin_theta[surface_number] + i * sf_delta_theta[surface_number];
+ const CCTK_REAL phi
+ = sf_origin_phi[surface_number] + j * sf_delta_phi[surface_number];
+ xx[n] = sf_origin_x[surface_number] + sin(theta) * cos(phi);
+ yy[n] = sf_origin_y[surface_number] + sin(theta) * sin(phi);
+ zz[n] = sf_origin_z[surface_number] + cos(theta);
+ ++n;
+ }
+ }
+ AHFinderDirect_radius_in_direction
+ (horizon_number, sf_ntheta[surface_number] * sf_nphi[surface_number],
+ &xx[0], &yy[0], &zz[0], &rr[0]);
+ n = 0;
+ for (int j=0; j<sf_nphi[surface_number]; ++j) {
+ for (int i=0; i<sf_ntheta[surface_number]; ++i) {
+ sf_radius[i + maxntheta * (j + maxnphi * surface_number)] = rr[n];
+ ++n;
+ }
+ }
+}
+
+//******************************************************************************
+
+//
+// This function copies the BH-diagnostics into the Cactus variables.
+//
+// Arguments:
+// CCTK_ARGUMENTS
+//
+void BH_diagnostics::save(CCTK_ARGUMENTS,
+ const int horizon_number)
+ const
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ assert(state.AH_data_array[horizon_number] != NULL);
+ const struct verbose_info& verbose_info = state.verbose_info;
+ const struct AH_data& AH_data = *state.AH_data_array[horizon_number];
+ patch_system& ps = *AH_data.ps_ptr;
+
+ if (AH_data.search_flag &&
+ AH_data.found_flag &&
+ cctk_iteration > ah_centroid_iteration[horizon_number-1])
+ {
+ ah_centroid_x_p[horizon_number-1] = ah_centroid_x[horizon_number-1];
+ ah_centroid_y_p[horizon_number-1] = ah_centroid_y[horizon_number-1];
+ ah_centroid_z_p[horizon_number-1] = ah_centroid_z[horizon_number-1];
+ ah_centroid_t_p[horizon_number-1] = ah_centroid_t[horizon_number-1];
+ ah_centroid_valid_p[horizon_number-1] = ah_centroid_valid[horizon_number-1];
+ ah_centroid_iteration_p[horizon_number-1] =
+ ah_centroid_iteration[horizon_number-1];
+
+ ah_centroid_x[horizon_number-1] = centroid_x;
+ ah_centroid_y[horizon_number-1] = centroid_y;
+ ah_centroid_z[horizon_number-1] = centroid_z;
+ ah_centroid_t[horizon_number-1] = cctk_time;
+ ah_centroid_valid[horizon_number-1] = AH_data.found_flag;
+ ah_centroid_iteration[horizon_number-1] = cctk_iteration;
+ }
+
+ ah_origin_x[horizon_number-1] = ps.origin_x();
+ ah_origin_y[horizon_number-1] = ps.origin_y();
+ ah_origin_z[horizon_number-1] = ps.origin_z();
+
+ for (int pn = 0; pn < ps.N_patches(); ++pn) {
+ assert (pn < 6);
+ patch& p = ps.ith_patch(pn);
+ for (int i = 0, irho = p.min_irho(); irho <= p.max_irho(); ++i, ++irho) {
+ assert (i <= max_N_zones_per_right_angle);
+ for (int j = 0, isigma = p.min_isigma(); isigma <= p.max_isigma(); ++j, ++isigma) {
+ assert (j <= max_N_zones_per_right_angle);
+ ah_radius[i + (max_N_zones_per_right_angle+1) * (j + (max_N_zones_per_right_angle+1) * (pn + 6 * (horizon_number-1)))]
+ = p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
+ }
+ }
+ }
+
+ ah_initial_find_flag [horizon_number-1] = AH_data.initial_find_flag;
+ ah_really_initial_find_flag[horizon_number-1] = AH_data.really_initial_find_flag;
+ ah_search_flag [horizon_number-1] = AH_data.search_flag;
+ ah_found_flag [horizon_number-1] = AH_data.found_flag;
+ if (verbose_info.print_algorithm_highlights) {
+ printf ("AHF BH_diagnostics::save[%d] initial_find_flag=%d\n", horizon_number, (int) AH_data.initial_find_flag);
+ printf ("AHF BH_diagnostics::save[%d] really_initial_find_flag=%d\n", horizon_number, (int) AH_data.really_initial_find_flag);
+ printf ("AHF BH_diagnostics::save[%d] search_flag=%d\n", horizon_number, (int) AH_data.search_flag);
+ printf ("AHF BH_diagnostics::save[%d] found_flag=%d\n", horizon_number, (int) AH_data.found_flag);
+ }
+}
+
+//******************************************************************************
+
+//
+// This function copies the BH-diagnostics from the Cactus variables.
+//
+// Arguments:
+// CCTK_ARGUMENTS
+//
+void BH_diagnostics::load(CCTK_ARGUMENTS,
+ const int horizon_number)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ assert(state.AH_data_array[horizon_number] != NULL);
+ const struct verbose_info& verbose_info = state.verbose_info;
+ struct AH_data& AH_data = *state.AH_data_array[horizon_number];
+ patch_system& ps = *AH_data.ps_ptr;
+
+ ps.origin_x(ah_origin_x[horizon_number-1]);
+ ps.origin_y(ah_origin_y[horizon_number-1]);
+ ps.origin_z(ah_origin_z[horizon_number-1]);
+
+ for (int pn = 0; pn < ps.N_patches(); ++pn) {
+ assert (pn < 6);
+ patch& p = ps.ith_patch(pn);
+ for (int i = 0, irho = p.min_irho(); irho <= p.max_irho(); ++i, ++irho) {
+ assert (i <= max_N_zones_per_right_angle);
+ for (int j = 0, isigma = p.min_isigma(); isigma <= p.max_isigma(); ++j, ++isigma) {
+ assert (j <= max_N_zones_per_right_angle);
+ p.ghosted_gridfn(gfns::gfn__h, irho,isigma) =
+ ah_radius[i + (max_N_zones_per_right_angle+1) * (j + (max_N_zones_per_right_angle+1) * (pn + 6 * (horizon_number-1)))];
+ }
+ }
+ }
+
+ // recover the full ghosted-grid horizon shape
+ // (we only save and load the nominal-grid shape)
+ ps.synchronize();
+
+ AH_data.initial_find_flag = ah_initial_find_flag [horizon_number-1];
+ AH_data.really_initial_find_flag = ah_really_initial_find_flag[horizon_number-1];
+ AH_data.search_flag = ah_search_flag [horizon_number-1];
+ AH_data.found_flag = ah_found_flag [horizon_number-1];
+ if (verbose_info.print_algorithm_highlights) {
+ printf ("AHF BH_diagnostics::load[%d] initial_find_flag=%d\n", horizon_number, (int) AH_data.initial_find_flag);
+ printf ("AHF BH_diagnostics::load[%d] really_initial_find_flag=%d\n", horizon_number, (int) AH_data.really_initial_find_flag);
+ printf ("AHF BH_diagnostics::load[%d] search_flag=%d\n", horizon_number, (int) AH_data.search_flag);
+ printf ("AHF BH_diagnostics::load[%d] found_flag=%d\n", horizon_number, (int) AH_data.found_flag);
+ }
+}
+
+//******************************************************************************
//******************************************************************************
//******************************************************************************
diff --git a/src/driver/BH_diagnostics.hh b/src/driver/BH_diagnostics.hh
index 0d368e8..6698b05 100644
--- a/src/driver/BH_diagnostics.hh
+++ b/src/driver/BH_diagnostics.hh
@@ -4,7 +4,7 @@
//
// prerequisites:
// <stdio.h>
-// "cctk.h"
+// "cctk_Arguments.h"
//
// everything in this file is inside this namespace
@@ -31,57 +31,63 @@ struct BH_diagnostics_info
// Note that all the diagnostics are for the full apparent horizon, even
// if we don't actually store all of it due to patch-system symmetries.
//
-// All the "mean" quantities are computed via surface integrals using the
-// induced metric on the surface.
-//
struct BH_diagnostics
{
public:
- // mean x,y,z
+ fp origin_x, origin_y, origin_z;
fp centroid_x, centroid_y, centroid_z;
-
- // these are quadrupole moments about the centroid, i.e.
- // mean(xi*xj) - centroid_i*centroid_j
- fp quadrupole_xx, quadrupole_xy, quadrupole_xz,
- quadrupole_yy, quadrupole_yz,
- quadrupole_zz;
-
- // min,max,mean surface radius about local coordinate origin
+ fp quadrupole_xx, quadrupole_xy, quadrupole_xz;
+ fp quadrupole_yy, quadrupole_yz, quadrupole_zz;
fp min_radius, max_radius, mean_radius;
// xyz bounding box
- fp min_x, max_x,
- min_y, max_y,
- min_z, max_z;
-
- // proper circumference
- // (computed using induced metric along these local-coordinate planes)
- fp circumference_xy,
- circumference_xz,
- circumference_yz;
-
- // surface area (computed using induced metric)
- // and quantities derived from it
- fp area, irreducible_mass, areal_radius;
+ fp min_x, max_x, min_y, max_y, min_z, max_z;
+
+ fp circumference_xy, circumference_xz, circumference_yz;
+ fp area;
+ fp expansion;
+ fp inner_expansion;
+ fp product_expansion;
+ fp mean_curvature;
+
+ fp area_gradient;
+ fp expansion_gradient;
+ fp inner_expansion_gradient;
+ fp product_expansion_gradient;
+ fp mean_curvature_gradient;
+ fp mean_curvature_minimum;
+ fp mean_curvature_maximum;
+ fp mean_curvature_integral;
public:
// position of diagnostics in buffer and number of diagnostics
enum {
- posn__centroid_x = 0, posn__centroid_y, posn__centroid_z,
- posn__quadrupole_xx, posn__quadrupole_xy, posn__quadrupole_xz,
- posn__quadrupole_yy, posn__quadrupole_yz,
- posn__quadrupole_zz,
+ posn__origin_x = 0, posn__origin_y, posn__origin_z,
+ posn__centroid_x, posn__centroid_y, posn__centroid_z,
+ posn__quadrupole_xx, posn__quadrupole_xy, posn__quadrupole_xz,
+ posn__quadrupole_yy, posn__quadrupole_yz, posn__quadrupole_zz,
posn__min_radius, posn__max_radius, posn__mean_radius,
posn__min_x, posn__max_x,
posn__min_y, posn__max_y,
posn__min_z, posn__max_z,
- posn__circumference_xy,
- posn__circumference_xz,
- posn__circumference_yz,
-
- posn__area, posn__irreducible_mass, posn__areal_radius,
+ posn__circumference_xy, posn__circumference_xz,
+ posn__circumference_yz,
+ posn__area,
+ posn__expansion,
+ posn__inner_expansion,
+ posn__product_expansion,
+ posn__mean_curvature,
+
+ posn__area_gradient,
+ posn__expansion_gradient,
+ posn__inner_expansion_gradient,
+ posn__product_expansion_gradient,
+ posn__mean_curvature_gradient,
+ posn__mean_curvature_minimum,
+ posn__mean_curvature_maximum,
+ posn__mean_curvature_integral,
N_buffer // no comma // size of buffer
};
@@ -93,6 +99,16 @@ public:
public:
// compute diagnostics (assuming that apparent horizon has been found)
void compute(const patch_system& ps,
+ const fp area,
+ const fp mean_expansion,
+ const fp mean_inner_expansion,
+ const fp mean_product_expansion,
+ const fp mean_mean_curvature,
+ const fp area_gradient,
+ const fp mean_expansion_gradient,
+ const fp mean_inner_expansion_gradient,
+ const fp mean_product_expansion_gradient,
+ const fp mean_mean_curvature_gradient,
const struct BH_diagnostics_info& BH_diagnostics_info);
// print (CCTK_VInfo()) a line or two summarizing diagnostics
@@ -112,6 +128,17 @@ public:
void output(FILE* fileptr, const struct IO_info& IO_info)
const;
+ // store the diagnostics in the Cactus variables
+ void store(CCTK_ARGUMENTS, int horizon_number, int surface_number)
+ const;
+
+ // save the horizon shape in grid arrays
+ void save(CCTK_ARGUMENTS, int horizon_number)
+ const;
+
+ // load the horizon shape from grid arrays
+ void load(CCTK_ARGUMENTS, int horizon_number);
+
// constructor initializes all diagnostics to 0.0
BH_diagnostics();
diff --git a/src/driver/Newton.cc b/src/driver/Newton.cc
index 2a54d17..62bab31 100644
--- a/src/driver/Newton.cc
+++ b/src/driver/Newton.cc
@@ -10,15 +10,19 @@
/// Newton_step - take the Newton step, scaling it down if it's too large
//
+#include <iostream>
+
#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <float.h>
#include <math.h>
+#include <string.h>
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -26,6 +30,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -48,7 +53,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -67,6 +71,7 @@ bool broadcast_status(const cGH* GH,
struct iteration_status_buffers& isb);
void broadcast_horizon_data(const cGH* GH,
bool broadcast_flag, bool broadcast_horizon_shape,
+ struct AH_data& AH_data,
struct BH_diagnostics& BH_diagnostics,
patch_system& ps,
struct horizon_buffers& horizon_buffers);
@@ -106,22 +111,22 @@ void Newton(const cGH* GH,
const struct verbose_info& verbose_info,
struct iteration_status_buffers& isb)
{
+cGH const * const cctkGH = GH;
+DECLARE_CCTK_ARGUMENTS;
+DECLARE_CCTK_PARAMETERS;
+
const bool my_active_flag = hs.has_genuine_horizons();
-const int N_horizons = hs.N_horizons();
// print out which horizons we're finding on this processor
-if (verbose_info.print_physics_details)
- then {
- if (hs.has_genuine_horizons())
- then CCTK_VInfo(CCTK_THORNSTRING,
- "proc %d: searching for horizon%s %s/%d",
- my_proc,
- (hs.my_N_horizons() > 1 ? "s" : ""),
- hs.sequence_string(","), N_horizons);
- else CCTK_VInfo(CCTK_THORNSTRING,
- "proc %d: dummy horizon(s) only",
- my_proc);
- }
+if (hs.has_genuine_horizons())
+ then CCTK_VInfo(CCTK_THORNSTRING,
+ "proc %d: searching for horizon%s %s/%d",
+ my_proc,
+ (hs.my_N_horizons() > 1 ? "s" : ""),
+ hs.sequence_string(","), N_horizons);
+ else CCTK_VInfo(CCTK_THORNSTRING,
+ "proc %d: dummy horizon(s) only",
+ my_proc);
//
// each pass through this loop finds a single horizon,
@@ -138,7 +143,10 @@ if (verbose_info.print_physics_details)
"Newton_solve(): processor %d working on horizon %d",
my_proc, hn);
- const bool horizon_is_genuine = hs.is_genuine();
+ // only try to find horizons every find_every time steps
+ const bool horizon_is_genuine =
+ hs.is_genuine() && AH_data_array[hn]->search_flag;
+ // this is only a pessimistic approximation
const bool there_is_another_genuine_horizon = hs.is_next_genuine();
if (verbose_info.print_algorithm_details)
then {
@@ -152,12 +160,262 @@ if (verbose_info.print_physics_details)
struct AH_data* AH_data_ptr
= horizon_is_genuine ? AH_data_array[hn] : NULL;
+
patch_system* const ps_ptr = horizon_is_genuine
? AH_data_ptr->ps_ptr : NULL;
Jacobian* const Jac_ptr = horizon_is_genuine
? AH_data_ptr->Jac_ptr: NULL;
- const fp add_to_expansion = horizon_is_genuine
- ? -AH_data_ptr->surface_expansion : 0.0;
+
+ if (horizon_is_genuine) {
+ // deal with dependent horizons
+ if (AH_data_ptr->depends_on > 0) {
+ assert (AH_data_ptr->depends_on != hn);
+ assert (AH_data_ptr->depends_on < hn);
+ // check that the other horizon is on the same processor!
+ AH_data *AH_other_ptr = AH_data_array[AH_data_ptr->depends_on];
+ assert (AH_other_ptr);
+ AH_data_ptr->compute_info.desired_value
+ = AH_other_ptr->compute_info.desired_value
+ * AH_data_ptr->desired_value_factor
+ + AH_data_ptr->desired_value_offset;
+ const int gnp = ps_ptr->ghosted_N_grid_points();
+ assert (AH_other_ptr->ps_ptr->ghosted_N_grid_points() == gnp);
+ memcpy (ps_ptr->ghosted_gridfn_data(gfns::gfn__h),
+ AH_other_ptr->ps_ptr->ghosted_gridfn_data(gfns::gfn__h),
+ gnp * sizeof(fp));
+ ps_ptr->origin_x (AH_other_ptr->ps_ptr->origin_x());
+ ps_ptr->origin_y (AH_other_ptr->ps_ptr->origin_y());
+ ps_ptr->origin_z (AH_other_ptr->ps_ptr->origin_z());
+ }
+ }
+
+ if (horizon_is_genuine) {
+ if (AH_data_ptr->move_origins
+ && AH_data_ptr->depends_on == 0
+ && AH_data_ptr->found_flag)
+ {
+ // move the origin to the centre
+ patch_system& ps = *ps_ptr;
+ fp cx=0, cy=0, cz=0; // change of origin
+ fp sx=0, sy=0, sz=0; // change of shape
+ if (! predict_origin_movement) {
+ size_t N=0;
+ for (int pn=0; pn<ps.N_patches(); ++pn) {
+ patch& p = ps.ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ const fp rho = p.rho_of_irho (irho);
+ const fp sigma = p.sigma_of_isigma (isigma);
+ const fp r = p.ghosted_gridfn (gfns::gfn__h, irho, isigma);
+ fp x, y, z;
+ p.xyz_of_r_rho_sigma (r, rho, sigma, x, y, z);
+ cx += x;
+ cy += y;
+ cz += z;
+ ++N;
+ }
+ }
+ }
+ assert (N > 0);
+ cx /= N;
+ cy /= N;
+ cz /= N;
+ sx=cx; sy=cy; sz=cz;
+ } else { // if predict_origin_movement
+ if (ah_centroid_valid[hn-1]) {
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF centroid x " << (ah_centroid_x[hn-1]) << " y " << (ah_centroid_y[hn-1]) << " z " << (ah_centroid_z[hn-1]) << " t " << (ah_centroid_t[hn-1]) << std::endl;
+ }
+ if (ah_centroid_valid_p[hn-1]) {
+ // have two previous origins: linear extrapolation
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF centroid_p x " << (ah_centroid_x_p[hn-1]) << " y " << (ah_centroid_y_p[hn-1]) << " z " << (ah_centroid_z_p[hn-1]) << " t " << (ah_centroid_t_p[hn-1]) << std::endl;
+ }
+ fp const dt = ah_centroid_t[hn-1] - ah_centroid_t_p[hn-1];
+ fp const dt_n = cctk_time - ah_centroid_t [hn-1];
+ fp const dt_p = cctk_time - ah_centroid_t_p[hn-1];
+ fp const timescale =
+ fabs (dt) + fabs (dt_p) + fabs (dt_n) +
+ 0.001 * fabs (cctk_delta_time);
+ if (10 * fabs (dt ) < timescale ||
+ 10 * fabs (dt_p) < timescale ||
+ 10 * fabs (dt_n) < timescale)
+ {
+ // the times are too similar
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF toosim" << std::endl;
+ }
+ cx = ah_centroid_x[hn-1];
+ cy = ah_centroid_y[hn-1];
+ cz = ah_centroid_z[hn-1];
+ } else {
+ fp const fact_n = + dt_p / dt;
+ fp const fact_p = - dt_n / dt;
+ if (fabs (fact_n) > 5 || fabs (fact_p) > 5) {
+ // don't trust a large extrapolation
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF notrust" << std::endl;
+ }
+ cx = ah_centroid_x[hn-1];
+ cy = ah_centroid_y[hn-1];
+ cz = ah_centroid_z[hn-1];
+ } else {
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF extrap fn " << fact_n << " fp " << fact_p << std::endl;
+ }
+ cx = fact_n * ah_centroid_x[hn-1] + fact_p * ah_centroid_x_p[hn-1];
+ cy = fact_n * ah_centroid_y[hn-1] + fact_p * ah_centroid_y_p[hn-1];
+ cz = fact_n * ah_centroid_z[hn-1] + fact_p * ah_centroid_z_p[hn-1];
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF xp " << (ah_centroid_x_p[hn-1]) << " x " << (ah_centroid_x[hn-1]) << " cx " << cx << std::endl;
+ }
+ }
+ }
+ } else {
+ // have one previous origin: constant extrapolation
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF const" << std::endl;
+ }
+ cx = ah_centroid_x[hn-1];
+ cy = ah_centroid_y[hn-1];
+ cz = ah_centroid_z[hn-1];
+ }
+ if (verbose_info.print_algorithm_highlights) {
+ std::cout << "AHF predicted position cx " << cx << " cy " << cy << " cz " << cz << std::endl;
+ }
+ cx -= ps.origin_x();
+ cy -= ps.origin_y();
+ cz -= ps.origin_z();
+ }
+ sx = ah_centroid_x[hn-1] - ps.origin_x();
+ sy = ah_centroid_y[hn-1] - ps.origin_y();
+ sz = ah_centroid_z[hn-1] - ps.origin_z();
+ } // if predict_origin_movement
+ switch (ps.type()) {
+ case patch_system::patch_system__full_sphere:
+ break; // do nothing
+ case patch_system::patch_system__plus_z_hemisphere:
+ cz = 0; sz = 0; break;
+ case patch_system::patch_system__plus_xy_quadrant_mirrored:
+ cx = cy = 0; sx = sy = 0; break;
+ case patch_system::patch_system__plus_xy_quadrant_rotating:
+ cx = cy = 0; sx = sy = 0; break;
+ case patch_system::patch_system__plus_xz_quadrant_mirrored:
+ cx = cz = 0; sx = sz = 0; break;
+ case patch_system::patch_system__plus_xz_quadrant_rotating:
+ cx = cz = 0; sx = sz = 0; break;
+ case patch_system::patch_system__plus_xyz_octant_mirrored:
+ cx = cy = cz = 0; sx = sy = sz = 0; break;
+ case patch_system::patch_system__plus_xyz_octant_rotating:
+ cx = cy = cz = 0; sx = sy = sz = 0; break;
+ default: assert(0);
+ }
+ ps.origin_x (ps.origin_x() + cx);
+ ps.origin_y (ps.origin_y() + cy);
+ ps.origin_z (ps.origin_z() + cz);
+ if (reshape_while_moving) {
+ for (int pn=0; pn<ps.N_patches(); ++pn) {
+ patch& p = ps.ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ const fp rho = p.rho_of_irho (irho);
+ const fp sigma = p.sigma_of_isigma (isigma);
+ fp & r = p.ghosted_gridfn (gfns::gfn__h, irho, isigma);
+ fp x, y, z;
+ p.xyz_of_r_rho_sigma (r, rho, sigma, x, y, z);
+ fp const proj = (sx*x + sy*y + sz*z) / r;
+ r -= proj;
+ }
+ }
+ }
+ ps.synchronize();
+ }
+ }
+
+ // modify the initial guess
+ jtutil::norm<fp> norms;
+ ps_ptr->ghosted_gridfn_norms (gfns::gfn__h, norms);
+ // smoothing:
+ ps_ptr->scale_ghosted_gridfn
+ (1.0 - AH_data_ptr->smoothing_factor, gfns::gfn__h);
+ ps_ptr->add_to_ghosted_gridfn
+ (AH_data_ptr->smoothing_factor * norms.mean(), gfns::gfn__h);
+ // enlarging:
+ ps_ptr->scale_ghosted_gridfn
+ (AH_data_ptr->shiftout_factor, gfns::gfn__h);
+ }
+
+ bool I_am_pretracking = horizon_is_genuine && AH_data_ptr->use_pretracking;
+ bool I_was_pretracking = false;
+ bool pretracking_have_upper_bound = false;
+ bool pretracking_have_lower_bound = false;
+ bool pretracking_was_successful = false;
+ fp const old_pretracking_value = I_am_pretracking ? AH_data_ptr->pretracking_value : 0.0;
+ fp pretracking_upper_bound;
+ fp pretracking_lower_bound;
+ bool pretracking_have_horizon_info;
+ fp pretracking_mean_expansion;
+ for (int pretracking_iter = 0;
+ I_am_pretracking
+ ? pretracking_iter < AH_data_ptr->pretracking_max_iterations
+ : true;
+ ++pretracking_iter)
+ {
+ bool found_this_horizon;
+ if (I_am_pretracking || I_was_pretracking) {
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: iteration %d", pretracking_iter);
+ if (pretracking_have_lower_bound) {
+ if (pretracking_have_upper_bound) {
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: looking for value %g in [%g,%g]",
+ double(AH_data_ptr->pretracking_value),
+ double(pretracking_lower_bound),
+ double(pretracking_upper_bound));
+ } else {
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: looking for value %g in [%g,*]",
+ double(AH_data_ptr->pretracking_value),
+ double(pretracking_lower_bound));
+ }
+ } else {
+ if (pretracking_have_upper_bound) {
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: looking for value %g in [*,%g]",
+ double(AH_data_ptr->pretracking_value),
+ double(pretracking_upper_bound));
+ } else {
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: looking for value %g in [*,*]",
+ double(AH_data_ptr->pretracking_value));
+ }
+ }
+ AH_data_ptr->compute_info.desired_value = AH_data_ptr->pretracking_value;
+ ps_ptr->ghosted_gridfn_copy (gfns::gfn__h, gfns::gfn__save_h);
+ pretracking_have_horizon_info = false;
+ }
+
+ if (! I_am_pretracking) {
+ if (horizon_is_genuine) {
+ if (! AH_data_ptr->initial_guess_info.reset_horizon_after_not_finding) {
+ // save the surface for possible backtracking later
+ ps_ptr->ghosted_gridfn_copy (gfns::gfn__h, gfns::gfn__save_h);
+ }
+ }
+ }
+
+ struct what_to_compute dummy_compute_info;
+ struct what_to_compute & compute_info =
+ horizon_is_genuine
+ ? AH_data_ptr->compute_info
+ : dummy_compute_info;
+
+ if (horizon_is_genuine) {
+ if (ps_ptr->N_additional_points()) {
+ const int gnp = ps_ptr->ghosted_N_grid_points();
+ ps_ptr->ghosted_gridfn_data(gfns::gfn__h)[gnp] = 0;
+ }
+ }
const int max_iterations
= horizon_is_genuine
@@ -166,10 +424,16 @@ if (verbose_info.print_physics_details)
: solver_info.max_Newton_iterations__subsequent)
: INT_MAX;
+ int num_Theta_growth_iterations = 0;
+ fp previous_Theta_norm = 1.0e30;
+ int num_Theta_nonshrink_iterations = 0;
+ fp best_Theta_norm = 1.0e30;
+
//
// each pass through this loop does a single Newton iteration
// on the current horizon (which might be either genuine or dummy)
//
+ bool do_return = false;
for (int iteration = 1 ; ; ++iteration)
{
if (verbose_info.print_algorithm_debug)
@@ -185,20 +449,136 @@ if (verbose_info.print_physics_details)
if (horizon_is_genuine
&& solver_info.debugging_output_at_each_Newton_iteration)
then output_gridfn(*ps_ptr, gfns::gfn__h,
+ "h", GH,
IO_info, IO_info.h_base_file_name,
+ IO_info.h_min_digits,
hn, verbose_info.print_algorithm_highlights,
iteration);
+ // calculate the norms also for a surface a bit further out,
+ // so that we know how they vary in space.
+ // perform this calculation first, so that the real values
+ // do not have to be saved.
+ const fp epsilon = Jacobian_info.perturbation_amplitude;
+ jtutil::norm<fp> shifted_Theta_norms;
+ jtutil::norm<fp> shifted_expansion_Theta_norms;
+ jtutil::norm<fp> shifted_inner_expansion_Theta_norms;
+ jtutil::norm<fp> shifted_product_expansion_Theta_norms;
+ jtutil::norm<fp> shifted_mean_curvature_Theta_norms;
+ fp shifted_area;
+ jtutil::norm<fp> shifted2_Theta_norms;
+ jtutil::norm<fp> shifted2_expansion_Theta_norms;
+ jtutil::norm<fp> shifted2_inner_expansion_Theta_norms;
+ jtutil::norm<fp> shifted2_product_expansion_Theta_norms;
+ jtutil::norm<fp> shifted2_mean_curvature_Theta_norms;
+ fp shifted2_area;
+ if (solver_info.want_expansion_gradients) {
+ if (horizon_is_genuine) {
+ ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
+ // ps_ptr->scale_ghosted_gridfn(1.0+epsilon, gfns::gfn__h);
+ }
+ const enum expansion_status raw_shifted_expansion_status
+ = expansion(ps_ptr, compute_info,
+ cgi, gi,
+ error_info, (iteration == 1),
+ false, // no, we don't want Jacobian coeffs
+ false,
+ &shifted_Theta_norms,
+ &shifted_expansion_Theta_norms,
+ &shifted_inner_expansion_Theta_norms,
+ &shifted_product_expansion_Theta_norms,
+ &shifted_mean_curvature_Theta_norms);
+ if (horizon_is_genuine) {
+ shifted_area = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ BH_diagnostics_info.integral_method);
+ ps_ptr->add_to_ghosted_gridfn(-epsilon, gfns::gfn__h);
+ // ps_ptr->scale_ghosted_gridfn(1.0/(1.0+epsilon), gfns::gfn__h);
+
+ ps_ptr->add_to_ghosted_gridfn(-epsilon, gfns::gfn__h);
+ // ps_ptr->scale_ghosted_gridfn(1.0/(1.0+epsilon), gfns::gfn__h);
+ }
+ const enum expansion_status raw_shifted2_expansion_status
+ = expansion(ps_ptr, compute_info,
+ cgi, gi,
+ error_info, (iteration == 1),
+ false, // no, we don't want Jacobian coeffs
+ false,
+ &shifted2_Theta_norms,
+ &shifted2_expansion_Theta_norms,
+ &shifted2_inner_expansion_Theta_norms,
+ &shifted2_product_expansion_Theta_norms,
+ &shifted2_mean_curvature_Theta_norms);
+ if (horizon_is_genuine) {
+ shifted2_area = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ BH_diagnostics_info.integral_method);
+ ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
+ // ps_ptr->scale_ghosted_gridfn(1.0+epsilon, gfns::gfn__h);
+ }
+ } // if want_expansion_gradients
+
+ // now calculate the real values.
jtutil::norm<fp> Theta_norms;
+ jtutil::norm<fp> expansion_Theta_norms;
+ jtutil::norm<fp> inner_expansion_Theta_norms;
+ jtutil::norm<fp> product_expansion_Theta_norms;
+ jtutil::norm<fp> mean_curvature_Theta_norms;
const enum expansion_status raw_expansion_status
- = expansion(ps_ptr, add_to_expansion,
+ = expansion(ps_ptr, compute_info,
cgi, gi,
error_info, (iteration == 1),
true, // yes, we want Jacobian coeffs
verbose_info.print_algorithm_details,
- &Theta_norms);
+ &Theta_norms,
+ &expansion_Theta_norms,
+ &inner_expansion_Theta_norms,
+ &product_expansion_Theta_norms,
+ &mean_curvature_Theta_norms);
+ fp area;
+ if (horizon_is_genuine)
+ {
+ area = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ BH_diagnostics_info.integral_method);
+ }
const bool Theta_is_ok = (raw_expansion_status == expansion_success);
- const bool norms_are_ok = horizon_is_genuine && Theta_is_ok;
+ const bool norms_are_ok = horizon_is_genuine && Theta_is_ok;
+
+ if (norms_are_ok) {
+ const fp this_norm = Theta_norms.infinity_norm();
+ if (this_norm > previous_Theta_norm) {
+ ++ num_Theta_growth_iterations;
+ } else {
+ num_Theta_growth_iterations = 0;
+ }
+ previous_Theta_norm = this_norm;
+
+ if (this_norm >= best_Theta_norm) {
+ ++ num_Theta_nonshrink_iterations;
+ } else {
+ num_Theta_nonshrink_iterations = 0;
+ best_Theta_norm = this_norm;
+ }
+ }
+
+ if (I_am_pretracking && norms_are_ok) {
+ pretracking_mean_expansion = expansion_Theta_norms.mean();
+ pretracking_have_horizon_info = true;
+ }
+
if (verbose_info.print_algorithm_debug)
then {
CCTK_VInfo(CCTK_THORNSTRING,
@@ -212,27 +592,64 @@ if (verbose_info.print_physics_details)
}
if (horizon_is_genuine && Theta_is_ok
&& solver_info.debugging_output_at_each_Newton_iteration)
- then output_gridfn(*ps_ptr, gfns::gfn__Theta,
+ then {
+ output_gridfn(*ps_ptr, gfns::gfn__Theta,
+ "Theta", GH,
IO_info, IO_info.Theta_base_file_name,
+ IO_info.h_min_digits,
+ hn, verbose_info.print_algorithm_highlights,
+ iteration);
+ output_gridfn(*ps_ptr, gfns::gfn__mean_curvature,
+ "mean_curvature", GH,
+ IO_info, IO_info.mean_curvature_base_file_name,
+ IO_info.h_min_digits,
hn, verbose_info.print_algorithm_highlights,
iteration);
+ }
//
// have we found this horizon?
// if so, compute and output BH diagnostics
//
- const bool found_this_horizon
- = norms_are_ok && (Theta_norms.infinity_norm()
- <= solver_info.Theta_norm_for_convergence);
+ found_this_horizon
+ = (norms_are_ok
+ && (I_was_pretracking
+ ? pretracking_was_successful
+ : Theta_norms.infinity_norm() <= solver_info.Theta_norm_for_convergence));
if (horizon_is_genuine)
then AH_data_ptr->found_flag = found_this_horizon;
- if (found_this_horizon)
+ if (found_this_horizon && ! I_am_pretracking)
then {
struct BH_diagnostics& BH_diagnostics
= AH_data_ptr->BH_diagnostics;
- BH_diagnostics.compute(*ps_ptr, BH_diagnostics_info);
+ const fp mean_expansion = expansion_Theta_norms.mean();
+ const fp mean_inner_expansion = inner_expansion_Theta_norms.mean();
+ const fp mean_product_expansion = product_expansion_Theta_norms.mean();
+ const fp mean_mean_curvature = mean_curvature_Theta_norms.mean();
+ // const fp area_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_area - area ) / epsilon;
+ // const fp mean_expansion_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_expansion_Theta_norms.mean() - expansion_Theta_norms.mean() ) / epsilon;
+ // const fp mean_inner_expansion_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_inner_expansion_Theta_norms.mean() - inner_expansion_Theta_norms.mean()) / epsilon;
+ // const fp mean_product_expansion_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_product_expansion_Theta_norms.mean() - product_expansion_Theta_norms.mean()) / epsilon;
+ // const fp mean_mean_curvature_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_mean_curvature_Theta_norms.mean() - mean_curvature_Theta_norms.mean() ) / epsilon;
+ const fp area_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_area - shifted2_area ) / (2*epsilon);
+ const fp mean_expansion_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_expansion_Theta_norms.mean() - shifted2_expansion_Theta_norms.mean() ) / (2*epsilon);
+ const fp mean_inner_expansion_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_inner_expansion_Theta_norms.mean() - shifted2_inner_expansion_Theta_norms.mean()) / (2*epsilon);
+ const fp mean_product_expansion_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_product_expansion_Theta_norms.mean() - shifted2_product_expansion_Theta_norms.mean()) / (2*epsilon);
+ const fp mean_mean_curvature_gradient = ! solver_info.want_expansion_gradients ? 0.0 : (shifted_mean_curvature_Theta_norms.mean() - shifted2_mean_curvature_Theta_norms.mean() ) / (2*epsilon);
+ BH_diagnostics.compute(*ps_ptr,
+ area,
+ mean_expansion,
+ mean_inner_expansion,
+ mean_product_expansion,
+ mean_mean_curvature,
+ area_gradient,
+ mean_expansion_gradient,
+ mean_inner_expansion_gradient,
+ mean_product_expansion_gradient,
+ mean_mean_curvature_gradient,
+ BH_diagnostics_info);
if (IO_info.output_BH_diagnostics)
then {
if (AH_data_ptr->BH_diagnostics_fileptr == NULL)
@@ -251,8 +668,13 @@ if (verbose_info.print_physics_details)
// (if so, we'll give up on this horizon)
//
const bool expansion_is_too_large
- = norms_are_ok && (Theta_norms.infinity_norm()
- > solver_info.max_allowable_Theta);
+ = norms_are_ok
+ && ( Theta_norms.infinity_norm() > solver_info.max_allowable_Theta
+ || ( solver_info.max_allowable_Theta_growth_iterations > 0
+ && num_Theta_growth_iterations > solver_info.max_allowable_Theta_growth_iterations)
+ || ( solver_info.max_allowable_Theta_nonshrink_iterations > 0
+ && num_Theta_nonshrink_iterations > solver_info.max_allowable_Theta_nonshrink_iterations)
+ );
//
@@ -260,10 +682,11 @@ if (verbose_info.print_physics_details)
// then pretend expansion() returned a "surface too large" error status
//
jtutil::norm<fp> h_norms;
- if (horizon_is_genuine)
- then ps_ptr->ghosted_gridfn_norms(gfns::gfn__h, h_norms);
- const fp mean_horizon_radius = horizon_is_genuine ? h_norms.mean()
- : 0.0;
+ if (horizon_is_genuine) {
+ ps_ptr->ghosted_gridfn_norms(gfns::gfn__h, h_norms);
+ }
+ const fp mean_horizon_radius
+ = horizon_is_genuine ? h_norms.mean() : 0.0;
const bool horizon_is_too_large
= (mean_horizon_radius > solver_info
.max_allowable_horizon_radius[hn]);
@@ -279,7 +702,7 @@ if (verbose_info.print_physics_details)
// does *this* horizon need more iterations?
// i.e. has this horizon's Newton iteration not yet converged?
- const bool this_horizon_needs_more_iterations
+ const bool this_horizon_needs_more_iterations
= horizon_is_genuine && Theta_is_ok
&& !found_this_horizon
&& !expansion_is_too_large
@@ -290,7 +713,8 @@ if (verbose_info.print_physics_details)
// on this or a following horizon?
const bool I_need_more_iterations
= this_horizon_needs_more_iterations
- || there_is_another_genuine_horizon;
+ || there_is_another_genuine_horizon
+ || I_am_pretracking;
if (verbose_info.print_algorithm_details)
then {
@@ -305,7 +729,6 @@ if (verbose_info.print_physics_details)
int(I_need_more_iterations));
}
-
//
// broadcast iteration status from each active processor
// to all processors, and inclusive-or the "we need more iterations"
@@ -373,6 +796,7 @@ if (verbose_info.print_physics_details)
broadcast_horizon_data(GH,
my_proc == found_proc,
broadcast_horizon_shape,
+ found_AH_data,
found_AH_data.BH_diagnostics,
*found_AH_data.ps_ptr,
found_AH_data.horizon_buffers);
@@ -387,8 +811,9 @@ if (verbose_info.print_physics_details)
//
// if we found our horizon, maybe output the horizon shape?
//
- if (found_this_horizon)
+ if (found_this_horizon && ! I_am_pretracking)
then {
+ // printf("will output h/Th/mc: %d/%d/%d\n", IO_info.output_h, IO_info.output_Theta, IO_info.output_mean_curvature); //xxxxxxxxxxxx
if (IO_info.output_h)
then {
// if this is the first time we've output h for this
@@ -396,13 +821,24 @@ if (verbose_info.print_physics_details)
if (!AH_data_ptr->h_files_written)
then setup_h_files(*ps_ptr, IO_info, hn);
output_gridfn(*ps_ptr, gfns::gfn__h,
+ "h", GH,
IO_info, IO_info.h_base_file_name,
+ IO_info.h_min_digits,
hn, verbose_info
.print_algorithm_highlights);
}
if (IO_info.output_Theta)
then output_gridfn(*ps_ptr, gfns::gfn__Theta,
+ "Theta", GH,
IO_info, IO_info.Theta_base_file_name,
+ IO_info.h_min_digits,
+ hn, verbose_info
+ .print_algorithm_highlights);
+ if (IO_info.output_mean_curvature)
+ then output_gridfn(*ps_ptr, gfns::gfn__mean_curvature,
+ "mean_curvature", GH,
+ IO_info, IO_info.mean_curvature_base_file_name,
+ IO_info.h_min_digits,
hn, verbose_info
.print_algorithm_highlights);
}
@@ -417,7 +853,8 @@ if (verbose_info.print_physics_details)
if (verbose_info.print_algorithm_details)
then CCTK_VInfo(CCTK_THORNSTRING,
"==> all processors are finished!");
- return; // *** NORMAL RETURN ***
+ do_return = true;
+ break; // *** LOOP EXIT ***
}
if ((N_procs == 1) && !this_horizon_needs_more_iterations)
then {
@@ -441,7 +878,7 @@ if (verbose_info.print_physics_details)
= expansion_Jacobian
(this_horizon_needs_more_iterations ? ps_ptr : NULL,
this_horizon_needs_more_iterations ? Jac_ptr : NULL,
- add_to_expansion,
+ compute_info,
cgi, gi, Jacobian_info,
error_info, (iteration == 1),
verbose_info.print_algorithm_details);
@@ -474,7 +911,7 @@ if (verbose_info.print_physics_details)
verbose_info.print_algorithm_details);
if ((rcond >= 0.0) && (rcond < 100.0*FP_EPSILON))
then {
- CCTK_VWarn(SERIOUS_WARNING, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
"Newton_solve: Jacobian matrix is numerically singular!");
// give up on this horizon
break; // *** LOOP CONTROL ***
@@ -491,7 +928,9 @@ if (verbose_info.print_physics_details)
if (solver_info.debugging_output_at_each_Newton_iteration)
then output_gridfn(*ps_ptr, gfns::gfn__Delta_h,
+ "Delta_h", GH,
IO_info, IO_info.Delta_h_base_file_name,
+ IO_info.h_min_digits,
hn, verbose_info.print_algorithm_details,
iteration);
@@ -507,6 +946,139 @@ if (verbose_info.print_physics_details)
// end of this Newton iteration
}
+ if (! I_am_pretracking) {
+ if (horizon_is_genuine) {
+ if (! AH_data_ptr->initial_guess_info.reset_horizon_after_not_finding) {
+ if (! found_this_horizon) {
+ // the surface failed; backtrack and continue
+ AH_data_ptr->ps_ptr->ghosted_gridfn_copy
+ (gfns::gfn__save_h, gfns::gfn__h);
+ }
+ }
+ }
+ }
+
+ // exit
+ if (do_return) return; // *** NORMAL RETURN ***
+
+ // break out of the pretracking loop if we are not pretracking
+ if (! I_am_pretracking) break;
+
+ if (! found_this_horizon) {
+ // the surface failed; backtrack and continue
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: solving failed; backtracking");
+ AH_data_ptr->ps_ptr->ghosted_gridfn_copy (gfns::gfn__save_h, gfns::gfn__h);
+ if (pretracking_have_lower_bound) {
+ assert (AH_data_ptr->pretracking_value >= pretracking_lower_bound - 1.0e-10 * fabs(pretracking_lower_bound));
+ }
+ pretracking_have_lower_bound = true;
+ pretracking_lower_bound = AH_data_ptr->pretracking_value;
+ if (pretracking_have_upper_bound) {
+ AH_data_ptr->pretracking_delta = 0.5 * (pretracking_upper_bound - pretracking_lower_bound);
+ AH_data_ptr->pretracking_value = pretracking_lower_bound + 0.5 * (pretracking_upper_bound - pretracking_lower_bound);
+ } else {
+ AH_data_ptr->pretracking_delta = fabs(AH_data_ptr->pretracking_delta);
+ AH_data_ptr->pretracking_delta *= 2.0;
+ if (AH_data_ptr->pretracking_delta > AH_data_ptr->pretracking_maximum_delta) {
+ AH_data_ptr->pretracking_delta = AH_data_ptr->pretracking_maximum_delta;
+ }
+ AH_data_ptr->pretracking_value += AH_data_ptr->pretracking_delta;
+ if (AH_data_ptr->pretracking_value > AH_data_ptr->pretracking_maximum_value) {
+ AH_data_ptr->pretracking_value = AH_data_ptr->pretracking_maximum_value;
+ }
+ }
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: new value %g, delta %g",
+ double(AH_data_ptr->pretracking_value),
+ double(AH_data_ptr->pretracking_delta));
+ if (pretracking_lower_bound >= AH_data_ptr->pretracking_maximum_value * 0.9999999999) {
+ // give up
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: upper bound reached, giving up.");
+ I_am_pretracking = false;
+ I_was_pretracking = true;
+ pretracking_was_successful = false;
+ // restore old pretracking goal
+ AH_data_ptr->pretracking_value = old_pretracking_value;
+ } else if (AH_data_ptr->pretracking_delta < AH_data_ptr->pretracking_minimum_delta) {
+ // give up
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: step size too small, giving up.");
+ I_am_pretracking = false;
+ I_was_pretracking = true;
+ pretracking_was_successful = true;
+ }
+ } else {
+ // the surface was okay
+ // get mean expansion
+ assert (pretracking_have_horizon_info);
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: solving succeeded; expansion is now %g",
+ double(pretracking_mean_expansion));
+// if (fabs(AH_data_ptr->pretracking_value) > 2.0 * AH_data_ptr->pretracking_minimum_delta) {
+ if (AH_data_ptr->pretracking_value > AH_data_ptr->pretracking_minimum_value + 1.0e-10 * AH_data_ptr->pretracking_minimum_delta) {
+ // it is not yet a horizon
+ if (pretracking_have_upper_bound) {
+ assert (AH_data_ptr->pretracking_value <= pretracking_upper_bound + 1.0e-10 * fabs(pretracking_upper_bound));
+ }
+ pretracking_have_upper_bound = true;
+ pretracking_upper_bound = AH_data_ptr->pretracking_value;
+ if (pretracking_have_lower_bound) {
+#if 1
+ // TODO
+ // move lower bound further down
+ pretracking_lower_bound -= pretracking_upper_bound - pretracking_lower_bound;
+ if (pretracking_lower_bound < AH_data_ptr->pretracking_minimum_value) pretracking_lower_bound = AH_data_ptr->pretracking_minimum_value;
+#endif
+ AH_data_ptr->pretracking_delta = 0.5 * (pretracking_lower_bound - pretracking_upper_bound);
+ AH_data_ptr->pretracking_value = pretracking_lower_bound + 0.5 * (pretracking_upper_bound - pretracking_lower_bound);
+ } else {
+ AH_data_ptr->pretracking_delta = - fabs(AH_data_ptr->pretracking_delta);
+ AH_data_ptr->pretracking_delta *= 2.0;
+ if (- AH_data_ptr->pretracking_delta > AH_data_ptr->pretracking_maximum_delta) {
+ AH_data_ptr->pretracking_delta = - AH_data_ptr->pretracking_maximum_delta;
+ }
+ AH_data_ptr->pretracking_value += AH_data_ptr->pretracking_delta;
+ if (AH_data_ptr->pretracking_value < AH_data_ptr->pretracking_minimum_value) {
+ AH_data_ptr->pretracking_value = AH_data_ptr->pretracking_minimum_value;
+ }
+ }
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: new value radius %g, delta %g",
+ double(AH_data_ptr->pretracking_value),
+ double(AH_data_ptr->pretracking_delta));
+ if (pretracking_upper_bound <= AH_data_ptr->pretracking_minimum_value * 1.00000000001) {
+ // give up
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: lower bound reached, giving up.");
+ I_am_pretracking = false;
+ I_was_pretracking = true;
+ pretracking_was_successful = false;
+ // restore old pretracking goal
+ AH_data_ptr->pretracking_value = old_pretracking_value;
+ } else if (- AH_data_ptr->pretracking_delta < AH_data_ptr->pretracking_minimum_delta) {
+ // give up
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: step size too small, giving up.");
+ I_am_pretracking = false;
+ I_was_pretracking = true;
+ pretracking_was_successful = true;
+ }
+ } else {
+ // a true horizon was found; we are done
+ CCTK_VInfo(CCTK_THORNSTRING,
+ "Pretracking: done.");
+ I_am_pretracking = false;
+ I_was_pretracking = true;
+ pretracking_was_successful = true;
+ }
+ } // if surface found
+
+ // end of pretracking loop
+ }
+ I_am_pretracking = false;
+
// end of this horizon
}
@@ -703,8 +1275,8 @@ return any_proc_needs_more_iterations;
//
// This function (which must be called on *every* processor) broadcasts
-// the BH diagnostics and optionally also the (ghosted) horizon shape,
-// from a specified processor to all processors.
+// the BH diagnostics and (ghosted) horizon shape from a specified processor
+// to all processors.
//
// The present implementation of this function uses the Cactus reduction
// API. If AHFinderDirect is ported to some other software environment,
@@ -715,15 +1287,11 @@ return any_proc_needs_more_iterations;
// GH --> The Cactus grid hierarchy.
// broadcast_flag = true on the broadcasting processor,
// false on all other processors
-// broadcast_horizon_shape = true to broadcast the (ghosted) horizon shape
-// as well as the BH diagnostics
-// false to only broadcast the BH diagnostics
// BH_diagnostics = On the broadcasting processor, this is the BH diagnostics
// to broadcast; on all other processors, it's set to the
// broadcast BH diagnostics.
-// ps = Used only if broadcast_horizon_shape; in this case...
-// On the broadcasting processor, gfn__h is broadcast;
-// on all other processors, gfn__h is set to the broadcast values.
+// ps = On the broadcasting processor, gfn__h is broadcast;
+// on all other processors, gfn__h is set to the broadcast values.
// horizon_buffers = Internal buffers for use in the broadcast;
// if N_buffer == 0 then we set N_buffer and allocate
// the buffers.
@@ -731,6 +1299,7 @@ return any_proc_needs_more_iterations;
namespace {
void broadcast_horizon_data(const cGH* GH,
bool broadcast_flag, bool broadcast_horizon_shape,
+ struct AH_data& AH_data,
struct BH_diagnostics& BH_diagnostics,
patch_system& ps,
struct horizon_buffers& horizon_buffers)
@@ -751,7 +1320,8 @@ if (horizon_buffers.N_buffer == 0)
// allocate the buffers
horizon_buffers.N_buffer
= BH_diagnostics::N_buffer
- + (broadcast_horizon_shape ? ps.N_grid_points() : 0);
+ + (broadcast_horizon_shape ? ps.N_grid_points() : 0)
+ + 4;
horizon_buffers.send_buffer
= new CCTK_REAL[horizon_buffers.N_buffer];
horizon_buffers.receive_buffer
@@ -762,9 +1332,9 @@ if (broadcast_flag)
then {
// pack the data to be broadcast into the send buffer
BH_diagnostics.copy_to_buffer(horizon_buffers.send_buffer);
+ int posn = BH_diagnostics::N_buffer;
if (broadcast_horizon_shape)
then {
- int posn = BH_diagnostics::N_buffer;
for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
{
const patch& p = ps.ith_patch(pn);
@@ -782,8 +1352,12 @@ if (broadcast_flag)
}
}
}
- assert( posn == horizon_buffers.N_buffer );
}
+ horizon_buffers.send_buffer[posn++] = AH_data.initial_find_flag;
+ horizon_buffers.send_buffer[posn++] = AH_data.really_initial_find_flag;
+ horizon_buffers.send_buffer[posn++] = AH_data.search_flag;
+ horizon_buffers.send_buffer[posn++] = AH_data.found_flag;
+ assert( posn == horizon_buffers.N_buffer );
}
else jtutil::zero_C_array(horizon_buffers.N_buffer,
horizon_buffers.send_buffer);
@@ -814,9 +1388,12 @@ if (!broadcast_flag)
then {
// unpack the data from the receive buffer
BH_diagnostics.copy_from_buffer(horizon_buffers.receive_buffer);
+ ps.origin_x(BH_diagnostics.origin_x);
+ ps.origin_y(BH_diagnostics.origin_y);
+ ps.origin_z(BH_diagnostics.origin_z);
+ int posn = BH_diagnostics::N_buffer;
if (broadcast_horizon_shape)
then {
- int posn = BH_diagnostics::N_buffer;
for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
{
patch& p = ps.ith_patch(pn);
@@ -834,12 +1411,16 @@ if (!broadcast_flag)
}
}
}
- assert( posn == horizon_buffers.N_buffer );
// recover the full ghosted-grid horizon shape
// (we only broadcast the nominal-grid shape)
ps.synchronize();
}
+ AH_data.initial_find_flag = horizon_buffers.receive_buffer[posn++];
+ AH_data.really_initial_find_flag = horizon_buffers.receive_buffer[posn++];
+ AH_data.search_flag = horizon_buffers.receive_buffer[posn++];
+ AH_data.found_flag = horizon_buffers.receive_buffer[posn++];
+ assert( posn == horizon_buffers.N_buffer );
}
}
}
@@ -918,6 +1499,7 @@ const fp scale = (max_Delta_h <= max_allowable_Delta_h)
if (verbose_info.print_algorithm_details)
then {
+
if (scale == 1.0)
then CCTK_VInfo(CCTK_THORNSTRING,
"h += Delta_h (rms-norm=%.1e, infinity-norm=%.1e)",
@@ -948,6 +1530,14 @@ if (verbose_info.print_algorithm_details)
}
}
}
+
+if (ps.N_additional_points())
+ {
+ const int np = ps.N_grid_points();
+ const int gnp = ps.ghosted_N_grid_points();
+ ps.ghosted_gridfn_data(gfns::gfn__h)[gnp]
+ -= scale * ps.gridfn_data(gfns::gfn__Delta_h)[np];
+ }
}
}
diff --git a/src/driver/README b/src/driver/README
index f3de3e7..a19bbb0 100644
--- a/src/driver/README
+++ b/src/driver/README
@@ -16,24 +16,16 @@ state.cc
setup.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
this is called from the scheduler to setup our data structures
-find_horizons.cc # sees CCTK_ARGUMENTS
+find_horizons.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
this is called from the scheduler to find the apparent horizon(s)
in a slice
-mask.cc # sees CCTK_ARGUMENTS
- this is called from the scheduler to set an excision mask or masks
-
-announce.cc # sees CCTK_ARGUMENTS
+announce.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
this is called from the scheduler to announce apparent horizon
- info to other thorns via aliased function calls
+ info to other thorns
-spherical_surface.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
- this is called from the scheduler to store apparent horizon
- info in the SphericalSurface variables
-
-aliased_functions.cc # sees CCTK_ARGUMENTS, CCTK_FUNCTIONS
- this is called from other thorns via the flesh aliased-function
- interface, for the other thorns to find out about apparent horizons
+mask.cc # sees CCTK_ARGUMENTS, CCTK_PARAMETERS
+ this is called from the scheduler to set an excision mask or masks
initial_guess.cc
this sets up the initial guess(es) for the horizon position(s)
@@ -46,24 +38,6 @@ Newton.cc # sees cGH (for interprocessor broadcasts)
io.cc
I/O routines
-BH_diagnostics.{cc,hh}
- this struct (= class with public data) computes and keeps track of
- the BH diagnostics (horizon circumferences, area, irreducible mass,
- etc)
-
-misc-driver.cc
- some misc code that doesn't fit anywhere else :)
-
-Makefile.standalone
- Makefile for standalone test drivers etc
-
-horizon_sequence.{cc,hh}
- this class keeps track of the sequence of horizons which a given
- processor should try to find (possibly including dummy ones to
- preserve the multiprocessor synchronization)
-test_horizon_sequence.cc
- standalone test driver for horizon_sequence.{cc,hh}
-
ellipsoid.maple
this is a Maple script to compute the intersection of a given
ray with an ellipsoid; this is used in setting up the initial guess
diff --git a/src/driver/README.parallel b/src/driver/README.parallel
index 67e3394..136c026 100644
--- a/src/driver/README.parallel
+++ b/src/driver/README.parallel
@@ -195,11 +195,3 @@ received from the broadcast, and for each flag which is true, all
processors then know to participate in the broadcast of the BH diagnostics
and (optionally) the horizon shape from the just-found-it processor
to all processors.
-
-We only broadcast the horizon shapes if they're needed, i.e. if either
-or both of the following conditions hold:
-* we're setting an excision mask
-* we're storing horizon information in the SphericalSurface variables
- for at least one horizon
-In either case, each processor needs to know the shapes of *all* horizons,
-so we do the broadcast.
diff --git a/src/driver/aliased_functions.cc b/src/driver/aliased_functions.cc
index 43c15ed..8b1218a 100644
--- a/src/driver/aliased_functions.cc
+++ b/src/driver/aliased_functions.cc
@@ -12,10 +12,12 @@
#include <assert.h>
#include <math.h>
+#include <vector>
+
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
-#include "cctk_Functions.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -23,6 +25,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -45,7 +48,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -57,13 +59,8 @@ extern struct state state;
//******************************************************************************
//
-// This function is called (via the Cactus flesh function-aliasing mechanism)
-// by other thorns to find out our local coordinate origin for a given AH.
-//
-// Arguments:
-// horizon_number = (in) The horizon to inquire about; must be in the range
-// 1 to N_horizons inclusive.
-// *p_origin_[xyz] = (out) The local coordinate origin is stored here.
+// This function is called (via the magic of function aliasing) by
+// other thorns to find out our local coordinate origin for a given AH.
//
// Results:
// This function returns 0 for ok, or -1 if the horizon number is invalid.
@@ -77,7 +74,7 @@ const struct verbose_info& verbose_info = state.verbose_info;
if (! ((horizon_number >= 1) && (horizon_number <= state.N_horizons)) )
then {
- CCTK_VWarn(SERIOUS_WARNING, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
"AHFinderDirect_local_coordinate_origin():\n"
" horizon_number=%d must be in the range [1,N_horizons=%d]!\n"
,
@@ -108,10 +105,6 @@ return 0; // *** NORMAL RETURN ***
// by other thorns to query whether or not the specified horizon was found
// the last time we searched for it.
//
-// Arguments:
-// horizon_number = (in) The horizon to inquire about; must be in the range
-// 1 to N_horizons inclusive.
-//
// Results:
// This function returns
// 1 if the horizon was found
@@ -125,7 +118,7 @@ const struct verbose_info& verbose_info = state.verbose_info;
if (! ((horizon_number >= 1) && (horizon_number <= state.N_horizons)) )
then {
- CCTK_VWarn(SERIOUS_WARNING, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
"AHFinderDirect_horizon_was_found():\n"
" horizon_number=%d must be in the range [1,N_horizons=%d]!\n"
,
@@ -202,26 +195,16 @@ if (AH_data.found_flag)
// its local coordinate origin to a given (x,y,z) coordinate or coordinates.
//
// Arguments:
-// horizon_number = (in) The horizon to inquire about; must be in the range
-// 1 to N_horizons inclusive.
-// N_points = (in) Number of (x,y,z) coordinate tuples (should be >= 0).
-// x[], y[], z[] = (in) These arrays give the (x,y,z) coordinates.
-// radius[] = (out) This array is set to the horizon radius values
-// (Euclidean distances from the local coordinate origin),
-// or to all -1.0 if we didn't find this horizon the
-// last time we looked for it.
+// horizon_number = must be in the range 1 to N_horizons
+// N_points = should be >= 0
+// x[], y[], z[] = these give the (x,y,z) coordinates
+// radius[] = this is set to the horizon radius values (Euclidean distance
+// from the local coordinate origin), or to all -1.0 if we didn't
+// find this horizon the last time we looked for it
//
// Results:
// This function returns 0 for ok, or -1 if the horizon number is invalid.
//
-// FIXME:
-// * The current implementation is quite inefficient: it does a full 2-D
-// interpolation (to find the horizon radius) for each of the xyz points.
-// It would be more efficient to batch the interpolations.
-// * If an (x,y,z) coordinate tuple coincides with this horizon's local
-// coordinate origin, we return the dummy radius 1.0. It would be
-// better to return -1.0.
-//
extern "C"
CCTK_INT AHFinderDirect_radius_in_direction
(CCTK_INT horizon_number,
@@ -229,37 +212,52 @@ extern "C"
const CCTK_REAL* const x, const CCTK_REAL* const y, const CCTK_REAL* const z,
CCTK_REAL* const radius)
{
-const struct verbose_info& verbose_info = state.verbose_info;
-
-if (! ((horizon_number >= 1) && (horizon_number <= state.N_horizons)) )
- then {
- CCTK_VWarn(SERIOUS_WARNING, __LINE__, __FILE__, CCTK_THORNSTRING,
-"AHFinderDirect_distance_outside_thorn():\n"
-" horizon_number=%d must be in the range [1,N_horizons=%d]!\n"
- ,
- int(horizon_number), state.N_horizons);
- return -1; // *** ERROR RETURN ***
- }
-
-assert(state.AH_data_array[horizon_number] != NULL);
-const struct AH_data& AH_data = *state.AH_data_array[horizon_number];
-
- for (int point = 0 ; point < N_points ; ++point)
- {
- if (AH_data.found_flag)
- then {
- assert(AH_data.ps_ptr != NULL);
- const patch_system& ps = *AH_data.ps_ptr;
-
- const fp local_x = x[point] - ps.origin_x();
- const fp local_y = y[point] - ps.origin_y();
- const fp local_z = z[point] - ps.origin_z();
- radius[point] = ps.radius_in_local_xyz_direction
- (gfns::gfn__h,
- local_x, local_y, local_z);
- }
- else radius[point] = -1.0;
- }
+ const struct verbose_info& verbose_info = state.verbose_info;
+
+ if (! ((horizon_number >= 1) && (horizon_number <= state.N_horizons)) ) {
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "AHFinderDirect_distance_outside_thorn():\n"
+ " horizon_number=%d must be in the range [1,N_horizons=%d]!\n"
+ ,
+ int(horizon_number), state.N_horizons);
+ return -1; // *** ERROR RETURN ***
+ }
+
+ assert(state.AH_data_array[horizon_number] != NULL);
+ const struct AH_data& AH_data = *state.AH_data_array[horizon_number];
+
+ if (AH_data.found_flag) {
+
+ assert(AH_data.ps_ptr != NULL);
+ const patch_system& ps = *AH_data.ps_ptr;
+
+ std::vector<fp> local_xs(N_points);
+ std::vector<fp> local_ys(N_points);
+ std::vector<fp> local_zs(N_points);
+
+ for (int point = 0 ; point < N_points ; ++point) {
+
+ local_xs.at(point) = x[point] - ps.origin_x();
+ local_ys.at(point) = y[point] - ps.origin_y();
+ local_zs.at(point) = z[point] - ps.origin_z();
+
+ }
+
+ ps.radii_in_local_xyz_directions (gfns::gfn__h,
+ N_points,
+ & local_xs.front(),
+ & local_ys.front(),
+ & local_zs.front(),
+ radius);
+
+ } else {
+ // if not found
+
+ for (int point = 0 ; point < N_points ; ++point) {
+ radius[point] = -1.0;
+ }
+
+ } // if not found
return 0; // *** NORMAL RETURN ***
}
diff --git a/src/driver/announce.cc b/src/driver/announce.cc
index 54b8972..5c0b62b 100644
--- a/src/driver/announce.cc
+++ b/src/driver/announce.cc
@@ -12,6 +12,7 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -19,6 +20,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -41,7 +43,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -63,35 +64,42 @@ extern "C"
void AHFinderDirect_announce(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
+DECLARE_CCTK_PARAMETERS
const struct verbose_info& verbose_info = state.verbose_info;
-// only try to announce AH info if we've found AHs at this time level
-if (! state.find_now(cctk_iteration))
+// which horizon to announce?
+const int hn = which_horizon_to_announce_centroid;
+if (hn == 0)
then return; // *** NO-OP RETURN ***
-// only try to anounce AH info if we've been asked to do so
-if (! state.announce_centroid_flag)
- then return; // *** NO-OP RETURN ***
+if (! ((hn >= 1) && (hn <= N_horizons)) )
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" AHFinderDirect_announce():\n"
+" invalid horizon number %d to announce\n"
+" (valid range is [1,N_horizons=%d])!\n"
+ ,
+ hn, int(N_horizons)); /*NOTREACHED*/
-// which horizon to announce?
-const int hn = state.which_horizon_to_announce_centroid;
+assert(state.AH_data_array[hn] != NULL);
+const struct AH_data& AH_data = *state.AH_data_array[hn];
+
+// only try to announce AH info if we've found AHs at this time level
+if (! AH_data.search_flag)
+ then return; // *** NO-OP RETURN ***
// did we actually *find* this horizon?
-if (state.AH_data_array[hn] == NULL)
+if (! AH_data.found_flag)
then return; // *** NO-OP RETURN ***
// is there anyone to announce it to?
if (CCTK_IsFunctionAliased("SetDriftCorrectPosition"))
then {
- assert(state.AH_data_array[hn] != NULL);
- const struct AH_data& AH_data = *state.AH_data_array[hn];
-
const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics;
const CCTK_REAL xx = BH_diagnostics.centroid_x;
const CCTK_REAL yy = BH_diagnostics.centroid_y;
const CCTK_REAL zz = BH_diagnostics.centroid_z;
-
if (verbose_info.print_physics_details)
then CCTK_VInfo(CCTK_THORNSTRING,
"horizon %d centroid (%g,%g,%g) --> DriftCorrect",
@@ -102,4 +110,89 @@ if (CCTK_IsFunctionAliased("SetDriftCorrectPosition"))
//******************************************************************************
+//
+// This function is called by the Cactus scheduler, to copy any
+// desired apparent horizon info to Cactus variables.
+//
+extern "C"
+ void AHFinderDirect_store(CCTK_ARGUMENTS)
+{
+DECLARE_CCTK_ARGUMENTS
+DECLARE_CCTK_PARAMETERS
+
+for (int hn = 1; hn <= N_horizons; ++ hn)
+ {
+
+ // Store in spherical surface
+ const int sn = which_surface_to_store_info[hn];
+ if (sn == -1)
+ then continue;
+
+ if (sn < 0 || sn >= nsurfaces)
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+" AHFinderDirect_store():\n"
+" invalid surface number %d for horizon number %d\n"
+" (valid range is [0,nsurfaces-1=%d])!\n"
+ ,
+ sn, hn,
+ int(nsurfaces-1)); /*NOTREACHED*/
+
+ const struct AH_data& AH_data = *state.AH_data_array[hn];
+ const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics;
+ BH_diagnostics.store(cctkGH, hn, sn);
+
+ }
+}
+
+//******************************************************************************
+
+//
+// This function is called by the Cactus scheduler, to copy any
+// desired apparent horizon info to Cactus variables.
+//
+extern "C"
+ void AHFinderDirect_save(CCTK_ARGUMENTS)
+{
+DECLARE_CCTK_ARGUMENTS
+DECLARE_CCTK_PARAMETERS
+
+for (int hn = 1; hn <= N_horizons; ++ hn)
+ {
+
+ const struct AH_data& AH_data = *state.AH_data_array[hn];
+ const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics;
+
+ // Save in grid array
+ BH_diagnostics.save(cctkGH, hn);
+
+ }
+}
+
+//******************************************************************************
+
+//
+// This function is called by the Cactus scheduler, to copy any
+// desired apparent horizon info from Cactus variables.
+//
+extern "C"
+ void AHFinderDirect_recover(CCTK_ARGUMENTS)
+{
+DECLARE_CCTK_ARGUMENTS
+DECLARE_CCTK_PARAMETERS
+
+for (int hn = 1; hn <= N_horizons; ++ hn)
+ {
+
+ struct AH_data& AH_data = *state.AH_data_array[hn];
+ struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics;
+
+ // Load from grid array
+ BH_diagnostics.load(cctkGH, hn);
+
+ }
+}
+
+//******************************************************************************
+
} // namespace AHFinderDirect
diff --git a/src/driver/driver.hh b/src/driver/driver.hh
index ae169fd..6569ba8 100644
--- a/src/driver/driver.hh
+++ b/src/driver/driver.hh
@@ -34,7 +34,6 @@ enum method
//
enum verbose_level
{
- verbose_level__no_output,
verbose_level__physics_highlights,
verbose_level__physics_details,
verbose_level__algorithm_highlights,
@@ -57,17 +56,6 @@ enum initial_guess_method
initial_guess__coord_ellipsoid // no comma
};
-//
-// this enum holds the decoded horizon_file_format parameter, i.e.
-// it specifies what format of input/output file(s) we should use
-// for h and H (and other angular grid functions)
-//
-enum horizon_file_format
- {
- horizon_file_format__ASCII_gnuplot,
- horizon_file_format__HDF5 // no comma
- };
-
//******************************************************************************
//
@@ -77,6 +65,7 @@ enum horizon_file_format
struct initial_guess_info
{
enum initial_guess_method method;
+ bool reset_horizon_after_not_finding;
// parameters for method == initial_guess__read_from_named_file
struct {
@@ -120,9 +109,12 @@ struct solver_info
fp max_allowable_Delta_h_over_h;
fp Theta_norm_for_convergence;
fp max_allowable_Theta;
+ fp max_allowable_Theta_growth_iterations;
+ fp max_allowable_Theta_nonshrink_iterations;
fp *max_allowable_horizon_radius; // --> new[]-allocated array
// of size N_horizons+1 ,
// subscripted by hn
+ bool want_expansion_gradients;
};
//
@@ -140,11 +132,13 @@ struct IO_info
// should cut this down to something reasonable
enum { default_directory_permission = 0777 };
- enum horizon_file_format horizon_file_format;
+ bool output_ASCII_files;
+ bool output_HDF5_files;
bool output_initial_guess;
int output_h_every, output_Theta_every;
+ int output_mean_curvature_every;
// based on the above, do we want to output things now (this time step)?
- bool output_h, output_Theta;
+ bool output_h, output_Theta, output_mean_curvature;
bool output_BH_diagnostics;
const char* BH_diagnostics_directory;
@@ -157,7 +151,9 @@ struct IO_info
const char* h_directory;
const char* h_base_file_name;
const char* Theta_base_file_name;
+ const char* mean_curvature_base_file_name;
const char* Delta_h_base_file_name;
+ int h_min_digits;
const char* Jacobian_base_file_name;
@@ -289,7 +285,26 @@ struct AH_data
//
patch_system* ps_ptr;
Jacobian* Jac_ptr;
- fp surface_expansion;
+ what_to_compute compute_info;
+
+ bool move_origins;
+
+ bool use_pretracking;
+ int pretracking_max_iterations;
+
+ fp pretracking_value;
+ fp pretracking_minimum_value;
+ fp pretracking_maximum_value;
+ fp pretracking_delta;
+ fp pretracking_minimum_delta;
+ fp pretracking_maximum_delta;
+
+ int depends_on;
+ fp desired_value_factor;
+ fp desired_value_offset;
+
+ fp shiftout_factor;
+ fp smoothing_factor;
// are we finding this horizon "from scratch"?
// ... true if this is the first time we've tried to find it,
@@ -299,10 +314,16 @@ struct AH_data
// (so we have that position as a very good initial guess)
// ... also false if we're not finding this horizon on this processor
bool initial_find_flag;
+ // is this really the first time in this simulation that we are
+ // trying to find a horizon?
+ // ... true initially if this is a genuine horizon,
+ // false after the first time that a horizon has been found
+ bool really_initial_find_flag;
// used only if we're finding this horizon on this processor
struct initial_guess_info initial_guess_info;
+ bool search_flag; // did we search for this horizon
bool found_flag; // did we find this horizon (successfully)
bool h_files_written; // have we written horizon-shape or similar
// files for this horizon yet?
@@ -310,13 +331,6 @@ struct AH_data
struct BH_diagnostics BH_diagnostics;
FILE *BH_diagnostics_fileptr;
- bool store_info_in_SS_vars; // should we store this horizon
- // in the SphericalSurface variables?
- int SS_surface_number; // if store_info_in_SS_vars ,
- // this is the SphericalSurface
- // surface number to store into;
- // otherwise this is ignored
-
// interprocessor-communication buffers
// for this horizon's BH diagnostics and (optionally) horizon shape
struct horizon_buffers horizon_buffers;
@@ -329,20 +343,9 @@ struct AH_data
//
struct state
{
- int find_every;
- bool find_now(int cctk_iteration_in) const
- {
- return (find_every != 0)
- && ((cctk_iteration_in % find_every) == 0);
- }
-
enum method method;
-
struct error_info error_info;
struct verbose_info verbose_info;
-
- const char* metric_type; // copy of ADMBase::metric_type
-
int timer_handle;
int N_procs; // total number of processors
int my_proc; // processor number of this processor
@@ -356,7 +359,6 @@ struct state
struct cactus_grid_info cgi;
struct geometry_info gi;
- bool test_all_Jacobian_compute_methods;
struct Jacobian_info Jac_info;
struct solver_info solver_info;
struct IO_info IO_info;
@@ -364,19 +366,6 @@ struct state
struct BH_diagnostics_info BH_diagnostics_info;
struct mask_info mask_info;
- bool announce_centroid_flag; // should we announce horizon centroid?
- int which_horizon_to_announce_centroid; // if so, which horizon?
-
- // should we always broadcast each horizon shape from the processor
- // that finds it, to all processors, even if there's no apparent need
- // for this information on other processors?
- bool always_broadcast_horizon_shape;
-
- // this is the inclusive-or of AH_data.store_info_in_SS_vars
- // over all horizons, i.e. it says if we will store horizon
- // information in the SphericalSurface variables for *any* horizon
- bool store_info_in_SS_vars_for_any_horizon;
-
// interprocessor-communication buffers for broadcasting
// Newton-iteration status from active processors to all processors
struct iteration_status_buffers isb;
@@ -402,10 +391,6 @@ struct state
extern "C"
void AHFinderDirect_setup(CCTK_ARGUMENTS);
-// ... called from Cactus Scheduler
-extern "C"
- void AHFinderDirect_setupupdate(CCTK_ARGUMENTS);
-
// find_horizons.cc
// ... called from Cactus Scheduler
extern "C"
@@ -416,11 +401,6 @@ extern "C"
extern "C"
void AHFinderDirect_announce(CCTK_ARGUMENTS);
-// spherical_surface.cc
-// ... called from Cactus Scheduler
-extern "C"
- void AHFinderDirect_store_SS_info(CCTK_ARGUMENTS);
-
// mask.cc
// ... called from Cactus Scheduler
extern "C"
@@ -438,7 +418,8 @@ extern "C"
CCTK_INT AHFinderDirect_radius_in_direction
(CCTK_INT horizon_number,
CCTK_INT N_points,
- const CCTK_REAL* const x, const CCTK_REAL* const y, const CCTK_REAL* const z,
+ const CCTK_REAL* const x, const CCTK_REAL* const y, const CCTK_REAL* const
+z,
CCTK_REAL* const radius);
// initial_guess.cc
@@ -469,18 +450,22 @@ void Newton(const cGH* GH,
// io.cc
void input_gridfn(patch_system& ps, int unknown_gfn,
const struct IO_info& IO_info, const char base_file_name[],
+ int min_digits,
int hn, bool print_msg_flag, int AHF_iteration = 0);
void input_gridfn__explicit_name(patch_system& ps, int unknown_gfn,
const struct IO_info& IO_info,
const char file_name[], bool print_msg_flag);
void setup_h_files(patch_system& ps, const struct IO_info& IO_info, int hn);
void output_gridfn(patch_system& ps, int unknown_gfn,
+ const char gfn_name[], const cGH *cctkGH,
const struct IO_info& IO_info, const char base_file_name[],
+ int min_digits,
int hn, bool print_msg_flag, int AHF_iteration = 0);
void output_Jacobians(const patch_system& ps,
const Jacobian* Jac_NP_ptr,
const Jacobian* Jac_SD_FDdr_ptr,
const struct IO_info& IO_info, const char base_file_name[],
+ int min_digits,
int hn, bool print_msg_flag, int AHF_iteration = 0);
// misc-driver.cc
diff --git a/src/driver/find_horizons.cc b/src/driver/find_horizons.cc
index bf3f25a..45cc780 100644
--- a/src/driver/find_horizons.cc
+++ b/src/driver/find_horizons.cc
@@ -6,8 +6,6 @@
// AHFinderDirect_find_horizons - top-level driver to find apparent horizons
///
/// find_horizon - find a horizon
-/// print_summary_of_which_horizons_found
-///
/// do_evaluate_expansions
/// do_test_expansion_Jacobian
///
@@ -15,10 +13,12 @@
#include <stdio.h>
#include <assert.h>
#include <math.h>
+#include <string.h>
-#include "util_String.h"
+#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -26,6 +26,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -48,7 +49,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -63,8 +63,6 @@ extern struct state state;
// ***** prototypes for functions local to this file
//
namespace {
-void print_summary_of_which_horizons_found
- (int N_horizons, const struct AH_data* const* AH_data_array);
void do_evaluate_expansions(int my_proc, int N_horizons,
horizon_sequence& hs,
struct AH_data* const AH_data_array[],
@@ -89,6 +87,36 @@ void do_test_expansion_Jacobians(int my_proc, int N_horizons,
//******************************************************************************
//
+// This function is called by the Cactus scheduler to import
+// the excision mask.
+//
+extern "C"
+ void AHFinderDirect_import_mask(CCTK_ARGUMENTS)
+{
+DECLARE_CCTK_ARGUMENTS
+DECLARE_CCTK_PARAMETERS
+
+for (int k=0; k<cctk_lsh[2]; ++k)
+for (int j=0; j<cctk_lsh[1]; ++j)
+for (int i=0; i<cctk_lsh[0]; ++i)
+{
+ const int ind = CCTK_GFINDEX3D(cctkGH,i,j,k);
+ // zero means: point can be used,
+ // non-zero means: point must be avoided
+ ahmask[ind] = 0;
+ if (use_mask)
+ // grid points with mask values of 1.0 can be used,
+ // values of 0.0 and 0.5 must be avoided.
+ // the excision boundary cannot be used because
+ // (a) it is inaccurate
+ // (b) it does not respect the symmetries e.g. in Kerr.
+ then ahmask[ind] = fabs(emask[ind] - 1.0) > 0.01;
+}
+}
+
+//******************************************************************************
+
+//
// This function is called by the Cactus scheduler to find the apparent
// horizon or horizons in the current slice.
//
@@ -96,22 +124,44 @@ extern "C"
void AHFinderDirect_find_horizons(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
+DECLARE_CCTK_PARAMETERS
-// only try to find horizons every find_every time steps
-if (! state.find_now(cctk_iteration))
- then return; // *** NO-OP RETURN ***
+// determine whether a horizon should be found at this iteration
+bool find_any = false;
+for (int hn = 1; hn <= state.my_hs->N_horizons(); ++ hn)
+{
+ // only try to find horizons every find_every time steps
+ const int my_find_after = find_after_individual[hn];
+ const int my_dont_find_after = dont_find_after_individual[hn];
+ const fp my_find_after_time = find_after_individual_time[hn];
+ const fp my_dont_find_after_time = dont_find_after_individual_time[hn];
+ const int my_find_every = (find_every_individual[hn] >= 0
+ ? find_every_individual[hn]
+ : find_every);
+ const bool find_this = cctk_iteration >= my_find_after
+ && (my_dont_find_after < 0
+ ? true
+ : cctk_iteration <= my_dont_find_after)
+ && cctk_time >= my_find_after_time
+ && (my_dont_find_after_time <= my_find_after_time
+ ? true
+ : cctk_time <= my_dont_find_after_time)
+ && my_find_every > 0
+ && cctk_iteration % my_find_every == 0
+ && ! disable_horizon[hn];
+ struct AH_data& AH_data = *state.AH_data_array[hn];
+ AH_data.search_flag = find_this;
+ find_any = find_any || find_this;
+}
+if (! find_any) return;
if (state.timer_handle >= 0)
then CCTK_TimerResetI(state.timer_handle);
const int my_proc = state.my_proc;
-const int N_horizons = state.N_horizons;
horizon_sequence& hs = *state.my_hs;
const bool active_flag = hs.has_genuine_horizons();
-const bool broadcast_horizon_shape
- = state.always_broadcast_horizon_shape
- || state.mask_info.set_mask_for_any_horizon
- || state.store_info_in_SS_vars_for_any_horizon;
+const bool broadcast_horizon_shape = true;
struct cactus_grid_info& cgi = state.cgi;
const struct geometry_info& gi = state.gi;
@@ -122,13 +172,50 @@ const struct verbose_info& verbose_info = state.verbose_info;
// what are the semantics of the Cactus gxx variables? (these may
// change from one call to another, so we have to re-check each time)
-if (CCTK_Equals(state.metric_type, "physical"))
+if (CCTK_Equals(metric_type, "physical"))
then cgi.use_Cactus_conformal_metric = false;
-else if (CCTK_Equals(state.metric_type, "static conformal"))
+else if (CCTK_Equals(metric_type, "static conformal"))
then cgi.use_Cactus_conformal_metric = (*conformal_state > 0);
else CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"AHFinderDirect_find_horizons(): unknown ADMBase::metric_type=\"%s\"!",
- state.metric_type); /*NOTREACHED*/
+"AHFinderDirect_find_horizons(): unknown metric_type=\"%s\"!",
+ metric_type); /*NOTREACHED*/
+
+// update parameters
+IO_info.output_ASCII_files = (output_ASCII_files != 0);
+IO_info.output_HDF5_files = (output_HDF5_files != 0);
+IO_info.output_initial_guess = (output_initial_guess != 0);
+IO_info.output_h_every = output_h_every;
+IO_info.output_Theta_every = output_Theta_every;
+IO_info.output_mean_curvature_every = output_mean_curvature_every;
+IO_info.output_h = false; // dummy value
+IO_info.output_Theta = false; // dummy value
+IO_info.output_mean_curvature = false; // dummy value
+
+IO_info.output_BH_diagnostics = (output_BH_diagnostics != 0);
+IO_info.BH_diagnostics_directory
+ = (strlen(BH_diagnostics_directory) == 0)
+ ? /* IO:: */ out_dir
+ : BH_diagnostics_directory;
+IO_info.BH_diagnostics_base_file_name = BH_diagnostics_base_file_name;
+IO_info.BH_diagnostics_file_name_extension = BH_diagnostics_file_name_extension;
+
+IO_info.output_ghost_zones_for_h = (output_ghost_zones_for_h != 0);
+IO_info.ASCII_gnuplot_file_name_extension = ASCII_gnuplot_file_name_extension;
+IO_info.HDF5_file_name_extension = HDF5_file_name_extension;
+IO_info.h_directory
+ = (strlen(h_directory) == 0)
+ ? /* IO:: */ out_dir
+ : h_directory;
+IO_info.h_base_file_name = h_base_file_name;
+IO_info.Theta_base_file_name = Theta_base_file_name;
+IO_info.mean_curvature_base_file_name = mean_curvature_base_file_name;
+IO_info.Delta_h_base_file_name = Delta_h_base_file_name;
+IO_info.h_min_digits = h_min_digits;
+IO_info.Jacobian_base_file_name = Jacobian_base_file_name;
+IO_info.output_OpenDX_control_files = (output_OpenDX_control_files != 0);
+IO_info.OpenDX_control_file_name_extension = OpenDX_control_file_name_extension;
+IO_info.time_iteration = 0;
+IO_info.time = 0.0;
// get the Cactus time step and decide if we want to output h and/or Theta now
IO_info.time_iteration = cctk_iteration;
@@ -139,6 +226,9 @@ IO_info.output_h
IO_info.output_Theta
= (IO_info.output_Theta_every > 0)
&& ((IO_info.time_iteration % IO_info.output_Theta_every) == 0);
+IO_info.output_mean_curvature
+ = (IO_info.output_mean_curvature_every > 0)
+ && ((IO_info.time_iteration % IO_info.output_mean_curvature_every) == 0);
// set initial guess for any (genuine) horizons that need it,
// i.e. for any (genuine) horizons where we didn't find the horizon previously
@@ -146,21 +236,39 @@ IO_info.output_Theta
{
assert( state.AH_data_array[hn] != NULL );
struct AH_data& AH_data = *state.AH_data_array[hn];
+ if (verbose_info.print_algorithm_highlights) {
+ printf ("AHF find_horizons[%d] initial_find_flag=%d\n", hn, (int) AH_data.initial_find_flag);
+ printf ("AHF find_horizons[%d] really_initial_find_flag=%d\n", hn, (int) AH_data.really_initial_find_flag);
+ printf ("AHF find_horizons[%d] search_flag=%d\n", hn, (int) AH_data.search_flag);
+ printf ("AHF find_horizons[%d] found_flag=%d\n", hn, (int) AH_data.found_flag);
+ }
if (AH_data.found_flag)
- then AH_data.initial_find_flag = false;
+ then {
+ AH_data.initial_find_flag = false;
+ AH_data.really_initial_find_flag = false;
+ }
else {
- patch_system& ps = *AH_data.ps_ptr;
- setup_initial_guess(ps,
- AH_data.initial_guess_info,
- IO_info,
- hn, N_horizons, verbose_info);
- if (active_flag && IO_info.output_initial_guess)
- then output_gridfn(ps, gfns::gfn__h,
- IO_info, IO_info.h_base_file_name,
- hn, verbose_info
- .print_algorithm_highlights);
- AH_data.initial_find_flag = true;
- }
+ if (AH_data.really_initial_find_flag
+ || AH_data.initial_guess_info.reset_horizon_after_not_finding)
+ then {
+ patch_system& ps = *AH_data.ps_ptr;
+ if (verbose_info.print_algorithm_highlights) {
+ printf ("AHF find_horizons[%d] setup_initial_guess\n", hn);
+ }
+ setup_initial_guess(ps,
+ AH_data.initial_guess_info,
+ IO_info,
+ hn, N_horizons, verbose_info);
+ if (active_flag && IO_info.output_initial_guess)
+ then output_gridfn(ps, gfns::gfn__h,
+ "h", cgi.GH,
+ IO_info, IO_info.h_base_file_name,
+ IO_info.h_min_digits,
+ hn, verbose_info
+ .print_algorithm_highlights);
+ AH_data.initial_find_flag = true;
+ }
+ }
}
//
@@ -180,7 +288,7 @@ case method__test_expansion_Jacobians:
do_test_expansion_Jacobians(my_proc, N_horizons,
state.AH_data_array,
cgi, gi, Jac_info,
- state.test_all_Jacobian_compute_methods,
+ (test_all_Jacobian_compute_methods != 0),
IO_info, error_info, verbose_info,
state.timer_handle);
break;
@@ -198,10 +306,6 @@ case method__find_horizons:
state.isb);
if (state.timer_handle >= 0)
then CCTK_TimerStopI(state.timer_handle);
- if (verbose_info.print_physics_highlights
- && !verbose_info.print_physics_details)
- then print_summary_of_which_horizons_found(N_horizons,
- state.AH_data_array);
break;
}
@@ -223,53 +327,6 @@ if (state.timer_handle >= 0)
}
//******************************************************************************
-
-//
-// This function prints (using CCTK_VInfo()) a 1-line summary of
-// which AHs were / were not found.
-//
-namespace {
-void print_summary_of_which_horizons_found
- (int N_horizons, const struct AH_data* const* AH_data_array)
-{
-const int hn_buffer_size = 10; // buffer for single "%d" for hn
-char hn_buffer[hn_buffer_size];
-const int msg_buffer_size = 200; // buffer for the entire line
-char msg_buffer[msg_buffer_size];
-
-msg_buffer[0] = '\0';
-Util_Strlcpy(msg_buffer, "found horizon(s) ", msg_buffer_size);;
-
-bool already_found_flag = false; // running inclusive-or of found_flag
- for (int hn = 1 ; hn <= N_horizons ; ++hn)
- {
- assert(AH_data_array[hn] != NULL);
- bool found_flag = AH_data_array[hn]->found_flag;
- if (found_flag)
- then {
- if (already_found_flag)
- then Util_Strlcat(msg_buffer, ",", msg_buffer_size);
- already_found_flag = true;
- snprintf(hn_buffer, hn_buffer_size, "%d", hn);
- Util_Strlcat(msg_buffer, hn_buffer, msg_buffer_size);
- }
- }
-
-if (already_found_flag)
- then {
- // we found one or more horizons
- Util_Strlcat(msg_buffer, " of ", msg_buffer_size);
-
- snprintf(hn_buffer, hn_buffer_size, "%d", N_horizons);
- Util_Strlcat(msg_buffer, hn_buffer, msg_buffer_size);
- }
- else Util_Strlcpy(msg_buffer, "no horizons found", msg_buffer_size);
-
-CCTK_VInfo(CCTK_THORNSTRING, msg_buffer);
-}
- }
-
-//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -317,7 +374,8 @@ if (active_flag)
if (timer_handle >= 0)
then CCTK_TimerStartI(timer_handle);
jtutil::norm<fp> Theta_norms;
- const bool Theta_ok = expansion(&ps, -AH_data.surface_expansion,
+ const bool Theta_ok = expansion(&ps,
+ AH_data.compute_info,
cgi, gi,
error_info, true,// initial eval
false, // no Jacobian coeffs
@@ -328,7 +386,9 @@ if (active_flag)
if (IO_info.output_h)
then output_gridfn(ps, gfns::gfn__h,
+ "h", cgi.GH,
IO_info, IO_info.h_base_file_name,
+ IO_info.h_min_digits,
hn, verbose_info.print_algorithm_details);
if (Theta_ok)
@@ -338,17 +398,28 @@ if (active_flag)
Theta_norms.rms_norm(), Theta_norms.infinity_norm());
if (IO_info.output_Theta)
then output_gridfn(ps, gfns::gfn__Theta,
+ "Theta", cgi.GH,
IO_info, IO_info
.Theta_base_file_name,
+ IO_info.h_min_digits,
+ hn, verbose_info
+ .print_algorithm_details);
+ if (IO_info.output_mean_curvature)
+ then output_gridfn(ps, gfns::gfn__mean_curvature,
+ "mean_curvature", cgi.GH,
+ IO_info, IO_info
+ .mean_curvature_base_file_name,
+ IO_info.h_min_digits,
hn, verbose_info
.print_algorithm_details);
}
}
}
else {
+ struct what_to_compute new_compute_info;
for (int i = 0 ; i < N_horizons ; ++i)
{
- expansion(NULL, 0.0, // dummy computation
+ expansion(NULL, new_compute_info,
cgi, gi,
error_info, true); // initial evaluation
}
@@ -402,17 +473,22 @@ const int hn = 1;
struct AH_data* const AH_data_ptr = active_flag ? AH_data_array[hn] : NULL;
patch_system* const ps_ptr = active_flag ? AH_data_ptr->ps_ptr : NULL;
-const fp add_to_expansion = active_flag ? -AH_data_ptr->surface_expansion : 0.0;
+struct what_to_compute dummy_compute_info;
+struct what_to_compute & compute_info =
+ active_flag
+ ? AH_data_ptr->compute_info
+ : dummy_compute_info;
//
// numerical-perturbation Jacobian
//
Jacobian* Jac_NP_ptr = active_flag ? AH_data_ptr->Jac_ptr : NULL;
-expansion(ps_ptr, add_to_expansion,
+expansion(ps_ptr, compute_info,
cgi, gi,
error_info, true); // initial evaluation
Jac_info.Jacobian_compute_method = Jacobian__numerical_perturbation;
-expansion_Jacobian(ps_ptr, Jac_NP_ptr, add_to_expansion,
+expansion_Jacobian(ps_ptr, Jac_NP_ptr,
+ compute_info,
cgi, gi, Jac_info,
error_info, true, // initial evaluation
print_msg_flag);
@@ -426,12 +502,13 @@ if (test_all_Jacobian_compute_methods)
*ps_ptr,
verbose_info.print_algorithm_details)
: NULL;
- expansion(ps_ptr, add_to_expansion,
+ expansion(ps_ptr, compute_info,
cgi, gi,
error_info, true, // initial evaluation
true); // compute SD Jacobian coeffs
Jac_info.Jacobian_compute_method = Jacobian__symbolic_diff_with_FD_dr;
- expansion_Jacobian(ps_ptr, Jac_SD_FDdr_ptr, add_to_expansion,
+ expansion_Jacobian(ps_ptr, Jac_SD_FDdr_ptr,
+ compute_info,
cgi, gi, Jac_info,
error_info, true, // initial evaluation
print_msg_flag);
@@ -441,6 +518,7 @@ if (active_flag)
then output_Jacobians(*ps_ptr,
Jac_NP_ptr, Jac_SD_FDdr_ptr,
IO_info, IO_info.Jacobian_base_file_name,
+ IO_info.h_min_digits,
hn, print_msg_flag);
}
}
diff --git a/src/driver/horizon_sequence.cc b/src/driver/horizon_sequence.cc
index 42345a7..e33c997 100644
--- a/src/driver/horizon_sequence.cc
+++ b/src/driver/horizon_sequence.cc
@@ -57,19 +57,19 @@ delete[] my_hn_;
//
char* horizon_sequence::sequence_string(const char sep[]) const
{
-const int hn_buffer_size = 10; // buffer size for single "%d"
-char hn_buffer[hn_buffer_size];
+const int N_hn_buffer = 10;
+char hn_buffer[N_hn_buffer];
-const int buffer_size = 200; // buffer size for entire string
-static char buffer[buffer_size];
+const int N_buffer = 100;
+static char buffer[N_buffer];
buffer[0] = '\0';
for (int pos = 0 ; pos < my_N_horizons_ ; ++pos)
{
if (pos > 0)
- then Util_Strlcat(buffer, sep, buffer_size);
- snprintf(hn_buffer, hn_buffer_size, "%d", my_hn_[pos]);
- Util_Strlcat(buffer, hn_buffer, buffer_size);
+ then Util_Strlcat(buffer, sep, N_buffer);
+ snprintf(hn_buffer, N_hn_buffer, "%d", my_hn_[pos]);
+ Util_Strlcat(buffer, hn_buffer, N_buffer);
}
return buffer;
diff --git a/src/driver/initial_guess.cc b/src/driver/initial_guess.cc
index 5f3fae4..315a47f 100644
--- a/src/driver/initial_guess.cc
+++ b/src/driver/initial_guess.cc
@@ -17,6 +17,7 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -24,6 +25,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -46,7 +48,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -94,7 +95,7 @@ case initial_guess__read_from_named_file:
case initial_guess__read_from_h_file:
input_gridfn(ps, gfns::gfn__h,
- IO_info, IO_info.h_base_file_name,
+ IO_info, IO_info.h_base_file_name, IO_info.h_min_digits,
hn, verbose_info.print_algorithm_highlights);
break;
diff --git a/src/driver/io.cc b/src/driver/io.cc
index e7ea3e7..6202eaa 100644
--- a/src/driver/io.cc
+++ b/src/driver/io.cc
@@ -9,8 +9,8 @@
// output_gridfn - write an angular grid function to an output file
// output_Jacobians - write a Jacobian matrix or matrices to an output file
//
-/// io_file_name - compute file name for angular-gridfn I/O file
-/// OpenDX_control_file_name - compute file name for OpenDX control file
+/// io_ASCII_file_name - compute file name for angular-gridfn I/O file
+/// io_HDF5_file_name - compute file name for angular-gridfn I/O file
//
#include <stdio.h>
@@ -21,6 +21,7 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -28,6 +29,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -50,7 +52,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
@@ -64,13 +65,15 @@ namespace {
void output_OpenDX_control_file(const patch_system& ps,
const struct IO_info& IO_info,
int hn);
-
-const char* io_file_name(const struct IO_info& IO_info,
- const char base_file_name[],
- int hn, int AHF_iteration = 0);
-const char* OpenDX_control_file_name(const struct IO_info& IO_info,
- const char base_file_name[],
- int hn);
+const char* io_ASCII_file_name(const struct IO_info& IO_info,
+ const char base_file_name[],
+ int min_digits,
+ int hn, int AHF_iteration = 0);
+const char* io_HDF5_file_name(const struct IO_info& IO_info,
+ const char base_file_name[],
+ int min_digits,
+ int hn, int AHF_iteration = 0);
+void create_h_directory(const struct IO_info& IO_info);
}
//******************************************************************************
@@ -86,10 +89,11 @@ const char* OpenDX_control_file_name(const struct IO_info& IO_info,
//
void input_gridfn(patch_system& ps, int unknown_gfn,
const struct IO_info& IO_info, const char base_file_name[],
+ int min_digits,
int hn, bool print_msg_flag, int AHF_iteration /* = 0 */)
{
-const char* file_name = io_file_name(IO_info, base_file_name,
- hn, AHF_iteration);
+const char* file_name = io_ASCII_file_name(IO_info, base_file_name, min_digits,
+ hn, AHF_iteration);
input_gridfn__explicit_name(ps, unknown_gfn,
IO_info, base_file_name, print_msg_flag);
@@ -115,27 +119,25 @@ if (print_msg_flag)
" reading initial guess from \"%s\"", file_name);
}
-switch (IO_info.horizon_file_format)
- {
-case horizon_file_format__ASCII_gnuplot:
+if (IO_info.output_ASCII_files)
+ then {
ps.read_ghosted_gridfn(unknown_gfn,
file_name,
false); // no ghost zones in data file
- break;
+ }
-case horizon_file_format__HDF5:
+else if (IO_info.output_HDF5_files)
+ then {
CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"input_gridfn__explicit_name(): HDF5 data files not implemented yet!");
- /*NOTREACHED*/
+"input_gridfn__explicit_name(): reading from HDF5 data files not implemented yet!");
+ }
-default:
+else
+ {
CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
"\n"
" input_gridfn__explicit_name():\n"
-" unknown IO_info.horizon_file_format=(int)%d!\n"
-" (this should never happen!)"
- ,
- int(IO_info.horizon_file_format)); /*NOTREACHED*/
+" (this should never happen!)"); /*NOTREACHED*/
}
}
@@ -151,6 +153,19 @@ default:
void setup_h_files(patch_system& ps, const struct IO_info& IO_info, int hn)
{
// create the output directory (if it doesn't already exist)
+create_h_directory(IO_info);
+output_OpenDX_control_file(ps, IO_info, hn);
+}
+
+//******************************************************************************
+
+//
+// This function creates the h ooutput directory if it does not exist
+//
+namespace {
+void create_h_directory(const struct IO_info& IO_info)
+{
+// create the output directory (if it doesn't already exist)
const int status = CCTK_CreateDirectory(IO_info.default_directory_permission,
IO_info.h_directory);
if (status < 0)
@@ -162,9 +177,8 @@ if (status < 0)
,
status,
IO_info.h_directory); /*NOTREACHED*/
-
-output_OpenDX_control_file(ps, IO_info, hn);
}
+ }
//******************************************************************************
@@ -178,14 +192,18 @@ void output_OpenDX_control_file(const patch_system& ps,
const struct IO_info& IO_info,
int hn)
{
-const char* file_name = OpenDX_control_file_name(IO_info,
- IO_info.h_base_file_name,
- hn);
-FILE *fileptr = fopen(file_name, "w");
+if (! IO_info.output_OpenDX_control_files) return;
+static char file_name_buffer[IO_info::file_name_buffer_size];
+snprintf(file_name_buffer, IO_info::file_name_buffer_size,
+ "%s/%s.ah%d.%s",
+ IO_info.h_directory, IO_info.h_base_file_name,
+ hn, IO_info.OpenDX_control_file_name_extension);
+
+FILE *fileptr = fopen(file_name_buffer, "w");
if (fileptr == NULL)
then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
"output_OpenDX_control_file(): can't open output file \"%s\"!",
- file_name); /*NOTREACHED*/
+ file_name_buffer); /*NOTREACHED*/
fprintf(fileptr, "# list the size of each patch (N_rho x N_sigma)\n");
for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
@@ -222,15 +240,20 @@ fclose(fileptr);
// FIXME: if the gridfn is not h, we assume that it's nominal-grid.
//
void output_gridfn(patch_system& ps, int unknown_gfn,
+ const char gfn_name[], const cGH *cctkGH,
const struct IO_info& IO_info, const char base_file_name[],
+ int min_digits,
int hn, bool print_msg_flag, int AHF_iteration /* = 0 */)
{
-const char* file_name = io_file_name(IO_info, base_file_name,
+
+if (IO_info.output_ASCII_files)
+ then {
+ const char* file_name
+ = io_ASCII_file_name(IO_info, base_file_name, min_digits,
hn, AHF_iteration);
+ // create the output directory (if it doesn't already exist)
+ create_h_directory(IO_info);
-switch (IO_info.horizon_file_format)
- {
-case horizon_file_format__ASCII_gnuplot:
switch (unknown_gfn)
{
case gfns::gfn__h:
@@ -250,6 +273,12 @@ case horizon_file_format__ASCII_gnuplot:
"writing Theta to \"%s\"", file_name);
ps.print_gridfn(unknown_gfn, file_name);
break;
+ case gfns::gfn__mean_curvature:
+ if (print_msg_flag)
+ then CCTK_VInfo(CCTK_THORNSTRING,
+ "writing mean curvature to \"%s\"", file_name);
+ ps.print_gridfn(unknown_gfn, file_name);
+ break;
case gfns::gfn__Delta_h:
if (print_msg_flag)
then CCTK_VInfo(CCTK_THORNSTRING,
@@ -264,19 +293,52 @@ case horizon_file_format__ASCII_gnuplot:
ps.print_gridfn(unknown_gfn, file_name);
break;
}
- break;
+ }
-case horizon_file_format__HDF5:
- CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"output_gridfn(): HDF5 data files not implemented yet!"); /*NOTREACHED*/
+if (IO_info.output_HDF5_files)
+ then {
+ const char* file_name
+ = io_HDF5_file_name(IO_info, base_file_name, min_digits,
+ hn, AHF_iteration);
+ // create the output directory (if it doesn't already exist)
+ create_h_directory(IO_info);
-default:
- CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"\n"
-" output_gridfn(): unknown IO_info.horizon_file_format=(int)%d!\n"
-" (this should never happen!)"
- ,
- int(IO_info.horizon_file_format)); /*NOTREACHED*/
+ switch (unknown_gfn)
+ {
+ case gfns::gfn__h:
+ if (print_msg_flag)
+ then CCTK_VInfo(CCTK_THORNSTRING,
+ "writing h to \"%s\"", file_name);
+ ps.output_ghosted_gridfn_with_xyz
+ (unknown_gfn, gfn_name, cctkGH,
+ true, gfns::gfn__h,
+ file_name,
+ IO_info.output_ghost_zones_for_h); // should we include
+ // ghost zones?
+ break;
+ case gfns::gfn__Theta:
+ if (print_msg_flag)
+ then CCTK_VInfo(CCTK_THORNSTRING,
+ "writing Theta to \"%s\"", file_name);
+ ps.output_gridfn(unknown_gfn, gfn_name, cctkGH,
+ file_name);
+ break;
+ case gfns::gfn__Delta_h:
+ if (print_msg_flag)
+ then CCTK_VInfo(CCTK_THORNSTRING,
+ "writing Delta_h to \"%s\"", file_name);
+ ps.output_gridfn(unknown_gfn, gfn_name, cctkGH,
+ file_name);
+ break;
+ default:
+ if (print_msg_flag)
+ then CCTK_VInfo(CCTK_THORNSTRING,
+ "writing gfn=%d to \"%s\"",
+ unknown_gfn, file_name);
+ ps.output_gridfn(unknown_gfn, gfn_name, cctkGH,
+ file_name);
+ break;
+ }
}
}
@@ -296,17 +358,21 @@ void output_Jacobians(const patch_system& ps,
const Jacobian* Jac_NP_ptr,
const Jacobian* Jac_SD_FDdr_ptr,
const struct IO_info& IO_info, const char base_file_name[],
+ int min_digits,
int hn, bool print_msg_flag, int AHF_iteration /* = 0 */)
{
if (Jac_NP_ptr == NULL)
then {
- CCTK_VWarn(SERIOUS_WARNING, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
"output_Jacobians(): Jac_NP_ptr == NULL is not (yet) supported!");
return; // *** ERROR RETURN ***
}
-const char* file_name = io_file_name(IO_info, base_file_name,
- hn, AHF_iteration);
+const char* file_name = io_ASCII_file_name(IO_info, base_file_name, min_digits,
+ hn, AHF_iteration);
+// create the output directory (if it doesn't already exist)
+create_h_directory(IO_info);
+
if (print_msg_flag)
then CCTK_VInfo(CCTK_THORNSTRING,
" writing %s to \"%s\"",
@@ -427,40 +493,25 @@ fclose(fileptr);
// result points into a private static buffer; the usual caveats apply.
//
namespace {
-const char* io_file_name(const struct IO_info& IO_info,
- const char base_file_name[],
- int hn, int AHF_iteration /* = 0 */)
+const char* io_ASCII_file_name(const struct IO_info& IO_info,
+ const char base_file_name[], int min_digits,
+ int hn, int AHF_iteration /* = 0 */)
{
static char file_name_buffer[IO_info::file_name_buffer_size];
-const char* file_name_extension;
-switch (IO_info.horizon_file_format)
- {
-case horizon_file_format__ASCII_gnuplot:
- file_name_extension = IO_info.ASCII_gnuplot_file_name_extension;
- break;
-case horizon_file_format__HDF5:
- file_name_extension = IO_info.HDF5_file_name_extension;
- break;
-default:
- CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"\n"
-" io_file_name(): unknown IO_info.horizon_file_format=(int)%d!\n"
-" (this should never happen!)"
- ,
- int(IO_info.horizon_file_format)); /*NOTREACHED*/
- }
+const char* file_name_extension
+ = IO_info.ASCII_gnuplot_file_name_extension;
if (AHF_iteration == 0)
then snprintf(file_name_buffer, IO_info::file_name_buffer_size,
- "%s/%s.t%d.ah%d.%s",
+ "%s/%s.t%0*d.ah%d.%s",
IO_info.h_directory, base_file_name,
- IO_info.time_iteration, hn,
+ min_digits, IO_info.time_iteration, hn,
file_name_extension);
else snprintf(file_name_buffer, IO_info::file_name_buffer_size,
- "%s/%s.t%d.ah%d.it%d.%s",
+ "%s/%s.t%0*d.ah%d.it%d.%s",
IO_info.h_directory, base_file_name,
- IO_info.time_iteration, hn, AHF_iteration,
+ min_digits, IO_info.time_iteration, hn, AHF_iteration,
file_name_extension);
return file_name_buffer;
@@ -470,48 +521,42 @@ return file_name_buffer;
//******************************************************************************
//
-// This function encapsulates our file-naming conventions for OpenDX
-// control files for our regular angular-gridfn output files.
+// This function encapsulates our file-naming conventions for angular-gridfn
+// output files (those used for h, H, and other angular grid functions).
//
// Arguments:
// base_file_name[] = from the parameter file
// hn = the horizon number
+// AHF_iteration = the apparent horizon finder's internal iteration
+// number (>= 1) if this is an intermediate iterate,
+// or the default (0) if this is a final computed
+// horizon position
//
// Results:
// This function returns (a pointer to) the file name. The returned
// result points into a private static buffer; the usual caveats apply.
//
namespace {
-const char* OpenDX_control_file_name(const struct IO_info& IO_info,
- const char base_file_name[],
- int hn)
+const char* io_HDF5_file_name(const struct IO_info& IO_info,
+ const char base_file_name[], int min_digits,
+ int hn, int AHF_iteration /* = 0 */)
{
-const char* file_name_extension;
+static char file_name_buffer[IO_info::file_name_buffer_size];
-switch (IO_info.horizon_file_format)
- {
-case horizon_file_format__ASCII_gnuplot:
- file_name_extension = IO_info.OpenDX_control_file_name_extension;
- break;
-case horizon_file_format__HDF5:
- CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"\n"
-" OpenDX_control_file_name(): don't know how to form OpenDX control file\n"
-" name for HDF output files!"); /*NOTREACHED*/
-default:
- CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"\n"
-" OpenDX_control_file_name(): unknown IO_info.horizon_file_format=(int)%d!\n"
-" (this should never happen!)"
- ,
- int(IO_info.horizon_file_format)); /*NOTREACHED*/
- }
+const char* file_name_extension
+ = IO_info.HDF5_file_name_extension;
-static char file_name_buffer[IO_info::file_name_buffer_size];
-snprintf(file_name_buffer, IO_info::file_name_buffer_size,
- "%s/%s.ah%d.%s",
- IO_info.h_directory, base_file_name, hn,
- file_name_extension);
+if (AHF_iteration == 0)
+ then snprintf(file_name_buffer, IO_info::file_name_buffer_size,
+ "%s/%s.ah%d.%s",
+ IO_info.h_directory, base_file_name,
+ hn,
+ file_name_extension);
+ else snprintf(file_name_buffer, IO_info::file_name_buffer_size,
+ "%s/%s.ah%d.it%d.%s",
+ IO_info.h_directory, base_file_name,
+ hn, AHF_iteration,
+ file_name_extension);
return file_name_buffer;
}
diff --git a/src/driver/make.code.defn b/src/driver/make.code.defn
index 7f9ae10..9da0915 100644
--- a/src/driver/make.code.defn
+++ b/src/driver/make.code.defn
@@ -7,21 +7,7 @@ SRCS = state.cc \
initial_guess.cc Newton.cc \
io.cc misc-driver.cc \
BH_diagnostics.cc horizon_sequence.cc \
- mask.cc announce.cc spherical_surface.cc aliased_functions.cc
+ mask.cc announce.cc aliased_functions.cc
# Subdirectories containing source files
SUBDIRS =
-
-# disable automatic template instantiation on DEC Alphas cxx compiler
-ifeq ($(shell uname), OSF1)
- ifeq ($(CXX), cxx)
- CXXFLAGS += -nopt
- endif
-endif
-
-# disable automagic template instantiation on SGI Irix CC compiler
-ifneq (,$(findstring IRIX,$(shell uname)))
- ifeq ($(notdir $(CXX)), CC)
- CXXFLAGS += -no_auto_include
- endif
-endif
diff --git a/src/driver/mask.cc b/src/driver/mask.cc
index 19ce183..ce7ebf1 100644
--- a/src/driver/mask.cc
+++ b/src/driver/mask.cc
@@ -21,6 +21,7 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "SpaceMask.h" // from thorn SpaceMask
@@ -30,6 +31,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -55,7 +57,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -170,6 +171,7 @@ extern "C"
void AHFinderDirect_maybe_do_masks(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS
+DECLARE_CCTK_PARAMETERS
const struct verbose_info& verbose_info = state.verbose_info;
struct mask_info& mask_info = state.mask_info;
@@ -377,23 +379,20 @@ if (verbose_info.print_algorithm_highlights)
}
}
-if (verbose_info.print_algorithm_details)
+if (verbose_info.print_algorithm_debug)
then {
CCTK_VInfo(CCTK_THORNSTRING,
- " this grid has x=[%g,%g] Delta_x=%g",
+ " grid on this processor has x=[%g,%g]",
double(mgi.global_xyz_of_ijk(X_AXIS, 0)),
- double(mgi.global_xyz_of_ijk(X_AXIS, mgi.proc_gridfn_dims[X_AXIS]-1)),
- double(mgi.coord_delta[X_AXIS]));
+ double(mgi.global_xyz_of_ijk(X_AXIS, mgi.proc_gridfn_dims[X_AXIS]-1)));
CCTK_VInfo(CCTK_THORNSTRING,
- " y=[%g,%g] Delta_y=%g",
+ " y=[%g,%g]",
double(mgi.global_xyz_of_ijk(Y_AXIS, 0)),
- double(mgi.global_xyz_of_ijk(Y_AXIS, mgi.proc_gridfn_dims[Y_AXIS]-1)),
- double(mgi.coord_delta[Y_AXIS]));
+ double(mgi.global_xyz_of_ijk(Y_AXIS, mgi.proc_gridfn_dims[Y_AXIS]-1)));
CCTK_VInfo(CCTK_THORNSTRING,
- " z=[%g,%g] Delta_z=%g",
+ " z=[%g,%g]",
double(mgi.global_xyz_of_ijk(Z_AXIS, 0)),
- double(mgi.global_xyz_of_ijk(Z_AXIS, mgi.proc_gridfn_dims[Z_AXIS]-1)),
- double(mgi.coord_delta[Z_AXIS]));
+ double(mgi.global_xyz_of_ijk(Z_AXIS, mgi.proc_gridfn_dims[Z_AXIS]-1)));
}
@@ -659,7 +658,7 @@ long buffer_count = 0;
//
// FIXME:
// it would be more efficient here to compute the
- // radia of a whole batch of points at once
+ // radii of a whole batch of points at once
const fp r_horizon = ps.radius_in_local_xyz_direction
(gfns::gfn__h,
local_x, local_y, local_z);
diff --git a/src/driver/misc-driver.cc b/src/driver/misc-driver.cc
index 0297529..e3cc6b0 100644
--- a/src/driver/misc-driver.cc
+++ b/src/driver/misc-driver.cc
@@ -11,6 +11,7 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -18,6 +19,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -40,7 +42,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
diff --git a/src/driver/setup.cc b/src/driver/setup.cc
index d010d32..5217097 100644
--- a/src/driver/setup.cc
+++ b/src/driver/setup.cc
@@ -5,24 +5,23 @@
// <<<access to persistent data>>>
//
// AHFinderDirect_setup - top-level driver to setup persistent data structures
-// AHFinderDirect_update - top-level driver to update from steerable parameters
-//
-/// set_mask_pars - set internal data structures from mask parameters
///
/// decode_method - decode the method parameter
/// decode_verbose_level - decode the verbose_level parameter
-/// decode_horizon_file_format - decode the horizon_file_format parameter
///
/// allocate_horizons_to_processor - choose which horizons this proc will find
///
/// choose_patch_system_type - choose patch system type
///
+#include <assert.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include <string.h>
+#include <vector>
+
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
@@ -36,6 +35,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -58,7 +58,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -67,17 +66,14 @@ using jtutil::error_exit;
//
namespace {
-void set_mask_pars(CCTK_ARGUMENTS);
-
enum method
decode_method(const char method_string[]);
enum verbose_level
decode_verbose_level(const char verbose_level_string[]);
-enum horizon_file_format
- decode_horizon_file_format(const char horizon_file_format_string[]);
int allocate_horizons_to_processor(int N_procs, int my_proc,
int N_horizons, bool multiproc_flag,
+ const CCTK_INT depends_on[],
horizon_sequence& my_hs,
const struct verbose_info& verbose_info);
@@ -113,9 +109,36 @@ CCTK_VInfo(CCTK_THORNSTRING,
//
+// check parameters
+//
+int need_zones = 0;
+for (int n=1; n<N_horizons; ++n) {
+ need_zones = jtutil::max(need_zones, N_zones_per_right_angle[n]);
+}
+if (need_zones > max_N_zones_per_right_angle) {
+ CCTK_VWarn (FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "AHFinderDirect_setup(): "
+ "The parameter max_N_zones_per_right_angle must be at least the maximum of all N_zones_per_right_angle[] parameters. "
+ "Set max_N_zones_per_right_angle to %d or higher to continue.",
+ need_zones); /*NOTREACHED*/
+ }
+for (int n=1; n<N_horizons; ++n) {
+ if (depends_on[n] != 0) {
+ assert (depends_on[n] >= 1 && depends_on[n] < n);
+ if (N_zones_per_right_angle[n] != N_zones_per_right_angle[depends_on[n]]) {
+ CCTK_VWarn (FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "AHFinderDirect_setup(): "
+ "The parameter N_zones_per_right_angle must be the same for a horizon as for the horizon on which it depends. "
+ "Horizon %d depends on horizon %d, but they have different resolutions.",
+ n, depends_on[n]); /*NOTREACHED*/
+ }
+ }
+}
+
+
+//
// basic setup
//
-state.find_every = find_every;
state.method = decode_method(method);
state.error_info.warn_level__point_outside__initial
@@ -144,9 +167,7 @@ verbose_info.print_algorithm_details
verbose_info.print_algorithm_debug
= (state.verbose_info.verbose_level >= verbose_level__algorithm_debug);
-state.metric_type = /* ADMBase:: */ metric_type;
-
-state.timer_handle = (print_timing_stats != 0) ? CCTK_TimerCreateI() : -1;
+state.timer_handle = (print_timing_stats != 0) ? CCTK_TimerCreate("finding apparent horizons") : -1;
state.N_procs = CCTK_nProcs(cctkGH);
state.my_proc = CCTK_MyProc(cctkGH);
@@ -173,6 +194,7 @@ if (cgi.coord_system_handle < 0)
coordinate_system_name); /*NOTREACHED*/
cgi.use_Cactus_conformal_metric = false; // dummy value, may change later
+cgi.mask_varindex = Cactus_gridfn_varindex("AHFinderDirect::ahmask");
cgi.g_dd_11_varindex = Cactus_gridfn_varindex("ADMBase::gxx");
cgi.g_dd_12_varindex = Cactus_gridfn_varindex("ADMBase::gxy");
cgi.g_dd_13_varindex = Cactus_gridfn_varindex("ADMBase::gxz");
@@ -222,9 +244,6 @@ gi.check_that_geometry_is_finite = (check_that_geometry_is_finite != 0);
//
// Jacobian info
//
-state.test_all_Jacobian_compute_methods
- = (test_all_Jacobian_compute_methods != 0);
-
struct Jacobian_info& Jac_info = state.Jac_info;
Jac_info.Jacobian_compute_method
= decode_Jacobian_compute_method(Jacobian_compute_method);
@@ -243,6 +262,8 @@ solver_info.linear_solver_pars.ILUCG_pars.error_tolerance
= ILUCG__error_tolerance;
solver_info.linear_solver_pars.ILUCG_pars.limit_CG_iterations
= (ILUCG__limit_CG_iterations != 0);
+solver_info.linear_solver_pars.UMFPACK_pars.N_II_iterations
+ = UMFPACK__N_II_iterations;
solver_info.max_Newton_iterations__initial
= max_Newton_iterations__initial;
solver_info.max_Newton_iterations__subsequent
@@ -250,9 +271,13 @@ solver_info.max_Newton_iterations__subsequent
solver_info.max_allowable_Delta_h_over_h = max_allowable_Delta_h_over_h;
solver_info.Theta_norm_for_convergence = Theta_norm_for_convergence;
solver_info.max_allowable_Theta = max_allowable_Theta;
+solver_info.max_allowable_Theta_growth_iterations
+ = max_allowable_Theta_growth_iterations;
+solver_info.max_allowable_Theta_nonshrink_iterations
+ = max_allowable_Theta_nonshrink_iterations;
// ... horizon numbers run from 1 to N_horizons inclusive
// so the array size is N_horizons+1
-solver_info.max_allowable_horizon_radius = new double[state.N_horizons+1];
+solver_info.max_allowable_horizon_radius = new fp[state.N_horizons+1];
{
for (int hn = 0 ; hn <= N_horizons ; ++hn)
{
@@ -260,18 +285,22 @@ solver_info.max_allowable_horizon_radius = new double[state.N_horizons+1];
= max_allowable_horizon_radius[hn];
}
}
+solver_info.want_expansion_gradients = want_expansion_gradients;
//
// I/O info
//
struct IO_info& IO_info = state.IO_info;
-IO_info.horizon_file_format = decode_horizon_file_format(horizon_file_format);
+IO_info.output_ASCII_files = (output_ASCII_files != 0);
+IO_info.output_HDF5_files = (output_HDF5_files != 0);
IO_info.output_initial_guess = (output_initial_guess != 0);
IO_info.output_h_every = output_h_every;
IO_info.output_Theta_every = output_Theta_every;
+IO_info.output_mean_curvature_every = output_mean_curvature_every;
IO_info.output_h = false; // dummy value
IO_info.output_Theta = false; // dummy value
+IO_info.output_mean_curvature = false; // dummy value
IO_info.output_BH_diagnostics = (output_BH_diagnostics != 0);
IO_info.BH_diagnostics_directory
@@ -290,7 +319,9 @@ IO_info.h_directory
: h_directory;
IO_info.h_base_file_name = h_base_file_name;
IO_info.Theta_base_file_name = Theta_base_file_name;
+IO_info.mean_curvature_base_file_name = mean_curvature_base_file_name;
IO_info.Delta_h_base_file_name = Delta_h_base_file_name;
+IO_info.h_min_digits = h_min_digits;
IO_info.Jacobian_base_file_name = Jacobian_base_file_name;
IO_info.output_OpenDX_control_files = (output_OpenDX_control_files != 0);
IO_info.OpenDX_control_file_name_extension = OpenDX_control_file_name_extension;
@@ -304,8 +335,6 @@ IO_info.time = 0.0;
state.BH_diagnostics_info.integral_method
= patch::decode_integration_method(integral_method);
-state.always_broadcast_horizon_shape = (always_broadcast_horizon_shape != 0);
-
//
// mask parameters
@@ -326,33 +355,43 @@ mask_info.set_mask_for_this_horizon = new bool[N_horizons+1];
}
}
if (mask_info.set_mask_for_any_horizon)
- then set_mask_pars(CCTK_PASS_CTOC);
-
-
-//
-// announce parameters
-//
-state.announce_centroid_flag = (which_horizon_to_announce_centroid != 0);
-if (state.announce_centroid_flag)
then {
- state.which_horizon_to_announce_centroid
- = which_horizon_to_announce_centroid;
- if ( (state.which_horizon_to_announce_centroid < 1)
- || (state.which_horizon_to_announce_centroid > state.N_horizons) )
- then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"\n"
-" AHFinderDirect_setup():\n"
-" invalid which_horizon_to_announce_centroid = %d!\n"
-" (valid range is [1,N_horizons=%d])!\n"
- ,
- state.which_horizon_to_announce_centroid,
- state.N_horizons); /*NOTREACHED*/
+ mask_info.radius_multiplier = mask_radius_multiplier;
+ mask_info.radius_offset = mask_radius_offset;
+ mask_info.buffer_thickness = mask_buffer_thickness;
+ mask_info.mask_is_noshrink = mask_is_noshrink;
+ mask_info.min_horizon_radius_points_for_mask
+ = min_horizon_radius_points_for_mask;
+ mask_info.set_old_style_mask = (set_old_style_mask != 0);
+ mask_info.set_new_style_mask = (set_new_style_mask != 0);
+ if (mask_info.set_old_style_mask)
+ then {
+ struct mask_info::old_style_mask_info& osmi
+ = mask_info.old_style_mask_info;
+ osmi.gridfn_name = old_style_mask_gridfn_name;
+ osmi.gridfn_varindex = Cactus_gridfn_varindex(osmi.gridfn_name);
+ osmi.gridfn_dataptr = NULL; // dummy value; fixup later
+ osmi.inside_value = old_style_mask_inside_value;
+ osmi.buffer_value = old_style_mask_buffer_value;
+ osmi.outside_value = old_style_mask_outside_value;
+ }
+ if (mask_info.set_new_style_mask)
+ then {
+ struct mask_info::new_style_mask_info& nsmi
+ = mask_info.new_style_mask_info;
+ nsmi.gridfn_name = new_style_mask_gridfn_name;
+ nsmi.gridfn_varindex = Cactus_gridfn_varindex(nsmi.gridfn_name);
+ nsmi.gridfn_dataptr = NULL; // dummy value; fixup later
+ nsmi.bitfield_name = new_style_mask_bitfield_name;
+ nsmi.bitfield_bitmask = 0; // dummy value; fixup later
+ nsmi.inside_value = new_style_mask_inside_value;
+ nsmi.buffer_value = new_style_mask_buffer_value;
+ nsmi.outside_value = new_style_mask_outside_value;
+ nsmi.inside_bitvalue = 0; // dummy value; fixup later
+ nsmi.buffer_bitvalue = 0; // dummy value; fixup later
+ nsmi.outside_bitvalue = 0; // dummy value; fixup later
+ }
}
- else state.which_horizon_to_announce_centroid = 0; // dummy value; unused
-
-// initial value, will get each horizon's store_info_in_SS_vars
-// flag inclusive-ored into it below
-state.store_info_in_SS_vars_for_any_horizon = false;
//
@@ -371,6 +410,7 @@ const bool multiproc_flag = (state.method == method__find_horizons);
state.N_active_procs
= allocate_horizons_to_processor(state.N_procs, state.my_proc,
state.N_horizons, multiproc_flag,
+ depends_on,
hs,
verbose_info);
@@ -474,6 +514,8 @@ if (strlen(surface_interpolator_name) > 0)
true, verbose_info.print_algorithm_details);
patch_system& ps = *AH_data.ps_ptr;
if (genuine_flag)
+ then ps.set_gridfn_to_constant(0.0, gfns::gfn__zero);
+ if (genuine_flag)
then ps.set_gridfn_to_constant(1.0, gfns::gfn__one);
AH_data.Jac_ptr = genuine_flag
@@ -482,9 +524,67 @@ if (strlen(surface_interpolator_name) > 0)
verbose_info.print_algorithm_details)
: NULL;
- AH_data.surface_expansion = surface_expansion[hn];
-
- AH_data.initial_find_flag = genuine_flag;
+ AH_data.compute_info.surface_definition =
+ STRING_EQUAL(surface_definition[hn], "expansion")
+ ? definition_expansion
+ : STRING_EQUAL(surface_definition[hn], "inner expansion")
+ ? definition_inner_expansion
+ : STRING_EQUAL(surface_definition[hn], "mean curvature")
+ ? definition_mean_curvature
+ : STRING_EQUAL(surface_definition[hn], "expansion product")
+ ? definition_expansion_product
+ : (CCTK_WARN (0, "internal error"), definition_error);
+ AH_data.compute_info.surface_modification =
+ STRING_EQUAL(surface_modification[hn], "none")
+ ? modification_none
+ : STRING_EQUAL(surface_modification[hn], "radius")
+ ? modification_radius
+ : STRING_EQUAL(surface_modification[hn], "radius^2")
+ ? modification_radius2
+#if 0
+ : STRING_EQUAL(surface_modification[hn], "mean radius")
+ ? modification_mean_radius
+ : STRING_EQUAL(surface_modification[hn], "areal radius")
+ ? modification_areal_radius
+#endif
+ : (CCTK_WARN (0, "internal error"), modification_error);
+ AH_data.compute_info.surface_selection =
+ STRING_EQUAL(surface_selection[hn], "definition")
+ ? selection_definition
+ : STRING_EQUAL(surface_selection[hn], "mean coordinate radius")
+ ? selection_mean_coordinate_radius
+ : STRING_EQUAL(surface_selection[hn], "areal radius")
+ ? selection_areal_radius
+ : STRING_EQUAL(surface_selection[hn], "expansion times mean coordinate radius")
+ ? selection_expansion_mean_coordinate_radius
+ : STRING_EQUAL(surface_selection[hn], "expansion times areal radius")
+ ? selection_expansion_areal_radius
+ : (CCTK_WARN (0, "internal error"), selection_error);
+ AH_data.compute_info.desired_value = desired_value[hn];
+
+ AH_data.move_origins = move_origins;
+
+ AH_data.use_pretracking = use_pretracking[hn];
+ AH_data.pretracking_max_iterations = pretracking_max_iterations[hn];
+
+ AH_data.pretracking_value = pretracking_value[hn];
+ AH_data.pretracking_minimum_value = pretracking_minimum_value[hn];
+ AH_data.pretracking_maximum_value = pretracking_maximum_value[hn];
+ AH_data.pretracking_delta = pretracking_delta[hn];
+ AH_data.pretracking_minimum_delta = pretracking_minimum_delta[hn];
+ AH_data.pretracking_maximum_delta = pretracking_maximum_delta[hn];
+
+ AH_data.depends_on = depends_on[hn];
+ AH_data.desired_value_factor = desired_value_factor[hn];
+ AH_data.desired_value_offset = desired_value_offset[hn];
+
+ AH_data.shiftout_factor = shiftout_factor[hn];
+ AH_data.smoothing_factor = smoothing_factor[hn];
+
+ // AH_data.initial_find_flag = genuine_flag;
+ // AH_data.really_initial_find_flag = AH_data.initial_find_flag;
+ AH_data.initial_find_flag = true;
+ AH_data.really_initial_find_flag = AH_data.initial_find_flag;
if (genuine_flag)
then {
@@ -493,6 +593,8 @@ if (strlen(surface_interpolator_name) > 0)
" setting initial guess parameters etc");
AH_data.initial_guess_info.method
= decode_initial_guess_method(initial_guess_method[hn]);
+ AH_data.initial_guess_info.reset_horizon_after_not_finding
+ = reset_horizon_after_not_finding[hn];
// ... read from named file
AH_data.initial_guess_info.read_from_named_file_info.file_name
= initial_guess__read_from_named_file__file_name[hn];
@@ -542,106 +644,47 @@ if (strlen(surface_interpolator_name) > 0)
= initial_guess__coord_ellipsoid__z_radius[hn];
}
+ AH_data.search_flag = false;
AH_data.found_flag = false;
AH_data.h_files_written = false;
AH_data.BH_diagnostics_fileptr = NULL;
-
- AH_data.store_info_in_SS_vars = (which_surface_to_store_info[hn] >= 0);
- if (AH_data.store_info_in_SS_vars)
- then {
- AH_data.SS_surface_number = which_surface_to_store_info[hn];
- if (AH_data.SS_surface_number
- >= /* SphericalSurface:: */ nsurfaces)
- then CCTK_VWarn(FATAL_ERROR,
- __LINE__, __FILE__, CCTK_THORNSTRING,
-"\n"
-" AHFinderDirect_setup():\n"
-" which_surface_to_store_info[%d] = %d\n"
-" is outside the legal range [0,SphericalSurface::nsurfaces=%d)!\n"
- ,
- hn, AH_data.SS_surface_number,
- int(/* SphericalSurface:: */ nsurfaces));
- /*NOTREACHED*/
- }
- else AH_data.SS_surface_number = 0; // dummy value
-
- state.store_info_in_SS_vars_for_any_horizon
- |= AH_data.store_info_in_SS_vars;
}
}
-}
-//******************************************************************************
-
-//
-// This function is called by the Cactus scheduler to update some of our
-// persistent data structures (stored in struct state ) from parameters
-// which may have been steered. It is also called by AHFinderDirect_setup()
-// (above) as part of the initial setup of these data structures.
-//
-extern "C"
- void AHFinderDirect_update(CCTK_ARGUMENTS)
-{
-set_mask_pars(CCTK_PASS_CTOC);
+ // Initialise the centroids. These values may later be overwritten
+ // when they are recovered from a checkpoint. However, if new
+ // horizons are enabled during recovery, they are then correctly
+ // initialised.
+ for (int n = 0; n < N_horizons; ++ n) {
+ // Horizon centroids are not valid
+ ah_centroid_x[n] = 0.0;
+ ah_centroid_y[n] = 0.0;
+ ah_centroid_z[n] = 0.0;
+ ah_centroid_t[n] = 0.0;
+ ah_centroid_valid[n] = 0;
+ ah_centroid_iteration[n] = -1;
+
+ ah_centroid_x_p[n] = 0.0;
+ ah_centroid_y_p[n] = 0.0;
+ ah_centroid_z_p[n] = 0.0;
+ ah_centroid_t_p[n] = 0.0;
+ ah_centroid_valid_p[n] = 0;
+ ah_centroid_iteration_p[n] = -1;
+
+ struct AH_data& AH_data = *state.AH_data_array[n+1];
+ ah_initial_find_flag[n] = AH_data.initial_find_flag;
+ ah_really_initial_find_flag[n] = AH_data.really_initial_find_flag;
+ ah_search_flag[n] = AH_data.search_flag;
+ ah_found_flag[n] = AH_data.found_flag;
+ if (verbose_info.print_algorithm_highlights) {
+ printf ("AHF setup %d initial_find_flag=%d\n", n+1, (int) AH_data.initial_find_flag);
+ printf ("AHF setup %d really_initial_find_flag=%d\n", n+1, (int) AH_data.really_initial_find_flag);
+ printf ("AHF setup %d search_flag=%d\n", n+1, (int) AH_data.search_flag);
+ printf ("AHF setup %d found_flag=%d\n", n+1, (int) AH_data.found_flag);
+ }
+ }
}
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
-//
-// This function sets our internal data structures from the the mask
-// parameters.
-//
-namespace {
-void set_mask_pars(CCTK_ARGUMENTS)
-{
-DECLARE_CCTK_ARGUMENTS
-DECLARE_CCTK_PARAMETERS
-
-struct mask_info& mask_info = state.mask_info;
-mask_info.set_old_style_mask = (set_old_style_mask != 0);
-mask_info.set_new_style_mask = (set_new_style_mask != 0);
-if (mask_info.set_mask_for_any_horizon)
- then {
- mask_info.radius_multiplier = mask_radius_multiplier;
- mask_info.radius_offset = mask_radius_offset;
- mask_info.buffer_thickness = mask_buffer_thickness;
- mask_info.mask_is_noshrink = mask_is_noshrink;
- mask_info.min_horizon_radius_points_for_mask
- = min_horizon_radius_points_for_mask;
- mask_info.set_old_style_mask = (set_old_style_mask != 0);
- mask_info.set_new_style_mask = (set_new_style_mask != 0);
- if (mask_info.set_old_style_mask)
- then {
- struct mask_info::old_style_mask_info& osmi
- = mask_info.old_style_mask_info;
- osmi.gridfn_name = old_style_mask_gridfn_name;
- osmi.gridfn_varindex = Cactus_gridfn_varindex(osmi.gridfn_name);
- osmi.gridfn_dataptr = NULL; // dummy value; fixup later
- osmi.inside_value = old_style_mask_inside_value;
- osmi.buffer_value = old_style_mask_buffer_value;
- osmi.outside_value = old_style_mask_outside_value;
- }
- if (mask_info.set_new_style_mask)
- then {
- struct mask_info::new_style_mask_info& nsmi
- = mask_info.new_style_mask_info;
- nsmi.gridfn_name = new_style_mask_gridfn_name;
- nsmi.gridfn_varindex = Cactus_gridfn_varindex(nsmi.gridfn_name);
- nsmi.gridfn_dataptr = NULL; // dummy value; fixup later
- nsmi.bitfield_name = new_style_mask_bitfield_name;
- nsmi.bitfield_bitmask = 0; // dummy value; fixup later
- nsmi.inside_value = new_style_mask_inside_value;
- nsmi.buffer_value = new_style_mask_buffer_value;
- nsmi.outside_value = new_style_mask_outside_value;
- nsmi.inside_bitvalue = 0; // dummy value; fixup later
- nsmi.buffer_bitvalue = 0; // dummy value; fixup later
- nsmi.outside_bitvalue = 0; // dummy value; fixup later
- }
- }
-}
- }
//******************************************************************************
//******************************************************************************
@@ -677,9 +720,7 @@ namespace {
enum verbose_level
decode_verbose_level(const char verbose_level_string[])
{
-if (STRING_EQUAL(verbose_level_string, "no output"))
- then return verbose_level__no_output;
-else if (STRING_EQUAL(verbose_level_string, "physics highlights"))
+if (STRING_EQUAL(verbose_level_string, "physics highlights"))
then return verbose_level__physics_highlights;
else if (STRING_EQUAL(verbose_level_string, "physics details"))
then return verbose_level__physics_details;
@@ -696,26 +737,6 @@ else CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
}
//******************************************************************************
-
-//
-// This function decodes the horizon_file_format parameter (string) into an
-// internal enum for future use.
-//
-namespace {
-enum horizon_file_format
- decode_horizon_file_format(const char horizon_file_format_string[])
-{
-if (STRING_EQUAL(horizon_file_format_string, "ASCII (gnuplot)"))
- then return horizon_file_format__ASCII_gnuplot;
-else if (STRING_EQUAL(horizon_file_format_string, "HDF5"))
- then return horizon_file_format__HDF5;
-else CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
-"decode_horizon_file_format(): unknown horizon_file_format_string=\"%s\"!",
- horizon_file_format_string); /*NOTREACHED*/
-}
- }
-
-//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -743,6 +764,7 @@ else CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
namespace {
int allocate_horizons_to_processor(int N_procs, int my_proc,
int N_horizons, bool multiproc_flag,
+ const CCTK_INT depends_on[],
horizon_sequence& my_hs,
const struct verbose_info& verbose_info)
{
@@ -753,15 +775,38 @@ const int N_active_procs = multiproc_flag ? jtutil::min(N_procs, N_horizons)
// Implementation note:
// We allocate the horizons to active processors in round-robin order.
//
+std::vector<int> proc_of_horizon (N_horizons+1);
+ for (int hn = 1 ; hn <= N_horizons ; ++hn)
+ {
+ proc_of_horizon.at(hn) = -1;
+ }
+
int proc = 0;
for (int hn = 1 ; hn <= N_horizons ; ++hn)
{
+ if (depends_on[hn] < 0 || depends_on[hn] > N_horizons) {
+ CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "horizon %d depends on a horizon with the illegal index %d",
+ hn, int(depends_on[hn]));
+ } else if (depends_on[hn] == hn) {
+ CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "horizon %d depends on itself",
+ hn);
+ } else if (depends_on[hn] > hn) {
+ CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "horizon %d depends on a horizon with a larger index %d",
+ hn, int(depends_on[hn]));
+ }
+ const int this_horizons_proc
+ = depends_on[hn] == 0 ? proc : proc_of_horizon.at(depends_on[hn]);
+ assert (this_horizons_proc >= 0 && this_horizons_proc < N_procs);
+ proc_of_horizon.at(hn) = this_horizons_proc;
if (verbose_info.print_algorithm_highlights)
then CCTK_VInfo(CCTK_THORNSTRING,
" allocating horizon %d to processor #%d",
- hn, proc);
- if (proc == my_proc)
- then my_hs.append_hn(hn);
+ hn, this_horizons_proc);
+ if (this_horizons_proc == my_proc)
+ then my_hs.append_hn(hn);
if (++proc >= N_active_procs)
then proc = 0;
}
@@ -875,6 +920,19 @@ else if (STRING_EQUAL(grid_domain, "octant"))
" ==> using \"+xz quadrant (mirrored)\" patch system");
return patch_system::patch_system__plus_xz_quadrant_mirrored;
}
+ else if ((origin_y == 0.0) && (origin_z == 0.0))
+ then {
+ CCTK_VInfo(CCTK_THORNSTRING,
+ " Cactus has mirrored octant mode");
+ CCTK_VInfo(CCTK_THORNSTRING,
+ " but patch system origin_x=%g != 0",
+ double(origin_z));
+ CCTK_VInfo(CCTK_THORNSTRING,
+ " ==> using \"+yz quadrant (mirrored)\" patch system");
+ //return patch_system::patch_system__plus_yz_quadrant_mirrored;
+ CCTK_WARN (0, "This patch system type is not implemented");
+ return patch_system::patch_system__full_sphere;
+ }
else {
CCTK_VInfo(CCTK_THORNSTRING,
" Cactus has mirrored octant mode");
@@ -888,7 +946,7 @@ else if (STRING_EQUAL(grid_domain, "octant"))
}
else {
- CCTK_VWarn(SERIOUS_WARNING, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
"\n"
" choose_patch_system_type()\n"
" grid::domain = \"%s\" not supported!\n"
diff --git a/src/driver/spherical_surface.cc b/src/driver/spherical_surface.cc
deleted file mode 100644
index 96d3bc8..0000000
--- a/src/driver/spherical_surface.cc
+++ /dev/null
@@ -1,264 +0,0 @@
-// spherical_surface.cc -- interface with SphericalSurface thorn
-// $Header$
-//
-// <<<access to persistent data>>>
-// AHFinderDirect_store_SS_info - ... SphericalSurface information
-/// store_diagnostic_info - store BH_diagnostics info in SphericalSurface vars
-/// store_horizon_shape - store horizon shape in SphericalSurface vars
-//
-
-#include <stdio.h>
-#include <assert.h>
-#include <math.h>
-
-#include "util_Table.h"
-#include "cctk.h"
-#include "cctk_Arguments.h"
-#include "cctk_Parameters.h"
-
-#include "config.h"
-#include "stdc.h"
-#include "../jtutil/util.hh"
-#include "../jtutil/array.hh"
-#include "../jtutil/cpm_map.hh"
-#include "../jtutil/linear_map.hh"
-
-#include "../patch/coords.hh"
-#include "../patch/grid.hh"
-#include "../patch/fd_grid.hh"
-#include "../patch/patch.hh"
-#include "../patch/patch_edge.hh"
-#include "../patch/patch_interp.hh"
-#include "../patch/ghost_zone.hh"
-#include "../patch/patch_system.hh"
-
-#include "../elliptic/Jacobian.hh"
-
-#include "../gr/gfns.hh"
-#include "../gr/gr.hh"
-
-#include "horizon_sequence.hh"
-#include "BH_diagnostics.hh"
-#include "driver.hh"
-
-// all the code in this file is inside this namespace
-namespace AHFinderDirect
- {
-using jtutil::error_exit;
-
-//******************************************************************************
-
-//
-// ***** prototypes for functions local to this file *****
-//
-
-namespace {
-void store_diagnostic_info(CCTK_ARGUMENTS,
- const patch_system& ps,
- const struct BH_diagnostics& BH_diagnostics,
- const int sn);
-void store_horizon_shape(CCTK_ARGUMENTS,
- const patch_system& ps,
- const int sn);
- }
-
-//******************************************************************************
-
-//
-// ***** access to persistent data *****
-//
-extern struct state state;
-
-//******************************************************************************
-
-//
-// This function is called by the Cactus scheduler, to store any desired
-// apparent horizon info to the SphericalSurface variables.
-//
-// Cactus parameters used:
-// SphericalSurface::nsurfaces = (in)
-//
-extern "C"
- void AHFinderDirect_store_SS_info(CCTK_ARGUMENTS)
-{
-DECLARE_CCTK_ARGUMENTS
-DECLARE_CCTK_PARAMETERS
-
-const int N_surfaces = /* SphericalSurface:: */ nsurfaces;
-const struct verbose_info& verbose_info = state.verbose_info;
-
- for (int hn = 1; hn <= N_horizons; ++ hn)
- {
- assert(state.AH_data_array[hn] != NULL);
- const struct AH_data& AH_data = *state.AH_data_array[hn];
- assert(AH_data.ps_ptr != NULL);
- const patch_system& ps = *AH_data.ps_ptr;
-
- if (! AH_data.store_info_in_SS_vars)
- then continue; // *** LOOP CONTROL ***
- const int sn = AH_data.SS_surface_number;
- assert(sn >= 0);
- assert(sn < N_surfaces);
-
- if (! state.find_now(cctk_iteration))
- then {
- // we didn't try to find this (or any!) horizon
- // at this time step
- /* SphericalSurface:: */ sf_valid[sn] = 0;
- continue; // *** LOOP CONTROL ***
- }
-
- if (! AH_data.found_flag)
- then {
- // we tried to find this horizon, but failed
- /* SphericalSurface:: */ sf_valid[sn] = -1;
- continue; // *** LOOP CONTROL ***
- }
-
- // get to here ==> we found this horizon
- /* SphericalSurface:: */ sf_valid[sn] = 1;
-
- if (verbose_info.print_algorithm_highlights)
- then CCTK_VInfo(CCTK_THORNSTRING,
- "storing horizon %d info in SphericalSurface surface %d",
- hn, sn);
-
- const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics;
- store_diagnostic_info(CCTK_PASS_CTOC, ps, BH_diagnostics, sn);
-
- store_horizon_shape(CCTK_PASS_CTOC, ps, sn);
- }
-}
-
-//******************************************************************************
-
-//
-// Assuming that we found this horizon, this function stores various
-// diagnostic info about it in the corresponding SphericalSurface variables.
-//
-// Arguments:
-// sn = (in) The SphericalSurface surface number to store the information in.
-//
-// Cactus variables:
-// sf_* = (out) The SphericalSurface variables.
-//
-namespace {
-void store_diagnostic_info(CCTK_ARGUMENTS,
- const patch_system& ps,
- const struct BH_diagnostics& BH_diagnostics,
- const int sn)
-{
-DECLARE_CCTK_ARGUMENTS
-
-/* SphericalSurface:: */ sf_origin_x[sn] = ps.origin_x();
-/* SphericalSurface:: */ sf_origin_y[sn] = ps.origin_y();
-/* SphericalSurface:: */ sf_origin_z[sn] = ps.origin_z();
-
-/* SphericalSurface:: */ sf_mean_radius [sn] = BH_diagnostics.mean_radius;
-/* SphericalSurface:: */ sf_min_radius [sn] = BH_diagnostics.min_radius;
-/* SphericalSurface:: */ sf_max_radius [sn] = BH_diagnostics.max_radius;
-
-/* SphericalSurface:: */ sf_area [sn] = BH_diagnostics.area;
-
-/* SphericalSurface:: */ sf_centroid_x [sn] = BH_diagnostics.centroid_x;
-/* SphericalSurface:: */ sf_centroid_y [sn] = BH_diagnostics.centroid_y;
-/* SphericalSurface:: */ sf_centroid_z [sn] = BH_diagnostics.centroid_z;
-/* SphericalSurface:: */ sf_quadrupole_xx[sn] = BH_diagnostics.quadrupole_xx;
-/* SphericalSurface:: */ sf_quadrupole_xy[sn] = BH_diagnostics.quadrupole_xy;
-/* SphericalSurface:: */ sf_quadrupole_xz[sn] = BH_diagnostics.quadrupole_xz;
-/* SphericalSurface:: */ sf_quadrupole_yy[sn] = BH_diagnostics.quadrupole_yy;
-/* SphericalSurface:: */ sf_quadrupole_yz[sn] = BH_diagnostics.quadrupole_yz;
-/* SphericalSurface:: */ sf_quadrupole_zz[sn] = BH_diagnostics.quadrupole_zz;
-
-/* SphericalSurface:: */ sf_min_x [sn] = BH_diagnostics.min_x;
-/* SphericalSurface:: */ sf_max_x [sn] = BH_diagnostics.max_x;
-/* SphericalSurface:: */ sf_min_y [sn] = BH_diagnostics.min_y;
-/* SphericalSurface:: */ sf_max_y [sn] = BH_diagnostics.max_y;
-/* SphericalSurface:: */ sf_min_z [sn] = BH_diagnostics.min_z;
-/* SphericalSurface:: */ sf_max_z [sn] = BH_diagnostics.max_z;
-}
- }
-
-//******************************************************************************
-
-//
-// This function stores our information about a specified horizon to the
-// SphericalSurface variables.
-//
-// Arguments:
-// sn = (in) The SphericalSurface surface number to store the information in.
-//
-// Cactus variables:
-// sf_maxn{theta,phi} = (in) The SphericalSurface array dimensions for
-// the 2-D array indexing.
-// sf_n{theta,phi} = (in) The SphericalSurface array dimensions for the
-// part of the 2-D array that's actually used.
-// sf_radius = (out) The SphericalSurface radius.
-//
-// FIXME:
-// * The present implementation is quite inefficient, as it calls
-// patch_system::radius_in_local_xyz_direction() (which does a
-// separate interpolator call) for each point. It would be more
-// efficient to have a new patch_system:: API which operated
-// on a whole array of points at once, to amortize the interpolator
-// overhead.
-// * It would be cleaner to abstract out the (complicated) indexing
-// calculation for the SphericalSurface shape array into a separate
-// access structure/function, the way we do with struct cactus_grid_info
-// for grid functions.
-//
-namespace {
-void store_horizon_shape(CCTK_ARGUMENTS,
- const patch_system& ps,
- const int sn)
-{
-DECLARE_CCTK_ARGUMENTS
-DECLARE_CCTK_PARAMETERS
-
-const double origin_theta = /* SphericalSurface:: */ sf_origin_theta[sn];
-const double origin_phi = /* SphericalSurface:: */ sf_origin_phi [sn];
-const double delta_theta = /* SphericalSurface:: */ sf_delta_theta [sn];
-const double delta_phi = /* SphericalSurface:: */ sf_delta_phi [sn];
-
-const int N_theta = /* SphericalSurface:: */ ntheta[sn];
-const int N_phi = /* SphericalSurface:: */ nphi [sn];
-const int max_N_theta = /* SphericalSurface:: */ maxntheta;
-const int max_N_phi = /* SphericalSurface:: */ maxnphi;
-
-// we want Fortran loop nesting here for cache efficiency in storing
-// to the SphericalSurface::sf_radius array (see comment below)
- for (int i_phi = 0 ; i_phi < N_phi ; ++i_phi)
- {
- const double phi = origin_phi + i_phi*delta_phi;
- const double sin_phi = sin(phi);
- const double cos_phi = cos(phi);
-
- for (int i_theta = 0 ; i_theta < N_theta ; ++i_theta)
- {
- const double theta = origin_theta + i_theta*delta_theta;
- const double sin_theta = sin(theta);
- const double cos_theta = cos(theta);
-
- const double local_x = sin_theta * cos_phi;
- const double local_y = sin_theta * sin_phi;
- const double local_z = cos_theta;
-
- const double local_r = ps.radius_in_local_xyz_direction
- (gfns::gfn__h,
- local_x, local_y, local_z);
-
- // SphericalSurface::sf_radius is actually stored as
- // a 3-D contiguous array, with indices
- // theta (contiguous, i.e. stride=1)
- // phi
- // surface (largest stride)
- const int sub = i_theta + max_N_theta * (i_phi + max_N_phi*sn);
- /* SphericalSurface:: */ sf_radius[sub] = local_r;
- }
- }
-}
- }
-
-//******************************************************************************
-
- } // namespace AHFinderDirect
diff --git a/src/driver/state.cc b/src/driver/state.cc
index dde1e23..9d495be 100644
--- a/src/driver/state.cc
+++ b/src/driver/state.cc
@@ -8,6 +8,7 @@
#include "util_Table.h"
#include "cctk.h"
#include "cctk_Arguments.h"
+#include "cctk_Parameters.h"
#include "config.h"
#include "stdc.h"
@@ -15,6 +16,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -37,7 +39,6 @@
// everything in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
diff --git a/src/elliptic/Jacobian.cc b/src/elliptic/Jacobian.cc
index 8a1cfa4..facd5cb 100644
--- a/src/elliptic/Jacobian.cc
+++ b/src/elliptic/Jacobian.cc
@@ -15,6 +15,7 @@
#include "util_Table.h"
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "config.h"
#include "stdc.h"
@@ -22,6 +23,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -39,7 +41,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/elliptic/Jacobian.hh b/src/elliptic/Jacobian.hh
index 0dcf14b..26f913a 100644
--- a/src/elliptic/Jacobian.hh
+++ b/src/elliptic/Jacobian.hh
@@ -160,7 +160,7 @@ protected:
// the constructor only uses ps to get the size of the matrix
Jacobian(patch_system& ps)
: ps_(ps),
- N_rows_(ps.N_grid_points())
+ N_rows_(ps.N_grid_points() + ps.N_additional_points())
{ }
public:
virtual ~Jacobian() { }
diff --git a/src/elliptic/dense_Jacobian.cc b/src/elliptic/dense_Jacobian.cc
index 61e3a8e..6deaab1 100644
--- a/src/elliptic/dense_Jacobian.cc
+++ b/src/elliptic/dense_Jacobian.cc
@@ -23,6 +23,7 @@
#include "util_Table.h"
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "config.h"
#include "stdc.h"
@@ -30,6 +31,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -46,7 +48,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/elliptic/make.code.defn b/src/elliptic/make.code.defn
index 72552f9..8f7883d 100644
--- a/src/elliptic/make.code.defn
+++ b/src/elliptic/make.code.defn
@@ -8,17 +8,3 @@ SRCS = Jacobian.cc \
# Subdirectories containing source files
SUBDIRS =
-
-# disable automatic template instantiation on DEC Alphas cxx compiler
-ifeq ($(shell uname), OSF1)
- ifeq ($(CXX), cxx)
- CXXFLAGS += -nopt
- endif
-endif
-
-# disable automagic template instantiation on SGI Irix CC compiler
-ifneq (,$(findstring IRIX,$(shell uname)))
- ifeq ($(notdir $(CXX)), CC)
- CXXFLAGS += -no_auto_include
- endif
-endif
diff --git a/src/elliptic/row_sparse_Jacobian.cc b/src/elliptic/row_sparse_Jacobian.cc
index 6b1152f..46da285 100644
--- a/src/elliptic/row_sparse_Jacobian.cc
+++ b/src/elliptic/row_sparse_Jacobian.cc
@@ -43,6 +43,7 @@
#include "util_Table.h"
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "config.h"
#include "stdc.h"
@@ -86,6 +87,7 @@ extern "C"
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -102,7 +104,6 @@ extern "C"
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
@@ -443,7 +444,7 @@ int max_N_in_row = 0;
{
for (int II = 0 ; II < N_rows_ ; ++II)
{
- max_N_in_row = jtutil::max(max_N_in_row, IA_[II+1]-IA_[II]);
+ max_N_in_row = jtutil::max(max_N_in_row, IA_[II+1]-IA_[II]);
}
}
diff --git a/src/gr.cg/expansion.c b/src/gr.cg/expansion.c
index 65f3677..e9e0161 100644
--- a/src/gr.cg/expansion.c
+++ b/src/gr.cg/expansion.c
@@ -1,182 +1,183 @@
/*
- * inputs = {r, partial_d_ln_sqrt_g, partial_d_g_uu, X_ud, X_udd, g_uu, K_uu, h}
+ * inputs = {partial_d_ln_sqrt_g, partial_d_g_uu, r, X_ud, X_udd, g_uu, K_uu, h}
* outputs = {Theta_A, Theta_B, Theta_C, Theta_D}
- * cost = 134*assignments+401*multiplications+3*divisions+5*functions+173*additions
+ * cost = 134*assignments+3*divisions+5*functions+401*multiplications+173*additions
*/
-fp t1, t2, t3, t5, t6, t8, t9, t11, t12, t14;
-fp t15, t17, t19, t25, t26, t27, t29, t31, t34, t35;
-fp t37, t39, t40, t42, t44, t46, t47, t49, t56, t61;
-fp t63, t65, t66, t67, t82, t93, t98, t100, t102, t106;
-fp t107, t110, t111, t112, t116, t119, t120, t121, t123, t124;
-fp t127, t128, t129, t130, t131, t133, t134, t135, t137, t138;
-fp t139, t141, t142, t143, t148, t149, t150, t153, t154, t155;
-fp t158, t159, t160, t163, t164, t167, t168, t171, t172, t177;
-fp t181, t182, t185, t186, t189, t191, t197, t198, t200, t205;
-fp t220, t224, t232, t239, t266, t273, t276, t280, t283, t289;
-fp t292, t302, t303, t306, t307, t310, t311, t314, t317, t326;
-fp t330, t334, t337, t340, t343, t353, t355, t356, t360, t362;
-fp t366, t382, t387, t394, t431, t440, t444, t447, t450, t465;
+fp t1, t2, t4, t5, t7, t8, t10, t11, t12, t14;
+fp t16, t18, t19, t21, t23, t29, t31, t33, t35, t40;
+fp t42, t46, t47, t48, t49, t56, t61, t63, t67, t83;
+fp t87, t102, t106, t107, t108, t109, t113, t116, t123, t128;
+fp t130, t134, t135, t138, t139, t140, t141, t144, t145, t148;
+fp t149, t155, t156, t159, t160, t161, t162, t163, t166, t167;
+fp t168, t171, t172, t173, t176, t177, t180, t181, t182, t185;
+fp t186, t197, t198, t205, t207, t210, t213, t221, t226, t228;
+fp t230, t241, t242, t248, t255, t258, t259, t260, t263, t270;
+fp t271, t274, t277, t278, t281, t282, t285, t291, t293, t294;
+fp t295, t297, t298, t301, t304, t309, t318, t323, t324, t330;
+fp t333, t340, t341, t344, t363, t369, t376, t378, t380, t384;
+fp t393, t396, t398, t411, t431, t440, t444, t447, t450, t465;
t1 = g_uu_13;
- t2 = t1*t1;
- t3 = 1/r;
- t5 = X_ud_13;
- t6 = PARTIAL_RHO(h);
- t8 = X_ud_23;
- t9 = PARTIAL_SIGMA(h);
- t11 = zz*t3-t5*t6-t8*t9;
- t12 = t11*t11;
- t14 = yy*yy;
- t15 = zz*zz;
- t17 = r*r;
- t19 = 1/t17/r;
- t25 = X_ud_11;
- t26 = t25*t25;
- t27 = PARTIAL_RHO_RHO(h);
- t29 = X_ud_21;
- t31 = PARTIAL_RHO_SIGMA(h);
- t34 = t29*t29;
- t35 = PARTIAL_SIGMA_SIGMA(h);
- t37 = (t14+t15)*t19-X_udd_111*t6-X_udd_211*t9-t26*t27-2.0*t29*t25*t31-t34
-*t35;
- t39 = g_uu_23;
- t40 = t39*t39;
- t42 = X_ud_12;
- t44 = X_ud_22;
- t46 = yy*t3-t42*t6-t44*t9;
- t47 = t46*t46;
- t49 = xx*xx;
- t56 = t5*t5;
- t61 = t8*t8;
- t63 = (t49+t14)*t19-X_udd_133*t6-X_udd_233*t9-t56*t27-2.0*t8*t5*t31-t61*
-t35;
- t65 = t1*t11;
- t66 = g_uu_22;
- t67 = t66*t46;
- t82 = -xx*yy*t19-X_udd_112*t6-X_udd_212*t9-t25*t42*t27-t29*t42*t31-t25*
-t44*t31-t29*t44*t35;
- t93 = t42*t42;
- t98 = t44*t44;
- t100 = (t49+t15)*t19-X_udd_122*t6-X_udd_222*t9-t93*t27-2.0*t44*t42*t31-
-t98*t35;
- t102 = t39*t11;
- t106 = t1*t12;
- t107 = partial_d_g_uu_123;
- t110 = g_uu_12;
- t111 = t110*t47;
- t112 = partial_d_g_uu_112;
- t116 = xx*t3-t25*t6-t29*t9;
- t119 = t66*t47;
- t120 = partial_d_g_uu_212;
- t121 = t120*t116;
- t123 = t39*t47;
- t124 = partial_d_g_uu_312;
- t127 = g_uu_11;
- t128 = t116*t116;
- t129 = t127*t128;
- t130 = partial_d_g_uu_113;
- t131 = t130*t11;
- t133 = t1*t128;
- t134 = partial_d_g_uu_313;
- t135 = t134*t11;
- t137 = g_uu_33;
- t138 = t137*t12;
- t139 = t134*t116;
- t141 = -t2*t12*t37-t40*t47*t63-2.0*t65*t67*t82-t40*t12*t100-2.0*t102*t67*
-t100-t106*t107*t46-t111*t112*t116-t119*t121-t123*t124*t116-t129*t131-t133*t135-
-t138*t139;
- t142 = t39*t12;
- t143 = partial_d_g_uu_213;
- t148 = t1*t116;
- t149 = partial_d_g_uu_322;
- t150 = t149*t47;
- t153 = t110*t116;
- t154 = partial_d_g_uu_222;
- t155 = t154*t47;
- t158 = t127*t116;
- t159 = partial_d_g_uu_122;
- t160 = t159*t47;
- t163 = partial_d_g_uu_333;
- t164 = t163*t12;
- t167 = partial_d_g_uu_133;
- t168 = t167*t12;
- t171 = partial_d_g_uu_233;
- t172 = t171*t12;
- t177 = t110*t46;
- t181 = partial_d_g_uu_323;
- t182 = t181*t11;
- t185 = t137*t11;
- t186 = t124*t46;
- t189 = -t142*t143*t116-t106*t130*t116+RATIONAL(-1.0,2.0)*t148*t150+
-RATIONAL(-1.0,2.0)*t153*t155+RATIONAL(-1.0,2.0)*t158*t160+RATIONAL(-1.0,2.0)*
-t148*t164+RATIONAL(-1.0,2.0)*t158*t168+RATIONAL(-1.0,2.0)*t153*t172+RATIONAL(
--1.0,2.0)*t65*t160-2.0*t65*t177*t37-t148*t182*t46-t185*t186*t116;
- t191 = t127*t127;
- t197 = t110*t128;
- t198 = t143*t11;
- t200 = t137*t137;
- t205 = t39*t46;
- t220 = -xx*zz*t19-X_udd_113*t6-X_udd_213*t9-t25*t5*t27-t29*t5*t31-t25*t8*
-t31-t29*t8*t35;
- t224 = t12*t11;
- t232 = t1*t220;
- t239 = -t191*t128*t37-2.0*t142*t1*t82-t197*t198-t200*t12*t63-t177*t131*
-t116-2.0*t65*t205*t220+RATIONAL(-1.0,2.0)*t39*t224*t171-t67*t198*t116-t205*t135
-*t116-2.0*t138*t232+RATIONAL(-1.0,2.0)*t205*t164+RATIONAL(-1.0,2.0)*t177*t168;
- t266 = -yy*zz*t19-X_udd_123*t6-X_udd_223*t9-t42*t5*t27-t44*t5*t31-t42*t8*
-t31-t44*t8*t35;
- t273 = t110*t110;
- t276 = t47*t46;
- t280 = t39*t266;
- t283 = t158*t37;
- t289 = t148*t266;
- t292 = RATIONAL(-1.0,2.0)*t67*t172+RATIONAL(-1.0,2.0)*t185*t150+RATIONAL(
--1.0,2.0)*t102*t155-2.0*t197*t127*t82-2.0*t133*t127*t220-2.0*t133*t110*t266+
-RATIONAL(-1.0,2.0)*t1*t224*t167-t273*t128*t100+RATIONAL(-1.0,2.0)*t39*t276*t149
--2.0*t138*t280-2.0*t65*t283+RATIONAL(-1.0,2.0)*t110*t276*t159-2.0*t67*t289;
- t302 = partial_d_g_uu_311;
- t303 = t302*t128;
- t306 = partial_d_g_uu_211;
- t307 = t306*t128;
- t310 = partial_d_g_uu_111;
- t311 = t310*t128;
- t314 = t148*t63;
- t317 = t153*t266;
- t326 = t107*t11;
- t330 = RATIONAL(-1.0,2.0)*t66*t276*t154-2.0*t273*t46*t116*t82+RATIONAL(
--1.0,2.0)*t205*t303+RATIONAL(-1.0,2.0)*t67*t307+RATIONAL(-1.0,2.0)*t177*t311
--2.0*t205*t314-2.0*t205*t317+RATIONAL(-1.0,2.0)*t185*t303+RATIONAL(-1.0,2.0)*
-t102*t307+RATIONAL(-1.0,2.0)*t65*t311-t111*t326-t158*t326*t46;
- t334 = t158*t82;
- t337 = t110*t82;
- t340 = t158*t220;
- t343 = t153*t100;
- t353 = t112*t46;
- t355 = partial_d_g_uu_223;
- t356 = t355*t11;
- t360 = t120*t46;
- t362 = -2.0*t177*t148*t220-2.0*t67*t334-2.0*t119*t337-2.0*t205*t340-2.0*
-t67*t343+RATIONAL(-1.0,2.0)*t137*t224*t163-t2*t128*t63-t273*t47*t37-t129*t353-
-t119*t356-t123*t182-t133*t186-t197*t360;
- t366 = t181*t46;
- t382 = t66*t66;
- t387 = t128*t116;
- t394 = -t142*t355*t46-t138*t366-2.0*t177*t283-2.0*t123*t110*t220-2.0*t123
-*t66*t266-t153*t356*t46-t65*t353*t116-t102*t360*t116-t382*t47*t100-2.0*t185*
-t317+RATIONAL(-1.0,2.0)*t127*t387*t310+RATIONAL(-1.0,2.0)*t110*t387*t306;
- t431 = RATIONAL(-1.0,2.0)*t1*t387*t302-2.0*t2*t11*t116*t220-2.0*t185*t314
--2.0*t102*t289-2.0*t65*t153*t82-2.0*t185*t205*t63-2.0*t40*t11*t46*t266-2.0*t102
-*t343-2.0*t102*t334-2.0*t185*t340-2.0*t102*t177*t82-2.0*t185*t67*t266-2.0*t185*
-t177*t220;
- Theta_A = t141+t189+t239+t292+t330+t362+t394+t431;
- t440 = t310*t116+t121+t139+t353+t154*t46+t366+t131+t356+t163*t11+t127*t37
-+2.0*t337+2.0*t232;
+ t2 = 1/r;
+ t4 = X_ud_13;
+ t5 = PARTIAL_RHO(h);
+ t7 = X_ud_23;
+ t8 = PARTIAL_SIGMA(h);
+ t10 = zz*t2-t4*t5-t7*t8;
+ t11 = t1*t10;
+ t12 = g_uu_23;
+ t14 = X_ud_12;
+ t16 = X_ud_22;
+ t18 = yy*t2-t14*t5-t16*t8;
+ t19 = t12*t18;
+ t21 = r*r;
+ t23 = 1/t21/r;
+ t29 = X_ud_11;
+ t31 = PARTIAL_RHO_RHO(h);
+ t33 = X_ud_21;
+ t35 = PARTIAL_RHO_SIGMA(h);
+ t40 = PARTIAL_SIGMA_SIGMA(h);
+ t42 = -xx*zz*t23-X_udd_113*t5-X_udd_213*t8-t29*t4*t31-t33*t4*t35-t29*t7*
+t35-t33*t7*t40;
+ t46 = g_uu_12;
+ t47 = t46*t18;
+ t48 = yy*yy;
+ t49 = zz*zz;
+ t56 = t29*t29;
+ t61 = t33*t33;
+ t63 = (t48+t49)*t23-X_udd_111*t5-X_udd_211*t8-t56*t31-2.0*t33*t29*t35-t61
+*t40;
+ t67 = t12*t12;
+ t83 = -yy*zz*t23-X_udd_123*t5-X_udd_223*t8-t14*t4*t31-t16*t4*t35-t14*t7*
+t35-t16*t7*t40;
+ t87 = t12*t10;
+ t102 = -xx*yy*t23-X_udd_112*t5-X_udd_212*t8-t29*t14*t31-t33*t14*t35-t29*
+t16*t35-t33*t16*t40;
+ t106 = g_uu_33;
+ t107 = t106*t10;
+ t108 = partial_d_g_uu_312;
+ t109 = t108*t18;
+ t113 = xx*t2-t29*t5-t33*t8;
+ t116 = xx*xx;
+ t123 = t4*t4;
+ t128 = t7*t7;
+ t130 = (t116+t48)*t23-X_udd_133*t5-X_udd_233*t8-t123*t31-2.0*t7*t4*t35-
+t128*t40;
+ t134 = partial_d_g_uu_212;
+ t135 = t134*t18;
+ t138 = g_uu_22;
+ t139 = t138*t18;
+ t140 = partial_d_g_uu_213;
+ t141 = t140*t10;
+ t144 = partial_d_g_uu_113;
+ t145 = t144*t10;
+ t148 = partial_d_g_uu_313;
+ t149 = t148*t10;
+ t155 = t10*t10;
+ t156 = t12*t155;
+ t159 = -2.0*t11*t19*t42-2.0*t11*t47*t63-2.0*t67*t10*t18*t83-2.0*t87*t47*
+t102-t107*t109*t113-2.0*t107*t19*t130-t87*t135*t113-t139*t141*t113-t47*t145*
+t113-t19*t149*t113-2.0*t107*t139*t83-t156*t140*t113;
+ t160 = g_uu_11;
+ t161 = t160*t113;
+ t162 = partial_d_g_uu_133;
+ t163 = t162*t155;
+ t166 = t46*t113;
+ t167 = partial_d_g_uu_233;
+ t168 = t167*t155;
+ t171 = partial_d_g_uu_222;
+ t172 = t18*t18;
+ t173 = t171*t172;
+ t176 = partial_d_g_uu_122;
+ t177 = t176*t172;
+ t180 = t1*t113;
+ t181 = partial_d_g_uu_333;
+ t182 = t181*t155;
+ t185 = partial_d_g_uu_322;
+ t186 = t185*t172;
+ t197 = t113*t113;
+ t198 = t46*t197;
+ t205 = RATIONAL(-1.0,2.0)*t161*t163+RATIONAL(-1.0,2.0)*t166*t168+RATIONAL
+(-1.0,2.0)*t166*t173+RATIONAL(-1.0,2.0)*t161*t177+RATIONAL(-1.0,2.0)*t180*t182+
+RATIONAL(-1.0,2.0)*t180*t186+RATIONAL(-1.0,2.0)*t47*t163+RATIONAL(-1.0,2.0)*
+t139*t168+RATIONAL(-1.0,2.0)*t19*t182+RATIONAL(-1.0,2.0)*t11*t177-2.0*t198*t160
+*t102-2.0*t11*t139*t102;
+ t207 = t160*t160;
+ t210 = t106*t106;
+ t213 = t46*t46;
+ t221 = t14*t14;
+ t226 = t16*t16;
+ t228 = (t116+t49)*t23-X_udd_122*t5-X_udd_222*t8-t221*t31-2.0*t16*t14*t35-
+t226*t40;
+ t230 = t1*t197;
+ t241 = partial_d_g_uu_112;
+ t242 = t241*t18;
+ t248 = t172*t18;
+ t255 = t180*t130;
+ t258 = -t207*t197*t63-t210*t155*t130-t213*t197*t228-2.0*t230*t160*t42-2.0
+*t230*t46*t83+RATIONAL(-1.0,2.0)*t107*t186+RATIONAL(-1.0,2.0)*t87*t173-t11*t242
+*t113-2.0*t47*t180*t42+RATIONAL(-1.0,2.0)*t12*t248*t185-2.0*t87*t139*t228-2.0*
+t19*t255;
+ t259 = t106*t155;
+ t260 = t12*t83;
+ t263 = t180*t83;
+ t270 = partial_d_g_uu_123;
+ t271 = t270*t10;
+ t274 = t166*t228;
+ t277 = partial_d_g_uu_211;
+ t278 = t277*t197;
+ t281 = partial_d_g_uu_111;
+ t282 = t281*t197;
+ t285 = t161*t102;
+ t291 = t46*t172;
+ t293 = t138*t172;
+ t294 = partial_d_g_uu_223;
+ t295 = t294*t10;
+ t297 = partial_d_g_uu_311;
+ t298 = t297*t197;
+ t301 = t161*t42;
+ t304 = -2.0*t259*t260-2.0*t139*t263-2.0*t213*t18*t113*t102-t161*t271*t18
+-2.0*t139*t274+RATIONAL(-1.0,2.0)*t139*t278+RATIONAL(-1.0,2.0)*t47*t282-2.0*
+t139*t285+RATIONAL(-1.0,2.0)*t138*t248*t171-t291*t271-t293*t295+RATIONAL(-1.0,
+2.0)*t107*t298-2.0*t19*t301;
+ t309 = t1*t1;
+ t318 = t166*t83;
+ t323 = partial_d_g_uu_323;
+ t324 = t323*t10;
+ t330 = t161*t63;
+ t333 = t155*t10;
+ t340 = RATIONAL(-1.0,2.0)*t87*t278-t309*t197*t130-t213*t172*t63+RATIONAL(
+-1.0,2.0)*t11*t282+RATIONAL(-1.0,2.0)*t19*t298-2.0*t19*t318-t166*t295*t18-t180*
+t324*t18+RATIONAL(-1.0,2.0)*t46*t248*t176-2.0*t47*t330+RATIONAL(-1.0,2.0)*t12*
+t333*t167+RATIONAL(-1.0,2.0)*t1*t333*t162;
+ t341 = t46*t102;
+ t344 = t12*t172;
+ t363 = t138*t138;
+ t369 = t1*t42;
+ t376 = -2.0*t293*t341-2.0*t344*t46*t42-2.0*t344*t138*t83+RATIONAL(-1.0,
+2.0)*t106*t333*t181-t344*t324-t67*t172*t130-t309*t155*t63-t67*t155*t228-t156*
+t294*t18-t363*t172*t228-2.0*t156*t1*t102-2.0*t259*t369-2.0*t309*t10*t113*t42;
+ t378 = t323*t18;
+ t380 = t160*t197;
+ t384 = t134*t113;
+ t393 = t1*t155;
+ t396 = t148*t113;
+ t398 = -t259*t378-t380*t242-t198*t135-t230*t109-t293*t384-t291*t241*t113-
+t344*t108*t113-t198*t141-t380*t145-t230*t149-t393*t144*t113-t259*t396;
+ t411 = t197*t113;
+ t431 = -t393*t270*t18-2.0*t107*t47*t42-2.0*t11*t166*t102-2.0*t87*t274-2.0
+*t107*t255+RATIONAL(-1.0,2.0)*t160*t411*t281+RATIONAL(-1.0,2.0)*t46*t411*t277+
+RATIONAL(-1.0,2.0)*t1*t411*t297-2.0*t87*t263-2.0*t87*t285-2.0*t11*t330-2.0*t107
+*t318-2.0*t107*t301;
+ Theta_A = t159+t205+t258+t304+t340+t376+t398+t431;
+ t440 = t281*t113+t384+t396+t242+t171*t18+t378+t145+t295+t181*t10+t160*t63
++2.0*t341+2.0*t369;
t444 = partial_d_ln_sqrt_g_1;
t447 = partial_d_ln_sqrt_g_2;
t450 = partial_d_ln_sqrt_g_3;
- t465 = t66*t100+2.0*t280+t137*t63+t127*t444*t116+t110*t447*t116+t1*t450*
-t116+t110*t444*t46+t66*t447*t46+t39*t450*t46+t1*t444*t11+t39*t447*t11+t137*t450
-*t11;
+ t465 = t138*t228+2.0*t260+t106*t130+t160*t444*t113+t46*t447*t113+t1*t450*
+t113+t46*t444*t18+t138*t447*t18+t12*t450*t18+t1*t444*t10+t12*t447*t10+t106*t450
+*t10;
Theta_B = t440+t465;
- Theta_C = K_uu_11*t128+2.0*K_uu_12*t46*t116+2.0*K_uu_13*t11*t116+K_uu_22*
-t47+2.0*K_uu_23*t11*t46+K_uu_33*t12;
- Theta_D = t129+2.0*t177*t116+2.0*t65*t116+t119+2.0*t102*t46+t138;
+ Theta_C = K_uu_11*t197+2.0*K_uu_12*t18*t113+2.0*K_uu_13*t10*t113+K_uu_22*
+t172+2.0*K_uu_23*t10*t18+K_uu_33*t155;
+ Theta_D = t380+2.0*t47*t113+2.0*t11*t113+t293+2.0*t87*t18+t259;
diff --git a/src/gr.cg/expansion_Jacobian.c b/src/gr.cg/expansion_Jacobian.c
index b5d2427..1017901 100644
--- a/src/gr.cg/expansion_Jacobian.c
+++ b/src/gr.cg/expansion_Jacobian.c
@@ -1,628 +1,631 @@
/*
- * inputs = {r, partial_d_ln_sqrt_g, partial_d_g_uu, X_ud, X_udd, g_uu, K_uu, Theta_A, Theta_B, Theta_C, Theta_D, h}
- * outputs = {partial_Theta_wrt_partial_d_h, partial_Theta_wrt_partial_dd_h}
- * cost = 458*assignments+1692*multiplications+10*divisions+7*functions+729*additions
+ * inputs = {partial_d_ln_sqrt_g, partial_d_g_uu, r, X_ud, X_udd, g_uu, K_uu, Theta_A, Theta_B, Theta_C, Theta_D, h}
+ * outputs = {partial_Theta_X_wrt_partial_d_h, partial_Theta_Y_wrt_partial_d_h, partial_Theta_X_wrt_partial_dd_h, partial_Theta_Y_wrt_partial_dd_h}
+ * cost = 466*assignments+10*divisions+7*functions+1722*multiplications+728*additions
*/
-fp t1, t2, t3, t4, t5, t7, t8, t10, t11, t13;
-fp t14, t16, t18, t20, t22, t24, t26, t28, t29, t31;
-fp t32, t35, t37, t38, t41, t42, t43, t46, t48, t52;
-fp t54, t55, t59, t60, t63, t67, t68, t69, t70, t71;
-fp t74, t76, t78, t80, t83, t85, t86, t92, t93, t94;
-fp t98, t99, t102, t103, t104, t107, t108, t112, t113, t114;
-fp t115, t116, t118, t119, t120, t122, t123, t126, t127, t128;
-fp t133, t136, t140, t141, t142, t143, t153, t156, t158, t160;
-fp t162, t165, t167, t168, t171, t172, t173, t174, t179, t183;
-fp t185, t189, t190, t193, t194, t195, t197, t198, t202, t205;
-fp t208, t209, t212, t216, t217, t218, t220, t222, t223, t224;
-fp t226, t227, t232, t235, t236, t237, t238, t240, t247, t248;
-fp t249, t254, t259, t263, t266, t267, t275, t278, t281, t284;
-fp t287, t288, t291, t296, t297, t298, t300, t307, t309, t311;
-fp t314, t316, t317, t322, t325, t326, t329, t334, t335, t336;
-fp t340, t346, t350, t351, t352, t354, t357, t358, t359, t361;
-fp t364, t365, t366, t368, t370, t373, t374, t376, t381, t385;
-fp t386, t392, t398, t401, t404, t405, t407, t408, t411, t414;
-fp t416, t417, t419, t421, t422, t424, t428, t431, t432, t434;
-fp t437, t440, t442, t449, t454, t458, t461, t467, t470, t471;
-fp t474, t475, t481, t485, t489, t494, t498, t503, t504, t505;
-fp t507, t514, t518, t534, t536, t542, t545, t548, t551, t552;
-fp t559, t561, t562, t565, t569, t571, t572, t573, t575, t576;
-fp t588, t589, t590, t593, t594, t599, t601, t605, t608, t609;
-fp t612, t613, t627, t632, t633, t640, t644, t652, t656, t664;
-fp t669, t672, t677, t678, t680, t694, t704, t707, t712, t716;
-fp t723, t738, t741, t746, t748, t750, t774, t776, t780, t785;
-fp t787, t792, t796, t797, t799, t800, t802, t803, t805, t807;
-fp t809, t811, t813, t815, t817, t819, t822, t824, t827, t829;
-fp t832, t835, t837, t840, t843, t847, t860, t869, t871, t876;
-fp t882, t886, t890, t891, t897, t899, t900, t902, t904, t905;
-fp t907, t913, t920, t929, t930, t933, t938, t944, t947, t949;
-fp t962, t970, t971, t976, t979, t983, t996, t997, t1000, t1001;
-fp t1004, t1010, t1012, t1015, t1033, t1036, t1039, t1047, t1048, t1050;
-fp t1062, t1065, t1070, t1074, t1075, t1078, t1080, t1082, t1087, t1093;
-fp t1095, t1097, t1103, t1107, t1112, t1114, t1138, t1139, t1141, t1145;
-fp t1150, t1163, t1166, t1169, t1174, t1186, t1189, t1192, t1200, t1214;
-fp t1234, t1266, t1281, t1289, t1300, t1301, t1308, t1335, t1342, t1345;
-fp t1364, t1370, t1405, t1414, t1427, t1457, t1460, t1463, t1465, t1469;
-fp t1475, t1476, t1477, t1483, t1486, t1487, t1491, t1492, t1493, t1497;
-fp t1505, t1508, t1510, t1513, t1516, t1517, t1520, t1526, t1536, t1547;
-fp t1552, t1555, t1558, t1561, t1572, t1580, t1594, t1600, t1606, t1610;
-fp t1622, t1629, t1639, t1641, t1643, t1645, t1648, t1655, t1659, t1660;
-fp t1666, t1667, t1684, t1697, t1704, t1718, t1721, t1739, t1748, t1751;
-fp t1757, t1760, t1761, t1768, t1771, t1783, t1785, t1788, t1791, t1803;
-fp t1809, t1812, t1825;
+fp t1, t2, t4, t5, t7, t8, t10, t11, t12, t14;
+fp t16, t18, t19, t20, t24, t25, t26, t28, t30, t32;
+fp t34, t36, t38, t40, t41, t42, t44, t47, t49, t50;
+fp t53, t54, t55, t56, t59, t60, t61, t68, t69, t70;
+fp t71, t75, t76, t79, t80, t81, t87, t91, t93, t97;
+fp t98, t101, t102, t108, t109, t112, t113, t114, t115, t117;
+fp t118, t119, t120, t123, t124, t126, t127, t128, t131, t133;
+fp t136, t137, t139, t140, t144, t146, t148, t151, t153, t154;
+fp t157, t160, t161, t162, t165, t166, t167, t169, t170, t171;
+fp t173, t177, t178, t179, t181, t184, t186, t190, t192, t196;
+fp t197, t198, t201, t203, t206, t207, t208, t209, t212, t213;
+fp t216, t218, t221, t222, t223, t226, t227, t228, t230, t232;
+fp t235, t237, t239, t241, t244, t246, t247, t251, t252, t254;
+fp t255, t257, t258, t262, t263, t265, t269, t271, t272, t273;
+fp t275, t278, t279, t284, t287, t288, t291, t294, t295, t298;
+fp t301, t307, t311, t312, t314, t317, t318, t322, t328, t330;
+fp t333, t337, t339, t341, t345, t357, t360, t363, t364, t365;
+fp t370, t372, t374, t377, t379, t380, t383, t384, t385, t387;
+fp t390, t397, t400, t405, t408, t410, t411, t412, t414, t419;
+fp t427, t430, t433, t436, t439, t443, t446, t447, t448, t451;
+fp t452, t454, t457, t458, t459, t462, t465, t471, t474, t478;
+fp t479, t481, t485, t489, t493, t499, t503, t508, t511, t513;
+fp t514, t521, t528, t534, t537, t539, t544, t550, t553, t556;
+fp t560, t564, t565, t574, t580, t582, t587, t595, t611, t616;
+fp t625, t627, t628, t629, t631, t632, t637, t639, t648, t652;
+fp t663, t676, t680, t681, t682, t698, t703, t709, t715, t718;
+fp t731, t735, t740, t742, t745, t747, t751, t759, t785, t790;
+fp t792, t797, t801, t802, t804, t805, t807, t808, t810, t812;
+fp t814, t816, t818, t820, t822, t824, t836, t837, t844, t846;
+fp t847, t849, t850, t852, t854, t856, t858, t860, t862, t866;
+fp t868, t873, t877, t879, t881, t884, t886, t890, t894, t895;
+fp t898, t902, t905, t910, t912, t914, t921, t926, t931, t934;
+fp t938, t940, t944, t946, t947, t950, t951, t956, t960, t964;
+fp t967, t970, t973, t976, t980, t983, t986, t991, t994, t999;
+fp t1005, t1009, t1012, t1015, t1016, t1024, t1030, t1034, t1037, t1044;
+fp t1057, t1066, t1076, t1089, t1101, t1112, t1123, t1130, t1143, t1162;
+fp t1172, t1185, t1206, t1230, t1236, t1272, t1283, t1313, t1326, t1332;
+fp t1341, t1346, t1351, t1380, t1389, t1402, t1415, t1418, t1420, t1423;
+fp t1425, t1428, t1431, t1433, t1436, t1439, t1443, t1446, t1465, t1466;
+fp t1467, t1470, t1476, t1477, t1478, t1481, t1484, t1485, t1490, t1497;
+fp t1500, t1501, t1504, t1506, t1511, t1514, t1518, t1524, t1532, t1537;
+fp t1540, t1543, t1556, t1560, t1567, t1568, t1582, t1585, t1588, t1600;
+fp t1601, t1606, t1610, t1613, t1631, t1635, t1641, t1646, t1652, t1662;
+fp t1668, t1673, t1674, t1688, t1694, t1695, t1704, t1705, t1711, t1739;
+fp t1749, t1752, t1755, t1766, t1769, t1772, t1777, t1782, t1791, t1794;
+fp t1803, t1809, t1819, t1830, t1834, t1855;
t1 = g_uu_13;
- t2 = X_ud_13;
- t3 = t1*t2;
- t4 = g_uu_12;
- t5 = 1/r;
- t7 = X_ud_11;
- t8 = PARTIAL_RHO(h);
- t10 = X_ud_21;
- t11 = PARTIAL_SIGMA(h);
- t13 = xx*t5-t7*t8-t10*t11;
- t14 = t4*t13;
- t16 = r*r;
- t18 = 1/t16/r;
- t20 = X_udd_112;
- t22 = X_udd_212;
- t24 = X_ud_12;
- t26 = PARTIAL_RHO_RHO(h);
- t28 = t10*t24;
- t29 = PARTIAL_RHO_SIGMA(h);
- t31 = X_ud_22;
- t32 = t7*t31;
- t35 = PARTIAL_SIGMA_SIGMA(h);
- t37 = -xx*yy*t18-t20*t8-t22*t11-t7*t24*t26-t28*t29-t32*t29-t10*t31*t35;
- t38 = t14*t37;
- t41 = g_uu_22;
- t42 = t41*t24;
- t43 = t1*t13;
- t46 = X_udd_123;
- t48 = X_udd_223;
- t52 = t31*t2;
- t54 = X_ud_23;
- t55 = t24*t54;
- t59 = -yy*zz*t18-t46*t8-t48*t11-t24*t2*t26-t52*t29-t55*t29-t31*t54*t35;
- t60 = t43*t59;
- t63 = g_uu_23;
- t67 = yy*t5-t24*t8-t31*t11;
- t68 = t63*t67;
- t69 = t1*t7;
- t70 = xx*xx;
- t71 = yy*yy;
- t74 = X_udd_133;
- t76 = X_udd_233;
- t78 = t2*t2;
- t80 = t54*t2;
- t83 = t54*t54;
- t85 = (t70+t71)*t18-t74*t8-t76*t11-t78*t26-2.0*t80*t29-t83*t35;
- t86 = t69*t85;
- t92 = zz*t5-t2*t8-t54*t11;
- t93 = t63*t92;
- t94 = t4*t67;
- t98 = t41*t67;
- t99 = t69*t59;
- t102 = g_uu_33;
- t103 = t102*t92;
- t104 = t43*t74;
- t107 = t1*t92;
- t108 = t4*t7;
- t112 = g_uu_11;
- t113 = t112*t13;
- t114 = partial_d_g_uu_123;
- t115 = t114*t2;
- t116 = t115*t67;
- t118 = partial_d_g_uu_211;
- t119 = t118*t13;
- t120 = t119*t7;
- t122 = t63*t2;
- t123 = t94*t37;
- t126 = partial_d_g_uu_122;
- t127 = t126*t67;
- t128 = t127*t24;
- t133 = t98*t37;
- t136 = X_udd_113;
- t140 = 2.0*t3*t38+2.0*t42*t60+2.0*t68*t86+2.0*t93*t94*t20+2.0*t98*t99+2.0
-*t103*t104+2.0*t107*t108*t37+t113*t116+t93*t120+2.0*t122*t123+t113*t128+2.0*
-t107*t14*t20+2.0*t3*t133+2.0*t107*t68*t136;
- t141 = partial_d_g_uu_311;
- t142 = t141*t13;
- t143 = t142*t7;
- t153 = zz*zz;
- t156 = X_udd_122;
- t158 = X_udd_222;
- t160 = t24*t24;
- t162 = t31*t24;
- t165 = t31*t31;
- t167 = (t70+t153)*t18-t156*t8-t158*t11-t160*t26-2.0*t162*t29-t165*t35;
- t168 = t108*t167;
- t171 = t13*t13;
- t172 = t112*t171;
- t173 = partial_d_g_uu_112;
- t174 = t173*t24;
- t179 = X_udd_213;
- t183 = t10*t2;
- t185 = t7*t54;
- t189 = -xx*zz*t18-t136*t8-t179*t11-t7*t2*t26-t183*t29-t185*t29-t10*t54*
-t35;
- t190 = t68*t189;
- t193 = t112*t7;
- t194 = t114*t92;
- t195 = t194*t67;
- t197 = t4*t4;
- t198 = t197*t67;
- t202 = t108*t59;
- t205 = t193*t37;
- t208 = t102*t2;
- t209 = t14*t59;
- t212 = t63*t24;
- t216 = t63*t63;
- t217 = t92*t92;
- t218 = t216*t217;
- t220 = t103*t143+2.0*t94*t43*t136+2.0*t107*t98*t20+2.0*t68*t104+2.0*t93*
-t168+t172*t174+2.0*t3*t190+t193*t195+2.0*t198*t7*t37+2.0*t103*t202+2.0*t93*t205
-+2.0*t208*t209+2.0*t107*t212*t189+t218*t156;
- t222 = t1*t1;
- t223 = t222*t217;
- t224 = X_udd_111;
- t226 = t102*t102;
- t227 = t226*t217;
- t232 = t113*t189;
- t235 = t67*t67;
- t236 = t41*t235;
- t237 = partial_d_g_uu_223;
- t238 = t237*t2;
- t240 = t194*t24;
- t247 = partial_d_g_uu_333;
- t248 = t247*t92;
- t249 = t248*t2;
- t254 = t113*t136;
- t259 = t1*t171;
- t263 = t193*t189;
- t266 = t223*t224+t227*t74+2.0*t107*t42*t37+2.0*t208*t232+t236*t238+t113*
-t240+2.0*t93*t98*t156+2.0*t68*t202+t43*t249+2.0*t93*t42*t167+2.0*t103*t254+2.0*
-t212*t209+2.0*t259*t4*t46+2.0*t103*t263;
- t267 = t98*t167;
- t275 = t14*t46;
- t278 = t43*t46;
- t281 = t113*t224;
- t284 = t113*t37;
- t287 = t102*t217;
- t288 = t63*t46;
- t291 = t113*t20;
- t296 = partial_d_g_uu_312;
- t297 = t296*t67;
- t298 = t297*t13;
- t300 = t222*t92;
- t307 = X_udd_211;
- t309 = t7*t7;
- t311 = t10*t7;
- t314 = t10*t10;
- t316 = (t71+t153)*t18-t224*t8-t307*t11-t309*t26-2.0*t311*t29-t314*t35;
- t317 = t113*t316;
- t322 = 2.0*t122*t267+2.0*t94*t69*t189+4.0*t43*t263+2.0*t103*t275+2.0*t98*
-t278+2.0*t107*t281+2.0*t122*t284+2.0*t287*t288+2.0*t93*t291+2.0*t68*t275+t208*
-t298+2.0*t300*t7*t189+2.0*t3*t317+2.0*t103*t86;
- t325 = t4*t24;
- t326 = t325*t189;
- t329 = t43*t85;
- t334 = partial_d_g_uu_313;
- t335 = t334*t92;
- t336 = t335*t13;
- t340 = t335*t7;
- t346 = t63*t59;
- t350 = partial_d_g_uu_111;
- t351 = t350*t13;
- t352 = t351*t7;
- t354 = t193*t316;
- t357 = partial_d_g_uu_113;
- t358 = t357*t2;
- t359 = t358*t13;
- t361 = t94*t189;
- t364 = partial_d_g_uu_323;
- t365 = t364*t2;
- t366 = t365*t67;
- t368 = 2.0*t103*t326+2.0*t208*t329+2.0*t212*t329+t212*t336+4.0*t68*t326+
-t68*t340+2.0*t93*t278+4.0*t43*t202+4.0*t103*t346*t2+t94*t352+2.0*t107*t354+t94*
-t359+2.0*t208*t361+t43*t366;
- t370 = t41*t59*t24;
- t373 = t357*t92;
- t374 = t373*t13;
- t376 = t1*t189;
- t381 = t63*t235;
- t385 = partial_d_g_uu_133;
- t386 = t385*t217;
- t392 = t4*t20;
- t398 = t350*t171;
- t401 = t118*t171;
- t404 = t334*t2;
- t405 = t404*t13;
- t407 = t4*t37;
- t408 = t407*t24;
- t411 = t43*t189;
- t414 = 4.0*t68*t370+t325*t374+4.0*t103*t376*t2+t98*t120+2.0*t381*t41*t46+
-RATIONAL(1.0,2.0)*t193*t386+2.0*t381*t4*t136+2.0*t236*t392+2.0*t259*t112*t136+
-RATIONAL(1.0,2.0)*t3*t398+RATIONAL(1.0,2.0)*t122*t401+t68*t405+4.0*t98*t408+2.0
-*t325*t411;
- t416 = t364*t92;
- t417 = t416*t67;
- t419 = t297*t7;
- t421 = t296*t24;
- t422 = t421*t13;
- t424 = t1*t37;
- t428 = t94*t316;
- t431 = t41*t41;
- t432 = t431*t235;
- t434 = t126*t235;
- t437 = t247*t217;
- t440 = t416*t24;
- t442 = t373*t7;
- t449 = t431*t67;
- t454 = t69*t417+t103*t419+t103*t422+4.0*t93*t424*t2+2.0*t3*t428+t432*t156
-+RATIONAL(1.0,2.0)*t193*t434+RATIONAL(1.0,2.0)*t69*t437+t43*t440+t94*t442+2.0*
-t300*t13*t136+t381*t296*t7+2.0*t449*t167*t24+t259*t421;
- t458 = t350*t7;
- t461 = t4*t235;
- t467 = t13*t189;
- t470 = t237*t92;
- t471 = t470*t24;
- t474 = t385*t92;
- t475 = t474*t2;
- t481 = t13*t37;
- t485 = t67*t59;
- t489 = t238*t67;
- t494 = RATIONAL(3.0,2.0)*t259*t141*t7+RATIONAL(3.0,2.0)*t172*t458+t461*
-t115+2.0*t198*t13*t20+2.0*t222*t2*t467+2.0*t98*t471+t113*t475+2.0*t107*t94*t224
-+2.0*t197*t24*t481+2.0*t216*t2*t485+t68*t249+t14*t489+t107*t128+2.0*t93*t99;
- t498 = t470*t67;
- t503 = partial_d_g_uu_233;
- t504 = t503*t92;
- t505 = t504*t2;
- t507 = t4*t171;
- t514 = t216*t92;
- t518 = t334*t7;
- t534 = t108*t498+2.0*t103*t94*t136+t14*t505+RATIONAL(3.0,2.0)*t507*t118*
-t7+2.0*t107*t325*t316+2.0*t514*t24*t59+t287*t518+t259*t404+RATIONAL(3.0,2.0)*
-t461*t126*t24+2.0*t514*t67*t46+RATIONAL(1.0,2.0)*t3*t434+2.0*t68*t440+t172*t358
-+2.0*t68*t422;
- t536 = partial_d_g_uu_213;
- t542 = t98*t59;
- t545 = t68*t85;
- t548 = t216*t235;
- t551 = t536*t13;
- t552 = t551*t2;
- t559 = t174*t13;
- t561 = t536*t92;
- t562 = t561*t7;
- t565 = t226*t92;
- t569 = t94*t475+t507*t536*t2+2.0*t43*t340+t14*t471+2.0*t208*t542+2.0*t208
-*t545+t548*t74+t98*t505+2.0*t93*t552+2.0*t94*t240+2.0*t113*t442+t107*t559+2.0*
-t14*t562+2.0*t565*t85*t2;
- t571 = partial_d_g_uu_322;
- t572 = t571*t67;
- t573 = t572*t24;
- t575 = t173*t67;
- t576 = t575*t13;
- t588 = partial_d_g_uu_212;
- t589 = t588*t24;
- t590 = t589*t13;
- t593 = t588*t67;
- t594 = t593*t13;
- t599 = t575*t7;
- t601 = t63*t217;
- t605 = t141*t171;
- t608 = t43*t573+t3*t576+2.0*t103*t405+2.0*t43*t419+t103*t573+2.0*t107*
-t359+2.0*t514*t167*t2+t93*t590+t381*t365+t122*t594+2.0*t103*t98*t46+t107*t599+
-2.0*t601*t1*t20+RATIONAL(1.0,2.0)*t208*t605;
- t609 = t593*t7;
- t612 = partial_d_g_uu_222;
- t613 = t612*t24;
- t627 = t588*t7;
- t632 = t612*t67;
- t633 = t632*t24;
- t640 = t216*t67;
- t644 = 2.0*t14*t609+RATIONAL(3.0,2.0)*t236*t613+t93*t609+2.0*t113*t599+
-RATIONAL(1.0,2.0)*t42*t401+2.0*t107*t116+RATIONAL(1.0,2.0)*t325*t398+2.0*t103*
-t366+t236*t627+2.0*t103*t212*t85+t14*t633+2.0*t93*t489+RATIONAL(3.0,2.0)*t381*
-t571*t24+2.0*t640*t85*t24;
- t652 = t364*t24;
- t656 = t1*t217;
- t664 = t247*t2;
- t669 = t1*t136;
- t672 = t503*t217;
- t677 = t112*t112;
- t678 = t677*t171;
- t680 = 4.0*t14*t205+2.0*t103*t68*t74+t287*t652+t461*t173*t7+t656*t114*t24
-+t601*t237*t24+t507*t589+t601*t536*t7+RATIONAL(3.0,2.0)*t287*t664+RATIONAL(1.0,
-2.0)*t212*t437+2.0*t287*t669+RATIONAL(1.0,2.0)*t108*t672+RATIONAL(1.0,2.0)*t42*
-t672+t678*t224;
- t694 = t677*t13;
- t704 = t571*t235;
- t707 = t612*t235;
- t712 = t222*t13;
- t716 = 2.0*t98*t590+2.0*t300*t316*t2+2.0*t94*t559+t98*t562+2.0*t122*t60+
-t93*t633+2.0*t103*t370+2.0*t694*t316*t7+RATIONAL(3.0,2.0)*t656*t385*t2+RATIONAL
-(3.0,2.0)*t601*t503*t2+RATIONAL(1.0,2.0)*t208*t704+RATIONAL(1.0,2.0)*t122*t707+
-RATIONAL(1.0,2.0)*t69*t704+2.0*t712*t85*t7;
- t723 = t197*t13;
- t738 = t14*t167;
- t741 = t14*t156;
- t746 = t561*t13;
- t748 = t197*t235;
- t750 = 2.0*t198*t316*t24+t656*t357*t7+2.0*t723*t167*t7+t68*t143+2.0*t507*
-t112*t20+2.0*t94*t354+t98*t552+RATIONAL(1.0,2.0)*t108*t707+RATIONAL(1.0,2.0)*
-t212*t605+2.0*t122*t738+2.0*t98*t741+2.0*t93*t408+t42*t746+t748*t224;
- t774 = t197*t171;
- t776 = t222*t171;
- t780 = 2.0*t94*t281+2.0*t42*t284+2.0*t98*t168+t107*t352+2.0*t212*t232+2.0
-*t93*t741+RATIONAL(1.0,2.0)*t325*t386+2.0*t42*t738+2.0*t98*t205+2.0*t98*t291+
-2.0*t325*t317+2.0*t68*t254+t774*t156+t776*t74+2.0*t68*t263;
- t785 = pow(Theta_D,1.0*RATIONAL(1.0,2.0));
- t787 = 1/t785/Theta_D;
- t792 = -t458-t627-t518-t174-t613-t652-t358-t238-t664-t112*t224-2.0*t392
--2.0*t669;
- t796 = partial_d_ln_sqrt_g_1;
- t797 = t112*t796;
- t799 = partial_d_ln_sqrt_g_2;
- t800 = t4*t799;
- t802 = partial_d_ln_sqrt_g_3;
- t803 = t1*t802;
- t805 = t4*t796;
- t807 = t41*t799;
- t809 = t63*t802;
- t811 = t1*t796;
- t813 = t63*t799;
- t815 = t102*t802;
- t817 = -t41*t156-2.0*t288-t102*t74-t797*t7-t800*t7-t803*t7-t805*t24-t807*
-t24-t809*t24-t811*t2-t813*t2-t815*t2;
- t819 = 1/t785;
- t822 = K_uu_11*t13;
- t824 = K_uu_12;
- t827 = t824*t67;
- t829 = K_uu_13;
- t832 = t829*t92;
- t835 = K_uu_22*t67;
- t837 = K_uu_23;
- t840 = t837*t92;
- t843 = K_uu_33*t92;
- t847 = 1/Theta_D;
- t860 = Theta_D*Theta_D;
- t869 = RATIONAL(3.0,2.0)*Theta_A/t785/t860+RATIONAL(1.0,2.0)*Theta_B*t787
-+Theta_C/t860;
- partial_Theta_wrt_partial_d_h_1 = (t140+t220+t266+t322+t368+t414+t454+
-t494+t534+t569+t608+t644+t680+t716+t750+t780)*t787+(t792+t817)*t819+(-2.0*t822*
-t7-2.0*t824*t24*t13-2.0*t827*t7-2.0*t829*t2*t13-2.0*t832*t7-2.0*t835*t24-2.0*
-t837*t2*t67-2.0*t840*t24-2.0*t843*t2)*t847-(-2.0*t113*t7-2.0*t325*t13-2.0*t94*
-t7-2.0*t3*t13-2.0*t107*t7-2.0*t98*t24-2.0*t122*t67-2.0*t93*t24-2.0*t103*t2)*
-t869;
- t871 = t113*t22;
- t876 = t63*t54;
- t882 = t551*t54;
- t886 = t561*t10;
- t890 = t112*t10;
- t891 = t890*t316;
- t897 = t334*t10;
- t899 = 2.0*t93*t871+t381*t296*t10+t876*t594+2.0*t93*t94*t22+t432*t158+2.0
-*t93*t882+t218*t158+2.0*t14*t886+t748*t307+2.0*t94*t891+t890*t195+t548*t76+t223
-*t307+t287*t897;
- t900 = t194*t31;
- t902 = t334*t54;
- t904 = t114*t54;
- t905 = t904*t67;
- t907 = t63*t31;
- t913 = t102*t54;
- t920 = t14*t48;
- t929 = t4*t10;
- t930 = t929*t59;
- t933 = t335*t10;
- t938 = t113*t900+t259*t902+t113*t905+2.0*t907*t209+2.0*t300*t13*t179+2.0*
-t913*t545+t507*t536*t54+t601*t536*t10+2.0*t68*t920+2.0*t712*t85*t10+2.0*t449*
-t167*t31+2.0*t68*t930+t68*t933+2.0*t197*t31*t481;
- t944 = t1*t54;
- t947 = t588*t31;
- t949 = t113*t307;
- t962 = t364*t54;
- t970 = t4*t31;
- t971 = t970*t189;
- t976 = t913*t298+2.0*t103*t907*t85+2.0*t944*t317+t507*t947+2.0*t107*t949+
-RATIONAL(3.0,2.0)*t507*t118*t10+2.0*t259*t4*t48+t259*t296*t31+2.0*t107*t891+
-t381*t962+2.0*t198*t13*t22+2.0*t103*t68*t76+2.0*t103*t971+2.0*t876*t60;
- t979 = t416*t31;
- t983 = t351*t10;
- t996 = t1*t10;
- t997 = t996*t85;
- t1000 = t41*t31;
- t1001 = t1000*t59;
- t1004 = t996*t59;
- t1010 = t142*t10;
- t1012 = 2.0*t907*t329+t43*t979+2.0*t913*t361+t107*t983+2.0*t944*t38+4.0*
-t93*t424*t54+2.0*t107*t929*t37+2.0*t103*t94*t179+2.0*t68*t997+2.0*t103*t1001+
-2.0*t98*t1004+t970*t374+2.0*t913*t542+t103*t1010;
- t1015 = t119*t10;
- t1033 = t43*t48;
- t1036 = t297*t10;
- t1039 = t373*t10;
- t1047 = t357*t54;
- t1048 = t1047*t13;
- t1050 = t93*t1015+2.0*t107*t1000*t37+2.0*t259*t112*t179+2.0*t970*t411+2.0
-*t944*t133+2.0*t93*t1004+2.0*t103*t98*t48+t774*t158+2.0*t98*t1033+2.0*t43*t1036
-+2.0*t113*t1039+2.0*t1000*t60+2.0*t94*t43*t179+t94*t1048;
- t1062 = t43*t76;
- t1065 = t113*t179;
- t1070 = t470*t31;
- t1074 = t237*t54;
- t1075 = t1074*t67;
- t1078 = t504*t54;
- t1080 = t474*t54;
- t1082 = 2.0*t107*t98*t22+2.0*t94*t996*t189+t98*t1015+2.0*t970*t317+2.0*
-t876*t123+2.0*t68*t1062+2.0*t68*t1065+2.0*t944*t428+t14*t1070+2.0*t94*t949+t14*
-t1075+t94*t1039+t14*t1078+t113*t1080;
- t1087 = t112*t189*t10;
- t1093 = t248*t54;
- t1095 = t127*t31;
- t1097 = t572*t31;
- t1103 = t296*t13*t31;
- t1107 = t407*t31;
- t1112 = t632*t31;
- t1114 = 4.0*t43*t930+4.0*t43*t1087+t227*t76+4.0*t68*t971+t68*t1093+t107*
-t1095+t103*t1097+4.0*t68*t1001+t98*t1078+2.0*t68*t1103+t678*t307+4.0*t98*t1107+
-RATIONAL(1.0,2.0)*t1000*t672+t93*t1112;
- t1138 = t173*t31;
- t1139 = t1138*t13;
- t1141 = t4*t22;
- t1145 = 2.0*t381*t41*t48+2.0*t216*t54*t485+t103*t1103+RATIONAL(1.0,2.0)*
-t996*t704+t103*t1036+t601*t237*t31+t172*t1047+RATIONAL(3.0,2.0)*t601*t503*t54+
-2.0*t514*t31*t59+2.0*t514*t67*t48+t776*t76+t107*t1139+2.0*t236*t1141+t996*t417;
- t1150 = t593*t10;
- t1163 = t947*t13;
- t1166 = t962*t67;
- t1169 = t575*t10;
- t1174 = t944*t576+t93*t1150+2.0*t723*t167*t10+RATIONAL(1.0,2.0)*t890*t386
-+RATIONAL(1.0,2.0)*t929*t672+RATIONAL(1.0,2.0)*t944*t434+RATIONAL(1.0,2.0)*t907
-*t437+t93*t1163+t98*t882+t43*t1166+t1000*t746+t107*t1169+t43*t1097+2.0*t107*
-t1048;
- t1186 = t112*t37*t10;
- t1189 = t929*t167;
- t1192 = t14*t158;
- t1200 = t43*t1093+t907*t336+2.0*t98*t1070+t113*t1095+2.0*t113*t1169+t68*
-t1010+t98*t886+t94*t1080+4.0*t14*t1186+2.0*t93*t1189+2.0*t93*t1192+2.0*t913*
-t232+2.0*t876*t738+t14*t1112;
- t1214 = t902*t13;
- t1234 = 2.0*t107*t14*t22+2.0*t1000*t738+2.0*t876*t267+2.0*t107*t68*t179+
-2.0*t94*t900+t68*t1214+2.0*t103*t920+2.0*t944*t190+2.0*t68*t1087+2.0*t93*t98*
-t158+2.0*t907*t232+2.0*t93*t1000*t167+2.0*t98*t1192+2.0*t98*t1189;
- t1266 = 2.0*t103*t1065+t94*t983+2.0*t1000*t284+2.0*t198*t316*t31+2.0*t107
-*t907*t189+RATIONAL(1.0,2.0)*t890*t434+2.0*t103*t1166+2.0*t43*t933+2.0*t103*
-t930+2.0*t94*t1139+2.0*t98*t1163+2.0*t98*t1186+RATIONAL(3.0,2.0)*t259*t141*t10+
-2.0*t222*t54*t467;
- t1281 = t588*t10;
- t1289 = t247*t54;
- t1300 = 2.0*t300*t10*t189+RATIONAL(3.0,2.0)*t656*t385*t54+t461*t904+t172*
-t1138+t236*t1074+2.0*t694*t316*t10+t236*t1281+RATIONAL(3.0,2.0)*t381*t571*t31+
-RATIONAL(3.0,2.0)*t461*t126*t31+RATIONAL(3.0,2.0)*t287*t1289+2.0*t103*t1087+2.0
-*t107*t905+2.0*t68*t979+2.0*t98*t871;
- t1301 = t612*t31;
- t1308 = t364*t31;
- t1335 = RATIONAL(3.0,2.0)*t236*t1301+2.0*t93*t1075+2.0*t14*t1150+t287*
-t1308+t656*t114*t31+t461*t173*t10+RATIONAL(1.0,2.0)*t1000*t401+t656*t357*t10+
-2.0*t300*t316*t54+2.0*t507*t112*t22+2.0*t640*t85*t31+2.0*t601*t1*t22+RATIONAL(
-1.0,2.0)*t876*t707+2.0*t565*t85*t54;
- t1342 = t63*t48;
- t1345 = t1*t179;
- t1364 = t350*t10;
- t1370 = RATIONAL(1.0,2.0)*t913*t704+2.0*t514*t167*t54+2.0*t287*t1342+2.0*
-t287*t1345+RATIONAL(1.0,2.0)*t970*t398+RATIONAL(1.0,2.0)*t996*t437+RATIONAL(1.0
-,2.0)*t907*t605+RATIONAL(1.0,2.0)*t944*t398+RATIONAL(1.0,2.0)*t876*t401+
-RATIONAL(1.0,2.0)*t913*t605+RATIONAL(1.0,2.0)*t929*t707+RATIONAL(1.0,2.0)*t970*
-t386+RATIONAL(3.0,2.0)*t172*t1364+2.0*t198*t10*t37;
- t1405 = 4.0*t103*t376*t54+2.0*t103*t1214+4.0*t103*t346*t54+2.0*t93*t1107+
-2.0*t107*t94*t307+2.0*t107*t970*t316+2.0*t913*t209+2.0*t381*t4*t179+t929*t498+
-2.0*t93*t1033+2.0*t103*t997+2.0*t103*t1062+2.0*t913*t329+2.0*t876*t284+2.0*t93*
-t1186;
- t1414 = -t1364-t1281-t897-t1138-t1301-t1308-t1047-t1074-t1289-t112*t307
--2.0*t1141-2.0*t1345;
- t1427 = -t41*t158-2.0*t1342-t102*t76-t797*t10-t800*t10-t803*t10-t805*t31-
-t807*t31-t809*t31-t811*t54-t813*t54-t815*t54;
- partial_Theta_wrt_partial_d_h_2 = (t899+t938+t976+t1012+t1050+t1082+t1114
-+t1145+t1174+t1200+t1234+t1266+t1300+t1335+t1370+t1405)*t787+(t1414+t1427)*t819
-+(-2.0*t822*t10-2.0*t824*t31*t13-2.0*t827*t10-2.0*t829*t54*t13-2.0*t832*t10-2.0
-*t835*t31-2.0*t837*t54*t67-2.0*t840*t31-2.0*t843*t54)*t847-(-2.0*t113*t10-2.0*
-t970*t13-2.0*t94*t10-2.0*t944*t13-2.0*t107*t10-2.0*t98*t31-2.0*t876*t67-2.0*t93
-*t31-2.0*t103*t54)*t869;
- t1457 = t14*t160;
- t1460 = t69*t2;
- t1463 = t68*t4;
- t1465 = t13*t24*t2;
- t1469 = t43*t78;
- t1475 = t103*t4;
- t1476 = t67*t7;
- t1477 = t1476*t2;
- t1483 = t212*t2;
- t1486 = t107*t41;
- t1487 = t1476*t24;
- t1491 = 2.0*t98*t1457+2.0*t287*t1460+2.0*t1463*t1465+t774*t160+2.0*t68*
-t1469+2.0*t107*t94*t309+2.0*t1475*t1477+2.0*t381*t108*t2+2.0*t287*t1483+2.0*
-t1486*t1487+t218*t160;
- t1492 = t13*t7;
- t1493 = t1492*t24;
- t1497 = t113*t309;
- t1505 = t98*t1;
- t1508 = t103*t41;
- t1510 = t67*t24*t2;
- t1513 = t93*t4;
- t1516 = t94*t1;
- t1517 = t1492*t2;
- t1520 = t107*t4;
- t1526 = 2.0*t198*t1493+t223*t309+2.0*t107*t1497+2.0*t259*t193*t2+2.0*t93*
-t1457+2.0*t1505*t1465+2.0*t1508*t1510+2.0*t1513*t1487+2.0*t1516*t1517+2.0*t1520
-*t1493+2.0*t103*t68*t78;
- t1536 = t93*t112;
- t1547 = t93*t1;
- t1552 = t432*t160+2.0*t93*t98*t160+t548*t78+2.0*t514*t1510+t748*t309+2.0*
-t1536*t1493+2.0*t300*t1517+2.0*t381*t42*t2+2.0*t507*t193*t24+2.0*t1547*t1465+
-2.0*t1475*t1465;
- t1555 = t103*t112;
- t1558 = t98*t112;
- t1561 = t108*t24;
- t1572 = t68*t112;
- t1580 = 2.0*t1547*t1477+2.0*t1555*t1517+2.0*t1558*t1493+2.0*t236*t1561+
-2.0*t259*t325*t2+t776*t78+t678*t309+t227*t78+2.0*t94*t1497+2.0*t1572*t1517+2.0*
-t103*t1469+2.0*t601*t69*t24;
- partial_Theta_wrt_partial_dd_h_11 = (t1491+t1526+t1552+t1580)*t787+(-t112
-*t309-2.0*t1561-2.0*t1460-t41*t160-2.0*t1483-t102*t78)*t819;
- t1594 = -t183-t185;
- t1600 = t67*t10;
- t1606 = -t28-t32;
- t1610 = t1*t1594;
- t1622 = 2.0*t218*t162-2.0*t107*t68*t1594+2.0*t432*t162+4.0*t1520*t1600*t7
-+2.0*t776*t80-2.0*t601*t1*t1606-2.0*t287*t1610+2.0*t223*t311+2.0*t748*t311-2.0*
-t93*t94*t1606+2.0*t774*t162;
- t1629 = -t52-t55;
- t1639 = t113*t1606;
- t1641 = t113*t1594;
- t1643 = t14*t1629;
- t1645 = -t381*t4*t1594-t300*t13*t1594-t107*t98*t1606-t259*t4*t1629-t103*
-t94*t1594-t107*t14*t1606+t678*t311-t507*t112*t1606-t93*t1639-t103*t1641-t103*
-t1643;
- t1648 = t43*t1629;
- t1655 = t13*t54*t2;
- t1659 = t13*t10;
- t1660 = t1659*t7;
- t1666 = t13*t31;
- t1667 = t1666*t24;
- t1684 = -2.0*t93*t1648+2.0*t227*t80+4.0*t103*t1*t1655+4.0*t94*t112*t1660
--2.0*t198*t13*t1606+4.0*t1513*t1667-2.0*t514*t67*t1629-2.0*t94*t43*t1594+4.0*
-t68*t1*t1655+4.0*t98*t4*t1667-2.0*t98*t1639;
- t1697 = t4*t1606;
- t1704 = t67*t31;
- t1718 = t63*t1629;
- t1721 = -2.0*t259*t112*t1594-2.0*t68*t1643-2.0*t68*t1641-2.0*t98*t1648+
-4.0*t107*t112*t1660-2.0*t236*t1697-2.0*t381*t41*t1629+4.0*t93*t41*t1704*t24-2.0
-*t103*t98*t1629+2.0*t548*t80+4.0*t103*t63*t67*t54*t2-2.0*t287*t1718;
- partial_Theta_wrt_partial_dd_h_12 = (t1622+2.0*t1645+t1684+t1721)*t787+(
--2.0*t890*t7+2.0*t1697+2.0*t1610-2.0*t1000*t24+2.0*t1718-2.0*t913*t2)*t819;
- t1739 = t996*t54;
- t1748 = t1704*t54;
- t1751 = t1600*t54;
- t1757 = t1600*t31;
- t1760 = 2.0*t507*t890*t31+2.0*t93*t98*t165+t227*t83+t548*t83+2.0*t287*
-t1739+2.0*t259*t970*t54+2.0*t601*t996*t31+2.0*t514*t1748+2.0*t1547*t1751+2.0*
-t107*t94*t314+2.0*t1486*t1757;
- t1761 = t907*t54;
- t1768 = t1659*t31;
- t1771 = t113*t314;
- t1783 = 2.0*t287*t1761+t748*t314+t774*t165+t678*t314+t223*t314+2.0*t198*
-t1768+2.0*t94*t1771+2.0*t1513*t1757+2.0*t1520*t1768+2.0*t1475*t1751+2.0*t103*
-t68*t83;
- t1785 = t1666*t54;
- t1788 = t1659*t54;
- t1791 = t43*t83;
- t1803 = t14*t165;
- t1809 = 2.0*t1547*t1785+2.0*t1516*t1788+2.0*t68*t1791+2.0*t1558*t1768+2.0
-*t259*t890*t54+2.0*t107*t1771+2.0*t1463*t1785+2.0*t98*t1803+t218*t165+t776*t83+
-t432*t165;
- t1812 = t929*t31;
- t1825 = t1572*t1788+t1505*t1785+t236*t1812+t103*t1791+t300*t1788+t381*
-t1000*t54+t381*t929*t54+t93*t1803+t1555*t1788+t1536*t1768+t1475*t1785+t1508*
-t1748;
- partial_Theta_wrt_partial_dd_h_22 = (t1760+t1783+t1809+2.0*t1825)*t787+(-
-t112*t314-2.0*t1812-2.0*t1739-t41*t165-2.0*t1761-t102*t83)*t819;
+ t2 = 1/r;
+ t4 = X_ud_13;
+ t5 = PARTIAL_RHO(h);
+ t7 = X_ud_23;
+ t8 = PARTIAL_SIGMA(h);
+ t10 = zz*t2-t4*t5-t7*t8;
+ t11 = t1*t10;
+ t12 = g_uu_12;
+ t14 = X_ud_12;
+ t16 = X_ud_22;
+ t18 = yy*t2-t14*t5-t16*t8;
+ t19 = t12*t18;
+ t20 = X_udd_111;
+ t24 = g_uu_23;
+ t25 = t24*t10;
+ t26 = t12*t14;
+ t28 = r*r;
+ t30 = 1/t28/r;
+ t32 = X_udd_112;
+ t34 = X_udd_212;
+ t36 = X_ud_11;
+ t38 = PARTIAL_RHO_RHO(h);
+ t40 = X_ud_21;
+ t41 = t40*t14;
+ t42 = PARTIAL_RHO_SIGMA(h);
+ t44 = t36*t16;
+ t47 = PARTIAL_SIGMA_SIGMA(h);
+ t49 = -xx*yy*t30-t32*t5-t34*t8-t36*t14*t38-t41*t42-t44*t42-t40*t16*t47;
+ t50 = t26*t49;
+ t53 = t1*t4;
+ t54 = partial_d_g_uu_122;
+ t55 = t18*t18;
+ t56 = t54*t55;
+ t59 = g_uu_33;
+ t60 = t59*t10;
+ t61 = X_udd_113;
+ t68 = xx*t2-t36*t5-t40*t8;
+ t69 = t68*t68;
+ t70 = t12*t69;
+ t71 = g_uu_11;
+ t75 = t24*t4;
+ t76 = t19*t49;
+ t79 = partial_d_g_uu_112;
+ t80 = t79*t68;
+ t81 = t80*t14;
+ t87 = X_udd_213;
+ t91 = t40*t4;
+ t93 = t36*t7;
+ t97 = -xx*zz*t30-t61*t5-t87*t8-t36*t4*t38-t91*t42-t93*t42-t40*t7*t47;
+ t98 = t26*t97;
+ t101 = g_uu_22;
+ t102 = t101*t18;
+ t108 = t59*t4;
+ t109 = t19*t97;
+ t112 = t71*t68;
+ t113 = partial_d_g_uu_133;
+ t114 = t113*t10;
+ t115 = t114*t4;
+ t117 = t12*t68;
+ t118 = partial_d_g_uu_213;
+ t119 = t118*t10;
+ t120 = t119*t36;
+ t123 = t79*t18;
+ t124 = t123*t36;
+ t126 = 2.0*t11*t19*t20+2.0*t25*t50+RATIONAL(1.0,2.0)*t53*t56+2.0*t60*t19*
+t61+2.0*t70*t71*t32+2.0*t75*t76+2.0*t19*t81+2.0*t60*t98+4.0*t102*t50+2.0*t11*
+t102*t32+2.0*t108*t109+t112*t115+2.0*t117*t120+t11*t124;
+ t127 = t101*t55;
+ t128 = t12*t32;
+ t131 = partial_d_g_uu_313;
+ t133 = t131*t68*t4;
+ t136 = t54*t18;
+ t137 = t136*t14;
+ t139 = yy*yy;
+ t140 = zz*zz;
+ t144 = X_udd_211;
+ t146 = t36*t36;
+ t148 = t40*t36;
+ t151 = t40*t40;
+ t153 = (t139+t140)*t30-t20*t5-t144*t8-t146*t38-2.0*t148*t42-t151*t47;
+ t154 = t19*t153;
+ t157 = t102*t49;
+ t160 = partial_d_g_uu_123;
+ t161 = t160*t10;
+ t162 = t161*t14;
+ t165 = partial_d_g_uu_312;
+ t166 = t165*t18;
+ t167 = t166*t36;
+ t169 = partial_d_g_uu_233;
+ t170 = t169*t10;
+ t171 = t170*t4;
+ t173 = t101*t14;
+ t177 = partial_d_g_uu_222;
+ t178 = t177*t18;
+ t179 = t178*t14;
+ t181 = t24*t18;
+ t184 = X_udd_123;
+ t186 = X_udd_223;
+ t190 = t16*t4;
+ t192 = t14*t7;
+ t196 = -yy*zz*t30-t184*t5-t186*t8-t14*t4*t38-t190*t42-t192*t42-t16*t7*t47
+;
+ t197 = t101*t196;
+ t198 = t197*t14;
+ t201 = t12*t12;
+ t203 = t68*t49;
+ t206 = t1*t36;
+ t207 = partial_d_g_uu_333;
+ t208 = t10*t10;
+ t209 = t207*t208;
+ t212 = partial_d_g_uu_322;
+ t213 = t212*t55;
+ t216 = 2.0*t127*t128+2.0*t60*t133+t112*t137+2.0*t53*t154+2.0*t53*t157+2.0
+*t19*t162+t60*t167+t117*t171+2.0*t11*t173*t49+t117*t179+4.0*t181*t198+2.0*t201*
+t14*t203+RATIONAL(1.0,2.0)*t206*t209+RATIONAL(1.0,2.0)*t206*t213;
+ t218 = t113*t208;
+ t221 = t24*t24;
+ t222 = t221*t55;
+ t223 = X_udd_133;
+ t226 = t1*t68;
+ t227 = t212*t18;
+ t228 = t227*t14;
+ t230 = t166*t68;
+ t232 = xx*xx;
+ t235 = X_udd_122;
+ t237 = X_udd_222;
+ t239 = t14*t14;
+ t241 = t16*t14;
+ t244 = t16*t16;
+ t246 = (t232+t140)*t30-t235*t5-t237*t8-t239*t38-2.0*t241*t42-t244*t47;
+ t247 = t102*t246;
+ t251 = partial_d_g_uu_212;
+ t252 = t251*t14;
+ t254 = t1*t1;
+ t255 = t254*t208;
+ t257 = t207*t10;
+ t258 = t257*t4;
+ t262 = t251*t18;
+ t263 = t262*t68;
+ t265 = t262*t36;
+ t269 = RATIONAL(1.0,2.0)*t26*t218+t222*t223+t19*t115+t226*t228+t108*t230+
+2.0*t75*t247+t11*t81+t70*t252+t255*t20+t226*t258+2.0*t112*t124+t75*t263+t25*
+t265+2.0*t60*t198;
+ t271 = t24*t14;
+ t272 = t131*t10;
+ t273 = t272*t68;
+ t275 = t226*t223;
+ t278 = t165*t14;
+ t279 = t278*t68;
+ t284 = t71*t36;
+ t287 = t12*t36;
+ t288 = t177*t55;
+ t291 = t169*t208;
+ t294 = t24*t208;
+ t295 = partial_d_g_uu_223;
+ t298 = t1*t208;
+ t301 = t12*t55;
+ t307 = t254*t10;
+ t311 = t71*t71;
+ t312 = t311*t69;
+ t314 = t181*t133+t271*t273+2.0*t60*t275+t60*t279+2.0*t25*t102*t235+
+RATIONAL(1.0,2.0)*t284*t56+RATIONAL(1.0,2.0)*t287*t288+RATIONAL(1.0,2.0)*t287*
+t291+t294*t295*t14+t298*t160*t14+RATIONAL(3.0,2.0)*t301*t54*t14+2.0*t226*t167+
+2.0*t307*t68*t61+t312*t20;
+ t317 = t59*t208;
+ t318 = t1*t61;
+ t322 = t118*t68*t4;
+ t328 = t221*t208;
+ t330 = t102*t196;
+ t333 = t1*t97;
+ t337 = t272*t36;
+ t339 = t252*t68;
+ t341 = t221*t10;
+ t345 = t1*t69;
+ t357 = 2.0*t317*t318+2.0*t25*t322+2.0*t25*t19*t32+t328*t235+2.0*t108*t330
++4.0*t60*t333*t4+t181*t337+t25*t339+2.0*t341*t18*t184+t345*t278+RATIONAL(1.0,
+2.0)*t284*t218+t294*t118*t36+2.0*t60*t102*t184+2.0*t25*t173*t246;
+ t360 = t112*t97;
+ t363 = partial_d_g_uu_111;
+ t364 = t363*t68;
+ t365 = t364*t36;
+ t370 = X_udd_233;
+ t372 = t4*t4;
+ t374 = t7*t4;
+ t377 = t7*t7;
+ t379 = (t232+t139)*t30-t223*t5-t370*t8-t372*t38-2.0*t374*t42-t377*t47;
+ t380 = t181*t379;
+ t383 = partial_d_g_uu_311;
+ t384 = t383*t68;
+ t385 = t384*t36;
+ t387 = t226*t196;
+ t390 = t201*t68;
+ t397 = t206*t196;
+ t400 = t383*t69;
+ t405 = t112*t61;
+ t408 = t201*t69;
+ t410 = partial_d_g_uu_211;
+ t411 = t410*t68;
+ t412 = t411*t36;
+ t414 = 2.0*t117*t265+2.0*t271*t360+t11*t365+2.0*t108*t380+t181*t385+2.0*
+t75*t387+2.0*t390*t246*t36+2.0*t11*t26*t153+2.0*t25*t397+RATIONAL(1.0,2.0)*t271
+*t400+t345*t131*t4+2.0*t181*t405+t408*t235+t25*t412;
+ t419 = t284*t97;
+ t427 = t226*t379;
+ t430 = t117*t184;
+ t433 = t181*t97;
+ t436 = t117*t246;
+ t439 = t24*t196;
+ t443 = t287*t196;
+ t446 = partial_d_g_uu_323;
+ t447 = t446*t18;
+ t448 = t447*t4;
+ t451 = t295*t10;
+ t452 = t451*t14;
+ t454 = t117*t235;
+ t457 = 2.0*t60*t181*t223+2.0*t181*t419+t60*t385+t102*t412+2.0*t60*t271*
+t379+2.0*t271*t427+2.0*t181*t430+2.0*t53*t433+2.0*t173*t436+4.0*t60*t439*t4+2.0
+*t181*t443+2.0*t60*t448+t117*t452+2.0*t102*t454;
+ t458 = t295*t18;
+ t459 = t458*t4;
+ t462 = t287*t246;
+ t465 = t117*t196;
+ t471 = t177*t14;
+ t474 = t24*t55;
+ t478 = t446*t10;
+ t479 = t478*t14;
+ t481 = t1*t49;
+ t485 = t206*t379;
+ t489 = t160*t18*t4;
+ t493 = t112*t20;
+ t499 = 2.0*t25*t459+2.0*t102*t462+2.0*t271*t465+2.0*t11*t271*t97+RATIONAL
+(3.0,2.0)*t127*t471+RATIONAL(3.0,2.0)*t474*t212*t14+t226*t479+4.0*t25*t481*t4+
+2.0*t181*t485+2.0*t11*t489+t117*t459+2.0*t19*t493+2.0*t108*t360+t19*t365;
+ t503 = t161*t18;
+ t508 = t284*t49;
+ t511 = t451*t18;
+ t513 = t59*t59;
+ t514 = t513*t10;
+ t521 = t478*t18;
+ t528 = t112*t153;
+ t534 = t207*t4;
+ t537 = t446*t14;
+ t539 = t284*t503+2.0*t307*t153*t4+2.0*t25*t508+t287*t511+2.0*t514*t379*t4
++t226*t448+2.0*t181*t275+t206*t521+2.0*t11*t181*t61+2.0*t102*t397+2.0*t26*t528+
+RATIONAL(3.0,2.0)*t298*t113*t4+RATIONAL(3.0,2.0)*t317*t534+t317*t537;
+ t544 = t112*t32;
+ t550 = t24*t184;
+ t553 = t226*t184;
+ t556 = t254*t68;
+ t560 = t201*t18;
+ t564 = t101*t101;
+ t565 = t564*t18;
+ t574 = t112*t49;
+ t580 = 2.0*t294*t1*t32+t112*t162+2.0*t25*t544+t112*t489+2.0*t60*t419+2.0*
+t317*t550+2.0*t102*t553+2.0*t556*t379*t36+2.0*t560*t153*t14+2.0*t565*t246*t14+
+2.0*t60*t405+2.0*t341*t246*t4+2.0*t75*t574+2.0*t19*t226*t61;
+ t582 = t284*t153;
+ t587 = t131*t36;
+ t595 = t68*t97;
+ t611 = t363*t69;
+ t616 = 2.0*t19*t582+2.0*t53*t528+t317*t587+2.0*t19*t206*t97+2.0*t60*t430+
+2.0*t254*t4*t595+2.0*t307*t36*t97+2.0*t108*t465+4.0*t181*t98+2.0*t181*t479+2.0*
+t173*t574+2.0*t102*t452+RATIONAL(1.0,2.0)*t26*t611+2.0*t102*t544;
+ t625 = t564*t55;
+ t627 = partial_d_g_uu_113;
+ t628 = t627*t10;
+ t629 = t628*t36;
+ t631 = t627*t68;
+ t632 = t631*t4;
+ t637 = t201*t55;
+ t639 = t628*t68;
+ t648 = 2.0*t60*t485+2.0*t25*t454+2.0*t108*t427+2.0*t60*t443+t625*t235+t19
+*t629+2.0*t11*t632+2.0*t25*t462+t637*t20+t26*t639+2.0*t226*t337+t19*t632+t474*
+t165*t36+2.0*t11*t493;
+ t652 = t119*t68;
+ t663 = t221*t18;
+ t676 = t251*t36;
+ t680 = t102*t322+t173*t652+2.0*t75*t436+2.0*t173*t387+2.0*t181*t279+t70*
+t118*t4+t102*t120+2.0*t663*t379*t14+2.0*t112*t629+2.0*t102*t339+2.0*t11*t117*
+t32+2.0*t11*t582+t127*t676+t301*t160*t4;
+ t681 = t71*t69;
+ t682 = t363*t36;
+ t698 = t226*t97;
+ t703 = t311*t68;
+ t709 = t410*t69;
+ t715 = t18*t196;
+ t718 = RATIONAL(3.0,2.0)*t681*t682+t298*t627*t36+RATIONAL(3.0,2.0)*t294*
+t169*t4+2.0*t11*t287*t49+t181*t258+t102*t171+2.0*t474*t12*t61+2.0*t26*t698+
+RATIONAL(1.0,2.0)*t271*t209+2.0*t703*t153*t36+RATIONAL(1.0,2.0)*t53*t611+
+RATIONAL(1.0,2.0)*t173*t709+RATIONAL(1.0,2.0)*t75*t709+2.0*t221*t4*t715;
+ t731 = t295*t4;
+ t735 = t627*t4;
+ t740 = t79*t14;
+ t742 = t117*t49;
+ t745 = t513*t208;
+ t747 = t123*t68;
+ t751 = 2.0*t341*t14*t196+RATIONAL(1.0,2.0)*t173*t291+RATIONAL(3.0,2.0)*
+t70*t410*t36+RATIONAL(3.0,2.0)*t345*t383*t36+t127*t731+t474*t446*t4+t681*t735+
+t301*t79*t36+t11*t137+t681*t740+2.0*t53*t742+t745*t223+t53*t747+2.0*t102*t508;
+ t759 = t254*t69;
+ t785 = RATIONAL(1.0,2.0)*t108*t400+2.0*t474*t101*t184+2.0*t25*t553+t759*
+t223+t25*t179+4.0*t226*t443+t60*t228+4.0*t226*t419+2.0*t345*t12*t184+2.0*t560*
+t36*t49+2.0*t560*t68*t32+RATIONAL(1.0,2.0)*t75*t288+RATIONAL(1.0,2.0)*t108*t213
++2.0*t345*t71*t61+4.0*t117*t508;
+ t790 = pow(Theta_D,1.0*RATIONAL(1.0,2.0));
+ t792 = 1/t790/Theta_D;
+ t797 = -t682-t676-t587-t740-t471-t537-t735-t731-t534-t71*t20-2.0*t128-2.0
+*t318;
+ t801 = partial_d_ln_sqrt_g_1;
+ t802 = t71*t801;
+ t804 = partial_d_ln_sqrt_g_2;
+ t805 = t12*t804;
+ t807 = partial_d_ln_sqrt_g_3;
+ t808 = t1*t807;
+ t810 = t12*t801;
+ t812 = t101*t804;
+ t814 = t24*t807;
+ t816 = t1*t801;
+ t818 = t24*t804;
+ t820 = t59*t807;
+ t822 = -t101*t235-2.0*t550-t59*t223-t802*t36-t805*t36-t808*t36-t810*t14-
+t812*t14-t814*t14-t816*t4-t818*t4-t820*t4;
+ t824 = 1/t790;
+ t836 = -2.0*t112*t36-2.0*t26*t68-2.0*t19*t36-2.0*t53*t68-2.0*t11*t36-2.0*
+t102*t14-2.0*t75*t18-2.0*t25*t14-2.0*t60*t4;
+ t837 = Theta_D*Theta_D;
+ t844 = RATIONAL(3.0,2.0)*Theta_A/t790/t837+RATIONAL(1.0,2.0)*Theta_B*t792
+;
+ partial_Theta_X_wrt_partial_d_h_1 = (t126+t216+t269+t314+t357+t414+t457+
+t499+t539+t580+t616+t648+t680+t718+t751+t785)*t792+(t797+t822)*t824-t836*t844;
+ t846 = t118*t7;
+ t847 = t846*t68;
+ t849 = t131*t7;
+ t850 = t849*t68;
+ t852 = t272*t40;
+ t854 = t251*t16;
+ t856 = t79*t16;
+ t858 = t119*t40;
+ t860 = t627*t7;
+ t862 = t1*t40;
+ t866 = t384*t40;
+ t868 = t59*t7;
+ t873 = t12*t40;
+ t877 = t628*t40;
+ t879 = t166*t40;
+ t881 = t102*t847+t181*t850+t181*t852+t70*t854+t681*t856+t102*t858+t681*
+t860+2.0*t19*t862*t97+t60*t866+2.0*t868*t360+t474*t165*t40+2.0*t11*t873*t49+t19
+*t877+t60*t879;
+ t884 = t251*t40;
+ t886 = t862*t379;
+ t890 = t131*t40;
+ t894 = t71*t40;
+ t895 = t894*t97;
+ t898 = t12*t16;
+ t902 = t631*t7;
+ t905 = t226*t370;
+ t910 = t24*t7;
+ t912 = t854*t68;
+ t914 = 2.0*t226*t852+t127*t884+2.0*t60*t886+t70*t846+t317*t890+2.0*t868*
+t427+2.0*t60*t895+t898*t639+RATIONAL(1.0,2.0)*t898*t218+2.0*t11*t902+2.0*t60*
+t905+RATIONAL(1.0,2.0)*t862*t213+t910*t263+t25*t912;
+ t921 = t451*t16;
+ t926 = t161*t16;
+ t931 = t862*t196;
+ t934 = t478*t16;
+ t938 = t262*t40;
+ t940 = t873*t246;
+ t944 = t446*t16;
+ t946 = 4.0*t25*t481*t7+t294*t118*t40+2.0*t102*t921+2.0*t910*t387+2.0*t19*
+t926+t862*t521+t894*t503+2.0*t25*t931+t226*t934+2.0*t181*t934+t25*t938+2.0*t25*
+t940+t112*t926+t317*t944;
+ t947 = t226*t186;
+ t950 = t160*t7;
+ t951 = t950*t18;
+ t956 = t170*t7;
+ t960 = t112*t144;
+ t964 = t1*t7;
+ t967 = t894*t153;
+ t970 = t117*t237;
+ t973 = t112*t34;
+ t976 = t894*t49;
+ t980 = 2.0*t25*t947+t112*t951+2.0*t19*t226*t87+t102*t956+t759*t370+t625*
+t237+2.0*t19*t960+t637*t144+2.0*t964*t742+2.0*t19*t967+2.0*t25*t970+2.0*t102*
+t973+2.0*t102*t976+t312*t144;
+ t983 = t136*t16;
+ t986 = t257*t7;
+ t991 = t12*t196*t40;
+ t994 = t101*t16;
+ t999 = t112*t87;
+ t1005 = t80*t16;
+ t1009 = t24*t16;
+ t1012 = t123*t40;
+ t1015 = t11*t983+t408*t237+t181*t986+2.0*t102*t931+4.0*t226*t991+2.0*t994
+*t387+4.0*t226*t895+2.0*t181*t999+t964*t747+4.0*t117*t976+2.0*t19*t1005+t181*
+t866+2.0*t1009*t465+2.0*t112*t1012;
+ t1016 = t411*t40;
+ t1024 = t227*t16;
+ t1030 = t458*t7;
+ t1034 = t117*t186;
+ t1037 = t364*t40;
+ t1044 = t102*t1016+2.0*t226*t879+RATIONAL(1.0,2.0)*t894*t218+RATIONAL(1.0
+,2.0)*t873*t291+t60*t1024+2.0*t181*t991+2.0*t1009*t360+2.0*t25*t1030+t255*t144+
+2.0*t181*t1034+t11*t1037+2.0*t181*t895+2.0*t112*t877+t11*t1005;
+ t1057 = t447*t7;
+ t1066 = t197*t16;
+ t1076 = 2.0*t181*t905+2.0*t898*t528+t11*t1012+2.0*t994*t574+2.0*t11*t181*
+t87+t868*t230+2.0*t60*t1057+2.0*t60*t19*t87+4.0*t60*t333*t7+4.0*t181*t1066+2.0*
+t994*t436+t25*t1016+2.0*t910*t436+2.0*t102*t970;
+ t1089 = t12*t97*t16;
+ t1101 = t898*t49;
+ t1112 = 2.0*t102*t940+t226*t1057+2.0*t117*t938+2.0*t181*t886+2.0*t1009*
+t427+2.0*t910*t76+4.0*t181*t1089+2.0*t60*t1009*t379+2.0*t11*t19*t144+2.0*t25*
+t19*t34+2.0*t25*t1101+4.0*t60*t439*t7+2.0*t910*t247+2.0*t60*t181*t370;
+ t1123 = t178*t16;
+ t1130 = t114*t7;
+ t1143 = 2.0*t868*t109+2.0*t25*t994*t246+4.0*t102*t1101+t25*t1123+2.0*t102
+*t947+2.0*t964*t154+t117*t956+t112*t1130+2.0*t60*t1089+2.0*t25*t102*t237+t345*
+t849+2.0*t25*t847+t117*t1123+2.0*t60*t1066;
+ t1162 = t165*t68*t16;
+ t1172 = 2.0*t868*t380+t873*t511+RATIONAL(1.0,2.0)*t862*t209+2.0*t898*t698
++2.0*t11*t994*t49+t745*t370+2.0*t60*t850+2.0*t868*t330+t19*t902+t226*t1024+2.0*
+t181*t1162+2.0*t201*t16*t203+2.0*t102*t912+t298*t627*t40;
+ t1185 = t12*t34;
+ t1206 = t226*t986+2.0*t60*t102*t186+t112*t983+2.0*t560*t40*t49+2.0*t560*
+t68*t34+2.0*t127*t1185+2.0*t514*t379*t7+2.0*t221*t7*t715+2.0*t11*t898*t153+
+RATIONAL(1.0,2.0)*t894*t56+2.0*t11*t102*t34+t117*t1030+2.0*t964*t157+t19*t1130;
+ t1230 = t24*t186;
+ t1236 = 2.0*t60*t991+t60*t1162+2.0*t868*t465+t328*t237+2.0*t117*t858+2.0*
+t60*t999+t19*t1037+2.0*t60*t1034+t222*t370+2.0*t11*t1009*t97+2.0*t341*t16*t196+
+2.0*t341*t18*t186+2.0*t317*t1230+2.0*t556*t379*t40;
+ t1272 = 2.0*t390*t246*t40+2.0*t565*t246*t16+2.0*t703*t153*t40+RATIONAL(
+1.0,2.0)*t994*t291+RATIONAL(1.0,2.0)*t1009*t209+RATIONAL(1.0,2.0)*t964*t56+2.0*
+t70*t71*t34+2.0*t345*t71*t87+2.0*t345*t12*t186+RATIONAL(1.0,2.0)*t868*t213+
+RATIONAL(1.0,2.0)*t910*t288+t301*t79*t40+t994*t652+2.0*t964*t433;
+ t1283 = t1*t87;
+ t1313 = 2.0*t11*t117*t34+2.0*t11*t967+2.0*t964*t528+2.0*t474*t101*t186+
+2.0*t317*t1283+2.0*t254*t7*t595+2.0*t307*t40*t97+2.0*t307*t68*t87+2.0*t560*t153
+*t16+2.0*t307*t153*t7+2.0*t474*t12*t87+2.0*t341*t246*t7+RATIONAL(3.0,2.0)*t70*
+t410*t40+RATIONAL(3.0,2.0)*t345*t383*t40;
+ t1326 = t177*t16;
+ t1332 = t207*t7;
+ t1341 = t295*t7;
+ t1346 = t363*t40;
+ t1351 = 2.0*t294*t1*t34+2.0*t663*t379*t16+t298*t160*t16+RATIONAL(3.0,2.0)
+*t474*t212*t16+RATIONAL(3.0,2.0)*t127*t1326+RATIONAL(3.0,2.0)*t301*t54*t16+
+RATIONAL(3.0,2.0)*t317*t1332+RATIONAL(3.0,2.0)*t294*t169*t7+RATIONAL(3.0,2.0)*
+t298*t113*t7+t127*t1341+t474*t446*t7+t301*t950+RATIONAL(3.0,2.0)*t681*t1346+
+t345*t165*t16;
+ t1380 = t294*t295*t16+RATIONAL(1.0,2.0)*t994*t709+RATIONAL(1.0,2.0)*t1009
+*t400+RATIONAL(1.0,2.0)*t964*t611+RATIONAL(1.0,2.0)*t898*t611+RATIONAL(1.0,2.0)
+*t910*t709+RATIONAL(1.0,2.0)*t868*t400+RATIONAL(1.0,2.0)*t873*t288+t117*t921+
+2.0*t910*t574+2.0*t11*t951+2.0*t11*t960+2.0*t25*t973+2.0*t25*t976+t1009*t273;
+ t1389 = -t1346-t884-t890-t856-t1326-t944-t860-t1341-t1332-t71*t144-2.0*
+t1185-2.0*t1283;
+ t1402 = -t101*t237-2.0*t1230-t59*t370-t802*t40-t805*t40-t808*t40-t810*t16
+-t812*t16-t814*t16-t816*t7-t818*t7-t820*t7;
+ t1415 = -2.0*t112*t40-2.0*t898*t68-2.0*t19*t40-2.0*t964*t68-2.0*t11*t40
+-2.0*t102*t16-2.0*t910*t18-2.0*t25*t16-2.0*t60*t7;
+ partial_Theta_X_wrt_partial_d_h_2 = (t881+t914+t946+t980+t1015+t1044+
+t1076+t1112+t1143+t1172+t1206+t1236+t1272+t1313+t1351+t1380)*t792+(t1389+t1402)
+*t824-t1415*t844;
+ t1418 = K_uu_11*t68;
+ t1420 = K_uu_12;
+ t1423 = t1420*t18;
+ t1425 = K_uu_13;
+ t1428 = t1425*t10;
+ t1431 = K_uu_22*t18;
+ t1433 = K_uu_23;
+ t1436 = t1433*t10;
+ t1439 = K_uu_33*t10;
+ t1443 = 1/Theta_D;
+ t1446 = 1/t837;
+ partial_Theta_Y_wrt_partial_d_h_1 = (-2.0*t1418*t36-2.0*t1420*t14*t68-2.0
+*t1423*t36-2.0*t1425*t4*t68-2.0*t1428*t36-2.0*t1431*t14-2.0*t1433*t4*t18-2.0*
+t1436*t14-2.0*t1439*t4)*t1443-t836*Theta_C*t1446;
+ partial_Theta_Y_wrt_partial_d_h_2 = (-2.0*t1418*t40-2.0*t1420*t16*t68-2.0
+*t1423*t40-2.0*t1425*t7*t68-2.0*t1428*t40-2.0*t1431*t16-2.0*t1433*t7*t18-2.0*
+t1436*t16-2.0*t1439*t7)*t1443-t1415*Theta_C*t1446;
+ t1465 = t11*t24;
+ t1466 = t18*t36;
+ t1467 = t1466*t4;
+ t1470 = t112*t146;
+ t1476 = t60*t71;
+ t1477 = t68*t36;
+ t1478 = t1477*t4;
+ t1481 = t181*t71;
+ t1484 = t102*t71;
+ t1485 = t1477*t14;
+ t1490 = t117*t239;
+ t1497 = t25*t71;
+ t1500 = 2.0*t1465*t1467+2.0*t19*t1470+2.0*t294*t206*t14+2.0*t1476*t1478+
+2.0*t1481*t1478+2.0*t1484*t1485+2.0*t11*t1470+2.0*t102*t1490+2.0*t345*t284*t4+
+t408*t239+2.0*t1497*t1485;
+ t1501 = t287*t14;
+ t1504 = t102*t1;
+ t1506 = t68*t14*t4;
+ t1511 = t226*t372;
+ t1514 = t19*t1;
+ t1518 = t18*t14*t4;
+ t1524 = t181*t12;
+ t1532 = 2.0*t127*t1501+2.0*t1504*t1506+2.0*t560*t1485+2.0*t181*t1511+2.0*
+t1514*t1478+2.0*t341*t1518+2.0*t70*t284*t14+2.0*t1524*t1506+2.0*t60*t1511+t328*
+t239+2.0*t1465*t1506;
+ t1537 = t206*t4;
+ t1540 = t11*t12;
+ t1543 = t60*t12;
+ t1556 = t271*t4;
+ t1560 = 2.0*t345*t26*t4+2.0*t317*t1537+2.0*t1540*t1485+2.0*t1543*t1467+
+2.0*t307*t1478+t255*t146+t222*t372+2.0*t11*t19*t146+2.0*t25*t102*t239+2.0*t317*
+t1556+t637*t146;
+ t1567 = t25*t12;
+ t1568 = t1466*t14;
+ t1582 = t11*t101;
+ t1585 = t60*t101;
+ t1588 = 2.0*t25*t1490+t759*t372+2.0*t474*t173*t4+2.0*t1567*t1568+t625*
+t239+2.0*t1543*t1506+2.0*t474*t287*t4+t745*t372+t312*t146+2.0*t60*t181*t372+2.0
+*t1582*t1568+2.0*t1585*t1518;
+ partial_Theta_X_wrt_partial_dd_h_11 = (t1500+t1532+t1560+t1588)*t792+(-
+t71*t146-2.0*t1501-2.0*t1537-t101*t239-2.0*t1556-t59*t372)*t824;
+ t1600 = -t91-t93;
+ t1601 = t1*t1600;
+ t1606 = -t190-t192;
+ t1610 = t117*t1606;
+ t1613 = -t41-t44;
+ t1631 = t18*t40;
+ t1635 = -2.0*t317*t1601+2.0*t408*t241-2.0*t345*t12*t1606-2.0*t181*t1610
+-2.0*t25*t19*t1613+2.0*t328*t241-2.0*t19*t226*t1600-2.0*t60*t19*t1600-2.0*t11*
+t102*t1613-2.0*t345*t71*t1600+4.0*t1540*t1631*t36;
+ t1641 = t112*t1600;
+ t1646 = t112*t1613;
+ t1652 = t18*t16;
+ t1662 = t24*t1606;
+ t1668 = 2.0*t255*t148-2.0*t70*t71*t1613-2.0*t60*t1641+2.0*t625*t241-2.0*
+t25*t1646+2.0*t312*t148+4.0*t25*t101*t1652*t14-2.0*t11*t181*t1600-2.0*t341*t18*
+t1606-2.0*t317*t1662-2.0*t560*t68*t1613;
+ t1673 = t68*t40;
+ t1674 = t1673*t36;
+ t1688 = t68*t7*t4;
+ t1694 = t68*t16;
+ t1695 = t1694*t14;
+ t1704 = -2.0*t60*t1610+4.0*t11*t71*t1674+2.0*t759*t374-2.0*t294*t1*t1613+
+2.0*t637*t148+2.0*t222*t374+4.0*t60*t1*t1688-2.0*t474*t12*t1600+4.0*t1567*t1695
+-2.0*t474*t101*t1606-2.0*t11*t117*t1613;
+ t1705 = t226*t1606;
+ t1711 = t12*t1613;
+ t1739 = -2.0*t25*t1705-2.0*t307*t68*t1600-2.0*t127*t1711-2.0*t181*t1641+
+4.0*t181*t1*t1688-2.0*t102*t1705+4.0*t102*t12*t1695+4.0*t19*t71*t1674+2.0*t745*
+t374+4.0*t60*t24*t18*t7*t4-2.0*t102*t1646-2.0*t60*t102*t1606;
+ partial_Theta_X_wrt_partial_dd_h_12 = (t1635+t1668+t1704+t1739)*t792+(
+-2.0*t894*t36+2.0*t1711+2.0*t1601-2.0*t994*t14+2.0*t1662-2.0*t868*t4)*t824;
+ t1749 = t226*t377;
+ t1752 = t1673*t7;
+ t1755 = t1694*t7;
+ t1766 = t873*t16;
+ t1769 = t1673*t16;
+ t1772 = t1631*t7;
+ t1777 = 2.0*t181*t1749+2.0*t1481*t1752+2.0*t1524*t1755+2.0*t345*t898*t7+
+t408*t244+t745*t377+2.0*t345*t894*t7+2.0*t127*t1766+2.0*t560*t1769+2.0*t1543*
+t1772+2.0*t1514*t1752;
+ t1782 = t117*t244;
+ t1791 = t1652*t7;
+ t1794 = t862*t7;
+ t1803 = 2.0*t474*t994*t7+t255*t151+2.0*t102*t1782+2.0*t25*t102*t244+2.0*
+t70*t894*t16+2.0*t341*t1791+2.0*t317*t1794+t759*t377+2.0*t60*t1749+t222*t377+
+2.0*t307*t1752;
+ t1809 = t1009*t7;
+ t1819 = t112*t151;
+ t1830 = 2.0*t1540*t1769+2.0*t25*t1782+2.0*t317*t1809+2.0*t1543*t1755+t328
+*t244+2.0*t1465*t1755+2.0*t1476*t1752+2.0*t11*t1819+2.0*t60*t181*t377+2.0*t474*
+t873*t7+2.0*t1497*t1769;
+ t1834 = t1631*t16;
+ t1855 = 2.0*t11*t19*t151+2.0*t1582*t1834+2.0*t1465*t1772+2.0*t1504*t1755+
+2.0*t294*t862*t16+2.0*t1567*t1834+t637*t151+t625*t244+t312*t151+2.0*t19*t1819+
+2.0*t1484*t1769+2.0*t1585*t1791;
+ partial_Theta_X_wrt_partial_dd_h_22 = (t1777+t1803+t1830+t1855)*t792+(-
+t71*t151-2.0*t1766-2.0*t1794-t101*t244-2.0*t1809-t59*t377)*t824;
+ partial_Theta_Y_wrt_partial_dd_h_11 = RATIONAL(0.0,1.0);
+ partial_Theta_Y_wrt_partial_dd_h_12 = RATIONAL(0.0,1.0);
+ partial_Theta_Y_wrt_partial_dd_h_22 = RATIONAL(0.0,1.0);
diff --git a/src/gr/Schwarzschild_EF.cc b/src/gr/Schwarzschild_EF.cc
index b27d5a4..63bc01f 100644
--- a/src/gr/Schwarzschild_EF.cc
+++ b/src/gr/Schwarzschild_EF.cc
@@ -16,6 +16,7 @@
#include "util_Table.h"
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "config.h"
#include "stdc.h"
@@ -23,6 +24,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -41,7 +43,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
diff --git a/src/gr/cg.hh b/src/gr/cg.hh
index 50d1468..da331ac 100644
--- a/src/gr/cg.hh
+++ b/src/gr/cg.hh
@@ -106,7 +106,8 @@
p.gridfn(gfns::gfn__partial_Theta_wrt_partial_dd_h_22, irho,isigma)
#define save_Theta p.gridfn(gfns::gfn__save_Theta, irho,isigma)
-#define Delta_h p.gridfn(gfns::gfn__Delta_h, irho,isigma)
+#define old_Theta p.gridfn(gfns::gfn__old_Theta, irho,isigma)
+#define Delta_h p.gridfn(gfns::gfn__Delta_h, irho,isigma)
//******************************************************************************
diff --git a/src/gr/expansion.cc b/src/gr/expansion.cc
index 5a03783..cdbd57c 100644
--- a/src/gr/expansion.cc
+++ b/src/gr/expansion.cc
@@ -37,9 +37,11 @@
#include <stdio.h>
#include <assert.h>
#include <math.h>
+#include <string.h>
#include "util_Table.h"
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "config.h"
#include "stdc.h"
@@ -47,6 +49,10 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
+using jtutil::pow2;
+using jtutil::pow3;
+using jtutil::pow4;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -65,9 +71,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
-using jtutil::pow2;
-using jtutil::pow4;
//******************************************************************************
//******************************************************************************
@@ -99,8 +102,13 @@ bool geometry_is_finite(patch_system& ps,
const struct error_info& error_info, bool initial_flag,
bool print_msg_flag);
-bool compute_Theta(patch_system& ps, fp add_to_expansion,
- bool Jacobian_flag, jtutil::norm<fp>* Theta_norms_ptr,
+bool compute_Theta(patch_system& ps, const struct what_to_compute& comput_info,
+ bool Jacobian_flag,
+ jtutil::norm<fp>* Theta_norms_ptr,
+ jtutil::norm<fp>* expansion_Theta_norms_ptr,
+ jtutil::norm<fp>* inner_expansion_Theta_norms_ptr,
+ jtutil::norm<fp>* product_expansion_Theta_norms_ptr,
+ jtutil::norm<fp>* mean_curvature_Theta_norms_ptr,
const struct error_info& error_info, bool initial_flag,
bool print_msg_flag);
}
@@ -172,13 +180,18 @@ bool compute_Theta(patch_system& ps, fp add_to_expansion,
// succeeded or failed, and if the latter, what caused the failure.
//
enum expansion_status
- expansion(patch_system* ps_ptr, fp add_to_expansion,
+ expansion(patch_system* ps_ptr,
+ const struct what_to_compute& compute_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct error_info& error_info, bool initial_flag,
bool Jacobian_flag /* = false */,
bool print_msg_flag /* = false */,
- jtutil::norm<fp>* Theta_norms_ptr /* = NULL */)
+ jtutil::norm<fp>* Theta_norms_ptr /* = NULL */,
+ jtutil::norm<fp>* expansion_Theta_norms_ptr /* = NULL */,
+ jtutil::norm<fp>* inner_expansion_Theta_norms_ptr /* = NULL */,
+ jtutil::norm<fp>* product_expansion_Theta_norms_ptr /* = NULL */,
+ jtutil::norm<fp>* mean_curvature_Theta_norms_ptr /* = NULL */)
{
const bool active_flag = (ps_ptr != NULL);
if (print_msg_flag)
@@ -230,6 +243,8 @@ if (gi.hardwire_Schwarzschild_EF_geometry)
if (active_flag)
then {
+
+
if (gi.check_that_geometry_is_finite
&& !geometry_is_finite(*ps_ptr,
error_info, initial_flag,
@@ -237,15 +252,134 @@ if (active_flag)
then return expansion_failure__geometry_nonfinite;
// *** ERROR RETURN ***
+ // Ensure that there is a norm object
+ const bool want_norms = Theta_norms_ptr;
+ jtutil::norm<fp> norms;
+ if (compute_info.surface_selection != selection_definition)
+ then if (! Theta_norms_ptr) Theta_norms_ptr = &norms;
+
+
// compute remaining gridfns --> $\Theta$
// and optionally also the Jacobian coefficients
// by algebraic ops and angular finite differencing
- if (!compute_Theta(*ps_ptr, add_to_expansion,
+ what_to_compute this_compute_info (compute_info);
+ this_compute_info.surface_selection = selection_definition;
+ if (!compute_Theta(*ps_ptr, this_compute_info,
Jacobian_flag, Theta_norms_ptr,
+ expansion_Theta_norms_ptr,
+ inner_expansion_Theta_norms_ptr,
+ product_expansion_Theta_norms_ptr,
+ mean_curvature_Theta_norms_ptr,
error_info, initial_flag,
print_msg_flag))
then return expansion_failure__gij_not_positive_definite;
// *** ERROR RETURN ***
+
+ if (compute_info.surface_selection != selection_definition) {
+ //
+ // Apply correction to find a surface by its areal radius
+ //
+ // get mean expansion
+ fp mean_expansion;
+ fp areal_radius;
+ switch (compute_info.surface_selection) {
+ case selection_mean_coordinate_radius: {
+ const int np = ps_ptr->N_grid_points();
+ fp sum_expansion = 0;
+ fp sum_radius = 0;
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ sum_expansion += p.gridfn(gfns::gfn__Theta, irho,isigma);
+ sum_radius += p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
+ }
+ }
+ }
+ mean_expansion = sum_expansion / np;
+ areal_radius = sum_radius / np;
+ break;
+ }
+ case selection_areal_radius: {
+ // get surface area
+ const fp area = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ patch::integration_method__automatic_choice);
+ mean_expansion = Theta_norms_ptr->mean();
+ areal_radius = sqrt(area / (4.0*PI));
+ break;
+ }
+ case selection_expansion_mean_coordinate_radius: {
+ const int np = ps_ptr->N_grid_points();
+ fp sum_expansion = 0;
+ fp sum_radius = 0;
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ sum_expansion += p.gridfn(gfns::gfn__Theta, irho,isigma);
+ sum_radius += p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
+ }
+ }
+ }
+ mean_expansion = sum_expansion / np;
+ areal_radius = mean_expansion * sum_radius / np;
+ break;
+ }
+ case selection_expansion_areal_radius: {
+ // get surface area
+ const fp area = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ patch::integration_method__automatic_choice);
+ mean_expansion = Theta_norms_ptr->mean();
+ areal_radius = mean_expansion * sqrt(area / (4.0*PI));
+ break;
+ }
+ default:
+ assert (0);
+ } // switch areal_radius_definition
+
+ if (! ps_ptr->N_additional_points()) {
+ // calculate correction
+ const fp correction
+ = (- mean_expansion
+ + areal_radius - compute_info.desired_value);
+ // apply correction
+ ps_ptr->add_to_gridfn(-correction, gfns::gfn__Theta);
+ } else {
+ const int np = ps_ptr->N_grid_points();
+ const int gnp = ps_ptr->ghosted_N_grid_points();
+ // apply correction
+ const fp correction
+ = ps_ptr->ghosted_gridfn_data(gfns::gfn__h)[gnp];
+ ps_ptr->add_to_gridfn(-correction, gfns::gfn__Theta);
+ ps_ptr->gridfn_data(gfns::gfn__Theta)[np]
+ = (mean_expansion - correction
+ - areal_radius + compute_info.desired_value);
+ }
+ if (want_norms) {
+ // recalculate norms
+ ps_ptr->gridfn_norms (gfns::gfn__Theta, *Theta_norms_ptr);
+ } // if want_norms
+ } else {
+ //
+ // do not apply correction
+ //
+ if (ps_ptr->N_additional_points()) {
+ const int np = ps_ptr->N_grid_points();
+ const int gnp = ps_ptr->ghosted_N_grid_points();
+ ps_ptr->gridfn_data(gfns::gfn__Theta)[np]
+ = ps_ptr->ghosted_gridfn_data(gfns::gfn__h)[gnp];
+ }
+ } // if use-areal-radius
}
return expansion_success; // *** NORMAL RETURN ***
@@ -256,25 +390,19 @@ return expansion_success; // *** NORMAL RETURN ***
//******************************************************************************
//
-// This function sets up the xyz-position gridfns:
-// * global_[xyz] (used by interplate_geometry() )
-// * global_{xx,xy,xz,yy,yz,zz} (used by higher-level code to compute
-// quadrupole moments of horizons)
-//
-// Bugs:
-// * We initialize the global_{xx,xy,xz,yy,yz,zz} gridfns every time
-// this function is called, i.e. at each horizon-finding Newton
-// iteration, even though they're only needed at the end of the
-// horizon-finding process. In practice the extra cost is small,
-// though, so it's probably not worth fixing this...
+// This function sets up the global xyz positions of the grid points
+// in the gridfns global_[xyz]. These will be used by interplate_geometry().
//
namespace {
-void setup_xyz_posns(patch_system& ps, bool print_msg_flag)
+void setup_xyz_posns(patch_system& ps, const bool print_msg_flag)
{
if (print_msg_flag)
then CCTK_VInfo(CCTK_THORNSTRING,
" xyz positions and derivative coefficients");
+#ifdef GEOMETRY_INTERP_DEBUG2
+ printf ("AH exp\n");
+#endif
for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
{
patch& p = ps.ith_patch(pn);
@@ -285,12 +413,15 @@ if (print_msg_flag)
isigma <= p.max_isigma() ;
++isigma)
{
- const fp r = p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
+ const fp r = p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
const fp rho = p.rho_of_irho(irho);
const fp sigma = p.sigma_of_isigma(isigma);
-
fp local_x, local_y, local_z;
p.xyz_of_r_rho_sigma(r,rho,sigma, local_x,local_y,local_z);
+#ifdef GEOMETRY_INTERP_DEBUG2
+ printf (" pn=%d irho=%d isigma=%d x=%g y=%g z=%g\n",
+ pn, irho, isigma, local_x, local_y, local_z);
+#endif
const fp global_x = ps.origin_x() + local_x;
const fp global_y = ps.origin_y() + local_y;
@@ -353,12 +484,15 @@ if (print_msg_flag)
// global_[xyz] # xyz positions of grid points
//
// Inputs (Cactus 3-D gridfns):
+// ahmask # excision mask
// gxx,gxy,gxz,gyy,gyz,gzz # 3-metric $g_{ij}$
// # (may be either physical or conformal)
// kxx,kxy,kxz,kyy,kyz,kzz # extrinsic curvature $K_{ij}$
// psi # optional conformal factor $\psi$
//
// Outputs (angular gridfns, all on the nominal grid):
+// mask # excision mask
+// partial_d_mask_[123] # derivatives of the mask
// g_dd_{11,12,13,22,23,33} # $\stored{g}_{ij}$
// K_dd_{11,12,13,22,23,33} # $K_{ij}$
// partial_d_g_dd_[123]{11,12,13,22,23,33} # $\partial_k \stored{g}_{ij}$
@@ -428,6 +562,7 @@ const void* const interp_coords[N_GRID_DIMS]
const CCTK_INT input_array_variable_indices[]
= {
+ cgi.mask_varindex,
cgi.g_dd_11_varindex, cgi.g_dd_12_varindex, cgi.g_dd_13_varindex,
cgi.g_dd_22_varindex, cgi.g_dd_23_varindex,
cgi.g_dd_33_varindex,
@@ -436,19 +571,6 @@ const CCTK_INT input_array_variable_indices[]
cgi.K_dd_33_varindex,
cgi.psi_varindex,
};
-const CCTK_INT input_array_type_codes[]
- = {
- // g_ij
- CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL,
- CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL,
- CCTK_VARIABLE_REAL,
- // K_ij
- CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL,
- CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL,
- CCTK_VARIABLE_REAL,
- // psi
- CCTK_VARIABLE_REAL,
- };
const int N_input_arrays_for_psi = 1;
const int N_input_arrays_dim = sizeof(input_array_variable_indices)
/ sizeof(input_array_variable_indices[0]);
@@ -463,6 +585,8 @@ const int N_input_arrays_use
const CCTK_INT output_array_type_codes[]
= {
+ // mask $\partial_x$ mask $\partial_y$ mask $\partial_z$ mask
+ CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL,
// $g_{ij}$ $\partial_x g_{ij}$ $\partial_y g_{ij}$ $\partial_z g_{ij}$
CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL,
CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL, CCTK_VARIABLE_REAL,
@@ -480,18 +604,20 @@ const CCTK_INT output_array_type_codes[]
const CCTK_INT operand_indices[]
= {
- 0, 0, 0, 0, // g_dd_11, partial_[xyz] g_dd_11
- 1, 1, 1, 1, // g_dd_12, partial_[xyz] g_dd_12
- 2, 2, 2, 2, // g_dd_13, partial_[xyz] g_dd_13
- 3, 3, 3, 3, // g_dd_22, partial_[xyz] g_dd_22
- 4, 4, 4, 4, // g_dd_23, partial_[xyz] g_dd_23
- 5, 5, 5, 5, // g_dd_33, partial_[xyz] g_dd_33
- 6, 7, 8, 9, 10, 11, // K_dd_{11,12,13,22,23,33}
- 12, 12, 12, 12, // psi, partial_[xyz] psi
+ 0, 0, 0, 0, // mask, partial_[xyz] mask
+ 1, 1, 1, 1, // g_dd_11, partial_[xyz] g_dd_11
+ 2, 2, 2, 2, // g_dd_12, partial_[xyz] g_dd_12
+ 3, 3, 3, 3, // g_dd_13, partial_[xyz] g_dd_13
+ 4, 4, 4, 4, // g_dd_22, partial_[xyz] g_dd_22
+ 5, 5, 5, 5, // g_dd_23, partial_[xyz] g_dd_23
+ 6, 6, 6, 6, // g_dd_33, partial_[xyz] g_dd_33
+ 7, 8, 9, 10, 11, 12, // K_dd_{11,12,13,22,23,33}
+ 13, 13, 13, 13, // psi, partial_[xyz] psi
};
#define DERIV(x) x
const CCTK_INT operation_codes[]
= {
+ DERIV(0), DERIV(1), DERIV(2), DERIV(3), // mask, partial_[xyz] mask
DERIV(0), DERIV(1), DERIV(2), DERIV(3), // g_dd_11, partial_[xyz] g_dd_11
DERIV(0), DERIV(1), DERIV(2), DERIV(3), // g_dd_12, partial_[xyz] g_dd_12
DERIV(0), DERIV(1), DERIV(2), DERIV(3), // g_dd_13, partial_[xyz] g_dd_13
@@ -505,6 +631,10 @@ const CCTK_INT operation_codes[]
void* const output_arrays[]
= {
+ CAST_PTR_OR_NULL(void*, ps_ptr->gridfn_data(gfns::gfn__mask)),
+ CAST_PTR_OR_NULL(void*, ps_ptr->gridfn_data(gfns::gfn__partial_d_mask_1)),
+ CAST_PTR_OR_NULL(void*, ps_ptr->gridfn_data(gfns::gfn__partial_d_mask_2)),
+ CAST_PTR_OR_NULL(void*, ps_ptr->gridfn_data(gfns::gfn__partial_d_mask_3)),
CAST_PTR_OR_NULL(void*, ps_ptr->gridfn_data(gfns::gfn__g_dd_11)),
CAST_PTR_OR_NULL(void*, ps_ptr->gridfn_data(gfns::gfn__partial_d_g_dd_111)),
CAST_PTR_OR_NULL(void*, ps_ptr->gridfn_data(gfns::gfn__partial_d_g_dd_211)),
@@ -625,6 +755,21 @@ if (print_msg_flag)
" calling geometry interpolator (%s%d points)",
(active_flag ? "" : "dummy: "), N_interp_points);
+#ifdef GEOMETRY_INTERP_DEBUG2
+ {
+ printf("AHFinderDirect:: proc %d: CCTK_InterpGridArrays() coordinates are:\n",
+ int(CCTK_MyProc(cgi.GH)));
+ for (int pt = 0 ; pt < N_interp_points ; ++ pt)
+ {
+ printf(" pt=%d [x,y,z]=[%g,%g,%g]\n",
+ pt,
+ double(((const CCTK_REAL*)interp_coords[0])[pt]),
+ double(((const CCTK_REAL*)interp_coords[1])[pt]),
+ double(((const CCTK_REAL*)interp_coords[2])[pt]));
+ }
+ }
+#endif /* GEOMETRY_INTERP_DEBUG2 */
+
#ifdef GEOMETRY_INTERP_DEBUG
printf("AHFinderDirect:: proc %d: initializing interpolator outputs to 999.999\n",
int(CCTK_MyProc(cgi.GH)));
@@ -676,8 +821,11 @@ fflush(stdout);
{
for (int pt = 0 ; pt < N_interp_points ; pt = 2*pt + (pt == 0))
{
- printf("AHFinderDirect:: proc %d: CCTK_InterpGridArrays() results for pt=%d:\n",
- int(CCTK_MyProc(cgi.GH)), pt);
+ printf("AHFinderDirect:: proc %d: CCTK_InterpGridArrays() results for pt=%d at [x,y,z]=[%g,%g,%g]:\n",
+ int(CCTK_MyProc(cgi.GH)), pt,
+ double(((const CCTK_REAL*)interp_coords[0])[pt]),
+ double(((const CCTK_REAL*)interp_coords[1])[pt]),
+ double(((const CCTK_REAL*)interp_coords[2])[pt]));
for (int out = 0 ; out < N_output_arrays_use ; ++out)
{
const CCTK_REAL* const out_ptr
@@ -743,8 +891,8 @@ if (status == CCTK_ERROR_INTERP_POINT_OUTSIDE)
CCTK_VWarn(warn_level, __LINE__, __FILE__, CCTK_THORNSTRING,
"interpolate_geometry():\n"
-" one or more points on the trial horizon surface point"
-" is/are outside the grid (or too close to the grid boundary)"
+" one or more points on the trial horizon surface point\n"
+" is/are outside the grid (or too close to the grid boundary)\n"
" (in a single-processor run, this may also mean that\n"
" driver::ghost_size is too small for this geometry interpolator)\n");
}
@@ -763,6 +911,51 @@ else if (status < 0)
"***** interpolate_geometry(): error return %d from interpolator!\n",
status); /*NOTREACHED*/
+//
+// ***** check the interpolated excision mask *****
+//
+{
+bool did_use_excised_gridpoint = false;
+if (active_flag)
+ then {
+ for (int pn = 0 ; pn < ps_ptr->N_patches() ; ++pn)
+ {
+ patch& p = ps_ptr->ith_patch(pn);
+
+ for (int irho = p.min_irho() ; irho <= p.max_irho() ; ++irho)
+ for (int isigma = p.min_isigma() ; isigma <= p.max_isigma() ; ++isigma)
+ {
+ const fp m = p.gridfn(gfns::gfn__mask, irho,isigma);
+ const fp m1 = p.gridfn(gfns::gfn__partial_d_mask_1, irho,isigma);
+ const fp m2 = p.gridfn(gfns::gfn__partial_d_mask_2, irho,isigma);
+ const fp m3 = p.gridfn(gfns::gfn__partial_d_mask_3, irho,isigma);
+ if (fabs(m) > 1.0e-12
+ || fabs(m1) > 1.0e-12 || fabs(m2) > 1.0e-12 || fabs(m3) > 1.0e-12)
+ then did_use_excised_gridpoint = true;
+ }
+ }
+ }
+if (did_use_excised_gridpoint)
+ then {
+ if (print_msg_flag)
+ then {
+ // see if we can get further info
+ const int warn_level
+ = initial_flag
+ ? error_info.warn_level__point_outside__initial
+ : error_info.warn_level__point_outside__subsequent;
+
+
+ CCTK_VWarn(warn_level, __LINE__, __FILE__, CCTK_THORNSTRING,
+"interpolate_geometry():\n"
+" one or more points on the trial horizon surface point\n"
+" is/are in an excised region (or too close to the excision boundary)\n");
+ }
+
+ return expansion_failure__surface_in_excised_region; // *** ERROR RETURN ***
+ }
+}
+
return expansion_success; // *** NORMAL RETURN ***
}
}
@@ -1166,14 +1359,59 @@ return true; // *** no check possible ***
// g_ij isn't positive definite).
//
namespace {
-bool compute_Theta(patch_system& ps, fp add_to_expansion,
- bool Jacobian_flag, jtutil::norm<fp>* Theta_norms_ptr,
+bool compute_Theta(patch_system& ps, const struct what_to_compute& compute_info,
+ bool Jacobian_flag,
+ jtutil::norm<fp>* Theta_norms_ptr,
+ jtutil::norm<fp>* expansion_Theta_norms_ptr,
+ jtutil::norm<fp>* inner_expansion_Theta_norms_ptr,
+ jtutil::norm<fp>* product_expansion_Theta_norms_ptr,
+ jtutil::norm<fp>* mean_curvature_Theta_norms_ptr,
const struct error_info& error_info, bool initial_flag,
bool print_msg_flag)
{
if (print_msg_flag)
then CCTK_VInfo(CCTK_THORNSTRING, " computing Theta(h)");
+#if 0
+ fp mean_radius, areal_radius;
+ switch (compute_info.surface_modification) {
+ case modification_none:
+ case modification_radius:
+ case modification_radius2:
+ // do nothing
+ break;
+ case modification_mean_radius: {
+ // get average coordinate radius
+ const int np = ps.N_grid_points();
+ fp sum_radius = 0;
+ for (int pn = 0; pn < ps.N_patches(); ++pn) {
+ patch& p = ps.ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ sum_radius += p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
+ }
+ }
+ }
+ mean_radius = sum_radius / np;
+ break;
+ }
+ case modification_areal_radius: {
+ // get surface area
+ const fp area = ps.integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ patch::integration_method__automatic_choice);
+ areal_radius = sqrt(area / (4.0*PI));
+ break;
+ }
+ default:
+ assert (0);
+ }
+#endif
+
for (int pn = 0 ; pn < ps.N_patches() ; ++pn)
{
patch& p = ps.ith_patch(pn);
@@ -1284,24 +1522,169 @@ CCTK_VWarn(warn_level, __LINE__, __FILE__, CCTK_THORNSTRING,
return false; // *** ERROR RETURN ***
}
+ assert (compute_info.surface_selection == selection_definition);
+
// compute H via equation (14) of my 1996 horizon finding paper
const fp sqrt_Theta_D = sqrt(Theta_D);
- Theta = + Theta_A/(Theta_D*sqrt_Theta_D)
- + Theta_B/sqrt_Theta_D
- + Theta_C/Theta_D
- - K
- + add_to_expansion;
+ const fp Theta_X = + Theta_A/(Theta_D*sqrt_Theta_D)
+ + Theta_B/sqrt_Theta_D;
+ const fp Theta_Y = + Theta_C/Theta_D
+ - K;
+
+#define mean_curvature p.gridfn(gfns::gfn__mean_curvature, irho,isigma)
+ mean_curvature = Theta_X;
+#undef mean_curvature
+
+ switch (compute_info.surface_definition) {
+ case definition_expansion:
+ Theta = + Theta_X + Theta_Y;
+ break;
+ case definition_inner_expansion:
+ Theta = - Theta_X + Theta_Y;
+ break;
+ case definition_mean_curvature:
+ Theta = + Theta_X;
+ break;
+ case definition_expansion_product:
+ Theta = (+ Theta_X + Theta_Y) * (- Theta_X + Theta_Y);
+ break;
+ default:
+ assert (0);
+ }
+
+ switch (compute_info.surface_modification) {
+ case modification_none:
+ // do nothing
+ break;
+ case modification_radius:
+ // multiply by radius
+ Theta *= r;
+ break;
+ case modification_radius2:
+ // multiply by radius^2
+ Theta *= pow2(r);
+ break;
+#if 0
+ case modification_mean_radius:
+ // multiply by average coordinate radius
+ Theta *= mean_radius;
+ break;
+ case modification_areal_radius:
+ // multiply by areal radius
+ Theta *= areal_radius;
+ break;
+#endif
+ default:
+ assert (0);
+ }
+
+ Theta -= compute_info.desired_value;
+
// update running norms of Theta(h) function
if (Theta_norms_ptr != NULL)
then Theta_norms_ptr->data(Theta);
+ if (expansion_Theta_norms_ptr != NULL)
+ then expansion_Theta_norms_ptr->data(+ Theta_X + Theta_Y);
+
+ if (inner_expansion_Theta_norms_ptr != NULL)
+ then inner_expansion_Theta_norms_ptr->data(- Theta_X + Theta_Y);
+
+ if (product_expansion_Theta_norms_ptr != NULL)
+ then product_expansion_Theta_norms_ptr->data((+ Theta_X + Theta_Y) * (- Theta_X + Theta_Y));
+
+ if (mean_curvature_Theta_norms_ptr != NULL)
+ then mean_curvature_Theta_norms_ptr->data(+ Theta_X);
+
+ fp partial_Theta_X_wrt_partial_d_h_1;
+ fp partial_Theta_X_wrt_partial_d_h_2;
+ fp partial_Theta_X_wrt_partial_dd_h_11;
+ fp partial_Theta_X_wrt_partial_dd_h_12;
+ fp partial_Theta_X_wrt_partial_dd_h_22;
+ fp partial_Theta_Y_wrt_partial_d_h_1;
+ fp partial_Theta_Y_wrt_partial_d_h_2;
+ fp partial_Theta_Y_wrt_partial_dd_h_11;
+ fp partial_Theta_Y_wrt_partial_dd_h_12;
+ fp partial_Theta_Y_wrt_partial_dd_h_22;
+
if (Jacobian_flag)
then {
// partial_Theta_wrt_partial_d_h,
// partial_Theta_wrt_partial_dd_h
#include "../gr.cg/expansion_Jacobian.c"
}
+
+ if (Jacobian_flag) {
+ switch (compute_info.surface_definition) {
+
+ case definition_expansion:
+ partial_Theta_wrt_partial_d_h_1
+ = (+ partial_Theta_X_wrt_partial_d_h_1
+ + partial_Theta_Y_wrt_partial_d_h_1);
+ partial_Theta_wrt_partial_d_h_2
+ = (+ partial_Theta_X_wrt_partial_d_h_2
+ + partial_Theta_Y_wrt_partial_d_h_2);
+ partial_Theta_wrt_partial_dd_h_11
+ = (+ partial_Theta_X_wrt_partial_dd_h_11
+ + partial_Theta_Y_wrt_partial_dd_h_11);
+ partial_Theta_wrt_partial_dd_h_12
+ = (+ partial_Theta_X_wrt_partial_dd_h_12
+ + partial_Theta_Y_wrt_partial_dd_h_12);
+ partial_Theta_wrt_partial_dd_h_22
+ = (+ partial_Theta_X_wrt_partial_dd_h_22
+ + partial_Theta_Y_wrt_partial_dd_h_22);
+ break;
+
+ case definition_inner_expansion:
+ partial_Theta_wrt_partial_d_h_1
+ = (- partial_Theta_X_wrt_partial_d_h_1
+ + partial_Theta_Y_wrt_partial_d_h_1);
+ partial_Theta_wrt_partial_d_h_2
+ = (- partial_Theta_X_wrt_partial_d_h_2
+ + partial_Theta_Y_wrt_partial_d_h_2);
+ partial_Theta_wrt_partial_dd_h_11
+ = (- partial_Theta_X_wrt_partial_dd_h_11
+ + partial_Theta_Y_wrt_partial_dd_h_11);
+ partial_Theta_wrt_partial_dd_h_12
+ = (- partial_Theta_X_wrt_partial_dd_h_12
+ + partial_Theta_Y_wrt_partial_dd_h_12);
+ partial_Theta_wrt_partial_dd_h_22
+ = (- partial_Theta_X_wrt_partial_dd_h_22
+ + partial_Theta_Y_wrt_partial_dd_h_22);
+ break;
+
+ case definition_mean_curvature:
+ partial_Theta_wrt_partial_d_h_1
+ = + partial_Theta_X_wrt_partial_d_h_1;
+ partial_Theta_wrt_partial_d_h_2
+ = + partial_Theta_X_wrt_partial_d_h_2;
+ partial_Theta_wrt_partial_dd_h_11
+ = + partial_Theta_X_wrt_partial_dd_h_11;
+ partial_Theta_wrt_partial_dd_h_12
+ = + partial_Theta_X_wrt_partial_dd_h_12;
+ partial_Theta_wrt_partial_dd_h_22
+ = + partial_Theta_X_wrt_partial_dd_h_22;
+ break;
+
+ case definition_expansion_product: {
+#define f(x,y,dx,dy) (- x*x + y*y)
+#define df(x,y,dx,dy) (- 2*x*dx + 2*y*dy)
+ partial_Theta_wrt_partial_d_h_1 = df(Theta_X, Theta_Y, partial_Theta_X_wrt_partial_d_h_1 , partial_Theta_Y_wrt_partial_d_h_1 );
+ partial_Theta_wrt_partial_d_h_2 = df(Theta_X, Theta_Y, partial_Theta_X_wrt_partial_d_h_2 , partial_Theta_Y_wrt_partial_d_h_2 );
+ partial_Theta_wrt_partial_dd_h_11 = df(Theta_X, Theta_Y, partial_Theta_X_wrt_partial_dd_h_11, partial_Theta_Y_wrt_partial_dd_h_11);
+ partial_Theta_wrt_partial_dd_h_12 = df(Theta_X, Theta_Y, partial_Theta_X_wrt_partial_dd_h_12, partial_Theta_Y_wrt_partial_dd_h_12);
+ partial_Theta_wrt_partial_dd_h_22 = df(Theta_X, Theta_Y, partial_Theta_X_wrt_partial_dd_h_22, partial_Theta_Y_wrt_partial_dd_h_22);
+#undef f
+#undef df
+ break;
+ }
+
+ default:
+ assert (0);
+ }
+ }
+
}
}
}
diff --git a/src/gr/expansion_Jacobian.cc b/src/gr/expansion_Jacobian.cc
index 372d114..04e00b5 100644
--- a/src/gr/expansion_Jacobian.cc
+++ b/src/gr/expansion_Jacobian.cc
@@ -17,6 +17,7 @@
#include "util_Table.h"
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "config.h"
#include "stdc.h"
@@ -24,6 +25,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "../patch/coords.hh"
#include "../patch/grid.hh"
@@ -42,7 +44,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
@@ -53,7 +54,8 @@ using jtutil::error_exit;
namespace {
enum expansion_status
expansion_Jacobian_NP
- (patch_system& ps, Jacobian& Jac, fp add_to_expansion,
+ (patch_system& ps, Jacobian& Jac,
+ const struct what_to_compute& comput_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct Jacobian_info& Jacobian_info,
@@ -73,7 +75,8 @@ void add_ghost_zone_Jacobian(const patch_system& ps,
int xm_irho, int xm_isigma);
enum expansion_status
expansion_Jacobian_dr_FD
- (patch_system* ps_ptr, Jacobian* Jac_ptr, fp add_to_expansion,
+ (patch_system* ps_ptr, Jacobian* Jac_ptr,
+ const struct what_to_compute& compute_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct Jacobian_info& Jacobian_info,
@@ -109,7 +112,7 @@ enum expansion_status
//
enum expansion_status
expansion_Jacobian(patch_system* ps_ptr, Jacobian* Jac_ptr,
- fp add_to_expansion,
+ const struct what_to_compute& compute_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct Jacobian_info& Jacobian_info,
@@ -125,7 +128,7 @@ case Jacobian__numerical_perturbation:
if (active_flag)
then {
status = expansion_Jacobian_NP(*ps_ptr, *Jac_ptr,
- add_to_expansion,
+ compute_info,
cgi, gi, Jacobian_info,
error_info, initial_flag,
print_msg_flag);
@@ -153,7 +156,8 @@ case Jacobian__symbolic_diff_with_FD_dr:
// this function looks at ps_ptr and Jac_ptr (non-NULL vs NULL)
// to choose a normal vs dummy computation
{
- status = expansion_Jacobian_dr_FD(ps_ptr, Jac_ptr, add_to_expansion,
+ status = expansion_Jacobian_dr_FD(ps_ptr, Jac_ptr,
+ compute_info,
cgi, gi, Jacobian_info,
error_info, initial_flag,
print_msg_flag);
@@ -171,6 +175,327 @@ default:
int(Jacobian_info.Jacobian_compute_method)); /*NOTREACHED*/
}
+ if (active_flag) {
+
+ switch (compute_info.surface_modification) {
+
+ case modification_none:
+ // do nothing
+ break;
+
+ case modification_radius: {
+ // multiply with the coordinate radius
+ // H_{(r)i} = H_i h_i
+ // J_{(r)ij} = J_{ij} h_i + H_i \delta_{ij}
+ const int np = ps_ptr->N_grid_points();
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ const int i = ps_ptr->gpn_of_patch_irho_isigma(p, irho,isigma);
+ const fp radius = p.ghosted_gridfn(gfns::gfn__h, irho, isigma);
+ for (int j=0; j<np; ++j) {
+ if (Jac_ptr->is_explicitly_stored (i, j)) {
+ const fp val = Jac_ptr->element (i, j);
+ Jac_ptr->set_element (i, j, val * radius);
+ }
+ }
+ const fp Theta = (p.gridfn(gfns::gfn__Theta, irho, isigma)
+ + compute_info.desired_value) / radius;
+ Jac_ptr->sum_into_element (i, i, Theta);
+ }
+ }
+ }
+ break;
+ }
+
+ case modification_radius2: {
+ // multiply with the square of the coordinate radius
+ // H_{(r2)i} = H_i h_i^2
+ // J_{(r2)ij} = J_{ij} h_i^2 + 2 H_i h_i \delta_{ij}
+ const int np = ps_ptr->N_grid_points();
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ const int i = ps_ptr->gpn_of_patch_irho_isigma(p, irho,isigma);
+ const fp radius = p.ghosted_gridfn(gfns::gfn__h, irho, isigma);
+ const fp radius2 = radius * radius;
+ for (int j=0; j<np; ++j) {
+ if (Jac_ptr->is_explicitly_stored (i, j)) {
+ const fp val = Jac_ptr->element (i, j);
+ Jac_ptr->set_element (i, j, val * radius2);
+ }
+ }
+ const fp Theta = (p.gridfn(gfns::gfn__Theta, irho, isigma)
+ + compute_info.desired_value) / radius2;
+ Jac_ptr->sum_into_element (i, i, 2 * Theta * radius);
+ }
+ }
+ }
+ break;
+ }
+
+#if 0
+ case modification_mean_radius: {
+ // multiply with the average coordinate radius
+ // H_{(\bar r)i} = H_i \bar r
+ // J_{(\bar r)ij} = J_{ij} \bar r + H_i / N
+ // calculate average coordinate radius
+ const int np = ps_ptr->N_grid_points();
+ fp sum_radius = 0;
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ sum_radius += p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
+ }
+ }
+ }
+ mean_radius = sum_radius / np;
+ // correct Jacobian
+ const int np = ps_ptr->N_grid_points();
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ const int i = ps_ptr->gpn_of_patch_irho_isigma(p, irho,isigma);
+ for (int j=0; j<np; ++j) {
+ if (Jac_ptr->is_explicitly_stored (i, j)) {
+ const fp val = Jac_ptr->element (i, j);
+ Jac_ptr->set_element (i, j, val * mean_radius);
+ }
+ }
+#error "unfinished"
+ const fp Theta = (p.gridfn(gfns::gfn__Theta, irho, isigma)
+ + compute_info.desired_value) / areal_radius;
+ const fp dRdh = 0.5 * areal_radius;
+ Jac_ptr->sum_into_element (i, i, Theta * dRdh);
+ }
+ }
+ }
+ break;
+ }
+
+ case modification_areal_radius: {
+ // multiply with the areal radius
+ // H_{(R)i} = H_i R
+ // J_{(R)ij} = J_{ij} R + H_i dR/dh_j
+ // get surface area
+ const fp area = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ patch::integration_method__automatic_choice);
+ const fp areal_radius = sqrt(area / (4.0*PI));
+ // correct Jacobian
+ const int np = ps_ptr->N_grid_points();
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ const int i = ps_ptr->gpn_of_patch_irho_isigma(p, irho,isigma);
+ for (int j=0; j<np; ++j) {
+ if (Jac_ptr->is_explicitly_stored (i, j)) {
+ const fp val = Jac_ptr->element (i, j);
+ Jac_ptr->set_element (i, j, val * areal_radius);
+ }
+ }
+ const fp Theta = (p.gridfn(gfns::gfn__Theta, irho, isigma)
+ + compute_info.desired_value) / areal_radius;
+ const fp dRdh = 0.5 * areal_radius;
+ Jac_ptr->sum_into_element (i, i, Theta * dRdh);
+ }
+ }
+ }
+ break;
+ }
+#endif
+
+ default:
+ assert (0);
+ } // switch surface_modification
+
+ if (ps_ptr->N_additional_points()) {
+ switch (compute_info.surface_selection) {
+
+ case selection_definition: {
+ // we want nothing special
+ const int np = ps_ptr->N_grid_points();
+ for (int i=0; i<np; ++i) {
+ Jac_ptr->set_element (i, np, 0.0);
+ }
+ for (int j=0; j<np; ++j) {
+ Jac_ptr->set_element (np, j, 0.0);
+ }
+ Jac_ptr->set_element (np, np, 1.0);
+ break;
+ }
+
+ case selection_mean_coordinate_radius: {
+ // Jac_ptr->set_element (II, JJ, x) == dTheta(II)/dh(JJ)
+ // \frac{\partial R}{\partial h_j} = 1 / N
+ const int np = ps_ptr->N_grid_points();
+ for (int i=0; i<np; ++i) {
+ Jac_ptr->set_element (i, np, -1.0);
+ }
+ for (int j=0; j<np; ++j) {
+ fp val = 0;
+ for (int k=0; k<np; ++k) {
+ val += Jac_ptr->element (k, j) / np;
+ }
+ val -= 1.0 / np;
+ Jac_ptr->set_element (np, j, val);
+ }
+ Jac_ptr->set_element (np, np, -1.0);
+ break;
+ }
+
+ case selection_areal_radius: {
+ // \frac{\partial R_a}{\partial h_j}
+ // = \sqrt{1 / 16 \pi A} \sum_k \sqrt{q_k} dS_k
+ // The "trapezoid" method is faster
+// const enum patch::integration_method method
+// = patch::integration_method__automatic_choice;
+ const enum patch::integration_method method
+ = patch::integration_method__trapezoid;
+ const fp area = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ method);
+ const int np = ps_ptr->N_grid_points();
+ for (int i=0; i<np; ++i) {
+ Jac_ptr->set_element (i, np, -1.0);
+ }
+ for (int j=0; j<np; ++j) {
+ fp val = 0;
+ for (int k=0; k<np; ++k) {
+ val += Jac_ptr->element (k, j) / np;
+ }
+ Jac_ptr->set_element (np, j, val);
+ }
+ for (int jpn = 0; jpn < ps_ptr->N_patches(); ++jpn) {
+ patch& jp = ps_ptr->ith_patch(jpn);
+ for (int jrho = jp.min_irho(); jrho <= jp.max_irho(); ++jrho) {
+ for (int jsigma = jp.min_isigma(); jsigma <= jp.max_isigma(); ++jsigma) {
+ const int j = ps_ptr->gpn_of_patch_irho_isigma(jp, jrho,jsigma);
+ // const fp radius = jp.ghosted_gridfn(gfns::gfn__h, jrho, jsigma);
+ const fp epsilon = Jacobian_info.perturbation_amplitude;
+ fp val1, val2;
+#if 0
+ // Re-calculate all points
+ // (this is slow, but it works)
+ val1 = area;
+ jp.ghosted_gridfn(gfns::gfn__h, jrho, jsigma) += epsilon;
+ val2 = ps_ptr->integrate_gridfn
+ (gfns::gfn__one, true, true, true,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ method);
+ jp.ghosted_gridfn(gfns::gfn__h, jrho, jsigma) -= epsilon;
+#else
+ // Re-calculate all points with non-zero Jacobian entries
+ jp.ghosted_gridfn(gfns::gfn__h, jrho, jsigma) -= epsilon/2;
+ val1 = 0;
+ for (int ipn = 0; ipn < ps_ptr->N_patches(); ++ipn) {
+ patch& ip = ps_ptr->ith_patch(ipn);
+ for (int irho = ip.min_irho(); irho <= ip.max_irho(); ++irho) {
+ for (int isigma = ip.min_isigma(); isigma <= ip.max_isigma(); ++isigma) {
+ const int i = ps_ptr->gpn_of_patch_irho_isigma(ip, irho,isigma);
+ if (Jac_ptr->is_explicitly_stored (i, j)) {
+ val1 += ps_ptr->integrate_gridpoint
+ (gfns::gfn__one,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ method,
+ ipn, irho, isigma);
+ }
+ }
+ }
+ }
+ jp.ghosted_gridfn(gfns::gfn__h, jrho, jsigma) += epsilon;
+ val2 = 0;
+ for (int ipn = 0; ipn < ps_ptr->N_patches(); ++ipn) {
+ patch& ip = ps_ptr->ith_patch(ipn);
+ for (int irho = ip.min_irho(); irho <= ip.max_irho(); ++irho) {
+ for (int isigma = ip.min_isigma(); isigma <= ip.max_isigma(); ++isigma) {
+ const int i = ps_ptr->gpn_of_patch_irho_isigma(ip, irho,isigma);
+ if (Jac_ptr->is_explicitly_stored (i, j)) {
+ val2 += ps_ptr->integrate_gridpoint
+ (gfns::gfn__one,
+ gfns::gfn__h,
+ gfns::gfn__g_dd_11, gfns::gfn__g_dd_12, gfns::gfn__g_dd_13,
+ gfns::gfn__g_dd_22, gfns::gfn__g_dd_23,
+ gfns::gfn__g_dd_33,
+ method,
+ ipn, irho, isigma);
+ }
+ }
+ }
+ }
+ jp.ghosted_gridfn(gfns::gfn__h, jrho, jsigma) -= epsilon/2;
+#endif
+ const fp val = 1 / sqrt(16*PI*area) * ps_ptr->integrate_correction(true, true, true) * (val2 - val1) / epsilon;
+ Jac_ptr->sum_into_element (np, j, -val);
+ }
+ }
+ }
+ Jac_ptr->set_element (np, np, -1.0);
+ break;
+ }
+
+ case selection_expansion_mean_coordinate_radius: {
+ // Jac_ptr->set_element (II, JJ, x) == dTheta(II)/dh(JJ)
+ const int np = ps_ptr->N_grid_points();
+ fp sum_expansion = 0;
+ fp sum_radius = 0;
+ for (int pn = 0; pn < ps_ptr->N_patches(); ++pn) {
+ patch& p = ps_ptr->ith_patch(pn);
+ for (int irho = p.min_irho(); irho <= p.max_irho(); ++irho) {
+ for (int isigma = p.min_isigma(); isigma <= p.max_isigma(); ++isigma) {
+ sum_expansion += p.gridfn(gfns::gfn__Theta, irho,isigma);
+ sum_radius += p.ghosted_gridfn(gfns::gfn__h, irho,isigma);
+ }
+ }
+ }
+ for (int i=0; i<np; ++i) {
+ Jac_ptr->set_element (i, np, -1.0);
+ }
+ for (int j=0; j<np; ++j) {
+ fp val = 0;
+ for (int k=0; k<np; ++k) {
+ val += (Jac_ptr->element (k, j) / np) * (1.0 - sum_radius / np);
+ }
+ val -= (sum_expansion / np) / np;
+ Jac_ptr->set_element (np, j, val);
+ }
+ Jac_ptr->set_element (np, np, -1.0);
+ break;
+ }
+
+ case selection_expansion_areal_radius: {
+ CCTK_WARN (0, "selection_expansion_areal_radius not implemented");
+ break;
+ }
+
+ default:
+ assert (0);
+ } // switch surface_selection
+ } else {
+ assert (compute_info.surface_selection == selection_definition);
+ }
+
+ } // if active
+
return expansion_success; // *** NORMAL RETURN ***
}
@@ -214,7 +539,8 @@ return expansion_success; // *** NORMAL RETURN ***
namespace {
enum expansion_status
expansion_Jacobian_NP
- (patch_system& ps, Jacobian& Jac, fp add_to_expansion,
+ (patch_system& ps, Jacobian& Jac,
+ const struct what_to_compute& compute_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct Jacobian_info& Jacobian_info,
@@ -227,6 +553,7 @@ if (print_msg_flag)
const fp epsilon = Jacobian_info.perturbation_amplitude;
ps.gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
+ps.gridfn_copy(gfns::gfn__mean_curvature, gfns::gfn__save_mean_curvature);
for (int ypn = 0 ; ypn < ps.N_patches() ; ++ypn)
{
@@ -247,7 +574,8 @@ ps.gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
const fp save_h_y = yp.ghosted_gridfn(gfns::gfn__h, y_irho,y_isigma);
yp.ghosted_gridfn(gfns::gfn__h, y_irho,y_isigma) += epsilon;
const
- enum expansion_status status = expansion(&ps, add_to_expansion,
+ enum expansion_status status = expansion(&ps,
+ compute_info,
cgi, gi,
error_info, initial_flag);
if (status != expansion_success)
@@ -275,12 +603,19 @@ ps.gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
}
}
+ if (ps.N_additional_points())
+ {
+ const int np = ps.N_grid_points();
+ Jac.set_element(np,JJ, 0.0); // insert dummy value
+ }
+
yp.ghosted_gridfn(gfns::gfn__h, y_irho,y_isigma) = save_h_y;
}
}
}
ps.gridfn_copy(gfns::gfn__save_Theta, gfns::gfn__Theta);
+ps.gridfn_copy(gfns::gfn__save_mean_curvature, gfns::gfn__mean_curvature);
return expansion_success; // *** NORMAL RETURN ***
}
}
@@ -440,6 +775,12 @@ ps.compute_synchronize_Jacobian();
}
}
+ if (ps.N_additional_points())
+ {
+ const int np = ps.N_grid_points();
+ Jac.set_element(II,np, 0.0); // insert dummy value
+ }
+
}
}
}
@@ -519,11 +860,12 @@ patch& yp = ye.my_patch();
// It's illegal for one but not both of ps_ptr and Jac_ptr to be NULL.
//
// The basic algorithm is that
-// Jac += diag[ (Theta(h+epsilon) - Theta(h)) / epsilon ]
+// Jac += diag[ (Theta(h+epsilon/2) - Theta(h-epsilon/2)) / epsilon ]
//
// Inputs (angular gridfns, on ghosted grid):
// h # shape of trial surface
// Theta # Theta(h) assumed to already be computed
+// # (saved and restored, but not used)
//
// Outputs:
// Jac += d/dr terms
@@ -535,7 +877,8 @@ patch& yp = ye.my_patch();
namespace {
enum expansion_status
expansion_Jacobian_dr_FD
- (patch_system* ps_ptr, Jacobian* Jac_ptr, fp add_to_expansion,
+ (patch_system* ps_ptr, Jacobian* Jac_ptr,
+ const struct what_to_compute& compute_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct Jacobian_info& Jacobian_info,
@@ -550,18 +893,52 @@ if (print_msg_flag)
const fp epsilon = Jacobian_info.perturbation_amplitude;
-// compute Theta(h+epsilon)
+what_to_compute this_compute_info (compute_info);
+this_compute_info.surface_modification = modification_none;
+this_compute_info.surface_selection = selection_definition;
+this_compute_info.desired_value = 0.0;
+
+fp additional_save_Theta;
+
+// compute Theta(h-epsilon/2)
if (active_flag)
then {
ps_ptr->gridfn_copy(gfns::gfn__Theta, gfns::gfn__save_Theta);
- ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
+ ps_ptr->gridfn_copy(gfns::gfn__mean_curvature, gfns::gfn__save_mean_curvature);
+ if (ps_ptr->N_additional_points())
+ then {
+ const int np = ps_ptr->N_grid_points();
+ additional_save_Theta = ps_ptr->gridfn_data(gfns::gfn__Theta)[np];
+ }
+ ps_ptr->add_to_ghosted_gridfn(-epsilon/2, gfns::gfn__h);
}
const
- enum expansion_status status = expansion(ps_ptr, add_to_expansion,
+ enum expansion_status status = expansion(ps_ptr,
+ this_compute_info,
cgi, gi,
error_info, initial_flag);
if (status != expansion_success)
- then return status; // *** ERROR RETURN ***
+ then {
+ expansion(NULL,
+ this_compute_info,
+ cgi, gi,
+ error_info, false);
+ return status; // *** ERROR RETURN ***
+ }
+
+// compute Theta(h+epsilon/2)
+if (active_flag)
+ then {
+ ps_ptr->gridfn_copy(gfns::gfn__Theta, gfns::gfn__old_Theta);
+ ps_ptr->add_to_ghosted_gridfn(epsilon, gfns::gfn__h);
+ }
+const
+ enum expansion_status status2 = expansion(ps_ptr,
+ this_compute_info,
+ cgi, gi,
+ error_info, initial_flag);
+if (status2 != expansion_success)
+ then return status2; // *** ERROR RETURN ***
if (active_flag)
then {
@@ -575,7 +952,7 @@ if (active_flag)
++isigma)
{
const int II = ps_ptr->gpn_of_patch_irho_isigma(p, irho,isigma);
- const fp old_Theta = p.gridfn(gfns::gfn__save_Theta,
+ const fp old_Theta = p.gridfn(gfns::gfn__old_Theta,
irho,isigma);
const fp new_Theta = p.gridfn(gfns::gfn__Theta,
irho,isigma);
@@ -586,8 +963,14 @@ if (active_flag)
}
// restore h and Theta
- ps_ptr->add_to_ghosted_gridfn(-epsilon, gfns::gfn__h);
+ ps_ptr->add_to_ghosted_gridfn(-epsilon/2, gfns::gfn__h);
ps_ptr->gridfn_copy(gfns::gfn__save_Theta, gfns::gfn__Theta);
+ ps_ptr->gridfn_copy(gfns::gfn__save_mean_curvature, gfns::gfn__mean_curvature);
+ if (ps_ptr->N_additional_points())
+ then {
+ const int np = ps_ptr->N_grid_points();
+ ps_ptr->gridfn_data(gfns::gfn__Theta)[np] = additional_save_Theta;
+ }
}
return expansion_success; // *** NORMAL RETURN ***
diff --git a/src/gr/gfns.hh b/src/gr/gfns.hh
index ee80c90..c223d03 100644
--- a/src/gr/gfns.hh
+++ b/src/gr/gfns.hh
@@ -16,10 +16,11 @@ namespace gfns
// ghosted gridfns
enum {
- ghosted_min_gfn = -1, // must set this by hand so
+ ghosted_min_gfn = -3, // must set this by hand so
// ghosted_max_gfn is still < 0
gfn__h = ghosted_min_gfn,
- ghosted_max_gfn = gfn__h
+ gfn__save_h,
+ ghosted_max_gfn = gfn__save_h
};
// nominal gridfns
@@ -38,7 +39,7 @@ enum {
gfn__global_x = nominal_min_gfn, // no access macro
gfn__global_y, // no access macro
gfn__global_z, // no access macro
-
+
gfn__global_xx, // no access macro
gfn__global_xy, // no access macro
gfn__global_xz, // no access macro
@@ -46,6 +47,11 @@ enum {
gfn__global_yz, // no access macro
gfn__global_zz, // no access macro
+ gfn__mask, // no access macro
+ gfn__partial_d_mask_1, // no access macro
+ gfn__partial_d_mask_2, // no access macro
+ gfn__partial_d_mask_3, // no access macro
+
gfn__g_dd_11,
gfn__g_dd_12,
gfn__g_dd_13,
@@ -82,6 +88,9 @@ enum {
gfn__partial_d_psi_2, // no access macro
gfn__partial_d_psi_3, // no access macro
+ gfn__mean_curvature, // no access macro
+ gfn__save_mean_curvature, // no access macro
+
gfn__Theta,
gfn__partial_Theta_wrt_partial_d_h_1,
gfn__partial_Theta_wrt_partial_d_h_2,
@@ -90,6 +99,8 @@ enum {
gfn__partial_Theta_wrt_partial_dd_h_22,
gfn__Delta_h,
gfn__save_Theta,
+ gfn__old_Theta,
+ gfn__zero,
gfn__one,
nominal_max_gfn = gfn__one // no comma
};
diff --git a/src/gr/gr.hh b/src/gr/gr.hh
index 00f106c..3564438 100644
--- a/src/gr/gr.hh
+++ b/src/gr/gr.hh
@@ -1,3 +1,4 @@
+
// gr.hh -- header file for general relativity code
// $Header$
@@ -14,6 +15,68 @@ namespace AHFinderDirect
enum { N_GRID_DIMS = 3, N_HORIZON_DIMS = 2 };
//
+// this enum specifies what kind of surface we want
+//
+enum a_surface_definition
+ {
+ definition_error, // this value is illegal
+ definition_expansion, // apparent horizon
+ definition_inner_expansion, // expansion Theta_(l), ingoing null normal
+ definition_mean_curvature, // mean curvature
+ definition_expansion_product // product of Theta_(n) and Theta_(l)
+ };
+
+//
+// this enum specifies how the surface definition is modified
+//
+enum a_surface_modification
+ {
+ modification_error, // this value is illegal
+ modification_none, // no modification
+ modification_radius, // times coordinate radius
+ modification_radius2 // times coordinate radius^2
+#if 0
+ modification_mean_radius, // times mean coordinate radius
+ modification_areal_radius // times areal radius
+#endif
+ };
+
+//
+// this enum specifies how we select the surface
+//
+enum a_surface_selection
+ {
+ selection_error, // this value is illegal
+ selection_definition, // use the surface's definition
+ selection_mean_coordinate_radius, // mean coordinate radius (cheap)
+ selection_areal_radius, // areal radius
+ selection_expansion_mean_coordinate_radius, // expansion times mean coordinate radius
+ selection_expansion_areal_radius // expansion times areal radius
+ };
+
+//
+// this struct specifies what to calculate
+//
+struct what_to_compute
+ {
+ // how Theta is calculated
+ a_surface_definition surface_definition;
+ // how Theta is modified
+ a_surface_modification surface_modification;
+ // what is solved for
+ a_surface_selection surface_selection;
+ // the desired value (expansion, areal radius, etc.)
+ fp desired_value;
+
+ what_to_compute ()
+ : surface_definition (definition_error),
+ surface_modification (modification_error),
+ surface_selection (selection_error),
+ desired_value (0.0)
+ { }
+ };
+
+//
// this enum holds the (a) decoded Jacobian_compute_method parameter,
// i.e. it specifies how we compute the (a) Jacobian matrix
//
@@ -76,6 +139,7 @@ struct cactus_grid_info
bool use_Cactus_conformal_metric;
// Cactus variable indices of geometry variables
+ int mask_varindex;
int g_dd_11_varindex, g_dd_12_varindex, g_dd_13_varindex,
g_dd_22_varindex, g_dd_23_varindex,
g_dd_33_varindex;
@@ -169,18 +233,23 @@ struct error_info
// expansion.cc
enum expansion_status
- expansion(patch_system* ps_ptr, fp add_to_expansion,
+ expansion(patch_system* ps_ptr,
+ const struct what_to_compute& comput_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct error_info& error_info, bool initial_flag,
bool Jacobian_flag = false,
bool print_msg_flag = false,
- jtutil::norm<fp>* H_norms_ptr = NULL);
+ jtutil::norm<fp>* H_norms_ptr = NULL,
+ jtutil::norm<fp>* expansion_H_norms_ptr = NULL,
+ jtutil::norm<fp>* inner_expansion_H_norms_ptr = NULL,
+ jtutil::norm<fp>* product_expansion_H_norms_ptr = NULL,
+ jtutil::norm<fp>* mean_curvature_H_norms_ptr = NULL);
// expansion_Jacobian.cc
enum expansion_status
expansion_Jacobian(patch_system* ps_ptr, Jacobian* Jac_ptr,
- fp add_to_expansion,
+ const struct what_to_compute& comput_info,
const struct cactus_grid_info& cgi,
const struct geometry_info& gi,
const struct Jacobian_info& Jacobian_info,
diff --git a/src/gr/gr_gfas.minc b/src/gr/gr_gfas.minc
index 34da085..b72531c 100644
--- a/src/gr/gr_gfas.minc
+++ b/src/gr/gr_gfas.minc
@@ -40,5 +40,7 @@ partial_Theta_D_wrt_partial_d_h, partial_Theta_D_wrt_partial_d_h__fnd,
partial_Theta_A_wrt_partial_dd_h, partial_Theta_A_wrt_partial_dd_h__fnd,
partial_Theta_B_wrt_partial_dd_h, partial_Theta_B_wrt_partial_dd_h__fnd,
-partial_Theta_wrt_partial_d_h, partial_Theta_wrt_partial_d_h__fnd,
-partial_Theta_wrt_partial_dd_h, partial_Theta_wrt_partial_dd_h__fnd # no comma
+partial_Theta_X_wrt_partial_d_h, partial_Theta_X_wrt_partial_d_h__fnd,
+partial_Theta_Y_wrt_partial_d_h, partial_Theta_Y_wrt_partial_d_h__fnd,
+partial_Theta_X_wrt_partial_dd_h, partial_Theta_X_wrt_partial_dd_h__fnd,
+partial_Theta_Y_wrt_partial_dd_h, partial_Theta_Y_wrt_partial_dd_h__fnd # no comma
diff --git a/src/gr/horizon.maple b/src/gr/horizon.maple
index 7284253..423642f 100644
--- a/src/gr/horizon.maple
+++ b/src/gr/horizon.maple
@@ -258,7 +258,7 @@ global
@include "../maple/gfa.minc",
@include "../gr/gr_gfas.minc";
local u,v,
- temp;
+ temp1,temp2;
printf("%a...\n", procname);
@@ -284,14 +284,16 @@ assert_fnd_exists(Theta_D);
:= frontend('diff', [Theta_D__fnd, Diff(h,y_rs[u])]);
# equation (A1a) in my 1996 apparent horizon finding paper
- temp := + (3/2)*Theta_A/Theta_D^(5/2)
- + (1/2)*Theta_B/Theta_D^(3/2)
- + Theta_C/Theta_D^2;
- partial_Theta_wrt_partial_d_h__fnd[u]
+ temp1 := + (3/2)*Theta_A/Theta_D^(5/2)
+ + (1/2)*Theta_B/Theta_D^(3/2);
+ partial_Theta_X_wrt_partial_d_h__fnd[u]
:= + partial_Theta_A_wrt_partial_d_h__fnd[u] / Theta_D^(3/2)
+ partial_Theta_B_wrt_partial_d_h__fnd[u] / Theta_D^(1/2)
- + partial_Theta_C_wrt_partial_d_h__fnd[u] / Theta_D
- - partial_Theta_D_wrt_partial_d_h__fnd[u] * temp;
+ - partial_Theta_D_wrt_partial_d_h__fnd[u] * temp1;
+ temp2 := + Theta_C/Theta_D^2;
+ partial_Theta_Y_wrt_partial_d_h__fnd[u]
+ := + partial_Theta_C_wrt_partial_d_h__fnd[u] / Theta_D
+ - partial_Theta_D_wrt_partial_d_h__fnd[u] * temp2;
end do;
# Jacobian coefficients of Theta_[AB] and Theta wrt Diff(h,y_rs[u],y_rs[v])
@@ -305,17 +307,23 @@ assert_fnd_exists(Theta_D);
:= frontend('diff', [Theta_B__fnd, Diff(h,y_rs[u],y_rs[v])]);
# equation (A1b) in my 1996 apparent horizon finding paper
- partial_Theta_wrt_partial_dd_h__fnd[u,v]
+ partial_Theta_X_wrt_partial_dd_h__fnd[u,v]
:= + partial_Theta_A_wrt_partial_dd_h__fnd[u,v] / Theta_D^(3/2)
- + partial_Theta_B_wrt_partial_dd_h__fnd[u,v] / Theta_D^(1/2)
+ + partial_Theta_B_wrt_partial_dd_h__fnd[u,v] / Theta_D^(1/2);
+ partial_Theta_Y_wrt_partial_dd_h__fnd[u,v]
+ := 0;
end do;
end do;
if (cg_flag)
- then codegen2([partial_Theta_wrt_partial_d_h__fnd,
- partial_Theta_wrt_partial_dd_h__fnd],
- ['partial_Theta_wrt_partial_d_h',
- 'partial_Theta_wrt_partial_dd_h'],
+ then codegen2([partial_Theta_X_wrt_partial_d_h__fnd,
+ partial_Theta_Y_wrt_partial_d_h__fnd,
+ partial_Theta_X_wrt_partial_dd_h__fnd,
+ partial_Theta_Y_wrt_partial_dd_h__fnd],
+ ['partial_Theta_X_wrt_partial_d_h',
+ 'partial_Theta_Y_wrt_partial_d_h',
+ 'partial_Theta_X_wrt_partial_dd_h',
+ 'partial_Theta_Y_wrt_partial_dd_h'],
"../gr.cg/expansion_Jacobian.c");
fi;
diff --git a/src/gr/make.code.defn b/src/gr/make.code.defn
index 37e9db6..71bf658 100644
--- a/src/gr/make.code.defn
+++ b/src/gr/make.code.defn
@@ -10,16 +10,9 @@ SRCS = expansion.cc \
# Subdirectories containing source files
SUBDIRS =
-# disable automatic template instantiation on DEC Alphas cxx compiler
+# disable automatic template instantiation on DEC Alphas
ifeq ($(shell uname), OSF1)
ifeq ($(CXX), cxx)
CXXFLAGS += -nopt
endif
endif
-
-# disable automagic template instantiation on SGI Irix CC compiler
-ifneq (,$(findstring IRIX,$(shell uname)))
- ifeq ($(notdir $(CXX)), CC)
- CXXFLAGS += -no_auto_include
- endif
-endif
diff --git a/src/gr/maple.log b/src/gr/maple.log
index 54c762f..1a91a6c 100644
--- a/src/gr/maple.log
+++ b/src/gr/maple.log
@@ -1,10 +1,11 @@
+RedHat v <9 or other Linux present, starting standard mode...
|\^/| Maple 7 (IBM INTEL LINUX)
._|\| |/|_. Copyright (c) 2001 by Waterloo Maple Inc.
\ MAPLE / All rights reserved. Maple is a registered trademark of
<____ ____> Waterloo Maple Inc.
| Type ? for help.
# top-level Maple file to read/run all code in this directory
-# $Header: /numrelcvs/AEIDevelopment/AHFinderDirect/src/gr/doit.maple,v 1.5 2002/09/13 14:12:18 jthorn Exp $
+# $Header: /numrelcvs/AEIThorns/AHFinderDirect/src/gr/doit.maple,v 1.5 2002/09/13 14:12:18 jthorn Exp $
>
> read "../maple/setup.mm";
msum := proc(fn::algebraic)
@@ -205,19 +206,22 @@ rho, sigma, y_rs, y_rs_list, y_rs_set, xy_all_list, xy_all_set, inert, none,
fnd, symmetric3_23, X_ud, X_ud__fnd, X_udd, X_udd__fnd, g_dd, K_dd, g_uu,
g_uu__fnd, K_uu, K_uu__fnd, K, K__fnd, partial_d_g_dd, partial_d_ln_sqrt_g,
partial_d_ln_sqrt_g__fnd, partial_d_g_uu, partial_d_g_uu__fnd, h, h__fnd,
-s_d, s_d__fnd, partial_d_s_d, partial_d_s_d__fnd, n_u, n_u__fnd, HA,
-HA__fnd, HB, HB__fnd, HC, HC__fnd, HD, HD__fnd, H, H__fnd, partial_d_HA,
-partial_d_HA__fnd, partial_d_HB, partial_d_HB__fnd, partial_d_HC,
-partial_d_HC__fnd, partial_d_HD, partial_d_HD__fnd, partial_d_H,
-partial_d_H__fnd, partial_HA_wrt_partial_d_h,
-partial_HA_wrt_partial_d_h__fnd, partial_HB_wrt_partial_d_h,
-partial_HB_wrt_partial_d_h__fnd, partial_HC_wrt_partial_d_h,
-partial_HC_wrt_partial_d_h__fnd, partial_HD_wrt_partial_d_h,
-partial_HD_wrt_partial_d_h__fnd, partial_HA_wrt_partial_dd_h,
-partial_HA_wrt_partial_dd_h__fnd, partial_HB_wrt_partial_dd_h,
-partial_HB_wrt_partial_dd_h__fnd, partial_H_wrt_partial_d_h,
-partial_H_wrt_partial_d_h__fnd, partial_H_wrt_partial_dd_h,
-partial_H_wrt_partial_dd_h__fnd;
+s_d, s_d__fnd, partial_d_s_d, partial_d_s_d__fnd, n_u, n_u__fnd, Theta_A,
+Theta_A__fnd, Theta_B, Theta_B__fnd, Theta_C, Theta_C__fnd, Theta_D,
+Theta_D__fnd, Theta, Theta__fnd, partial_d_Theta_A, partial_d_Theta_A__fnd,
+partial_d_Theta_B, partial_d_Theta_B__fnd, partial_d_Theta_C,
+partial_d_Theta_C__fnd, partial_d_Theta_D, partial_d_Theta_D__fnd,
+partial_d_Theta_, partial_d_Theta__fnd, partial_Theta_A_wrt_partial_d_h,
+partial_Theta_A_wrt_partial_d_h__fnd, partial_Theta_B_wrt_partial_d_h,
+partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
+partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
+partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
+partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
option remember;
var_list := [args[2 .. nargs]];
if type(operand, indexed) and op(0, operand) = 'X_ud' and
@@ -597,9 +601,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
make_gfa('g_dd', {inert}, [1 .. N, 1 .. N], symmetric);
make_gfa('K_dd', {inert}, [1 .. N, 1 .. N], symmetric);
make_gfa('g_uu', {inert, fnd}, [1 .. N, 1 .. N], symmetric);
@@ -635,9 +641,13 @@ partial_Theta_wrt_partial_dd_h__fnd;
[1 .. N_ang, 1 .. N_ang], symmetric);
make_gfa('partial_Theta_B_wrt_partial_dd_h', {inert, fnd},
[1 .. N_ang, 1 .. N_ang], symmetric);
- make_gfa('partial_Theta_wrt_partial_d_h', {inert, fnd}, [1 .. N_ang],
+ make_gfa('partial_Theta_X_wrt_partial_d_h', {inert, fnd}, [1 .. N_ang],
+ none);
+ make_gfa('partial_Theta_Y_wrt_partial_d_h', {inert, fnd}, [1 .. N_ang],
none);
- make_gfa('partial_Theta_wrt_partial_dd_h', {inert, fnd},
+ make_gfa('partial_Theta_X_wrt_partial_dd_h', {inert, fnd},
+ [1 .. N_ang, 1 .. N_ang], symmetric);
+ make_gfa('partial_Theta_Y_wrt_partial_dd_h', {inert, fnd},
[1 .. N_ang, 1 .. N_ang], symmetric);
NULL
end proc
@@ -660,9 +670,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
option remember;
var_list := [args[2 .. nargs]];
if type(operand, indexed) and op(0, operand) = 'g_dd' and
@@ -696,9 +708,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(g_dd);
assert_fnd_exists(g_uu, fnd);
@@ -727,9 +741,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(g_uu);
assert_fnd_exists(K_dd);
@@ -771,9 +787,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(g_dd);
assert_fnd_exists(g_uu);
@@ -809,9 +827,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(g_dd);
assert_fnd_exists(g_uu);
@@ -852,9 +872,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(h);
assert_fnd_exists(X_ud);
@@ -883,9 +905,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(h);
assert_fnd_exists(X_ud);
@@ -923,9 +947,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(g_uu);
assert_fnd_exists(K_uu);
@@ -958,7 +984,7 @@ partial_Theta_wrt_partial_dd_h__fnd;
end proc
expansion_Jacobian := proc(cg_flag::boolean)
-local u, v, temp;
+local u, v, temp1, temp2;
global delta, N, N_ang, xx, yy, zz, x_xyz, x_xyz_list, x_xyz_set, r, r__fnd,
rho, sigma, y_rs, y_rs_list, y_rs_set, xy_all_list, xy_all_set, inert, none,
fnd, symmetric3_23, X_ud, X_ud__fnd, X_udd, X_udd__fnd, g_dd, K_dd, g_uu,
@@ -975,9 +1001,11 @@ partial_Theta_B_wrt_partial_d_h__fnd, partial_Theta_C_wrt_partial_d_h,
partial_Theta_C_wrt_partial_d_h__fnd, partial_Theta_D_wrt_partial_d_h,
partial_Theta_D_wrt_partial_d_h__fnd, partial_Theta_A_wrt_partial_dd_h,
partial_Theta_A_wrt_partial_dd_h__fnd, partial_Theta_B_wrt_partial_dd_h,
-partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_wrt_partial_d_h,
-partial_Theta_wrt_partial_d_h__fnd, partial_Theta_wrt_partial_dd_h,
-partial_Theta_wrt_partial_dd_h__fnd;
+partial_Theta_B_wrt_partial_dd_h__fnd, partial_Theta_X_wrt_partial_d_h,
+partial_Theta_X_wrt_partial_d_h__fnd, partial_Theta_Y_wrt_partial_d_h,
+partial_Theta_Y_wrt_partial_d_h__fnd, partial_Theta_X_wrt_partial_dd_h,
+partial_Theta_X_wrt_partial_dd_h__fnd, partial_Theta_Y_wrt_partial_dd_h,
+partial_Theta_Y_wrt_partial_dd_h__fnd;
printf("%a...\n", procname);
assert_fnd_exists(g_uu);
assert_fnd_exists(K_uu);
@@ -996,13 +1024,15 @@ partial_Theta_wrt_partial_dd_h__fnd;
frontend('diff', [Theta_C__fnd, Diff(h, y_rs[u])]);
partial_Theta_D_wrt_partial_d_h__fnd[u] :=
frontend('diff', [Theta_D__fnd, Diff(h, y_rs[u])]);
- temp := 3/2*Theta_A/Theta_D^(5/2) + 1/2*Theta_B/Theta_D^(3/2)
- + Theta_C/Theta_D^2;
- partial_Theta_wrt_partial_d_h__fnd[u] :=
+ temp1 := 3/2*Theta_A/Theta_D^(5/2) + 1/2*Theta_B/Theta_D^(3/2);
+ partial_Theta_X_wrt_partial_d_h__fnd[u] :=
partial_Theta_A_wrt_partial_d_h__fnd[u]/Theta_D^(3/2)
+ partial_Theta_B_wrt_partial_d_h__fnd[u]/Theta_D^(1/2)
- + partial_Theta_C_wrt_partial_d_h__fnd[u]/Theta_D
- - partial_Theta_D_wrt_partial_d_h__fnd[u]*temp
+ - partial_Theta_D_wrt_partial_d_h__fnd[u]*temp1;
+ temp2 := Theta_C/Theta_D^2;
+ partial_Theta_Y_wrt_partial_d_h__fnd[u] :=
+ partial_Theta_C_wrt_partial_d_h__fnd[u]/Theta_D
+ - partial_Theta_D_wrt_partial_d_h__fnd[u]*temp2
end do;
for u to N_ang do for v from u to N_ang do
partial_Theta_A_wrt_partial_dd_h__fnd[u, v] :=
@@ -1011,16 +1041,22 @@ partial_Theta_wrt_partial_dd_h__fnd;
partial_Theta_B_wrt_partial_dd_h__fnd[u, v] :=
frontend('diff', [Theta_B__fnd, Diff(h, y_rs[u], y_rs[v])])
;
- partial_Theta_wrt_partial_dd_h__fnd[u, v] :=
+ partial_Theta_X_wrt_partial_dd_h__fnd[u, v] :=
partial_Theta_A_wrt_partial_dd_h__fnd[u, v]/Theta_D^(3/2)
+
- partial_Theta_B_wrt_partial_dd_h__fnd[u, v]/Theta_D^(1/2)
+ partial_Theta_B_wrt_partial_dd_h__fnd[u, v]/Theta_D^(1/2);
+ partial_Theta_Y_wrt_partial_dd_h__fnd[u, v] := 0
end do
end do;
- if cg_flag then codegen2([partial_Theta_wrt_partial_d_h__fnd,
- partial_Theta_wrt_partial_dd_h__fnd],
- ['partial_Theta_wrt_partial_d_h', 'partial_Theta_wrt_partial_dd_h']
- , "../gr.cg/expansion_Jacobian.c")
+ if cg_flag then codegen2([partial_Theta_X_wrt_partial_d_h__fnd,
+ partial_Theta_Y_wrt_partial_d_h__fnd,
+ partial_Theta_X_wrt_partial_dd_h__fnd,
+ partial_Theta_Y_wrt_partial_dd_h__fnd], [
+ 'partial_Theta_X_wrt_partial_d_h',
+ 'partial_Theta_Y_wrt_partial_d_h',
+ 'partial_Theta_X_wrt_partial_dd_h',
+ 'partial_Theta_Y_wrt_partial_dd_h'],
+ "../gr.cg/expansion_Jacobian.c")
end if;
NULL
end proc
@@ -1040,7 +1076,7 @@ codegen2(g_uu) --> "../gr.cg/inverse_metric.c"
find temporary variables
--> `codegen2/temps`
convert Diff(expr,rho,sigma) --> PARTIAL_RHO_SIGMA(expr) etc
-bytes used=1000088, alloc=917336, time=0.12
+bytes used=1000776, alloc=917336, time=0.13
--> `codegen2/fix_Diff`
convert R_dd[2,3] --> R_dd_23 etc
--> `codegen2/unindex`
@@ -1053,7 +1089,7 @@ codegen2([K, K_uu]) --> "../gr.cg/extrinsic_curvature_trace_raise.c"
convert --> equation list
--> `codegen2/eqnlist`
optimizing computation sequence
-bytes used=2000352, alloc=1441528, time=0.17
+bytes used=2001072, alloc=1441528, time=0.20
--> `codegen2/optimize`
find temporary variables
--> `codegen2/temps`
@@ -1061,39 +1097,39 @@ bytes used=2000352, alloc=1441528, time=0.17
--> `codegen2/fix_Diff`
convert R_dd[2,3] --> R_dd_23 etc
--> `codegen2/unindex`
-bytes used=3000584, alloc=1638100, time=0.22
+bytes used=3001364, alloc=1638100, time=0.26
convert p/q --> RATIONAL(p/q)
--> `codegen2/fix_rationals`
writing C code
> curvature(true);
inverse_metric_gradient...
-bytes used=4000860, alloc=1703624, time=0.28
+bytes used=4001680, alloc=1703624, time=0.34
codegen2(partial_d_g_uu) --> "../gr.cg/inverse_metric_gradient.c"
--> `codegen2/input`
convert --> equation list
--> `codegen2/eqnlist`
optimizing computation sequence
-bytes used=5001020, alloc=1703624, time=0.38
+bytes used=5001836, alloc=1703624, time=0.42
--> `codegen2/optimize`
find temporary variables
--> `codegen2/temps`
convert Diff(expr,rho,sigma) --> PARTIAL_RHO_SIGMA(expr) etc
-bytes used=6001324, alloc=1769148, time=0.44
+bytes used=6002212, alloc=1769148, time=0.49
--> `codegen2/fix_Diff`
convert R_dd[2,3] --> R_dd_23 etc
--> `codegen2/unindex`
-bytes used=7001528, alloc=1769148, time=0.51
+bytes used=7002736, alloc=1769148, time=0.55
convert p/q --> RATIONAL(p/q)
--> `codegen2/fix_rationals`
writing C code
-bytes used=8001896, alloc=1769148, time=0.57
+bytes used=8003012, alloc=1769148, time=0.62
metric_det_gradient...
codegen2(partial_d_ln_sqrt_g) --> "../gr.cg/metric_det_gradient.c"
--> `codegen2/input`
convert --> equation list
--> `codegen2/eqnlist`
optimizing computation sequence
-bytes used=9002080, alloc=1769148, time=0.64
+bytes used=9003256, alloc=1769148, time=0.75
--> `codegen2/optimize`
find temporary variables
--> `codegen2/temps`
@@ -1108,29 +1144,29 @@ codegen/C/expression: Unknown function: RATIONAL will be left as is.
> horizon(true);
non_unit_normal...
non_unit_normal_deriv...
-bytes used=10002316, alloc=1769148, time=0.69
+bytes used=10005164, alloc=1769148, time=0.82
expansion...
-bytes used=11002748, alloc=1834672, time=0.77
+bytes used=11005388, alloc=1834672, time=0.89
codegen2([Theta_A, Theta_B, Theta_C, Theta_D]) --> "../gr.cg/expansion.c"
--> `codegen2/input`
convert --> equation list
--> `codegen2/eqnlist`
optimizing computation sequence
-bytes used=12003104, alloc=1834672, time=0.83
-bytes used=13003356, alloc=2031244, time=0.95
-bytes used=14003520, alloc=2031244, time=1.05
+bytes used=12005892, alloc=1834672, time=0.96
+bytes used=13006112, alloc=2031244, time=1.09
+bytes used=14006296, alloc=2031244, time=1.20
--> `codegen2/optimize`
find temporary variables
--> `codegen2/temps`
convert Diff(expr,rho,sigma) --> PARTIAL_RHO_SIGMA(expr) etc
-bytes used=15003896, alloc=2096768, time=1.11
+bytes used=15006844, alloc=2096768, time=1.27
--> `codegen2/fix_Diff`
convert R_dd[2,3] --> R_dd_23 etc
-bytes used=16004136, alloc=2096768, time=1.18
+bytes used=16007112, alloc=2096768, time=1.34
--> `codegen2/unindex`
-bytes used=17004388, alloc=2096768, time=1.25
+bytes used=17007616, alloc=2096768, time=1.40
convert p/q --> RATIONAL(p/q)
-bytes used=18004580, alloc=2096768, time=1.31
+bytes used=18007784, alloc=2096768, time=1.46
--> `codegen2/fix_rationals`
writing C code
codegen/C/expression: Unknown function: PARTIAL_RHO will be left as is.
@@ -1141,57 +1177,58 @@ codegen/C/expression: Unknown function: PARTIAL_RHO_SIGMA
will be left as is.
codegen/C/expression: Unknown function: PARTIAL_SIGMA_SIGMA
will be left as is.
-bytes used=19004732, alloc=2096768, time=1.37
-bytes used=20004972, alloc=2096768, time=1.47
+bytes used=19008004, alloc=2096768, time=1.51
+bytes used=20008500, alloc=2096768, time=1.62
expansion_Jacobian...
-bytes used=21005184, alloc=2096768, time=1.56
-codegen2([partial_Theta_wrt_partial_d_h, partial_Theta_wrt_partial_dd_h]) --> "../gr.cg/expansion_Jacobian.c"
+bytes used=21009180, alloc=2096768, time=1.70
+codegen2([partial_Theta_X_wrt_partial_d_h, partial_Theta_Y_wrt_partial_d_h, partial_Theta_X_wrt_partial_dd_h, partial_Theta_Y_wrt_partial_dd_h]) --> "../gr.cg/expansion_Jacobian.c"
--> `codegen2/input`
convert --> equation list
-bytes used=22005440, alloc=2096768, time=1.63
+bytes used=22009512, alloc=2096768, time=1.77
--> `codegen2/eqnlist`
optimizing computation sequence
-bytes used=23005788, alloc=2162292, time=1.71
-bytes used=24006060, alloc=2293340, time=1.78
-bytes used=25006304, alloc=2293340, time=1.84
-bytes used=26006456, alloc=2293340, time=1.94
-bytes used=27007216, alloc=2293340, time=2.10
-bytes used=28007500, alloc=2293340, time=2.26
-bytes used=29007664, alloc=2293340, time=2.39
-bytes used=30007868, alloc=2424388, time=2.50
-bytes used=31008068, alloc=2424388, time=2.60
-bytes used=32009692, alloc=2555436, time=2.71
+bytes used=23009696, alloc=2162292, time=1.84
+bytes used=24009880, alloc=2293340, time=1.91
+bytes used=25010716, alloc=2293340, time=1.97
+bytes used=26010940, alloc=2293340, time=2.07
+bytes used=27011284, alloc=2293340, time=2.21
+bytes used=28011604, alloc=2293340, time=2.37
+bytes used=29011784, alloc=2293340, time=2.47
+bytes used=30012024, alloc=2424388, time=2.60
+bytes used=31012336, alloc=2424388, time=2.69
+bytes used=32012604, alloc=2489912, time=2.80
--> `codegen2/optimize`
find temporary variables
+bytes used=33012892, alloc=2620960, time=2.87
--> `codegen2/temps`
convert Diff(expr,rho,sigma) --> PARTIAL_RHO_SIGMA(expr) etc
-bytes used=33010028, alloc=2555436, time=2.77
-bytes used=34010432, alloc=2555436, time=2.84
-bytes used=35010740, alloc=2555436, time=2.91
+bytes used=34013116, alloc=2620960, time=2.94
+bytes used=35013316, alloc=2620960, time=3.01
+bytes used=36013600, alloc=2620960, time=3.08
--> `codegen2/fix_Diff`
-bytes used=36021172, alloc=2555436, time=2.99
convert R_dd[2,3] --> R_dd_23 etc
-bytes used=37021516, alloc=2555436, time=3.05
-bytes used=38021792, alloc=2555436, time=3.12
-bytes used=39022208, alloc=2555436, time=3.20
+bytes used=37014080, alloc=2620960, time=3.15
+bytes used=38014560, alloc=2620960, time=3.22
+bytes used=39014928, alloc=2620960, time=3.29
--> `codegen2/unindex`
-bytes used=40022676, alloc=2555436, time=3.27
-bytes used=41022924, alloc=2555436, time=3.33
-bytes used=42023096, alloc=2555436, time=3.40
-bytes used=43023256, alloc=2555436, time=3.47
-bytes used=44023688, alloc=2555436, time=3.53
+bytes used=40015272, alloc=2620960, time=3.36
+bytes used=41015476, alloc=2620960, time=3.43
+bytes used=42015660, alloc=2620960, time=3.49
+bytes used=43016244, alloc=2620960, time=3.56
+bytes used=44016600, alloc=2620960, time=3.63
convert p/q --> RATIONAL(p/q)
-bytes used=45023996, alloc=2555436, time=3.60
-bytes used=46024268, alloc=2555436, time=3.67
-bytes used=47024688, alloc=2555436, time=3.73
-bytes used=48025108, alloc=2555436, time=3.80
+bytes used=45016764, alloc=2620960, time=3.68
+bytes used=46016940, alloc=2620960, time=3.74
+bytes used=47017228, alloc=2620960, time=3.81
+bytes used=48017676, alloc=2620960, time=3.87
--> `codegen2/fix_rationals`
writing C code
-bytes used=49025260, alloc=2555436, time=3.86
-bytes used=50025744, alloc=2555436, time=3.91
-bytes used=51026008, alloc=2555436, time=4.03
-bytes used=52026168, alloc=2555436, time=4.18
-bytes used=53026328, alloc=2555436, time=4.32
-bytes used=54026584, alloc=2555436, time=4.44
+bytes used=49017944, alloc=2620960, time=3.94
+bytes used=50018104, alloc=2620960, time=3.99
+bytes used=51018308, alloc=2620960, time=4.08
+bytes used=52018568, alloc=2620960, time=4.20
+bytes used=53018900, alloc=2620960, time=4.35
+bytes used=54019192, alloc=2620960, time=4.53
+bytes used=55019432, alloc=2620960, time=4.68
> quit
-bytes used=54895808, alloc=2555436, time=4.56
+bytes used=55315640, alloc=2620960, time=4.73
diff --git a/src/gr/misc-gr.cc b/src/gr/misc-gr.cc
index be9ccd0..eaaaf9a 100644
--- a/src/gr/misc-gr.cc
+++ b/src/gr/misc-gr.cc
@@ -11,6 +11,7 @@
#include "util_Table.h"
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "config.h"
#include "stdc.h"
diff --git a/src/gr/setup_gr_gfas.maple b/src/gr/setup_gr_gfas.maple
index 6af4aed..b2fed25 100644
--- a/src/gr/setup_gr_gfas.maple
+++ b/src/gr/setup_gr_gfas.maple
@@ -74,8 +74,11 @@ make_gfa('partial_Theta_B_wrt_partial_dd_h', {inert,fnd},
[1..N_ang, 1..N_ang], symmetric);
# Jacobian coefficients for Theta itself
-make_gfa('partial_Theta_wrt_partial_d_h', {inert,fnd}, [1..N_ang], none);
-make_gfa('partial_Theta_wrt_partial_dd_h', {inert,fnd},
+make_gfa('partial_Theta_X_wrt_partial_d_h', {inert,fnd}, [1..N_ang], none);
+make_gfa('partial_Theta_Y_wrt_partial_d_h', {inert,fnd}, [1..N_ang], none);
+make_gfa('partial_Theta_X_wrt_partial_dd_h', {inert,fnd},
+ [1..N_ang, 1..N_ang], symmetric);
+make_gfa('partial_Theta_Y_wrt_partial_dd_h', {inert,fnd},
[1..N_ang, 1..N_ang], symmetric);
NULL;
diff --git a/src/include/config.h b/src/include/config.h
index 106fc1c..0da3f35 100644
--- a/src/include/config.h
+++ b/src/include/config.h
@@ -42,8 +42,7 @@ typedef CCTK_INT integer;
/* CCTK_VWarn() "warning level" for fatal errors (terminate execution) */
/* note low-level software uses error_exit() instead of CCTK_VWarn(), */
/* with exit codes defined in "stdc.h" */
-#define FATAL_ERROR 0
-#define SERIOUS_WARNING 1
+#define FATAL_ERROR (-1)
/******************************************************************************/
diff --git a/src/include/stdc.h b/src/include/stdc.h
index c8a5228..7a3ad4d 100644
--- a/src/include/stdc.h
+++ b/src/include/stdc.h
@@ -53,20 +53,20 @@
/******************************************************************************/
#ifdef __cplusplus
-namespace AHFinderDirect
- {
namespace jtutil
{
#endif
/*
- * Low-level code in this thorn does error handling with error_exit() .
- * In this this thorn this function is a wrapper around
- * CCTK_VWarn(msg_level, ...)
- * This function is declared to return int so it may be easily used in
- * conditional expressions like
+ * Low-level code in this thorn is done with error_exit() . In this
+ * this thorn it's a wrapper around CCTK_VWarn(msg_level, ...) . It's
+ * declared to return int so it may be easily used in conditional
+ * expressions like
* foo = bar_ok ? baz(bar) : error_exit(...);
*/
+#ifdef __cplusplus
+ extern "C"
+#endif
int error_exit(int msg_level, const char *format, ...)
#ifdef __GNUC__
__attribute__ ((noreturn))
@@ -88,7 +88,6 @@ int error_exit(int msg_level, const char *format, ...)
#ifdef __cplusplus
} /* namespace jtutil */
- } /* namespace AHFinderDirect */
#endif
/******************************************************************************/
diff --git a/src/jtutil/README b/src/jtutil/README
index 31ac7aa..1b6ea5e 100644
--- a/src/jtutil/README
+++ b/src/jtutil/README
@@ -1,8 +1,6 @@
This directory holds low-level utility code in the C++ namespace jtutil::.
-Apart from this namespace being inside this thorn's global AHFinderDirect::
-namespace, this code isn't specific to this project -- it's things like
-min/max templates, multidimensional array classes, fuzzy arithmetic
-routines, etc.
+This code is not specific to this project -- it's things like min/max
+templates, multidimensional array classes, fuzzy arithmetic routines, etc.
array<fp>
is a template class (templated on the integer or floating-point
diff --git a/src/jtutil/array.cc b/src/jtutil/array.cc
index c8e5c47..b6fbc99 100644
--- a/src/jtutil/array.cc
+++ b/src/jtutil/array.cc
@@ -33,12 +33,6 @@
#include "util.hh"
#include "array.hh"
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -46,6 +40,8 @@ namespace jtutil
//
// This function constructs an array1d object.
//
+namespace jtutil
+ {
template <typename T>
array1d<T>::array1d(int min_i_in, int max_i_in,
T *array_in /* = NULL */,
@@ -77,18 +73,22 @@ if (we_own_array_)
operator()(i) = T(0);
}
}
+ } // namespace jtutil::
//******************************************************************************
//
// This function destroys an array1d object.
//
+namespace jtutil
+ {
template <typename T>
array1d<T>::~array1d()
{
if (we_own_array_)
then delete[] array_;
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -97,6 +97,8 @@ if (we_own_array_)
//
// This function constructs an array2d object.
//
+namespace jtutil
+ {
template <typename T>
array2d<T>::array2d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
@@ -135,18 +137,22 @@ if (we_own_array_)
}
}
}
+ } // namespace jtutil::
//******************************************************************************
//
// This function destroys an array2d object.
//
+namespace jtutil
+ {
template <typename T>
array2d<T>::~array2d()
{
if (we_own_array_)
then delete[] array_;
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -155,6 +161,8 @@ if (we_own_array_)
//
// This function constructs an array3d object.
//
+namespace jtutil
+ {
template <typename T>
array3d<T>::array3d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
@@ -202,18 +210,22 @@ if (we_own_array_)
}
}
}
+ } // namespace jtutil::
//******************************************************************************
//
// This function destroys an array3d object.
//
+namespace jtutil
+ {
template <typename T>
array3d<T>::~array3d()
{
if (we_own_array_)
then delete[] array_;
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -223,6 +235,8 @@ if (we_own_array_)
//
// This function constructs an array4d object.
//
+namespace jtutil
+ {
template <typename T>
array4d<T>::array4d(int min_i_in, int max_i_in,
int min_j_in, int max_j_in,
@@ -278,6 +292,7 @@ if (we_own_array_)
}
}
}
+ } // namespace jtutil::
#endif /* NOT_USED */
//******************************************************************************
@@ -286,12 +301,15 @@ if (we_own_array_)
//
// This function destroys an array4d object.
//
+namespace jtutil
+ {
template <typename T>
array4d<T>::~array4d()
{
if (we_own_array_)
then delete[] array_;
}
+ } // namespace jtutil::
#endif /* NOT_USED */
//******************************************************************************
@@ -302,40 +320,33 @@ if (we_own_array_)
// ***** template instantiations *****
//
-template class array1d<int>;
+template class jtutil::array1d<int>;
// FIXME: we shouldn't have to instantiate these both, the const one
// is actually trivially derivable from the non-const one. :(
-template class array1d< void *>;
-template class array1d<const void *>;
+template class jtutil::array1d< void *>;
+template class jtutil::array1d<const void *>;
#ifdef STANDALONE_TEST
- template class array1d<float>;
- template class array2d<float>;
- template class array3d<float>;
+ template class jtutil::array1d<float>;
+ template class jtutil::array2d<float>;
+ template class jtutil::array3d<float>;
#ifdef NOT_USED
- template class array4d<float>;
+ template class jtutil::array4d<float>;
#endif
- template class array1d<double>;
- template class array2d<double>;
- template class array3d<double>;
+ template class jtutil::array1d<double>;
+ template class jtutil::array2d<double>;
+ template class jtutil::array3d<double>;
#ifdef NOT_USED
- template class array4d<double>;
+ template class jtutil::array4d<double>;
#endif
#else
// full-fledged Cactus thorn
- template class array1d<CCTK_REAL>;
+ template class jtutil::array1d<CCTK_REAL>;
- template class array2d<CCTK_INT>;
- template class array2d<CCTK_REAL>;
+ template class jtutil::array2d<CCTK_INT>;
+ template class jtutil::array2d<CCTK_REAL>;
- template class array3d<CCTK_REAL>;
+ template class jtutil::array3d<CCTK_REAL>;
#endif
-
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
diff --git a/src/jtutil/array.hh b/src/jtutil/array.hh
index 14a023e..bf70628 100644
--- a/src/jtutil/array.hh
+++ b/src/jtutil/array.hh
@@ -62,14 +62,10 @@
//
#endif
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//******************************************************************************
+namespace jtutil
+ {
template <typename T>
class array1d
{
@@ -150,9 +146,12 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
+ } // namespace jtutil::
//******************************************************************************
+namespace jtutil
+ {
template <typename T>
class array2d
{
@@ -244,9 +243,12 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
+ } // namespace jtutil::
//******************************************************************************
+namespace jtutil
+ {
template <typename T>
class array3d
{
@@ -346,10 +348,13 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
+ } // namespace jtutil::
//******************************************************************************
#ifdef NOT_USED
+namespace jtutil
+ {
template <typename T>
class array4d
{
@@ -464,11 +469,9 @@ private:
bool we_own_array_; // true ==> array_ --> new[] array which we own
// false ==> array_ --> client-owned storage
};
+ } // namespace jtutil::
#endif /* NOT_USED */
//******************************************************************************
- } // namespace jtutil
- } // namespace AHFinderDirect
-
#endif /* AHFINDERDIRECT__ARRAY_HH */
diff --git a/src/jtutil/cpm_map.cc b/src/jtutil/cpm_map.cc
index 1a44b20..09ab35a 100644
--- a/src/jtutil/cpm_map.cc
+++ b/src/jtutil/cpm_map.cc
@@ -14,12 +14,7 @@
#include "stdc.h"
#include "util.hh"
#include "cpm_map.hh"
-
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
@@ -30,6 +25,8 @@ namespace jtutil
// specified fixed point (must be integer or half-integer) and domain.
// The sample point need not be in the map's domain/range.
//
+namespace jtutil
+ {
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t fixed_point)
@@ -53,6 +50,7 @@ assert(
fuzzy<fp_t>::ceiling(fixed_point)
);
}
+ } // namespace jtutil::
//******************************************************************************
@@ -61,6 +59,8 @@ assert(
// specified by a sample point sample_i --> sample_j and by sign.
// The sample point need not be in the map's domain/range.
//
+namespace jtutil
+ {
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
int sample_i, int sample_j,
@@ -73,6 +73,7 @@ cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
// verify that we have setup correct
assert( map_unchecked(sample_i) == sample_j );
}
+ } // namespace jtutil::
//******************************************************************************
@@ -84,6 +85,8 @@ assert( map_unchecked(sample_i) == sample_j );
// is never ok) and by sign. The sample point need not be in the map's
// domain/range.
//
+namespace jtutil
+ {
template <typename fp_t>
cpm_map<fp_t>::cpm_map(int min_i_in, int max_i_in,
fp_t sample_i, fp_t sample_j,
@@ -112,6 +115,7 @@ assert(
(map_is_plus_in ? fuzzy<fp_t>::floor (sample_j)
: fuzzy<fp_t>::ceiling(sample_j)) );
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -121,12 +125,5 @@ assert(
// ***** template instantiations *****
//
-template class cpm_map<float>;
-template class cpm_map<double>;
-
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
+template class jtutil::cpm_map<float>;
+template class jtutil::cpm_map<double>;
diff --git a/src/jtutil/cpm_map.hh b/src/jtutil/cpm_map.hh
index 1c63e8d..6b14ab3 100644
--- a/src/jtutil/cpm_map.hh
+++ b/src/jtutil/cpm_map.hh
@@ -25,14 +25,10 @@
//
#endif
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//******************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
class cpm_map
{
@@ -136,10 +132,8 @@ private:
int offset_;
bool map_is_plus_;
};
+ } // namespace jtutil::
//******************************************************************************
- } // namespace jtutil
- } // namespace AHFinderDirect
-
#endif /* AHFINDERDIRECT__CPM_MAP_HH */
diff --git a/src/jtutil/error_exit.cc b/src/jtutil/error_exit.cc
index ffffa1e..fd8e2d8 100644
--- a/src/jtutil/error_exit.cc
+++ b/src/jtutil/error_exit.cc
@@ -18,12 +18,6 @@
#include "config.h"
#include "stdc.h"
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//******************************************************************************
//
@@ -54,6 +48,9 @@ namespace jtutil
// args... = (in) Any additional arguments are (presumably) used in formatting
// the error message string.
//
+namespace jtutil
+ {
+extern "C"
/*VARARGS*/
int error_exit(int msg_level, const char *format, ...)
{
@@ -78,14 +75,10 @@ if ((len > 0) && (buffer[len-1] == '\n'))
then abort();
else exit(msg_level);
#else
- CCTK_VWarn(msg_level, __LINE__, __FILE__, CCTK_THORNSTRING, "%s", buffer);
+ CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, "%s", buffer);
#endif
// if we got here, evidently msg_level wasn't drastic enough
abort(); /*NOTREACHED*/
}
-
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
+ } // namespace jtutil::
diff --git a/src/jtutil/fuzzy.cc b/src/jtutil/fuzzy.cc
index e444c30..d3e4314 100644
--- a/src/jtutil/fuzzy.cc
+++ b/src/jtutil/fuzzy.cc
@@ -11,39 +11,40 @@
//
#include <stdlib.h>
-#include <stdio.h>
#include "stdc.h"
#include "util.hh"
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//******************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
bool fuzzy<fp_t>::EQ(fp_t x, fp_t y)
{
-fp_t max_abs = max(jtutil::abs(x), jtutil::abs(y));
-fp_t epsilon = max(tolerance_, tolerance_*max_abs);
+fp_t max_abs = jtutil::max(jtutil::abs(x), jtutil::abs(y));
+fp_t epsilon = jtutil::max(tolerance_, tolerance_*max_abs);
return jtutil::abs(x-y) <= epsilon;
}
+ } // namespace jtutil::
//******************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
bool fuzzy<fp_t>::is_integer(fp_t x)
{
int i = round<fp_t>::to_integer(x);
return EQ(x, fp_t(i));
}
+ } // namespace jtutil::
//******************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
int fuzzy<fp_t>::floor(fp_t x)
{
@@ -51,9 +52,12 @@ return fuzzy<fp_t>::is_integer(x)
? round<fp_t>::to_integer(x)
: round<fp_t>::floor(x);
}
+ } // namespace jtutil::
//******************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
int fuzzy<fp_t>::ceiling(fp_t x)
{
@@ -61,6 +65,7 @@ return fuzzy<fp_t>::is_integer(x)
? round<fp_t>::to_integer(x)
: round<fp_t>::ceiling(x);
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -75,6 +80,8 @@ return fuzzy<fp_t>::is_integer(x)
// me figure out the correct syntax here!
//
+namespace jtutil
+ {
// initializations of fuzzy::tolerance for each instantation we're going to make
template <>
float fuzzy<float>::tolerance_ = 1.0e-5; // about 100 * FLT_EPSILON
@@ -85,10 +92,4 @@ template <>
// template instantiations
template class fuzzy<float>;
template class fuzzy<double>;
-
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
+ } // namespace jtutil::
diff --git a/src/jtutil/linear_map.cc b/src/jtutil/linear_map.cc
index b44b466..636675e 100644
--- a/src/jtutil/linear_map.cc
+++ b/src/jtutil/linear_map.cc
@@ -16,12 +16,7 @@
#include "stdc.h"
#include "util.hh"
#include "linear_map.hh"
-
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
+using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
@@ -32,6 +27,8 @@ namespace jtutil
//
// This function constructs a linear_map<fp_t> object.
//
+namespace jtutil
+ {
template <typename fp_t>
linear_map<fp_t>::linear_map(int min_int_in, int max_int_in,
fp_t min_fp_in, fp_t delta_fp_in, fp_t max_fp_in)
@@ -40,6 +37,7 @@ linear_map<fp_t>::linear_map(int min_int_in, int max_int_in,
{
constructor_common(min_fp_in, max_fp_in);
}
+ } // namespace jtutil::
//******************************************************************************
@@ -47,6 +45,8 @@ constructor_common(min_fp_in, max_fp_in);
// This function constructs a linear_map<fp_t> object with a subrange
// of an existing one.
//
+namespace jtutil
+ {
template <typename fp_t>
linear_map<fp_t>::linear_map(const linear_map<fp_t> &lm_in,
int min_int_in, int max_int_in) // subrange
@@ -65,6 +65,7 @@ if (! (is_in_range(min_int_in) && is_in_range(max_int_in)) )
constructor_common(lm_in.fp_of_int_unchecked(min_int_in),
lm_in.fp_of_int_unchecked(max_int_in));
}
+ } // namespace jtutil::
//******************************************************************************
@@ -72,6 +73,8 @@ constructor_common(lm_in.fp_of_int_unchecked(min_int_in),
// This function does the common argument validation and setup for
// all the constructors of class linear_map<fp_t>:: .
//
+namespace jtutil
+ {
template <typename fp_t>
void linear_map<fp_t>::constructor_common(fp_t min_fp_in, fp_t max_fp_in)
// assumes
@@ -98,6 +101,7 @@ if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in))
double(min_fp_in), double(delta_fp()), double(max_fp_in));
/*NOTREACHED*/
}
+ } // namespace jtutil::
//******************************************************************************
@@ -105,6 +109,8 @@ if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in))
// This function converts fp --> int coordinate, returning the result
// as an fp (which need not be fuzzily integral).
//
+namespace jtutil
+ {
template <typename fp_t>
fp_t linear_map<fp_t>::fp_int_of_fp(fp_t x)
const
@@ -121,6 +127,7 @@ if (! is_in_range(x))
return inverse_delta_ * (x - origin_);
}
+ } // namespace jtutil::
//******************************************************************************
@@ -133,6 +140,8 @@ return inverse_delta_ * (x - origin_);
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
// is ++ugly. :(
//
+namespace jtutil
+ {
template <typename fp_t>
int linear_map<fp_t>::int_of_fp(fp_t x, noninteger_action nia /* = nia_error */)
const
@@ -187,6 +196,7 @@ default:
return 0; // dummy return to quiet gcc
// (which doesn't grok that error_exit() never returns)
}
+ } // namespace jtutil::
//******************************************************************************
@@ -200,6 +210,8 @@ return 0; // dummy return to quiet gcc
// Having to explicitly specify the namespace for jtutil::round<fp_t>::
// is ++ugly. :(
//
+namespace jtutil
+ {
template <typename fp_t>
int linear_map<fp_t>::delta_int_of_delta_fp
(fp_t delta_x, noninteger_action nia /* = nia_error */)
@@ -259,6 +271,7 @@ default:
return 0; // dummy return to quiet gcc
// (which doesn't grok that error_exit() never returns)
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -268,12 +281,5 @@ return 0; // dummy return to quiet gcc
// ***** template instantiation *****
//
-template class linear_map<float>;
-template class linear_map<double>;
-
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
+template class jtutil::linear_map<float>;
+template class jtutil::linear_map<double>;
diff --git a/src/jtutil/linear_map.hh b/src/jtutil/linear_map.hh
index 6125a36..48c0f2d 100644
--- a/src/jtutil/linear_map.hh
+++ b/src/jtutil/linear_map.hh
@@ -26,14 +26,10 @@
//
#endif
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//*****************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
class linear_map
{
@@ -143,10 +139,8 @@ private:
// bounds (inclusive)
const int min_int_, max_int_;
};
+ } // namespace jtutil::
//******************************************************************************
- } // namespace jtutil
- } // namespace AHFinderDirect
-
#endif /* AHFINDERDIRECT__LINEAR_MAP_HH */
diff --git a/src/jtutil/make.code.defn b/src/jtutil/make.code.defn
index f9bcd04..c188744 100644
--- a/src/jtutil/make.code.defn
+++ b/src/jtutil/make.code.defn
@@ -7,17 +7,3 @@ SRCS = array.cc cpm_map.cc fuzzy.cc linear_map.cc norm.cc round.cc \
# Subdirectories containing source files
SUBDIRS =
-
-# disable automatic template instantiation on DEC Alphas cxx compiler
-ifeq ($(shell uname), OSF1)
- ifeq ($(CXX), cxx)
- CXXFLAGS += -nopt
- endif
-endif
-
-# disable automagic template instantiation on SGI Irix CC compiler
-ifneq (,$(findstring IRIX,$(shell uname)))
- ifeq ($(notdir $(CXX)), CC)
- CXXFLAGS += -no_auto_include
- endif
-endif
diff --git a/src/jtutil/miscfp.cc b/src/jtutil/miscfp.cc
index 519f7e0..87a0272 100644
--- a/src/jtutil/miscfp.cc
+++ b/src/jtutil/miscfp.cc
@@ -23,12 +23,6 @@
#include "stdc.h"
#include "util.hh"
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -37,12 +31,15 @@ namespace jtutil
// This function computes the floating point "signum" function (as in APL),
// signum(x) = -1.0, 0.0, or +1.0, according to the sign of x.
//
+namespace jtutil
+ {
double signum(double x)
{
if (x == 0.0)
then return 0.0;
else return (x > 0.0) ? 1.0 : -1.0;
}
+ } // namespace jtutil::
//******************************************************************************
@@ -61,10 +58,13 @@ if (x == 0.0)
// unwarranted IEEE exceptions if any of |x|, |y|, or |z| is close to
// the overflow and/or underflow threshold.
//
+namespace jtutil
+ {
double hypot3(double x, double y, double z)
{
return sqrt(x*x + y*y + z*z);
}
+ } // namespace jtutil::
//******************************************************************************
@@ -81,11 +81,14 @@ return sqrt(x*x + y*y + z*z);
// some real $R$, i.e. it returns the angle between the positive $x$ axis and
// the line joining the origin and the point $(x,y)$.
//
+namespace jtutil
+ {
double arctan_xy(double x, double y)
{
// note reversed argument order (y,x) in std::atan2() function
return ((x == 0.0) && (y == 0.0)) ? 0.0 : atan2(y,x);
}
+ } // namespace jtutil::
//******************************************************************************
@@ -93,6 +96,8 @@ return ((x == 0.0) && (y == 0.0)) ? 0.0 : atan2(y,x);
// This function reduces x modulo xmod to be (fuzzily) in the range
// [xmin, xmax] , or does an error_exit() if no such value exists.
//
+namespace jtutil
+ {
double modulo_reduce(double x, double xmod, double xmin, double xmax)
{
double xx = x;
@@ -108,24 +113,27 @@ double xx = x;
}
if (! (fuzzy<double>::GE(xx, xmin) && fuzzy<double>::LE(xx, xmax)) )
- then error_exit(ERROR_EXIT,
+ then jtutil::error_exit(ERROR_EXIT,
"***** modulo_reduce(): no modulo value is fuzzily within specified range!\n"
" x = %g xmod = %g\n"
" [xmin,xmax] = [%g,%g]\n"
" ==> xx = %g\n"
,
- x, xmod,
- xmin, xmax,
- xx); /*NOTREACHED*/
+ x, xmod,
+ xmin, xmax,
+ xx); /*NOTREACHED*/
return xx;
}
+ } // namespace jtutil::
//******************************************************************************
//
// This function sets a C-style array to all zeros.
//
+namespace jtutil
+ {
template <typename fp_t>
void zero_C_array(int N, fp_t array[])
{
@@ -134,6 +142,7 @@ template <typename fp_t>
array[i] = 0;
}
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -143,11 +152,7 @@ template <typename fp_t>
// ***** template instantiations *****
//
+namespace jtutil
+ {
template void zero_C_array<CCTK_REAL>(int, CCTK_REAL[]);
-
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
+ } // namespace jtutil::
diff --git a/src/jtutil/norm.cc b/src/jtutil/norm.cc
index 5c9b699..5ff72a9 100644
--- a/src/jtutil/norm.cc
+++ b/src/jtutil/norm.cc
@@ -16,12 +16,6 @@
#include "util.hh"
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//*****************************************************************************
//*****************************************************************************
//*****************************************************************************
@@ -29,6 +23,8 @@ namespace jtutil
//
// This function constructs a norm object.
//
+namespace jtutil
+ {
template <typename fp_t>
norm<fp_t>::norm()
: N_(0L),
@@ -36,12 +32,15 @@ template <typename fp_t>
max_abs_value_(0.0), min_abs_value_(0.0),
max_value_(0.0), min_value_(0.0)
{ }
+ }
//*****************************************************************************
//
// This function resets a norm object to its initial state
//
+namespace jtutil
+ {
template <typename fp_t>
void norm<fp_t>::reset()
{
@@ -53,12 +52,15 @@ min_abs_value_ = 0.0;
max_value_ = 0.0;
min_value_ = 0.0;
}
+ }
//*****************************************************************************
//
// This function updates the norms with a new data point x .
//
+namespace jtutil
+ {
template <typename fp_t>
void norm<fp_t>::data(fp_t x)
{
@@ -74,19 +76,29 @@ max_value_ = (N_ == 0) ? x : jtutil::max(max_value_, x);
++N_;
}
+ } // namespace jtutil::
//******************************************************************************
//
// these functions compute the corresponding norms
//
+namespace jtutil
+ {
template<typename fp_t>
fp_t norm<fp_t>::mean() const { return sum_/fp_t(N_); }
template<typename fp_t>
+ fp_t norm<fp_t>::std_dev() const
+ {
+ if (is_empty()) return fp_t(0);
+ return sqrt(jtutil::max(fp_t(0),fp_t(N_)*sum2_-sum_*sum_))/fp_t(N_);
+ }
+template<typename fp_t>
fp_t norm<fp_t>::two_norm() const { return sqrt(sum2_); }
template<typename fp_t>
fp_t norm<fp_t>::rms_norm() const
{ assert(is_nonempty()); return sqrt(sum2_/fp_t(N_)); }
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -98,10 +110,3 @@ template<typename fp_t>
template class jtutil::norm<float>;
template class jtutil::norm<double>;
-
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
diff --git a/src/jtutil/round.cc b/src/jtutil/round.cc
index 3c2d7e6..6559944 100644
--- a/src/jtutil/round.cc
+++ b/src/jtutil/round.cc
@@ -14,12 +14,6 @@
#include "stdc.h"
#include "util.hh"
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
-namespace jtutil
- {
-
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -35,6 +29,8 @@ namespace jtutil
//******************************************************************************
// round to nearest integer, up for exact tie
+namespace jtutil
+ {
template <typename fp_t>
int round<fp_t>::to_integer(fp_t x)
{
@@ -42,9 +38,12 @@ return (x >= 0.0)
? int(x + 0.5) // eg 3.6 --> int(4.1) = 4
: - int( (-x) + 0.5 ); // eg -3.6 --> - int(4.1) = -4
}
+ } // namespace jtutil::
//******************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
int round<fp_t>::floor(fp_t x)
{
@@ -52,9 +51,12 @@ return (x >= 0.0)
? int(x)
: - ceiling(-x);
}
+ } // namespace jtutil::
//******************************************************************************
+namespace jtutil
+ {
template <typename fp_t>
int round<fp_t>::ceiling(fp_t x)
{
@@ -62,6 +64,7 @@ return (x >= 0.0)
? int(x) + (x != fp_t(int(x)))
: - floor(-x);
}
+ } // namespace jtutil::
//******************************************************************************
//******************************************************************************
@@ -71,12 +74,5 @@ return (x >= 0.0)
// ***** template instantiations *****
//
-template class round<float>;
-template class round<double>;
-
-//******************************************************************************
-//******************************************************************************
-//******************************************************************************
-
- } // namespace jtutil
- } // namespace AHFinderDirect
+template class jtutil::round<float>;
+template class jtutil::round<double>;
diff --git a/src/jtutil/test_array.cc b/src/jtutil/test_array.cc
index 2b413c4..56c2a0c 100644
--- a/src/jtutil/test_array.cc
+++ b/src/jtutil/test_array.cc
@@ -9,8 +9,6 @@
#include "util.hh"
#include "array.hh"
-using namespace AHFinderDirect;
-
using jtutil::fuzzy;
using jtutil::array1d;
using jtutil::array2d;
diff --git a/src/jtutil/test_array2.cc b/src/jtutil/test_array2.cc
index c89e209..9015cbd 100644
--- a/src/jtutil/test_array2.cc
+++ b/src/jtutil/test_array2.cc
@@ -9,8 +9,6 @@
#include "util.hh"
#include "array.hh"
-using namespace AHFinderDirect;
-
void print( jtutil::array2d<double>& Aref);
void cprint(const jtutil::array2d<double>& Aref);
diff --git a/src/jtutil/test_cpm_map.cc b/src/jtutil/test_cpm_map.cc
index cdb5c7c..070321a 100644
--- a/src/jtutil/test_cpm_map.cc
+++ b/src/jtutil/test_cpm_map.cc
@@ -7,9 +7,6 @@
#include "stdc.h"
#include "util.hh"
#include "cpm_map.hh"
-
-using namespace AHFinderDirect;
-
using jtutil::cpm_map;
//******************************************************************************
diff --git a/src/jtutil/test_error_exit.cc b/src/jtutil/test_error_exit.cc
index fd4e170..a1b568e 100644
--- a/src/jtutil/test_error_exit.cc
+++ b/src/jtutil/test_error_exit.cc
@@ -4,8 +4,6 @@
#include <stdio.h>
#include "stdc.h"
-
-using namespace AHFinderDirect;
using jtutil::error_exit;
int main()
diff --git a/src/jtutil/test_fuzzy.cc b/src/jtutil/test_fuzzy.cc
index 3566f61..437df36 100644
--- a/src/jtutil/test_fuzzy.cc
+++ b/src/jtutil/test_fuzzy.cc
@@ -12,9 +12,6 @@
#include "stdc.h"
#include "util.hh"
-
-using namespace AHFinderDirect;
-
using jtutil::error_exit;
using jtutil::fuzzy;
diff --git a/src/jtutil/test_linear_map.cc b/src/jtutil/test_linear_map.cc
index 29b8974..f38d362 100644
--- a/src/jtutil/test_linear_map.cc
+++ b/src/jtutil/test_linear_map.cc
@@ -7,9 +7,6 @@
#include "stdc.h"
#include "util.hh"
#include "linear_map.hh"
-
-using namespace AHFinderDirect;
-
using jtutil::fuzzy;
using jtutil::linear_map;
diff --git a/src/jtutil/test_modulo.cc b/src/jtutil/test_modulo.cc
index a32ba2b..c587ea6 100644
--- a/src/jtutil/test_modulo.cc
+++ b/src/jtutil/test_modulo.cc
@@ -6,9 +6,6 @@
#include "stdc.h"
#include "util.hh"
-
-using namespace AHFinderDirect;
-
using jtutil::error_exit;
using jtutil::fuzzy;
diff --git a/src/jtutil/test_norm.cc b/src/jtutil/test_norm.cc
index 6eec312..f9c8d47 100644
--- a/src/jtutil/test_norm.cc
+++ b/src/jtutil/test_norm.cc
@@ -7,9 +7,6 @@
#include "stdc.h"
#include "util.hh"
-
-using namespace AHFinderDirect;
-
using jtutil::norm;
using jtutil::fuzzy;
diff --git a/src/jtutil/test_round.cc b/src/jtutil/test_round.cc
index dc90584..5e3354a 100644
--- a/src/jtutil/test_round.cc
+++ b/src/jtutil/test_round.cc
@@ -6,8 +6,6 @@
#include "stdc.h"
#include "util.hh"
-
-using namespace AHFinderDirect;
using jtutil::round;
//
diff --git a/src/jtutil/util.hh b/src/jtutil/util.hh
index d59485a..d3a9c1a 100644
--- a/src/jtutil/util.hh
+++ b/src/jtutil/util.hh
@@ -9,9 +9,6 @@
// "stdc.h"
//
-// everything in this file is inside these namespaces
-namespace AHFinderDirect
- {
namespace jtutil
{
@@ -102,6 +99,7 @@ class norm
public:
// get norms etc
fp_t mean() const;
+ fp_t std_dev() const; // sqrt(sum (x_i - average of x_i)^2 / N)
fp_t two_norm() const; // sqrt(sum x_i^2)
fp_t rms_norm() const; // sqrt(average of x_i^2)
fp_t infinity_norm() const { return max_abs_value_; }
@@ -211,6 +209,5 @@ public:
//******************************************************************************
} // namespace jtutil
- } // namespace AHFinderDirect
#endif /* AHFINDERDIRECT__UTIL_HH */
diff --git a/src/maple/Makefile b/src/maple/Makefile
index 8b17ffa..935bef6 100644
--- a/src/maple/Makefile
+++ b/src/maple/Makefile
@@ -1,5 +1,5 @@
# Makefile for maple code
-# $Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/maple/Makefile,v 1.4 2003-07-31 17:25:49 jthorn Exp $
+# $Header: /usr/local/svn/cvs-repositories/numrelcvs/AEIThorns/AHFinderDirect/src/maple/Makefile,v 1.4.2.1 2004-04-06 21:04:22 schnetter Exp $
#
# Environment Variables:
@@ -31,4 +31,4 @@ clean :
.PHONY : run
run : mm
- maple -f <setup.mm >maple.log
+ maple <setup.mm >maple.log
diff --git a/src/misc/README b/src/misc/README
index 3932df9..0229869 100644
--- a/src/misc/README
+++ b/src/misc/README
@@ -17,7 +17,3 @@ mpp
select.patch
This is a Perl script to extract a selected patch from a
gridfn output file.
-
-select.plane
- This is a Perl script to extract one of the xy, xz, or yz
- planes from an AH-shape data file.
diff --git a/src/misc/select.patch b/src/misc/select.patch
index b3457e5..ff09a7b 100755
--- a/src/misc/select.patch
+++ b/src/misc/select.patch
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/local/bin/perl -w
# $Header$
#
@@ -8,8 +8,7 @@
# This filter prints that part of standard input starting with a
# line of the form (eg)
# ## +z patch
-# (with any number >= 1 of # characters allowed) and continuing up to and
-# including two consecutive newlines.
+# and continuing up to and including two consecutive newlines.
#
use strict;
@@ -22,7 +21,7 @@ my $in_selected_patch = 0;
my $newline_count = 0;
while (my $line = <STDIN>)
{
- if ($line =~ /^#+ \Q${patch_name}/o)
+ if ($line =~ /^### \Q${patch_name}/o)
{ $in_selected_patch = 1; }
if ($line =~ /^\n/)
{ ++$newline_count; }
diff --git a/src/patch/coords.cc b/src/patch/coords.cc
index 828553a..1b229c2 100644
--- a/src/patch/coords.cc
+++ b/src/patch/coords.cc
@@ -33,22 +33,17 @@
#include "config.h"
#include "stdc.h"
#include "../jtutil/util.hh"
+using jtutil::error_exit;
+using jtutil::arctan_xy;
+using jtutil::signum;
+using jtutil::pow2;
+using jtutil::hypot3;
#include "coords.hh"
-// FIXME: sometimes we get assertion failures in these checks,
-// but I've never been able to track down just what's wrong
-// ==> for now, just disable them :( :(
-#undef XYZ_OF_RMNP_SIGN_CHECKS
-
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
-using jtutil::arctan_xy;
-using jtutil::signum;
-using jtutil::pow2;
-using jtutil::hypot3;
//******************************************************************************
//******************************************************************************
@@ -134,15 +129,13 @@ z = sign_z * r * temp;
x = x_over_z * z;
y = y_over_z * z;
-#ifdef XYZ_OF_RMNP_SIGN_CHECKS
-if (jtutil::fuzzy<fp>::NE(r, 0.0))
- then {
- if (jtutil::fuzzy<fp>::NE(x, 0.0))
- then assert( signum(x) == sign_x );
- if (jtutil::fuzzy<fp>::NE(y, 0.0))
- then assert( signum(y) == sign_y );
- }
-#endif
+// if (jtutil::fuzzy<fp>::NE(r, 0.0))
+// then {
+// if (jtutil::fuzzy<fp>::NE(x, 0.0))
+// then assert( signum(x) == sign_x );
+// if (jtutil::fuzzy<fp>::NE(y, 0.0))
+// then assert( signum(y) == sign_y );
+// }
}
}
@@ -179,15 +172,13 @@ y = sign_y * r * temp;
z = z_over_y * y;
x = x_over_y * y;
-#ifdef XYZ_OF_RMNP_SIGN_CHECKS
-if (jtutil::fuzzy<fp>::NE(r, 0.0))
- then {
- if (jtutil::fuzzy<fp>::NE(z, 0.0))
- then assert( signum(z) == sign_z );
- if (jtutil::fuzzy<fp>::NE(x, 0.0))
- then assert( signum(x) == sign_x );
- }
-#endif
+// if (jtutil::fuzzy<fp>::NE(r, 0.0))
+// then {
+// if (jtutil::fuzzy<fp>::NE(z, 0.0))
+// then assert( signum(z) == sign_z );
+// if (jtutil::fuzzy<fp>::NE(x, 0.0))
+// then assert( signum(x) == sign_x );
+// }
}
}
@@ -223,15 +214,13 @@ x = sign_x * r * temp;
z = z_over_x * x;
y = y_over_x * x;
-#ifdef XYZ_OF_RMNP_SIGN_CHECKS
-if (jtutil::fuzzy<fp>::NE(r, 0.0))
- then {
- if (jtutil::fuzzy<fp>::NE(z, 0.0))
- then assert( signum(z) == sign_z );
- if (jtutil::fuzzy<fp>::NE(y, 0.0))
- then assert( signum(y) == sign_y );
- }
-#endif
+// if (jtutil::fuzzy<fp>::NE(r, 0.0))
+// then {
+// if (jtutil::fuzzy<fp>::NE(z, 0.0))
+// then assert( signum(z) == sign_z );
+// if (jtutil::fuzzy<fp>::NE(y, 0.0))
+// then assert( signum(y) == sign_y );
+// }
}
}
@@ -321,7 +310,8 @@ const fp tan2_nu = pow2(tan_nu);
fp x, y, z;
xyz_of_r_mu_nu(r,mu,nu, x,y,z);
-assert( jtutil::fuzzy<fp>::NE(r, 0.0) );
+// Comment this out, accept a nan instead
+// assert( jtutil::fuzzy<fp>::NE(r, 0.0) );
const fp rinv = 1.0/r;
partial_x_wrt_r = x*rinv;
partial_y_wrt_r = y*rinv;
@@ -363,7 +353,8 @@ const fp tan2_phi_bar = pow2(tan_phi_bar);
fp x, y, z;
xyz_of_r_mu_phi(r,mu,phi, x,y,z);
-assert( jtutil::fuzzy<fp>::NE(r, 0.0) );
+// Comment this out, accept a nan instead
+// assert( jtutil::fuzzy<fp>::NE(r, 0.0) );
const fp rinv = 1.0/r;
partial_x_wrt_r = x*rinv;
partial_y_wrt_r = y*rinv;
@@ -404,7 +395,8 @@ const fp tan2_phi = pow2(tan_phi);
fp x, y, z;
xyz_of_r_nu_phi(r,nu,phi, x,y,z);
-assert( jtutil::fuzzy<fp>::NE(r, 0.0) );
+// Comment this out, accept a nan instead
+// assert( jtutil::fuzzy<fp>::NE(r, 0.0) );
const fp rinv = 1.0/r;
partial_x_wrt_r = x*rinv;
partial_y_wrt_r = y*rinv;
@@ -659,13 +651,13 @@ else if (S == coords_set_nu)
then return "nu";
else if (S == coords_set_phi)
then return "phi";
-else if (S == coords_set_mu|coords_set_nu)
+else if (S == (coords_set_mu|coords_set_nu))
then return "{mu,nu}";
-else if (S == coords_set_mu|coords_set_phi)
+else if (S == (coords_set_mu|coords_set_phi))
then return "{mu,phi}";
-else if (S == coords_set_nu|coords_set_phi)
+else if (S == (coords_set_nu|coords_set_phi))
then return "{nu,phi}";
-else if (S == coords_set_mu|coords_set_nu|coords_set_phi)
+else if (S == (coords_set_mu|coords_set_nu|coords_set_phi))
then return "{mu,nu,phi}";
else error_exit(PANIC_EXIT,
"***** local_coords::mu_nu_phi::name_of_coords_set:\n"
diff --git a/src/patch/coords.hh b/src/patch/coords.hh
index e6ca9bd..f362474 100644
--- a/src/patch/coords.hh
+++ b/src/patch/coords.hh
@@ -278,6 +278,11 @@ public:
fp origin_y() const { return origin_y_; }
fp origin_z() const { return origin_z_; }
+ // set global (x,y,z) coordinates of local origin point
+ void origin_x(const fp x) { origin_x_=x; }
+ void origin_y(const fp y) { origin_y_=y; }
+ void origin_z(const fp z) { origin_z_=z; }
+
// radius of given (x,y,z) with respect to local origin point
#ifdef NOT_USED
fp radius_of_local_xyz(fp local_x, fp local_y, fp local_z) const
diff --git a/src/patch/fd_grid.cc b/src/patch/fd_grid.cc
index 80d1e1b..48e490e 100644
--- a/src/patch/fd_grid.cc
+++ b/src/patch/fd_grid.cc
@@ -20,6 +20,7 @@
#include "../jtutil/util.hh"
#include "../jtutil/array.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -28,7 +29,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//*****************************************************************************
diff --git a/src/patch/fd_grid.hh b/src/patch/fd_grid.hh
index c750a75..9ae24c4 100644
--- a/src/patch/fd_grid.hh
+++ b/src/patch/fd_grid.hh
@@ -309,7 +309,7 @@ namespace AHFinderDirect
#define FD_GRID__ORDER4__DXX__KPM2 ( 1.0/12.0)
#define FD_GRID__ORDER4__DXX__KPM1 (16.0/12.0)
-#define FD_GRID__ORDER4__DXX__K0 (30.0/12.0)
+#define FD_GRID__ORDER4__DXX__K0 (30.0/12.0)
#define FD_GRID__ORDER4__DXX(inv_delta_x_, data_, \
irho_plus_m_, isigma_plus_m_) \
const fp data_p2 = data_(ghosted_gfn, \
diff --git a/src/patch/ghost_zone.cc b/src/patch/ghost_zone.cc
index 32c073f..985c1ca 100644
--- a/src/patch/ghost_zone.cc
+++ b/src/patch/ghost_zone.cc
@@ -34,6 +34,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -46,7 +47,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/ghost_zone.hh b/src/patch/ghost_zone.hh
index a35aa6f..22916ad 100644
--- a/src/patch/ghost_zone.hh
+++ b/src/patch/ghost_zone.hh
@@ -793,7 +793,8 @@ private:
// -------------------
// partial gridfn at y
//
- mutable int Jacobian_min_y_ipar_m_, Jacobian_max_y_ipar_m_;
+ mutable int Jacobian_min_y_ipar_m_;
+ mutable int Jacobian_max_y_ipar_m_;
// other patch's y ipar posn for a Jacobian row
// ... subscripts are (oiperp, ipar)
diff --git a/src/patch/make.code.defn b/src/patch/make.code.defn
index 15194f2..a24223f 100644
--- a/src/patch/make.code.defn
+++ b/src/patch/make.code.defn
@@ -15,17 +15,3 @@ SRCS = coords.cc \
# Subdirectories containing source files
SUBDIRS =
-
-# disable automatic template instantiation on DEC Alphas cxx compiler
-ifeq ($(shell uname), OSF1)
- ifeq ($(CXX), cxx)
- CXXFLAGS += -nopt
- endif
-endif
-
-# disable automagic template instantiation on SGI Irix CC compiler
-ifneq (,$(findstring IRIX,$(shell uname)))
- ifeq ($(notdir $(CXX)), CC)
- CXXFLAGS += -no_auto_include
- endif
-endif
diff --git a/src/patch/patch.cc b/src/patch/patch.cc
index f4305f6..6b355fd 100644
--- a/src/patch/patch.cc
+++ b/src/patch/patch.cc
@@ -43,6 +43,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -55,7 +56,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
@@ -300,7 +300,7 @@ else error_exit(PANIC_EXIT,
" which is a multiple of 90 degrees!\n"
" %s patch: [min,max]_dsigma()=[%g,%g]\n"
,
- name(), min_dsigma(), max_dsigma());
+ name(), double(min_dsigma()), double(max_dsigma()));
const fp sigma = sigma_of_dsigma(dsigma);
const int isigma = isigma_of_sigma(sigma);
@@ -371,7 +371,7 @@ else error_exit(PANIC_EXIT,
" which is a multiple of 90 degrees!\n"
" %s patch: [min,max]_drho()=[%g,%g]\n"
,
- name(), min_drho(), max_drho());
+ name(), double(min_drho()), double(max_drho()));
const fp rho = rho_of_drho(drho);
const int irho = irho_of_rho(rho);
@@ -611,6 +611,57 @@ fp sum = 0.0;
return delta_rho() * delta_sigma() * sum;
}
+fp patch::integrate_gridpoint(int unknown_src_gfn,
+ int ghosted_radius_gfn,
+ int g_xx_gfn, int g_xy_gfn, int g_xz_gfn,
+ int g_yy_gfn, int g_yz_gfn,
+ int g_zz_gfn,
+ enum integration_method method,
+ int irho, int isigma)
+ const
+{
+const bool src_is_ghosted = is_valid_ghosted_gfn(unknown_src_gfn);
+
+const fp fn = unknown_gridfn(src_is_ghosted,
+ unknown_src_gfn, irho,isigma);
+
+const fp rho = rho_of_irho (irho);
+const fp sigma = sigma_of_isigma(isigma);
+const fp r = ghosted_gridfn(ghosted_radius_gfn, irho,isigma);
+const fp partial_surface_r_wrt_rho
+ = partial_rho (ghosted_radius_gfn, irho,isigma);
+const fp partial_surface_r_wrt_sigma
+ = partial_sigma(ghosted_radius_gfn, irho,isigma);
+
+const fp g_xx = gridfn(g_xx_gfn, irho,isigma);
+const fp g_xy = gridfn(g_xy_gfn, irho,isigma);
+const fp g_xz = gridfn(g_xz_gfn, irho,isigma);
+const fp g_yy = gridfn(g_yy_gfn, irho,isigma);
+const fp g_yz = gridfn(g_yz_gfn, irho,isigma);
+const fp g_zz = gridfn(g_zz_gfn, irho,isigma);
+
+fp g_rho_rho, g_rho_sigma, g_sigma_sigma;
+const fp Jac = rho_sigma_metric(r, rho, sigma,
+ partial_surface_r_wrt_rho,
+ partial_surface_r_wrt_sigma,
+ g_xx, g_xy, g_xz,
+ g_yy, g_yz,
+ g_zz,
+ g_rho_rho, g_rho_sigma,
+ g_sigma_sigma);
+
+const fp coeff_rho = integration_coeff(method,
+ max_irho()-min_irho(),
+ irho -min_irho());
+const fp coeff_sigma = integration_coeff(method,
+ max_isigma()-min_isigma(),
+ isigma -min_isigma());
+
+const fp val = coeff_rho*coeff_sigma * fn * sqrt(jtutil::abs(Jac));
+
+return delta_rho() * delta_sigma() * val;
+}
+
//******************************************************************************
//
diff --git a/src/patch/patch.hh b/src/patch/patch.hh
index d18c53c..6482154 100644
--- a/src/patch/patch.hh
+++ b/src/patch/patch.hh
@@ -416,6 +416,15 @@ public:
enum integration_method method)
const;
+ fp integrate_gridpoint(int unknown_src_gfn,
+ int ghosted_radius_gfn,
+ int g_xx_gfn, int g_xy_gfn, int g_xz_gfn,
+ int g_yy_gfn, int g_yz_gfn,
+ int g_zz_gfn,
+ enum integration_method method,
+ int irho, int isigma)
+ const;
+
// compute integration coefficient $c_i$ where
// $\int_{x_0}^{x_N} f(x) \, dx
// \approx \Delta x \, \sum_{i=0}^N c_i f(x_i)$
diff --git a/src/patch/patch_info.cc b/src/patch/patch_info.cc
index 002b63b..c293cf6 100644
--- a/src/patch/patch_info.cc
+++ b/src/patch/patch_info.cc
@@ -19,6 +19,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -27,7 +28,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/patch_interp.cc b/src/patch/patch_interp.cc
index 580ad3f..a7ac765 100644
--- a/src/patch/patch_interp.cc
+++ b/src/patch/patch_interp.cc
@@ -26,6 +26,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -38,7 +39,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//*****************************************************************************
//*****************************************************************************
@@ -306,9 +306,9 @@ if ( MSS_is_fn_of_interp_coords || MSS_is_fn_of_input_array_values
" MSS_is_fn_of_input_array_values=(int)%d (we only grok 0)\n"
" Jacobian_is_fn_of_input_array_values=(int)%d (we only grok 0)\n"
,
- MSS_is_fn_of_interp_coords,
- MSS_is_fn_of_input_array_values,
- Jacobian_is_fn_of_input_array_values); /*NOTREACHED*/
+ int(MSS_is_fn_of_interp_coords),
+ int(MSS_is_fn_of_input_array_values),
+ int(Jacobian_is_fn_of_input_array_values)); /*NOTREACHED*/
}
//******************************************************************************
diff --git a/src/patch/patch_system.cc b/src/patch/patch_system.cc
index 98974e6..bbd29f7 100644
--- a/src/patch/patch_system.cc
+++ b/src/patch/patch_system.cc
@@ -30,6 +30,8 @@
//
// patch_system::set_gridfn_to_constant
// patch_system::gridfn_copy
+// patch_system::ghosted_gridfn_copy
+// patch_system::add_to_gridfn
// patch_system::add_to_ghosted_gridfn
// patch_system::gridfn_norms
// patch_system::ghosted_gridfn_norms
@@ -39,9 +41,11 @@
//
// patch_system::patch_containing_local_xyz
// patch_system::radius_in_local_xyz_direction
+// patch_system::radii_in_local_xyz_directions
//
// patch_system::print_unknown_gridfn
// patch_system::read_unknown_gridfn
+// patch_system::output_unknown_gridfn
//
// patch_system::synchronize
// patch_system::compute_synchronize_Jacobian
@@ -51,20 +55,37 @@
/// patch_system::ghost_zone_Jacobian
//
+#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <vector>
+#include <sstream>
+#include <string>
#include "cctk.h"
+#include "CactusBase/IOUtil/src/ioGH.h"
#include "config.h"
#include "stdc.h"
+#include "../gr/gfns.hh"
#include "../jtutil/util.hh"
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
+
+#ifdef CCTK_HDF5
+// Some macros to fix compatibility issues as long as 1.8.0 is in beta
+// phase
+# define H5_USE_16_API 1
+# include <hdf5.h>
+#endif
#include "coords.hh"
#include "grid.hh"
@@ -80,7 +101,6 @@
// all the code in this file is inside this namespace
namespace AHFinderDirect
{
-using jtutil::error_exit;
//******************************************************************************
//******************************************************************************
@@ -325,12 +345,13 @@ delete[] ghosted_gridfn_storage_;
delete[] gridfn_storage_;
delete[] ghosted_starting_gpn_;
delete[] starting_gpn_;
-delete[] all_patches_;
for (int pn = N_patches()-1 ; pn >= 0 ; --pn)
{
delete &ith_patch(pn);
}
+
+delete[] all_patches_;
}
//******************************************************************************
@@ -342,6 +363,8 @@ delete[] all_patches_;
// of this patch system. This function also correctly sets
// N_grid_points_
// N_ghosted_grid_points_
+// max_N_additional_points_
+// N_additional_points_
// all_patches_[]
// starting_gpn_[]
// ghosted_starting_gpn_[]
@@ -353,6 +376,9 @@ void patch_system::create_patches(const struct patch_info patch_info_in[],
int N_zones_per_right_angle,
bool print_msg_flag)
{
+max_N_additional_points_ = 1;
+// N_additional_points_ = 0;
+N_additional_points_ = 1;
N_grid_points_ = 0;
ghosted_N_grid_points_ = 0;
for (int pn = 0 ; pn < N_patches() ; ++pn)
@@ -461,8 +487,8 @@ const int N_gridfns_in = jtutil::how_many_in_range(min_gfn_in, max_gfn_in);
const int ghosted_N_gridfns_in
= jtutil::how_many_in_range(ghosted_min_gfn_in, ghosted_max_gfn_in);
-const int gfn_stride = N_grid_points();
-const int ghosted_gfn_stride = ghosted_N_grid_points();
+const int gfn_stride = N_grid_points() + max_N_additional_points();
+const int ghosted_gfn_stride = ghosted_N_grid_points() + max_N_additional_points();
const int N_storage = gfn_stride * N_gridfns_in;
const int ghosted_N_storage = ghosted_gfn_stride * ghosted_N_gridfns_in;
@@ -531,7 +557,7 @@ const patch& plast = ith_patch(N_patches()-1);
const fp* const gfn1_first_ptr
= & pfirst.gridfn(gfn+1, pfirst.min_irho(),
pfirst.min_isigma());
- if (! (gfn1_first_ptr == gfn_last_ptr+1))
+ if (! (gfn1_first_ptr == gfn_last_ptr+max_N_additional_points()+1))
then error_exit(PANIC_EXIT,
"***** patch_system::setup_gridfn_storage():\n"
" nominal-grid gridfns don't partition overall storage array!"
@@ -561,7 +587,7 @@ const patch& plast = ith_patch(N_patches()-1);
= & pfirst.ghosted_gridfn(ghosted_gfn+1,
pfirst.ghosted_min_irho(),
pfirst.ghosted_min_isigma());
- if (! (ghosted_gfn1_first_ptr == ghosted_gfn_last_ptr+1))
+ if (! (ghosted_gfn1_first_ptr == ghosted_gfn_last_ptr+max_N_additional_points()+1))
then error_exit(PANIC_EXIT,
"***** patch_system::setup_gridfn_storage():\n"
" ghosted-grid gridfns don't partition overall storage array!"
@@ -635,7 +661,7 @@ const patch& plast = ith_patch(N_patches()-1);
if (! (p1_first_ptr == p_last_ptr+1))
then error_exit(PANIC_EXIT,
"***** patch_system::setup_gridfn_storage():\n"
-" nominal-grid patches gridfns don't partition storage for gfn=%d!\n"
+" ghosted-grid patches gridfns don't partition storage for gfn=%d!\n"
" (this should never happen!)\n"
" %s patch (pn=%d) last point at p_last_ptr=%p\n"
" %s patch (pn=%d) first point at p1_first_ptr=%p\n"
@@ -1489,6 +1515,29 @@ void patch_system::set_gridfn_to_constant(fp a, int dst_gfn)
//******************************************************************************
//
+// This function sets a ghosted gridfn to a constant value.
+//
+void patch_system::set_ghosted_gridfn_to_constant(fp a, int ghosted_dst_gfn)
+{
+ for (int pn = 0 ; pn < N_patches() ; ++pn)
+ {
+ patch& p = ith_patch(pn);
+ for (int irho = p.ghosted_min_irho() ;
+ irho <= p.ghosted_max_irho() ; ++irho)
+ {
+ for (int isigma = p.ghosted_min_isigma() ;
+ isigma <= p.ghosted_max_isigma() ;
+ ++isigma)
+ {
+ p.ghosted_gridfn(ghosted_dst_gfn, irho,isigma) = a;
+ }
+ }
+ }
+}
+
+//******************************************************************************
+
+//
// This function copies one (nominal-grid) gridfn to another.
//
void patch_system::gridfn_copy(int src_gfn, int dst_gfn)
@@ -1511,6 +1560,78 @@ void patch_system::gridfn_copy(int src_gfn, int dst_gfn)
//******************************************************************************
//
+// This function copies one ghosted gridfn to another.
+//
+void patch_system::ghosted_gridfn_copy(int ghosted_src_gfn,
+ int ghosted_dst_gfn)
+{
+ for (int pn = 0 ; pn < N_patches() ; ++pn)
+ {
+ patch& p = ith_patch(pn);
+ for (int irho = p.ghosted_min_irho() ;
+ irho <= p.ghosted_max_irho() ; ++irho)
+ {
+ for (int isigma = p.ghosted_min_isigma() ;
+ isigma <= p.ghosted_max_isigma() ;
+ ++isigma)
+ {
+ p.ghosted_gridfn(ghosted_dst_gfn, irho,isigma)
+ = p.ghosted_gridfn(ghosted_src_gfn, irho,isigma);
+ }
+ }
+ }
+}
+
+//******************************************************************************
+
+//
+// This function copies a ghosted gridfn to a nominal gridfn.
+//
+void patch_system::ghosted_gridfn_copy_to_nominal(int ghosted_src_gfn,
+ int dst_gfn)
+{
+ for (int pn = 0 ; pn < N_patches() ; ++pn)
+ {
+ patch& p = ith_patch(pn);
+ for (int irho = p.min_irho() ; irho <= p.max_irho() ; ++irho)
+ {
+ for (int isigma = p.min_isigma() ; isigma <= p.max_isigma() ;
+ ++isigma)
+ {
+ p.gridfn(dst_gfn, irho,isigma)
+ = p.ghosted_gridfn(ghosted_src_gfn, irho,isigma);
+ }
+ }
+ }
+}
+
+//******************************************************************************
+
+//
+// This function adds a scalar to a (nominal-grid) gridfn.
+//
+void patch_system::add_to_gridfn(fp delta, int dst_gfn)
+{
+ for (int pn = 0 ; pn < N_patches() ; ++pn)
+ {
+ patch& p = ith_patch(pn);
+ for (int irho = p.min_irho() ;
+ irho <= p.max_irho() ;
+ ++irho)
+ {
+ for (int isigma = p.min_isigma() ;
+ isigma <= p.max_isigma() ;
+ ++isigma)
+ {
+ p.gridfn(dst_gfn, irho,isigma) += delta;
+ }
+ }
+ }
+}
+
+//******************************************************************************
+
+//
// This function adds a scalar to a ghosted gridfn.
//
void patch_system::add_to_ghosted_gridfn(fp delta, int ghosted_dst_gfn)
@@ -1535,6 +1656,30 @@ void patch_system::add_to_ghosted_gridfn(fp delta, int ghosted_dst_gfn)
//******************************************************************************
//
+// This function scales a ghosted gridfn with a scalar.
+//
+void patch_system::scale_ghosted_gridfn(fp factor, int ghosted_dst_gfn)
+{
+ for (int pn = 0 ; pn < N_patches() ; ++pn)
+ {
+ patch& p = ith_patch(pn);
+ for (int irho = p.ghosted_min_irho() ;
+ irho <= p.ghosted_max_irho() ;
+ ++irho)
+ {
+ for (int isigma = p.ghosted_min_isigma() ;
+ isigma <= p.ghosted_max_isigma() ;
+ ++isigma)
+ {
+ p.ghosted_gridfn(ghosted_dst_gfn, irho,isigma) *= factor;
+ }
+ }
+ }
+}
+
+//******************************************************************************
+
+//
// This function computes norms of a nominal-grid gridfn.
//
void patch_system::gridfn_norms(int src_gfn, jtutil::norm<fp>& norms)
@@ -1757,6 +1902,69 @@ default:
return integral;
}
+fp patch_system::integrate_gridpoint(int unknown_src_gfn,
+ int ghosted_radius_gfn,
+ int g_xx_gfn, int g_xy_gfn, int g_xz_gfn,
+ int g_yy_gfn, int g_yz_gfn,
+ int g_zz_gfn,
+ enum patch::integration_method method,
+ int pn, int irho, int isigma)
+ const
+{
+const patch& p = ith_patch(pn);
+const fp val = p.integrate_gridpoint(unknown_src_gfn,
+ ghosted_radius_gfn,
+ g_xx_gfn, g_xy_gfn, g_xz_gfn,
+ g_yy_gfn, g_yz_gfn,
+ g_zz_gfn,
+ method,
+ irho, isigma);
+
+return val;
+}
+fp patch_system::integrate_correction(bool src_gfn_is_even_across_xy_plane,
+ bool src_gfn_is_even_across_xz_plane,
+ bool src_gfn_is_even_across_yz_plane)
+ const
+{
+fp integral = 1.0;
+//
+// correct the integral
+// for the fact that the patch system may not cover the full 2-sphere
+//
+switch (type())
+ {
+case patch_system__full_sphere:
+ break;
+case patch_system__plus_z_hemisphere:
+ integral *= src_gfn_is_even_across_xy_plane ? 2.0 : 0.0;
+ break;
+case patch_system__plus_xy_quadrant_mirrored:
+case patch_system__plus_xy_quadrant_rotating:
+ integral *= src_gfn_is_even_across_xz_plane ? 2.0 : 0.0;
+ integral *= src_gfn_is_even_across_yz_plane ? 2.0 : 0.0;
+ break;
+case patch_system__plus_xz_quadrant_mirrored:
+case patch_system__plus_xz_quadrant_rotating:
+ integral *= src_gfn_is_even_across_xy_plane ? 2.0 : 0.0;
+ integral *= src_gfn_is_even_across_yz_plane ? 2.0 : 0.0;
+ break;
+case patch_system__plus_xyz_octant_mirrored:
+case patch_system__plus_xyz_octant_rotating:
+ integral *= src_gfn_is_even_across_xy_plane ? 2.0 : 0.0;
+ integral *= src_gfn_is_even_across_xz_plane ? 2.0 : 0.0;
+ integral *= src_gfn_is_even_across_yz_plane ? 2.0 : 0.0;
+ break;
+default:
+ error_exit(PANIC_EXIT,
+"***** patch_system::integrate_gridfn(): bad patch system type()=(int)%d!\n"
+" (this should never happen!)\n",
+ int(type())); /*NOTREACHED*/
+ }
+
+return integral;
+}
+
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -1814,7 +2022,6 @@ else error_exit(ERROR_EXIT,
// patch-system symmetries. If the point coincides with the local origin,
// we return the dummy value 1.0.
//
-// Bugs:
// Due to the surface-interpolator overhead, repeatedly calling this
// function is rather inefficient.
//
@@ -1940,13 +2147,177 @@ if (status < 0)
,
status,
double(x), double(y), double(z),
- p.name(), rho, sigma,
+ p.name(), double(rho), double(sigma),
double(p.drho_of_rho(rho)),
double(p.dsigma_of_sigma(sigma))); /*NOTREACHED*/
return xyz_radius;
}
+struct perpatch {
+ std::vector<int> n;
+ std::vector<fp> rho, sigma;
+ std::vector<fp> radii;
+ void reserve (int const npoints)
+ {
+ n.reserve (npoints);
+ rho.reserve (npoints);
+ sigma.reserve (npoints);
+ radii.reserve (npoints);
+ }
+ void addpoint (int const n_, fp const rho_, fp const sigma_)
+ {
+ n .push_back (n_);
+ rho .push_back (rho_);
+ sigma.push_back (sigma_);
+ radii.push_back (fp (0.0));
+ }
+};
+
+void patch_system::radii_in_local_xyz_directions(int const ghosted_radius_gfn,
+ int const npoints,
+ fp const * const xp,
+ fp const * const yp,
+ fp const * const zp,
+ fp * const radii)
+ const
+{
+ std::vector<perpatch> patchpoints (N_patches());
+ for (int pn=0; pn<N_patches(); ++pn) {
+ patchpoints.at(pn).reserve (npoints);
+ }
+
+ for (int n=0; n<npoints; ++n) {
+ fp x = xp[n];
+ fp y = yp[n];
+ fp z = zp[n];
+
+ if ((x == 0.0) && (y == 0.0) && (z == 0.0)) {
+ radii[n] = 1.0;
+ } else {
+ //
+ // apply symmetries to map (x,y,z) into that part of the
+ // 2-sphere which is covered by the patch system
+ //
+ switch (type())
+ {
+ case patch_system__full_sphere:
+ break;
+ case patch_system__plus_z_hemisphere:
+ z = fabs(z);
+ break;
+ case patch_system__plus_xy_quadrant_mirrored:
+ case patch_system__plus_xy_quadrant_rotating:
+ x = fabs(x);
+ y = fabs(y);
+ break;
+ case patch_system__plus_xz_quadrant_mirrored:
+ case patch_system__plus_xz_quadrant_rotating:
+ x = fabs(x);
+ z = fabs(z);
+ break;
+ case patch_system__plus_xyz_octant_mirrored:
+ case patch_system__plus_xyz_octant_rotating:
+ x = fabs(x);
+ y = fabs(y);
+ z = fabs(z);
+ break;
+ default:
+ error_exit(PANIC_EXIT,
+"***** patch_system::radii_in_local_xyz_directions():\n"
+" unknown patch system type()=(int)%d!\n"
+" (this should never happen!)\n",
+ int(type())); /*NOTREACHED*/
+ }
+
+ const patch* p_ptr = patch_containing_local_xyz(x, y, z);
+ if (p_ptr == NULL)
+ then error_exit(ERROR_EXIT,
+"***** patch_system::radius_in_local_xyz_direction():\n"
+" can't find containing patch!\n"
+" (this should never happen!)\n"
+" [local] (x,y,z)=(%g,%g,%g)\n"
+ ,
+ double(x), double(y), double(z)); /*NOTREACHED*/
+
+ const patch& p = *p_ptr;
+ const fp rho = p. rho_of_xyz(x,y,z);
+ const fp sigma = p.sigma_of_xyz(x,y,z);
+
+ patchpoints.at(p.patch_number()).addpoint (n, rho, sigma);
+ }
+ } // for n
+
+ for (int pn=0; pn<N_patches(); ++pn) {
+ const patch& p = ith_patch(pn);
+ perpatch& localpatchpoints = patchpoints.at(pn);
+
+ // Set up the surface interpolator to interpolate the surface
+ // radius gridfn to the (rho,sigma) coordinates:
+ //
+ // Notes on the interpolator setup:
+ // * The interpolator assumes Fortran subscripting, so we take the
+ // coordinates in the order (sigma,rho) to match our C
+ // subscripting in the patch system.
+ // * To avoid having to set up min/max array subscripts in the
+ // parameter table, we treat the patch as using 0-origin
+ // (integer) array subscripts (irho - ghosted_min_irho(), isigma
+ // - ghosted_min_isigma()). However, we use the usual
+ // floating-point coordinates.
+ //
+
+ const int N_dims = 2;
+ const CCTK_REAL coord_origin[N_dims]
+ = { p.ghosted_min_sigma(), p.ghosted_min_rho() };
+ const CCTK_REAL coord_delta[N_dims]
+ = { p.delta_sigma(), p.delta_rho() };
+
+ const int N_interp_points = localpatchpoints.radii.size();
+ const int interp_coords_type_code = CCTK_VARIABLE_REAL;
+ const void* const interp_coords[N_dims]
+ = { static_cast<const void*>(& localpatchpoints.sigma.front()),
+ static_cast<const void*>(& localpatchpoints.rho .front()) };
+
+ const int N_input_arrays = 1;
+ const CCTK_INT input_array_dims[N_dims]
+ = { p.ghosted_N_isigma(), p.ghosted_N_irho() };
+ const CCTK_INT input_array_type_codes[N_input_arrays]
+ = { CCTK_VARIABLE_REAL };
+ const void* const input_arrays[N_input_arrays]
+ = { static_cast<const void*>
+ (p.ghosted_gridfn_data_array(ghosted_radius_gfn)) };
+
+ const int N_output_arrays = 1;
+ const CCTK_INT output_array_type_codes[N_output_arrays]
+ = { CCTK_VARIABLE_REAL };
+ void* const output_arrays[N_output_arrays]
+ = { static_cast<void*>(& localpatchpoints.radii.front()) };
+
+ const int status = CCTK_InterpLocalUniform
+ (N_dims,
+ surface_interp_handle_,
+ surface_interp_par_table_handle_,
+ coord_origin, coord_delta,
+ N_interp_points,
+ interp_coords_type_code, interp_coords,
+ N_input_arrays,
+ input_array_dims, input_array_type_codes, input_arrays,
+ N_output_arrays,
+ output_array_type_codes, output_arrays);
+ if (status < 0)
+ then error_exit(ERROR_EXIT,
+"***** patch_system::radii_in_local_xyz_directions():\n"
+" error return (status=%d) from surface interpolator!\n"
+ ,
+ status); /*NOTREACHED*/
+
+ for (size_t nn=0; nn<localpatchpoints.radii.size(); ++nn) {
+ radii[localpatchpoints.n.at(nn)] = localpatchpoints.radii.at(nn);
+ }
+
+ } // for p
+}
+
//******************************************************************************
//******************************************************************************
//******************************************************************************
@@ -2034,8 +2405,9 @@ fprintf(output_fp, "\n");
const fp dpy = p.dpy_of_rho_sigma(rho, sigma);
fprintf(output_fp,
"%g\t%g\t%#.15g",
- dpx, dpy, p.unknown_gridfn(ghosted_flag,
- unknown_gfn, irho,isigma));
+ double(dpx), double(dpy),
+ double(p.unknown_gridfn(ghosted_flag,
+ unknown_gfn, irho,isigma)));
if (print_xyz_flag)
then {
const fp r = p.unknown_gridfn(radius_is_ghosted_flag,
@@ -2049,7 +2421,8 @@ fprintf(output_fp, "\n");
const fp global_z = origin_z() + local_z;
fprintf(output_fp,
"\t%#.10g\t%#.10g\t%#.10g",
- global_x, global_y, global_z);
+ double(global_x), double(global_y),
+ double(global_z));
}
fprintf(output_fp, "\n");
}
@@ -2122,12 +2495,13 @@ int line_number = 1;
" dpx=%g dpy=%g\n"
,
p.name(), unknown_gfn,
- irho, p.effective_min_irho(want_ghost_zones),
- p.effective_max_irho(want_ghost_zones),
- isigma,
+ int(irho),
+ p.effective_min_irho(want_ghost_zones),
+ p.effective_max_irho(want_ghost_zones),
+ int(isigma),
p.effective_min_isigma(want_ghost_zones),
p.effective_max_isigma(want_ghost_zones),
- dpx, dpy); /*NOTREACHED*/
+ double(dpx), double(dpy)); /*NOTREACHED*/
++line_number;
} while ((buffer[0] == '#') || (buffer[0] == '\n'));
@@ -2150,8 +2524,8 @@ int line_number = 1;
,
p.name(), unknown_gfn,
line_number,
- dpx, dpy,
- read_dpx, read_dpy); /*NOTREACHED*/
+ double(dpx), double(dpy),
+ double(read_dpx), double(read_dpy)); /*NOTREACHED*/
p.unknown_gridfn(ghosted_flag,
unknown_gfn, irho,isigma) = read_gridfn_value;
@@ -2164,6 +2538,298 @@ fclose(input_fp);
}
//******************************************************************************
+
+#ifdef CCTK_HDF5
+
+static void WriteAttribute (const hid_t dataset, const char* name, char value);
+static void WriteAttribute (const hid_t dataset, const char* name, const char* values);
+static void WriteAttribute (const hid_t dataset, const char* name, const char* values, int nvalues);
+
+static void WriteAttribute (const hid_t dataset, const char* const name, const char value)
+{
+ WriteAttribute (dataset, name, &value, 1);
+}
+
+static void WriteAttribute (const hid_t dataset, const char* const name, const char* const values)
+{
+ WriteAttribute (dataset, name, values, strlen(values));
+}
+
+static void WriteAttribute (const hid_t dataset, const char* const name, const char* const values, const int nvalues)
+{
+ assert (dataset>=0);
+ assert (name);
+ assert (values);
+ assert (nvalues>=0);
+
+ herr_t herr;
+
+ const hid_t dataspace = H5Screate (H5S_SCALAR);
+ assert (dataspace>=0);
+
+ const hid_t datatype = H5Tcopy (H5T_C_S1);
+ assert (datatype>=0);
+ herr = H5Tset_size (datatype, nvalues);
+ assert (!herr);
+
+ const hid_t attribute = H5Acreate (dataset, name, datatype, dataspace, H5P_DEFAULT);
+ assert (attribute>=0);
+ herr = H5Awrite (attribute, datatype, values);
+ assert (!herr);
+ herr = H5Aclose (attribute);
+ assert (!herr);
+
+ herr = H5Tclose (datatype);
+ assert (!herr);
+
+ herr = H5Sclose (dataspace);
+ assert (!herr);
+}
+
+#endif
+
+//
+// This function output an unknown-grid gridfn in HDF5 format to a
+// named output file.
+//
+void patch_system::output_unknown_gridfn
+ (bool ghosted_flag, int unknown_gfn,
+ const char gfn_name[], const cGH *cctkGH,
+ bool output_xyz_flag, bool radius_is_ghosted_flag,
+ int unknown_radius_gfn,
+ const char output_file_name[], bool want_ghost_zones)
+ const
+{
+if (want_ghost_zones && !ghosted_flag)
+ then error_exit(PANIC_EXIT,
+"***** patch_system::output_unknown_gridfn(unknown_gfn=%d):\n"
+" can't have want_ghost_zones && !ghosted_flag !\n"
+,
+ unknown_gfn); /*NOTREACHED*/
+if (want_ghost_zones && output_xyz_flag && !radius_is_ghosted_flag)
+ then error_exit(PANIC_EXIT,
+"***** patch_system::output_unknown_gridfn(unknown_gfn=%d):\n"
+" can't have want_ghost_zones && output_xyz_flag\n"
+" && !radius_is_ghosted_flag!\n"
+" unknown_radius_gfn=%d\n"
+,
+ unknown_gfn,
+ unknown_radius_gfn); /*NOTREACHED*/
+
+#ifdef CCTK_HDF5
+
+ using std::ostringstream;
+ using std::string;
+ using std::vector;
+
+ herr_t herr;
+
+ hid_t writer;
+
+ // Get grid hierarchy extentsion from IOUtil
+ const ioGH * const iogh = (const ioGH *)CCTK_GHExtension (cctkGH, "IO");
+ assert (iogh);
+
+ struct stat fileinfo;
+ if (! iogh->recovered || stat(output_file_name, &fileinfo) != 0) {
+ writer = H5Fcreate (output_file_name, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ } else {
+ writer = H5Fopen (output_file_name, H5F_ACC_RDWR, H5P_DEFAULT);
+ }
+ assert (writer >= 0);
+
+ hid_t datatype;
+ if (sizeof(fp) == sizeof(float)) {
+ datatype = H5T_NATIVE_FLOAT;
+ } else if (sizeof(fp) == sizeof(double)) {
+ datatype = H5T_NATIVE_DOUBLE;
+ } else if (sizeof(fp) == sizeof(long double)) {
+ datatype = H5T_NATIVE_LDOUBLE;
+ } else {
+ assert (0);
+ }
+ assert (datatype >= 0);
+
+ for (int pn=0; pn<N_patches(); ++pn) {
+ const patch& p = ith_patch(pn);
+
+ hsize_t shape[2];
+ shape[0] = p.effective_N_isigma(want_ghost_zones);
+ shape[1] = p.effective_N_irho(want_ghost_zones);
+
+ hid_t dataspace = H5Screate_simple (2, shape, NULL);
+ assert (dataspace >= 0);
+
+
+
+ ostringstream datasetnamebuf;
+ datasetnamebuf << gfn_name
+ << " it=" << cctkGH->cctk_iteration
+ << " patch=" << pn;
+ string datasetnamestr = datasetnamebuf.str();
+ assert (datasetnamestr.size() <= 256); // limit dataset name length
+ const char * const datasetname = datasetnamestr.c_str();
+ assert (datasetname);
+
+ ostringstream datasetnamebufx;
+ datasetnamebufx << "x"
+ << " it=" << cctkGH->cctk_iteration
+ << " patch=" << pn;
+ string datasetnamestrx = datasetnamebufx.str();
+ assert (datasetnamestrx.size() <= 256); // limit dataset name length
+ const char * const datasetnamex = datasetnamestrx.c_str();
+ assert (datasetnamex);
+
+ ostringstream datasetnamebufy;
+ datasetnamebufy << "y"
+ << " it=" << cctkGH->cctk_iteration
+ << " patch=" << pn;
+ string datasetnamestry = datasetnamebufy.str();
+ assert (datasetnamestry.size() <= 256); // limit dataset name length
+ const char * const datasetnamey = datasetnamestry.c_str();
+ assert (datasetnamey);
+
+ ostringstream datasetnamebufz;
+ datasetnamebufz << "z"
+ << " it=" << cctkGH->cctk_iteration
+ << " patch=" << pn;
+ string datasetnamestrz = datasetnamebufz.str();
+ assert (datasetnamestrz.size() <= 256); // limit dataset name length
+ const char * const datasetnamez = datasetnamestrz.c_str();
+ assert (datasetnamez);
+
+
+
+ hid_t dataset = H5Dcreate (writer, datasetname, datatype, dataspace, H5P_DEFAULT);
+ assert (dataset >= 0);
+
+ hid_t datasetx;
+ hid_t datasety;
+ hid_t datasetz;
+ if (output_xyz_flag) {
+
+ datasetx = H5Dcreate (writer, datasetnamex, datatype, dataspace, H5P_DEFAULT);
+ assert (datasetx >= 0);
+
+ datasety = H5Dcreate (writer, datasetnamey, datatype, dataspace, H5P_DEFAULT);
+ assert (datasety >= 0);
+
+ datasetz = H5Dcreate (writer, datasetnamez, datatype, dataspace, H5P_DEFAULT);
+ assert (datasetz >= 0);
+
+ } // if output_xyf_flag
+
+
+
+ vector<fp> tmpdata;
+ vector<fp> tmpx, tmpy, tmpz;
+ tmpdata.resize (shape[0] * shape[1]);
+ if (output_xyz_flag) {
+ tmpx.resize (shape[0] * shape[1]);
+ tmpy.resize (shape[0] * shape[1]);
+ tmpz.resize (shape[0] * shape[1]);
+ }
+
+ int elt = 0;
+ for (int irho = p.effective_min_irho(want_ghost_zones);
+ irho <= p.effective_max_irho(want_ghost_zones);
+ ++irho)
+ {
+ for (int isigma = p.effective_min_isigma(want_ghost_zones);
+ isigma <= p.effective_max_isigma(want_ghost_zones);
+ ++isigma)
+ {
+
+ tmpdata.at(elt) = p.unknown_gridfn (ghosted_flag, unknown_gfn, irho,isigma);
+ if (output_xyz_flag) {
+ const fp r = p.unknown_gridfn(radius_is_ghosted_flag,
+ unknown_radius_gfn,
+ irho,isigma);
+ const fp rho = p.rho_of_irho(irho);
+ const fp sigma = p.sigma_of_isigma(isigma);
+ fp local_x, local_y, local_z;
+ p.xyz_of_r_rho_sigma(r,rho,sigma,
+ local_x,local_y,local_z);
+ const fp global_x = origin_x() + local_x;
+ const fp global_y = origin_y() + local_y;
+ const fp global_z = origin_z() + local_z;
+ tmpx.at(elt) = global_x;
+ tmpy.at(elt) = global_y;
+ tmpz.at(elt) = global_z;
+ }
+ ++elt;
+
+ }
+ }
+
+
+
+ herr = H5Dwrite (dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmpdata.front());
+ assert (! herr);
+
+ WriteAttribute (dataset, "name", gfn_name);
+
+ herr = H5Dclose (dataset);
+ assert (! herr);
+
+
+
+ if (output_xyz_flag) {
+
+ herr = H5Dwrite (datasetx, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmpx.front());
+ assert (! herr);
+
+ WriteAttribute (datasetx, "name", "x");
+
+ herr = H5Dclose (datasetx);
+ assert (! herr);
+
+
+
+ herr = H5Dwrite (datasety, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmpy.front());
+ assert (! herr);
+
+ WriteAttribute (datasety, "name", "y");
+
+ herr = H5Dclose (datasety);
+ assert (! herr);
+
+
+
+ herr = H5Dwrite (datasetz, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, &tmpz.front());
+ assert (! herr);
+
+ WriteAttribute (datasetz, "name", "z");
+
+ herr = H5Dclose (datasetz);
+ assert (! herr);
+
+ } // if output_xyz_flag
+
+
+
+ herr = H5Sclose (dataspace);
+ assert (! herr);
+
+ } // for pn
+
+
+
+ herr = H5Fclose (writer);
+ assert (! herr);
+
+#else
+ error_exit(ERROR_EXIT,
+"***** patch_system::output_unknown_gridfn(unknown_gfn=%d):\n"
+" no HDF5 support compiled in. Cannot write output file \"%s\"\n!"
+,
+ unknown_gfn,
+ output_file_name); /*NOTREACHED*/
+
+#endif
+}
+
+//******************************************************************************
//******************************************************************************
//******************************************************************************
diff --git a/src/patch/patch_system.hh b/src/patch/patch_system.hh
index 38e5ea3..11cf665 100644
--- a/src/patch/patch_system.hh
+++ b/src/patch/patch_system.hh
@@ -104,6 +104,11 @@ public:
fp origin_y() const { return global_coords_.origin_y(); }
fp origin_z() const { return global_coords_.origin_z(); }
+ // set global (x,y,z) coordinates of local origin point
+ void origin_x(const fp x) { global_coords_.origin_x(x); }
+ void origin_y(const fp y) { global_coords_.origin_y(y); }
+ void origin_z(const fp z) { global_coords_.origin_z(z); }
+
//
// ***** meta-info about the entire patch system *****
@@ -132,6 +137,9 @@ public:
// total number of grid points
int N_grid_points() const { return N_grid_points_; }
int ghosted_N_grid_points() const { return ghosted_N_grid_points_; }
+ int max_N_additional_points() const { return max_N_additional_points_; }
+ int N_additional_points() const { return N_additional_points_; }
+ int N_additional_points(const int n) { return N_additional_points_=n; }
//
@@ -263,14 +271,21 @@ private:
//
public:
// dst = a
- void set_gridfn_to_constant(fp a, int dst_gfn);
+ void set_gridfn_to_constant(fp a, int dst_gfn);
+ void set_ghosted_gridfn_to_constant(fp a, int ghosted_dst_gfn);
// dst = src
- void gridfn_copy(int src_gfn, int dst_gfn);
+ void gridfn_copy(int src_gfn, int dst_gfn);
+ void ghosted_gridfn_copy(int ghosted_src_gfn, int ghosted_dst_gfn);
+ void ghosted_gridfn_copy_to_nominal(int ghosted_src_gfn, int dst_gfn);
// dst += delta
+ void add_to_gridfn(fp delta, int dst_gfn);
void add_to_ghosted_gridfn(fp delta, int ghosted_dst_gfn);
+ // dst *= factor
+ void scale_ghosted_gridfn(fp factor, int ghosted_dst_gfn);
+
// compute norms of gridfn (only over nominal grid)
void gridfn_norms(int src_gfn, jtutil::norm<fp>& norms)
const;
@@ -296,15 +311,18 @@ public:
// radius of surface in direction of an (x,y,z) point,
// taking into account any patch-system symmetries;
// or dummy value 1.0 if point is identical to local origin
- //
- // FIXME:
- // We should provide another API to compute this for a whole
- // batch of points at once, since this would be more efficient
- // (the interpolator overhead would be amortized over the whole batch)
fp radius_in_local_xyz_direction(int ghosted_radius_gfn,
fp x, fp y, fp z)
const;
+ void radii_in_local_xyz_directions(int ghosted_radius_gfn,
+ int npoints,
+ fp const * xp,
+ fp const * yp,
+ fp const * zp,
+ fp * radii)
+ const;
+
//
// ***** line/surface operations *****
@@ -349,6 +367,20 @@ public:
enum patch::integration_method method)
const;
+ fp integrate_gridpoint(int unknown_src_gfn,
+ int ghosted_radius_gfn,
+ int g_xx_gfn, int g_xy_gfn, int g_xz_gfn,
+ int g_yy_gfn, int g_yz_gfn,
+ int g_zz_gfn,
+ enum patch::integration_method method,
+ int pn, int irho, int isigma)
+ const;
+
+ fp integrate_correction(bool src_gfn_is_even_across_xy_plane,
+ bool src_gfn_is_even_across_xz_plane,
+ bool src_gfn_is_even_across_yz_plane)
+ const;
+
//
@@ -427,6 +459,74 @@ private:
const char input_file_name[],
bool want_ghost_zones);
+public:
+ // output to a named file
+ // output format is HDF5
+ void output_gridfn(int gfn,
+ const char gfn_name[], const cGH *cctkGH,
+ const char output_file_name[]) const
+ {
+ output_unknown_gridfn(false, gfn,
+ gfn_name, cctkGH,
+ false, false, 0,
+ output_file_name, false);
+ }
+ void output_ghosted_gridfn(int ghosted_gfn,
+ const char gfn_name[], const cGH *cctkGH,
+ const char output_file_name[],
+ bool want_ghost_zones = true)
+ const
+ {
+ output_unknown_gridfn(true, ghosted_gfn,
+ gfn_name, cctkGH,
+ false, false, 0,
+ output_file_name, want_ghost_zones);
+ }
+
+ // output to a named file (newly (re)created)
+ // output format is
+ // dpx dpy gridfn global_x global_y global_z
+ // where global_[xyz} are derived from the angular position
+ // and a specified (unknown-grid) radius gridfn
+ void output_gridfn_with_xyz
+ (int gfn,
+ const char gfn_name[], const cGH *cctkGH,
+ bool radius_is_ghosted_flag, int unknown_radius_gfn,
+ const char output_file_name[])
+ const
+ {
+ output_unknown_gridfn(false, gfn,
+ gfn_name, cctkGH,
+ true, radius_is_ghosted_flag,
+ unknown_radius_gfn,
+ output_file_name, false);
+ }
+ void output_ghosted_gridfn_with_xyz
+ (int ghosted_gfn,
+ const char gfn_name[], const cGH *cctkGH,
+ bool radius_is_ghosted_flag, int unknown_radius_gfn,
+ const char output_file_name[],
+ bool want_ghost_zones = true)
+ const
+ {
+ output_unknown_gridfn(true, ghosted_gfn,
+ gfn_name, cctkGH,
+ true, radius_is_ghosted_flag,
+ unknown_radius_gfn,
+ output_file_name, want_ghost_zones);
+ }
+
+private:
+ // ... internal worker functions
+ void output_unknown_gridfn
+ (bool ghosted_flag, int unknown_gfn,
+ const char gfn_name[], const cGH *cctkGH,
+ bool print_xyz_flag, bool radius_is_ghosted_flag,
+ int unknown_radius_gfn,
+ const char output_file_name[], bool want_ghost_zones)
+ const;
+
+
//
// ***** access to gridfns as 1-D arrays *****
@@ -587,6 +687,8 @@ private:
enum patch_system_type type_;
int N_patches_;
int N_grid_points_, ghosted_N_grid_points_;
+ int max_N_additional_points_;
+ int N_additional_points_;
// [pn] = --> individual patches
// *** constructor initialization list ordering:
@@ -607,7 +709,8 @@ private:
fp* ghosted_gridfn_storage_;
// min/max m over all ghost zone points
- mutable int global_min_ym_, global_max_ym_;
+ mutable int global_min_ym_;
+ mutable int global_max_ym_;
// info about the surface interpolator
// ... used only by radius_in_local_xyz_direction()
diff --git a/src/patch/test_coords.cc b/src/patch/test_coords.cc
index bf40c74..0abe7d8 100644
--- a/src/patch/test_coords.cc
+++ b/src/patch/test_coords.cc
@@ -15,14 +15,14 @@
#include "config.h"
#include "stdc.h"
#include "../jtutil/util.hh"
+using jtutil::error_exit;
+using jtutil::radians_of_degrees;
+using jtutil::degrees_of_radians;
#include "coords.hh"
using namespace AHFinderDirect;
using namespace local_coords;
-using jtutil::error_exit;
-using jtutil::radians_of_degrees;
-using jtutil::degrees_of_radians;
//******************************************************************************
diff --git a/src/patch/test_coords2.cc b/src/patch/test_coords2.cc
index cbf7a0a..bc53633 100644
--- a/src/patch/test_coords2.cc
+++ b/src/patch/test_coords2.cc
@@ -18,14 +18,14 @@
#include "coords.hh"
-using namespace AHFinderDirect;
-using namespace local_coords;
-
using jtutil::fuzzy;
using jtutil::error_exit;
using jtutil::radians_of_degrees;
using jtutil::degrees_of_radians;
+using namespace AHFinderDirect;
+using namespace local_coords;
+
// prototypes
namespace {
void test_r_mu_nu_phi(fp x, fp y, fp z);
diff --git a/src/patch/test_patch_system.cc b/src/patch/test_patch_system.cc
index cad9711..64ff79e 100644
--- a/src/patch/test_patch_system.cc
+++ b/src/patch/test_patch_system.cc
@@ -41,6 +41,7 @@
#include "../jtutil/array.hh"
#include "../jtutil/cpm_map.hh"
#include "../jtutil/linear_map.hh"
+using jtutil::error_exit;
#include "coords.hh"
#include "grid.hh"
@@ -52,7 +53,6 @@
#include "patch_system.hh"
using namespace AHFinderDirect;
-using jtutil::error_exit;
//******************************************************************************
diff --git a/src/sparse-matrix/umfpack/make.code.deps b/src/sparse-matrix/umfpack/make.code.deps
index d647c9a..3912cd5 100644
--- a/src/sparse-matrix/umfpack/make.code.deps
+++ b/src/sparse-matrix/umfpack/make.code.deps
@@ -4,5 +4,4 @@
#
# See the header comments in make.code.defn for general comments.
#
-CFLAGS += -DNBLAS -DNDEBUG -DINT
CPPFLAGS += -DNBLAS -DNDEBUG -DINT