From: kronbichler Date: Tue, 26 Jul 2011 15:13:11 +0000 (+0000) Subject: Improve performance of evaluation of tensor product polynomials: no need to allocate... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d3cfe0c060f5951f83c653334cb2a8e149161d3;p=dealii-svn.git Improve performance of evaluation of tensor product polynomials: no need to allocate memory. git-svn-id: https://svn.dealii.org/trunk@23965 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/base/tensor_product_polynomials.cc b/deal.II/source/base/tensor_product_polynomials.cc index 64e7676c08..ffd5baaa0b 100644 --- a/deal.II/source/base/tensor_product_polynomials.cc +++ b/deal.II/source/base/tensor_product_polynomials.cc @@ -141,9 +141,16 @@ TensorProductPolynomials::compute_grad (const unsigned int i, // uni-directional derivatives at // the given point in each // co-ordinate direction - std::vector > v(dim, std::vector (2)); - for (unsigned int d=0; d tmp (2); + for (unsigned int d=0; d grad; for (unsigned int d=0; d::compute_grad_grad (const unsigned int i, unsigned int indices[dim]; compute_index (i, indices); - std::vector > v(dim, std::vector (3)); - for (unsigned int d=0; d tmp (3); + for (unsigned int d=0; d grad_grad; for (unsigned int d1=0; d1 &p, std::vector > &grads, std::vector > &grad_grads) const { - Assert (values.size()==n_tensor_pols || values.size()==0, + Assert (values.size()==n_tensor_pols || values.size()==0, ExcDimensionMismatch2(values.size(), n_tensor_pols, 0)); - Assert (grads.size()==n_tensor_pols|| grads.size()==0, + Assert (grads.size()==n_tensor_pols || grads.size()==0, ExcDimensionMismatch2(grads.size(), n_tensor_pols, 0)); Assert (grad_grads.size()==n_tensor_pols|| grad_grads.size()==0, ExcDimensionMismatch2(grad_grads.size(), n_tensor_pols, 0)); @@ -225,17 +240,25 @@ compute (const Point &p, n_values_and_derivatives = 3; - // compute the values (and - // derivatives, if necessary) of - // all polynomials at this - // evaluation point - Table<2,std::vector > v(dim, polynomials.size()); - for (unsigned int d=0; d (that has enough + // fields for any evaluation of values and + // derivatives) + Table<2,Tensor<1,3> > v(dim, polynomials.size()); + { + std::vector tmp (n_values_and_derivatives); + for (unsigned int d=0; d