From 3c3b6e3a6942b383d5ce4d7132ef89381eb93c83 Mon Sep 17 00:00:00 2001 From: hartmann Date: Mon, 26 Jun 2000 15:38:17 +0000 Subject: [PATCH] New get_face function in FEFaceValues and FESubfaceValues. git-svn-id: https://svn.dealii.org/trunk@3079 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe_values.h | 73 ++++++++++++++++++++++++-- deal.II/deal.II/source/fe/fe_values.cc | 11 ++-- 2 files changed, 77 insertions(+), 7 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index 1505ca2441..a77b7bb988 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -960,8 +960,15 @@ class FEFaceValuesBase : public FEValuesBase const unsigned int n_faces_or_subfaces, const UpdateFlags update_flags, const FiniteElement &fe); - - /** + + /** + * Virtual destructor needed for + * the virtual @p{get_face} + * function. + */ + virtual ~FEFaceValuesBase (); + + /** * Return the outward normal vector to * the cell at the @p{i}th quadrature * point. The length of the vector @@ -976,6 +983,14 @@ class FEFaceValuesBase : public FEValuesBase */ const vector > & get_normal_vectors () const; + /** + * Return the present + * face. Implemented in the + * derived classes. + */ + virtual DoFHandler::face_iterator get_face() const=0; + + protected: /** * Store the gradients of the shape @@ -1115,6 +1130,12 @@ class FEFaceValues : public FEFaceValuesBase */ void reinit (const typename DoFHandler::cell_iterator &cell, const unsigned int face_no); + + + /** + * Return the present face. + */ + virtual DoFHandler::face_iterator get_face() const; }; @@ -1252,12 +1273,31 @@ class FESubfaceValues : public FEFaceValuesBase const unsigned int face_no, const unsigned int subface_no); + /** + * Return the present face. + */ + virtual DoFHandler::face_iterator get_face() const; + /** * Exception */ DeclException0 (ExcReinitCalledWithBoundaryFace); -}; + /** + * Exception + */ + DeclException0 (ExcFaceHasNoSubfaces); + + protected: + + /** + * Store the subface selected + * last time the @p{reinit} + * function was called. Is used + * by the @p{get_face} fuction. + */ + DoFHandler::face_iterator present_subface; +}; @@ -1352,6 +1392,12 @@ FEValuesBase::get_cell() const /*------------------------ Inline functions: FEFaceValuesBase --------------------*/ +template +inline +FEFaceValuesBase::~FEFaceValuesBase() +{}; + + template inline const vector > & @@ -1363,4 +1409,25 @@ FEFaceValuesBase::get_normal_vectors () const }; +/*------------------------ Inline functions: FEFaceValues ------------------------*/ + +template +inline +DoFHandler::face_iterator +FEFaceValues::get_face() const { + return present_cell->face(selected_dataset); +}; + + + +/*------------------------ Inline functions: FESubfaceValues ------------------------*/ + +template +inline +DoFHandler::face_iterator +FESubfaceValues::get_face() const { + return present_subface; +}; + + #endif diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index b048988e4f..95763dcce3 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -739,10 +739,17 @@ void FESubfaceValues::reinit (const typename DoFHandler::cell_iterator const unsigned int face_no, const unsigned int subface_no) { + Assert (face_no < GeometryInfo::faces_per_cell, + ExcIndexRange (face_no, 0, GeometryInfo::faces_per_cell)); + Assert (subface_no < GeometryInfo::subfaces_per_face, + ExcIndexRange (subface_no, 0, GeometryInfo::subfaces_per_face)); Assert (cell->face(face_no)->at_boundary() == false, ExcReinitCalledWithBoundaryFace()); + Assert (cell->face(face_no)->has_children()== true, + ExcFaceHasNoSubfaces()); present_cell = cell; + present_subface = cell->face(face_no)->child(subface_no); selected_dataset = face_no*(1<<(dim-1)) + subface_no; // assert that the finite elements @@ -753,10 +760,6 @@ void FESubfaceValues::reinit (const typename DoFHandler::cell_iterator == static_cast&>(cell->get_dof_handler().get_fe()), typename FEValuesBase::ExcFEDontMatch()); - Assert (face_no < GeometryInfo::faces_per_cell, - ExcIndexRange (face_no, 0, GeometryInfo::faces_per_cell)); - Assert (subface_no < GeometryInfo::subfaces_per_face, - ExcIndexRange (subface_no, 0, GeometryInfo::subfaces_per_face)); // fill jacobi matrices and real // quadrature points -- 2.39.5