From: hartmann Date: Thu, 11 Mar 2004 14:55:33 +0000 (+0000) Subject: New output_indices and set/get_renumbering functions according to those in the Polyno... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0802c50d9f69ffb8e8a798ad7eac6b90062a5a6a;p=dealii-svn.git New output_indices and set/get_renumbering functions according to those in the PolynomialSpace class. git-svn-id: https://svn.dealii.org/trunk@8715 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/tensor_product_polynomials.h b/deal.II/base/include/base/tensor_product_polynomials.h index 11405be2d9..ffc5c6f726 100644 --- a/deal.II/base/include/base/tensor_product_polynomials.h +++ b/deal.II/base/include/base/tensor_product_polynomials.h @@ -42,8 +42,15 @@ * ..., P1(x)P2(y), * P2(x)P2(y), P3(x)P2(y), * ... and likewise in 3d. + * + * The @ref{output_indices} function prints the ordering of the + * dim-dimensional polynomials, i.e. for each polynomial in the + * polynomial space it gives the indices i,j,k of the one-dimensional + * polynomials in x,y and z direction. The ordering of the + * dim-dimensional polynomials can be changed by using the + * @p{set_renumbering} function. * - * @author Ralf Hartmann, Guido Kanschat, 2000, Wolfgang Bangerth 2003 + * @author Ralf Hartmann, 2000, 2004, Guido Kanschat, 2000, Wolfgang Bangerth 2003 */ template class TensorProductPolynomials @@ -60,6 +67,33 @@ class TensorProductPolynomials */ template TensorProductPolynomials (const std::vector &pols); + + /** + * Prints the list of the indices + * to out. + */ + void output_indices(std::ostream &out) const; + + /** + * Sets the ordering of the + * polynomials. Requires + * renumber.size()==n(). + * Stores a copy of + * renumber. + */ + void set_renumbering(const std::vector &renumber); + + /** + * Gives read access to the + * renumbering vector. + */ + const std::vector &get_renumbering() const; + + /** + * Gives read access to the + * inverse renumbering vector. + */ + const std::vector &get_renumbering_inverse() const; /** * Computes the value and the @@ -200,6 +234,18 @@ class TensorProductPolynomials */ unsigned int n_tensor_pols; + /** + * Index map for reordering the + * polynomials. + */ + std::vector index_map; + + /** + * Index map for reordering the + * polynomials. + */ + std::vector index_map_inverse; + /** * Each tensor product polynomial * i is a product of @@ -223,7 +269,27 @@ class TensorProductPolynomials unsigned int x_to_the_dim (const unsigned int x); }; +/// @if NoDoc + +template +inline +const std::vector & +TensorProductPolynomials::get_renumbering() const +{ + return index_map; +} + +template +inline +const std::vector & +TensorProductPolynomials::get_renumbering_inverse() const +{ + return index_map_inverse; +} + + +/// @endif /** @@ -480,8 +546,20 @@ TensorProductPolynomials:: TensorProductPolynomials(const std::vector &pols) : polynomials (pols.begin(), pols.end()), - n_tensor_pols(x_to_the_dim(pols.size())) -{} + n_tensor_pols(x_to_the_dim(pols.size())), + index_map(n_tensor_pols), + index_map_inverse(n_tensor_pols) +{ + // per default set this index map + // to identity. This map can be + // changed by the user through the + // set_renumbering function + for (unsigned int i=0; i +void +TensorProductPolynomials::output_indices(std::ostream &out) const +{ + unsigned int ix[dim]; + for (unsigned int i=0; i +void +TensorProductPolynomials::set_renumbering( + const std::vector &renumber) +{ + Assert(renumber.size()==index_map.size(), + ExcDimensionMismatch(renumber.size(), index_map.size())); - indices[0] = i % n_pols; - indices[1] = (i/n_pols) % n_pols; - indices[2] = i / (n_pols*n_pols); + index_map=renumber; + for (unsigned int i=0; i