From: Denis Davydov Date: Fri, 3 Apr 2015 06:44:32 +0000 (+0200) Subject: Avoid a copy operation implemented by hand. This at least allows rvalue references... X-Git-Tag: v8.3.0-rc1~184^2~8 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8bac39174d024e823e16bfc27e5bcbc2bd2357b9;p=dealii.git Avoid a copy operation implemented by hand. This at least allows rvalue references in C++11 to work if the compiler supports it. --- diff --git a/include/deal.II/numerics/fe_field_function.templates.h b/include/deal.II/numerics/fe_field_function.templates.h index 64859236c6..28d8e4a911 100644 --- a/include/deal.II/numerics/fe_field_function.templates.h +++ b/include/deal.II/numerics/fe_field_function.templates.h @@ -139,13 +139,14 @@ namespace Functions FEValues fe_v(mapping, cell->get_fe(), quad, update_gradients); fe_v.reinit(cell); + + // FIXME: we need a temp argument because get_function_values wants to put + // its data into an object storing the correct scalar type, but this + // function wants to return everything in a vector std::vector< std::vector > > vgrads (1, std::vector >(n_components) ); fe_v.get_function_gradients(data_vector, vgrads); - const unsigned int s = vgrads[0].size(); - gradients.resize(s); - for (unsigned int i = 0; i < s; i++) - gradients[i] = vgrads[0][i]; + gradients = std::vector >(vgrads[0].begin(), vgrads[0].end()); } @@ -318,11 +319,10 @@ namespace Functions fe_v.get_present_fe_values ().get_function_gradients(data_vector, vgrads); for (unsigned int q=0; q > &viq = values[maps[i][q]]; const unsigned int s = vgrads[q].size(); - viq.resize(s); + values[maps[i][q]].resize(s); for (unsigned int l=0; l