Ejemplo n.º 1
0
 /** The buffer content may be copied back on destruction to some
     final location */
 ~buffer() {
   /* If there is a final_data set and that points to something
      alive, copy back the data through the shared pointer */
   if (auto p = final_data.lock())
     std::copy_n(access.data(), access.num_elements(), p.get());
   /* If data are shared with the host but not concretely, we would
      have to copy back the data to the host */
   // else if (shared_data)
   //   std::copy_n(access.data(), access.num_elements(), shared_data.get());
 }
Ejemplo n.º 2
0
void fill(boost::multi_array_ref<V1,NumDims> &x, const V2 &v) {
    std::fill_n(x.data(), x.num_elements(), v);
}
Ejemplo n.º 3
0
 template <typename T, size_t dim> static void fill (boost::multi_array_ref<T, dim>& array, const T& value) {
   std::fill (array.data (), array.data () + array.num_elements (), value);
 }