From 63caa2238a29c2cf70a200badc51874b688d572a Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Wed, 24 Feb 2010 18:12:25 +0000 Subject: [PATCH] remove cell_normal and move normal into FEValuesBase git-svn-id: https://svn.dealii.org/trunk@20688 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_update_flags.h | 36 +++--- deal.II/deal.II/include/fe/fe_values.h | 103 +++++++++--------- deal.II/deal.II/source/fe/fe_values.cc | 48 +++----- deal.II/deal.II/source/fe/mapping_q.cc | 6 +- deal.II/deal.II/source/fe/mapping_q1.cc | 29 +++-- .../deal.II/source/fe/mapping_q1_eulerian.cc | 6 +- .../deal.II/source/fe/mapping_q_eulerian.cc | 6 +- 7 files changed, 110 insertions(+), 124 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_update_flags.h b/deal.II/deal.II/include/fe/fe_update_flags.h index 33fe2b8384..c9438f008d 100644 --- a/deal.II/deal.II/include/fe/fe_update_flags.h +++ b/deal.II/deal.II/include/fe/fe_update_flags.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -113,7 +113,7 @@ enum UpdateFlags * the real cell. */ update_hessians = 0x0004, - //! Outter normal vector, not normalized + //! Outer normal vector, not normalized /** * Vector product of tangential * vectors, yielding a normal @@ -143,21 +143,24 @@ enum UpdateFlags * reference to realcell. */ update_JxW_values = 0x0020, - //! Normal vectors to the faces + //! Normal vectors + /** + * Compute the normal vectors, + * either for a face or for a + * cell of codimension + * one. Setting this flag for + * any other object will raise + * an error. + */ + update_normal_vectors = 0x0040, /** - * Compute the unit outer - * normal vector on the face of - * a cell. + * @deprecated Use #update_normal_vectors */ - update_face_normal_vectors = 0x0040, - //! Normal vectors to the cells + update_face_normal_vectors = update_normal_vectors, /** - * Compute the unit outer - * normal vector on the cell - * itself. Only possible if - * dim=spacedim-1 + * @deprecated Use #update_normal_vectors */ - update_cell_normal_vectors = 0x20000, + update_cell_normal_vectors = update_normal_vectors, //! Volume element /** * Compute the Jacobian of the @@ -255,13 +258,6 @@ enum UpdateFlags * derivatives. */ update_second_derivatives = update_hessians, - //! Normal vectors - /** - * @deprecated Update normal - * vectors. Use - * update_face_normal_vectors - */ - update_normal_vectors = update_face_normal_vectors, //! Values needed for Piola transform /** * Combination of the flags diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index 79501b6fe3..e4d8148b75 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -1282,14 +1282,6 @@ class FEValuesData */ std::vector > normal_vectors; - /** - * List of outward vectors normal to the cell - * surface (line) at the quadrature points - * for the codimension 1 case, - * when spacedim=3 (=2). - */ - std::vector > cell_normal_vectors; - /** * List of boundary forms at the * quadrature points. This field is filled @@ -2550,15 +2542,38 @@ class FEValuesBase : protected FEValuesData, */ const typename Triangulation::cell_iterator get_cell () const; - /** - * Returns the vectors normal to - * the cell in each of the - * quadrature points. + /** + * For a face, return the outward + * normal vector to the cell at + * the ith quadrature + * point. + * + * For a cell of codimension one, + * return the normal vector, as + * it is specified by the + * numbering of the vertices. + * + * The length of the vector + * is normalized to one. */ + const Point & normal_vector (const unsigned int i) const; - const std::vector > & get_cell_normal_vectors () const; + /** + * Return the normal vectors at + * the quadrature points. For a + * face, these are the outward + * normal vectors to the + * cell. For a cell of + * codimension one, the + * orientation is given by the + * numbering of vertices. + */ + const std::vector > & get_normal_vectors () const; /** + * @deprecated Use + * normal_vector() instead. + * * Return the outward normal vector to * the cell at the ith quadrature * point. The length of the vector @@ -2566,6 +2581,16 @@ class FEValuesBase : protected FEValuesData, */ const Point & cell_normal_vector (const unsigned int i) const; + /** + * @deprecated Use + * get_normal_vectors() instead. + * + * Returns the vectors normal to + * the cell in each of the + * quadrature points. + */ + const std::vector > & get_cell_normal_vectors () const; + /** * Return the relation of the current * cell to the previous cell. This @@ -2998,7 +3023,7 @@ class FEValues : public FEValuesBase * when evaluating something on the surface of a cell. All the data * that is available in the interior of cells is also available here. * - * On surfaces of mesh cells, normal vectors and boundary forms are + * On surfaces of mesh cells, boundary forms are * additional values that can be computed. This class provides the * interface to access those. Implementations are in derived classes * FEFaceValues and FESubfaceValues. @@ -3050,14 +3075,6 @@ class FEFaceValuesBase : public FEValuesBase const FiniteElement &fe, const Quadrature& quadrature); - /** - * Return the outward normal vector to - * the cell at the ith quadrature - * point. The length of the vector - * is normalized to one. - */ - const Point & normal_vector (const unsigned int i) const; - /** * Boundary form of the * transformation of the cell at @@ -3077,13 +3094,6 @@ class FEFaceValuesBase : public FEValuesBase */ const Tensor<1,spacedim> & boundary_form (const unsigned int i) const; - /** - * Return the list of outward normal - * vectors to the cell at the - * quadrature points. - */ - const std::vector > & get_normal_vectors () const; - /** * Return the list of outward * normal vectors times the @@ -4497,15 +4507,25 @@ get_function_2nd_derivatives (const InputVector &fe_func template inline const Point & -FEValuesBase::cell_normal_vector (const unsigned int i) const +FEValuesBase::normal_vector (const unsigned int i) const { typedef FEValuesBase FVB; - Assert (icell_normal_vectors.size(), - ExcIndexRange(i, 0, this->cell_normal_vectors.size())); - Assert (this->update_flags & update_cell_normal_vectors, + Assert (this->update_flags & update_normal_vectors, typename FVB::ExcAccessToUninitializedField()); + Assert (inormal_vectors.size(), + ExcIndexRange(i, 0, this->normal_vectors.size())); + + return this->normal_vectors[i]; +} - return this->cell_normal_vectors[i]; + + +template +inline +const Point & +FEValuesBase::cell_normal_vector (const unsigned int i) const +{ + return this->normal_vector(i); } @@ -4536,21 +4556,6 @@ FEValues::get_present_fe_values () const /*------------------------ Inline functions: FEFaceValuesBase --------------------*/ -template -inline -const Point & -FEFaceValuesBase::normal_vector (const unsigned int i) const -{ - typedef FEValuesBase FVB; - Assert (inormal_vectors.size(), - ExcIndexRange(i, 0, this->normal_vectors.size())); - Assert (this->update_flags & update_normal_vectors, - typename FVB::ExcAccessToUninitializedField()); - - return this->normal_vectors[i]; -} - - template inline unsigned int diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index 983102bcaf..951b5b5c41 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -1463,9 +1463,6 @@ FEValuesData::initialize (const unsigned int n_quadrature_p if (flags & update_normal_vectors) this->normal_vectors.resize(n_quadrature_points); - - if (flags & update_cell_normal_vectors) - this->cell_normal_vectors.resize(n_quadrature_points); } @@ -2959,12 +2956,21 @@ void FEValuesBase::get_function_laplacians ( template const std::vector > & -FEValuesBase::get_cell_normal_vectors () const +FEValuesBase::get_normal_vectors () const { typedef FEValuesBase FEVB; - Assert (this->update_flags & update_cell_normal_vectors, + Assert (this->update_flags & update_normal_vectors, typename FEVB::ExcAccessToUninitializedField()); - return this->cell_normal_vectors; + return this->normal_vectors; +} + + + +template +const std::vector > & +FEValuesBase::get_cell_normal_vectors () const +{ + return this->get_normal_vectors (); } @@ -3114,20 +3120,14 @@ template void FEValues::initialize (const UpdateFlags update_flags) { - // you can't compute normal vectors - // on cells, only on faces - typedef FEValuesBase FEVB; - Assert ((update_flags & update_normal_vectors) == false, - typename FEVB::ExcInvalidUpdateFlag()); - // You can compute normal vectors // to the cells only in the // codimension one case. - if(dim == spacedim) - Assert ( (update_flags & update_cell_normal_vectors) == false, - typename FEVB::ExcInvalidUpdateFlag()); - - + typedef FEValuesBase FEVB; + if (dim != spacedim-1) + Assert ((update_flags & update_normal_vectors) == false, + typename FEVB::ExcInvalidUpdateFlag()); + const UpdateFlags flags = this->compute_update_flags (update_flags); // then get objects into which the @@ -3304,7 +3304,7 @@ void FEValues::do_reinit () this->jacobians, this->jacobian_grads, this->inverse_jacobians, - this->cell_normal_vectors, + this->normal_vectors, this->cell_similarity); this->get_fe().fill_fe_values(this->get_mapping(), @@ -3351,18 +3351,6 @@ FEFaceValuesBase::FEFaceValuesBase (const unsigned int n_q_points, -template -const std::vector > & -FEFaceValuesBase::get_normal_vectors () const -{ - typedef FEValuesBase FEVB; - Assert (this->update_flags & update_normal_vectors, - typename FEVB::ExcAccessToUninitializedField()); - return this->normal_vectors; -} - - - template const std::vector > & FEFaceValuesBase::get_boundary_forms () const diff --git a/deal.II/deal.II/source/fe/mapping_q.cc b/deal.II/deal.II/source/fe/mapping_q.cc index a77a6b8c84..ce211ca58b 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, 2007, 2008, 2009 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -313,7 +313,7 @@ MappingQ::fill_fe_values ( std::vector > &jacobians, std::vector > &jacobian_grads, std::vector > &inverse_jacobians, - std::vector > &cell_normal_vectors, + std::vector > &normal_vectors, CellSimilarity::Similarity &cell_similarity) const { // convert data object to internal @@ -358,7 +358,7 @@ MappingQ::fill_fe_values ( MappingQ1::fill_fe_values(cell, q, *p_data, quadrature_points, JxW_values, jacobians, jacobian_grads, inverse_jacobians, - cell_normal_vectors, cell_similarity); + normal_vectors, cell_similarity); } diff --git a/deal.II/deal.II/source/fe/mapping_q1.cc b/deal.II/deal.II/source/fe/mapping_q1.cc index ca0f2c818a..75f67acef6 100644 --- a/deal.II/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/deal.II/source/fe/mapping_q1.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -366,7 +366,6 @@ MappingQ1::update_once (const UpdateFlags in) const if (in & (update_covariant_transformation | update_contravariant_transformation | update_JxW_values - | update_cell_normal_vectors | update_boundary_forms | update_normal_vectors | update_jacobians @@ -389,7 +388,6 @@ MappingQ1::update_each (const UpdateFlags in) const | update_covariant_transformation | update_contravariant_transformation | update_JxW_values - | update_cell_normal_vectors | update_boundary_forms | update_normal_vectors | update_volume_elements @@ -423,7 +421,6 @@ MappingQ1::update_each (const UpdateFlags in) const if (out & (update_covariant_transformation | update_JxW_values - | update_cell_normal_vectors | update_jacobians | update_jacobian_grads | update_boundary_forms @@ -442,8 +439,8 @@ MappingQ1::update_each (const UpdateFlags in) const if (out & update_contravariant_transformation) out |= update_JxW_values; - if (out & update_cell_normal_vectors) - out |= update_JxW_values | update_cell_normal_vectors; + if (out & update_normal_vectors) + out |= update_JxW_values; } @@ -744,7 +741,7 @@ MappingQ1::fill_fe_values ( std::vector > &jacobians, std::vector > &jacobian_grads, std::vector > &inverse_jacobians, - std::vector > &cell_normal_vectors, + std::vector > &normal_vectors, CellSimilarity::Similarity &cell_similarity) const { // ensure that the following cast is really correct: @@ -767,15 +764,15 @@ MappingQ1::fill_fe_values ( // columns of the Jacobian and // store the cell normal vectors in // the case <2,3> - if (update_flags & (update_cell_normal_vectors + if (update_flags & (update_normal_vectors | update_JxW_values)) { Assert (JxW_values.size() == n_q_points, ExcDimensionMismatch(JxW_values.size(), n_q_points)); - Assert( !(update_flags & update_cell_normal_vectors ) || - (cell_normal_vectors.size() == n_q_points), - ExcDimensionMismatch(cell_normal_vectors.size(), n_q_points)); + Assert( !(update_flags & update_normal_vectors ) || + (normal_vectors.size() == n_q_points), + ExcDimensionMismatch(normal_vectors.size(), n_q_points)); if (cell_similarity != CellSimilarity::translation) for (unsigned int point=0; point::fill_fe_values ( data.contravariant[point]=transpose(data.contravariant[point]); JxW_values[point] = data.contravariant[point][0].norm()*weights[point]; - if(update_flags & update_cell_normal_vectors) + if(update_flags & update_normal_vectors) { - cell_normal_vectors[point][0]=-data.contravariant[point][0][1] + normal_vectors[point][0]=-data.contravariant[point][0][1] /data.contravariant[point][0].norm(); - cell_normal_vectors[point][1]=data.contravariant[point][0][0] + normal_vectors[point][1]=data.contravariant[point][0][0] /data.contravariant[point][0].norm(); } } @@ -812,8 +809,8 @@ MappingQ1::fill_fe_values ( //is stored in the 3d //subtensor of the contravariant tensor data.contravariant[point][2]/=data.contravariant[point][2].norm(); - if(update_flags & update_cell_normal_vectors) - cell_normal_vectors[point]=data.contravariant[point][2]; + if(update_flags & update_normal_vectors) + normal_vectors[point]=data.contravariant[point][2]; } } diff --git a/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc b/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc index fa37567b27..1f85b2c50c 100644 --- a/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc +++ b/deal.II/deal.II/source/fe/mapping_q1_eulerian.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -126,7 +126,7 @@ MappingQ1Eulerian::fill_fe_values ( std::vector > &jacobians, std::vector > &jacobian_grads, std::vector > &inverse_jacobians, - std::vector > &cell_normal_vectors, + std::vector > &normal_vectors, CellSimilarity::Similarity &cell_similarity) const { // disable any previously detected @@ -136,7 +136,7 @@ MappingQ1Eulerian::fill_fe_values ( MappingQ1::fill_fe_values (cell, q, mapping_data, quadrature_points, JxW_values, jacobians, jacobian_grads, inverse_jacobians, - cell_normal_vectors, cell_similarity); + normal_vectors, cell_similarity); } diff --git a/deal.II/deal.II/source/fe/mapping_q_eulerian.cc b/deal.II/deal.II/source/fe/mapping_q_eulerian.cc index e810fb4c41..4c85e5eb4a 100644 --- a/deal.II/deal.II/source/fe/mapping_q_eulerian.cc +++ b/deal.II/deal.II/source/fe/mapping_q_eulerian.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -193,7 +193,7 @@ MappingQEulerian::fill_fe_values ( std::vector > &jacobians, std::vector > &jacobian_grads, std::vector > &inverse_jacobians, - std::vector > &cell_normal_vectors, + std::vector > &normal_vectors, CellSimilarity::Similarity &cell_similarity) const { // disable any previously detected @@ -203,7 +203,7 @@ MappingQEulerian::fill_fe_values ( MappingQ::fill_fe_values (cell, q, mapping_data, quadrature_points, JxW_values, jacobians, jacobian_grads, inverse_jacobians, - cell_normal_vectors, cell_similarity); + normal_vectors, cell_similarity); } -- 2.39.5