diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2005-11-19 21:36:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2005-11-19 21:36:00 +0000 |
commit | 0f55bae54ad1462224509f15e1c3f759120ac645 (patch) | |
tree | 6cab55a3973bfee9e7129846a872704cf64095c9 | |
parent | eb0efc4490f17c59d2dbbf028cdc15cca7bc5a34 (diff) |
CarpetReduce: Cache the grid function index of the weight function
Obtaining the weight function's index showed up high in a profile.
darcs-hash:20051119213646-dae7b-c0f463975c782b1a6854aa66a84169609efe2443.gz
-rw-r--r-- | Carpet/CarpetReduce/src/reduce.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Carpet/CarpetReduce/src/reduce.cc b/Carpet/CarpetReduce/src/reduce.cc index 1d0a5f448..59feb34c0 100644 --- a/Carpet/CarpetReduce/src/reduce.cc +++ b/Carpet/CarpetReduce/src/reduce.cc @@ -1100,8 +1100,13 @@ namespace CarpetReduce { CCTK_REAL const * weight; CCTK_REAL levfac; if (want_global_mode) { + static int iweight = -1; + if (iweight == -1) { + iweight = CCTK_VarIndex ("CarpetReduce::weight"); + assert (iweight >= 0); + } weight = (static_cast<CCTK_REAL const *> - (CCTK_VarDataPtr (cgh, 0, "CarpetReduce::weight"))); + (CCTK_VarDataPtrI (cgh, 0, iweight))); assert (weight); levfac = 1.0 / prod (rvect (spacereflevelfact)); } else { |