From: Timo Heister Date: Fri, 20 Sep 2019 14:13:17 +0000 (-0400) Subject: instantiate TensorProductPolynomials for dim=0 X-Git-Tag: v9.2.0-rc1~1057^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d808f04f6a3975f8f56b9c1112b0dc5ec401e360;p=dealii.git instantiate TensorProductPolynomials for dim=0 --- diff --git a/include/deal.II/base/tensor_product_polynomials.h b/include/deal.II/base/tensor_product_polynomials.h index 28f7c9d036..546904b53f 100644 --- a/include/deal.II/base/tensor_product_polynomials.h +++ b/include/deal.II/base/tensor_product_polynomials.h @@ -410,7 +410,8 @@ private: * i. */ void - compute_index(const unsigned int i, unsigned int (&indices)[dim]) const; + compute_index(const unsigned int i, + unsigned int (&indices)[(dim > 0 ? dim : 1)]) const; /** * Given the input to the constructor, compute n_pols. diff --git a/source/base/scalar_polynomials_base.cc b/source/base/scalar_polynomials_base.cc index c067980ed4..8eedfaf6da 100644 --- a/source/base/scalar_polynomials_base.cc +++ b/source/base/scalar_polynomials_base.cc @@ -35,6 +35,7 @@ ScalarPolynomialsBase::ScalarPolynomialsBase( +template class ScalarPolynomialsBase<0>; template class ScalarPolynomialsBase<1>; template class ScalarPolynomialsBase<2>; template class ScalarPolynomialsBase<3>; diff --git a/source/base/tensor_product_polynomials.cc b/source/base/tensor_product_polynomials.cc index 49ce046c0d..7db3763f10 100644 --- a/source/base/tensor_product_polynomials.cc +++ b/source/base/tensor_product_polynomials.cc @@ -98,7 +98,7 @@ void TensorProductPolynomials::output_indices( std::ostream &out) const { - unsigned int ix[dim]; + unsigned int ix[(dim > 0) ? dim : 1]; for (unsigned int i = 0; i < this->n(); ++i) { compute_index(i, ix); @@ -164,7 +164,7 @@ TensorProductPolynomials::compute_grad( const unsigned int i, const Point & p) const { - unsigned int indices[dim]; + unsigned int indices[(dim > 0) ? dim : 1]; compute_index(i, indices); // compute values and @@ -201,7 +201,7 @@ TensorProductPolynomials::compute_grad_grad( const unsigned int i, const Point & p) const { - unsigned int indices[dim]; + unsigned int indices[(dim > 0) ? dim : 1]; compute_index(i, indices); double v[dim][3]; @@ -433,8 +433,9 @@ AnisotropicPolynomials::AnisotropicPolynomials( template void -AnisotropicPolynomials::compute_index(const unsigned int i, - unsigned int (&indices)[dim]) const +AnisotropicPolynomials::compute_index( + const unsigned int i, + unsigned int (&indices)[(dim > 0 ? dim : 1)]) const { #ifdef DEBUG unsigned int n_poly = 1; @@ -443,7 +444,10 @@ AnisotropicPolynomials::compute_index(const unsigned int i, Assert(i < n_poly, ExcInternalError()); #endif - if (dim == 1) + if (dim == 0) + { + } + else if (dim == 1) internal::compute_tensor_index(i, polynomials[0].size(), 0 /*not used*/, @@ -462,7 +466,7 @@ double AnisotropicPolynomials::compute_value(const unsigned int i, const Point & p) const { - unsigned int indices[dim]; + unsigned int indices[(dim > 0) ? dim : 1]; compute_index(i, indices); double value = 1.; @@ -478,7 +482,7 @@ Tensor<1, dim> AnisotropicPolynomials::compute_grad(const unsigned int i, const Point & p) const { - unsigned int indices[dim]; + unsigned int indices[(dim > 0) ? dim : 1]; compute_index(i, indices); // compute values and @@ -506,7 +510,7 @@ Tensor<2, dim> AnisotropicPolynomials::compute_grad_grad(const unsigned int i, const Point & p) const { - unsigned int indices[dim]; + unsigned int indices[(dim > 0) ? dim : 1]; compute_index(i, indices); std::vector> v(dim, std::vector(3)); @@ -601,7 +605,7 @@ AnisotropicPolynomials::evaluate( // one-dimensional indices of // this particular tensor // product polynomial - unsigned int indices[dim]; + unsigned int indices[(dim > 0) ? dim : 1]; compute_index(i, indices); if (update_values) @@ -706,6 +710,7 @@ AnisotropicPolynomials::clone() const /* ------------------- explicit instantiations -------------- */ +template class TensorProductPolynomials<0, Polynomials::Polynomial>; template class TensorProductPolynomials<1, Polynomials::Polynomial>; template class TensorProductPolynomials<2, Polynomials::Polynomial>; template class TensorProductPolynomials<3, Polynomials::Polynomial>; @@ -720,6 +725,7 @@ template class TensorProductPolynomials< 3, Polynomials::PiecewisePolynomial>; +template class AnisotropicPolynomials<0>; template class AnisotropicPolynomials<1>; template class AnisotropicPolynomials<2>; template class AnisotropicPolynomials<3>;