aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/TODO7
-rw-r--r--doc/documentation.tex262
-rw-r--r--par/misner1.2-025-init-mask.par13
-rw-r--r--param.ccl83
-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
11 files changed, 554 insertions, 331 deletions
diff --git a/doc/TODO b/doc/TODO
index 671d6d3..1e39684 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,13 +1,6 @@
small things
set centroid variables for drift correction
read IO parameters to set (default) directory in which we write output files
- it should be possible to set a mask to different values in the
- excised region, in the buffer zone between there & the AH,
- and outside the AH; also it should be possible to supress
- setting the mask (i.e. just leave it unchanged) in any subset of these
- there should to be an option to make the excised region never shrink,
- i.e. if a point is ever excised then it would stay excised for the
- rest of the run
add an option to compute/output the surface radius on a latitude/longitude
grid
I should set CXXFLAGS for this thorn to turn off automagic template
diff --git a/doc/documentation.tex b/doc/documentation.tex
index 9487040..4661919 100644
--- a/doc/documentation.tex
+++ b/doc/documentation.tex
@@ -114,6 +114,7 @@
\def\Cplusplus{\hbox{C\raise.25ex\hbox{\footnotesize ++}}}
% misc math mode stuff
+\def\assign{\leftarrow} % for pseudocode algorithms
\def\ltsim{\lesssim}
\def\gtsim{\gtrsim}
%%\def\tfrac#1#2{{\textstyle \frac{#1}{#2}}}
@@ -796,127 +797,218 @@ controlled by the following parameters:
This thorn can optionally set a mask grid function (or functions)
at each point of the Cactus grid, to indicate where that point is
with respect to the apparent horizon(s). This is usually used for
-excision. This feature is controlled by the following parameteters:
+excision.
\begin{description}
-\item[\code{set\_horizon\_mask}]
+\item[\code{set\_mask}]
\mbox{}\\
If this Boolean parameter is set to true,
- \thorn{AHFinderDirect} will set a mask grid function.
+ \thorn{AHFinderDirect} will set a mask grid function(s).
This parameter defaults to false (don't set a mask).
+ If this parameter is set to true, you almost certainly also
+ need to set the Boolean parameter \verb|SpaceMask::use_mask|
+ to true to to turn on storage for the mask grid function(s)!
+\end{description}
+
+If \verb|set_mask| is set, \thorn{AHFinderDirect} partitions the
+Cactus grid into 3~regions: an \defn{inside}, a \defn{buffer},
+and an \defn{outside}. Typically the inner region is excised, but
+\thorn{AHFinderDirect} doesn't itself do this -- you need to set up
+any excision parameters separately.
+
+The 3~regions are defined as follows: For a grid point a distance $r[i]$
+from horizon~$i$'s local coordinate origin, with horizon~$i$'s radius
+in this same direction (again, measured from its local coordinate origin)
+being $r_\text{horizon}[i]$,%%%
+\footnote{%%%
+ Note that these are flat-space distances
+ $[(x-x_0)^2 + (y - y_0)^2 + (z-z_0)^2]^{1/2}$
+ -- the spacetime metric is {\em not\/} used here.
+ }%%%
+{} the regions are defined by
+\begin{equation}
+\renewcommand{\arraystretch}{1.333}
+\begin{tabular}{l@{~}lll@{~}lll}
+$r[i] \le r_\text{inner}[i]$ & \text{for some $i$}
+ &
+ & &
+ & $\Rightarrow$ & \text{inner} \\
+$r[i] > r_\text{inner}[i]$ & \text{for all $i$}
+ & \text{and} &
+ $r[i] \le r_\text{outer}[i]$ & \text{for some $i$}
+ & $\Rightarrow$ & \text{buffer} \\
+$r[i] > r_\text{outer}[i]$ & \text{for all $i$}
+ &
+ & &
+ & $\Rightarrow$ & \text{outer} %%%\\
+\end{tabular}
+\end{equation}
+where
+\begin{equation}
+\renewcommand{\arraystretch}{1.333}
+\begin{array}{lcl}
+r_\text{inner}
+ & = & \verb|mask_radius_multiplier| \times r_\text{horizon}
+ \,\,+\,\, \verb|mask_radius_offset| \times \Delta x
+ \\
+r_\text{outer}
+ & = & r_\text{inner}
+ \,\,+\,\, \verb|mask_buffer_thickness| \times \Delta x
+ %%%\\
+\end{array}
+ \label{AHFinderDirect/eqn-r-inside-outside}
+\end{equation}
+and where $\Delta x$ is the Cactus grid spacing (more precisely,
+the geometric mean of the $x$, $y$, and $z$ Cactus grid spacings).
+
+\begin{description}
\item[%%%
\begin{tabular}{@{}l@{}}
- \code{mask\_radius\_multiplier[}$n$\code{]} \\
- \code{mask\_radius\_offset[}$n$\code{]} %%%\\
+ \code{mask\_radius\_multiplier} \\
+ \code{mask\_radius\_offset} \\
+ \code{mask\_buffer\_thickness} %%%\\
\end{tabular}
]
\mbox{}\\
- If we set a mask, we do so based on a \defn{mask volume}
- for each horizon. This is defined by
- \begin{equation}
- r(\rho,\sigma) = \verb|mask_radius_multiplier| \times h(\rho,\sigma)
- \,\,+\,\, \verb|mask_radius_offset| \times \Delta x
- \end{equation}
- where $(\rho,\sigma)$ are generic angular coordinates
- on the horizon surface, $h(\rho,\sigma)$ gives the horizon
- radius, $\Delta x$ is the Cactus grid spacing%%%
-\footnote{%%%
- More precisely, $\Delta x$ is the geometric mean
- of the $x$, $y$, and $z$ Cactus grid spacings.%%%
- }%%%
-, and $r(\rho,\sigma)$ gives the radius of the mask volume.
- The default values are $\verb|mask_radius_multiplier| = 0.9$
- and $\verb|mask_radius_offset| = -5.0$ for each $n$,
- giving a ``buffer zone'' (between the mask volume and
- the horizon) of 20\% of the horizon radius, plus an extra
- 5~Cactus grid spacings.
+ These parameters are used to define the radia $r_\text{inner}$
+ and $r_\text{outer}$ in
+ equation~\eqref{AHFinderDirect/eqn-r-inside-outside} above.
Note that the sign convention here is that
\verb|mask_radius_multiplier| is {\em multiplied\/}
by the horizon radius, then \verb|mask_radius_offset|
(scaled by the Cactus grid spacing) is {\em added\/}.
- Thus for use with excision (where the mask region should
- be somewhat {\em inside\/} the horizon), you should choose
- \verb|mask_radius_multiplier| to be a positive real number
- slightly less than 1.0, and \verb|mask_radius_offset|
- a negative real number.%%%
-\footnote{%%%
- As another example, if you were to choose
- $\code{mask\_radius\_multiplier} = 1.0$ and
- $\code{mask\_radius\_offset} = 0.0$ then the mask volume
- would be precisely the horizon's interior (\ie{} there would
- be no buffer zone), so all Cactus grid points inside/outside
- the horizon would be set to the ``inside''/``outside'' states
- respectively.
- }%%%
+ Thus for use with excision (where the inner region --
+ which will be excised -- must be somewhat {\em inside\/}
+ the horizon), \verb|mask_radius_multiplier| should be a
+ positive real number slightly less than~1.0, and
+ \verb|mask_radius_offset| a negative real number.
-\item[%%%
- \begin{tabular}{@{}l@{}}
- \code{set\_old\_style\_mask} \\
- \code{set\_new\_style\_mask} %%%\\
- \end{tabular}
- ]
+ The default values for these parameters are
+ \begin{verbatim}
+ mask_radius_multiplier = 0.8
+ mask_radius_offset = -5.0
+ mask_buffer_thickness = 5.0
+ \end{verbatim}
+
+\item[\code{mask\_is\_noshrink}]
\mbox{}\\
- \thorn{AHFinderDirect} supports two types of mask grid functions;
- these Boolean parameters choose which of them you want to set:
+ This Boolean parameter specifies whether the inside and
+ buffer regions should be prevented from ever shrinking
+ during a time evolution (this is the default), or whether
+ they should be set independently from one time step to the
+ next (and thus allowed to either grow or shrink). More
+ precisely, once a given grid point has been classified as
+ inside, buffer, or outside, \thorn{AHFinderDirect} executes
+ the following algorithm:
\begin{description}
- \item[\code{set\_old\_style\_mask}]
- \mbox{}\\
- This parameter (default \verb|"true"|) specifies an
- old-style excision mask, where a \verb|CCTK_REAL|
- Cactus grid function is set to one value inside the
- mask volume, and another value outside. (This is how
- the \thorn{AHFinder} apparent horizon finder works.)
- \item[\code{set\_new\_style\_mask}]
- \mbox{}\\
- This parameter (default \verb|"false"|) specifies a
- new-style excision mask, where a specified bit field
- in a \verb|CCTK_INT| Cactus grid function is set to
- one value inside the mask volume, and another value
- outside. The bit field is specified by its name,
- as registered with the \thorn{SpaceMask} thorn.
- We plan to eventually convert all Cactus excision
- (and other uses of mask grid functions) to this scheme,
- but at the moment not much code supports it.
- Note that \thorn{AHFinderDirect} doesn't itself set
- up any bit fields -- you must arrange for some other
- thorn(s) to do this.
+ \item[inside]\mbox{}\\[-\baselineskip]
+ \begin{tabbing}
+ $\verb|mask| \assign \verb|inside_value|$ %%%\\
+ \end{tabbing}
+ \item[buffer]\mbox{}\\[-\baselineskip]
+ \begin{tabbing}
+ if \=(\verb|mask_is_noshrink|) \+\\
+ then \=
+ \{ \+\\
+ if \=($\verb|mask| \ne \verb|inside_value|$) \+\\
+ then $\verb|mask| \assign \verb|buffer_value|$
+ \-\\
+ \} \-\\
+ else \>$\verb|mask| \assign \verb|buffer_value|$ \-%%%\\
+ \end{tabbing}
+ \item[outside]\mbox{}\\[-\baselineskip]
+ \begin{tabbing}
+ if \=(\verb|mask_is_noshrink|) \+\\
+ then \=
+ \{ \+\\
+ if \=(($\verb|mask| \ne \verb|inside_value|$)
+ and
+ ($\verb|mask| \ne \verb|buffer_value|$)) \+\\
+ then $\verb|mask| \assign \verb|outside_value|$
+ \-\\
+ \} \-\\
+ else \>$\verb|mask| \assign \verb|outside_value|$ \-%%%\\
+ \end{tabbing}
\end{description}
+\end{description}
+
+\thorn{AHFinderDirect} supports two types of mask grid functions;
+the following two Boolean parameters choose which of them you want
+to set; you can set either or even both of these:
+\begin{description}
+\item[\code{set\_old\_style\_mask}]
+\mbox{}\\
+ This parameter (default \verb|"true"|) specifies an
+ old-style excision mask, one stored in a \verb|CCTK_REAL|
+ Cactus grid function. (The \thorn{AHFinder} apparent horizon
+ finder uses this type of mask.)
+
+\item[\code{set\_new\_style\_mask}]
+\mbox{}\\
+ This parameter (default \verb|"false"|) specifies a
+ new-style excision mask, one stored in a specified bit field
+ of a \verb|CCTK_INT| Cactus grid function.
+ The bit field is specified by its name,
+ as registered with the \thorn{SpaceMask} thorn.
+ We plan to eventually convert all Cactus excision
+ (and other uses of mask grid functions) to this scheme,
+ but at the moment not much code supports it.
+ Note that \thorn{AHFinderDirect} doesn't itself create/register
+ any bit fields or state names with \thorn{SpaceMask} --
+ you must arrange for some other thorn(s) to do this.
+\end{description}
+
+For an old-style mask, the following parameters specify the mask grid
+function and how it should be set:
+\begin{description}
+\item[\code{old\_style\_mask\_gridfn\_name}]
+\mbox{}\\
+ This parameter specifies the mask grid function's name.
\item[%%%
\begin{tabular}{@{}l@{}}
- \code{old\_style\_mask\_gridfn\_name} \\
\code{old\_style\_mask\_inside\_value} \\
+ \code{old\_style\_mask\_buffer\_value} \\
\code{old\_style\_mask\_outside\_value} %%%\\
\end{tabular}
]
\mbox{}\\
- If \verb|mask_type| is set to \verb|"old-style (CCTK_REAL)"|,
- these parameters specify the mask grid function's name and
- the (\verb|CCTK_REAL|) ``inside'' and ``outside'' values
- respectively.
+ If an old-style mask is to be set in the corresponding
+ regions, these parameters specify the values to which
+ it should be set. These are all \verb|CCTK_REAL| values.
+\end{description}
+For an new-style mask, the following parameters specify the mask grid
+function and how it should be set:
+\begin{description}
\item[%%%
\begin{tabular}{@{}l@{}}
- \code{new\_style\_mask\_gridfn\_name} \\
- \code{new\_style\_mask\_inside\_state\_name} \\
- \code{new\_style\_mask\_outside\_state\_name} %%%\\
+ \code{new\_style\_mask\_gridfn\_name} \\
+ \code{new\_style\_mask\_bitfield\_name} %%%\\
\end{tabular}
]
\mbox{}\\
- If \verb|mask_type| is set to \verb|"new-style (CCTK_INT)"|,
- these parameters specify the mask grid function's name,
- and the ``state'' names for ``inside'' and ``outside'' values
- as registered with the \thorn{SpaceMask} thorn.
+ These parameters specify the mask grid function's name
+ and the bitfield name within it.
- Note that at present \thorn{AHFinderDirect} only converts these
- character strings into integer bit masks once, in its startup
- routine. This may change at some point to (re-)doing the
- conversion at each horizon finding; this would work better if
- the string names aren't registered until after \thorn{AHFinderDirect}'s
- startup routine runs.
+\item[%%%
+ \begin{tabular}{@{}l@{}}
+ \code{new\_style\_mask\_inside\_value} \\
+ \code{new\_style\_mask\_buffer\_value} \\
+ \code{new\_style\_mask\_outside\_value} %%%\\
+ \end{tabular}
+ ]
+\mbox{}\\
+ If an new-style mask is to be set in the corresponding
+ regions, these parameters specify the values to which
+ it should be set. These are all character-string state
+ names, as registered with the \thorn{SpaceMask} thorn.
\end{description}
+Note that \thorn{AHFinderDirect} doesn't itself register any bitfields
+or states with \thorn{SpaceMask} -- you must arrange for some other thorn(s)
+to do this before \thorn{AHFinderDirect} tries to find the horizon(s).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/par/misner1.2-025-init-mask.par b/par/misner1.2-025-init-mask.par
index 0914452..1acd2d0 100644
--- a/par/misner1.2-025-init-mask.par
+++ b/par/misner1.2-025-init-mask.par
@@ -78,14 +78,15 @@ AHFinderDirect::find_AHs_at_poststep = "false"
AHFinderDirect::print_timing_stats = "true"
##AHFinderDirect::verbose_level = "algorithm details"
-AHFinderDirect::set_horizon_mask = "true"
+AHFinderDirect::set_mask = "true"
AHFinderDirect::set_old_style_mask = "true"
AHFinderDirect::set_new_style_mask = "false"
-# have mask directly show horizon position for testing (no buffer zone)
-AHFinderDirect::mask_radius_multiplier[1] = 1.0
-AHFinderDirect::mask_radius_multiplier[2] = 1.0
-AHFInderDirect::mask_radius_offset[1] = 0.0
-AHFInderDirect::mask_radius_offset[2] = 0.0
+
+# inside = horizon - 5 grid points
+# buffer = from there out to horizon
+AHFinderDirect::mask_radius_multiplier = 1.0
+AHFInderDirect::mask_radius_offset = -5.0
+AHFInderDirect::mask_buffer_thickness = 5.0
AHFinderDirect::h_base_file_name = "misner1.2-025-init.h"
diff --git a/param.ccl b/param.ccl
index 8e16bfe..855418d 100644
--- a/param.ccl
+++ b/param.ccl
@@ -403,37 +403,59 @@ string Jacobian_base_file_name "base file name for Jacobian output file(s)"
# ***** based on each apparent horizon shape *****
#
-boolean set_horizon_mask \
+boolean set_mask \
"should we set a mask grid function (or functions) for each horizon?"
{
} "false"
#
-# If we set a mask, we do so based on a "mask volume" for each horizon,
-# defined by
-# r(rho,sigma) = mask_radius_multiplier*h(rho,sigma)
-# + dx*mask_radius_offset
+# If we set a mask, we do so based on partitioning the Cactus grid into
+# 3 regions, an "inside", a "buffer", and an "outside" (typically the inside
+# region is excised). For a grid point a distance r[i] from horizon i's
+# local coordinate origin, with horizon i's radius in this same direction
+# (again, measured from its local coordinate origin) being r_horizon[i],
+# the regions are defined as follows:
+# r[i] <= r_inner[i] for some i ==> inside
+# r[i] > r_inner[i] for all i
+# and r[i] <= r_outer[i] for some i ==> buffer
+# r[i] > r_outer[i] for all i ==> outside
# where
-# r(rho,sigma) = gives the adjusted-horizon radius
-# as a function of angular coordinates about
-# the local coordinate origin
-# h(rho,sigma) = gives the radius of the apparent horizon
-# as a function of angular coordinates about
-# the local coordinate origin
-# dx = geometric mean of the Cactus x, y, and z grid spacings
+# r_inner = mask_radius_multiplier * r_horizon
+# + mask_radius_offset * Delta_x
+# r_outer = r_innter + mask_buffer_thickness * Delta_x
+# and where Delta_x is the Cactus grid spacing (more precisely,
+# the geometric mean of the x, y, and z Cactus grid spacings).
#
-real mask_radius_multiplier[5] \
- "radius multiplier to define the mask volume for this horizon"
+real mask_radius_multiplier \
+ "radius multiplier to define the 'inside' mask region"
{
(0:*) :: \
"any positive real number; typically this will be slightly less than 1.0"
} 0.8
-real mask_radius_offset[5] \
- "radius offset (in Cactus grid spacings) to define the mask volume \
- for this horizon"
+real mask_radius_offset \
+ "radius offset (in Cactus grid spacings) to define the 'inside' mask region"
{
*:* :: "any real number; typically this will be negative"
} -5.0
+real mask_buffer_thickness \
+ "thickness (in Cactus grid spacings) of the 'buffer' mask region"
+{
+*:* :: "any real number; typically this will be positive"
+} 5.0
+
+#
+# If this parameter is set to true, then we prevent the inside & buffer
+# regions from ever shrinking, i.e. if a point is ever set to the inside
+# value then we leave at that value forever, and if it's ever set to
+# the buffer value then we leave at that value or the inside value forever.
+# If this parameter is set to false, then we set the inside/buffer/outside
+# values independently at each time step, so all three regions can grow
+# or shrink depending on the horizon positions/shapes.
+#
+boolean mask_is_noshrink \
+ "should we prevent the inside & buffer regions from ever shrinking?"
+{
+} "true"
#
# This thorn supports two types of mask grid functions:
@@ -469,12 +491,17 @@ string old_style_mask_gridfn_name "name of the old-style mask grid function"
.+ :: "any valid Cactus grid function name"
} "SpaceMask::emask"
real old_style_mask_inside_value \
- "set the old-style mask to this value *inside* the mask volume"
+ "set the old-style mask to this value in the 'inside' region"
{
*:* :: "any real number"
} 0.0
+real old_style_mask_buffer_value \
+ "set the old-style mask to this value in the 'buffer' region"
+{
+*:* :: "any real number"
+} 0.5
real old_style_mask_outside_value \
- "set the old-style mask to this value *outside* the mask volume"
+ "set the old-style mask to this value in the 'outside' region"
{
*:* :: "any real number"
} 1.0
@@ -491,18 +518,24 @@ string new_style_mask_bitfield_name \
{
.+ :: "any valid bit field ('type') name registered with the SpaceMask thorn"
} "mask"
-string new_style_mask_inside_state_name \
+string new_style_mask_inside_value \
+ "set the specified bit field of the new-style mask to this named state \
+ at grid points in the 'inside' region"
+{
+.+ :: "any state name registered with the SpaceMask thorn"
+} "inside"
+string new_style_mask_buffer_value \
"set the specified bit field of the new-style mask to this named state \
- at grid points *inside* the mask volume"
+ at grid points in the 'buffer' region"
{
.+ :: "any state name registered with the SpaceMask thorn"
-} "excised"
-string new_style_mask_outside_state_name \
+} "buffer"
+string new_style_mask_outside_value \
"set the specified bit field of the new-style mask to this named state \
- at grid points *outside* the mask volume"
+ at grid points in the 'outside' region"
{
.+ :: "any state name registered with the SpaceMask thorn"
-} "normal"
+} "outside"
################################################################################
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
};
//