From: Guido Kanschat Date: Mon, 30 Jan 2006 14:58:09 +0000 (+0000) Subject: MGTransferBlock changed to blocks instead of components X-Git-Tag: v8.0.0~12468 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b11edf11e1f246f4f939e19af528591f10d2f78;p=dealii.git MGTransferBlock changed to blocks instead of components git-svn-id: https://svn.dealii.org/trunk@12211 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 dc7c48027a..0e9f26fa27 100644 --- a/deal.II/deal.II/include/dofs/dof_tools.h +++ b/deal.II/deal.II/include/dofs/dof_tools.h @@ -1089,6 +1089,24 @@ class DoFTools std::vector target_component = std::vector()); + /** + * Count the degrees of freedom + * in each block. This function + * is similar to + * count_dofs_per_component(), + * with the difference that the + * counting is done by + * blocks. See @ref GlossBlock + * "blocks" in the glossary for + * details. + */ + template + static void + count_dofs_per_block (const DoFHandler& dof_handler, + std::vector& dofs_per_component, + std::vector target_block + = std::vector()); + /** * @deprecated See the previous * function with the same name diff --git a/deal.II/deal.II/include/fe/fe.h b/deal.II/deal.II/include/fe/fe.h index b00f7c747c..b13e053494 100644 --- a/deal.II/deal.II/include/fe/fe.h +++ b/deal.II/deal.II/include/fe/fe.h @@ -2318,8 +2318,8 @@ inline std::pair FiniteElement::system_to_block_index (const unsigned int index) const { - Assert (index < this->n_blocks(), - ExcIndexRange(index, 0, this->n_blocks())); + Assert (index < this->dofs_per_cell, + ExcIndexRange(index, 0, this->dofs_per_cell)); // The block is computed simply as // first block of this base plus // the index within the base blocks diff --git a/deal.II/deal.II/source/dofs/dof_tools.cc b/deal.II/deal.II/source/dofs/dof_tools.cc index c944344a1f..f6172f7a15 100644 --- a/deal.II/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/deal.II/source/dofs/dof_tools.cc @@ -2540,6 +2540,70 @@ DoFTools::count_dofs_per_component ( } +template +void +DoFTools::count_dofs_per_block ( + const DoFHandler& dof_handler, + std::vector& dofs_per_block, + std::vector target_block) +{ + const FiniteElement& fe = dof_handler.get_fe(); + const unsigned int n_blocks = fe.n_blocks(); + dofs_per_block.resize (n_blocks); + std::fill (dofs_per_block.begin(), dofs_per_block.end(), 0U); + + // If the empty vector was given as + // default argument, set up this + // vector as identity. + if (target_block.size()==0) + { + target_block.resize(n_blocks); + for (unsigned int i=0;i > + dofs_in_block (n_blocks, std::vector(dof_handler.n_dofs(), false)); + std::vector > + block_select (n_blocks, std::vector(n_blocks, false)); + Threads::ThreadGroup<> threads; + for (unsigned int i=0; i &, + const std::vector &, + std::vector &, + bool) + = &DoFTools::template extract_dofs; + block_select[i][i] = true; + threads += Threads::spawn (fun_ptr)(dof_handler, block_select[i], + dofs_in_block[i], true); + }; + threads.join_all (); + + // next count what we got + for (unsigned int block=0;block void DoFTools::count_dofs_per_component ( @@ -4100,6 +4164,12 @@ DoFTools::count_dofs_per_component ( const DoFHandler&, std::vector&, bool, std::vector); +template +void +DoFTools::count_dofs_per_block ( + const DoFHandler&, + std::vector&, std::vector); + template void DoFTools::count_dofs_per_component (