Ejemplo n.º 1
0
 void add_arguments_to_kernel_rec(evnt_vec& events, args_vec& arguments, 
                                  T0& arg0, Ts&... args) {
     cl_int err{0};
     size_t buffer_size = sizeof(typename T0::value_type) * arg0.size();
     auto buffer = clCreateBuffer(m_context.get(),
                                  CL_MEM_READ_ONLY,
                                  buffer_size,
                                  nullptr,
                                  &err);
     if (err != CL_SUCCESS) {
         CPPA_LOGMF(CPPA_ERROR, "clCreateBuffer: " << get_opencl_error(err));
         return;
     }
     cl_event event;
     err = clEnqueueWriteBuffer(m_queue.get(), buffer, CL_FALSE, 0,
                                buffer_size, arg0.data(),
                                0, nullptr, &event);
     if (err != CL_SUCCESS) {
         CPPA_LOGMF(CPPA_ERROR, "clEnqueueWriteBuffer: "
                                << get_opencl_error(err));
         return;
     }
     events.push_back(std::move(event));
     mem_ptr tmp;
     tmp.adopt(std::move(buffer));
     arguments.push_back(tmp);
     add_arguments_to_kernel_rec(events, arguments, args...);
 }
 result_type operator() (T0 & bbox, T1 const& pos) const
 {
     if (pos)
     {
         double x = std::get<0>(*pos);
         double y = std::get<1>(*pos);
         if (!bbox.valid())
         {
             bbox.init(x, y, x, y); //TODO: add init(x,y) convinience method
         }
         else
         {
             bbox.expand_to_include(x, y);
         }
     }
 }
Ejemplo n.º 3
0
void set_gamma_method(T0 const& obj, T1 & ras_ptr)
{
    switch (obj.get_gamma_method())
    {
    case GAMMA_POWER:
        ras_ptr->gamma(agg::gamma_power(obj.get_gamma()));
        break;
    case GAMMA_LINEAR:
        ras_ptr->gamma(agg::gamma_linear(0.0, obj.get_gamma()));
        break;
    case GAMMA_NONE:
        ras_ptr->gamma(agg::gamma_none());
        break;
    case GAMMA_THRESHOLD:
        ras_ptr->gamma(agg::gamma_threshold(obj.get_gamma()));
        break;
    case GAMMA_MULTIPLY:
        ras_ptr->gamma(agg::gamma_multiply(obj.get_gamma()));
        break;
    default:
        ras_ptr->gamma(agg::gamma_power(obj.get_gamma()));
    }
}
Ejemplo n.º 4
0
 result_type operator() (T0 & coords, T1 const& pos) const
 {
     if (pos) coords.push_back(*pos);
 }
Ejemplo n.º 5
0
 result_type operator() (T0 & feature, T1 && geom) const
 {
     return feature.set_geometry(std::move(geom));
 }
Ejemplo n.º 6
0
 result_type operator() (T0 & feature, T1 const& key, T2 && val) const
 {
     feature.put_new(key, mapnik::util::apply_visitor(attribute_value_visitor(tr_),val));
 }
 void operator() (T0 & boxes, T1 const& begin, T2 const& box, T3 const& range) const
 {
     if (box.valid()) boxes.emplace_back(box, std::make_pair(std::distance(begin, range.begin()), std::distance(range.begin(), range.end())));
 }
Ejemplo n.º 8
0
 _permutations<T0> permutations(T0 iter)
 {
     return _permutations<T0>(iter, std::distance(iter.begin(), iter.end()));
 }
Ejemplo n.º 9
0
void stdv_to_vectort(T0 &v1, igraph_vector_t &v2) {
	size_t n = v1.size();
	igraph_vector_resize(&v2, n);
	for (size_t i = 0; i < n; i++) VECTOR(v2)[i] = v1[i];
}
Ejemplo n.º 10
0
 static void process(T0 & ren, T1 const& sym, T2 & f, T3 const& tr)
 {
     ren.process(sym,f,tr);
 }