From f31bbbb047e29f265697261dd6a209ee87140763 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 5 Feb 2008 20:43:14 +0000 Subject: [PATCH] Make the flag that determines whether to use higher order mappings also on internal cells settable by the user. git-svn-id: https://svn.dealii.org/trunk@15711 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/mapping_q.h | 41 ++++++++++++++++++-------- deal.II/deal.II/source/fe/mapping_q.cc | 41 ++++++++++++++------------ deal.II/doc/news/changes.h | 8 +++++ 3 files changed, 58 insertions(+), 32 deletions(-) diff --git a/deal.II/deal.II/include/fe/mapping_q.h b/deal.II/deal.II/include/fe/mapping_q.h index 021e94ccca..bbe8299fde 100644 --- a/deal.II/deal.II/include/fe/mapping_q.h +++ b/deal.II/deal.II/include/fe/mapping_q.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -45,8 +45,30 @@ class MappingQ : public MappingQ1 * Constructor. @p p gives the * degree of mapping polynomials * on boundary cells. - */ - MappingQ (const unsigned int p); + * + * The second argument determines + * whether the higher order + * mapping should also be used on + * interior cells. If its value + * is false (the + * default), the a lower-order + * mapping is used in the + * interior. This is sufficient + * for most cases where higher + * order mappings are only used + * to better approximate the + * boundary. In that case, cells + * bounded by straight lines are + * acceptable in the + * interior. However, there are + * cases where one would also + * like to use a higher order + * mapping in the interior. The + * MappingQEulerian class is one + * such case. + */ + MappingQ (const unsigned int p, + const bool use_mapping_q_on_all_cells = false); /** * Copy constructor. Performs a @@ -512,16 +534,8 @@ class MappingQ : public MappingQ1 * then @p MappingQ is used on * all cells, not only on * boundary cells. - * - * The default value is false. - * - * This flag is kept in the - * implementation to allow a fast - * switch between the two cases, - * as someone might want to do - * some comparative tests. */ - static const bool use_mapping_q_on_all_cells = false; + const bool use_mapping_q_on_all_cells; }; /*@}*/ @@ -530,7 +544,8 @@ class MappingQ : public MappingQ1 #ifndef DOXYGEN -template<> MappingQ<1>::MappingQ (const unsigned int); +template<> MappingQ<1>::MappingQ (const unsigned int, + const bool); template<> MappingQ<1>::~MappingQ (); template<> void MappingQ<1>::compute_shapes_virtual ( const std::vector > &unit_points, diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index 1c5a3f210d..0a9b377841 100644 --- a/deal.II/deal.II/source/fe/mapping_q.cc +++ b/deal.II/deal.II/source/fe/mapping_q.cc @@ -32,16 +32,12 @@ DEAL_II_NAMESPACE_OPEN -template -const bool MappingQ::use_mapping_q_on_all_cells; - - template MappingQ::InternalData::InternalData (const unsigned int n_shape_functions) : MappingQ1::InternalData(n_shape_functions), - use_mapping_q1_on_current_cell(false), - mapping_q1_data(1 << dim) + use_mapping_q1_on_current_cell(false), + mapping_q1_data(1 << dim) { this->is_mapping_q1_data=false; } @@ -65,25 +61,28 @@ MappingQ::InternalData::memory_consumption () const // in 1d, it is irrelevant which polynomial degree to use, since all // cells are scaled linearly template<> -MappingQ<1>::MappingQ (const unsigned int): +MappingQ<1>::MappingQ (const unsigned int, + const bool use_mapping_q_on_all_cells): degree(1), n_inner(0), n_outer(0), tensor_pols(0), n_shape_functions(2), - renumber(0) + renumber(0), + use_mapping_q_on_all_cells (false) {} template<> -MappingQ<1>::MappingQ (const MappingQ<1> &): +MappingQ<1>::MappingQ (const MappingQ<1> &m): MappingQ1<1> (), degree(1), n_inner(0), n_outer(0), tensor_pols(0), n_shape_functions(2), - renumber(0) + renumber(0), + use_mapping_q_on_all_cells (m.use_mapping_q_on_all_cells) {} @@ -96,7 +95,8 @@ MappingQ<1>::~MappingQ () template -MappingQ::MappingQ (const unsigned int p) +MappingQ::MappingQ (const unsigned int p, + const bool use_mapping_q_on_all_cells) : degree(p), n_inner(Utilities::fixed_power(degree-1)), @@ -104,7 +104,8 @@ MappingQ::MappingQ (const unsigned int p) :8+12*(degree-1)+6*(degree-1)*(degree-1)), tensor_pols(0), n_shape_functions(Utilities::fixed_power(degree+1)), - renumber(0) + renumber(0), + use_mapping_q_on_all_cells (use_mapping_q_on_all_cells) { // Construct the tensor product // polynomials used as shape @@ -150,14 +151,16 @@ MappingQ::MappingQ (const unsigned int p) template -MappingQ::MappingQ (const MappingQ &mapping): +MappingQ::MappingQ (const MappingQ &mapping) + : MappingQ1(), - degree(mapping.degree), - n_inner(mapping.n_inner), - n_outer(n_outer), - tensor_pols(0), - n_shape_functions(mapping.n_shape_functions), - renumber(mapping.renumber) + degree(mapping.degree), + n_inner(mapping.n_inner), + n_outer(n_outer), + tensor_pols(0), + n_shape_functions(mapping.n_shape_functions), + renumber(mapping.renumber), + use_mapping_q_on_all_cells (mapping.use_mapping_q_on_all_cells) { tensor_pols=new TensorProductPolynomials (*mapping.tensor_pols); laplace_on_quad_vector=mapping.laplace_on_quad_vector; diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index fdf6ac255c..0fb045ad8d 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -233,6 +233,14 @@ constraints individually.
    +
  1. New: The MappingQ class constructor now takes a parameter that determines + whether a higher order mapping should also be used for interior cells. By default, + the higher order mapping is only used for cells on the boundary; cells in the + interior are bounded by straight edges described by a (bi-, tri-)linear mapping. +
    + (WB 2008/02/05) +

  2. +
  3. New: The function VectorTools::compute_no_normal_flux_constraints computes the constraints that correspond to boundary conditions of the form $\vec u \cdot \vec n = 0$. The use of the function is demonstrated in the -- 2.39.5