From 880be55769936e6b37cbacc0e3cb3c00a6ca115d Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Mon, 12 Mar 2007 16:14:00 +0000 Subject: CarpetLib: Small regridding optimisation in gh class Do not copy the grid hierarchy, swap it instead. darcs-hash:20070312161422-dae7b-df574c2583c94cd81361d6a523c4e678b136f349.gz --- Carpet/CarpetLib/src/gh.cc | 3 ++- Carpet/CarpetLib/src/gh.hh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Carpet') diff --git a/Carpet/CarpetLib/src/gh.cc b/Carpet/CarpetLib/src/gh.cc index 159aa1e3d..1fa06ee2d 100644 --- a/Carpet/CarpetLib/src/gh.cc +++ b/Carpet/CarpetLib/src/gh.cc @@ -43,7 +43,8 @@ void gh::regrid (mregs const & regs) DECLARE_CCTK_PARAMETERS; // Save the old grid hierarchy - _oldregions = _regions; + _oldregions.clear (); + swap (_oldregions, _regions); _regions = regs; // Consistency checks diff --git a/Carpet/CarpetLib/src/gh.hh b/Carpet/CarpetLib/src/gh.hh index c48f3cd9c..619aeebf0 100644 --- a/Carpet/CarpetLib/src/gh.hh +++ b/Carpet/CarpetLib/src/gh.hh @@ -125,7 +125,7 @@ public: { return (int)_regions.AT(0).AT(rl).size(); } - + bool is_local (const int rl, const int c) const { return processor(rl,c) == dist::rank(); -- cgit v1.2.3