From: Ralf Hartmann Date: Mon, 27 Feb 2006 15:23:45 +0000 (+0000) Subject: DH templatize some more functions. X-Git-Tag: v8.0.0~12172 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28c170e4a6ea33f1641c75c7175a942a79774d2f;p=dealii.git DH templatize some more functions. git-svn-id: https://svn.dealii.org/trunk@12510 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/deal.II/include/dofs/dof_tools.h b/deal.II/deal.II/include/dofs/dof_tools.h index 635b3f5905..6bcf061459 100644 --- a/deal.II/deal.II/include/dofs/dof_tools.h +++ b/deal.II/deal.II/include/dofs/dof_tools.h @@ -936,9 +936,9 @@ class DoFTools * GridTools::get_subdomain_association * function. */ - template + template static void - get_subdomain_association (const DoFHandler &dof_handler, + get_subdomain_association (const DH &dof_handler, std::vector &subdomain); /** @@ -964,10 +964,10 @@ class DoFTools * GridTools::count_cells_with_subdomain_association * function. */ - template + template static unsigned int - count_dofs_with_subdomain_association (const DoFHandler &dof_handler, - const unsigned int subdomain); + count_dofs_with_subdomain_association (const DH &dof_handler, + const unsigned int subdomain); /** * Count how many degrees of diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index aaa8e54136..19661cfc9f 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -126,7 +126,7 @@ namespace fe_is_primitive (const hp::DoFHandler &dh) { //TODO:[?] Verify that this is really correct - return dh.get_fe().get_fe(0).is_primitive(); + return dh.get_fe()[0].is_primitive(); } } @@ -2368,11 +2368,10 @@ DoFTools::extract_subdomain_dofs (const DH &dof_handler, -template +template void -DoFTools:: -get_subdomain_association (const DoFHandler &dof_handler, - std::vector &subdomain_association) +DoFTools::get_subdomain_association (const DH &dof_handler, + std::vector &subdomain_association) { Assert(subdomain_association.size() == dof_handler.n_dofs(), ExcDimensionMismatch(subdomain_association.size(), @@ -2382,19 +2381,21 @@ get_subdomain_association (const DoFHandler &dof_handler, std::fill_n (subdomain_association.begin(), dof_handler.n_dofs(), deal_II_numbers::invalid_unsigned_int); - const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell; - std::vector local_dof_indices (dofs_per_cell); + std::vector local_dof_indices; + local_dof_indices.reserve (max_dofs_per_cell(dof_handler)); // this function is similar to the // make_sparsity_pattern function, // see there for more information - typename DoFHandler::active_cell_iterator + typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); for (; cell!=endc; ++cell) { const unsigned int subdomain_id = cell->subdomain_id(); + const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; + local_dof_indices.resize (dofs_per_cell); cell->get_dof_indices (local_dof_indices); // set subdomain ids. if dofs already @@ -2414,11 +2415,11 @@ get_subdomain_association (const DoFHandler &dof_handler, -template +template unsigned int DoFTools::count_dofs_with_subdomain_association ( - const DoFHandler &dof_handler, - const unsigned int subdomain) + const DH &dof_handler, + const unsigned int subdomain) { // in debug mode, make sure that there are // some cells at least with this subdomain @@ -2426,7 +2427,7 @@ DoFTools::count_dofs_with_subdomain_association ( #ifdef DEBUG { bool found = false; - for (typename Triangulation::active_cell_iterator + for (typename Triangulation::active_cell_iterator cell=dof_handler.get_tria().begin_active(); cell!=dof_handler.get_tria().end(); ++cell) if (cell->subdomain_id() == subdomain) @@ -3972,8 +3973,8 @@ DoFTools::distribute_cell_to_dof_vector > template void -DoFTools::distribute_cell_to_dof_vector > -(const DoFHandler &dof_handler, +DoFTools::distribute_cell_to_dof_vector > +(const hp::DoFHandler &dof_handler, const Vector &cell_data, Vector &dof_data, const unsigned int component); @@ -4017,16 +4018,26 @@ DoFTools::extract_subdomain_dofs > template void -DoFTools::get_subdomain_association +DoFTools::get_subdomain_association > (const DoFHandler &dof_handler, std::vector &subdomain_association); +template +void +DoFTools::get_subdomain_association > +(const hp::DoFHandler &dof_handler, + std::vector &subdomain_association); template unsigned int -DoFTools:: -count_dofs_with_subdomain_association (const DoFHandler &, - const unsigned int); +DoFTools::count_dofs_with_subdomain_association > +(const DoFHandler &, + const unsigned int); +template +unsigned int +DoFTools::count_dofs_with_subdomain_association > +(const hp::DoFHandler &, + const unsigned int); template