From a0e6739a89358e1ba578dfe7db345277c3341983 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 9 Mar 2010 00:38:37 +0000 Subject: [PATCH] Use a faster variant of functions. git-svn-id: https://svn.dealii.org/trunk@20759 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/polynomials_adini.cc | 146 +++++++++++------------ 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/deal.II/base/source/polynomials_adini.cc b/deal.II/base/source/polynomials_adini.cc index 9e25870cf4..1853754d1a 100644 --- a/deal.II/base/source/polynomials_adini.cc +++ b/deal.II/base/source/polynomials_adini.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -69,7 +69,7 @@ PolynomialsAdini::PolynomialsAdini() : ENTER_COEFFICIENTS( dy, 9, 0,-1, 0, 3, 0, 6,-2, 0,-6, 0, 0, 0); ENTER_COEFFICIENTS( dy, 10, 0, 0, 0,-1, 0, 0, 1, 0, 0, 0, 0, 0); ENTER_COEFFICIENTS( dy, 11, 0, 0, 0, 0, 0,-2, 0, 0, 3, 0, 0, 0); - + // 0 1 2 3 4 5 6 7 8 9 10 11 ENTER_COEFFICIENTS( dxx, 0,-6, 12, 6, 0, 0,-12, 0, 0, 0, 0, 0, 0); ENTER_COEFFICIENTS( dxx, 1,-4, 6, 4, 0, 0, -6, 0, 0, 0, 0, 0, 0); @@ -111,13 +111,13 @@ PolynomialsAdini::PolynomialsAdini() : ENTER_COEFFICIENTS( dxy, 11, 0, 0,-2, 0, 3, 0, 0, 0, 0, 0, 0, 0); } -void -PolynomialsAdini::compute (const Point<2> &unit_point, +void +PolynomialsAdini::compute (const Point<2> &unit_point, std::vector &values, std::vector > &grads, std::vector< Tensor<2,2> > &grad_grads) const { - if(values.size()>0)//nur dann was tun + if(values.empty() == false)//nur dann was tun { for(unsigned int i=0; i &unit_point, } } - if(grads.size()>0)//nur dann was tun + if(grads.empty() == false)//nur dann was tun { for(unsigned int i=0; i0)//nur dann was tun + + if(grad_grads.empty() == false)//nur dann was tun { for(unsigned int i=0; i &p) { const double x = p(0); const double y = p(1); - return coef( 0,i) + - coef( 1,i)*x + - coef( 2,i)*y + - coef( 3,i)*x*x + - coef( 4,i)*y*y + - coef( 5,i)*x*y + - coef( 6,i)*x*x*x + - coef( 7,i)*y*y*y + - coef( 8,i)*x*y*y + - coef( 9,i)*x*x*y + - coef(10,i)*x*x*x*y + + return coef( 0,i) + + coef( 1,i)*x + + coef( 2,i)*y + + coef( 3,i)*x*x + + coef( 4,i)*y*y + + coef( 5,i)*x*y + + coef( 6,i)*x*x*x + + coef( 7,i)*y*y*y + + coef( 8,i)*x*y*y + + coef( 9,i)*x*x*y + + coef(10,i)*x*x*x*y + coef(11,i)*x*y*y*y; } @@ -166,78 +166,78 @@ Tensor<1,2> PolynomialsAdini::compute_grad (const unsigned int i, const Point<2> const double x = p(0); const double y = p(1); Tensor<1,2> tensor; - tensor[0]= dx( 0,i) + - dx( 1,i)*x + - dx( 2,i)*y + - dx( 3,i)*x*x + - dx( 4,i)*y*y + - dx( 5,i)*x*y + - dx( 6,i)*x*x*x + - dx( 7,i)*y*y*y + - dx( 8,i)*x*y*y + - dx( 9,i)*x*x*y + - dx(10,i)*x*x*x*y + + tensor[0]= dx( 0,i) + + dx( 1,i)*x + + dx( 2,i)*y + + dx( 3,i)*x*x + + dx( 4,i)*y*y + + dx( 5,i)*x*y + + dx( 6,i)*x*x*x + + dx( 7,i)*y*y*y + + dx( 8,i)*x*y*y + + dx( 9,i)*x*x*y + + dx(10,i)*x*x*x*y + dx(11,i)*x*y*y*y; - tensor[1]= dy( 0,i) + - dy( 1,i)*x + - dy( 2,i)*y + - dy( 3,i)*x*x + - dy( 4,i)*y*y + - dy( 5,i)*x*y + - dy( 6,i)*x*x*x + - dy( 7,i)*y*y*y + - dy( 8,i)*x*y*y + - dy( 9,i)*x*x*y + - dy(10,i)*x*x*x*y + + tensor[1]= dy( 0,i) + + dy( 1,i)*x + + dy( 2,i)*y + + dy( 3,i)*x*x + + dy( 4,i)*y*y + + dy( 5,i)*x*y + + dy( 6,i)*x*x*x + + dy( 7,i)*y*y*y + + dy( 8,i)*x*y*y + + dy( 9,i)*x*x*y + + dy(10,i)*x*x*x*y + dy(11,i)*x*y*y*y; return tensor; -} +} Tensor<2,2> PolynomialsAdini::compute_grad_grad (const unsigned int i, const Point<2> &p) const { const double x = p(0); const double y = p(1); Tensor<2,2> tensor; - tensor[0][0]= dxx( 0,i) + - dxx( 1,i)*x + - dxx( 2,i)*y + - dxx( 3,i)*x*x + - dxx( 4,i)*y*y + + tensor[0][0]= dxx( 0,i) + + dxx( 1,i)*x + + dxx( 2,i)*y + + dxx( 3,i)*x*x + + dxx( 4,i)*y*y + dxx( 5,i)*x*y + - dxx( 6,i)*x*x*x + - dxx( 7,i)*y*y*y + - dxx( 8,i)*x*y*y + - dxx( 9,i)*x*x*y + - dxx(10,i)*x*x*x*y + + dxx( 6,i)*x*x*x + + dxx( 7,i)*y*y*y + + dxx( 8,i)*x*y*y + + dxx( 9,i)*x*x*y + + dxx(10,i)*x*x*x*y + dxx(11,i)*x*y*y*y; - tensor[0][1]= dxy( 0,i) + - dxy( 1,i)*x + - dxy( 2,i)*y + - dxy( 3,i)*x*x + - dxy( 4,i)*y*y + + tensor[0][1]= dxy( 0,i) + + dxy( 1,i)*x + + dxy( 2,i)*y + + dxy( 3,i)*x*x + + dxy( 4,i)*y*y + dxy( 5,i)*x*y + - dxy( 6,i)*x*x*x + - dxy( 7,i)*y*y*y + - dxy( 8,i)*x*y*y + - dxy( 9,i)*x*x*y + - dxy(10,i)*x*x*x*y + + dxy( 6,i)*x*x*x + + dxy( 7,i)*y*y*y + + dxy( 8,i)*x*y*y + + dxy( 9,i)*x*x*y + + dxy(10,i)*x*x*x*y + dxy(11,i)*x*y*y*y; tensor[1][0]= tensor[0][1]; - tensor[1][1]= dyy( 0,i) + - dyy( 1,i)*x + - dyy( 2,i)*y + - dyy( 3,i)*x*x + - dyy( 4,i)*y*y + + tensor[1][1]= dyy( 0,i) + + dyy( 1,i)*x + + dyy( 2,i)*y + + dyy( 3,i)*x*x + + dyy( 4,i)*y*y + dyy( 5,i)*x*y + - dyy( 6,i)*x*x*x + - dyy( 7,i)*y*y*y + - dyy( 8,i)*x*y*y + - dyy( 9,i)*x*x*y + - dyy(10,i)*x*x*x*y + + dyy( 6,i)*x*x*x + + dyy( 7,i)*y*y*y + + dyy( 8,i)*x*y*y + + dyy( 9,i)*x*x*y + + dyy(10,i)*x*x*x*y + dyy(11,i)*x*y*y*y; return tensor; -} +} DEAL_II_NAMESPACE_CLOSE -- 2.39.5