From e2c5a4915e254cb57053b2d8b1cec94883e6c523 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Thu, 3 Sep 1998 15:44:42 +0000 Subject: [PATCH] Neue FEValues git-svn-id: https://svn.dealii.org/trunk@551 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/include/fe/fe.h | 7 +++++- deal.II/deal.II/include/fe/fe_values.h | 20 +++++++++++++---- deal.II/deal.II/source/fe/fe_values.cc | 22 +++++++++---------- deal.II/deal.II/source/numerics/assembler.cc | 1 - .../source/numerics/error_estimator.cc | 15 +++++-------- deal.II/deal.II/source/numerics/matrices.cc | 2 +- deal.II/deal.II/source/numerics/vectors.cc | 2 +- 7 files changed, 41 insertions(+), 28 deletions(-) diff --git a/deal.II/deal.II/include/fe/fe.h b/deal.II/deal.II/include/fe/fe.h index aa211dc7aa..cbaa74528d 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -6,6 +6,7 @@ /*---------------------------- fe.h ---------------------------*/ #include +#include #include #include #include @@ -212,7 +213,11 @@ struct FiniteElementData<2> { * @author Wolfgang Bangerth, 1998 */ template -struct FiniteElementBase : public FiniteElementData { +struct FiniteElementBase : + public Subscriptor, + public FiniteElementData + +{ public: /** * Construct an object of this type. diff --git a/deal.II/deal.II/include/fe/fe_values.h b/deal.II/deal.II/include/fe/fe_values.h index 43fa7ca521..3b3f53c6e9 100644 --- a/deal.II/deal.II/include/fe/fe_values.h +++ b/deal.II/deal.II/include/fe/fe_values.h @@ -6,9 +6,10 @@ /*---------------------------- fe_values.h ---------------------------*/ +#include +#include #include #include -#include #include #include @@ -617,10 +618,13 @@ class FEValues : public FEValuesBase { * may use other ways.) */ void reinit (const typename DoFHandler::cell_iterator &, - const FiniteElement &, const Boundary &); private: + /** + * Store the finite element for later use. + */ + SmartPointer > fe; /** * Store the gradients of the shape * functions at the quadrature points on @@ -889,8 +893,12 @@ class FEFaceValues : public FEFaceValuesBase { */ void reinit (const typename DoFHandler::cell_iterator &cell, const unsigned int face_no, - const FiniteElement &fe, const Boundary &boundary); +private: + /** + * Store the finite element for later use. + */ + SmartPointer > fe; }; @@ -1041,13 +1049,17 @@ class FESubfaceValues : public FEFaceValuesBase { void reinit (const typename DoFHandler::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, - const FiniteElement &fe, const Boundary &boundary); /** * Exception */ DeclException0 (ExcReinitCalledWithBoundaryFace); +private: + /** + * Store the finite element for later use. + */ + SmartPointer > fe; }; diff --git a/deal.II/deal.II/source/fe/fe_values.cc b/deal.II/deal.II/source/fe/fe_values.cc index 647351d800..27b8320022 100644 --- a/deal.II/deal.II/source/fe/fe_values.cc +++ b/deal.II/deal.II/source/fe/fe_values.cc @@ -164,6 +164,7 @@ FEValues::FEValues (const FiniteElement &fe, fe.n_transform_functions, 1, update_flags), + fe(&fe), unit_shape_gradients(fe.total_dofs, vector >(quadrature.n_quadrature_points)), unit_shape_gradients_transform(fe.n_transform_functions, @@ -201,7 +202,6 @@ FEValues::FEValues (const FiniteElement &fe, template void FEValues::reinit (const typename DoFHandler::cell_iterator &cell, - const FiniteElement &fe, const Boundary &boundary) { present_cell = cell; // fill jacobi matrices and real @@ -211,7 +211,7 @@ void FEValues::reinit (const typename DoFHandler::cell_iterator &cell, (update_flags & update_q_points) || (update_flags & update_gradients) || (update_flags & update_ansatz_points)) - fe.fill_fe_values (cell, + fe->fill_fe_values (cell, unit_quadrature_points, jacobi_matrices, update_flags & (update_jacobians | @@ -227,7 +227,7 @@ void FEValues::reinit (const typename DoFHandler::cell_iterator &cell, // compute gradients on real element if // requested if (update_flags & update_gradients) - for (unsigned int i=0; itotal_dofs; ++i) for (unsigned int j=0; j::FEFaceValues (const FiniteElement &fe, fe.total_dofs, fe.n_transform_functions, GeometryInfo::faces_per_cell, - update_flags) + update_flags), + fe(&fe) { unit_face_quadrature_points = quadrature.get_quad_points(); weights = quadrature.get_weights (); @@ -353,7 +354,6 @@ FEFaceValues::FEFaceValues (const FiniteElement &fe, template void FEFaceValues::reinit (const typename DoFHandler::cell_iterator &cell, const unsigned int face_no, - const FiniteElement &fe, const Boundary &boundary) { present_cell = cell; selected_dataset = face_no; @@ -365,7 +365,7 @@ void FEFaceValues::reinit (const typename DoFHandler::cell_iterator &c (update_flags & update_gradients) || (update_flags & update_ansatz_points) || (update_flags & update_JxW_values)) - fe.fill_fe_face_values (cell, + fe->fill_fe_face_values (cell, face_no, unit_face_quadrature_points, unit_quadrature_points[face_no], @@ -388,7 +388,7 @@ void FEFaceValues::reinit (const typename DoFHandler::cell_iterator &c // compute gradients on real element if // requested if (update_flags & update_gradients) - for (unsigned int i=0; itotal_dofs; ++i) { fill_n (shape_gradients[i].begin(), n_quadrature_points, @@ -432,7 +432,8 @@ FESubfaceValues::FESubfaceValues (const FiniteElement &fe, fe.total_dofs, fe.n_transform_functions, GeometryInfo::faces_per_cell * GeometryInfo::subfaces_per_face, - update_flags) + update_flags), + fe(&fe) { Assert ((update_flags & update_ansatz_points) == false, ExcInvalidUpdateFlag()); @@ -479,7 +480,6 @@ template void FESubfaceValues::reinit (const typename DoFHandler::cell_iterator &cell, const unsigned int face_no, const unsigned int subface_no, - const FiniteElement &fe, const Boundary &boundary) { Assert (cell->face(face_no)->at_boundary() == false, ExcReinitCalledWithBoundaryFace()); @@ -493,7 +493,7 @@ void FESubfaceValues::reinit (const typename DoFHandler::cell_iterator (update_flags & update_q_points) || (update_flags & update_gradients) || (update_flags & update_JxW_values)) - fe.fill_fe_subface_values (cell, + fe->fill_fe_subface_values (cell, face_no, subface_no, unit_face_quadrature_points, @@ -515,7 +515,7 @@ void FESubfaceValues::reinit (const typename DoFHandler::cell_iterator // compute gradients on real element if // requested if (update_flags & update_gradients) - for (unsigned int i=0; itotal_dofs; ++i) { fill_n (shape_gradients[i].begin(), n_quadrature_points, diff --git a/deal.II/deal.II/source/numerics/assembler.cc b/deal.II/deal.II/source/numerics/assembler.cc index 4881ac452f..1cec0d6cbe 100644 --- a/deal.II/deal.II/source/numerics/assembler.cc +++ b/deal.II/deal.II/source/numerics/assembler.cc @@ -106,7 +106,6 @@ void Assembler::assemble (const Equation &equation) { present_level, present_index, dof_handler), - fe, boundary); const unsigned int n_dofs = dof_handler->get_selected_fe().total_dofs; diff --git a/deal.II/deal.II/source/numerics/error_estimator.cc b/deal.II/deal.II/source/numerics/error_estimator.cc index 647482a501..23b0002265 100644 --- a/deal.II/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/deal.II/source/numerics/error_estimator.cc @@ -224,7 +224,7 @@ template void KellyErrorEstimator:: integrate_over_regular_face (const active_cell_iterator &cell, const unsigned int face_no, - const FiniteElement &fe, + const FiniteElement &, const Boundary &boundary, const FunctionMap &neumann_bc, const unsigned int n_q_points, @@ -237,7 +237,7 @@ integrate_over_regular_face (const active_cell_iterator &cell, // initialize data of the restriction // of this cell to the present face - fe_face_values_cell.reinit (cell, face_no, fe, boundary); + fe_face_values_cell.reinit (cell, face_no, boundary); // set up a vector of the gradients // of the finite element function @@ -275,8 +275,7 @@ integrate_over_regular_face (const active_cell_iterator &cell, // get restriction of finite element // function of #neighbor# to the // common face. - fe_face_values_neighbor.reinit (neighbor, neighbor_neighbor, - fe, boundary); + fe_face_values_neighbor.reinit (neighbor, neighbor_neighbor, boundary); // get a list of the gradients of // the finite element solution @@ -380,7 +379,7 @@ template void KellyErrorEstimator:: integrate_over_irregular_face (const active_cell_iterator &cell, const unsigned int face_no, - const FiniteElement &fe, + const FiniteElement &, const Boundary &boundary, const unsigned int n_q_points, FEFaceValues &fe_face_values, @@ -429,16 +428,14 @@ integrate_over_irregular_face (const active_cell_iterator &cell, // present cell to the subface and // store the gradient of the solution // in psi - fe_subface_values.reinit (cell, face_no, subface_no, - fe, boundary); + fe_subface_values.reinit (cell, face_no, subface_no, boundary); fe_subface_values.get_function_grads (solution, psi); // restrict the finite element on the // neighbor cell to the common #subface#. // store the gradient in #neighbor_psi# vector > neighbor_psi (n_q_points); - fe_face_values.reinit (neighbor_child, neighbor_neighbor, - fe, boundary); + fe_face_values.reinit (neighbor_child, neighbor_neighbor, boundary); fe_face_values.get_function_grads (solution, neighbor_psi); // compute the jump in the gradients diff --git a/deal.II/deal.II/source/numerics/matrices.cc b/deal.II/deal.II/source/numerics/matrices.cc index 938988f502..2089de405f 100644 --- a/deal.II/deal.II/source/numerics/matrices.cc +++ b/deal.II/deal.II/source/numerics/matrices.cc @@ -165,7 +165,7 @@ void MatrixCreator::create_boundary_mass_matrix (const DoFHandler & cell_matrix.clear (); cell_vector.clear (); - fe_values.reinit (cell, face, fe, boundary); + fe_values.reinit (cell, face, boundary); const dFMatrix &values = fe_values.get_shape_values (); const vector &weights = fe_values.get_JxW_values (); diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 30e780f6a5..38f13f1a1e 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -370,7 +370,7 @@ void VectorTools::integrate_difference (const DoFHandler &dof, { double diff=0; // initialize for this cell - fe_values.reinit (cell, fe, boundary); + fe_values.reinit (cell, boundary); switch (norm) { -- 2.39.5