aboutsummaryrefslogtreecommitdiff
path: root/src/patch/patch_system.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/patch/patch_system.hh')
-rw-r--r--src/patch/patch_system.hh119
1 files changed, 111 insertions, 8 deletions
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()