From: bangerth Date: Wed, 27 Nov 2013 16:49:19 +0000 (+0000) Subject: Clean up code a bit. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74a49dd43cd562bf09c9cdf6c0fa63f60e497293;p=dealii-svn.git Clean up code a bit. git-svn-id: https://svn.dealii.org/trunk@31813 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/source/dofs/dof_tools_constraints.cc b/deal.II/source/dofs/dof_tools_constraints.cc index 57bfd9c0b2..b361c25d72 100644 --- a/deal.II/source/dofs/dof_tools_constraints.cc +++ b/deal.II/source/dofs/dof_tools_constraints.cc @@ -1990,7 +1990,7 @@ namespace DoFTools } - + template void make_periodicity_constraints (const DH &dof_handler, @@ -2140,64 +2140,35 @@ namespace DoFTools { namespace Assembler { - struct Scratch - { - Scratch() {}; - }; + struct Scratch {}; template struct CopyData { - CopyData(unsigned int const &coarse_component, - std::vector const &weight_mapping); - - CopyData(CopyData const &data); - - unsigned int coarse_component; - unsigned int dofs_per_cell; + unsigned int dofs_per_cell; std::vector parameter_dof_indices; - std::vector weight_mapping; std::vector > global_parameter_representation; }; - - - - template - CopyData::CopyData(unsigned int const &coarse_component, - std::vector const &weight_mapping) : - coarse_component(coarse_component), - weight_mapping(weight_mapping) - {} - - - - template - CopyData::CopyData(CopyData const &data) : - coarse_component(data.coarse_component), - dofs_per_cell(data.dofs_per_cell), - parameter_dof_indices(data.parameter_dof_indices), - weight_mapping(data.weight_mapping), - global_parameter_representation(data.global_parameter_representation) - {} } namespace { /** * This is a function that is called by the _2 function and that - * operates on one cell only. It is worked in parallel if + * operates on one cell only. It is worked in parallel if * multhithreading is available. */ template void compute_intergrid_weights_3 ( - typename dealii::DoFHandler::active_cell_iterator const &cell, - Assembler::Scratch const &scratch, + const typename dealii::DoFHandler::active_cell_iterator &cell, + const Assembler::Scratch &, Assembler::CopyData ©_data, - FiniteElement const &coarse_fe, - InterGridMap > const &coarse_to_fine_grid_map, - std::vector > const ¶meter_dofs) - + const unsigned int coarse_component, + const FiniteElement &coarse_fe, + const InterGridMap > &coarse_to_fine_grid_map, + const std::vector > ¶meter_dofs, + const std::vector &weight_mapping) { // for each cell on the parameter grid: find out which degrees of // freedom on the fine grid correspond in which way to the degrees @@ -2245,12 +2216,12 @@ namespace DoFTools // vector to hold the representation of a single degree of freedom // on the coarse grid (for the selected fe) on the fine grid - const types::global_dof_index n_fine_dofs = copy_data.weight_mapping.size(); + const types::global_dof_index n_fine_dofs = weight_mapping.size(); copy_data.dofs_per_cell = coarse_fe.dofs_per_cell; copy_data.parameter_dof_indices.resize(copy_data.dofs_per_cell); - + // get the global indices of the parameter dofs on this // parameter grid cell cell->get_dof_indices (copy_data.parameter_dof_indices); @@ -2260,7 +2231,7 @@ namespace DoFTools for (unsigned int local_dof=0; local_dof - void copy_intergrid_weights_3(Assembler::CopyData const ©_data, - FiniteElement const &coarse_fe, + void copy_intergrid_weights_3(const Assembler::CopyData ©_data, + const unsigned int coarse_component, + const FiniteElement &coarse_fe, + const std::vector &weight_mapping, std::vector > &weights) { unsigned int pos(0); for (unsigned int local_dof=0; local_dof @@ -2358,25 +2331,25 @@ namespace DoFTools std::vector > &weights) { Assembler::Scratch scratch; - Assembler::CopyData copy_data(coarse_component,weight_mapping); - - WorkStream::run(coarse_grid.begin_active(),coarse_grid.end(), - static_cast - ::active_cell_iterator const &,Assembler::Scratch const &,Assembler::CopyData - &)> > ( - std_cxx1x::bind(&compute_intergrid_weights_3, - std_cxx1x::_1, - std_cxx1x::_2, - std_cxx1x::_3, - std_cxx1x::cref(coarse_grid.get_fe()), - std_cxx1x::cref(coarse_to_fine_grid_map), - std_cxx1x::cref(parameter_dofs))), - static_cast const &)> > ( - std_cxx1x::bind(©_intergrid_weights_3, - std_cxx1x::_1, - std_cxx1x::cref(coarse_grid.get_fe()), - std_cxx1x::ref(weights))), + Assembler::CopyData copy_data; + + WorkStream::run(coarse_grid.begin_active(), + coarse_grid.end(), + std_cxx1x::bind(&compute_intergrid_weights_3, + std_cxx1x::_1, + std_cxx1x::_2, + std_cxx1x::_3, + coarse_component, + std_cxx1x::cref(coarse_grid.get_fe()), + std_cxx1x::cref(coarse_to_fine_grid_map), + std_cxx1x::cref(parameter_dofs), + std_cxx1x::cref(weight_mapping)), + std_cxx1x::bind(©_intergrid_weights_3, + std_cxx1x::_1, + coarse_component, + std_cxx1x::cref(coarse_grid.get_fe()), + std_cxx1x::cref(weight_mapping), + std_cxx1x::ref(weights)), scratch, copy_data); } @@ -2889,16 +2862,16 @@ namespace DoFTools cell->at_boundary ()) { const FiniteElement &fe = cell->get_fe(); - + // get global indices of dofs on the cell cell_dofs.resize (fe.dofs_per_cell); cell->get_dof_indices (cell_dofs); - + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; ++face_no) { const typename DH::face_iterator face = cell->face(face_no); - + // if face is on the boundary and satisfies the correct // boundary id property if (face->at_boundary () @@ -2917,7 +2890,7 @@ namespace DoFTools { // Find out if a dof has a contribution in this // component, and if so, add it to the list - const std::vector::iterator it_index_on_cell + const std::vector::iterator it_index_on_cell = std::find (cell_dofs.begin(), cell_dofs.end(), face_dofs[i]); Assert (it_index_on_cell != cell_dofs.end(), ExcInvalidIterator()); const unsigned int index_on_cell = std::distance(cell_dofs.begin(),