From bd997333fcb2fad55ad55f32fdbc57e4c4cb51f4 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 30 Jul 2015 10:33:57 -0500 Subject: [PATCH] Remove the compute_fill_face() function from the public interface. Instead make it part of the internal implementation of the class in the .cc file. --- include/deal.II/fe/mapping_q1.h | 11 -- source/fe/mapping_q1.cc | 255 +++++++++++++++++--------------- 2 files changed, 137 insertions(+), 129 deletions(-) diff --git a/include/deal.II/fe/mapping_q1.h b/include/deal.II/fe/mapping_q1.h index 81071b09a7..b918399bb2 100644 --- a/include/deal.II/fe/mapping_q1.h +++ b/include/deal.II/fe/mapping_q1.h @@ -386,17 +386,6 @@ public: const unsigned int n_orig_q_points, InternalData &data) const; - /** - * Do the computation for the fill_* functions. - */ - void compute_fill_face (const typename Triangulation::cell_iterator &cell, - const unsigned int face_no, - const unsigned int subface_no, - const DataSetDescriptor data_set, - const Quadrature &quadrature, - const InternalData &internal_data, - FEValuesData &output_data) const; - /** * Compute shape values and/or derivatives. */ diff --git a/source/fe/mapping_q1.cc b/source/fe/mapping_q1.cc index 36e56291db..638d46d588 100644 --- a/source/fe/mapping_q1.cc +++ b/source/fe/mapping_q1.cc @@ -653,66 +653,66 @@ namespace internal const UpdateFlags update_flags(data.current_update_flags()); if (update_flags & update_contravariant_transformation) - // if the current cell is just a - // translation of the previous one, no - // need to recompute jacobians... - if (cell_similarity != CellSimilarity::translation) - { - const unsigned int n_q_points = data.contravariant.size(); - - std::fill(data.contravariant.begin(), data.contravariant.end(), - DerivativeForm<1,dim,spacedim>()); - - Assert (data.n_shape_functions > 0, ExcInternalError()); - const Tensor<1,spacedim> *supp_pts = - &data.mapping_support_points[0]; - - for (unsigned int point=0; point *data_derv = - &data.derivative(point+data_set, 0); - - double result [spacedim][dim]; - - // peel away part of sum to avoid zeroing the - // entries and adding for the first time - for (unsigned int i=0; i()); + + Assert (data.n_shape_functions > 0, ExcInternalError()); + const Tensor<1,spacedim> *supp_pts = + &data.mapping_support_points[0]; + + for (unsigned int point=0; point *data_derv = + &data.derivative(point+data_set, 0); + + double result [spacedim][dim]; + + // peel away part of sum to avoid zeroing the + // entries and adding for the first time + for (unsigned int i=0; i -void -MappingQ1:: -compute_fill_face (const typename Triangulation::cell_iterator &cell, - const unsigned int face_no, - const unsigned int subface_no, - const DataSetDescriptor data_set, - const Quadrature &quadrature, - const InternalData &internal_data, - FEValuesData &output_data) const -{ - // if necessary, recompute the support points of the transformation of this cell - // (note that we need to first check the triangulation pointer, since otherwise - // the second test might trigger an exception if the triangulations are not the - // same) - if ((internal_data.mapping_support_points.size() == 0) - || - (&cell->get_triangulation() != - &internal_data.cell_of_current_support_points->get_triangulation()) - || - (cell != internal_data.cell_of_current_support_points)) + /** + * Do the work of MappingQ1::fill_fe_face_values() and + * MappingQ1::fill_fe_subface_values() in a generic way, + * using the 'data_set' to differentiate whether we will + * work on a face (and if so, which one) or subface. + */ + template + void + do_fill_fe_face_values (const dealii::MappingQ1 &mapping, + const typename dealii::Triangulation::cell_iterator &cell, + const unsigned int face_no, + const unsigned int subface_no, + const typename dealii::MappingQ1::DataSetDescriptor data_set, + const Quadrature &quadrature, + const typename dealii::MappingQ1::InternalData &data, + FEValuesData &output_data) { - compute_mapping_support_points(cell, internal_data.mapping_support_points); - internal_data.cell_of_current_support_points = cell; + maybe_compute_q_points (data_set, + data, + output_data.quadrature_points); + maybe_update_Jacobians (CellSimilarity::none, + data_set, + data); + maybe_compute_face_data (mapping, + cell, face_no, subface_no, quadrature.size(), + quadrature.get_weights(), data, + output_data); } - - internal::maybe_compute_q_points (data_set, - internal_data, - output_data.quadrature_points); - internal::maybe_update_Jacobians (CellSimilarity::none, - data_set, - internal_data); - internal::maybe_compute_face_data (*this, - cell, face_no, subface_no, quadrature.size(), - quadrature.get_weights(), internal_data, - output_data); + } } + template void MappingQ1:: @@ -1132,19 +1117,36 @@ fill_fe_face_values (const typename Triangulation::cell_iterator & FEValuesData &output_data) const { // ensure that the following cast is really correct: - Assert (dynamic_cast(&internal_data) != 0, + Assert ((dynamic_cast(&internal_data) != 0), ExcInternalError()); - const InternalData &data = static_cast(internal_data); + const InternalData &data + = static_cast(internal_data); + + // if necessary, recompute the support points of the transformation of this cell + // (note that we need to first check the triangulation pointer, since otherwise + // the second test might trigger an exception if the triangulations are not the + // same) + if ((data.mapping_support_points.size() == 0) + || + (&cell->get_triangulation() != + &data.cell_of_current_support_points->get_triangulation()) + || + (cell != data.cell_of_current_support_points)) + { + compute_mapping_support_points(cell, data.mapping_support_points); + data.cell_of_current_support_points = cell; + } - compute_fill_face (cell, face_no, numbers::invalid_unsigned_int, - DataSetDescriptor::face (face_no, - cell->face_orientation(face_no), - cell->face_flip(face_no), - cell->face_rotation(face_no), - quadrature.size()), - quadrature, - data, - output_data); + internal::do_fill_fe_face_values (*this, + cell, face_no, numbers::invalid_unsigned_int, + DataSetDescriptor::face (face_no, + cell->face_orientation(face_no), + cell->face_flip(face_no), + cell->face_rotation(face_no), + quadrature.size()), + quadrature, + data, + output_data); } @@ -1160,20 +1162,37 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato FEValuesData &output_data) const { // ensure that the following cast is really correct: - Assert (dynamic_cast(&internal_data) != 0, + Assert ((dynamic_cast(&internal_data) != 0), ExcInternalError()); - const InternalData &data = static_cast(internal_data); + const InternalData &data + = static_cast(internal_data); + + // if necessary, recompute the support points of the transformation of this cell + // (note that we need to first check the triangulation pointer, since otherwise + // the second test might trigger an exception if the triangulations are not the + // same) + if ((data.mapping_support_points.size() == 0) + || + (&cell->get_triangulation() != + &data.cell_of_current_support_points->get_triangulation()) + || + (cell != data.cell_of_current_support_points)) + { + compute_mapping_support_points(cell, data.mapping_support_points); + data.cell_of_current_support_points = cell; + } - compute_fill_face (cell, face_no, subface_no, - DataSetDescriptor::subface (face_no, subface_no, - cell->face_orientation(face_no), - cell->face_flip(face_no), - cell->face_rotation(face_no), - quadrature.size(), - cell->subface_case(face_no)), - quadrature, - data, - output_data); + internal::do_fill_fe_face_values (*this, + cell, face_no, subface_no, + DataSetDescriptor::subface (face_no, subface_no, + cell->face_orientation(face_no), + cell->face_flip(face_no), + cell->face_rotation(face_no), + quadrature.size(), + cell->subface_case(face_no)), + quadrature, + data, + output_data); } -- 2.39.5