@@ -220,7 +220,9 @@ namespace aspect
220220 print_aspect_header (log_file_stream);
221221 }
222222
223- computing_timer.enter_section (" Initialization" );
223+
224+ // now that we have output set up, we can start timer sections
225+ TimerOutput::Scope timer (computing_timer, " Initialization" );
224226
225227 // first do some error checking for the parameters we got
226228 {
@@ -652,8 +654,6 @@ namespace aspect
652654 // now that all member variables have been set up, also
653655 // connect the functions that will actually do the assembly
654656 set_assemblers ();
655-
656- computing_timer.exit_section ();
657657 }
658658
659659
@@ -1258,7 +1258,7 @@ namespace aspect
12581258 {
12591259 signals.edit_parameters_pre_setup_dofs (*this , parameters);
12601260
1261- computing_timer. enter_section ( " Setup dof systems" );
1261+ TimerOutput::Scope timer (computing_timer, " Setup dof systems" );
12621262
12631263 dof_handler.distribute_dofs (finite_element);
12641264
@@ -1390,9 +1390,6 @@ namespace aspect
13901390
13911391 rebuild_stokes_matrix = true ;
13921392 rebuild_stokes_preconditioner = true ;
1393-
1394-
1395- computing_timer.exit_section ();
13961393 }
13971394
13981395
@@ -1463,7 +1460,7 @@ namespace aspect
14631460 template <int dim>
14641461 void Simulator<dim>::postprocess ()
14651462 {
1466- computing_timer. enter_section ( " Postprocessing" );
1463+ TimerOutput::Scope timer (computing_timer, " Postprocessing" );
14671464 pcout << " Postprocessing:" << std::endl;
14681465
14691466 // run all the postprocessing routines and then write
@@ -1501,108 +1498,109 @@ namespace aspect
15011498
15021499 // finally, write the entire set of current results to disk
15031500 output_statistics ();
1504-
1505- computing_timer.exit_section ();
15061501 }
15071502
15081503
15091504 template <int dim>
15101505 void Simulator<dim>::refine_mesh (const unsigned int max_grid_level)
15111506 {
1512- computing_timer.enter_section (" Refine mesh structure, part 1" );
1507+ parallel::distributed::SolutionTransfer<dim,LinearAlgebra::BlockVector>
1508+ system_trans (dof_handler);
15131509
1514- Vector< float > estimated_error_per_cell (triangulation. n_active_cells ());
1515- mesh_refinement_manager. execute (estimated_error_per_cell) ;
1510+ std_cxx11::unique_ptr<parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector> >
1511+ freesurface_trans ;
15161512
1517- if (parameters.adapt_by_fraction_of_cells )
1518- parallel::distributed::GridRefinement::
1519- refine_and_coarsen_fixed_number (triangulation,
1520- estimated_error_per_cell,
1521- parameters.refinement_fraction ,
1522- parameters.coarsening_fraction );
1523- else
1524- parallel::distributed::GridRefinement::
1525- refine_and_coarsen_fixed_fraction (triangulation,
1526- estimated_error_per_cell,
1527- parameters.refinement_fraction ,
1528- parameters.coarsening_fraction );
1513+ {
1514+ TimerOutput::Scope timer (computing_timer, " Refine mesh structure, part 1" );
15291515
1530- mesh_refinement_manager.tag_additional_cells ();
1516+ Vector<float > estimated_error_per_cell (triangulation.n_active_cells ());
1517+ mesh_refinement_manager.execute (estimated_error_per_cell);
15311518
1519+ if (parameters.adapt_by_fraction_of_cells )
1520+ parallel::distributed::GridRefinement::
1521+ refine_and_coarsen_fixed_number (triangulation,
1522+ estimated_error_per_cell,
1523+ parameters.refinement_fraction ,
1524+ parameters.coarsening_fraction );
1525+ else
1526+ parallel::distributed::GridRefinement::
1527+ refine_and_coarsen_fixed_fraction (triangulation,
1528+ estimated_error_per_cell,
1529+ parameters.refinement_fraction ,
1530+ parameters.coarsening_fraction );
15321531
1533- // clear refinement flags if parameter.refinement_fraction=0.0
1534- if (parameters.refinement_fraction ==0.0 )
1535- {
1536- for (typename Triangulation<dim>::active_cell_iterator
1537- cell = triangulation.begin_active ();
1538- cell != triangulation.end (); ++cell)
1539- cell->clear_refine_flag ();
1540- }
1541- else
1542- {
1543- // limit maximum refinement level
1544- if (triangulation.n_levels () > max_grid_level)
1532+ mesh_refinement_manager.tag_additional_cells ();
1533+
1534+
1535+ // clear refinement flags if parameter.refinement_fraction=0.0
1536+ if (parameters.refinement_fraction ==0.0 )
1537+ {
15451538 for (typename Triangulation<dim>::active_cell_iterator
1546- cell = triangulation.begin_active (max_grid_level );
1539+ cell = triangulation.begin_active ();
15471540 cell != triangulation.end (); ++cell)
15481541 cell->clear_refine_flag ();
1549- }
1550-
1551- // clear coarsening flags if parameter.coarsening_fraction=0.0
1552- if (parameters.coarsening_fraction ==0.0 )
1553- {
1554- for (typename Triangulation<dim>::active_cell_iterator
1555- cell = triangulation.begin_active ();
1556- cell != triangulation.end (); ++cell)
1557- cell->clear_coarsen_flag ();
1558- }
1559- else
1560- {
1561- // limit minimum refinement level
1562- for (typename Triangulation<dim>::active_cell_iterator
1563- cell = triangulation.begin_active (0 );
1564- cell != triangulation.end_active (parameters.min_grid_level ); ++cell)
1565- cell->clear_coarsen_flag ();
1566- }
1542+ }
1543+ else
1544+ {
1545+ // limit maximum refinement level
1546+ if (triangulation.n_levels () > max_grid_level)
1547+ for (typename Triangulation<dim>::active_cell_iterator
1548+ cell = triangulation.begin_active (max_grid_level);
1549+ cell != triangulation.end (); ++cell)
1550+ cell->clear_refine_flag ();
1551+ }
15671552
1568- std::vector<const LinearAlgebra::BlockVector *> x_system (2 );
1569- x_system[0 ] = &solution;
1570- x_system[1 ] = &old_solution;
1553+ // clear coarsening flags if parameter.coarsening_fraction=0.0
1554+ if (parameters.coarsening_fraction ==0.0 )
1555+ {
1556+ for (typename Triangulation<dim>::active_cell_iterator
1557+ cell = triangulation.begin_active ();
1558+ cell != triangulation.end (); ++cell)
1559+ cell->clear_coarsen_flag ();
1560+ }
1561+ else
1562+ {
1563+ // limit minimum refinement level
1564+ for (typename Triangulation<dim>::active_cell_iterator
1565+ cell = triangulation.begin_active (0 );
1566+ cell != triangulation.end_active (parameters.min_grid_level ); ++cell)
1567+ cell->clear_coarsen_flag ();
1568+ }
15711569
1572- if (parameters.free_surface_enabled )
1573- x_system.push_back ( &free_surface->mesh_velocity );
1570+ std::vector<const LinearAlgebra::BlockVector *> x_system (2 );
1571+ x_system[0 ] = &solution;
1572+ x_system[1 ] = &old_solution;
15741573
1575- parallel::distributed::SolutionTransfer<dim,LinearAlgebra::BlockVector>
1576- system_trans (dof_handler );
1574+ if (parameters. free_surface_enabled )
1575+ x_system. push_back ( &free_surface-> mesh_velocity );
15771576
1578- std::vector<const LinearAlgebra::Vector *> x_fs_system (1 );
1579- std_cxx11::unique_ptr<parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector> >
1580- freesurface_trans;
1577+ std::vector<const LinearAlgebra::Vector *> x_fs_system (1 );
15811578
1582- if (parameters.free_surface_enabled )
1583- {
1584- x_fs_system[0 ] = &free_surface->mesh_displacements ;
1585- freesurface_trans.reset (new parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector>
1586- (free_surface->free_surface_dof_handler ));
1587- }
1579+ if (parameters.free_surface_enabled )
1580+ {
1581+ x_fs_system[0 ] = &free_surface->mesh_displacements ;
1582+ freesurface_trans.reset (new parallel::distributed::SolutionTransfer<dim,LinearAlgebra::Vector>
1583+ (free_surface->free_surface_dof_handler ));
1584+ }
15881585
15891586
1590- // Possibly store data of plugins associated with cells
1591- signals.pre_refinement_store_user_data (triangulation);
1587+ // Possibly store data of plugins associated with cells
1588+ signals.pre_refinement_store_user_data (triangulation);
15921589
1593- triangulation.prepare_coarsening_and_refinement ();
1594- system_trans.prepare_for_coarsening_and_refinement (x_system);
1590+ triangulation.prepare_coarsening_and_refinement ();
1591+ system_trans.prepare_for_coarsening_and_refinement (x_system);
15951592
1596- if (parameters.free_surface_enabled )
1597- freesurface_trans->prepare_for_coarsening_and_refinement (x_fs_system);
1593+ if (parameters.free_surface_enabled )
1594+ freesurface_trans->prepare_for_coarsening_and_refinement (x_fs_system);
15981595
1599- triangulation.execute_coarsening_and_refinement ();
1600- computing_timer. exit_section ();
1596+ triangulation.execute_coarsening_and_refinement ();
1597+ } // leave the timed section
16011598
16021599 setup_dofs ();
16031600
1604- computing_timer.enter_section (" Refine mesh structure, part 2" );
16051601 {
1602+ TimerOutput::Scope timer (computing_timer, " Refine mesh structure, part 2" );
1603+
16061604 LinearAlgebra::BlockVector distributed_system;
16071605 LinearAlgebra::BlockVector old_distributed_system;
16081606 LinearAlgebra::BlockVector distributed_mesh_velocity;
@@ -1662,11 +1660,10 @@ namespace aspect
16621660
16631661 // Possibly load data of plugins associated with cells
16641662 signals.post_refinement_load_user_data (triangulation);
1665- }
1666- computing_timer.exit_section ();
16671663
1668- // calculate global volume after displacing mesh (if we have, in fact, displaced it)
1669- global_volume = GridTools::volume (triangulation, *mapping);
1664+ // calculate global volume after displacing mesh (if we have, in fact, displaced it)
1665+ global_volume = GridTools::volume (triangulation, *mapping);
1666+ }
16701667 }
16711668
16721669
@@ -1814,7 +1811,7 @@ namespace aspect
18141811
18151812 if (parameters.resume_computation == false )
18161813 {
1817- computing_timer. enter_section ( " Setup initial conditions" );
1814+ TimerOutput::Scope timer (computing_timer, " Setup initial conditions" );
18181815
18191816 // Add topography to box models after all initial refinement
18201817 // is completed.
@@ -1825,8 +1822,6 @@ namespace aspect
18251822 compute_initial_pressure_field ();
18261823
18271824 signals.post_set_initial_state (*this );
1828-
1829- computing_timer.exit_section ();
18301825 }
18311826
18321827 // start the principal loop over time steps:
0 commit comments