From: bangerth Date: Tue, 26 Jun 2007 05:05:31 +0000 (+0000) Subject: Use Utilities::fixed_power X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c085dbc120fbbdccacdc26b949c7dd926b24f75;p=dealii-svn.git Use Utilities::fixed_power git-svn-id: https://svn.dealii.org/trunk@14809 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/fe/fe_abf.cc b/deal.II/deal.II/source/fe/fe_abf.cc index ce9c2b20c9..d229bef1fe 100644 --- a/deal.II/deal.II/source/fe/fe_abf.cc +++ b/deal.II/deal.II/source/fe/fe_abf.cc @@ -11,6 +11,7 @@ // //--------------------------------------------------------------------------- +#include #include #include #include @@ -413,7 +414,7 @@ FE_ABF::initialize_restriction() // have to do it here. this->restriction[child](face*this->dofs_per_face+i_face, i_child) - += std::pow(.5, dim-1.) * q_sub.weight(k) + += Utilities::fixed_power(.5) * q_sub.weight(k) * cached_values(i_child, k) * this->shape_value_component(face*this->dofs_per_face+i_face, q_sub.point(k), diff --git a/deal.II/deal.II/source/fe/fe_raviart_thomas.cc b/deal.II/deal.II/source/fe/fe_raviart_thomas.cc index 5dba3929a8..bc4ceb87da 100644 --- a/deal.II/deal.II/source/fe/fe_raviart_thomas.cc +++ b/deal.II/deal.II/source/fe/fe_raviart_thomas.cc @@ -11,6 +11,7 @@ // //--------------------------------------------------------------------------- +#include #include #include #include @@ -336,7 +337,7 @@ FE_RaviartThomas::initialize_restriction() // have to do it here. this->restriction[child](face*this->dofs_per_face+i_face, i_child) - += std::pow(.5, dim-1.) * q_sub.weight(k) + += Utilities::fixed_power(.5) * q_sub.weight(k) * cached_values(i_child, k) * this->shape_value_component(face*this->dofs_per_face+i_face, q_sub.point(k), diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index 3b0f604b6d..7b027cd1fc 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -11,8 +11,8 @@ // //--------------------------------------------------------------------------- -#include -#include + +#include #include #include #include @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include @@ -93,34 +95,15 @@ MappingQ<1>::~MappingQ () -template -number power(const number x, const unsigned int y) -{ - // since the power to which x is - // raised is usually the space - // dimension, and since this is - // rarely larger than three, the - // following code is optimal and - // cannot be further optimized by - // grouping of operands to reduce - // the number of multiplications - // from O(x) to O(log x) - number value=1; - for (unsigned int i=0; i MappingQ::MappingQ (const unsigned int p) : degree(p), - n_inner(power(degree-1, dim)), + n_inner(Utilities::fixed_power(degree-1)), n_outer((dim==2) ? 4+4*(degree-1) :8+12*(degree-1)+6*(degree-1)*(degree-1)), tensor_pols(0), - n_shape_functions(power(degree+1,dim)), + n_shape_functions(Utilities::fixed_power(degree+1)), renumber(0) { // Construct the tensor product