From d603265db8e2db48fc3c459d9aa510bed225d505 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Tue, 22 Jul 2008 17:00:28 -0500 Subject: CarpetInterp2: New function fasterp_setup_t Add a new fasterp_setup_t which sets up an interpolation starting from local coordinates and patch numbers. --- Carpet/CarpetInterp2/src/fasterp.cc | 42 ++++++++++++++++++++++++++++++------- Carpet/CarpetInterp2/src/fasterp.hh | 14 +++++++++++++ 2 files changed, 49 insertions(+), 7 deletions(-) (limited to 'Carpet/CarpetInterp2') 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 lower (Carpet::maps); vector upper (Carpet::maps); @@ -302,10 +330,10 @@ namespace CarpetInterp2 { int n_nz_nlocs = 0; assert (Carpet::is_level_mode()); for (int n=0; nbaseextent(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 const & varinds, vector & values) const; + + size_t get_npoints () + const + { + return recv_descr.npoints; + } }; -- cgit v1.2.3