From 3efa1113bd791316c9b1ae894c58a7886121f68d Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 9 Jan 2013 04:19:43 +0000 Subject: [PATCH] Clean up code slightly. git-svn-id: https://svn.dealii.org/trunk@27989 0785d39b-7218-0410-832d-ea1e28bc413d --- .../base/tensor_product_polynomials_const.cc | 42 ++++++++++++++++--- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/deal.II/source/base/tensor_product_polynomials_const.cc b/deal.II/source/base/tensor_product_polynomials_const.cc index 7be23144ff..7265e869a6 100644 --- a/deal.II/source/base/tensor_product_polynomials_const.cc +++ b/deal.II/source/base/tensor_product_polynomials_const.cc @@ -1,3 +1,16 @@ +//--------------------------------------------------------------------------- +// $Id: trilinos_sparse_matrix.cc 27985 2013-01-08 21:36:23Z bangerth $ +// Version: $Name$ +// +// Copyright (C) 2012, 2013 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- + #include #include #include @@ -90,6 +103,8 @@ TensorProductPolynomialsConst::compute_value (const unsigned int i, const unsigned int max_indices = Utilities::fixed_power(polynomials.size()); Assert (i<=max_indices, ExcInternalError()); + + // treat the regular basis functions if (i::compute_value (const unsigned int i, return value; } else - return 1.; //return 1 for q0 node + // this is for the constant function + return 1.; } template <> @@ -114,6 +130,7 @@ TensorProductPolynomialsConst<0>::compute_value (const unsigned int , return 0.; } + template Tensor<1,dim> TensorProductPolynomialsConst::compute_grad (const unsigned int i, @@ -122,9 +139,12 @@ TensorProductPolynomialsConst::compute_grad (const unsigned int i, const unsigned int max_indices = Utilities::fixed_power(polynomials.size()); Assert (i<=max_indices, ExcInternalError()); - Tensor<1,dim> grad; + + // treat the regular basis functions if (i grad; + unsigned int indices[dim]; compute_index (i, indices); @@ -149,10 +169,16 @@ TensorProductPolynomialsConst::compute_grad (const unsigned int i, for (unsigned int x=0; x(); } + + template Tensor<2,dim> TensorProductPolynomialsConst::compute_grad_grad (const unsigned int i, @@ -161,9 +187,12 @@ TensorProductPolynomialsConst::compute_grad_grad (const unsigned int i, const unsigned int max_indices = Utilities::fixed_power(polynomials.size()); Assert (i<=max_indices, ExcInternalError()); - Tensor<2,dim> grad_grad; + + // treat the regular basis functions if (i grad_grad; + unsigned int indices[dim]; compute_index (i, indices); @@ -195,8 +224,11 @@ TensorProductPolynomialsConst::compute_grad_grad (const unsigned int i, grad_grad[d1][d2] *= v[x][derivative]; } } + return grad_grad; //return 0 for q0 node } - return grad_grad; //return 0 for q0 node + else + // this is for the constant function + return Tensor<2,dim>(); } template -- 2.39.5