From: Denis Davydov Date: Sat, 15 Apr 2017 08:35:17 +0000 (+0200) Subject: implement comments X-Git-Tag: v9.0.0-rc1~1688^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4103%2Fhead;p=dealii.git implement comments --- diff --git a/doc/doxygen/images/extract_dofs_with_support_on.png b/doc/doxygen/images/extract_dofs_with_support_contained_within.png similarity index 100% rename from doc/doxygen/images/extract_dofs_with_support_on.png rename to doc/doxygen/images/extract_dofs_with_support_contained_within.png diff --git a/doc/news/changes/minor/20170324DenisDavydov b/doc/news/changes/minor/20170324DenisDavydov index 462f1a659c..212711ae1d 100644 --- a/doc/news/changes/minor/20170324DenisDavydov +++ b/doc/news/changes/minor/20170324DenisDavydov @@ -1,4 +1,5 @@ -New: DoFTools::extract_dofs_with_support_on() returns a set of degrees of -freedom that have support on a subset of locally owned cells. +New: DoFTools::extract_dofs_with_support_contained_within() returns a set of +degrees of freedom whose support is entirely contained within the cells for +which the predicate returns true.
(Denis Davydov, 2017/03/24) diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index d0eead0241..2ae871e631 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -1437,18 +1437,18 @@ namespace DoFTools const std::set &boundary_ids = std::set()); /** - * Extract all degrees of freedom (DoFs) that have support only within cells, - * for which @p predicate is true. The result is returned as - * an IndexSet. + * Extract all indices of shape functions such that their support is entirely + * contained within the cells for which the @p predicate is true. + * The result is returned as an IndexSet. * * Consider the following FE space where predicate returns true - * for all cells on the left side: + * for all cells on the left half of the domain: * - * @image html extract_dofs_with_support_on.png + * @image html extract_dofs_with_support_contained_within.png * - * This functions will return the union of all DoFs on those cells minus + * This functions will return the union of all DoF indices on those cells minus * DoF 11, 13, 2 and 0; the result will be [9,10], 12, [14,38]. - * On the image above the returned DoFs are separated from the rest by the + * In the image above the returned DoFs are separated from the rest by the * red line * * Essentially, the question this functions answers is the following: @@ -1460,14 +1460,14 @@ namespace DoFTools * * In case of parallel::distributed::Triangulation @p predicate will be called * only for locally owned and ghost cells. The resulting index set may contain - * DoFs that are associated to the locally owned or ghost cells, but are not + * DoFs that are associated with the locally owned or ghost cells, but are not * owned by the current MPI core. */ template IndexSet - extract_dofs_with_support_on(const DoFHandlerType &dof_handler, - const std::function< bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate, - const ConstraintMatrix &cm = ConstraintMatrix()); + extract_dofs_with_support_contained_within(const DoFHandlerType &dof_handler, + const std::function< bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate, + const ConstraintMatrix &cm = ConstraintMatrix()); /** * Extract a vector that represents the constant modes of the DoFHandler for diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 796335ef7f..899169dc8a 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -767,9 +767,9 @@ namespace DoFTools template IndexSet - extract_dofs_with_support_on(const DoFHandlerType &dof_handler, - const std::function< bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate, - const ConstraintMatrix &cm) + extract_dofs_with_support_contained_within(const DoFHandlerType &dof_handler, + const std::function< bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate, + const ConstraintMatrix &cm) { const std::function< bool(const typename DoFHandlerType::active_cell_iterator &)> predicate_local = [=] (const typename DoFHandlerType::active_cell_iterator & cell) -> bool @@ -796,7 +796,7 @@ namespace DoFTools } // Get halo layer and accumulate its DoFs - std::set halo_dofs; + std::set dofs_with_support_on_halo_cells; const std::vector halo_cells = GridTools::compute_active_cell_halo_layer(dof_handler, predicate_local); @@ -816,55 +816,51 @@ namespace DoFTools const unsigned int dofs_per_cell = (*it)->get_fe().dofs_per_cell; local_dof_indices.resize (dofs_per_cell); (*it)->get_dof_indices (local_dof_indices); - halo_dofs.insert(local_dof_indices.begin(), - local_dof_indices.end()); + dofs_with_support_on_halo_cells.insert(local_dof_indices.begin(), + local_dof_indices.end()); } // A complication coming from the fact that DoFs living on locally - // owned cells which satisfy predicate may participate in constrains for + // owned cells which satisfy predicate may participate in constraints for // DoFs outside of this region. if (cm.n_constraints() > 0) { - const std::vector > *line_ptr; - - // Remove DoFs that are part of constrains for DoFs outside + // Remove DoFs that are part of constraints for DoFs outside // of predicate. Since we will subtract halo_dofs from predicate_dofs, // achieve this by extending halo_dofs with DoFs to which // halo_dofs are constrained. std::set extra_halo; - for (std::set::iterator it = halo_dofs.begin(); - it != halo_dofs.end(); ++it) - { - line_ptr = cm.get_constraint_entries(*it); - // if halo DoF is constrained, add all DoFs to which it's constrained. - if (line_ptr!=NULL) - { - const unsigned int line_size = line_ptr->size(); - for (unsigned int j=0; j::iterator it = dofs_with_support_on_halo_cells.begin(); + it != dofs_with_support_on_halo_cells.end(); ++it) + // if halo DoF is constrained, add all DoFs to which it's constrained + // because after resolving constraints, the support of the DoFs that + // constrain the current DoF will extend to the halo cells. + if (const std::vector > *line_ptr = cm.get_constraint_entries(*it)) + { + const unsigned int line_size = line_ptr->size(); + for (unsigned int j=0; j > + DoFTools::extract_dofs_with_support_contained_within > (const DoFHandler &, const std::function< bool(const typename DoFHandler::active_cell_iterator &)> &, const ConstraintMatrix&); diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_01.cc b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_01.cc similarity index 97% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_01.cc rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_01.cc index 741020cd8c..a6cbc171f6 100644 --- a/tests/dofs/dof_tools_extract_dofs_with_support_on_01.cc +++ b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_01.cc @@ -90,7 +90,7 @@ void test (const unsigned int flag) ConstraintMatrix cm; DoFTools::make_hanging_node_constraints(dh,cm); - IndexSet support = DoFTools::extract_dofs_with_support_on(dh, pred_d, cm); + IndexSet support = DoFTools::extract_dofs_with_support_contained_within(dh, pred_d, cm); support.print(deallog); // print grid and DoFs for visual inspection diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_01.output b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_01.output similarity index 100% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_01.output rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_01.output diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_02.cc b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.cc similarity index 94% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_02.cc rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.cc index d74ba742fb..9c2431a50a 100644 --- a/tests/dofs/dof_tools_extract_dofs_with_support_on_02.cc +++ b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.cc @@ -14,9 +14,9 @@ // --------------------------------------------------------------------- // -// similar to dof_tools_23, but for the p::d::Tria. As an MPI test, make sure -// that the total number of shape functions that are non-zero within the domain -// is the same. +// test DoFTools::extract_dofs_with_support_contained_within() for the p::d::Tria. +// As an MPI test, make sure that the total number of shape functions that are +// non-zero within the domain is the same. #include "../tests.h" #include @@ -102,7 +102,7 @@ void test (const unsigned int flag) DoFTools::make_hanging_node_constraints(dh,cm); cm.close (); - const IndexSet support = DoFTools::extract_dofs_with_support_on(dh, pred_d, cm); + const IndexSet support = DoFTools::extract_dofs_with_support_contained_within(dh, pred_d, cm); const IndexSet support_local = support & dh.locally_owned_dofs(); deallog << support.n_elements() << std::endl; diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_02.mpirun=1.output b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.mpirun=1.output similarity index 100% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_02.mpirun=1.output rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.mpirun=1.output diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_02.mpirun=3.output b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.mpirun=3.output similarity index 100% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_02.mpirun=3.output rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.mpirun=3.output diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_02.mpirun=5.output b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.mpirun=5.output similarity index 100% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_02.mpirun=5.output rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_02.mpirun=5.output diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_03.cc b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_03.cc similarity index 93% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_03.cc rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_03.cc index e19e4ec036..91d2131322 100644 --- a/tests/dofs/dof_tools_extract_dofs_with_support_on_03.cc +++ b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_03.cc @@ -14,7 +14,7 @@ // --------------------------------------------------------------------- // -// same as dof_tools_32 test DoFTools::extract_dofs_with_support_on() but +// test DoFTools::extract_dofs_with_support_contained_within() but // for a slightly different configuration #include "../tests.h" @@ -96,8 +96,8 @@ void test (const bool left = true) DoFTools::make_hanging_node_constraints(dh,cm); IndexSet support = left ? - DoFTools::extract_dofs_with_support_on(dh, pred_left, cm) : - DoFTools::extract_dofs_with_support_on(dh, pred_right, cm); + DoFTools::extract_dofs_with_support_contained_within(dh, pred_left, cm) : + DoFTools::extract_dofs_with_support_contained_within(dh, pred_right, cm); support.print(deallog); // print grid and DoFs for visual inspection diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_03.output b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_03.output similarity index 100% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_03.output rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_03.output diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_04.cc b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_04.cc similarity index 98% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_04.cc rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_04.cc index 7126ab0558..38bd6fa454 100644 --- a/tests/dofs/dof_tools_extract_dofs_with_support_on_04.cc +++ b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_04.cc @@ -14,8 +14,8 @@ // --------------------------------------------------------------------- // -// test DoFTools::extract_dofs_with_support_on() for calculation of the RHS -// function in parallel +// test DoFTools::extract_dofs_with_support_contained_within() for calculation +// of the RHS function in parallel #include "../tests.h" #include @@ -111,7 +111,7 @@ void test () std::vector local_dof_indices(fe.dofs_per_cell); // get support on the predicate - IndexSet support = DoFTools::extract_dofs_with_support_on(dh, pred_d, cm); + IndexSet support = DoFTools::extract_dofs_with_support_contained_within(dh, pred_d, cm); IndexSet local_support = support & locally_owned_set; // rhs vectors: diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_04.mpirun=2.output b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_04.mpirun=2.output similarity index 100% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_04.mpirun=2.output rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_04.mpirun=2.output diff --git a/tests/dofs/dof_tools_extract_dofs_with_support_on_04.output b/tests/dofs/dof_tools_extract_dofs_with_support_contained_within_04.output similarity index 100% rename from tests/dofs/dof_tools_extract_dofs_with_support_on_04.output rename to tests/dofs/dof_tools_extract_dofs_with_support_contained_within_04.output