aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-05-13 14:15:01 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2003-05-13 14:15:01 +0000
commit56c143d35416ed3ff9cb0d7d3e0f379483499479 (patch)
tree625c81b7d3890958a039216e92d1832df58f5b7c /src
parente4e46a64b58ac6d9830eb738e4307128dc1e18b3 (diff)
redo excision mask:
* there are now 3 states (inside/buffer/outside) * there is now a "noshrink" option * many other changes too -- see thorn guide for details the new excision support isn't very well tested yet :( :( git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1056 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src')
-rw-r--r--src/driver/driver.hh38
-rw-r--r--src/driver/find_horizons.cc79
-rw-r--r--src/driver/mask.cc250
-rw-r--r--src/driver/misc-driver.cc22
-rw-r--r--src/driver/setup.cc69
-rw-r--r--src/gr/expansion.cc32
-rw-r--r--src/gr/gr.hh30
7 files changed, 312 insertions, 208 deletions
diff --git a/src/driver/driver.hh b/src/driver/driver.hh
index c9961c4..1f29ea2 100644
--- a/src/driver/driver.hh
+++ b/src/driver/driver.hh
@@ -168,23 +168,29 @@ struct verbose_info
//
struct mask_info
{
- bool do_mask;
- const fp* radius_multiplier; // --> array [hn] which we do *not* own
- const fp* radius_offset; // ditto
+ bool set_mask;
+ CCTK_REAL radius_multiplier, radius_offset;
+ CCTK_REAL buffer_thickness;
+ bool mask_is_noshrink;
bool set_old_style_mask, set_new_style_mask;
struct old_style_mask_info
{
- const char* mask_gridfn_name;
- int mask_gridfn_varindex;
- CCTK_REAL* mask_gridfn_data;
- CCTK_REAL inside_value, outside_value;
+ const char* gridfn_name;
+ int gridfn_varindex;
+ CCTK_REAL* gridfn_dataptr;
+ CCTK_REAL inside_value, buffer_value, outside_value;
} old_style_mask_info;
struct new_style_mask_info
{
- const char* mask_gridfn_name;
- int mask_gridfn_varindex;
- CCTK_INT* mask_gridfn_data;
- CCTK_INT bitfield_mask, inside_value, outside_value;
+ const char* gridfn_name;
+ int gridfn_varindex;
+ CCTK_INT* gridfn_dataptr;
+ const char* bitfield_name;
+ CCTK_INT bitfield_bitmask;
+ const char* inside_value;
+ const char* buffer_value;
+ const char* outside_value;
+ CCTK_INT inside_bitvalue, buffer_bitvalue, outside_bitvalue;
} new_style_mask_info;
};
@@ -379,15 +385,17 @@ void output_Jacobians(const patch_system& ps,
int hn, bool print_msg_flag, int AHF_iteration = 0);
// mask.cc
+void setup_mask_dataptrs_and_bitfields(const cGH *GH,
+ struct mask_info& mask_info);
void set_mask_gridfn(int N_horizons,
const struct AH_data* const AH_data_array[],
const struct cactus_grid_info& cgi,
const struct mask_info& mask_info,
const struct verbose_info& verbose_info);
-// misc.cc
+// misc-driver.cc
int Cactus_gridfn_varindex(const char gridfn_name[]);
template <typename T>
- T* Cactus_gridfn_data_ptr(const cGH *GH, int varindex,
- const char gridfn_name[],
- bool check_for_NULL = true);
+ T* Cactus_gridfn_dataptr(const cGH *GH, int varindex,
+ const char gridfn_name[],
+ bool check_for_NULL = true);
diff --git a/src/driver/find_horizons.cc b/src/driver/find_horizons.cc
index c311442..f3f3803 100644
--- a/src/driver/find_horizons.cc
+++ b/src/driver/find_horizons.cc
@@ -5,7 +5,7 @@
// <<<prototypes for functions local to this file>>>
// AHFinderDirect_find_horizons - top-level driver to find apparent horizons
///
-/// setup_Cactus_gridfn_data_ptrs - get all data pointers given variable indices
+/// setup_Cactus_gridfn_dataptrs - get all data pointers given variable indices
///
/// find_horizon - find a horizon
/// do_evaluate_expansions
@@ -60,7 +60,7 @@ extern struct state state;
// ***** prototypes for functions local to this file
//
namespace {
-void setup_Cactus_gridfn_data_ptrs(const cGH *GH, struct cactus_grid_info& cgi);
+void setup_Cactus_gridfn_dataptrs(const cGH *GH, struct cactus_grid_info& cgi);
void do_evaluate_expansions(int my_proc, int N_horizons,
horizon_sequence& hs,
@@ -107,16 +107,16 @@ const bool active_flag = hs.has_genuine_horizons();
const struct geometry_info& gi = state.gi;
struct Jacobian_info& Jac_info = state.Jac_info;
struct IO_info& IO_info = state.IO_info;
-const struct mask_info& mask_info = state.mask_info;
+ struct mask_info& mask_info = state.mask_info;
const struct error_info& error_info = state.error_info;
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(metric_type, "physical"))
- then cgi.Cactus_conformal_metric = false;
+ then cgi.use_Cactus_conformal_metric = false;
else if (CCTK_Equals(metric_type, "static conformal"))
- then cgi.Cactus_conformal_metric = (conformal_state > 0);
+ then cgi.use_Cactus_conformal_metric = (conformal_state > 0);
else CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
"AHFinderDirect_find_horizons(): unknown metric_type=\"%s\"!",
metric_type); /*NOTREACHED*/
@@ -135,7 +135,7 @@ IO_info.output_Theta
// we need to re-fetch the Cactus data pointers at least each time step,
// because they change each time Cactus rotates the time levels
if (gi.geometry_method == geometry__local_interp_from_Cactus_grid)
- then setup_Cactus_gridfn_data_ptrs(cctkGH, cgi);
+ then setup_Cactus_gridfn_dataptrs(cctkGH, cgi);
// set initial guess for any (genuine) horizons that need it,
// i.e. for any (genuine) horizons where we didn't find the horizon previously
@@ -186,7 +186,7 @@ case method__find_horizons:
{
if (state.timer_handle >= 0)
then CCTK_TimerStartI(state.timer_handle);
- const bool broadcast_horizon_shape = mask_info.do_mask;
+ const bool broadcast_horizon_shape = mask_info.set_mask;
Newton(cctkGH,
state.N_procs, state.N_active_procs, my_proc,
*state.my_hs, state.AH_data_array,
@@ -216,10 +216,13 @@ if (state.timer_handle >= 0)
}
// optionally set the mask gridfn based on each horizon's shape
-if (mask_info.do_mask)
- then set_mask_gridfn(N_horizons, state.AH_data_array,
+if (mask_info.set_mask)
+ then {
+ setup_mask_dataptrs_and_bitfields(cctkGH, mask_info);
+ set_mask_gridfn(N_horizons, state.AH_data_array,
cgi, mask_info,
verbose_info);
+ }
}
//******************************************************************************
@@ -232,36 +235,36 @@ if (mask_info.do_mask)
//
namespace {
-void setup_Cactus_gridfn_data_ptrs(const cGH *GH, struct cactus_grid_info& cgi)
+void setup_Cactus_gridfn_dataptrs(const cGH *GH, struct cactus_grid_info& cgi)
{
-cgi.g_dd_11_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.g_dd_11_varindex, "g_11");
-cgi.g_dd_12_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.g_dd_12_varindex, "g_12");
-cgi.g_dd_13_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.g_dd_13_varindex, "g_13");
-cgi.g_dd_22_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.g_dd_22_varindex, "g_22");
-cgi.g_dd_23_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.g_dd_23_varindex, "g_23");
-cgi.g_dd_33_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.g_dd_33_varindex, "g_33");
-cgi.K_dd_11_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.K_dd_11_varindex, "K_11");
-cgi.K_dd_12_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.K_dd_12_varindex, "K_12");
-cgi.K_dd_13_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.K_dd_13_varindex, "K_13");
-cgi.K_dd_22_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.K_dd_22_varindex, "K_22");
-cgi.K_dd_23_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.K_dd_23_varindex, "K_23");
-cgi.K_dd_33_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.K_dd_33_varindex, "K_33");
-const bool check_for_NULL = cgi.Cactus_conformal_metric;
-cgi.psi_data = Cactus_gridfn_data_ptr<CCTK_REAL>
- (GH, cgi.psi_varindex, "psi",
- check_for_NULL);
+cgi.g_dd_11_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.g_dd_11_varindex, "g_11");
+cgi.g_dd_12_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.g_dd_12_varindex, "g_12");
+cgi.g_dd_13_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.g_dd_13_varindex, "g_13");
+cgi.g_dd_22_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.g_dd_22_varindex, "g_22");
+cgi.g_dd_23_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.g_dd_23_varindex, "g_23");
+cgi.g_dd_33_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.g_dd_33_varindex, "g_33");
+cgi.K_dd_11_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.K_dd_11_varindex, "K_11");
+cgi.K_dd_12_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.K_dd_12_varindex, "K_12");
+cgi.K_dd_13_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.K_dd_13_varindex, "K_13");
+cgi.K_dd_22_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.K_dd_22_varindex, "K_22");
+cgi.K_dd_23_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.K_dd_23_varindex, "K_23");
+cgi.K_dd_33_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.K_dd_33_varindex, "K_33");
+const bool check_for_NULL = cgi.use_Cactus_conformal_metric;
+cgi.psi_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, cgi.psi_varindex, "psi",
+ check_for_NULL);
}
}
diff --git a/src/driver/mask.cc b/src/driver/mask.cc
index a3578db..e945832 100644
--- a/src/driver/mask.cc
+++ b/src/driver/mask.cc
@@ -2,6 +2,7 @@
// $Header$
//
// <<<prototypes for functions local to this file>>>
+// setup_mask_dataptrs_and_bitfields - map gridfn/bitfield names to ptr/bitmasks
// set_mask_gridfn - set mask gridfn(s) based on each horizon's shape
//
@@ -45,32 +46,117 @@ using jtutil::error_exit;
//******************************************************************************
//
+// This function maps the character-string names of the mask gridfn(s)
+// and/or bitfield(s) into internal data pointers and/or bit masks/values:
+//
+// mask_info.old_style_mask_info
+// .gridfn_varindex --> .gridfn_dataptr
+// mask_info.new_style_mask_info
+// .gridfn_varindex --> .gridfn_dataptr
+// .bitfield_name --> .bitfield_bitmask
+// .inside_value --> .inside_bitvalue
+// .buffer_value --> .buffer_bitvalue
+// .outside_value --> .outside_bitvalue
+//
+// FIXME: right now the SpaceMask() functions return 0 for error;
+// this may change to -1 in the future
+//
+void setup_mask_dataptrs_and_bitfields(const cGH *GH,
+ struct mask_info& mask_info)
+{
+const int SPACEMASK_ERROR = 0;
+
+struct mask_info::old_style_mask_info& osmi = mask_info.old_style_mask_info;
+if (mask_info.set_old_style_mask)
+ then osmi.gridfn_dataptr = Cactus_gridfn_dataptr<CCTK_REAL>
+ (GH, osmi.gridfn_varindex,
+ osmi.gridfn_name);
+
+if (mask_info.set_new_style_mask)
+ then {
+ struct mask_info::new_style_mask_info& nsmi
+ = mask_info.new_style_mask_info;
+ nsmi.gridfn_dataptr = Cactus_gridfn_dataptr<CCTK_INT>
+ (GH, nsmi.gridfn_varindex,
+ nsmi.gridfn_name);
+
+ nsmi.bitfield_bitmask = SpaceMask_GetTypeBits(nsmi.bitfield_name);
+ if (nsmi.bitfield_bitmask == SPACEMASK_ERROR)
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+"setup_mask_dataptrs_and_bitfields():\n"
+" couldn't get bit mask for new-style mask bit field \"%s\"!\n"
+" (this almost certainly means this bit field was never registered\n"
+" with SpaceMask; remember that AHFinderDirect doesn't do this\n"
+" registration, rather you need to arrange for some other thorn(s)\n"
+" to do it)\n"
+ ,
+ nsmi.bitfield_name); /*NOTREACHED*/
+
+ nsmi.inside_bitvalue = SpaceMask_GetStateBits(nsmi.bitfield_name,
+ nsmi.inside_value);
+ nsmi.buffer_bitvalue = SpaceMask_GetStateBits(nsmi.bitfield_name,
+ nsmi.buffer_value);
+ nsmi.outside_bitvalue = SpaceMask_GetStateBits(nsmi.bitfield_name,
+ nsmi.outside_value);
+ if ( (nsmi.inside_bitvalue == SPACEMASK_ERROR)
+ || (nsmi.buffer_bitvalue == SPACEMASK_ERROR)
+ || (nsmi.outside_bitvalue == SPACEMASK_ERROR) )
+ then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
+"\n"
+"setup_mask_dataptrs_and_bitfields():\n"
+" couldn't get bit value(s) for one or more of the new-style mask\n"
+" inside/buffer/outside values \"%s\"/\"%s\"/\"%s\"!\n"
+" (this almost certainly means one or more of the values was/were\n"
+" never registered with SpaceMask; remember that AHFinderDirect\n"
+" doesn't do this registration, rather you need to arrange for\n"
+" some other thorn(s) to do it)\n"
+ ,
+ nsmi.inside_value,
+ nsmi.buffer_value,
+ nsmi.outside_value); /*NOTREACHED*/
+ }
+}
+
+//******************************************************************************
+
+//
// This function sets the mask grid function specified by mask_info
// based on each horizon's shape.
//
+// FIXME: The current implementation is quite inefficient: it does
+// a full 2-D interpolation for each xyz grid point within
+// each horizon's xyz bounding box. It would be more efficient
+// to batch the interpolations, and maybe also use r_min/r_max
+// tests for early-out...
+//
void set_mask_gridfn(int N_horizons,
const struct AH_data* const AH_data_array[],
const struct cactus_grid_info& cgi,
const struct mask_info& mask_info,
const struct verbose_info& verbose_info)
{
+const fp Cactus_dx = cgi.mean_coord_delta;
const bool set_old_style_mask = mask_info.set_old_style_mask;
const bool set_new_style_mask = mask_info.set_new_style_mask;
-const struct mask_info::old_style_mask_info& old_style_mask_info
- = mask_info.old_style_mask_info;
-const struct mask_info::new_style_mask_info& new_style_mask_info
- = mask_info.new_style_mask_info;
+const struct mask_info::old_style_mask_info& osmi = mask_info.old_style_mask_info;
+const struct mask_info::new_style_mask_info& nsmi = mask_info.new_style_mask_info;
if (verbose_info.print_algorithm_highlights)
then {
if (set_old_style_mask)
then CCTK_VInfo(CCTK_THORNSTRING,
"setting old-style (CCTK_REAL) mask grid function %s",
- old_style_mask_info.mask_gridfn_name);
+ osmi.gridfn_name);
if (set_new_style_mask)
- then CCTK_VInfo(CCTK_THORNSTRING,
+ then {
+ CCTK_VInfo(CCTK_THORNSTRING,
"setting new-style (CCTK_INT) mask grid function %s",
- new_style_mask_info.mask_gridfn_name);
+ nsmi.gridfn_name);
+ CCTK_VInfo(CCTK_THORNSTRING,
+ " bit field %s",
+ nsmi.bitfield_name);
+ }
}
if (verbose_info.print_algorithm_debug)
@@ -90,24 +176,6 @@ if (verbose_info.print_algorithm_debug)
}
-//
-// set up the gridfn data pointers
-//
-CCTK_REAL* old_style_mask_gridfn_data_ptr
- = set_old_style_mask
- ? Cactus_gridfn_data_ptr<CCTK_REAL>
- (cgi.GH,
- old_style_mask_info.mask_gridfn_varindex,
- old_style_mask_info.mask_gridfn_name)
- : NULL;
-CCTK_INT * new_style_mask_gridfn_data_ptr
- = set_new_style_mask
- ? Cactus_gridfn_data_ptr<CCTK_INT>
- (cgi.GH,
- new_style_mask_info.mask_gridfn_varindex,
- new_style_mask_info.mask_gridfn_name)
- : NULL;
-
//
// set the mask to the outside value everywhere in
@@ -125,12 +193,33 @@ if (verbose_info.print_algorithm_details)
{
const int posn = CCTK_GFINDEX3D(cgi.GH, i,j,k);
if (set_old_style_mask)
- then old_style_mask_gridfn_data_ptr[posn] = old_style_mask_info
- .outside_value;
+ then {
+ if (mask_info.mask_is_noshrink)
+ then {
+ CCTK_REAL old_value = osmi.gridfn_dataptr[posn];
+ if ((old_value != osmi.inside_value) && (old_value != osmi.buffer_value))
+ then osmi.gridfn_dataptr[posn] = osmi.outside_value;
+ }
+ else osmi.gridfn_dataptr[posn] = osmi.buffer_value;
+ }
if (set_new_style_mask)
- then SpaceMask_SetStateBits(new_style_mask_gridfn_data_ptr, posn,
- new_style_mask_info.bitfield_mask,
- new_style_mask_info.inside_value);
+ then {
+ if (mask_info.mask_is_noshrink)
+ then {
+ if ( !SpaceMask_CheckStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.inside_bitvalue)
+ && !SpaceMask_CheckStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.buffer_bitvalue) )
+ then SpaceMask_SetStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.outside_bitvalue);
+ }
+ else SpaceMask_SetStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.outside_bitvalue);
+ }
}
}
}
@@ -149,16 +238,12 @@ if (verbose_info.print_algorithm_details)
if (verbose_info.print_algorithm_details)
then CCTK_VInfo(CCTK_THORNSTRING,
- " setting mask grid function to \"inside\" for horizon %d",
+ " setting mask grid function to \"buffer\"/\"inside\" for horizon %d",
hn);
const patch_system& ps = *AH_data.ps_ptr;
const struct BH_diagnostics& BH_diagnostics = AH_data.BH_diagnostics;
- const fp radius_multiplier = mask_info.radius_multiplier[hn];
- const fp radius_offset = mask_info.radius_offset[hn]
- * cgi.mean_coord_delta;
-
// horizon bounding box, rounded "out" to the next grid point
const int AH_min_i = cgi.ijk_floor_of_global_xyz(X_AXIS, BH_diagnostics.min_x);
const int AH_max_i = cgi.ijk_ceil_of_global_xyz (X_AXIS, BH_diagnostics.max_x);
@@ -227,6 +312,7 @@ if (verbose_info.print_algorithm_details)
// set the mask for each point in the intersection
//
long inside_count = 0;
+ long buffer_count = 0;
for (int k = use_min_k ; k <= use_max_k ; ++k)
{
for (int j = use_min_j ; j <= use_max_j ; ++j)
@@ -244,62 +330,68 @@ if (verbose_info.print_algorithm_details)
const fp r = jtutil::hypot3(local_x, local_y, local_z);
- CCTK_REAL old_style_mask_value;
- CCTK_INT new_style_mask_value;
- if (r > BH_diagnostics.max_radius)
- then {
- // definitely outside
- old_style_mask_value = old_style_mask_info.outside_value;
- new_style_mask_value = new_style_mask_info.outside_value;
- }
- else if (r < BH_diagnostics.min_radius)
+ // interpolate to find r_horizon in this direction
+ //
+ // FIXME:
+ // it would be more efficient here to compute the
+ // radia 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);
+
+ const fp r_inner = mask_info.radius_multiplier*r_horizon
+ + mask_info.radius_offset*Cactus_dx;
+ const fp r_outer = r_inner + mask_info.buffer_thickness*Cactus_dx;
+
+ if (r <= r_inner)
then {
- // definitely inside
++inside_count;
- old_style_mask_value = old_style_mask_info.inside_value;
- new_style_mask_value = new_style_mask_info.inside_value;
+ if (set_old_style_mask)
+ then osmi.gridfn_dataptr[posn] = osmi.inside_value;
+ if (set_new_style_mask)
+ then SpaceMask_SetStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.inside_bitvalue);
}
- else {
- // interpolate to find out inside/outside status
- //
- // FIXME:
- // it would be more efficient here to compute the
- // radia 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);
- const fp r_mask = radius_multiplier*r_horizon
- + radius_offset;
- if (r < r_mask)
+ else if (r <= r_outer)
+ then {
+ ++buffer_count;
+ if (set_old_style_mask)
then {
- ++inside_count;
- old_style_mask_value
- = old_style_mask_info.inside_value;
- new_style_mask_value
- = new_style_mask_info.inside_value;
+ if (mask_info.mask_is_noshrink)
+ then {
+ if (osmi.gridfn_dataptr[posn] != osmi.inside_value)
+ then osmi.gridfn_dataptr[posn] = osmi.buffer_value;
+ }
+ else osmi.gridfn_dataptr[posn] = osmi.buffer_value;
}
- else {
- old_style_mask_value
- = old_style_mask_info.outside_value;
- new_style_mask_value
- = new_style_mask_info.outside_value;
+ if (set_new_style_mask)
+ then {
+ if (mask_info.mask_is_noshrink)
+ then {
+ if (! SpaceMask_CheckStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.inside_bitvalue))
+ then SpaceMask_SetStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.buffer_bitvalue);
+ }
+ else SpaceMask_SetStateBits(nsmi.gridfn_dataptr, posn,
+ nsmi.bitfield_bitmask,
+ nsmi.buffer_bitvalue);
}
}
-
- // set the mask
- if (set_old_style_mask)
- then old_style_mask_gridfn_data_ptr[posn] = old_style_mask_value;
- if (set_new_style_mask)
- then SpaceMask_SetStateBits(new_style_mask_gridfn_data_ptr, posn,
- new_style_mask_info.bitfield_mask,
- new_style_mask_value);
+ else {
+ // it's "outside", and we've already done that case above
+ // ==> no-op here
+ }
}
}
}
if (verbose_info.print_algorithm_details)
then CCTK_VInfo(CCTK_THORNSTRING,
- " %ld points set to \"inside\" on this processor",
- inside_count);
+ " %ld \"inside\" points, %ld \"buffer\" points on this processor",
+ inside_count, buffer_count);
}
}
diff --git a/src/driver/misc-driver.cc b/src/driver/misc-driver.cc
index f8a8228..735d0f9 100644
--- a/src/driver/misc-driver.cc
+++ b/src/driver/misc-driver.cc
@@ -2,7 +2,7 @@
// $Header$
//
// Cactus_gridfn_varindex - get Cactus gridfn variable index
-// Cactus_gridfn_data_ptr - get Cactus gridfn data pointer
+// Cactus_gridfn_dataptr - get Cactus gridfn data pointer
// ***** template instantiations *****
//
@@ -78,9 +78,9 @@ return varindex;
// pointer is ok)
//
template <typename T>
- T* Cactus_gridfn_data_ptr(const cGH *GH, int varindex,
- const char gridfn_name[],
- bool check_for_NULL /* = true */)
+ T* Cactus_gridfn_dataptr(const cGH *GH, int varindex,
+ const char gridfn_name[],
+ bool check_for_NULL /* = true */)
{
const int time_level = 0;
@@ -89,7 +89,7 @@ T* data_ptr = static_cast<T*>( CCTK_VarDataPtrI(GH, time_level, varindex) );
if (check_for_NULL && (data_ptr == NULL))
then CCTK_VWarn(FATAL_ERROR, __LINE__, __FILE__, CCTK_THORNSTRING,
"\n"
-" Cactus_gridfn_data_ptr(): got unexpected NULL data pointer\n"
+" Cactus_gridfn_dataptr(): got unexpected NULL data pointer\n"
" for Cactus gridfn!\n"
" name=\"%s\" varindex=%d"
,
@@ -100,9 +100,9 @@ return data_ptr;
//******************************************************************************
-template CCTK_REAL* Cactus_gridfn_data_ptr<CCTK_REAL>(const cGH*, int,
- const char*,
- bool /* = true */);
-template CCTK_INT* Cactus_gridfn_data_ptr<CCTK_INT>(const cGH*, int,
- const char*,
- bool /* = true */);
+template CCTK_REAL* Cactus_gridfn_dataptr<CCTK_REAL>(const cGH*, int,
+ const char*,
+ bool /* = true */);
+template CCTK_INT* Cactus_gridfn_dataptr<CCTK_INT>(const cGH*, int,
+ const char*,
+ bool /* = true */);
diff --git a/src/driver/setup.cc b/src/driver/setup.cc
index 6ed80c6..02dfbb3 100644
--- a/src/driver/setup.cc
+++ b/src/driver/setup.cc
@@ -157,7 +157,7 @@ if (verbose_info.print_algorithm_highlights)
then CCTK_VInfo(CCTK_THORNSTRING, " setting up Cactus grid info");
struct cactus_grid_info& cgi = state.cgi;
cgi.GH = cctkGH;
-cgi.Cactus_conformal_metric = false; // dummy value, may change later
+cgi.use_Cactus_conformal_metric = false; // dummy value, may change later
// get global/local Cactus grid origin
// KLUDGE -- is this the right way to get this??
@@ -215,19 +215,19 @@ cgi.psi_varindex = Cactus_gridfn_varindex("StaticConformal::psi");
// we can't set the data pointers yet because they may change from time
// step to time step as (if) Cactus rotates the multiple time levels
-cgi.g_dd_11_data = NULL; // dummy value, will be reset later
-cgi.g_dd_12_data = NULL; // dummy value, will be reset later
-cgi.g_dd_13_data = NULL; // dummy value, will be reset later
-cgi.g_dd_22_data = NULL; // dummy value, will be reset later
-cgi.g_dd_23_data = NULL; // dummy value, will be reset later
-cgi.g_dd_33_data = NULL; // dummy value, will be reset later
-cgi.K_dd_11_data = NULL; // dummy value, will be reset later
-cgi.K_dd_12_data = NULL; // dummy value, will be reset later
-cgi.K_dd_13_data = NULL; // dummy value, will be reset later
-cgi.K_dd_22_data = NULL; // dummy value, will be reset later
-cgi.K_dd_23_data = NULL; // dummy value, will be reset later
-cgi.K_dd_33_data = NULL; // dummy value, will be reset later
-cgi.psi_data = NULL; // dummy value, will be reset later
+cgi.g_dd_11_dataptr = NULL; // dummy value, will be reset later
+cgi.g_dd_12_dataptr = NULL; // dummy value, will be reset later
+cgi.g_dd_13_dataptr = NULL; // dummy value, will be reset later
+cgi.g_dd_22_dataptr = NULL; // dummy value, will be reset later
+cgi.g_dd_23_dataptr = NULL; // dummy value, will be reset later
+cgi.g_dd_33_dataptr = NULL; // dummy value, will be reset later
+cgi.K_dd_11_dataptr = NULL; // dummy value, will be reset later
+cgi.K_dd_12_dataptr = NULL; // dummy value, will be reset later
+cgi.K_dd_13_dataptr = NULL; // dummy value, will be reset later
+cgi.K_dd_22_dataptr = NULL; // dummy value, will be reset later
+cgi.K_dd_23_dataptr = NULL; // dummy value, will be reset later
+cgi.K_dd_33_dataptr = NULL; // dummy value, will be reset later
+cgi.psi_dataptr = NULL; // dummy value, will be reset later
//
@@ -319,43 +319,44 @@ state.BH_diagnostics_info.integral_method
//
-// stuff for setting a mask gridfn based on each horizon shape
+// mask parameters
//
struct mask_info& mask_info = state.mask_info;
-mask_info.do_mask = (set_horizon_mask != 0);
-if (mask_info.do_mask)
+mask_info.set_mask = (set_mask != 0);
+if (mask_info.set_mask)
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.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.mask_gridfn_name = old_style_mask_gridfn_name;
- osmi.mask_gridfn_varindex
- = Cactus_gridfn_varindex(osmi.mask_gridfn_name);
- osmi.mask_gridfn_data = NULL;
- osmi.inside_value = old_style_mask_inside_value;
+ 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.mask_gridfn_name = new_style_mask_gridfn_name;
- nsmi.mask_gridfn_varindex
- = Cactus_gridfn_varindex(nsmi.mask_gridfn_name);
- nsmi.mask_gridfn_data = NULL;
- nsmi.bitfield_mask
- = SpaceMask_GetTypeBits(new_style_mask_bitfield_name);
- nsmi.inside_value
- = SpaceMask_GetStateBits(new_style_mask_bitfield_name,
- new_style_mask_inside_state_name);
- nsmi.outside_value
- = SpaceMask_GetStateBits(new_style_mask_bitfield_name,
- new_style_mask_outside_state_name);
+ 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
}
}
diff --git a/src/gr/expansion.cc b/src/gr/expansion.cc
index dd024c3..5030c0b 100644
--- a/src/gr/expansion.cc
+++ b/src/gr/expansion.cc
@@ -197,7 +197,7 @@ case geometry__local_interp_from_Cactus_grid:
if (status != expansion_success)
then return status; // *** ERROR RETURN ***
}
- if (active_flag && cgi.Cactus_conformal_metric)
+ if (active_flag && cgi.use_Cactus_conformal_metric)
then convert_conformal_to_physical(*ps_ptr,
print_msg_flag);
break;
@@ -300,7 +300,7 @@ if (print_msg_flag)
// partial_d_psi_k # optional
// at the nominal-grid trial horizon surface positions given by the
// global_(x,y,z) angular gridfns in the patch system *ps_ptr. The psi
-// interpolation is only done if the cgi.Cactus_conformal_metric flag
+// interpolation is only done if the cgi.use_Cactus_conformal_metric flag
// is set. Note that this function ignores the physical-vs-conformal
// semantics of the gridfns; it just interpolates and takes derivatives
// of the stored gridfn values.
@@ -366,7 +366,7 @@ const char* const global_local_str
= (gi.geometry_method == geometry__global_interp_from_Cactus_grid)
? "global"
: "local";
-const bool psi_flag = cgi.Cactus_conformal_metric;
+const bool psi_flag = cgi.use_Cactus_conformal_metric;
if (print_msg_flag)
then CCTK_VInfo(CCTK_THORNSTRING,
@@ -422,19 +422,19 @@ const CCTK_INT input_array_type_codes[]
};
const void* const input_arrays[]
= {
- static_cast<const void*>(cgi.g_dd_11_data),
- static_cast<const void*>(cgi.g_dd_12_data),
- static_cast<const void*>(cgi.g_dd_13_data),
- static_cast<const void*>(cgi.g_dd_22_data),
- static_cast<const void*>(cgi.g_dd_23_data),
- static_cast<const void*>(cgi.g_dd_33_data),
- static_cast<const void*>(cgi.K_dd_11_data),
- static_cast<const void*>(cgi.K_dd_12_data),
- static_cast<const void*>(cgi.K_dd_13_data),
- static_cast<const void*>(cgi.K_dd_22_data),
- static_cast<const void*>(cgi.K_dd_23_data),
- static_cast<const void*>(cgi.K_dd_33_data),
- static_cast<const void*>(cgi.psi_data),
+ static_cast<const void*>(cgi.g_dd_11_dataptr),
+ static_cast<const void*>(cgi.g_dd_12_dataptr),
+ static_cast<const void*>(cgi.g_dd_13_dataptr),
+ static_cast<const void*>(cgi.g_dd_22_dataptr),
+ static_cast<const void*>(cgi.g_dd_23_dataptr),
+ static_cast<const void*>(cgi.g_dd_33_dataptr),
+ static_cast<const void*>(cgi.K_dd_11_dataptr),
+ static_cast<const void*>(cgi.K_dd_12_dataptr),
+ static_cast<const void*>(cgi.K_dd_13_dataptr),
+ static_cast<const void*>(cgi.K_dd_22_dataptr),
+ static_cast<const void*>(cgi.K_dd_23_dataptr),
+ static_cast<const void*>(cgi.K_dd_33_dataptr),
+ static_cast<const void*>(cgi.psi_dataptr),
};
const int N_input_arrays_for_psi = 1;
diff --git a/src/gr/gr.hh b/src/gr/gr.hh
index b6720ae..bcc8702 100644
--- a/src/gr/gr.hh
+++ b/src/gr/gr.hh
@@ -75,7 +75,7 @@ struct cactus_grid_info
// true ==> the Cactus g_ij are conformal values as per
// CactusEinstein/StaticConformal and the psi gridfn
// false ==> the Cactus g_ij are the physical metric
- bool Cactus_conformal_metric;
+ bool use_Cactus_conformal_metric;
// Cactus coordinate system
fp global_coord_origin[N_GRID_DIMS]; // global (x,y,z)
@@ -127,7 +127,7 @@ struct cactus_grid_info
int K_dd_11_varindex, K_dd_12_varindex, K_dd_13_varindex,
K_dd_22_varindex, K_dd_23_varindex,
K_dd_33_varindex;
- int psi_varindex; // unused if !Cactus_conformal_metric
+ int psi_varindex; // unused if !use_Cactus_conformal_metric
//
// stuff for doing a local interpolation via CCTK_InterpLocalUniform()
@@ -136,19 +136,19 @@ struct cactus_grid_info
//
// --> Cactus gridfn data for grid posn (0,0,0)
- const fp* g_dd_11_data;
- const fp* g_dd_12_data;
- const fp* g_dd_13_data;
- const fp* g_dd_22_data;
- const fp* g_dd_23_data;
- const fp* g_dd_33_data;
- const fp* K_dd_11_data;
- const fp* K_dd_12_data;
- const fp* K_dd_13_data;
- const fp* K_dd_22_data;
- const fp* K_dd_23_data;
- const fp* K_dd_33_data;
- const fp* psi_data; // NULL if !Cactus_conformal_metric
+ const fp* g_dd_11_dataptr;
+ const fp* g_dd_12_dataptr;
+ const fp* g_dd_13_dataptr;
+ const fp* g_dd_22_dataptr;
+ const fp* g_dd_23_dataptr;
+ const fp* g_dd_33_dataptr;
+ const fp* K_dd_11_dataptr;
+ const fp* K_dd_12_dataptr;
+ const fp* K_dd_13_dataptr;
+ const fp* K_dd_22_dataptr;
+ const fp* K_dd_23_dataptr;
+ const fp* K_dd_33_dataptr;
+ const fp* psi_dataptr; // NULL if !use_Cactus_conformal_metric
};
//