From: Toby D. Young Date: Mon, 6 Jul 2009 10:35:32 +0000 (+0000) Subject: Cleaned the code. Added output of the sparsity pattern. X-Git-Tag: v8.0.0~7544 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1503370499ab5d9d962f257812b3edf2131dcbc9;p=dealii.git Cleaned the code. Added output of the sparsity pattern. git-svn-id: https://svn.dealii.org/trunk@19015 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-36/doc/results.dox b/deal.II/examples/step-36/doc/results.dox index b5eaba9377..2bfa782bbd 100644 --- a/deal.II/examples/step-36/doc/results.dox +++ b/deal.II/examples/step-36/doc/results.dox @@ -1,2 +1,22 @@

Results

+

Possibilities for extensions

+ +It is always worth playing a few games in the playground! So here goes +with a few suggestions: + + \ No newline at end of file diff --git a/deal.II/examples/step-36/step-36.cc b/deal.II/examples/step-36/step-36.cc index ba24fd7c45..d4581ba5b7 100644 --- a/deal.II/examples/step-36/step-36.cc +++ b/deal.II/examples/step-36/step-36.cc @@ -35,7 +35,7 @@ #include // PETSc appears here because SLEPc - // depends on him: + // depends on this library: #include #include @@ -114,7 +114,7 @@ EigenvalueProblem::EigenvalueProblem (const std::string &prm_file) } - // @sect4{EigenvalueProblem::make_grid_and_dofs} + // @sect3{EigenvalueProblem::make_grid_and_dofs} template void EigenvalueProblem::make_grid_and_dofs () { @@ -122,19 +122,34 @@ void EigenvalueProblem::make_grid_and_dofs () triangulation.refine_global (5); dof_handler.distribute_dofs (fe); - // CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(), - // dof_handler.n_dofs()); - // DoFTools::make_sparsity_pattern (dof_handler, csp); + CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(), + dof_handler.n_dofs()); + DoFTools::make_sparsity_pattern (dof_handler, csp); + csp.compress (); + + // What is going on here? + + // This does not work! // stiffness_matrix.reinit (csp); // mass_matrix.reinit (csp); - + + // But this does... TODO: Fix it! stiffness_matrix.reinit (dof_handler.n_dofs(), dof_handler.n_dofs(), - dof_handler.max_couplings_between_dofs()); + dof_handler.max_couplings_between_dofs()); mass_matrix.reinit (dof_handler.n_dofs(), dof_handler.n_dofs(), - dof_handler.max_couplings_between_dofs()); + dof_handler.max_couplings_between_dofs()); + + // with this done we stream-out the + // sparsity pattern + std::ofstream out ("constrained_sparsity_pattern.gpl"); + csp.print_gnuplot (out); - // Set the collective eigenfunction - // block to be as big as we wanted! + // The next step is to take care of + // the eigenspectrum. In this case, + // the outputs are eigenfunctions and + // eigenvalues. Set the collective + // eigenfunction block to be as big as + // we wanted! eigenfunctions .resize (parameters.get_integer ("Number of eigenvalues/eigenfunctions")); for (unsigned int i=0; i::make_grid_and_dofs () // block eigenvalues .resize (eigenfunctions.size ()); + } - // @sect5{EigenvalueProblem::assemble_system} + // @sect3{EigenvalueProblem::assemble_system} template void EigenvalueProblem::assemble_system () { @@ -263,7 +279,7 @@ void EigenvalueProblem::assemble_system () } - // @sect6{EigenvalueProblem::solve} + // @sect3{EigenvalueProblem::solve} // Now that the system is set up, here // is a good time to actually solve // the problem: As with other examples @@ -295,7 +311,7 @@ void EigenvalueProblem::solve () } - // @sect7{EigenvalueProblem::output_results} + // @sect3{EigenvalueProblem::output_results} template void EigenvalueProblem::output_results () const { @@ -332,7 +348,7 @@ void EigenvalueProblem::output_results () const } - // @sect8{EigenvalueProblem::run} + // @sect3{EigenvalueProblem::run} // This is the function which has the // top-level control over @@ -360,7 +376,7 @@ void EigenvalueProblem::run () } - // @sect9{The main function} + // @sect3{The main function} int main (int argc, char **argv) { try