diff options
author | Roland Haas <rhaas@tapir.caltech.edu> | 2013-09-04 14:45:56 -0700 |
---|---|---|
committer | Roland Haas <rhaas@tapir.caltech.edu> | 2013-09-27 10:41:38 -0700 |
commit | 0e435fca01c0ce3356565c661afb0ff9d64880a1 (patch) | |
tree | 78aa48df07d6def528a5b4368b96691e9de57722 /Carpet/CarpetLib/src/data.cc | |
parent | 38923afb0681b02fae2171cf54671cbe587ff748 (diff) |
CarpetLib: add some code for electric fence like functionality
Diffstat (limited to 'Carpet/CarpetLib/src/data.cc')
-rw-r--r-- | Carpet/CarpetLib/src/data.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/data.cc b/Carpet/CarpetLib/src/data.cc index 0d1b29d9e..9ed352df2 100644 --- a/Carpet/CarpetLib/src/data.cc +++ b/Carpet/CarpetLib/src/data.cc @@ -561,6 +561,19 @@ size_t data<T>::allocsize (const ibbox & extent_, const int proc_) const return vectorlength * prod (pad_shape (extent_)) * sizeof (T); } +template<typename T> +bool data<T>::check_fence (const int upperlower) const +{ + assert ((vectorleader != NULL) xor (vectorindex == 0)); + bool retval = true; + // since vectors share _memory we only check the first/last vector element + if ((vectorindex == 0 and upperlower == 0) or + (vectorindex == vectorlength-1 and upperlower == 1)) { + retval = _memory->is_fence_intact(upperlower); + } + return retval; +} + // Data manipulators |