From ccdeb0195a789e9db51b8fcf5d7fa56530042d1f Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sun, 19 May 2019 00:42:51 +0200 Subject: [PATCH] Clarify size of coef --- examples/step-64/step-64.cu | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/step-64/step-64.cu b/examples/step-64/step-64.cu index 67558f8f81..e8741fed8c 100644 --- a/examples/step-64/step-64.cu +++ b/examples/step-64/step-64.cu @@ -249,15 +249,13 @@ namespace Step64 // information when doing matrix-vector products. // // In the second half, we need to store the value of the coefficient - // for each quadrature point in every locally owned cells. In - // actuality, however, the code stores the coefficient on - // every cell of the local DoFHandler object, including the - // ghost and artificial cells. (See the glossary entries on - // @ref @ref GlossGhostCell "ghost cells" - // and - // @ref GlossArtificialCell "artificial cells".) These will simply - // be ignored in the loop over all cells in the `vmult()` function - // below. + // for each quadrature point in every active, locally owned cell. + // We can ask the parallel triangulation for the number of active, locally + // owned cells but only have a DoFHandler object at hand. Since + // DoFHandler::get_triangulation() returns a Triangulation object, not a + // parallel::Triangulation object, we have to downcast the return value. This + // is safe to do here because we know that the triangulation is a + // parallel:distributed::Triangulation object in fact. template HelmholtzOperator::HelmholtzOperator( const DoFHandler & dof_handler, @@ -274,8 +272,9 @@ namespace Step64 const unsigned int n_owned_cells = - std::distance::active_cell_iterator>( - dof_handler.begin_active(), dof_handler.end()); + dynamic_cast *>( + &dof_handler.get_triangulation()) + ->n_locally_owned_active_cells(); coef.reinit(Utilities::pow(fe_degree + 1, dim) * n_owned_cells); const VaryingCoefficientFunctor functor(coef.get_values()); -- 2.39.5