From 56cf44f2ff8340c1c257fd0f20bfdaa103ecc5c5 Mon Sep 17 00:00:00 2001 From: wolf Date: Thu, 22 Feb 2001 11:50:33 +0000 Subject: [PATCH] count_dofs_per_component git-svn-id: https://svn.dealii.org/trunk@4010 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/deal.II/source/dofs/dof_tools.cc | 62 +++++++++++++++++++++++- deal.II/doc/news/2001/c-3-1.html | 12 ++++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index 7141a1e5f0..7c206cda16 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -30,7 +30,7 @@ #include #include - +#include // if necessary try to work around a bug in the IBM xlC compiler #ifdef XLC_WORK_AROUND_STD_BUG @@ -1037,6 +1037,59 @@ DoFTools::extract_hanging_node_dofs (const DoFHandler<3> &dof_handler, +template +void +DoFTools::count_dofs_per_component (const DoFHandler &dof_handler, + std::vector &dofs_per_component) +{ + const unsigned int n_components = dof_handler.get_fe().n_components(); + dofs_per_component.resize (n_components); + + // special case for only one + // component. treat this first + // since it does not require any + // computations + if (n_components == 1) + { + dofs_per_component[0] = dof_handler.n_dofs(); + return; + }; + + // otherwise determine the number + // of dofs in each component + // separately. do so in parallel + std::vector > dofs_in_component (n_components, + std::vector(dof_handler.n_dofs(), + false)); + std::vector > component_select (n_components, + std::vector(n_components, false)); + Threads::ThreadManager thread_manager; + for (unsigned int i=0; i) + .collect_args (dof_handler, component_select[i], + dofs_in_component[i])); + }; + thread_manager.wait(); + + // next count what we got + for (unsigned int i=0; i void DoFTools::compute_intergrid_constraints (const DoFHandler &coarse_grid, @@ -1780,6 +1833,13 @@ DoFTools::extract_boundary_dofs (const DoFHandler &, std::vector &); #endif + +template +void +DoFTools::count_dofs_per_component (const DoFHandler &dof_handler, + std::vector &dofs_per_component); + + template void DoFTools::compute_intergrid_constraints (const DoFHandler &, diff --git a/deal.II/doc/news/2001/c-3-1.html b/deal.II/doc/news/2001/c-3-1.html index 2e952238fd..0dff483f96 100644 --- a/deal.II/doc/news/2001/c-3-1.html +++ b/deal.II/doc/news/2001/c-3-1.html @@ -111,8 +111,18 @@ documentation, etc.

deal.II

    +
  1. + New: The DoFTools class now has + a function count_dofs_per_component + that counts the number of degrees of freedom in each of the + components of the finite element, i.e. how many degrees of + freedom there are on the global mesh for each variable (field). +
    + (WB 2001/02/22) +

    +
  2. - New: The CellAccessor now has a function + New: The CellAccessor class now has a function has_boundary_lines that mostly has the same semantics that at_boundary has, but also covers the case that a hexahedron in 3d may be at -- 2.39.5