From: bangerth Date: Wed, 3 Sep 2008 01:53:35 +0000 (+0000) Subject: Clean up a few issues with Trilinos and otherwise. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f9734e1b2d2366cc8c230ed2453ec82a168cae5;p=dealii-svn.git Clean up a few issues with Trilinos and otherwise. git-svn-id: https://svn.dealii.org/trunk@16718 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index 57d80394d0..c8ea6d0033 100644 --- a/deal.II/examples/step-31/step-31.cc +++ b/deal.II/examples/step-31/step-31.cc @@ -65,9 +65,6 @@ #include -//TODO: Put into the class itself -Epetra_SerialComm comm_serial; - // This is Trilinos // Next, we import all deal.II @@ -424,11 +421,11 @@ namespace LinearSolvers const SmartPointer > stokes_matrix; const SmartPointer, PreconditionerMp > > m_inverse; -const PreconditionerA &a_preconditioner; + const PreconditionerA &a_preconditioner; -mutable Vector tmp; + mutable Vector tmp; -}; + }; @@ -529,6 +526,9 @@ class BoussinesqFlowProblem const double cell_diameter, const double old_time_step); + + Epetra_SerialComm trilinos_communicator; + Triangulation triangulation; const unsigned int stokes_degree; @@ -549,8 +549,9 @@ class BoussinesqFlowProblem FE_Q temperature_fe; DoFHandler temperature_dof_handler; ConstraintMatrix temperature_constraints; - - SparsityPattern temperature_sparsity_pattern; + + Epetra_Map temperature_partitioner; + SparsityPattern temperature_sparsity_pattern; TrilinosWrappers::SparseMatrix temperature_mass_matrix; TrilinosWrappers::SparseMatrix temperature_stiffness_matrix; TrilinosWrappers::SparseMatrix temperature_matrix; @@ -604,6 +605,8 @@ BoussinesqFlowProblem::BoussinesqFlowProblem () temperature_fe (temperature_degree), temperature_dof_handler (triangulation), + temperature_partitioner (0, 0, trilinos_communicator), + time_step (0), old_time_step (0), timestep_number (0), @@ -926,51 +929,18 @@ void BoussinesqFlowProblem::setup_dofs () Table<2,DoFTools::Coupling> coupling (dim+1, dim+1); - // build the sparsity pattern. note - // that all dim velocities couple with - // each other and with the pressures, - // but that not all of the other - // components couple: - switch (dim) - { - case 2: - { - static const bool coupling_matrix[3][3] - = {{ 1, 1, 1}, - { 1, 1, 1}, - - { 1, 1, 0}}; - for (unsigned int c=0; c::setup_dofs () stokes_matrix.reinit (stokes_sparsity_pattern); } - + { Amg_preconditioner.reset (); Mp_preconditioner.reset (); @@ -994,53 +964,12 @@ void BoussinesqFlowProblem::setup_dofs () csp.collect_sizes (); Table<2,DoFTools::Coupling> coupling (dim+1, dim+1); - - // build the sparsity pattern. note - // that all dim velocities couple with - // each other and with the pressures, - // but that not all of the other - // components couple: - switch (dim) - { - case 2: - { - static const bool coupling_matrix[3][3] - = {{ 1, 0, 0}, - { 0, 1, 0}, - - { 0, 0, 1}}; - for (unsigned int c=0; c::setup_dofs () stokes_preconditioner_matrix.reinit (stokes_preconditioner_sparsity_pattern); } + temperature_partitioner = Epetra_Map (n_T, 0, trilinos_communicator); { temperature_mass_matrix.clear (); temperature_stiffness_matrix.clear (); @@ -1059,11 +989,12 @@ void BoussinesqFlowProblem::setup_dofs () temperature_constraints.condense (csp); temperature_sparsity_pattern.copy_from (csp); -//TODO: Put into the class itself - Epetra_Map map (n_T, 0, comm_serial); - temperature_matrix.reinit (map, temperature_sparsity_pattern); - temperature_mass_matrix.reinit (map, temperature_sparsity_pattern); - temperature_stiffness_matrix.reinit (map, temperature_sparsity_pattern); + temperature_matrix.reinit (temperature_partitioner, + temperature_sparsity_pattern); + temperature_mass_matrix.reinit (temperature_partitioner, + temperature_sparsity_pattern); + temperature_stiffness_matrix.reinit (temperature_partitioner, + temperature_sparsity_pattern); } @@ -1087,13 +1018,11 @@ void BoussinesqFlowProblem::setup_dofs () stokes_rhs.block(1).reinit (n_p); stokes_rhs.collect_sizes (); -//TODO: Put into the class itself - Epetra_Map map (n_T, 0, comm_serial); - temperature_solution.reinit (map); - old_temperature_solution.reinit (map); - old_old_temperature_solution.reinit (map); + temperature_solution.reinit (temperature_partitioner); + old_temperature_solution.reinit (temperature_partitioner); + old_old_temperature_solution.reinit (temperature_partitioner); - temperature_rhs.reinit (map); + temperature_rhs.reinit (temperature_partitioner); }