diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-01-14 15:12:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-01-14 15:12:00 +0000 |
commit | 0cc61c57b87d0a72532a12a98d5daeac80fe70df (patch) | |
tree | e200f531c6abe4ecda83f60e2aa0caf1c3bdfb8f /Carpet/CarpetLib/src/ggf.cc | |
parent | 9a5fe470d0801aeb56d39243a2028318b4fe2252 (diff) |
CarpetLib: Add function ggf::fill, which fills all time levels
Add a new function ggf::fill, which fills all time levels from the
current time level.
Remove the function ggf::copy, which was unused.
darcs-hash:20080114151255-dae7b-469b57d0393ba0ed22590c2eabe862e02702fde7.gz
Diffstat (limited to 'Carpet/CarpetLib/src/ggf.cc')
-rw-r--r-- | Carpet/CarpetLib/src/ggf.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Carpet/CarpetLib/src/ggf.cc b/Carpet/CarpetLib/src/ggf.cc index 3a81a3677..f698835ec 100644 --- a/Carpet/CarpetLib/src/ggf.cc +++ b/Carpet/CarpetLib/src/ggf.cc @@ -257,19 +257,20 @@ void ggf::flip (int rl, int c, int ml) { -#if 0 -// Copy a component from the next time level -void ggf::copy (comm_state& state, int tl, int rl, int c, int ml) -{ - // Copy - static Timer timer ("copy"); - timer.start (); - transfer_from (state, - tl ,rl,c,ml, &dh::dboxes::exterior, - tl+1,rl, ml); - timer.stop (0); +// Fill all time levels from the current time level +void ggf::fill (int rl, int c, int ml) { + assert (rl>=0 and rl<h.reflevels()); + assert (c>=0 and c<h.components(rl)); + assert (ml>=0 and ml<h.mglevels()); + if (not h.is_local(rl,c)) return; + fdata const & fdatas = storage.AT(ml).AT(rl).AT(c); + void const * const srcptr = fdatas.AT(0)->storage(); + size_t const size = fdatas.AT(0)->size() * fdatas.AT(0)->elementsize(); + for (int tl=1; tl<timelevels(ml,rl); ++tl) { + void * const dstptr = fdatas.AT(tl)->storage(); + memcpy (dstptr, srcptr, size); + } } -#endif |