From: kanschat Date: Wed, 17 Nov 1999 22:29:02 +0000 (+0000) Subject: FunctionMap removed in interpolate_boundary X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f150d5bf6da66fe40394c120abe56bef5924c86;p=dealii-svn.git FunctionMap removed in interpolate_boundary git-svn-id: https://svn.dealii.org/trunk@1887 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/numerics/vectors.h b/deal.II/deal.II/include/numerics/vectors.h index cc70c314cb..c0add050cd 100644 --- a/deal.II/deal.II/include/numerics/vectors.h +++ b/deal.II/deal.II/include/numerics/vectors.h @@ -356,6 +356,7 @@ class VectorTools Vector &rhs_vector); /** + * Prepare Dirichlet boundary conditions. * Make up the list of nodes subject * to Dirichlet boundary conditions * and the values to be @@ -367,6 +368,11 @@ class VectorTools * of the boundary part to be projected * on already was in the variable. * + * The parameter #boundary_component# corresponds + * to the number #boundary_indicator# of the face. + * 255 is an illegal value, since it is reserved + * for interior faces. + * * The flags in the last * parameter, #component_mask# * denote which components of the @@ -384,8 +390,8 @@ class VectorTools * element. * * It is assumed that the number - * of components of the functions - * in #dirichlet_bc# matches that + * of components of the function + * in #boundary_function# matches that * of the finite element used by * #dof#. * @@ -393,10 +399,13 @@ class VectorTools * information. */ static void interpolate_boundary_values (const DoFHandler &dof, - const FunctionMap &dirichlet_bc, + unsigned char boundary_component, + const Function &boundary_function, map &boundary_values, const vector &component_mask = vector()); +//TODO: Update project_boundary_values for more components +//TODO: Replace FunctionMap /** * Project #function# to the boundary * of the domain, using the given quadrature @@ -408,18 +417,18 @@ class VectorTools * on already was in the variable. * * It is assumed that the number - * of components of the functions - * in #boundary_functions# + * of components of + * #boundary_function# * matches that of the finite * element used by #dof#. * * See the general documentation of this * class for further information. */ - static void project_boundary_values (const DoFHandler &dof, - const FunctionMap &boundary_functions, - const Quadrature &q, - map &boundary_values); + static void project_boundary_values (const DoFHandler &dof, + const FunctionMap &boundary_function, + const Quadrature&q, + map &boundary_values); /** * Compute the error of the finite element solution. diff --git a/deal.II/deal.II/source/numerics/base.cc b/deal.II/deal.II/source/numerics/base.cc index 3a9b43a062..4d1d23afee 100644 --- a/deal.II/deal.II/source/numerics/base.cc +++ b/deal.II/deal.II/source/numerics/base.cc @@ -74,7 +74,8 @@ template void ProblemBase::assemble (const Equation &equation, const Quadrature &quadrature, const UpdateFlags update_flags, - const FunctionMap &dirichlet_bc) { + const FunctionMap &dirichlet_bc) +{ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected()); system_sparsity.reinit (dof_handler->n_dofs(), @@ -123,8 +124,13 @@ void ProblemBase::assemble (const Equation &equation, // apply Dirichlet bc as described // in the docs map boundary_value_list; - VectorTools::interpolate_boundary_values (*dof_handler, dirichlet_bc, - boundary_value_list); + + for (FunctionMap::const_iterator dirichlet = dirichlet_bc.begin() ; + dirichlet != dirichlet_bc.end() ; ++dirichlet) + VectorTools::interpolate_boundary_values (*dof_handler, + dirichlet->first, + *(dirichlet->second), + boundary_value_list); MatrixTools::apply_boundary_values (boundary_value_list, system_matrix, solution, right_hand_side); @@ -134,7 +140,8 @@ void ProblemBase::assemble (const Equation &equation, template -void ProblemBase::solve () { +void ProblemBase::solve () +{ Assert ((tria!=0) && (dof_handler!=0), ExcNoTriaSelected()); SolverControl control(4000, 1e-16); diff --git a/deal.II/deal.II/source/numerics/vectors.cc b/deal.II/deal.II/source/numerics/vectors.cc index 4eaf3a3f93..42b2115236 100644 --- a/deal.II/deal.II/source/numerics/vectors.cc +++ b/deal.II/deal.II/source/numerics/vectors.cc @@ -466,15 +466,16 @@ void VectorTools::create_right_hand_side (const DoFHandler &dof, template <> void VectorTools<1>::interpolate_boundary_values (const DoFHandler<1> &dof, - const FunctionMap &dirichlet_bc, + unsigned char boundary_component, + const Function<1> &boundary_function, map &boundary_values, const vector &component_mask_) { - Assert (dirichlet_bc.find(255) == dirichlet_bc.end(), + Assert (boundary_component != 255, ExcInvalidBoundaryIndicator()); const FiniteElement<1> &fe = dof.get_fe(); - Assert (fe.n_components == dirichlet_bc.begin()->second->n_components, + Assert (fe.n_components == boundary_function.n_components, ExcComponentMismatch()); Assert (fe.dofs_per_vertex == fe.n_components, ExcComponentMismatch()); @@ -490,7 +491,7 @@ VectorTools<1>::interpolate_boundary_values (const DoFHandler<1> &dof, // check whether boundary values at the // left boundary of the line are requested - if (dirichlet_bc.find(0) != dirichlet_bc.end()) + if (boundary_component == 0) { // first find the leftmost active // cell by first traversing the coarse @@ -512,12 +513,12 @@ VectorTools<1>::interpolate_boundary_values (const DoFHandler<1> &dof, for (unsigned int i=0; ivertex_dof_index(0,i)] - = dirichlet_bc.find(0)->second->value(leftmost_cell->vertex(0), i); + = boundary_function.value(leftmost_cell->vertex(0), i); }; // same for the right boundary of // the line are requested - if (dirichlet_bc.find(1) != dirichlet_bc.end()) + if (boundary_component == 1) { // first find the leftmost active // cell by first traversing the coarse @@ -535,7 +536,7 @@ VectorTools<1>::interpolate_boundary_values (const DoFHandler<1> &dof, for (unsigned int i=0; ivertex_dof_index(1,i)] - = dirichlet_bc.find(1)->second->value(rightmost_cell->vertex(1), i); + = boundary_function.value(rightmost_cell->vertex(1), i); }; }; @@ -548,18 +549,19 @@ VectorTools<1>::interpolate_boundary_values (const DoFHandler<1> &dof, template void VectorTools::interpolate_boundary_values (const DoFHandler &dof, - const FunctionMap &dirichlet_bc, + unsigned char boundary_component, + const Function &boundary_function, map &boundary_values, const vector &component_mask_) { - Assert (dirichlet_bc.find(255) == dirichlet_bc.end(), + Assert (boundary_component != 255, ExcInvalidBoundaryIndicator()); const FiniteElement &fe = dof.get_fe(); const unsigned int n_components = fe.n_components; const bool fe_is_system = (n_components != 1); - Assert (n_components == dirichlet_bc.begin()->second->n_components, + Assert (n_components == boundary_function.n_components, ExcInvalidFE()); // set the component mask to either @@ -571,8 +573,6 @@ VectorTools::interpolate_boundary_values (const DoFHandler &dof, Assert (count(component_mask.begin(), component_mask.end(), true) > 0, ExcComponentMismatch()); - typename FunctionMap::const_iterator function_ptr; - // field to store the indices of dofs vector face_dofs (fe.dofs_per_face, -1); vector > dof_locations (face_dofs.size(), Point()); @@ -589,10 +589,8 @@ VectorTools::interpolate_boundary_values (const DoFHandler &dof, DoFHandler::active_face_iterator face = dof.begin_active_face(), endf = dof.end_face(); for (; face!=endf; ++face) - if ((function_ptr = dirichlet_bc.find(face->boundary_indicator())) != - dirichlet_bc.end()) - // face is subject to one of the - // bc listed in #dirichlet_bc# + if (boundary_component == face->boundary_indicator()) + // face is of the right component { // get indices, physical location and // boundary values of dofs on this @@ -602,7 +600,7 @@ VectorTools::interpolate_boundary_values (const DoFHandler &dof, if (fe_is_system) { - function_ptr->second->vector_value_list (dof_locations, dof_values_system); + boundary_function.vector_value_list (dof_locations, dof_values_system); // enter into list @@ -617,7 +615,7 @@ VectorTools::interpolate_boundary_values (const DoFHandler &dof, { // get only the one component that // this function has - function_ptr->second->value_list (dof_locations, + boundary_function.value_list (dof_locations, dof_values_scalar, 0); @@ -636,7 +634,8 @@ void VectorTools::project_boundary_values (const DoFHandler &dof, const FunctionMap &boundary_functions, const Quadrature &q, - map &boundary_values) { + map &boundary_values) +{ Assert (dof.get_fe().n_components == boundary_functions.begin()->second->n_components, ExcComponentMismatch()); diff --git a/tests/deal.II/wave-test-3.cc b/tests/deal.II/wave-test-3.cc index 84d5a12436..0650686cce 100644 --- a/tests/deal.II/wave-test-3.cc +++ b/tests/deal.II/wave-test-3.cc @@ -5938,12 +5938,9 @@ void TimeStep_Dual::do_timestep () map boundary_value_list; if (dim != 1) { - VectorTools::FunctionMap dirichlet_bc; static const ZeroFunction boundary_values; - dirichlet_bc[0] = &boundary_values; - - VectorTools::interpolate_boundary_values (*dof_handler, dirichlet_bc, + VectorTools::interpolate_boundary_values (*dof_handler, 0, boundary_values, boundary_value_list); MatrixTools::apply_boundary_values (boundary_value_list, system_matrix, v, @@ -8271,12 +8268,10 @@ void TimeStep_Primal::do_timestep () // zero already. parameters.boundary_values_u->set_time (time); parameters.boundary_values_v->set_time (time); - VectorTools::FunctionMap dirichlet_bc; - dirichlet_bc[0] = parameters.boundary_values_u; map boundary_value_list; - VectorTools::interpolate_boundary_values (*dof_handler, - dirichlet_bc, + VectorTools::interpolate_boundary_values (*dof_handler, 0, + *(parameters.boundary_values_u), boundary_value_list); MatrixTools::apply_boundary_values (boundary_value_list, system_matrix, u, @@ -8300,11 +8295,9 @@ void TimeStep_Primal::do_timestep () // at all if (dim != 1) { - VectorTools::FunctionMap dirichlet_bc; - dirichlet_bc[0] = parameters.boundary_values_v; map boundary_value_list; - VectorTools::interpolate_boundary_values (*dof_handler, - dirichlet_bc, + VectorTools::interpolate_boundary_values (*dof_handler, 0, + *(parameters.boundary_values_v), boundary_value_list); MatrixTools::apply_boundary_values (boundary_value_list, system_matrix, v,