diff options
author | Erik Schnetter <schnetter@aei.mpg.de> | 2005-01-03 13:53:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@aei.mpg.de> | 2005-01-03 13:53:00 +0000 |
commit | c255f2a5e8475f4f4867bdc251836804545b882f (patch) | |
tree | 588606cb1f21d99096aac4bfd73b4a94937d7aeb | |
parent | 365415f06872899013bb5f530a5c3104c8fb6d00 (diff) |
CarpetLib: Rename data::interpolate_in_time to data::try_without_time_interpolation
darcs-hash:20050103135332-891bb-e92a19212dfbadde889fda0760232f5b7749aac3.gz
-rw-r--r-- | Carpet/CarpetLib/src/data.cc | 49 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/data.hh | 10 |
2 files changed, 31 insertions, 28 deletions
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc index 0b837e30e..5ff5c28d8 100644 --- a/Carpet/CarpetLib/src/data.cc +++ b/Carpet/CarpetLib/src/data.cc @@ -1050,28 +1050,6 @@ extern "C" { const int regbbox[3][3]); } -template<> -bool data<CCTK_REAL8> -::interpolate_in_time (const vector<const gdata*> & gsrcs, - const vector<CCTK_REAL> & times, - const ibbox& box, const CCTK_REAL time, - const int order_space, - const int order_time) { - for (size_t tl=0; tl<times.size(); ++tl) { - if (abs(times[tl] - time) < eps) { - vector<const gdata*> my_gsrcs(1); - vector<CCTK_REAL> my_times(1); - my_gsrcs[0] = gsrcs[tl]; - my_times[0] = times[tl]; - const int my_order_time = 0; - interpolate_from_innerloop - (my_gsrcs, my_times, box, time, order_space, my_order_time); - return true; - } - } - return false; -} - template<typename T> void data<T> ::interpolate_restrict (const vector<const data<T>*> & srcs, @@ -1503,6 +1481,29 @@ void data<CCTK_REAL8> } template<> +bool data<CCTK_REAL8> +::try_without_time_interpolation (const vector<const gdata*> & gsrcs, + const vector<CCTK_REAL> & times, + const ibbox& box, const CCTK_REAL time, + const int order_space, + const int order_time) +{ + for (size_t tl=0; tl<times.size(); ++tl) { + if (abs(times[tl] - time) < eps) { + vector<const gdata*> my_gsrcs(1); + vector<CCTK_REAL> my_times(1); + my_gsrcs[0] = gsrcs[tl]; + my_times[0] = times[tl]; + const int my_order_time = 0; + interpolate_from_innerloop + (my_gsrcs, my_times, box, time, order_space, my_order_time); + return true; + } + } + return false; +} + +template<> void data<CCTK_REAL8> ::interpolate_from_innerloop (const vector<const gdata*> gsrcs, const vector<CCTK_REAL> times, @@ -1538,8 +1539,10 @@ void data<CCTK_REAL8> bool did_time_interpolation = false; if (times.size() > 1) { + // try to avoid time interpolation if possible did_time_interpolation = - interpolate_in_time (gsrcs, times, box, time, order_space, order_time); + try_without_time_interpolation + (gsrcs, times, box, time, order_space, order_time); } if (!did_time_interpolation) { diff --git a/Carpet/CarpetLib/src/data.hh b/Carpet/CarpetLib/src/data.hh index 27b91acfb..9f0d9b6dd 100644 --- a/Carpet/CarpetLib/src/data.hh +++ b/Carpet/CarpetLib/src/data.hh @@ -150,11 +150,11 @@ public: // Output ostream& output (ostream& os) const; private: - bool interpolate_in_time (const vector<const gdata*> & gsrcs, - const vector<CCTK_REAL> & times, - const ibbox& box, const CCTK_REAL time, - const int order_space, - const int order_time); + bool try_without_time_interpolation (const vector<const gdata*> & gsrcs, + const vector<CCTK_REAL> & times, + const ibbox& box, const CCTK_REAL time, + const int order_space, + const int order_time); void interpolate_restrict (const vector<const data<T>*> & gsrcs, const vector<CCTK_REAL> & times, const ibbox& box); |