From 7cd88d9405995e2bcb953b011d71b457b2f9275c Mon Sep 17 00:00:00 2001 From: kronbichler Date: Mon, 9 Mar 2009 12:22:00 +0000 Subject: [PATCH] Use the new CellSimilarity capability of FEValues in order to speed up assembly. git-svn-id: https://svn.dealii.org/trunk@18468 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-32/step-32.cc | 100 ++++++++++++++++------------ 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index 35adcfff59..79fc28af55 100644 --- a/deal.II/examples/step-32/step-32.cc +++ b/deal.II/examples/step-32/step-32.cc @@ -792,24 +792,30 @@ BoussinesqFlowProblem::assemble_stokes_preconditioner () Utilities::Trilinos::get_this_mpi_process(trilinos_communicator)) { stokes_fe_values.reinit (cell); - local_matrix = 0; - for (unsigned int q=0; qget_dof_indices (local_dof_indices); @@ -926,7 +932,8 @@ void BoussinesqFlowProblem::assemble_stokes_system () stokes_fe_values.reinit (cell); temperature_fe_values.reinit (temperature_cell); - local_matrix = 0; + if (stokes_fe_values.get_cell_similarity() != CellSimilarity::translation) + local_matrix = 0; local_rhs = 0; temperature_fe_values.get_function_values (old_temperature_solution, @@ -939,7 +946,8 @@ void BoussinesqFlowProblem::assemble_stokes_system () for (unsigned int k=0; k::assemble_stokes_system () } } - if (rebuild_stokes_matrix) + if (rebuild_stokes_matrix && + stokes_fe_values.get_cell_similarity() != CellSimilarity::translation) for (unsigned int i=0; i gravity = ( (dim == 2) ? (Point (0,1)) : (Point (0,0,1)) ); @@ -968,12 +977,14 @@ void BoussinesqFlowProblem::assemble_stokes_system () if (rebuild_stokes_matrix == true) stokes_constraints.distribute_local_to_global (local_matrix, + local_rhs, local_dof_indices, - stokes_matrix); - - stokes_constraints.distribute_local_to_global (local_rhs, - local_dof_indices, - stokes_rhs); + stokes_matrix, + stokes_rhs); + else + stokes_constraints.distribute_local_to_global (local_rhs, + local_dof_indices, + stokes_rhs); } stokes_matrix.compress(); @@ -1024,31 +1035,34 @@ void BoussinesqFlowProblem::assemble_temperature_matrix () if (cell->subdomain_id() == Utilities::Trilinos::get_this_mpi_process(trilinos_communicator) ) { - local_mass_matrix = 0; - local_stiffness_matrix = 0; - temperature_fe_values.reinit (cell); - for (unsigned int q=0; qget_dof_indices (local_dof_indices); -- 2.39.5