From: Guido Kanschat Date: Tue, 25 Sep 2007 19:46:29 +0000 (+0000) Subject: project_boundary_values for vector-valued elements X-Git-Tag: v8.0.0~9825 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5116d3e198616f06033b4b31ec70415442e35afa;p=dealii.git project_boundary_values for vector-valued elements git-svn-id: https://svn.dealii.org/trunk@15237 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/source/numerics/matrices.cc b/deal.II/deal.II/source/numerics/matrices.cc index d8e583b707..8c2fc1d32f 100644 --- a/deal.II/deal.II/source/numerics/matrices.cc +++ b/deal.II/deal.II/source/numerics/matrices.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -994,7 +994,8 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, const FiniteElement &fe = dof.get_fe(); const unsigned int n_components = fe.n_components(); const bool fe_is_system = (n_components != 1); - + const bool fe_is_primitive = fe.is_primitive(); + Assert (matrix.n() == dof.n_boundary_dofs(boundary_functions), ExcInternalError()); Assert (matrix.n() == matrix.m(), ExcInternalError()); @@ -1035,10 +1036,12 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, // two variables for the coefficient, // one for the two cases indicated in // the name - std::vector coefficient_values (fe_values.n_quadrature_points); + std::vector coefficient_values (fe_values.n_quadrature_points, 1.); std::vector > coefficient_vector_values (fe_values.n_quadrature_points, Vector(n_components)); - + const bool coefficient_is_vector = (coefficient != 0 && coefficient->n_components != 1) + ? true : false; + std::vector rhs_values_scalar (fe_values.n_quadrature_points); std::vector > rhs_values_system (fe_values.n_quadrature_points, Vector(n_components)); @@ -1069,84 +1072,69 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, boundary_functions.find(cell->face(face)->boundary_indicator()) ->second->vector_value_list (fe_values.get_quadrature_points(), rhs_values_system); - - if (coefficient != 0) + + if (coefficient_is_vector) + // If coefficient is + // vector valued, fill + // all components + coefficient->vector_value_list (fe_values.get_quadrature_points(), + coefficient_vector_values); + else { - if (coefficient->n_components==1) - { - coefficient->value_list (fe_values.get_quadrature_points(), - coefficient_values); - for (unsigned int point=0; pointvector_value_list (fe_values.get_quadrature_points(), - coefficient_vector_values); - for (unsigned int point=0; pointvalue_list (fe_values.get_quadrature_points(), + coefficient_values); + // Copy scalar + // values into vector + for (unsigned int point=0; point &mapping, ->second->value_list (fe_values.get_quadrature_points(), rhs_values_scalar); if (coefficient != 0) + coefficient->value_list (fe_values.get_quadrature_points(), + coefficient_values); + for (unsigned int point=0; pointvalue_list (fe_values.get_quadrature_points(), - coefficient_values); - for (unsigned int point=0; point &mapping, // searches. cell->get_dof_indices (dofs); cell->face(face)->get_dof_indices (dofs_on_face_vector); - + // check for each of the // dofs on this cell // whether it is on the @@ -1288,52 +1258,11 @@ create_boundary_mass_matrix_1 (const Mapping &mapping, matrix.add(dof_to_boundary_mapping[dofs[i]], dof_to_boundary_mapping[dofs[j]], cell_matrix(i,j)); - else - { - // assume that all - // shape functions - // that are nonzero - // on the boundary - // are also listed - // in the - // @p{dof_to_boundary} - // mapping. if that - // is not the case, - // then the - // boundary mass - // matrix does not - // make that much - // sense anyway, as - // it only contains - // entries for - // parts of the - // functions living - // on the boundary - // - // these, we may - // compare here for - // relative - // smallness of all - // entries in the - // local matrix - // which are not - // taken over to - // the global one - Assert (std::fabs(cell_matrix(i,j)) <= 1e-10 * max_diag_entry, - ExcInternalError ()); - }; for (unsigned int j=0; j