diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-07-22 17:00:28 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-07-22 17:19:53 -0500 |
commit | d603265db8e2db48fc3c459d9aa510bed225d505 (patch) | |
tree | 13b45d09086a5dea429f4ff7bb2fb110aca80ec0 /Carpet/CarpetInterp2 | |
parent | 54a193fcbf1a221e1772aa00e74d03c45e84ff1a (diff) |
CarpetInterp2: New function fasterp_setup_t
Add a new fasterp_setup_t which sets up an interpolation starting from
local coordinates and patch numbers.
Diffstat (limited to 'Carpet/CarpetInterp2')
-rw-r--r-- | Carpet/CarpetInterp2/src/fasterp.cc | 42 | ||||
-rw-r--r-- | Carpet/CarpetInterp2/src/fasterp.hh | 14 |
2 files changed, 49 insertions, 7 deletions
diff --git a/Carpet/CarpetInterp2/src/fasterp.cc b/Carpet/CarpetInterp2/src/fasterp.cc index 1c945710f..ac56ee293 100644 --- a/Carpet/CarpetInterp2/src/fasterp.cc +++ b/Carpet/CarpetInterp2/src/fasterp.cc @@ -231,7 +231,7 @@ namespace CarpetInterp2 { - // Set up an interpolation + // Set up an interpolation starting from global coordinates fasterp_setup_t:: fasterp_setup_t (cGH const * restrict const cctkGH, fasterp_glocs_t const & locations, @@ -240,8 +240,6 @@ namespace CarpetInterp2 { { // Some global properties int const npoints = locations.size(); - int const nprocs = CCTK_nProcs (cctkGH); - // int const myproc = CCTK_MyProc (cctkGH); @@ -280,6 +278,36 @@ namespace CarpetInterp2 { } // if not multi-patch + setup (cctkGH, local_locations); + } + + + + // Set up an interpolation starting from local coordinates + fasterp_setup_t:: + fasterp_setup_t (cGH const * restrict const cctkGH, + fasterp_llocs_t const & locations, + int const order_) + : order (order_) + { + setup (cctkGH, locations); + } + + + + // Helper for setting up an interpolation + void + fasterp_setup_t:: + setup (cGH const * restrict const cctkGH, + fasterp_llocs_t const & locations) + { + // Some global properties + int const npoints = locations.size(); + int const nprocs = CCTK_nProcs (cctkGH); + // int const myproc = CCTK_MyProc (cctkGH); + + + // Obtain the coordinate ranges for all patches vector<rvect> lower (Carpet::maps); vector<rvect> upper (Carpet::maps); @@ -302,10 +330,10 @@ namespace CarpetInterp2 { int n_nz_nlocs = 0; assert (Carpet::is_level_mode()); for (int n=0; n<npoints; ++n) { - int const m = local_locations.maps.AT(n); - rvect const pos (local_locations.coords[0].AT(n), - local_locations.coords[1].AT(n), - local_locations.coords[2].AT(n)); + int const m = locations.maps.AT(n); + rvect const pos (locations.coords[0].AT(n), + locations.coords[1].AT(n), + locations.coords[2].AT(n)); gh const * const hh = Carpet::vhh.AT(m); ibbox const & baseext = hh->baseextent(Carpet::mglevel, 0); diff --git a/Carpet/CarpetInterp2/src/fasterp.hh b/Carpet/CarpetInterp2/src/fasterp.hh index 84b20da80..c34b9bf32 100644 --- a/Carpet/CarpetInterp2/src/fasterp.hh +++ b/Carpet/CarpetInterp2/src/fasterp.hh @@ -165,11 +165,19 @@ namespace CarpetInterp2 { send_descr_t send_descr; int order; + void + setup (cGH const * restrict cctkGH, + fasterp_llocs_t const & locations); + public: fasterp_setup_t (cGH const * restrict cctkGH, fasterp_glocs_t const & locations, int order); + fasterp_setup_t (cGH const * restrict cctkGH, + fasterp_llocs_t const & locations, + int order); + ~ fasterp_setup_t (); void @@ -177,6 +185,12 @@ namespace CarpetInterp2 { vector<int> const & varinds, vector<CCTK_REAL *> & values) const; + + size_t get_npoints () + const + { + return recv_descr.npoints; + } }; |