From e87bcde6070dd94c683c93eaacb8bb47c8dc6cbe Mon Sep 17 00:00:00 2001 From: bangerth Date: Sat, 31 Mar 2012 08:37:04 +0000 Subject: [PATCH] Convert tabs into spaces so that editors with different notions how many spaces a tab corresponds to still all show our carefully indented code correctly. git-svn-id: https://svn.dealii.org/trunk@25345 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/algorithms/newton.h | 208 +- .../deal.II/algorithms/newton.templates.h | 120 +- deal.II/include/deal.II/algorithms/operator.h | 64 +- .../deal.II/algorithms/operator.templates.h | 18 +- .../deal.II/algorithms/theta_timestepping.h | 280 +- .../algorithms/theta_timestepping.templates.h | 60 +- .../deal.II/algorithms/timestep_control.h | 246 +- .../deal.II/base/auto_derivative_function.h | 340 +- .../deal.II/base/conditional_ostream.h | 112 +- .../include/deal.II/base/convergence_table.h | 348 +- deal.II/include/deal.II/base/data_out_base.h | 3680 ++++---- .../include/deal.II/base/derivative_form.h | 150 +- deal.II/include/deal.II/base/event.h | 218 +- deal.II/include/deal.II/base/exceptions.h | 1020 +- deal.II/include/deal.II/base/flow_function.h | 256 +- deal.II/include/deal.II/base/function.h | 890 +- .../include/deal.II/base/function_bessel.h | 16 +- .../deal.II/base/function_derivative.h | 202 +- deal.II/include/deal.II/base/function_lib.h | 1348 +-- .../include/deal.II/base/function_parser.h | 210 +- deal.II/include/deal.II/base/function_time.h | 48 +- deal.II/include/deal.II/base/geometry_info.h | 2484 ++--- deal.II/include/deal.II/base/index_set.h | 1038 +-- deal.II/include/deal.II/base/job_identifier.h | 90 +- deal.II/include/deal.II/base/logstream.h | 912 +- .../include/deal.II/base/memory_consumption.h | 500 +- .../include/deal.II/base/mg_level_object.h | 160 +- deal.II/include/deal.II/base/mpi.h | 476 +- .../include/deal.II/base/multithread_info.h | 130 +- deal.II/include/deal.II/base/named_data.h | 302 +- deal.II/include/deal.II/base/numbers.h | 372 +- deal.II/include/deal.II/base/parallel.h | 1112 +-- .../include/deal.II/base/parameter_handler.h | 2416 ++--- .../include/deal.II/base/parsed_function.h | 366 +- deal.II/include/deal.II/base/partitioner.h | 520 +- deal.II/include/deal.II/base/path_search.h | 380 +- deal.II/include/deal.II/base/point.h | 202 +- deal.II/include/deal.II/base/polynomial.h | 150 +- .../include/deal.II/base/polynomial_space.h | 314 +- .../include/deal.II/base/polynomials_abf.h | 178 +- .../include/deal.II/base/polynomials_adini.h | 26 +- .../include/deal.II/base/polynomials_bdm.h | 178 +- .../deal.II/base/polynomials_nedelec.h | 172 +- deal.II/include/deal.II/base/polynomials_p.h | 88 +- .../deal.II/base/polynomials_raviart_thomas.h | 158 +- deal.II/include/deal.II/base/qprojector.h | 370 +- deal.II/include/deal.II/base/quadrature.h | 348 +- deal.II/include/deal.II/base/quadrature_lib.h | 192 +- .../deal.II/base/quadrature_selector.h | 102 +- deal.II/include/deal.II/base/smartpointer.h | 324 +- deal.II/include/deal.II/base/subscriptor.h | 332 +- .../include/deal.II/base/symmetric_tensor.h | 1596 ++-- .../deal.II/base/synchronous_iterator.h | 154 +- deal.II/include/deal.II/base/table.h | 308 +- deal.II/include/deal.II/base/table_handler.h | 198 +- deal.II/include/deal.II/base/table_indices.h | 190 +- .../deal.II/base/template_constraints.h | 16 +- deal.II/include/deal.II/base/tensor.h | 876 +- deal.II/include/deal.II/base/tensor_base.h | 860 +- .../include/deal.II/base/tensor_function.h | 188 +- .../deal.II/base/tensor_product_polynomials.h | 626 +- .../deal.II/base/thread_local_storage.h | 42 +- .../include/deal.II/base/thread_management.h | 4878 +++++----- deal.II/include/deal.II/base/timer.h | 566 +- deal.II/include/deal.II/base/types.h | 88 +- deal.II/include/deal.II/base/utilities.h | 900 +- deal.II/include/deal.II/base/vector_slice.h | 134 +- deal.II/include/deal.II/base/work_stream.h | 842 +- .../deal.II/distributed/grid_refinement.h | 160 +- .../deal.II/distributed/solution_transfer.h | 312 +- deal.II/include/deal.II/distributed/tria.h | 1460 +-- deal.II/include/deal.II/dofs/block_info.h | 222 +- deal.II/include/deal.II/dofs/dof_accessor.h | 3066 +++--- .../deal.II/dofs/dof_accessor.templates.h | 4828 +++++----- .../include/deal.II/dofs/dof_constraints.h | 2 +- deal.II/include/deal.II/dofs/dof_faces.h | 122 +- deal.II/include/deal.II/dofs/dof_handler.h | 1908 ++-- .../include/deal.II/dofs/dof_handler_policy.h | 170 +- .../deal.II/dofs/dof_iterator_selector.h | 14 +- deal.II/include/deal.II/dofs/dof_levels.h | 142 +- deal.II/include/deal.II/dofs/dof_objects.h | 82 +- .../include/deal.II/dofs/dof_renumbering.h | 1410 +-- deal.II/include/deal.II/dofs/dof_tools.h | 4010 ++++---- deal.II/include/deal.II/dofs/function_map.h | 20 +- deal.II/include/deal.II/dofs/number_cache.h | 158 +- deal.II/include/deal.II/fe/fe.h | 3658 ++++---- deal.II/include/deal.II/fe/fe_abf.h | 426 +- deal.II/include/deal.II/fe/fe_base.h | 1150 +-- deal.II/include/deal.II/fe/fe_bdm.h | 106 +- deal.II/include/deal.II/fe/fe_dg_vector.h | 228 +- .../deal.II/fe/fe_dg_vector.templates.h | 30 +- deal.II/include/deal.II/fe/fe_dgp.h | 442 +- deal.II/include/deal.II/fe/fe_dgp_monomial.h | 444 +- .../include/deal.II/fe/fe_dgp_nonparametric.h | 904 +- deal.II/include/deal.II/fe/fe_dgq.h | 582 +- deal.II/include/deal.II/fe/fe_face.h | 76 +- deal.II/include/deal.II/fe/fe_nedelec.h | 368 +- deal.II/include/deal.II/fe/fe_nothing.h | 94 +- deal.II/include/deal.II/fe/fe_poly.h | 510 +- .../include/deal.II/fe/fe_poly.templates.h | 268 +- deal.II/include/deal.II/fe/fe_poly_face.h | 494 +- .../deal.II/fe/fe_poly_face.templates.h | 110 +- deal.II/include/deal.II/fe/fe_poly_tensor.h | 356 +- deal.II/include/deal.II/fe/fe_q.h | 572 +- .../include/deal.II/fe/fe_q_hierarchical.h | 548 +- .../include/deal.II/fe/fe_raviart_thomas.h | 404 +- deal.II/include/deal.II/fe/fe_system.h | 1776 ++-- deal.II/include/deal.II/fe/fe_tools.h | 2484 ++--- deal.II/include/deal.II/fe/fe_update_flags.h | 326 +- deal.II/include/deal.II/fe/fe_values.h | 6530 ++++++------- deal.II/include/deal.II/fe/mapping.h | 724 +- deal.II/include/deal.II/fe/mapping_c1.h | 116 +- .../include/deal.II/fe/mapping_cartesian.h | 198 +- deal.II/include/deal.II/fe/mapping_q.h | 772 +- deal.II/include/deal.II/fe/mapping_q1.h | 1072 +-- .../include/deal.II/fe/mapping_q1_eulerian.h | 128 +- .../include/deal.II/fe/mapping_q_eulerian.h | 96 +- .../include/deal.II/grid/filtered_iterator.h | 838 +- deal.II/include/deal.II/grid/geometry_info.h | 2 +- deal.II/include/deal.II/grid/grid_generator.h | 1590 ++-- deal.II/include/deal.II/grid/grid_in.h | 502 +- deal.II/include/deal.II/grid/grid_out.h | 2468 ++--- .../include/deal.II/grid/grid_refinement.h | 80 +- .../include/deal.II/grid/grid_reordering.h | 90 +- .../deal.II/grid/grid_reordering_internal.h | 704 +- deal.II/include/deal.II/grid/grid_tools.h | 1766 ++-- deal.II/include/deal.II/grid/intergrid_map.h | 174 +- deal.II/include/deal.II/grid/magic_numbers.h | 2 +- .../include/deal.II/grid/persistent_tria.h | 320 +- deal.II/include/deal.II/grid/tria.h | 3776 ++++---- deal.II/include/deal.II/grid/tria_accessor.h | 4168 ++++----- .../deal.II/grid/tria_accessor.templates.h | 2064 ++-- deal.II/include/deal.II/grid/tria_boundary.h | 910 +- .../include/deal.II/grid/tria_boundary_lib.h | 942 +- deal.II/include/deal.II/grid/tria_faces.h | 116 +- deal.II/include/deal.II/grid/tria_iterator.h | 1220 +-- .../deal.II/grid/tria_iterator.templates.h | 292 +- .../include/deal.II/grid/tria_iterator_base.h | 16 +- .../deal.II/grid/tria_iterator_selector.h | 40 +- deal.II/include/deal.II/grid/tria_levels.h | 120 +- deal.II/include/deal.II/grid/tria_object.h | 158 +- deal.II/include/deal.II/grid/tria_objects.h | 1038 +-- deal.II/include/deal.II/hp/dof_faces.h | 32 +- deal.II/include/deal.II/hp/dof_handler.h | 1276 +-- deal.II/include/deal.II/hp/dof_levels.h | 60 +- deal.II/include/deal.II/hp/dof_objects.h | 78 +- deal.II/include/deal.II/hp/fe_collection.h | 116 +- deal.II/include/deal.II/hp/fe_values.h | 120 +- .../include/deal.II/hp/mapping_collection.h | 18 +- deal.II/include/deal.II/hp/q_collection.h | 28 +- .../include/deal.II/integrators/divergence.h | 238 +- .../include/deal.II/integrators/elasticity.h | 2 +- deal.II/include/deal.II/integrators/l2.h | 80 +- deal.II/include/deal.II/integrators/laplace.h | 242 +- .../deal.II/integrators/local_integrators.h | 2 +- deal.II/include/deal.II/integrators/maxwell.h | 528 +- deal.II/include/deal.II/integrators/patches.h | 16 +- deal.II/include/deal.II/lac/arpack_solver.h | 200 +- deal.II/include/deal.II/lac/block_indices.h | 384 +- deal.II/include/deal.II/lac/block_list.h | 616 +- deal.II/include/deal.II/lac/block_matrix.h | 16 +- .../include/deal.II/lac/block_matrix_array.h | 828 +- .../include/deal.II/lac/block_matrix_base.h | 2482 ++--- .../include/deal.II/lac/block_sparse_matrix.h | 548 +- .../lac/block_sparse_matrix.templates.h | 36 +- .../deal.II/lac/block_sparse_matrix_ez.h | 534 +- .../lac/block_sparse_matrix_ez.templates.h | 76 +- .../deal.II/lac/block_sparsity_pattern.h | 1522 +-- deal.II/include/deal.II/lac/block_vector.h | 610 +- .../deal.II/lac/block_vector.templates.h | 34 +- .../include/deal.II/lac/block_vector_base.h | 620 +- .../include/deal.II/lac/chunk_sparse_matrix.h | 1974 ++-- .../lac/chunk_sparse_matrix.templates.h | 1268 +-- .../deal.II/lac/chunk_sparsity_pattern.h | 1456 +-- .../lac/compressed_set_sparsity_pattern.h | 452 +- .../lac/compressed_simple_sparsity_pattern.h | 508 +- .../deal.II/lac/compressed_sparsity_pattern.h | 450 +- .../include/deal.II/lac/constraint_matrix.h | 2522 ++--- .../deal.II/lac/constraint_matrix.templates.h | 3064 +++--- deal.II/include/deal.II/lac/eigen.h | 344 +- deal.II/include/deal.II/lac/exceptions.h | 78 +- deal.II/include/deal.II/lac/filtered_matrix.h | 756 +- deal.II/include/deal.II/lac/full_matrix.h | 2026 ++-- .../deal.II/lac/full_matrix.templates.h | 1324 +-- deal.II/include/deal.II/lac/householder.h | 180 +- deal.II/include/deal.II/lac/identity_matrix.h | 170 +- .../include/deal.II/lac/iterative_inverse.h | 76 +- .../include/deal.II/lac/lapack_full_matrix.h | 1010 +- deal.II/include/deal.II/lac/lapack_support.h | 190 +- deal.II/include/deal.II/lac/matrix_block.h | 842 +- deal.II/include/deal.II/lac/matrix_iterator.h | 184 +- deal.II/include/deal.II/lac/matrix_lib.h | 590 +- .../deal.II/lac/matrix_lib.templates.h | 58 +- deal.II/include/deal.II/lac/matrix_out.h | 550 +- .../deal.II/lac/parallel_block_vector.h | 444 +- deal.II/include/deal.II/lac/parallel_vector.h | 2274 ++--- .../deal.II/lac/parallel_vector.templates.h | 568 +- .../deal.II/lac/petsc_block_sparse_matrix.h | 12 +- .../include/deal.II/lac/petsc_block_vector.h | 82 +- .../include/deal.II/lac/petsc_full_matrix.h | 4 +- .../include/deal.II/lac/petsc_matrix_base.h | 942 +- .../lac/petsc_parallel_block_sparse_matrix.h | 6 +- .../deal.II/lac/petsc_parallel_block_vector.h | 148 +- .../lac/petsc_parallel_sparse_matrix.h | 40 +- .../deal.II/lac/petsc_parallel_vector.h | 186 +- .../include/deal.II/lac/petsc_precondition.h | 522 +- deal.II/include/deal.II/lac/petsc_solver.h | 44 +- .../include/deal.II/lac/petsc_sparse_matrix.h | 16 +- deal.II/include/deal.II/lac/petsc_vector.h | 70 +- .../include/deal.II/lac/petsc_vector_base.h | 304 +- deal.II/include/deal.II/lac/pointer_matrix.h | 646 +- deal.II/include/deal.II/lac/precondition.h | 1180 +-- .../include/deal.II/lac/precondition_block.h | 1152 +-- .../lac/precondition_block.templates.h | 1002 +- .../deal.II/lac/precondition_block_base.h | 648 +- .../deal.II/lac/precondition_selector.h | 138 +- .../include/deal.II/lac/relaxation_block.h | 622 +- .../deal.II/lac/relaxation_block.templates.h | 190 +- deal.II/include/deal.II/lac/schur_matrix.h | 46 +- deal.II/include/deal.II/lac/shifted_matrix.h | 142 +- deal.II/include/deal.II/lac/slepc_solver.h | 178 +- .../lac/slepc_spectral_transformation.h | 38 +- deal.II/include/deal.II/lac/solver.h | 124 +- deal.II/include/deal.II/lac/solver_bicgstab.h | 366 +- deal.II/include/deal.II/lac/solver_cg.h | 372 +- deal.II/include/deal.II/lac/solver_control.h | 706 +- deal.II/include/deal.II/lac/solver_gmres.h | 1018 +- deal.II/include/deal.II/lac/solver_minres.h | 308 +- deal.II/include/deal.II/lac/solver_qmrs.h | 348 +- .../include/deal.II/lac/solver_relaxation.h | 106 +- .../include/deal.II/lac/solver_richardson.h | 358 +- deal.II/include/deal.II/lac/solver_selector.h | 268 +- .../deal.II/lac/sparse_decomposition.h | 412 +- .../lac/sparse_decomposition.templates.h | 106 +- deal.II/include/deal.II/lac/sparse_direct.h | 1134 +-- deal.II/include/deal.II/lac/sparse_ilu.h | 202 +- .../deal.II/lac/sparse_ilu.templates.h | 288 +- deal.II/include/deal.II/lac/sparse_matrix.h | 3260 +++---- .../deal.II/lac/sparse_matrix.templates.h | 1448 +-- .../include/deal.II/lac/sparse_matrix_ez.h | 1684 ++-- .../deal.II/lac/sparse_matrix_ez.templates.h | 160 +- deal.II/include/deal.II/lac/sparse_mic.h | 116 +- .../deal.II/lac/sparse_mic.templates.h | 54 +- deal.II/include/deal.II/lac/sparse_vanka.h | 472 +- .../deal.II/lac/sparse_vanka.templates.h | 664 +- .../include/deal.II/lac/sparsity_pattern.h | 2584 ++--- deal.II/include/deal.II/lac/sparsity_tools.h | 412 +- .../include/deal.II/lac/swappable_vector.h | 404 +- .../deal.II/lac/swappable_vector.templates.h | 168 +- .../include/deal.II/lac/transpose_matrix.h | 148 +- .../include/deal.II/lac/tridiagonal_matrix.h | 534 +- .../lac/trilinos_block_sparse_matrix.h | 258 +- .../deal.II/lac/trilinos_block_vector.h | 676 +- .../deal.II/lac/trilinos_precondition.h | 1428 +-- deal.II/include/deal.II/lac/trilinos_solver.h | 282 +- .../deal.II/lac/trilinos_sparse_matrix.h | 2918 +++--- .../deal.II/lac/trilinos_sparsity_pattern.h | 1258 +-- deal.II/include/deal.II/lac/trilinos_vector.h | 714 +- .../deal.II/lac/trilinos_vector_base.h | 998 +- deal.II/include/deal.II/lac/vector.h | 1246 +-- .../include/deal.II/lac/vector.templates.h | 520 +- deal.II/include/deal.II/lac/vector_memory.h | 444 +- deal.II/include/deal.II/lac/vector_view.h | 248 +- .../include/deal.II/meshworker/assembler.h | 1216 +-- deal.II/include/deal.II/meshworker/dof_info.h | 354 +- .../deal.II/meshworker/dof_info.templates.h | 42 +- .../include/deal.II/meshworker/functional.h | 350 +- .../deal.II/meshworker/integration_info.h | 1250 +-- .../meshworker/integration_info.templates.h | 154 +- .../deal.II/meshworker/local_results.h | 556 +- deal.II/include/deal.II/meshworker/loop.h | 76 +- deal.II/include/deal.II/meshworker/output.h | 246 +- deal.II/include/deal.II/meshworker/simple.h | 1562 ++-- .../deal.II/meshworker/vector_selector.h | 690 +- .../meshworker/vector_selector.templates.h | 178 +- deal.II/include/deal.II/multigrid/mg_base.h | 206 +- .../deal.II/multigrid/mg_block_smoother.h | 228 +- deal.II/include/deal.II/multigrid/mg_coarse.h | 176 +- .../deal.II/multigrid/mg_constrained_dofs.h | 208 +- .../deal.II/multigrid/mg_dof_accessor.h | 960 +- .../deal.II/multigrid/mg_dof_handler.h | 1532 +-- .../multigrid/mg_dof_iterator_selector.h | 16 +- deal.II/include/deal.II/multigrid/mg_matrix.h | 256 +- .../include/deal.II/multigrid/mg_smoother.h | 916 +- deal.II/include/deal.II/multigrid/mg_tools.h | 376 +- .../include/deal.II/multigrid/mg_transfer.h | 280 +- .../deal.II/multigrid/mg_transfer.templates.h | 118 +- .../deal.II/multigrid/mg_transfer_block.h | 642 +- .../multigrid/mg_transfer_block.templates.h | 22 +- .../deal.II/multigrid/mg_transfer_component.h | 502 +- .../mg_transfer_component.templates.h | 24 +- deal.II/include/deal.II/multigrid/multigrid.h | 910 +- .../deal.II/multigrid/multigrid.templates.h | 252 +- .../numerics/data_component_interpretation.h | 84 +- deal.II/include/deal.II/numerics/data_out.h | 1480 +-- .../include/deal.II/numerics/data_out_faces.h | 366 +- .../deal.II/numerics/data_out_rotation.h | 220 +- .../include/deal.II/numerics/data_out_stack.h | 562 +- .../deal.II/numerics/data_postprocessor.h | 422 +- .../numerics/derivative_approximation.h | 872 +- .../deal.II/numerics/dof_output_operator.h | 6 +- .../numerics/dof_output_operator.templates.h | 4 +- .../deal.II/numerics/dof_print_solver_step.h | 82 +- .../deal.II/numerics/error_estimator.h | 894 +- .../deal.II/numerics/fe_field_function.h | 462 +- .../numerics/fe_field_function.templates.h | 402 +- deal.II/include/deal.II/numerics/histogram.h | 320 +- deal.II/include/deal.II/numerics/matrices.h | 1110 +-- .../include/deal.II/numerics/mesh_worker.h | 2 +- .../deal.II/numerics/mesh_worker_assembler.h | 2 +- .../deal.II/numerics/mesh_worker_info.h | 2 +- .../deal.II/numerics/mesh_worker_loop.h | 2 +- .../deal.II/numerics/mesh_worker_output.h | 2 +- .../numerics/mesh_worker_vector_selector.h | 2 +- deal.II/include/deal.II/numerics/newton.h | 2 +- deal.II/include/deal.II/numerics/operator.h | 2 +- .../deal.II/numerics/point_value_history.h | 716 +- .../deal.II/numerics/solution_transfer.h | 422 +- .../deal.II/numerics/theta_timestepping.h | 2 +- .../include/deal.II/numerics/time_dependent.h | 2418 ++--- .../deal.II/numerics/timestep_control.h | 2 +- deal.II/include/deal.II/numerics/vectors.h | 3226 +++---- .../deal.II/numerics/vectors.templates.h | 8304 ++++++++--------- 323 files changed, 106562 insertions(+), 106562 deletions(-) diff --git a/deal.II/include/deal.II/algorithms/newton.h b/deal.II/include/deal.II/algorithms/newton.h index bdb76903bd..7bd649cad1 100644 --- a/deal.II/include/deal.II/algorithms/newton.h +++ b/deal.II/include/deal.II/algorithms/newton.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -64,136 +64,136 @@ namespace Algorithms class Newton : public Operator { public: - /** - * Constructor, receiving the - * applications computing the - * residual and solving the - * linear problem, respectively. - */ + /** + * Constructor, receiving the + * applications computing the + * residual and solving the + * linear problem, respectively. + */ Newton (Operator& residual, Operator& inverse_derivative); - - /** - * Declare the parameters - * applicable to Newton's method. - */ + + /** + * Declare the parameters + * applicable to Newton's method. + */ void declare_parameters (ParameterHandler& param); - - /** - * Read the parameters. - */ + + /** + * Read the parameters. + */ void initialize (ParameterHandler& param); - /** - * Initialize the pointer + /** + * Initialize the pointer * data_out for debugging. - */ + */ void initialize (OutputOperator& output); - - /** - * The actual Newton - * iteration. The initial value - * is in out(0), which - * also contains the result - * after convergence. Values in - * in are not used by - * Newton, but will be handed - * down to the objects - * #residual and #inverse_derivative. - */ + + /** + * The actual Newton + * iteration. The initial value + * is in out(0), which + * also contains the result + * after convergence. Values in + * in are not used by + * Newton, but will be handed + * down to the objects + * #residual and #inverse_derivative. + */ virtual void operator() (NamedData& out, const NamedData& in); - + virtual void notify(const Event&); - /** - * Set the maximal residual - * reduction allowed without - * triggering assembling in the - * next step. Return the - * previous value. - */ + /** + * Set the maximal residual + * reduction allowed without + * triggering assembling in the + * next step. Return the + * previous value. + */ double threshold(double new_value); - /** - * Control object for the - * Newton iteration. - */ + /** + * Control object for the + * Newton iteration. + */ ReductionControl control; private: - /** - * The operator computing the residual. - */ + /** + * The operator computing the residual. + */ SmartPointer, Newton > residual; - /** - * The operator applying the - * inverse derivative to the residual. - */ + /** + * The operator applying the + * inverse derivative to the residual. + */ SmartPointer, Newton > inverse_derivative; - /** - * The operator handling the output + /** + * The operator handling the output * in case the debug_vectors is true. * Call the initialize function first. - */ + */ SmartPointer, Newton > data_out; - - /** - * This flag is set by the - * function assemble(), - * indicating that the matrix - * must be assembled anew upon - * start. - */ + + /** + * This flag is set by the + * function assemble(), + * indicating that the matrix + * must be assembled anew upon + * start. + */ bool assemble_now; - /** - * A flag used to decide how - * many stepsize iteration - * should be made. Default is - * the original value of 21. - * - * Enter zero here to turn of - * stepsize control. - * - * @note Controlled by - * Stepsize iterations in - * parameter file - */ + /** + * A flag used to decide how + * many stepsize iteration + * should be made. Default is + * the original value of 21. + * + * Enter zero here to turn of + * stepsize control. + * + * @note Controlled by + * Stepsize iterations in + * parameter file + */ unsigned int n_stepsize_iterations; - - /** - * Threshold for re-assembling matrix. - * - * If the quotient of two - * consecutive residuals is - * smaller than this threshold, - * the system matrix is not - * assembled in this step. - * - * @note This parameter should be - * adjusted to the residual gain - * of the inner solver. - * - * The default values is zero, - * resulting in reassembling in - * every Newton step. - */ + + /** + * Threshold for re-assembling matrix. + * + * If the quotient of two + * consecutive residuals is + * smaller than this threshold, + * the system matrix is not + * assembled in this step. + * + * @note This parameter should be + * adjusted to the residual gain + * of the inner solver. + * + * The default values is zero, + * resulting in reassembling in + * every Newton step. + */ double assemble_threshold; public: - /** - * Print residual, update and - * updated solution after each - * step into file - * Newton_NNN? - */ + /** + * Print residual, update and + * updated solution after each + * step into file + * Newton_NNN? + */ bool debug_vectors; - /** - * Write debug output to - * #deallog; the higher the - * number, the more output. - */ - unsigned int debug; + /** + * Write debug output to + * #deallog; the higher the + * number, the more output. + */ + unsigned int debug; }; } diff --git a/deal.II/include/deal.II/algorithms/newton.templates.h b/deal.II/include/deal.II/algorithms/newton.templates.h index bbcba5826c..710fcf0b67 100644 --- a/deal.II/include/deal.II/algorithms/newton.templates.h +++ b/deal.II/include/deal.II/algorithms/newton.templates.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010 by Guido Kanschat +// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Guido Kanschat // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -25,13 +25,13 @@ namespace Algorithms { template Newton::Newton(Operator& residual, Operator& inverse_derivative) - : - residual(&residual), inverse_derivative(&inverse_derivative), - assemble_now(false), - n_stepsize_iterations(21), - assemble_threshold(0.), - debug_vectors(false), - debug(0) + : + residual(&residual), inverse_derivative(&inverse_derivative), + assemble_now(false), + n_stepsize_iterations(21), + assemble_threshold(0.), + debug_vectors(false), + debug(0) {} @@ -64,7 +64,7 @@ namespace Algorithms void Newton::initialize (OutputOperator& output) { - data_out = &output; + data_out = &output; } template @@ -108,70 +108,70 @@ namespace Algorithms out2.add(p, "Update"); unsigned int step = 0; - // fill res with (f(u), v) + // fill res with (f(u), v) (*residual)(out1, src1); double resnorm = res->l2_norm(); double old_residual = resnorm / assemble_threshold + 1; while (control.check(step++, resnorm) == SolverControl::iterate) { - // assemble (Df(u), v) - if (resnorm/old_residual >= assemble_threshold) - inverse_derivative->notify (Events::bad_derivative); - - Du->reinit(u); - try - { - (*inverse_derivative)(out2, src2); - } - catch (SolverControl::NoConvergence& e) - { - deallog << "Inner iteration failed after " - << e.last_step << " steps with residual " - << e.last_residual << std::endl; - } - - if (debug_vectors) - { - NamedData out; + // assemble (Df(u), v) + if (resnorm/old_residual >= assemble_threshold) + inverse_derivative->notify (Events::bad_derivative); + + Du->reinit(u); + try + { + (*inverse_derivative)(out2, src2); + } + catch (SolverControl::NoConvergence& e) + { + deallog << "Inner iteration failed after " + << e.last_step << " steps with residual " + << e.last_residual << std::endl; + } + + if (debug_vectors) + { + NamedData out; VECTOR* p = &u; out.add(p, "solution"); - p = Du; out.add(p, "update"); - p = res; out.add(p, "residual"); + p = Du; out.add(p, "update"); + p = res; out.add(p, "residual"); *data_out << step; - *data_out << out; - } - - u.add(-1., *Du); - old_residual = resnorm; - (*residual)(out1, src1); - resnorm = res->l2_norm(); - - // Step size control - unsigned int step_size = 0; - while (resnorm >= old_residual) - { - ++step_size; - if (step_size > n_stepsize_iterations) - { - deallog << "No smaller stepsize allowed!"; - break; - } - if (control.log_history()) - deallog << "Trying step size: 1/" << (1<l2_norm(); - } + *data_out << out; + } + + u.add(-1., *Du); + old_residual = resnorm; + (*residual)(out1, src1); + resnorm = res->l2_norm(); + + // Step size control + unsigned int step_size = 0; + while (resnorm >= old_residual) + { + ++step_size; + if (step_size > n_stepsize_iterations) + { + deallog << "No smaller stepsize allowed!"; + break; + } + if (control.log_history()) + deallog << "Trying step size: 1/" << (1<l2_norm(); + } } deallog.pop(); - // in case of failure: throw - // exception + // in case of failure: throw + // exception if (control.last_check() != SolverControl::success) throw SolverControl::NoConvergence (control.last_step(), - control.last_value()); - // otherwise exit as normal + control.last_value()); + // otherwise exit as normal } } diff --git a/deal.II/include/deal.II/algorithms/operator.h b/deal.II/include/deal.II/algorithms/operator.h index 5ccbea1142..0a58d365f8 100644 --- a/deal.II/include/deal.II/algorithms/operator.h +++ b/deal.II/include/deal.II/algorithms/operator.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -55,35 +55,35 @@ namespace Algorithms class Operator : public Subscriptor { public: - /** - * The virtual destructor. - */ + /** + * The virtual destructor. + */ ~Operator(); - /** - * The actual operation, which - * is implemented in a derived class. - */ + /** + * The actual operation, which + * is implemented in a derived class. + */ virtual void operator() (NamedData& out, const NamedData& in) = 0; - /** - * Register an event triggered - * by an outer iteration. - */ + /** + * Register an event triggered + * by an outer iteration. + */ virtual void notify(const Event&); - /** - * Clear all #notifications. - */ + /** + * Clear all #notifications. + */ void clear_events(); protected: - /** - * Accumulate reasons for - * reassembling here. If any of - * those is set, the function - * solve() of a terminal - * application must take care - * of reassembling the matrix. - */ + /** + * Accumulate reasons for + * reassembling here. If any of + * those is set, the function + * solve() of a terminal + * application must take care + * of reassembling the matrix. + */ Event notifications; }; @@ -99,9 +99,9 @@ namespace Algorithms OutputOperator(const OutputOperator&); public: OutputOperator (); - /** - * Empty virtual destructor. - */ + /** + * Empty virtual destructor. + */ virtual ~OutputOperator(); /** * Set the stream #os to @@ -111,14 +111,14 @@ namespace Algorithms * to #deallog. */ void initialize_stream(std::ostream& stream); - /** - * Set the current step. - */ + /** + * Set the current step. + */ OutputOperator& operator<< (unsigned int step); - /** - * Output all the vectors in NamedData. - */ + /** + * Output all the vectors in NamedData. + */ virtual OutputOperator& operator<< (const NamedData& vectors); protected: unsigned int step; diff --git a/deal.II/include/deal.II/algorithms/operator.templates.h b/deal.II/include/deal.II/algorithms/operator.templates.h index a4e6705074..b852ceab3c 100644 --- a/deal.II/include/deal.II/algorithms/operator.templates.h +++ b/deal.II/include/deal.II/algorithms/operator.templates.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010 by Guido Kanschat +// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Guido Kanschat // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -20,15 +20,15 @@ namespace Algorithms Operator::~Operator() {} - - + + template void Operator::notify(const Event& e) { notifications += e; } - - + + template void Operator::clear_events () @@ -40,7 +40,7 @@ namespace Algorithms template OutputOperator::~OutputOperator() {} - + template OutputOperator::OutputOperator() : @@ -52,7 +52,7 @@ namespace Algorithms { os =&stream; } - + template OutputOperator& OutputOperator::operator<< (const NamedData& vectors) @@ -69,8 +69,8 @@ namespace Algorithms { (*os) << ' ' << step; for (unsigned int i=0;isize();++j) - (*os) << ' ' << (*vectors(i))(j); + for (unsigned int j=0;jsize();++j) + (*os) << ' ' << (*vectors(i))(j); (*os) << std::endl; } return *this; diff --git a/deal.II/include/deal.II/algorithms/theta_timestepping.h b/deal.II/include/deal.II/algorithms/theta_timestepping.h index d054f1fe18..17632007e6 100644 --- a/deal.II/include/deal.II/algorithms/theta_timestepping.h +++ b/deal.II/include/deal.II/algorithms/theta_timestepping.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -40,7 +40,7 @@ namespace Algorithms /// The current step size times something double step; }; - + /** * Application class performing the theta timestepping scheme. * @@ -105,7 +105,7 @@ namespace Algorithms * TimeStepData. Thus, we have a circular dependency of information, * and we include the following example for its use. It can be found * in examples/doxygen/theta_timestepping.cc - * + * * @dontinclude theta_timestepping.cc * * First, we define the two operators used by ThetaTimestepping and @@ -168,167 +168,167 @@ namespace Algorithms class ThetaTimestepping : public Operator { public: - /** - * Constructor, receiving the - * two operators stored in - * #op_explicit and #op_implicit. For - * their meening, see the - * description of those variables. - */ + /** + * Constructor, receiving the + * two operators stored in + * #op_explicit and #op_implicit. For + * their meening, see the + * description of those variables. + */ ThetaTimestepping (Operator& op_explicit, - Operator& op_implicit); + Operator& op_implicit); - /** - * The timestepping scheme. in - * should contain the initial - * value in first position. out - */ + /** + * The timestepping scheme. in + * should contain the initial + * value in first position. out + */ virtual void operator() (NamedData& out, const NamedData& in); - /** - * Register an event triggered - * by an outer iteration. - */ + /** + * Register an event triggered + * by an outer iteration. + */ virtual void notify(const Event&); - /** - * Define an operator which - * will output the result in - * each step. Note that no - * output will be generated - * without this. - */ + /** + * Define an operator which + * will output the result in + * each step. Note that no + * output will be generated + * without this. + */ void set_output(OutputOperator& output); - + void declare_parameters (ParameterHandler& param); void initialize (ParameterHandler& param); - /** - * The current time in the - * timestepping scheme. - */ + /** + * The current time in the + * timestepping scheme. + */ const double& current_time() const; - /** - * The current step size. - */ + /** + * The current step size. + */ const double& step_size() const; - /** - * The weight between implicit - * and explicit part. - */ + /** + * The weight between implicit + * and explicit part. + */ const double& theta() const; - /** - * The data handed to the - * #op_explicit time stepping - * operator. - * - * The time in here is the time - * at the beginning of the - * current step, the time step - * is (1-#theta) times the - * actual time step. - */ + /** + * The data handed to the + * #op_explicit time stepping + * operator. + * + * The time in here is the time + * at the beginning of the + * current step, the time step + * is (1-#theta) times the + * actual time step. + */ const TimestepData& explicit_data() const; - - /** - * The data handed to the - * #op_implicit time stepping - * operator. - * - * The time in here is the time - * at the beginning of the - * current step, the time step - * is #theta times the - * actual time step. - */ + + /** + * The data handed to the + * #op_implicit time stepping + * operator. + * + * The time in here is the time + * at the beginning of the + * current step, the time step + * is #theta times the + * actual time step. + */ const TimestepData& implicit_data() const; - /** - * Allow access to the control object. - */ + /** + * Allow access to the control object. + */ TimestepControl& timestep_control(); - + private: - /** - * The object controlling the - * time step size and computing - * the new time in each step. - */ + /** + * The object controlling the + * time step size and computing + * the new time in each step. + */ TimestepControl control; - - /** - * The control parameter theta in the - * range [0,1]. - */ + + /** + * The control parameter theta in the + * range [0,1]. + */ double vtheta; - /** - * Use adaptive #theta if - * true. - */ + /** + * Use adaptive #theta if + * true. + */ bool adaptive; - /** - * The data for the explicit - * part of the scheme. - */ + /** + * The data for the explicit + * part of the scheme. + */ TimestepData d_explicit; - - /** - * The data for the implicit - * part of the scheme. - */ + + /** + * The data for the implicit + * part of the scheme. + */ TimestepData d_implicit; - - - /** - * The operator computing the - * explicit part of the - * scheme. This will receive in - * its input data the value at - * the current time with name - * "Current time solution". It - * should obtain the current - * time and time step size from - * explicit_data(). - * - * Its return value is - * Mu+cAu, where - * u is the current - * state vector, M the - * mass matrix, A the - * operator in space and - * c is the time step - * size in explicit_data(). - */ + + + /** + * The operator computing the + * explicit part of the + * scheme. This will receive in + * its input data the value at + * the current time with name + * "Current time solution". It + * should obtain the current + * time and time step size from + * explicit_data(). + * + * Its return value is + * Mu+cAu, where + * u is the current + * state vector, M the + * mass matrix, A the + * operator in space and + * c is the time step + * size in explicit_data(). + */ SmartPointer, ThetaTimestepping > op_explicit; - - /** - * The operator solving the - * implicit part of the - * scheme. It will receive in - * its input data the vector - * "Previous time". Information on the - * timestep should be obtained - * from implicit_data(). - * - * Its return value is the - * solution u of - * Mu-cAu=f, where - * f is the dual space - * vector found in the - * "Previous time" entry of the - * input data, M the - * mass matrix, A the - * operator in space and - * c is the time step - * size in explicit_data(). - */ + + /** + * The operator solving the + * implicit part of the + * scheme. It will receive in + * its input data the vector + * "Previous time". Information on the + * timestep should be obtained + * from implicit_data(). + * + * Its return value is the + * solution u of + * Mu-cAu=f, where + * f is the dual space + * vector found in the + * "Previous time" entry of the + * input data, M the + * mass matrix, A the + * operator in space and + * c is the time step + * size in explicit_data(). + */ SmartPointer, ThetaTimestepping > op_implicit; - /** - * The operator writing the - * output in each time step - */ + /** + * The operator writing the + * output in each time step + */ SmartPointer, ThetaTimestepping > output; }; @@ -340,7 +340,7 @@ namespace Algorithms { return d_explicit; } - + template inline @@ -349,10 +349,10 @@ namespace Algorithms { return d_implicit; } - + template inline - void ThetaTimestepping::set_output (OutputOperator& out) + void ThetaTimestepping::set_output (OutputOperator& out) { output = &out; } diff --git a/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h b/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h index e8fee89556..288a969f00 100644 --- a/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h +++ b/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010 by Guido Kanschat +// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Guido Kanschat // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -21,7 +21,7 @@ namespace Algorithms { template ThetaTimestepping::ThetaTimestepping (Operator& e, Operator& i) - : vtheta(0.5), adaptive(false), op_explicit(&e), op_implicit(&i) + : vtheta(0.5), adaptive(false), op_explicit(&e), op_implicit(&i) {} @@ -71,9 +71,9 @@ namespace Algorithms d_explicit.time = control.now(); - // The data used to compute the - // vector associated with the old - // timestep + // The data used to compute the + // vector associated with the old + // timestep VECTOR* p = out(0); NamedData src1; src1.add(p, "Previous iterate"); @@ -85,8 +85,8 @@ namespace Algorithms p = aux; NamedData out1; out1.add(p, "Result"); - // The data provided to the inner - // solver + // The data provided to the inner + // solver src2.add(p, "Previous time"); src2.merge(in); @@ -95,29 +95,29 @@ namespace Algorithms for (unsigned int count = 1; d_explicit.time < control.final(); ++count) { - const bool step_change = control.advance(); - d_implicit.time = control.now(); - d_explicit.step = (1.-vtheta)*control.step(); - d_implicit.step = vtheta*control.step(); - deallog << "Time step:" << d_implicit.time << std::endl; - - op_explicit->notify(Events::new_time); - op_implicit->notify(Events::new_time); - if (step_change) - { - op_explicit->notify(Events::new_timestep_size); - op_implicit->notify(Events::new_timestep_size); - } - - // Compute - // (I + (1-theta)dt A) u - (*op_explicit)(out1, src1); - (*op_implicit)(out, src2); - - if (output != 0 && control.print()) - (*output) << count << out; - - d_explicit.time = control.now(); + const bool step_change = control.advance(); + d_implicit.time = control.now(); + d_explicit.step = (1.-vtheta)*control.step(); + d_implicit.step = vtheta*control.step(); + deallog << "Time step:" << d_implicit.time << std::endl; + + op_explicit->notify(Events::new_time); + op_implicit->notify(Events::new_time); + if (step_change) + { + op_explicit->notify(Events::new_timestep_size); + op_implicit->notify(Events::new_timestep_size); + } + + // Compute + // (I + (1-theta)dt A) u + (*op_explicit)(out1, src1); + (*op_implicit)(out, src2); + + if (output != 0 && control.print()) + (*output) << count << out; + + d_explicit.time = control.now(); } deallog.pop(); } diff --git a/deal.II/include/deal.II/algorithms/timestep_control.h b/deal.II/include/deal.II/algorithms/timestep_control.h index a1b6c67706..12ddde717b 100644 --- a/deal.II/include/deal.II/algorithms/timestep_control.h +++ b/deal.II/include/deal.II/algorithms/timestep_control.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2010 by Guido Kanschat +// Copyright (C) 2010, 2012 by Guido Kanschat // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -48,149 +48,149 @@ namespace Algorithms class TimestepControl : public Subscriptor { public: - /** - * The time stepping - * strategies. These are - * controlled by the value of - * tolerance() and start_step(). - */ + /** + * The time stepping + * strategies. These are + * controlled by the value of + * tolerance() and start_step(). + */ enum Strategy { - /** - * Choose a uniform time - * step size. The step size - * is determined by - * start_step(), - * tolerance() is ignored. - */ - uniform, - /** - * Start with the time step - * size given by - * start_step() and double it - * in every - * step. tolerance() is - * ignored. - * - * This strategy is - * intended for - * pseudo-timestepping - * schemes computing a - * stationary limit. - */ - doubling + /** + * Choose a uniform time + * step size. The step size + * is determined by + * start_step(), + * tolerance() is ignored. + */ + uniform, + /** + * Start with the time step + * size given by + * start_step() and double it + * in every + * step. tolerance() is + * ignored. + * + * This strategy is + * intended for + * pseudo-timestepping + * schemes computing a + * stationary limit. + */ + doubling }; - /** - * Constructor setting default - * values - */ + /** + * Constructor setting default + * values + */ TimestepControl (double start = 0., - double final = 1., - double tolerance = 1.e-2, - double start_step = 1.e-2, - double print_step = -1., - double max_step = 1.); - - /** - * Declare the control - * parameters for parameter - * handler. - */ + double final = 1., + double tolerance = 1.e-2, + double start_step = 1.e-2, + double print_step = -1., + double max_step = 1.); + + /** + * Declare the control + * parameters for parameter + * handler. + */ static void declare_parameters (ParameterHandler& param); - /** - * Read the control parameters - * from a parameter handler. - */ + /** + * Read the control parameters + * from a parameter handler. + */ void parse_parameters (ParameterHandler& param); - /** - * The left end of the time interval. - */ + /** + * The left end of the time interval. + */ double start () const; - /** - * The right end of the time - * interval. The control - * mechanism ensures that the - * final time step ends at this - * point. - */ + /** + * The right end of the time + * interval. The control + * mechanism ensures that the + * final time step ends at this + * point. + */ double final () const; - /** - * The tolerance value - * controlling the time steps. - */ + /** + * The tolerance value + * controlling the time steps. + */ double tolerance () const; - /** - * The size of the current time - * step. - */ + /** + * The size of the current time + * step. + */ double step () const; - - /** - * The current time. - */ + + /** + * The current time. + */ double now () const; - /** - * Compute the size of the next - * step size and return true if - * it differs from the current - * step size. Advance the - * current time by the new step - * size. - */ + /** + * Compute the size of the next + * step size and return true if + * it differs from the current + * step size. Advance the + * current time by the new step + * size. + */ bool advance (); - /** - * Set start value. - */ + /** + * Set start value. + */ void start (double); - /** - * Set final time value. - */ + /** + * Set final time value. + */ void final (double); - /** - * Set tolerance - */ + /** + * Set tolerance + */ void tolerance (double); - /** - * Set strategy. - */ + /** + * Set strategy. + */ void strategy (Strategy); - - /** - * Set size of the first - * step. This may be overwritten - * by the time stepping strategy. - */ + + /** + * Set size of the first + * step. This may be overwritten + * by the time stepping strategy. + */ void start_step (double); - - /** - * Set size of the maximum - * step size. - */ + + /** + * Set size of the maximum + * step size. + */ void max_step (double); - /** - * Set now() equal to - * start(). Initialize step() and - * print() to their initial - * values. - */ + /** + * Set now() equal to + * start(). Initialize step() and + * print() to their initial + * values. + */ void restart (); - /** - * Return true if this timestep - * should be written to disk. - */ + /** + * Return true if this timestep + * should be written to disk. + */ bool print (); - /** - * Set the output name template. - */ + /** + * Set the output name template. + */ void file_name_format (const char*); const char* file_name_format (); private: - + double start_val; double final_val; double tolerance_val; @@ -198,18 +198,18 @@ namespace Algorithms double start_step_val; double max_step_val; double min_step_val; - /** - * The size of the current time - * step. This may differ from - * #step_val, if we aimed at #final_val. - */ + /** + * The size of the current time + * step. This may differ from + * #step_val, if we aimed at #final_val. + */ double current_step_val; double step_val; - + double now_val; double print_step; double next_print_val; - + char format[30]; }; diff --git a/deal.II/include/deal.II/base/auto_derivative_function.h b/deal.II/include/deal.II/base/auto_derivative_function.h index 4a8f7dc149..8f43db4ce4 100644 --- a/deal.II/include/deal.II/base/auto_derivative_function.h +++ b/deal.II/include/deal.II/base/auto_derivative_function.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -40,7 +40,7 @@ DEAL_II_NAMESPACE_OPEN * // gradient by employing difference quotients. * Tensor<1,dim> grad=user_function.gradient(some_point); * @endcode - * + * * If the user overloads and implements also the gradient function, * then, of course, the users gradient function is called. * @@ -74,199 +74,199 @@ template class AutoDerivativeFunction : public Function { public: - - /** - * Names of difference formulas. - */ + + /** + * Names of difference formulas. + */ enum DifferenceFormula { - /** - * The symmetric Euler - * formula of second order: - * @f[ - * u'(t) \approx - * \frac{u(t+h) - - * u(t-h)}{2h}. - * @f] - */ - Euler, - /** - * The upwind Euler - * formula of first order: - * @f[ - * u'(t) \approx - * \frac{u(t) - - * u(t-h)}{h}. - * @f] - */ - UpwindEuler, - /** - * The fourth order scheme - * @f[ - * u'(t) \approx - * \frac{u(t-2h) - 8u(t-h) - * + 8u(t+h) - u(t+2h)}{12h}. - * @f] - */ - FourthOrder + /** + * The symmetric Euler + * formula of second order: + * @f[ + * u'(t) \approx + * \frac{u(t+h) - + * u(t-h)}{2h}. + * @f] + */ + Euler, + /** + * The upwind Euler + * formula of first order: + * @f[ + * u'(t) \approx + * \frac{u(t) - + * u(t-h)}{h}. + * @f] + */ + UpwindEuler, + /** + * The fourth order scheme + * @f[ + * u'(t) \approx + * \frac{u(t-2h) - 8u(t-h) + * + 8u(t+h) - u(t+2h)}{12h}. + * @f] + */ + FourthOrder }; - /** - * Constructor. Takes the - * difference step size - * h. It's within the user's - * responsibility to choose an - * appropriate value here. h - * should be chosen taking into - * account the absolute value as - * well as the amount of local - * variation of the function. - * Setting h=1e-6 might be a - * good choice for functions with - * an absolute value of about 1, - * that furthermore does not vary - * to much. - * - * h can be changed later - * using the set_h() function. - * - * Sets DifferenceFormula - * formula to the default - * Euler formula of the - * set_formula() - * function. Change this preset - * formula by calling the - * set_formula() function. - */ + /** + * Constructor. Takes the + * difference step size + * h. It's within the user's + * responsibility to choose an + * appropriate value here. h + * should be chosen taking into + * account the absolute value as + * well as the amount of local + * variation of the function. + * Setting h=1e-6 might be a + * good choice for functions with + * an absolute value of about 1, + * that furthermore does not vary + * to much. + * + * h can be changed later + * using the set_h() function. + * + * Sets DifferenceFormula + * formula to the default + * Euler formula of the + * set_formula() + * function. Change this preset + * formula by calling the + * set_formula() function. + */ AutoDerivativeFunction (const double h, - const unsigned int n_components = 1, - const double initial_time = 0.0); - - /** - * Virtual destructor; absolutely - * necessary in this case. - */ + const unsigned int n_components = 1, + const double initial_time = 0.0); + + /** + * Virtual destructor; absolutely + * necessary in this case. + */ virtual ~AutoDerivativeFunction (); - - /** - * Choose the difference formula. - * See the enum #DifferenceFormula - * for available choices. - */ + + /** + * Choose the difference formula. + * See the enum #DifferenceFormula + * for available choices. + */ void set_formula (const DifferenceFormula formula = Euler); - /** - * Takes the difference step size - * h. It's within the user's - * responsibility to choose an - * appropriate value here. h - * should be chosen taking into - * account the absolute value of - * as well as the amount of local - * variation of the function. - * Setting h=1e-6 might be a - * good choice for functions with - * an absolute value of about 1, - * that furthermore does not vary - * to much. - */ + /** + * Takes the difference step size + * h. It's within the user's + * responsibility to choose an + * appropriate value here. h + * should be chosen taking into + * account the absolute value of + * as well as the amount of local + * variation of the function. + * Setting h=1e-6 might be a + * good choice for functions with + * an absolute value of about 1, + * that furthermore does not vary + * to much. + */ void set_h (const double h); - - /** - * Return the gradient of the - * specified component of the - * function at the given point. - * - * Computes numerical difference - * quotients using the preset - * #DifferenceFormula. - */ + + /** + * Return the gradient of the + * specified component of the + * function at the given point. + * + * Computes numerical difference + * quotients using the preset + * #DifferenceFormula. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; - /** - * Return the gradient of all - * components of the - * function at the given point. - * - * Computes numerical difference - * quotients using the preset - * #DifferenceFormula. - */ + /** + * Return the gradient of all + * components of the + * function at the given point. + * + * Computes numerical difference + * quotients using the preset + * #DifferenceFormula. + */ virtual void vector_gradient (const Point &p, - std::vector > &gradients) const; - - /** - * Set gradients to the - * gradients of the specified - * component of the function at - * the points. It is assumed - * that gradients already has the - * right size, i.e. the same - * size as the points array. - * - * Computes numerical difference - * quotients using the preset - * #DifferenceFormula. - */ + std::vector > &gradients) const; + + /** + * Set gradients to the + * gradients of the specified + * component of the function at + * the points. It is assumed + * that gradients already has the + * right size, i.e. the same + * size as the points array. + * + * Computes numerical difference + * quotients using the preset + * #DifferenceFormula. + */ virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - - /** - * Set gradients to the gradients of - * the function at the points, - * for all components. - * It is assumed that gradients - * already has the right size, i.e. - * the same size as the points array. - * - * The outer loop over - * gradients is over the points - * in the list, the inner loop - * over the different components - * of the function. - * - * Computes numerical difference - * quotients using the preset - * #DifferenceFormula. - */ + std::vector > &gradients, + const unsigned int component = 0) const; + + /** + * Set gradients to the gradients of + * the function at the points, + * for all components. + * It is assumed that gradients + * already has the right size, i.e. + * the same size as the points array. + * + * The outer loop over + * gradients is over the points + * in the list, the inner loop + * over the different components + * of the function. + * + * Computes numerical difference + * quotients using the preset + * #DifferenceFormula. + */ virtual void vector_gradient_list (const std::vector > &points, - std::vector > > &gradients) const; + std::vector > > &gradients) const; - /** - * Returns a - * #DifferenceFormula of the - * order ord at minimum. - */ + /** + * Returns a + * #DifferenceFormula of the + * order ord at minimum. + */ static DifferenceFormula get_formula_of_order (const unsigned int ord); - /** - * Exception. - */ + /** + * Exception. + */ DeclException0(ExcInvalidFormula); private: - - /** - * Step size of the difference - * formula. Set by the set_h() - * function. - */ + + /** + * Step size of the difference + * formula. Set by the set_h() + * function. + */ double h; - /** - * Includes the unit vectors - * scaled by h. - */ + /** + * Includes the unit vectors + * scaled by h. + */ std::vector > ht; - - /** - * Difference formula. Set by the - * set_formula() function. - */ + + /** + * Difference formula. Set by the + * set_formula() function. + */ DifferenceFormula formula; }; diff --git a/deal.II/include/deal.II/base/conditional_ostream.h b/deal.II/include/deal.II/base/conditional_ostream.h index d7ee976997..d7da18e098 100644 --- a/deal.II/include/deal.II/base/conditional_ostream.h +++ b/deal.II/include/deal.II/base/conditional_ostream.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 by the deal.II authors +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -85,79 +85,79 @@ DEAL_II_NAMESPACE_OPEN class ConditionalOStream { public: - /** - * Constructor. Set the stream to which - * we want to write, and the condition - * based on which writes are actually - * forwarded. Per default the condition - * of an object is active. - */ + /** + * Constructor. Set the stream to which + * we want to write, and the condition + * based on which writes are actually + * forwarded. Per default the condition + * of an object is active. + */ ConditionalOStream (std::ostream &stream, const bool active = true); - /** - * Depending on the - * active flag set the - * condition of this stream to - * active (true) or non-active - * (false). An object of this - * class prints to cout - * if and only if its condition - * is active. - */ + /** + * Depending on the + * active flag set the + * condition of this stream to + * active (true) or non-active + * (false). An object of this + * class prints to cout + * if and only if its condition + * is active. + */ void set_condition (const bool active); - /** - * Return the condition of the object. - */ + /** + * Return the condition of the object. + */ bool is_active() const; - /** - * Return a reference to the stream - * currently in use. - */ + /** + * Return a reference to the stream + * currently in use. + */ std::ostream & get_stream () const; - - /** - * Output a constant something through - * this stream. This function must be @p - * const so that member objects of this - * type can also be used from @p const - * member functions of the surrounding - * class. - */ + + /** + * Output a constant something through + * this stream. This function must be @p + * const so that member objects of this + * type can also be used from @p const + * member functions of the surrounding + * class. + */ template const ConditionalOStream & operator << (const T &t) const; - /** - * Treat ostream manipulators. This - * function must be @p const so that - * member objects of this type can also - * be used from @p const member functions - * of the surrounding class. - * - * Note that compilers want to see this - * treated differently from the general - * template above since functions like @p - * std::endl are actually overloaded and - * can't be bound directly to a template - * type. - */ + /** + * Treat ostream manipulators. This + * function must be @p const so that + * member objects of this type can also + * be used from @p const member functions + * of the surrounding class. + * + * Note that compilers want to see this + * treated differently from the general + * template above since functions like @p + * std::endl are actually overloaded and + * can't be bound directly to a template + * type. + */ const ConditionalOStream & operator<< (std::ostream& (*p) (std::ostream&)) const; private: - /** - * Reference to the stream we - * want to write to. - */ + /** + * Reference to the stream we + * want to write to. + */ std::ostream &output_stream; - /** - * Stores the actual condition - * the object is in. - */ + /** + * Stores the actual condition + * the object is in. + */ bool active_flag; }; diff --git a/deal.II/include/deal.II/base/convergence_table.h b/deal.II/include/deal.II/base/convergence_table.h index 66f65106db..4d6f984cec 100644 --- a/deal.II/include/deal.II/base/convergence_table.h +++ b/deal.II/include/deal.II/base/convergence_table.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -58,208 +58,208 @@ DEAL_II_NAMESPACE_OPEN class ConvergenceTable: public TableHandler { public: - /** - * Constructor. - */ + /** + * Constructor. + */ ConvergenceTable(); - /** - * Rate in relation to the rows. - */ + /** + * Rate in relation to the rows. + */ enum RateMode { - /** - * Do not do anything. - */ - none, - /** - * Quotient of values in - * the previous row and in - * this row. - */ - reduction_rate, - /** - * Logarithm of - * #reduction_rate to the - * base 2 representing the - * order of convergence - * when halving the grid - * size, e.g. from h to - * h/2. - */ - reduction_rate_log2 + /** + * Do not do anything. + */ + none, + /** + * Quotient of values in + * the previous row and in + * this row. + */ + reduction_rate, + /** + * Logarithm of + * #reduction_rate to the + * base 2 representing the + * order of convergence + * when halving the grid + * size, e.g. from h to + * h/2. + */ + reduction_rate_log2 }; - /** - * Evaluates the convergence rates of the - * data column data_column_key - * due to the #RateMode in relation to - * the reference column reference_column_key. - * Be sure that the value types of the - * table entries of the - * data column and the reference data column - * is a number, i.e. double, float, - * (unsigned) int, and so on. - * - * The new rate column and the data column - * will be merged to a supercolumn. The - * tex caption of the supercolumn will be - * (by default) the same as the one of the - * data column. This may be changed by using - * the set_tex_supercaption (...) function - * of the base class TableHandler. - * - * This method behaves in the following way: - * - * If RateMode is reduction_rate, then the computed - * output is - * $ \frac{e_{n-1}/k_{n-1}}{e_n/k_n} $. - * - * Where $k$ is the reference column. - * - * If RateMode is reduction_rate_log2, then the - * computed output is - * $ - * 2\frac{\log |e_{n-1}/e_{n}|}{\log |k_n/k_{n-1}|} - * $. - * - * This is useful, for example, if we use as - * reference key the number of degrees of freedom. - * Assuming that the error is proportional to - * $ C (1/\sqrt{k})^r $, then this method will - * produce the rate $r$ as a result. - * - * @note Since this function adds columns - * to the table after several rows have - * already been filled, it switches off - * the auto fill mode of the TableHandler - * base class. If you intend to add - * further data with auto fill, you will - * have to re-enable it after calling - * this function. - */ + /** + * Evaluates the convergence rates of the + * data column data_column_key + * due to the #RateMode in relation to + * the reference column reference_column_key. + * Be sure that the value types of the + * table entries of the + * data column and the reference data column + * is a number, i.e. double, float, + * (unsigned) int, and so on. + * + * The new rate column and the data column + * will be merged to a supercolumn. The + * tex caption of the supercolumn will be + * (by default) the same as the one of the + * data column. This may be changed by using + * the set_tex_supercaption (...) function + * of the base class TableHandler. + * + * This method behaves in the following way: + * + * If RateMode is reduction_rate, then the computed + * output is + * $ \frac{e_{n-1}/k_{n-1}}{e_n/k_n} $. + * + * Where $k$ is the reference column. + * + * If RateMode is reduction_rate_log2, then the + * computed output is + * $ + * 2\frac{\log |e_{n-1}/e_{n}|}{\log |k_n/k_{n-1}|} + * $. + * + * This is useful, for example, if we use as + * reference key the number of degrees of freedom. + * Assuming that the error is proportional to + * $ C (1/\sqrt{k})^r $, then this method will + * produce the rate $r$ as a result. + * + * @note Since this function adds columns + * to the table after several rows have + * already been filled, it switches off + * the auto fill mode of the TableHandler + * base class. If you intend to add + * further data with auto fill, you will + * have to re-enable it after calling + * this function. + */ void evaluate_convergence_rates (const std::string &data_column_key, const std::string &reference_column_key, const RateMode rate_mode); - /** - * Evaluates the convergence rates of the - * data column data_column_key - * due to the #RateMode. - * Be sure that the value types of the - * table entries of the data column - * is a number, i.e. double, float, - * (unsigned) int, and so on. - * - * The new rate column and the data column - * will be merged to a supercolumn. The - * tex caption of the supercolumn will be - * (by default) the same as the one of the - * data column. This may be changed by using - * the set_tex_supercaption() function - * of the base class TableHandler. - * - * @note Since this function adds columns - * to the table after several rows have - * already been filled, it switches off - * the auto fill mode of the TableHandler - * base class. If you intend to add - * further data with auto fill, you will - * have to re-enable it after calling - * this function. - */ + /** + * Evaluates the convergence rates of the + * data column data_column_key + * due to the #RateMode. + * Be sure that the value types of the + * table entries of the data column + * is a number, i.e. double, float, + * (unsigned) int, and so on. + * + * The new rate column and the data column + * will be merged to a supercolumn. The + * tex caption of the supercolumn will be + * (by default) the same as the one of the + * data column. This may be changed by using + * the set_tex_supercaption() function + * of the base class TableHandler. + * + * @note Since this function adds columns + * to the table after several rows have + * already been filled, it switches off + * the auto fill mode of the TableHandler + * base class. If you intend to add + * further data with auto fill, you will + * have to re-enable it after calling + * this function. + */ void evaluate_convergence_rates (const std::string &data_column_key, const RateMode rate_mode); - /** - * Omit this column key - * (not supercolumn!) from the - * evaluation of the convergence rates - * of `all' columns (see the following - * two functions). - * - * The Column::flag==1 is reserved for - * omitting the column from convergence - * rate evalution. - */ + /** + * Omit this column key + * (not supercolumn!) from the + * evaluation of the convergence rates + * of `all' columns (see the following + * two functions). + * + * The Column::flag==1 is reserved for + * omitting the column from convergence + * rate evalution. + */ void omit_column_from_convergence_rate_evaluation(const std::string &key); - /** - * Evaluates convergence rates - * due to the rate_mode - * in relation to the reference - * column - * reference_column_key. This - * function evaluates the rates - * of ALL columns except of the - * columns that are to be omitted - * (see previous function) and - * execpt of the columns that are - * previously evaluated rate - * columns. This function allows - * to evaluate the convergence - * rate for almost all columns of - * a table without calling - * evaluate_convergence_rates() - * for each column separately. - * - * Example: - * Columns like n cells or - * n dofs columns may be wanted - * to be omitted in the evaluation - * of the convergence rates. Hence they - * should omitted by calling the - * omit_column_from_convergence_rate_evaluation(). - */ + /** + * Evaluates convergence rates + * due to the rate_mode + * in relation to the reference + * column + * reference_column_key. This + * function evaluates the rates + * of ALL columns except of the + * columns that are to be omitted + * (see previous function) and + * execpt of the columns that are + * previously evaluated rate + * columns. This function allows + * to evaluate the convergence + * rate for almost all columns of + * a table without calling + * evaluate_convergence_rates() + * for each column separately. + * + * Example: + * Columns like n cells or + * n dofs columns may be wanted + * to be omitted in the evaluation + * of the convergence rates. Hence they + * should omitted by calling the + * omit_column_from_convergence_rate_evaluation(). + */ void evaluate_all_convergence_rates(const std::string &reference_column_key, const RateMode rate_mode); - /** - * Evaluates convergence rates - * due to the rate_mode. This - * function evaluates the rates of - * ALL columns except of the - * columns that are to be omitted - * (see previous function) - * and execpt of the columns that are - * previously - * evaluated rate columns. - * This function allows to evaluate - * the convergence rate for almost all - * columns of a table without calling - * evaluate_convergence_rates() - * for each column seperately. - * - * Example: - * Columns like n cells or - * n dofs columns may be wanted - * to be omitted in the evaluation - * of the convergence rates. Hence they - * should omitted by calling the - * omit_column_from_convergence_rate_evaluation(). - */ + /** + * Evaluates convergence rates + * due to the rate_mode. This + * function evaluates the rates of + * ALL columns except of the + * columns that are to be omitted + * (see previous function) + * and execpt of the columns that are + * previously + * evaluated rate columns. + * This function allows to evaluate + * the convergence rate for almost all + * columns of a table without calling + * evaluate_convergence_rates() + * for each column seperately. + * + * Example: + * Columns like n cells or + * n dofs columns may be wanted + * to be omitted in the evaluation + * of the convergence rates. Hence they + * should omitted by calling the + * omit_column_from_convergence_rate_evaluation(). + */ void evaluate_all_convergence_rates(const RateMode rate_mode); - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ - /** - * Exception - */ + /** + * Exception + */ DeclException0 (ExcWrongValueType); - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcRateColumnAlreadyExists, - std::string, - << "Rate column <" << arg1 << "> does already exist."); - //@} + std::string, + << "Rate column <" << arg1 << "> does already exist."); + //@} }; diff --git a/deal.II/include/deal.II/base/data_out_base.h b/deal.II/include/deal.II/base/data_out_base.h index 077a3e5622..86dc55bed7 100644 --- a/deal.II/include/deal.II/base/data_out_base.h +++ b/deal.II/include/deal.II/base/data_out_base.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -218,1192 +218,1192 @@ class ParameterHandler; class DataOutBase { public: - /** - * Data structure describing a patch of - * data in dim space - * dimensions. - * - * A patch consists of the following data: - *
    - *
  • the corner #vertices, - *
  • the number - * #n_subdivisions of the number - * of cells the Patch has in each - * space direction, - *
  • the #data attached to - * each vertex, in the usual - * lexicographic ordering, - *
  • Information on #neighbors. - *
- * - * See the general - * documentation of the - * DataOutBase class for more - * information on its contents and - * purposes. In the case of two - * dimensions, the next picture ist an - * example of n_subdivision = 4 - * because the number of (sub)cells - * within each patch is equal to - * 2^dim. - * - * @ingroup output - * - * @author Wolfgang Bangerth, Guido Kanschat - */ + /** + * Data structure describing a patch of + * data in dim space + * dimensions. + * + * A patch consists of the following data: + *
    + *
  • the corner #vertices, + *
  • the number + * #n_subdivisions of the number + * of cells the Patch has in each + * space direction, + *
  • the #data attached to + * each vertex, in the usual + * lexicographic ordering, + *
  • Information on #neighbors. + *
+ * + * See the general + * documentation of the + * DataOutBase class for more + * information on its contents and + * purposes. In the case of two + * dimensions, the next picture ist an + * example of n_subdivision = 4 + * because the number of (sub)cells + * within each patch is equal to + * 2^dim. + * + * @ingroup output + * + * @author Wolfgang Bangerth, Guido Kanschat + */ template struct Patch { - /** - * Make the spacedim template - * parameter available. - */ - static const unsigned int space_dim=spacedim; - - /** - * Corner points of a patch. - * Inner points are computed by - * a multilinear transform of - * the unit cell to the cell - * specified by these corner - * points. The order of points - * is the same as for cells - * in the triangulation. - */ - Point vertices[GeometryInfo::vertices_per_cell]; - - /** - * Numbers of neighbors of a patch. - * OpenDX format requires - * neighbor information for - * advanced output. Here the - * neighborship relationship - * of patches is - * stored. During output, - * this must be transformed - * into neighborship of - * sub-grid cells. - */ - unsigned int neighbors[GeometryInfo::faces_per_cell]; - - /** - * Number of this - * patch. Since we are not - * sure patches are handled - * in the same order, always, - * we better store this. - */ - unsigned int patch_index; - - /** - * Number of subdivisions with - * which this patch is to be - * written. 1 means no - * subdivision, 2 means - * bisection, 3 trisection, - * etc. - */ - unsigned int n_subdivisions; - - /** - * Data vectors. The format is - * as follows: - * data(i,.) denotes the data - * belonging to the ith data - * vector. data.n() - * therefore equals the number - * of output points; this - * number is (subdivisions+1)^{dim}. - * data.m() equals the number of - * data vectors. - * - * Within each column, - * data(.,j) are the - * data values at the output - * point j, where - * j denotes the - * usual lexicographic - * ordering in deal.II. This - * is also the order of - * points as provided by the - * QIterated class - * when used with the - * QTrapez class as - * subquadrature. - * - * Since the number of data vectors - * is usually the same for all - * patches to be printed, - * data.size() should yield - * the same value for all patches - * provided. The exception are - * patches for which - * points_are_available are set, - * where the actual coordinates of - * the point are appended to the - * 'data' field, see the - * documentation of the - * points_are_available flag. - */ - Table<2,float> data; - - /** - * Bool flag indicating, whether the - * coordinates of the inner patch - * points are appended to the @p data - * table (@ true) or not (@ false), - * where the second is the standard and - * can be found for all cells in the - * interior of a domain. - * - * On the boundary of a domain, patch - * points are evaluated using a - * Mapping and therefore have to be - * stored inside the patch, as the - * Mapping and the corresponding - * boundary information are no longer - * available later on when we - * actually write the patch out to an - * output stream. - */ - bool points_are_available; - - /** - * Default constructor. Sets - * n_subdivisions to one. - */ - Patch (); - - /** - * Compare the present patch - * for equality with another - * one. This is used in a few - * of the automated tests in - * our testsuite. - */ - bool operator == (const Patch &patch) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; - - /** - * Value to be used if this - * patch has no neighbor on - * one side. - */ - static const unsigned int no_neighbor = numbers::invalid_unsigned_int; - /** @addtogroup Exceptions - * @{ */ - - /** - * Exception - */ - DeclException2 (ExcInvalidCombinationOfDimensions, - int, int, - << "It is not possible to have a structural dimension of " << arg1 - << " to be larger than the space dimension of the surrounding" - << " space " << arg2); - //@} + /** + * Make the spacedim template + * parameter available. + */ + static const unsigned int space_dim=spacedim; + + /** + * Corner points of a patch. + * Inner points are computed by + * a multilinear transform of + * the unit cell to the cell + * specified by these corner + * points. The order of points + * is the same as for cells + * in the triangulation. + */ + Point vertices[GeometryInfo::vertices_per_cell]; + + /** + * Numbers of neighbors of a patch. + * OpenDX format requires + * neighbor information for + * advanced output. Here the + * neighborship relationship + * of patches is + * stored. During output, + * this must be transformed + * into neighborship of + * sub-grid cells. + */ + unsigned int neighbors[GeometryInfo::faces_per_cell]; + + /** + * Number of this + * patch. Since we are not + * sure patches are handled + * in the same order, always, + * we better store this. + */ + unsigned int patch_index; + + /** + * Number of subdivisions with + * which this patch is to be + * written. 1 means no + * subdivision, 2 means + * bisection, 3 trisection, + * etc. + */ + unsigned int n_subdivisions; + + /** + * Data vectors. The format is + * as follows: + * data(i,.) denotes the data + * belonging to the ith data + * vector. data.n() + * therefore equals the number + * of output points; this + * number is (subdivisions+1)^{dim}. + * data.m() equals the number of + * data vectors. + * + * Within each column, + * data(.,j) are the + * data values at the output + * point j, where + * j denotes the + * usual lexicographic + * ordering in deal.II. This + * is also the order of + * points as provided by the + * QIterated class + * when used with the + * QTrapez class as + * subquadrature. + * + * Since the number of data vectors + * is usually the same for all + * patches to be printed, + * data.size() should yield + * the same value for all patches + * provided. The exception are + * patches for which + * points_are_available are set, + * where the actual coordinates of + * the point are appended to the + * 'data' field, see the + * documentation of the + * points_are_available flag. + */ + Table<2,float> data; + + /** + * Bool flag indicating, whether the + * coordinates of the inner patch + * points are appended to the @p data + * table (@ true) or not (@ false), + * where the second is the standard and + * can be found for all cells in the + * interior of a domain. + * + * On the boundary of a domain, patch + * points are evaluated using a + * Mapping and therefore have to be + * stored inside the patch, as the + * Mapping and the corresponding + * boundary information are no longer + * available later on when we + * actually write the patch out to an + * output stream. + */ + bool points_are_available; + + /** + * Default constructor. Sets + * n_subdivisions to one. + */ + Patch (); + + /** + * Compare the present patch + * for equality with another + * one. This is used in a few + * of the automated tests in + * our testsuite. + */ + bool operator == (const Patch &patch) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; + + /** + * Value to be used if this + * patch has no neighbor on + * one side. + */ + static const unsigned int no_neighbor = numbers::invalid_unsigned_int; + /** @addtogroup Exceptions + * @{ */ + + /** + * Exception + */ + DeclException2 (ExcInvalidCombinationOfDimensions, + int, int, + << "It is not possible to have a structural dimension of " << arg1 + << " to be larger than the space dimension of the surrounding" + << " space " << arg2); + //@} }; - /** - * Flags controlling the details of - * output in OpenDX format. - * - * @ingroup output - */ + /** + * Flags controlling the details of + * output in OpenDX format. + * + * @ingroup output + */ struct DXFlags { - /** - * Write neighbor - * information. This - * information is necessary - * for instance, if OpenDX is - * supposed to compute - * integral curves - * (streamlines). If it is - * not present, streamlines - * end at cell boundaries. - */ - bool write_neighbors; - /** - * Write integer values of - * the Triangulation in - * binary format. - */ - bool int_binary; - /** - * Write coordinate vectors in - * binary format. - */ - bool coordinates_binary; - - /** - * Write data vectors in - * binary format. - */ - bool data_binary; - - /** - * Write binary coordinate - * vectors as double (64 bit) - * numbers instead of float (32 bit). - */ - bool data_double; - - /** - * Constructor. - */ - DXFlags (const bool write_neighbors = false, - const bool int_binary = false, - const bool coordinates_binary = false, - const bool data_binary = false); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm); - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. - */ - std::size_t memory_consumption () const; + /** + * Write neighbor + * information. This + * information is necessary + * for instance, if OpenDX is + * supposed to compute + * integral curves + * (streamlines). If it is + * not present, streamlines + * end at cell boundaries. + */ + bool write_neighbors; + /** + * Write integer values of + * the Triangulation in + * binary format. + */ + bool int_binary; + /** + * Write coordinate vectors in + * binary format. + */ + bool coordinates_binary; + + /** + * Write data vectors in + * binary format. + */ + bool data_binary; + + /** + * Write binary coordinate + * vectors as double (64 bit) + * numbers instead of float (32 bit). + */ + bool data_double; + + /** + * Constructor. + */ + DXFlags (const bool write_neighbors = false, + const bool int_binary = false, + const bool coordinates_binary = false, + const bool data_binary = false); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm); + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details - * of output in UCD format for - * AVS. - * - * @ingroup output - */ + /** + * Flags controlling the details + * of output in UCD format for + * AVS. + * + * @ingroup output + */ struct UcdFlags { - /** - * Write a comment at the - * beginning of the file - * stating the date of - * creation and some other - * data. While this is - * supported by the UCD - * format and - * AVS, some other - * programs get confused by - * this, so the default is to - * not write a - * preamble. However, a - * preamble can be written - * using this flag. - * - * Default: false. - */ - bool write_preamble; - - /** - * Constructor. - */ - UcdFlags (const bool write_preamble = false); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm); - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Write a comment at the + * beginning of the file + * stating the date of + * creation and some other + * data. While this is + * supported by the UCD + * format and + * AVS, some other + * programs get confused by + * this, so the default is to + * not write a + * preamble. However, a + * preamble can be written + * using this flag. + * + * Default: false. + */ + bool write_preamble; + + /** + * Constructor. + */ + UcdFlags (const bool write_preamble = false); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm); + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details of - * output in Gnuplot format. At - * present no flags are implemented. - * - * @ingroup output - */ + /** + * Flags controlling the details of + * output in Gnuplot format. At + * present no flags are implemented. + * + * @ingroup output + */ struct GnuplotFlags { private: - /** - * Dummy entry to suppress compiler - * warnings when copying an empty - * structure. Remove this member - * when adding the first flag to - * this structure (and remove the - * private as well). - */ - int dummy; + /** + * Dummy entry to suppress compiler + * warnings when copying an empty + * structure. Remove this member + * when adding the first flag to + * this structure (and remove the + * private as well). + */ + int dummy; public: - /** - * Constructor. - */ - GnuplotFlags (); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Constructor. + */ + GnuplotFlags (); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details - * of output in Povray - * format. Several flags are - * implemented, see their - * respective documentation. - * - * @ingroup output - */ + /** + * Flags controlling the details + * of output in Povray + * format. Several flags are + * implemented, see their + * respective documentation. + * + * @ingroup output + */ struct PovrayFlags { - /** - * Normal vector interpolation, - * if set to true - * - * default = false - */ - bool smooth; - - /** - * Use bicubic patches (b-splines) - * instead of triangles. - * - * default = false - */ - bool bicubic_patch; - - /** - * include external "data.inc" - * with camera, light and - * texture definition for the - * scene. - * - * default = false - */ - bool external_data; - - /** - * Constructor. - */ - PovrayFlags (const bool smooth = false, - const bool bicubic_patch = false, - const bool external_data = false); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm); - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Normal vector interpolation, + * if set to true + * + * default = false + */ + bool smooth; + + /** + * Use bicubic patches (b-splines) + * instead of triangles. + * + * default = false + */ + bool bicubic_patch; + + /** + * include external "data.inc" + * with camera, light and + * texture definition for the + * scene. + * + * default = false + */ + bool external_data; + + /** + * Constructor. + */ + PovrayFlags (const bool smooth = false, + const bool bicubic_patch = false, + const bool external_data = false); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm); + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details of - * output in encapsulated postscript - * format. - * - * @ingroup output - */ + /** + * Flags controlling the details of + * output in encapsulated postscript + * format. + * + * @ingroup output + */ struct EpsFlags { - /** - * This denotes the number of the - * data vector which shall be used - * for generating the height - * information. By default, the - * first data vector is taken, - * i.e. height_vector==0, if - * there is any data vector. If there - * is no data vector, no height - * information is generated. - */ - unsigned int height_vector; - - /** - * Number of the vector which is - * to be taken to colorize cells. - * The same applies as for - * height_vector. - */ - unsigned int color_vector; - - /** - * Enum denoting the possibilities - * whether the scaling should be done - * such that the given size equals - * the width or the height of - * the resulting picture. - */ - enum SizeType { - /// Scale to given width - width, - /// Scale to given height - height - }; - - /** - * See above. Default is width. - */ - SizeType size_type; - - /** - * Width or height of the output - * as given in postscript units - * This usually is given by the - * strange unit 1/72 inch. Whether - * this is height or width is - * specified by the flag - * size_type. - * - * Default is 300, which represents - * a size of roughly 10 cm. - */ - unsigned int size; - - /** - * Width of a line in postscript - * units. Default is 0.5. - */ - double line_width; - - /** - * Angle of the line origin-viewer - * against the z-axis in degrees. - * - * Default is the Gnuplot-default - * of 60. - */ - double azimut_angle; - - /** - * Angle by which the viewers - * position projected onto the - * x-y-plane is rotated around - * the z-axis, in positive sense - * when viewed from above. The - * unit are degrees, and zero - * equals a position above or below - * the negative y-axis. - * - * Default is the - * Gnuplot-default of 30. - * An exemple of a - * Gnuplot-default of 0 is - * the following: - * - * @verbatim - * - * 3________7 - * / /| - * / / | - * 2/______6/ | - * | | | | - * O--> | 0___|___4 - * | / | / - * | / | / - * 1|/______5/ - * - * @endverbatim - */ - double turn_angle; - - /** - * Factor by which the z-axis is to - * be stretched as compared to the - * x- and y-axes. This is to compensate - * for the different sizes that - * coordinate and solution values may - * have and to prevent that the plot - * looks to much out-of-place (no - * elevation at all if solution values - * are much smaller than coordinate - * values, or the common "extremely - * mountainous area" in the opposite - * case. - * - * Default is 1.0. - */ - double z_scaling; - - /** - * Flag the determines whether the - * lines bounding the cells (or the - * parts of each patch) are to be - * plotted. - * - * Default: true. - */ - bool draw_mesh; - - /** - * Flag whether to fill the regions - * between the lines bounding the cells - * or not. If not, no hidden line removal - * is performed, which in this crude - * implementation is done through - * writing the cells in a back-to-front - * order, thereby hiding the cells in - * the background by cells in the - * foreground. - * - * If this flag is false and draw_mesh - * is false as well, nothing will be - * printed. - * - * If this flag is true, then the cells - * will be drawn either colored by one - * of the data sets (if shade_cells is - * true), or pure white (if - * shade_cells is false or if there are - * no data sets). - * - * Default is true. - */ - bool draw_cells; - - /** - * Flag to determine whether the cells - * shall be colorized by the data - * set denoted by color_vector, or - * simply be painted in white. This - * flag only makes sense if - * draw_cells==true. Colorization is - * done through the color_function. - * - * Default is true. - */ - bool shade_cells; - - /** - * Structure keeping the three color - * values in the RGB system. - */ - struct RgbValues - { - float red; - float green; - float blue; - - /** - * Return true if the - * color represented by - * the three color values - * is a grey scale, - * i.e. all components - * are equal. - */ - bool is_grey () const; - }; - - /** - * Definition of a function pointer - * type taking a value and returning - * a triple of color values in RGB - * values. - * - * Besides the actual value by which - * the color is to be computed, min - * and max values of the data to - * be colorized are given as well. - */ - typedef RgbValues (*ColorFunction) (const double value, - const double min_value, - const double max_value); - - /** - * This is a pointer to the function - * which is used to colorize the cells. - * By default, it points to the - * static function default_color_function - * which is a member of this class. - */ - ColorFunction color_function; - - - /** - * Default colorization function. This - * one does what one usually wants: - * It shifts colors from black (lowest - * value) through blue, green and red - * to white (highest value). For the - * exact defition of the color scale - * refer to the implementation. - * - * This function was originally written - * by Stefan Nauber. - */ - static RgbValues + /** + * This denotes the number of the + * data vector which shall be used + * for generating the height + * information. By default, the + * first data vector is taken, + * i.e. height_vector==0, if + * there is any data vector. If there + * is no data vector, no height + * information is generated. + */ + unsigned int height_vector; + + /** + * Number of the vector which is + * to be taken to colorize cells. + * The same applies as for + * height_vector. + */ + unsigned int color_vector; + + /** + * Enum denoting the possibilities + * whether the scaling should be done + * such that the given size equals + * the width or the height of + * the resulting picture. + */ + enum SizeType { + /// Scale to given width + width, + /// Scale to given height + height + }; + + /** + * See above. Default is width. + */ + SizeType size_type; + + /** + * Width or height of the output + * as given in postscript units + * This usually is given by the + * strange unit 1/72 inch. Whether + * this is height or width is + * specified by the flag + * size_type. + * + * Default is 300, which represents + * a size of roughly 10 cm. + */ + unsigned int size; + + /** + * Width of a line in postscript + * units. Default is 0.5. + */ + double line_width; + + /** + * Angle of the line origin-viewer + * against the z-axis in degrees. + * + * Default is the Gnuplot-default + * of 60. + */ + double azimut_angle; + + /** + * Angle by which the viewers + * position projected onto the + * x-y-plane is rotated around + * the z-axis, in positive sense + * when viewed from above. The + * unit are degrees, and zero + * equals a position above or below + * the negative y-axis. + * + * Default is the + * Gnuplot-default of 30. + * An exemple of a + * Gnuplot-default of 0 is + * the following: + * + * @verbatim + * + * 3________7 + * / /| + * / / | + * 2/______6/ | + * | | | | + * O--> | 0___|___4 + * | / | / + * | / | / + * 1|/______5/ + * + * @endverbatim + */ + double turn_angle; + + /** + * Factor by which the z-axis is to + * be stretched as compared to the + * x- and y-axes. This is to compensate + * for the different sizes that + * coordinate and solution values may + * have and to prevent that the plot + * looks to much out-of-place (no + * elevation at all if solution values + * are much smaller than coordinate + * values, or the common "extremely + * mountainous area" in the opposite + * case. + * + * Default is 1.0. + */ + double z_scaling; + + /** + * Flag the determines whether the + * lines bounding the cells (or the + * parts of each patch) are to be + * plotted. + * + * Default: true. + */ + bool draw_mesh; + + /** + * Flag whether to fill the regions + * between the lines bounding the cells + * or not. If not, no hidden line removal + * is performed, which in this crude + * implementation is done through + * writing the cells in a back-to-front + * order, thereby hiding the cells in + * the background by cells in the + * foreground. + * + * If this flag is false and draw_mesh + * is false as well, nothing will be + * printed. + * + * If this flag is true, then the cells + * will be drawn either colored by one + * of the data sets (if shade_cells is + * true), or pure white (if + * shade_cells is false or if there are + * no data sets). + * + * Default is true. + */ + bool draw_cells; + + /** + * Flag to determine whether the cells + * shall be colorized by the data + * set denoted by color_vector, or + * simply be painted in white. This + * flag only makes sense if + * draw_cells==true. Colorization is + * done through the color_function. + * + * Default is true. + */ + bool shade_cells; + + /** + * Structure keeping the three color + * values in the RGB system. + */ + struct RgbValues + { + float red; + float green; + float blue; + + /** + * Return true if the + * color represented by + * the three color values + * is a grey scale, + * i.e. all components + * are equal. + */ + bool is_grey () const; + }; + + /** + * Definition of a function pointer + * type taking a value and returning + * a triple of color values in RGB + * values. + * + * Besides the actual value by which + * the color is to be computed, min + * and max values of the data to + * be colorized are given as well. + */ + typedef RgbValues (*ColorFunction) (const double value, + const double min_value, + const double max_value); + + /** + * This is a pointer to the function + * which is used to colorize the cells. + * By default, it points to the + * static function default_color_function + * which is a member of this class. + */ + ColorFunction color_function; + + + /** + * Default colorization function. This + * one does what one usually wants: + * It shifts colors from black (lowest + * value) through blue, green and red + * to white (highest value). For the + * exact defition of the color scale + * refer to the implementation. + * + * This function was originally written + * by Stefan Nauber. + */ + static RgbValues default_color_function (const double value, const double min_value, const double max_value); - /** - * This is an alternative color - * function producing a grey scale - * between black (lowest values) - * and white (highest values). You - * may use it by setting the - * color_function variable to the - * address of this function. - */ - static RgbValues + /** + * This is an alternative color + * function producing a grey scale + * between black (lowest values) + * and white (highest values). You + * may use it by setting the + * color_function variable to the + * address of this function. + */ + static RgbValues grey_scale_color_function (const double value, const double min_value, const double max_value); - /** - * This is one more - * alternative color function - * producing a grey scale - * between white (lowest - * values) and black (highest - * values), i.e. the scale is - * reversed to the previous - * one. You may use it by - * setting the - * color_function - * variable to the address of - * this function. - */ - static RgbValues + /** + * This is one more + * alternative color function + * producing a grey scale + * between white (lowest + * values) and black (highest + * values), i.e. the scale is + * reversed to the previous + * one. You may use it by + * setting the + * color_function + * variable to the address of + * this function. + */ + static RgbValues reverse_grey_scale_color_function (const double value, const double min_value, const double max_value); - /** - * Constructor. - */ - EpsFlags (const unsigned int height_vector = 0, - const unsigned int color_vector = 0, - const SizeType size_type = width, - const unsigned int size = 300, - const double line_width = 0.5, - const double azimut_angle = 60, - const double turn_angle = 30, - const double z_scaling = 1.0, - const bool draw_mesh = true, - const bool draw_cells = true, - const bool shade_cells = true, - const ColorFunction color_function= &default_color_function); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - * - * For coloring, only the color - * functions declared in this - * class are offered. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm); - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Constructor. + */ + EpsFlags (const unsigned int height_vector = 0, + const unsigned int color_vector = 0, + const SizeType size_type = width, + const unsigned int size = 300, + const double line_width = 0.5, + const double azimut_angle = 60, + const double turn_angle = 30, + const double z_scaling = 1.0, + const bool draw_mesh = true, + const bool draw_cells = true, + const bool shade_cells = true, + const ColorFunction color_function= &default_color_function); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + * + * For coloring, only the color + * functions declared in this + * class are offered. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm); + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details - * of output in GMV - * format. At present no flags - * are implemented. - * - * @ingroup output - */ + /** + * Flags controlling the details + * of output in GMV + * format. At present no flags + * are implemented. + * + * @ingroup output + */ struct GmvFlags { private: - /** - * Dummy entry to suppress compiler - * warnings when copying an empty - * structure. Remove this member - * when adding the first flag to - * this structure (and remove the - * private as well). - */ - int dummy; + /** + * Dummy entry to suppress compiler + * warnings when copying an empty + * structure. Remove this member + * when adding the first flag to + * this structure (and remove the + * private as well). + */ + int dummy; public: - /** - * Default constructor. - */ - GmvFlags (); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Default constructor. + */ + GmvFlags (); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details - * of output in - * Tecplot format. - * - * @ingroup output - */ + /** + * Flags controlling the details + * of output in + * Tecplot format. + * + * @ingroup output + */ struct TecplotFlags { public: - /** - * This variable is needed to hold the - * output file name when using the - * Tecplot API to write binary files. - * If the user doesn't set the file - * name with this variable only - * ASCII Tecplot output will be - * produced. - */ + /** + * This variable is needed to hold the + * output file name when using the + * Tecplot API to write binary files. + * If the user doesn't set the file + * name with this variable only + * ASCII Tecplot output will be + * produced. + */ const char* tecplot_binary_file_name; - /** - * Tecplot allows to assign - * names to zones. This - * variable stores this name. - */ - const char* zone_name; - - /** - * Constructor - **/ - TecplotFlags (const char* tecplot_binary_file_name = NULL, - const char* zone_name = NULL); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Tecplot allows to assign + * names to zones. This + * variable stores this name. + */ + const char* zone_name; + + /** + * Constructor + **/ + TecplotFlags (const char* tecplot_binary_file_name = NULL, + const char* zone_name = NULL); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details - * of output in VTK - * format. At present no flags - * are implemented. - * - * @ingroup output - */ + /** + * Flags controlling the details + * of output in VTK + * format. At present no flags + * are implemented. + * + * @ingroup output + */ struct VtkFlags { private: - /** - * Dummy entry to suppress compiler - * warnings when copying an empty - * structure. Remove this member - * when adding the first flag to - * this structure (and remove the - * private as well). - */ - int dummy; + /** + * Dummy entry to suppress compiler + * warnings when copying an empty + * structure. Remove this member + * when adding the first flag to + * this structure (and remove the + * private as well). + */ + int dummy; public: - /** - * Default constructor. - */ - VtkFlags (); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Default constructor. + */ + VtkFlags (); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Flags controlling the details - * of output in deal.II - * intermediate format. At - * present no flags are - * implemented. - * - * @ingroup output - */ + /** + * Flags controlling the details + * of output in deal.II + * intermediate format. At + * present no flags are + * implemented. + * + * @ingroup output + */ struct Deal_II_IntermediateFlags { - /** - * An indicator of the - * currect file format - * version used to write - * intermediate format. We do - * not attempt to be backward - * compatible, so this number - * is used only to verify - * that the format we are - * writing is what the - * current readers and - * writers understand. - */ + /** + * An indicator of the + * currect file format + * version used to write + * intermediate format. We do + * not attempt to be backward + * compatible, so this number + * is used only to verify + * that the format we are + * writing is what the + * current readers and + * writers understand. + */ static const unsigned int format_version = 3; private: - /** - * Dummy entry to suppress compiler - * warnings when copying an empty - * structure. Remove this member - * when adding the first flag to - * this structure (and remove the - * private as well). - */ - int dummy; + /** + * Dummy entry to suppress compiler + * warnings when copying an empty + * structure. Remove this member + * when adding the first flag to + * this structure (and remove the + * private as well). + */ + int dummy; public: - /** - * Constructor. - */ - Deal_II_IntermediateFlags (); - - /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. - */ - static void declare_parameters (ParameterHandler &prm); - - /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. - * - * The flags thus obtained overwrite - * all previous contents of this object. - */ - void parse_parameters (const ParameterHandler &prm) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ - std::size_t memory_consumption () const; + /** + * Constructor. + */ + Deal_II_IntermediateFlags (); + + /** + * Declare all flags with name + * and type as offered by this + * class, for use in input files. + */ + static void declare_parameters (ParameterHandler &prm); + + /** + * Read the parameters declared in + * declare_parameters and set the + * flags for this output format + * accordingly. + * + * The flags thus obtained overwrite + * all previous contents of this object. + */ + void parse_parameters (const ParameterHandler &prm) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ + std::size_t memory_consumption () const; }; - /** - * Provide a data type specifying - * the presently supported output - * formats. - */ + /** + * Provide a data type specifying + * the presently supported output + * formats. + */ enum OutputFormat { - /** - * Use the format already - * stored in the object. - */ - default_format, - /** - * Do not write any output. - */ - none, - /** - * Output for OpenDX. - */ - dx, - /** - * Output in the UCD format - * for AVS. - */ - ucd, - /** - * Output for the - * Gnuplot tool. - */ - gnuplot, - /** - * Output for the - * Povray - * raytracer. - */ - povray, - /** - * Output in encapsulated - * PostScript. - */ - eps, - /** - * Output for GMV. - */ - gmv, - /** - * Output for - * Tecplot in text - * format. - */ - - tecplot, - /** - * Output for - * Tecplot in - * binary format. Faster - * and smaller than text - * format. - */ - tecplot_binary, - - /** - * Output in - * VTK format. - */ - vtk, - - /** - * Output in - * VTK format. - */ - vtu, - - /** - * Output in deal.II - * intermediate format. - */ - deal_II_intermediate + /** + * Use the format already + * stored in the object. + */ + default_format, + /** + * Do not write any output. + */ + none, + /** + * Output for OpenDX. + */ + dx, + /** + * Output in the UCD format + * for AVS. + */ + ucd, + /** + * Output for the + * Gnuplot tool. + */ + gnuplot, + /** + * Output for the + * Povray + * raytracer. + */ + povray, + /** + * Output in encapsulated + * PostScript. + */ + eps, + /** + * Output for GMV. + */ + gmv, + /** + * Output for + * Tecplot in text + * format. + */ + + tecplot, + /** + * Output for + * Tecplot in + * binary format. Faster + * and smaller than text + * format. + */ + tecplot_binary, + + /** + * Output in + * VTK format. + */ + vtk, + + /** + * Output in + * VTK format. + */ + vtu, + + /** + * Output in deal.II + * intermediate format. + */ + deal_II_intermediate }; @@ -1417,10 +1417,10 @@ class DataOutBase */ template static void write_dx (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const DXFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const DXFlags &flags, + std::ostream &out); /** * Write the given list of patches to the output stream in eps format. @@ -1469,10 +1469,10 @@ class DataOutBase */ template static void write_eps (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const EpsFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const EpsFlags &flags, + std::ostream &out); /** * Write the given list of patches to the output stream in @@ -1486,10 +1486,10 @@ class DataOutBase */ template static void write_gmv (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const GmvFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const GmvFlags &flags, + std::ostream &out); /** * Write the given list of patches to the output stream in gnuplot @@ -1553,10 +1553,10 @@ class DataOutBase */ template static void write_gnuplot (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const GnuplotFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const GnuplotFlags &flags, + std::ostream &out); /** * Write the given list of patches to the output stream for the @@ -1607,10 +1607,10 @@ class DataOutBase */ template static void write_povray (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const PovrayFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const PovrayFlags &flags, + std::ostream &out); /** * Write the given list of patches to the output stream in @@ -1621,10 +1621,10 @@ class DataOutBase */ template static void write_tecplot (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const TecplotFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const TecplotFlags &flags, + std::ostream &out); /** * Write the given list of patches to the output stream in @@ -1672,10 +1672,10 @@ class DataOutBase */ template static void write_ucd (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const UcdFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const UcdFlags &flags, + std::ostream &out); /** * Write the given list of patches to the output stream in VTK @@ -1691,10 +1691,10 @@ class DataOutBase */ template static void write_vtk (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const VtkFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const VtkFlags &flags, + std::ostream &out); /** @@ -1720,10 +1720,10 @@ class DataOutBase */ template static void write_vtu (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const VtkFlags &flags, - std::ostream &out); + const std::vector &data_names, + const std::vector > &vector_data_ranges, + const VtkFlags &flags, + std::ostream &out); /** * This writes the header for the xml based vtu file format. This @@ -1825,206 +1825,206 @@ class DataOutBase std::pair determine_intermediate_format_dimensions (std::istream &input); - /** - * Return the OutputFormat - * value corresponding to the - * given string. If the string - * does not match any known - * format, an exception is - * thrown. - * - * Since this function does not - * need data from this object, it - * is static and can thus be - * called without creating an - * object of this class. Its main - * purpose is to allow a program - * to use any implemented output - * format without the need to - * extend the program's parser - * each time a new format is - * implemented. - * - * To get a list of presently - * available format names, - * e.g. to give it to the - * ParameterHandler class, - * use the function - * get_output_format_names(). - */ + /** + * Return the OutputFormat + * value corresponding to the + * given string. If the string + * does not match any known + * format, an exception is + * thrown. + * + * Since this function does not + * need data from this object, it + * is static and can thus be + * called without creating an + * object of this class. Its main + * purpose is to allow a program + * to use any implemented output + * format without the need to + * extend the program's parser + * each time a new format is + * implemented. + * + * To get a list of presently + * available format names, + * e.g. to give it to the + * ParameterHandler class, + * use the function + * get_output_format_names(). + */ static OutputFormat parse_output_format (const std::string &format_name); - /** - * Return a list of implemented - * output formats. The different - * names are separated by - * vertical bar signs (`|') - * as used by the - * ParameterHandler classes. - */ + /** + * Return a list of implemented + * output formats. The different + * names are separated by + * vertical bar signs (`|') + * as used by the + * ParameterHandler classes. + */ static std::string get_output_format_names (); - /** - * Provide a function which tells us which - * suffix a file with a given output format - * usually has. At present the following - * formats are defined: - *
    - *
  • dx: .dx - *
  • ucd: .inp - *
  • gnuplot: .gnuplot - *
  • povray: .pov - *
  • eps: .eps - *
  • gmv: .gmv - *
  • tecplot: .dat - *
  • tecplot_binary: .plt - *
  • vtk: .vtk - *
  • vtu: .vtu - *
  • deal_II_intermediate: .d2. - *
- */ + /** + * Provide a function which tells us which + * suffix a file with a given output format + * usually has. At present the following + * formats are defined: + *
    + *
  • dx: .dx + *
  • ucd: .inp + *
  • gnuplot: .gnuplot + *
  • povray: .pov + *
  • eps: .eps + *
  • gmv: .gmv + *
  • tecplot: .dat + *
  • tecplot_binary: .plt + *
  • vtk: .vtk + *
  • vtu: .vtu + *
  • deal_II_intermediate: .d2. + *
+ */ static std::string default_suffix (const OutputFormat output_format); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ static std::size_t memory_consumption (); - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ - /** - * Exception - */ + /** + * Exception + */ DeclException2 (ExcInvalidDatasetSize, - int, int, - << "The number of points in this data set is " << arg1 - << ", but we expected " << arg2 << " in each space direction."); - /** - * An output function did not - * receive any patches for - * writing. - */ + int, int, + << "The number of points in this data set is " << arg1 + << ", but we expected " << arg2 << " in each space direction."); + /** + * An output function did not + * receive any patches for + * writing. + */ DeclException0 (ExcNoPatches); - /** - * Exception - */ + /** + * Exception + */ DeclException0 (ExcTecplotAPIError); - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcErrorOpeningTecplotFile, - char*, - << "There was an error opening Tecplot file " << arg1 - << " for output"); + char*, + << "There was an error opening Tecplot file " << arg1 + << " for output"); - //@} + //@} private: - /** - * Write the coordinates of nodes - * in the desired format. - */ + /** + * Write the coordinates of nodes + * in the desired format. + */ template static void write_nodes (const std::vector >& patches, - STREAM& out); + STREAM& out); - /** - * Write the node numbers of a - * cell in the desired format. - */ + /** + * Write the node numbers of a + * cell in the desired format. + */ template static void write_cells (const std::vector >& patches, - STREAM& out); + STREAM& out); - /** - * Write data in the desired - * format. - */ + /** + * Write data in the desired + * format. + */ template static void write_data (const std::vector >& patches, - const unsigned int n_data_sets, - const bool double_precision, - STREAM& out); - - /** - * Class holding the data of one - * cell of a patch in two space - * dimensions for output. It is - * the projection of a cell in - * three-dimensional space (two - * coordinates, one height value) - * to the direction of sight. - */ + const unsigned int n_data_sets, + const bool double_precision, + STREAM& out); + + /** + * Class holding the data of one + * cell of a patch in two space + * dimensions for output. It is + * the projection of a cell in + * three-dimensional space (two + * coordinates, one height value) + * to the direction of sight. + */ class EpsCell2d { public: - /** - * Vector of vertices of this cell. - */ - Point<2> vertices[4]; - - /** - * Data value from which the actual - * colors will be computed by - * the colorization function stated - * in the EpsFlags class. - */ - float color_value; - - /** - * Depth into the picture, which - * is defined as the distance from - * an observer at an the origin in - * direction of the line of sight. - */ - float depth; - - /** - * Comparison operator for - * sorting. - */ - bool operator < (const EpsCell2d &) const; + /** + * Vector of vertices of this cell. + */ + Point<2> vertices[4]; + + /** + * Data value from which the actual + * colors will be computed by + * the colorization function stated + * in the EpsFlags class. + */ + float color_value; + + /** + * Depth into the picture, which + * is defined as the distance from + * an observer at an the origin in + * direction of the line of sight. + */ + float depth; + + /** + * Comparison operator for + * sorting. + */ + bool operator < (const EpsCell2d &) const; }; - /** - * This is a helper function for - * the write_gmv - * function. There, the data in - * the patches needs to be copied - * around as output is one - * variable globally at a time, - * rather than all data on each - * vertex at a time. This copying - * around can be done detached - * from the main thread, and is - * thus moved into this separate - * function. - * - * Note that because of the - * similarity of the formats, - * this function is also used by - * the Vtk and Tecplot output - * functions. - */ + /** + * This is a helper function for + * the write_gmv + * function. There, the data in + * the patches needs to be copied + * around as output is one + * variable globally at a time, + * rather than all data on each + * vertex at a time. This copying + * around can be done detached + * from the main thread, and is + * thus moved into this separate + * function. + * + * Note that because of the + * similarity of the formats, + * this function is also used by + * the Vtk and Tecplot output + * functions. + */ template static void write_gmv_reorder_data_vectors (const std::vector > &patches, - Table<2,double> &data_vectors); + Table<2,double> &data_vectors); @@ -2176,9 +2176,9 @@ class DataOutInterface : private DataOutBase using DataOutBase::get_output_format_names; using DataOutBase::determine_intermediate_format_dimensions; - /** - * Constructor. - */ + /** + * Constructor. + */ DataOutInterface (); /** @@ -2188,525 +2188,525 @@ class DataOutInterface : private DataOutBase */ virtual ~DataOutInterface (); - /** - * Obtain data through get_patches() - * and write it to out - * in OpenDX format. See - * DataOutBase::write_dx. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in OpenDX format. See + * DataOutBase::write_dx. + */ void write_dx (std::ostream &out) const; - /** - * Obtain data through get_patches() - * and write it to out - * in EPS format. See - * DataOutBase::write_eps. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in EPS format. See + * DataOutBase::write_eps. + */ void write_eps (std::ostream &out) const; - /** - * Obtain data through get_patches() - * and write it to out - * in GMV format. See - * DataOutBase::write_gmv. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in GMV format. See + * DataOutBase::write_gmv. + */ void write_gmv (std::ostream &out) const; - /** - * Obtain data through get_patches() - * and write it to out - * in GNUPLOT format. See - * DataOutBase::write_gnuplot. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in GNUPLOT format. See + * DataOutBase::write_gnuplot. + */ void write_gnuplot (std::ostream &out) const; - /** - * Obtain data through get_patches() - * and write it to out - * in POVRAY format. See - * DataOutBase::write_povray. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in POVRAY format. See + * DataOutBase::write_povray. + */ void write_povray (std::ostream &out) const; - /** - * Obtain data through get_patches() - * and write it to out - * in Tecplot format. See - * DataOutBase::write_tecplot. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in Tecplot format. See + * DataOutBase::write_tecplot. + */ void write_tecplot (std::ostream &out) const; - /** - * Obtain data through - * get_patches() and write it in - * the Tecplot binary output - * format. Note that the name of - * the output file must be - * specified through the - * TecplotFlags interface. - */ + /** + * Obtain data through + * get_patches() and write it in + * the Tecplot binary output + * format. Note that the name of + * the output file must be + * specified through the + * TecplotFlags interface. + */ void write_tecplot_binary (std::ostream &out) const; - /** - * Obtain data through - * get_patches() and write it to - * out in UCD format for - * AVS. See - * DataOutBase::write_ucd. - */ + /** + * Obtain data through + * get_patches() and write it to + * out in UCD format for + * AVS. See + * DataOutBase::write_ucd. + */ void write_ucd (std::ostream &out) const; - /** - * Obtain data through get_patches() - * and write it to out - * in Vtk format. See - * DataOutBase::write_vtk. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in Vtk format. See + * DataOutBase::write_vtk. + */ void write_vtk (std::ostream &out) const; - /** - * Obtain data through get_patches() - * and write it to out - * in Vtu (VTK's XML) format. See - * DataOutBase::write_vtu. - * - * Some visualization programs, - * such as ParaView, can read - * several separate VTU files to - * parallelize visualization. In - * that case, you need a - * .pvtu file that - * describes which VTU files form - * a group. The - * DataOutInterface::write_pvtu_record() - * function can generate such a - * master record. Likewise, - * DataOutInterface::write_visit_record() - * does the same for VisIt. - */ + /** + * Obtain data through get_patches() + * and write it to out + * in Vtu (VTK's XML) format. See + * DataOutBase::write_vtu. + * + * Some visualization programs, + * such as ParaView, can read + * several separate VTU files to + * parallelize visualization. In + * that case, you need a + * .pvtu file that + * describes which VTU files form + * a group. The + * DataOutInterface::write_pvtu_record() + * function can generate such a + * master record. Likewise, + * DataOutInterface::write_visit_record() + * does the same for VisIt. + */ void write_vtu (std::ostream &out) const; /** * Collective MPI call to write the - * solution from all participating nodes - * (those in the given communicator) to a - * single compressed .vtu file on a - * shared file system. The communicator - * can be a sub communicator of the one - * used by the computation. This routine - * uses MPI I/O to achieve high - * performance on parallel filesystems. - * Also see - * DataOutInterface::write_vtu(). + * solution from all participating nodes + * (those in the given communicator) to a + * single compressed .vtu file on a + * shared file system. The communicator + * can be a sub communicator of the one + * used by the computation. This routine + * uses MPI I/O to achieve high + * performance on parallel filesystems. + * Also see + * DataOutInterface::write_vtu(). */ void write_vtu_in_parallel (const char* filename, MPI_Comm comm) const; - /** - * Some visualization programs, such as - * ParaView, can read several separate - * VTU files to parallelize - * visualization. In that case, you need - * a .pvtu file that - * describes which VTU files (written, - * for example, through the write_vtu() - * function) form a group. The current - * function can generate such a master - * record. - * - * The file so written contains a list of - * (scalar or vector) fields whose values - * are described by the individual files - * that comprise the set of parallel VTU - * files along with the names of these - * files. This function gets the names - * and types of fields through the - * get_patches() function of this class - * like all the other write_xxx() - * functions. The second argument to this - * function specifies the names of the - * files that form the parallel set. - * - * @note See DataOutBase::write_vtu for - * writing each piece. Also note that - * only one parallel process needs to - * call the current function, listing the - * names of the files written by all - * parallel processes. - * - * @note The use of this function is - * explained in step-40. - * - * @note At the time of writing, - * the other big VTK-based - * visualization program, VisIt, - * can not read pvtu - * records. However, it can read - * visit records as written by - * the write_visit_record() - * function. - */ + /** + * Some visualization programs, such as + * ParaView, can read several separate + * VTU files to parallelize + * visualization. In that case, you need + * a .pvtu file that + * describes which VTU files (written, + * for example, through the write_vtu() + * function) form a group. The current + * function can generate such a master + * record. + * + * The file so written contains a list of + * (scalar or vector) fields whose values + * are described by the individual files + * that comprise the set of parallel VTU + * files along with the names of these + * files. This function gets the names + * and types of fields through the + * get_patches() function of this class + * like all the other write_xxx() + * functions. The second argument to this + * function specifies the names of the + * files that form the parallel set. + * + * @note See DataOutBase::write_vtu for + * writing each piece. Also note that + * only one parallel process needs to + * call the current function, listing the + * names of the files written by all + * parallel processes. + * + * @note The use of this function is + * explained in step-40. + * + * @note At the time of writing, + * the other big VTK-based + * visualization program, VisIt, + * can not read pvtu + * records. However, it can read + * visit records as written by + * the write_visit_record() + * function. + */ void write_pvtu_record (std::ostream &out, - const std::vector &piece_names) const; - - /** - * This function is the exact - * equivalent of the - * write_pvtu_record() function - * but for the VisIt - * visualization program. See - * there for the purpose of this - * function. - * - * This function is documented - * in the "Creating a master file - * for parallel" section (section 5.7) - * of the "Getting data into VisIt" - * report that can be found here: - * https://wci.llnl.gov/codes/visit/2.0.0/GettingDataIntoVisIt2.0.0.pdf - */ + const std::vector &piece_names) const; + + /** + * This function is the exact + * equivalent of the + * write_pvtu_record() function + * but for the VisIt + * visualization program. See + * there for the purpose of this + * function. + * + * This function is documented + * in the "Creating a master file + * for parallel" section (section 5.7) + * of the "Getting data into VisIt" + * report that can be found here: + * https://wci.llnl.gov/codes/visit/2.0.0/GettingDataIntoVisIt2.0.0.pdf + */ void write_visit_record (std::ostream &out, - const std::vector &piece_names) const; - - /** - * Obtain data through get_patches() - * and write it to out - * in deal.II intermediate - * format. See - * DataOutBase::write_deal_II_intermediate. - * - * Note that the intermediate - * format is what its name - * suggests: a direct - * representation of internal - * data. It isn't standardized - * and will change whenever we - * change our internal - * representation. You can only - * expect to process files - * written in this format using - * the same version of deal.II - * that was used for writing. - */ + const std::vector &piece_names) const; + + /** + * Obtain data through get_patches() + * and write it to out + * in deal.II intermediate + * format. See + * DataOutBase::write_deal_II_intermediate. + * + * Note that the intermediate + * format is what its name + * suggests: a direct + * representation of internal + * data. It isn't standardized + * and will change whenever we + * change our internal + * representation. You can only + * expect to process files + * written in this format using + * the same version of deal.II + * that was used for writing. + */ void write_deal_II_intermediate (std::ostream &out) const; - /** - * Write data and grid to out - * according to the given data - * format. This function simply - * calls the appropriate - * write_* function. If no - * output format is requested, - * the default_format is - * written. - * - * An error occurs if no format - * is provided and the default - * format is default_format. - */ + /** + * Write data and grid to out + * according to the given data + * format. This function simply + * calls the appropriate + * write_* function. If no + * output format is requested, + * the default_format is + * written. + * + * An error occurs if no format + * is provided and the default + * format is default_format. + */ void write (std::ostream &out, - const OutputFormat output_format = default_format) const; - - /** - * Set the default format. The - * value set here is used - * anytime, output for format - * default_format is - * requested. - */ + const OutputFormat output_format = default_format) const; + + /** + * Set the default format. The + * value set here is used + * anytime, output for format + * default_format is + * requested. + */ void set_default_format (const OutputFormat default_format); - /** - * Set the flags to be used for - * output in OpenDX format. - */ + /** + * Set the flags to be used for + * output in OpenDX format. + */ void set_flags (const DXFlags &dx_flags); - /** - * Set the flags to be used for - * output in UCD format. - */ + /** + * Set the flags to be used for + * output in UCD format. + */ void set_flags (const UcdFlags &ucd_flags); - /** - * Set the flags to be used for - * output in GNUPLOT format. - */ + /** + * Set the flags to be used for + * output in GNUPLOT format. + */ void set_flags (const GnuplotFlags &gnuplot_flags); - /** - * Set the flags to be used for - * output in POVRAY format. - */ + /** + * Set the flags to be used for + * output in POVRAY format. + */ void set_flags (const PovrayFlags &povray_flags); - /** - * Set the flags to be used for - * output in EPS output. - */ + /** + * Set the flags to be used for + * output in EPS output. + */ void set_flags (const EpsFlags &eps_flags); - /** - * Set the flags to be used for - * output in GMV format. - */ + /** + * Set the flags to be used for + * output in GMV format. + */ void set_flags (const GmvFlags &gmv_flags); - /** - * Set the flags to be used for - * output in Tecplot format. - */ + /** + * Set the flags to be used for + * output in Tecplot format. + */ void set_flags (const TecplotFlags &tecplot_flags); - /** - * Set the flags to be used for - * output in VTK format. - */ + /** + * Set the flags to be used for + * output in VTK format. + */ void set_flags (const VtkFlags &vtk_flags); - /** - * Set the flags to be used for output in - * deal.II intermediate format. - */ + /** + * Set the flags to be used for output in + * deal.II intermediate format. + */ void set_flags (const Deal_II_IntermediateFlags &deal_II_intermediate_flags); - /** - * A function that returns the same - * string as the respective function in - * the base class does; the only - * exception being that if the parameter - * is omitted, then the value for the - * present default format is returned, - * i.e. the correct suffix for the format - * that was set through - * set_default_format() or - * parse_parameters() before calling this - * function. - */ + /** + * A function that returns the same + * string as the respective function in + * the base class does; the only + * exception being that if the parameter + * is omitted, then the value for the + * present default format is returned, + * i.e. the correct suffix for the format + * that was set through + * set_default_format() or + * parse_parameters() before calling this + * function. + */ std::string default_suffix (const OutputFormat output_format = default_format) const; - /** - * Declare parameters for all - * output formats by declaring - * subsections within the - * parameter file for each output - * format and call the respective - * declare_parameters - * functions of the flag classes - * for each output format. - * - * Some of the declared - * subsections may not contain - * entries, if the respective - * format does not export any - * flags. - * - * Note that the top-level - * parameters denoting the number - * of subdivisions per patch and - * the output format are not - * declared, since they are only - * passed to virtual functions - * and are not stored inside - * objects of this type. You have - * to declare them yourself. - */ + /** + * Declare parameters for all + * output formats by declaring + * subsections within the + * parameter file for each output + * format and call the respective + * declare_parameters + * functions of the flag classes + * for each output format. + * + * Some of the declared + * subsections may not contain + * entries, if the respective + * format does not export any + * flags. + * + * Note that the top-level + * parameters denoting the number + * of subdivisions per patch and + * the output format are not + * declared, since they are only + * passed to virtual functions + * and are not stored inside + * objects of this type. You have + * to declare them yourself. + */ static void declare_parameters (ParameterHandler &prm); - /** - * Read the parameters declared - * in declare_parameters and - * set the flags for the output - * formats accordingly. - * - * The flags thus obtained - * overwrite all previous - * contents of the flag objects - * as default-constructed or set - * by the set_flags() function. - */ + /** + * Read the parameters declared + * in declare_parameters and + * set the flags for the output + * formats accordingly. + * + * The flags thus obtained + * overwrite all previous + * contents of the flag objects + * as default-constructed or set + * by the set_flags() function. + */ void parse_parameters (ParameterHandler &prm); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ std::size_t memory_consumption () const; protected: - /** - * This is the abstract function - * through which derived classes - * propagate preprocessed data in - * the form of Patch - * structures (declared in the - * base class DataOutBase) to - * the actual output - * function. You need to overload - * this function to allow the - * output functions to know what - * they shall print. - */ + /** + * This is the abstract function + * through which derived classes + * propagate preprocessed data in + * the form of Patch + * structures (declared in the + * base class DataOutBase) to + * the actual output + * function. You need to overload + * this function to allow the + * output functions to know what + * they shall print. + */ virtual const std::vector > & get_patches () const = 0; - /** - * Abstract virtual function - * through which the names of - * data sets are obtained by the - * output functions of the base - * class. - */ + /** + * Abstract virtual function + * through which the names of + * data sets are obtained by the + * output functions of the base + * class. + */ virtual std::vector get_dataset_names () const = 0; - /** - * This functions returns - * information about how the - * individual components of - * output files that consist of - * more than one data set are to - * be interpreted. - * - * It returns a list of index - * pairs and corresponding name - * indicating which components of - * the output are to be - * considered vector-valued - * rather than just a collection - * of scalar data. The index - * pairs are inclusive; for - * example, if we have a Stokes - * problem in 2d with components - * (u,v,p), then the - * corresponding vector data - * range should be (0,1), and the - * returned list would consist of - * only a single element with a - * tuple such as (0,1,"velocity"). - * - * Since some of the derived - * classes do not know about - * vector data, this function has - * a default implementation that - * simply returns an empty - * string, meaning that all data - * is to be considered a - * collection of scalar fields. - */ + /** + * This functions returns + * information about how the + * individual components of + * output files that consist of + * more than one data set are to + * be interpreted. + * + * It returns a list of index + * pairs and corresponding name + * indicating which components of + * the output are to be + * considered vector-valued + * rather than just a collection + * of scalar data. The index + * pairs are inclusive; for + * example, if we have a Stokes + * problem in 2d with components + * (u,v,p), then the + * corresponding vector data + * range should be (0,1), and the + * returned list would consist of + * only a single element with a + * tuple such as (0,1,"velocity"). + * + * Since some of the derived + * classes do not know about + * vector data, this function has + * a default implementation that + * simply returns an empty + * string, meaning that all data + * is to be considered a + * collection of scalar fields. + */ virtual std::vector > get_vector_data_ranges () const; - /** - * The default number of - * subdivisions for patches. This - * is filled by parse_parameters() - * and should be obeyed by - * build_patches() in derived - * classes. - */ + /** + * The default number of + * subdivisions for patches. This + * is filled by parse_parameters() + * and should be obeyed by + * build_patches() in derived + * classes. + */ unsigned int default_subdivisions; private: - /** - * Standard output format. Use - * this format, if output format - * default_format is - * requested. It can be changed - * by the set_format function - * or in a parameter file. - */ + /** + * Standard output format. Use + * this format, if output format + * default_format is + * requested. It can be changed + * by the set_format function + * or in a parameter file. + */ OutputFormat default_fmt; - /** - * Flags to be used upon output - * of OpenDX data. Can be changed by - * using the set_flags - * function. - */ + /** + * Flags to be used upon output + * of OpenDX data. Can be changed by + * using the set_flags + * function. + */ DXFlags dx_flags; - /** - * Flags to be used upon output - * of UCD data. Can be changed by - * using the set_flags - * function. - */ + /** + * Flags to be used upon output + * of UCD data. Can be changed by + * using the set_flags + * function. + */ UcdFlags ucd_flags; - /** - * Flags to be used upon output - * of GNUPLOT data. Can be - * changed by using the - * set_flags function. - */ + /** + * Flags to be used upon output + * of GNUPLOT data. Can be + * changed by using the + * set_flags function. + */ GnuplotFlags gnuplot_flags; - /** - * Flags to be used upon output - * of POVRAY data. Can be changed - * by using the set_flags - * function. - */ + /** + * Flags to be used upon output + * of POVRAY data. Can be changed + * by using the set_flags + * function. + */ PovrayFlags povray_flags; - /** - * Flags to be used upon output - * of EPS data in one space - * dimension. Can be changed by - * using the set_flags - * function. - */ + /** + * Flags to be used upon output + * of EPS data in one space + * dimension. Can be changed by + * using the set_flags + * function. + */ EpsFlags eps_flags; - /** - * Flags to be used upon output - * of gmv data in one space - * dimension. Can be changed by - * using the set_flags - * function. - */ + /** + * Flags to be used upon output + * of gmv data in one space + * dimension. Can be changed by + * using the set_flags + * function. + */ GmvFlags gmv_flags; - /** - * Flags to be used upon output - * of Tecplot data in one space - * dimension. Can be changed by - * using the set_flags - * function. - */ + /** + * Flags to be used upon output + * of Tecplot data in one space + * dimension. Can be changed by + * using the set_flags + * function. + */ TecplotFlags tecplot_flags; - /** - * Flags to be used upon output - * of vtk data in one space - * dimension. Can be changed by - * using the set_flags - * function. - */ + /** + * Flags to be used upon output + * of vtk data in one space + * dimension. Can be changed by + * using the set_flags + * function. + */ VtkFlags vtk_flags; - /** - * Flags to be used upon output of - * deal.II intermediate data in one space - * dimension. Can be changed by using the - * set_flags function. - */ + /** + * Flags to be used upon output of + * deal.II intermediate data in one space + * dimension. Can be changed by using the + * set_flags function. + */ Deal_II_IntermediateFlags deal_II_intermediate_flags; }; @@ -2766,14 +2766,14 @@ template class DataOutReader : public DataOutInterface { public: - /** - * Read a sequence of patches as - * written previously by - * DataOutBase::write_deal_II_intermediate - * and store them in the present - * object. This overwrites any - * previous content. - */ + /** + * Read a sequence of patches as + * written previously by + * DataOutBase::write_deal_II_intermediate + * and store them in the present + * object. This overwrites any + * previous content. + */ void read (std::istream &in); /** @@ -2813,14 +2813,14 @@ class DataOutReader : public DataOutInterface * patches, the previous state is * overwritten, and the merged-in * patches are lost. - * + * * This function will fail if * either this or the other * object did not yet set up any * patches. - * - * The use of this function is - * demonstrated in step-19. + * + * The use of this function is + * demonstrated in step-19. */ void merge (const DataOutReader &other); @@ -2836,102 +2836,102 @@ class DataOutReader : public DataOutInterface * Exception */ DeclException0 (ExcIncompatiblePatchLists); - /** - * Exception - */ + /** + * Exception + */ DeclException4 (ExcIncompatibleDimensions, - int, int, int, int, - << "Either the dimensions <" << arg1 << "> and <" - << arg2 << "> or the space dimensions <" - << arg3 << "> and <" << arg4 - << "> do not match!"); + int, int, int, int, + << "Either the dimensions <" << arg1 << "> and <" + << arg2 << "> or the space dimensions <" + << arg3 << "> and <" << arg4 + << "> do not match!"); protected: - /** - * This is the function - * through which this class - * propagates preprocessed data in - * the form of Patch - * structures (declared in the - * base class DataOutBase) to - * the actual output - * function. - * - * It returns the patches as read - * the last time a stream was - * given to the read() function. - */ + /** + * This is the function + * through which this class + * propagates preprocessed data in + * the form of Patch + * structures (declared in the + * base class DataOutBase) to + * the actual output + * function. + * + * It returns the patches as read + * the last time a stream was + * given to the read() function. + */ virtual const std::vector > & get_patches () const; - /** - * Abstract virtual function - * through which the names of - * data sets are obtained by the - * output functions of the base - * class. - * - * Return the names of the - * variables as read the last - * time we read a file. - */ + /** + * Abstract virtual function + * through which the names of + * data sets are obtained by the + * output functions of the base + * class. + * + * Return the names of the + * variables as read the last + * time we read a file. + */ virtual std::vector get_dataset_names () const; - /** - * This functions returns - * information about how the - * individual components of - * output files that consist of - * more than one data set are to - * be interpreted. - * - * It returns a list of index - * pairs and corresponding name - * indicating which components of - * the output are to be - * considered vector-valued - * rather than just a collection - * of scalar data. The index - * pairs are inclusive; for - * example, if we have a Stokes - * problem in 2d with components - * (u,v,p), then the - * corresponding vector data - * range should be (0,1), and the - * returned list would consist of - * only a single element with a - * tuple such as (0,1,"velocity"). - * - * Since some of the derived - * classes do not know about - * vector data, this function has - * a default implementation that - * simply returns an empty - * string, meaning that all data - * is to be considered a - * collection of scalar fields. - */ + /** + * This functions returns + * information about how the + * individual components of + * output files that consist of + * more than one data set are to + * be interpreted. + * + * It returns a list of index + * pairs and corresponding name + * indicating which components of + * the output are to be + * considered vector-valued + * rather than just a collection + * of scalar data. The index + * pairs are inclusive; for + * example, if we have a Stokes + * problem in 2d with components + * (u,v,p), then the + * corresponding vector data + * range should be (0,1), and the + * returned list would consist of + * only a single element with a + * tuple such as (0,1,"velocity"). + * + * Since some of the derived + * classes do not know about + * vector data, this function has + * a default implementation that + * simply returns an empty + * string, meaning that all data + * is to be considered a + * collection of scalar fields. + */ virtual std::vector > get_vector_data_ranges () const; private: - /** - * Arrays holding the set of - * patches as well as the names - * of output variables, all of - * which we read from an input - * stream. - */ + /** + * Arrays holding the set of + * patches as well as the names + * of output variables, all of + * which we read from an input + * stream. + */ std::vector > patches; std::vector dataset_names; - /** - * Information about whether - * certain components of the - * output field are to be - * considered vectors. - */ + /** + * Information about whether + * certain components of the + * output field are to be + * considered vectors. + */ std::vector > vector_data_ranges; }; @@ -2963,7 +2963,7 @@ DataOutBase::EpsFlags::RgbValues::is_grey () const template std::ostream & operator << (std::ostream &out, - const DataOutBase::Patch &patch); + const DataOutBase::Patch &patch); @@ -2978,7 +2978,7 @@ operator << (std::ostream &out, template std::istream & operator >> (std::istream &in, - DataOutBase::Patch &patch); + DataOutBase::Patch &patch); diff --git a/deal.II/include/deal.II/base/derivative_form.h b/deal.II/include/deal.II/base/derivative_form.h index d203440d40..6c239901dd 100644 --- a/deal.II/include/deal.II/base/derivative_form.h +++ b/deal.II/include/deal.II/base/derivative_form.h @@ -28,92 +28,92 @@ template class DerivativeForm { public: - /** - * Constructor. Initialize all entries - * to zero. - */ + /** + * Constructor. Initialize all entries + * to zero. + */ DerivativeForm (); - /** - Constructor from a second order tensor. - */ + /** + Constructor from a second order tensor. + */ DerivativeForm (const Tensor<2,dim> &); - /** - * Read-Write access operator. - */ + /** + * Read-Write access operator. + */ Tensor &operator [] (const unsigned int i); - /** - * Read-only access operator. - */ + /** + * Read-only access operator. + */ const Tensor &operator [] (const unsigned int i) const; - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ DerivativeForm & operator = (const DerivativeForm &); - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ DerivativeForm & operator = (const Tensor<2,dim> &); - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ DerivativeForm & operator = (const Tensor<1,dim> &); - /** - Converts a DerivativeForm <1,dim, dim> - to Tensor<2,dim>. - If the derivative is the Jacobian of F, - then Tensor[i] = grad(F^i). - */ + /** + Converts a DerivativeForm <1,dim, dim> + to Tensor<2,dim>. + If the derivative is the Jacobian of F, + then Tensor[i] = grad(F^i). + */ operator Tensor<2,dim>() const; - /** - Converts a DerivativeForm <1, dim, 1> - to Tensor<1,dim>. - */ + /** + Converts a DerivativeForm <1, dim, 1> + to Tensor<1,dim>. + */ operator Tensor<1,dim>() const; - /** - Return the transpose of a rectangular DerivativeForm, - that is to say viewed as a two dimensional matrix. - */ + /** + Return the transpose of a rectangular DerivativeForm, + that is to say viewed as a two dimensional matrix. + */ DerivativeForm<1, spacedim, dim> transpose () const; - /** - Computes the volume element associated with the - jacobian of the tranformation F. - That is to say if $DF$ is square, it computes - $\det(DF)$, in case DF is not square returns - $\sqrt(\det(DF^{t} * DF))$. - */ + /** + Computes the volume element associated with the + jacobian of the tranformation F. + That is to say if $DF$ is square, it computes + $\det(DF)$, in case DF is not square returns + $\sqrt(\det(DF^{t} * DF))$. + */ double determinant () const; - /** - Assuming (*this) stores the jacobian of - the mapping F, it computes its covariant - matrix, namely $DF*G^{-1}$, where - $G = DF^{t}*DF$. - If $DF$ is square, covariant from - gives $DF^{-t}$. - */ + /** + Assuming (*this) stores the jacobian of + the mapping F, it computes its covariant + matrix, namely $DF*G^{-1}$, where + $G = DF^{t}*DF$. + If $DF$ is square, covariant from + gives $DF^{-t}$. + */ DerivativeForm<1, dim, spacedim> covariant_form() const; - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ + /** + * Determine an estimate for the + * memory consumption (in bytes) + * of this object. + */ static std::size_t memory_consumption (); /** @@ -121,20 +121,20 @@ class DerivativeForm */ DeclException1 (ExcInvalidTensorIndex, int, - << "Invalid DerivativeForm index " << arg1); + << "Invalid DerivativeForm index " << arg1); private: - /** Auxiliary function that computes - (*this) * T^{t} */ + /** Auxiliary function that computes + (*this) * T^{t} */ DerivativeForm<1, dim, spacedim> times_T_t (Tensor<2,dim> T) const; private: - /** - * Array of tensors holding the - * subelements. - */ + /** + * Array of tensors holding the + * subelements. + */ Tensor tensor[spacedim]; @@ -164,7 +164,7 @@ inline DerivativeForm::DerivativeForm(const Tensor<2,dim> &T) { Assert( (dim == spacedim) && (order==1), - ExcMessage("Only allowed for square tensors.")); + ExcMessage("Only allowed for square tensors.")); for (unsigned int j=0; j & DerivativeForm:: operator = (const Tensor<2,dim> &ta) { Assert( (dim == spacedim) && (order==1), - ExcMessage("Only allowed for square tensors.")); + ExcMessage("Only allowed for square tensors.")); for (unsigned int j=0; j & DerivativeForm:: operator = (const Tensor<1,dim> &T) { Assert( (1 == spacedim) && (order==1), - ExcMessage("Only allowed for spacedim==1 and order==1.")); + ExcMessage("Only allowed for spacedim==1 and order==1.")); (*this)[0] = T; @@ -246,7 +246,7 @@ inline DerivativeForm::operator Tensor<1,dim>() const { Assert( (1 == spacedim) && (order==1), - ExcMessage("Only allowed for spacedim==1.")); + ExcMessage("Only allowed for spacedim==1.")); return (*this)[0]; @@ -259,7 +259,7 @@ inline DerivativeForm::operator Tensor<2,dim>() const { Assert( (dim == spacedim) && (order==1), - ExcMessage("Only allowed for square tensors.")); + ExcMessage("Only allowed for square tensors.")); Tensor<2,dim> t; @@ -322,8 +322,8 @@ DerivativeForm::determinant () const DerivativeForm<1,spacedim,dim> DF_t = this->transpose(); Tensor<2, dim> G; //First fundamental form for (unsigned int i=0; i::covariant_form() const DerivativeForm<1,spacedim,dim> DF_t = this->transpose(); Tensor<2, dim> G; //First fundamental form for (unsigned int i=0; itimes_T_t(invert(G))); @@ -390,7 +390,7 @@ template inline Tensor<1, spacedim> apply_transformation (const DerivativeForm<1,dim,spacedim> &DF, - const Tensor<1,dim> &T) + const Tensor<1,dim> &T) { Tensor<1, spacedim> dest; for (unsigned int i=0; i inline DerivativeForm<1, spacedim, dim> apply_transformation (const DerivativeForm<1,dim,spacedim> &DF, - const Tensor<2,dim> &T) + const Tensor<2,dim> &T) { DerivativeForm<1, spacedim, dim> dest; @@ -431,7 +431,7 @@ template inline Tensor<2, spacedim> apply_transformation (const DerivativeForm<1,dim,spacedim> &DF1, - const DerivativeForm<1,dim,spacedim> &DF2) + const DerivativeForm<1,dim,spacedim> &DF2) { Tensor<2, spacedim> dest; diff --git a/deal.II/include/deal.II/base/event.h b/deal.II/include/deal.II/base/event.h index 5dcba7beb7..33ac960098 100644 --- a/deal.II/include/deal.II/base/event.h +++ b/deal.II/include/deal.II/base/event.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -44,93 +44,93 @@ namespace Algorithms class Event { public: - /** - * This function registers a - * new event type and assigns a - * unique identifier to it. The - * result of this function - * should be stored for later - * use. - */ + /** + * This function registers a + * new event type and assigns a + * unique identifier to it. The + * result of this function + * should be stored for later + * use. + */ static Event assign (const char* name); - /** - * If you forgot to store the - * result of assign, here is - * how to retrieve it knowing - * the name. - */ + /** + * If you forgot to store the + * result of assign, here is + * how to retrieve it knowing + * the name. + */ // static Event find(const std::string& name); - /** - * Constructor, generating a - * clear Event. - */ + /** + * Constructor, generating a + * clear Event. + */ Event (); - /** - * Clear all flags - */ + /** + * Clear all flags + */ void clear(); - /** - * Set all flags - */ + /** + * Set all flags + */ void all(); - /** - * Add the flags of the other event - */ + /** + * Add the flags of the other event + */ Event& operator += (const Event& event); - /** - * Clear the flags of the other event - */ + /** + * Clear the flags of the other event + */ Event& operator -= (const Event& event); - /** - * Test whether all the flags - * set in the other Event are - * also set in this one. - */ + /** + * Test whether all the flags + * set in the other Event are + * also set in this one. + */ bool test (const Event& event) const; - /** - * Return true if any - * event is set. - */ + /** + * Return true if any + * event is set. + */ bool any () const; - /** - * List the flags to a stream. - */ + /** + * List the flags to a stream. + */ template void print (OS& os) const; - /** - * List all assigned events. - */ + /** + * List all assigned events. + */ template static void print_assigned (OS& os); private: - /** - * Sometimes, actions have to - * be taken by all - * means. Therefore, if this - * value is true, test() always - * returns true. - */ + /** + * Sometimes, actions have to + * be taken by all + * means. Therefore, if this + * value is true, test() always + * returns true. + */ bool all_true; - /** - * The actual list of events - */ + /** + * The actual list of events + */ std::vector flags; - /** - * The names of registered events - */ + /** + * The names of registered events + */ static std::vector names; }; @@ -139,29 +139,29 @@ namespace Algorithms */ namespace Events { - /** - * The program has just started - * and everything should be - * new. - */ + /** + * The program has just started + * and everything should be + * new. + */ extern const Event initial; - /** - * The current derivative leads - * to slow convergence of - * Newton's method. - */ + /** + * The current derivative leads + * to slow convergence of + * Newton's method. + */ extern const Event bad_derivative; - /** - * The time stepping scheme - * starts a new time step. - */ + /** + * The time stepping scheme + * starts a new time step. + */ extern const Event new_time; - /** - * The time stepping scheme has changed the time step size. - */ + /** + * The time stepping scheme has changed the time step size. + */ extern const Event new_timestep_size; } @@ -175,7 +175,7 @@ namespace Algorithms { if (all_true) return true; for (std::vector::const_iterator i=flags.begin(); - i != flags.end(); ++i) + i != flags.end(); ++i) if (*i) return true; return false; } @@ -186,41 +186,41 @@ namespace Algorithms Event::test (const Event& event) const { - // First, test all_true in this + // First, test all_true in this if (all_true) return true; const unsigned int n = flags.size(); const unsigned int m = event.flags.size(); const unsigned int n_min = std::min(n, m); - // Now, if all_true set in the - // other, then all must be true - // in this + // Now, if all_true set in the + // other, then all must be true + // in this if (event.all_true) { - // Non existing flags are - // always assumed false - if (m > n) - return false; - - // Test all flags separately - // and return false if one is - // not set - for (std::vector::const_iterator i=flags.begin(); - i != flags.end(); ++i) - if (!*i) return false; - // All flags are set - return true; + // Non existing flags are + // always assumed false + if (m > n) + return false; + + // Test all flags separately + // and return false if one is + // not set + for (std::vector::const_iterator i=flags.begin(); + i != flags.end(); ++i) + if (!*i) return false; + // All flags are set + return true; } - // Finally, compare each flag - // separately + // Finally, compare each flag + // separately for (unsigned int i=0;i::iterator i=flags.begin(); - i != flags.end(); ++i) - *i = false; - return *this; + for (std::vector::iterator i=flags.begin(); + i != flags.end(); ++i) + *i = false; + return *this; } if (flags.size() < event.flags.size()) @@ -274,7 +274,7 @@ namespace Algorithms for (unsigned int i=0;i OS& operator << (OS& o, const Event& e) { diff --git a/deal.II/include/deal.II/base/exceptions.h b/deal.II/include/deal.II/base/exceptions.h index 2b30fe54d8..86d8035aaf 100644 --- a/deal.II/include/deal.II/base/exceptions.h +++ b/deal.II/include/deal.II/base/exceptions.h @@ -48,129 +48,129 @@ DEAL_II_NAMESPACE_OPEN class ExceptionBase : public std::exception { public: - /** - * Default constructor. - */ + /** + * Default constructor. + */ ExceptionBase (); - /** - * The constructor takes the file in which the - * error happened, the line and the violated - * condition as well as the name of the - * exception class as a char* as arguments. - */ + /** + * The constructor takes the file in which the + * error happened, the line and the violated + * condition as well as the name of the + * exception class as a char* as arguments. + */ ExceptionBase (const char* f, const int l, const char *func, - const char* c, const char *e); + const char* c, const char *e); /** * Copy constructor. */ ExceptionBase (const ExceptionBase &exc); - /** - * Destructor. Empty, but needed - * for the sake of exception - * specification, since the base - * class has this exception - * specification and the - * automatically generated - * destructor would have a - * different one due to member - * objects. - */ + /** + * Destructor. Empty, but needed + * for the sake of exception + * specification, since the base + * class has this exception + * specification and the + * automatically generated + * destructor would have a + * different one due to member + * objects. + */ virtual ~ExceptionBase () throw(); - /** - * Set the file name and line of where the - * exception appeared as well as the violated - * condition and the name of the exception as - * a char pointer. - */ + /** + * Set the file name and line of where the + * exception appeared as well as the violated + * condition and the name of the exception as + * a char pointer. + */ void set_fields (const char *f, - const int l, - const char *func, - const char *c, - const char *e); - - /** - * Print out the general part of the error - * information. - */ + const int l, + const char *func, + const char *c, + const char *e); + + /** + * Print out the general part of the error + * information. + */ void print_exc_data (std::ostream &out) const; - /** - * Print more specific information about the - * exception which occured. Overload this - * function in your own exception classes. - */ + /** + * Print more specific information about the + * exception which occured. Overload this + * function in your own exception classes. + */ virtual void print_info (std::ostream &out) const; - /** - * Function derived from the base class - * which allows to pass information like - * the line and name of the file where the - * exception occured as well as user - * information. - * - * This function is mainly used - * when using exceptions - * declared by the - * DeclException* - * macros with the - * throw mechanism or - * the AssertThrow - * macro. - */ + /** + * Function derived from the base class + * which allows to pass information like + * the line and name of the file where the + * exception occured as well as user + * information. + * + * This function is mainly used + * when using exceptions + * declared by the + * DeclException* + * macros with the + * throw mechanism or + * the AssertThrow + * macro. + */ virtual const char * what () const throw (); - /** - * Print a stacktrace, if one has - * been recorded previously, to - * the given stream. - */ + /** + * Print a stacktrace, if one has + * been recorded previously, to + * the given stream. + */ void print_stack_trace (std::ostream &out) const; protected: - /** - * Name of the file this exception happen in. - */ + /** + * Name of the file this exception happen in. + */ const char *file; - /** - * Line number in this file. - */ + /** + * Line number in this file. + */ unsigned int line; - /** - * Name of the function, pretty printed. - */ + /** + * Name of the function, pretty printed. + */ const char *function; - /** - * The violated condition, as a string. - */ + /** + * The violated condition, as a string. + */ const char *cond; - /** - * Name of the exception and call sequence. - */ + /** + * Name of the exception and call sequence. + */ const char *exc; - /** - * A backtrace to the position - * where the problem happened, if - * the system supports this. - */ + /** + * A backtrace to the position + * where the problem happened, if + * the system supports this. + */ char ** stacktrace; - /** - * The number of stacktrace - * frames that are stored in the - * previous variable. Zero if the - * system does not support stack - * traces. - */ + /** + * The number of stacktrace + * frames that are stored in the + * previous variable. Zero if the + * system does not support stack + * traces. + */ int n_stacktrace_frames; }; @@ -186,75 +186,75 @@ class ExceptionBase : public std::exception namespace deal_II_exceptions { - /** - * Set a string that is printed - * upon output of the message - * indicating a triggered - * Assert statement. This - * string, which is printed in - * addition to the usual output may - * indicate information that is - * otherwise not readily available - * unless we are using a - * debugger. For example, with - * distributed programs on cluster - * computers, the output of all - * processes is redirected to the - * same console window. In this - * case, it is convenient to set as - * additional name the name of the - * host on which the program runs, - * so that one can see in which - * instance of the program the - * exception occured. - * - * The string pointed to by the - * argument is copied, so needs not - * be stored after the call to this - * function. - * - * Previously set additional output - * is replaced by the argument - * given to this function. - */ + /** + * Set a string that is printed + * upon output of the message + * indicating a triggered + * Assert statement. This + * string, which is printed in + * addition to the usual output may + * indicate information that is + * otherwise not readily available + * unless we are using a + * debugger. For example, with + * distributed programs on cluster + * computers, the output of all + * processes is redirected to the + * same console window. In this + * case, it is convenient to set as + * additional name the name of the + * host on which the program runs, + * so that one can see in which + * instance of the program the + * exception occured. + * + * The string pointed to by the + * argument is copied, so needs not + * be stored after the call to this + * function. + * + * Previously set additional output + * is replaced by the argument + * given to this function. + */ void set_additional_assert_output (const char * const p); - /** - * Calling this function disables - * printing a stacktrace along with - * the other output printed when an - * exception occurs. Most of the - * time, you will want to see such - * a stacktrace; suppressing it, - * however, is useful if one wants - * to compare the output of a - * program across different - * machines and systems, since the - * stacktrace shows memory - * addresses and library - * names/paths that depend on the - * exact setup of a machine. - */ + /** + * Calling this function disables + * printing a stacktrace along with + * the other output printed when an + * exception occurs. Most of the + * time, you will want to see such + * a stacktrace; suppressing it, + * however, is useful if one wants + * to compare the output of a + * program across different + * machines and systems, since the + * stacktrace shows memory + * addresses and library + * names/paths that depend on the + * exact setup of a machine. + */ void suppress_stacktrace_in_exceptions (); - /** - * Calling this function switches off - * the use of std::abort() when an - * exception is created using the - * Assert() macro. Generally, you - * want to abort the execution of a - * program when Assert() is called, + /** + * Calling this function switches off + * the use of std::abort() when an + * exception is created using the + * Assert() macro. Generally, you + * want to abort the execution of a + * program when Assert() is called, * but it needs to be switched off - * if you want to log all exceptions - * created, or if you want to test - * if an assertion is working - * correctly. This is done for example + * if you want to log all exceptions + * created, or if you want to test + * if an assertion is working + * correctly. This is done for example * in regression tests. * Please note that some fatal - * errors will still call abort(), e.g. + * errors will still call abort(), e.g. * when an exception is caught - * during exception handling - */ + * during exception handling + */ void disable_abort_on_exception (); /** @@ -276,11 +276,11 @@ namespace deal_II_exceptions * @ref ExceptionBase */ void issue_error_assert (const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - ExceptionBase &e); + int line, + const char *function, + const char *cond, + const char *exc_name, + ExceptionBase &e); /** @@ -292,14 +292,14 @@ namespace deal_II_exceptions */ template void issue_error_throw (const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e) + int line, + const char *function, + const char *cond, + const char *exc_name, + exc e) { - // Fill the fields of the - // exception object + // Fill the fields of the + // exception object e.set_fields (file, line, function, cond, exc_name); throw e; } @@ -318,11 +318,11 @@ namespace deal_II_exceptions template inline void issue_error_assert_1 (const char *file, - int line, - const char *function, - const char *cond, - const char *exc_name, - exc e) + int line, + const char *function, + const char *cond, + const char *exc_name, + exc e) { issue_error_assert (file,line,function,cond,exc_name,e); } @@ -358,10 +358,10 @@ namespace deal_II_exceptions #define Assert(cond, exc) \ { \ if (!(cond)) \ - ::dealii::deal_II_exceptions::internals:: \ + ::dealii::deal_II_exceptions::internals:: \ issue_error_assert_1 (__FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, #cond, #exc, exc);\ + __LINE__, \ + __PRETTY_FUNCTION__, #cond, #exc, exc);\ } @@ -399,26 +399,26 @@ namespace deal_II_exceptions # define AssertThrow(cond, exc) \ { \ if (!(cond)) \ - ::dealii::deal_II_exceptions::internals:: \ + ::dealii::deal_II_exceptions::internals:: \ issue_error_throw (__FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, #cond, #exc, exc); \ + __LINE__, \ + __PRETTY_FUNCTION__, #cond, #exc, exc); \ } # else // HAVE_BUILTIN_EXPECT # define AssertThrow(cond, exc) \ { \ if (__builtin_expect(!(cond), false)) \ - ::dealii::deal_II_exceptions::internals:: \ + ::dealii::deal_II_exceptions::internals:: \ issue_error_throw (__FILE__, \ - __LINE__, \ - __PRETTY_FUNCTION__, #cond, #exc, exc); \ + __LINE__, \ + __PRETTY_FUNCTION__, #cond, #exc, exc); \ } # endif #else # define AssertThrow(cond, exc) \ { \ if (!(cond)) \ - ::dealii::deal_II_exceptions::internals::abort (); \ + ::dealii::deal_II_exceptions::internals::abort (); \ } #endif @@ -464,7 +464,7 @@ class Exception1 : public dealii::ExceptionBase { \ class Exception2 : public dealii::ExceptionBase { \ public: \ Exception2 (const type1 a1, const type2 a2) : \ - arg1 (a1), arg2(a2) {} \ + arg1 (a1), arg2(a2) {} \ virtual ~Exception2 () throw () {} \ virtual void print_info (std::ostream &out) const { \ out outsequence << std::endl; \ @@ -485,7 +485,7 @@ class Exception2 : public dealii::ExceptionBase { \ class Exception3 : public dealii::ExceptionBase { \ public: \ Exception3 (const type1 a1, const type2 a2, const type3 a3) : \ - arg1 (a1), arg2(a2), arg3(a3) {} \ + arg1 (a1), arg2(a2), arg3(a3) {} \ virtual ~Exception3 () throw () {} \ virtual void print_info (std::ostream &out) const { \ out outsequence << std::endl; \ @@ -507,8 +507,8 @@ class Exception3 : public dealii::ExceptionBase { \ class Exception4 : public dealii::ExceptionBase { \ public: \ Exception4 (const type1 a1, const type2 a2, \ - const type3 a3, const type4 a4) : \ - arg1 (a1), arg2(a2), arg3(a3), arg4(a4) {} \ + const type3 a3, const type4 a4) : \ + arg1 (a1), arg2(a2), arg3(a3), arg4(a4) {} \ virtual ~Exception4 () throw () {} \ virtual void print_info (std::ostream &out) const { \ out outsequence << std::endl; \ @@ -531,8 +531,8 @@ class Exception4 : public dealii::ExceptionBase { \ class Exception5 : public dealii::ExceptionBase { \ public: \ Exception5 (const type1 a1, const type2 a2, const type3 a3, \ - const type4 a4, const type5 a5) : \ - arg1 (a1), arg2(a2), arg3(a3), arg4(a4), arg5(a5) {} \ + const type4 a4, const type5 a5) : \ + arg1 (a1), arg2(a2), arg3(a3), arg4(a4), arg5(a5) {} \ virtual ~Exception5 () throw () {} \ virtual void print_info (std::ostream &out) const { \ out outsequence << std::endl; \ @@ -621,163 +621,163 @@ class Exception5 : public dealii::ExceptionBase { \ */ namespace StandardExceptions { - /** - * @addtogroup Exceptions - */ - //@{ - - /** - * Exception denoting a division by - * zero. - * - * @note Unfortunately, automatic - * detection of division by zero is - * very hardware dependent and - * requires severe hacking on some - * architectures. Therefore, this - * exception is only raised if the - * test s performed explicitly. - */ + /** + * @addtogroup Exceptions + */ + //@{ + + /** + * Exception denoting a division by + * zero. + * + * @note Unfortunately, automatic + * detection of division by zero is + * very hardware dependent and + * requires severe hacking on some + * architectures. Therefore, this + * exception is only raised if the + * test s performed explicitly. + */ DeclException0 (ExcDivideByZero); - /** - * Exception raised if a number is - * not finite. - * - * This exception should be used to - * catch infinite or not a number - * results of arithmetic operations - * that do not result from a - * division by zero (use - * ExcDivideByZero for those). - */ + /** + * Exception raised if a number is + * not finite. + * + * This exception should be used to + * catch infinite or not a number + * results of arithmetic operations + * that do not result from a + * division by zero (use + * ExcDivideByZero for those). + */ DeclException0 (ExcNumberNotFinite); - /** - * Trying to allocate a new - * object failed due to lack of - * free memory. - */ + /** + * Trying to allocate a new + * object failed due to lack of + * free memory. + */ DeclException0 (ExcOutOfMemory); - /** - * A memory handler reached a point - * where all allocated objects - * should have been released. Since - * this exception is thrown, some - * were still allocated. - */ + /** + * A memory handler reached a point + * where all allocated objects + * should have been released. Since + * this exception is thrown, some + * were still allocated. + */ DeclException1 (ExcMemoryLeak, int, - << "Destroying memory handler while " << arg1 - << " objects are still allocated"); + << "Destroying memory handler while " << arg1 + << " objects are still allocated"); - /** - * An error occurred reading or - * writing a file. - */ + /** + * An error occurred reading or + * writing a file. + */ DeclException0 (ExcIO); - /** - * An error occurred opening the named file. - * - * The constructor takes a single - * argument of type char* - * naming the file. - */ + /** + * An error occurred opening the named file. + * + * The constructor takes a single + * argument of type char* + * naming the file. + */ DeclException1 (ExcFileNotOpen, - char*, - << "Could not open file " << arg1); - - /** - * Exception denoting a part of the - * library or application program - * that has not yet been - * implemented. In many cases, this - * only indicates that there wasn't - * much need for something yet, not - * that this is difficult to - * implement. It is therefore quite - * worth the effort to take a look - * at the corresponding place and - * see whether it can be - * implemented without too much - * effort. - */ + char*, + << "Could not open file " << arg1); + + /** + * Exception denoting a part of the + * library or application program + * that has not yet been + * implemented. In many cases, this + * only indicates that there wasn't + * much need for something yet, not + * that this is difficult to + * implement. It is therefore quite + * worth the effort to take a look + * at the corresponding place and + * see whether it can be + * implemented without too much + * effort. + */ DeclException0 (ExcNotImplemented); - /** - * This exception usually indicates - * that some condition which the - * programmer thinks must be - * satisfied at a certain point in - * an algorithm, is not - * fulfilled. This might be due to - * some programming error above, - * due to changes to the algorithm - * that did not preserve this - * assertion, or due to assumptions - * the programmer made that are not - * valid at all (i.e. the exception - * is thrown although there is no - * error here). Within the library, - * this exception is most often - * used when we write some kind of - * complicated algorithm and are - * not yet sure whether we got it - * right; we then put in assertions - * after each part of the algorithm - * that check for some conditions - * that should hold there, and - * throw an exception if they do - * not. - * - * We usually leave in these - * assertions even after we are - * confident that the - * implementation is correct, since - * if someone later changes or - * extends the algorithm, these - * exceptions will indicate to him - * if he violates assumptions that - * are used later in the - * algorithm. Furthermore, it - * sometimes happens that an - * algorithm does not work in very - * rare corner cases. These cases - * will then be trapped sooner or - * later by the exception, so that - * the algorithm can then be fixed - * for these cases as well. - */ + /** + * This exception usually indicates + * that some condition which the + * programmer thinks must be + * satisfied at a certain point in + * an algorithm, is not + * fulfilled. This might be due to + * some programming error above, + * due to changes to the algorithm + * that did not preserve this + * assertion, or due to assumptions + * the programmer made that are not + * valid at all (i.e. the exception + * is thrown although there is no + * error here). Within the library, + * this exception is most often + * used when we write some kind of + * complicated algorithm and are + * not yet sure whether we got it + * right; we then put in assertions + * after each part of the algorithm + * that check for some conditions + * that should hold there, and + * throw an exception if they do + * not. + * + * We usually leave in these + * assertions even after we are + * confident that the + * implementation is correct, since + * if someone later changes or + * extends the algorithm, these + * exceptions will indicate to him + * if he violates assumptions that + * are used later in the + * algorithm. Furthermore, it + * sometimes happens that an + * algorithm does not work in very + * rare corner cases. These cases + * will then be trapped sooner or + * later by the exception, so that + * the algorithm can then be fixed + * for these cases as well. + */ DeclException0 (ExcInternalError); - /** - * This exception is used in - * functions that may not be called - * (i.e. in pure functions) but - * could not be declared pure since - * the class is intended to be used - * anyway, even though the - * respective function may only be - * called if a derived class is - * used. - */ + /** + * This exception is used in + * functions that may not be called + * (i.e. in pure functions) but + * could not be declared pure since + * the class is intended to be used + * anyway, even though the + * respective function may only be + * called if a derived class is + * used. + */ DeclException0 (ExcPureFunctionCalled); /** - * Used for constructors that are - * disabled. Examples are copy - * constructors and assignment - * operators of large objects, - * which are only allowed for empty - * objects. - */ + * Used for constructors that are + * disabled. Examples are copy + * constructors and assignment + * operators of large objects, + * which are only allowed for empty + * objects. + */ DeclException0 (ExcInvalidConstructorCall); - /** - * This exception is used if some - * object is found uninitialized. - */ + /** + * This exception is used if some + * object is found uninitialized. + */ DeclException0 (ExcNotInitialized); /** @@ -786,46 +786,46 @@ namespace StandardExceptions */ DeclException0 (ExcInvalidState); - /** - * This exception is raised if a - * functionality is not possible in - * the given dimension. Mostly used - * to throw function calls in 1d. - * - * The constructor takes a single - * int, denoting the - * dimension. - */ + /** + * This exception is raised if a + * functionality is not possible in + * the given dimension. Mostly used + * to throw function calls in 1d. + * + * The constructor takes a single + * int, denoting the + * dimension. + */ DeclException1 (ExcImpossibleInDim, - int, - << "Impossible in " << arg1 << "d."); + int, + << "Impossible in " << arg1 << "d."); - /** - * A number is zero, but it should - * not be here. - */ + /** + * A number is zero, but it should + * not be here. + */ DeclException0(ExcZero); - /** - * The object should have been - * filled with something before - * this member function is called. - */ + /** + * The object should have been + * filled with something before + * this member function is called. + */ DeclException0(ExcEmptyObject); - /** - * This exception is raised - * whenever the sizes of two - * objects were assumed to be - * equal, but were not. - * - * Parameters to the constructor - * are the first and second size, - * both of type int. - */ + /** + * This exception is raised + * whenever the sizes of two + * objects were assumed to be + * equal, but were not. + * + * Parameters to the constructor + * are the first and second size, + * both of type int. + */ DeclException2 (ExcDimensionMismatch, - std::size_t, std::size_t, - << "Dimension " << arg1 << " not equal to " << arg2); + std::size_t, std::size_t, + << "Dimension " << arg1 << " not equal to " << arg2); /** * The first dimension should be @@ -836,187 +836,187 @@ namespace StandardExceptions int, int, int, << "Dimension " << arg1 << " neither equal to " << arg2 << " nor to " << arg3); - /** - * This exception is one of the - * most often used ones, and - * indicates that an index is not - * within the expected range. For - * example, you might try to access - * an element of a vector which - * does not exist. - * - * The constructor takes three - * int, namely - *
    - *
  1. the violating index - *
  2. the lower bound - *
  3. the upper bound plus one - *
- */ + /** + * This exception is one of the + * most often used ones, and + * indicates that an index is not + * within the expected range. For + * example, you might try to access + * an element of a vector which + * does not exist. + * + * The constructor takes three + * int, namely + *
    + *
  1. the violating index + *
  2. the lower bound + *
  3. the upper bound plus one + *
+ */ DeclException3 (ExcIndexRange, int, int, int, - << "Index " << arg1 << " is not in [" - << arg2 << "," << arg3 << "["); + << "Index " << arg1 << " is not in [" + << arg2 << "," << arg3 << "["); - /** - * A number is too small. - */ + /** + * A number is too small. + */ DeclException2 (ExcLowerRange, int, int, - << "Number " << arg1 - << " must be larger or equal " << arg2); - - /** - * This exception indicates that - * the first argument should be an - * integer multiple of the second, - * but is not. - */ + << "Number " << arg1 + << " must be larger or equal " << arg2); + + /** + * This exception indicates that + * the first argument should be an + * integer multiple of the second, + * but is not. + */ DeclException2 (ExcNotMultiple, int, int, - << "Division " << arg1 - << " by " << arg2 - << " has remainder different from zero"); - - /** - * This exception is thrown if the - * iterator you access has - * corrupted data. It might for - * instance be, that the container - * it refers does not have an entry - * at the point the iterator - * refers. - * - * Typically, this will be an - * internal error of deal.II, - * because the increment and - * decrement operators should never - * yield an invalid iterator. - */ + << "Division " << arg1 + << " by " << arg2 + << " has remainder different from zero"); + + /** + * This exception is thrown if the + * iterator you access has + * corrupted data. It might for + * instance be, that the container + * it refers does not have an entry + * at the point the iterator + * refers. + * + * Typically, this will be an + * internal error of deal.II, + * because the increment and + * decrement operators should never + * yield an invalid iterator. + */ DeclException0 (ExcInvalidIterator); - /** - * This exception is thrown if the - * iterator you incremented or - * decremented was already at its - * final state. - */ + /** + * This exception is thrown if the + * iterator you incremented or + * decremented was already at its + * final state. + */ DeclException0 (ExcIteratorPastEnd); - /** - * This exception works around a - * design flaw in the - * DeclException0 macro: - * exceptions desclared through - * DeclException0 - * do not allow one to specify a - * message that is displayed when - * the exception is raised, as - * opposed to the other exceptions - * which allow to show a text along - * with the given parameters. - * - * When throwing this exception, - * you can give a message as a - * std::string as argument to the - * exception that is then - * displayed. The argument can, of - * course, be constructed at run-time, - * for example including the name of a - * file that can't be opened, or any - * other text you may want to assemble - * from different pieces. - */ + /** + * This exception works around a + * design flaw in the + * DeclException0 macro: + * exceptions desclared through + * DeclException0 + * do not allow one to specify a + * message that is displayed when + * the exception is raised, as + * opposed to the other exceptions + * which allow to show a text along + * with the given parameters. + * + * When throwing this exception, + * you can give a message as a + * std::string as argument to the + * exception that is then + * displayed. The argument can, of + * course, be constructed at run-time, + * for example including the name of a + * file that can't be opened, or any + * other text you may want to assemble + * from different pieces. + */ DeclException1 (ExcMessage, - std::string, - << arg1); - - /** - * Exception used when running into - * functions that are only supported - * in a backward compatibility mode. - */ + std::string, + << arg1); + + /** + * Exception used when running into + * functions that are only supported + * in a backward compatibility mode. + */ DeclException1 (ExcCompatibility, - char*, - << "You are using a backward compatibility feature\n" - << "that you have disabled during configuration of\n" - << "the library by the --disable-compat=" - << arg1 << " switch. You should either use an\n" - << "alternative function, or configure again without\n" - << "this switch and recompile the library."); - - /** - * Some of our numerical classes - * allow for setting alll entries - * to zero using the assignment - * operator =. - * - * In many cases, this assignment - * operator makes sense only - * for the argument zero. In other - * cases, this exception is thrown. - */ + char*, + << "You are using a backward compatibility feature\n" + << "that you have disabled during configuration of\n" + << "the library by the --disable-compat=" + << arg1 << " switch. You should either use an\n" + << "alternative function, or configure again without\n" + << "this switch and recompile the library."); + + /** + * Some of our numerical classes + * allow for setting alll entries + * to zero using the assignment + * operator =. + * + * In many cases, this assignment + * operator makes sense only + * for the argument zero. In other + * cases, this exception is thrown. + */ DeclException0 (ExcScalarAssignmentOnlyForZeroValue); - /** - * This function requires the BLAS - * library. Please reconfigure - * using the option - * --with-blas and check - * if it is actually included. - */ + /** + * This function requires the BLAS + * library. Please reconfigure + * using the option + * --with-blas and check + * if it is actually included. + */ DeclException0 (ExcNeedsBLAS); - /** - * This function requires the LAPACK - * library. Please reconfigure - * using the option - * --with-lapack and check - * if it is actually included. - */ + /** + * This function requires the LAPACK + * library. Please reconfigure + * using the option + * --with-lapack and check + * if it is actually included. + */ DeclException0 (ExcNeedsLAPACK); - /** - * This function requires the UMFPack - * library. Please reconfigure - * using the option - * --with-umfpack and check - * if it is actually included. - */ + /** + * This function requires the UMFPack + * library. Please reconfigure + * using the option + * --with-umfpack and check + * if it is actually included. + */ DeclException0 (ExcNeedsUMFPACK); - /** - * This function requires the METIS - * library. Please reconfigure - * using the option - * --with-metis and check - * if it is actually included. - */ + /** + * This function requires the METIS + * library. Please reconfigure + * using the option + * --with-metis and check + * if it is actually included. + */ DeclException0 (ExcNeedsMETIS); - /** - * This function requires the Petsc - * library. Please reconfigure - * using the option - * --with-petsc and check - * if it is actually included. - */ + /** + * This function requires the Petsc + * library. Please reconfigure + * using the option + * --with-petsc and check + * if it is actually included. + */ DeclException0 (ExcNeedsPETSC); - /** - * This function requires the - * NetCDF library, which is neither - * in your standard path nor - * configured with --with-netcdf. - */ + /** + * This function requires the + * NetCDF library, which is neither + * in your standard path nor + * configured with --with-netcdf. + */ DeclException0 (ExcNeedsNetCDF); - /** - * A configuration option disabled - * this feature. In order to use - * it, you must reconfigure and - * recompile the libraries. - */ + /** + * A configuration option disabled + * this feature. In order to use + * it, you must reconfigure and + * recompile the libraries. + */ DeclException1 (ExcDisabled, char*, - << "This feature was disabled by the " - "configuration option --disable-" - << arg1 << ". Reconfigure to use it!"); + << "This feature was disabled by the " + "configuration option --disable-" + << arg1 << ". Reconfigure to use it!"); //@} } diff --git a/deal.II/include/deal.II/base/flow_function.h b/deal.II/include/deal.II/base/flow_function.h index 316726966d..cc1d5711f0 100644 --- a/deal.II/include/deal.II/base/flow_function.h +++ b/deal.II/include/deal.II/base/flow_function.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2007, 2008, 2010 by the deal.II authors +// Copyright (C) 2007, 2008, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -45,103 +45,103 @@ namespace Functions class FlowFunction : public Function { public: - /** - * Constructor, setting up some - * internal data structures. - */ + /** + * Constructor, setting up some + * internal data structures. + */ FlowFunction(); - /** - * Virtual destructor. - */ + /** + * Virtual destructor. + */ virtual ~FlowFunction(); - /** - * Store an adjustment for the - * pressure function, such that - * its mean value is - * p. - */ + /** + * Store an adjustment for the + * pressure function, such that + * its mean value is + * p. + */ void pressure_adjustment(double p); - /** - * Values in a structure more - * suitable for vector valued - * functions. The outer vector - * is indexed by solution - * component, the inner by - * quadrature point. - */ + /** + * Values in a structure more + * suitable for vector valued + * functions. The outer vector + * is indexed by solution + * component, the inner by + * quadrature point. + */ virtual void vector_values (const std::vector >& points, - std::vector >& values) const = 0; - /** - * Gradients in a structure more - * suitable for vector valued - * functions. The outer vector - * is indexed by solution - * component, the inner by - * quadrature point. - */ + std::vector >& values) const = 0; + /** + * Gradients in a structure more + * suitable for vector valued + * functions. The outer vector + * is indexed by solution + * component, the inner by + * quadrature point. + */ virtual void vector_gradients (const std::vector > &points, - std::vector > > &gradients) const = 0; - /** - * Force terms in a structure more - * suitable for vector valued - * functions. The outer vector - * is indexed by solution - * component, the inner by - * quadrature point. - * - * @warning This is not the - * true Laplacian, but the - * force term to be used as - * right hand side in Stokes' - * equations - */ + std::vector > > &gradients) const = 0; + /** + * Force terms in a structure more + * suitable for vector valued + * functions. The outer vector + * is indexed by solution + * component, the inner by + * quadrature point. + * + * @warning This is not the + * true Laplacian, but the + * force term to be used as + * right hand side in Stokes' + * equations + */ virtual void vector_laplacians (const std::vector > &points, - std::vector > &values) const = 0; + std::vector > &values) const = 0; virtual void vector_value (const Point& points, Vector& value) const; virtual double value (const Point& points, const unsigned int component) const; virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; virtual void vector_gradient_list (const std::vector > &points, - std::vector > > &gradients) const; - /** - * The force term in the - * momentum equation. - */ + std::vector > > &gradients) const; + /** + * The force term in the + * momentum equation. + */ virtual void vector_laplacian_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; std::size_t memory_consumption () const; protected: - /** - * Mean value of the pressure - * to be added by derived - * classes. - */ + /** + * Mean value of the pressure + * to be added by derived + * classes. + */ double mean_pressure; private: - /** - * A mutex that guards the - * following scratch arrays. - */ + /** + * A mutex that guards the + * following scratch arrays. + */ mutable Threads::Mutex mutex; - /** - * Auxiliary values for the usual - * Function interface. - */ + /** + * Auxiliary values for the usual + * Function interface. + */ mutable std::vector > aux_values; - /** - * Auxiliary values for the usual - * Function interface. - */ + /** + * Auxiliary values for the usual + * Function interface. + */ mutable std::vector > > aux_gradients; }; @@ -158,22 +158,22 @@ namespace Functions class PoisseuilleFlow : public FlowFunction { public: - /** - * Construct an object for the - * given channel radius - * r and the Reynolds - * number Re. - */ + /** + * Construct an object for the + * given channel radius + * r and the Reynolds + * number Re. + */ PoisseuilleFlow (const double r, - const double Re); + const double Re); virtual ~PoisseuilleFlow(); virtual void vector_values (const std::vector >& points, - std::vector >& values) const; + std::vector >& values) const; virtual void vector_gradients (const std::vector >& points, - std::vector > >& gradients) const; + std::vector > >& gradients) const; virtual void vector_laplacians (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; private: const double radius; @@ -199,31 +199,31 @@ namespace Functions public FlowFunction { public: - /** - * Constructor setting the - * Reynolds number required for - * pressure computation and - * scaling of the right hand side. - */ + /** + * Constructor setting the + * Reynolds number required for + * pressure computation and + * scaling of the right hand side. + */ StokesCosine (const double viscosity = 1., const double reaction = 0.); - /** - * Change the viscosity and the - * reaction parameter. - */ + /** + * Change the viscosity and the + * reaction parameter. + */ void set_parameters (const double viscosity, const double reaction); virtual ~StokesCosine(); virtual void vector_values (const std::vector >& points, - std::vector >& values) const; + std::vector >& values) const; virtual void vector_gradients (const std::vector >& points, - std::vector > >& gradients) const; + std::vector > >& gradients) const; virtual void vector_laplacians (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; private: - /// The viscosity + /// The viscosity double viscosity; - /// The reaction parameter + /// The reaction parameter double reaction; }; @@ -239,35 +239,35 @@ namespace Functions class StokesLSingularity : public FlowFunction<2> { public: - /// Constructor setting upsome data. + /// Constructor setting upsome data. StokesLSingularity(); virtual void vector_values (const std::vector >& points, - std::vector >& values) const; + std::vector >& values) const; virtual void vector_gradients (const std::vector >& points, - std::vector > >& gradients) const; + std::vector > >& gradients) const; virtual void vector_laplacians (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; private: - /// The auxiliary function Psi. + /// The auxiliary function Psi. double Psi(double phi) const; - /// The derivative of Psi() + /// The derivative of Psi() double Psi_1(double phi) const; - /// The 2nd derivative of Psi() + /// The 2nd derivative of Psi() double Psi_2(double phi) const; - /// The 3rd derivative of Psi() + /// The 3rd derivative of Psi() double Psi_3(double phi) const; - /// The 4th derivative of Psi() + /// The 4th derivative of Psi() double Psi_4(double phi) const; - /// The angle of the reentrant corner + /// The angle of the reentrant corner const double omega; - /// The exponent of the radius + /// The exponent of the radius static const double lambda; - /// Cosine of lambda times omega + /// Cosine of lambda times omega const double coslo; - /// Auxiliary variable 1+lambda + /// Auxiliary variable 1+lambda const double lp; - /// Auxiliary variable 1-lambda + /// Auxiliary variable 1-lambda const double lm; }; @@ -283,31 +283,31 @@ namespace Functions class Kovasznay : public FlowFunction<2> { public: - /** - * Construct an object for the - * give Reynolds number - * Re. If the - * parameter Stokes is - * true, the right hand side of - * the momentum equation - * returned by - * vector_laplacians() contains - * the nonlinearity, such that - * the Kovasznay solution can - * be obtained as the solution - * to a Stokes problem. - */ + /** + * Construct an object for the + * give Reynolds number + * Re. If the + * parameter Stokes is + * true, the right hand side of + * the momentum equation + * returned by + * vector_laplacians() contains + * the nonlinearity, such that + * the Kovasznay solution can + * be obtained as the solution + * to a Stokes problem. + */ Kovasznay (const double Re, bool Stokes = false); virtual ~Kovasznay(); virtual void vector_values (const std::vector >& points, - std::vector >& values) const; + std::vector >& values) const; virtual void vector_gradients (const std::vector >& points, - std::vector > >& gradients) const; + std::vector > >& gradients) const; virtual void vector_laplacians (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; - /// The value of lambda. + /// The value of lambda. double lambda () const; private: const double Reynolds; diff --git a/deal.II/include/deal.II/base/function.h b/deal.II/include/deal.II/base/function.h index 8bc5f9110b..9cde3bccd1 100644 --- a/deal.II/include/deal.II/base/function.h +++ b/deal.II/include/deal.II/base/function.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -99,71 +99,71 @@ template class Vector; */ template class Function : public FunctionTime, - public Subscriptor + public Subscriptor { public: - /** - * Export the value of the - * template parameter as a static - * member constant. Sometimes - * useful for some expression - * template programming. - */ + /** + * Export the value of the + * template parameter as a static + * member constant. Sometimes + * useful for some expression + * template programming. + */ static const unsigned int dimension = dim; - /** - * Number of vector components. - */ + /** + * Number of vector components. + */ const unsigned int n_components; - /** - * Constructor. May take an - * initial value for the number - * of components (which defaults - * to one, i.e. a scalar - * function), and the time - * variable, which defaults to - * zero. - */ + /** + * Constructor. May take an + * initial value for the number + * of components (which defaults + * to one, i.e. a scalar + * function), and the time + * variable, which defaults to + * zero. + */ Function (const unsigned int n_components = 1, - const double initial_time = 0.0); - - /** - * Virtual destructor; absolutely - * necessary in this case. - * - * This destructor is declared - * pure virtual, such that - * objects of this class cannot - * be created. Since all the - * other virtual functions have a - * pseudo-implementation to avoid - * overhead in derived classes, - * this is the best place to do - * this. - * - * Nevertheless, since derived - * classes want to call the - * destructor of a base class, - * the destructor is implemented - * (despite it being pure - * virtual). - * - * Note: Compaq's cxx compiler - * does not allow defining a - * function that was declared - * pure. It simply refuses to - * instantiate the function when - * it later sees it, but also - * does not generate a respective - * function itself, which then - * leads to linker errors - * claiming that the destructor - * of this class is missing. We - * therefore only make the - * function abstract if the - * compiler can handle this. - */ + const double initial_time = 0.0); + + /** + * Virtual destructor; absolutely + * necessary in this case. + * + * This destructor is declared + * pure virtual, such that + * objects of this class cannot + * be created. Since all the + * other virtual functions have a + * pseudo-implementation to avoid + * overhead in derived classes, + * this is the best place to do + * this. + * + * Nevertheless, since derived + * classes want to call the + * destructor of a base class, + * the destructor is implemented + * (despite it being pure + * virtual). + * + * Note: Compaq's cxx compiler + * does not allow defining a + * function that was declared + * pure. It simply refuses to + * instantiate the function when + * it later sees it, but also + * does not generate a respective + * function itself, which then + * leads to linker errors + * claiming that the destructor + * of this class is missing. We + * therefore only make the + * function abstract if the + * compiler can handle this. + */ virtual ~Function () #ifndef DEAL_II_IMPLEMENTED_PURE_FUNCTION_BUG = 0 @@ -184,193 +184,193 @@ class Function : public FunctionTime, */ Function & operator= (const Function &f); - /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component you - * want to have evaluated; it - * defaults to zero, i.e. the - * first component. - */ + /** + * Return the value of the + * function at the given + * point. Unless there is only + * one component (i.e. the + * function is scalar), you + * should state the component you + * want to have evaluated; it + * defaults to zero, i.e. the + * first component. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Return all components of a - * vector-valued function at a - * given point. - * - * values shall have the right - * size beforehand, - * i.e. #n_components. - */ + const unsigned int component = 0) const; + + /** + * Return all components of a + * vector-valued function at a + * given point. + * + * values shall have the right + * size beforehand, + * i.e. #n_components. + */ virtual void vector_value (const Point &p, Vector &values) const; - /** - * Set values to the point - * values of the specified - * component of the function at - * the points. It is assumed - * that values already has the - * right size, i.e. the same - * size as the points array. - * - * Be default, this function - * repeatedly calls value() for - * each point separately, to - * fill the output array. - */ + /** + * Set values to the point + * values of the specified + * component of the function at + * the points. It is assumed + * that values already has the + * right size, i.e. the same + * size as the points array. + * + * Be default, this function + * repeatedly calls value() for + * each point separately, to + * fill the output array. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Set values to the point - * values of the function at the - * points. It is assumed that - * values already has the right - * size, i.e. the same size as - * the points array, and that - * all elements be vectors with - * the same number of components - * as this function has. - * - * Be default, this function - * repeatedly calls vector_value() for - * each point separately, to - * fill the output array. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Set values to the point + * values of the function at the + * points. It is assumed that + * values already has the right + * size, i.e. the same size as + * the points array, and that + * all elements be vectors with + * the same number of components + * as this function has. + * + * Be default, this function + * repeatedly calls vector_value() for + * each point separately, to + * fill the output array. + */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; - - /** - * For each component of the - * function, fill a vector of - * values, one for each point. - * - * The default implementation of - * this function in Function calls - * value_list() for each - * component. In order to improve - * performance, this can be - * reimplemented in derived - * classes to speed up performance. - */ + std::vector > &values) const; + + /** + * For each component of the + * function, fill a vector of + * values, one for each point. + * + * The default implementation of + * this function in Function calls + * value_list() for each + * component. In order to improve + * performance, this can be + * reimplemented in derived + * classes to speed up performance. + */ virtual void vector_values (const std::vector >& points, - std::vector >& values) const; + std::vector >& values) const; - /** - * Return the gradient of the - * specified component of the - * function at the given point. - */ + /** + * Return the gradient of the + * specified component of the + * function at the given point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; - /** - * Return the gradient of all - * components of the - * function at the given point. - */ + /** + * Return the gradient of all + * components of the + * function at the given point. + */ virtual void vector_gradient (const Point &p, std::vector > &gradients) const; - /** - * Set gradients to the - * gradients of the specified - * component of the function at - * the points. It is assumed - * that gradients already has the - * right size, i.e. the same - * size as the points array. - */ + /** + * Set gradients to the + * gradients of the specified + * component of the function at + * the points. It is assumed + * that gradients already has the + * right size, i.e. the same + * size as the points array. + */ virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - - /** - * For each component of the - * function, fill a vector of - * gradient values, one for each point. - * - * The default implementation of - * this function in Function calls - * value_list() for each - * component. In order to improve - * performance, this can be - * reimplemented in derived - * classes to speed up performance. - */ + std::vector > &gradients, + const unsigned int component = 0) const; + + /** + * For each component of the + * function, fill a vector of + * gradient values, one for each point. + * + * The default implementation of + * this function in Function calls + * value_list() for each + * component. In order to improve + * performance, this can be + * reimplemented in derived + * classes to speed up performance. + */ virtual void vector_gradients (const std::vector > &points, - std::vector > > &gradients) const; - - /** - * Set gradients to the gradients of - * the function at the points, - * for all components. - * It is assumed that gradients - * already has the right size, i.e. - * the same size as the points array. - * - * The outer loop over - * gradients is over the points - * in the list, the inner loop - * over the different components - * of the function. - */ + std::vector > > &gradients) const; + + /** + * Set gradients to the gradients of + * the function at the points, + * for all components. + * It is assumed that gradients + * already has the right size, i.e. + * the same size as the points array. + * + * The outer loop over + * gradients is over the points + * in the list, the inner loop + * over the different components + * of the function. + */ virtual void vector_gradient_list (const std::vector > &points, - std::vector > > &gradients) const; + std::vector > > &gradients) const; - /** - * Compute the Laplacian of a - * given component at point p. - */ + /** + * Compute the Laplacian of a + * given component at point p. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; - /** - * Compute the Laplacian of all - * components at point p and - * store them in values. - */ + /** + * Compute the Laplacian of all + * components at point p and + * store them in values. + */ virtual void vector_laplacian (const Point &p, - Vector &values) const; + Vector &values) const; - /** - * Compute the Laplacian of one - * component at a set of points. - */ + /** + * Compute the Laplacian of one + * component at a set of points. + */ virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; - /** - * Compute the Laplacians of all - * components at a set of points. - */ + /** + * Compute the Laplacians of all + * components at a set of points. + */ virtual void vector_laplacian_list (const std::vector > &points, - std::vector > &values) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + std::vector > &values) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ std::size_t memory_consumption () const; }; @@ -392,104 +392,104 @@ template class ZeroFunction : public Function { public: - /** - * Constructor. The number of - * components is preset to one. - */ + /** + * Constructor. The number of + * components is preset to one. + */ ZeroFunction (const unsigned int n_components = 1); - /** - * Virtual destructor; absolutely - * necessary in this case. - */ + /** + * Virtual destructor; absolutely + * necessary in this case. + */ virtual ~ZeroFunction (); - /** - * Return the value of the function - * at the given point for one - * component. - */ + /** + * Return the value of the function + * at the given point for one + * component. + */ virtual double value (const Point &p, - const unsigned int component) const; + const unsigned int component) const; - /** - * Return the value of the function - * at the given point for all - * components. - */ + /** + * Return the value of the function + * at the given point for all + * components. + */ virtual void vector_value (const Point &p, Vector &return_value) const; - /** - * Set values to the point values - * of the function at the points, - * for the given component. - * It is assumed that values - * already has the right size, i.e. - * the same size as the points - * array. - */ + /** + * Set values to the point values + * of the function at the points, + * for the given component. + * It is assumed that values + * already has the right size, i.e. + * the same size as the points + * array. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Set values to the point values - * of the function at the points, - * for all components. - * It is assumed that values - * already has the right size, i.e. - * the same size as the points - * array. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Set values to the point values + * of the function at the points, + * for all components. + * It is assumed that values + * already has the right size, i.e. + * the same size as the points + * array. + */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; - /** - * Return the gradient of the function - * at the given point, for the - * given component. - */ + /** + * Return the gradient of the function + * at the given point, for the + * given component. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - * Return the gradient of the - * specified component of the - * function at the given point, - * for all components. - */ + const unsigned int component = 0) const; + + /** + * Return the gradient of the + * specified component of the + * function at the given point, + * for all components. + */ virtual void vector_gradient (const Point &p, std::vector > &gradients) const; - /** - * Set gradients to the gradients of - * the function at the points, - * for the given component. - * It is assumed that values - * already has the right size, i.e. - * the same size as the points array. - */ + /** + * Set gradients to the gradients of + * the function at the points, + * for the given component. + * It is assumed that values + * already has the right size, i.e. + * the same size as the points array. + */ virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - - /** - * Set gradients to the gradients of - * the function at the points, - * for all components. - * It is assumed that gradients - * already has the right size, i.e. - * the same size as the points array. - * - * The outer loop over - * gradients is over the points - * in the list, the inner loop - * over the different components - * of the function. - */ + std::vector > &gradients, + const unsigned int component = 0) const; + + /** + * Set gradients to the gradients of + * the function at the points, + * for all components. + * It is assumed that gradients + * already has the right size, i.e. + * the same size as the points array. + * + * The outer loop over + * gradients is over the points + * in the list, the inner loop + * over the different components + * of the function. + */ virtual void vector_gradient_list (const std::vector > &points, - std::vector > > &gradients) const; + std::vector > > &gradients) const; }; @@ -521,83 +521,83 @@ template class ConstantFunction : public ZeroFunction { public: - /** - * Constructor; takes the constant function - * value as an argument. The number of - * components is preset to one. - */ + /** + * Constructor; takes the constant function + * value as an argument. The number of + * components is preset to one. + */ ConstantFunction (const double value, - const unsigned int n_components = 1); + const unsigned int n_components = 1); - /** - * Virtual destructor; absolutely - * necessary in this case. - */ + /** + * Virtual destructor; absolutely + * necessary in this case. + */ virtual ~ConstantFunction (); - /** - * Return the value of the function - * at the given point for one - * component. - */ + /** + * Return the value of the function + * at the given point for one + * component. + */ virtual double value (const Point &p, - const unsigned int component) const; + const unsigned int component) const; - /** - * Return the value of the function - * at the given point for all - * components. - */ + /** + * Return the value of the function + * at the given point for all + * components. + */ virtual void vector_value (const Point &p, - Vector &return_value) const; - - /** - * Set values to the point values - * of the function at the points, - * for the given component. - * It is assumed that values - * already has the right size, i.e. - * the same size as the points - * array. - */ + Vector &return_value) const; + + /** + * Set values to the point values + * of the function at the points, + * for the given component. + * It is assumed that values + * already has the right size, i.e. + * the same size as the points + * array. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Set values to the point values - * of the function at the points, - * for all components. - * It is assumed that values - * already has the right size, i.e. - * the same size as the points - * array. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Set values to the point values + * of the function at the points, + * for all components. + * It is assumed that values + * already has the right size, i.e. + * the same size as the points + * array. + */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + std::vector > &values) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ std::size_t memory_consumption () const; protected: - /** - * Store the constant function value. - */ + /** + * Store the constant function value. + */ const double function_value; }; @@ -619,90 +619,90 @@ template class ComponentSelectFunction : public ConstantFunction { public: - /** - * Constructor if only a single - * component shall be - * non-zero. Arguments denote the - * component selected, the value - * for that component and the - * total number of vector - * components. - */ + /** + * Constructor if only a single + * component shall be + * non-zero. Arguments denote the + * component selected, the value + * for that component and the + * total number of vector + * components. + */ ComponentSelectFunction (const unsigned int selected, - const double value, - const unsigned int n_components); - - /** - * Constructor. As before, but - * the value for the selected - * component is assumed to be - * one. In essence, this function - * then works as a mask. - */ + const double value, + const unsigned int n_components); + + /** + * Constructor. As before, but + * the value for the selected + * component is assumed to be + * one. In essence, this function + * then works as a mask. + */ ComponentSelectFunction (const unsigned int selected, - const unsigned int n_components); - - /** - * Constructor if multiple - * components shall have - * non-zero, unit values - * (i.e. this should be a mask - * for multiple components). The - * first argument denotes a - * half-open interval of - * components (for example - * std::pair(0,dim) for the first - * dim components), and the - * second argument is the total - * number of vector components. - */ + const unsigned int n_components); + + /** + * Constructor if multiple + * components shall have + * non-zero, unit values + * (i.e. this should be a mask + * for multiple components). The + * first argument denotes a + * half-open interval of + * components (for example + * std::pair(0,dim) for the first + * dim components), and the + * second argument is the total + * number of vector components. + */ ComponentSelectFunction (const std::pair &selected, - const unsigned int n_components); + const unsigned int n_components); - /** - * Return the value of the function - * at the given point for all - * components. - */ + /** + * Return the value of the function + * at the given point for all + * components. + */ virtual void vector_value (const Point &p, - Vector &return_value) const; - - /** - * Set values to the point values - * of the function at the points, - * for all components. - * It is assumed that values - * already has the right size, i.e. - * the same size as the points - * array. - */ + Vector &return_value) const; + + /** + * Set values to the point values + * of the function at the points, + * for all components. + * It is assumed that values + * already has the right size, i.e. + * the same size as the points + * array. + */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + std::vector > &values) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ std::size_t memory_consumption () const; protected: - /** - * Half-open interval of the - * indices of selected - * components. - */ + /** + * Half-open interval of the + * indices of selected + * components. + */ const std::pair selected_components; }; @@ -776,8 +776,8 @@ class ComponentSelectFunction : public ConstantFunction * @code * ScalarFunctionFromFunctionObject * my_distance_object (std_cxx1x::bind (&Point::distance, - * q, - * std_cxx1x::_1)); + * q, + * std_cxx1x::_1)); * @endcode * The savings in work to write this are apparent. * @@ -802,7 +802,7 @@ public: * produces for this point. */ virtual double value (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; private: /** diff --git a/deal.II/include/deal.II/base/function_bessel.h b/deal.II/include/deal.II/base/function_bessel.h index da3f431e14..dd45b1a921 100644 --- a/deal.II/include/deal.II/base/function_bessel.h +++ b/deal.II/include/deal.II/base/function_bessel.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -32,17 +32,17 @@ namespace Functions { public: Bessel1(const unsigned int order, - const double wave_number, - const Point center = Point()); + const double wave_number, + const Point center = Point()); virtual double value (const Point& points, const unsigned int component) const; virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; + std::vector > &gradients, + const unsigned int component = 0) const; private: unsigned int order; double wave_number; diff --git a/deal.II/include/deal.II/base/function_derivative.h b/deal.II/include/deal.II/base/function_derivative.h index c566a3663c..98016982e9 100644 --- a/deal.II/include/deal.II/base/function_derivative.h +++ b/deal.II/include/deal.II/base/function_derivative.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -40,121 +40,121 @@ template class FunctionDerivative : public AutoDerivativeFunction { public: - /** - * Constructor. Provided are the - * functions to compute - * derivatives of, the direction - * vector of the differentiation - * and the step size h of the - * difference formula. - */ + /** + * Constructor. Provided are the + * functions to compute + * derivatives of, the direction + * vector of the differentiation + * and the step size h of the + * difference formula. + */ FunctionDerivative (const Function &f, - const Point &direction, - const double h = 1.e-6); - - /** - * Constructor. Provided are the - * functions to compute - * derivatives of and the - * direction vector of the - * differentiation in each - * quadrature point and the - * difference step size. - * - * This is the constructor for a - * variable velocity field. Most - * probably, a new object of - * FunctionDerivative has to - * be constructed for each set of - * quadrature points. - * - * The number of quadrature point - * must still be the same, when - * values are accessed. - */ + const Point &direction, + const double h = 1.e-6); + + /** + * Constructor. Provided are the + * functions to compute + * derivatives of and the + * direction vector of the + * differentiation in each + * quadrature point and the + * difference step size. + * + * This is the constructor for a + * variable velocity field. Most + * probably, a new object of + * FunctionDerivative has to + * be constructed for each set of + * quadrature points. + * + * The number of quadrature point + * must still be the same, when + * values are accessed. + */ FunctionDerivative (const Function &f, - const std::vector > &direction, - const double h = 1.e-6); - - /** - * Choose the difference formula. - * This is set to the default in - * the constructor. - * - * Formulas implemented right now - * are first order backward Euler - * (UpwindEuler), second - * order symmetric Euler - * (Euler) and a symmetric - * fourth order formula - * (FourthOrder). - */ + const std::vector > &direction, + const double h = 1.e-6); + + /** + * Choose the difference formula. + * This is set to the default in + * the constructor. + * + * Formulas implemented right now + * are first order backward Euler + * (UpwindEuler), second + * order symmetric Euler + * (Euler) and a symmetric + * fourth order formula + * (FourthOrder). + */ void set_formula (typename AutoDerivativeFunction::DifferenceFormula formula - = AutoDerivativeFunction::Euler); - /** - * Change the base step size of - * the difference formula - */ + = AutoDerivativeFunction::Euler); + /** + * Change the base step size of + * the difference formula + */ void set_h (const double h); - + virtual double value (const Point& p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void vector_value(const Point& p, - Vector& value) const; - + Vector& value) const; + virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ std::size_t memory_consumption () const; - - /** @addtogroup Exceptions - * @{ */ - /** - * Exception. - */ + /** @addtogroup Exceptions + * @{ */ + + /** + * Exception. + */ DeclException0(ExcInvalidFormula); - //@} + //@} private: - /** - * Function for differentiation. - */ + /** + * Function for differentiation. + */ const Function& f; - /** - * Step size of the difference - * formula. - */ + /** + * Step size of the difference + * formula. + */ double h; - - /** - * Difference formula. - */ + + /** + * Difference formula. + */ typename AutoDerivativeFunction::DifferenceFormula formula; - - /** - * Helper object. Contains the - * increment vector for the - * formula. - */ + + /** + * Helper object. Contains the + * increment vector for the + * formula. + */ std::vector > incr; }; diff --git a/deal.II/include/deal.II/base/function_lib.h b/deal.II/include/deal.II/base/function_lib.h index b4ddbd72fa..47a578a05e 100644 --- a/deal.II/include/deal.II/base/function_lib.h +++ b/deal.II/include/deal.II/base/function_lib.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -30,8 +30,8 @@ DEAL_II_NAMESPACE_OPEN */ namespace Functions { - - + + /** * The distance to the origin squared. * @@ -47,30 +47,30 @@ namespace Functions { public: virtual double value (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; virtual void vector_value (const Point &p, - Vector &values) const; + Vector &values) const; virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; virtual void vector_gradient (const Point &p, - std::vector > &gradient) const; + std::vector > &gradient) const; virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; + std::vector > &gradients, + const unsigned int component = 0) const; virtual double laplacian (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; }; - - - + + + /** - * The function xy in 2d and 3d, not implemented in 1d. + * The function xy in 2d and 3d, not implemented in 1d. * This function serves as an example for * a vanishing Laplacian. * @@ -82,41 +82,41 @@ namespace Functions { public: virtual double value (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - + std::vector &values, + const unsigned int component = 0) const; + virtual void vector_value_list (const std::vector >& points, - std::vector >& values) const; - + std::vector >& values) const; + virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - + std::vector > &gradients, + const unsigned int component = 0) const; + virtual void vector_gradient_list (const std::vector > &, - std::vector > >&) const; - - /** - * Laplacian of the function at one point. - */ + std::vector > >&) const; + + /** + * Laplacian of the function at one point. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; - - /** - * Laplacian of the function at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Laplacian of the function at multiple points. + */ virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; }; - - - + + + /** * d-quadratic pillow on the unit hypercube. * @@ -136,57 +136,57 @@ namespace Functions class PillowFunction : public Function { public: - /** - * Constructor. Provide a - * constant that will be added to - * each function value. - */ + /** + * Constructor. Provide a + * constant that will be added to + * each function value. + */ PillowFunction (const double offset=0.); - - /** - * The value at a single point. - */ + + /** + * The value at a single point. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Values at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Values at multiple points. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Gradient at a single point. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Gradient at a single point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - * Gradients at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Gradients at multiple points. + */ virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - - /** - * Laplacian at a single point. - */ + std::vector > &gradients, + const unsigned int component = 0) const; + + /** + * Laplacian at a single point. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; - - /** - * Laplacian at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Laplacian at multiple points. + */ virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; private: const double offset; }; - - - + + + /** * Cosine-shaped pillow function. * This is another function with zero boundary values on $[-1,1]^d$. In the interior @@ -199,57 +199,57 @@ namespace Functions class CosineFunction : public Function { public: - /** - * Constructor which allows to - * optionally generate a vector - * valued cosine function with - * the same value in each - * component. - */ + /** + * Constructor which allows to + * optionally generate a vector + * valued cosine function with + * the same value in each + * component. + */ CosineFunction (const unsigned int n_components = 1); - + virtual double value (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - + std::vector &values, + const unsigned int component = 0) const; + virtual void vector_value_list (const std::vector >& points, - std::vector >& values) const; - + std::vector >& values) const; + virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - + std::vector > &gradients, + const unsigned int component = 0) const; + virtual double laplacian (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Second derivatives at a - * single point. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Second derivatives at a + * single point. + */ virtual Tensor<2,dim> hessian (const Point &p, - const unsigned int component = 0) const; - - /** - * Second derivatives at - * multiple points. - */ + const unsigned int component = 0) const; + + /** + * Second derivatives at + * multiple points. + */ virtual void hessian_list (const std::vector > &points, - std::vector > &hessians, - const unsigned int component = 0) const; + std::vector > &hessians, + const unsigned int component = 0) const; }; - - - + + + /** * Gradient of the cosine-shaped pillow function. * @@ -266,39 +266,39 @@ namespace Functions class CosineGradFunction : public Function { public: - /** - * Constructor, creating a - * function with @p dim components. - */ + /** + * Constructor, creating a + * function with @p dim components. + */ CosineGradFunction (); - + virtual double value (const Point &p, - const unsigned int component) const; + const unsigned int component) const; virtual void vector_value (const Point &p, - Vector &values) const; + Vector &values) const; virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component) const; - + std::vector &values, + const unsigned int component) const; + virtual void vector_value_list (const std::vector >& points, - std::vector >& values) const; - + std::vector >& values) const; + virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component) const; - + const unsigned int component) const; + virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component) const; - + std::vector > &gradients, + const unsigned int component) const; + virtual void vector_gradient_list (const std::vector > &points, - std::vector > > &gradients) const; + std::vector > > &gradients) const; virtual double laplacian (const Point &p, - const unsigned int component) const; + const unsigned int component) const; }; - - - + + + /** * Product of exponential functions in each coordinate direction. * @@ -309,48 +309,48 @@ namespace Functions class ExpFunction : public Function { public: - /** - * The value at a single point. - */ + /** + * The value at a single point. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Values at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Values at multiple points. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Gradient at a single point. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Gradient at a single point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - * Gradients at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Gradients at multiple points. + */ virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - - /** - * Laplacian at a single point. - */ + std::vector > &gradients, + const unsigned int component = 0) const; + + /** + * Laplacian at a single point. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; - - /** - * Laplacian at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Laplacian at multiple points. + */ virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; }; - - - + + + /** * Harmonic singularity on the L-shaped domain in 2D. * @@ -362,35 +362,35 @@ namespace Functions { public: virtual double value (const Point<2> &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; virtual void vector_value_list (const std::vector >& points, - std::vector >& values) const; - + std::vector >& values) const; + virtual Tensor<1,2> gradient (const Point<2> &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - + std::vector > &gradients, + const unsigned int component = 0) const; + virtual void vector_gradient_list (const std::vector > &, - std::vector > >&) const; - + std::vector > >&) const; + virtual double laplacian (const Point<2> &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; }; - - - + + + /** * Gradient of the harmonic singularity on the L-shaped domain in 2D. * @@ -403,41 +403,41 @@ namespace Functions class LSingularityGradFunction : public Function<2> { public: - /** - * Default constructor setting - * the dimension to 2. - */ + /** + * Default constructor setting + * the dimension to 2. + */ LSingularityGradFunction (); virtual double value (const Point<2> &p, - const unsigned int component) const; - + const unsigned int component) const; + virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component) const; + std::vector &values, + const unsigned int component) const; virtual void vector_value_list (const std::vector >& points, - std::vector >& values) const; - + std::vector >& values) const; + virtual Tensor<1,2> gradient (const Point<2> &p, - const unsigned int component) const; - + const unsigned int component) const; + virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component) const; - + std::vector > &gradients, + const unsigned int component) const; + virtual void vector_gradient_list (const std::vector > &, - std::vector > >&) const; - + std::vector > >&) const; + virtual double laplacian (const Point<2> &p, - const unsigned int component) const; - + const unsigned int component) const; + virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component) const; + std::vector &values, + const unsigned int component) const; }; - - - + + + /** * Singularity on the slit domain in 2D and 3D. * @@ -449,34 +449,34 @@ namespace Functions { public: virtual double value (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - + std::vector &values, + const unsigned int component = 0) const; + virtual void vector_value_list (const std::vector >& points, - std::vector >& values) const; - + std::vector >& values) const; + virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - + std::vector > &gradients, + const unsigned int component = 0) const; + virtual void vector_gradient_list (const std::vector > &, - std::vector > >&) const; - + std::vector > >&) const; + virtual double laplacian (const Point &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; }; - - + + /** * Singularity on the slit domain with one Neumann boundary in 2D. * @@ -487,35 +487,35 @@ namespace Functions { public: virtual double value (const Point<2> &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - + std::vector &values, + const unsigned int component = 0) const; + virtual void vector_value_list (const std::vector >& points, - std::vector >& values) const; - + std::vector >& values) const; + virtual Tensor<1,2> gradient (const Point<2> &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - + std::vector > &gradients, + const unsigned int component = 0) const; + virtual void vector_gradient_list (const std::vector > &, - std::vector > >&) const; - + std::vector > >&) const; + virtual double laplacian (const Point<2> &p, - const unsigned int component = 0) const; - + const unsigned int component = 0) const; + virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; }; - - + + /** * A jump in x-direction transported into some direction. * @@ -535,102 +535,102 @@ namespace Functions class JumpFunction : public Function { public: - /** - * Constructor. Provide the - * advection direction here and - * the steepness of the slope. - */ + /** + * Constructor. Provide the + * advection direction here and + * the steepness of the slope. + */ JumpFunction (const Point &direction, - const double steepness); - - /** - * Function value at one point. - */ + const double steepness); + + /** + * Function value at one point. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Function values at multiple - * points. - */ + const unsigned int component = 0) const; + + /** + * Function values at multiple + * points. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Gradient at one point. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Gradient at one point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - Gradients at multiple points. - */ + const unsigned int component = 0) const; + + /** + Gradients at multiple points. + */ virtual void gradient_list (const std::vector > &points, - std::vector > &gradients, - const unsigned int component = 0) const; - - /** - * Laplacian of the function at one point. - */ + std::vector > &gradients, + const unsigned int component = 0) const; + + /** + * Laplacian of the function at one point. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; - - /** - * Laplacian of the function at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Laplacian of the function at multiple points. + */ virtual void laplacian_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + std::vector &values, + const unsigned int component = 0) const; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ std::size_t memory_consumption () const; - + protected: - /** - * Advection vector. - */ + /** + * Advection vector. + */ const Point direction; - - /** - * Steepness (maximal derivative) - * of the slope. - */ + + /** + * Steepness (maximal derivative) + * of the slope. + */ const double steepness; - - /** - * Advection angle. - */ + + /** + * Advection angle. + */ double angle; - - /** - * Sine of angle. - */ + + /** + * Sine of angle. + */ double sine; - - /** - * Cosine of angle. - */ + + /** + * Cosine of angle. + */ double cosine; }; - - - + + + /** * Given a wavenumber vector generate a cosine function. The * wavenumber coefficient is given as a $d$-dimensional point $k$ @@ -644,53 +644,53 @@ namespace Functions * @author Wolfgang Bangerth, 2001 */ template - class FourierCosineFunction : public Function + class FourierCosineFunction : public Function { public: - /** - * Constructor. Take the Fourier - * coefficients in each space - * direction as argument. - */ + /** + * Constructor. Take the Fourier + * coefficients in each space + * direction as argument. + */ FourierCosineFunction (const Point &fourier_coefficients); - - /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component you - * want to have evaluated; it - * defaults to zero, i.e. the - * first component. - */ + + /** + * Return the value of the + * function at the given + * point. Unless there is only + * one component (i.e. the + * function is scalar), you + * should state the component you + * want to have evaluated; it + * defaults to zero, i.e. the + * first component. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Return the gradient of the - * specified component of the - * function at the given point. - */ + const unsigned int component = 0) const; + + /** + * Return the gradient of the + * specified component of the + * function at the given point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - * Compute the Laplacian of a - * given component at point p. - */ + const unsigned int component = 0) const; + + /** + * Compute the Laplacian of a + * given component at point p. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; private: - /** - * Stored Fourier coefficients. - */ + /** + * Stored Fourier coefficients. + */ const Point fourier_coefficients; }; - - - + + + /** * Given a wavenumber vector generate a sine function. The * wavenumber coefficient is given as a $d$-dimensional point $k$ @@ -704,51 +704,51 @@ namespace Functions * @author Wolfgang Bangerth, 2001 */ template - class FourierSineFunction : public Function + class FourierSineFunction : public Function { public: - /** - * Constructor. Take the Fourier - * coefficients in each space - * direction as argument. - */ + /** + * Constructor. Take the Fourier + * coefficients in each space + * direction as argument. + */ FourierSineFunction (const Point &fourier_coefficients); - - /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component you - * want to have evaluated; it - * defaults to zero, i.e. the - * first component. - */ + + /** + * Return the value of the + * function at the given + * point. Unless there is only + * one component (i.e. the + * function is scalar), you + * should state the component you + * want to have evaluated; it + * defaults to zero, i.e. the + * first component. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Return the gradient of the - * specified component of the - * function at the given point. - */ + const unsigned int component = 0) const; + + /** + * Return the gradient of the + * specified component of the + * function at the given point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - * Compute the Laplacian of a - * given component at point p. - */ + const unsigned int component = 0) const; + + /** + * Compute the Laplacian of a + * given component at point p. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; private: - /** - * Stored Fourier coefficients. - */ + /** + * Stored Fourier coefficients. + */ const Point fourier_coefficients; }; - + /** * Given a sequence of wavenumber vectors and weights generate a sum @@ -761,50 +761,50 @@ namespace Functions * @author Wolfgang Bangerth, 2001 */ template - class FourierSineSum : public Function + class FourierSineSum : public Function { public: - /** - * Constructor. Take the Fourier - * coefficients in each space - * direction as argument. - */ + /** + * Constructor. Take the Fourier + * coefficients in each space + * direction as argument. + */ FourierSineSum (const std::vector > &fourier_coefficients, - const std::vector &weights); - - /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component you - * want to have evaluated; it - * defaults to zero, i.e. the - * first component. - */ + const std::vector &weights); + + /** + * Return the value of the + * function at the given + * point. Unless there is only + * one component (i.e. the + * function is scalar), you + * should state the component you + * want to have evaluated; it + * defaults to zero, i.e. the + * first component. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Return the gradient of the - * specified component of the - * function at the given point. - */ + const unsigned int component = 0) const; + + /** + * Return the gradient of the + * specified component of the + * function at the given point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - * Compute the Laplacian of a - * given component at point p. - */ + const unsigned int component = 0) const; + + /** + * Compute the Laplacian of a + * given component at point p. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; private: - /** - * Stored Fourier coefficients - * and weights. - */ + /** + * Stored Fourier coefficients + * and weights. + */ const std::vector > fourier_coefficients; const std::vector weights; }; @@ -822,51 +822,51 @@ namespace Functions * @author Wolfgang Bangerth, 2001 */ template - class FourierCosineSum : public Function + class FourierCosineSum : public Function { public: - /** - * Constructor. Take the Fourier - * coefficients in each space - * direction as argument. - */ + /** + * Constructor. Take the Fourier + * coefficients in each space + * direction as argument. + */ FourierCosineSum (const std::vector > &fourier_coefficients, - const std::vector &weights); - - /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component you - * want to have evaluated; it - * defaults to zero, i.e. the - * first component. - */ + const std::vector &weights); + + /** + * Return the value of the + * function at the given + * point. Unless there is only + * one component (i.e. the + * function is scalar), you + * should state the component you + * want to have evaluated; it + * defaults to zero, i.e. the + * first component. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Return the gradient of the - * specified component of the - * function at the given point. - */ + const unsigned int component = 0) const; + + /** + * Return the gradient of the + * specified component of the + * function at the given point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; - - /** - * Compute the Laplacian of a - * given component at point p. - */ + const unsigned int component = 0) const; + + /** + * Compute the Laplacian of a + * given component at point p. + */ virtual double laplacian (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; private: - /** - * Stored Fourier coefficients - * and weights. - */ + /** + * Stored Fourier coefficients + * and weights. + */ const std::vector > fourier_coefficients; const std::vector weights; }; @@ -885,63 +885,63 @@ namespace Functions class CutOffFunctionBase : public Function { public: - /** - * Value used in the - * constructor of this and - * derived classes to denote - * that no component is - * selected. - */ + /** + * Value used in the + * constructor of this and + * derived classes to denote + * that no component is + * selected. + */ static const unsigned int no_component = numbers::invalid_unsigned_int; - /** - * Constructor. Arguments are the - * center of the ball and its - * radius. - * - * If an argument select is - * given and not -1, the - * cut-off function will be - * non-zero for this component - * only. - */ + /** + * Constructor. Arguments are the + * center of the ball and its + * radius. + * + * If an argument select is + * given and not -1, the + * cut-off function will be + * non-zero for this component + * only. + */ CutOffFunctionBase (const double radius = 1., - const Point = Point(), - const unsigned int n_components = 1, - const unsigned int select = CutOffFunctionBase::no_component); - - /** - * Move the center of the ball - * to new point p. - */ + const Point = Point(), + const unsigned int n_components = 1, + const unsigned int select = CutOffFunctionBase::no_component); + + /** + * Move the center of the ball + * to new point p. + */ void new_center (const Point& p); - - /** - * Set the radius of the ball to r. - */ + + /** + * Set the radius of the ball to r. + */ void new_radius (const double r); protected: - /** - * Center of the integration ball. - */ + /** + * Center of the integration ball. + */ Point center; - /** - * Radius of the ball. - */ + /** + * Radius of the ball. + */ double radius; - /** - * Component selected. If - * no_component, the function is - * the same in all components. - */ + /** + * Component selected. If + * no_component, the function is + * the same in all components. + */ const unsigned int selected; }; - - - + + + /** * Cut-off function in L-infinity for an arbitrary ball. This * function is the characteristic function of a ball around center @@ -959,43 +959,43 @@ namespace Functions class CutOffFunctionLinfty : public CutOffFunctionBase { public: - /** - * Constructor. Arguments are the - * center of the ball and its - * radius. - * - * If an argument select is - * given and not -1, the - * cut-off function will be - * non-zero for this component - * only. - */ + /** + * Constructor. Arguments are the + * center of the ball and its + * radius. + * + * If an argument select is + * given and not -1, the + * cut-off function will be + * non-zero for this component + * only. + */ CutOffFunctionLinfty (const double radius = 1., - const Point = Point(), - const unsigned int n_components = 1, - const unsigned int select = CutOffFunctionBase::no_component); - - /** - * Function value at one point. - */ + const Point = Point(), + const unsigned int n_components = 1, + const unsigned int select = CutOffFunctionBase::no_component); + + /** + * Function value at one point. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Function values at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Function values at multiple points. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; - /** - * Function values at multiple points. - */ + /** + * Function values at multiple points. + */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; }; - - + + /** * Cut-off function for an arbitrary ball. This function is a cone * with support in a ball of certain radius around center. The @@ -1009,43 +1009,43 @@ namespace Functions class CutOffFunctionW1 : public CutOffFunctionBase { public: - /** - * Constructor. Arguments are the - * center of the ball and its - * radius. - * radius. - * - * If an argument select is - * given, the cut-off function - * will be non-zero for this - * component only. - */ + /** + * Constructor. Arguments are the + * center of the ball and its + * radius. + * radius. + * + * If an argument select is + * given, the cut-off function + * will be non-zero for this + * component only. + */ CutOffFunctionW1 (const double radius = 1., - const Point = Point(), - const unsigned int n_components = 1, - const unsigned int select = CutOffFunctionBase::no_component); - - /** - * Function value at one point. - */ + const Point = Point(), + const unsigned int n_components = 1, + const unsigned int select = CutOffFunctionBase::no_component); + + /** + * Function value at one point. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Function values at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Function values at multiple points. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; - /** - * Function values at multiple points. - */ + /** + * Function values at multiple points. + */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; }; - - + + /** * Cut-off function for an arbitrary ball. This is the traditional * cut-off function in C-infinity for a ball of certain radius @@ -1060,46 +1060,46 @@ namespace Functions class CutOffFunctionCinfty : public CutOffFunctionBase { public: - /** - * Constructor. Arguments are the - * center of the ball and its - * radius. - * radius. - * - * If an argument select is - * given, the cut-off function - * will be non-zero for this - * component only. - */ + /** + * Constructor. Arguments are the + * center of the ball and its + * radius. + * radius. + * + * If an argument select is + * given, the cut-off function + * will be non-zero for this + * component only. + */ CutOffFunctionCinfty (const double radius = 1., - const Point = Point(), - const unsigned int n_components = 1, - const unsigned int select = CutOffFunctionBase::no_component); - - /** - * Function value at one point. - */ + const Point = Point(), + const unsigned int n_components = 1, + const unsigned int select = CutOffFunctionBase::no_component); + + /** + * Function value at one point. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Function values at multiple points. - */ + const unsigned int component = 0) const; + + /** + * Function values at multiple points. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; - /** - * Function values at multiple points. - */ + /** + * Function values at multiple points. + */ virtual void vector_value_list (const std::vector > &points, - std::vector > &values) const; + std::vector > &values) const; - /** - * Function gradient at one point. - */ + /** + * Function gradient at one point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; }; @@ -1120,56 +1120,56 @@ namespace Functions class Monomial : public Function { public: - /** - * Constructor. The first argument is - * explained in the general description - * of the class. The second argument - * denotes the number of vector - * components this object shall - * represent. All vector components - * will have the same value. - */ + /** + * Constructor. The first argument is + * explained in the general description + * of the class. The second argument + * denotes the number of vector + * components this object shall + * represent. All vector components + * will have the same value. + */ Monomial (const Tensor<1,dim> &exponents, - const unsigned int n_components = 1); - - /** - * Function value at one point. - */ + const unsigned int n_components = 1); + + /** + * Function value at one point. + */ virtual double value (const Point &p, - const unsigned int component = 0) const; - - /** - * Return all components of a - * vector-valued function at a - * given point. - * - * values shall have the right - * size beforehand, - * i.e. #n_components. - */ + const unsigned int component = 0) const; + + /** + * Return all components of a + * vector-valued function at a + * given point. + * + * values shall have the right + * size beforehand, + * i.e. #n_components. + */ virtual void vector_value (const Point &p, - Vector &values) const; + Vector &values) const; - /** - * Function values at multiple points. - */ + /** + * Function values at multiple points. + */ virtual void value_list (const std::vector > &points, - std::vector &values, - const unsigned int component = 0) const; + std::vector &values, + const unsigned int component = 0) const; - /** - * Function gradient at one point. - */ + /** + * Function gradient at one point. + */ virtual Tensor<1,dim> gradient (const Point &p, - const unsigned int component = 0) const; + const unsigned int component = 0) const; private: - /** - * The set of exponents. - */ + /** + * The set of exponents. + */ const Tensor<1,dim> exponents; }; - + } DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/include/deal.II/base/function_parser.h b/deal.II/include/deal.II/base/function_parser.h index 40317b10f1..b6b8b17c6f 100644 --- a/deal.II/include/deal.II/base/function_parser.h +++ b/deal.II/include/deal.II/base/function_parser.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009 by the deal.II authors +// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -73,8 +73,8 @@ template class Vector; // And populate it with the newly created objects. vector_function.initialize(variables, - expressions, - constants); + expressions, + constants); @endverbatim * FunctionParser also provides an option to use units in expressions. @@ -185,12 +185,12 @@ template class Vector; The class supports these functions: abs(A) : Absolute value of A. If A is negative, returns -A otherwise - returns A. + returns A. acos(A) : Arc-cosine of A. Returns the angle, measured in radians, - whose cosine is A. + whose cosine is A. acosh(A) : Same as acos() but for hyperbolic cosine. asin(A) : Arc-sine of A. Returns the angle, measured in radians, whose - sine is A. + sine is A. asinh(A) : Same as asin() but for hyperbolic sine. atan(A) : Arc-tangent of (A). Returns the angle, measured in radians, whose tangent is (A). @@ -208,8 +208,8 @@ template class Vector; csc(A) : Cosecant of A (equivalent to 1/sin(A)). eval(...) : This a recursive call to the function to be evaluated. The number of parameters must be the same as the number of parameters - taken by the function. Usually called inside if() to avoid - infinite recursion. + taken by the function. Usually called inside if() to avoid + infinite recursion. exp(A) : Exponential of A. Returns the value of e raised to the power A where e is the base of the natural logarithm, i.e. the non-repeating value approximately equal to 2.71828182846. @@ -277,12 +277,12 @@ template class Vector; // And populate it with the newly created objects. function.initialize(variables, - expression, - constants, - true); // This tells the parser that - // it is a time-dependent function - // and there is another variable - // to be taken into account (t). + expression, + constants, + true); // This tells the parser that + // it is a time-dependent function + // and there is another variable + // to be taken into account (t). @endverbatim @@ -304,8 +304,8 @@ template class Vector; // And populate it with the newly created objects. function.initialize(variables, - expression, - constants); + expression, + constants); @endverbatim * @@ -317,43 +317,43 @@ template class FunctionParser : public Function { public: - /** - * Constructor for Parsed - * functions. Its arguments are - * the same of the base class - * Function. The only difference - * is that this object needs to - * be initialized with - * initialize() method before you - * can use it. If an attempt to - * use this function is made - * before the initialize() method - * has been called, then an - * exception is thrown. - */ + /** + * Constructor for Parsed + * functions. Its arguments are + * the same of the base class + * Function. The only difference + * is that this object needs to + * be initialized with + * initialize() method before you + * can use it. If an attempt to + * use this function is made + * before the initialize() method + * has been called, then an + * exception is thrown. + */ FunctionParser (const unsigned int n_components = 1, - const double initial_time = 0.0); - - /** - * Destructor. Explicitly delete - * the FunctionParser objects - * (there is one for each - * component of the function). - */ + const double initial_time = 0.0); + + /** + * Destructor. Explicitly delete + * the FunctionParser objects + * (there is one for each + * component of the function). + */ ~FunctionParser(); - /** - * Type for the constant - * map. Used by the initialize() - * method. - */ + /** + * Type for the constant + * map. Used by the initialize() + * method. + */ typedef std::map ConstMap; - /** - * Iterator for the constants - * map. Used by the initialize() - * method. - */ + /** + * Iterator for the constants + * map. Used by the initialize() + * method. + */ typedef ConstMap::iterator ConstMapIterator; /** @@ -478,42 +478,42 @@ class FunctionParser : public Function const bool time_dependent = false, const bool use_degrees = false); - /** - * A function that returns - * default names for variables, - * to be used in the first - * argument of the initialize() - * functions: it returns "x" in - * 1d, "x,y" in 2d, and "x,y,z" - * in 3d. - */ + /** + * A function that returns + * default names for variables, + * to be used in the first + * argument of the initialize() + * functions: it returns "x" in + * 1d, "x,y" in 2d, and "x,y,z" + * in 3d. + */ static std::string default_variable_names (); - /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component you - * want to have evaluated; it - * defaults to zero, i.e. the - * first component. - */ + /** + * Return the value of the + * function at the given + * point. Unless there is only + * one component (i.e. the + * function is scalar), you + * should state the component you + * want to have evaluated; it + * defaults to zero, i.e. the + * first component. + */ virtual double value (const Point &p, const unsigned int component = 0) const; - /** - * Return all components of a - * vector-valued function at a - * given point. - * - * values shall have the - * right size beforehand, - * i.e. #n_components. - */ + /** + * Return all components of a + * vector-valued function at a + * given point. + * + * values shall have the + * right size beforehand, + * i.e. #n_components. + */ virtual void vector_value (const Point &p, Vector &values) const; @@ -532,34 +532,34 @@ class FunctionParser : public Function //@} private: - /** - * A pointer to the actual - * function parsers. - */ + /** + * A pointer to the actual + * function parsers. + */ fparser::FunctionParser * fp; - /** - * State of usability. This - * variable is checked every time - * the function is called for - * evaluation. It's set to true - * in the initialize() methods. - */ + /** + * State of usability. This + * variable is checked every time + * the function is called for + * evaluation. It's set to true + * in the initialize() methods. + */ bool initialized; - /** - * Number of variables. If this - * is also a function of time, - * then the number of variables - * is dim+1, otherwhise it is - * dim. In the case that this is - * a time dependent function, the - * time is supposed to be the - * last variable. If #n_vars is - * not identical to the number of - * the variables parsed by the - * initialize() method, then an - * exception is thrown. + /** + * Number of variables. If this + * is also a function of time, + * then the number of variables + * is dim+1, otherwhise it is + * dim. In the case that this is + * a time dependent function, the + * time is supposed to be the + * last variable. If #n_vars is + * not identical to the number of + * the variables parsed by the + * initialize() method, then an + * exception is thrown. */ unsigned int n_vars; }; @@ -572,13 +572,13 @@ FunctionParser::default_variable_names () switch (dim) { case 1: - return "x"; + return "x"; case 2: - return "x,y"; + return "x,y"; case 3: - return "x,y,z"; + return "x,y,z"; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } return ""; } diff --git a/deal.II/include/deal.II/base/function_time.h b/deal.II/include/deal.II/base/function_time.h index c892e09bb7..d5d28254a5 100644 --- a/deal.II/include/deal.II/base/function_time.h +++ b/deal.II/include/deal.II/base/function_time.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -62,39 +62,39 @@ DEAL_II_NAMESPACE_OPEN class FunctionTime { public: - /** - * Constructor. May take an initial vakue - * for the time variable, which defaults - * to zero. - */ + /** + * Constructor. May take an initial vakue + * for the time variable, which defaults + * to zero. + */ FunctionTime (const double initial_time = 0.0); - /** - * Virtual destructor. - */ + /** + * Virtual destructor. + */ virtual ~FunctionTime(); - - /** - * Return the value of the time variable/ - */ + + /** + * Return the value of the time variable/ + */ double get_time () const; - /** - * Set the time to new_time, overwriting - * the old value. - */ + /** + * Set the time to new_time, overwriting + * the old value. + */ virtual void set_time (const double new_time); - /** - * Advance the time by the given - * time step delta_t. - */ + /** + * Advance the time by the given + * time step delta_t. + */ virtual void advance_time (const double delta_t); private: - /** - * Store the present time. - */ + /** + * Store the present time. + */ double time; }; diff --git a/deal.II/include/deal.II/base/geometry_info.h b/deal.II/include/deal.II/base/geometry_info.h index 6b24987b06..75f97619d2 100644 --- a/deal.II/include/deal.II/base/geometry_info.h +++ b/deal.II/include/deal.II/base/geometry_info.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -37,45 +37,45 @@ DEAL_II_NAMESPACE_OPEN template struct RefinementPossibilities { - /** - * Possible values for refinement - * cases in the current - * dimension. - * - * Note the construction of the - * values: the lowest bit - * describes a cut of the x-axis, - * the second to lowest bit - * corresponds to a cut of the - * y-axis and the third to lowest - * bit corresponds to a cut of - * the z-axis. Thus, the - * following relations hold - * (among others): - * - * @code - * cut_xy == cut_x | cut_y - * cut_xyz == cut_xy | cut_xz - * cut_x == cut_xy & cut_xz - * @endcode - * - * Only those cuts that are - * reasonable in a given space - * dimension are offered, of - * course. - * - * In addition, the tag - * isotropic_refinement - * denotes isotropic refinement - * in the space dimension - * selected by the template - * argument of this class. - */ + /** + * Possible values for refinement + * cases in the current + * dimension. + * + * Note the construction of the + * values: the lowest bit + * describes a cut of the x-axis, + * the second to lowest bit + * corresponds to a cut of the + * y-axis and the third to lowest + * bit corresponds to a cut of + * the z-axis. Thus, the + * following relations hold + * (among others): + * + * @code + * cut_xy == cut_x | cut_y + * cut_xyz == cut_xy | cut_xz + * cut_x == cut_xy & cut_xz + * @endcode + * + * Only those cuts that are + * reasonable in a given space + * dimension are offered, of + * course. + * + * In addition, the tag + * isotropic_refinement + * denotes isotropic refinement + * in the space dimension + * selected by the template + * argument of this class. + */ enum Possibilities { - no_refinement= 0, + no_refinement= 0, - isotropic_refinement = static_cast(-1) + isotropic_refinement = static_cast(-1) }; }; @@ -94,46 +94,46 @@ struct RefinementPossibilities template <> struct RefinementPossibilities<1> { - /** - * Possible values for refinement - * cases in the current - * dimension. - * - * Note the construction of the - * values: the lowest bit - * describes a cut of the x-axis, - * the second to lowest bit - * corresponds to a cut of the - * y-axis and the third to lowest - * bit corresponds to a cut of - * the z-axis. Thus, the - * following relations hold - * (among others): - * - * @code - * cut_xy == cut_x | cut_y - * cut_xyz == cut_xy | cut_xz - * cut_x == cut_xy & cut_xz - * @endcode - * - * Only those cuts that are - * reasonable in a given space - * dimension are offered, of - * course. - * - * In addition, the tag - * isotropic_refinement - * denotes isotropic refinement - * in the space dimension - * selected by the template - * argument of this class. - */ + /** + * Possible values for refinement + * cases in the current + * dimension. + * + * Note the construction of the + * values: the lowest bit + * describes a cut of the x-axis, + * the second to lowest bit + * corresponds to a cut of the + * y-axis and the third to lowest + * bit corresponds to a cut of + * the z-axis. Thus, the + * following relations hold + * (among others): + * + * @code + * cut_xy == cut_x | cut_y + * cut_xyz == cut_xy | cut_xz + * cut_x == cut_xy & cut_xz + * @endcode + * + * Only those cuts that are + * reasonable in a given space + * dimension are offered, of + * course. + * + * In addition, the tag + * isotropic_refinement + * denotes isotropic refinement + * in the space dimension + * selected by the template + * argument of this class. + */ enum Possibilities { - no_refinement= 0, - cut_x = 1, + no_refinement= 0, + cut_x = 1, - isotropic_refinement = cut_x + isotropic_refinement = cut_x }; }; @@ -153,48 +153,48 @@ struct RefinementPossibilities<1> template <> struct RefinementPossibilities<2> { - /** - * Possible values for refinement - * cases in the current - * dimension. - * - * Note the construction of the - * values: the lowest bit - * describes a cut of the x-axis, - * the second to lowest bit - * corresponds to a cut of the - * y-axis and the third to lowest - * bit corresponds to a cut of - * the z-axis. Thus, the - * following relations hold - * (among others): - * - * @code - * cut_xy == cut_x | cut_y - * cut_xyz == cut_xy | cut_xz - * cut_x == cut_xy & cut_xz - * @endcode - * - * Only those cuts that are - * reasonable in a given space - * dimension are offered, of - * course. - * - * In addition, the tag - * isotropic_refinement - * denotes isotropic refinement - * in the space dimension - * selected by the template - * argument of this class. - */ + /** + * Possible values for refinement + * cases in the current + * dimension. + * + * Note the construction of the + * values: the lowest bit + * describes a cut of the x-axis, + * the second to lowest bit + * corresponds to a cut of the + * y-axis and the third to lowest + * bit corresponds to a cut of + * the z-axis. Thus, the + * following relations hold + * (among others): + * + * @code + * cut_xy == cut_x | cut_y + * cut_xyz == cut_xy | cut_xz + * cut_x == cut_xy & cut_xz + * @endcode + * + * Only those cuts that are + * reasonable in a given space + * dimension are offered, of + * course. + * + * In addition, the tag + * isotropic_refinement + * denotes isotropic refinement + * in the space dimension + * selected by the template + * argument of this class. + */ enum Possibilities { - no_refinement= 0, - cut_x = 1, - cut_y = 2, - cut_xy = cut_x | cut_y, + no_refinement= 0, + cut_x = 1, + cut_y = 2, + cut_xy = cut_x | cut_y, - isotropic_refinement = cut_xy + isotropic_refinement = cut_xy }; }; @@ -215,52 +215,52 @@ struct RefinementPossibilities<2> template <> struct RefinementPossibilities<3> { - /** - * Possible values for refinement - * cases in the current - * dimension. - * - * Note the construction of the - * values: the lowest bit - * describes a cut of the x-axis, - * the second to lowest bit - * corresponds to a cut of the - * y-axis and the third to lowest - * bit corresponds to a cut of - * the z-axis. Thus, the - * following relations hold - * (among others): - * - * @code - * cut_xy == cut_x | cut_y - * cut_xyz == cut_xy | cut_xz - * cut_x == cut_xy & cut_xz - * @endcode - * - * Only those cuts that are - * reasonable in a given space - * dimension are offered, of - * course. - * - * In addition, the tag - * isotropic_refinement - * denotes isotropic refinement - * in the space dimension - * selected by the template - * argument of this class. - */ + /** + * Possible values for refinement + * cases in the current + * dimension. + * + * Note the construction of the + * values: the lowest bit + * describes a cut of the x-axis, + * the second to lowest bit + * corresponds to a cut of the + * y-axis and the third to lowest + * bit corresponds to a cut of + * the z-axis. Thus, the + * following relations hold + * (among others): + * + * @code + * cut_xy == cut_x | cut_y + * cut_xyz == cut_xy | cut_xz + * cut_x == cut_xy & cut_xz + * @endcode + * + * Only those cuts that are + * reasonable in a given space + * dimension are offered, of + * course. + * + * In addition, the tag + * isotropic_refinement + * denotes isotropic refinement + * in the space dimension + * selected by the template + * argument of this class. + */ enum Possibilities { - no_refinement= 0, - cut_x = 1, - cut_y = 2, - cut_xy = cut_x | cut_y, - cut_z = 4, - cut_xz = cut_x | cut_z, - cut_yz = cut_y | cut_z, - cut_xyz = cut_x | cut_y | cut_z, - - isotropic_refinement = cut_xyz + no_refinement= 0, + cut_x = 1, + cut_y = 2, + cut_xy = cut_x | cut_y, + cut_z = 4, + cut_xz = cut_x | cut_z, + cut_yz = cut_y | cut_z, + cut_xyz = cut_x | cut_y | cut_z, + + isotropic_refinement = cut_xyz }; }; @@ -280,110 +280,110 @@ template class RefinementCase : public RefinementPossibilities { public: - /** - * Default constructor. Initialize the - * refinement case with no_refinement. - */ + /** + * Default constructor. Initialize the + * refinement case with no_refinement. + */ RefinementCase (); - /** - * Constructor. Take and store a - * value indicating a particular - * refinement from the list of - * possible refinements specified - * in the base class. - */ + /** + * Constructor. Take and store a + * value indicating a particular + * refinement from the list of + * possible refinements specified + * in the base class. + */ RefinementCase (const typename RefinementPossibilities::Possibilities refinement_case); - /** - * Constructor. Take and store a - * value indicating a particular - * refinement as a bit field. To - * avoid implicit conversions to - * and from integral values, this - * constructor is marked as - * explicit. - */ + /** + * Constructor. Take and store a + * value indicating a particular + * refinement as a bit field. To + * avoid implicit conversions to + * and from integral values, this + * constructor is marked as + * explicit. + */ explicit RefinementCase (const unsigned char refinement_case); - /** - * Return the numeric value - * stored by this class. While - * the presence of this operator - * might seem dangerous, it is - * useful in cases where one - * would like to have code like - * switch - * (refinement_flag)... case - * RefinementCase::cut_x: - * ... , which can be - * written as switch - * (static_cast@(refinement_flag). Another - * application is to use an - * object of the current type as - * an index into an array; - * however, this use is - * deprecated as it assumes a - * certain mapping from the - * symbolic flags defined in the - * RefinementPossibilities base - * class to actual numerical - * values (the array indices). - */ + /** + * Return the numeric value + * stored by this class. While + * the presence of this operator + * might seem dangerous, it is + * useful in cases where one + * would like to have code like + * switch + * (refinement_flag)... case + * RefinementCase::cut_x: + * ... , which can be + * written as switch + * (static_cast@(refinement_flag). Another + * application is to use an + * object of the current type as + * an index into an array; + * however, this use is + * deprecated as it assumes a + * certain mapping from the + * symbolic flags defined in the + * RefinementPossibilities base + * class to actual numerical + * values (the array indices). + */ operator unsigned char () const; - /** - * Return the union of the - * refinement flags represented - * by the current object and the - * one given as argument. - */ + /** + * Return the union of the + * refinement flags represented + * by the current object and the + * one given as argument. + */ RefinementCase operator | (const RefinementCase &r) const; - /** - * Return the intersection of the - * refinement flags represented - * by the current object and the - * one given as argument. - */ + /** + * Return the intersection of the + * refinement flags represented + * by the current object and the + * one given as argument. + */ RefinementCase operator & (const RefinementCase &r) const; - /** - * Return the negation of the - * refinement flags represented - * by the current object. For - * example, in 2d, if the current - * object holds the flag - * cut_x, then the - * returned value will be - * cut_y; if the - * current value is - * isotropic_refinement - * then the result will be - * no_refinement; - * etc. - */ + /** + * Return the negation of the + * refinement flags represented + * by the current object. For + * example, in 2d, if the current + * object holds the flag + * cut_x, then the + * returned value will be + * cut_y; if the + * current value is + * isotropic_refinement + * then the result will be + * no_refinement; + * etc. + */ RefinementCase operator ~ () const; - /** - * Return the flag that - * corresponds to cutting a cell - * along the axis given as - * argument. For example, if - * i=0 then the - * returned value is - * RefinementPossibilities::cut_x. - */ + /** + * Return the flag that + * corresponds to cutting a cell + * along the axis given as + * argument. For example, if + * i=0 then the + * returned value is + * RefinementPossibilities::cut_x. + */ static RefinementCase cut_axis (const unsigned int i); - /** - * Return the amount of memory - * occupied by an object of this - * type. - */ + /** + * Return the amount of memory + * occupied by an object of this + * type. + */ static std::size_t memory_consumption (); /** @@ -392,23 +392,23 @@ class RefinementCase : public RefinementPossibilities */ template void serialize(Archive & ar, - const unsigned int version); + const unsigned int version); - /** - * Exception. - */ + /** + * Exception. + */ DeclException1 (ExcInvalidRefinementCase, - int, - << "The refinement flags given (" << arg1 << ") contain set bits that do not " - << "make sense for the space dimension of the object to which they are applied."); + int, + << "The refinement flags given (" << arg1 << ") contain set bits that do not " + << "make sense for the space dimension of the object to which they are applied."); private: - /** - * Store the refinement case as a - * bit field with as many bits as - * are necessary in any given - * dimension. - */ + /** + * Store the refinement case as a + * bit field with as many bits as + * are necessary in any given + * dimension. + */ unsigned char value : (dim > 0 ? dim : 1); }; @@ -441,16 +441,16 @@ namespace internal template struct SubfacePossibilities { - /** - * Possible cases of faces - * being subdivided into - * subface. - */ + /** + * Possible cases of faces + * being subdivided into + * subface. + */ enum Possibilities { - case_none = 0, + case_none = 0, - case_isotropic = static_cast(-1) + case_isotropic = static_cast(-1) }; }; @@ -468,18 +468,18 @@ namespace internal template <> struct SubfacePossibilities<0> { - /** - * Possible cases of faces - * being subdivided into - * subface. - * - * Dummy implementation. - */ + /** + * Possible cases of faces + * being subdivided into + * subface. + * + * Dummy implementation. + */ enum Possibilities { - case_none = 0, + case_none = 0, - case_isotropic = case_none + case_isotropic = case_none }; }; @@ -499,20 +499,20 @@ namespace internal template <> struct SubfacePossibilities<1> { - /** - * Possible cases of faces - * being subdivided into - * subface. - * - * In 1d there are no faces, - * thus no subface - * possibilities. - */ + /** + * Possible cases of faces + * being subdivided into + * subface. + * + * In 1d there are no faces, + * thus no subface + * possibilities. + */ enum Possibilities { - case_none = 0, + case_none = 0, - case_isotropic = case_none + case_isotropic = case_none }; }; @@ -533,24 +533,24 @@ namespace internal template <> struct SubfacePossibilities<2> { - /** - * Possible cases of faces - * being subdivided into - * subface. - * - * In 2d there are following - * possibilities: a face (line) - * being refined * - * (case_x) or not - * refined - * (case_no). - */ + /** + * Possible cases of faces + * being subdivided into + * subface. + * + * In 2d there are following + * possibilities: a face (line) + * being refined * + * (case_x) or not + * refined + * (case_no). + */ enum Possibilities { - case_none = 0, - case_x = 1, + case_none = 0, + case_x = 1, - case_isotropic = case_x + case_isotropic = case_x }; }; @@ -654,30 +654,30 @@ namespace internal template <> struct SubfacePossibilities<3> { - /** - * Possible cases of faces - * being subdivided into - * subface. - * - * See documentation to the - * SubfacePossibilities<3> for - * more details on the subface - * possibilities. - */ + /** + * Possible cases of faces + * being subdivided into + * subface. + * + * See documentation to the + * SubfacePossibilities<3> for + * more details on the subface + * possibilities. + */ enum Possibilities { - case_none = 0, - case_x = 1, - case_x1y = 2, - case_x2y = 3, - case_x1y2y = 4, - case_y = 5, - case_y1x = 6, - case_y2x = 7, - case_y1x2x = 8, - case_xy = 9, - - case_isotropic = case_xy + case_none = 0, + case_x = 1, + case_x1y = 2, + case_x2y = 3, + case_x1y2y = 4, + case_y = 5, + case_y1x = 6, + case_y2x = 7, + case_y1x2x = 8, + case_xy = 9, + + case_isotropic = case_xy }; }; @@ -696,65 +696,65 @@ namespace internal class SubfaceCase : public SubfacePossibilities { public: - /** - * Constructor. Take and store - * a value indicating a - * particular subface - * possibility in the list of - * possible situations - * specified in the base class. - */ + /** + * Constructor. Take and store + * a value indicating a + * particular subface + * possibility in the list of + * possible situations + * specified in the base class. + */ SubfaceCase (const typename SubfacePossibilities::Possibilities subface_possibility); - /** - * Return the numeric value - * stored by this class. While - * the presence of this operator - * might seem dangerous, it is - * useful in cases where one - * would like to have code like - * switch - * (subface_case)... case - * SubfaceCase@::case_x: - * ... , which can be - * written as switch - * (static_cast@(subface_case). Another - * application is to use an - * object of the current type as - * an index into an array; - * however, this use is - * deprecated as it assumes a - * certain mapping from the - * symbolic flags defined in the - * SubfacePossibilities - * base class to actual numerical - * values (the array indices). - */ + /** + * Return the numeric value + * stored by this class. While + * the presence of this operator + * might seem dangerous, it is + * useful in cases where one + * would like to have code like + * switch + * (subface_case)... case + * SubfaceCase@::case_x: + * ... , which can be + * written as switch + * (static_cast@(subface_case). Another + * application is to use an + * object of the current type as + * an index into an array; + * however, this use is + * deprecated as it assumes a + * certain mapping from the + * symbolic flags defined in the + * SubfacePossibilities + * base class to actual numerical + * values (the array indices). + */ operator unsigned char () const; - /** - * Return the amount of memory - * occupied by an object of this - * type. - */ + /** + * Return the amount of memory + * occupied by an object of this + * type. + */ static std::size_t memory_consumption (); - /** - * Exception. - */ + /** + * Exception. + */ DeclException1 (ExcInvalidSubfaceCase, - int, - << "The subface case given (" << arg1 << ") does not make sense " - << "for the space dimension of the object to which they are applied."); + int, + << "The subface case given (" << arg1 << ") does not make sense " + << "for the space dimension of the object to which they are applied."); private: - /** - * Store the refinement case as a - * bit field with as many bits as - * are necessary in any given - * dimension. - */ + /** + * Store the refinement case as a + * bit field with as many bits as + * are necessary in any given + * dimension. + */ unsigned char value : (dim == 3 ? 4 : 1); }; @@ -796,17 +796,17 @@ struct GeometryInfo<0> * a cell, i.e. the number of * children of an isotropically * refined cell. - * - * If a cell is refined - * anisotropically, the actual - * number of children may be less - * than the value given here. + * + * If a cell is refined + * anisotropically, the actual + * number of children may be less + * than the value given here. */ static const unsigned int max_children_per_cell = 1; - /** - * Number of faces a cell has. - */ + /** + * Number of faces a cell has. + */ static const unsigned int faces_per_cell = 0; /** @@ -814,65 +814,65 @@ struct GeometryInfo<0> * a refined face, i.e. the * number of children of an * isotropically refined face. - * - * If a cell is refined - * anisotropically, the actual - * number of children may be less - * than the value given here. + * + * If a cell is refined + * anisotropically, the actual + * number of children may be less + * than the value given here. */ static const unsigned int max_children_per_face = 0; - /** - * Return the number of children - * of a cell (or face) refined - * with ref_case. Since - * we are concerned here with - * points, the number of children - * is equal to one. - */ + /** + * Return the number of children + * of a cell (or face) refined + * with ref_case. Since + * we are concerned here with + * points, the number of children + * is equal to one. + */ static unsigned int n_children(const RefinementCase<0> &refinement_case); - /** - * Number of vertices a cell has. - */ + /** + * Number of vertices a cell has. + */ static const unsigned int vertices_per_cell = 1; - /** - * Number of vertices each face has. - * Since this is not useful in one - * dimension, we provide a useless - * number (in the hope that a compiler - * may warn when it sees constructs like - * for (i=0; i, - * at least if @p i is an unsigned int. - */ + /** + * Number of vertices each face has. + * Since this is not useful in one + * dimension, we provide a useless + * number (in the hope that a compiler + * may warn when it sees constructs like + * for (i=0; i, + * at least if @p i is an unsigned int. + */ static const unsigned int vertices_per_face = 0; - /** - * Number of lines each face has. - */ + /** + * Number of lines each face has. + */ static const unsigned int lines_per_face = 0; - /** - * Number of quads on each face. - */ + /** + * Number of quads on each face. + */ static const unsigned int quads_per_face = 0; - /** - * Number of lines of a cell. - */ + /** + * Number of lines of a cell. + */ static const unsigned int lines_per_cell = 0; - /** - * Number of quadrilaterals of a - * cell. - */ + /** + * Number of quadrilaterals of a + * cell. + */ static const unsigned int quads_per_cell = 0; - /** - * Number of hexahedra of a - * cell. - */ + /** + * Number of hexahedra of a + * cell. + */ static const unsigned int hexes_per_cell = 0; }; @@ -1420,17 +1420,17 @@ struct GeometryInfo * a refined cell, i.e. the * number of children of an * isotropically refined cell. - * - * If a cell is refined - * anisotropically, the actual - * number of children may be less - * than the value given here. + * + * If a cell is refined + * anisotropically, the actual + * number of children may be less + * than the value given here. */ static const unsigned int max_children_per_cell = 1 << dim; - /** - * Number of faces of a cell. - */ + /** + * Number of faces of a cell. + */ static const unsigned int faces_per_cell = 2 * dim; /** @@ -1438,126 +1438,126 @@ struct GeometryInfo * a refined face, i.e. the * number of children of an * isotropically refined face. - * - * If a cell is refined - * anisotropically, the actual - * number of children may be less - * than the value given here. + * + * If a cell is refined + * anisotropically, the actual + * number of children may be less + * than the value given here. */ static const unsigned int max_children_per_face = GeometryInfo::max_children_per_cell; - /** - * Number of vertices of a cell. - */ + /** + * Number of vertices of a cell. + */ static const unsigned int vertices_per_cell = 1 << dim; - /** - * Number of vertices on each - * face. - */ + /** + * Number of vertices on each + * face. + */ static const unsigned int vertices_per_face = GeometryInfo::vertices_per_cell; - /** - * Number of lines on each face. - */ + /** + * Number of lines on each face. + */ static const unsigned int lines_per_face = GeometryInfo::lines_per_cell; - /** - * Number of quads on each face. - */ + /** + * Number of quads on each face. + */ static const unsigned int quads_per_face = GeometryInfo::quads_per_cell; - /** - * Number of lines of a cell. - * - * The formula to compute this makes use - * of the fact that when going from one - * dimension to the next, the object of - * the lower dimension is copied once - * (thus twice the old number of lines) - * and then a new line is inserted - * between each vertex of the old object - * and the corresponding one in the copy. - */ + /** + * Number of lines of a cell. + * + * The formula to compute this makes use + * of the fact that when going from one + * dimension to the next, the object of + * the lower dimension is copied once + * (thus twice the old number of lines) + * and then a new line is inserted + * between each vertex of the old object + * and the corresponding one in the copy. + */ static const unsigned int lines_per_cell = (2*GeometryInfo::lines_per_cell + GeometryInfo::vertices_per_cell); - /** - * Number of quadrilaterals of a - * cell. - * - * This number is computed recursively - * just as the previous one, with the - * exception that new quads result from - * connecting an original line and its - * copy. - */ + /** + * Number of quadrilaterals of a + * cell. + * + * This number is computed recursively + * just as the previous one, with the + * exception that new quads result from + * connecting an original line and its + * copy. + */ static const unsigned int quads_per_cell = (2*GeometryInfo::quads_per_cell + GeometryInfo::lines_per_cell); - /** - * Number of hexahedra of a - * cell. - */ + /** + * Number of hexahedra of a + * cell. + */ static const unsigned int hexes_per_cell = (2*GeometryInfo::hexes_per_cell + GeometryInfo::quads_per_cell); - /** - * Rearrange vertices for UCD - * output. For a cell being - * written in UCD format, each - * entry in this field contains - * the number of a vertex in - * deal.II that corresponds - * to the UCD numbering at this - * location. - * - * Typical example: write a cell - * and arrange the vertices, such - * that UCD understands them. - * - * @code - * for (i=0; i< n_vertices; ++i) - * out << cell->vertex(ucd_to_deal[i]); - * @endcode - * - * As the vertex numbering in - * deal.II versions <= 5.1 - * happened to coincide with the - * UCD numbering, this field can - * also be used like a - * old_to_lexicographic mapping. - */ + /** + * Rearrange vertices for UCD + * output. For a cell being + * written in UCD format, each + * entry in this field contains + * the number of a vertex in + * deal.II that corresponds + * to the UCD numbering at this + * location. + * + * Typical example: write a cell + * and arrange the vertices, such + * that UCD understands them. + * + * @code + * for (i=0; i< n_vertices; ++i) + * out << cell->vertex(ucd_to_deal[i]); + * @endcode + * + * As the vertex numbering in + * deal.II versions <= 5.1 + * happened to coincide with the + * UCD numbering, this field can + * also be used like a + * old_to_lexicographic mapping. + */ static const unsigned int ucd_to_deal[vertices_per_cell]; - /** - * Rearrange vertices for OpenDX - * output. For a cell being - * written in OpenDX format, each - * entry in this field contains - * the number of a vertex in - * deal.II that corresponds - * to the DX numbering at this - * location. - * - * Typical example: write a cell - * and arrange the vertices, such - * that OpenDX understands them. - * - * @code - * for (i=0; i< n_vertices; ++i) - * out << cell->vertex(dx_to_deal[i]); - * @endcode - */ + /** + * Rearrange vertices for OpenDX + * output. For a cell being + * written in OpenDX format, each + * entry in this field contains + * the number of a vertex in + * deal.II that corresponds + * to the DX numbering at this + * location. + * + * Typical example: write a cell + * and arrange the vertices, such + * that OpenDX understands them. + * + * @code + * for (i=0; i< n_vertices; ++i) + * out << cell->vertex(dx_to_deal[i]); + * @endcode + */ static const unsigned int dx_to_deal[vertices_per_cell]; /** - * This field stores for each vertex + * This field stores for each vertex * to which faces it belongs. In any * given dimension, the number of * faces is equal to the dimension. @@ -1568,69 +1568,69 @@ struct GeometryInfo */ static const unsigned int vertex_to_face[vertices_per_cell][dim]; - /** - * Return the number of children - * of a cell (or face) refined - * with ref_case. - */ + /** + * Return the number of children + * of a cell (or face) refined + * with ref_case. + */ static unsigned int n_children(const RefinementCase &refinement_case); - /** - * Return the number of subfaces - * of a face refined according to - * internal::SubfaceCase - * @p face_ref_case. - */ + /** + * Return the number of subfaces + * of a face refined according to + * internal::SubfaceCase + * @p face_ref_case. + */ static unsigned int n_subfaces(const internal::SubfaceCase &subface_case); - /** - * Given a face on the reference - * element with a - * internal::SubfaceCase@ - * @p face_refinement_case this - * function returns the ratio - * between the area of the @p - * subface_no th subface and the - * area(=1) of the face. - * - * E.g. for - * internal::SubfaceCase@<3@>::cut_xy - * the ratio is 1/4 for each of - * the subfaces. - */ + /** + * Given a face on the reference + * element with a + * internal::SubfaceCase@ + * @p face_refinement_case this + * function returns the ratio + * between the area of the @p + * subface_no th subface and the + * area(=1) of the face. + * + * E.g. for + * internal::SubfaceCase@<3@>::cut_xy + * the ratio is 1/4 for each of + * the subfaces. + */ static double subface_ratio(const internal::SubfaceCase &subface_case, - const unsigned int subface_no); - - /** - * Given a cell refined with the - * RefinementCase - * @p cell_refinement_case - * return the - * SubfaceCase of - * the @p face_no th face. - */ + const unsigned int subface_no); + + /** + * Given a cell refined with the + * RefinementCase + * @p cell_refinement_case + * return the + * SubfaceCase of + * the @p face_no th face. + */ static RefinementCase face_refinement_case (const RefinementCase &cell_refinement_case, - const unsigned int face_no, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false); - - /** - * Given the SubfaceCase @p - * face_refinement_case of the @p - * face_no th face, return the - * smallest RefinementCase of the - * cell, which corresponds to - * that refinement of the face. - */ + const unsigned int face_no, + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false); + + /** + * Given the SubfaceCase @p + * face_refinement_case of the @p + * face_no th face, return the + * smallest RefinementCase of the + * cell, which corresponds to + * that refinement of the face. + */ static RefinementCase min_cell_refinement_case_for_face_refinement @@ -1640,385 +1640,385 @@ struct GeometryInfo const bool face_flip = false, const bool face_rotation = false); - /** - * Given a cell refined with the - * RefinementCase @p - * cell_refinement_case return - * the RefinementCase of the @p - * line_no th face. - */ + /** + * Given a cell refined with the + * RefinementCase @p + * cell_refinement_case return + * the RefinementCase of the @p + * line_no th face. + */ static RefinementCase<1> line_refinement_case(const RefinementCase &cell_refinement_case, - const unsigned int line_no); - - /** - * Return the minimal / smallest - * RefinementCase of the cell, which - * ensures refinement of line - * @p line_no. - */ + const unsigned int line_no); + + /** + * Return the minimal / smallest + * RefinementCase of the cell, which + * ensures refinement of line + * @p line_no. + */ static RefinementCase min_cell_refinement_case_for_line_refinement(const unsigned int line_no); /** - * This field stores which child - * cells are adjacent to a - * certain face of the mother - * cell. - * - * For example, in 2D the layout of - * a cell is as follows: - * @verbatim - * . 3 - * . 2-->--3 - * . | | - * . 0 ^ ^ 1 - * . | | - * . 0-->--1 - * . 2 - * @endverbatim - * Vertices and faces are indicated - * with their numbers, faces also with - * their directions. - * - * Now, when refined, the layout is - * like this: - * @verbatim - * *--*--* - * | 2|3 | - * *--*--* - * | 0|1 | - * *--*--* - * @endverbatim - * - * Thus, the child cells on face - * 0 are (ordered in the - * direction of the face) 0 and - * 2, on face 3 they are 2 and 3, - * etc. - * - * For three spatial dimensions, the exact - * order of the children is laid down in - * the general documentation of this - * class. - * - * Through the face_orientation, - * face_flip and - * face_rotation arguments this - * function handles faces oriented in the - * standard and non-standard orientation. - * face_orientation defaults to - * true, face_flip and - * face_rotation default to - * false (standard orientation) - * and has no effect in 2d. The concept of - * face orientations is explained in this - * @ref GlossFaceOrientation "glossary" - * entry. - * - * In the case of anisotropically refined - * cells and faces, the @p RefinementCase of - * the face, face_ref_case, - * might have an influence on - * which child is behind which given - * subface, thus this is an additional - * argument, defaulting to isotropic - * refinement of the face. - */ + * This field stores which child + * cells are adjacent to a + * certain face of the mother + * cell. + * + * For example, in 2D the layout of + * a cell is as follows: + * @verbatim + * . 3 + * . 2-->--3 + * . | | + * . 0 ^ ^ 1 + * . | | + * . 0-->--1 + * . 2 + * @endverbatim + * Vertices and faces are indicated + * with their numbers, faces also with + * their directions. + * + * Now, when refined, the layout is + * like this: + * @verbatim + * *--*--* + * | 2|3 | + * *--*--* + * | 0|1 | + * *--*--* + * @endverbatim + * + * Thus, the child cells on face + * 0 are (ordered in the + * direction of the face) 0 and + * 2, on face 3 they are 2 and 3, + * etc. + * + * For three spatial dimensions, the exact + * order of the children is laid down in + * the general documentation of this + * class. + * + * Through the face_orientation, + * face_flip and + * face_rotation arguments this + * function handles faces oriented in the + * standard and non-standard orientation. + * face_orientation defaults to + * true, face_flip and + * face_rotation default to + * false (standard orientation) + * and has no effect in 2d. The concept of + * face orientations is explained in this + * @ref GlossFaceOrientation "glossary" + * entry. + * + * In the case of anisotropically refined + * cells and faces, the @p RefinementCase of + * the face, face_ref_case, + * might have an influence on + * which child is behind which given + * subface, thus this is an additional + * argument, defaulting to isotropic + * refinement of the face. + */ static unsigned int child_cell_on_face (const RefinementCase &ref_case, - const unsigned int face, - const unsigned int subface, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false, - const RefinementCase &face_refinement_case - = RefinementCase::isotropic_refinement); - - /** - * Map line vertex number to cell - * vertex number, i.e. give the - * cell vertex number of the - * vertexth vertex of - * line line, e.g. - * GeometryInfo<2>::line_to_cell_vertices(3,0)=2. - * - * The order of the lines, as well as - * their direction (which in turn - * determines which is the first and - * which the second vertex on a line) is - * the canonical one in deal.II, as - * described in the general documentation - * of this class. - * - * For dim=2 this call - * is simply passed down to the - * face_to_cell_vertices() - * function. - */ + const unsigned int face, + const unsigned int subface, + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false, + const RefinementCase &face_refinement_case + = RefinementCase::isotropic_refinement); + + /** + * Map line vertex number to cell + * vertex number, i.e. give the + * cell vertex number of the + * vertexth vertex of + * line line, e.g. + * GeometryInfo<2>::line_to_cell_vertices(3,0)=2. + * + * The order of the lines, as well as + * their direction (which in turn + * determines which is the first and + * which the second vertex on a line) is + * the canonical one in deal.II, as + * described in the general documentation + * of this class. + * + * For dim=2 this call + * is simply passed down to the + * face_to_cell_vertices() + * function. + */ static unsigned int line_to_cell_vertices (const unsigned int line, - const unsigned int vertex); - - /** - * Map face vertex number to cell - * vertex number, i.e. give the - * cell vertex number of the - * vertexth vertex of - * face face, e.g. - * GeometryInfo<2>::face_to_cell_vertices(3,0)=2, - * see the image under point N4 - * in the 2d section of this - * class's documentation. - * - * Through the face_orientation, - * face_flip and - * face_rotation arguments this - * function handles faces oriented in the - * standard and non-standard orientation. - * face_orientation defaults to - * true, face_flip and - * face_rotation default to - * false (standard orientation) - * and has no effect in 2d. - * - * As the children of a cell are - * ordered according to the - * vertices of the cell, this - * call is passed down to the - * child_cell_on_face() function. - * Hence this function is simply - * a wrapper of - * child_cell_on_face() giving it - * a suggestive name. - */ + const unsigned int vertex); + + /** + * Map face vertex number to cell + * vertex number, i.e. give the + * cell vertex number of the + * vertexth vertex of + * face face, e.g. + * GeometryInfo<2>::face_to_cell_vertices(3,0)=2, + * see the image under point N4 + * in the 2d section of this + * class's documentation. + * + * Through the face_orientation, + * face_flip and + * face_rotation arguments this + * function handles faces oriented in the + * standard and non-standard orientation. + * face_orientation defaults to + * true, face_flip and + * face_rotation default to + * false (standard orientation) + * and has no effect in 2d. + * + * As the children of a cell are + * ordered according to the + * vertices of the cell, this + * call is passed down to the + * child_cell_on_face() function. + * Hence this function is simply + * a wrapper of + * child_cell_on_face() giving it + * a suggestive name. + */ static unsigned int face_to_cell_vertices (const unsigned int face, - const unsigned int vertex, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false); - - /** - * Map face line number to cell - * line number, i.e. give the - * cell line number of the - * lineth line of face - * face, e.g. - * GeometryInfo<3>::face_to_cell_lines(5,0)=4. - * - * Through the face_orientation, - * face_flip and - * face_rotation arguments this - * function handles faces oriented in the - * standard and non-standard orientation. - * face_orientation defaults to - * true, face_flip and - * face_rotation default to - * false (standard orientation) - * and has no effect in 2d. - */ + const unsigned int vertex, + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false); + + /** + * Map face line number to cell + * line number, i.e. give the + * cell line number of the + * lineth line of face + * face, e.g. + * GeometryInfo<3>::face_to_cell_lines(5,0)=4. + * + * Through the face_orientation, + * face_flip and + * face_rotation arguments this + * function handles faces oriented in the + * standard and non-standard orientation. + * face_orientation defaults to + * true, face_flip and + * face_rotation default to + * false (standard orientation) + * and has no effect in 2d. + */ static unsigned int face_to_cell_lines (const unsigned int face, - const unsigned int line, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false); - - /** - * Map the vertex index @p vertex of a face - * in standard orientation to one of a face - * with arbitrary @p face_orientation, @p - * face_flip and @p face_rotation. The - * values of these three flags default to - * true, false and - * false, respectively. this - * combination describes a face in standard - * orientation. - * - * This function is only implemented in 3D. - */ + const unsigned int line, + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false); + + /** + * Map the vertex index @p vertex of a face + * in standard orientation to one of a face + * with arbitrary @p face_orientation, @p + * face_flip and @p face_rotation. The + * values of these three flags default to + * true, false and + * false, respectively. this + * combination describes a face in standard + * orientation. + * + * This function is only implemented in 3D. + */ static unsigned int standard_to_real_face_vertex (const unsigned int vertex, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false); - - /** - * Map the vertex index @p vertex of a face - * with arbitrary @p face_orientation, @p - * face_flip and @p face_rotation to a face - * in standard orientation. The values of - * these three flags default to - * true, false and - * false, respectively. this - * combination describes a face in standard - * orientation. - * - * This function is only implemented in 3D. - */ + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false); + + /** + * Map the vertex index @p vertex of a face + * with arbitrary @p face_orientation, @p + * face_flip and @p face_rotation to a face + * in standard orientation. The values of + * these three flags default to + * true, false and + * false, respectively. this + * combination describes a face in standard + * orientation. + * + * This function is only implemented in 3D. + */ static unsigned int real_to_standard_face_vertex (const unsigned int vertex, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false); - - /** - * Map the line index @p line of a face - * in standard orientation to one of a face - * with arbitrary @p face_orientation, @p - * face_flip and @p face_rotation. The - * values of these three flags default to - * true, false and - * false, respectively. this - * combination describes a face in standard - * orientation. - * - * This function is only implemented in 3D. - */ + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false); + + /** + * Map the line index @p line of a face + * in standard orientation to one of a face + * with arbitrary @p face_orientation, @p + * face_flip and @p face_rotation. The + * values of these three flags default to + * true, false and + * false, respectively. this + * combination describes a face in standard + * orientation. + * + * This function is only implemented in 3D. + */ static unsigned int standard_to_real_face_line (const unsigned int line, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false); - - /** - * Map the line index @p line of a face - * with arbitrary @p face_orientation, @p - * face_flip and @p face_rotation to a face - * in standard orientation. The values of - * these three flags default to - * true, false and - * false, respectively. this - * combination describes a face in standard - * orientation. - * - * This function is only implemented in 3D. - */ + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false); + + /** + * Map the line index @p line of a face + * with arbitrary @p face_orientation, @p + * face_flip and @p face_rotation to a face + * in standard orientation. The values of + * these three flags default to + * true, false and + * false, respectively. this + * combination describes a face in standard + * orientation. + * + * This function is only implemented in 3D. + */ static unsigned int real_to_standard_face_line (const unsigned int line, - const bool face_orientation = true, - const bool face_flip = false, - const bool face_rotation = false); - - /** - * Return the position of the @p ith - * vertex on the unit cell. The order of - * vertices is the canonical one in - * deal.II, as described in the general - * documentation of this class. - */ + const bool face_orientation = true, + const bool face_flip = false, + const bool face_rotation = false); + + /** + * Return the position of the @p ith + * vertex on the unit cell. The order of + * vertices is the canonical one in + * deal.II, as described in the general + * documentation of this class. + */ static Point unit_cell_vertex (const unsigned int vertex); - /** - * Given a point @p p in unit - * coordinates, return the number - * of the child cell in which it - * would lie in. If the point - * lies on the interface of two - * children, return any one of - * their indices. The result is - * always less than - * GeometryInfo::max_children_per_cell. - * - * The order of child cells is described - * the general documentation of this - * class. - */ + /** + * Given a point @p p in unit + * coordinates, return the number + * of the child cell in which it + * would lie in. If the point + * lies on the interface of two + * children, return any one of + * their indices. The result is + * always less than + * GeometryInfo::max_children_per_cell. + * + * The order of child cells is described + * the general documentation of this + * class. + */ static unsigned int child_cell_from_point (const Point &p); - /** - * Given coordinates @p p on the - * unit cell, return the values - * of the coordinates of this - * point in the coordinate system - * of the given child. Neither - * original nor returned - * coordinates need actually be - * inside the cell, we simply - * perform a scale-and-shift - * operation with a shift that - * depends on the number of the - * child. - */ + /** + * Given coordinates @p p on the + * unit cell, return the values + * of the coordinates of this + * point in the coordinate system + * of the given child. Neither + * original nor returned + * coordinates need actually be + * inside the cell, we simply + * perform a scale-and-shift + * operation with a shift that + * depends on the number of the + * child. + */ static Point cell_to_child_coordinates (const Point &p, - const unsigned int child_index, - const RefinementCase refine_case - = RefinementCase::isotropic_refinement); - - /** - * The reverse function to the - * one above: take a point in the - * coordinate system of the - * child, and transform it to the - * coordinate system of the - * mother cell. - */ + const unsigned int child_index, + const RefinementCase refine_case + = RefinementCase::isotropic_refinement); + + /** + * The reverse function to the + * one above: take a point in the + * coordinate system of the + * child, and transform it to the + * coordinate system of the + * mother cell. + */ static Point child_to_cell_coordinates (const Point &p, - const unsigned int child_index, - const RefinementCase refine_case - = RefinementCase::isotropic_refinement); - - /** - * Return true if the given point - * is inside the unit cell of the - * present space dimension. - */ + const unsigned int child_index, + const RefinementCase refine_case + = RefinementCase::isotropic_refinement); + + /** + * Return true if the given point + * is inside the unit cell of the + * present space dimension. + */ static bool is_inside_unit_cell (const Point &p); - /** - * Return true if the given point - * is inside the unit cell of the - * present space dimension. This - * * function accepts an - * additional * parameter which - * specifies how * much the point - * position may * actually be - * outside the true * unit - * cell. This is useful because - * in practice we may often not - * be able to compute the - * coordinates of a point in - * reference coordinates exactly, - * but only up to numerical - * roundoff. - * - * The tolerance parameter may be - * less than zero, indicating - * that the point should be - * safely inside the cell. - */ + /** + * Return true if the given point + * is inside the unit cell of the + * present space dimension. This + * * function accepts an + * additional * parameter which + * specifies how * much the point + * position may * actually be + * outside the true * unit + * cell. This is useful because + * in practice we may often not + * be able to compute the + * coordinates of a point in + * reference coordinates exactly, + * but only up to numerical + * roundoff. + * + * The tolerance parameter may be + * less than zero, indicating + * that the point should be + * safely inside the cell. + */ static bool is_inside_unit_cell (const Point &p, - const double eps); + const double eps); - /** - * Projects a given point onto the + /** + * Projects a given point onto the * unit cell, i.e. each coordinate * outside [0..1] is modified * to lie within that interval. - */ + */ static Point project_to_unit_cell (const Point &p); @@ -2035,122 +2035,122 @@ struct GeometryInfo double distance_to_unit_cell (const Point &p); - /** - * Compute the value of the $i$-th - * $d$-linear (i.e. (bi-,tri-)linear) - * shape function at location $\xi$. - */ + /** + * Compute the value of the $i$-th + * $d$-linear (i.e. (bi-,tri-)linear) + * shape function at location $\xi$. + */ static double d_linear_shape_function (const Point &xi, - const unsigned int i); + const unsigned int i); - /** - * Compute the gradient of the $i$-th - * $d$-linear (i.e. (bi-,tri-)linear) - * shape function at location $\xi$. - */ + /** + * Compute the gradient of the $i$-th + * $d$-linear (i.e. (bi-,tri-)linear) + * shape function at location $\xi$. + */ static Tensor<1,dim> d_linear_shape_function_gradient (const Point &xi, - const unsigned int i); - - /** - * For a (bi-, tri-)linear - * mapping from the reference - * cell, face, or edge to the - * object specified by the given - * vertices, compute the - * alternating form of the - * transformed unit vectors - * vertices. For an object of - * dimensionality @p dim, there - * are @p dim vectors with @p - * spacedim components each, and - * the alternating form is a - * tensor of rank spacedim-dim - * that corresponds to the wedge - * product of the @p dim unit - * vectors, and it corresponds to - * the volume and normal vectors - * of the mapping from reference - * element to the element - * described by the vertices. - * - * For example, if dim==spacedim==2, then - * the alternating form is a scalar - * (because spacedim-dim=0) and its value - * equals $\mathbf v_1\wedge \mathbf - * v_2=\mathbf v_1^\perp \cdot\mathbf - * v_2$, where $\mathbf v_1^\perp$ is a - * vector that is rotated to the right by - * 90 degrees from $\mathbf v_1$. If - * dim==spacedim==3, then the result is - * again a scalar with value $\mathbf - * v_1\wedge \mathbf v_2 \wedge \mathbf - * v_3 = (\mathbf v_1\times \mathbf - * v_2)\cdot \mathbf v_3$, where $\mathbf - * v_1, \mathbf v_2, \mathbf v_3$ are the - * images of the unit vectors at a vertex - * of the unit dim-dimensional cell under - * transformation to the dim-dimensional - * cell in spacedim-dimensional space. In - * both cases, i.e. for dim==2 or 3, the - * result happens to equal the - * determinant of the Jacobian of the - * mapping from reference cell to cell in - * real space. Note that it is the actual - * determinant, not its absolute value as - * often used in transforming integrals - * from one coordinate system to - * another. In particular, if the object - * specified by the vertices is a - * parallelogram (i.e. a linear - * transformation of the reference cell) - * then the computed values are the same - * at all vertices and equal the (signed) - * area of the cell; similarly, for - * parallel-epipeds, it is the volume of - * the cell. - * - * Likewise, if we have dim==spacedim-1 - * (e.g. we have a quad in 3d space, or a - * line in 2d), then the alternating - * product denotes the normal vector - * (i.e. a rank-1 tensor, since - * spacedim-dim=1) to the object at each - * vertex, where the normal vector's - * magnitude denotes the area element of - * the transformation from the reference - * object to the object given by the - * vertices. In particular, if again the - * mapping from reference object to the - * object under consideration here is - * linear (not bi- or trilinear), then - * the returned vectors are all - * %parallel, perpendicular to the mapped - * object described by the vertices, and - * have a magnitude equal to the - * area/volume of the mapped object. If - * dim=1, spacedim=2, then the returned - * value is $\mathbf v_1^\perp$, where - * $\mathbf v_1$ is the image of the sole - * unit vector of a line mapped to the - * line in 2d given by the vertices; if - * dim=2, spacedim=3, then the returned - * values are $\mathbf v_1 \wedge \mathbf - * v_2=\mathbf v_1 \times \mathbf v_2$ - * where $\mathbf v_1,\mathbf v_2$ are - * the two three-dimensional vectors that - * are tangential to the quad mapped into - * three-dimensional space. - * - * This function is used in order to - * determine how distorted a cell is (see - * the entry on - * @ref GlossDistorted "distorted cells" - * in the glossary). - */ + const unsigned int i); + + /** + * For a (bi-, tri-)linear + * mapping from the reference + * cell, face, or edge to the + * object specified by the given + * vertices, compute the + * alternating form of the + * transformed unit vectors + * vertices. For an object of + * dimensionality @p dim, there + * are @p dim vectors with @p + * spacedim components each, and + * the alternating form is a + * tensor of rank spacedim-dim + * that corresponds to the wedge + * product of the @p dim unit + * vectors, and it corresponds to + * the volume and normal vectors + * of the mapping from reference + * element to the element + * described by the vertices. + * + * For example, if dim==spacedim==2, then + * the alternating form is a scalar + * (because spacedim-dim=0) and its value + * equals $\mathbf v_1\wedge \mathbf + * v_2=\mathbf v_1^\perp \cdot\mathbf + * v_2$, where $\mathbf v_1^\perp$ is a + * vector that is rotated to the right by + * 90 degrees from $\mathbf v_1$. If + * dim==spacedim==3, then the result is + * again a scalar with value $\mathbf + * v_1\wedge \mathbf v_2 \wedge \mathbf + * v_3 = (\mathbf v_1\times \mathbf + * v_2)\cdot \mathbf v_3$, where $\mathbf + * v_1, \mathbf v_2, \mathbf v_3$ are the + * images of the unit vectors at a vertex + * of the unit dim-dimensional cell under + * transformation to the dim-dimensional + * cell in spacedim-dimensional space. In + * both cases, i.e. for dim==2 or 3, the + * result happens to equal the + * determinant of the Jacobian of the + * mapping from reference cell to cell in + * real space. Note that it is the actual + * determinant, not its absolute value as + * often used in transforming integrals + * from one coordinate system to + * another. In particular, if the object + * specified by the vertices is a + * parallelogram (i.e. a linear + * transformation of the reference cell) + * then the computed values are the same + * at all vertices and equal the (signed) + * area of the cell; similarly, for + * parallel-epipeds, it is the volume of + * the cell. + * + * Likewise, if we have dim==spacedim-1 + * (e.g. we have a quad in 3d space, or a + * line in 2d), then the alternating + * product denotes the normal vector + * (i.e. a rank-1 tensor, since + * spacedim-dim=1) to the object at each + * vertex, where the normal vector's + * magnitude denotes the area element of + * the transformation from the reference + * object to the object given by the + * vertices. In particular, if again the + * mapping from reference object to the + * object under consideration here is + * linear (not bi- or trilinear), then + * the returned vectors are all + * %parallel, perpendicular to the mapped + * object described by the vertices, and + * have a magnitude equal to the + * area/volume of the mapped object. If + * dim=1, spacedim=2, then the returned + * value is $\mathbf v_1^\perp$, where + * $\mathbf v_1$ is the image of the sole + * unit vector of a line mapped to the + * line in 2d given by the vertices; if + * dim=2, spacedim=3, then the returned + * values are $\mathbf v_1 \wedge \mathbf + * v_2=\mathbf v_1 \times \mathbf v_2$ + * where $\mathbf v_1,\mathbf v_2$ are + * the two three-dimensional vectors that + * are tangential to the quad mapped into + * three-dimensional space. + * + * This function is used in order to + * determine how distorted a cell is (see + * the entry on + * @ref GlossDistorted "distorted cells" + * in the glossary). + */ template static void @@ -2165,74 +2165,74 @@ struct GeometryInfo ; /** - * For each face of the reference - * cell, this field stores the - * coordinate direction in which - * its normal vector points. In - * dim dimension these - * are the 2*dim first - * entries of - * {0,0,1,1,2,2,3,3}. - * - * Note that this is only the - * coordinate number. The actual - * direction of the normal vector - * is obtained by multiplying the - * unit vector in this direction - * with #unit_normal_orientation. - */ + * For each face of the reference + * cell, this field stores the + * coordinate direction in which + * its normal vector points. In + * dim dimension these + * are the 2*dim first + * entries of + * {0,0,1,1,2,2,3,3}. + * + * Note that this is only the + * coordinate number. The actual + * direction of the normal vector + * is obtained by multiplying the + * unit vector in this direction + * with #unit_normal_orientation. + */ static const unsigned int unit_normal_direction[faces_per_cell]; - /** - * Orientation of the unit normal - * vector of a face of the - * reference cell. In - * dim dimension these - * are the 2*dim first - * entries of - * {-1,1,-1,1,-1,1,-1,1}. - * - * Each value is either - * 1 or -1, - * corresponding to a normal - * vector pointing in the - * positive or negative - * coordinate direction, - * respectively. - * - * Note that this is only the - * standard orientation - * of faces. At least in 3d, - * actual faces of cells in a - * triangulation can also have - * the opposite orientation, - * depending on a flag that one - * can query from the cell it - * belongs to. For more - * information, see the - * @ref GlossFaceOrientation "glossary" - * entry on - * face orientation. - */ + /** + * Orientation of the unit normal + * vector of a face of the + * reference cell. In + * dim dimension these + * are the 2*dim first + * entries of + * {-1,1,-1,1,-1,1,-1,1}. + * + * Each value is either + * 1 or -1, + * corresponding to a normal + * vector pointing in the + * positive or negative + * coordinate direction, + * respectively. + * + * Note that this is only the + * standard orientation + * of faces. At least in 3d, + * actual faces of cells in a + * triangulation can also have + * the opposite orientation, + * depending on a flag that one + * can query from the cell it + * belongs to. For more + * information, see the + * @ref GlossFaceOrientation "glossary" + * entry on + * face orientation. + */ static const int unit_normal_orientation[faces_per_cell]; - /** - * List of numbers which denotes which - * face is opposite to a given face. Its - * entries are the first 2*dim - * entries of - * { 1, 0, 3, 2, 5, 4, 7, 6}. - */ + /** + * List of numbers which denotes which + * face is opposite to a given face. Its + * entries are the first 2*dim + * entries of + * { 1, 0, 3, 2, 5, 4, 7, 6}. + */ static const unsigned int opposite_face[faces_per_cell]; /** - * Exception - */ + * Exception + */ DeclException1 (ExcInvalidCoordinate, - double, - << "The coordinates must satisfy 0 <= x_i <= 1, " - << "but here we have x_i=" << arg1); + double, + << "The coordinates must satisfy 0 <= x_i <= 1, " + << "but here we have x_i=" << arg1); /** * Exception @@ -2285,17 +2285,17 @@ template <> Tensor<1,1> GeometryInfo<1>:: d_linear_shape_function_gradient (const Point<1> &xi, - const unsigned int i); + const unsigned int i); template <> Tensor<1,2> GeometryInfo<2>:: d_linear_shape_function_gradient (const Point<2> &xi, - const unsigned int i); + const unsigned int i); template <> Tensor<1,3> GeometryInfo<3>:: d_linear_shape_function_gradient (const Point<3> &xi, - const unsigned int i); + const unsigned int i); @@ -2308,8 +2308,8 @@ namespace internal template inline SubfaceCase::SubfaceCase (const typename SubfacePossibilities::Possibilities subface_possibility) - : - value (subface_possibility) + : + value (subface_possibility) {} @@ -2379,8 +2379,8 @@ RefinementCase<3>::cut_axis (const unsigned int i) template inline RefinementCase::RefinementCase () - : - value (RefinementPossibilities::no_refinement) + : + value (RefinementPossibilities::no_refinement) {} @@ -2389,16 +2389,16 @@ template inline RefinementCase:: RefinementCase (const typename RefinementPossibilities::Possibilities refinement_case) - : - value (refinement_case) + : + value (refinement_case) { - // check that only those bits of - // the given argument are set that - // make sense for a given space - // dimension + // check that only those bits of + // the given argument are set that + // make sense for a given space + // dimension Assert ((refinement_case & RefinementPossibilities::isotropic_refinement) == - refinement_case, - ExcInvalidRefinementCase (refinement_case)); + refinement_case, + ExcInvalidRefinementCase (refinement_case)); } @@ -2406,16 +2406,16 @@ RefinementCase (const typename RefinementPossibilities::Possibilities refin template inline RefinementCase::RefinementCase (const unsigned char refinement_case) - : - value (refinement_case) + : + value (refinement_case) { - // check that only those bits of - // the given argument are set that - // make sense for a given space - // dimension + // check that only those bits of + // the given argument are set that + // make sense for a given space + // dimension Assert ((refinement_case & RefinementPossibilities::isotropic_refinement) == - refinement_case, - ExcInvalidRefinementCase (refinement_case)); + refinement_case, + ExcInvalidRefinementCase (refinement_case)); } @@ -2455,7 +2455,7 @@ RefinementCase RefinementCase::operator ~ () const { return RefinementCase(static_cast ( - (~value) & RefinementPossibilities::isotropic_refinement)); + (~value) & RefinementPossibilities::isotropic_refinement)); } @@ -2474,7 +2474,7 @@ RefinementCase::memory_consumption () template template void RefinementCase::serialize (Archive &ar, - const unsigned int) + const unsigned int) { // serialization can't deal with bitfields, so copy from/to a full sized // unsigned char @@ -2492,7 +2492,7 @@ Point<1> GeometryInfo<1>::unit_cell_vertex (const unsigned int vertex) { Assert (vertex < vertices_per_cell, - ExcIndexRange (vertex, 0, vertices_per_cell)); + ExcIndexRange (vertex, 0, vertices_per_cell)); return Point<1>(static_cast(vertex)); } @@ -2505,7 +2505,7 @@ Point<2> GeometryInfo<2>::unit_cell_vertex (const unsigned int vertex) { Assert (vertex < vertices_per_cell, - ExcIndexRange (vertex, 0, vertices_per_cell)); + ExcIndexRange (vertex, 0, vertices_per_cell)); return Point<2>(vertex%2, vertex/2); } @@ -2518,7 +2518,7 @@ Point<3> GeometryInfo<3>::unit_cell_vertex (const unsigned int vertex) { Assert (vertex < vertices_per_cell, - ExcIndexRange (vertex, 0, vertices_per_cell)); + ExcIndexRange (vertex, 0, vertices_per_cell)); return Point<3>(vertex%2, vertex/2%2, vertex/4); } @@ -2558,8 +2558,8 @@ GeometryInfo<2>::child_cell_from_point (const Point<2> &p) Assert ((p[1] >= 0) && (p[1] <= 1), ExcInvalidCoordinate(p[1])); return (p[0] <= 0.5 ? - (p[1] <= 0.5 ? 0 : 2) : - (p[1] <= 0.5 ? 1 : 3)); + (p[1] <= 0.5 ? 0 : 2) : + (p[1] <= 0.5 ? 1 : 3)); } @@ -2574,12 +2574,12 @@ GeometryInfo<3>::child_cell_from_point (const Point<3> &p) Assert ((p[2] >= 0) && (p[2] <= 1), ExcInvalidCoordinate(p[2])); return (p[0] <= 0.5 ? - (p[1] <= 0.5 ? - (p[2] <= 0.5 ? 0 : 4) : - (p[2] <= 0.5 ? 2 : 6)) : - (p[1] <= 0.5 ? - (p[2] <= 0.5 ? 1 : 5) : - (p[2] <= 0.5 ? 3 : 7))); + (p[1] <= 0.5 ? + (p[2] <= 0.5 ? 0 : 4) : + (p[2] <= 0.5 ? 2 : 6)) : + (p[1] <= 0.5 ? + (p[2] <= 0.5 ? 1 : 5) : + (p[2] <= 0.5 ? 3 : 7))); } @@ -2599,14 +2599,14 @@ template <> inline Point<1> GeometryInfo<1>::cell_to_child_coordinates (const Point<1> &p, - const unsigned int child_index, - const RefinementCase<1> refine_case) + const unsigned int child_index, + const RefinementCase<1> refine_case) { Assert (child_index < 2, - ExcIndexRange (child_index, 0, 2)); + ExcIndexRange (child_index, 0, 2)); Assert (refine_case==RefinementCase<1>::cut_x, - ExcInternalError()); + ExcInternalError()); return p*2.0-unit_cell_vertex(child_index); } @@ -2617,32 +2617,32 @@ template <> inline Point<2> GeometryInfo<2>::cell_to_child_coordinates (const Point<2> &p, - const unsigned int child_index, - const RefinementCase<2> refine_case) + const unsigned int child_index, + const RefinementCase<2> refine_case) { Assert (child_index < GeometryInfo<2>::n_children(refine_case), - ExcIndexRange (child_index, 0, GeometryInfo<2>::n_children(refine_case))); + ExcIndexRange (child_index, 0, GeometryInfo<2>::n_children(refine_case))); Point<2> point=p; switch (refine_case) { case RefinementCase<2>::cut_x: - point[0]*=2.0; - if (child_index==1) - point[0]-=1.0; - break; + point[0]*=2.0; + if (child_index==1) + point[0]-=1.0; + break; case RefinementCase<2>::cut_y: - point[1]*=2.0; - if (child_index==1) - point[1]-=1.0; - break; + point[1]*=2.0; + if (child_index==1) + point[1]-=1.0; + break; case RefinementCase<2>::cut_xy: - point*=2.0; - point-=unit_cell_vertex(child_index); - break; + point*=2.0; + point-=unit_cell_vertex(child_index); + break; default: - Assert(false, ExcInternalError()); + Assert(false, ExcInternalError()); } return point; @@ -2654,70 +2654,70 @@ template <> inline Point<3> GeometryInfo<3>::cell_to_child_coordinates (const Point<3> &p, - const unsigned int child_index, - const RefinementCase<3> refine_case) + const unsigned int child_index, + const RefinementCase<3> refine_case) { Assert (child_index < GeometryInfo<3>::n_children(refine_case), - ExcIndexRange (child_index, 0, GeometryInfo<3>::n_children(refine_case))); + ExcIndexRange (child_index, 0, GeometryInfo<3>::n_children(refine_case))); Point<3> point=p; - // there might be a cleverer way to do - // this, but since this function is called - // in very few places for initialization - // purposes only, I don't care at the - // moment + // there might be a cleverer way to do + // this, but since this function is called + // in very few places for initialization + // purposes only, I don't care at the + // moment switch (refine_case) { case RefinementCase<3>::cut_x: - point[0]*=2.0; - if (child_index==1) - point[0]-=1.0; - break; + point[0]*=2.0; + if (child_index==1) + point[0]-=1.0; + break; case RefinementCase<3>::cut_y: - point[1]*=2.0; - if (child_index==1) - point[1]-=1.0; - break; + point[1]*=2.0; + if (child_index==1) + point[1]-=1.0; + break; case RefinementCase<3>::cut_z: - point[2]*=2.0; - if (child_index==1) - point[2]-=1.0; - break; + point[2]*=2.0; + if (child_index==1) + point[2]-=1.0; + break; case RefinementCase<3>::cut_xy: - point[0]*=2.0; - point[1]*=2.0; - if (child_index%2==1) - point[0]-=1.0; - if (child_index/2==1) - point[1]-=1.0; - break; + point[0]*=2.0; + point[1]*=2.0; + if (child_index%2==1) + point[0]-=1.0; + if (child_index/2==1) + point[1]-=1.0; + break; case RefinementCase<3>::cut_xz: - // careful, this is slightly - // different from xy and yz due to - // differnt internal numbering of - // children! - point[0]*=2.0; - point[2]*=2.0; - if (child_index/2==1) - point[0]-=1.0; - if (child_index%2==1) - point[2]-=1.0; - break; + // careful, this is slightly + // different from xy and yz due to + // differnt internal numbering of + // children! + point[0]*=2.0; + point[2]*=2.0; + if (child_index/2==1) + point[0]-=1.0; + if (child_index%2==1) + point[2]-=1.0; + break; case RefinementCase<3>::cut_yz: - point[1]*=2.0; - point[2]*=2.0; - if (child_index%2==1) - point[1]-=1.0; - if (child_index/2==1) - point[2]-=1.0; - break; + point[1]*=2.0; + point[2]*=2.0; + if (child_index%2==1) + point[1]-=1.0; + if (child_index/2==1) + point[2]-=1.0; + break; case RefinementCase<3>::cut_xyz: - point*=2.0; - point-=unit_cell_vertex(child_index); - break; + point*=2.0; + point-=unit_cell_vertex(child_index); + break; default: - Assert(false, ExcInternalError()); + Assert(false, ExcInternalError()); } return point; @@ -2729,8 +2729,8 @@ template inline Point GeometryInfo::cell_to_child_coordinates (const Point &/*p*/, - const unsigned int /*child_index*/, - const RefinementCase /*refine_case*/) + const unsigned int /*child_index*/, + const RefinementCase /*refine_case*/) { AssertThrow (false, ExcNotImplemented()); @@ -2743,14 +2743,14 @@ template <> inline Point<1> GeometryInfo<1>::child_to_cell_coordinates (const Point<1> &p, - const unsigned int child_index, - const RefinementCase<1> refine_case) + const unsigned int child_index, + const RefinementCase<1> refine_case) { Assert (child_index < 2, - ExcIndexRange (child_index, 0, 2)); + ExcIndexRange (child_index, 0, 2)); Assert (refine_case==RefinementCase<1>::cut_x, - ExcInternalError()); + ExcInternalError()); return (p+unit_cell_vertex(child_index))*0.5; } @@ -2761,70 +2761,70 @@ template <> inline Point<3> GeometryInfo<3>::child_to_cell_coordinates (const Point<3> &p, - const unsigned int child_index, - const RefinementCase<3> refine_case) + const unsigned int child_index, + const RefinementCase<3> refine_case) { Assert (child_index < GeometryInfo<3>::n_children(refine_case), - ExcIndexRange (child_index, 0, GeometryInfo<3>::n_children(refine_case))); + ExcIndexRange (child_index, 0, GeometryInfo<3>::n_children(refine_case))); Point<3> point=p; - // there might be a cleverer way to do - // this, but since this function is called - // in very few places for initialization - // purposes only, I don't care at the - // moment + // there might be a cleverer way to do + // this, but since this function is called + // in very few places for initialization + // purposes only, I don't care at the + // moment switch (refine_case) { case RefinementCase<3>::cut_x: - if (child_index==1) - point[0]+=1.0; - point[0]*=0.5; - break; + if (child_index==1) + point[0]+=1.0; + point[0]*=0.5; + break; case RefinementCase<3>::cut_y: - if (child_index==1) - point[1]+=1.0; - point[1]*=0.5; - break; + if (child_index==1) + point[1]+=1.0; + point[1]*=0.5; + break; case RefinementCase<3>::cut_z: - if (child_index==1) - point[2]+=1.0; - point[2]*=0.5; - break; + if (child_index==1) + point[2]+=1.0; + point[2]*=0.5; + break; case RefinementCase<3>::cut_xy: - if (child_index%2==1) - point[0]+=1.0; - if (child_index/2==1) - point[1]+=1.0; - point[0]*=0.5; - point[1]*=0.5; - break; + if (child_index%2==1) + point[0]+=1.0; + if (child_index/2==1) + point[1]+=1.0; + point[0]*=0.5; + point[1]*=0.5; + break; case RefinementCase<3>::cut_xz: - // careful, this is slightly - // different from xy and yz due to - // differnt internal numbering of - // children! - if (child_index/2==1) - point[0]+=1.0; - if (child_index%2==1) - point[2]+=1.0; - point[0]*=0.5; - point[2]*=0.5; - break; + // careful, this is slightly + // different from xy and yz due to + // differnt internal numbering of + // children! + if (child_index/2==1) + point[0]+=1.0; + if (child_index%2==1) + point[2]+=1.0; + point[0]*=0.5; + point[2]*=0.5; + break; case RefinementCase<3>::cut_yz: - if (child_index%2==1) - point[1]+=1.0; - if (child_index/2==1) - point[2]+=1.0; - point[1]*=0.5; - point[2]*=0.5; - break; + if (child_index%2==1) + point[1]+=1.0; + if (child_index/2==1) + point[2]+=1.0; + point[1]*=0.5; + point[2]*=0.5; + break; case RefinementCase<3>::cut_xyz: - point+=unit_cell_vertex(child_index); - point*=0.5; - break; + point+=unit_cell_vertex(child_index); + point*=0.5; + break; default: - Assert(false, ExcInternalError()); + Assert(false, ExcInternalError()); } return point; @@ -2836,31 +2836,31 @@ template <> inline Point<2> GeometryInfo<2>::child_to_cell_coordinates (const Point<2> &p, - const unsigned int child_index, - const RefinementCase<2> refine_case) + const unsigned int child_index, + const RefinementCase<2> refine_case) { Assert (child_index < GeometryInfo<2>::n_children(refine_case), - ExcIndexRange (child_index, 0, GeometryInfo<2>::n_children(refine_case))); + ExcIndexRange (child_index, 0, GeometryInfo<2>::n_children(refine_case))); Point<2> point=p; switch (refine_case) { case RefinementCase<2>::cut_x: - if (child_index==1) - point[0]+=1.0; - point[0]*=0.5; - break; + if (child_index==1) + point[0]+=1.0; + point[0]*=0.5; + break; case RefinementCase<2>::cut_y: - if (child_index==1) - point[1]+=1.0; - point[1]*=0.5; - break; + if (child_index==1) + point[1]+=1.0; + point[1]*=0.5; + break; case RefinementCase<2>::cut_xy: - point+=unit_cell_vertex(child_index); - point*=0.5; - break; + point+=unit_cell_vertex(child_index); + point*=0.5; + break; default: - Assert(false, ExcInternalError()); + Assert(false, ExcInternalError()); } return point; @@ -2872,8 +2872,8 @@ template inline Point GeometryInfo::child_to_cell_coordinates (const Point &/*p*/, - const unsigned int /*child_index*/, - const RefinementCase /*refine_case*/) + const unsigned int /*child_index*/, + const RefinementCase /*refine_case*/) { AssertThrow (false, ExcNotImplemented()); return Point(); @@ -2897,7 +2897,7 @@ bool GeometryInfo<2>::is_inside_unit_cell (const Point<2> &p) { return (p[0] >= 0.) && (p[0] <= 1.) && - (p[1] >= 0.) && (p[1] <= 1.); + (p[1] >= 0.) && (p[1] <= 1.); } @@ -2908,15 +2908,15 @@ bool GeometryInfo<3>::is_inside_unit_cell (const Point<3> &p) { return (p[0] >= 0.) && (p[0] <= 1.) && - (p[1] >= 0.) && (p[1] <= 1.) && - (p[2] >= 0.) && (p[2] <= 1.); + (p[1] >= 0.) && (p[1] <= 1.) && + (p[2] >= 0.) && (p[2] <= 1.); } template <> inline bool GeometryInfo<1>::is_inside_unit_cell (const Point<1> &p, - const double eps) + const double eps) { return (p[0] >= -eps) && (p[0] <= 1.+eps); } @@ -2927,11 +2927,11 @@ template <> inline bool GeometryInfo<2>::is_inside_unit_cell (const Point<2> &p, - const double eps) + const double eps) { const double l = -eps, u = 1+eps; return (p[0] >= l) && (p[0] <= u) && - (p[1] >= l) && (p[1] <= u); + (p[1] >= l) && (p[1] <= u); } @@ -2940,12 +2940,12 @@ template <> inline bool GeometryInfo<3>::is_inside_unit_cell (const Point<3> &p, - const double eps) + const double eps) { const double l = -eps, u = 1.0+eps; return (p[0] >= l) && (p[0] <= u) && - (p[1] >= l) && (p[1] <= u) && - (p[2] >= l) && (p[2] <= u); + (p[1] >= l) && (p[1] <= u) && + (p[2] >= l) && (p[2] <= u); } diff --git a/deal.II/include/deal.II/base/index_set.h b/deal.II/include/deal.II/base/index_set.h index c4162e414a..aa21ea567d 100644 --- a/deal.II/include/deal.II/base/index_set.h +++ b/deal.II/include/deal.II/base/index_set.h @@ -54,353 +54,353 @@ DEAL_II_NAMESPACE_OPEN class IndexSet { public: - /** - * Default constructor. - */ + /** + * Default constructor. + */ IndexSet (); - /** - * Constructor that also sets the - * overall size of the index - * range. - */ + /** + * Constructor that also sets the + * overall size of the index + * range. + */ IndexSet (const unsigned int size); - /** - * Remove all indices from this - * index set. The index set retains - * its size, however. - */ + /** + * Remove all indices from this + * index set. The index set retains + * its size, however. + */ void clear (); - /** - * Set the maximal size of the - * indices upon which this object - * operates. - * - * This function can only be - * called if the index set does - * not yet contain any elements. - * This can be achieved by calling - * clear(), for example. - */ + /** + * Set the maximal size of the + * indices upon which this object + * operates. + * + * This function can only be + * called if the index set does + * not yet contain any elements. + * This can be achieved by calling + * clear(), for example. + */ void set_size (const unsigned int size); - /** - * Return the size of the index - * space of which this index set - * is a subset of. - * - * Note that the result is not equal to - * the number of indices within this - * set. The latter information is - * returned by n_elements(). - */ + /** + * Return the size of the index + * space of which this index set + * is a subset of. + * + * Note that the result is not equal to + * the number of indices within this + * set. The latter information is + * returned by n_elements(). + */ unsigned int size () const; - /** - * Add the half-open range - * $[\text{begin},\text{end})$ to - * the set of indices represented - * by this class. - */ + /** + * Add the half-open range + * $[\text{begin},\text{end})$ to + * the set of indices represented + * by this class. + */ void add_range (const unsigned int begin, - const unsigned int end); + const unsigned int end); - /** - * Add an individual index to the - * set of indices. - */ + /** + * Add an individual index to the + * set of indices. + */ void add_index (const unsigned int index); - /** - * Add a whole set of indices - * described by dereferencing - * every element of the the - * iterator range - * [begin,end). - */ + /** + * Add a whole set of indices + * described by dereferencing + * every element of the the + * iterator range + * [begin,end). + */ template void add_indices (const ForwardIterator &begin, - const ForwardIterator &end); + const ForwardIterator &end); - /** - * Add the given IndexSet @p other to the - * current one, constructing the union of - * *this and @p other. - */ + /** + * Add the given IndexSet @p other to the + * current one, constructing the union of + * *this and @p other. + */ void add_indices(const IndexSet & other); - /** - * Return whether the specified - * index is an element of the - * index set. - */ + /** + * Return whether the specified + * index is an element of the + * index set. + */ bool is_element (const unsigned int index) const; - /** - * Return whether the index set - * stored by this object defines - * a contiguous range. This is - * true also if no indices are - * stored at all. - */ + /** + * Return whether the index set + * stored by this object defines + * a contiguous range. This is + * true also if no indices are + * stored at all. + */ bool is_contiguous () const; - /** - * Return the number of elements - * stored in this index set. - */ + /** + * Return the number of elements + * stored in this index set. + */ unsigned int n_elements () const; - /** - * Return the global index of the local - * index with number @p local_index - * stored in this index set. @p - * local_index obviously needs to be less - * than n_elements(). - */ + /** + * Return the global index of the local + * index with number @p local_index + * stored in this index set. @p + * local_index obviously needs to be less + * than n_elements(). + */ unsigned int nth_index_in_set (const unsigned int local_index) const; - /** - * Return the how-manyth element of this - * set (counted in ascending order) @p - * global_index is. @p global_index needs - * to be less than the size(). This - * function throws an exception if the - * index @p global_index is not actually - * a member of this index set, i.e. if - * is_element(global_index) is false. - */ + /** + * Return the how-manyth element of this + * set (counted in ascending order) @p + * global_index is. @p global_index needs + * to be less than the size(). This + * function throws an exception if the + * index @p global_index is not actually + * a member of this index set, i.e. if + * is_element(global_index) is false. + */ unsigned int index_within_set (const unsigned int global_index) const; - /** - * Each index set can be - * represented as the union of a - * number of contiguous intervals - * of indices, where if necessary - * intervals may only consist of - * individual elements to - * represent isolated members of - * the index set. - * - * This function returns the - * minimal number of such - * intervals that are needed to - * represent the index set under - * consideration. - */ + /** + * Each index set can be + * represented as the union of a + * number of contiguous intervals + * of indices, where if necessary + * intervals may only consist of + * individual elements to + * represent isolated members of + * the index set. + * + * This function returns the + * minimal number of such + * intervals that are needed to + * represent the index set under + * consideration. + */ unsigned int n_intervals () const; - /** - * Compress the internal - * representation by merging - * individual elements with - * contiguous ranges, etc. This - * function does not have any - * external effect. - */ + /** + * Compress the internal + * representation by merging + * individual elements with + * contiguous ranges, etc. This + * function does not have any + * external effect. + */ void compress () const; - /** - * Comparison for equality of - * index sets. This operation is - * only allowed if the size of - * the two sets is the same - * (though of course they do not - * have to have the same number - * of indices). - */ + /** + * Comparison for equality of + * index sets. This operation is + * only allowed if the size of + * the two sets is the same + * (though of course they do not + * have to have the same number + * of indices). + */ bool operator == (const IndexSet &is) const; - /** - * Comparison for inequality of - * index sets. This operation is - * only allowed if the size of - * the two sets is the same - * (though of course they do not - * have to have the same number - * of indices). - */ + /** + * Comparison for inequality of + * index sets. This operation is + * only allowed if the size of + * the two sets is the same + * (though of course they do not + * have to have the same number + * of indices). + */ bool operator != (const IndexSet &is) const; - /** - * Return the intersection of the - * current index set and the - * argument given, i.e. a set of - * indices that are elements of - * both index sets. The two index - * sets must have the same size - * (though of course they do not - * have to have the same number - * of indices). - */ + /** + * Return the intersection of the + * current index set and the + * argument given, i.e. a set of + * indices that are elements of + * both index sets. The two index + * sets must have the same size + * (though of course they do not + * have to have the same number + * of indices). + */ IndexSet operator & (const IndexSet &is) const; - /** - * This command takes an interval - * [begin, end) and returns - * the intersection of the current - * index set with the interval, shifted - * to the range [0, - * end-begin). - */ + /** + * This command takes an interval + * [begin, end) and returns + * the intersection of the current + * index set with the interval, shifted + * to the range [0, + * end-begin). + */ IndexSet get_view (const unsigned int begin, - const unsigned int end) const; + const unsigned int end) const; - /** - * Removes all elements contained in @p - * other from this set. In other words, - * if $x$ is the current object and $o$ - * the argument, then we compute $x - * \leftarrow x \backslash o$. - */ + /** + * Removes all elements contained in @p + * other from this set. In other words, + * if $x$ is the current object and $o$ + * the argument, then we compute $x + * \leftarrow x \backslash o$. + */ void subtract_set (const IndexSet & other); - /** - * Fills the given vector with all - * indices contained in this IndexSet. - */ + /** + * Fills the given vector with all + * indices contained in this IndexSet. + */ void fill_index_vector(std::vector & indices) const; - /** - * Fill the given vector with either - * zero or one elements, providing - * a binary representation of this - * index set. The given vector is - * assumed to already have the correct - * size. - * - * The given argument is filled with - * integer values zero and one, using - * vector.operator[]. Thus, - * any object that has such an operator - * can be used as long as it allows - * conversion of integers zero and one to - * elements of the vector. Specifically, - * this is the case for classes Vector, - * BlockVector, but also - * std::vector@, - * std::vector@, and - * std::vector@. - */ + /** + * Fill the given vector with either + * zero or one elements, providing + * a binary representation of this + * index set. The given vector is + * assumed to already have the correct + * size. + * + * The given argument is filled with + * integer values zero and one, using + * vector.operator[]. Thus, + * any object that has such an operator + * can be used as long as it allows + * conversion of integers zero and one to + * elements of the vector. Specifically, + * this is the case for classes Vector, + * BlockVector, but also + * std::vector@, + * std::vector@, and + * std::vector@. + */ template void fill_binary_vector (Vector &vector) const; - /** - * Outputs a text representation of this - * IndexSet to the given stream. Used for - * testing. - */ + /** + * Outputs a text representation of this + * IndexSet to the given stream. Used for + * testing. + */ template void print(STREAM &out) const; - /** - * Writes the IndexSet into a text based - * file format, that can be read in again - * using the read() function. - */ + /** + * Writes the IndexSet into a text based + * file format, that can be read in again + * using the read() function. + */ void write(std::ostream & out) const; - /** - * Constructs the IndexSet from a text - * based representation given by the - * stream @param in written by the - * write() function. - */ + /** + * Constructs the IndexSet from a text + * based representation given by the + * stream @param in written by the + * write() function. + */ void read(std::istream & in); - /** - * Writes the IndexSet into a binary, - * compact representation, that can be - * read in again using the block_read() - * function. - */ + /** + * Writes the IndexSet into a binary, + * compact representation, that can be + * read in again using the block_read() + * function. + */ void block_write(std::ostream & out) const; - /** - * Constructs the IndexSet from a binary - * representation given by the stream - * @param in written by the write_block() - * function. - */ + /** + * Constructs the IndexSet from a binary + * representation given by the stream + * @param in written by the write_block() + * function. + */ void block_read(std::istream & in); #ifdef DEAL_II_USE_TRILINOS - /** - * Given an MPI communicator, - * create a Trilinos map object - * that represents a distribution - * of vector elements or matrix - * rows in which we will locally - * store those elements or rows - * for which we store the index - * in the current index set, and - * all the other elements/rows - * elsewhere on one of the other - * MPI processes. - * - * The last argument only plays a - * role if the communicator is a - * parallel one, distributing - * computations across multiple - * processors. In that case, if - * the last argument is false, - * then it is assumed that the - * index sets this function is - * called on on all processors - * are mutually exclusive but - * together enumerate each index - * exactly once. In other words, - * if you call this function on - * two processors, then the index - * sets this function is called - * with must together have all - * possible indices from zero to - * size()-1, and no index must - * appear in both index - * sets. This corresponds, for - * example, to the case where we - * want to split the elements of - * vectors into unique subsets to - * be stored on different - * processors -- no element - * should be owned by more than - * one processor, but each - * element must be owned by one. - * - * On the other hand, if the - * second argument is true, then - * the index sets can be - * overlapping, though they still - * need to contain each index - * exactly once on all processors - * taken together. This is a - * useful operation if we want to - * create vectors that not only - * contain the locally owned - * indices, but for example also - * the elements that correspond - * to degrees of freedom located - * on ghost cells. - */ + /** + * Given an MPI communicator, + * create a Trilinos map object + * that represents a distribution + * of vector elements or matrix + * rows in which we will locally + * store those elements or rows + * for which we store the index + * in the current index set, and + * all the other elements/rows + * elsewhere on one of the other + * MPI processes. + * + * The last argument only plays a + * role if the communicator is a + * parallel one, distributing + * computations across multiple + * processors. In that case, if + * the last argument is false, + * then it is assumed that the + * index sets this function is + * called on on all processors + * are mutually exclusive but + * together enumerate each index + * exactly once. In other words, + * if you call this function on + * two processors, then the index + * sets this function is called + * with must together have all + * possible indices from zero to + * size()-1, and no index must + * appear in both index + * sets. This corresponds, for + * example, to the case where we + * want to split the elements of + * vectors into unique subsets to + * be stored on different + * processors -- no element + * should be owned by more than + * one processor, but each + * element must be owned by one. + * + * On the other hand, if the + * second argument is true, then + * the index sets can be + * overlapping, though they still + * need to contain each index + * exactly once on all processors + * taken together. This is a + * useful operation if we want to + * create vectors that not only + * contain the locally owned + * indices, but for example also + * the elements that correspond + * to degrees of freedom located + * on ghost cells. + */ Epetra_Map make_trilinos_map (const MPI_Comm &communicator = MPI_COMM_WORLD, - const bool overlapping = false) const; + const bool overlapping = false) const; #endif - /** + /** * Determine an estimate for the memory * consumption (in bytes) of this * object. - */ + */ std::size_t memory_consumption () const; DeclException1 (ExcIndexNotPresent, int, - << "The global index " << arg1 - << " is not an element of this set."); + << "The global index " << arg1 + << " is not an element of this set."); /** * Write or read the data of this object to or @@ -410,153 +410,153 @@ class IndexSet void serialize (Archive & ar, const unsigned int version); private: - /** - * A type that denotes the half - * open index range - * [begin,end). - * - * The nth_index_in_set denotes - * the how many-th index within - * this IndexSet the first - * element of the current range - * is. This information is only - * accurate if - * IndexSet::compress() has been - * called after the last - * insertion. - */ + /** + * A type that denotes the half + * open index range + * [begin,end). + * + * The nth_index_in_set denotes + * the how many-th index within + * this IndexSet the first + * element of the current range + * is. This information is only + * accurate if + * IndexSet::compress() has been + * called after the last + * insertion. + */ struct Range { - unsigned int begin; - unsigned int end; - - unsigned int nth_index_in_set; - - /** - * Default constructor. Since there is no useful choice for - * a default constructed interval, this constructor simply - * creates something that resembles an invalid range. We - * need this constructor for serialization purposes, but the - * invalid range should be filled with something read from - * the archive before it is used, so we should hopefully - * never get to see an invalid range in the wild. - **/ - Range (); - - /** - * Constructor. Create a half-open interval with the given indices. - * - * @param i1 Left end point of the interval. - * @param i2 First index greater than the last index of the indicated range. - **/ - Range (const unsigned int i1, - const unsigned int i2); - - friend - inline bool operator< (const Range &range_1, - const Range &range_2) - { - return ((range_1.begin < range_2.begin) - || - ((range_1.begin == range_2.begin) - && - (range_1.end < range_2.end))); - } - - static bool end_compare(const IndexSet::Range & x, const IndexSet::Range & y) - { - return x.end < y.end; - } + unsigned int begin; + unsigned int end; + + unsigned int nth_index_in_set; + + /** + * Default constructor. Since there is no useful choice for + * a default constructed interval, this constructor simply + * creates something that resembles an invalid range. We + * need this constructor for serialization purposes, but the + * invalid range should be filled with something read from + * the archive before it is used, so we should hopefully + * never get to see an invalid range in the wild. + **/ + Range (); + + /** + * Constructor. Create a half-open interval with the given indices. + * + * @param i1 Left end point of the interval. + * @param i2 First index greater than the last index of the indicated range. + **/ + Range (const unsigned int i1, + const unsigned int i2); + + friend + inline bool operator< (const Range &range_1, + const Range &range_2) + { + return ((range_1.begin < range_2.begin) + || + ((range_1.begin == range_2.begin) + && + (range_1.end < range_2.end))); + } + + static bool end_compare(const IndexSet::Range & x, const IndexSet::Range & y) + { + return x.end < y.end; + } static bool nth_index_compare (const IndexSet::Range & x, - const IndexSet::Range & y) + const IndexSet::Range & y) + { + return (x.nth_index_in_set+(x.end-x.begin) < + y.nth_index_in_set+(y.end-y.begin)); + } + + friend + inline bool operator== (const Range &range_1, + const Range &range_2) { - return (x.nth_index_in_set+(x.end-x.begin) < - y.nth_index_in_set+(y.end-y.begin)); + return ((range_1.begin == range_2.begin) + || + (range_1.begin == range_2.begin)); } - friend - inline bool operator== (const Range &range_1, - const Range &range_2) - { - return ((range_1.begin == range_2.begin) - || - (range_1.begin == range_2.begin)); - } - - std::size_t memory_consumption () const - { - return sizeof(Range); - } - - /** - * Write or read the data of this object to or - * from a stream for the purpose of serialization - */ - template - void serialize (Archive & ar, const unsigned int version); + std::size_t memory_consumption () const + { + return sizeof(Range); + } + + /** + * Write or read the data of this object to or + * from a stream for the purpose of serialization + */ + template + void serialize (Archive & ar, const unsigned int version); }; - /** - * A set of contiguous ranges of - * indices that make up (part of) - * this index set. This variable - * is always kept sorted. - * - * The variable is marked - * "mutable" so that it can be - * changed by compress(), though - * this of course doesn't change - * anything about the external - * representation of this index - * set. - */ + /** + * A set of contiguous ranges of + * indices that make up (part of) + * this index set. This variable + * is always kept sorted. + * + * The variable is marked + * "mutable" so that it can be + * changed by compress(), though + * this of course doesn't change + * anything about the external + * representation of this index + * set. + */ mutable std::vector ranges; - /** - * True if compress() has been - * called after the last change - * in the set of indices. - * - * The variable is marked - * "mutable" so that it can be - * changed by compress(), though - * this of course doesn't change - * anything about the external - * representation of this index - * set. - */ + /** + * True if compress() has been + * called after the last change + * in the set of indices. + * + * The variable is marked + * "mutable" so that it can be + * changed by compress(), though + * this of course doesn't change + * anything about the external + * representation of this index + * set. + */ mutable bool is_compressed; - /** - * The overall size of the index - * range. Elements of this index - * set have to have a smaller - * number than this value. - */ + /** + * The overall size of the index + * range. Elements of this index + * set have to have a smaller + * number than this value. + */ unsigned int index_space_size; - /** - * This integer caches the index of the - * largest range in @p ranges. This gives - * O(1) access to the range with - * most elements, while general access - * costs O(log(n_ranges)). The - * largest range is needed for the - * methods @p is_element(), @p - * index_within_set(), @p - * nth_index_in_set. In many - * applications, the largest range - * contains most elements (the locally - * owned range), whereas there are only a - * few other elements (ghosts). - */ + /** + * This integer caches the index of the + * largest range in @p ranges. This gives + * O(1) access to the range with + * most elements, while general access + * costs O(log(n_ranges)). The + * largest range is needed for the + * methods @p is_element(), @p + * index_within_set(), @p + * nth_index_in_set. In many + * applications, the largest range + * contains most elements (the locally + * owned range), whereas there are only a + * few other elements (ghosts). + */ mutable unsigned int largest_range; - /** - * Actually perform the compress() - * operation. - */ + /** + * Actually perform the compress() + * operation. + */ void do_compress() const; }; @@ -565,37 +565,37 @@ class IndexSet inline IndexSet::Range::Range () - : - begin(numbers::invalid_unsigned_int), - end(numbers::invalid_unsigned_int) + : + begin(numbers::invalid_unsigned_int), + end(numbers::invalid_unsigned_int) {} inline IndexSet::Range::Range (const unsigned int i1, - const unsigned int i2) - : - begin(i1), - end(i2) + const unsigned int i2) + : + begin(i1), + end(i2) {} inline IndexSet::IndexSet () - : - is_compressed (true), - index_space_size (0), - largest_range (deal_II_numbers::invalid_unsigned_int) + : + is_compressed (true), + index_space_size (0), + largest_range (deal_II_numbers::invalid_unsigned_int) {} inline IndexSet::IndexSet (const unsigned int size) - : - is_compressed (true), - index_space_size (size), - largest_range (deal_II_numbers::invalid_unsigned_int) + : + is_compressed (true), + index_space_size (size), + largest_range (deal_II_numbers::invalid_unsigned_int) {} @@ -615,8 +615,8 @@ void IndexSet::set_size (const unsigned int sz) { Assert (ranges.empty(), - ExcMessage ("This function can only be called if the current " - "object does not yet contain any elements.")); + ExcMessage ("This function can only be called if the current " + "object does not yet contain any elements.")); index_space_size = sz; is_compressed = true; } @@ -647,31 +647,31 @@ IndexSet::compress () const inline void IndexSet::add_range (const unsigned int begin, - const unsigned int end) + const unsigned int end) { Assert ((begin < index_space_size) - || - ((begin == index_space_size) && (end == index_space_size)), - ExcIndexRange (begin, 0, index_space_size)); + || + ((begin == index_space_size) && (end == index_space_size)), + ExcIndexRange (begin, 0, index_space_size)); Assert (end <= index_space_size, - ExcIndexRange (end, 0, index_space_size+1)); + ExcIndexRange (end, 0, index_space_size+1)); Assert (begin <= end, - ExcIndexRange (begin, 0, end)); + ExcIndexRange (begin, 0, end)); if (begin != end) { const Range new_range(begin,end); - // the new index might be larger than the last - // index present in the ranges. Then we can - // skip the binary search + // the new index might be larger than the last + // index present in the ranges. Then we can + // skip the binary search if (ranges.size() == 0 || begin > ranges.back().end) - ranges.push_back(new_range); + ranges.push_back(new_range); else - ranges.insert (Utilities::lower_bound (ranges.begin(), - ranges.end(), - new_range), - new_range); + ranges.insert (Utilities::lower_bound (ranges.begin(), + ranges.end(), + new_range), + new_range); is_compressed = false; } } @@ -683,7 +683,7 @@ void IndexSet::add_index (const unsigned int index) { Assert (index < index_space_size, - ExcIndexRange (index, 0, index_space_size)); + ExcIndexRange (index, 0, index_space_size)); const Range new_range(index, index+1); if (ranges.size() == 0 || index > ranges.back().end) @@ -692,9 +692,9 @@ IndexSet::add_index (const unsigned int index) ranges.back().end++; else ranges.insert (Utilities::lower_bound (ranges.begin(), - ranges.end(), - new_range), - new_range); + ranges.end(), + new_range), + new_range); is_compressed = false; } @@ -704,12 +704,12 @@ template inline void IndexSet::add_indices (const ForwardIterator &begin, - const ForwardIterator &end) + const ForwardIterator &end) { - // insert each element of the - // range. if some of them happen to - // be consecutive, merge them to a - // range + // insert each element of the + // range. if some of them happen to + // be consecutive, merge them to a + // range for (ForwardIterator p=begin; p!=end;) { const unsigned int begin_index = *p; @@ -717,10 +717,10 @@ IndexSet::add_indices (const ForwardIterator &begin, ForwardIterator q = p; ++q; while ((q != end) && (*q == end_index)) - { - ++end_index; - ++q; - } + { + ++end_index; + ++q; + } add_range (begin_index, end_index); p = q; @@ -756,62 +756,62 @@ IndexSet::is_element (const unsigned int index) const { compress (); - // fast check whether the index is in the - // largest range + // fast check whether the index is in the + // largest range Assert (largest_range < ranges.size(), ExcInternalError()); if (index >= ranges[largest_range].begin && - index < ranges[largest_range].end) - return true; - - // get the element after which - // we would have to insert a - // range that consists of all - // elements from this element - // to the end of the index - // range plus one. after this - // call we know that if - // p!=end() then - // p->begin<=index unless there - // is no such range at all - // - // if the searched for element - // is an element of this range, - // then we're done. otherwise, - // the element can't be in one - // of the following ranges - // because otherwise p would be - // a different iterator - // - // since we already know the position - // relative to the largest range (we - // called compress!), we can perform - // the binary search on ranges with - // lower/higher number compared to the - // largest range + index < ranges[largest_range].end) + return true; + + // get the element after which + // we would have to insert a + // range that consists of all + // elements from this element + // to the end of the index + // range plus one. after this + // call we know that if + // p!=end() then + // p->begin<=index unless there + // is no such range at all + // + // if the searched for element + // is an element of this range, + // then we're done. otherwise, + // the element can't be in one + // of the following ranges + // because otherwise p would be + // a different iterator + // + // since we already know the position + // relative to the largest range (we + // called compress!), we can perform + // the binary search on ranges with + // lower/higher number compared to the + // largest range std::vector::const_iterator - p = std::upper_bound (ranges.begin() + (index= p->begin) && (index < p->end)); + return ((index >= p->begin) && (index < p->end)); Assert ((p == ranges.end()) || (p->begin > index), - ExcInternalError()); + ExcInternalError()); - // now move to that previous - // range + // now move to that previous + // range --p; Assert (p->begin <= index, ExcInternalError()); return (p->end > index); } - // didn't find this index, so it's - // not in the set + // didn't find this index, so it's + // not in the set return false; } @@ -831,8 +831,8 @@ inline unsigned int IndexSet::n_elements () const { - // make sure we have - // non-overlapping ranges + // make sure we have + // non-overlapping ranges compress (); unsigned int v = 0; @@ -860,24 +860,24 @@ inline unsigned int IndexSet::nth_index_in_set (const unsigned int n) const { - // to make this call thread-safe, compress() - // must not be called through this function + // to make this call thread-safe, compress() + // must not be called through this function Assert (is_compressed == true, ExcMessage ("IndexSet must be compressed.")); Assert (n < n_elements(), ExcIndexRange (n, 0, n_elements())); - // first check whether the index is in the - // largest range + // first check whether the index is in the + // largest range Assert (largest_range < ranges.size(), ExcInternalError()); std::vector::const_iterator main_range=ranges.begin()+largest_range; if (n>=main_range->nth_index_in_set && nnth_index_in_set+(main_range->end-main_range->begin)) return main_range->begin + (n-main_range->nth_index_in_set); - // find out which chunk the local index n - // belongs to by using a binary search. the - // comparator is based on the end of the - // ranges. Use the position relative to main_range to - // subdivide the ranges + // find out which chunk the local index n + // belongs to by using a binary search. the + // comparator is based on the end of the + // ranges. Use the position relative to main_range to + // subdivide the ranges Range r (n,n+1); r.nth_index_in_set = n; std::vector::const_iterator range_begin, range_end; @@ -894,7 +894,7 @@ IndexSet::nth_index_in_set (const unsigned int n) const std::vector::const_iterator p = Utilities::lower_bound(range_begin, range_end, r, - Range::nth_index_compare); + Range::nth_index_compare); if (p != ranges.end()) return p->begin + (n-p->nth_index_in_set); @@ -911,15 +911,15 @@ inline unsigned int IndexSet::index_within_set (const unsigned int n) const { - // to make this call thread-safe, compress() - // must not be called through this function + // to make this call thread-safe, compress() + // must not be called through this function Assert (is_compressed == true, ExcMessage ("IndexSet must be compressed.")); Assert (is_element(n) == true, ExcIndexNotPresent (n)); Assert (n < size(), ExcIndexRange (n, 0, size())); - // check whether the index is in the largest - // range. use the result to perform a - // one-sided binary search afterward + // check whether the index is in the largest + // range. use the result to perform a + // one-sided binary search afterward Assert (largest_range < ranges.size(), ExcInternalError()); std::vector::const_iterator main_range=ranges.begin()+largest_range; if (n >= main_range->begin && n < main_range->end) @@ -940,7 +940,7 @@ IndexSet::index_within_set (const unsigned int n) const std::vector::const_iterator p = Utilities::lower_bound(range_begin, range_end, r, - Range::end_compare); + Range::end_compare); Assert(p!=ranges.end(), ExcInternalError()); Assert(p->begin<=n, ExcInternalError()); @@ -955,7 +955,7 @@ bool IndexSet::operator == (const IndexSet &is) const { Assert (size() == is.size(), - ExcDimensionMismatch (size(), is.size())); + ExcDimensionMismatch (size(), is.size())); compress (); is.compress (); @@ -970,7 +970,7 @@ bool IndexSet::operator != (const IndexSet &is) const { Assert (size() == is.size(), - ExcDimensionMismatch (size(), is.size())); + ExcDimensionMismatch (size(), is.size())); compress (); is.compress (); @@ -985,15 +985,15 @@ void IndexSet::fill_binary_vector (Vector &vector) const { Assert (vector.size() == size(), - ExcDimensionMismatch (vector.size(), size())); + ExcDimensionMismatch (vector.size(), size())); compress(); - // first fill all elements of the vector - // with zeroes. + // first fill all elements of the vector + // with zeroes. std::fill (vector.begin(), vector.end(), 0); - // then write ones into the elements whose - // indices are contained in the index set + // then write ones into the elements whose + // indices are contained in the index set for (std::vector::iterator it = ranges.begin(); it != ranges.end(); ++it) @@ -1014,12 +1014,12 @@ IndexSet::print (STREAM &out) const for (p = ranges.begin(); p != ranges.end(); ++p) { if (p->end-p->begin==1) - out << p->begin; + out << p->begin; else - out << "[" << p->begin << "," << p->end-1 << "]"; + out << "[" << p->begin << "," << p->end-1 << "]"; if (p !=--ranges.end()) - out << ", "; + out << ", "; } out << "}" << std::endl; } diff --git a/deal.II/include/deal.II/base/job_identifier.h b/deal.II/include/deal.II/base/job_identifier.h index 255366ef43..d7b0e70d2d 100644 --- a/deal.II/include/deal.II/base/job_identifier.h +++ b/deal.II/include/deal.II/base/job_identifier.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -23,62 +23,62 @@ DEAL_II_NAMESPACE_OPEN * identifier. There exists a library object dealjobid of this * class. This object can be accessed by all output functions to * provide an id for the current job. - * + * * @ingroup utilities */ class JobIdentifier { public: - /** - * Constructor. Set program - * identifier to value of - * program_id concatenated - * with the present time. - */ + /** + * Constructor. Set program + * identifier to value of + * program_id concatenated + * with the present time. + */ JobIdentifier(); - /** - * This function returns an - * identifier for the running - * program. Currently, the - * library provides a function - * returning "JobID". - * - * The user may define a - * replacement of this function - * in his source code and avoid - * linking the library - * version. Unfortunately, this - * mechanism does not work with - * shared libraries. - */ + /** + * This function returns an + * identifier for the running + * program. Currently, the + * library provides a function + * returning "JobID". + * + * The user may define a + * replacement of this function + * in his source code and avoid + * linking the library + * version. Unfortunately, this + * mechanism does not work with + * shared libraries. + */ static const char* program_id(); - /** - * Obtain the base name of the - * file currently being - * compiled. That is, if the file - * is mypath/file.cc - * return just - * file. Typically, this - * can be called from a program - * with the argument - * __FILE__ and is used - * in the deal.II test suite. - */ + /** + * Obtain the base name of the + * file currently being + * compiled. That is, if the file + * is mypath/file.cc + * return just + * file. Typically, this + * can be called from a program + * with the argument + * __FILE__ and is used + * in the deal.II test suite. + */ static std::string base_name(const char* filename); - - /** - * Return the value of id. - */ + + /** + * Return the value of id. + */ const std::string operator () () const; - + private: - /** - * String holding the identifier - * of the presently running - * program. - */ + /** + * String holding the identifier + * of the presently running + * program. + */ std::string id; }; diff --git a/deal.II/include/deal.II/base/logstream.h b/deal.II/include/deal.II/base/logstream.h index 78ddcf0620..29714298e8 100644 --- a/deal.II/include/deal.II/base/logstream.h +++ b/deal.II/include/deal.II/base/logstream.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -26,7 +26,7 @@ #ifdef HAVE_SYS_TIMES_H #include #else -struct tms +struct tms { int tms_utime, tms_stime, tms_cutime, tms_cstime; }; @@ -79,537 +79,537 @@ DEAL_II_NAMESPACE_OPEN * It should be pointed out that all of these measures distort the * output and make it less accurate. Therefore, they are only * recommended if the output needs to be reproducible. - * + * * @ingroup textoutput * @author Guido Kanschat, Wolfgang Bangerth, 1999, 2003, 2011 */ class LogStream : public Subscriptor { public: - /** - * A subclass allowing for the - * safe generation and removal of - * prefices. - * - * Somewhere at the beginning of - * a block, create one of these - * objects, and it will appear as - * a prefix in LogStream output - * like #deallog. At the end of - * the block, the prefix will - * automatically be removed, when - * this object is destroyed. - */ + /** + * A subclass allowing for the + * safe generation and removal of + * prefices. + * + * Somewhere at the beginning of + * a block, create one of these + * objects, and it will appear as + * a prefix in LogStream output + * like #deallog. At the end of + * the block, the prefix will + * automatically be removed, when + * this object is destroyed. + */ class Prefix { public: - /** - * Set a new prefix for - * #deallog, which will be - * removed when the variable - * is destroyed . - */ - Prefix(const std::string& text); - - /** - * Set a new prefix for the - * given stream, which will - * be removed when the - * variable is destroyed . - */ - Prefix(const std::string& text, LogStream& stream); - - /** - * Remove the prefix - * associated with this - * variable. - */ - ~Prefix (); - + /** + * Set a new prefix for + * #deallog, which will be + * removed when the variable + * is destroyed . + */ + Prefix(const std::string& text); + + /** + * Set a new prefix for the + * given stream, which will + * be removed when the + * variable is destroyed . + */ + Prefix(const std::string& text, LogStream& stream); + + /** + * Remove the prefix + * associated with this + * variable. + */ + ~Prefix (); + private: - SmartPointer stream; + SmartPointer stream; }; - - /** - * Standard constructor, since we - * intend to provide an object - * deallog in the library. Set the - * standard output stream to std::cerr. - */ + + /** + * Standard constructor, since we + * intend to provide an object + * deallog in the library. Set the + * standard output stream to std::cerr. + */ LogStream (); - /** - * Destructor. - */ + /** + * Destructor. + */ ~LogStream(); - - /** - * Enable output to a second - * stream o. - */ + + /** + * Enable output to a second + * stream o. + */ void attach (std::ostream& o); - - /** - * Disable output to the second - * stream. You may want to call - * close on the stream that was - * previously attached to this object. - */ + + /** + * Disable output to the second + * stream. You may want to call + * close on the stream that was + * previously attached to this object. + */ void detach (); - /** - * Setup the logstream for - * regression test mode. - * - * This sets the parameters - * #double_threshold, - * #float_threshold, and #offset - * to nonzero values. The exact - * values being used have been - * determined experimentally and - * can be found in the source - * code. - * - * Called with an argument - * false, switches off - * test mode and sets all - * involved parameters to zero. - */ + /** + * Setup the logstream for + * regression test mode. + * + * This sets the parameters + * #double_threshold, + * #float_threshold, and #offset + * to nonzero values. The exact + * values being used have been + * determined experimentally and + * can be found in the source + * code. + * + * Called with an argument + * false, switches off + * test mode and sets all + * involved parameters to zero. + */ void test_mode (bool on=true); - - /** - * Gives the default stream (std_out). - */ + + /** + * Gives the default stream (std_out). + */ std::ostream& get_console (); - /** - * Gives the file stream. - */ + /** + * Gives the file stream. + */ std::ostream& get_file_stream (); - /** - * @return true, if file stream - * has already been attached. - */ + /** + * @return true, if file stream + * has already been attached. + */ bool has_file () const; - - /** - * Reroutes cerr to LogStream. - * Works as a switch, turning - * logging of cerr on - * and off alternatingly with - * every call. - */ + + /** + * Reroutes cerr to LogStream. + * Works as a switch, turning + * logging of cerr on + * and off alternatingly with + * every call. + */ void log_cerr (); - - /** - * Return the prefix string. - */ + + /** + * Return the prefix string. + */ const std::string& get_prefix () const; - - /** - * @deprecated Use Prefix instead - * - * Push another prefix on the - * stack. Prefixes are - * automatically separated by a - * colon and there is a double - * colon after the last prefix. - */ + + /** + * @deprecated Use Prefix instead + * + * Push another prefix on the + * stack. Prefixes are + * automatically separated by a + * colon and there is a double + * colon after the last prefix. + */ void push (const std::string& text); - - /** - * @deprecated Use Prefix instead - * - * Remove the last prefix. - */ + + /** + * @deprecated Use Prefix instead + * + * Remove the last prefix. + */ void pop (); - - /** - * Maximum number of levels to be - * printed on the console. This - * function allows to restrict - * console output to the upmost - * levels of iterations. Only - * output with less than n - * prefixes is printed. By calling - * this function with n=0, no - * console output will be written. - * - * The previous value of this - * parameter is returned. - */ + + /** + * Maximum number of levels to be + * printed on the console. This + * function allows to restrict + * console output to the upmost + * levels of iterations. Only + * output with less than n + * prefixes is printed. By calling + * this function with n=0, no + * console output will be written. + * + * The previous value of this + * parameter is returned. + */ unsigned int depth_console (const unsigned int n); - - /** - * Maximum number of levels to be - * written to the log file. The - * functionality is the same as - * depth_console, nevertheless, - * this function should be used - * with care, since it may spoile - * the value of a log file. - * - * The previous value of this - * parameter is returned. - */ + + /** + * Maximum number of levels to be + * written to the log file. The + * functionality is the same as + * depth_console, nevertheless, + * this function should be used + * with care, since it may spoile + * the value of a log file. + * + * The previous value of this + * parameter is returned. + */ unsigned int depth_file (const unsigned int n); /** - * Set time printing flag. If this flag - * is true, each output line will - * be prepended by the user time used - * by the running program so far. - * - * The previous value of this - * parameter is returned. - */ + * Set time printing flag. If this flag + * is true, each output line will + * be prepended by the user time used + * by the running program so far. + * + * The previous value of this + * parameter is returned. + */ bool log_execution_time (const bool flag); - /** - * Output time differences - * between consecutive logs. If - * this function is invoked with - * true, the time difference - * between the previous log line - * and the recent one is - * printed. If it is invoked with - * false, the accumulated - * time since start of the - * program is printed (default - * behavior). - * - * The measurement of times is - * not changed by this function, - * just the output. - * - * The previous value of this - * parameter is returned. - */ + /** + * Output time differences + * between consecutive logs. If + * this function is invoked with + * true, the time difference + * between the previous log line + * and the recent one is + * printed. If it is invoked with + * false, the accumulated + * time since start of the + * program is printed (default + * behavior). + * + * The measurement of times is + * not changed by this function, + * just the output. + * + * The previous value of this + * parameter is returned. + */ bool log_time_differences (const bool flag); - /** - * Write detailed timing - * information. - * - * - */ + /** + * Write detailed timing + * information. + * + * + */ void timestamp(); - - /** - * Log the thread id. - */ + + /** + * Log the thread id. + */ bool log_thread_id (const bool flag); - - /** - * Set a threshold for the - * minimal absolute value of - * double values. All numbers - * with a smaller absolute value - * will be printed as zero. - * - * The default value for this - * threshold is zero, - * i.e. numbers are printed - * according to their real value. - * - * This feature is mostly useful - * for automated tests: there, - * one would like to reproduce - * the exact same solution in - * each run of a - * testsuite. However, subtle - * difference in processor, - * operating system, or compiler - * version can lead to - * differences in the last few - * digits of numbers, due to - * different rounding. While one - * can avoid trouble for most - * numbers when comparing with - * stored results by simply - * limiting the accuracy of - * output, this does not hold for - * numbers very close to zero, - * i.e. zero plus accumulated - * round-off. For these numbers, - * already the first digit is - * tainted by round-off. Using - * the present function, it is - * possible to eliminate this - * source of problems, by simply - * writing zero to the output in - * this case. - */ + + /** + * Set a threshold for the + * minimal absolute value of + * double values. All numbers + * with a smaller absolute value + * will be printed as zero. + * + * The default value for this + * threshold is zero, + * i.e. numbers are printed + * according to their real value. + * + * This feature is mostly useful + * for automated tests: there, + * one would like to reproduce + * the exact same solution in + * each run of a + * testsuite. However, subtle + * difference in processor, + * operating system, or compiler + * version can lead to + * differences in the last few + * digits of numbers, due to + * different rounding. While one + * can avoid trouble for most + * numbers when comparing with + * stored results by simply + * limiting the accuracy of + * output, this does not hold for + * numbers very close to zero, + * i.e. zero plus accumulated + * round-off. For these numbers, + * already the first digit is + * tainted by round-off. Using + * the present function, it is + * possible to eliminate this + * source of problems, by simply + * writing zero to the output in + * this case. + */ void threshold_double(const double t); - /** - * The same as - * threshold_double(), but for - * float values. - */ + /** + * The same as + * threshold_double(), but for + * float values. + */ void threshold_float(const float t); - - /** - * Output a constant something - * through this stream. - */ + + /** + * Output a constant something + * through this stream. + */ template LogStream & operator << (const T &t); - /** - * Output double precision - * numbers through this - * stream. - * - * If they are set, this function - * applies the methods for making - * floating point output - * reproducible as discussed in - * the introduction. - */ + /** + * Output double precision + * numbers through this + * stream. + * + * If they are set, this function + * applies the methods for making + * floating point output + * reproducible as discussed in + * the introduction. + */ LogStream & operator << (const double t); - /** - * Output single precision - * numbers through this - * stream. - * - * If they are set, this function - * applies the methods for making - * floating point output - * reproducible as discussed in - * the introduction. - */ + /** + * Output single precision + * numbers through this + * stream. + * + * If they are set, this function + * applies the methods for making + * floating point output + * reproducible as discussed in + * the introduction. + */ LogStream & operator << (const float t); - /** - * Treat ostream - * manipulators. This passes on - * the whole thing to the - * template function with the - * exception of the - * std::endl - * manipulator, for which special - * action is performed: write the - * temporary stream buffer - * including a header to the file - * and std::cout and - * empty the buffer. - * - * An overload of this function is needed - * anyway, since the compiler can't bind - * manipulators like @p std::endl - * directly to template arguments @p T - * like in the previous general - * template. This is due to the fact that - * @p std::endl is actually an overloaded - * set of functions for @p std::ostream, - * @p std::wostream, and potentially more - * of this kind. This function is - * therefore necessary to pick one - * element from this overload set. - */ + /** + * Treat ostream + * manipulators. This passes on + * the whole thing to the + * template function with the + * exception of the + * std::endl + * manipulator, for which special + * action is performed: write the + * temporary stream buffer + * including a header to the file + * and std::cout and + * empty the buffer. + * + * An overload of this function is needed + * anyway, since the compiler can't bind + * manipulators like @p std::endl + * directly to template arguments @p T + * like in the previous general + * template. This is due to the fact that + * @p std::endl is actually an overloaded + * set of functions for @p std::ostream, + * @p std::wostream, and potentially more + * of this kind. This function is + * therefore necessary to pick one + * element from this overload set. + */ LogStream & operator<< (std::ostream& (*p) (std::ostream&)); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ std::size_t memory_consumption () const; - /** - * Exception. - */ + /** + * Exception. + */ DeclException0(ExcNoFileStreamGiven); private: - - /** - * Stack of strings which are printed - * at the beginning of each line to - * allow identification where the - * output was generated. - */ + + /** + * Stack of strings which are printed + * at the beginning of each line to + * allow identification where the + * output was generated. + */ std::stack prefixes; - /** - * Default stream, where the output - * is to go to. This stream defaults - * to std::cerr, but can be set to another - * stream through the constructor. - */ + /** + * Default stream, where the output + * is to go to. This stream defaults + * to std::cerr, but can be set to another + * stream through the constructor. + */ std::ostream *std_out; - /** - * Pointer to a stream, where a copy of - * the output is to go to. Usually, this - * will be a file stream. - * - * You can set and reset this stream - * by the attach function. - */ + /** + * Pointer to a stream, where a copy of + * the output is to go to. Usually, this + * will be a file stream. + * + * You can set and reset this stream + * by the attach function. + */ std::ostream *file; - /** - * Value denoting the number of - * prefixes to be printed to the - * standard output. If more than - * this number of prefixes is - * pushed to the stack, then no - * output will be generated until - * the number of prefixes shrinks - * back below this number. - */ + /** + * Value denoting the number of + * prefixes to be printed to the + * standard output. If more than + * this number of prefixes is + * pushed to the stack, then no + * output will be generated until + * the number of prefixes shrinks + * back below this number. + */ unsigned int std_depth; - /** - * Same for the maximum depth of - * prefixes for output to a file. - */ + /** + * Same for the maximum depth of + * prefixes for output to a file. + */ unsigned int file_depth; /** - * Flag for printing execution time. - */ + * Flag for printing execution time. + */ bool print_utime; - /** - * Flag for printing time differences. - */ + /** + * Flag for printing time differences. + */ bool diff_utime; - /** - * Time of last output line. - */ + /** + * Time of last output line. + */ double last_time; - /** - * Threshold for printing double - * values. Every number with - * absolute value less than this - * is printed as zero. - */ + /** + * Threshold for printing double + * values. Every number with + * absolute value less than this + * is printed as zero. + */ double double_threshold; - /** - * Threshold for printing float - * values. Every number with - * absolute value less than this - * is printed as zero. - */ + /** + * Threshold for printing float + * values. Every number with + * absolute value less than this + * is printed as zero. + */ float float_threshold; - /** - * An offset added to every float - * or double number upon - * output. This is done after the - * number is compared to - * #double_threshold or #float_threshold, - * but before rounding. - * - * This functionality was - * introduced to produce more - * reproducable floating point - * output for regression - * tests. The rationale is, that - * an exact output value is much - * more likely to be 1/8 than - * 0.124997. If we round to two - * digits though, 1/8 becomes - * unreliably either .12 or .13 - * due to machine accuracy. On - * the other hand, if we add a - * something above machine - * accuracy first, we will always - * get .13. - * - * It is safe to leave this - * value equal to zero. For - * regression tests, the function - * test_mode() sets it to a - * reasonable value. - * - * The offset is relative to the - * magnitude of the number. - */ + /** + * An offset added to every float + * or double number upon + * output. This is done after the + * number is compared to + * #double_threshold or #float_threshold, + * but before rounding. + * + * This functionality was + * introduced to produce more + * reproducable floating point + * output for regression + * tests. The rationale is, that + * an exact output value is much + * more likely to be 1/8 than + * 0.124997. If we round to two + * digits though, 1/8 becomes + * unreliably either .12 or .13 + * due to machine accuracy. On + * the other hand, if we add a + * something above machine + * accuracy first, we will always + * get .13. + * + * It is safe to leave this + * value equal to zero. For + * regression tests, the function + * test_mode() sets it to a + * reasonable value. + * + * The offset is relative to the + * magnitude of the number. + */ double offset; - - /** - * Flag for printing thread id. - */ + + /** + * Flag for printing thread id. + */ bool print_thread_id; - /** - * The value times() returned - * on initialization. - */ + /** + * The value times() returned + * on initialization. + */ double reference_time_val; - /** - * The tms structure times() - * filled on initialization. - */ + /** + * The tms structure times() + * filled on initialization. + */ struct tms reference_tms; - - /** - * Original buffer of - * std::cerr. We store - * the address of that buffer - * when #log_cerr is called, and - * reset it to this value if - * #log_cerr is called a second - * time, or when the destructor - * of this class is run. - */ + + /** + * Original buffer of + * std::cerr. We store + * the address of that buffer + * when #log_cerr is called, and + * reset it to this value if + * #log_cerr is called a second + * time, or when the destructor + * of this class is run. + */ std::streambuf *old_cerr; - + /** - * Print head of line. This prints - * optional time information and - * the contents of the prefix stack. - */ + * Print head of line. This prints + * optional time information and + * the contents of the prefix stack. + */ void print_line_head (); - /** - * Actually do the work of - * writing output. This function - * unifies the work that is - * common to the two - * operator<< functions. - */ + /** + * Actually do the work of + * writing output. This function + * unifies the work that is + * common to the two + * operator<< functions. + */ template void print (const T &t); - /** - * Check if we are on a new line - * and print the header before - * the data. - */ + /** + * Check if we are on a new line + * and print the header before + * the data. + */ std::ostringstream& get_stream(); - - /** - * Type of the stream map - */ + + /** + * Type of the stream map + */ typedef std::map > stream_map_type; - - /** - * We generate a stringstream for - * every process that sends log - * messages. - */ + + /** + * We generate a stringstream for + * every process that sends log + * messages. + */ stream_map_type outstreams; - + }; @@ -621,12 +621,12 @@ inline void LogStream::print (const T &t) { - // if the previous command was an - // std::endl, print the topmost - // prefix and a colon + // if the previous command was an + // std::endl, print the topmost + // prefix and a colon std::ostringstream& stream = get_stream(); stream << t; - // print the rest of the message + // print the rest of the message // if (prefixes.size() <= std_depth) // *std_out << t; @@ -641,8 +641,8 @@ inline LogStream & LogStream::operator<< (const T& t) { - // do the work that is common to - // the operator<< functions + // do the work that is common to + // the operator<< functions print (t); return *this; } @@ -668,7 +668,7 @@ LogStream::operator<< (const double t) print ('0'); else print(t*(1.+offset)); - + return *this; } @@ -693,15 +693,15 @@ LogStream::operator<< (const float t) print ('0'); else print(t*(1.+offset)); - + return *this; } inline LogStream::Prefix::Prefix(const std::string& text, LogStream& s) - : - stream(&s) + : + stream(&s) { stream->push(text); } @@ -725,8 +725,8 @@ extern LogStream deallog; inline LogStream::Prefix::Prefix(const std::string& text) - : - stream(&deallog) + : + stream(&deallog) { stream->push(text); } diff --git a/deal.II/include/deal.II/base/memory_consumption.h b/deal.II/include/deal.II/base/memory_consumption.h index d5b8dfe0a0..ee048569c2 100644 --- a/deal.II/include/deal.II/base/memory_consumption.h +++ b/deal.II/include/deal.II/base/memory_consumption.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -83,334 +83,334 @@ DEAL_II_NAMESPACE_OPEN namespace MemoryConsumption { - /** - * This function is the generic - * interface for determining the - * memory used by an object. If no - * specialization for the type - * T is specified, it will - * call the member function - * t.memory_consumption(). - * - * The library provides - * specializations for all basic - * C++ data types. Every additional - * type needs to have a member - * function memory_consumption() - * callable for constant objects to - * be used in this framework. - */ + /** + * This function is the generic + * interface for determining the + * memory used by an object. If no + * specialization for the type + * T is specified, it will + * call the member function + * t.memory_consumption(). + * + * The library provides + * specializations for all basic + * C++ data types. Every additional + * type needs to have a member + * function memory_consumption() + * callable for constant objects to + * be used in this framework. + */ template inline std::size_t memory_consumption (const T &t); - /** - * Determine the amount of memory - * in bytes consumed by a bool - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a bool + * variable. + */ inline std::size_t memory_consumption (const bool); - /** - * Determine the amount of memory - * in bytes consumed by a char - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a char + * variable. + */ inline std::size_t memory_consumption (const char); - /** - * Determine the amount of memory - * in bytes consumed by a - * short int variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a + * short int variable. + */ inline std::size_t memory_consumption (const short int); - /** - * Determine the amount of memory - * in bytes consumed by a - * short unsigned int variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a + * short unsigned int variable. + */ inline std::size_t memory_consumption (const short unsigned int); - /** - * Determine the amount of memory - * in bytes consumed by a int - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a int + * variable. + */ inline std::size_t memory_consumption (const int); - /** - * Determine the amount of memory - * in bytes consumed by a unsigned int - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a unsigned int + * variable. + */ inline std::size_t memory_consumption (const unsigned int); - /** - * Determine the amount of memory - * in bytes consumed by a float - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a float + * variable. + */ inline std::size_t memory_consumption (const float); - /** - * Determine the amount of memory - * in bytes consumed by a double - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a double + * variable. + */ inline std::size_t memory_consumption (const double); - /** - * Determine the amount of memory - * in bytes consumed by a long double - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a long double + * variable. + */ inline std::size_t memory_consumption (const long double); - /** - * Determine the amount of memory - * in bytes consumed by a std::complex - * variable. - */ + /** + * Determine the amount of memory + * in bytes consumed by a std::complex + * variable. + */ template inline std::size_t memory_consumption (const std::complex &); - /** - * Determine an estimate of the - * amount of memory in bytes - * consumed by a std::string - * variable. - */ + /** + * Determine an estimate of the + * amount of memory in bytes + * consumed by a std::string + * variable. + */ inline std::size_t memory_consumption (const std::string &s); - /** - * Determine the amount of memory - * in bytes consumed by a - * std::vector of elements - * of type T by - * recursively calling - * memory_consumption() for each entry. - * - * This function loops over all - * entries of the vector and - * determines their sizes using - * memory_consumption() for each - * v[i]. If the entries - * are of constant size, there - * might be another global function - * memory_consumption() for this - * data type or if there is a - * member function of that class of - * that names that returns a - * constant value and the compiler - * will unroll this loop so that - * the operation is fast. If the - * size of the data elements is - * variable, for example if they do - * memory allocation themselves, - * then the operation will - * necessarily be more expensive. - * - * Using the algorithm, in - * particular the loop over all - * elements, it is possible to also - * compute the memory consumption - * of vectors of vectors, vectors - * of strings, etc, where the - * individual elements may have - * vastly different sizes. - * - * Note that this algorithm also - * takes into account the size of - * elements that are allocated by - * this vector but not currently - * used. - * - * For the most commonly used - * vectors, there are special - * functions that compute the size - * without a loop. This also - * applies for the special case of - * vectors of bools. - */ + /** + * Determine the amount of memory + * in bytes consumed by a + * std::vector of elements + * of type T by + * recursively calling + * memory_consumption() for each entry. + * + * This function loops over all + * entries of the vector and + * determines their sizes using + * memory_consumption() for each + * v[i]. If the entries + * are of constant size, there + * might be another global function + * memory_consumption() for this + * data type or if there is a + * member function of that class of + * that names that returns a + * constant value and the compiler + * will unroll this loop so that + * the operation is fast. If the + * size of the data elements is + * variable, for example if they do + * memory allocation themselves, + * then the operation will + * necessarily be more expensive. + * + * Using the algorithm, in + * particular the loop over all + * elements, it is possible to also + * compute the memory consumption + * of vectors of vectors, vectors + * of strings, etc, where the + * individual elements may have + * vastly different sizes. + * + * Note that this algorithm also + * takes into account the size of + * elements that are allocated by + * this vector but not currently + * used. + * + * For the most commonly used + * vectors, there are special + * functions that compute the size + * without a loop. This also + * applies for the special case of + * vectors of bools. + */ template inline std::size_t memory_consumption (const std::vector &v); - /** - * Estimate the amount of memory - * (in bytes) occupied by a - * C-style array. Since in this - * library we do not usually - * store simple data elements - * like doubles in such - * arrays (but rather use STL - * std::vectors or deal.II - * Vector objects), we do not - * provide specializations like - * for the std::vector arrays, but - * always use the loop over all - * elements. - */ + /** + * Estimate the amount of memory + * (in bytes) occupied by a + * C-style array. Since in this + * library we do not usually + * store simple data elements + * like doubles in such + * arrays (but rather use STL + * std::vectors or deal.II + * Vector objects), we do not + * provide specializations like + * for the std::vector arrays, but + * always use the loop over all + * elements. + */ template inline std::size_t memory_consumption (const T (&v)[N]); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of bools. - * - * This is a special case, as the - * bools are not stored - * one-by-one, but as a bit - * field. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of bools. + * + * This is a special case, as the + * bools are not stored + * one-by-one, but as a bit + * field. + */ inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of ints. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of ints. + */ inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of doubles. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of doubles. + */ inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of floats. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of floats. + */ inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of chars. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of chars. + */ inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of unsigned chars. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of unsigned chars. + */ inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of pointers. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of pointers. + */ template inline std::size_t memory_consumption (const std::vector &v); - /** - * Specialization of the - * determination of the memory - * consumption of a vector, here - * for a vector of strings. This - * function is not necessary from a - * strict C++ viewpoint, since it - * could be generated, but is - * necessary for compatibility with - * IBM's xlC 5.0 compiler, and - * doesn't harm for other compilers - * as well. - */ + /** + * Specialization of the + * determination of the memory + * consumption of a vector, here + * for a vector of strings. This + * function is not necessary from a + * strict C++ viewpoint, since it + * could be generated, but is + * necessary for compatibility with + * IBM's xlC 5.0 compiler, and + * doesn't harm for other compilers + * as well. + */ std::size_t memory_consumption (const std::vector &v); - /** - * Determine an estimate of the - * amount of memory in bytes - * consumed by a pair of values. - */ + /** + * Determine an estimate of the + * amount of memory in bytes + * consumed by a pair of values. + */ template inline std::size_t memory_consumption (const std::pair &p); - /** - * Return the amount of memory - * used by a pointer. - * - * @note This returns the size of - * the pointer, not of the object - * pointed to. - */ + /** + * Return the amount of memory + * used by a pointer. + * + * @note This returns the size of + * the pointer, not of the object + * pointed to. + */ template inline std::size_t memory_consumption (const T * const); - /** - * Return the amount of memory - * used by a pointer. - * - * @note This returns the size of - * the pointer, not of the object - * pointed to. - */ + /** + * Return the amount of memory + * used by a pointer. + * + * @note This returns the size of + * the pointer, not of the object + * pointed to. + */ template inline std::size_t memory_consumption (T * const); - /** - * Return the amount of memory - * used by a void pointer. - * - * Note that we needed this - * function since void is no - * type and a void* is thus - * not caught by the general - * T* template function - * above. - * - * @note This returns the size of - * the pointer, not of the object - * pointed to. - */ + /** + * Return the amount of memory + * used by a void pointer. + * + * Note that we needed this + * function since void is no + * type and a void* is thus + * not caught by the general + * T* template function + * above. + * + * @note This returns the size of + * the pointer, not of the object + * pointed to. + */ inline std::size_t memory_consumption (void * const); - /** - * Return the amount of memory used - * by a shared pointer. - * - * @note This returns the size of - * the pointer, not of the object - * pointed to. - */ + /** + * Return the amount of memory used + * by a shared pointer. + * + * @note This returns the size of + * the pointer, not of the object + * pointed to. + */ template inline std::size_t memory_consumption (const std_cxx1x::shared_ptr &); @@ -546,7 +546,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector &v) { return (v.capacity() * sizeof(int) + - sizeof(v)); + sizeof(v)); } @@ -555,7 +555,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector &v) { return (v.capacity() * sizeof(double) + - sizeof(v)); + sizeof(v)); } @@ -564,7 +564,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector &v) { return (v.capacity() * sizeof(float) + - sizeof(v)); + sizeof(v)); } @@ -573,7 +573,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector &v) { return (v.capacity() * sizeof(char) + - sizeof(v)); + sizeof(v)); } @@ -582,7 +582,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector &v) { return (v.capacity() * sizeof(unsigned char) + - sizeof(v)); + sizeof(v)); } @@ -592,7 +592,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::vector &v) { return (v.capacity() * sizeof(T *) + - sizeof(v)); + sizeof(v)); } @@ -602,7 +602,7 @@ namespace MemoryConsumption std::size_t memory_consumption (const std::pair &p) { return (memory_consumption(p.first) + - memory_consumption(p.second)); + memory_consumption(p.second)); } diff --git a/deal.II/include/deal.II/base/mg_level_object.h b/deal.II/include/deal.II/base/mg_level_object.h index 354efd05fc..0d2a58c6f2 100644 --- a/deal.II/include/deal.II/base/mg_level_object.h +++ b/deal.II/include/deal.II/base/mg_level_object.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2010, 2011 by the deal.II authors +// Copyright (C) 2003, 2004, 2005, 2006, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -38,89 +38,89 @@ template class MGLevelObject : public Subscriptor { public: - /** - * Constructor allowing to - * initialize the number of - * levels. By default, the object - * is created empty. - */ + /** + * Constructor allowing to + * initialize the number of + * levels. By default, the object + * is created empty. + */ MGLevelObject (const unsigned int minlevel = 0, - const unsigned int maxlevel = 0); - - /** - * Access object on level @p level. - */ + const unsigned int maxlevel = 0); + + /** + * Access object on level @p level. + */ Object & operator[] (const unsigned int level); - - /** - * Access object on level - * @p level. Constant version. - */ + + /** + * Access object on level + * @p level. Constant version. + */ const Object & operator[] (const unsigned int level) const; - /** - * Delete all previous contents - * of this object and reset its - * size according to the values - * of @p new_minlevel and - * @p new_maxlevel. - */ + /** + * Delete all previous contents + * of this object and reset its + * size according to the values + * of @p new_minlevel and + * @p new_maxlevel. + */ void resize (const unsigned int new_minlevel, - const unsigned int new_maxlevel); - - /** - * Call operator = (s) - * on all objects stored by this - * object. This is particularly - * useful for - * e.g. Object==Vector@ - */ + const unsigned int new_maxlevel); + + /** + * Call operator = (s) + * on all objects stored by this + * object. This is particularly + * useful for + * e.g. Object==Vector@ + */ MGLevelObject & operator = (const double d); - - /** - * Call @p clear on all objects - * stored by this object. This - * function is only implemented - * for some @p Object classes, - * e.g. the PreconditionBlockSOR - * and similar classes. - */ + + /** + * Call @p clear on all objects + * stored by this object. This + * function is only implemented + * for some @p Object classes, + * e.g. the PreconditionBlockSOR + * and similar classes. + */ void clear(); - /** - * Coarsest level for multigrid. - */ + /** + * Coarsest level for multigrid. + */ unsigned int min_level () const; - - /** - * Finest level for multigrid. - */ + + /** + * Finest level for multigrid. + */ unsigned int max_level () const; - - /** - * @deprecated Replaced by min_level() - */ + + /** + * @deprecated Replaced by min_level() + */ unsigned int get_minlevel () const; - - /** - * @deprecated Replaced by max_level() - */ + + /** + * @deprecated Replaced by max_level() + */ unsigned int get_maxlevel () const; - - /** - * Memory used by this object. - */ + + /** + * Memory used by this object. + */ std::size_t memory_consumption () const; - + private: - /** - * Level of first component. - */ + /** + * Level of first component. + */ unsigned int minlevel; - /** - * Array of the objects to be held. - */ + /** + * Array of the objects to be held. + */ std::vector > objects; }; @@ -130,9 +130,9 @@ class MGLevelObject : public Subscriptor template MGLevelObject::MGLevelObject(const unsigned int min, - const unsigned int max) - : - minlevel(0) + const unsigned int max) + : + minlevel(0) { resize (min, max); } @@ -143,7 +143,7 @@ Object & MGLevelObject::operator[] (const unsigned int i) { Assert((i>=minlevel) && (i::operator[] (const unsigned int i) const { Assert((i>=minlevel) && (i::operator[] (const unsigned int i) const template void MGLevelObject::resize (const unsigned int new_minlevel, - const unsigned int new_maxlevel) + const unsigned int new_maxlevel) { Assert (new_minlevel <= new_maxlevel, ExcInternalError()); - // note that on clear(), the - // shared_ptr class takes care of - // deleting the object it points to - // by itself + // note that on clear(), the + // shared_ptr class takes care of + // deleting the object it points to + // by itself objects.clear (); minlevel = new_minlevel; for (unsigned int i=0; i (new Object)); + objects.push_back(std_cxx1x::shared_ptr (new Object)); } @@ -238,7 +238,7 @@ MGLevelObject::memory_consumption () const const Iter end = objects.end(); for (Iter o=objects.begin(); o!=end; ++o) result += (*o)->memory_consumption(); - + return result; } diff --git a/deal.II/include/deal.II/base/mpi.h b/deal.II/include/deal.II/base/mpi.h index 7bb90ebc9d..2fdb14da05 100644 --- a/deal.II/include/deal.II/base/mpi.h +++ b/deal.II/include/deal.II/base/mpi.h @@ -19,9 +19,9 @@ #if defined(DEAL_II_COMPILER_SUPPORTS_MPI) || defined(DEAL_II_USE_PETSC) # include #else - // without MPI, we would still like to use - // some constructs with MPI data - // types. Therefore, create some dummies + // without MPI, we would still like to use + // some constructs with MPI data + // types. Therefore, create some dummies typedef int MPI_Comm; const int MPI_COMM_SELF = 0; typedef int MPI_Datatype; @@ -45,128 +45,128 @@ namespace Utilities /** * A namespace for utility functions that * abstract certain operations using the - * Message Passing Interface (MPI) or - * provide fallback operations in - * case deal.II is configured not to use - * MPI at all. + * Message Passing Interface (MPI) or + * provide fallback operations in + * case deal.II is configured not to use + * MPI at all. * * @ingroup utilities */ namespace MPI { - /** - * Return the number of MPI processes - * there exist in the given communicator - * object. If this is a sequential job, - * it returns 1. - */ + /** + * Return the number of MPI processes + * there exist in the given communicator + * object. If this is a sequential job, + * it returns 1. + */ unsigned int n_mpi_processes (const MPI_Comm &mpi_communicator); - /** - * Return the number of the present MPI - * process in the space of processes - * described by the given - * communicator. This will be a unique - * value for each process between zero - * and (less than) the number of all - * processes (given by - * get_n_mpi_processes()). - */ + /** + * Return the number of the present MPI + * process in the space of processes + * described by the given + * communicator. This will be a unique + * value for each process between zero + * and (less than) the number of all + * processes (given by + * get_n_mpi_processes()). + */ unsigned int this_mpi_process (const MPI_Comm &mpi_communicator); - /** - * Consider an unstructured - * communication pattern where - * every process in an MPI - * universe wants to send some - * data to a subset of the other - * processors. To do that, the - * other processors need to know - * who to expect messages - * from. This function computes - * this information. - * - * @param mpi_comm A communicator - * that describes the processors - * that are going to communicate - * with each other. - * - * @param destinations The list - * of processors the current - * process wants to send - * information to. This list need - * not be sorted in any way. If - * it contains duplicate entries - * that means that multiple - * messages are intended for a - * given destination. - * - * @return A list of processors - * that have indicated that they - * want to send something to the - * current processor. The - * resulting list is not - * sorted. It may contain - * duplicate entries if - * processors enter the same - * destination more than once in - * their destinations list. - */ + /** + * Consider an unstructured + * communication pattern where + * every process in an MPI + * universe wants to send some + * data to a subset of the other + * processors. To do that, the + * other processors need to know + * who to expect messages + * from. This function computes + * this information. + * + * @param mpi_comm A communicator + * that describes the processors + * that are going to communicate + * with each other. + * + * @param destinations The list + * of processors the current + * process wants to send + * information to. This list need + * not be sorted in any way. If + * it contains duplicate entries + * that means that multiple + * messages are intended for a + * given destination. + * + * @return A list of processors + * that have indicated that they + * want to send something to the + * current processor. The + * resulting list is not + * sorted. It may contain + * duplicate entries if + * processors enter the same + * destination more than once in + * their destinations list. + */ std::vector compute_point_to_point_communication_pattern (const MPI_Comm & mpi_comm, - const std::vector & destinations); - - /** - * Given a communicator, generate a new - * communicator that contains the same - * set of processors but that has a - * different, unique identifier. - * - * This functionality can be used to - * ensure that different objects, such as - * distributed matrices, each have unique - * communicators over which they can - * interact without interfering with each - * other. - * - * When no longer needed, the - * communicator created here needs to - * be destroyed using - * MPI_Comm_free. - */ + const std::vector & destinations); + + /** + * Given a communicator, generate a new + * communicator that contains the same + * set of processors but that has a + * different, unique identifier. + * + * This functionality can be used to + * ensure that different objects, such as + * distributed matrices, each have unique + * communicators over which they can + * interact without interfering with each + * other. + * + * When no longer needed, the + * communicator created here needs to + * be destroyed using + * MPI_Comm_free. + */ MPI_Comm duplicate_communicator (const MPI_Comm &mpi_communicator); - /** - * Return the sum over all processors of the value @p t. This function - * is collective over all processors given in the communicator. If - * deal.II is not configured for use of MPI, this function simply - * returns the value of @p t. This function corresponds to the - * MPI_Allreduce function, i.e. all processors receive - * the result of this operation. - * - * @note This function is only implemented for certain template - * arguments T, namely float, double, int, - * unsigned int. - */ + /** + * Return the sum over all processors of the value @p t. This function + * is collective over all processors given in the communicator. If + * deal.II is not configured for use of MPI, this function simply + * returns the value of @p t. This function corresponds to the + * MPI_Allreduce function, i.e. all processors receive + * the result of this operation. + * + * @note This function is only implemented for certain template + * arguments T, namely float, double, int, + * unsigned int. + */ template T sum (const T &t, - const MPI_Comm &mpi_communicator); - - /** - * Like the previous function, - * but take the sums over the - * elements of an array - * of length N. In other words, - * the i-th element of the - * results array is the sum over - * the i-th entries of the input - * arrays from each processor. - */ + const MPI_Comm &mpi_communicator); + + /** + * Like the previous function, + * but take the sums over the + * elements of an array + * of length N. In other words, + * the i-th element of the + * results array is the sum over + * the i-th entries of the input + * arrays from each processor. + */ template inline void sum (const T (&values)[N], - const MPI_Comm &mpi_communicator, - T (&sums)[N]); + const MPI_Comm &mpi_communicator, + T (&sums)[N]); /** * Like the previous function, @@ -183,37 +183,37 @@ namespace Utilities const MPI_Comm &mpi_communicator, std::vector &sums); - /** - * Return the maximum over all processors of the value @p t. This function - * is collective over all processors given in the communicator. If - * deal.II is not configured for use of MPI, this function simply - * returns the value of @p t. This function corresponds to the - * MPI_Allreduce function, i.e. all processors receive - * the result of this operation. - * - * @note This function is only implemented for certain template - * arguments T, namely float, double, int, - * unsigned int. - */ + /** + * Return the maximum over all processors of the value @p t. This function + * is collective over all processors given in the communicator. If + * deal.II is not configured for use of MPI, this function simply + * returns the value of @p t. This function corresponds to the + * MPI_Allreduce function, i.e. all processors receive + * the result of this operation. + * + * @note This function is only implemented for certain template + * arguments T, namely float, double, int, + * unsigned int. + */ template T max (const T &t, - const MPI_Comm &mpi_communicator); - - /** - * Like the previous function, - * but take the maxima over the - * elements of an array - * of length N. In other words, - * the i-th element of the - * results array is the maximum of - * the i-th entries of the input - * arrays from each processor. - */ + const MPI_Comm &mpi_communicator); + + /** + * Like the previous function, + * but take the maxima over the + * elements of an array + * of length N. In other words, + * the i-th element of the + * results array is the maximum of + * the i-th entries of the input + * arrays from each processor. + */ template inline void max (const T (&values)[N], - const MPI_Comm &mpi_communicator, - T (&maxima)[N]); + const MPI_Comm &mpi_communicator, + T (&maxima)[N]); /** * Like the previous function, @@ -230,143 +230,143 @@ namespace Utilities const MPI_Comm &mpi_communicator, std::vector &maxima); - /** - * Data structure to store the result of - * min_max_avg(). - */ + /** + * Data structure to store the result of + * min_max_avg(). + */ struct MinMaxAvg { - double sum; - double min; - double max; - unsigned int min_index; - unsigned int max_index; - double avg; + double sum; + double min; + double max; + unsigned int min_index; + unsigned int max_index; + double avg; }; - /** - * Returns sum, average, minimum, - * maximum, processor id of minimum and - * maximum as a collective operation of - * on the given MPI communicator @param - * mpi_communicator . Each processor's - * value is given in @param my_value and - * the result will be returned in @p - * result . The result is available on all - * machines. - */ + /** + * Returns sum, average, minimum, + * maximum, processor id of minimum and + * maximum as a collective operation of + * on the given MPI communicator @param + * mpi_communicator . Each processor's + * value is given in @param my_value and + * the result will be returned in @p + * result . The result is available on all + * machines. + */ MinMaxAvg min_max_avg (const double my_value, - const MPI_Comm &mpi_communicator); - - - - /** - * A class that is used to initialize the - * MPI system at the beginning of a - * program and to shut it down again at - * the end. - * - * If a program uses MPI one would - * typically just create an object of - * this type at the beginning of - * main(). The constructor - * of this class then runs - * MPI_Init() with the given - * arguments. At the end of the program, - * the compiler will invoke the - * destructor of this object which in - * turns calls MPI_Finalize - * to shut down the MPI system. - * - * This class is used in step-32, for example. - */ + const MPI_Comm &mpi_communicator); + + + + /** + * A class that is used to initialize the + * MPI system at the beginning of a + * program and to shut it down again at + * the end. + * + * If a program uses MPI one would + * typically just create an object of + * this type at the beginning of + * main(). The constructor + * of this class then runs + * MPI_Init() with the given + * arguments. At the end of the program, + * the compiler will invoke the + * destructor of this object which in + * turns calls MPI_Finalize + * to shut down the MPI system. + * + * This class is used in step-32, for example. + */ class MPI_InitFinalize { public: - /** - * Constructor. Takes the arguments - * from the command line (in case of - * MPI, the number of processes is - * specified there), and sets up a - * respective communicator by calling - * MPI_Init(). This - * constructor can only be called once - * in a program, since MPI cannot be - * initialized twice. - */ - MPI_InitFinalize (int &argc, - char** &argv); - - /** - * Destructor. Calls - * MPI_Finalize() in - * case this class owns the MPI - * process. - */ - ~MPI_InitFinalize(); + /** + * Constructor. Takes the arguments + * from the command line (in case of + * MPI, the number of processes is + * specified there), and sets up a + * respective communicator by calling + * MPI_Init(). This + * constructor can only be called once + * in a program, since MPI cannot be + * initialized twice. + */ + MPI_InitFinalize (int &argc, + char** &argv); + + /** + * Destructor. Calls + * MPI_Finalize() in + * case this class owns the MPI + * process. + */ + ~MPI_InitFinalize(); private: - /** - * This flag tells the class - * whether it owns the MPI - * process (i.e., it has been - * constructed using the - * argc/argv input, or it has - * been copied). In the former - * case, the command - * MPI_Finalize() will - * be called at destruction. - */ - const bool owns_mpi; + /** + * This flag tells the class + * whether it owns the MPI + * process (i.e., it has been + * constructed using the + * argc/argv input, or it has + * been copied). In the former + * case, the command + * MPI_Finalize() will + * be called at destruction. + */ + const bool owns_mpi; }; namespace internal { #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - /** - * Return the corresponding MPI data - * type id for the argument given. - */ + /** + * Return the corresponding MPI data + * type id for the argument given. + */ inline MPI_Datatype mpi_type_id (const int *) { - return MPI_INT; + return MPI_INT; } inline MPI_Datatype mpi_type_id (const long int *) { - return MPI_LONG; + return MPI_LONG; } inline MPI_Datatype mpi_type_id (const unsigned int *) { - return MPI_UNSIGNED; + return MPI_UNSIGNED; } inline MPI_Datatype mpi_type_id (const unsigned long int *) { - return MPI_UNSIGNED_LONG; + return MPI_UNSIGNED_LONG; } inline MPI_Datatype mpi_type_id (const float *) { - return MPI_FLOAT; + return MPI_FLOAT; } inline MPI_Datatype mpi_type_id (const double *) { - return MPI_DOUBLE; + return MPI_DOUBLE; } inline MPI_Datatype mpi_type_id (const long double *) { - return MPI_LONG_DOUBLE; + return MPI_LONG_DOUBLE; } #endif } @@ -375,13 +375,13 @@ namespace Utilities template inline T sum (const T &t, - const MPI_Comm &mpi_communicator) + const MPI_Comm &mpi_communicator) { #ifdef DEAL_II_COMPILER_SUPPORTS_MPI T sum; MPI_Allreduce (const_cast(static_cast(&t)), - &sum, 1, internal::mpi_type_id(&t), MPI_SUM, - mpi_communicator); + &sum, 1, internal::mpi_type_id(&t), MPI_SUM, + mpi_communicator); return sum; #else (void)mpi_communicator; @@ -393,17 +393,17 @@ namespace Utilities template inline void sum (const T (&values)[N], - const MPI_Comm &mpi_communicator, - T (&sums)[N]) + const MPI_Comm &mpi_communicator, + T (&sums)[N]) { #ifdef DEAL_II_COMPILER_SUPPORTS_MPI MPI_Allreduce (const_cast(static_cast(&values[0])), - &sums[0], N, internal::mpi_type_id(values), MPI_SUM, - mpi_communicator); + &sums[0], N, internal::mpi_type_id(values), MPI_SUM, + mpi_communicator); #else (void)mpi_communicator; for (unsigned int i=0; i inline T max (const T &t, - const MPI_Comm &mpi_communicator) + const MPI_Comm &mpi_communicator) { #ifdef DEAL_II_COMPILER_SUPPORTS_MPI T sum; MPI_Allreduce (const_cast(static_cast(&t)), - &sum, 1, internal::mpi_type_id(&t), MPI_MAX, - mpi_communicator); + &sum, 1, internal::mpi_type_id(&t), MPI_MAX, + mpi_communicator); return sum; #else (void)mpi_communicator; @@ -447,17 +447,17 @@ namespace Utilities template inline void max (const T (&values)[N], - const MPI_Comm &mpi_communicator, - T (&maxima)[N]) + const MPI_Comm &mpi_communicator, + T (&maxima)[N]) { #ifdef DEAL_II_COMPILER_SUPPORTS_MPI MPI_Allreduce (const_cast(static_cast(&values[0])), - &maxima[0], N, internal::mpi_type_id(values), MPI_MAX, - mpi_communicator); + &maxima[0], N, internal::mpi_type_id(values), MPI_MAX, + mpi_communicator); #else (void)mpi_communicator; for (unsigned int i=0; imultithread_info.cc - * near to the error directive. - */ + /** + * The number of CPUs in the + * system. It is one if + * detection is not implemented + * or failed. + * + * If it is one, although you + * are on a multi-processor + * machine, please refer to the + * documentation in + * multithread_info.cc + * near to the error directive. + */ const unsigned int n_cpus; - /** - * The number of threads to use as - * a default value for all functions - * that support multithreading. - * At start time this is n_cpus or - * one, if detection of the number - * of CPUs is not possible. - */ + /** + * The number of threads to use as + * a default value for all functions + * that support multithreading. + * At start time this is n_cpus or + * one, if detection of the number + * of CPUs is not possible. + */ unsigned int n_default_threads; - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. Since sometimes - * the size of objects can - * not be determined exactly - * (for example: what is the - * memory consumption of an - * STL std::map type with a - * certain number of - * elements?), this is only - * an estimate. however often - * quite close to the true - * value. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. Since sometimes + * the size of objects can + * not be determined exactly + * (for example: what is the + * memory consumption of an + * STL std::map type with a + * certain number of + * elements?), this is only + * an estimate. however often + * quite close to the true + * value. + */ static std::size_t memory_consumption (); - /** - * Exception - */ + /** + * Exception + */ DeclException0(ExcProcNotPresent); - + private: - /** - * Private function to determine - * the number of CPUs. - * Implementation for Linux, OSF, - * SGI, and Sun machines; if no - * detection of the number of CPUs is - * supported, or if detection - * fails, this function returns - * one. - */ + /** + * Private function to determine + * the number of CPUs. + * Implementation for Linux, OSF, + * SGI, and Sun machines; if no + * detection of the number of CPUs is + * supported, or if detection + * fails, this function returns + * one. + */ static unsigned int get_n_cpus(); }; diff --git a/deal.II/include/deal.II/base/named_data.h b/deal.II/include/deal.II/base/named_data.h index 098695e5d7..0623378c7f 100644 --- a/deal.II/include/deal.II/base/named_data.h +++ b/deal.II/include/deal.II/base/named_data.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -30,7 +30,7 @@ DEAL_II_NAMESPACE_OPEN * Note that it is the actual data stored in this object. Therefore, * for storing vectors and other large objects, it should be * considered to use SmartPointer or boost::shared_ptr for DATA. - * + * * Objects of this kind have a smart way of treating constness: if a * const data object is added or a const NamedData is supplied with * merge(), the object will henceforth consider itself as const @@ -43,128 +43,128 @@ template class NamedData : public Subscriptor { public: - /** Standard constructor creating - * an empty object. - */ + /** Standard constructor creating + * an empty object. + */ NamedData(); - /** - * Assignment operator, copying - * conversible data from another - * object. - */ + /** + * Assignment operator, copying + * conversible data from another + * object. + */ template NamedData& operator = (const NamedData& other); - - /** - * \name Adding members - */ + + /** + * \name Adding members + */ //@{ - /** - * Add a new data item to the end - * of the collection. - */ + /** + * Add a new data item to the end + * of the collection. + */ void add(DATA& v, const std::string& name); - - /** - * Add a new constant data item - * to the end of the collection - * and make the collection - * constant. - */ + + /** + * Add a new constant data item + * to the end of the collection + * and make the collection + * constant. + */ void add(const DATA& v, const std::string& name); - /** - * Merge the data of another - * NamedData to the end of this - * object. - * - * If the other object had - * #is_constant set, so will have - * this object after merge. - */ + /** + * Merge the data of another + * NamedData to the end of this + * object. + * + * If the other object had + * #is_constant set, so will have + * this object after merge. + */ template void merge(NamedData&); - /** - * Merge the data of another - * NamedData to the end of this - * object. - * - * After this operation, all - * data in this object will be - * treated as const. - */ + /** + * Merge the data of another + * NamedData to the end of this + * object. + * + * After this operation, all + * data in this object will be + * treated as const. + */ template void merge(const NamedData&); //@} - /** - * \name Accessing and querying - * contents - */ + /** + * \name Accessing and querying + * contents + */ //@{ /// Number of stored data objects. unsigned int size() const; - /** - * @brief Access to stored data - * object by index. - * - * @note This function throws an - * exception, if is_const() - * returns true. In such - * a case, either cast the - * NamedData object to a const - * reference, or use the function - * read() instead of this operator. - */ + /** + * @brief Access to stored data + * object by index. + * + * @note This function throws an + * exception, if is_const() + * returns true. In such + * a case, either cast the + * NamedData object to a const + * reference, or use the function + * read() instead of this operator. + */ DATA& operator() (unsigned int i); - + /// Read-only access to stored data object by index. const DATA& operator() (unsigned int i) const; /// Read only access for a non-const object. const DATA& read (unsigned int i) const; - + /// Name of object at index. const std::string& name(unsigned int i) const; - + /// Find index of a named object unsigned int find(const std::string& name) const; /// Returns true if this object contains constant data bool is_const () const; - + /// List names of stored objects template void print(OUT& o) const; //@} - /** - * Exception indicating that a - * function expected a vector - * to have a certain name, but - * NamedData had a different - * name in that position. - */ + /** + * Exception indicating that a + * function expected a vector + * to have a certain name, but + * NamedData had a different + * name in that position. + */ DeclException2(ExcNameMismatch, int, std::string, - << "Name at position " << arg1 << " is not equal to " << arg2); - - /** - * Exception indicating that read - * access to stored data was - * attempted although the - * NamedData object contains - * const data and #is_constant - * was true. - */ + << "Name at position " << arg1 << " is not equal to " << arg2); + + /** + * Exception indicating that read + * access to stored data was + * attempted although the + * NamedData object contains + * const data and #is_constant + * was true. + */ DeclException0(ExcConstantObject); - + private: - /// True if the object is to be treated constant + /// True if the object is to be treated constant bool is_constant; - /// The actual data stored + /// The actual data stored std::vector data; - - /// Names for the data + + /// Names for the data std::vector names; }; @@ -180,54 +180,54 @@ class NamedData : public Subscriptor class NamedSelection { public: - /** - * Add a new name to be searched - * for in NamedData. - * - * @note Names will be added to - * the end of the current list. - */ + /** + * Add a new name to be searched + * for in NamedData. + * + * @note Names will be added to + * the end of the current list. + */ void add (const std::string& name); - /** - * Create the index vector - * pointing into the NamedData - * object. - */ + /** + * Create the index vector + * pointing into the NamedData + * object. + */ template void initialize(const NamedData& data); - /** - * The number of names in this - * object. This function may be - * used whether initialize() was - * called before or not. - */ + /** + * The number of names in this + * object. This function may be + * used whether initialize() was + * called before or not. + */ unsigned int size() const; - - /** - * Return the corresponding index - * in the NamedData object - * supplied to the last - * initialize(). It is an error - * if initialize() has not been - * called before. - * - * Indices are in the same order - * as the calls to add(). - */ + + /** + * Return the corresponding index + * in the NamedData object + * supplied to the last + * initialize(). It is an error + * if initialize() has not been + * called before. + * + * Indices are in the same order + * as the calls to add(). + */ unsigned int operator() (unsigned int i) const; private: - /** - * The selected names. - */ + /** + * The selected names. + */ std::vector names; - /** - * The index map generated by - * initialize() and accessed by - * operator(). - */ + /** + * The index map generated by + * initialize() and accessed by + * operator(). + */ std::vector indices; }; @@ -237,11 +237,11 @@ class NamedSelection template inline NamedData::NamedData() - : - is_constant(false) + : + is_constant(false) {} - - + + template inline void @@ -251,8 +251,8 @@ NamedData::add(DATA& v, const std::string& n) names.push_back(n); data.push_back(v); } - - + + template inline void @@ -264,8 +264,8 @@ NamedData::add(const DATA& v, const std::string& n) names.push_back(n); is_constant = true; } - - + + template template inline @@ -273,7 +273,7 @@ void NamedData::merge(NamedData& other) { Assert(!is_constant, ExcConstantObject()); - + for (unsigned int i=0;i::merge(NamedData& other) } is_constant = other.is_const(); } - - + + template template inline @@ -297,7 +297,7 @@ NamedData::merge(const NamedData& other) } is_constant = true; } - + template @@ -311,7 +311,7 @@ NamedData::operator= (const NamedData& other) is_constant = other.is_const(); return *this; } - + template @@ -321,8 +321,8 @@ NamedData::size() const { return data.size(); } - - + + template inline bool @@ -330,8 +330,8 @@ NamedData::is_const() const { return is_constant; } - - + + template inline DATA& @@ -341,8 +341,8 @@ NamedData::operator() (unsigned int i) AssertIndexRange(i, size()); return data[i]; } - - + + template inline const DATA& @@ -351,8 +351,8 @@ NamedData::operator() (unsigned int i) const AssertIndexRange(i, size()); return data[i]; } - - + + template inline const DATA& @@ -361,8 +361,8 @@ NamedData::read (unsigned int i) const AssertIndexRange(i, size()); return data[i]; } - - + + template inline const std::string& @@ -371,8 +371,8 @@ NamedData::name(unsigned int i) const AssertIndexRange(i, size()); return names[i]; } - - + + template inline unsigned int @@ -384,8 +384,8 @@ NamedData::find (const std::string& name) const return deal_II_numbers::invalid_unsigned_int; return i - names.begin(); } - - + + template template inline @@ -430,7 +430,7 @@ unsigned int NamedSelection::operator() (unsigned int i) const { Assert (indices.size() == names.size(), ExcNotInitialized()); - AssertIndexRange(i, size()); + AssertIndexRange(i, size()); return indices[i]; } diff --git a/deal.II/include/deal.II/base/numbers.h b/deal.II/include/deal.II/base/numbers.h index 1f3cecdac9..0a51cea75f 100644 --- a/deal.II/include/deal.II/base/numbers.h +++ b/deal.II/include/deal.II/base/numbers.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2006, 2007, 2010 by the deal.II authors +// Copyright (C) 2006, 2007, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -35,254 +35,254 @@ DEAL_II_NAMESPACE_OPEN */ namespace numbers { - /** - * Representation of the - * largest number that - * can be put into an - * unsigned integer. This - * value is widely used - * throughout the library - * as a marker for an - * invalid unsigned - * integer value, such as - * an invalid array - * index, an invalid - * array size, and the - * like. - */ + /** + * Representation of the + * largest number that + * can be put into an + * unsigned integer. This + * value is widely used + * throughout the library + * as a marker for an + * invalid unsigned + * integer value, such as + * an invalid array + * index, an invalid + * array size, and the + * like. + */ static const unsigned int invalid_unsigned_int = static_cast (-1); - /** - * e - */ + /** + * e + */ static const double E = 2.7182818284590452354; - /** - * log_2 e - */ + /** + * log_2 e + */ static const double LOG2E = 1.4426950408889634074; - /** - * log_10 e - */ + /** + * log_10 e + */ static const double LOG10E = 0.43429448190325182765; - /** - * log_e 2 - */ + /** + * log_e 2 + */ static const double LN2 = 0.69314718055994530942; - /** - * log_e 10 - */ + /** + * log_e 10 + */ static const double LN10 = 2.30258509299404568402; - /** - * pi - */ + /** + * pi + */ static const double PI = 3.14159265358979323846; - /** - * pi/2 - */ + /** + * pi/2 + */ static const double PI_2 = 1.57079632679489661923; - /** - * pi/4 - */ + /** + * pi/4 + */ static const double PI_4 = 0.78539816339744830962; - /** - * sqrt(2) - */ + /** + * sqrt(2) + */ static const double SQRT2 = 1.41421356237309504880; - /** - * 1/sqrt(2) - */ + /** + * 1/sqrt(2) + */ static const double SQRT1_2 = 0.70710678118654752440; - /** - * Return @p true if the given - * value is a finite floating - * point number, i.e. is neither - * plus or minus infinity nor NaN - * (not a number). - * - * Note that the argument type of - * this function is - * double. In other - * words, if you give a very - * large number of type - * long double, this - * function may return - * false even if the - * number is finite with respect - * to type long - * double. - */ + /** + * Return @p true if the given + * value is a finite floating + * point number, i.e. is neither + * plus or minus infinity nor NaN + * (not a number). + * + * Note that the argument type of + * this function is + * double. In other + * words, if you give a very + * large number of type + * long double, this + * function may return + * false even if the + * number is finite with respect + * to type long + * double. + */ bool is_finite (const double x); - /** - * Return @p true if real and - * imaginary parts of the given - * complex number are finite. - */ + /** + * Return @p true if real and + * imaginary parts of the given + * complex number are finite. + */ bool is_finite (const std::complex &x); - /** - * Return @p true if real and - * imaginary parts of the given - * complex number are finite. - */ + /** + * Return @p true if real and + * imaginary parts of the given + * complex number are finite. + */ bool is_finite (const std::complex &x); - /** - * Return @p true if real and - * imaginary parts of the given - * complex number are finite. - * - * Again may not work correctly if - * real or imaginary parts are very - * large numbers that are infinite in - * terms of double, but - * finite with respect to - * long double. - */ + /** + * Return @p true if real and + * imaginary parts of the given + * complex number are finite. + * + * Again may not work correctly if + * real or imaginary parts are very + * large numbers that are infinite in + * terms of double, but + * finite with respect to + * long double. + */ bool is_finite (const std::complex &x); - /** - * A structure that, together with - * its partial specializations - * NumberTraits > , - * provides traits and member - * functions that make it possible - * to write templates that work on - * both real number types and - * complex number types. This - * template is mostly used to - * implement linear algebra classes - * such as vectors and matrices - * that work for both real and - * complex numbers. - * - * @author Wolfgang Bangerth, 2007 - */ + /** + * A structure that, together with + * its partial specializations + * NumberTraits > , + * provides traits and member + * functions that make it possible + * to write templates that work on + * both real number types and + * complex number types. This + * template is mostly used to + * implement linear algebra classes + * such as vectors and matrices + * that work for both real and + * complex numbers. + * + * @author Wolfgang Bangerth, 2007 + */ template struct NumberTraits { - /** - * A flag that specifies whether the - * template type given to this class is - * complex or real. Since the general - * template is selected for non-complex - * types, the answer is - * false. - */ + /** + * A flag that specifies whether the + * template type given to this class is + * complex or real. Since the general + * template is selected for non-complex + * types, the answer is + * false. + */ static const bool is_complex = false; - /** - * For this data type, typedef the - * corresponding real type. Since the - * general template is selected for all - * data types that are not - * specializations of std::complex, - * the underlying type must be - * real-values, so the real_type is - * equal to the underlying type. - */ + /** + * For this data type, typedef the + * corresponding real type. Since the + * general template is selected for all + * data types that are not + * specializations of std::complex, + * the underlying type must be + * real-values, so the real_type is + * equal to the underlying type. + */ typedef number real_type; - /** - * Return the complex-conjugate of the - * given number. Since the general - * template is selected if number is - * not a complex data type, this - * function simply returns the given - * number. - */ + /** + * Return the complex-conjugate of the + * given number. Since the general + * template is selected if number is + * not a complex data type, this + * function simply returns the given + * number. + */ static const number & conjugate (const number &x); - /** - * Return the square of the absolute - * value of the given number. Since the - * general template is chosen for types - * not equal to std::complex, this - * function simply returns the square - * of the given number. - */ + /** + * Return the square of the absolute + * value of the given number. Since the + * general template is chosen for types + * not equal to std::complex, this + * function simply returns the square + * of the given number. + */ static real_type abs_square (const number &x); - /** - * Return the absolute value of a - * number. - */ + /** + * Return the absolute value of a + * number. + */ static real_type abs (const number &x); }; - /** - * Specialization of the general - * NumberTraits class that provides the - * relevant information if the underlying - * data type is std::complex. - * - * @author Wolfgang Bangerth, 2007 - */ + /** + * Specialization of the general + * NumberTraits class that provides the + * relevant information if the underlying + * data type is std::complex. + * + * @author Wolfgang Bangerth, 2007 + */ template struct NumberTraits > { - /** - * A flag that specifies whether the - * template type given to this class is - * complex or real. Since this - * specialization of the general - * template is selected for complex - * types, the answer is - * true. - */ + /** + * A flag that specifies whether the + * template type given to this class is + * complex or real. Since this + * specialization of the general + * template is selected for complex + * types, the answer is + * true. + */ static const bool is_complex = true; - /** - * For this data type, typedef the - * corresponding real type. Since this - * specialization of the template is - * selected for number types - * std::complex, the real type is - * equal to the type used to store the - * two components of the complex - * number. - */ + /** + * For this data type, typedef the + * corresponding real type. Since this + * specialization of the template is + * selected for number types + * std::complex, the real type is + * equal to the type used to store the + * two components of the complex + * number. + */ typedef number real_type; - /** - * Return the complex-conjugate of the - * given number. - */ + /** + * Return the complex-conjugate of the + * given number. + */ static std::complex conjugate (const std::complex &x); - /** - * Return the square of the absolute - * value of the given number. Since - * this specialization of the general - * template is chosen for types equal - * to std::complex, this function - * returns the product of a number and - * its complex conjugate. - */ + /** + * Return the square of the absolute + * value of the given number. Since + * this specialization of the general + * template is chosen for types equal + * to std::complex, this function + * returns the product of a number and + * its complex conjugate. + */ static real_type abs_square (const std::complex &x); - /** - * Return the absolute value of a - * complex number. - */ + /** + * Return the absolute value of a + * complex number. + */ static real_type abs (const std::complex &x); }; diff --git a/deal.II/include/deal.II/base/parallel.h b/deal.II/include/deal.II/base/parallel.h index 4fa79b5a67..ed3b8b2a76 100644 --- a/deal.II/include/deal.II/base/parallel.h +++ b/deal.II/include/deal.II/base/parallel.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2008, 2009, 2011 by the deal.II authors +// Copyright (C) 2008, 2009, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -40,93 +40,93 @@ namespace parallel { namespace internal { - /** - * Convert a function object of type F - * into an object that can be applied to - * all elements of a range of synchronous - * iterators. - */ + /** + * Convert a function object of type F + * into an object that can be applied to + * all elements of a range of synchronous + * iterators. + */ template struct Body { - /** - * Constructor. Take and package the - * given function object. - */ - Body (const F &f) - : - f (f) - {} - - template - void - operator () (const Range &range) const - { - for (typename Range::const_iterator p=range.begin(); - p != range.end(); ++p) - apply (f, p.iterators); - } + /** + * Constructor. Take and package the + * given function object. + */ + Body (const F &f) + : + f (f) + {} + + template + void + operator () (const Range &range) const + { + for (typename Range::const_iterator p=range.begin(); + p != range.end(); ++p) + apply (f, p.iterators); + } private: - /** - * The stored function object. - */ - const F f; - - /** - * Apply F to a set of iterators with - * two elements. - */ - template - static - void - apply (const F &f, - const std_cxx1x::tuple &p) - { - *std_cxx1x::get<1>(p) = f (*std_cxx1x::get<0>(p)); - } - - /** - * Apply F to a set of iterators with - * three elements. - */ - template - static - void - apply (const F &f, - const std_cxx1x::tuple &p) - { - *std_cxx1x::get<2>(p) = f (*std_cxx1x::get<0>(p), - *std_cxx1x::get<1>(p)); - } - - /** - * Apply F to a set of iterators with - * three elements. - */ - template - static - void - apply (const F &f, - const std_cxx1x::tuple &p) - { - *std_cxx1x::get<3>(p) = f (*std_cxx1x::get<0>(p), - *std_cxx1x::get<1>(p), - *std_cxx1x::get<2>(p)); - } + /** + * The stored function object. + */ + const F f; + + /** + * Apply F to a set of iterators with + * two elements. + */ + template + static + void + apply (const F &f, + const std_cxx1x::tuple &p) + { + *std_cxx1x::get<1>(p) = f (*std_cxx1x::get<0>(p)); + } + + /** + * Apply F to a set of iterators with + * three elements. + */ + template + static + void + apply (const F &f, + const std_cxx1x::tuple &p) + { + *std_cxx1x::get<2>(p) = f (*std_cxx1x::get<0>(p), + *std_cxx1x::get<1>(p)); + } + + /** + * Apply F to a set of iterators with + * three elements. + */ + template + static + void + apply (const F &f, + const std_cxx1x::tuple &p) + { + *std_cxx1x::get<3>(p) = f (*std_cxx1x::get<0>(p), + *std_cxx1x::get<1>(p), + *std_cxx1x::get<2>(p)); + } }; - /** - * Take a function object and create a - * Body object from it. We do this in - * this helper function since - * alternatively we would have to specify - * the actual data type of F -- which for - * function objects is often - * extraordinarily complicated. - */ + /** + * Take a function object and create a + * Body object from it. We do this in + * this helper function since + * alternatively we would have to specify + * the actual data type of F -- which for + * function objects is often + * extraordinarily complicated. + */ template Body make_body(const F &f) { @@ -134,51 +134,51 @@ namespace parallel } } - /** - * An algorithm that performs the action - * *out++ = predicate(*in++) - * where the in iterator - * ranges over the given input range. - * - * This algorithm does pretty much what - * std::transform does. The difference is - * that the function can run in parallel - * when deal.II is configured to use - * multiple threads. - * - * If running in parallel, the iterator range - * is split into several chunks that are - * each packaged up as a task and given to - * the Threading Building Blocks scheduler - * to work on as compute resources are - * available. The function returns once all - * chunks have been worked on. The last - * argument denotes the minimum number of - * elements of the iterator range per - * task; the number must be - * large enough to amortize the startup - * cost of new tasks, and small enough to - * ensure that tasks can be - * reasonably load balanced. - * - * For a discussion of the kind of - * problems to which this function - * is applicable, see the - * @ref threads "Parallel computing with multiple processors" - * module. - */ + /** + * An algorithm that performs the action + * *out++ = predicate(*in++) + * where the in iterator + * ranges over the given input range. + * + * This algorithm does pretty much what + * std::transform does. The difference is + * that the function can run in parallel + * when deal.II is configured to use + * multiple threads. + * + * If running in parallel, the iterator range + * is split into several chunks that are + * each packaged up as a task and given to + * the Threading Building Blocks scheduler + * to work on as compute resources are + * available. The function returns once all + * chunks have been worked on. The last + * argument denotes the minimum number of + * elements of the iterator range per + * task; the number must be + * large enough to amortize the startup + * cost of new tasks, and small enough to + * ensure that tasks can be + * reasonably load balanced. + * + * For a discussion of the kind of + * problems to which this function + * is applicable, see the + * @ref threads "Parallel computing with multiple processors" + * module. + */ template + typename OutputIterator, + typename Predicate> void transform (const InputIterator &begin_in, - const InputIterator &end_in, - OutputIterator out, - Predicate &predicate, - const unsigned int grainsize) + const InputIterator &end_in, + OutputIterator out, + Predicate &predicate, + const unsigned int grainsize) { #if DEAL_II_USE_MT == 0 - // make sure we don't get compiler - // warnings about unused arguments + // make sure we don't get compiler + // warnings about unused arguments (void) grainsize; for (OutputIterator in = begin_in; in != end_in;) @@ -189,64 +189,64 @@ namespace parallel Iterators x_begin (begin_in, out); Iterators x_end (end_in, OutputIterator()); tbb::parallel_for (tbb::blocked_range(x_begin, - x_end, - grainsize), - internal::make_body (predicate), - tbb::auto_partitioner()); + x_end, + grainsize), + internal::make_body (predicate), + tbb::auto_partitioner()); #endif } - /** - * An algorithm that performs the action - * *out++ = predicate(*in1++, *in2++) - * where the in1 iterator - * ranges over the given input - * range, using the parallel for - * operator of tbb. - * - * This algorithm does pretty much what - * std::transform does. The difference is - * that the function can run in parallel - * when deal.II is configured to use - * multiple threads. - * - * If running in parallel, the iterator range - * is split into several chunks that are - * each packaged up as a task and given to - * the Threading Building Blocks scheduler - * to work on as compute resources are - * available. The function returns once all - * chunks have been worked on. The last - * argument denotes the minimum number of - * elements of the iterator range per - * task; the number must be - * large enough to amortize the startup - * cost of new tasks, and small enough to - * ensure that tasks can be - * reasonably load balanced. - * - * For a discussion of the kind of - * problems to which this function - * is applicable, see the - * @ref threads "Parallel computing with multiple processors" - * module. - */ + /** + * An algorithm that performs the action + * *out++ = predicate(*in1++, *in2++) + * where the in1 iterator + * ranges over the given input + * range, using the parallel for + * operator of tbb. + * + * This algorithm does pretty much what + * std::transform does. The difference is + * that the function can run in parallel + * when deal.II is configured to use + * multiple threads. + * + * If running in parallel, the iterator range + * is split into several chunks that are + * each packaged up as a task and given to + * the Threading Building Blocks scheduler + * to work on as compute resources are + * available. The function returns once all + * chunks have been worked on. The last + * argument denotes the minimum number of + * elements of the iterator range per + * task; the number must be + * large enough to amortize the startup + * cost of new tasks, and small enough to + * ensure that tasks can be + * reasonably load balanced. + * + * For a discussion of the kind of + * problems to which this function + * is applicable, see the + * @ref threads "Parallel computing with multiple processors" + * module. + */ template + typename InputIterator2, + typename OutputIterator, + typename Predicate> void transform (const InputIterator1 &begin_in1, - const InputIterator1 &end_in1, - InputIterator2 in2, - OutputIterator out, - Predicate &predicate, - const unsigned int grainsize) + const InputIterator1 &end_in1, + InputIterator2 in2, + OutputIterator out, + Predicate &predicate, + const unsigned int grainsize) { #if DEAL_II_USE_MT == 0 - // make sure we don't get compiler - // warnings about unused arguments + // make sure we don't get compiler + // warnings about unused arguments (void) grainsize; for (OutputIterator in1 = begin_in1; in1 != end_in1;) @@ -259,64 +259,64 @@ namespace parallel Iterators x_begin (begin_in1, in2, out); Iterators x_end (end_in1, InputIterator2(), OutputIterator()); tbb::parallel_for (tbb::blocked_range(x_begin, - x_end, - grainsize), - internal::make_body (predicate), - tbb::auto_partitioner()); + x_end, + grainsize), + internal::make_body (predicate), + tbb::auto_partitioner()); #endif } - /** - * An algorithm that performs the action - * *out++ = predicate(*in1++, *in2++, *in3++) - * where the in1 iterator - * ranges over the given input range. - * - * This algorithm does pretty much what - * std::transform does. The difference is - * that the function can run in parallel - * when deal.II is configured to use - * multiple threads. - * - * If running in parallel, the iterator range - * is split into several chunks that are - * each packaged up as a task and given to - * the Threading Building Blocks scheduler - * to work on as compute resources are - * available. The function returns once all - * chunks have been worked on. The last - * argument denotes the minimum number of - * elements of the iterator range per - * task; the number must be - * large enough to amortize the startup - * cost of new tasks, and small enough to - * ensure that tasks can be - * reasonably load balanced. - * - * For a discussion of the kind of - * problems to which this function - * is applicable, see the - * @ref threads "Parallel computing with multiple processors" - * module. - */ + /** + * An algorithm that performs the action + * *out++ = predicate(*in1++, *in2++, *in3++) + * where the in1 iterator + * ranges over the given input range. + * + * This algorithm does pretty much what + * std::transform does. The difference is + * that the function can run in parallel + * when deal.II is configured to use + * multiple threads. + * + * If running in parallel, the iterator range + * is split into several chunks that are + * each packaged up as a task and given to + * the Threading Building Blocks scheduler + * to work on as compute resources are + * available. The function returns once all + * chunks have been worked on. The last + * argument denotes the minimum number of + * elements of the iterator range per + * task; the number must be + * large enough to amortize the startup + * cost of new tasks, and small enough to + * ensure that tasks can be + * reasonably load balanced. + * + * For a discussion of the kind of + * problems to which this function + * is applicable, see the + * @ref threads "Parallel computing with multiple processors" + * module. + */ template + typename InputIterator2, + typename InputIterator3, + typename OutputIterator, + typename Predicate> void transform (const InputIterator1 &begin_in1, - const InputIterator1 &end_in1, - InputIterator2 in2, - InputIterator3 in3, - OutputIterator out, - Predicate &predicate, - const unsigned int grainsize) + const InputIterator1 &end_in1, + InputIterator2 in2, + InputIterator3 in3, + OutputIterator out, + Predicate &predicate, + const unsigned int grainsize) { #if DEAL_II_USE_MT == 0 - // make sure we don't get compiler - // warnings about unused arguments + // make sure we don't get compiler + // warnings about unused arguments (void) grainsize; for (OutputIterator in1 = begin_in1; in1 != end_in1;) @@ -328,12 +328,12 @@ namespace parallel typedef SynchronousIterators SyncIterators; Iterators x_begin (begin_in1, in2, in3, out); Iterators x_end (end_in1, InputIterator2(), - InputIterator3(), OutputIterator()); + InputIterator3(), OutputIterator()); tbb::parallel_for (tbb::blocked_range(x_begin, - x_end, - grainsize), - internal::make_body (predicate), - tbb::auto_partitioner()); + x_end, + grainsize), + internal::make_body (predicate), + tbb::auto_partitioner()); #endif } @@ -341,13 +341,13 @@ namespace parallel namespace internal { #if DEAL_II_USE_MT - /** - * Take a range argument and call the - * given function with its begin and end. - */ + /** + * Take a range argument and call the + * given function with its begin and end. + */ template void apply_to_subranges (const tbb::blocked_range &range, - const Function &f) + const Function &f) { f (range.begin(), range.end()); } @@ -355,125 +355,125 @@ namespace parallel } - /** - * This function applies the given function - * argument @p f to all elements in the range - * [begin,end) and may do so - * in parallel. - * - * However, in many cases it is not - * efficient to call a function on each - * element, so this function calls the - * given function object on sub-ranges. In - * other words: if the given range - * [begin,end) is smaller than - * grainsize or if multithreading is not - * enabled, then we call - * f(begin,end); otherwise, we - * may execute, possibly in %parallel, a - * sequence of calls f(b,e) - * where [b,e) are - * subintervals of [begin,end) - * and the collection of calls we do to - * f(.,.) will happen on - * disjoint subintervals that collectively - * cover the original interval - * [begin,end). - * - * Oftentimes, the called function will of - * course have to get additional - * information, such as the object to work - * on for a given value of the iterator - * argument. This can be achieved by - * binding certain arguments. For - * example, here is an implementation of a - * matrix-vector multiplication $y=Ax$ for - * a full matrix $A$ and vectors $x,y$: - * @code - * void matrix_vector_product (const FullMatrix &A, - * const Vector &x, - * Vector &y) - * { - * parallel::apply_to_subranges - * (0, A.n_rows(), - * std_cxx1x::bind (&mat_vec_on_subranges, - * std_cxx1x::_1, std_cxx1x::_2, - * std_cxx1x::cref(A), - * std_cxx1x::cref(x), - * std_cxx1x::ref(y)), - * 50); - * } - * - * void mat_vec_on_subranges (const unsigned int begin_row, - * const unsigned int end_row, - * const FullMatrix &A, - * const Vector &x, - * Vector &y) - * { - * for (unsigned int row=begin_row; row!=end_row; ++row) - * for (unsigned int col=0; colstd_cxx1x::bind function to - * convert - * mat_vec_on_subranged from a - * function that takes 5 arguments to one - * taking 2 by binding the remaining - * arguments (the modifiers - * std_cxx1x::ref and - * std_cxx1x::cref make sure - * that the enclosed variables are actually - * passed by reference and constant - * reference, rather than by value). The - * resulting function object requires only - * two arguments, begin_row and end_row, - * with all other arguments fixed. - * - * The code, if in single-thread mode, will - * call mat_vec_on_subranges - * on the entire range - * [0,n_rows) exactly once. In - * multi-threaded mode, however, it may be - * called multiple times on subranges of - * this interval, possibly allowing more - * than one CPU core to take care of part - * of the work. - * - * The @p grainsize argument (50 in the - * example above) makes sure that subranges - * do not become too small, to avoid - * spending more time on scheduling - * subranges to CPU resources than on doing - * actual work. - * - * For a discussion of the kind of - * problems to which this function - * is applicable, see also the - * @ref threads "Parallel computing with multiple processors" - * module. - */ + /** + * This function applies the given function + * argument @p f to all elements in the range + * [begin,end) and may do so + * in parallel. + * + * However, in many cases it is not + * efficient to call a function on each + * element, so this function calls the + * given function object on sub-ranges. In + * other words: if the given range + * [begin,end) is smaller than + * grainsize or if multithreading is not + * enabled, then we call + * f(begin,end); otherwise, we + * may execute, possibly in %parallel, a + * sequence of calls f(b,e) + * where [b,e) are + * subintervals of [begin,end) + * and the collection of calls we do to + * f(.,.) will happen on + * disjoint subintervals that collectively + * cover the original interval + * [begin,end). + * + * Oftentimes, the called function will of + * course have to get additional + * information, such as the object to work + * on for a given value of the iterator + * argument. This can be achieved by + * binding certain arguments. For + * example, here is an implementation of a + * matrix-vector multiplication $y=Ax$ for + * a full matrix $A$ and vectors $x,y$: + * @code + * void matrix_vector_product (const FullMatrix &A, + * const Vector &x, + * Vector &y) + * { + * parallel::apply_to_subranges + * (0, A.n_rows(), + * std_cxx1x::bind (&mat_vec_on_subranges, + * std_cxx1x::_1, std_cxx1x::_2, + * std_cxx1x::cref(A), + * std_cxx1x::cref(x), + * std_cxx1x::ref(y)), + * 50); + * } + * + * void mat_vec_on_subranges (const unsigned int begin_row, + * const unsigned int end_row, + * const FullMatrix &A, + * const Vector &x, + * Vector &y) + * { + * for (unsigned int row=begin_row; row!=end_row; ++row) + * for (unsigned int col=0; colstd_cxx1x::bind function to + * convert + * mat_vec_on_subranged from a + * function that takes 5 arguments to one + * taking 2 by binding the remaining + * arguments (the modifiers + * std_cxx1x::ref and + * std_cxx1x::cref make sure + * that the enclosed variables are actually + * passed by reference and constant + * reference, rather than by value). The + * resulting function object requires only + * two arguments, begin_row and end_row, + * with all other arguments fixed. + * + * The code, if in single-thread mode, will + * call mat_vec_on_subranges + * on the entire range + * [0,n_rows) exactly once. In + * multi-threaded mode, however, it may be + * called multiple times on subranges of + * this interval, possibly allowing more + * than one CPU core to take care of part + * of the work. + * + * The @p grainsize argument (50 in the + * example above) makes sure that subranges + * do not become too small, to avoid + * spending more time on scheduling + * subranges to CPU resources than on doing + * actual work. + * + * For a discussion of the kind of + * problems to which this function + * is applicable, see also the + * @ref threads "Parallel computing with multiple processors" + * module. + */ template void apply_to_subranges (const RangeType &begin, - const typename identity::type &end, - const Function &f, - const unsigned int grainsize) + const typename identity::type &end, + const Function &f, + const unsigned int grainsize) { #if DEAL_II_USE_MT == 0 - // make sure we don't get compiler - // warnings about unused arguments + // make sure we don't get compiler + // warnings about unused arguments (void) grainsize; f (begin, end); #else tbb::parallel_for (tbb::blocked_range - (begin, end, grainsize), - std_cxx1x::bind (&internal::apply_to_subranges, - std_cxx1x::_1, - std_cxx1x::cref(f)), - tbb::auto_partitioner()); + (begin, end, grainsize), + std_cxx1x::bind (&internal::apply_to_subranges, + std_cxx1x::_1, + std_cxx1x::cref(f)), + tbb::auto_partitioner()); #endif } @@ -482,203 +482,203 @@ namespace parallel namespace internal { #if DEAL_II_USE_MT == 1 - /** - * A class that conforms to the Body - * requirements of the TBB - * parallel_reduce function. The first - * template argument denotes the type on - * which the reduction is to be done. The - * second denotes the type of the - * function object that shall be called - * for each subrange. - */ + /** + * A class that conforms to the Body + * requirements of the TBB + * parallel_reduce function. The first + * template argument denotes the type on + * which the reduction is to be done. The + * second denotes the type of the + * function object that shall be called + * for each subrange. + */ template + typename Function> struct ReductionOnSubranges { - /** - * A variable that will hold the - * result of the reduction. - */ - ResultType result; - - /** - * Constructor. Take the function - * object to call on each sub-range - * as well as the neutral element - * with respect to the reduction - * operation. - * - * The second argument denotes a - * function object that will be use - * to reduce the result of two - * computations into one number. An - * example if we want to simply - * accumulate integer results would - * be std::plus(). - */ - template - ReductionOnSubranges (const Function &f, - const Reductor &reductor, - const ResultType neutral_element = ResultType()) - : - result (neutral_element), - f (f), - neutral_element (neutral_element), - reductor (reductor) - {} - - /** - * Splitting constructor. See the TBB - * book for more details about this. - */ - ReductionOnSubranges (const ReductionOnSubranges &r, - tbb::split) - : - result (r.neutral_element), - f (r.f), - neutral_element (r.neutral_element), - reductor (r.reductor) - {} - - /** - * Join operation: merge the results - * from computations on different - * sub-intervals. - */ - void join (const ReductionOnSubranges &r) - { - result = reductor(result, r.result); - } - - /** - * Execute the given function on the - * specified range. - */ - template - void operator () (const tbb::blocked_range &range) - { - result = reductor(result, - f (range.begin(), range.end())); - } + /** + * A variable that will hold the + * result of the reduction. + */ + ResultType result; + + /** + * Constructor. Take the function + * object to call on each sub-range + * as well as the neutral element + * with respect to the reduction + * operation. + * + * The second argument denotes a + * function object that will be use + * to reduce the result of two + * computations into one number. An + * example if we want to simply + * accumulate integer results would + * be std::plus(). + */ + template + ReductionOnSubranges (const Function &f, + const Reductor &reductor, + const ResultType neutral_element = ResultType()) + : + result (neutral_element), + f (f), + neutral_element (neutral_element), + reductor (reductor) + {} + + /** + * Splitting constructor. See the TBB + * book for more details about this. + */ + ReductionOnSubranges (const ReductionOnSubranges &r, + tbb::split) + : + result (r.neutral_element), + f (r.f), + neutral_element (r.neutral_element), + reductor (r.reductor) + {} + + /** + * Join operation: merge the results + * from computations on different + * sub-intervals. + */ + void join (const ReductionOnSubranges &r) + { + result = reductor(result, r.result); + } + + /** + * Execute the given function on the + * specified range. + */ + template + void operator () (const tbb::blocked_range &range) + { + result = reductor(result, + f (range.begin(), range.end())); + } private: - /** - * The function object to call on - * every sub-range. - */ - const Function f; - - /** - * The neutral element with respect - * to the reduction operation. This - * is needed when calling the - * splitting constructor since we - * have to re-set the result variable - * in this case. - */ - const ResultType neutral_element; - - /** - * The function object to be used to - * reduce the result of two calls - * into one number. - */ - const std_cxx1x::function reductor; + /** + * The function object to call on + * every sub-range. + */ + const Function f; + + /** + * The neutral element with respect + * to the reduction operation. This + * is needed when calling the + * splitting constructor since we + * have to re-set the result variable + * in this case. + */ + const ResultType neutral_element; + + /** + * The function object to be used to + * reduce the result of two calls + * into one number. + */ + const std_cxx1x::function reductor; }; #endif } - /** - * This function works a lot like the - * apply_to_subranges(), but it allows to - * accumulate numerical results computed on - * each subrange into one number. The type - * of this number is given by the - * ResultType template argument that needs - * to be explicitly specified. - * - * An example of use of this function is to - * compute the value of the expression $x^T - * A x$ for a square matrix $A$ and a - * vector $x$. The sum over rows can be - * parallelized and the whole code might - * look like this: - * @code - * void matrix_norm (const FullMatrix &A, - * const Vector &x) - * { - * return - * std::sqrt - * (parallel::accumulate_from_subranges - * (0, A.n_rows(), - * std_cxx1x::bind (&mat_norm_sqr_on_subranges, - * std_cxx1x::_1, std_cxx1x::_2, - * std_cxx1x::cref(A), - * std_cxx1x::cref(x)), - * 50); - * } - * - * double - * mat_norm_sqr_on_subranges (const unsigned int begin_row, - * const unsigned int end_row, - * const FullMatrix &A, - * const Vector &x) - * { - * double norm_sqr = 0; - * for (unsigned int row=begin_row; row!=end_row; ++row) - * for (unsigned int col=0; colmat_norm_sqr_on_subranges - * is called on the entire range - * [0,A.n_rows()) if this - * range is less than the minimum grainsize - * (above chosen as 50) or if deal.II is - * configured to not use - * multithreading. Otherwise, it may be - * called on subsets of the given range, - * with results from the individual - * subranges accumulated internally. - * - * @warning If ResultType is a floating point - * type, then accumulation is not a - * commutative operation. In other words, - * if the given function object is called - * three times on three subranges, - * returning values $a,b,c$, then the - * returned result of this function is - * $a+b+c$. However, depending on how the - * three sub-tasks are distributed on - * available CPU resources, the result may - * also be $a+c+b$ or any other - * permutation; because floating point - * addition does not commute (as opposed, of - * course, to addition of real %numbers), - * the result of invoking this function - * several times may differ on the order of - * round-off. - * - * For a discussion of the kind of - * problems to which this function - * is applicable, see also the - * @ref threads "Parallel computing with multiple processors" - * module. - */ + /** + * This function works a lot like the + * apply_to_subranges(), but it allows to + * accumulate numerical results computed on + * each subrange into one number. The type + * of this number is given by the + * ResultType template argument that needs + * to be explicitly specified. + * + * An example of use of this function is to + * compute the value of the expression $x^T + * A x$ for a square matrix $A$ and a + * vector $x$. The sum over rows can be + * parallelized and the whole code might + * look like this: + * @code + * void matrix_norm (const FullMatrix &A, + * const Vector &x) + * { + * return + * std::sqrt + * (parallel::accumulate_from_subranges + * (0, A.n_rows(), + * std_cxx1x::bind (&mat_norm_sqr_on_subranges, + * std_cxx1x::_1, std_cxx1x::_2, + * std_cxx1x::cref(A), + * std_cxx1x::cref(x)), + * 50); + * } + * + * double + * mat_norm_sqr_on_subranges (const unsigned int begin_row, + * const unsigned int end_row, + * const FullMatrix &A, + * const Vector &x) + * { + * double norm_sqr = 0; + * for (unsigned int row=begin_row; row!=end_row; ++row) + * for (unsigned int col=0; colmat_norm_sqr_on_subranges + * is called on the entire range + * [0,A.n_rows()) if this + * range is less than the minimum grainsize + * (above chosen as 50) or if deal.II is + * configured to not use + * multithreading. Otherwise, it may be + * called on subsets of the given range, + * with results from the individual + * subranges accumulated internally. + * + * @warning If ResultType is a floating point + * type, then accumulation is not a + * commutative operation. In other words, + * if the given function object is called + * three times on three subranges, + * returning values $a,b,c$, then the + * returned result of this function is + * $a+b+c$. However, depending on how the + * three sub-tasks are distributed on + * available CPU resources, the result may + * also be $a+c+b$ or any other + * permutation; because floating point + * addition does not commute (as opposed, of + * course, to addition of real %numbers), + * the result of invoking this function + * several times may differ on the order of + * round-off. + * + * For a discussion of the kind of + * problems to which this function + * is applicable, see also the + * @ref threads "Parallel computing with multiple processors" + * module. + */ template ResultType accumulate_from_subranges (const Function &f, - const RangeType &begin, - const typename identity::type &end, - const unsigned int grainsize) + const RangeType &begin, + const typename identity::type &end, + const unsigned int grainsize) { #if DEAL_II_USE_MT == 0 - // make sure we don't get compiler - // warnings about unused arguments + // make sure we don't get compiler + // warnings about unused arguments (void) grainsize; return f(begin,end); @@ -686,8 +686,8 @@ namespace parallel internal::ReductionOnSubranges reductor (f, std::plus(), 0); tbb::parallel_reduce (tbb::blocked_range(begin, end, grainsize), - reductor, - tbb::auto_partitioner()); + reductor, + tbb::auto_partitioner()); return reductor.result; #endif } @@ -699,44 +699,44 @@ namespace internal { namespace Vector { - /** - * If we do computations on vectors in - * parallel (say, we add two vectors to - * get a third, and we do the loop over - * all elements in parallel), then this - * variable determines the minimum number - * of elements for which it is profitable - * to split a range of elements any - * further to distribute to different - * threads. - * - * This variable is available as - * a global writable variable in - * order to allow the testsuite - * to also test the parallel - * case. By default, it is set to - * several thousand elements, - * which is a case that the - * testsuite would not normally - * encounter. As a consequence, - * in the testsuite we set it to - * one -- a value that's hugely - * unprofitable but definitely - * tests parallel operations. - */ + /** + * If we do computations on vectors in + * parallel (say, we add two vectors to + * get a third, and we do the loop over + * all elements in parallel), then this + * variable determines the minimum number + * of elements for which it is profitable + * to split a range of elements any + * further to distribute to different + * threads. + * + * This variable is available as + * a global writable variable in + * order to allow the testsuite + * to also test the parallel + * case. By default, it is set to + * several thousand elements, + * which is a case that the + * testsuite would not normally + * encounter. As a consequence, + * in the testsuite we set it to + * one -- a value that's hugely + * unprofitable but definitely + * tests parallel operations. + */ extern unsigned int minimum_parallel_grain_size; } namespace SparseMatrix { - /** - * Like - * internal::Vector::minimum_parallel_grain_size, - * but now denoting the number of rows of - * a matrix that should be worked on as a - * minimum. - */ + /** + * Like + * internal::Vector::minimum_parallel_grain_size, + * but now denoting the number of rows of + * a matrix that should be worked on as a + * minimum. + */ extern unsigned int minimum_parallel_grain_size; } } diff --git a/deal.II/include/deal.II/base/parameter_handler.h b/deal.II/include/deal.II/base/parameter_handler.h index a379fa3acd..8cbbeb49df 100644 --- a/deal.II/include/deal.II/base/parameter_handler.h +++ b/deal.II/include/deal.II/base/parameter_handler.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -54,95 +54,95 @@ class LogStream; namespace Patterns { - /** - * Base class to declare common - * interface. The purpose of this - * class is mostly to define the - * interface of patterns, and to - * force derived classes to have a - * clone function. It is thus, - * in the languages of the "Design - * Patterns" book (Gamma et al.), a - * "prototype". + /** + * Base class to declare common + * interface. The purpose of this + * class is mostly to define the + * interface of patterns, and to + * force derived classes to have a + * clone function. It is thus, + * in the languages of the "Design + * Patterns" book (Gamma et al.), a + * "prototype". */ class PatternBase { public: - /** - * Make destructor of this and all - * derived classes virtual. - */ + /** + * Make destructor of this and all + * derived classes virtual. + */ virtual ~PatternBase (); - /** - * Return true if the given string - * matches the pattern. - */ + /** + * Return true if the given string + * matches the pattern. + */ virtual bool match (const std::string &test_string) const = 0; - /** - * Return a string describing the - * pattern. - */ + /** + * Return a string describing the + * pattern. + */ virtual std::string description () const = 0; - /** - * Return a pointer to an - * exact copy of the - * object. This is necessary - * since we want to store - * objects of this type in - * containers, were we need - * to copy objects without - * knowledge of their actual - * data type (we only have - * pointers to the base - * class). - * - * Ownership of the objects - * returned by this function - * is passed to the caller of - * this function. - */ + /** + * Return a pointer to an + * exact copy of the + * object. This is necessary + * since we want to store + * objects of this type in + * containers, were we need + * to copy objects without + * knowledge of their actual + * data type (we only have + * pointers to the base + * class). + * + * Ownership of the objects + * returned by this function + * is passed to the caller of + * this function. + */ virtual PatternBase * clone () const = 0; - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. To - * avoid unnecessary - * overhead, we do not force - * derived classes to provide - * this function as a virtual - * overloaded one, but rather - * try to cast the present - * object to one of the known - * derived classes and if - * that fails then take the - * size of this base class - * instead and add 32 byte - * (this value is arbitrary, - * it should account for - * virtual function tables, - * and some possible data - * elements). Since there are - * usually not many thousands - * of objects of this type - * around, and since the - * memory_consumption - * mechanism is used to find - * out where memory in the - * range of many megabytes - * is, this seems like a - * reasonable approximation. - * - * On the other hand, if you - * know that your class - * deviates from this - * assumption significantly, - * you can still overload - * this function. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this object. To + * avoid unnecessary + * overhead, we do not force + * derived classes to provide + * this function as a virtual + * overloaded one, but rather + * try to cast the present + * object to one of the known + * derived classes and if + * that fails then take the + * size of this base class + * instead and add 32 byte + * (this value is arbitrary, + * it should account for + * virtual function tables, + * and some possible data + * elements). Since there are + * usually not many thousands + * of objects of this type + * around, and since the + * memory_consumption + * mechanism is used to find + * out where memory in the + * range of many megabytes + * is, this seems like a + * reasonable approximation. + * + * On the other hand, if you + * know that your class + * deviates from this + * assumption significantly, + * you can still overload + * this function. + */ virtual std::size_t memory_consumption () const; }; @@ -152,7 +152,7 @@ namespace Patterns */ PatternBase * pattern_factory (const std::string& description); - /** + /** * Test for the string being an * integer. If bounds are given * to the constructor, then the @@ -189,117 +189,117 @@ namespace Patterns class Integer : public PatternBase { public: - /** - * Minimal integer value. If - * the numeric_limits class - * is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. - */ + /** + * Minimal integer value. If + * the numeric_limits class + * is available use this + * information to obtain the + * extremal values, otherwise + * set it so that this class + * understands that all values + * are allowed. + */ static const int min_int_value; - /** - * Maximal integer value. If - * the numeric_limits class - * is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. - */ + /** + * Maximal integer value. If + * the numeric_limits class + * is available use this + * information to obtain the + * extremal values, otherwise + * set it so that this class + * understands that all values + * are allowed. + */ static const int max_int_value; - /** - * Constructor. Bounds can be - * specified within which a - * valid parameter has to - * be. If the upper bound is - * smaller than the lower - * bound, then the infinite - * interval is meant. The - * default values are chosen - * such that no bounds are - * enforced on parameters. - */ + /** + * Constructor. Bounds can be + * specified within which a + * valid parameter has to + * be. If the upper bound is + * smaller than the lower + * bound, then the infinite + * interval is meant. The + * default values are chosen + * such that no bounds are + * enforced on parameters. + */ Integer (const int lower_bound = min_int_value, - const int upper_bound = max_int_value); - - /** - * Return true if the - * string is an integer and - * its value is within the - * specified range. - */ + const int upper_bound = max_int_value); + + /** + * Return true if the + * string is an integer and + * its value is within the + * specified range. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. If bounds were - * specified to the - * constructor, then include - * them into this - * description. - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. If bounds were + * specified to the + * constructor, then include + * them into this + * description. + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static Integer* create (const std::string& description); private: - /** - * Value of the lower - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or larger, if the - * bounds of the interval for - * a valid range. - */ + /** + * Value of the lower + * bound. A number that + * satisfies the @ref match + * operation of this class + * must be equal to this + * value or larger, if the + * bounds of the interval for + * a valid range. + */ const int lower_bound; - /** - * Value of the upper - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or less, if the - * bounds of the interval for - * a valid range. - */ + /** + * Value of the upper + * bound. A number that + * satisfies the @ref match + * operation of this class + * must be equal to this + * value or less, if the + * bounds of the interval for + * a valid range. + */ const int upper_bound; - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; - /** + /** * Test for the string being a * double. If bounds are * given to the constructor, then @@ -337,117 +337,117 @@ namespace Patterns class Double : public PatternBase { public: - /** - * Minimal double value. If the - * std::numeric_limits - * class is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. - */ + /** + * Minimal double value. If the + * std::numeric_limits + * class is available use this + * information to obtain the + * extremal values, otherwise + * set it so that this class + * understands that all values + * are allowed. + */ static const double min_double_value; - /** - * Maximal double value. If the - * numeric_limits class is - * available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. - */ + /** + * Maximal double value. If the + * numeric_limits class is + * available use this + * information to obtain the + * extremal values, otherwise + * set it so that this class + * understands that all values + * are allowed. + */ static const double max_double_value; - /** - * Constructor. Bounds can be - * specified within which a - * valid parameter has to - * be. If the upper bound is - * smaller than the lower - * bound, then the infinite - * interval is meant. The - * default values are chosen - * such that no bounds are - * enforced on parameters. - */ + /** + * Constructor. Bounds can be + * specified within which a + * valid parameter has to + * be. If the upper bound is + * smaller than the lower + * bound, then the infinite + * interval is meant. The + * default values are chosen + * such that no bounds are + * enforced on parameters. + */ Double (const double lower_bound = min_double_value, - const double upper_bound = max_double_value); - - /** - * Return true if the - * string is a number and its - * value is within the - * specified range. - */ + const double upper_bound = max_double_value); + + /** + * Return true if the + * string is a number and its + * value is within the + * specified range. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. If bounds were - * specified to the - * constructor, then include - * them into this - * description. - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. If bounds were + * specified to the + * constructor, then include + * them into this + * description. + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static Double* create (const std::string& description); private: - /** - * Value of the lower - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or larger, if the - * bounds of the interval for - * a valid range. - */ + /** + * Value of the lower + * bound. A number that + * satisfies the @ref match + * operation of this class + * must be equal to this + * value or larger, if the + * bounds of the interval for + * a valid range. + */ const double lower_bound; - /** - * Value of the upper - * bound. A number that - * satisfies the @ref match - * operation of this class - * must be equal to this - * value or less, if the - * bounds of the interval for - * a valid range. - */ + /** + * Value of the upper + * bound. A number that + * satisfies the @ref match + * operation of this class + * must be equal to this + * value or less, if the + * bounds of the interval for + * a valid range. + */ const double upper_bound; - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; - /** + /** * Test for the string being one * of a sequence of values given * like a regular expression. For @@ -464,73 +464,73 @@ namespace Patterns class Selection : public PatternBase { public: - /** - * Constructor. Take the - * given parameter as the - * specification of valid - * strings. - */ + /** + * Constructor. Take the + * given parameter as the + * specification of valid + * strings. + */ Selection (const std::string &seq); - /** - * Return true if the - * string is an element of - * the description list - * passed to the constructor. - */ + /** + * Return true if the + * string is an element of + * the description list + * passed to the constructor. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * list of valid strings - * passed to the constructor. - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. Here, this is the + * list of valid strings + * passed to the constructor. + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this object. + */ std::size_t memory_consumption () const; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static Selection* create (const std::string& description); private: - /** - * List of valid strings as - * passed to the - * constructor. We don't make - * this string constant, as - * we process it somewhat in - * the constructor. - */ + /** + * List of valid strings as + * passed to the + * constructor. We don't make + * this string constant, as + * we process it somewhat in + * the constructor. + */ std::string sequence; - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; @@ -548,29 +548,29 @@ namespace Patterns class List : public PatternBase { public: - /** - * Maximal integer value. If - * the numeric_limits class - * is available use this - * information to obtain the - * extremal values, otherwise - * set it so that this class - * understands that all values - * are allowed. - */ + /** + * Maximal integer value. If + * the numeric_limits class + * is available use this + * information to obtain the + * extremal values, otherwise + * set it so that this class + * understands that all values + * are allowed. + */ static const unsigned int max_int_value; - /** - * Constructor. Take the - * given parameter as the - * specification of valid - * elements of the list. - * - * The two other arguments can - * be used to denote minimal - * and maximal allowable - * lengths of the list. - */ + /** + * Constructor. Take the + * given parameter as the + * specification of valid + * elements of the list. + * + * The two other arguments can + * be used to denote minimal + * and maximal allowable + * lengths of the list. + */ List (const PatternBase &base_pattern, const unsigned int min_elements = 0, const unsigned int max_elements = max_int_value); @@ -580,52 +580,52 @@ namespace Patterns */ virtual ~List (); - /** - * Return true if the - * string is a comma-separated - * list of strings each of - * which match the pattern - * given to the constructor. - */ + /** + * Return true if the + * string is a comma-separated + * list of strings each of + * which match the pattern + * given to the constructor. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static List* create (const std::string& description); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this object. + */ std::size_t memory_consumption () const; - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ /** * Exception. @@ -634,13 +634,13 @@ namespace Patterns int, int, << "The values " << arg1 << " and " << arg2 << " do not form a valid range."); - //@} + //@} private: - /** - * Copy of the pattern that - * each element of the list has - * to satisfy. - */ + /** + * Copy of the pattern that + * each element of the list has + * to satisfy. + */ PatternBase *pattern; /** @@ -655,13 +655,13 @@ namespace Patterns */ const unsigned int max_elements; - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; - /** + /** * This class is much like the * Selection class, but it * allows the input to be a @@ -686,88 +686,88 @@ namespace Patterns class MultipleSelection : public PatternBase { public: - /** - * Constructor. Take the - * given parameter as the - * specification of valid - * strings. - */ + /** + * Constructor. Take the + * given parameter as the + * specification of valid + * strings. + */ MultipleSelection (const std::string &seq); - /** - * Return true if the - * string is an element of - * the description list - * passed to the constructor. - */ + /** + * Return true if the + * string is an element of + * the description list + * passed to the constructor. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * list of valid strings - * passed to the constructor. - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. Here, this is the + * list of valid strings + * passed to the constructor. + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static MultipleSelection* create (const std::string& description); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this object. + */ std::size_t memory_consumption () const; - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ - /** - * Exception. - */ + /** + * Exception. + */ DeclException1 (ExcCommasNotAllowed, - int, - << "A comma was found at position " << arg1 - << " of your input string, but commas are not allowed here."); - //@} + int, + << "A comma was found at position " << arg1 + << " of your input string, but commas are not allowed here."); + //@} private: - /** - * List of valid strings as - * passed to the - * constructor. We don't make - * this string constant, as - * we process it somewhat in - * the constructor. - */ + /** + * List of valid strings as + * passed to the + * constructor. We don't make + * this string constant, as + * we process it somewhat in + * the constructor. + */ std::string sequence; - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; - /** + /** * Test for the string being * either "true" or "false". This * is mapped to the Selection @@ -776,263 +776,263 @@ namespace Patterns class Bool : public Selection { public: - /** - * Constructor. - */ + /** + * Constructor. + */ Bool (); - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static Bool* create (const std::string& description); private: - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; - /** + /** * Always returns true when testing a * string. */ class Anything : public PatternBase { public: - /** - * Constructor. (Allow for at - * least one non-virtual - * function in this class, as - * otherwise sometimes no - * virtual table is emitted.) - */ + /** + * Constructor. (Allow for at + * least one non-virtual + * function in this class, as + * otherwise sometimes no + * virtual table is emitted.) + */ Anything (); - /** - * Return true if the - * string matches its - * constraints, i.e. always. - */ + /** + * Return true if the + * string matches its + * constraints, i.e. always. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * string "[Anything]". - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. Here, this is the + * string "[Anything]". + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static Anything* create (const std::string& description); private: - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; - /** - * A pattern that can be used to indicate - * when a parameter is intended to be the - * name of a file. By itself, this class - * does not check whether the string that - * is given in a parameter file actually - * corresponds to an existing file (it - * could, for example, be the name of a - * file to which you want to write - * output). Functionally, the class is - * therefore equivalent to the Anything - * class. However, it allows to specify the - * intent of a parameter. The flag - * given to the constructor also allows to - * specify whether the file is supposed to - * be an input or output file. - * - * The reason for the existence of this - * class is to support graphical user - * interfaces for editing parameter - * files. These may open a file selection - * dialog if the filename is supposed to - * represent an input file. + /** + * A pattern that can be used to indicate + * when a parameter is intended to be the + * name of a file. By itself, this class + * does not check whether the string that + * is given in a parameter file actually + * corresponds to an existing file (it + * could, for example, be the name of a + * file to which you want to write + * output). Functionally, the class is + * therefore equivalent to the Anything + * class. However, it allows to specify the + * intent of a parameter. The flag + * given to the constructor also allows to + * specify whether the file is supposed to + * be an input or output file. + * + * The reason for the existence of this + * class is to support graphical user + * interfaces for editing parameter + * files. These may open a file selection + * dialog if the filename is supposed to + * represent an input file. */ class FileName : public PatternBase { public: - /** - * Files can be used for input - * or output. This can be - * specified in the constructor - * by choosing the flag type. - */ + /** + * Files can be used for input + * or output. This can be + * specified in the constructor + * by choosing the flag type. + */ enum FileType {input = 0, output = 1}; - /** - * Constructor. The type of the file - * can be specified by choosing the - * flag. - */ + /** + * Constructor. The type of the file + * can be specified by choosing the + * flag. + */ FileName (const FileType type = input); - /** - * Return true if the - * string matches its - * constraints, i.e. always. - */ + /** + * Return true if the + * string matches its + * constraints, i.e. always. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * string "[Filename]". - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. Here, this is the + * string "[Filename]". + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * file type flag - */ + /** + * file type flag + */ FileType file_type; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static FileName* create (const std::string& description); private: - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; - /** - * A pattern that can be used to indicate - * when a parameter is intended to be the - * name of a directory. By itself, this - * class does not check whether the string - * that is given in a parameter file - * actually corresponds to an existing - * directory. Functionally, the class is - * therefore equivalent to the Anything - * class. However, it allows to specify the - * intent of a parameter. - * - * The reason for the existence of this - * class is to support graphical user - * interfaces for editing parameter - * files. These may open a file selection - * dialog to select or create a directory. + /** + * A pattern that can be used to indicate + * when a parameter is intended to be the + * name of a directory. By itself, this + * class does not check whether the string + * that is given in a parameter file + * actually corresponds to an existing + * directory. Functionally, the class is + * therefore equivalent to the Anything + * class. However, it allows to specify the + * intent of a parameter. + * + * The reason for the existence of this + * class is to support graphical user + * interfaces for editing parameter + * files. These may open a file selection + * dialog to select or create a directory. */ class DirectoryName : public PatternBase { public: - /** - * Constructor. - */ + /** + * Constructor. + */ DirectoryName (); - /** - * Return true if the - * string matches its - * constraints, i.e. always. - */ + /** + * Return true if the + * string matches its + * constraints, i.e. always. + */ virtual bool match (const std::string &test_string) const; - /** - * Return a description of - * the pattern that valid - * strings are expected to - * match. Here, this is the - * string "[Filename]". - */ + /** + * Return a description of + * the pattern that valid + * strings are expected to + * match. Here, this is the + * string "[Filename]". + */ virtual std::string description () const; - /** - * Return a copy of the - * present object, which is - * newly allocated on the - * heap. Ownership of that - * object is transferred to - * the caller of this - * function. - */ + /** + * Return a copy of the + * present object, which is + * newly allocated on the + * heap. Ownership of that + * object is transferred to + * the caller of this + * function. + */ virtual PatternBase * clone () const; - /** - * Creates new object if the start of - * description matches - * description_init. Ownership of that - * object is transferred to the caller - * of this function. - */ + /** + * Creates new object if the start of + * description matches + * description_init. Ownership of that + * object is transferred to the caller + * of this function. + */ static DirectoryName* create (const std::string& description); private: - /** - * Initial part of description - */ + /** + * Initial part of description + */ static const char* description_init; }; } @@ -1104,11 +1104,11 @@ namespace Patterns * { * prm.declare_entry ("Solver", * "CG", - * Patterns::Selection("CG|GMRES|GaussElim"), - * "Name of a linear solver for the inner iteration"); + * Patterns::Selection("CG|GMRES|GaussElim"), + * "Name of a linear solver for the inner iteration"); * prm.declare_entry ("Maximum number of iterations", * "20", - * ParameterHandler::RegularExpressions::Integer()); + * ParameterHandler::RegularExpressions::Integer()); * ... * } * prm.leave_subsection (); @@ -1124,7 +1124,7 @@ namespace Patterns * { * prm.declare_entry ("Nonlinear method", * "Newton-Raphson", - * ParameterHandler::RegularExpressions::Anything()); + * ParameterHandler::RegularExpressions::Anything()); * eq.declare_parameters (prm); * } * prm.leave_subsection (); @@ -1228,7 +1228,7 @@ namespace Patterns * * *

Using the %ParameterHandler Graphical User Interface

- * + * * An alternative to using the hand-written input files shown above is to * use the graphical user interface (GUI) that accompanies this class. For * this, you first need to write a description of all the parameters, their @@ -1649,238 +1649,238 @@ namespace Patterns class ParameterHandler : public Subscriptor { private: - /** - * Inhibit automatic - * CopyConstructor. - */ + /** + * Inhibit automatic + * CopyConstructor. + */ ParameterHandler (const ParameterHandler&); - /** - * Inhibit automatic - * assignment operator. - */ + /** + * Inhibit automatic + * assignment operator. + */ ParameterHandler& operator= (const ParameterHandler&); public: - /** - * List of possible output - * formats. - * - * The formats down the list with - * prefix Short and bit - * 6 and 7 set reproduce the old - * behavior of not writing - * comments or original values to - * the files. - */ + /** + * List of possible output + * formats. + * + * The formats down the list with + * prefix Short and bit + * 6 and 7 set reproduce the old + * behavior of not writing + * comments or original values to + * the files. + */ enum OutputStyle { - /** - * Write human readable - * output suitable to be - * read by ParameterHandler - * again. - */ - Text = 1, - /** - * Write parameters as a - * LaTeX table. - */ - LaTeX = 2, - /** - * Write out declared parameters - * with description and possible - * values. - */ - Description = 3, - - /** - * Write out everything as - * an XML - * file. - * - * See the general - * documentation of this - * class for an example of - * output. - */ - XML = 4, - - /** - * Write out everything as - * a JSON - * file. - */ - JSON = 5, - - /** - * Write input for - * ParameterHandler without - * comments or changed - * default values. - */ - ShortText = 193 + /** + * Write human readable + * output suitable to be + * read by ParameterHandler + * again. + */ + Text = 1, + /** + * Write parameters as a + * LaTeX table. + */ + LaTeX = 2, + /** + * Write out declared parameters + * with description and possible + * values. + */ + Description = 3, + + /** + * Write out everything as + * an XML + * file. + * + * See the general + * documentation of this + * class for an example of + * output. + */ + XML = 4, + + /** + * Write out everything as + * a JSON + * file. + */ + JSON = 5, + + /** + * Write input for + * ParameterHandler without + * comments or changed + * default values. + */ + ShortText = 193 }; - /** - * Constructor. - */ + /** + * Constructor. + */ ParameterHandler (); - /** - * Destructor. Declare this only - * to have a virtual destructor, - * which is safer as we have - * virtual functions. It - * actually does nothing - * spectacular. - */ + /** + * Destructor. Declare this only + * to have a virtual destructor, + * which is safer as we have + * virtual functions. It + * actually does nothing + * spectacular. + */ virtual ~ParameterHandler (); - /** - * Read input from a stream until - * stream returns eof - * condition or error. - * - * Return whether the read was - * successful. - */ + /** + * Read input from a stream until + * stream returns eof + * condition or error. + * + * Return whether the read was + * successful. + */ virtual bool read_input (std::istream &input); - /** - * Read input from a file the - * name of which is given. The - * PathSearch class "PARAMETERS" - * is used to find the file. - * - * Return whether the read was - * successful. - * - * Unless optional is - * true, this function - * will automatically generate - * the requested file with - * default values if the file did - * not exist. This file will not - * contain additional comments if - * write_stripped_file - * is true. - */ + /** + * Read input from a file the + * name of which is given. The + * PathSearch class "PARAMETERS" + * is used to find the file. + * + * Return whether the read was + * successful. + * + * Unless optional is + * true, this function + * will automatically generate + * the requested file with + * default values if the file did + * not exist. This file will not + * contain additional comments if + * write_stripped_file + * is true. + */ virtual bool read_input (const std::string &filename, - const bool optional = false, - const bool write_stripped_file = false); - - /** - * Read input from a string in - * memory. The lines in memory - * have to be separated by @\n - * characters. - * - * Return whether the read was - * successful. - */ + const bool optional = false, + const bool write_stripped_file = false); + + /** + * Read input from a string in + * memory. The lines in memory + * have to be separated by @\n + * characters. + * + * Return whether the read was + * successful. + */ virtual bool read_input_from_string (const char *s); - /** - * Read a parameter file in XML - * format. This could be from a file - * originally written by the - * print_parameters() function using the - * XML output style and then modified by - * hand as necessary; or from a file - * written using this method and then - * modified by the graphical parameter - * GUI (see the general documentation of - * this class). - * - * Return whether the read was - * successful. - */ + /** + * Read a parameter file in XML + * format. This could be from a file + * originally written by the + * print_parameters() function using the + * XML output style and then modified by + * hand as necessary; or from a file + * written using this method and then + * modified by the graphical parameter + * GUI (see the general documentation of + * this class). + * + * Return whether the read was + * successful. + */ virtual bool read_input_from_xml (std::istream &input); - - /** - * Clear all contents. - */ + + /** + * Clear all contents. + */ void clear (); - /** - * Declare a new entry with name - * entry, default and for - * which any input has to match - * the pattern (default: any - * pattern). - * - * The last parameter defaulting - * to an empty string is used to - * add a documenting text to each - * entry which will be printed as - * a comment when this class is - * asked to write out all - * declarations to a stream using - * the print_parameters() - * function. - * - * The function generates an - * exception if the default value - * doesn't match the given - * pattern. An entry can be - * declared more than once - * without generating an error, - * for example to override an - * earlier default value. - */ + /** + * Declare a new entry with name + * entry, default and for + * which any input has to match + * the pattern (default: any + * pattern). + * + * The last parameter defaulting + * to an empty string is used to + * add a documenting text to each + * entry which will be printed as + * a comment when this class is + * asked to write out all + * declarations to a stream using + * the print_parameters() + * function. + * + * The function generates an + * exception if the default value + * doesn't match the given + * pattern. An entry can be + * declared more than once + * without generating an error, + * for example to override an + * earlier default value. + */ void declare_entry (const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern = Patterns::Anything(), const std::string &documentation = std::string()); - /** - * Enter a subsection; if not yet - * existent, declare it. - */ + /** + * Enter a subsection; if not yet + * existent, declare it. + */ void enter_subsection (const std::string &subsection); - /** - * Leave present subsection. - * Return false if there is - * no subsection to leave; true - * otherwise. - */ + /** + * Leave present subsection. + * Return false if there is + * no subsection to leave; true + * otherwise. + */ bool leave_subsection (); - /** - * Return value of entry - * entry_string. If the - * entry was changed, then the - * changed value is returned, - * otherwise the default - * value. If the value of an - * undeclared entry is required, - * an exception will be thrown. - */ + /** + * Return value of entry + * entry_string. If the + * entry was changed, then the + * changed value is returned, + * otherwise the default + * value. If the value of an + * undeclared entry is required, + * an exception will be thrown. + */ std::string get (const std::string &entry_string) const; - /** - * Return value of entry - * entry_string as long - * int. (A long int is chosen so - * that even very large unsigned values - * can be returned by this function). - */ + /** + * Return value of entry + * entry_string as long + * int. (A long int is chosen so + * that even very large unsigned values + * can be returned by this function). + */ long int get_integer (const std::string &entry_string) const; - /** - * Return value of entry - * entry_name as - * double. - */ + /** + * Return value of entry + * entry_name as + * double. + */ double get_double (const std::string &entry_name) const; - /** - * Return value of entry - * entry_name as bool. + /** + * Return value of entry + * entry_name as bool. * The entry may be "true" or "yes" * for true, "false" or * "no" for false respectively. @@ -1894,13 +1894,13 @@ class ParameterHandler : public Subscriptor * * The parameter must already exist in * the present subsection. - * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * + * The function throws an + * exception of type + * ExcValueDoesNotMatchPattern + * if the new value does not + * conform to the pattern for + * this entry. */ void set (const std::string &entry_name, const std::string &new_value); @@ -1915,13 +1915,13 @@ class ParameterHandler : public Subscriptor * string and a bool as arguments, which * is certainly not what is most often * intended. - * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * + * The function throws an + * exception of type + * ExcValueDoesNotMatchPattern + * if the new value does not + * conform to the pattern for + * this entry. */ void set (const std::string &entry_name, const char *new_value); @@ -1933,13 +1933,13 @@ class ParameterHandler : public Subscriptor * * The parameter must already exist in * the present subsection. - * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * + * The function throws an + * exception of type + * ExcValueDoesNotMatchPattern + * if the new value does not + * conform to the pattern for + * this entry. */ void set (const std::string &entry_name, const long int &new_value); @@ -1959,13 +1959,13 @@ class ParameterHandler : public Subscriptor * one you can get back out using * get_double() may differ in the 16th * digit. - * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * + * The function throws an + * exception of type + * ExcValueDoesNotMatchPattern + * if the new value does not + * conform to the pattern for + * this entry. */ void set (const std::string &entry_name, const double &new_value); @@ -1977,270 +1977,270 @@ class ParameterHandler : public Subscriptor * * The parameter must already exist in * the present subsection. - * - * The function throws an - * exception of type - * ExcValueDoesNotMatchPattern - * if the new value does not - * conform to the pattern for - * this entry. + * + * The function throws an + * exception of type + * ExcValueDoesNotMatchPattern + * if the new value does not + * conform to the pattern for + * this entry. */ void set (const std::string &entry_name, const bool &new_value); - /** - * Print all parameters with the - * given style to - * out. Presently only - * Text and LaTeX are - * implemented. - * - * In Text format, the output - * is formatted in such a way - * that it is possible to use it - * for later input again. This is - * most useful to record the - * parameters for a specific run, - * since if you output the - * parameters using this function - * into a log file, you can - * always recover the results by - * simply copying the output to - * your input file. - * - * Besides the name and value of - * each entry, the output also - * contains the default value of - * entries if it is different - * from the actual value, as well - * as the documenting string - * given to the - * declare_entry() function - * if available. - */ + /** + * Print all parameters with the + * given style to + * out. Presently only + * Text and LaTeX are + * implemented. + * + * In Text format, the output + * is formatted in such a way + * that it is possible to use it + * for later input again. This is + * most useful to record the + * parameters for a specific run, + * since if you output the + * parameters using this function + * into a log file, you can + * always recover the results by + * simply copying the output to + * your input file. + * + * Besides the name and value of + * each entry, the output also + * contains the default value of + * entries if it is different + * from the actual value, as well + * as the documenting string + * given to the + * declare_entry() function + * if available. + */ std::ostream & print_parameters (std::ostream &out, - const OutputStyle style); - - /** - * Print out the parameters of - * the present subsection as - * given by the - * subsection_path member - * variable. This variable is - * controlled by entering and - * leaving subsections through - * the enter_subsection() and - * leave_subsection() - * functions. - * - * In most cases, you will not - * want to use this function - * directly, but have it called - * recursively by the previous - * function. - */ + const OutputStyle style); + + /** + * Print out the parameters of + * the present subsection as + * given by the + * subsection_path member + * variable. This variable is + * controlled by entering and + * leaving subsections through + * the enter_subsection() and + * leave_subsection() + * functions. + * + * In most cases, you will not + * want to use this function + * directly, but have it called + * recursively by the previous + * function. + */ void print_parameters_section (std::ostream &out, - const OutputStyle style, - const unsigned int indent_level); - - /** - * Print parameters to a - * logstream. This function - * allows to print all parameters - * into a log-file. Sections - * will be indented in the usual - * log-file style. - */ + const OutputStyle style, + const unsigned int indent_level); + + /** + * Print parameters to a + * logstream. This function + * allows to print all parameters + * into a log-file. Sections + * will be indented in the usual + * log-file style. + */ void log_parameters (LogStream& out); - /** - * Log parameters in the present - * subsection. The subsection is - * determined by the - * subsection_path member - * variable. This variable is - * controlled by entering and - * leaving subsections through - * the enter_subsection() and - * leave_subsection() - * functions. - * - * In most cases, you will not - * want to use this function - * directly, but have it called - * recursively by the previous - * function. - */ + /** + * Log parameters in the present + * subsection. The subsection is + * determined by the + * subsection_path member + * variable. This variable is + * controlled by entering and + * leaving subsections through + * the enter_subsection() and + * leave_subsection() + * functions. + * + * In most cases, you will not + * want to use this function + * directly, but have it called + * recursively by the previous + * function. + */ void log_parameters_section (LogStream& out); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. + */ std::size_t memory_consumption () const; - /** - * Write the data of this object to a - * stream for the purpose of - * serialization. - */ + /** + * Write the data of this object to a + * stream for the purpose of + * serialization. + */ template void save (Archive & ar, const unsigned int version) const; - /** - * Read the data of this object from a - * stream for the purpose of - * serialization. - */ + /** + * Read the data of this object from a + * stream for the purpose of + * serialization. + */ template void load (Archive & ar, const unsigned int version); BOOST_SERIALIZATION_SPLIT_MEMBER() /** - * Test for equality. + * Test for equality. */ bool operator == (const ParameterHandler & prm2) const; - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcEntryAlreadyExists, - std::string, - << "The following entry already exists: " << arg1); - /** - * Exception - */ + std::string, + << "The following entry already exists: " << arg1); + /** + * Exception + */ DeclException2 (ExcValueDoesNotMatchPattern, - std::string, std::string, - << "The string <" << arg1 - << "> does not match the given pattern <" << arg2 << ">"); - /** - * Exception - */ + std::string, std::string, + << "The string <" << arg1 + << "> does not match the given pattern <" << arg2 << ">"); + /** + * Exception + */ DeclException0 (ExcAlreadyAtTopLevel); - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcEntryUndeclared, - std::string, - << "You can't ask for entry <" << arg1 << "> you have not yet declared"); - /** - * Exception - */ + std::string, + << "You can't ask for entry <" << arg1 << "> you have not yet declared"); + /** + * Exception + */ DeclException1 (ExcConversionError, - std::string, - << "Error when trying to convert the following string: " << arg1); - //@} + std::string, + << "Error when trying to convert the following string: " << arg1); + //@} private: - /** - * The separator used when - * accessing elements of a path - * into the parameter tree. - */ + /** + * The separator used when + * accessing elements of a path + * into the parameter tree. + */ static const char path_separator = '.'; - /** - * The complete tree of sections - * and entries. See the general - * documentation of this class - * for a description how data is - * stored in this variable. - * - * The variable is a pointer so - * that we can use an incomplete - * type, rather than having to - * include all of the - * property_tree stuff from - * boost. This works around a - * problem with gcc 4.5. - */ + /** + * The complete tree of sections + * and entries. See the general + * documentation of this class + * for a description how data is + * stored in this variable. + * + * The variable is a pointer so + * that we can use an incomplete + * type, rather than having to + * include all of the + * property_tree stuff from + * boost. This works around a + * problem with gcc 4.5. + */ std::auto_ptr entries; - /** - * A list of patterns that are - * used to describe the - * parameters of this object. The - * are indexed by nodes in the - * property tree. - */ + /** + * A list of patterns that are + * used to describe the + * parameters of this object. The + * are indexed by nodes in the + * property tree. + */ std::vector > patterns; - /** - * Mangle a string so that it - * doesn't contain any special - * characters or spaces. - */ + /** + * Mangle a string so that it + * doesn't contain any special + * characters or spaces. + */ static std::string mangle (const std::string &s); - /** - * Unmangle a string into its - * original form. - */ + /** + * Unmangle a string into its + * original form. + */ static std::string demangle (const std::string &s); - /** - * Return whether a given node is - * a parameter node or a - * subsection node. - */ + /** + * Return whether a given node is + * a parameter node or a + * subsection node. + */ static bool is_parameter_node (const boost::property_tree::ptree &); - /** - * Path of presently selected - * subsections; empty list means - * top level - */ + /** + * Path of presently selected + * subsections; empty list means + * top level + */ std::vector subsection_path; - /** - * Return the string that - * identifies the current path - * into the property tree. This - * is only a path, i.e. it is not - * terminated by the - * path_separator character. - */ + /** + * Return the string that + * identifies the current path + * into the property tree. This + * is only a path, i.e. it is not + * terminated by the + * path_separator character. + */ std::string get_current_path () const; - /** - * Given the name of an entry as - * argument, the function - * computes a full path into the - * parameter tree using the - * current subsection. - */ + /** + * Given the name of an entry as + * argument, the function + * computes a full path into the + * parameter tree using the + * current subsection. + */ std::string get_current_full_path (const std::string &name) const; - /** - * Scan one line of input. - * lineno is the number of - * the line presently scanned - * (for the logs if there are - * messages). Return false if - * line contained stuff that - * could not be understood, the - * uppermost subsection was to be - * left by an END or end - * statement, a value for a - * non-declared entry was given - * or teh entry value did not - * match the regular - * expression. true otherwise. - * - * The function modifies its - * argument, but also takes it by - * value, so the caller's - * variable is not changed. - */ + /** + * Scan one line of input. + * lineno is the number of + * the line presently scanned + * (for the logs if there are + * messages). Return false if + * line contained stuff that + * could not be understood, the + * uppermost subsection was to be + * left by an END or end + * statement, a value for a + * non-declared entry was given + * or teh entry value did not + * match the regular + * expression. true otherwise. + * + * The function modifies its + * argument, but also takes it by + * value, so the caller's + * variable is not changed. + */ bool scan_line (std::string line, - const unsigned int lineno); + const unsigned int lineno); friend class MultipleParameterLoop; }; @@ -2322,8 +2322,8 @@ class ParameterHandler : public Subscriptor * * * void HelperClass::declare_parameters (ParameterHandler &prm) { - * // entries of the problem class - * // note: must be static member! + * // entries of the problem class + * // note: must be static member! * Problem::declare_parameters (prm); * } * @@ -2460,10 +2460,10 @@ class ParameterHandler : public Subscriptor class MultipleParameterLoop : public ParameterHandler { public: - /** - * This is the class the helper class or the - * problem class has to be derived of. - */ + /** + * This is the class the helper class or the + * problem class has to be derived of. + */ class UserClass { public: @@ -2475,71 +2475,71 @@ class MultipleParameterLoop : public ParameterHandler */ virtual ~UserClass (); - /** - * create_new must provide a clean - * object, either by creating a new one - * or by cleaning an old one. - */ - virtual void create_new (const unsigned int run_no) = 0; - - /** - * This should declare parameters and call - * the declare_parameters function of the - * problem class. - */ - virtual void declare_parameters (ParameterHandler &prm) = 0; - - /** - * Get the parameters and run any - * necessary action. - */ - virtual void run (ParameterHandler &prm) = 0; + /** + * create_new must provide a clean + * object, either by creating a new one + * or by cleaning an old one. + */ + virtual void create_new (const unsigned int run_no) = 0; + + /** + * This should declare parameters and call + * the declare_parameters function of the + * problem class. + */ + virtual void declare_parameters (ParameterHandler &prm) = 0; + + /** + * Get the parameters and run any + * necessary action. + */ + virtual void run (ParameterHandler &prm) = 0; }; - /** - * Constructor - */ + /** + * Constructor + */ MultipleParameterLoop (); - /** - * Destructor. Declare this only to have - * a virtual destructor, which is safer - * as we have virtual functions. - * It actually does nothing spectacular. - */ + /** + * Destructor. Declare this only to have + * a virtual destructor, which is safer + * as we have virtual functions. + * It actually does nothing spectacular. + */ virtual ~MultipleParameterLoop (); virtual bool read_input (std::istream &Input); virtual bool read_input (const std::string &FileName, - const bool optional = false, - const bool write_stripped_file = false); - - /** - * Read input from a string in memory. The - * lines in memory have to be separated by - * @\n characters. - */ + const bool optional = false, + const bool write_stripped_file = false); + + /** + * Read input from a string in memory. The + * lines in memory have to be separated by + * @\n characters. + */ virtual bool read_input_from_string (const char *s); - /** - * run the central loop. - */ + /** + * run the central loop. + */ void loop (UserClass &uc); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. + */ std::size_t memory_consumption () const; private: - /** - * An object in the list of entries with - * multiple values. - */ + /** + * An object in the list of entries with + * multiple values. + */ class Entry { public: @@ -2555,102 +2555,102 @@ class MultipleParameterLoop : public ParameterHandler variant, array }; - /** - * Constructor - */ - Entry () : type (array) {} - - /** - * Construct an object with given subsection - * path, name and value. The splitting up - * into the different variants is done - * later by split_different_values. - */ - Entry (const std::vector &Path, - const std::string &Name, - const std::string &Value); - - /** - * Split the entry value into the different - * branches. - */ - void split_different_values (); - - /** - * Path to variant entry. - */ - std::vector subsection_path; - - /** - * Name of entry. - */ - std::string entry_name; - - /** - * Original variant value. - */ - std::string entry_value; - - /** - * List of entry values constructed out of - * what was given in the input file (that - * is stored in EntryValue. - */ - std::vector different_values; - - /** - * Store whether this entry is a variant - * entry or an array. - */ - MultipleEntryType type; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. - */ - std::size_t memory_consumption () const; + /** + * Constructor + */ + Entry () : type (array) {} + + /** + * Construct an object with given subsection + * path, name and value. The splitting up + * into the different variants is done + * later by split_different_values. + */ + Entry (const std::vector &Path, + const std::string &Name, + const std::string &Value); + + /** + * Split the entry value into the different + * branches. + */ + void split_different_values (); + + /** + * Path to variant entry. + */ + std::vector subsection_path; + + /** + * Name of entry. + */ + std::string entry_name; + + /** + * Original variant value. + */ + std::string entry_value; + + /** + * List of entry values constructed out of + * what was given in the input file (that + * is stored in EntryValue. + */ + std::vector different_values; + + /** + * Store whether this entry is a variant + * entry or an array. + */ + MultipleEntryType type; + + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. + */ + std::size_t memory_consumption () const; }; - /** - * List of variant entry values. - */ + /** + * List of variant entry values. + */ std::vector multiple_choices; - /** - * Number of branches constructed - * from the different - * combinations of the variants. - * This obviously equals the - * number of runs to be - * performed. - */ + /** + * Number of branches constructed + * from the different + * combinations of the variants. + * This obviously equals the + * number of runs to be + * performed. + */ unsigned int n_branches; - /** - * Initialize the different - * branches, i.e. construct the - * combinations. - */ + /** + * Initialize the different + * branches, i.e. construct the + * combinations. + */ void init_branches (); - /** - * Traverse the section currently - * set by - * enter_subsection()/leave_subsection() - * and see which of the entries - * are variante/array - * entries. Then fill the - * multiple_choices variable - * using this information. - */ + /** + * Traverse the section currently + * set by + * enter_subsection()/leave_subsection() + * and see which of the entries + * are variante/array + * entries. Then fill the + * multiple_choices variable + * using this information. + */ void init_branches_current_section (); - /** - * Transfer the entry values for one run - * to the entry tree. - */ + /** + * Transfer the entry values for one run + * to the entry tree. + */ void fill_entry_values (const unsigned int run_no); }; diff --git a/deal.II/include/deal.II/base/parsed_function.h b/deal.II/include/deal.II/base/parsed_function.h index 81deafc990..eef457cbe3 100644 --- a/deal.II/include/deal.II/base/parsed_function.h +++ b/deal.II/include/deal.II/base/parsed_function.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2007, 2009 by the deal.II authors +// Copyright (C) 2007, 2009, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -31,228 +31,228 @@ namespace Functions * the Function object declared in the parameter file. This class is * derived from the AutoDerivativeFunction class, so you don't need * to specify derivatives. An example of usage of this class is as follows: - * + * * @code * // A parameter handler * ParameterHandler prm; - * + * * // Declare a section for the function we need * prm.enter_subsection("My vector function"); * ParsedFunction::declare_parameters(prm, dim); * prm.leave_subsection(); - * + * * // Create a ParsedFunction * ParsedFunction my_vector_function(dim); - * + * * // Parse an input file. * prm.read_input(some_input_file); - * + * * // Initialize the ParsedFunction object with the given file * prm.enter_subsection("My vector function"); * my_vector_function.parse_parameters(prm); * prm.leave_subsection(); * * @endcode - * + * * And here is an example of how the input parameter could look like * (see the documentation of the FunctionParser class for a detailed * description of the syntax of the function definition): - * + * * @code - * + * * # A test two dimensional vector function, depending on time * subsection My vector function * set Function constants = kappa=.1, lambda=2. * set Function expression = if(y>.5, kappa*x*(1-x),0); t^2*cos(lambda*pi*x) * set Variable names = x,y,t * end - * + * * @endcode - * + * * @ingroup functions * @author Luca Heltai, 2006 */ template - class ParsedFunction : public AutoDerivativeFunction + class ParsedFunction : public AutoDerivativeFunction { public: - /** - * Construct a vector - * function. The vector - * function which is generated - * has @p n_components - * components (defaults to - * 1). The parameter @p h is - * used to initialize the - * AutoDerivativeFunction class - * from which this class is - * derived. - */ + /** + * Construct a vector + * function. The vector + * function which is generated + * has @p n_components + * components (defaults to + * 1). The parameter @p h is + * used to initialize the + * AutoDerivativeFunction class + * from which this class is + * derived. + */ ParsedFunction (const unsigned int n_components = 1, const double h=1e-8); - - /** - * Declare parameters needed by - * this class. The additional - * parameter @p n_components is - * used to generate the right - * code according to the number - * of components of the - * function that will parse - * this ParameterHandler. If - * the number of components - * which is parsed does not - * match the number of - * components of this object, - * an assertion is thrown and - * the program is aborted. The - * default behavior for this - * class is to declare the - * following entries: - * - * @code - * - * set Function constants = - * set Function expression = 0 - * set Variable names = x,y,t - * - * @endcode - * - */ - static void declare_parameters(ParameterHandler &prm, - const unsigned int n_components = 1); - - /** - * Parse parameters needed by - * this class. If the number - * of components which is - * parsed does not match the - * number of components of this - * object, an assertion is - * thrown and the program is - * aborted. In order for the - * class to function properly, - * we follow the same - * convenctions declared in the - * FunctionParser class (look - * there for a detailed - * description of the syntax - * for function declarations). - * - * The three variables that can - * be parsed from a parameter - * file are the following: - * - * @code - * - * set Function constants = - * set Function expression = - * set Variable names = - * - * @endcode - * - * Function constants is a - * collection of pairs in the - * form name=value, separated - * by commas, for example: - * - * @code - * - * set Function constants = lambda=1. , alpha=2., gamma=3. - * - * @endcode - * - * These constants can be used - * in the declaration of the - * function expression, which - * follows the convention of - * the FunctionParser - * class. In order to specify - * vector functions, - * semicolons have to be used - * to separate the different - * components, e.g.: - * - * @code - * - * set Function expression = cos(pi*x) ; cos(pi*y) - * - * @endcode - * - * The variable names entry - * can be used to customize - * the name of the variables - * used in the Function. It - * defaults to - * - * @code - * - * set Variable names = x,t - * - * @endcode - * - * for one dimensional problems, - * - * @code - * - * set Variable names = x,y,t - * - * @endcode - * - * for two dimensional problems and - * - * @code - * - * set Variable names = x,y,z,t - * - * @endcode - * - * for three dimensional problems. - * - * The time variable can be - * set according to - * specifications in the - * FunctionTime base class. - */ + + /** + * Declare parameters needed by + * this class. The additional + * parameter @p n_components is + * used to generate the right + * code according to the number + * of components of the + * function that will parse + * this ParameterHandler. If + * the number of components + * which is parsed does not + * match the number of + * components of this object, + * an assertion is thrown and + * the program is aborted. The + * default behavior for this + * class is to declare the + * following entries: + * + * @code + * + * set Function constants = + * set Function expression = 0 + * set Variable names = x,y,t + * + * @endcode + * + */ + static void declare_parameters(ParameterHandler &prm, + const unsigned int n_components = 1); + + /** + * Parse parameters needed by + * this class. If the number + * of components which is + * parsed does not match the + * number of components of this + * object, an assertion is + * thrown and the program is + * aborted. In order for the + * class to function properly, + * we follow the same + * convenctions declared in the + * FunctionParser class (look + * there for a detailed + * description of the syntax + * for function declarations). + * + * The three variables that can + * be parsed from a parameter + * file are the following: + * + * @code + * + * set Function constants = + * set Function expression = + * set Variable names = + * + * @endcode + * + * Function constants is a + * collection of pairs in the + * form name=value, separated + * by commas, for example: + * + * @code + * + * set Function constants = lambda=1. , alpha=2., gamma=3. + * + * @endcode + * + * These constants can be used + * in the declaration of the + * function expression, which + * follows the convention of + * the FunctionParser + * class. In order to specify + * vector functions, + * semicolons have to be used + * to separate the different + * components, e.g.: + * + * @code + * + * set Function expression = cos(pi*x) ; cos(pi*y) + * + * @endcode + * + * The variable names entry + * can be used to customize + * the name of the variables + * used in the Function. It + * defaults to + * + * @code + * + * set Variable names = x,t + * + * @endcode + * + * for one dimensional problems, + * + * @code + * + * set Variable names = x,y,t + * + * @endcode + * + * for two dimensional problems and + * + * @code + * + * set Variable names = x,y,z,t + * + * @endcode + * + * for three dimensional problems. + * + * The time variable can be + * set according to + * specifications in the + * FunctionTime base class. + */ void parse_parameters(ParameterHandler &prm); - - /** - * Get one value at the given - * point. - */ + + /** + * Get one value at the given + * point. + */ virtual void vector_value (const Point &p, - Vector &values) const; - - /** - * Return the value of the - * function at the given - * point. Unless there is only - * one component (i.e. the - * function is scalar), you - * should state the component - * you want to have evaluated; - * it defaults to zero, - * i.e. the first component. - */ + Vector &values) const; + + /** + * Return the value of the + * function at the given + * point. Unless there is only + * one component (i.e. the + * function is scalar), you + * should state the component + * you want to have evaluated; + * it defaults to zero, + * i.e. the first component. + */ virtual double value (const Point< dim > & p, - const unsigned int component = 0) const; - - /** - * Set the time to a specific - * value for time-dependent - * functions. - * - * We need to overwrite this to - * set the time also in the - * accessor - * FunctionParser. - */ + const unsigned int component = 0) const; + + /** + * Set the time to a specific + * value for time-dependent + * functions. + * + * We need to overwrite this to + * set the time also in the + * accessor + * FunctionParser. + */ virtual void set_time(const double newtime); - + private: - /** - * The object with which we do - * computations. - */ + /** + * The object with which we do + * computations. + */ FunctionParser function_object; }; } diff --git a/deal.II/include/deal.II/base/partitioner.h b/deal.II/include/deal.II/base/partitioner.h index cdda1843ca..101c00544c 100644 --- a/deal.II/include/deal.II/base/partitioner.h +++ b/deal.II/include/deal.II/base/partitioner.h @@ -61,312 +61,312 @@ namespace Utilities class Partitioner { public: - /** - * Empty Constructor. - */ + /** + * Empty Constructor. + */ Partitioner (); - /** - * Constructor with size argument. Creates an - * MPI_COMM_SELF structure where there is no - * real parallel layout. - */ + /** + * Constructor with size argument. Creates an + * MPI_COMM_SELF structure where there is no + * real parallel layout. + */ Partitioner (const unsigned int size); - /** - * Constructor with index set arguments. This - * constructor creates a distributed layout - * based on a given communicators, an - * IndexSet describing the locally owned - * range and another one for describing ghost - * indices that are owned by other - * processors, but we need to have read or - * write access to. - */ + /** + * Constructor with index set arguments. This + * constructor creates a distributed layout + * based on a given communicators, an + * IndexSet describing the locally owned + * range and another one for describing ghost + * indices that are owned by other + * processors, but we need to have read or + * write access to. + */ Partitioner (const IndexSet &locally_owned_indices, - const IndexSet &ghost_indices_in, - const MPI_Comm communicator_in); - - /** - * Constructor with one index set argument. This - * constructor creates a distributed layout - * based on a given communicator, and an IndexSet - * describing the locally owned range. It - * allows to set the ghost indices at a later - * time. Apart from this, it is similar to the - * other constructor with two index sets. - */ + const IndexSet &ghost_indices_in, + const MPI_Comm communicator_in); + + /** + * Constructor with one index set argument. This + * constructor creates a distributed layout + * based on a given communicator, and an IndexSet + * describing the locally owned range. It + * allows to set the ghost indices at a later + * time. Apart from this, it is similar to the + * other constructor with two index sets. + */ Partitioner (const IndexSet &locally_owned_indices, - const MPI_Comm communicator_in); + const MPI_Comm communicator_in); - /** - * Sets the locally owned indices. Used in the - * constructor. - */ + /** + * Sets the locally owned indices. Used in the + * constructor. + */ void set_owned_indices (const IndexSet &locally_owned_indices); - /** - * Allows to set the ghost indices after the - * constructor has been called. - */ + /** + * Allows to set the ghost indices after the + * constructor has been called. + */ void set_ghost_indices (const IndexSet &ghost_indices); - /** - * Returns the global size. - */ + /** + * Returns the global size. + */ types::global_dof_index size() const; - /** - * Returns the local size, i.e. - * local_range().second minus - * local_range().first. - */ + /** + * Returns the local size, i.e. + * local_range().second minus + * local_range().first. + */ unsigned int local_size() const; - /** - * Returns an IndexSet representation of the - * local range. This class only supports - * contiguous local ranges, so the IndexSet - * actually only consists of one single range - * of data, and is equivalent to the result of - * local_range(). - */ + /** + * Returns an IndexSet representation of the + * local range. This class only supports + * contiguous local ranges, so the IndexSet + * actually only consists of one single range + * of data, and is equivalent to the result of + * local_range(). + */ const IndexSet & locally_owned_range() const; - /** - * Returns the local range. The returned pair - * consists of the index of the first element - * and the index of the element one past the - * last locally owned one. - */ + /** + * Returns the local range. The returned pair + * consists of the index of the first element + * and the index of the element one past the + * last locally owned one. + */ std::pair local_range() const; - /** - * Returns true if the given global index is - * in the local range of this processor. - */ + /** + * Returns true if the given global index is + * in the local range of this processor. + */ bool in_local_range (const types::global_dof_index global_index) const; - /** - * Returns the local index corresponding to - * the given global index. If the given global - * index is neither locally owned nor a ghost, - * an exception is thrown. - * - * Note that the local index for locally owned - * indices is between 0 and local_size()-1, - * and the local index for ghosts is between - * local_size() and - * local_size()+n_ghost_indices()-1. - */ + /** + * Returns the local index corresponding to + * the given global index. If the given global + * index is neither locally owned nor a ghost, + * an exception is thrown. + * + * Note that the local index for locally owned + * indices is between 0 and local_size()-1, + * and the local index for ghosts is between + * local_size() and + * local_size()+n_ghost_indices()-1. + */ unsigned int global_to_local (const types::global_dof_index global_index) const; - /** - * Returns the global index corresponding to - * the given local index. - * - * Note that the local index for locally owned - * indices is between 0 and local_size()-1, - * and the local index for ghosts is between - * local_size() and - * local_size()+n_ghost_indices()-1. - */ + /** + * Returns the global index corresponding to + * the given local index. + * + * Note that the local index for locally owned + * indices is between 0 and local_size()-1, + * and the local index for ghosts is between + * local_size() and + * local_size()+n_ghost_indices()-1. + */ types::global_dof_index local_to_global (const unsigned int local_index) const; - /** - * Returns whether the given global index is a - * ghost index on the present - * processor. Returns false for indices that - * are owned locally and for indices not - * present at all. - */ + /** + * Returns whether the given global index is a + * ghost index on the present + * processor. Returns false for indices that + * are owned locally and for indices not + * present at all. + */ bool is_ghost_entry (const types::global_dof_index global_index) const; - /** - * Returns an IndexSet representation of all - * ghost indices. - */ + /** + * Returns an IndexSet representation of all + * ghost indices. + */ const IndexSet& ghost_indices() const; - /** - * Returns the number of ghost indices. Same - * as ghost_indices().n_elements(), but cached - * for simpler access. - */ + /** + * Returns the number of ghost indices. Same + * as ghost_indices().n_elements(), but cached + * for simpler access. + */ unsigned int n_ghost_indices() const; - /** - * Returns a list of processors (first entry) - * and the number of degrees of freedom for - * the individual processor on the ghost - * elements present (second entry). - */ + /** + * Returns a list of processors (first entry) + * and the number of degrees of freedom for + * the individual processor on the ghost + * elements present (second entry). + */ const std::vector >& ghost_targets() const; - /** - * The set of (local) indices that we are - * importing during compress(), i.e., others' - * ghosts that belong to the local - * range. Similar structure as in an IndexSet, - * but tailored to be iterated over, and some - * indices may be duplicates. - */ + /** + * The set of (local) indices that we are + * importing during compress(), i.e., others' + * ghosts that belong to the local + * range. Similar structure as in an IndexSet, + * but tailored to be iterated over, and some + * indices may be duplicates. + */ const std::vector >& import_indices() const; - /** - * Number of import indices, i.e., indices - * that are ghosts on other processors and we - * will receive data from. - */ + /** + * Number of import indices, i.e., indices + * that are ghosts on other processors and we + * will receive data from. + */ unsigned int n_import_indices() const; - /** - * Returns a list of processors (first entry) - * and the number of degrees of freedom for - * all the processors that data is obtained - * from (second entry), i.e., locally owned - * indices that are ghosts on other - * processors. - */ + /** + * Returns a list of processors (first entry) + * and the number of degrees of freedom for + * all the processors that data is obtained + * from (second entry), i.e., locally owned + * indices that are ghosts on other + * processors. + */ const std::vector >& import_targets() const; - /** - * Checks whether the given - * partitioner is compatible with the - * partitioner used for this - * vector. Two partitioners are - * compatible if the have the same - * local size and the same ghost - * indices. They do not necessarily - * need to be the same data - * field. This is a local operation - * only, i.e., if only some - * processors decide that the - * partitioning is not compatible, - * only these processors will return - * @p false, whereas the other - * processors will return @p true. - */ + /** + * Checks whether the given + * partitioner is compatible with the + * partitioner used for this + * vector. Two partitioners are + * compatible if the have the same + * local size and the same ghost + * indices. They do not necessarily + * need to be the same data + * field. This is a local operation + * only, i.e., if only some + * processors decide that the + * partitioning is not compatible, + * only these processors will return + * @p false, whereas the other + * processors will return @p true. + */ bool is_compatible (const Partitioner &part) const; - /** - * Returns the MPI ID of the calling - * processor. Cached to have simple access. - */ + /** + * Returns the MPI ID of the calling + * processor. Cached to have simple access. + */ unsigned int this_mpi_process () const; - /** - * Returns the total number of MPI processor - * participating in the given - * partitioner. Cached to have simple access. - */ + /** + * Returns the total number of MPI processor + * participating in the given + * partitioner. Cached to have simple access. + */ unsigned int n_mpi_processes () const; - /** - * Returns the MPI communicator underlying the - * partitioner object. - */ + /** + * Returns the MPI communicator underlying the + * partitioner object. + */ MPI_Comm get_communicator() const; - /** - * Computes the memory consumption of this - * structure. - */ + /** + * Computes the memory consumption of this + * structure. + */ std::size_t memory_consumption() const; /** - * Exception - */ + * Exception + */ DeclException2 (ExcIndexNotPresent, - unsigned int, unsigned int, - << "Global index " << arg1 - << " neither owned nor ghost on proc " << arg2); - - private: /** - * The global size of the vector over all - * processors - */ + unsigned int, unsigned int, + << "Global index " << arg1 + << " neither owned nor ghost on proc " << arg2); + + private: /** + * The global size of the vector over all + * processors + */ const types::global_dof_index global_size; - /** - * The range of the vector that is stored - * locally. - */ + /** + * The range of the vector that is stored + * locally. + */ IndexSet locally_owned_range_data; - /** - * The range of the vector that is stored - * locally. Extracted from locally_owned_range - * for performance reasons. - */ + /** + * The range of the vector that is stored + * locally. Extracted from locally_owned_range + * for performance reasons. + */ std::pair local_range_data; - /** - * The set of indices to which we need to have - * read access but that are not locally owned - */ + /** + * The set of indices to which we need to have + * read access but that are not locally owned + */ IndexSet ghost_indices_data; - /** - * Caches the number of ghost indices. It - * would be expensive to use @p - * ghost_indices.n_elements() to compute this. - */ + /** + * Caches the number of ghost indices. It + * would be expensive to use @p + * ghost_indices.n_elements() to compute this. + */ unsigned int n_ghost_indices_data; - /** - * Contains information which processors my - * ghost indices belong to and how many those - * indices are - */ + /** + * Contains information which processors my + * ghost indices belong to and how many those + * indices are + */ std::vector > ghost_targets_data; - /** - * The set of (local) indices that we are - * importing during compress(), i.e., others' - * ghosts that belong to the local - * range. Similar structure as in an IndexSet, - * but tailored to be iterated over, and some - * indices may be duplicates. - */ + /** + * The set of (local) indices that we are + * importing during compress(), i.e., others' + * ghosts that belong to the local + * range. Similar structure as in an IndexSet, + * but tailored to be iterated over, and some + * indices may be duplicates. + */ std::vector > import_indices_data; - /** - * Caches the number of ghost indices. It - * would be expensive to compute it by - * iterating over the import indices and - * accumulate them. - */ + /** + * Caches the number of ghost indices. It + * would be expensive to compute it by + * iterating over the import indices and + * accumulate them. + */ unsigned int n_import_indices_data; - /** - * The set of processors and length of data - * field which send us their ghost data - */ + /** + * The set of processors and length of data + * field which send us their ghost data + */ std::vector > import_targets_data; - /** - * The ID of the current processor in the MPI - * network - */ + /** + * The ID of the current processor in the MPI + * network + */ unsigned int my_pid; - /** - * The total number of processors active in - * the problem - */ + /** + * The total number of processors active in + * the problem + */ unsigned int n_procs; - /** - * The MPI communicator involved in the - * problem - */ + /** + * The MPI communicator involved in the + * problem + */ const MPI_Comm communicator; }; @@ -415,7 +415,7 @@ namespace Utilities Partitioner::in_local_range (const types::global_dof_index global_index) const { return (local_range_data.first <= global_index && - global_index < local_range_data.second); + global_index < local_range_data.second); } @@ -424,12 +424,12 @@ namespace Utilities bool Partitioner::is_ghost_entry (const types::global_dof_index global_index) const { - // if the index is in the global range, it is - // trivially not a ghost + // if the index is in the global range, it is + // trivially not a ghost if (in_local_range(global_index) == true) - return false; + return false; else - return ghost_indices().is_element(global_index); + return ghost_indices().is_element(global_index); } @@ -439,19 +439,19 @@ namespace Utilities Partitioner::global_to_local (const types::global_dof_index global_index) const { Assert(in_local_range(global_index) || is_ghost_entry (global_index), - ExcIndexNotPresent(global_index, my_pid)); + ExcIndexNotPresent(global_index, my_pid)); if (in_local_range(global_index)) - return global_index - local_range_data.first; + return global_index - local_range_data.first; else if (is_ghost_entry (global_index)) - return (local_size() + - ghost_indices_data.index_within_set (global_index)); + return (local_size() + + ghost_indices_data.index_within_set (global_index)); else - // should only end up here in - // optimized mode, when we use this - // large number to trigger a segfault - // when using this method for array - // access - return numbers::invalid_unsigned_int; + // should only end up here in + // optimized mode, when we use this + // large number to trigger a segfault + // when using this method for array + // access + return numbers::invalid_unsigned_int; } @@ -462,9 +462,9 @@ namespace Utilities { AssertIndexRange (local_index, local_size() + n_ghost_indices_data); if (local_index < local_size()) - return local_range_data.first + local_index; + return local_range_data.first + local_index; else - return ghost_indices_data.nth_index_in_set (local_index-local_size()); + return ghost_indices_data.nth_index_in_set (local_index-local_size()); } @@ -525,14 +525,14 @@ namespace Utilities bool Partitioner::is_compatible (const Partitioner &part) const { - // is the partitioner points to the same - // memory location as the calling processor + // is the partitioner points to the same + // memory location as the calling processor if (&part == this) - return true; + return true; else - return (global_size == part.global_size && - local_range_data == part.local_range_data && - ghost_indices_data == part.ghost_indices_data); + return (global_size == part.global_size && + local_range_data == part.local_range_data && + ghost_indices_data == part.ghost_indices_data); } @@ -540,11 +540,11 @@ namespace Utilities unsigned int Partitioner::this_mpi_process() const { - // return the id from the variable stored in - // this class instead of - // Utilities::MPI::this_mpi_process() in order - // to make this query also work when MPI is - // not initialized. + // return the id from the variable stored in + // this class instead of + // Utilities::MPI::this_mpi_process() in order + // to make this query also work when MPI is + // not initialized. return my_pid; } @@ -554,11 +554,11 @@ namespace Utilities unsigned int Partitioner::n_mpi_processes() const { - // return the number of MPI processes from the - // variable stored in this class instead of - // Utilities::MPI::n_mpi_processes() in order - // to make this query also work when MPI is - // not initialized. + // return the number of MPI processes from the + // variable stored in this class instead of + // Utilities::MPI::n_mpi_processes() in order + // to make this query also work when MPI is + // not initialized. return n_procs; } diff --git a/deal.II/include/deal.II/base/path_search.h b/deal.II/include/deal.II/base/path_search.h index 1eda1dc24e..9b5e758ee4 100644 --- a/deal.II/include/deal.II/base/path_search.h +++ b/deal.II/include/deal.II/base/path_search.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 2005, 2006, 2007, 2008, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -75,7 +75,7 @@ DEAL_II_NAMESPACE_OPEN * trailing "/", while suffixes should always start with a * dot. These characters are not added automatically (allowing you to * do some real file name editing). - * + * * @todo Add support for environment variables like in kpathsea. * * @ingroup input @@ -84,219 +84,219 @@ DEAL_II_NAMESPACE_OPEN class PathSearch { public: - /** - * Position for adding a new item - * to a list. - */ + /** + * Position for adding a new item + * to a list. + */ enum Position { - /// Add new item at end of list - back, - /// Add new item at front of list - front, - /// Add in path list after empty element - after_none + /// Add new item at end of list + back, + /// Add new item at front of list + front, + /// Add in path list after empty element + after_none }; - - /** - * Constructor. The first argument is a - * string identifying the class of files - * to be searched for. - * - * The debug argument determines - * the verbosity of this class. - */ + + /** + * Constructor. The first argument is a + * string identifying the class of files + * to be searched for. + * + * The debug argument determines + * the verbosity of this class. + */ PathSearch (const std::string& cls, - const unsigned int debug=0); - - /** - * Find a file in the class - * specified by the constructor - * and return its complete path - * name (including a possible - * suffix). - * - * File search works by actually - * trying to open the file. If @p - * fopen is successful with the - * provided @p open_mode, then - * the file is found, otherwise - * the search continues. - * - * @warning Be careful with @p - * open_mode! In particular, use - * "w" with great care! - * If the file does not exist, it - * cannot be found. If it does - * exist, the @p fopen function - * will truncate it to zero - * length. - * - * @param filename The base - * name of the file to be found, - * without path components and - * suffix. - * @param open_mode The mode - * handed over to the @p fopen - * function. - */ + const unsigned int debug=0); + + /** + * Find a file in the class + * specified by the constructor + * and return its complete path + * name (including a possible + * suffix). + * + * File search works by actually + * trying to open the file. If @p + * fopen is successful with the + * provided @p open_mode, then + * the file is found, otherwise + * the search continues. + * + * @warning Be careful with @p + * open_mode! In particular, use + * "w" with great care! + * If the file does not exist, it + * cannot be found. If it does + * exist, the @p fopen function + * will truncate it to zero + * length. + * + * @param filename The base + * name of the file to be found, + * without path components and + * suffix. + * @param open_mode The mode + * handed over to the @p fopen + * function. + */ std::string find (const std::string& filename, - const char* open_mode = "r"); - - /** - * Find a file in the class - * specified by the constructor - * and return its complete path - * name. Do not use the standard - * suffix list, but only try to - * apply the suffix given. - * - * File search works by actually - * trying to open the file. If @p - * fopen is successful with the - * provided @p open_mode, then - * the file is found, otherwise - * the search continues. - * - * @warning Be careful with @p - * open_mode! In particular, use - * "w" with great care! - * If the file does not exist, it - * cannot be found. If it does - * exist, the @p fopen function - * will truncate it to zero - * length. - * - * @param filename The base - * name of the file to be found, - * without path components and - * suffix. - * @param suffix The suffix to be - * used for opening. - * @param open_mode The mode - * handed over to the @p fopen - * function. - */ + const char* open_mode = "r"); + + /** + * Find a file in the class + * specified by the constructor + * and return its complete path + * name. Do not use the standard + * suffix list, but only try to + * apply the suffix given. + * + * File search works by actually + * trying to open the file. If @p + * fopen is successful with the + * provided @p open_mode, then + * the file is found, otherwise + * the search continues. + * + * @warning Be careful with @p + * open_mode! In particular, use + * "w" with great care! + * If the file does not exist, it + * cannot be found. If it does + * exist, the @p fopen function + * will truncate it to zero + * length. + * + * @param filename The base + * name of the file to be found, + * without path components and + * suffix. + * @param suffix The suffix to be + * used for opening. + * @param open_mode The mode + * handed over to the @p fopen + * function. + */ std::string find (const std::string& filename, - const std::string& suffix, - const char* open_mode = "r"); + const std::string& suffix, + const char* open_mode = "r"); - /** - * Show the paths and suffixes - * used for this object. - */ + /** + * Show the paths and suffixes + * used for this object. + */ template void show(STREAM& stream) const; - - /** - * Add a new class. - */ + + /** + * Add a new class. + */ static void add_class (const std::string& cls); - - /** - * Add a path to the current - * class. See - * PathSearch::Position for - * possible position arguments. - */ + + /** + * Add a path to the current + * class. See + * PathSearch::Position for + * possible position arguments. + */ void add_path (const std::string& path, Position pos = back); - - /** - * Add a path to the current - * class. See - * PathSearch::Position for - * possible position arguments. - */ + + /** + * Add a path to the current + * class. See + * PathSearch::Position for + * possible position arguments. + */ void add_suffix (const std::string& suffix, Position pos = back); - /** - * This class was not - * registered in the path - * search mechanism. - * @ingroup Exceptions - */ + /** + * This class was not + * registered in the path + * search mechanism. + * @ingroup Exceptions + */ DeclException1(ExcNoClass, - std::string, - << "The class " - << arg1 - << " must be registered before referring it in PathSearch"); - /** - * The PathSearch class could not - * find a file with this name in - * its path list. - * @ingroup Exceptions - */ + std::string, + << "The class " + << arg1 + << " must be registered before referring it in PathSearch"); + /** + * The PathSearch class could not + * find a file with this name in + * its path list. + * @ingroup Exceptions + */ DeclException2(ExcFileNotFound, - std::string, std::string, - << "The file \"" << arg1 - << "\" was not found in the path for files of class " - << arg2); - + std::string, std::string, + << "The file \"" << arg1 + << "\" was not found in the path for files of class " + << arg2); + private: - /** - * Type of values in the class - * maps. - */ + /** + * Type of values in the class + * maps. + */ typedef std::map >::value_type map_type; - - /** - * Initialize the static list - * objects for further use. - */ + + /** + * Initialize the static list + * objects for further use. + */ static void initialize_classes(); - - /** - * Get path list for a certain - * class. Used to set up - * #my_path_list in constructor. - */ + + /** + * Get path list for a certain + * class. Used to set up + * #my_path_list in constructor. + */ static std::vector& get_path_list(const std::string& cls); - - /** - * Get suffix list for a certain - * class. Used to set up - * #my_suffix_list in constructor. - */ + + /** + * Get suffix list for a certain + * class. Used to set up + * #my_suffix_list in constructor. + */ static std::vector& get_suffix_list(const std::string& cls); - - /** - * The file class handled by this object. - */ + + /** + * The file class handled by this object. + */ const std::string cls; - - /** - * All path lists for all - * classes, such that we can - * build them only once. - */ + + /** + * All path lists for all + * classes, such that we can + * build them only once. + */ static std::map > path_lists; - - /** - * List of suffixes for each - * class. - */ + + /** + * List of suffixes for each + * class. + */ static std::map > suffix_lists; - - /** - * Path list for the class this - * object belongs to. - */ + + /** + * Path list for the class this + * object belongs to. + */ std::vector& my_path_list; - - /** - * Suffix list for the class this - * object belongs to. - */ + + /** + * Suffix list for the class this + * object belongs to. + */ std::vector& my_suffix_list; - - /** - * Debug flag. No output if zero. - */ + + /** + * Debug flag. No output if zero. + */ const unsigned int debug; - - /** - * The empty string. - */ + + /** + * The empty string. + */ static std::string empty; }; @@ -315,7 +315,7 @@ PathSearch::show(STREAM& out) const p != my_path_list.end(); ++p) { if (!first) - out << ':'; + out << ':'; out << *p; first = false; } diff --git a/deal.II/include/deal.II/base/point.h b/deal.II/include/deal.II/base/point.h index 72cfc9e22e..250bdac915 100644 --- a/deal.II/include/deal.II/base/point.h +++ b/deal.II/include/deal.II/base/point.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -51,69 +51,69 @@ template class Point : public Tensor<1,dim,Number> { public: - /** - * Standard constructor. Creates - * an origin. - */ + /** + * Standard constructor. Creates + * an origin. + */ Point (); - /** - * Constructor. Initialize all - * entries to zero if - * initialize==true. - */ + /** + * Constructor. Initialize all + * entries to zero if + * initialize==true. + */ explicit Point (const bool initialize); - /** - * Convert a tensor to a point. Since no - * additional data is inside a point, - * this is ok. - */ + /** + * Convert a tensor to a point. Since no + * additional data is inside a point, + * this is ok. + */ Point (const Tensor<1,dim,Number> &); - /** - * Constructor for one dimensional - * points. This function is only - * implemented for dim==1 since - * the usage is considered unsafe for - * points with dim!=1. - */ + /** + * Constructor for one dimensional + * points. This function is only + * implemented for dim==1 since + * the usage is considered unsafe for + * points with dim!=1. + */ explicit Point (const Number x); - /** - * Constructor for two dimensional - * points. This function is only - * implemented for dim==2 since - * the usage is considered unsafe for - * points with dim!=2. - */ + /** + * Constructor for two dimensional + * points. This function is only + * implemented for dim==2 since + * the usage is considered unsafe for + * points with dim!=2. + */ Point (const Number x, const Number y); - /** - * Constructor for three dimensional - * points. This function is only - * implemented for dim==3 since - * the usage is considered unsafe for - * points with dim!=3. - */ + /** + * Constructor for three dimensional + * points. This function is only + * implemented for dim==3 since + * the usage is considered unsafe for + * points with dim!=3. + */ Point (const Number x, const Number y, const Number z); - /** - * Return a unit vector in - * coordinate direction i. - */ + /** + * Return a unit vector in + * coordinate direction i. + */ static Point unit_vector(const unsigned int i); - /** - * Read access to the indexth - * coordinate. - */ + /** + * Read access to the indexth + * coordinate. + */ Number operator () (const unsigned int index) const; - /** - * Read and write access to the - * indexth coordinate. - */ + /** + * Read and write access to the + * indexth coordinate. + */ Number & operator () (const unsigned int index); /* @@ -121,66 +121,66 @@ class Point : public Tensor<1,dim,Number> * to avoid additional casting. */ - /** - * Add two point vectors. If possible, - * use operator += instead - * since this does not need to copy a - * point at least once. - */ + /** + * Add two point vectors. If possible, + * use operator += instead + * since this does not need to copy a + * point at least once. + */ Point operator + (const Tensor<1,dim,Number>&) const; - /** - * Subtract two point vectors. If - * possible, use operator += - * instead since this does not need to - * copy a point at least once. - */ + /** + * Subtract two point vectors. If + * possible, use operator += + * instead since this does not need to + * copy a point at least once. + */ Point operator - (const Tensor<1,dim,Number>&) const; - /** - * The opposite vector. - */ + /** + * The opposite vector. + */ Point operator - () const; - /** - * Multiply by a factor. If possible, - * use operator *= instead - * since this does not need to copy a - * point at least once. - * - * There is a commutative complement to this - * function also - */ + /** + * Multiply by a factor. If possible, + * use operator *= instead + * since this does not need to copy a + * point at least once. + * + * There is a commutative complement to this + * function also + */ Point operator * (const Number) const; - /** - * Returns the scalar product of two - * vectors. - */ + /** + * Returns the scalar product of two + * vectors. + */ Number operator * (const Tensor<1,dim,Number> &) const; - /** - * Divide by a factor. If possible, use - * operator /= instead since - * this does not need to copy a point at - * least once. - */ + /** + * Divide by a factor. If possible, use + * operator /= instead since + * this does not need to copy a point at + * least once. + */ Point operator / (const Number) const; - /** - * Returns the scalar product of this - * point vector with itself, i.e. the - * square, or the square of the norm. - */ + /** + * Returns the scalar product of this + * point vector with itself, i.e. the + * square, or the square of the norm. + */ Number square () const; - /** - * Returns the Euclidian distance of - * this point to the point - * p, i.e. the l_2 norm - * of the difference between the vectors - * representing the two points. - */ + /** + * Returns the Euclidian distance of + * this point to the point + * p, i.e. the l_2 norm + * of the difference between the vectors + * representing the two points. + */ Number distance (const Point &p) const; /** @@ -206,7 +206,7 @@ template inline Point::Point (const bool initialize) : - Tensor<1,dim,Number>(initialize) + Tensor<1,dim,Number>(initialize) {} @@ -333,7 +333,7 @@ inline Number Point::operator * (const Tensor<1,dim,Number> &p) const { - // simply pass down + // simply pass down return Tensor<1,dim,Number>::operator * (p); } @@ -401,7 +401,7 @@ Point::serialize(Archive & ar, const unsigned int) template inline Point operator * (const Number factor, - const Point &p) + const Point &p) { return p*factor; } @@ -415,7 +415,7 @@ Point operator * (const Number factor, template inline Point operator * (const double factor, - const Point &p) + const Point &p) { return p*factor; } @@ -430,7 +430,7 @@ Point operator * (const double factor, template inline std::ostream & operator << (std::ostream &out, - const Point &p) + const Point &p) { for (unsigned int i=0; i inline std::istream & operator >> (std::istream &in, - Point &p) + Point &p) { for (unsigned int i=0; i> p[i]; @@ -468,7 +468,7 @@ std::istream & operator >> (std::istream &in, template inline std::ostream & operator << (std::ostream &out, - const Point<1,Number> &p) + const Point<1,Number> &p) { out << p[0]; diff --git a/deal.II/include/deal.II/base/polynomial.h b/deal.II/include/deal.II/base/polynomial.h index 82e8227616..611b7a7884 100644 --- a/deal.II/include/deal.II/base/polynomial.h +++ b/deal.II/include/deal.II/base/polynomial.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -74,18 +74,18 @@ namespace Polynomials */ Polynomial (const unsigned int n); - /** - * Constructor for Lagrange polynomial and its - * point of evaluation. The idea is to - * construct $\prod_{i\neq j} - * \frac{x-x_i}{x_j-x_i}$, where j is the - * evaluation point specified as argument and - * the support points contain all points - * (including x_j, which will internally not - * be stored). - */ + /** + * Constructor for Lagrange polynomial and its + * point of evaluation. The idea is to + * construct $\prod_{i\neq j} + * \frac{x-x_i}{x_j-x_i}$, where j is the + * evaluation point specified as argument and + * the support points contain all points + * (including x_j, which will internally not + * be stored). + */ Polynomial (const std::vector > &lagrange_support_points, - const unsigned int evaluation_point); + const unsigned int evaluation_point); /** * Default constructor creating @@ -212,9 +212,9 @@ namespace Polynomials */ Polynomial& operator -= (const Polynomial& p); - /** - * Test for equality of two polynomials. - */ + /** + * Test for equality of two polynomials. + */ bool operator == (const Polynomial & p) const; /** @@ -252,13 +252,13 @@ namespace Polynomials static void multiply (std::vector& coefficients, const number factor); - /** - * Transforms polynomial form of - * product of linear factors into - * standard form, $\sum_i a_i - * x^i$. Deletes all data structures - * related to the product form. - */ + /** + * Transforms polynomial form of + * product of linear factors into + * standard form, $\sum_i a_i + * x^i$. Deletes all data structures + * related to the product form. + */ void transform_into_standard_form (); /** @@ -275,28 +275,28 @@ namespace Polynomials */ std::vector coefficients; - /** - * Stores whether the polynomial is in - * Lagrange product form, i.e., - * constructed as a product $(x-x_0) - * (x-x_1) \ldots (x-x_n)/c$, or not. - */ + /** + * Stores whether the polynomial is in + * Lagrange product form, i.e., + * constructed as a product $(x-x_0) + * (x-x_1) \ldots (x-x_n)/c$, or not. + */ bool in_lagrange_product_form; - /** - * If the polynomial is in Lagrange - * product form, i.e., constructed as a - * product $(x-x_0) (x-x_1) \ldots - * (x-x_n)/c$, store the shifts $x_i$. - */ + /** + * If the polynomial is in Lagrange + * product form, i.e., constructed as a + * product $(x-x_0) (x-x_1) \ldots + * (x-x_n)/c$, store the shifts $x_i$. + */ std::vector lagrange_support_points; - /** - * If the polynomial is in Lagrange - * product form, i.e., constructed as a - * product $(x-x_0) (x-x_1) \ldots - * (x-x_n)/c$, store the weight c. - */ + /** + * If the polynomial is in Lagrange + * product form, i.e., constructed as a + * product $(x-x_0) (x-x_1) \ldots + * (x-x_n)/c$, store the weight c. + */ number lagrange_weight; }; @@ -416,16 +416,16 @@ namespace Polynomials }; - /** - * Given a set of points along the - * real axis, this function returns - * all Lagrange polynomials for - * interpolation of these - * points. The number of - * polynomials is equal to the - * number of points and the maximum - * degree is one less. - */ + /** + * Given a set of points along the + * real axis, this function returns + * all Lagrange polynomials for + * interpolation of these + * points. The number of + * polynomials is equal to the + * number of points and the maximum + * degree is one less. + */ std::vector > generate_complete_Lagrange_basis (const std::vector >& points); @@ -493,15 +493,15 @@ namespace Polynomials /** * Compute coefficients recursively. - * The coefficients are stored in a - * static data vector to be available - * when needed next time. Since the - * recursion is performed for the - * interval $[-1,1]$, the polynomials - * are shifted to $[0,1]$ by the - * scale and shift - * functions of Polynomial, - * afterwards. + * The coefficients are stored in a + * static data vector to be available + * when needed next time. Since the + * recursion is performed for the + * interval $[-1,1]$, the polynomials + * are shifted to $[0,1]$ by the + * scale and shift + * functions of Polynomial, + * afterwards. */ static void compute_coefficients (const unsigned int p); @@ -699,12 +699,12 @@ namespace Polynomials { if (in_lagrange_product_form == true) { - return lagrange_support_points.size(); + return lagrange_support_points.size(); } else { - Assert (coefficients.size()>0, ExcEmptyObject()); - return coefficients.size() - 1; + Assert (coefficients.size()>0, ExcEmptyObject()); + return coefficients.size() - 1; } } @@ -717,24 +717,24 @@ namespace Polynomials { if (in_lagrange_product_form == false) { - Assert (coefficients.size() > 0, ExcEmptyObject()); + Assert (coefficients.size() > 0, ExcEmptyObject()); // Horner scheme - const unsigned int m=coefficients.size(); - number value = coefficients.back(); - for (int k=m-2; k>=0; --k) - value = value*x + coefficients[k]; - return value; + const unsigned int m=coefficients.size(); + number value = coefficients.back(); + for (int k=m-2; k>=0; --k) + value = value*x + coefficients[k]; + return value; } else { - // direct evaluation of Lagrange polynomial - const unsigned int m = lagrange_support_points.size(); - number value = 1.; - for (unsigned int j=0; j class PolynomialSpace { public: - /** - * Access to the dimension of - * this object, for checking and - * automatic setting of dimension - * in other classes. - */ + /** + * Access to the dimension of + * this object, for checking and + * automatic setting of dimension + * in other classes. + */ static const unsigned int dimension = dim; - - /** - * Constructor. pols is a - * vector of pointers to - * one-dimensional polynomials - * and will be copied into a - * private member variable. The static - * type of the template argument - * pols needs to be - * convertible to - * Polynomials::Polynomial@, - * i.e. should usually be a - * derived class of - * Polynomials::Polynomial@. - */ + + /** + * Constructor. pols is a + * vector of pointers to + * one-dimensional polynomials + * and will be copied into a + * private member variable. The static + * type of the template argument + * pols needs to be + * convertible to + * Polynomials::Polynomial@, + * i.e. should usually be a + * derived class of + * Polynomials::Polynomial@. + */ template PolynomialSpace (const std::vector &pols); - /** - * Prints the list of the indices - * to out. - */ + /** + * Prints the list of the indices + * to out. + */ template void output_indices(STREAM &out) const; - /** - * Sets the ordering of the - * polynomials. Requires - * renumber.size()==n(). - * Stores a copy of - * renumber. - */ + /** + * Sets the ordering of the + * polynomials. Requires + * renumber.size()==n(). + * Stores a copy of + * renumber. + */ void set_numbering(const std::vector &renumber); - - /** - * Computes the value and the - * first and second derivatives - * of each polynomial at - * unit_point. - * - * The size of the vectors must - * either be equal 0 or equal - * n(). In the first case, - * the function will not compute - * these values, i.e. you - * indicate what you want to have - * computed by resizing those - * vectors which you want filled. - * - * If you need values or - * derivatives of all polynomials - * then use this function, rather - * than using any of the - * compute_value(), - * compute_grad() or - * compute_grad_grad() - * functions, see below, in a - * loop over all polynomials. - */ + + /** + * Computes the value and the + * first and second derivatives + * of each polynomial at + * unit_point. + * + * The size of the vectors must + * either be equal 0 or equal + * n(). In the first case, + * the function will not compute + * these values, i.e. you + * indicate what you want to have + * computed by resizing those + * vectors which you want filled. + * + * If you need values or + * derivatives of all polynomials + * then use this function, rather + * than using any of the + * compute_value(), + * compute_grad() or + * compute_grad_grad() + * functions, see below, in a + * loop over all polynomials. + */ void compute (const Point &unit_point, - std::vector &values, - std::vector > &grads, - std::vector > &grad_grads) const; - - /** - * Computes the value of the - * ith polynomial at - * unit_point. - * - * Consider using compute() instead. - */ + std::vector &values, + std::vector > &grads, + std::vector > &grad_grads) const; + + /** + * Computes the value of the + * ith polynomial at + * unit_point. + * + * Consider using compute() instead. + */ double compute_value (const unsigned int i, - const Point &p) const; - - /** - * Computes the gradient of the - * ith polynomial at - * unit_point. - * - * Consider using compute() instead. - */ + const Point &p) const; + + /** + * Computes the gradient of the + * ith polynomial at + * unit_point. + * + * Consider using compute() instead. + */ Tensor<1,dim> compute_grad (const unsigned int i, - const Point &p) const; - - /** - * Computes the second derivative - * (grad_grad) of the ith - * polynomial at - * unit_point. - * - * Consider using compute() instead. - */ + const Point &p) const; + + /** + * Computes the second derivative + * (grad_grad) of the ith + * polynomial at + * unit_point. + * + * Consider using compute() instead. + */ Tensor<2,dim> compute_grad_grad (const unsigned int i, const Point &p) const; - /** - * Return the number of - * polynomials spanning the space - * represented by this - * class. Here, if N is the - * number of one-dimensional - * polynomials given, then the - * result of this function is - * N in 1d, N(N+1)/2 in - * 2d, and N(N+1)(N+2)/6 in - * 3d. - */ + /** + * Return the number of + * polynomials spanning the space + * represented by this + * class. Here, if N is the + * number of one-dimensional + * polynomials given, then the + * result of this function is + * N in 1d, N(N+1)/2 in + * 2d, and N(N+1)(N+2)/6 in + * 3d. + */ unsigned int n () const; - /** - * Degree of the space. This is - * by definition the number of - * polynomials given to the - * constructor, NOT the maximal - * degree of a polynomial in this - * vector. The latter value is - * never checked and therefore - * left to the application. - */ - unsigned int degree () const; - - /** - * Static function used in the - * constructor to compute the - * number of polynomials. - */ + /** + * Degree of the space. This is + * by definition the number of + * polynomials given to the + * constructor, NOT the maximal + * degree of a polynomial in this + * vector. The latter value is + * never checked and therefore + * left to the application. + */ + unsigned int degree () const; + + /** + * Static function used in the + * constructor to compute the + * number of polynomials. + */ static unsigned int compute_n_pols (const unsigned int n); protected: - - /** - * Compute numbers in x, y and z - * direction. Given an index - * n in the d-dimensional - * polynomial space, compute the - * indices i,j,k such that - * pn(x,y,z) = - * pi(x)pj(y)pk(z). - */ + + /** + * Compute numbers in x, y and z + * direction. Given an index + * n in the d-dimensional + * polynomial space, compute the + * indices i,j,k such that + * pn(x,y,z) = + * pi(x)pj(y)pk(z). + */ void compute_index (const unsigned int n, unsigned int (&index)[dim]) const; private: - /** - * Copy of the vector pols of - * polynomials given to the - * constructor. - */ + /** + * Copy of the vector pols of + * polynomials given to the + * constructor. + */ const std::vector > polynomials; - /** - * Store the precomputed value - * which the n() function - * returns. - */ + /** + * Store the precomputed value + * which the n() function + * returns. + */ const unsigned int n_pols; - /** - * Index map for reordering the - * polynomials. - */ + /** + * Index map for reordering the + * polynomials. + */ std::vector index_map; - /** - * Index map for reordering the - * polynomials. - */ + /** + * Index map for reordering the + * polynomials. + */ std::vector index_map_inverse; }; @@ -281,16 +281,16 @@ void PolynomialSpace<3>::compute_index(const unsigned int n, template template PolynomialSpace::PolynomialSpace (const std::vector &pols) - : - polynomials (pols.begin(), pols.end()), - n_pols (compute_n_pols(polynomials.size())), - index_map(n_pols), - index_map_inverse(n_pols) + : + polynomials (pols.begin(), pols.end()), + n_pols (compute_n_pols(polynomials.size())), + index_map(n_pols), + index_map_inverse(n_pols) { - // per default set this index map - // to identity. This map can be - // changed by the user through the - // set_numbering function + // per default set this index map + // to identity. This map can be + // changed by the user through the + // set_numbering function for (unsigned int i=0; i::n() const return n_pols; } - + template inline @@ -329,7 +329,7 @@ PolynomialSpace::output_indices(STREAM &out) const compute_index(i,ix); out << i << "\t"; for (unsigned int d=0; d class PolynomialsABF { public: - /** - * Constructor. Creates all basis - * functions for Raviart-Thomas polynomials - * of given degree. - * - * @arg k: the degree of the - * Raviart-Thomas-space, which is the degree - * of the largest tensor product - * polynomial space - * Qk contained. - */ + /** + * Constructor. Creates all basis + * functions for Raviart-Thomas polynomials + * of given degree. + * + * @arg k: the degree of the + * Raviart-Thomas-space, which is the degree + * of the largest tensor product + * polynomial space + * Qk contained. + */ PolynomialsABF (const unsigned int k); - /** - * Destructor deleting the polynomials. - */ + /** + * Destructor deleting the polynomials. + */ ~PolynomialsABF (); - /** - * Computes the value and the - * first and second derivatives - * of each Raviart-Thomas - * polynomial at @p unit_point. - * - * The size of the vectors must - * either be zero or equal - * n(). In the - * first case, the function will - * not compute these values. - * - * If you need values or - * derivatives of all tensor - * product polynomials then use - * this function, rather than - * using any of the - * compute_value, - * compute_grad or - * compute_grad_grad - * functions, see below, in a - * loop over all tensor product - * polynomials. - */ + /** + * Computes the value and the + * first and second derivatives + * of each Raviart-Thomas + * polynomial at @p unit_point. + * + * The size of the vectors must + * either be zero or equal + * n(). In the + * first case, the function will + * not compute these values. + * + * If you need values or + * derivatives of all tensor + * product polynomials then use + * this function, rather than + * using any of the + * compute_value, + * compute_grad or + * compute_grad_grad + * functions, see below, in a + * loop over all tensor product + * polynomials. + */ void compute (const Point &unit_point, std::vector > &values, std::vector > &grads, std::vector > &grad_grads) const; - /** - * Returns the number of ABF polynomials. - */ + /** + * Returns the number of ABF polynomials. + */ unsigned int n () const; - /** - * Returns the degree of the ABF - * space, which is two less than - * the highest polynomial degree. - */ + /** + * Returns the degree of the ABF + * space, which is two less than + * the highest polynomial degree. + */ unsigned int degree () const; - /** - * Return the name of the space , - * which is ABF. - */ + /** + * Return the name of the space , + * which is ABF. + */ std::string name () const; - - /** - * Return the number of - * polynomials in the space - * RT(degree) without - * requiring to build an object - * of PolynomialsABF. This is - * required by the FiniteElement - * classes. - */ + + /** + * Return the number of + * polynomials in the space + * RT(degree) without + * requiring to build an object + * of PolynomialsABF. This is + * required by the FiniteElement + * classes. + */ static unsigned int compute_n_pols(unsigned int degree); private: - /** - * The degree of this object as - * given to the constructor. - */ + /** + * The degree of this object as + * given to the constructor. + */ const unsigned int my_degree; - /** - * An object representing the - * polynomial space for a single - * component. We can re-use it by - * rotating the coordinates of - * the evaluation point. - */ + /** + * An object representing the + * polynomial space for a single + * component. We can re-use it by + * rotating the coordinates of + * the evaluation point. + */ AnisotropicPolynomials* polynomial_space; - /** - * Number of Raviart-Thomas - * polynomials. - */ + /** + * Number of Raviart-Thomas + * polynomials. + */ unsigned int n_pols; - /** - * A mutex that guards the - * following scratch arrays. - */ + /** + * A mutex that guards the + * following scratch arrays. + */ mutable Threads::Mutex mutex; - /** - * Auxiliary memory. - */ + /** + * Auxiliary memory. + */ mutable std::vector p_values; - /** - * Auxiliary memory. - */ + /** + * Auxiliary memory. + */ mutable std::vector > p_grads; - /** - * Auxiliary memory. - */ + /** + * Auxiliary memory. + */ mutable std::vector > p_grad_grads; }; diff --git a/deal.II/include/deal.II/base/polynomials_adini.h b/deal.II/include/deal.II/base/polynomials_adini.h index e7bd31a883..17798dcae7 100644 --- a/deal.II/include/deal.II/base/polynomials_adini.h +++ b/deal.II/include/deal.II/base/polynomials_adini.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2009 by the deal.II authors +// Copyright (C) 2009, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -34,12 +34,12 @@ DEAL_II_NAMESPACE_OPEN * @author Bärbel Janssen, 2007 */ -class PolynomialsAdini +class PolynomialsAdini { public: /** - * Constructor for - * the polynomials of + * Constructor for + * the polynomials of * the described space */ PolynomialsAdini (); @@ -69,7 +69,7 @@ class PolynomialsAdini * loop over all polynomials. */ - void compute (const Point<2> &unit_point, + void compute (const Point<2> &unit_point, std::vector &values, std::vector > &grads, std::vector< Tensor<2,2> > &grad_grads) const; @@ -82,7 +82,7 @@ class PolynomialsAdini * Consider using compute() instead. */ - double compute_value (const unsigned int i, + double compute_value (const unsigned int i, const Point<2> &p) const; /** @@ -109,11 +109,11 @@ class PolynomialsAdini private: /** - * Store the coefficients of the + * Store the coefficients of the * polynominals in the order * $1,x,y,x^2,y^2,xy,x^3,y^3,xy^2,x^2y,x^3y,xy^3$ */ - Table<2, double> coef; + Table<2, double> coef; /** * Store the coefficients of the x-derivative @@ -121,32 +121,32 @@ class PolynomialsAdini * $1,x,y,x^2,y^2,xy,x^3,y^3,xy^2,x^2y,x^3y,xy^3$ */ - Table<2, double> dx; + Table<2, double> dx; /** * Store the coefficients of the y-derivative * of the polynominals in the order * $1,x,y,x^2,y^2,xy,x^3,y^3,xy^2,x^2y,x^3y,xy^3$ */ - Table<2, double> dy; + Table<2, double> dy; /** * Store the coefficients of the second x-derivative * of the polynominals in the order * $1,x,y,x^2,y^2,xy,x^3,y^3,xy^2,x^2y,x^3y,xy^3$ */ - Table<2, double> dxx; + Table<2, double> dxx; /** * Store the coefficients of the second y-derivative * of the polynominals in the order * $1,x,y,x^2,y^2,xy,x^3,y^3,xy^2,x^2y,x^3y,xy^3$ */ - Table<2, double> dyy; + Table<2, double> dyy; /** * Store the coefficients of the second mixed derivative * of the polynominals in the order * $1,x,y,x^2,y^2,xy,x^3,y^3,xy^2,x^2y,x^3y,xy^3$ */ - Table<2, double> dxy; + Table<2, double> dxy; }; diff --git a/deal.II/include/deal.II/base/polynomials_bdm.h b/deal.II/include/deal.II/base/polynomials_bdm.h index 1523692108..b5bd31e2f7 100644 --- a/deal.II/include/deal.II/base/polynomials_bdm.h +++ b/deal.II/include/deal.II/base/polynomials_bdm.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2004, 2005, 2006, 2009, 2010 by the deal.II authors +// Copyright (C) 2004, 2005, 2006, 2009, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -58,121 +58,121 @@ template class PolynomialsBDM { public: - /** - * Constructor. Creates all basis - * functions for BDM polynomials - * of given degree. - * - * @arg k: the degree of the - * BDM-space, which is the degree - * of the largest complete - * polynomial space - * Pk contained - * in the BDM-space. - */ + /** + * Constructor. Creates all basis + * functions for BDM polynomials + * of given degree. + * + * @arg k: the degree of the + * BDM-space, which is the degree + * of the largest complete + * polynomial space + * Pk contained + * in the BDM-space. + */ PolynomialsBDM (const unsigned int k); - /** - * Computes the value and the - * first and second derivatives - * of each BDM - * polynomial at @p unit_point. - * - * The size of the vectors must - * either be zero or equal - * n(). In the - * first case, the function will - * not compute these values. - * - * If you need values or - * derivatives of all tensor - * product polynomials then use - * this function, rather than - * using any of the - * compute_value, - * compute_grad or - * compute_grad_grad - * functions, see below, in a - * loop over all tensor product - * polynomials. - */ + /** + * Computes the value and the + * first and second derivatives + * of each BDM + * polynomial at @p unit_point. + * + * The size of the vectors must + * either be zero or equal + * n(). In the + * first case, the function will + * not compute these values. + * + * If you need values or + * derivatives of all tensor + * product polynomials then use + * this function, rather than + * using any of the + * compute_value, + * compute_grad or + * compute_grad_grad + * functions, see below, in a + * loop over all tensor product + * polynomials. + */ void compute (const Point &unit_point, std::vector > &values, std::vector > &grads, std::vector > &grad_grads) const; - /** - * Returns the number of BDM polynomials. - */ + /** + * Returns the number of BDM polynomials. + */ unsigned int n () const; - /** - * Returns the degree of the BDM - * space, which is one less than - * the highest polynomial degree. - */ + /** + * Returns the degree of the BDM + * space, which is one less than + * the highest polynomial degree. + */ unsigned int degree () const; - /** - * Return the name of the space , - * which is BDM. - */ + /** + * Return the name of the space , + * which is BDM. + */ std::string name () const; - - /** - * Return the number of - * polynomials in the space - * BDM(degree) without - * requiring to build an object - * of PolynomialsBDM. This is - * required by the FiniteElement - * classes. - */ + + /** + * Return the number of + * polynomials in the space + * BDM(degree) without + * requiring to build an object + * of PolynomialsBDM. This is + * required by the FiniteElement + * classes. + */ static unsigned int compute_n_pols(unsigned int degree); private: - /** - * An object representing the - * polynomial space used - * here. The constructor fills - * this with the monomial basis. - */ + /** + * An object representing the + * polynomial space used + * here. The constructor fills + * this with the monomial basis. + */ const PolynomialSpace polynomial_space; - /** - * Storage for monomials. In 2D, - * this is just the polynomial of - * order k. In 3D, we - * need all polynomials from - * degree zero to k. - */ + /** + * Storage for monomials. In 2D, + * this is just the polynomial of + * order k. In 3D, we + * need all polynomials from + * degree zero to k. + */ std::vector > monomials; - /** - * Number of BDM - * polynomials. - */ + /** + * Number of BDM + * polynomials. + */ unsigned int n_pols; - /** - * A mutex that guards the - * following scratch arrays. - */ + /** + * A mutex that guards the + * following scratch arrays. + */ mutable Threads::Mutex mutex; - /** - * Auxiliary memory. - */ + /** + * Auxiliary memory. + */ mutable std::vector p_values; - /** - * Auxiliary memory. - */ + /** + * Auxiliary memory. + */ mutable std::vector > p_grads; - /** - * Auxiliary memory. - */ + /** + * Auxiliary memory. + */ mutable std::vector > p_grad_grads; }; diff --git a/deal.II/include/deal.II/base/polynomials_nedelec.h b/deal.II/include/deal.II/base/polynomials_nedelec.h index f8c97b5d25..5e77df2bd3 100644 --- a/deal.II/include/deal.II/base/polynomials_nedelec.h +++ b/deal.II/include/deal.II/base/polynomials_nedelec.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- -// $Id$ +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -48,103 +48,103 @@ template class PolynomialsNedelec { public: - /** - * Constructor. Creates all basis - * functions for Nédélec polynomials - * of given degree. - * - * @arg k: the degree of the - * Nédélec space, which is the degree - * of the largest tensor product - * polynomial space - * Qk contained. - */ + /** + * Constructor. Creates all basis + * functions for Nédélec polynomials + * of given degree. + * + * @arg k: the degree of the + * Nédélec space, which is the degree + * of the largest tensor product + * polynomial space + * Qk contained. + */ PolynomialsNedelec (const unsigned int k); - - /** - * Computes the value and the - * first and second derivatives - * of each Nédélec - * polynomial at @p unit_point. - * - * The size of the vectors must - * either be zero or equal - * n(). In the - * first case, the function will - * not compute these values. - * - * If you need values or - * derivatives of all tensor - * product polynomials then use - * this function, rather than - * using any of the - * compute_value, - * compute_grad or - * compute_grad_grad - * functions, see below, in a - * loop over all tensor product - * polynomials. - */ + + /** + * Computes the value and the + * first and second derivatives + * of each Nédélec + * polynomial at @p unit_point. + * + * The size of the vectors must + * either be zero or equal + * n(). In the + * first case, the function will + * not compute these values. + * + * If you need values or + * derivatives of all tensor + * product polynomials then use + * this function, rather than + * using any of the + * compute_value, + * compute_grad or + * compute_grad_grad + * functions, see below, in a + * loop over all tensor product + * polynomials. + */ void compute (const Point &unit_point, std::vector > &values, std::vector > &grads, std::vector > &grad_grads) const; - /** - * Returns the number of Nédélec - * polynomials. - */ + /** + * Returns the number of Nédélec + * polynomials. + */ unsigned int n () const; - - /** - * Returns the degree of the Nédélec - * space, which is one less than - * the highest polynomial degree. - */ + + /** + * Returns the degree of the Nédélec + * space, which is one less than + * the highest polynomial degree. + */ unsigned int degree () const; - - /** - * Return the name of the space , - * which is Nedelec. - */ + + /** + * Return the name of the space , + * which is Nedelec. + */ std::string name () const; - - /** - * Return the number of - * polynomials in the space - * N(degree) without - * requiring to build an object - * of PolynomialsNedelec. This is - * required by the FiniteElement - * classes. - */ + + /** + * Return the number of + * polynomials in the space + * N(degree) without + * requiring to build an object + * of PolynomialsNedelec. This is + * required by the FiniteElement + * classes. + */ static unsigned int compute_n_pols (unsigned int degree); - + private: - /** - * The degree of this object as - * given to the constructor. - */ + /** + * The degree of this object as + * given to the constructor. + */ const unsigned int my_degree; - - /** - * An object representing the - * polynomial space for a single - * component. We can re-use it by - * rotating the coordinates of - * the evaluation point. - */ + + /** + * An object representing the + * polynomial space for a single + * component. We can re-use it by + * rotating the coordinates of + * the evaluation point. + */ const AnisotropicPolynomials polynomial_space; - /** - * Number of Nédélec polynomials. - */ + /** + * Number of Nédélec polynomials. + */ const unsigned int n_pols; - /** - * A static member function that - * creates the polynomial space - * we use to initialize the - * #polynomial_space member - * variable. - */ + /** + * A static member function that + * creates the polynomial space + * we use to initialize the + * #polynomial_space member + * variable. + */ static std::vector > > create_polynomials (const unsigned int k); }; diff --git a/deal.II/include/deal.II/base/polynomials_p.h b/deal.II/include/deal.II/base/polynomials_p.h index 760d44ee21..23033706f8 100644 --- a/deal.II/include/deal.II/base/polynomials_p.h +++ b/deal.II/include/deal.II/base/polynomials_p.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2004, 2005, 2006, 2009 by the deal.II authors +// Copyright (C) 2004, 2005, 2006, 2009, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -45,58 +45,58 @@ template class PolynomialsP: public PolynomialSpace { public: - /** - * Access to the dimension of - * this object, for checking and - * automatic setting of dimension - * in other classes. - */ + /** + * Access to the dimension of + * this object, for checking and + * automatic setting of dimension + * in other classes. + */ static const unsigned int dimension = dim; - - /** - * Constructor. Creates all basis - * functions of $P_p$. - * @arg p: the degree of the - * polynomial space - */ + + /** + * Constructor. Creates all basis + * functions of $P_p$. + * @arg p: the degree of the + * polynomial space + */ PolynomialsP (const unsigned int p); - /** - * Returns the degree p - * of the polynomial space - * P_p. - * - * Note, that this number is - * PolynomialSpace::degree()-1, - * compare definition in - * PolynomialSpace. - */ + /** + * Returns the degree p + * of the polynomial space + * P_p. + * + * Note, that this number is + * PolynomialSpace::degree()-1, + * compare definition in + * PolynomialSpace. + */ unsigned int degree() const; - /** - * For the nth - * polynomial $p_n(x,y,z)=x^i y^j - * z^k$ this function gives the - * degrees i,j,k in the x,y,z - * directions. - */ + /** + * For the nth + * polynomial $p_n(x,y,z)=x^i y^j + * z^k$ this function gives the + * degrees i,j,k in the x,y,z + * directions. + */ void directional_degrees(unsigned int n, - unsigned int (°rees)[dim]) const; - + unsigned int (°rees)[dim]) const; + private: - /** - * Fills the index_map. - */ + /** + * Fills the index_map. + */ void create_polynomial_ordering(std::vector &index_map) const; - /** - * Degree p of the - * polynomial space $P_p$, - * i.e. the number p - * which was given to the - * constructor. - */ + /** + * Degree p of the + * polynomial space $P_p$, + * i.e. the number p + * which was given to the + * constructor. + */ const unsigned int p; }; @@ -113,7 +113,7 @@ PolynomialsP::degree() const template inline void PolynomialsP::directional_degrees(unsigned int n, - unsigned int (°rees)[dim]) const + unsigned int (°rees)[dim]) const { this->compute_index(n,degrees); } diff --git a/deal.II/include/deal.II/base/polynomials_raviart_thomas.h b/deal.II/include/deal.II/base/polynomials_raviart_thomas.h index 5e00ef9cb3..0c112f983c 100644 --- a/deal.II/include/deal.II/base/polynomials_raviart_thomas.h +++ b/deal.II/include/deal.II/base/polynomials_raviart_thomas.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 by the deal.II authors +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -47,106 +47,106 @@ template class PolynomialsRaviartThomas { public: - /** - * Constructor. Creates all basis - * functions for Raviart-Thomas polynomials - * of given degree. - * - * @arg k: the degree of the - * Raviart-Thomas-space, which is the degree - * of the largest tensor product - * polynomial space - * Qk contained. - */ + /** + * Constructor. Creates all basis + * functions for Raviart-Thomas polynomials + * of given degree. + * + * @arg k: the degree of the + * Raviart-Thomas-space, which is the degree + * of the largest tensor product + * polynomial space + * Qk contained. + */ PolynomialsRaviartThomas (const unsigned int k); - /** - * Computes the value and the - * first and second derivatives - * of each Raviart-Thomas - * polynomial at @p unit_point. - * - * The size of the vectors must - * either be zero or equal - * n(). In the - * first case, the function will - * not compute these values. - * - * If you need values or - * derivatives of all tensor - * product polynomials then use - * this function, rather than - * using any of the - * compute_value, - * compute_grad or - * compute_grad_grad - * functions, see below, in a - * loop over all tensor product - * polynomials. - */ + /** + * Computes the value and the + * first and second derivatives + * of each Raviart-Thomas + * polynomial at @p unit_point. + * + * The size of the vectors must + * either be zero or equal + * n(). In the + * first case, the function will + * not compute these values. + * + * If you need values or + * derivatives of all tensor + * product polynomials then use + * this function, rather than + * using any of the + * compute_value, + * compute_grad or + * compute_grad_grad + * functions, see below, in a + * loop over all tensor product + * polynomials. + */ void compute (const Point &unit_point, std::vector > &values, std::vector > &grads, std::vector > &grad_grads) const; - /** - * Returns the number of Raviart-Thomas polynomials. - */ + /** + * Returns the number of Raviart-Thomas polynomials. + */ unsigned int n () const; - /** - * Returns the degree of the Raviart-Thomas - * space, which is one less than - * the highest polynomial degree. - */ + /** + * Returns the degree of the Raviart-Thomas + * space, which is one less than + * the highest polynomial degree. + */ unsigned int degree () const; - /** - * Return the name of the space , - * which is RaviartThomas. - */ + /** + * Return the name of the space , + * which is RaviartThomas. + */ std::string name () const; - /** - * Return the number of - * polynomials in the space - * RT(degree) without - * requiring to build an object - * of PolynomialsRaviartThomas. This is - * required by the FiniteElement - * classes. - */ + /** + * Return the number of + * polynomials in the space + * RT(degree) without + * requiring to build an object + * of PolynomialsRaviartThomas. This is + * required by the FiniteElement + * classes. + */ static unsigned int compute_n_pols(unsigned int degree); private: - /** - * The degree of this object as - * given to the constructor. - */ + /** + * The degree of this object as + * given to the constructor. + */ const unsigned int my_degree; - /** - * An object representing the - * polynomial space for a single - * component. We can re-use it by - * rotating the coordinates of - * the evaluation point. - */ + /** + * An object representing the + * polynomial space for a single + * component. We can re-use it by + * rotating the coordinates of + * the evaluation point. + */ const AnisotropicPolynomials polynomial_space; - /** - * Number of Raviart-Thomas - * polynomials. - */ + /** + * Number of Raviart-Thomas + * polynomials. + */ const unsigned int n_pols; - /** - * A static member function that - * creates the polynomial space - * we use to initialize the - * #polynomial_space member - * variable. - */ + /** + * A static member function that + * creates the polynomial space + * we use to initialize the + * #polynomial_space member + * variable. + */ static std::vector > > create_polynomials (const unsigned int k); diff --git a/deal.II/include/deal.II/base/qprojector.h b/deal.II/include/deal.II/base/qprojector.h index af40276a0c..7ffa03220a 100644 --- a/deal.II/include/deal.II/base/qprojector.h +++ b/deal.II/include/deal.II/base/qprojector.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009 by the deal.II authors +// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -46,7 +46,7 @@ DEAL_II_NAMESPACE_OPEN * way to find the starting index of the points and weights * corresponding to one face or subface within this array. This is * done through the DataSetDescriptor member class. - * + * * The different functions are grouped into a common class to avoid * putting them into global namespace. However, since they have no * local data, all functions are declared static and can be @@ -73,196 +73,196 @@ template class QProjector { public: - /** - * Define a typedef for a - * quadrature that acts on an - * object of one dimension - * less. For cells, this would - * then be a face quadrature. - */ + /** + * Define a typedef for a + * quadrature that acts on an + * object of one dimension + * less. For cells, this would + * then be a face quadrature. + */ typedef Quadrature SubQuadrature; - - /** - * Compute the quadrature points - * on the cell if the given - * quadrature formula is used on - * face face_no. For further - * details, see the general doc - * for this class. - */ + + /** + * Compute the quadrature points + * on the cell if the given + * quadrature formula is used on + * face face_no. For further + * details, see the general doc + * for this class. + */ static void project_to_face (const SubQuadrature &quadrature, - const unsigned int face_no, - std::vector > &q_points); - - /** - * Compute the cell quadrature - * formula corresponding to using - * quadrature on face - * face_no. For further - * details, see the general doc - * for this class. - */ + const unsigned int face_no, + std::vector > &q_points); + + /** + * Compute the cell quadrature + * formula corresponding to using + * quadrature on face + * face_no. For further + * details, see the general doc + * for this class. + */ static Quadrature project_to_face (const SubQuadrature &quadrature, - const unsigned int face_no); - - /** - * Compute the quadrature points on the - * cell if the given quadrature formula is - * used on face face_no, subface - * number subface_no corresponding - * to RefineCase::Type - * ref_case. The last argument is - * only used in 3D. - * - * @note Only the points are - * transformed. The quadrature - * weights are the same as those - * of the original rule. - */ + const unsigned int face_no); + + /** + * Compute the quadrature points on the + * cell if the given quadrature formula is + * used on face face_no, subface + * number subface_no corresponding + * to RefineCase::Type + * ref_case. The last argument is + * only used in 3D. + * + * @note Only the points are + * transformed. The quadrature + * weights are the same as those + * of the original rule. + */ static void project_to_subface (const SubQuadrature &quadrature, - const unsigned int face_no, - const unsigned int subface_no, - std::vector > &q_points, - const RefinementCase &ref_case=RefinementCase::isotropic_refinement); - - /** - * Compute the cell quadrature formula - * corresponding to using - * quadrature on subface - * subface_no of face - * face_no with - * RefinementCase - * ref_case. The last argument is - * only used in 3D. - * - * @note Only the points are - * transformed. The quadrature - * weights are the same as those - * of the original rule. - */ + const unsigned int face_no, + const unsigned int subface_no, + std::vector > &q_points, + const RefinementCase &ref_case=RefinementCase::isotropic_refinement); + + /** + * Compute the cell quadrature formula + * corresponding to using + * quadrature on subface + * subface_no of face + * face_no with + * RefinementCase + * ref_case. The last argument is + * only used in 3D. + * + * @note Only the points are + * transformed. The quadrature + * weights are the same as those + * of the original rule. + */ static Quadrature project_to_subface (const SubQuadrature &quadrature, - const unsigned int face_no, - const unsigned int subface_no, - const RefinementCase &ref_case=RefinementCase::isotropic_refinement); - - /** - * Take a face quadrature formula - * and generate a cell quadrature - * formula from it where the - * quadrature points of the given - * argument are projected on all - * faces. - * - * The weights of the new rule - * are replications of the - * original weights. Thus, the - * sum of the weights is not one, - * but the number of faces, which - * is the surface of the - * reference cell. - * - * This in particular allows us - * to extract a subset of points - * corresponding to a single face - * and use it as a quadrature on - * this face, as is done in - * FEFaceValues. - * - * @note In 3D, this function - * produces eight sets of - * quadrature points for each - * face, in order to cope - * possibly different - * orientations of the mesh. - */ + const unsigned int face_no, + const unsigned int subface_no, + const RefinementCase &ref_case=RefinementCase::isotropic_refinement); + + /** + * Take a face quadrature formula + * and generate a cell quadrature + * formula from it where the + * quadrature points of the given + * argument are projected on all + * faces. + * + * The weights of the new rule + * are replications of the + * original weights. Thus, the + * sum of the weights is not one, + * but the number of faces, which + * is the surface of the + * reference cell. + * + * This in particular allows us + * to extract a subset of points + * corresponding to a single face + * and use it as a quadrature on + * this face, as is done in + * FEFaceValues. + * + * @note In 3D, this function + * produces eight sets of + * quadrature points for each + * face, in order to cope + * possibly different + * orientations of the mesh. + */ static Quadrature project_to_all_faces (const SubQuadrature &quadrature); - /** - * Take a face quadrature formula - * and generate a cell quadrature - * formula from it where the - * quadrature points of the given - * argument are projected on all - * subfaces. - * - * Like in project_to_all_faces(), - * the weights of the new rule - * sum up to the number of faces - * (not subfaces), which - * is the surface of the - * reference cell. - * - * This in particular allows us - * to extract a subset of points - * corresponding to a single subface - * and use it as a quadrature on - * this face, as is done in - * FESubfaceValues. - */ + /** + * Take a face quadrature formula + * and generate a cell quadrature + * formula from it where the + * quadrature points of the given + * argument are projected on all + * subfaces. + * + * Like in project_to_all_faces(), + * the weights of the new rule + * sum up to the number of faces + * (not subfaces), which + * is the surface of the + * reference cell. + * + * This in particular allows us + * to extract a subset of points + * corresponding to a single subface + * and use it as a quadrature on + * this face, as is done in + * FESubfaceValues. + */ static Quadrature project_to_all_subfaces (const SubQuadrature &quadrature); - /** - * Project a given quadrature - * formula to a child of a - * cell. You may want to use this - * function in case you want to - * extend an integral only over - * the area which a potential - * child would occupy. The child - * numbering is the same as the - * children would be numbered - * upon refinement of the cell. - * - * As integration using this - * quadrature formula now only - * extends over a fraction of the - * cell, the weights of the - * resulting object are divided by - * GeometryInfo::children_per_cell. - */ + /** + * Project a given quadrature + * formula to a child of a + * cell. You may want to use this + * function in case you want to + * extend an integral only over + * the area which a potential + * child would occupy. The child + * numbering is the same as the + * children would be numbered + * upon refinement of the cell. + * + * As integration using this + * quadrature formula now only + * extends over a fraction of the + * cell, the weights of the + * resulting object are divided by + * GeometryInfo::children_per_cell. + */ static Quadrature project_to_child (const Quadrature &quadrature, - const unsigned int child_no); - - /** - * Project a quadrature rule to - * all children of a - * cell. Similarly to - * project_to_all_subfaces(), - * this function replicates the - * formula generated by - * project_to_child() for all - * children, such that the - * weights sum up to one, the - * volume of the total cell - * again. - * - * The child - * numbering is the same as the - * children would be numbered - * upon refinement of the cell. - */ + const unsigned int child_no); + + /** + * Project a quadrature rule to + * all children of a + * cell. Similarly to + * project_to_all_subfaces(), + * this function replicates the + * formula generated by + * project_to_child() for all + * children, such that the + * weights sum up to one, the + * volume of the total cell + * again. + * + * The child + * numbering is the same as the + * children would be numbered + * upon refinement of the cell. + */ static Quadrature project_to_all_children (const Quadrature &quadrature); - - /** - * Project the onedimensional - * rule quadrature to - * the straight line connecting - * the points p1 and - * p2. - */ + + /** + * Project the onedimensional + * rule quadrature to + * the straight line connecting + * the points p1 and + * p2. + */ static Quadrature project_to_line(const Quadrature<1>& quadrature, - const Point& p1, - const Point& p2); + const Point& p1, + const Point& p2); /** * Since the @@ -315,7 +315,7 @@ class QProjector * static functions. */ static DataSetDescriptor cell (); - + /** * Static function to generate an * offset object for a given face of a @@ -363,10 +363,10 @@ class QProjector * one that has been * projected onto the faces) * has. - * - * Through the last argument - * anisotropic refinement can be - * respected. + * + * Through the last argument + * anisotropic refinement can be + * respected. */ static DataSetDescriptor @@ -376,7 +376,7 @@ class QProjector const bool face_flip, const bool face_rotation, const unsigned int n_quadrature_points, - const internal::SubfaceCase ref_case=internal::SubfaceCase::case_isotropic); + const internal::SubfaceCase ref_case=internal::SubfaceCase::case_isotropic); /** * Conversion operator to an @@ -393,7 +393,7 @@ class QProjector * offsets. */ operator unsigned int () const; - + private: /** * Store the integer offset @@ -432,7 +432,7 @@ class QProjector * Given a quadrature object in * 2d, rotate all quadrature * points by @p n_times * 90 degrees - * counterclockwise + * counterclockwise * and return them with their * original weights. * @@ -440,12 +440,12 @@ class QProjector * projecting a 2d quadrature * rule onto the faces of a 3d * cube, since there we need all - * rotations to account for - * face_flip and face_rotation + * rotations to account for + * face_flip and face_rotation * of non-standard faces. */ static Quadrature<2> rotate (const Quadrature<2> &q, - const unsigned int n_times); + const unsigned int n_times); }; /*@}*/ @@ -523,21 +523,21 @@ QProjector<1>::project_to_subface (const Quadrature<0> &, const unsigned int, const unsigned int, std::vector > &, - const RefinementCase<0> &); + const RefinementCase<0> &); template <> void QProjector<2>::project_to_subface (const Quadrature<1> &quadrature, const unsigned int face_no, const unsigned int subface_no, std::vector > &q_points, - const RefinementCase<1> &); + const RefinementCase<1> &); template <> void QProjector<3>::project_to_subface (const Quadrature<2> &quadrature, const unsigned int face_no, const unsigned int subface_no, std::vector > &q_points, - const RefinementCase<2> &face_ref_case); + const RefinementCase<2> &face_ref_case); template <> Quadrature<1> @@ -550,7 +550,7 @@ QIterated<1>::uses_both_endpoints (const Quadrature<1> &base_quadrature); template <> QIterated<1>::QIterated (const Quadrature<1> &base_quadrature, - const unsigned int n_copies); + const unsigned int n_copies); #endif // DOXYGEN diff --git a/deal.II/include/deal.II/base/quadrature.h b/deal.II/include/deal.II/base/quadrature.h index 003c52b014..43384cdd1c 100644 --- a/deal.II/include/deal.II/base/quadrature.h +++ b/deal.II/include/deal.II/base/quadrature.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -80,64 +80,64 @@ template class Quadrature : public Subscriptor { public: - /** - * Define a typedef for a - * quadrature that acts on an - * object of one dimension - * less. For cells, this would - * then be a face quadrature. - */ + /** + * Define a typedef for a + * quadrature that acts on an + * object of one dimension + * less. For cells, this would + * then be a face quadrature. + */ typedef Quadrature SubQuadrature; - /** - * Constructor. - * - * This constructor is marked as - * explicit to avoid involuntary - * accidents like in - * hp::QCollection@ - * q_collection(3) where - * hp::QCollection@ - * q_collection(QGauss@(3)) - * was meant. - */ + /** + * Constructor. + * + * This constructor is marked as + * explicit to avoid involuntary + * accidents like in + * hp::QCollection@ + * q_collection(3) where + * hp::QCollection@ + * q_collection(QGauss@(3)) + * was meant. + */ explicit Quadrature (const unsigned int n_quadrature_points = 0); - /** - * Build this quadrature formula - * as the tensor product of a - * formula in a dimension one - * less than the present and a - * formula in one dimension. - * - * SubQuadrature::type - * expands to - * Quadrature. - */ + /** + * Build this quadrature formula + * as the tensor product of a + * formula in a dimension one + * less than the present and a + * formula in one dimension. + * + * SubQuadrature::type + * expands to + * Quadrature. + */ Quadrature (const SubQuadrature &, - const Quadrature<1> &); - - /** - * Build this quadrature formula - * as the dim-fold - * tensor product of a formula in - * one dimension. - * - * Assuming that the points in - * the one-dimensional rule are in - * ascending order, the points of - * the resulting rule are ordered - * lexicographically with - * x running fastest. - * - * In order to avoid a conflict - * with the copy constructor in - * 1d, we let the argument be a - * 0d quadrature formula for - * dim==1, and a 1d quadrature - * formula for all other space - * dimensions. - */ + const Quadrature<1> &); + + /** + * Build this quadrature formula + * as the dim-fold + * tensor product of a formula in + * one dimension. + * + * Assuming that the points in + * the one-dimensional rule are in + * ascending order, the points of + * the resulting rule are ordered + * lexicographically with + * x running fastest. + * + * In order to avoid a conflict + * with the copy constructor in + * 1d, we let the argument be a + * 0d quadrature formula for + * dim==1, and a 1d quadrature + * formula for all other space + * dimensions. + */ explicit Quadrature (const Quadrature &quadrature_1d); /** @@ -145,105 +145,105 @@ class Quadrature : public Subscriptor */ Quadrature (const Quadrature &q); - /** - * Construct a quadrature formula - * from given vectors of - * quadrature points (which - * should really be in the unit - * cell) and the corresponding - * weights. You will want to have - * the weights sum up to one, but - * this is not checked. - */ + /** + * Construct a quadrature formula + * from given vectors of + * quadrature points (which + * should really be in the unit + * cell) and the corresponding + * weights. You will want to have + * the weights sum up to one, but + * this is not checked. + */ Quadrature (const std::vector > &points, - const std::vector &weights); - - /** - * Construct a dummy quadrature - * formula from a list of points, - * with weights set to - * infinity. The resulting object - * is therefore not meant to - * actually perform integrations, - * but rather to be used with - * FEValues objects in - * order to find the position of - * some points (the quadrature - * points in this object) on the - * transformed cell in real - * space. - */ + const std::vector &weights); + + /** + * Construct a dummy quadrature + * formula from a list of points, + * with weights set to + * infinity. The resulting object + * is therefore not meant to + * actually perform integrations, + * but rather to be used with + * FEValues objects in + * order to find the position of + * some points (the quadrature + * points in this object) on the + * transformed cell in real + * space. + */ Quadrature (const std::vector > &points); - /** - * Constructor for a one-point - * quadrature. Sets the weight of - * this point to one. - */ + /** + * Constructor for a one-point + * quadrature. Sets the weight of + * this point to one. + */ Quadrature (const Point &point); - /** - * Virtual destructor. - */ + /** + * Virtual destructor. + */ virtual ~Quadrature (); - /** - * Assignment operator. Copies - * contents of #weights and - * #quadrature_points as well as - * size. - */ + /** + * Assignment operator. Copies + * contents of #weights and + * #quadrature_points as well as + * size. + */ Quadrature& operator = (const Quadrature&); /** - * Test for equality of two quadratures. - */ + * Test for equality of two quadratures. + */ bool operator == (const Quadrature & p) const; - /** - * Set the quadrature points and - * weights to the values provided - * in the arguments. - */ + /** + * Set the quadrature points and + * weights to the values provided + * in the arguments. + */ void initialize(const std::vector > &points, - const std::vector &weights); + const std::vector &weights); - /** - * Number of quadrature points. - */ + /** + * Number of quadrature points. + */ unsigned int size () const; - /** - * Return the ith quadrature - * point. - */ + /** + * Return the ith quadrature + * point. + */ const Point & point (const unsigned int i) const; - /** - * Return a reference to the - * whole array of quadrature - * points. - */ + /** + * Return a reference to the + * whole array of quadrature + * points. + */ const std::vector > & get_points () const; - /** - * Return the weight of the ith - * quadrature point. - */ + /** + * Return the weight of the ith + * quadrature point. + */ double weight (const unsigned int i) const; - /** - * Return a reference to the whole array - * of weights. - */ + /** + * Return a reference to the whole array + * of weights. + */ const std::vector & get_weights () const; - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. + */ std::size_t memory_consumption () const; /** @@ -254,19 +254,19 @@ class Quadrature : public Subscriptor void serialize (Archive & ar, const unsigned int version); protected: - /** - * List of quadrature points. To - * be filled by the constructors - * of derived classes. - */ + /** + * List of quadrature points. To + * be filled by the constructors + * of derived classes. + */ std::vector > quadrature_points; - /** - * List of weights of the - * quadrature points. To be - * filled by the constructors of - * derived classes. - */ + /** + * List of weights of the + * quadrature points. To be + * filled by the constructors of + * derived classes. + */ std::vector weights; }; @@ -286,28 +286,28 @@ template class QAnisotropic : public Quadrature { public: - /** - * Constructor for a - * one-dimensional formula. This - * one just copies the given - * quadrature rule. - */ + /** + * Constructor for a + * one-dimensional formula. This + * one just copies the given + * quadrature rule. + */ QAnisotropic(const Quadrature<1>& qx); - /** - * Constructor for a - * two-dimensional formula. - */ + /** + * Constructor for a + * two-dimensional formula. + */ QAnisotropic(const Quadrature<1>& qx, - const Quadrature<1>& qy); + const Quadrature<1>& qy); - /** - * Constructor for a - * three-dimensional formula. - */ + /** + * Constructor for a + * three-dimensional formula. + */ QAnisotropic(const Quadrature<1>& qx, - const Quadrature<1>& qy, - const Quadrature<1>& qz); + const Quadrature<1>& qy, + const Quadrature<1>& qz); }; @@ -340,25 +340,25 @@ template class QIterated : public Quadrature { public: - /** - * Constructor. Iterate the given - * quadrature formula n_copies times in - * each direction. - */ + /** + * Constructor. Iterate the given + * quadrature formula n_copies times in + * each direction. + */ QIterated (const Quadrature<1> &base_quadrature, - const unsigned int n_copies); + const unsigned int n_copies); - /** - * Exception - */ + /** + * Exception + */ DeclException0 (ExcInvalidQuadratureFormula); private: - /** - * Check whether the given - * quadrature formula has quadrature - * points at the left and right end points - * of the interval. - */ + /** + * Check whether the given + * quadrature formula has quadrature + * points at the left and right end points + * of the interval. + */ static bool uses_both_endpoints (const Quadrature<1> &base_quadrature); }; @@ -443,7 +443,7 @@ template <> Quadrature<0>::Quadrature (const unsigned int); template <> Quadrature<0>::Quadrature (const Quadrature<-1> &, - const Quadrature<1> &); + const Quadrature<1> &); template <> Quadrature<0>::Quadrature (const Quadrature<1> &); template <> @@ -451,7 +451,7 @@ Quadrature<0>::~Quadrature (); template <> Quadrature<1>::Quadrature (const Quadrature<0> &, - const Quadrature<1> &); + const Quadrature<1> &); template <> Quadrature<1>::Quadrature (const Quadrature<0> &); diff --git a/deal.II/include/deal.II/base/quadrature_lib.h b/deal.II/include/deal.II/base/quadrature_lib.h index 571027671a..a73a6d2f26 100644 --- a/deal.II/include/deal.II/base/quadrature_lib.h +++ b/deal.II/include/deal.II/base/quadrature_lib.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -33,13 +33,13 @@ template class QGauss : public Quadrature { public: - /** - * Generate a formula with - * n quadrature points (in - * each space direction), exact for - * polynomials of degree - * 2n-1. - */ + /** + * Generate a formula with + * n quadrature points (in + * each space direction), exact for + * polynomials of degree + * 2n-1. + */ QGauss (const unsigned int n); }; @@ -74,65 +74,65 @@ template class QGaussLobatto : public Quadrature { public: - /** - * Generate a formula with - * n quadrature points - * (in each space direction). - */ + /** + * Generate a formula with + * n quadrature points + * (in each space direction). + */ QGaussLobatto(const unsigned int n); protected: - /** - * Compute Legendre-Gauss-Lobatto - * quadrature points in the - * interval $[-1, +1]$. They are - * equal to the roots of the - * corresponding Jacobi - * polynomial (specified by @p - * alpha, @p beta). @p q is - * number of points. - * - * @return vector containing nodes. - */ + /** + * Compute Legendre-Gauss-Lobatto + * quadrature points in the + * interval $[-1, +1]$. They are + * equal to the roots of the + * corresponding Jacobi + * polynomial (specified by @p + * alpha, @p beta). @p q is + * number of points. + * + * @return vector containing nodes. + */ std::vector compute_quadrature_points (const unsigned int q, - const int alpha, - const int beta) const; - - /** - * Compute Legendre-Gauss-Lobatto quadrature - * weights. - * The quadrature points and weights are - * related to Jacobi polynomial specified - * by @p alpha, @p beta. - * @p x denotes the quadrature points. - * @return vector containing weights. - */ + const int alpha, + const int beta) const; + + /** + * Compute Legendre-Gauss-Lobatto quadrature + * weights. + * The quadrature points and weights are + * related to Jacobi polynomial specified + * by @p alpha, @p beta. + * @p x denotes the quadrature points. + * @return vector containing weights. + */ std::vector compute_quadrature_weights (const std::vector &x, - const int alpha, - const int beta) const; - - /** - * Evaluate a Jacobi polynomial - * $ P^{\alpha, \beta}_n(x) $ - * specified by the parameters - * @p alpha, @p beta, @p n. - * Note: The Jacobi polynomials are - * not orthonormal and defined on - * the interval $[-1, +1]$. - * @p x is the point of evaluation. - */ + const int alpha, + const int beta) const; + + /** + * Evaluate a Jacobi polynomial + * $ P^{\alpha, \beta}_n(x) $ + * specified by the parameters + * @p alpha, @p beta, @p n. + * Note: The Jacobi polynomials are + * not orthonormal and defined on + * the interval $[-1, +1]$. + * @p x is the point of evaluation. + */ long double JacobiP(const long double x, - const int alpha, - const int beta, - const unsigned int n) const; - - /** - * Evaluate the Gamma function - * $ \Gamma(n) = (n-1)! $. - * @param n point of evaluation (integer). - */ + const int alpha, + const int beta, + const unsigned int n) const; + + /** + * Evaluate the Gamma function + * $ \Gamma(n) = (n-1)! $. + * @param n point of evaluation (integer). + */ long double gamma(const unsigned int n) const; }; @@ -214,25 +214,25 @@ template class QGaussLog : public Quadrature { public: - /** - * Generate a formula with - * n quadrature points - */ + /** + * Generate a formula with + * n quadrature points + */ QGaussLog(const unsigned int n, const bool revert=false); protected: /** - * Sets the points of the - * quadrature formula. - */ + * Sets the points of the + * quadrature formula. + */ std::vector set_quadrature_points(const unsigned int n) const; /** - * Sets the weights of the - * quadrature formula. - */ + * Sets the weights of the + * quadrature formula. + */ std::vector set_quadrature_weights(const unsigned int n) const; @@ -288,29 +288,29 @@ template class QGaussLogR : public Quadrature { public: - /** - * The constructor takes four arguments: - * the order of the gauss formula on each - * of the segments $[0,x_0]$ and - * $[x_0,1]$, the actual location of the - * singularity, the scale factor inside - * the logarithmic function and a flag - * that decides wether the singularity is - * left inside the quadrature formula or - * it is factored out, to be included in - * the integrand. - */ + /** + * The constructor takes four arguments: + * the order of the gauss formula on each + * of the segments $[0,x_0]$ and + * $[x_0,1]$, the actual location of the + * singularity, the scale factor inside + * the logarithmic function and a flag + * that decides wether the singularity is + * left inside the quadrature formula or + * it is factored out, to be included in + * the integrand. + */ QGaussLogR(const unsigned int n, - const Point x0 = Point(), - const double alpha = 1, - const bool factor_out_singular_weight=false); + const Point x0 = Point(), + const double alpha = 1, + const bool factor_out_singular_weight=false); protected: - /** - * This is the length of interval - * $(0,origin)$, or 1 if either of the two - * extremes have been selected. - */ + /** + * This is the length of interval + * $(0,origin)$, or 1 if either of the two + * extremes have been selected. + */ const double fraction; }; @@ -364,7 +364,7 @@ class QGaussOneOverR : public Quadrature * QGaussOneOverR singular_quad(order, q_point, false); * // This will produce the integral of f(x)/R * for(unsigned int i=0; i * @endcode */ QGaussOneOverR(const unsigned int n, - const Point singularity, - const bool factor_out_singular_weight=false); + const Point singularity, + const bool factor_out_singular_weight=false); /** * The constructor takes three arguments: the order of the Gauss * formula, the index of the vertex where the singularity is @@ -403,7 +403,7 @@ class QGaussOneOverR : public Quadrature * QGaussOneOverR singular_quad(order, vertex_id, false); * // This will produce the integral of f(x)/R * for(unsigned int i=0; i * @endcode */ QGaussOneOverR(const unsigned int n, - const unsigned int vertex_index, - const bool factor_out_singular_weight=false); + const unsigned int vertex_index, + const bool factor_out_singular_weight=false); private: /** Given a quadrature point and a degree n, this function returns * the size of the singular quadrature rule, considering whether * the point is inside the cell, on an edge of the cell, or on a * corner of the cell. */ static unsigned int quad_size(const Point singularity, - const unsigned int n); + const unsigned int n); }; diff --git a/deal.II/include/deal.II/base/quadrature_selector.h b/deal.II/include/deal.II/base/quadrature_selector.h index 4bcf6e939c..837cc4cc81 100644 --- a/deal.II/include/deal.II/base/quadrature_selector.h +++ b/deal.II/include/deal.II/base/quadrature_selector.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006 by the deal.II authors +// Copyright (C) 2003, 2004, 2005, 2006, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -38,69 +38,69 @@ template class QuadratureSelector : public Quadrature { public: - /** - * Constructor. Takes the name of - * the quadrature rule (one of - * "gauss", "milne", "weddle", - * etc) and, if it iss "gauss", - * the order of the quadrature - * rule as argument. - */ + /** + * Constructor. Takes the name of + * the quadrature rule (one of + * "gauss", "milne", "weddle", + * etc) and, if it iss "gauss", + * the order of the quadrature + * rule as argument. + */ QuadratureSelector (const std::string &s, - const unsigned int order=0); + const unsigned int order=0); - /** - * This function returns all - * possible names for quadratures - * as a list separated by |, - * so that you can use it for the - * definition of parameter files - * (see ParameterHandler for - * details). - */ + /** + * This function returns all + * possible names for quadratures + * as a list separated by |, + * so that you can use it for the + * definition of parameter files + * (see ParameterHandler for + * details). + */ static std::string get_quadrature_names(); - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ - /** - * Exception - */ + /** + * Exception + */ DeclException1 (ExcInvalidQGaussOrder, - int, - << "You tried to generate QGauss with an invalid order of " - << arg1 << " (must be >= 2)"); - /** - * Exception - */ + int, + << "You tried to generate QGauss with an invalid order of " + << arg1 << " (must be >= 2)"); + /** + * Exception + */ DeclException2 (ExcInvalidOrder, - std::string, - unsigned int, - << "You tried to generate a " << arg1 - << " object; no order is needed (" << arg2 - << " was given as parameter)"); - /** - * Exception - */ + std::string, + unsigned int, + << "You tried to generate a " << arg1 + << " object; no order is needed (" << arg2 + << " was given as parameter)"); + /** + * Exception + */ DeclException1 (ExcInvalidQuadrature, - std::string, - << arg1 - << " is not a valid quadrature name for a quadrature rule"); - //@} + std::string, + << arg1 + << " is not a valid quadrature name for a quadrature rule"); + //@} private: - /** - * This static function creates a - * quadrature object according to - * the name given as a string, - * and the appropriate order (if - * the name is "gauss"). It is - * called from the constructor. - */ + /** + * This static function creates a + * quadrature object according to + * the name given as a string, + * and the appropriate order (if + * the name is "gauss"). It is + * called from the constructor. + */ static Quadrature create_quadrature (const std::string &s, - const unsigned int order); + const unsigned int order); }; DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/include/deal.II/base/smartpointer.h b/deal.II/include/deal.II/base/smartpointer.h index 53e50d9498..f580e80acc 100644 --- a/deal.II/include/deal.II/base/smartpointer.h +++ b/deal.II/include/deal.II/base/smartpointer.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -59,192 +59,192 @@ template class SmartPointer { public: - /** - * Standard constructor for null - * pointer. The id of this - * pointer is set to the name of - * the class P. - */ + /** + * Standard constructor for null + * pointer. The id of this + * pointer is set to the name of + * the class P. + */ SmartPointer (); - /* - * Copy constructor for - * SmartPointer. We do now - * copy the object subscribed to - * from tt, but subscribe - * ourselves to it again. - */ + /* + * Copy constructor for + * SmartPointer. We do now + * copy the object subscribed to + * from tt, but subscribe + * ourselves to it again. + */ template SmartPointer (const SmartPointer &tt); - /* - * Copy constructor for - * SmartPointer. We do now - * copy the object subscribed to - * from tt, but subscribe - * ourselves to it again. - */ + /* + * Copy constructor for + * SmartPointer. We do now + * copy the object subscribed to + * from tt, but subscribe + * ourselves to it again. + */ SmartPointer (const SmartPointer &tt); - /** - * Constructor taking a normal - * pointer. If possible, i.e. if - * the pointer is not a null - * pointer, the constructor - * subscribes to the given object - * to lock it, i.e. to prevent - * its destruction before the end - * of its use. - * - * The id is used in the - * call to - * Subscriptor::subscribe(id) and - * by ~SmartPointer() in the call - * to Subscriptor::unsubscribe(). - */ + /** + * Constructor taking a normal + * pointer. If possible, i.e. if + * the pointer is not a null + * pointer, the constructor + * subscribes to the given object + * to lock it, i.e. to prevent + * its destruction before the end + * of its use. + * + * The id is used in the + * call to + * Subscriptor::subscribe(id) and + * by ~SmartPointer() in the call + * to Subscriptor::unsubscribe(). + */ SmartPointer (T *t, const char* id); - /** - * Constructor taking a normal - * pointer. If possible, i.e. if - * the pointer is not a null - * pointer, the constructor - * subscribes to the given object - * to lock it, i.e. to prevent - * its destruction before the end - * of its use. The id of this - * pointer is set to the name of - * the class P. - */ + /** + * Constructor taking a normal + * pointer. If possible, i.e. if + * the pointer is not a null + * pointer, the constructor + * subscribes to the given object + * to lock it, i.e. to prevent + * its destruction before the end + * of its use. The id of this + * pointer is set to the name of + * the class P. + */ SmartPointer (T *t); - /** - * Destructor, removing the - * subscription. - */ + /** + * Destructor, removing the + * subscription. + */ ~SmartPointer(); - /** - * Assignment operator for normal - * pointers. The pointer - * subscribes to the new object - * automatically and unsubscribes - * to an old one if it exists. It - * will not try to subscribe to a - * null-pointer, but still - * delete the old subscription. - */ + /** + * Assignment operator for normal + * pointers. The pointer + * subscribes to the new object + * automatically and unsubscribes + * to an old one if it exists. It + * will not try to subscribe to a + * null-pointer, but still + * delete the old subscription. + */ SmartPointer & operator= (T *tt); - /** - * Assignment operator for - * SmartPointer. The pointer - * subscribes to the new object - * automatically and unsubscribes - * to an old one if it exists. - */ + /** + * Assignment operator for + * SmartPointer. The pointer + * subscribes to the new object + * automatically and unsubscribes + * to an old one if it exists. + */ template SmartPointer & operator= (const SmartPointer &tt); - /** - * Assignment operator for - * SmartPointer. The pointer - * subscribes to the new object - * automatically and unsubscribes - * to an old one if it exists. - */ + /** + * Assignment operator for + * SmartPointer. The pointer + * subscribes to the new object + * automatically and unsubscribes + * to an old one if it exists. + */ SmartPointer & operator= (const SmartPointer &tt); - /** - * Delete the object pointed to - * and set the pointer to zero. - */ + /** + * Delete the object pointed to + * and set the pointer to zero. + */ void clear (); - /** - * Conversion to normal pointer. - */ + /** + * Conversion to normal pointer. + */ operator T* () const; - /** - * Dereferencing operator. This - * operator throws an - * ExcNotInitialized if the - * pointer is a null pointer. - */ + /** + * Dereferencing operator. This + * operator throws an + * ExcNotInitialized if the + * pointer is a null pointer. + */ T& operator * () const; - /** - * Dereferencing operator. This - * operator throws an - * ExcNotInitialized if the - * pointer is a null pointer. - */ + /** + * Dereferencing operator. This + * operator throws an + * ExcNotInitialized if the + * pointer is a null pointer. + */ T * operator -> () const; - /** - * Exchange the pointers of this - * object and the argument. Since - * both the objects to which is - * pointed are subscribed to - * before and after, we do not - * have to change their - * subscription counters. - * - * Note that this function (with - * two arguments) and the - * respective functions where one - * of the arguments is a pointer - * and the other one is a C-style - * pointer are implemented in - * global namespace. - */ + /** + * Exchange the pointers of this + * object and the argument. Since + * both the objects to which is + * pointed are subscribed to + * before and after, we do not + * have to change their + * subscription counters. + * + * Note that this function (with + * two arguments) and the + * respective functions where one + * of the arguments is a pointer + * and the other one is a C-style + * pointer are implemented in + * global namespace. + */ template void swap (SmartPointer &tt); - /** - * Swap pointers between this - * object and the pointer - * given. As this releases the - * object pointed to presently, - * we reduce its subscription - * count by one, and increase it - * at the object which we will - * point to in the future. - * - * Note that we indeed need a - * reference of a pointer, as we - * want to change the pointer - * variable which we are given. - */ + /** + * Swap pointers between this + * object and the pointer + * given. As this releases the + * object pointed to presently, + * we reduce its subscription + * count by one, and increase it + * at the object which we will + * point to in the future. + * + * Note that we indeed need a + * reference of a pointer, as we + * want to change the pointer + * variable which we are given. + */ void swap (T *&tt); - /** - * Return an estimate of the - * amount of memory (in bytes) - * used by this class. Note in - * particular, that this only - * includes the amount of memory - * used by this object, not - * by the object pointed to. - */ + /** + * Return an estimate of the + * amount of memory (in bytes) + * used by this class. Note in + * particular, that this only + * includes the amount of memory + * used by this object, not + * by the object pointed to. + */ std::size_t memory_consumption () const; private: - /** - * Pointer to the object we want - * to subscribt to. Since it is - * often necessary to follow this - * pointer when debugging, we - * have deliberately chosen a - * short name. - */ + /** + * Pointer to the object we want + * to subscribt to. Since it is + * often necessary to follow this + * pointer when debugging, we + * have deliberately chosen a + * short name. + */ T * t; - /** - * The identification for the - * subscriptor. - */ + /** + * The identification for the + * subscriptor. + */ const char* const id; }; @@ -256,7 +256,7 @@ template inline SmartPointer::SmartPointer () : - t (0), id(typeid(P).name()) + t (0), id(typeid(P).name()) {} @@ -265,7 +265,7 @@ template inline SmartPointer::SmartPointer (T *t) : - t (t), id(typeid(P).name()) + t (t), id(typeid(P).name()) { if (t != 0) t->subscribe(id); @@ -277,7 +277,7 @@ template inline SmartPointer::SmartPointer (T *t, const char* id) : - t (t), id(id) + t (t), id(id) { if (t != 0) t->subscribe(id); @@ -290,7 +290,7 @@ template inline SmartPointer::SmartPointer (const SmartPointer &tt) : - t (tt.t), id(tt.id) + t (tt.t), id(tt.id) { if (t != 0) t->subscribe(id); @@ -302,7 +302,7 @@ template inline SmartPointer::SmartPointer (const SmartPointer &tt) : - t (tt.t), id(tt.id) + t (tt.t), id(tt.id) { if (t != 0) t->subscribe(id); @@ -339,8 +339,8 @@ template inline SmartPointer & SmartPointer::operator = (T *tt) { - // optimize if no real action is - // requested + // optimize if no real action is + // requested if (t == tt) return *this; @@ -360,9 +360,9 @@ inline SmartPointer & SmartPointer::operator = (const SmartPointer& tt) { - // if objects on the left and right - // hand side of the operator= are - // the same, then this is a no-op + // if objects on the left and right + // hand side of the operator= are + // the same, then this is a no-op if (&tt == this) return *this; @@ -381,9 +381,9 @@ inline SmartPointer & SmartPointer::operator = (const SmartPointer& tt) { - // if objects on the left and right - // hand side of the operator= are - // the same, then this is a no-op + // if objects on the left and right + // hand side of the operator= are + // the same, then this is a no-op if (&tt == this) return *this; diff --git a/deal.II/include/deal.II/base/subscriptor.h b/deal.II/include/deal.II/base/subscriptor.h index ddba6c5a49..7fd27ab85f 100644 --- a/deal.II/include/deal.II/base/subscriptor.h +++ b/deal.II/include/deal.II/base/subscriptor.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -52,205 +52,205 @@ DEAL_II_NAMESPACE_OPEN class Subscriptor { public: - /** - * Constructor setting the counter to zero. - */ + /** + * Constructor setting the counter to zero. + */ Subscriptor(); - /** - * Copy-constructor. - * - * The counter of the copy is zero, - * since references point to the - * original object. - */ + /** + * Copy-constructor. + * + * The counter of the copy is zero, + * since references point to the + * original object. + */ Subscriptor(const Subscriptor&); - /** - * Destructor, asserting that the counter - * is zero. - */ + /** + * Destructor, asserting that the counter + * is zero. + */ virtual ~Subscriptor(); - /** - * Assignment operator. - * - * This has to be handled with - * care, too, because the counter - * has to remain the same. It therefore - * does nothing more than returning - * *this. - */ + /** + * Assignment operator. + * + * This has to be handled with + * care, too, because the counter + * has to remain the same. It therefore + * does nothing more than returning + * *this. + */ Subscriptor& operator = (const Subscriptor&); - /** - * Subscribes a user of the - * object. The subscriber may be - * identified by text supplied as - * identifier. - */ + /** + * Subscribes a user of the + * object. The subscriber may be + * identified by text supplied as + * identifier. + */ void subscribe (const char* identifier = 0) const; - /** - * Unsubscribes a user from the - * object. - * - * @note The identifier - * must be the same - * pointer as the one - * supplied to subscribe(), not - * just the same text. - */ + /** + * Unsubscribes a user from the + * object. + * + * @note The identifier + * must be the same + * pointer as the one + * supplied to subscribe(), not + * just the same text. + */ void unsubscribe (const char* identifier = 0) const; - /** - * Return the present number of - * subscriptions to this object. - * This allows to use this class - * for reference counted lifetime - * determination where the last one - * to unsubscribe also deletes the - * object. - */ + /** + * Return the present number of + * subscriptions to this object. + * This allows to use this class + * for reference counted lifetime + * determination where the last one + * to unsubscribe also deletes the + * object. + */ unsigned int n_subscriptions () const; - /** - * List the subscribers to #deallog. - */ + /** + * List the subscribers to #deallog. + */ void list_subscribers () const; - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ - /** - * Exception: - * Object may not be deleted, since - * it is used. - */ + /** + * Exception: + * Object may not be deleted, since + * it is used. + */ DeclException3(ExcInUse, - int, char*, std::string &, - << "Object of class " << arg2 - << " is still used by " << arg1 << " other objects." - << arg3); - - /** - * A subscriber with the - * identification string given to - * Subscriptor::unsubscribe() did - * not subscribe to the object. - */ + int, char*, std::string &, + << "Object of class " << arg2 + << " is still used by " << arg1 << " other objects." + << arg3); + + /** + * A subscriber with the + * identification string given to + * Subscriptor::unsubscribe() did + * not subscribe to the object. + */ DeclException2(ExcNoSubscriber, char*, char*, - << "No subscriber with identifier \"" << arg2 - << "\" did subscribe to this object of class " << arg1); - //@} - - /** - * Read or write the data of this - * object to or from a stream for - * the purpose of serialization. - * - * This function does not - * actually serialize any of the - * member variables of this - * class. The reason is that what - * this class stores is only who - * subscribes to this object, but - * who does so at the time of - * storing the contents of this - * object does not necessarily - * have anything to do with who - * subscribes to the object when - * it is restored. Consequently, - * we do not want to overwrite - * the subscribers at the time of - * restoring, and then there is - * no reason to write the - * subscribers out in the first - * place. - */ + << "No subscriber with identifier \"" << arg2 + << "\" did subscribe to this object of class " << arg1); + //@} + + /** + * Read or write the data of this + * object to or from a stream for + * the purpose of serialization. + * + * This function does not + * actually serialize any of the + * member variables of this + * class. The reason is that what + * this class stores is only who + * subscribes to this object, but + * who does so at the time of + * storing the contents of this + * object does not necessarily + * have anything to do with who + * subscribes to the object when + * it is restored. Consequently, + * we do not want to overwrite + * the subscribers at the time of + * restoring, and then there is + * no reason to write the + * subscribers out in the first + * place. + */ template void serialize(Archive & ar, const unsigned int version); private: - /** - * Register a subscriber for - * debugging purposes. Called by - * subscribe() in debug mode. - */ + /** + * Register a subscriber for + * debugging purposes. Called by + * subscribe() in debug mode. + */ void do_subscribe(const char* id) const; - /** - * Deregister a subscriber for - * debugging purposes. Called by - * unsubscribe() in debug mode. - */ + /** + * Deregister a subscriber for + * debugging purposes. Called by + * unsubscribe() in debug mode. + */ void do_unsubscribe(const char* id) const; - /** - * The data type used in - * #counter_map. - */ + /** + * The data type used in + * #counter_map. + */ typedef std::map::value_type map_value_type; - /** - * The iterator type used in - * #counter_map. - */ + /** + * The iterator type used in + * #counter_map. + */ typedef std::map::iterator map_iterator; - /** - * Store the number of objects - * which subscribed to this - * object. Initialally, this - * number is zero, and upon - * destruction it shall be zero - * again (i.e. all objects which - * subscribed should have - * unsubscribed again). - * - * The creator (and owner) of an - * object is counted in the map - * below if HE manages to supply - * identification. - * - * We use the mutable keyword - * in order to allow subscription - * to constant objects also. - * - * In multithreaded mode, this - * counter may be modified by - * different threads. We thus - * have to mark it - * volatile. However, this is - * counter-productive in non-MT - * mode since it may pessimize - * code. So use the macro - * defined above to selectively - * add volatility. - */ + /** + * Store the number of objects + * which subscribed to this + * object. Initialally, this + * number is zero, and upon + * destruction it shall be zero + * again (i.e. all objects which + * subscribed should have + * unsubscribed again). + * + * The creator (and owner) of an + * object is counted in the map + * below if HE manages to supply + * identification. + * + * We use the mutable keyword + * in order to allow subscription + * to constant objects also. + * + * In multithreaded mode, this + * counter may be modified by + * different threads. We thus + * have to mark it + * volatile. However, this is + * counter-productive in non-MT + * mode since it may pessimize + * code. So use the macro + * defined above to selectively + * add volatility. + */ mutable DEAL_VOLATILE unsigned int counter; - /** - * In this map, we count - * subscriptions for each - * different identification string - * supplied to subscribe(). - */ + /** + * In this map, we count + * subscriptions for each + * different identification string + * supplied to subscribe(). + */ mutable std::map counter_map; - /** - * Pointer to the typeinfo object - * of this object, from which we - * can later deduce the class - * name. Since this information - * on the derived class is - * neither available in the - * destructor, nor in the - * constructor, we obtain it in - * between and store it here. - */ + /** + * Pointer to the typeinfo object + * of this object, from which we + * can later deduce the class + * name. Since this information + * on the derived class is + * neither available in the + * destructor, nor in the + * constructor, we obtain it in + * between and store it here. + */ mutable const std::type_info * object_info; }; @@ -260,10 +260,10 @@ template inline void Subscriptor::serialize(Archive &, - const unsigned int) + const unsigned int) { - // do nothing, as explained in the - // documentation of this function + // do nothing, as explained in the + // documentation of this function } // If we are in optimized mode, the subscription checking is turned diff --git a/deal.II/include/deal.II/base/symmetric_tensor.h b/deal.II/include/deal.II/base/symmetric_tensor.h index a0085bb427..0760e6514a 100644 --- a/deal.II/include/deal.II/base/symmetric_tensor.h +++ b/deal.II/include/deal.II/base/symmetric_tensor.h @@ -47,86 +47,86 @@ namespace internal */ namespace SymmetricTensorAccessors { - /** - * Create a TableIndices<2> - * object where the first entries - * up to position-1 are - * taken from previous_indices, - * and new_index is put at - * position - * position. The - * remaining indices remain in - * invalid state. - */ + /** + * Create a TableIndices<2> + * object where the first entries + * up to position-1 are + * taken from previous_indices, + * and new_index is put at + * position + * position. The + * remaining indices remain in + * invalid state. + */ inline TableIndices<2> merge (const TableIndices<2> &previous_indices, - const unsigned int new_index, - const unsigned int position) + const unsigned int new_index, + const unsigned int position) { Assert (position < 2, ExcIndexRange (position, 0, 2)); if (position == 0) - return TableIndices<2>(new_index); + return TableIndices<2>(new_index); else - return TableIndices<2>(previous_indices[0], new_index); + return TableIndices<2>(previous_indices[0], new_index); } - /** - * Create a TableIndices<4> - * object where the first entries - * up to position-1 are - * taken from previous_indices, - * and new_index is put at - * position - * position. The - * remaining indices remain in - * invalid state. - */ + /** + * Create a TableIndices<4> + * object where the first entries + * up to position-1 are + * taken from previous_indices, + * and new_index is put at + * position + * position. The + * remaining indices remain in + * invalid state. + */ inline TableIndices<4> merge (const TableIndices<4> &previous_indices, - const unsigned int new_index, - const unsigned int position) + const unsigned int new_index, + const unsigned int position) { Assert (position < 4, ExcIndexRange (position, 0, 4)); switch (position) - { - case 0: - return TableIndices<4>(new_index); - case 1: - return TableIndices<4>(previous_indices[0], - new_index); - case 2: - return TableIndices<4>(previous_indices[0], - previous_indices[1], - new_index); - case 3: - return TableIndices<4>(previous_indices[0], - previous_indices[1], - previous_indices[2], - new_index); - } + { + case 0: + return TableIndices<4>(new_index); + case 1: + return TableIndices<4>(previous_indices[0], + new_index); + case 2: + return TableIndices<4>(previous_indices[0], + previous_indices[1], + new_index); + case 3: + return TableIndices<4>(previous_indices[0], + previous_indices[1], + previous_indices[2], + new_index); + } Assert (false, ExcInternalError()); return TableIndices<4>(); } - /** - * Typedef template magic - * denoting the result of a - * double contraction between two - * tensors or ranks rank1 and - * rank2. In general, this is a - * tensor of rank - * rank1+rank2-4, but if - * this is zero it is a single - * scalar Number. For this case, - * we have a specialization. - * - * @author Wolfgang Bangerth, 2005 - */ + /** + * Typedef template magic + * denoting the result of a + * double contraction between two + * tensors or ranks rank1 and + * rank2. In general, this is a + * tensor of rank + * rank1+rank2-4, but if + * this is zero it is a single + * scalar Number. For this case, + * we have a specialization. + * + * @author Wolfgang Bangerth, 2005 + */ template struct double_contraction_result { @@ -134,24 +134,24 @@ namespace internal }; - /** - * Typedef template magic - * denoting the result of a - * double contraction between two - * tensors or ranks rank1 and - * rank2. In general, this is a - * tensor of rank - * rank1+rank2-4, but if - * this is zero it is a single - * scalar Number. For this case, - * we have a specialization. - * - * @author Wolfgang Bangerth, 2005 - */ + /** + * Typedef template magic + * denoting the result of a + * double contraction between two + * tensors or ranks rank1 and + * rank2. In general, this is a + * tensor of rank + * rank1+rank2-4, but if + * this is zero it is a single + * scalar Number. For this case, + * we have a specialization. + * + * @author Wolfgang Bangerth, 2005 + */ template struct double_contraction_result<2,2,dim,Number> { - typedef Number type; + typedef Number type; }; @@ -223,9 +223,9 @@ namespace internal * Number of independent components of a * symmetric tensor of rank 4. */ - static const unsigned int - n_independent_components = (n_rank2_components * - StorageType<2,dim,Number>::n_independent_components); + static const unsigned int + n_independent_components = (n_rank2_components * + StorageType<2,dim,Number>::n_independent_components); /** * Declare the type in which we @@ -337,26 +337,26 @@ namespace internal * object which we will * access. * - * The second argument - * denotes the values of - * previous indices into the - * tensor. For example, for a - * rank-4 tensor, if P=2, - * then we will already have - * had two successive element - * selections (e.g. through - * tensor[1][2]), - * and the two index values - * have to be stored - * somewhere. This class - * therefore only makes use - * of the first rank-P - * elements of this array, - * but passes it on to the - * next level with P-1 which - * fills the next entry, and - * so on. - * + * The second argument + * denotes the values of + * previous indices into the + * tensor. For example, for a + * rank-4 tensor, if P=2, + * then we will already have + * had two successive element + * selections (e.g. through + * tensor[1][2]), + * and the two index values + * have to be stored + * somewhere. This class + * therefore only makes use + * of the first rank-P + * elements of this array, + * but passes it on to the + * next level with P-1 which + * fills the next entry, and + * so on. + * * The constructor is made * private in order to prevent * you having such objects @@ -451,31 +451,31 @@ namespace internal * object which we will * access. * - * The second argument - * denotes the values of - * previous indices into the - * tensor. For example, for a - * rank-4 tensor, if P=2, - * then we will already have - * had two successive element - * selections (e.g. through - * tensor[1][2]), - * and the two index values - * have to be stored - * somewhere. This class - * therefore only makes use - * of the first rank-P - * elements of this array, - * but passes it on to the - * next level with P-1 which - * fills the next entry, and - * so on. - * - * For this particular - * specialization, i.e. for - * P==1, all but the last - * index are already filled. - * + * The second argument + * denotes the values of + * previous indices into the + * tensor. For example, for a + * rank-4 tensor, if P=2, + * then we will already have + * had two successive element + * selections (e.g. through + * tensor[1][2]), + * and the two index values + * have to be stored + * somewhere. This class + * therefore only makes use + * of the first rank-P + * elements of this array, + * but passes it on to the + * next level with P-1 which + * fills the next entry, and + * so on. + * + * For this particular + * specialization, i.e. for + * P==1, all but the last + * index are already filled. + * * The constructor is made * private in order to prevent * you having such objects @@ -614,33 +614,33 @@ template class SymmetricTensor { public: - /** - * Provide a way to get the - * dimension of an object without - * explicit knowledge of it's - * data type. Implementation is - * this way instead of providing - * a function dimension() - * because now it is possible to - * get the dimension at compile - * time without the expansion and - * preevaluation of an inlined - * function; the compiler may - * therefore produce more - * efficient code and you may use - * this value to declare other - * data types. - */ + /** + * Provide a way to get the + * dimension of an object without + * explicit knowledge of it's + * data type. Implementation is + * this way instead of providing + * a function dimension() + * because now it is possible to + * get the dimension at compile + * time without the expansion and + * preevaluation of an inlined + * function; the compiler may + * therefore produce more + * efficient code and you may use + * this value to declare other + * data types. + */ static const unsigned int dimension = dim; - /** - * An integer denoting the number of - * independent components that fully - * describe a symmetric tensor. In $d$ - * space dimensions, this number equals - * $\frac 12 (d^2+d)$ for symmetric - * tensors of rank 2. - */ + /** + * An integer denoting the number of + * independent components that fully + * describe a symmetric tensor. In $d$ + * space dimensions, this number equals + * $\frac 12 (d^2+d)$ for symmetric + * tensors of rank 2. + */ static const unsigned int n_independent_components = internal::SymmetricTensorAccessors::StorageType:: n_independent_components; @@ -671,52 +671,52 @@ class SymmetricTensor */ SymmetricTensor (const Tensor<2,dim,Number> &t); - /** - * A constructor that creates a - * symmetric tensor from an array - * holding its independent - * elements. Using this - * constructor assumes that the - * caller knows the order in - * which elements are stored in - * symmetric tensors; its use is - * therefore discouraged, but if - * you think you want to use it - * anyway you can query the order - * of elements using the - * unrolled_index() function. - * - * This constructor is currently only - * implemented for symmetric tensors of - * rank 2. - * - * The size of the array passed - * is equal to - * SymmetricTensor::n_independent_component; - * the reason for using the - * object from the internal - * namespace is to work around - * bugs in some older compilers. - */ + /** + * A constructor that creates a + * symmetric tensor from an array + * holding its independent + * elements. Using this + * constructor assumes that the + * caller knows the order in + * which elements are stored in + * symmetric tensors; its use is + * therefore discouraged, but if + * you think you want to use it + * anyway you can query the order + * of elements using the + * unrolled_index() function. + * + * This constructor is currently only + * implemented for symmetric tensors of + * rank 2. + * + * The size of the array passed + * is equal to + * SymmetricTensor::n_independent_component; + * the reason for using the + * object from the internal + * namespace is to work around + * bugs in some older compilers. + */ SymmetricTensor (const Number (&array) [internal::SymmetricTensorAccessors::StorageType::n_independent_components]); - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ SymmetricTensor & operator = (const SymmetricTensor &); - /** - * This operator assigns a scalar - * to a tensor. To avoid - * confusion with what exactly it - * means to assign a scalar value - * to a tensor, zero is the only - * value allowed for d, - * allowing the intuitive - * notation t=0 to reset - * all elements of the tensor to - * zero. - */ + /** + * This operator assigns a scalar + * to a tensor. To avoid + * confusion with what exactly it + * means to assign a scalar value + * to a tensor, zero is the only + * value allowed for d, + * allowing the intuitive + * notation t=0 to reset + * all elements of the tensor to + * zero. + */ SymmetricTensor & operator = (const Number d); /** @@ -727,121 +727,121 @@ class SymmetricTensor */ operator Tensor () const; - /** - * Test for equality of two tensors. - */ + /** + * Test for equality of two tensors. + */ bool operator == (const SymmetricTensor &) const; - /** - * Test for inequality of two tensors. - */ + /** + * Test for inequality of two tensors. + */ bool operator != (const SymmetricTensor &) const; - /** - * Add another tensor. - */ + /** + * Add another tensor. + */ SymmetricTensor & operator += (const SymmetricTensor &); - /** - * Subtract another tensor. - */ + /** + * Subtract another tensor. + */ SymmetricTensor & operator -= (const SymmetricTensor &); - /** - * Scale the tensor by factor, - * i.e. multiply all components by - * factor. - */ + /** + * Scale the tensor by factor, + * i.e. multiply all components by + * factor. + */ SymmetricTensor & operator *= (const Number factor); - /** - * Scale the vector by - * 1/factor. - */ + /** + * Scale the vector by + * 1/factor. + */ SymmetricTensor & operator /= (const Number factor); - /** - * Add two tensors. If possible, you - * should use operator += - * instead since this does not need the - * creation of a temporary. - */ + /** + * Add two tensors. If possible, you + * should use operator += + * instead since this does not need the + * creation of a temporary. + */ SymmetricTensor operator + (const SymmetricTensor &s) const; - /** - * Subtract two tensors. If possible, - * you should use operator -= - * instead since this does not need the - * creation of a temporary. - */ + /** + * Subtract two tensors. If possible, + * you should use operator -= + * instead since this does not need the + * creation of a temporary. + */ SymmetricTensor operator - (const SymmetricTensor &s) const; - /** - * Unary minus operator. Negate all - * entries of a tensor. - */ + /** + * Unary minus operator. Negate all + * entries of a tensor. + */ SymmetricTensor operator - () const; /** - * Product between the present - * symmetric tensor and a tensor - * of rank 2. For example, if the - * present object is also a - * rank-2 tensor, then this is - * the scalar-product double - * contraction - * aijbij - * over all indices - * i,j. In this case, - * the return value evaluates to - * a single scalar. While it is - * possible to define other - * scalar product (and associated - * induced norms), this one seems - * to be the most appropriate - * one. - * - * If the present object is a - * rank-4 tensor, the the result - * is a rank-2 tensor, the - * operation contracts over the - * last two indices of the - * present object and the indices - * of the argument, and the - * result is a tensor of rank 2. - * - * Note that the multiplication - * operator for symmetrict - * tensors is defined to be a - * double contraction over two - * indices, while it is defined - * as a single contraction over - * only one index for regular - * Tensor objects. For - * symmetric tensors it therefore - * acts in a way that is commonly - * denoted by a "colon - * multiplication" in the - * mathematica literature. - * - * There are global functions - * double_contract that - * do the same work as this - * operator, but rather than - * returning the result as a - * return value, they write it - * into the first argument to the - * function. + * Product between the present + * symmetric tensor and a tensor + * of rank 2. For example, if the + * present object is also a + * rank-2 tensor, then this is + * the scalar-product double + * contraction + * aijbij + * over all indices + * i,j. In this case, + * the return value evaluates to + * a single scalar. While it is + * possible to define other + * scalar product (and associated + * induced norms), this one seems + * to be the most appropriate + * one. + * + * If the present object is a + * rank-4 tensor, the the result + * is a rank-2 tensor, the + * operation contracts over the + * last two indices of the + * present object and the indices + * of the argument, and the + * result is a tensor of rank 2. + * + * Note that the multiplication + * operator for symmetrict + * tensors is defined to be a + * double contraction over two + * indices, while it is defined + * as a single contraction over + * only one index for regular + * Tensor objects. For + * symmetric tensors it therefore + * acts in a way that is commonly + * denoted by a "colon + * multiplication" in the + * mathematica literature. + * + * There are global functions + * double_contract that + * do the same work as this + * operator, but rather than + * returning the result as a + * return value, they write it + * into the first argument to the + * function. */ typename internal::SymmetricTensorAccessors::double_contraction_result::type operator * (const SymmetricTensor<2,dim,Number> &s) const; - /** - * Contraction over two indices - * of the present object with the - * rank-4 symmetric tensor given - * as argument. - */ + /** + * Contraction over two indices + * of the present object with the + * rank-4 symmetric tensor given + * as argument. + */ typename internal::SymmetricTensorAccessors::double_contraction_result::type operator * (const SymmetricTensor<4,dim,Number> &s) const; @@ -882,19 +882,19 @@ class SymmetricTensor internal::SymmetricTensorAccessors::Accessor operator [] (const unsigned int row); - /** - * Access to an element where you - * specify the entire set of - * indices. - */ + /** + * Access to an element where you + * specify the entire set of + * indices. + */ Number operator [] (const TableIndices &indices) const; - /** - * Access to an element where you - * specify the entire set of - * indices. - */ + /** + * Access to an element where you + * specify the entire set of + * indices. + */ Number & operator [] (const TableIndices &indices); @@ -915,62 +915,62 @@ class SymmetricTensor */ Number norm () const; - /** - * Tensors can be unrolled by - * simply pasting all elements - * into one long vector, but for - * this an order of elements has - * to be defined. For symmetric - * tensors, this function returns - * which index within the range - * [0,n_independent_components) - * the given entry in a symmetric - * tensor has. - */ + /** + * Tensors can be unrolled by + * simply pasting all elements + * into one long vector, but for + * this an order of elements has + * to be defined. For symmetric + * tensors, this function returns + * which index within the range + * [0,n_independent_components) + * the given entry in a symmetric + * tensor has. + */ static unsigned int component_to_unrolled_index (const TableIndices &indices); - /** - * The opposite of the previous - * function: given an index $i$ - * in the unrolled form of the - * tensor, return what set of - * indices $(k,l)$ (for rank-2 - * tensors) or $(k,l,m,n)$ (for - * rank-4 tensors) corresponds to - * it. - */ + /** + * The opposite of the previous + * function: given an index $i$ + * in the unrolled form of the + * tensor, return what set of + * indices $(k,l)$ (for rank-2 + * tensors) or $(k,l,m,n)$ (for + * rank-4 tensors) corresponds to + * it. + */ static TableIndices unrolled_to_component_indices (const unsigned int i); - /** - * Reset all values to zero. - * - * Note that this is partly inconsistent - * with the semantics of the @p clear() - * member functions of the STL and of - * several other classes within deal.II - * which not only reset the values of - * stored elements to zero, but release - * all memory and return the object into - * a virginial state. However, since the - * size of objects of the present type is - * determined by its template parameters, - * resizing is not an option, and indeed - * the state where all elements have a - * zero value is the state right after - * construction of such an object. - */ + /** + * Reset all values to zero. + * + * Note that this is partly inconsistent + * with the semantics of the @p clear() + * member functions of the STL and of + * several other classes within deal.II + * which not only reset the values of + * stored elements to zero, but release + * all memory and return the object into + * a virginial state. However, since the + * size of objects of the present type is + * determined by its template parameters, + * resizing is not an option, and indeed + * the state where all elements have a + * zero value is the state right after + * construction of such an object. + */ void clear (); - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. + */ static std::size_t memory_consumption (); /** @@ -981,10 +981,10 @@ class SymmetricTensor void serialize(Archive & ar, const unsigned int version); private: - /** - * A structure that describes - * properties of the base tensor. - */ + /** + * A structure that describes + * properties of the base tensor. + */ typedef internal::SymmetricTensorAccessors::StorageType base_tensor_descriptor; @@ -995,20 +995,20 @@ class SymmetricTensor */ typedef typename base_tensor_descriptor::base_tensor_type base_tensor_type; - /** - * The place where we store the - * data of the tensor. - */ + /** + * The place where we store the + * data of the tensor. + */ base_tensor_type data; - /** - * Make all other symmetric tensors friends. - */ + /** + * Make all other symmetric tensors friends. + */ template friend class SymmetricTensor; - /** - * Make a few more functions friends. - */ + /** + * Make a few more functions friends. + */ template friend Number2 trace (const SymmetricTensor<2,dim2,Number2> &d); @@ -1045,10 +1045,10 @@ namespace internal template Accessor:: Accessor (tensor_type &tensor, - const TableIndices &previous_indices) - : - tensor (tensor), - previous_indices (previous_indices) + const TableIndices &previous_indices) + : + tensor (tensor), + previous_indices (previous_indices) {} @@ -1058,7 +1058,7 @@ namespace internal Accessor::operator[] (const unsigned int i) { return Accessor (tensor, - merge (previous_indices, i, rank-P)); + merge (previous_indices, i, rank-P)); } @@ -1066,10 +1066,10 @@ namespace internal template Accessor:: Accessor (tensor_type &tensor, - const TableIndices &previous_indices) - : - tensor (tensor), - previous_indices (previous_indices) + const TableIndices &previous_indices) + : + tensor (tensor), + previous_indices (previous_indices) {} @@ -1132,8 +1132,8 @@ SymmetricTensor::SymmetricTensor (const Tensor<2,dim,Number> &t template inline SymmetricTensor::SymmetricTensor (const Number (&array) [internal::SymmetricTensorAccessors::StorageType::n_independent_components]) - : - data (array) + : + data (array) {} @@ -1163,8 +1163,8 @@ SymmetricTensor::operator = (const Number d) - // helper function to convert symmetric tensor - // to generic tensor + // helper function to convert symmetric tensor + // to generic tensor namespace internal { template @@ -1182,7 +1182,7 @@ namespace internal conversion (const Tensor<1,3,Number> &data) { const Number t[2][2] = {{data[0], data[2]}, - {data[2], data[1]}}; + {data[2], data[1]}}; return Tensor<2,2,Number>(t); } @@ -1192,8 +1192,8 @@ namespace internal conversion (const Tensor<1,6,Number> &data) { const Number t[3][3] = {{data[0], data[3], data[4]}, - {data[3], data[1], data[5]}, - {data[4], data[5], data[2]}}; + {data[3], data[1], data[5]}, + {data[4], data[5], data[2]}}; return Tensor<2,3,Number>(t); } } @@ -1343,30 +1343,30 @@ namespace internal inline typename SymmetricTensorAccessors::double_contraction_result<2,2,dim,Number>::type perform_double_contraction (const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &data, - const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &sdata) + const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &sdata) { switch (dim) { case 1: - return data[0] * sdata[0]; + return data[0] * sdata[0]; case 2: - return (data[0] * sdata[0] + - data[1] * sdata[1] + - 2*data[2] * sdata[2]); + return (data[0] * sdata[0] + + data[1] * sdata[1] + + 2*data[2] * sdata[2]); case 3: - return (data[0] * sdata[0] + - data[1] * sdata[1] + - data[2] * sdata[2] + - 2*data[3] * sdata[3] + - 2*data[4] * sdata[4] + - 2*data[5] * sdata[5]); + return (data[0] * sdata[0] + + data[1] * sdata[1] + + data[2] * sdata[2] + + 2*data[3] * sdata[3] + + 2*data[4] * sdata[4] + + 2*data[5] * sdata[5]); default: - Number sum = 0; - for (unsigned int d=0; d::type perform_double_contraction (const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &data, - const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &sdata) + const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &sdata) { Number tmp [SymmetricTensorAccessors::StorageType<2,dim,Number>::n_independent_components]; switch (dim) { case 1: - tmp[0] = data[0][0] * sdata[0]; - break; + tmp[0] = data[0][0] * sdata[0]; + break; case 2: - for (unsigned int i=0; i<3; ++i) - tmp[i] = (data[i][0] * sdata[0] + - data[i][1] * sdata[1] + - 2 * data[i][2] * sdata[2]); - break; + for (unsigned int i=0; i<3; ++i) + tmp[i] = (data[i][0] * sdata[0] + + data[i][1] * sdata[1] + + 2 * data[i][2] * sdata[2]); + break; case 3: - for (unsigned int i=0; i<6; ++i) - tmp[i] = (data[i][0] * sdata[0] + - data[i][1] * sdata[1] + - data[i][2] * sdata[2] + - 2 * data[i][3] * sdata[3] + - 2 * data[i][4] * sdata[4] + - 2 * data[i][5] * sdata[5]); - break; + for (unsigned int i=0; i<6; ++i) + tmp[i] = (data[i][0] * sdata[0] + + data[i][1] * sdata[1] + + data[i][2] * sdata[2] + + 2 * data[i][3] * sdata[3] + + 2 * data[i][4] * sdata[4] + + 2 * data[i][5] * sdata[5]); + break; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } return SymmetricTensor<2,dim,Number>(tmp); } @@ -1411,31 +1411,31 @@ namespace internal inline typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type perform_double_contraction (const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &data, - const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &sdata) + const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &sdata) { typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type tmp; switch (dim) { case 1: - tmp[0] = data[0] * sdata[0][0]; - break; + tmp[0] = data[0] * sdata[0][0]; + break; case 2: - for (unsigned int i=0; i<3; ++i) - tmp[i] = (data[0] * sdata[0][i] + - data[1] * sdata[1][i] + - 2 * data[2] * sdata[2][i]); - break; + for (unsigned int i=0; i<3; ++i) + tmp[i] = (data[0] * sdata[0][i] + + data[1] * sdata[1][i] + + 2 * data[2] * sdata[2][i]); + break; case 3: - for (unsigned int i=0; i<6; ++i) - tmp[i] = (data[0] * sdata[0][i] + - data[1] * sdata[1][i] + - data[2] * sdata[2][i] + - 2 * data[3] * sdata[3][i] + - 2 * data[4] * sdata[4][i] + - 2 * data[5] * sdata[5][i]); - break; + for (unsigned int i=0; i<6; ++i) + tmp[i] = (data[0] * sdata[0][i] + + data[1] * sdata[1][i] + + data[2] * sdata[2][i] + + 2 * data[3] * sdata[3][i] + + 2 * data[4] * sdata[4][i] + + 2 * data[5] * sdata[5][i]); + break; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } return tmp; } @@ -1446,33 +1446,33 @@ namespace internal inline typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type perform_double_contraction (const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &data, - const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &sdata) + const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &sdata) { typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type tmp; switch (dim) { case 1: - tmp[0][0] = data[0][0] * sdata[0][0]; - break; + tmp[0][0] = data[0][0] * sdata[0][0]; + break; case 2: - for (unsigned int i=0; i<3; ++i) - for (unsigned int j=0; j<3; ++j) - tmp[i][j] = (data[i][0] * sdata[0][j] + - data[i][1] * sdata[1][j] + - 2*data[i][2] * sdata[2][j]); - break; + for (unsigned int i=0; i<3; ++i) + for (unsigned int j=0; j<3; ++j) + tmp[i][j] = (data[i][0] * sdata[0][j] + + data[i][1] * sdata[1][j] + + 2*data[i][2] * sdata[2][j]); + break; case 3: - for (unsigned int i=0; i<6; ++i) - for (unsigned int j=0; j<6; ++j) - tmp[i][j] = (data[i][0] * sdata[0][j] + - data[i][1] * sdata[1][j] + - data[i][2] * sdata[2][j] + - 2*data[i][3] * sdata[3][j] + - 2*data[i][4] * sdata[4][j] + - 2*data[i][5] * sdata[5][j]); - break; + for (unsigned int i=0; i<6; ++i) + for (unsigned int j=0; j<6; ++j) + tmp[i][j] = (data[i][0] * sdata[0][j] + + data[i][1] * sdata[1][j] + + data[i][2] * sdata[2][j] + + 2*data[i][3] * sdata[3][j] + + 2*data[i][4] * sdata[4][j] + + 2*data[i][5] * sdata[5][j]); + break; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } return tmp; } @@ -1486,10 +1486,10 @@ inline typename internal::SymmetricTensorAccessors::double_contraction_result::type SymmetricTensor::operator * (const SymmetricTensor<2,dim,Number> &s) const { - // need to have two different function calls - // because a scalar and rank-2 tensor are not - // the same data type (see internal function - // above) + // need to have two different function calls + // because a scalar and rank-2 tensor are not + // the same data type (see internal function + // above) return internal::perform_double_contraction (data, s.data); } @@ -1508,65 +1508,65 @@ SymmetricTensor::operator * (const SymmetricTensor<4,dim,Number - // internal namespace to switch between the - // access of different tensors. There used to - // be explicit instantiations before for - // different ranks and dimensions, but since - // we now allow for templates on the data - // type, and since we cannot partially - // specialize the implementation, this got - // into a separate namespace + // internal namespace to switch between the + // access of different tensors. There used to + // be explicit instantiations before for + // different ranks and dimensions, but since + // we now allow for templates on the data + // type, and since we cannot partially + // specialize the implementation, this got + // into a separate namespace namespace internal { template inline Number & symmetric_tensor_access (const TableIndices<2> &indices, - typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &data) + typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &data) { switch (dim) { case 1: - return data[0]; + return data[0]; case 2: // first treat the main diagonal // elements, which are stored // consecutively at the beginning - if (indices[0] == indices[1]) - return data[indices[0]]; + if (indices[0] == indices[1]) + return data[indices[0]]; // the rest is messier and requires a few // switches. at least for the 2x2 case it // is reasonably simple - Assert (((indices[0]==1) && (indices[1]==0)) || - ((indices[0]==0) && (indices[1]==1)), - ExcInternalError()); - return data[2]; + Assert (((indices[0]==1) && (indices[1]==0)) || + ((indices[0]==0) && (indices[1]==1)), + ExcInternalError()); + return data[2]; case 3: // first treat the main diagonal // elements, which are stored // consecutively at the beginning - if (indices[0] == indices[1]) - return data[indices[0]]; + if (indices[0] == indices[1]) + return data[indices[0]]; // the rest is messier and requires a few // switches, but simpler if we just sort // our indices - { - TableIndices<2> sorted_indices (indices); - sorted_indices.sort (); - - if ((sorted_indices[0]==0) && (sorted_indices[1]==1)) - return data[3]; - else if ((sorted_indices[0]==0) && (sorted_indices[1]==2)) - return data[4]; - else if ((sorted_indices[0]==1) && (sorted_indices[1]==2)) - return data[5]; - else - Assert (false, ExcInternalError()); - } + { + TableIndices<2> sorted_indices (indices); + sorted_indices.sort (); + + if ((sorted_indices[0]==0) && (sorted_indices[1]==1)) + return data[3]; + else if ((sorted_indices[0]==0) && (sorted_indices[1]==2)) + return data[4]; + else if ((sorted_indices[0]==1) && (sorted_indices[1]==2)) + return data[5]; + else + Assert (false, ExcInternalError()); + } } static Number dummy_but_referenceable = 0; @@ -1579,51 +1579,51 @@ namespace internal inline Number symmetric_tensor_access (const TableIndices<2> &indices, - const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &data) + const typename SymmetricTensorAccessors::StorageType<2,dim,Number>::base_tensor_type &data) { switch (dim) { case 1: - return data[0]; + return data[0]; case 2: // first treat the main diagonal // elements, which are stored // consecutively at the beginning - if (indices[0] == indices[1]) - return data[indices[0]]; + if (indices[0] == indices[1]) + return data[indices[0]]; // the rest is messier and requires a few // switches. at least for the 2x2 case it // is reasonably simple - Assert (((indices[0]==1) && (indices[1]==0)) || - ((indices[0]==0) && (indices[1]==1)), - ExcInternalError()); - return data[2]; + Assert (((indices[0]==1) && (indices[1]==0)) || + ((indices[0]==0) && (indices[1]==1)), + ExcInternalError()); + return data[2]; case 3: // first treat the main diagonal // elements, which are stored // consecutively at the beginning - if (indices[0] == indices[1]) - return data[indices[0]]; + if (indices[0] == indices[1]) + return data[indices[0]]; // the rest is messier and requires a few // switches, but simpler if we just sort // our indices - { - TableIndices<2> sorted_indices (indices); - sorted_indices.sort (); - - if ((sorted_indices[0]==0) && (sorted_indices[1]==1)) - return data[3]; - else if ((sorted_indices[0]==0) && (sorted_indices[1]==2)) - return data[4]; - else if ((sorted_indices[0]==1) && (sorted_indices[1]==2)) - return data[5]; - else - Assert (false, ExcInternalError()); - } + { + TableIndices<2> sorted_indices (indices); + sorted_indices.sort (); + + if ((sorted_indices[0]==0) && (sorted_indices[1]==1)) + return data[3]; + else if ((sorted_indices[0]==0) && (sorted_indices[1]==2)) + return data[4]; + else if ((sorted_indices[0]==1) && (sorted_indices[1]==2)) + return data[5]; + else + Assert (false, ExcInternalError()); + } } static Number dummy_but_referenceable = 0; @@ -1636,99 +1636,99 @@ namespace internal inline Number & symmetric_tensor_access (const TableIndices<4> &indices, - typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &data) + typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &data) { switch (dim) { - case 1: - return data[0][0]; - - case 2: - // each entry of the tensor can be - // thought of as an entry in a - // matrix that maps the rolled-out - // rank-2 tensors into rolled-out - // rank-2 tensors. this is the - // format in which we store rank-4 - // tensors. determine which - // position the present entry is - // stored in - { - unsigned int base_index[2] ; - if ((indices[0] == 0) && (indices[1] == 0)) - base_index[0] = 0; - else if ((indices[0] == 1) && (indices[1] == 1)) - base_index[0] = 1; - else - base_index[0] = 2; - - if ((indices[2] == 0) && (indices[3] == 0)) - base_index[1] = 0; - else if ((indices[2] == 1) && (indices[3] == 1)) - base_index[1] = 1; - else - base_index[1] = 2; - - return data[base_index[0]][base_index[1]]; - } - - case 3: - // each entry of the tensor can be - // thought of as an entry in a - // matrix that maps the rolled-out - // rank-2 tensors into rolled-out - // rank-2 tensors. this is the - // format in which we store rank-4 - // tensors. determine which - // position the present entry is - // stored in - { - unsigned int base_index[2] ; - if ((indices[0] == 0) && (indices[1] == 0)) - base_index[0] = 0; - else if ((indices[0] == 1) && (indices[1] == 1)) - base_index[0] = 1; - else if ((indices[0] == 2) && (indices[1] == 2)) - base_index[0] = 2; - else if (((indices[0] == 0) && (indices[1] == 1)) || - ((indices[0] == 1) && (indices[1] == 0))) - base_index[0] = 3; - else if (((indices[0] == 0) && (indices[1] == 2)) || - ((indices[0] == 2) && (indices[1] == 0))) - base_index[0] = 4; - else - { - Assert (((indices[0] == 1) && (indices[1] == 2)) || - ((indices[0] == 2) && (indices[1] == 1)), - ExcInternalError()); - base_index[0] = 5; - } - - if ((indices[2] == 0) && (indices[3] == 0)) - base_index[1] = 0; - else if ((indices[2] == 1) && (indices[3] == 1)) - base_index[1] = 1; - else if ((indices[2] == 2) && (indices[3] == 2)) - base_index[1] = 2; - else if (((indices[2] == 0) && (indices[3] == 1)) || - ((indices[2] == 1) && (indices[3] == 0))) - base_index[1] = 3; - else if (((indices[2] == 0) && (indices[3] == 2)) || - ((indices[2] == 2) && (indices[3] == 0))) - base_index[1] = 4; - else - { - Assert (((indices[2] == 1) && (indices[3] == 2)) || - ((indices[2] == 2) && (indices[3] == 1)), - ExcInternalError()); - base_index[1] = 5; - } - - return data[base_index[0]][base_index[1]]; - } - - default: - Assert (false, ExcNotImplemented()); + case 1: + return data[0][0]; + + case 2: + // each entry of the tensor can be + // thought of as an entry in a + // matrix that maps the rolled-out + // rank-2 tensors into rolled-out + // rank-2 tensors. this is the + // format in which we store rank-4 + // tensors. determine which + // position the present entry is + // stored in + { + unsigned int base_index[2] ; + if ((indices[0] == 0) && (indices[1] == 0)) + base_index[0] = 0; + else if ((indices[0] == 1) && (indices[1] == 1)) + base_index[0] = 1; + else + base_index[0] = 2; + + if ((indices[2] == 0) && (indices[3] == 0)) + base_index[1] = 0; + else if ((indices[2] == 1) && (indices[3] == 1)) + base_index[1] = 1; + else + base_index[1] = 2; + + return data[base_index[0]][base_index[1]]; + } + + case 3: + // each entry of the tensor can be + // thought of as an entry in a + // matrix that maps the rolled-out + // rank-2 tensors into rolled-out + // rank-2 tensors. this is the + // format in which we store rank-4 + // tensors. determine which + // position the present entry is + // stored in + { + unsigned int base_index[2] ; + if ((indices[0] == 0) && (indices[1] == 0)) + base_index[0] = 0; + else if ((indices[0] == 1) && (indices[1] == 1)) + base_index[0] = 1; + else if ((indices[0] == 2) && (indices[1] == 2)) + base_index[0] = 2; + else if (((indices[0] == 0) && (indices[1] == 1)) || + ((indices[0] == 1) && (indices[1] == 0))) + base_index[0] = 3; + else if (((indices[0] == 0) && (indices[1] == 2)) || + ((indices[0] == 2) && (indices[1] == 0))) + base_index[0] = 4; + else + { + Assert (((indices[0] == 1) && (indices[1] == 2)) || + ((indices[0] == 2) && (indices[1] == 1)), + ExcInternalError()); + base_index[0] = 5; + } + + if ((indices[2] == 0) && (indices[3] == 0)) + base_index[1] = 0; + else if ((indices[2] == 1) && (indices[3] == 1)) + base_index[1] = 1; + else if ((indices[2] == 2) && (indices[3] == 2)) + base_index[1] = 2; + else if (((indices[2] == 0) && (indices[3] == 1)) || + ((indices[2] == 1) && (indices[3] == 0))) + base_index[1] = 3; + else if (((indices[2] == 0) && (indices[3] == 2)) || + ((indices[2] == 2) && (indices[3] == 0))) + base_index[1] = 4; + else + { + Assert (((indices[2] == 1) && (indices[3] == 2)) || + ((indices[2] == 2) && (indices[3] == 1)), + ExcInternalError()); + base_index[1] = 5; + } + + return data[base_index[0]][base_index[1]]; + } + + default: + Assert (false, ExcNotImplemented()); } static Number dummy; @@ -1740,99 +1740,99 @@ namespace internal inline Number symmetric_tensor_access (const TableIndices<4> &indices, - const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &data) + const typename SymmetricTensorAccessors::StorageType<4,dim,Number>::base_tensor_type &data) { switch (dim) { case 1: - return data[0][0]; + return data[0][0]; case 2: - // each entry of the tensor can be - // thought of as an entry in a - // matrix that maps the rolled-out - // rank-2 tensors into rolled-out - // rank-2 tensors. this is the - // format in which we store rank-4 - // tensors. determine which - // position the present entry is - // stored in - { - unsigned int base_index[2] ; - if ((indices[0] == 0) && (indices[1] == 0)) - base_index[0] = 0; - else if ((indices[0] == 1) && (indices[1] == 1)) - base_index[0] = 1; - else - base_index[0] = 2; - - if ((indices[2] == 0) && (indices[3] == 0)) - base_index[1] = 0; - else if ((indices[2] == 1) && (indices[3] == 1)) - base_index[1] = 1; - else - base_index[1] = 2; - - return data[base_index[0]][base_index[1]]; - } + // each entry of the tensor can be + // thought of as an entry in a + // matrix that maps the rolled-out + // rank-2 tensors into rolled-out + // rank-2 tensors. this is the + // format in which we store rank-4 + // tensors. determine which + // position the present entry is + // stored in + { + unsigned int base_index[2] ; + if ((indices[0] == 0) && (indices[1] == 0)) + base_index[0] = 0; + else if ((indices[0] == 1) && (indices[1] == 1)) + base_index[0] = 1; + else + base_index[0] = 2; + + if ((indices[2] == 0) && (indices[3] == 0)) + base_index[1] = 0; + else if ((indices[2] == 1) && (indices[3] == 1)) + base_index[1] = 1; + else + base_index[1] = 2; + + return data[base_index[0]][base_index[1]]; + } case 3: - // each entry of the tensor can be - // thought of as an entry in a - // matrix that maps the rolled-out - // rank-2 tensors into rolled-out - // rank-2 tensors. this is the - // format in which we store rank-4 - // tensors. determine which - // position the present entry is - // stored in - { - unsigned int base_index[2] ; - if ((indices[0] == 0) && (indices[1] == 0)) - base_index[0] = 0; - else if ((indices[0] == 1) && (indices[1] == 1)) - base_index[0] = 1; - else if ((indices[0] == 2) && (indices[1] == 2)) - base_index[0] = 2; - else if (((indices[0] == 0) && (indices[1] == 1)) || - ((indices[0] == 1) && (indices[1] == 0))) - base_index[0] = 3; - else if (((indices[0] == 0) && (indices[1] == 2)) || - ((indices[0] == 2) && (indices[1] == 0))) - base_index[0] = 4; - else - { - Assert (((indices[0] == 1) && (indices[1] == 2)) || - ((indices[0] == 2) && (indices[1] == 1)), - ExcInternalError()); - base_index[0] = 5; - } - - if ((indices[2] == 0) && (indices[3] == 0)) - base_index[1] = 0; - else if ((indices[2] == 1) && (indices[3] == 1)) - base_index[1] = 1; - else if ((indices[2] == 2) && (indices[3] == 2)) - base_index[1] = 2; - else if (((indices[2] == 0) && (indices[3] == 1)) || - ((indices[2] == 1) && (indices[3] == 0))) - base_index[1] = 3; - else if (((indices[2] == 0) && (indices[3] == 2)) || - ((indices[2] == 2) && (indices[3] == 0))) - base_index[1] = 4; - else - { - Assert (((indices[2] == 1) && (indices[3] == 2)) || - ((indices[2] == 2) && (indices[3] == 1)), - ExcInternalError()); - base_index[1] = 5; - } - - return data[base_index[0]][base_index[1]]; - } - - default: - Assert (false, ExcNotImplemented()); + // each entry of the tensor can be + // thought of as an entry in a + // matrix that maps the rolled-out + // rank-2 tensors into rolled-out + // rank-2 tensors. this is the + // format in which we store rank-4 + // tensors. determine which + // position the present entry is + // stored in + { + unsigned int base_index[2] ; + if ((indices[0] == 0) && (indices[1] == 0)) + base_index[0] = 0; + else if ((indices[0] == 1) && (indices[1] == 1)) + base_index[0] = 1; + else if ((indices[0] == 2) && (indices[1] == 2)) + base_index[0] = 2; + else if (((indices[0] == 0) && (indices[1] == 1)) || + ((indices[0] == 1) && (indices[1] == 0))) + base_index[0] = 3; + else if (((indices[0] == 0) && (indices[1] == 2)) || + ((indices[0] == 2) && (indices[1] == 0))) + base_index[0] = 4; + else + { + Assert (((indices[0] == 1) && (indices[1] == 2)) || + ((indices[0] == 2) && (indices[1] == 1)), + ExcInternalError()); + base_index[0] = 5; + } + + if ((indices[2] == 0) && (indices[3] == 0)) + base_index[1] = 0; + else if ((indices[2] == 1) && (indices[3] == 1)) + base_index[1] = 1; + else if ((indices[2] == 2) && (indices[3] == 2)) + base_index[1] = 2; + else if (((indices[2] == 0) && (indices[3] == 1)) || + ((indices[2] == 1) && (indices[3] == 0))) + base_index[1] = 3; + else if (((indices[2] == 0) && (indices[3] == 2)) || + ((indices[2] == 2) && (indices[3] == 0))) + base_index[1] = 4; + else + { + Assert (((indices[2] == 1) && (indices[3] == 2)) || + ((indices[2] == 2) && (indices[3] == 1)), + ExcInternalError()); + base_index[1] = 5; + } + + return data[base_index[0]][base_index[1]]; + } + + default: + Assert (false, ExcNotImplemented()); } static Number dummy; @@ -1921,24 +1921,24 @@ namespace internal switch (dim) { case 1: - return_value = std::fabs(data[0]); - break; + return_value = std::fabs(data[0]); + break; case 2: - return_value = std::sqrt(data[0]*data[0] + data[1]*data[1] + - 2*data[2]*data[2]); - break; + return_value = std::sqrt(data[0]*data[0] + data[1]*data[1] + + 2*data[2]*data[2]); + break; case 3: - return_value = std::sqrt(data[0]*data[0] + data[1]*data[1] + - data[2]*data[2] + 2*data[3]*data[3] + - 2*data[4]*data[4] + 2*data[5]*data[5]); - break; + return_value = std::sqrt(data[0]*data[0] + data[1]*data[1] + + data[2]*data[2] + 2*data[3]*data[3] + + 2*data[4]*data[4] + 2*data[5]*data[5]); + break; default: - return_value = 0; - for (unsigned int d=0; d::component_to_unrolled_index return 0; case 2: { - static const unsigned int table[2][2] = {{0, 2}, - {2, 1}}; - return table[indices[0]][indices[1]]; + static const unsigned int table[2][2] = {{0, 2}, + {2, 1}}; + return table[indices[0]][indices[1]]; } case 3: { - static const unsigned int table[3][3] = {{0, 3, 4}, - {3, 1, 5}, - {4, 5, 2}}; - return table[indices[0]][indices[1]]; + static const unsigned int table[3][3] = {{0, 3, 4}, + {3, 1, 5}, + {4, 5, 2}}; + return table[indices[0]][indices[1]]; } case 4: { - static const unsigned int table[4][4] = {{0, 4, 5, 6}, - {4, 1, 7, 8}, - {5, 7, 2, 9}, - {6, 8, 9, 3}}; - return table[indices[0]][indices[1]]; + static const unsigned int table[4][4] = {{0, 4, 5, 6}, + {4, 1, 7, 8}, + {5, 7, 2, 9}, + {6, 8, 9, 3}}; + return table[indices[0]][indices[1]]; } default: Assert (false, ExcNotImplemented()); @@ -2049,22 +2049,22 @@ SymmetricTensor::unrolled_to_component_indices return TableIndices<2>(0,0); case 2: { - static const TableIndices<2> table[3] = - { TableIndices<2> (0,0), - TableIndices<2> (1,1), - TableIndices<2> (0,1) }; - return table[i]; + static const TableIndices<2> table[3] = + { TableIndices<2> (0,0), + TableIndices<2> (1,1), + TableIndices<2> (0,1) }; + return table[i]; } case 3: { - static const TableIndices<2> table[6] = - { TableIndices<2> (0,0), - TableIndices<2> (1,1), - TableIndices<2> (2,2), - TableIndices<2> (0,1), - TableIndices<2> (0,2), - TableIndices<2> (1,2) }; - return table[i]; + static const TableIndices<2> table[6] = + { TableIndices<2> (0,0), + TableIndices<2> (1,1), + TableIndices<2> (2,2), + TableIndices<2> (0,1), + TableIndices<2> (0,2), + TableIndices<2> (1,2) }; + return table[i]; } default: Assert (false, ExcNotImplemented()); @@ -2112,14 +2112,14 @@ Number determinant (const SymmetricTensor<2,dim,Number> &t) case 2: return (t.data[0] * t.data[1] - t.data[2]*t.data[2]); case 3: - // in analogy to general tensors, but - // there's something to be simplified for - // the present case + // in analogy to general tensors, but + // there's something to be simplified for + // the present case return ( t.data[0]*t.data[1]*t.data[2] - -t.data[0]*t.data[5]*t.data[5] - -t.data[1]*t.data[4]*t.data[4] - -t.data[2]*t.data[3]*t.data[3] - +2*t.data[3]*t.data[4]*t.data[5] ); + -t.data[0]*t.data[5]*t.data[5] + -t.data[1]*t.data[4]*t.data[4] + -t.data[2]*t.data[3]*t.data[3] + +2*t.data[3]*t.data[4]*t.data[5] ); default: Assert (false, ExcNotImplemented()); return 0; @@ -2225,7 +2225,7 @@ inline Number second_invariant (const SymmetricTensor<2,3,Number> &t) { return (t[0][0]*t[1][1] + t[1][1]*t[2][2] + t[2][2]*t[0][0] - - t[0][1]*t[0][1] - t[0][2]*t[0][2] - t[1][2]*t[1][2]); + - t[0][1]*t[0][1] - t[0][2]*t[0][2] - t[1][2]*t[1][2]); } @@ -2301,7 +2301,7 @@ unit_symmetric_tensor () break; default: for (unsigned int d=0; d &t) // corresponding to the left and right // multiplication with mult^-1 { - const Number t4 = t.data[0][0]*t.data[1][1], - t6 = t.data[0][0]*t.data[1][2], - t8 = t.data[0][1]*t.data[1][0], + const Number t4 = t.data[0][0]*t.data[1][1], + t6 = t.data[0][0]*t.data[1][2], + t8 = t.data[0][1]*t.data[1][0], t00 = t.data[0][2]*t.data[1][0], t01 = t.data[0][1]*t.data[2][0], t04 = t.data[0][2]*t.data[2][0], t07 = 1.0/(t4*t.data[2][2]-t6*t.data[2][1]- - t8*t.data[2][2]+t00*t.data[2][1]+ - t01*t.data[1][2]-t04*t.data[1][1]); - tmp.data[0][0] = (t.data[1][1]*t.data[2][2]-t.data[1][2]*t.data[2][1])*t07; - tmp.data[0][1] = -(t.data[0][1]*t.data[2][2]-t.data[0][2]*t.data[2][1])*t07; - tmp.data[0][2] = -(-t.data[0][1]*t.data[1][2]+t.data[0][2]*t.data[1][1])*t07; - tmp.data[1][0] = -(t.data[1][0]*t.data[2][2]-t.data[1][2]*t.data[2][0])*t07; - tmp.data[1][1] = (t.data[0][0]*t.data[2][2]-t04)*t07; - tmp.data[1][2] = -(t6-t00)*t07; - tmp.data[2][0] = -(-t.data[1][0]*t.data[2][1]+t.data[1][1]*t.data[2][0])*t07; - tmp.data[2][1] = -(t.data[0][0]*t.data[2][1]-t01)*t07; - tmp.data[2][2] = (t4-t8)*t07; + t8*t.data[2][2]+t00*t.data[2][1]+ + t01*t.data[1][2]-t04*t.data[1][1]); + tmp.data[0][0] = (t.data[1][1]*t.data[2][2]-t.data[1][2]*t.data[2][1])*t07; + tmp.data[0][1] = -(t.data[0][1]*t.data[2][2]-t.data[0][2]*t.data[2][1])*t07; + tmp.data[0][2] = -(-t.data[0][1]*t.data[1][2]+t.data[0][2]*t.data[1][1])*t07; + tmp.data[1][0] = -(t.data[1][0]*t.data[2][2]-t.data[1][2]*t.data[2][0])*t07; + tmp.data[1][1] = (t.data[0][0]*t.data[2][2]-t04)*t07; + tmp.data[1][2] = -(t6-t00)*t07; + tmp.data[2][0] = -(-t.data[1][0]*t.data[2][1]+t.data[1][1]*t.data[2][0])*t07; + tmp.data[2][1] = -(t.data[0][0]*t.data[2][1]-t01)*t07; + tmp.data[2][2] = (t4-t8)*t07; // scale last row and column as mentioned // above - tmp.data[2][0] /= 2; - tmp.data[2][1] /= 2; - tmp.data[0][2] /= 2; - tmp.data[1][2] /= 2; - tmp.data[2][2] /= 4; + tmp.data[2][0] /= 2; + tmp.data[2][1] /= 2; + tmp.data[0][2] /= 2; + tmp.data[1][2] /= 2; + tmp.data[2][2] /= 4; } break; default: @@ -2672,9 +2672,9 @@ symmetrize (const Tensor<2,3,Number> &t) { const Number array[6] = { t[0][0], t[1][1], t[2][2], - (t[0][1] + t[1][0])/2, - (t[0][2] + t[2][0])/2, - (t[1][2] + t[2][1])/2 }; + (t[0][1] + t[1][0])/2, + (t[0][2] + t[2][0])/2, + (t[1][2] + t[2][1])/2 }; return SymmetricTensor<2,3,Number>(array); } @@ -2690,7 +2690,7 @@ template inline SymmetricTensor operator * (const SymmetricTensor &t, - const Number factor) + const Number factor) { SymmetricTensor tt = t; tt *= factor; @@ -2709,7 +2709,7 @@ template inline SymmetricTensor operator * (const Number factor, - const SymmetricTensor &t) + const SymmetricTensor &t) { SymmetricTensor tt = t; tt *= factor; @@ -2727,7 +2727,7 @@ template inline SymmetricTensor operator / (const SymmetricTensor &t, - const Number factor) + const Number factor) { SymmetricTensor tt = t; tt /= factor; @@ -2746,7 +2746,7 @@ template inline SymmetricTensor operator * (const SymmetricTensor &t, - const double factor) + const double factor) { SymmetricTensor tt = t; tt *= factor; @@ -2765,7 +2765,7 @@ template inline SymmetricTensor operator * (const double factor, - const SymmetricTensor &t) + const SymmetricTensor &t) { SymmetricTensor tt = t; tt *= factor; @@ -2783,7 +2783,7 @@ template inline SymmetricTensor operator / (const SymmetricTensor &t, - const double factor) + const double factor) { SymmetricTensor tt = t; tt /= factor; @@ -2812,8 +2812,8 @@ template inline void double_contract (SymmetricTensor<2,1,Number> &tmp, - const SymmetricTensor<4,1,Number> &t, - const SymmetricTensor<2,1,Number> &s) + const SymmetricTensor<4,1,Number> &t, + const SymmetricTensor<2,1,Number> &s) { tmp[0][0] = t[0][0][0][0] * s[0][0]; } @@ -2839,8 +2839,8 @@ template inline void double_contract (SymmetricTensor<2,1,Number> &tmp, - const SymmetricTensor<2,1,Number> &s, - const SymmetricTensor<4,1,Number> &t) + const SymmetricTensor<2,1,Number> &s, + const SymmetricTensor<4,1,Number> &t) { tmp[0][0] = t[0][0][0][0] * s[0][0]; } @@ -2865,16 +2865,16 @@ template inline void double_contract (SymmetricTensor<2,2,Number> &tmp, - const SymmetricTensor<4,2,Number> &t, - const SymmetricTensor<2,2,Number> &s) + const SymmetricTensor<4,2,Number> &t, + const SymmetricTensor<2,2,Number> &s) { const unsigned int dim = 2; for (unsigned int i=0; i inline void double_contract (SymmetricTensor<2,2,Number> &tmp, - const SymmetricTensor<2,2,Number> &s, - const SymmetricTensor<4,2,Number> &t) + const SymmetricTensor<2,2,Number> &s, + const SymmetricTensor<4,2,Number> &t) { const unsigned int dim = 2; for (unsigned int i=0; i inline void double_contract (SymmetricTensor<2,3,Number> &tmp, - const SymmetricTensor<4,3,Number> &t, - const SymmetricTensor<2,3,Number> &s) + const SymmetricTensor<4,3,Number> &t, + const SymmetricTensor<2,3,Number> &s) { const unsigned int dim = 3; for (unsigned int i=0; i inline void double_contract (SymmetricTensor<2,3,Number> &tmp, - const SymmetricTensor<2,3,Number> &s, - const SymmetricTensor<4,3,Number> &t) + const SymmetricTensor<2,3,Number> &s, + const SymmetricTensor<4,3,Number> &t) { const unsigned int dim = 3; for (unsigned int i=0; i &src1, template inline std::ostream & operator << (std::ostream &out, - const SymmetricTensor<2,dim,Number> &t) + const SymmetricTensor<2,dim,Number> &t) { - //make out lives a bit simpler by outputing - //the tensor through the operator for the - //general Tensor class + //make out lives a bit simpler by outputing + //the tensor through the operator for the + //general Tensor class Tensor<2,dim,Number> tt; for (unsigned int i=0; i inline std::ostream & operator << (std::ostream &out, - const SymmetricTensor<4,dim,Number> &t) + const SymmetricTensor<4,dim,Number> &t) { - //make out lives a bit simpler by outputing - //the tensor through the operator for the - //general Tensor class + //make out lives a bit simpler by outputing + //the tensor through the operator for the + //general Tensor class Tensor<4,dim,Number> tt; for (unsigned int i=0; i struct SynchronousIterators { - /** - * Constructor. - */ + /** + * Constructor. + */ SynchronousIterators (const Iterators &i); - /** - * Copy constructor. - */ + /** + * Copy constructor. + */ SynchronousIterators (const SynchronousIterators &i); - /** - * Storage for the iterators - * represented by the current class. - */ + /** + * Storage for the iterators + * represented by the current class. + */ Iterators iterators; }; @@ -75,8 +75,8 @@ template inline SynchronousIterators:: SynchronousIterators (const Iterators &i) - : - iterators (i) + : + iterators (i) {} @@ -84,87 +84,87 @@ template inline SynchronousIterators:: SynchronousIterators (const SynchronousIterators &i) - : - iterators (i.iterators) + : + iterators (i.iterators) {} - /** - * Return whether the first element of - * the first argument is less than the - * first element of the second - * argument. Since the objects compared - * march forward all elements at the same - * time, comparing the first element is - * sufficient. - */ + /** + * Return whether the first element of + * the first argument is less than the + * first element of the second + * argument. Since the objects compared + * march forward all elements at the same + * time, comparing the first element is + * sufficient. + */ template inline bool operator< (const SynchronousIterators &a, - const SynchronousIterators &b) + const SynchronousIterators &b) { return std_cxx1x::get<0>(a.iterators) < std_cxx1x::get<0>(b.iterators); } - /** - * Return the distance between the first - * and the second argument. Since the - * objects compared march forward all - * elements at the same time, - * differencing the first element is - * sufficient. - */ + /** + * Return the distance between the first + * and the second argument. Since the + * objects compared march forward all + * elements at the same time, + * differencing the first element is + * sufficient. + */ template inline std::size_t operator- (const SynchronousIterators &a, - const SynchronousIterators &b) + const SynchronousIterators &b) { Assert (std::distance (std_cxx1x::get<0>(b.iterators), - std_cxx1x::get<0>(a.iterators)) >= 0, - ExcInternalError()); + std_cxx1x::get<0>(a.iterators)) >= 0, + ExcInternalError()); return std::distance (std_cxx1x::get<0>(b.iterators), - std_cxx1x::get<0>(a.iterators)); + std_cxx1x::get<0>(a.iterators)); } - /** - * Advance a tuple of iterators by $n$. - */ + /** + * Advance a tuple of iterators by $n$. + */ template inline void advance (std_cxx1x::tuple &t, - const unsigned int n) + const unsigned int n) { std::advance (std_cxx1x::get<0>(t), n); std::advance (std_cxx1x::get<1>(t), n); } - /** - * Advance a tuple of iterators by $n$. - */ + /** + * Advance a tuple of iterators by $n$. + */ template inline void advance (std_cxx1x::tuple &t, - const unsigned int n) + const unsigned int n) { std::advance (std_cxx1x::get<0>(t), n); std::advance (std_cxx1x::get<1>(t), n); std::advance (std_cxx1x::get<2>(t), n); } - /** - * Advance a tuple of iterators by $n$. - */ + /** + * Advance a tuple of iterators by $n$. + */ template + typename I3, typename I4> inline void advance (std_cxx1x::tuple &t, - const unsigned int n) + const unsigned int n) { std::advance (std_cxx1x::get<0>(t), n); std::advance (std_cxx1x::get<1>(t), n); @@ -174,9 +174,9 @@ void advance (std_cxx1x::tuple &t, - /** - * Advance a tuple of iterators by 1. - */ + /** + * Advance a tuple of iterators by 1. + */ template inline void advance_by_one (std_cxx1x::tuple &t) @@ -185,9 +185,9 @@ void advance_by_one (std_cxx1x::tuple &t) ++std_cxx1x::get<1>(t); } - /** - * Advance a tuple of iterators by 1. - */ + /** + * Advance a tuple of iterators by 1. + */ template inline void advance_by_one (std_cxx1x::tuple &t) @@ -197,11 +197,11 @@ void advance_by_one (std_cxx1x::tuple &t) ++std_cxx1x::get<2>(t); } - /** - * Advance a tuple of iterators by 1. - */ + /** + * Advance a tuple of iterators by 1. + */ template + typename I3, typename I4> inline void advance_by_one (std_cxx1x::tuple &t) { @@ -213,25 +213,25 @@ void advance_by_one (std_cxx1x::tuple &t) - /** - * Advance the elements of this iterator - * by $n$. - */ + /** + * Advance the elements of this iterator + * by $n$. + */ template inline SynchronousIterators operator + (const SynchronousIterators &a, - const std::size_t n) + const std::size_t n) { SynchronousIterators x (a); dealii::advance (x.iterators, n); return x; } - /** - * Advance the elements of this iterator - * by 1. - */ + /** + * Advance the elements of this iterator + * by 1. + */ template inline SynchronousIterators @@ -242,20 +242,20 @@ operator ++ (SynchronousIterators &a) } - /** - * Compare synch iterators for - * inequality. Since they march in synch, - * comparing only the first element is - * sufficient. - */ + /** + * Compare synch iterators for + * inequality. Since they march in synch, + * comparing only the first element is + * sufficient. + */ template inline bool operator != (const SynchronousIterators &a, - const SynchronousIterators &b) + const SynchronousIterators &b) { return (std_cxx1x::get<0>(a.iterators) != - std_cxx1x::get<0>(b.iterators)); + std_cxx1x::get<0>(b.iterators)); } DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/include/deal.II/base/table.h b/deal.II/include/deal.II/base/table.h index 971dbb2144..800b93d993 100644 --- a/deal.II/include/deal.II/base/table.h +++ b/deal.II/include/deal.II/base/table.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -182,11 +182,11 @@ namespace internal * sub-tables to functions as * arguments, as in * f(table[i]). - * - * Using this constructor is risky if - * accessors are stored longer than - * the table it points to. Don't do - * this. + * + * Using this constructor is risky if + * accessors are stored longer than + * the table it points to. Don't do + * this. */ Accessor (const Accessor &a); @@ -321,11 +321,11 @@ namespace internal * sub-tables to functions as * arguments, as in * f(table[i]). - * - * Using this constructor is risky if - * accessors are stored longer than - * the table it points to. Don't do - * this. + * + * Using this constructor is risky if + * accessors are stored longer than + * the table it points to. Don't do + * this. */ Accessor (const Accessor &a); @@ -531,9 +531,9 @@ class TableBase : public Subscriptor */ template TableBase& operator = (const TableBase &src); - + /** - * Test for equality of two tables. + * Test for equality of two tables. */ bool operator == (const TableBase & T2) const; @@ -556,12 +556,12 @@ class TableBase : public Subscriptor * touched. */ void reinit (const TableIndices &new_size, - const bool fast = false); + const bool fast = false); - /** - * Size of the table in direction - * i. - */ + /** + * Size of the table in direction + * i. + */ unsigned int size (const unsigned int i) const; /** @@ -614,10 +614,10 @@ class TableBase : public Subscriptor template void fill (const T2 *entries); - /** - * Fill all table entries with - * the same value. - */ + /** + * Fill all table entries with + * the same value. + */ void fill (const T& value); /** @@ -651,9 +651,9 @@ class TableBase : public Subscriptor std::size_t memory_consumption () const; /** - * Write or read the data of this object to or + * Write or read the data of this object to or * from a stream for the purpose of serialization. - */ + */ template void serialize (Archive & ar, const unsigned int version); @@ -699,10 +699,10 @@ class TableBase : public Subscriptor typename std::vector::const_reference el (const TableIndices &indices) const; /** - * @deprecated This function - * accesses data directly and - * should not be used! - * + * @deprecated This function + * accesses data directly and + * should not be used! + * * Direct read-only access to * data field. Used by * FullMatrix of the LAC @@ -724,10 +724,10 @@ class TableBase : public Subscriptor */ TableIndices table_size; - /** - * Make all other table classes - * friends. - */ + /** + * Make all other table classes + * friends. + */ template friend class TableBase; }; @@ -886,7 +886,7 @@ class Table<2,T> : public TableBase<2,T> */ void reinit (const unsigned int size1, const unsigned int size2, - const bool fast = false); + const bool fast = false); /** * Access operator. Generate an @@ -925,7 +925,7 @@ class Table<2,T> : public TableBase<2,T> */ typename std::vector::const_reference operator () (const unsigned int i, - const unsigned int j) const; + const unsigned int j) const; /** @@ -939,7 +939,7 @@ class Table<2,T> : public TableBase<2,T> */ typename std::vector::reference operator () (const unsigned int i, - const unsigned int j); + const unsigned int j); /** * Make the corresponding @@ -993,7 +993,7 @@ class Table<2,T> : public TableBase<2,T> * then called vector2d. */ typename std::vector::reference el (const unsigned int i, - const unsigned int j); + const unsigned int j); /** * Return the value of the @@ -1020,7 +1020,7 @@ class Table<2,T> : public TableBase<2,T> * then called vector2d. */ typename std::vector::const_reference el (const unsigned int i, - const unsigned int j) const; + const unsigned int j) const; }; @@ -1156,7 +1156,7 @@ class Table<4,T> : public TableBase<4,T> Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4); + const unsigned int size4); /** * Access operator. Generate an @@ -1198,7 +1198,7 @@ class Table<4,T> : public TableBase<4,T> typename std::vector::const_reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l) const; + const unsigned int l) const; /** @@ -1213,7 +1213,7 @@ class Table<4,T> : public TableBase<4,T> typename std::vector::reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l); + const unsigned int l); /** * Make the corresponding @@ -1264,8 +1264,8 @@ class Table<5,T> : public TableBase<5,T> Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4, - const unsigned int size5); + const unsigned int size4, + const unsigned int size5); /** * Access operator. Generate an @@ -1307,8 +1307,8 @@ class Table<5,T> : public TableBase<5,T> typename std::vector::const_reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m) const; + const unsigned int l, + const unsigned int m) const; /** * Direct access to one element @@ -1322,8 +1322,8 @@ class Table<5,T> : public TableBase<5,T> typename std::vector::reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m); + const unsigned int l, + const unsigned int m); /** * Make the corresponding @@ -1374,9 +1374,9 @@ class Table<6,T> : public TableBase<6,T> Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4, - const unsigned int size5, - const unsigned int size6); + const unsigned int size4, + const unsigned int size5, + const unsigned int size6); /** * Access operator. Generate an @@ -1418,9 +1418,9 @@ class Table<6,T> : public TableBase<6,T> typename std::vector::const_reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n) const; + const unsigned int l, + const unsigned int m, + const unsigned int n) const; /** * Direct access to one element @@ -1434,9 +1434,9 @@ class Table<6,T> : public TableBase<6,T> typename std::vector::reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n); + const unsigned int l, + const unsigned int m, + const unsigned int n); /** * Make the corresponding @@ -1486,10 +1486,10 @@ class Table<7,T> : public TableBase<7,T> Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4, - const unsigned int size5, - const unsigned int size6, - const unsigned int size7); + const unsigned int size4, + const unsigned int size5, + const unsigned int size6, + const unsigned int size7); /** * Access operator. Generate an @@ -1531,10 +1531,10 @@ class Table<7,T> : public TableBase<7,T> typename std::vector::const_reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n, - const unsigned int o) const; + const unsigned int l, + const unsigned int m, + const unsigned int n, + const unsigned int o) const; /** * Direct access to one element @@ -1548,10 +1548,10 @@ class Table<7,T> : public TableBase<7,T> typename std::vector::reference operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n, - const unsigned int o); + const unsigned int l, + const unsigned int m, + const unsigned int n, + const unsigned int o); /** * Make the corresponding @@ -1603,7 +1603,7 @@ class TransposeTable : public TableBase<2,T> * class. */ TransposeTable (const unsigned int size1, - const unsigned int size2); + const unsigned int size2); /** * Reinitialize the object. This @@ -1617,7 +1617,7 @@ class TransposeTable : public TableBase<2,T> */ void reinit (const unsigned int size1, const unsigned int size2, - const bool fast = false); + const bool fast = false); /** * Direct access to one element @@ -1757,7 +1757,7 @@ void TableBase::serialize (Archive & ar, const unsigned int) { ar & static_cast(*this); - + ar & values & table_size; } @@ -1941,7 +1941,7 @@ TableBase::operator = (const TableBase& m) reinit (m.size()); if (!empty()) std::copy (m.values.begin(), m.values.begin() + n_elements(), - values.begin()); + values.begin()); return *this; } @@ -1949,7 +1949,7 @@ TableBase::operator = (const TableBase& m) template inline -bool +bool TableBase::operator == (const TableBase & T2) const { return (values == T2.values); @@ -1984,7 +1984,7 @@ template inline void TableBase::reinit (const TableIndices &new_sizes, - const bool fast) + const bool fast) { table_size = new_sizes; @@ -2170,7 +2170,7 @@ typename std::vector::reference TableBase::el (const TableIndices &indices) { Assert (position(indices) < values.size(), - ExcIndexRange (position(indices), 0, values.size())); + ExcIndexRange (position(indices), 0, values.size())); return values[position(indices)]; } @@ -2297,7 +2297,7 @@ inline void Table<2,T>::reinit (const unsigned int size1, const unsigned int size2, - const bool fast) + const bool fast) { this->TableBase<2,T>::reinit (TableIndices<2> (size1, size2),fast); } @@ -2434,7 +2434,7 @@ TransposeTable::TransposeTable () template inline TransposeTable::TransposeTable (const unsigned int size1, - const unsigned int size2) + const unsigned int size2) : TableBase<2,T> (TableIndices<2> (size2, size1)) {} @@ -2445,8 +2445,8 @@ template inline void TransposeTable::reinit (const unsigned int size1, - const unsigned int size2, - const bool fast) + const unsigned int size2, + const bool fast) { this->TableBase<2,T>::reinit (TableIndices<2> (size2, size1),fast); } @@ -2457,7 +2457,7 @@ template inline typename std::vector::const_reference TransposeTable::operator () (const unsigned int i, - const unsigned int j) const + const unsigned int j) const { Assert (i < this->table_size[1], ExcIndexRange (i, 0, this->table_size[1])); @@ -2472,7 +2472,7 @@ template inline typename std::vector::reference TransposeTable::operator () (const unsigned int i, - const unsigned int j) + const unsigned int j) { Assert (i < this->table_size[1], ExcIndexRange (i, 0, this->table_size[1])); @@ -2487,7 +2487,7 @@ template inline typename std::vector::const_reference TransposeTable::el (const unsigned int i, - const unsigned int j) const + const unsigned int j) const { return this->values[j*this->table_size[1]+i]; } @@ -2498,7 +2498,7 @@ template inline typename std::vector::reference TransposeTable::el (const unsigned int i, - const unsigned int j) + const unsigned int j) { return this->values[j*this->table_size[1]+i]; } @@ -2648,7 +2648,7 @@ inline Table<4,T>::Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4) + const unsigned int size4) : TableBase<4,T> (TableIndices<4> (size1, size2, size3, size4)) {} @@ -2664,7 +2664,7 @@ Table<4,T>::operator [] (const unsigned int i) const ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3]; + this->table_size[3]; return (internal::TableBaseAccessors::Accessor<4,T,true,3> (*this, this->values.begin() + i*subobject_size)); @@ -2681,7 +2681,7 @@ Table<4,T>::operator [] (const unsigned int i) ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3]; + this->table_size[3]; return (internal::TableBaseAccessors::Accessor<4,T,false,3> (*this, this->values.begin() + i*subobject_size)); @@ -2695,7 +2695,7 @@ typename std::vector::const_reference Table<4,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l) const + const unsigned int l) const { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -2706,7 +2706,7 @@ Table<4,T>::operator () (const unsigned int i, Assert (l < this->table_size[3], ExcIndexRange (l, 0, this->table_size[3])); return this->values[((i*this->table_size[1]+j) - *this->table_size[2] + k) + *this->table_size[2] + k) *this->table_size[3] + l]; } @@ -2718,7 +2718,7 @@ typename std::vector::reference Table<4,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l) + const unsigned int l) { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -2729,7 +2729,7 @@ Table<4,T>::operator () (const unsigned int i, Assert (l < this->table_size[3], ExcIndexRange (l, 0, this->table_size[3])); return this->values[((i*this->table_size[1]+j) - *this->table_size[2] + k) + *this->table_size[2] + k) *this->table_size[3] + l]; } @@ -2767,8 +2767,8 @@ inline Table<5,T>::Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4, - const unsigned int size5) + const unsigned int size4, + const unsigned int size5) : TableBase<5,T> (TableIndices<5> (size1, size2, size3, size4, size5)) {} @@ -2784,8 +2784,8 @@ Table<5,T>::operator [] (const unsigned int i) const ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3] * - this->table_size[4]; + this->table_size[3] * + this->table_size[4]; return (internal::TableBaseAccessors::Accessor<5,T,true,4> (*this, this->values.begin() + i*subobject_size)); @@ -2802,8 +2802,8 @@ Table<5,T>::operator [] (const unsigned int i) ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3] * - this->table_size[4]; + this->table_size[3] * + this->table_size[4]; return (internal::TableBaseAccessors::Accessor<5,T,false,4> (*this, this->values.begin() + i*subobject_size)); @@ -2817,8 +2817,8 @@ typename std::vector::const_reference Table<5,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m) const + const unsigned int l, + const unsigned int m) const { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -2831,8 +2831,8 @@ Table<5,T>::operator () (const unsigned int i, Assert (m < this->table_size[4], ExcIndexRange (m, 0, this->table_size[4])); return this->values[(((i*this->table_size[1]+j) - *this->table_size[2] + k) - *this->table_size[3] + l) + *this->table_size[2] + k) + *this->table_size[3] + l) *this->table_size[4] + m]; } @@ -2844,8 +2844,8 @@ typename std::vector::reference Table<5,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m) + const unsigned int l, + const unsigned int m) { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -2858,8 +2858,8 @@ Table<5,T>::operator () (const unsigned int i, Assert (m < this->table_size[4], ExcIndexRange (m, 0, this->table_size[4])); return this->values[(((i*this->table_size[1]+j) - *this->table_size[2] + k) - *this->table_size[3] + l) + *this->table_size[2] + k) + *this->table_size[3] + l) *this->table_size[4] + m]; } @@ -2897,9 +2897,9 @@ inline Table<6,T>::Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4, - const unsigned int size5, - const unsigned int size6) + const unsigned int size4, + const unsigned int size5, + const unsigned int size6) : TableBase<6,T> (TableIndices<6> (size1, size2, size3, size4, size5, size6)) {} @@ -2915,9 +2915,9 @@ Table<6,T>::operator [] (const unsigned int i) const ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3] * - this->table_size[4] * - this->table_size[5]; + this->table_size[3] * + this->table_size[4] * + this->table_size[5]; return (internal::TableBaseAccessors::Accessor<6,T,true,5> (*this, this->values.begin() + i*subobject_size)); @@ -2934,9 +2934,9 @@ Table<6,T>::operator [] (const unsigned int i) ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3] * - this->table_size[4] * - this->table_size[5]; + this->table_size[3] * + this->table_size[4] * + this->table_size[5]; return (internal::TableBaseAccessors::Accessor<6,T,false,5> (*this, this->values.begin() + i*subobject_size)); @@ -2950,9 +2950,9 @@ typename std::vector::const_reference Table<6,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n) const + const unsigned int l, + const unsigned int m, + const unsigned int n) const { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -2967,9 +2967,9 @@ Table<6,T>::operator () (const unsigned int i, Assert (n < this->table_size[5], ExcIndexRange (n, 0, this->table_size[5])); return this->values[((((i*this->table_size[1]+j) - *this->table_size[2] + k) - *this->table_size[3] + l) - *this->table_size[4] + m) + *this->table_size[2] + k) + *this->table_size[3] + l) + *this->table_size[4] + m) *this->table_size[5] + n]; } @@ -2981,9 +2981,9 @@ typename std::vector::reference Table<6,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n) + const unsigned int l, + const unsigned int m, + const unsigned int n) { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -2998,9 +2998,9 @@ Table<6,T>::operator () (const unsigned int i, Assert (n < this->table_size[5], ExcIndexRange (n, 0, this->table_size[5])); return this->values[((((i*this->table_size[1]+j) - *this->table_size[2] + k) - *this->table_size[3] + l) - *this->table_size[4] + m) + *this->table_size[2] + k) + *this->table_size[3] + l) + *this->table_size[4] + m) *this->table_size[5] + n]; } @@ -3038,10 +3038,10 @@ inline Table<7,T>::Table (const unsigned int size1, const unsigned int size2, const unsigned int size3, - const unsigned int size4, - const unsigned int size5, - const unsigned int size6, - const unsigned int size7) + const unsigned int size4, + const unsigned int size5, + const unsigned int size6, + const unsigned int size7) : TableBase<7,T> (TableIndices<7> (size1, size2, size3, size4, size5, size6, size7)) {} @@ -3057,10 +3057,10 @@ Table<7,T>::operator [] (const unsigned int i) const ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3] * - this->table_size[4] * - this->table_size[5] * - this->table_size[6]; + this->table_size[3] * + this->table_size[4] * + this->table_size[5] * + this->table_size[6]; return (internal::TableBaseAccessors::Accessor<7,T,true,6> (*this, this->values.begin() + i*subobject_size)); @@ -3077,10 +3077,10 @@ Table<7,T>::operator [] (const unsigned int i) ExcIndexRange (i, 0, this->table_size[0])); const unsigned int subobject_size = this->table_size[1] * this->table_size[2] * - this->table_size[3] * - this->table_size[4] * - this->table_size[5] * - this->table_size[6]; + this->table_size[3] * + this->table_size[4] * + this->table_size[5] * + this->table_size[6]; return (internal::TableBaseAccessors::Accessor<7,T,false,6> (*this, this->values.begin() + i*subobject_size)); @@ -3094,10 +3094,10 @@ typename std::vector::const_reference Table<7,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n, - const unsigned int o) const + const unsigned int l, + const unsigned int m, + const unsigned int n, + const unsigned int o) const { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -3114,11 +3114,11 @@ Table<7,T>::operator () (const unsigned int i, Assert (o < this->table_size[6], ExcIndexRange (o, 0, this->table_size[6])); return this->values[(((((i*this->table_size[1]+j) - *this->table_size[2] + k) - *this->table_size[3] + l) - *this->table_size[4] + m) - *this->table_size[5] + n) - *this->table_size[6] + o]; + *this->table_size[2] + k) + *this->table_size[3] + l) + *this->table_size[4] + m) + *this->table_size[5] + n) + *this->table_size[6] + o]; } @@ -3129,10 +3129,10 @@ typename std::vector::reference Table<7,T>::operator () (const unsigned int i, const unsigned int j, const unsigned int k, - const unsigned int l, - const unsigned int m, - const unsigned int n, - const unsigned int o) + const unsigned int l, + const unsigned int m, + const unsigned int n, + const unsigned int o) { Assert (i < this->table_size[0], ExcIndexRange (i, 0, this->table_size[0])); @@ -3149,11 +3149,11 @@ Table<7,T>::operator () (const unsigned int i, Assert (o < this->table_size[5], ExcIndexRange (o, 0, this->table_size[6])); return this->values[(((((i*this->table_size[1]+j) - *this->table_size[2] + k) - *this->table_size[3] + l) - *this->table_size[4] + m) - *this->table_size[5] + n) - *this->table_size[6] + o]; + *this->table_size[2] + k) + *this->table_size[3] + l) + *this->table_size[4] + m) + *this->table_size[5] + n) + *this->table_size[6] + o]; } diff --git a/deal.II/include/deal.II/base/table_handler.h b/deal.II/include/deal.II/base/table_handler.h index 3e17bd60c1..034bd82542 100644 --- a/deal.II/include/deal.II/base/table_handler.h +++ b/deal.II/include/deal.II/base/table_handler.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -448,14 +448,14 @@ class TableHandler * add_value() function with an empty * string), then the entry of the table * is printed as "". - * - * The second argument indicates how - * column keys are to be displayed. See - * the description of TextOutputFormat - * for more information + * + * The second argument indicates how + * column keys are to be displayed. See + * the description of TextOutputFormat + * for more information */ void write_text (std::ostream &out, - const TextOutputFormat format = table_with_headers) const; + const TextOutputFormat format = table_with_headers) const; /** * Write table as a tex file. If @@ -472,15 +472,15 @@ class TableHandler void write_tex (std::ostream &file, const bool with_header=true) const; /** - * Read or write the data of this - * object to or from a stream for - * the purpose of serialization. - */ + * Read or write the data of this + * object to or from a stream for + * the purpose of serialization. + */ template void serialize(Archive & ar, const unsigned int version); - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ /** * Exception @@ -517,7 +517,7 @@ class TableHandler DeclException1 (ExcUndefinedTexFormat, std::string, << "<" << arg1 << "> is not a tex column format. Use l,c,r."); - //@} + //@} protected: /** @@ -537,27 +537,27 @@ class TableHandler */ Column (const std::string &tex_caption); - /** - * Pad this column with default constructed elements to the - * number of rows given by the argument. - */ - void pad_column_below (const unsigned int length); + /** + * Pad this column with default constructed elements to the + * number of rows given by the argument. + */ + void pad_column_below (const unsigned int length); - /** - * Read or write the data of this - * object to or from a stream for - * the purpose of serialization. - */ - template - void serialize(Archive & ar, const unsigned int version); + /** + * Read or write the data of this + * object to or from a stream for + * the purpose of serialization. + */ + template + void serialize(Archive & ar, const unsigned int version); /** * List of entries within * this column. Values are - * always immediately - * converted to strings to - * provide a uniform method - * of lookup. + * always immediately + * converted to strings to + * provide a uniform method + * of lookup. */ std::vector entries; @@ -604,13 +604,13 @@ class TableHandler * Flag that may be used by * derived classes for * arbitrary purposes. - * - * In particular, the - * ConvergenceTable class uses the - * flag to denote columns for which - * convergence information has - * already been computed, or should - * not be computed at all. + * + * In particular, the + * ConvergenceTable class uses the + * flag to denote columns for which + * convergence information has + * already been computed, or should + * not be computed at all. */ unsigned int flag; }; @@ -655,12 +655,12 @@ class TableHandler /** * Maps the column keys to the * columns (not supercolumns). - * - * The field is declared mutable so - * that the write_text() and write_tex() - * functions can be const, even though they - * may pad columns below if auto_fill_mode - * is on. + * + * The field is declared mutable so + * that the write_text() and write_tex() + * functions can be const, even though they + * may pad columns below if auto_fill_mode + * is on. */ mutable std::map columns; @@ -693,11 +693,11 @@ class TableHandler /** * The caption of the table itself. - */ + */ std::string tex_table_caption; /** * The label of the table. - */ + */ std::string tex_table_label; /** @@ -740,30 +740,30 @@ namespace internal template void TableEntry::save (Archive & ar, - const unsigned int) const + const unsigned int) const { - // write first an identifier for the kind - // of data stored and then the actual - // data, in its correct data type + // write first an identifier for the kind + // of data stored and then the actual + // data, in its correct data type if (const int *p = boost::get(&value)) { - char c = 'i'; - ar & c & *p; + char c = 'i'; + ar & c & *p; } else if (const unsigned int *p = boost::get(&value)) { - char c = 'u'; - ar & c & *p; + char c = 'u'; + ar & c & *p; } else if (const double *p = boost::get(&value)) { - char c = 'd'; - ar & c & *p; + char c = 'd'; + ar & c & *p; } else if (const std::string *p = boost::get(&value)) { - char c = 's'; - ar & c & *p; + char c = 's'; + ar & c & *p; } else Assert (false, ExcInternalError()); @@ -773,58 +773,58 @@ namespace internal template void TableEntry::load (Archive & ar, - const unsigned int) + const unsigned int) { - // following what we do in the save() - // function, first read in the data type - // as a one-character id, and then read - // the data + // following what we do in the save() + // function, first read in the data type + // as a one-character id, and then read + // the data char c; ar & c; switch (c) { - case 'i': - { - int val; - ar & val; - value = val; - break; - } - - case 'u': - { - unsigned int val; - ar & val; - value = val; - break; - } - - case 'd': - { - double val; - ar & val; - value = val; - break; - } - - case 's': - { - std::string val; - ar & val; - value = val; - break; - } - - default: - Assert (false, ExcInternalError()); + case 'i': + { + int val; + ar & val; + value = val; + break; + } + + case 'u': + { + unsigned int val; + ar & val; + value = val; + break; + } + + case 'd': + { + double val; + ar & val; + value = val; + break; + } + + case 's': + { + std::string val; + ar & val; + value = val; + break; + } + + default: + Assert (false, ExcInternalError()); } } } template void TableHandler::add_value (const std::string &key, - const T value) + const T value) { // see if the column already exists if (columns.find(key) == columns.end()) @@ -855,7 +855,7 @@ void TableHandler::add_value (const std::string &key, template void TableHandler::Column::serialize(Archive & ar, - const unsigned int) + const unsigned int) { ar & entries & tex_caption & tex_format & precision @@ -868,7 +868,7 @@ TableHandler::Column::serialize(Archive & ar, template void TableHandler::serialize(Archive & ar, - const unsigned int) + const unsigned int) { ar & column_order & columns & supercolumns & tex_supercaptions diff --git a/deal.II/include/deal.II/base/table_indices.h b/deal.II/include/deal.II/base/table_indices.h index 4c1fbd75f6..a5b99fc594 100644 --- a/deal.II/include/deal.II/base/table_indices.h +++ b/deal.II/include/deal.II/base/table_indices.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2005, 2006, 2009 by the deal.II authors +// Copyright (C) 2005, 2006, 2009, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -69,9 +69,9 @@ class TableIndicesBase void sort (); /** - * Write or read the data of this object to or + * Write or read the data of this object to or * from a stream for the purpose of serialization. - */ + */ template void serialize (Archive & ar, const unsigned int version); @@ -101,17 +101,17 @@ class TableIndicesBase template class TableIndices { - /** - * Standard constructor, setting - * all indices to zero. - */ + /** + * Standard constructor, setting + * all indices to zero. + */ TableIndices(); - /** - * The actual constructor, taking - * @p N arguments of type - * unsigned int to - * initialize the index object. - */ + /** + * The actual constructor, taking + * @p N arguments of type + * unsigned int to + * initialize the index object. + */ TableIndices(...); }; @@ -174,17 +174,17 @@ class TableIndices<2> : public TableIndicesBase<2> /** * Constructor. Set indices to * the given values. - * - * The default values for the - * second and subsequent - * arguments are necessary for - * some neat template tricks in - * SymmetricTensor where we only - * want to set the first index - * and construct the subsequent - * ones later on, i.e. for the - * moment we don't care about the - * later indices. + * + * The default values for the + * second and subsequent + * arguments are necessary for + * some neat template tricks in + * SymmetricTensor where we only + * want to set the first index + * and construct the subsequent + * ones later on, i.e. for the + * moment we don't care about the + * later indices. */ TableIndices (const unsigned int index1, const unsigned int index2 = numbers::invalid_unsigned_int); @@ -217,17 +217,17 @@ class TableIndices<3> : public TableIndicesBase<3> /** * Constructor. Set indices to * the given values. - * - * The default values for the - * second and subsequent - * arguments are necessary for - * some neat template tricks in - * SymmetricTensor where we only - * want to set the first index - * and construct the subsequent - * ones later on, i.e. for the - * moment we don't care about the - * later indices. + * + * The default values for the + * second and subsequent + * arguments are necessary for + * some neat template tricks in + * SymmetricTensor where we only + * want to set the first index + * and construct the subsequent + * ones later on, i.e. for the + * moment we don't care about the + * later indices. */ TableIndices (const unsigned int index1, const unsigned int index2 = numbers::invalid_unsigned_int, @@ -260,17 +260,17 @@ class TableIndices<4> : public TableIndicesBase<4> /** * Constructor. Set indices to * the given values. - * - * The default values for the - * second and subsequent - * arguments are necessary for - * some neat template tricks in - * SymmetricTensor where we only - * want to set the first index - * and construct the subsequent - * ones later on, i.e. for the - * moment we don't care about the - * later indices. + * + * The default values for the + * second and subsequent + * arguments are necessary for + * some neat template tricks in + * SymmetricTensor where we only + * want to set the first index + * and construct the subsequent + * ones later on, i.e. for the + * moment we don't care about the + * later indices. */ TableIndices (const unsigned int index1, const unsigned int index2 = numbers::invalid_unsigned_int, @@ -304,17 +304,17 @@ class TableIndices<5> : public TableIndicesBase<5> /** * Constructor. Set indices to * the given values. - * - * The default values for the - * second and subsequent - * arguments are necessary for - * some neat template tricks in - * SymmetricTensor where we only - * want to set the first index - * and construct the subsequent - * ones later on, i.e. for the - * moment we don't care about the - * later indices. + * + * The default values for the + * second and subsequent + * arguments are necessary for + * some neat template tricks in + * SymmetricTensor where we only + * want to set the first index + * and construct the subsequent + * ones later on, i.e. for the + * moment we don't care about the + * later indices. */ TableIndices (const unsigned int index1, const unsigned int index2 = numbers::invalid_unsigned_int, @@ -349,17 +349,17 @@ class TableIndices<6> : public TableIndicesBase<6> /** * Constructor. Set indices to * the given values. - * - * The default values for the - * second and subsequent - * arguments are necessary for - * some neat template tricks in - * SymmetricTensor where we only - * want to set the first index - * and construct the subsequent - * ones later on, i.e. for the - * moment we don't care about the - * later indices. + * + * The default values for the + * second and subsequent + * arguments are necessary for + * some neat template tricks in + * SymmetricTensor where we only + * want to set the first index + * and construct the subsequent + * ones later on, i.e. for the + * moment we don't care about the + * later indices. */ TableIndices (const unsigned int index1, const unsigned int index2 = numbers::invalid_unsigned_int, @@ -395,17 +395,17 @@ class TableIndices<7> : public TableIndicesBase<7> /** * Constructor. Set indices to * the given values. - * - * The default values for the - * second and subsequent - * arguments are necessary for - * some neat template tricks in - * SymmetricTensor where we only - * want to set the first index - * and construct the subsequent - * ones later on, i.e. for the - * moment we don't care about the - * later indices. + * + * The default values for the + * second and subsequent + * arguments are necessary for + * some neat template tricks in + * SymmetricTensor where we only + * want to set the first index + * and construct the subsequent + * ones later on, i.e. for the + * moment we don't care about the + * later indices. */ TableIndices (const unsigned int index1, const unsigned int index2 = numbers::invalid_unsigned_int, @@ -567,7 +567,7 @@ inline TableIndices<4>::TableIndices (const unsigned int index1, const unsigned int index2, const unsigned int index3, - const unsigned int index4) + const unsigned int index4) { this->indices[0] = index1; this->indices[1] = index2; @@ -592,8 +592,8 @@ inline TableIndices<5>::TableIndices (const unsigned int index1, const unsigned int index2, const unsigned int index3, - const unsigned int index4, - const unsigned int index5) + const unsigned int index4, + const unsigned int index5) { this->indices[0] = index1; this->indices[1] = index2; @@ -608,8 +608,8 @@ inline TableIndices<6>::TableIndices () { this->indices[0] = this->indices[1] = this->indices[2] - = this->indices[3] = this->indices[4] - = this->indices[5] = 0; + = this->indices[3] = this->indices[4] + = this->indices[5] = 0; } @@ -618,9 +618,9 @@ inline TableIndices<6>::TableIndices (const unsigned int index1, const unsigned int index2, const unsigned int index3, - const unsigned int index4, - const unsigned int index5, - const unsigned int index6) + const unsigned int index4, + const unsigned int index5, + const unsigned int index6) { this->indices[0] = index1; this->indices[1] = index2; @@ -636,8 +636,8 @@ inline TableIndices<7>::TableIndices () { this->indices[0] = this->indices[1] = this->indices[2] - = this->indices[3] = this->indices[4] - = this->indices[5] = this->indices[6] = 0; + = this->indices[3] = this->indices[4] + = this->indices[5] = this->indices[6] = 0; } @@ -646,10 +646,10 @@ inline TableIndices<7>::TableIndices (const unsigned int index1, const unsigned int index2, const unsigned int index3, - const unsigned int index4, - const unsigned int index5, - const unsigned int index6, - const unsigned int index7) + const unsigned int index4, + const unsigned int index5, + const unsigned int index6, + const unsigned int index7) { this->indices[0] = index1; this->indices[1] = index2; @@ -669,14 +669,14 @@ TableIndices<7>::TableIndices (const unsigned int index1, template std::ostream & operator << (std::ostream &o, - const TableIndices &indices) + const TableIndices &indices) { o << '['; for (unsigned int i=0; i struct constraint_and_return_value; * to the second template argument. It is used in order to construct * constraints on template arguments in template (and member template) * functions. The negative specialization is missing. - * + * * Here's how the trick works, called SFINAE (substitution failure is * not an error): The C++ standard prescribes that a template function * is only considered in a call, if all parts of its signature can be @@ -42,9 +42,9 @@ template struct constraint_and_return_value; * parameter T must be identified with the type "int". However, * the return type T::type does not exist. The trick now is * that this is not considered an error: this template is simply - * not considered, the compiler keeps on looking for another + * not considered, the compiler keeps on looking for another * possible function foo. - * + * * The idea is then to make the return type un-instantiatable if * certain constraints on the template types are not satisfied: * @verbatim @@ -75,7 +75,7 @@ template struct constraint_and_return_value; * the return type is just the second type in the template. * * @author Wolfgang Bangerth, 2003 - */ + */ template struct constraint_and_return_value { typedef T type; @@ -177,7 +177,7 @@ struct identity * * @author Wolfgang Bangerth, 2004 */ -struct PointerComparison +struct PointerComparison { /** * Comparison function for pointers of @@ -197,7 +197,7 @@ struct PointerComparison * same, so we always return @p false. */ template - static bool equal (const T*, const U*); + static bool equal (const T*, const U*); }; @@ -263,7 +263,7 @@ namespace internal * @author Wolfgang Bangerth, 2006 */ template - struct int2type + struct int2type {}; diff --git a/deal.II/include/deal.II/base/tensor.h b/deal.II/include/deal.II/base/tensor.h index 132bebbea1..85ae3e9330 100644 --- a/deal.II/include/deal.II/base/tensor.h +++ b/deal.II/include/deal.II/base/tensor.h @@ -46,167 +46,167 @@ template class Tensor { public: - /** - * Provide a way to get the - * dimension of an object without - * explicit knowledge of it's - * data type. Implementation is - * this way instead of providing - * a function dimension() - * because now it is possible to - * get the dimension at compile - * time without the expansion and - * preevaluation of an inlined - * function; the compiler may - * therefore produce more - * efficient code and you may use - * this value to declare other - * data types. - */ + /** + * Provide a way to get the + * dimension of an object without + * explicit knowledge of it's + * data type. Implementation is + * this way instead of providing + * a function dimension() + * because now it is possible to + * get the dimension at compile + * time without the expansion and + * preevaluation of an inlined + * function; the compiler may + * therefore produce more + * efficient code and you may use + * this value to declare other + * data types. + */ static const unsigned int dimension = dim; - /** - * Publish the rank of this tensor to - * the outside world. - */ + /** + * Publish the rank of this tensor to + * the outside world. + */ static const unsigned int rank = rank_; - /** - * Type of stored objects. This - * is a tensor of lower rank. - */ + /** + * Type of stored objects. This + * is a tensor of lower rank. + */ typedef Tensor value_type; - /** - * Declare a type that has holds - * real-valued numbers with the same - * precision as the template argument to - * this class. For std::complex, - * this corresponds to type number, and - * it is equal to Number for all other - * cases. See also the respective field - * in Vector. - * - * This typedef is used to - * represent the return type of - * norms. - */ + /** + * Declare a type that has holds + * real-valued numbers with the same + * precision as the template argument to + * this class. For std::complex, + * this corresponds to type number, and + * it is equal to Number for all other + * cases. See also the respective field + * in Vector. + * + * This typedef is used to + * represent the return type of + * norms. + */ typedef typename numbers::NumberTraits::real_type real_type; - /** - * Declare an array type which - * can be used to initialize an - * object of this type - * statically. - */ + /** + * Declare an array type which + * can be used to initialize an + * object of this type + * statically. + */ typedef typename Tensor::array_type array_type[dim]; - /** - * Constructor. Initialize all entries - * to zero. - */ + /** + * Constructor. Initialize all entries + * to zero. + */ Tensor (); - /** - * Copy constructor, where the data is - * copied from a C-style array. - */ + /** + * Copy constructor, where the data is + * copied from a C-style array. + */ Tensor (const array_type &initializer); - /** - * Conversion operator from tensor of - * tensors. - */ + /** + * Conversion operator from tensor of + * tensors. + */ Tensor (const Tensor<1,dim,Tensor > &tensor_in); - /** - * Conversion operator to tensor of - * tensors. - */ + /** + * Conversion operator to tensor of + * tensors. + */ operator Tensor<1,dim,Tensor > () const; - /** - * Read-Write access operator. - */ + /** + * Read-Write access operator. + */ Tensor &operator [] (const unsigned int i); - /** - * Read-only access operator. - */ + /** + * Read-only access operator. + */ const Tensor &operator [] (const unsigned int i) const; - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ Tensor & operator = (const Tensor &); - /** - * This operator assigns a scalar - * to a tensor. To avoid - * confusion with what exactly it - * means to assign a scalar value - * to a tensor, zero is the only - * value allowed for d, - * allowing the intuitive - * notation t=0 to reset - * all elements of the tensor to - * zero. - */ + /** + * This operator assigns a scalar + * to a tensor. To avoid + * confusion with what exactly it + * means to assign a scalar value + * to a tensor, zero is the only + * value allowed for d, + * allowing the intuitive + * notation t=0 to reset + * all elements of the tensor to + * zero. + */ Tensor & operator = (const Number d); - /** - * Test for equality of two tensors. - */ + /** + * Test for equality of two tensors. + */ bool operator == (const Tensor &) const; - /** - * Test for inequality of two tensors. - */ + /** + * Test for inequality of two tensors. + */ bool operator != (const Tensor &) const; - /** - * Add another tensor. - */ + /** + * Add another tensor. + */ Tensor & operator += (const Tensor &); - /** - * Subtract another tensor. - */ + /** + * Subtract another tensor. + */ Tensor & operator -= (const Tensor &); - /** - * Scale the tensor by factor, - * i.e. multiply all components by - * factor. - */ + /** + * Scale the tensor by factor, + * i.e. multiply all components by + * factor. + */ Tensor & operator *= (const Number factor); - /** - * Scale the vector by - * 1/factor. - */ + /** + * Scale the vector by + * 1/factor. + */ Tensor & operator /= (const Number factor); - /** - * Add two tensors. If possible, you - * should use operator += - * instead since this does not need the - * creation of a temporary. - */ + /** + * Add two tensors. If possible, you + * should use operator += + * instead since this does not need the + * creation of a temporary. + */ Tensor operator + (const Tensor &) const; - /** - * Subtract two tensors. If possible, - * you should use operator -= - * instead since this does not need the - * creation of a temporary. - */ + /** + * Subtract two tensors. If possible, + * you should use operator -= + * instead since this does not need the + * creation of a temporary. + */ Tensor operator - (const Tensor &) const; - /** - * Unary minus operator. Negate all - * entries of a tensor. - */ + /** + * Unary minus operator. Negate all + * entries of a tensor. + */ Tensor operator - () const; /** @@ -221,53 +221,53 @@ class Tensor * Frobenius-norm of a tensor, * i.e. the square root of the * sum of squares of all entries. - * - * This function mainly exists - * because it makes computing the - * norm simpler recursively, but - * may also be useful in other - * contexts. + * + * This function mainly exists + * because it makes computing the + * norm simpler recursively, but + * may also be useful in other + * contexts. */ real_type norm_square () const; - /** - * Fill a vector with all tensor elements. - * - * This function unrolls all - * tensor entries into a single, - * linearly numbered vector. As - * usual in C++, the rightmost - * index of the tensor marches fastest. - */ + /** + * Fill a vector with all tensor elements. + * + * This function unrolls all + * tensor entries into a single, + * linearly numbered vector. As + * usual in C++, the rightmost + * index of the tensor marches fastest. + */ template void unroll (Vector & result) const; - /** - * Reset all values to zero. - * - * Note that this is partly inconsistent - * with the semantics of the @p clear() - * member functions of the STL and of - * several other classes within deal.II - * which not only reset the values of - * stored elements to zero, but release - * all memory and return the object into - * a virginial state. However, since the - * size of objects of the present type is - * determined by its template parameters, - * resizing is not an option, and indeed - * the state where all elements have a - * zero value is the state right after - * construction of such an object. - */ + /** + * Reset all values to zero. + * + * Note that this is partly inconsistent + * with the semantics of the @p clear() + * member functions of the STL and of + * several other classes within deal.II + * which not only reset the values of + * stored elements to zero, but release + * all memory and return the object into + * a virginial state. However, since the + * size of objects of the present type is + * determined by its template parameters, + * resizing is not an option, and indeed + * the state where all elements have a + * zero value is the state right after + * construction of such an object. + */ void clear (); - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ + /** + * Determine an estimate for the + * memory consumption (in bytes) + * of this object. + */ static std::size_t memory_consumption (); /** @@ -285,29 +285,29 @@ class Tensor void serialize(Archive & ar, const unsigned int version); private: - /** - * Array of tensors holding the - * subelements. - */ + /** + * Array of tensors holding the + * subelements. + */ Tensor subtensor[dim]; - /** - * Help function for unroll. - */ + /** + * Help function for unroll. + */ template void unroll_recursion(Vector &result, - unsigned int &start_index) const; - - // make the following class a - // friend to this class. in principle, - // it would suffice if otherrank==rank+1, - // but then the compiler complains - // that this be an explicit specialization - // which is not what we want - // - // also, it would be sufficient to make - // the function unroll_loops a friend, - // but that seems to be impossible as well. + unsigned int &start_index) const; + + // make the following class a + // friend to this class. in principle, + // it would suffice if otherrank==rank+1, + // but then the compiler complains + // that this be an explicit specialization + // which is not what we want + // + // also, it would be sufficient to make + // the function unroll_loops a friend, + // but that seems to be impossible as well. template friend class Tensor; }; @@ -565,7 +565,7 @@ template inline void Tensor::unroll_recursion (Vector &result, - unsigned int &index) const + unsigned int &index) const { for (unsigned i=0; i &p) template inline Number contract (const Tensor<1,dim,Number> &src1, - const Tensor<1,dim,Number> &src2) + const Tensor<1,dim,Number> &src2) { Number res = 0.; for (unsigned int i=0; i &src1, template inline void contract (Tensor<1,dim,Number> &dest, - const Tensor<2,dim,Number> &src1, - const Tensor<1,dim,Number> &src2) + const Tensor<2,dim,Number> &src1, + const Tensor<1,dim,Number> &src2) { for (unsigned int i=0; i &src1, { dest[i] = src1[i][0] * src2[0]; for (unsigned int j=1; j &src1, template inline void contract (Tensor<1,dim,Number> &dest, - const Tensor<1,dim,Number> &src1, - const Tensor<2,dim,Number> &src2) + const Tensor<1,dim,Number> &src1, + const Tensor<2,dim,Number> &src2) { for (unsigned int i=0; i &src1, { dest[i] = src1[0] * src2[0][i]; for (unsigned int j=1; j &src1, template inline void contract (Tensor<2,dim,Number> &dest, - const Tensor<2,dim,Number> &src1, - const Tensor<2,dim,Number> &src2) + const Tensor<2,dim,Number> &src1, + const Tensor<2,dim,Number> &src2) { for (unsigned int i=0; i &src1, for (unsigned int i=0; i &src1, template inline void contract (Tensor<2,dim,Number> &dest, - const Tensor<2,dim,Number> &src1, const unsigned int index1, - const Tensor<2,dim,Number> &src2, const unsigned int index2) + const Tensor<2,dim,Number> &src1, const unsigned int index1, + const Tensor<2,dim,Number> &src2, const unsigned int index2) { dest.clear (); switch (index1) { case 1: - switch (index2) - { - case 1: - for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); - }; - break; + }; + break; case 2: - switch (index2) - { - case 1: - for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); - }; - break; + }; + break; default: - Assert (false, (typename Tensor<2,dim,Number>::ExcInvalidTensorIndex (index1))); + Assert (false, (typename Tensor<2,dim,Number>::ExcInvalidTensorIndex (index1))); }; } @@ -941,36 +941,36 @@ void contract (Tensor<2,dim,Number> &dest, template inline void contract (Tensor<2,dim,Number> &dest, - const Tensor<3,dim,Number> &src1, const unsigned int index1, - const Tensor<1,dim,Number> &src2) + const Tensor<3,dim,Number> &src1, const unsigned int index1, + const Tensor<1,dim,Number> &src2) { dest.clear (); switch (index1) { case 1: - for (unsigned int i=0; i::ExcInvalidTensorIndex (index1))); }; } @@ -986,15 +986,15 @@ void contract (Tensor<2,dim,Number> &dest, template inline void contract (Tensor<3,dim,Number> &dest, - const Tensor<3,dim,Number> &src1, - const Tensor<2,dim,Number> &src2) + const Tensor<3,dim,Number> &src1, + const Tensor<2,dim,Number> &src2) { dest.clear (); for (unsigned int i=0; i &dest, template inline void contract (Tensor<3,dim,Number> &dest, - const Tensor<3,dim,Number> &src1, const unsigned int index1, - const Tensor<2,dim,Number> &src2, const unsigned int index2) + const Tensor<3,dim,Number> &src1, const unsigned int index1, + const Tensor<2,dim,Number> &src2, const unsigned int index2) { dest.clear (); switch (index1) { case 1: - switch (index2) - { - case 1: - for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); - } - - break; + switch (index2) + { + case 1: + for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); + } + + break; case 2: - switch (index2) - { - case 1: - for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); - } - - break; + switch (index2) + { + case 1: + for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); + } + + break; case 3: - switch (index2) - { - case 1: - for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); - } - - break; + switch (index2) + { + case 1: + for (unsigned int i=0; i::ExcInvalidTensorIndex (index2))); + } + + break; default: - Assert (false, - (typename Tensor<3,dim,Number>::ExcInvalidTensorIndex (index1))); + Assert (false, + (typename Tensor<3,dim,Number>::ExcInvalidTensorIndex (index1))); } } @@ -1123,8 +1123,8 @@ operator * (const Tensor<3,dim,Number> &src1, for (unsigned int i=0; i &src1, template inline void contract (Tensor<3,dim,Number> &dest, - const Tensor<2,dim,Number> &src1, - const Tensor<3,dim,Number> &src2) + const Tensor<2,dim,Number> &src1, + const Tensor<3,dim,Number> &src2) { dest.clear (); for (unsigned int i=0; i &src1, for (unsigned int i=0; i &src1, for (unsigned int i=0; i &src1, template inline void double_contract (Tensor<2,dim,Number> &dest, - const Tensor<4,dim,Number> &src1, - const Tensor<2,dim,Number> &src2) + const Tensor<4,dim,Number> &src1, + const Tensor<2,dim,Number> &src2) { dest.clear (); for (unsigned int i=0; i &dest, template inline Number contract3 (const Tensor<1,dim,Number>& u, - const Tensor<2,dim,Number>& A, - const Tensor<1,dim,Number>& v) + const Tensor<2,dim,Number>& A, + const Tensor<1,dim,Number>& v) { Number result = 0.; @@ -1263,14 +1263,14 @@ template inline Number contract3 (const Tensor<1,dim,Number> &t1, - const Tensor<3,dim,Number> &t2, - const Tensor<2,dim,Number> &t3) + const Tensor<3,dim,Number> &t2, + const Tensor<2,dim,Number> &t3) { Number s = 0; for (unsigned int i=0; i inline Number contract3 (const Tensor<2,dim,Number> &t1, - const Tensor<3,dim,Number> &t2, - const Tensor<1,dim,Number> &t3) + const Tensor<3,dim,Number> &t2, + const Tensor<1,dim,Number> &t3) { Number s = 0; for (unsigned int i=0; i inline Number contract3 (const Tensor<2,dim,Number> &t1, - const Tensor<4,dim,Number> &t2, - const Tensor<2,dim,Number> &t3) + const Tensor<4,dim,Number> &t2, + const Tensor<2,dim,Number> &t3) { Number s = 0; for (unsigned int i=0; i &t1, */ template void outer_product (Tensor<2,dim,Number> &dst, - const Tensor<1,dim,Number> &src1, - const Tensor<1,dim,Number> &src2) + const Tensor<1,dim,Number> &src1, + const Tensor<1,dim,Number> &src2) { for (unsigned int i=0; i &dst, */ template void outer_product (Tensor<3,dim,Number> &dst, - const Tensor<1,dim,Number> &src1, - const Tensor<2,dim,Number> &src2) + const Tensor<1,dim,Number> &src1, + const Tensor<2,dim,Number> &src2) { for (unsigned int i=0; i &dst, */ template void outer_product (Tensor<3,dim,Number> &dst, - const Tensor<2,dim,Number> &src1, - const Tensor<1,dim,Number> &src2) + const Tensor<2,dim,Number> &src1, + const Tensor<1,dim,Number> &src2) { for (unsigned int i=0; i &dst, */ template void outer_product (Tensor<1,dim,Number> &dst, - const Number src1, - const Tensor<1,dim,Number> &src2) + const Number src1, + const Tensor<1,dim,Number> &src2) { for (unsigned int i=0; i &dst, */ template void outer_product (Tensor<1,dim,Number> &dst, - const Tensor<1,dim,Number> src1, - const Number src2) + const Tensor<1,dim,Number> src1, + const Number src2) { for (unsigned int i=0; i inline void cross_product (Tensor<1,dim,Number> &dst, - const Tensor<1,dim,Number> &src) + const Tensor<1,dim,Number> &src) { Assert (dim==2, ExcInternalError()); @@ -1460,8 +1460,8 @@ template inline void cross_product (Tensor<1,dim,Number> &dst, - const Tensor<1,dim,Number> &src1, - const Tensor<1,dim,Number> &src2) + const Tensor<1,dim,Number> &src1, + const Tensor<1,dim,Number> &src2) { Assert (dim==3, ExcInternalError()); @@ -1485,7 +1485,7 @@ template inline Number scalar_product (const Tensor<2,dim,Number> &t1, - const Tensor<2,dim,Number> &t2) + const Tensor<2,dim,Number> &t2) { Number s = 0; for (unsigned int i=0; i &t) { return ((t[0][0] * t[1][1]) - - (t[1][0] * t[0][1])); + (t[1][0] * t[0][1])); } @@ -1570,18 +1570,18 @@ template inline Number determinant (const Tensor<2,3,Number> &t) { - // get this using Maple: - // with(linalg); - // a := matrix(3,3); - // x := det(a); - // readlib(C); - // C(x, optimized); + // get this using Maple: + // with(linalg); + // a := matrix(3,3); + // x := det(a); + // readlib(C); + // C(x, optimized); return ( t[0][0]*t[1][1]*t[2][2] - -t[0][0]*t[1][2]*t[2][1] - -t[1][0]*t[0][1]*t[2][2] - +t[1][0]*t[0][2]*t[2][1] - +t[2][0]*t[0][1]*t[1][2] - -t[2][0]*t[0][2]*t[1][1] ); + -t[0][0]*t[1][2]*t[2][1] + -t[1][0]*t[0][1]*t[2][2] + +t[1][0]*t[0][2]*t[2][1] + +t[2][0]*t[0][1]*t[1][2] + -t[2][0]*t[0][2]*t[1][1] ); } @@ -1596,25 +1596,25 @@ template inline Number determinant (const Tensor<2,dim,Number> &t) { - // compute the determinant using the - // Laplace expansion of the - // determinant. this may not be the most - // efficient algorithm, but it does for - // small n. - // - // for some algorithmic simplicity, we use - // the expansion along the last row + // compute the determinant using the + // Laplace expansion of the + // determinant. this may not be the most + // efficient algorithm, but it does for + // small n. + // + // for some algorithmic simplicity, we use + // the expansion along the last row Number det = 0; for (unsigned int k=0; k minor; for (unsigned int i=0; i(k+1)) * - determinant (minor); + determinant (minor); det += t[dim-1][k] * cofactor; } @@ -1660,50 +1660,50 @@ invert (const Tensor<2,dim,Number> &t) switch (dim) { case 1: - return_tensor[0][0] = 1.0/t[0][0]; - break; + return_tensor[0][0] = 1.0/t[0][0]; + break; case 2: - // this is Maple output, - // thus a bit unstructured + // this is Maple output, + // thus a bit unstructured { - const Number t4 = 1.0/(t[0][0]*t[1][1]-t[0][1]*t[1][0]); - return_tensor[0][0] = t[1][1]*t4; - return_tensor[0][1] = -t[0][1]*t4; - return_tensor[1][0] = -t[1][0]*t4; - return_tensor[1][1] = t[0][0]*t4; - break; + const Number t4 = 1.0/(t[0][0]*t[1][1]-t[0][1]*t[1][0]); + return_tensor[0][0] = t[1][1]*t4; + return_tensor[0][1] = -t[0][1]*t4; + return_tensor[1][0] = -t[1][0]*t4; + return_tensor[1][1] = t[0][0]*t4; + break; } case 3: { - const Number t4 = t[0][0]*t[1][1], - t6 = t[0][0]*t[1][2], - t8 = t[0][1]*t[1][0], - t00 = t[0][2]*t[1][0], - t01 = t[0][1]*t[2][0], - t04 = t[0][2]*t[2][0], - t07 = 1.0/(t4*t[2][2]-t6*t[2][1]-t8*t[2][2]+ - t00*t[2][1]+t01*t[1][2]-t04*t[1][1]); - return_tensor[0][0] = (t[1][1]*t[2][2]-t[1][2]*t[2][1])*t07; - return_tensor[0][1] = (t[0][2]*t[2][1]-t[0][1]*t[2][2])*t07; - return_tensor[0][2] = (t[0][1]*t[1][2]-t[0][2]*t[1][1])*t07; - return_tensor[1][0] = (t[1][2]*t[2][0]-t[1][0]*t[2][2])*t07; - return_tensor[1][1] = (t[0][0]*t[2][2]-t04)*t07; - return_tensor[1][2] = (t00-t6)*t07; - return_tensor[2][0] = (t[1][0]*t[2][1]-t[1][1]*t[2][0])*t07; - return_tensor[2][1] = (t01-t[0][0]*t[2][1])*t07; - return_tensor[2][2] = (t4-t8)*t07; - - break; + const Number t4 = t[0][0]*t[1][1], + t6 = t[0][0]*t[1][2], + t8 = t[0][1]*t[1][0], + t00 = t[0][2]*t[1][0], + t01 = t[0][1]*t[2][0], + t04 = t[0][2]*t[2][0], + t07 = 1.0/(t4*t[2][2]-t6*t[2][1]-t8*t[2][2]+ + t00*t[2][1]+t01*t[1][2]-t04*t[1][1]); + return_tensor[0][0] = (t[1][1]*t[2][2]-t[1][2]*t[2][1])*t07; + return_tensor[0][1] = (t[0][2]*t[2][1]-t[0][1]*t[2][2])*t07; + return_tensor[0][2] = (t[0][1]*t[1][2]-t[0][2]*t[1][1])*t07; + return_tensor[1][0] = (t[1][2]*t[2][0]-t[1][0]*t[2][2])*t07; + return_tensor[1][1] = (t[0][0]*t[2][2]-t04)*t07; + return_tensor[1][2] = (t00-t6)*t07; + return_tensor[2][0] = (t[1][0]*t[2][1]-t[1][1]*t[2][0])*t07; + return_tensor[2][1] = (t01-t[0][0]*t[2][1])*t07; + return_tensor[2][2] = (t4-t8)*t07; + + break; } - // if desired, take over the - // inversion of a 4x4 tensor - // from the FullMatrix + // if desired, take over the + // inversion of a 4x4 tensor + // from the FullMatrix default: - AssertThrow (false, ExcNotImplemented()); + AssertThrow (false, ExcNotImplemented()); } return Tensor<2,dim,Number>(return_tensor); } @@ -1730,10 +1730,10 @@ transpose (const Tensor<2,dim,Number> &t) { tt[i][i] = t[i][i]; for (unsigned int j=i+1; j(tt); } @@ -1816,10 +1816,10 @@ l1_norm (const Tensor<2,dim,Number> &t) { double sum = 0; for (unsigned int i=0; i max) - max = sum; + max = sum; } return max; @@ -1845,10 +1845,10 @@ linfty_norm (const Tensor<2,dim,Number> &t) { double sum = 0; for (unsigned int j=0; j max) - max = sum; + max = sum; } return max; @@ -1866,7 +1866,7 @@ template inline Tensor operator * (const Tensor &t, - const Number factor) + const Number factor) { Tensor tt = t; tt *= factor; @@ -1885,7 +1885,7 @@ template inline Tensor operator * (const Number factor, - const Tensor &t) + const Tensor &t) { Tensor tt = t; tt *= factor; @@ -1903,7 +1903,7 @@ template inline Tensor operator / (const Tensor &t, - const Number factor) + const Number factor) { Tensor tt = t; tt /= factor; @@ -1923,7 +1923,7 @@ template inline Tensor operator * (const Tensor &t, - const double factor) + const double factor) { Tensor tt = t; tt *= factor; @@ -1942,7 +1942,7 @@ template inline Tensor operator * (const double factor, - const Tensor &t) + const Tensor &t) { Tensor tt = t; tt *= factor; @@ -1960,7 +1960,7 @@ template inline Tensor operator / (const Tensor &t, - const double factor) + const double factor) { Tensor tt = t; tt /= factor; diff --git a/deal.II/include/deal.II/base/tensor_base.h b/deal.II/include/deal.II/base/tensor_base.h index 23346316d4..08bc4dbe3f 100644 --- a/deal.II/include/deal.II/base/tensor_base.h +++ b/deal.II/include/deal.II/base/tensor_base.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -70,161 +70,161 @@ template class Tensor<0,dim,Number> { public: - /** - * Provide a way to get the - * dimension of an object without - * explicit knowledge of it's - * data type. Implementation is - * this way instead of providing - * a function dimension() - * because now it is possible to - * get the dimension at compile - * time without the expansion and - * preevaluation of an inlined - * function; the compiler may - * therefore produce more - * efficient code and you may use - * this value to declare other - * data types. - */ + /** + * Provide a way to get the + * dimension of an object without + * explicit knowledge of it's + * data type. Implementation is + * this way instead of providing + * a function dimension() + * because now it is possible to + * get the dimension at compile + * time without the expansion and + * preevaluation of an inlined + * function; the compiler may + * therefore produce more + * efficient code and you may use + * this value to declare other + * data types. + */ static const unsigned int dimension = dim; - /** - * Publish the rank of this tensor to - * the outside world. - */ + /** + * Publish the rank of this tensor to + * the outside world. + */ static const unsigned int rank = 0; - /** - * Type of stored objects. This - * is a Number for a rank 1 tensor. - */ + /** + * Type of stored objects. This + * is a Number for a rank 1 tensor. + */ typedef Number value_type; - /** - * Declare a type that has holds - * real-valued numbers with the same - * precision as the template argument to - * this class. For std::complex, - * this corresponds to type number, and - * it is equal to Number for all other - * cases. See also the respective field - * in Vector. - * - * This typedef is used to - * represent the return type of - * norms. - */ + /** + * Declare a type that has holds + * real-valued numbers with the same + * precision as the template argument to + * this class. For std::complex, + * this corresponds to type number, and + * it is equal to Number for all other + * cases. See also the respective field + * in Vector. + * + * This typedef is used to + * represent the return type of + * norms. + */ typedef typename numbers::NumberTraits::real_type real_type; - /** - * Constructor. Set to zero. - */ + /** + * Constructor. Set to zero. + */ Tensor (); - /** - * Copy constructor, where the - * data is copied from a C-style - * array. - */ + /** + * Copy constructor, where the + * data is copied from a C-style + * array. + */ Tensor (const value_type &initializer); - /** - * Copy constructor. - */ + /** + * Copy constructor. + */ Tensor (const Tensor<0,dim,Number> &); - /** - * Conversion to Number. Since - * rank-0 tensors are scalars, - * this is a natural operation. - */ + /** + * Conversion to Number. Since + * rank-0 tensors are scalars, + * this is a natural operation. + */ operator Number () const; - /** - * Conversion to Number. Since - * rank-0 tensors are scalars, - * this is a natural operation. - * - * This is the non-const - * conversion operator that - * returns a writable reference. - */ + /** + * Conversion to Number. Since + * rank-0 tensors are scalars, + * this is a natural operation. + * + * This is the non-const + * conversion operator that + * returns a writable reference. + */ operator Number& (); - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ Tensor<0,dim,Number> & operator = (const Tensor<0,dim,Number> &); - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ Tensor<0,dim,Number> & operator = (const Number d); - /** - * Test for equality of two - * tensors. - */ + /** + * Test for equality of two + * tensors. + */ bool operator == (const Tensor<0,dim,Number> &) const; - /** - * Test for inequality of two - * tensors. - */ + /** + * Test for inequality of two + * tensors. + */ bool operator != (const Tensor<0,dim,Number> &) const; - /** - * Add another vector, i.e. move - * this point by the given - * offset. - */ + /** + * Add another vector, i.e. move + * this point by the given + * offset. + */ Tensor<0,dim,Number> & operator += (const Tensor<0,dim,Number> &); - /** - * Subtract another vector. - */ + /** + * Subtract another vector. + */ Tensor<0,dim,Number> & operator -= (const Tensor<0,dim,Number> &); - /** - * Scale the vector by - * factor, i.e. multiply all - * coordinates by factor. - */ + /** + * Scale the vector by + * factor, i.e. multiply all + * coordinates by factor. + */ Tensor<0,dim,Number> & operator *= (const Number factor); - /** - * Scale the vector by 1/factor. - */ + /** + * Scale the vector by 1/factor. + */ Tensor<0,dim,Number> & operator /= (const Number factor); - /** - * Returns the scalar product of - * two vectors. - */ + /** + * Returns the scalar product of + * two vectors. + */ Number operator * (const Tensor<0,dim,Number> &) const; - /** - * Add two tensors. If possible, - * use operator += instead - * since this does not need to - * copy a point at least once. - */ + /** + * Add two tensors. If possible, + * use operator += instead + * since this does not need to + * copy a point at least once. + */ Tensor<0,dim,Number> operator + (const Tensor<0,dim,Number> &) const; - /** - * Subtract two tensors. If - * possible, use operator += - * instead since this does not - * need to copy a point at least - * once. - */ + /** + * Subtract two tensors. If + * possible, use operator += + * instead since this does not + * need to copy a point at least + * once. + */ Tensor<0,dim,Number> operator - (const Tensor<0,dim,Number> &) const; - /** - * Tensor with inverted entries. - */ + /** + * Tensor with inverted entries. + */ Tensor<0,dim,Number> operator - () const; /** @@ -244,44 +244,44 @@ class Tensor<0,dim,Number> * Frobenius-norm of a tensor, * i.e. the square root of the * sum of squares of all entries. - * - * This function mainly exists - * because it makes computing the - * norm simpler recursively, but - * may also be useful in other - * contexts. + * + * This function mainly exists + * because it makes computing the + * norm simpler recursively, but + * may also be useful in other + * contexts. */ real_type norm_square () const; - /** - * Reset all values to zero. - * - * Note that this is partly inconsistent - * with the semantics of the @p clear() - * member functions of the STL and of - * several other classes within deal.II - * which not only reset the values of - * stored elements to zero, but release - * all memory and return the object into - * a virginial state. However, since the - * size of objects of the present type is - * determined by its template parameters, - * resizing is not an option, and indeed - * the state where all elements have a - * zero value is the state right after - * construction of such an object. - */ + /** + * Reset all values to zero. + * + * Note that this is partly inconsistent + * with the semantics of the @p clear() + * member functions of the STL and of + * several other classes within deal.II + * which not only reset the values of + * stored elements to zero, but release + * all memory and return the object into + * a virginial state. However, since the + * size of objects of the present type is + * determined by its template parameters, + * resizing is not an option, and indeed + * the state where all elements have a + * zero value is the state right after + * construction of such an object. + */ void clear (); /** * Only tensors with a positive - * dimension are implemented. This - * exception is thrown by the - * constructor if the template - * argument dim is zero or - * less. - * - * @ingroup Exceptions + * dimension are implemented. This + * exception is thrown by the + * constructor if the template + * argument dim is zero or + * less. + * + * @ingroup Exceptions */ DeclException1 (ExcDimTooSmall, int, @@ -295,9 +295,9 @@ class Tensor<0,dim,Number> void serialize(Archive & ar, const unsigned int version); private: - /** - * The value of this scalar object. - */ + /** + * The value of this scalar object. + */ Number value; }; @@ -329,191 +329,191 @@ template class Tensor<1,dim,Number> { public: - /** - * Provide a way to get the - * dimension of an object without - * explicit knowledge of it's - * data type. Implementation is - * this way instead of providing - * a function dimension() - * because now it is possible to - * get the dimension at compile - * time without the expansion and - * preevaluation of an inlined - * function; the compiler may - * therefore produce more - * efficient code and you may use - * this value to declare other - * data types. - */ + /** + * Provide a way to get the + * dimension of an object without + * explicit knowledge of it's + * data type. Implementation is + * this way instead of providing + * a function dimension() + * because now it is possible to + * get the dimension at compile + * time without the expansion and + * preevaluation of an inlined + * function; the compiler may + * therefore produce more + * efficient code and you may use + * this value to declare other + * data types. + */ static const unsigned int dimension = dim; - /** - * Publish the rank of this tensor to - * the outside world. - */ + /** + * Publish the rank of this tensor to + * the outside world. + */ static const unsigned int rank = 1; - /** - * Type of stored objects. This - * is a Number for a rank 1 tensor. - */ + /** + * Type of stored objects. This + * is a Number for a rank 1 tensor. + */ typedef Number value_type; - /** - * Declare a type that has holds - * real-valued numbers with the same - * precision as the template argument to - * this class. For std::complex, - * this corresponds to type number, and - * it is equal to Number for all other - * cases. See also the respective field - * in Vector. - * - * This typedef is used to - * represent the return type of - * norms. - */ + /** + * Declare a type that has holds + * real-valued numbers with the same + * precision as the template argument to + * this class. For std::complex, + * this corresponds to type number, and + * it is equal to Number for all other + * cases. See also the respective field + * in Vector. + * + * This typedef is used to + * represent the return type of + * norms. + */ typedef typename numbers::NumberTraits::real_type real_type; - /** - * Declare an array type which can - * be used to initialize statically - * an object of this type. - * - * Avoid warning about zero-sized - * array for dim==0 by - * choosing lunatic value that is - * likely to overflow memory - * limits. - */ + /** + * Declare an array type which can + * be used to initialize statically + * an object of this type. + * + * Avoid warning about zero-sized + * array for dim==0 by + * choosing lunatic value that is + * likely to overflow memory + * limits. + */ typedef Number array_type[(dim!=0) ? dim : 100000000]; - /** - * Constructor. Initialize all entries - * to zero if initialize==true; this - * is the default behaviour. - */ + /** + * Constructor. Initialize all entries + * to zero if initialize==true; this + * is the default behaviour. + */ explicit Tensor (const bool initialize = true); - /** - * Copy constructor, where the - * data is copied from a C-style - * array. - */ + /** + * Copy constructor, where the + * data is copied from a C-style + * array. + */ Tensor (const array_type &initializer); - /** - * Copy constructor. - */ + /** + * Copy constructor. + */ Tensor (const Tensor<1,dim,Number> &); - /** - * Read access to the indexth - * coordinate. - * - * Note that the derived - * Point class also provides - * access through the () - * operator for - * backcompatibility. - */ + /** + * Read access to the indexth + * coordinate. + * + * Note that the derived + * Point class also provides + * access through the () + * operator for + * backcompatibility. + */ Number operator [] (const unsigned int index) const; - /** - * Read and write access to the - * indexth coordinate. - * - * Note that the derived - * Point class also provides - * access through the () - * operator for - * backcompatibility. - */ + /** + * Read and write access to the + * indexth coordinate. + * + * Note that the derived + * Point class also provides + * access through the () + * operator for + * backcompatibility. + */ Number & operator [] (const unsigned int index); - /** - * Assignment operator. - */ + /** + * Assignment operator. + */ Tensor<1,dim,Number> & operator = (const Tensor<1,dim,Number> &); - /** - * This operator assigns a scalar - * to a tensor. To avoid - * confusion with what exactly it - * means to assign a scalar value - * to a tensor, zero is the only - * value allowed for d, - * allowing the intuitive - * notation t=0 to reset - * all elements of the tensor to - * zero. - */ + /** + * This operator assigns a scalar + * to a tensor. To avoid + * confusion with what exactly it + * means to assign a scalar value + * to a tensor, zero is the only + * value allowed for d, + * allowing the intuitive + * notation t=0 to reset + * all elements of the tensor to + * zero. + */ Tensor<1,dim,Number> & operator = (const Number d); - /** - * Test for equality of two - * tensors. - */ + /** + * Test for equality of two + * tensors. + */ bool operator == (const Tensor<1,dim,Number> &) const; - /** - * Test for inequality of two - * tensors. - */ + /** + * Test for inequality of two + * tensors. + */ bool operator != (const Tensor<1,dim,Number> &) const; - /** - * Add another vector, i.e. move - * this point by the given - * offset. - */ + /** + * Add another vector, i.e. move + * this point by the given + * offset. + */ Tensor<1,dim,Number> & operator += (const Tensor<1,dim,Number> &); - /** - * Subtract another vector. - */ + /** + * Subtract another vector. + */ Tensor<1,dim,Number> & operator -= (const Tensor<1,dim,Number> &); - /** - * Scale the vector by - * factor, i.e. multiply all - * coordinates by factor. - */ + /** + * Scale the vector by + * factor, i.e. multiply all + * coordinates by factor. + */ Tensor<1,dim,Number> & operator *= (const Number factor); - /** - * Scale the vector by 1/factor. - */ + /** + * Scale the vector by 1/factor. + */ Tensor<1,dim,Number> & operator /= (const Number factor); - /** - * Returns the scalar product of - * two vectors. - */ + /** + * Returns the scalar product of + * two vectors. + */ Number operator * (const Tensor<1,dim,Number> &) const; - /** - * Add two tensors. If possible, - * use operator += instead - * since this does not need to - * copy a point at least once. - */ + /** + * Add two tensors. If possible, + * use operator += instead + * since this does not need to + * copy a point at least once. + */ Tensor<1,dim,Number> operator + (const Tensor<1,dim,Number> &) const; - /** - * Subtract two tensors. If - * possible, use operator += - * instead since this does not - * need to copy a point at least - * once. - */ + /** + * Subtract two tensors. If + * possible, use operator += + * instead since this does not + * need to copy a point at least + * once. + */ Tensor<1,dim,Number> operator - (const Tensor<1,dim,Number> &) const; - /** - * Tensor with inverted entries. - */ + /** + * Tensor with inverted entries. + */ Tensor<1,dim,Number> operator - () const; /** @@ -533,64 +533,64 @@ class Tensor<1,dim,Number> * Frobenius-norm of a tensor, * i.e. the square root of the * sum of squares of all entries. - * - * This function mainly exists - * because it makes computing the - * norm simpler recursively, but - * may also be useful in other - * contexts. + * + * This function mainly exists + * because it makes computing the + * norm simpler recursively, but + * may also be useful in other + * contexts. */ real_type norm_square () const; - /** - * Reset all values to zero. - * - * Note that this is partly inconsistent - * with the semantics of the @p clear() - * member functions of the STL and of - * several other classes within deal.II - * which not only reset the values of - * stored elements to zero, but release - * all memory and return the object into - * a virginial state. However, since the - * size of objects of the present type is - * determined by its template parameters, - * resizing is not an option, and indeed - * the state where all elements have a - * zero value is the state right after - * construction of such an object. - */ + /** + * Reset all values to zero. + * + * Note that this is partly inconsistent + * with the semantics of the @p clear() + * member functions of the STL and of + * several other classes within deal.II + * which not only reset the values of + * stored elements to zero, but release + * all memory and return the object into + * a virginial state. However, since the + * size of objects of the present type is + * determined by its template parameters, + * resizing is not an option, and indeed + * the state where all elements have a + * zero value is the state right after + * construction of such an object. + */ void clear (); - /** - * Fill a vector with all tensor elements. - * - * This function unrolls all - * tensor entries into a single, - * linearly numbered vector. As - * usual in C++, the rightmost - * index marches fastest. - */ + /** + * Fill a vector with all tensor elements. + * + * This function unrolls all + * tensor entries into a single, + * linearly numbered vector. As + * usual in C++, the rightmost + * index marches fastest. + */ template void unroll (Vector &result) const; - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this - * object. - */ + /** + * Determine an estimate for + * the memory consumption (in + * bytes) of this + * object. + */ static std::size_t memory_consumption (); /** * Only tensors with a positive - * dimension are implemented. This - * exception is thrown by the - * constructor if the template - * argument dim is zero or - * less. - * - * @ingroup Exceptions + * dimension are implemented. This + * exception is thrown by the + * constructor if the template + * argument dim is zero or + * less. + * + * @ingroup Exceptions */ DeclException1 (ExcDimTooSmall, int, @@ -604,70 +604,70 @@ class Tensor<1,dim,Number> void serialize(Archive & ar, const unsigned int version); private: - /** - * Store the values in a simple - * array. For dim==0 store - * one element, because otherways - * the compiler would choke. We - * catch this case in the - * constructor to disallow the - * creation of such an object. - */ + /** + * Store the values in a simple + * array. For dim==0 store + * one element, because otherways + * the compiler would choke. We + * catch this case in the + * constructor to disallow the + * creation of such an object. + */ Number values[(dim!=0) ? (dim) : 1]; #ifdef DEAL_II_TEMPLATE_SPEC_ACCESS_WORKAROUND public: #endif - /** - * Help function for unroll. If - * we have detected an access - * control bug in the compiler, - * this function is declared - * public, otherwise private. Do - * not attempt to use this - * function from outside in any - * case, even if it should be - * public for your compiler. - */ + /** + * Help function for unroll. If + * we have detected an access + * control bug in the compiler, + * this function is declared + * public, otherwise private. Do + * not attempt to use this + * function from outside in any + * case, even if it should be + * public for your compiler. + */ template void unroll_recursion (Vector &result, - unsigned int &start_index) const; + unsigned int &start_index) const; private: - /** - * Make the following classes - * friends to this class. In - * principle, it would suffice if - * otherrank==2, but that is not - * possible in C++ at present. - * - * Also, it would be sufficient - * to make the function - * unroll_loops a friend, but - * that seems to be impossible as - * well. - */ + /** + * Make the following classes + * friends to this class. In + * principle, it would suffice if + * otherrank==2, but that is not + * possible in C++ at present. + * + * Also, it would be sufficient + * to make the function + * unroll_loops a friend, but + * that seems to be impossible as + * well. + */ template friend class dealii::Tensor; - /** - * Point is allowed access to - * the coordinates. This is - * supposed to improve speed. - */ + /** + * Point is allowed access to + * the coordinates. This is + * supposed to improve speed. + */ friend class Point; }; - /** - * Prints the value of this scalar. - */ + /** + * Prints the value of this scalar. + */ template std::ostream & operator << (std::ostream &out, const Tensor<0,dim,Number> &p); - /** - * Prints the values of this tensor in the - * form x1 x2 x3 etc. - */ + /** + * Prints the values of this tensor in the + * form x1 x2 x3 etc. + */ template std::ostream & operator << (std::ostream &out, const Tensor<1,dim,Number> &p); @@ -887,11 +887,11 @@ inline Tensor<1,dim,Number>::Tensor (const bool initialize) { if (initialize) - // need to create an object Number(0) to - // initialize to zero to avoid confusion with - // Tensor::operator=(scalar) when using - // something like - // Tensor<1,dim,Tensor<1,dim,Number> >. + // need to create an object Number(0) to + // initialize to zero to avoid confusion with + // Tensor::operator=(scalar) when using + // something like + // Tensor<1,dim,Tensor<1,dim,Number> >. for (unsigned int i=0; i!=dim; ++i) values[i] = Number(0); } @@ -926,16 +926,16 @@ template <> inline Tensor<1,0,double>::Tensor (const Tensor<1,0,double> &) { - // at some places in the library, - // we have Point<0> for formal - // reasons (e.g., we sometimes have - // Quadrature for faces, so - // we have Quadrature<0> for dim=1, - // and then we have Point<0>). To - // avoid warnings in the above - // function that the loop end check - // always fails, we implement this - // function here + // at some places in the library, + // we have Point<0> for formal + // reasons (e.g., we sometimes have + // Quadrature for faces, so + // we have Quadrature<0> for dim=1, + // and then we have Point<0>). To + // avoid warnings in the above + // function that the loop end check + // always fails, we implement this + // function here } @@ -964,16 +964,16 @@ template <> inline Tensor<1,0,double> & Tensor<1,0,double>::operator = (const Tensor<1,0,double> &) { - // at some places in the library, - // we have Point<0> for formal - // reasons (e.g., we sometimes have - // Quadrature for faces, so - // we have Quadrature<0> for dim=1, - // and then we have Point<0>). To - // avoid warnings in the above - // function that the loop end check - // always fails, we implement this - // function here + // at some places in the library, + // we have Point<0> for formal + // reasons (e.g., we sometimes have + // Quadrature for faces, so + // we have Quadrature<0> for dim=1, + // and then we have Point<0>). To + // avoid warnings in the above + // function that the loop end check + // always fails, we implement this + // function here return *this; } @@ -984,11 +984,11 @@ inline Tensor<1,dim,Number> & Tensor<1,dim,Number>::operator = (const Tensor<1,dim,Number> &p) { - // unroll by hand since this is a - // frequently called function and - // some compilers don't want to - // always unroll the loop in the - // general template + // unroll by hand since this is a + // frequently called function and + // some compilers don't want to + // always unroll the loop in the + // general template switch (dim) { case 1: @@ -1005,7 +1005,7 @@ Tensor<1,dim,Number>::operator = (const Tensor<1,dim,Number> &p) break; default: for (unsigned int i=0; i::operator * (const Tensor<1,dim,Number> &p) const { - // unroll by hand since this is a - // frequently called function and - // some compilers don't want to - // always unroll the loop in the - // general template + // unroll by hand since this is a + // frequently called function and + // some compilers don't want to + // always unroll the loop in the + // general template switch (dim) { case 1: @@ -1117,17 +1117,17 @@ Tensor<1,dim,Number>::operator * (const Tensor<1,dim,Number> &p) const break; case 2: return (values[0] * p.values[0] + - values[1] * p.values[1]); + values[1] * p.values[1]); break; case 3: return (values[0] * p.values[0] + - values[1] * p.values[1] + - values[2] * p.values[2]); + values[1] * p.values[1] + + values[2] * p.values[2]); break; default: Number q = values[0] * values[0]; for (unsigned int i=1; i inline void Tensor<1,dim,Number>::unroll_recursion (Vector &result, - unsigned int &index) const + unsigned int &index) const { for (unsigned i=0; i inline Tensor<1,dim,Number> operator * (const Tensor<1,dim,Number> &t, - const Number factor) + const Number factor) { Tensor<1,dim,Number> tt (false); for (unsigned int d=0; d inline Tensor<1,dim,Number> operator * (const Number factor, - const Tensor<1,dim,Number> &t) + const Tensor<1,dim,Number> &t) { Tensor<1,dim,Number> tt (false); for (unsigned int d=0; d inline Tensor<1,dim,Number> operator / (const Tensor<1,dim,Number> &t, - const Number factor) + const Number factor) { Tensor<1,dim,Number> tt (false); for (unsigned int d=0; d inline Tensor<1,dim> operator * (const Tensor<1,dim> &t, - const double factor) + const double factor) { Tensor<1,dim> tt (false); for (unsigned int d=0; d inline Tensor<1,dim> operator * (const double factor, - const Tensor<1,dim> &t) + const Tensor<1,dim> &t) { Tensor<1,dim> tt (false); for (unsigned int d=0; d inline Tensor<1,dim> operator / (const Tensor<1,dim> &t, - const double factor) + const double factor) { Tensor<1,dim> tt (false); for (unsigned int d=0; d class TensorFunction : public FunctionTime, - public Subscriptor + public Subscriptor { public: - /** - * Define typedefs for the return - * types of the value - * functions. - */ + /** + * Define typedefs for the return + * types of the value + * functions. + */ typedef Tensor value_type; #ifdef DEAL_II_LOCAL_TYPEDEF_COMP_WORKAROUND - /** - * Define a typedef for the - * return value of the gradient - * function. - * - * The construct here is only - * used in case we hit a certain - * bug in Sun's Forte - * compiler. See the respective - * macro in the aclocal.m4 file - * for a full description of the - * bug, or the documentation to - * the quadrature class. - * - * For better readability we - * later typedef this so-created - * type to one in the enclosing - * class. - */ + /** + * Define a typedef for the + * return value of the gradient + * function. + * + * The construct here is only + * used in case we hit a certain + * bug in Sun's Forte + * compiler. See the respective + * macro in the aclocal.m4 file + * for a full description of the + * bug, or the documentation to + * the quadrature class. + * + * For better readability we + * later typedef this so-created + * type to one in the enclosing + * class. + */ template struct GradientTypeHelper { - typedef Tensor type; + typedef Tensor type; }; - /** - * Typedef the kludge declared - * above to a type in the class - * in which we would like to use - * it. - * - * This typedef is only used if - * the respective bug in the - * compiler is encountered, - * otherwise the proper typedef - * below is used. - */ + /** + * Typedef the kludge declared + * above to a type in the class + * in which we would like to use + * it. + * + * This typedef is only used if + * the respective bug in the + * compiler is encountered, + * otherwise the proper typedef + * below is used. + */ typedef typename GradientTypeHelper::type gradient_type; #else typedef Tensor gradient_type; -#endif - - /** - * Constructor. May take an - * initial value for the time - * variable, which defaults to - * zero. - */ +#endif + + /** + * Constructor. May take an + * initial value for the time + * variable, which defaults to + * zero. + */ TensorFunction (const double initial_time = 0.0); - - /** - * Virtual destructor; absolutely - * necessary in this case, as - * classes are usually not used - * by their true type, but rather - * through pointers to this base - * class. - */ + + /** + * Virtual destructor; absolutely + * necessary in this case, as + * classes are usually not used + * by their true type, but rather + * through pointers to this base + * class. + */ virtual ~TensorFunction (); - - /** - * Return the value of the function - * at the given point. - */ + + /** + * Return the value of the function + * at the given point. + */ virtual value_type value (const Point &p) const; - /** - * Set values to the point - * values of the function at the - * points. It is assumed - * that values already has - * the right size, i.e. the same - * size as the points array. - */ + /** + * Set values to the point + * values of the function at the + * points. It is assumed + * that values already has + * the right size, i.e. the same + * size as the points array. + */ virtual void value_list (const std::vector > &points, - std::vector &values) const; + std::vector &values) const; - /** - * Return the gradient of the - * function at the given point. - */ + /** + * Return the gradient of the + * function at the given point. + */ virtual gradient_type gradient (const Point &p) const; - /** - * Set gradients to the - * gradients of the function at - * the points. It is assumed - * that values already has - * the right size, i.e. the same - * size as the points array. - */ + /** + * Set gradients to the + * gradients of the function at + * the points. It is assumed + * that values already has + * the right size, i.e. the same + * size as the points array. + */ virtual void gradient_list (const std::vector > &points, - std::vector &gradients) const; + std::vector &gradients) const; - /** - * Exception - */ + /** + * Exception + */ DeclException0 (ExcPureFunctionCalled); - /** - * Exception - */ + /** + * Exception + */ DeclException2 (ExcVectorHasWrongSize, - int, int, - << "The vector has size " << arg1 << " but should have " - << arg2 << " elements."); - + int, int, + << "The vector has size " << arg1 << " but should have " + << arg2 << " elements."); + }; DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/include/deal.II/base/tensor_product_polynomials.h b/deal.II/include/deal.II/base/tensor_product_polynomials.h index eb02ecdc2c..7837939db6 100644 --- a/deal.II/include/deal.II/base/tensor_product_polynomials.h +++ b/deal.II/include/deal.II/base/tensor_product_polynomials.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -61,195 +61,195 @@ template class TensorProductPolynomials { public: - /** - * Access to the dimension of - * this object, for checking and - * automatic setting of dimension - * in other classes. - */ + /** + * Access to the dimension of + * this object, for checking and + * automatic setting of dimension + * in other classes. + */ static const unsigned int dimension = dim; - /** - * Constructor. pols is - * a vector of objects that - * should be derived or otherwise - * convertible to one-dimensional - * polynomial objects. It will be - * copied element by element into - * a private variable. - */ + /** + * Constructor. pols is + * a vector of objects that + * should be derived or otherwise + * convertible to one-dimensional + * polynomial objects. It will be + * copied element by element into + * a private variable. + */ template TensorProductPolynomials (const std::vector &pols); - /** - * Prints the list of the indices - * to out. - */ + /** + * Prints the list of the indices + * to out. + */ void output_indices(std::ostream &out) const; - /** - * Sets the ordering of the - * polynomials. Requires - * renumber.size()==n(). - * Stores a copy of - * renumber. - */ + /** + * Sets the ordering of the + * polynomials. Requires + * renumber.size()==n(). + * Stores a copy of + * renumber. + */ void set_numbering(const std::vector &renumber); - /** - * Gives read access to the - * renumber vector. - */ + /** + * Gives read access to the + * renumber vector. + */ const std::vector &get_numbering() const; - /** - * Gives read access to the - * inverse renumber vector. - */ + /** + * Gives read access to the + * inverse renumber vector. + */ const std::vector &get_numbering_inverse() const; - /** - * Computes the value and the - * first and second derivatives - * of each tensor product - * polynomial at unit_point. - * - * The size of the vectors must - * either be equal 0 or equal - * n(). In the first case, the - * function will not compute - * these values. - * - * If you need values or - * derivatives of all tensor - * product polynomials then use - * this function, rather than - * using any of the - * compute_value(), - * compute_grad() or - * compute_grad_grad() - * functions, see below, in a - * loop over all tensor product - * polynomials. - */ + /** + * Computes the value and the + * first and second derivatives + * of each tensor product + * polynomial at unit_point. + * + * The size of the vectors must + * either be equal 0 or equal + * n(). In the first case, the + * function will not compute + * these values. + * + * If you need values or + * derivatives of all tensor + * product polynomials then use + * this function, rather than + * using any of the + * compute_value(), + * compute_grad() or + * compute_grad_grad() + * functions, see below, in a + * loop over all tensor product + * polynomials. + */ void compute (const Point &unit_point, std::vector &values, std::vector > &grads, std::vector > &grad_grads) const; - /** - * Computes the value of the - * ith tensor product - * polynomial at - * unit_point. Here i is - * given in tensor product - * numbering. - * - * Note, that using this function - * within a loop over all tensor - * product polynomials is not - * efficient, because then each - * point value of the underlying - * (one-dimensional) polynomials - * is (unnecessarily) computed - * several times. Instead use - * the compute() function with - * values.size()==n() - * to get the point values of all - * tensor polynomials all at once - * and in a much more efficient - * way. - */ + /** + * Computes the value of the + * ith tensor product + * polynomial at + * unit_point. Here i is + * given in tensor product + * numbering. + * + * Note, that using this function + * within a loop over all tensor + * product polynomials is not + * efficient, because then each + * point value of the underlying + * (one-dimensional) polynomials + * is (unnecessarily) computed + * several times. Instead use + * the compute() function with + * values.size()==n() + * to get the point values of all + * tensor polynomials all at once + * and in a much more efficient + * way. + */ double compute_value (const unsigned int i, - const Point &p) const; - - /** - * Computes the grad of the - * ith tensor product - * polynomial at - * unit_point. Here i is - * given in tensor product - * numbering. - * - * Note, that using this function - * within a loop over all tensor - * product polynomials is not - * efficient, because then each - * derivative value of the - * underlying (one-dimensional) - * polynomials is (unnecessarily) - * computed several times. - * Instead use the compute() - * function, see above, with - * grads.size()==n() - * to get the point value of all - * tensor polynomials all at once - * and in a much more efficient - * way. - */ + const Point &p) const; + + /** + * Computes the grad of the + * ith tensor product + * polynomial at + * unit_point. Here i is + * given in tensor product + * numbering. + * + * Note, that using this function + * within a loop over all tensor + * product polynomials is not + * efficient, because then each + * derivative value of the + * underlying (one-dimensional) + * polynomials is (unnecessarily) + * computed several times. + * Instead use the compute() + * function, see above, with + * grads.size()==n() + * to get the point value of all + * tensor polynomials all at once + * and in a much more efficient + * way. + */ Tensor<1,dim> compute_grad (const unsigned int i, - const Point &p) const; - - /** - * Computes the second - * derivative (grad_grad) of the - * ith tensor product - * polynomial at - * unit_point. Here i is - * given in tensor product - * numbering. - * - * Note, that using this function - * within a loop over all tensor - * product polynomials is not - * efficient, because then each - * derivative value of the - * underlying (one-dimensional) - * polynomials is (unnecessarily) - * computed several times. - * Instead use the compute() - * function, see above, with - * grad_grads.size()==n() - * to get the point value of all - * tensor polynomials all at once - * and in a much more efficient - * way. - */ + const Point &p) const; + + /** + * Computes the second + * derivative (grad_grad) of the + * ith tensor product + * polynomial at + * unit_point. Here i is + * given in tensor product + * numbering. + * + * Note, that using this function + * within a loop over all tensor + * product polynomials is not + * efficient, because then each + * derivative value of the + * underlying (one-dimensional) + * polynomials is (unnecessarily) + * computed several times. + * Instead use the compute() + * function, see above, with + * grad_grads.size()==n() + * to get the point value of all + * tensor polynomials all at once + * and in a much more efficient + * way. + */ Tensor<2,dim> compute_grad_grad (const unsigned int i, const Point &p) const; - /** - * Returns the number of tensor - * product polynomials. For n - * 1d polynomials this is ndim. - */ + /** + * Returns the number of tensor + * product polynomials. For n + * 1d polynomials this is ndim. + */ unsigned int n () const; private: - /** - * Copy of the vector pols of - * polynomials given to the - * constructor. - */ + /** + * Copy of the vector pols of + * polynomials given to the + * constructor. + */ std::vector > polynomials; - /** - * Number of tensor product - * polynomials. See n(). - */ + /** + * Number of tensor product + * polynomials. See n(). + */ unsigned int n_tensor_pols; - /** - * Index map for reordering the - * polynomials. - */ + /** + * Index map for reordering the + * polynomials. + */ std::vector index_map; - /** - * Index map for reordering the - * polynomials. - */ + /** + * Index map for reordering the + * polynomials. + */ std::vector index_map_inverse; /** @@ -262,17 +262,17 @@ class TensorProductPolynomials * for each space direction, * given the index i. */ - // fix to avoid compiler warnings about zero - // length arrays + // fix to avoid compiler warnings about zero + // length arrays void compute_index (const unsigned int i, unsigned int (&indices)[(dim>0?dim:1)]) const; - /** - * Computes - * xdim for - * unsigned int x. Used in - * the constructor. - */ + /** + * Computes + * xdim for + * unsigned int x. Used in + * the constructor. + */ static unsigned int x_to_the_dim (const unsigned int x); }; @@ -323,157 +323,157 @@ template class AnisotropicPolynomials { public: - /** - * Constructor. pols is a - * table of one-dimensional - * polynomials. The number of - * rows in this table should be - * equal to the space dimension, - * with the elements of each row - * giving the polynomials that - * shall be used in this - * particular coordinate - * direction. These polynomials - * may vary between coordinates, - * as well as their number. - */ + /** + * Constructor. pols is a + * table of one-dimensional + * polynomials. The number of + * rows in this table should be + * equal to the space dimension, + * with the elements of each row + * giving the polynomials that + * shall be used in this + * particular coordinate + * direction. These polynomials + * may vary between coordinates, + * as well as their number. + */ AnisotropicPolynomials (const std::vector > > &pols); - /** - * Computes the value and the - * first and second derivatives - * of each tensor product - * polynomial at unit_point. - * - * The size of the vectors must - * either be equal 0 or equal - * n_tensor_pols. In the - * first case, the function will - * not compute these values. - * - * If you need values or - * derivatives of all tensor - * product polynomials then use - * this function, rather than - * using any of the - * compute_value, - * compute_grad or - * compute_grad_grad - * functions, see below, in a - * loop over all tensor product - * polynomials. - */ + /** + * Computes the value and the + * first and second derivatives + * of each tensor product + * polynomial at unit_point. + * + * The size of the vectors must + * either be equal 0 or equal + * n_tensor_pols. In the + * first case, the function will + * not compute these values. + * + * If you need values or + * derivatives of all tensor + * product polynomials then use + * this function, rather than + * using any of the + * compute_value, + * compute_grad or + * compute_grad_grad + * functions, see below, in a + * loop over all tensor product + * polynomials. + */ void compute (const Point &unit_point, std::vector &values, std::vector > &grads, std::vector > &grad_grads) const; - /** - * Computes the value of the - * ith tensor product - * polynomial at - * unit_point. Here i is - * given in tensor product - * numbering. - * - * Note, that using this function - * within a loop over all tensor - * product polynomials is not - * efficient, because then each - * point value of the underlying - * (one-dimensional) polynomials - * is (unnecessarily) computed - * several times. Instead use - * the compute function, see - * above, with - * values.size()==n_tensor_pols - * to get the point values of all - * tensor polynomials all at once - * and in a much more efficient - * way. - */ + /** + * Computes the value of the + * ith tensor product + * polynomial at + * unit_point. Here i is + * given in tensor product + * numbering. + * + * Note, that using this function + * within a loop over all tensor + * product polynomials is not + * efficient, because then each + * point value of the underlying + * (one-dimensional) polynomials + * is (unnecessarily) computed + * several times. Instead use + * the compute function, see + * above, with + * values.size()==n_tensor_pols + * to get the point values of all + * tensor polynomials all at once + * and in a much more efficient + * way. + */ double compute_value (const unsigned int i, - const Point &p) const; - - /** - * Computes the grad of the - * ith tensor product - * polynomial at - * unit_point. Here i is - * given in tensor product - * numbering. - * - * Note, that using this function - * within a loop over all tensor - * product polynomials is not - * efficient, because then each - * derivative value of the - * underlying (one-dimensional) - * polynomials is (unnecessarily) - * computed several times. - * Instead use the compute - * function, see above, with - * grads.size()==n_tensor_pols - * to get the point value of all - * tensor polynomials all at once - * and in a much more efficient - * way. - */ + const Point &p) const; + + /** + * Computes the grad of the + * ith tensor product + * polynomial at + * unit_point. Here i is + * given in tensor product + * numbering. + * + * Note, that using this function + * within a loop over all tensor + * product polynomials is not + * efficient, because then each + * derivative value of the + * underlying (one-dimensional) + * polynomials is (unnecessarily) + * computed several times. + * Instead use the compute + * function, see above, with + * grads.size()==n_tensor_pols + * to get the point value of all + * tensor polynomials all at once + * and in a much more efficient + * way. + */ Tensor<1,dim> compute_grad (const unsigned int i, - const Point &p) const; - - /** - * Computes the second - * derivative (grad_grad) of the - * ith tensor product - * polynomial at - * unit_point. Here i is - * given in tensor product - * numbering. - * - * Note, that using this function - * within a loop over all tensor - * product polynomials is not - * efficient, because then each - * derivative value of the - * underlying (one-dimensional) - * polynomials is (unnecessarily) - * computed several times. - * Instead use the compute - * function, see above, with - * grad_grads.size()==n_tensor_pols - * to get the point value of all - * tensor polynomials all at once - * and in a much more efficient - * way. - */ + const Point &p) const; + + /** + * Computes the second + * derivative (grad_grad) of the + * ith tensor product + * polynomial at + * unit_point. Here i is + * given in tensor product + * numbering. + * + * Note, that using this function + * within a loop over all tensor + * product polynomials is not + * efficient, because then each + * derivative value of the + * underlying (one-dimensional) + * polynomials is (unnecessarily) + * computed several times. + * Instead use the compute + * function, see above, with + * grad_grads.size()==n_tensor_pols + * to get the point value of all + * tensor polynomials all at once + * and in a much more efficient + * way. + */ Tensor<2,dim> compute_grad_grad (const unsigned int i, const Point &p) const; - /** - * Returns the number of tensor - * product polynomials. It is the - * product of the number of - * polynomials in each coordinate - * direction. - */ + /** + * Returns the number of tensor + * product polynomials. It is the + * product of the number of + * polynomials in each coordinate + * direction. + */ unsigned int n () const; private: - /** - * Copy of the vector pols of - * polynomials given to the - * constructor. - */ + /** + * Copy of the vector pols of + * polynomials given to the + * constructor. + */ std::vector > > polynomials; - /** - * Number of tensor product - * polynomials. This is - * Nx*Ny*Nz, or with terms - * dropped if the number of space - * dimensions is less than 3. - */ + /** + * Number of tensor product + * polynomials. This is + * Nx*Ny*Nz, or with terms + * dropped if the number of space + * dimensions is less than 3. + */ unsigned int n_tensor_pols; /** @@ -489,11 +489,11 @@ class AnisotropicPolynomials void compute_index (const unsigned int i, unsigned int (&indices)[dim]) const; - /** - * Given the input to the - * constructor, compute - * n_tensor_pols. - */ + /** + * Given the input to the + * constructor, compute + * n_tensor_pols. + */ static unsigned int get_n_tensor_pols (const std::vector > > &pols); @@ -539,16 +539,16 @@ template template TensorProductPolynomials:: TensorProductPolynomials(const std::vector &pols) - : - polynomials (pols.begin(), pols.end()), - n_tensor_pols(x_to_the_dim(pols.size())), - index_map(n_tensor_pols), - index_map_inverse(n_tensor_pols) + : + polynomials (pols.begin(), pols.end()), + n_tensor_pols(x_to_the_dim(pols.size())), + index_map(n_tensor_pols), + index_map_inverse(n_tensor_pols) { - // per default set this index map - // to identity. This map can be - // changed by the user through the - // set_numbering() function + // per default set this index map + // to identity. This map can be + // changed by the user through the + // set_numbering() function for (unsigned int i=0; i /** * @brief A class that provides a separate storage location on each thread that accesses the object. - * + * * This class offers ways so that every thread that accesses it has its * own copy of an object of type T. In essence, accessing this object * can never result in race conditions in multithreaded programs since * no other thread than the current one can ever access it. - * + * * The class builds on the Threading Building Blocks's tbb::enumerable_thread_specific * class but wraps it in such a way that this class can also be used when deal.II * is configured not to use threads at all -- in that case, this class simply * stores a single copy of an object of type T. - * + * *

Construction and destruction

- * + * * Objects of this class can either be default constructed or by providing an * "exemplar", i.e. an object of type T so that everytime we need to create * a T on a thread that doesn't already have such an object, it is copied from * the exemplar. - * + * * Upon destruction of objects of this class, all T objects that correspond * to threads that have accessed this object are destroyed. Note that this may be * before the time when a thread is terminated. - * + * *

Access

- * + * * The T object stored by this object can be accessed using the get() function. It * provides a reference to a unique object when accessed from different threads. * Objects of type T are created lazily, i.e. they are only created whenever a * thread actually calls get(). **/ - class ThreadLocalStorage + class ThreadLocalStorage { public: /** @@ -69,7 +69,7 @@ namespace Threads * using its default constructor. **/ ThreadLocalStorage (); - + /** * A kind of copy constructor. Initialize each thread local object * by copying the given object. @@ -85,7 +85,7 @@ namespace Threads /** * Return a reference to the data stored by this object for the current * thread this function is called on. - * + * * Note that there is no member function get() that is const and * returns a const reference as one would expect. The reason is that * if such a member function were called on a thread for which no @@ -97,7 +97,7 @@ namespace Threads * allow such access. */ T & get (); - + /** * Conversion operator that simply converts the thread-local object * to the data type that it stores. This function is equivalent to @@ -105,7 +105,7 @@ namespace Threads * TLS object look more like the object it is storing. */ operator T & (); - + /** * Copy the given argument into the storage space used to represent * the current thread. Calling this function as tls_data = object @@ -113,9 +113,9 @@ namespace Threads * intent of this operator is to make the ThreadLocalStorage object * look more like the object it represents on the current thread. * - * @param t The object to be copied into the storage space used + * @param t The object to be copied into the storage space used * for the current thread. - * + * * @return The current object, after the changes have been made **/ ThreadLocalStorage & operator = (const T &t); @@ -125,17 +125,17 @@ namespace Threads /** * The data element we store. If we support threads, then this * object will be of a type that provides a separate object - * for each thread. Otherwise, it is simply a single object + * for each thread. Otherwise, it is simply a single object * of type T. **/ tbb::enumerable_thread_specific data; #else T data; -#endif +#endif }; - + // ----------------- inline and template functions ---------------------------- - + template inline ThreadLocalStorage::ThreadLocalStorage() @@ -167,7 +167,7 @@ namespace Threads return data.local(); #else return data; -#endif +#endif } @@ -178,7 +178,7 @@ namespace Threads { return get(); } - + template inline diff --git a/deal.II/include/deal.II/base/thread_management.h b/deal.II/include/deal.II/base/thread_management.h index bea0a8b680..fb6a169c64 100644 --- a/deal.II/include/deal.II/base/thread_management.h +++ b/deal.II/include/deal.II/base/thread_management.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -127,22 +127,22 @@ namespace Threads ~ScopedLock () {} }; - /** - * Simulate acquisition of the - * mutex. As this class does - * nothing really, this - * function does nothing as - * well. - */ + /** + * Simulate acquisition of the + * mutex. As this class does + * nothing really, this + * function does nothing as + * well. + */ inline void acquire () const {} - /** - * Simulate release of the - * mutex. As this class does - * nothing really, this - * function does nothing as - * well. - */ + /** + * Simulate release of the + * mutex. As this class does + * nothing really, this + * function does nothing as + * well. + */ inline void release () const {} }; @@ -169,42 +169,42 @@ namespace Threads class DummyThreadCondition { public: - /** - * Signal to a single listener - * that a condition has been - * met, i.e. that some data - * will now be available. Since - * in single threaded mode, - * this function of course does - * nothing. - */ + /** + * Signal to a single listener + * that a condition has been + * met, i.e. that some data + * will now be available. Since + * in single threaded mode, + * this function of course does + * nothing. + */ inline void signal () const {} - /** - * Signal to multiple listener - * that a condition has been - * met, i.e. that some data - * will now be available. Since - * in single threaded mode, - * this function of course does - * nothing. - */ + /** + * Signal to multiple listener + * that a condition has been + * met, i.e. that some data + * will now be available. Since + * in single threaded mode, + * this function of course does + * nothing. + */ inline void broadcast () const {} - /** - * Wait for the condition to be - * signalled. Signal variables - * need to be guarded by a - * mutex which needs to be - * given to this function as an - * argument, see the man page - * of posix_cond_wait for a - * description of the - * mechanisms. Since in single - * threaded mode, this function - * of course does nothing, but - * returns immediately. - */ + /** + * Wait for the condition to be + * signalled. Signal variables + * need to be guarded by a + * mutex which needs to be + * given to this function as an + * argument, see the man page + * of posix_cond_wait for a + * description of the + * mechanisms. Since in single + * threaded mode, this function + * of course does nothing, but + * returns immediately. + */ inline void wait (DummyThreadMutex &) const {} }; @@ -228,81 +228,81 @@ namespace Threads class DummyBarrier { public: - /** - * Constructor. Since barriers - * are only useful in - * single-threaded mode if the - * number of threads to be - * synchronised is one, this - * constructor raises an - * exception if the count - * argument is one. - */ + /** + * Constructor. Since barriers + * are only useful in + * single-threaded mode if the + * number of threads to be + * synchronised is one, this + * constructor raises an + * exception if the count + * argument is one. + */ DummyBarrier (const unsigned int count, - const char *name = 0, - void *arg = 0); - - /** - * Wait for all threads to - * reach this point. Since - * there may only be one - * thread, return immediately, - * i.e. this function is a - * no-op. - */ + const char *name = 0, + void *arg = 0); + + /** + * Wait for all threads to + * reach this point. Since + * there may only be one + * thread, return immediately, + * i.e. this function is a + * no-op. + */ int wait () const { return 0; } - /** - * Dump the state of this - * object. Here: do nothing. - */ + /** + * Dump the state of this + * object. Here: do nothing. + */ void dump () const {} - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ - /** - * Exception. - */ + /** + * Exception. + */ DeclException1 (ExcBarrierSizeNotUseful, - int, - << "In single-thread mode, other barrier sizes than 1 are not " - << "useful. You gave " << arg1); + int, + << "In single-thread mode, other barrier sizes than 1 are not " + << "useful. You gave " << arg1); - //@} + //@} }; #if DEAL_II_USE_MT == 1 - /** - * Class implementing a - * Mutex. Mutexes are used to lock - * data structures to ensure that - * only a single thread of - * execution can access them at the - * same time. - * - *

Copy semantics

- * - * When copied, the receiving - * object does not receive any - * state from the object being - * copied, i.e. an entirely new - * mutex is created. This is - * consistent with expectations if - * a mutex is used as a member - * variable to lock the other - * member variables of a class: in - * that case, the mutex of the - * copied-to object should only - * guard the members of the - * copied-to object, not the - * members of both the copied-to - * and copied-from object. - * - * @author Wolfgang Bangerth, 2002, 2003, 2009 - */ + /** + * Class implementing a + * Mutex. Mutexes are used to lock + * data structures to ensure that + * only a single thread of + * execution can access them at the + * same time. + * + *

Copy semantics

+ * + * When copied, the receiving + * object does not receive any + * state from the object being + * copied, i.e. an entirely new + * mutex is created. This is + * consistent with expectations if + * a mutex is used as a member + * variable to lock the other + * member variables of a class: in + * that case, the mutex of the + * copied-to object should only + * guard the members of the + * copied-to object, not the + * members of both the copied-to + * and copied-from object. + * + * @author Wolfgang Bangerth, 2002, 2003, 2009 + */ class Mutex { public: @@ -364,40 +364,40 @@ namespace Threads Mutex &mutex; }; - /** - * Default constructor. - */ + /** + * Default constructor. + */ Mutex () - {} - - /** - * Copy constructor. As - * discussed in this class's - * documentation, no state is - * copied from the object given - * as argument. - */ + {} + + /** + * Copy constructor. As + * discussed in this class's + * documentation, no state is + * copied from the object given + * as argument. + */ Mutex (const Mutex &) - : - mutex() - {} + : + mutex() + {} - /** - * Acquire a mutex. - */ + /** + * Acquire a mutex. + */ inline void acquire () { mutex.lock(); } - /** - * Release the mutex again. - */ + /** + * Release the mutex again. + */ inline void release () { mutex.unlock(); } private: - /** - * Data object storing the - * mutex data - */ + /** + * Data object storing the + * mutex data + */ std_cxx1x::mutex mutex; /** @@ -409,131 +409,131 @@ namespace Threads }; - /** - * Class implementing a condition - * variable. The semantics of this - * class and its member functions - * are the same as those of the - * POSIX functions. - * - * @author Wolfgang Bangerth, 2003 - */ + /** + * Class implementing a condition + * variable. The semantics of this + * class and its member functions + * are the same as those of the + * POSIX functions. + * + * @author Wolfgang Bangerth, 2003 + */ class ConditionVariable { public: - /** - * Signal to a single listener - * that a condition has been - * met, i.e. that some data - * will now be available. - */ + /** + * Signal to a single listener + * that a condition has been + * met, i.e. that some data + * will now be available. + */ inline void signal () { condition_variable.notify_one(); } - /** - * Signal to multiple listener - * that a condition has been - * met, i.e. that some data - * will now be available. - */ + /** + * Signal to multiple listener + * that a condition has been + * met, i.e. that some data + * will now be available. + */ inline void broadcast () { condition_variable.notify_all(); } - /** - * Wait for the condition to be - * signalled. Signal variables - * need to be guarded by a - * mutex which needs to be - * given to this function as an - * argument, see the man page - * of pthread_cond_wait for a - * description of the - * mechanisms. - * - * The mutex is assumed held at the - * entry to this function but is - * released upon exit. - */ + /** + * Wait for the condition to be + * signalled. Signal variables + * need to be guarded by a + * mutex which needs to be + * given to this function as an + * argument, see the man page + * of pthread_cond_wait for a + * description of the + * mechanisms. + * + * The mutex is assumed held at the + * entry to this function but is + * released upon exit. + */ inline void wait (Mutex &mutex) { - std_cxx1x::unique_lock lock(mutex.mutex, - std_cxx1x::adopt_lock); - condition_variable.wait (lock); - } + std_cxx1x::unique_lock lock(mutex.mutex, + std_cxx1x::adopt_lock); + condition_variable.wait (lock); + } private: - /** - * Data object storing the - * necessary data. - */ + /** + * Data object storing the + * necessary data. + */ std_cxx1x::condition_variable condition_variable; }; - /** - * Implementation of a thread - * barrier class, based on the - * POSIX thread functions. POSIX - * barriers are a relatively new - * feature and are not supported on - * all systems. - * - * If the configuration detected - * the absence of these functions, - * then barriers will not be - * available, and creating objects - * of this class will result in an - * exception been thrown unless the - * count given for the parties - * waiting for the barrier is equal - * to one (as in this case waiting - * for the barrier is a - * no-operation, and we can - * dispense with the POSIX - * functions at all). The rest of - * the threading functionality will - * be available in its full extent, - * though, even if POSIX barriers - * are not available. - * - * @author Wolfgang Bangerth, 2002 - */ + /** + * Implementation of a thread + * barrier class, based on the + * POSIX thread functions. POSIX + * barriers are a relatively new + * feature and are not supported on + * all systems. + * + * If the configuration detected + * the absence of these functions, + * then barriers will not be + * available, and creating objects + * of this class will result in an + * exception been thrown unless the + * count given for the parties + * waiting for the barrier is equal + * to one (as in this case waiting + * for the barrier is a + * no-operation, and we can + * dispense with the POSIX + * functions at all). The rest of + * the threading functionality will + * be available in its full extent, + * though, even if POSIX barriers + * are not available. + * + * @author Wolfgang Bangerth, 2002 + */ class PosixThreadBarrier { public: - /** - * Constructor. Initialize the - * underlying POSIX barrier data - * structure. - */ + /** + * Constructor. Initialize the + * underlying POSIX barrier data + * structure. + */ PosixThreadBarrier (const unsigned int count, - const char *name = 0, - void *arg = 0); + const char *name = 0, + void *arg = 0); - /** - * Destructor. Release all - * resources. - */ + /** + * Destructor. Release all + * resources. + */ ~PosixThreadBarrier (); - /** - * Wait for all threads to - * reach this point. The return - * value is zero for all - * participating threads except - * for one, for which the - * return value is some - * non-zero value. The - * operating system picks the - * special thread by some not - * further known method. - */ + /** + * Wait for all threads to + * reach this point. The return + * value is zero for all + * participating threads except + * for one, for which the + * return value is some + * non-zero value. The + * operating system picks the + * special thread by some not + * further known method. + */ int wait (); private: - /** - * Data object storing the - * POSIX data which we need to - * call the POSIX functions. - */ + /** + * Data object storing the + * POSIX data which we need to + * call the POSIX functions. + */ #ifndef DEAL_II_USE_MT_POSIX_NO_BARRIERS pthread_barrier_t barrier; #else @@ -547,8 +547,8 @@ namespace Threads * used ThreadMutex up to release 6.1, but * since it is already in a namespace * Threads this seems redundant). - * - * @deprecated + * + * @deprecated */ typedef Mutex ThreadMutex; @@ -557,8 +557,8 @@ namespace Threads * used ThreadCondition up to release 6.1, * but since it is already in a namespace * Threads this seems redundant). - * - * @deprecated + * + * @deprecated */ typedef ConditionVariable ThreadCondition; @@ -571,39 +571,39 @@ namespace Threads typedef PosixThreadBarrier Barrier; #else - /** - * In non-multithread mode, the - * mutex and thread management - * classes are aliased to dummy - * classes that actually do - * nothing, in particular not lock - * objects. Likewise for the - * barrier class. - */ + /** + * In non-multithread mode, the + * mutex and thread management + * classes are aliased to dummy + * classes that actually do + * nothing, in particular not lock + * objects. Likewise for the + * barrier class. + */ typedef DummyThreadMutex Mutex; typedef DummyThreadMutex ThreadMutex; - /** - * In non-multithread mode, the - * mutex and thread management - * classes are aliased to dummy - * classes that actually do - * nothing, in particular not lock - * objects. Likewise for the - * barrier class. - */ + /** + * In non-multithread mode, the + * mutex and thread management + * classes are aliased to dummy + * classes that actually do + * nothing, in particular not lock + * objects. Likewise for the + * barrier class. + */ typedef DummyThreadCondition ConditionVariable; typedef DummyThreadCondition ThreadCondition; - /** - * In non-multithread mode, the - * mutex and thread management - * classes are aliased to dummy - * classes that actually do - * nothing, in particular not lock - * objects. Likewise for the - * barrier class. - */ + /** + * In non-multithread mode, the + * mutex and thread management + * classes are aliased to dummy + * classes that actually do + * nothing, in particular not lock + * objects. Likewise for the + * barrier class. + */ typedef DummyBarrier Barrier; #endif @@ -667,74 +667,74 @@ namespace Threads * on tasks created using the * Threads::new_task functions are * not counted. - * - * @ingroup threads + * + * @ingroup threads */ unsigned int n_existing_threads (); - /** - * Return a number used as id of - * this thread. This number is - * generated using the system call - * getpid, or, if it - * exists gettid. The - * result of either is converted to - * an integer and returned by this - * function. - * - * @todo As of now, none of our - * systems seems to support - * gettid, so that part of - * the code is untested yet. - * - * @ingroup threads - */ + /** + * Return a number used as id of + * this thread. This number is + * generated using the system call + * getpid, or, if it + * exists gettid. The + * result of either is converted to + * an integer and returned by this + * function. + * + * @todo As of now, none of our + * systems seems to support + * gettid, so that part of + * the code is untested yet. + * + * @ingroup threads + */ unsigned int this_thread_id (); - /** - * Split the range [begin,end) - * into n_intervals subintervals - * of equal size. The last interval - * will be a little bit larger, if - * the number of elements in the - * whole range is not exactly - * divisible by n_intervals. The - * type of the iterators has to - * fulfill the requirements of a - * forward iterator, - * i.e. operator++ must be - * available, and of course it must - * be assignable. - * - * A list of subintervals is - * returned as a vector of pairs of - * iterators, where each pair - * denotes the range - * [begin[i],end[i]). - * - * @ingroup threads - */ + /** + * Split the range [begin,end) + * into n_intervals subintervals + * of equal size. The last interval + * will be a little bit larger, if + * the number of elements in the + * whole range is not exactly + * divisible by n_intervals. The + * type of the iterators has to + * fulfill the requirements of a + * forward iterator, + * i.e. operator++ must be + * available, and of course it must + * be assignable. + * + * A list of subintervals is + * returned as a vector of pairs of + * iterators, where each pair + * denotes the range + * [begin[i],end[i]). + * + * @ingroup threads + */ template std::vector > split_range (const ForwardIterator &begin, - const ForwardIterator &end, - const unsigned int n_intervals); - - /** - * Split the interval [begin,end) - * into subintervals of (almost) - * equal size. This function works - * mostly as the one before, with - * the difference that instead of - * iterators, now values are taken - * that define the whole interval. - * - * @ingroup threads - */ + const ForwardIterator &end, + const unsigned int n_intervals); + + /** + * Split the interval [begin,end) + * into subintervals of (almost) + * equal size. This function works + * mostly as the one before, with + * the difference that instead of + * iterators, now values are taken + * that define the whole interval. + * + * @ingroup threads + */ std::vector > split_interval (const unsigned int begin, - const unsigned int end, - const unsigned int n_intervals); + const unsigned int end, + const unsigned int n_intervals); /** * @cond internal @@ -753,7 +753,7 @@ namespace Threads namespace internal { /** - * @internal + * @internal * If in a sub-thread an * exception is thrown, it is not * propagated to the main @@ -785,7 +785,7 @@ namespace Threads void handle_std_exception (const std::exception &exc); /** - * @internal + * @internal * Same as above, but the type of * the exception is not derived * from std::exception, so @@ -795,7 +795,7 @@ namespace Threads void handle_unknown_exception (); /** - * @internal + * @internal * The following function is used * for internal bookkeeping of the * number of existing threads. It @@ -807,7 +807,7 @@ namespace Threads void register_thread (); /** - * @internal + * @internal * The following function is used * for internal bookkeeping of the * number of existing threads. It @@ -832,24 +832,24 @@ namespace Threads template std::vector > split_range (const ForwardIterator &begin, - const ForwardIterator &end, - const unsigned int n_intervals) + const ForwardIterator &end, + const unsigned int n_intervals) { typedef std::pair IteratorPair; - // in non-multithreaded mode, we - // often have the case that this - // function is called with - // n_intervals==1, so have a - // shortcut here to handle that - // case efficiently + // in non-multithreaded mode, we + // often have the case that this + // function is called with + // n_intervals==1, so have a + // shortcut here to handle that + // case efficiently if (n_intervals==1) return (std::vector - (1, IteratorPair(begin, end))); + (1, IteratorPair(begin, end))); - // if more than one interval - // requested, do the full work + // if more than one interval + // requested, do the full work const unsigned int n_elements = std::distance (begin, end); const unsigned int n_elements_per_interval = n_elements / n_intervals; const unsigned int residual = n_elements % n_intervals; @@ -859,30 +859,30 @@ namespace Threads return_values[0].first = begin; for (unsigned int i=0; i=0' - // is checked (dist has a - // template type, which - // here is unsigned if no - // cast is performed) - std::advance (return_values[i].second, - static_cast(n_elements_per_interval)); - // distribute residual in - // division equally among - // the first few - // subintervals - if (i < residual) - ++return_values[i].second; - - return_values[i+1].first = return_values[i].second; - } - else - return_values[i].second = end; + if (i != n_intervals-1) + { + return_values[i].second = return_values[i].first; + // note: the cast is + // performed to avoid a + // warning of gcc that in + // the library `dist>=0' + // is checked (dist has a + // template type, which + // here is unsigned if no + // cast is performed) + std::advance (return_values[i].second, + static_cast(n_elements_per_interval)); + // distribute residual in + // division equally among + // the first few + // subintervals + if (i < residual) + ++return_values[i].second; + + return_values[i+1].first = return_values[i].second; + } + else + return_values[i].second = end; } return return_values; } @@ -895,8 +895,8 @@ namespace Threads namespace internal { /** - * @internal - * Given an arbitrary type RT, + * @internal + * Given an arbitrary type RT, * store an element of it and grant * access to it through functions * get() and set(). There are @@ -917,7 +917,7 @@ namespace Threads /** - * @internal + * @internal * Given an arbitrary type RT, * store an element of it and grant * access to it through functions @@ -942,7 +942,7 @@ namespace Threads /** - * @internal + * @internal * Given an arbitrary type RT, * store an element of it and grant * access to it through functions @@ -965,14 +965,14 @@ namespace Threads { template inline void call (const std_cxx1x::function &function, - internal::return_value &ret_val) + internal::return_value &ret_val) { ret_val.set (function()); } inline void call (const std_cxx1x::function &function, - internal::return_value &) + internal::return_value &) { function(); } @@ -983,7 +983,7 @@ namespace Threads namespace internal { /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments, and whether the @@ -1001,7 +1001,7 @@ namespace Threads /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1015,7 +1015,7 @@ namespace Threads /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1029,7 +1029,7 @@ namespace Threads /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1039,12 +1039,12 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1054,13 +1054,13 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1070,14 +1070,14 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type, - typename std_cxx1x::tuple_element<3,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type, + typename std_cxx1x::tuple_element<3,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1087,15 +1087,15 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type, - typename std_cxx1x::tuple_element<3,ArgList>::type, - typename std_cxx1x::tuple_element<4,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type, + typename std_cxx1x::tuple_element<3,ArgList>::type, + typename std_cxx1x::tuple_element<4,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1105,16 +1105,16 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type, - typename std_cxx1x::tuple_element<3,ArgList>::type, - typename std_cxx1x::tuple_element<4,ArgList>::type, - typename std_cxx1x::tuple_element<5,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type, + typename std_cxx1x::tuple_element<3,ArgList>::type, + typename std_cxx1x::tuple_element<4,ArgList>::type, + typename std_cxx1x::tuple_element<5,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1124,17 +1124,17 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type, - typename std_cxx1x::tuple_element<3,ArgList>::type, - typename std_cxx1x::tuple_element<4,ArgList>::type, - typename std_cxx1x::tuple_element<5,ArgList>::type, - typename std_cxx1x::tuple_element<6,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type, + typename std_cxx1x::tuple_element<3,ArgList>::type, + typename std_cxx1x::tuple_element<4,ArgList>::type, + typename std_cxx1x::tuple_element<5,ArgList>::type, + typename std_cxx1x::tuple_element<6,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1144,18 +1144,18 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type, - typename std_cxx1x::tuple_element<3,ArgList>::type, - typename std_cxx1x::tuple_element<4,ArgList>::type, - typename std_cxx1x::tuple_element<5,ArgList>::type, - typename std_cxx1x::tuple_element<6,ArgList>::type, - typename std_cxx1x::tuple_element<7,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type, + typename std_cxx1x::tuple_element<3,ArgList>::type, + typename std_cxx1x::tuple_element<4,ArgList>::type, + typename std_cxx1x::tuple_element<5,ArgList>::type, + typename std_cxx1x::tuple_element<6,ArgList>::type, + typename std_cxx1x::tuple_element<7,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1165,20 +1165,20 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type, - typename std_cxx1x::tuple_element<3,ArgList>::type, - typename std_cxx1x::tuple_element<4,ArgList>::type, - typename std_cxx1x::tuple_element<5,ArgList>::type, - typename std_cxx1x::tuple_element<6,ArgList>::type, - typename std_cxx1x::tuple_element<7,ArgList>::type, - typename std_cxx1x::tuple_element<8,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type, + typename std_cxx1x::tuple_element<3,ArgList>::type, + typename std_cxx1x::tuple_element<4,ArgList>::type, + typename std_cxx1x::tuple_element<5,ArgList>::type, + typename std_cxx1x::tuple_element<6,ArgList>::type, + typename std_cxx1x::tuple_element<7,ArgList>::type, + typename std_cxx1x::tuple_element<8,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to non-member * function based on the template * arguments. This is the @@ -1188,21 +1188,21 @@ namespace Threads struct fun_ptr_helper { typedef RT (type) (typename std_cxx1x::tuple_element<0,ArgList>::type, - typename std_cxx1x::tuple_element<1,ArgList>::type, - typename std_cxx1x::tuple_element<2,ArgList>::type, - typename std_cxx1x::tuple_element<3,ArgList>::type, - typename std_cxx1x::tuple_element<4,ArgList>::type, - typename std_cxx1x::tuple_element<5,ArgList>::type, - typename std_cxx1x::tuple_element<6,ArgList>::type, - typename std_cxx1x::tuple_element<7,ArgList>::type, - typename std_cxx1x::tuple_element<8,ArgList>::type, - typename std_cxx1x::tuple_element<9,ArgList>::type); + typename std_cxx1x::tuple_element<1,ArgList>::type, + typename std_cxx1x::tuple_element<2,ArgList>::type, + typename std_cxx1x::tuple_element<3,ArgList>::type, + typename std_cxx1x::tuple_element<4,ArgList>::type, + typename std_cxx1x::tuple_element<5,ArgList>::type, + typename std_cxx1x::tuple_element<6,ArgList>::type, + typename std_cxx1x::tuple_element<7,ArgList>::type, + typename std_cxx1x::tuple_element<8,ArgList>::type, + typename std_cxx1x::tuple_element<9,ArgList>::type); }; /** - * @internal + * @internal * Construct a pointer to * non-member function based on the * template arguments. We do this @@ -1231,195 +1231,195 @@ namespace Threads { #if (DEAL_II_USE_MT == 1) - /** - * A class that represents threads. For - * each thread, we create exactly one of - * these objects -- exactly one because - * it carries the returned value of the - * function called on the thread. - * - * While we have only one of these - * objects per thread, several - * Threads::Thread objects may refer to - * this descriptor. - * - * Note, however, that since this - * object holds the location - * where we store the return - * value of the thread, the - * object has to live at least as - * long as the thread - * executes. This means that even - * if all Threads::Thread objects - * that refered to this - * descriptor (through a - * std::shared_ptr) have gone out - * of scope, we must still hold - * on to the object. We do this - * by having the descriptor keep - * a pointer to itself and reset - * it to zero once it is done -- - * effectly keeping the use - * pointer above zero as long as - * work is going on. - * - * To enable the current class to - * obtain a shared_ptr from - * itself, we derive from the - * class - * std::enable_shared_from_this. - */ + /** + * A class that represents threads. For + * each thread, we create exactly one of + * these objects -- exactly one because + * it carries the returned value of the + * function called on the thread. + * + * While we have only one of these + * objects per thread, several + * Threads::Thread objects may refer to + * this descriptor. + * + * Note, however, that since this + * object holds the location + * where we store the return + * value of the thread, the + * object has to live at least as + * long as the thread + * executes. This means that even + * if all Threads::Thread objects + * that refered to this + * descriptor (through a + * std::shared_ptr) have gone out + * of scope, we must still hold + * on to the object. We do this + * by having the descriptor keep + * a pointer to itself and reset + * it to zero once it is done -- + * effectly keeping the use + * pointer above zero as long as + * work is going on. + * + * To enable the current class to + * obtain a shared_ptr from + * itself, we derive from the + * class + * std::enable_shared_from_this. + */ template struct ThreadDescriptor : public std_cxx1x::enable_shared_from_this > { - /** - * A pointer to the current - * object, kept nonzero as - * long as the thread is - * executing to avoid - * destroying the current - * object while we are still - * expecting to write - * something into the return - * value location. - */ - std_cxx1x::shared_ptr > self; - - /** - * An object that represents the - * thread started. - */ - std_cxx1x::thread thread; - - /** - * An object that will hold the value - * returned by the function called on - * the thread. - */ + /** + * A pointer to the current + * object, kept nonzero as + * long as the thread is + * executing to avoid + * destroying the current + * object while we are still + * expecting to write + * something into the return + * value location. + */ + std_cxx1x::shared_ptr > self; + + /** + * An object that represents the + * thread started. + */ + std_cxx1x::thread thread; + + /** + * An object that will hold the value + * returned by the function called on + * the thread. + */ return_value ret_val; - /** - * A bool variable that is initially - * false, is set to true when a new - * thread is started, and is set back - * to false once join() has been - * called. - * - * We use this variable to make sure - * we can call join() twice on the - * same thread. For some reason, the - * C++ standard library throws a - * std::system_error exception if one - * tries to call std::thread::join - * twice (and in fact, before the - * second call, std::thread::joinable - * returns false) but this is a - * somewhat desirable thing to do - * because one doesn't have to keep - * track whether join() has been - * called before. Using this - * variable, whenever we have called - * join() before, the variable is set - * to true and we can skip over - * calling std::thread::join() a - * second time. - * - * Further, note that we need no - * mutex for this variable: threads - * can only be join from the thread - * that created it - * originally. Consequently, - * everything that happens in a - * function that does not create - * threads (such as the join() - * function below) looks atomic to - * the outside world. Since we clear - * and test thread_is_active in the - * same function as we call - * std::thread::join, these actions - * are atomic and need no mutex. Of - * course, two threads may call - * join() on the same thread object - * at the same time, but this action - * is undefined anyway since they can - * not both join the same thread. - */ - bool thread_is_active; - - /** - * Default constructor. - */ - ThreadDescriptor () - : - thread_is_active (false) - {} - - - /** - * Start the thread and let - * it put its return value - * into the ret_val object. - * - * Note that we cannot - * already do this in the - * constructor of this class: - * we will call - * enable_shared_from_this::shared_from_this - * which requires that there - * is already a shared_ptr - * that owns this object; - * however, at the time of - * creation, there can of - * course be no shared_ptr - * that owns the object -- it - * is, after all, just being - * created and can not - * already have been handed - * off to a shared_ptr; as a - * consequence, we first - * create the object, give it - * to a shared_ptr, and then - * call shared_from_this. - */ - void start (const std_cxx1x::function &function) - { - // set the self pointer - // and then start the - // thread - self = this->shared_from_this (); - thread_is_active = true; - thread = std_cxx1x::thread (thread_entry_point, function, this); - } - - - /** - * Wait for the thread to end. - */ - void join () - { - // see if the thread hasn't been - // joined yet. if it has, then - // join() is a no-op - if (thread_is_active == true) - { - Assert (thread.joinable(), ExcInternalError()); - thread.join (); - thread_is_active = false; - } - } + /** + * A bool variable that is initially + * false, is set to true when a new + * thread is started, and is set back + * to false once join() has been + * called. + * + * We use this variable to make sure + * we can call join() twice on the + * same thread. For some reason, the + * C++ standard library throws a + * std::system_error exception if one + * tries to call std::thread::join + * twice (and in fact, before the + * second call, std::thread::joinable + * returns false) but this is a + * somewhat desirable thing to do + * because one doesn't have to keep + * track whether join() has been + * called before. Using this + * variable, whenever we have called + * join() before, the variable is set + * to true and we can skip over + * calling std::thread::join() a + * second time. + * + * Further, note that we need no + * mutex for this variable: threads + * can only be join from the thread + * that created it + * originally. Consequently, + * everything that happens in a + * function that does not create + * threads (such as the join() + * function below) looks atomic to + * the outside world. Since we clear + * and test thread_is_active in the + * same function as we call + * std::thread::join, these actions + * are atomic and need no mutex. Of + * course, two threads may call + * join() on the same thread object + * at the same time, but this action + * is undefined anyway since they can + * not both join the same thread. + */ + bool thread_is_active; + + /** + * Default constructor. + */ + ThreadDescriptor () + : + thread_is_active (false) + {} + + + /** + * Start the thread and let + * it put its return value + * into the ret_val object. + * + * Note that we cannot + * already do this in the + * constructor of this class: + * we will call + * enable_shared_from_this::shared_from_this + * which requires that there + * is already a shared_ptr + * that owns this object; + * however, at the time of + * creation, there can of + * course be no shared_ptr + * that owns the object -- it + * is, after all, just being + * created and can not + * already have been handed + * off to a shared_ptr; as a + * consequence, we first + * create the object, give it + * to a shared_ptr, and then + * call shared_from_this. + */ + void start (const std_cxx1x::function &function) + { + // set the self pointer + // and then start the + // thread + self = this->shared_from_this (); + thread_is_active = true; + thread = std_cxx1x::thread (thread_entry_point, function, this); + } + + + /** + * Wait for the thread to end. + */ + void join () + { + // see if the thread hasn't been + // joined yet. if it has, then + // join() is a no-op + if (thread_is_active == true) + { + Assert (thread.joinable(), ExcInternalError()); + thread.join (); + thread_is_active = false; + } + } private: - /** - * The function that runs on the - * thread. - */ - static - void thread_entry_point (const std_cxx1x::function function, - ThreadDescriptor *descriptor) - { - // call the function - // in question. since an + /** + * The function that runs on the + * thread. + */ + static + void thread_entry_point (const std_cxx1x::function function, + ThreadDescriptor *descriptor) + { + // call the function + // in question. since an // exception that is // thrown from one of the // called functions will @@ -1445,64 +1445,64 @@ namespace Threads } internal::deregister_thread (); - // once we are done, - // we can release our - // hold on the thread - // descriptor - // object. if all - // Threads::Thread - // object that - // pointed here - // should have gone - // out of scope - // already, then this - // will trigger - // destruction of the - // descriptor object - Assert (descriptor->self.use_count () > 0, - ExcInternalError()); - descriptor->self.reset (); - } + // once we are done, + // we can release our + // hold on the thread + // descriptor + // object. if all + // Threads::Thread + // object that + // pointed here + // should have gone + // out of scope + // already, then this + // will trigger + // destruction of the + // descriptor object + Assert (descriptor->self.use_count () > 0, + ExcInternalError()); + descriptor->self.reset (); + } }; #else - /** - * A class that represents threads. For - * each thread, we create exactly one of - * these objects -- exactly one because - * it carries the returned value of the - * function called on the thread. - * - * While we have only one of these - * objects per thread, several - * Threads::Thread objects may refer to - * this descriptor. - */ + /** + * A class that represents threads. For + * each thread, we create exactly one of + * these objects -- exactly one because + * it carries the returned value of the + * function called on the thread. + * + * While we have only one of these + * objects per thread, several + * Threads::Thread objects may refer to + * this descriptor. + */ template struct ThreadDescriptor { - /** - * An object that will hold the value - * returned by the function called on - * the thread. - */ + /** + * An object that will hold the value + * returned by the function called on + * the thread. + */ return_value ret_val; - /** - * Start the thread and - * let it put its return value into - * the ret_val object. - */ - void start (const std_cxx1x::function &function) - { - call (function, ret_val); - } - - /** - * Wait for the thread to end. - */ - void join () - {} + /** + * Start the thread and + * let it put its return value into + * the ret_val object. + */ + void start (const std_cxx1x::function &function) + { + call (function, ret_val); + } + + /** + * Wait for the thread to end. + */ + void join () + {} }; #endif @@ -1518,22 +1518,22 @@ namespace Threads * can require to wait for its * termination and access its * return value. - * - * Threads can be abandoned, - * i.e. if you just call - * Threads::new_thread but don't - * care about the returned object, - * or if you assign the return - * Threads::Thread object to an - * object that subsequently goes - * out of scope, then the thread - * previously created will still - * continue to do work. You will - * simply not be able to access its - * return value any more, and it - * may also happen that your - * program terminates before the - * thread has finished its work. + * + * Threads can be abandoned, + * i.e. if you just call + * Threads::new_thread but don't + * care about the returned object, + * or if you assign the return + * Threads::Thread object to an + * object that subsequently goes + * out of scope, then the thread + * previously created will still + * continue to do work. You will + * simply not be able to access its + * return value any more, and it + * may also happen that your + * program terminates before the + * thread has finished its work. * * The default value of the * template argument is void, @@ -1543,8 +1543,8 @@ namespace Threads * template argument. * * @author Wolfgang Bangerth, 2003, 2009 - * @ingroup threads - * @ingroup threads + * @ingroup threads + * @ingroup threads */ template class Thread @@ -1555,21 +1555,21 @@ namespace Threads * with a function object. */ Thread (const std_cxx1x::function &function) - : - thread_descriptor (new internal::ThreadDescriptor()) - { - // in a second step, start - // the thread. this needs - // to be done in two steps - // because inside the start - // function we call - // enable_shared_from_this::shared_from_this - // which requires that - // there is already a - // shared_ptr that owns the - // object - thread_descriptor->start (function); - } + : + thread_descriptor (new internal::ThreadDescriptor()) + { + // in a second step, start + // the thread. this needs + // to be done in two steps + // because inside the start + // function we call + // enable_shared_from_this::shared_from_this + // which requires that + // there is already a + // shared_ptr that owns the + // object + thread_descriptor->start (function); + } /** * Default constructor. You @@ -1591,10 +1591,10 @@ namespace Threads * then this function is a no-op. */ void join () const - { - if (thread_descriptor) - thread_descriptor->join (); - } + { + if (thread_descriptor) + thread_descriptor->join (); + } /** * Get the return value of the @@ -1605,22 +1605,22 @@ namespace Threads * also calls join(). */ RT return_value () - { - join (); - return thread_descriptor->ret_val.get(); - } - - /** - * Return true if this object - * has had a thread associated - * with it, either by using the - * non-default constructor or - * by assignment. - */ + { + join (); + return thread_descriptor->ret_val.get(); + } + + /** + * Return true if this object + * has had a thread associated + * with it, either by using the + * non-default constructor or + * by assignment. + */ bool valid () const - { - return static_cast(thread_descriptor); - } + { + return static_cast(thread_descriptor); + } /** @@ -1633,9 +1633,9 @@ namespace Threads * to compare these pointers. */ bool operator == (const Thread &t) - { - return thread_descriptor == t.thread_descriptor; - } + { + return thread_descriptor == t.thread_descriptor; + } private: /** @@ -1648,29 +1648,29 @@ namespace Threads * sure that that object lives * as long as there is at least * one subscriber to it. - * - * Note that since the - * descriptor holds the - * location where the return - * value is stored, even if all - * Threads::Thread objects that - * point to the descriptor go - * out of scope, we must make - * sure that the descriptor is - * not yet destroyed. Rather, - * the descriptor must be - * destroyed when the last - * Threads::Thread object that - * points to it goes out of - * scope or whenever the thread - * is finished, whatever - * happens later. We do this by - * having the descriptor keep a - * pointer to itself and reset - * it to zero once it is done - * -- effectly keeping the use - * pointer above zero as long - * as work is going on. + * + * Note that since the + * descriptor holds the + * location where the return + * value is stored, even if all + * Threads::Thread objects that + * point to the descriptor go + * out of scope, we must make + * sure that the descriptor is + * not yet destroyed. Rather, + * the descriptor must be + * destroyed when the last + * Threads::Thread object that + * points to it goes out of + * scope or whenever the thread + * is finished, whatever + * happens later. We do this by + * having the descriptor keep a + * pointer to itself and reset + * it to zero once it is done + * -- effectly keeping the use + * pointer above zero as long + * as work is going on. */ std_cxx1x::shared_ptr > thread_descriptor; }; @@ -1678,42 +1678,42 @@ namespace Threads namespace internal { - /** - * A general template that returns - * std_cxx1x::ref(t) if t is of reference - * type, and t otherwise. - * - * The case that t is of reference type - * is handled in a partial specialization - * declared below. - */ + /** + * A general template that returns + * std_cxx1x::ref(t) if t is of reference + * type, and t otherwise. + * + * The case that t is of reference type + * is handled in a partial specialization + * declared below. + */ template struct maybe_make_ref { - static T act (T &t) - { - return t; - } + static T act (T &t) + { + return t; + } }; - /** - * A general template that returns - * std_cxx1x::ref(t) if t is of reference - * type, and t otherwise. - * - * The case that t is of reference type - * is handled in this partial - * specialization. - */ + /** + * A general template that returns + * std_cxx1x::ref(t) if t is of reference + * type, and t otherwise. + * + * The case that t is of reference type + * is handled in this partial + * specialization. + */ template struct maybe_make_ref { - static std_cxx1x::reference_wrapper act (T &t) - { - return std_cxx1x::ref(t); - } + static std_cxx1x::reference_wrapper act (T &t) + { + return std_cxx1x::ref(t); + } }; } @@ -1722,7 +1722,7 @@ namespace Threads namespace internal { /** - * @internal + * @internal * General template declaration * of a class that is used to * encapsulate arguments to @@ -1752,7 +1752,7 @@ namespace Threads // ----------- encapsulators for function objects /** - * @internal + * @internal * Encapsulator class for * functions with no arguments. */ @@ -1760,27 +1760,27 @@ namespace Threads class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} fun_encapsulator (const std_cxx1x::function::type> &function) : function (function) - {} + {} inline Thread operator() () - { - return Thread (function); - } + { + return Thread (function); + } private: std_cxx1x::function::type> function; }; /** - * @internal + * @internal * Encapsulator class for * functions with 1 argument. */ @@ -1788,346 +1788,346 @@ namespace Threads class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} fun_encapsulator (const std_cxx1x::function::type> &function) : function (function) - {} + {} inline Thread operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1))); - } + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 2 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 2 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 3 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 3 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2, - typename std_cxx1x::tuple_element<2,ArgList>::type arg3) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2), - internal::maybe_make_ref::type>::act(arg3))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2, + typename std_cxx1x::tuple_element<2,ArgList>::type arg3) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2), + internal::maybe_make_ref::type>::act(arg3))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 4 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 4 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2, - typename std_cxx1x::tuple_element<2,ArgList>::type arg3, - typename std_cxx1x::tuple_element<3,ArgList>::type arg4) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2), - internal::maybe_make_ref::type>::act(arg3), - internal::maybe_make_ref::type>::act(arg4))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2, + typename std_cxx1x::tuple_element<2,ArgList>::type arg3, + typename std_cxx1x::tuple_element<3,ArgList>::type arg4) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2), + internal::maybe_make_ref::type>::act(arg3), + internal::maybe_make_ref::type>::act(arg4))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 5 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 5 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2, - typename std_cxx1x::tuple_element<2,ArgList>::type arg3, - typename std_cxx1x::tuple_element<3,ArgList>::type arg4, - typename std_cxx1x::tuple_element<4,ArgList>::type arg5) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2), - internal::maybe_make_ref::type>::act(arg3), - internal::maybe_make_ref::type>::act(arg4), - internal::maybe_make_ref::type>::act(arg5))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2, + typename std_cxx1x::tuple_element<2,ArgList>::type arg3, + typename std_cxx1x::tuple_element<3,ArgList>::type arg4, + typename std_cxx1x::tuple_element<4,ArgList>::type arg5) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2), + internal::maybe_make_ref::type>::act(arg3), + internal::maybe_make_ref::type>::act(arg4), + internal::maybe_make_ref::type>::act(arg5))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 6 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 6 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2, - typename std_cxx1x::tuple_element<2,ArgList>::type arg3, - typename std_cxx1x::tuple_element<3,ArgList>::type arg4, - typename std_cxx1x::tuple_element<4,ArgList>::type arg5, - typename std_cxx1x::tuple_element<5,ArgList>::type arg6) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2), - internal::maybe_make_ref::type>::act(arg3), - internal::maybe_make_ref::type>::act(arg4), - internal::maybe_make_ref::type>::act(arg5), - internal::maybe_make_ref::type>::act(arg6))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2, + typename std_cxx1x::tuple_element<2,ArgList>::type arg3, + typename std_cxx1x::tuple_element<3,ArgList>::type arg4, + typename std_cxx1x::tuple_element<4,ArgList>::type arg5, + typename std_cxx1x::tuple_element<5,ArgList>::type arg6) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2), + internal::maybe_make_ref::type>::act(arg3), + internal::maybe_make_ref::type>::act(arg4), + internal::maybe_make_ref::type>::act(arg5), + internal::maybe_make_ref::type>::act(arg6))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 7 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 7 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2, - typename std_cxx1x::tuple_element<2,ArgList>::type arg3, - typename std_cxx1x::tuple_element<3,ArgList>::type arg4, - typename std_cxx1x::tuple_element<4,ArgList>::type arg5, - typename std_cxx1x::tuple_element<5,ArgList>::type arg6, - typename std_cxx1x::tuple_element<6,ArgList>::type arg7) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2), - internal::maybe_make_ref::type>::act(arg3), - internal::maybe_make_ref::type>::act(arg4), - internal::maybe_make_ref::type>::act(arg5), - internal::maybe_make_ref::type>::act(arg6), - internal::maybe_make_ref::type>::act(arg7))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2, + typename std_cxx1x::tuple_element<2,ArgList>::type arg3, + typename std_cxx1x::tuple_element<3,ArgList>::type arg4, + typename std_cxx1x::tuple_element<4,ArgList>::type arg5, + typename std_cxx1x::tuple_element<5,ArgList>::type arg6, + typename std_cxx1x::tuple_element<6,ArgList>::type arg7) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2), + internal::maybe_make_ref::type>::act(arg3), + internal::maybe_make_ref::type>::act(arg4), + internal::maybe_make_ref::type>::act(arg5), + internal::maybe_make_ref::type>::act(arg6), + internal::maybe_make_ref::type>::act(arg7))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 8 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 8 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2, - typename std_cxx1x::tuple_element<2,ArgList>::type arg3, - typename std_cxx1x::tuple_element<3,ArgList>::type arg4, - typename std_cxx1x::tuple_element<4,ArgList>::type arg5, - typename std_cxx1x::tuple_element<5,ArgList>::type arg6, - typename std_cxx1x::tuple_element<6,ArgList>::type arg7, - typename std_cxx1x::tuple_element<7,ArgList>::type arg8) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2), - internal::maybe_make_ref::type>::act(arg3), - internal::maybe_make_ref::type>::act(arg4), - internal::maybe_make_ref::type>::act(arg5), - internal::maybe_make_ref::type>::act(arg6), - internal::maybe_make_ref::type>::act(arg7), - internal::maybe_make_ref::type>::act(arg8))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2, + typename std_cxx1x::tuple_element<2,ArgList>::type arg3, + typename std_cxx1x::tuple_element<3,ArgList>::type arg4, + typename std_cxx1x::tuple_element<4,ArgList>::type arg5, + typename std_cxx1x::tuple_element<5,ArgList>::type arg6, + typename std_cxx1x::tuple_element<6,ArgList>::type arg7, + typename std_cxx1x::tuple_element<7,ArgList>::type arg8) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2), + internal::maybe_make_ref::type>::act(arg3), + internal::maybe_make_ref::type>::act(arg4), + internal::maybe_make_ref::type>::act(arg5), + internal::maybe_make_ref::type>::act(arg6), + internal::maybe_make_ref::type>::act(arg7), + internal::maybe_make_ref::type>::act(arg8))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; - /** - * @internal - * Encapsulator class for - * functions with 9 arguments. - */ + /** + * @internal + * Encapsulator class for + * functions with 9 arguments. + */ template class fun_encapsulator { public: - fun_encapsulator (typename internal::fun_ptr::type *function) - : function (*function) - {} - - fun_encapsulator (const std_cxx1x::function::type> &function) - : function (function) - {} - - inline - Thread - operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, - typename std_cxx1x::tuple_element<1,ArgList>::type arg2, - typename std_cxx1x::tuple_element<2,ArgList>::type arg3, - typename std_cxx1x::tuple_element<3,ArgList>::type arg4, - typename std_cxx1x::tuple_element<4,ArgList>::type arg5, - typename std_cxx1x::tuple_element<5,ArgList>::type arg6, - typename std_cxx1x::tuple_element<6,ArgList>::type arg7, - typename std_cxx1x::tuple_element<7,ArgList>::type arg8, - typename std_cxx1x::tuple_element<8,ArgList>::type arg9) - { - return - Thread - (std_cxx1x::bind (function, - internal::maybe_make_ref::type>::act(arg1), - internal::maybe_make_ref::type>::act(arg2), - internal::maybe_make_ref::type>::act(arg3), - internal::maybe_make_ref::type>::act(arg4), - internal::maybe_make_ref::type>::act(arg5), - internal::maybe_make_ref::type>::act(arg6), - internal::maybe_make_ref::type>::act(arg7), - internal::maybe_make_ref::type>::act(arg8), - internal::maybe_make_ref::type>::act(arg9))); - } + fun_encapsulator (typename internal::fun_ptr::type *function) + : function (*function) + {} + + fun_encapsulator (const std_cxx1x::function::type> &function) + : function (function) + {} + + inline + Thread + operator() (typename std_cxx1x::tuple_element<0,ArgList>::type arg1, + typename std_cxx1x::tuple_element<1,ArgList>::type arg2, + typename std_cxx1x::tuple_element<2,ArgList>::type arg3, + typename std_cxx1x::tuple_element<3,ArgList>::type arg4, + typename std_cxx1x::tuple_element<4,ArgList>::type arg5, + typename std_cxx1x::tuple_element<5,ArgList>::type arg6, + typename std_cxx1x::tuple_element<6,ArgList>::type arg7, + typename std_cxx1x::tuple_element<7,ArgList>::type arg8, + typename std_cxx1x::tuple_element<8,ArgList>::type arg9) + { + return + Thread + (std_cxx1x::bind (function, + internal::maybe_make_ref::type>::act(arg1), + internal::maybe_make_ref::type>::act(arg2), + internal::maybe_make_ref::type>::act(arg3), + internal::maybe_make_ref::type>::act(arg4), + internal::maybe_make_ref::type>::act(arg5), + internal::maybe_make_ref::type>::act(arg6), + internal::maybe_make_ref::type>::act(arg7), + internal::maybe_make_ref::type>::act(arg8), + internal::maybe_make_ref::type>::act(arg9))); + } private: - std_cxx1x::function::type> function; + std_cxx1x::function::type> function; }; } @@ -2140,8 +2140,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with no arguments. - * - * @deprecated + * + * @deprecated */ template inline @@ -2156,8 +2156,8 @@ namespace Threads * Overload of the non-const spawn * function for member functions with * no arguments. - * - * @deprecated + * + * @deprecated */ template inline @@ -2173,8 +2173,8 @@ namespace Threads * Overload of the spawn function for * const member functions with no * arguments. - * - * @deprecated + * + * @deprecated */ template inline @@ -2195,8 +2195,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 1 argument. - * - * @deprecated + * + * @deprecated */ template inline @@ -2208,13 +2208,13 @@ namespace Threads - /** - * Overload of the non-const spawn - * function for member functions with - * 1 argument. - * - * @deprecated - */ + /** + * Overload of the non-const spawn + * function for member functions with + * 1 argument. + * + * @deprecated + */ template inline internal::fun_encapsulator,1> @@ -2225,13 +2225,13 @@ namespace Threads (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1)); } - /** - * Overload of the spawn function for - * const member functions with 1 - * argument. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 1 + * argument. + * + * @deprecated + */ template inline internal::fun_encapsulator,1> @@ -2249,8 +2249,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 2 arguments. - * - * @deprecated + * + * @deprecated */ template inline @@ -2262,13 +2262,13 @@ namespace Threads - /** - * Overload of the non-const spawn - * function for member functions with - * 2 arguments. - * - * @deprecated - */ + /** + * Overload of the non-const spawn + * function for member functions with + * 2 arguments. + * + * @deprecated + */ template inline internal::fun_encapsulator,2> @@ -2279,13 +2279,13 @@ namespace Threads (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2)); } - /** - * Overload of the spawn function for - * const member functions with 2 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 2 + * arguments. + * + * @deprecated + */ template inline internal::fun_encapsulator,2> @@ -2303,8 +2303,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 3 arguments. - * - * @deprecated + * + * @deprecated */ template @@ -2317,15 +2317,15 @@ namespace Threads - /** - * Overload of the non-const spawn - * function for member functions with - * 3 arguments. - * - * @deprecated - */ + /** + * Overload of the non-const spawn + * function for member functions with + * 3 arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3> inline internal::fun_encapsulator,3> spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3)) @@ -2335,15 +2335,15 @@ namespace Threads (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3)); } - /** - * Overload of the spawn function for - * const member functions with 3 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 3 + * arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3> inline internal::fun_encapsulator,3> spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3) const) @@ -2361,8 +2361,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 4 arguments. - * - * @deprecated + * + * @deprecated */ template @@ -2375,15 +2375,15 @@ namespace Threads - /** - * Overload of the non-const spawn - * function for member functions with - * 4 arguments. - * - * @deprecated - */ - template + /** + * Overload of the non-const spawn + * function for member functions with + * 4 arguments. + * + * @deprecated + */ + template inline internal::fun_encapsulator,4> spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4)) @@ -2393,15 +2393,15 @@ namespace Threads (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4)); } - /** - * Overload of the spawn function for - * const member functions with 4 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 4 + * arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline internal::fun_encapsulator,4> spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4) const) @@ -2418,8 +2418,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 5 arguments. - * - * @deprecated + * + * @deprecated */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5> inline internal::fun_encapsulator,5> spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5)) @@ -2452,16 +2452,16 @@ namespace Threads (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4, std_cxx1x::_5)); } - /** - * Overload of the spawn function for - * const member functions with 5 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 5 + * arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5> inline internal::fun_encapsulator,5> spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5) const) @@ -2478,8 +2478,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 6 arguments. - * - * @deprecated + * + * @deprecated */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6> inline internal::fun_encapsulator,6> spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6)) @@ -2512,19 +2512,19 @@ namespace Threads (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4, std_cxx1x::_5, std_cxx1x::_6)); } - /** - * Overload of the spawn function for - * const member functions with 6 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 6 + * arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6> inline internal::fun_encapsulator,6> + std_cxx1x::tuple,6> spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6) const) { return @@ -2539,8 +2539,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 7 arguments. - * - * @deprecated + * + * @deprecated */ template inline internal::fun_encapsulator,7> + Arg4, Arg5, Arg6, Arg7>,7> spawn (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) { return fun_ptr; @@ -2556,20 +2556,20 @@ namespace Threads - /** - * Overload of the non-const spawn - * function for member functions with - * 7 arguments. - * - * @deprecated - */ + /** + * Overload of the non-const spawn + * function for member functions with + * 7 arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator,7> + Arg4, Arg5, Arg6, Arg7>,7> spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7)) { return @@ -2577,21 +2577,21 @@ namespace Threads (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4, std_cxx1x::_5, std_cxx1x::_6, std_cxx1x::_7)); } - /** - * Overload of the spawn function for - * const member functions with 7 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 7 + * arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline internal::fun_encapsulator,7> + std_cxx1x::tuple,7> spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) const) { return @@ -2606,8 +2606,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 8 arguments. - * - * @deprecated + * + * @deprecated */ template inline internal::fun_encapsulator,8> + Arg4, Arg5, Arg6, + Arg7, Arg8>,8> spawn (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, Arg6,Arg7,Arg8)) { @@ -2625,47 +2625,47 @@ namespace Threads - /** - * Overload of the non-const spawn - * function for member functions with - * 8 arguments. - * - * @deprecated - */ + /** + * Overload of the non-const spawn + * function for member functions with + * 8 arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator,8> + Arg4, Arg5, Arg6, + Arg7, Arg8>,8> spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8)) + Arg6,Arg7,Arg8)) { return std_cxx1x::function >::type> (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4, std_cxx1x::_5, std_cxx1x::_6, std_cxx1x::_7, std_cxx1x::_8)); } - /** - * Overload of the spawn function for - * const member functions with 8 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 8 + * arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline internal::fun_encapsulator,8> + std_cxx1x::tuple,8> spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8) const) + Arg6,Arg7,Arg8) const) { return std_cxx1x::function >::type> @@ -2679,8 +2679,8 @@ namespace Threads * Overload of the spawn function for * non-member or static member * functions with 9 arguments. - * - * @deprecated + * + * @deprecated */ template inline internal::fun_encapsulator,9> + Arg4, Arg5, Arg6, + Arg7, Arg8, Arg9>,9> spawn (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, Arg6,Arg7,Arg8,Arg9)) { @@ -2698,47 +2698,47 @@ namespace Threads - /** - * Overload of the non-const spawn - * function for member functions with - * 9 arguments. - * - * @deprecated - */ + /** + * Overload of the non-const spawn + * function for member functions with + * 9 arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator,9> + Arg4, Arg5, Arg6, + Arg7, Arg8, Arg9>,9> spawn (C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9)) + Arg6,Arg7,Arg8,Arg9)) { return std_cxx1x::function >::type> (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::_4, std_cxx1x::_5, std_cxx1x::_6, std_cxx1x::_7, std_cxx1x::_8, std_cxx1x::_9)); } - /** - * Overload of the spawn function for - * const member functions with 9 - * arguments. - * - * @deprecated - */ + /** + * Overload of the spawn function for + * const member functions with 9 + * arguments. + * + * @deprecated + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline internal::fun_encapsulator,9> + std_cxx1x::tuple,9> spawn (const C &c, RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9) const) + Arg6,Arg7,Arg8,Arg9) const) { return std_cxx1x::function >::type> @@ -2749,7 +2749,7 @@ namespace Threads // ----------- thread starters for functions not taking any parameters - /** + /** * Overload of the new_thread function for * objects that can be converted to * std_cxx1x::function, i.e. anything @@ -2757,8 +2757,8 @@ namespace Threads * object without arguments and returning * an object of type RT (or void). * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread @@ -2772,8 +2772,8 @@ namespace Threads * non-member or static member * functions with no arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread @@ -2788,13 +2788,13 @@ namespace Threads * function for member functions with * no arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (C::*fun_ptr)(), - typename identity::type &c) + typename identity::type &c) { return Thread @@ -2808,13 +2808,13 @@ namespace Threads * const member functions with no * arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (C::*fun_ptr)() const, - const typename identity::type &c) + const typename identity::type &c) { return Thread @@ -2831,61 +2831,61 @@ namespace Threads * non-member or static member * functions with 1 argument. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (*fun_ptr)(Arg1), - typename identity::type arg1) + typename identity::type arg1) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1))); + internal::maybe_make_ref::act(arg1))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 1 argument. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 1 argument. + * + * @ingroup threads + */ template inline Thread new_thread (RT (C::*fun_ptr)(Arg1), - typename identity::type &c, - typename identity::type arg1) + typename identity::type &c, + typename identity::type arg1) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1))); + internal::maybe_make_ref::act(arg1))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 1 - * argument. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 1 + * argument. + * + * @ingroup threads + */ template inline Thread new_thread (RT (C::*fun_ptr)(Arg1) const, - typename identity::type &c, - typename identity::type arg1) + typename identity::type &c, + typename identity::type arg1) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1))); + internal::maybe_make_ref::act(arg1))); } #endif @@ -2896,67 +2896,67 @@ namespace Threads * non-member or static member * functions with 2 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (*fun_ptr)(Arg1,Arg2), - typename identity::type arg1, - typename identity::type arg2) + typename identity::type arg1, + typename identity::type arg2) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 2 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 2 arguments. + * + * @ingroup threads + */ template inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 2 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 2 + * arguments. + * + * @ingroup threads + */ template inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2))); } #endif @@ -2967,76 +2967,76 @@ namespace Threads * non-member or static member * functions with 3 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (*fun_ptr)(Arg1,Arg2,Arg3), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 3 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 3 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 3 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 3 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3))); } #endif @@ -3048,82 +3048,82 @@ namespace Threads * non-member or static member * functions with 4 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 4 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 4 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 4 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 4 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4))); } #endif @@ -3134,91 +3134,91 @@ namespace Threads * non-member or static member * functions with 5 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 5 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 5 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 5 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 5 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5))); } #endif @@ -3229,97 +3229,97 @@ namespace Threads * non-member or static member * functions with 6 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Thread new_thread (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 6 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 6 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 6 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 6 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6))); } #endif @@ -3330,8 +3330,8 @@ namespace Threads * non-member or static member * functions with 7 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template new_thread (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 7 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 7 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 7 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 7 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7))); } #endif @@ -3440,8 +3440,8 @@ namespace Threads * non-member or static member * functions with 8 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template new_thread (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8) + Arg6,Arg7,Arg8), + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 8 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 8 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8) + Arg6,Arg7,Arg8), + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 8 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 8 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8) + Arg6,Arg7,Arg8) const, + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8))); } #endif @@ -3559,8 +3559,8 @@ namespace Threads * non-member or static member * functions with 9 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template new_thread (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8, - typename identity::type arg9) + Arg6,Arg7,Arg8,Arg9), + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8, + typename identity::type arg9) { return Thread (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8), - internal::maybe_make_ref::act(arg9))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8), + internal::maybe_make_ref::act(arg9))); } - /** - * Overload of the non-const new_thread - * function for member functions with - * 9 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_thread + * function for member functions with + * 9 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8, - typename identity::type arg9) + Arg6,Arg7,Arg8,Arg9), + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8, + typename identity::type arg9) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8), - internal::maybe_make_ref::act(arg9))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8), + internal::maybe_make_ref::act(arg9))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_thread function for - * const member functions with 9 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_thread function for + * const member functions with 9 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline Thread new_thread (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8, - typename identity::type arg9) + Arg6,Arg7,Arg8,Arg9) const, + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8, + typename identity::type arg9) { return Thread (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8), - internal::maybe_make_ref::act(arg9))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8), + internal::maybe_make_ref::act(arg9))); } #endif @@ -3686,9 +3686,9 @@ namespace Threads * all together. The thread objects * need to have the same return * value for the called function. - * + * * @author Wolfgang Bangerth, 2003 - * @ingroup threads + * @ingroup threads */ template class ThreadGroup @@ -3699,10 +3699,10 @@ namespace Threads * the collection. */ ThreadGroup & operator += (const Thread &t) - { - threads.push_back (t); - return *this; - } + { + threads.push_back (t); + return *this; + } /** * Wait for all threads in the @@ -3740,37 +3740,37 @@ namespace Threads template struct TaskDescriptor; - /** - * The task class for TBB that is - * used by the TaskDescriptor - * class. - */ + /** + * The task class for TBB that is + * used by the TaskDescriptor + * class. + */ template struct TaskEntryPoint : public tbb::task { - TaskEntryPoint (TaskDescriptor &task_descriptor) - : - task_descriptor (task_descriptor) - {} - - virtual tbb::task * execute () - { - // call the function object - // and put the return value - // into the proper place - call (task_descriptor.function, task_descriptor.ret_val); - return 0; - } - - /** - * A reference to the descriptor - * object of this task. - */ - TaskDescriptor &task_descriptor; + TaskEntryPoint (TaskDescriptor &task_descriptor) + : + task_descriptor (task_descriptor) + {} + + virtual tbb::task * execute () + { + // call the function object + // and put the return value + // into the proper place + call (task_descriptor.function, task_descriptor.ret_val); + return 0; + } + + /** + * A reference to the descriptor + * object of this task. + */ + TaskDescriptor &task_descriptor; }; /** - * @internal + * @internal * Base class describing a * task. This is the basic * class abstracting the @@ -3779,45 +3779,45 @@ namespace Threads * It provides a mechanism * to start a new task, as well * as for joining it. - * - * Internally, the way things are - * implemented is that all Task<> - * objects keep a shared pointer - * to the task descriptor. When - * the last Task<> object goes - * out of scope, the destructor - * of the descriptor is - * called. Since tasks can not be - * abandoned, the destructor - * makes sure that the task is - * finished before it can - * continue to destroy the - * object. * - * Note that unlike threads, - * tasks are not always started - * right away, and so the - * starting thread can't rely on - * the fact that the started task - * can copy things off the - * spawning thread's stack - * frame. As a consequence, the - * task description needs to - * include a way to store the - * function and its arguments - * that shall be run on the task. - * + * Internally, the way things are + * implemented is that all Task<> + * objects keep a shared pointer + * to the task descriptor. When + * the last Task<> object goes + * out of scope, the destructor + * of the descriptor is + * called. Since tasks can not be + * abandoned, the destructor + * makes sure that the task is + * finished before it can + * continue to destroy the + * object. + * + * Note that unlike threads, + * tasks are not always started + * right away, and so the + * starting thread can't rely on + * the fact that the started task + * can copy things off the + * spawning thread's stack + * frame. As a consequence, the + * task description needs to + * include a way to store the + * function and its arguments + * that shall be run on the task. + * * @author Wolfgang Bangerth, 2009 */ template struct TaskDescriptor { private: - /** - * The function and its arguments - * that are to be run on the task. - */ - std_cxx1x::function function; + /** + * The function and its arguments + * that are to be run on the task. + */ + std_cxx1x::function function; /** * Variable holding the data the TBB @@ -3832,70 +3832,70 @@ namespace Threads * object go out of scope then no * action is needed on our behalf. */ - tbb::task *task; + tbb::task *task; - /** - * A place where the task will - * deposit its return value. - */ + /** + * A place where the task will + * deposit its return value. + */ return_value ret_val; - /** - * A flag indicating whether the task - * has terminated. - */ - bool task_is_done; + /** + * A flag indicating whether the task + * has terminated. + */ + bool task_is_done; public: - /** - * Constructor. Take the function to - * be run on this task as argument. - */ - TaskDescriptor (const std_cxx1x::function &function); - - /** - * Default - * constructor. Throws an - * exception since we want to - * queue a task immediately - * upon construction of these - * objects to make sure that - * each TaskDescriptor object - * corresponds to exactly one - * task. - */ - TaskDescriptor (); - - /** - * Copy constructor. Throws - * an exception since we want - * to make sure that each - * TaskDescriptor object - * corresponds to exactly one - * task. - */ - TaskDescriptor (const TaskDescriptor &); + /** + * Constructor. Take the function to + * be run on this task as argument. + */ + TaskDescriptor (const std_cxx1x::function &function); + + /** + * Default + * constructor. Throws an + * exception since we want to + * queue a task immediately + * upon construction of these + * objects to make sure that + * each TaskDescriptor object + * corresponds to exactly one + * task. + */ + TaskDescriptor (); + + /** + * Copy constructor. Throws + * an exception since we want + * to make sure that each + * TaskDescriptor object + * corresponds to exactly one + * task. + */ + TaskDescriptor (const TaskDescriptor &); /** * Destructor. */ ~TaskDescriptor (); - /** - * Queue up the task to the - * scheduler. We need to do - * this in a separate - * function since the new - * tasks needs to access - * objects from the current - * object and that can only - * reliably happen if the - * current object is - * completely constructed - * already. - */ - void queue_task (); + /** + * Queue up the task to the + * scheduler. We need to do + * this in a separate + * function since the new + * tasks needs to access + * objects from the current + * object and that can only + * reliably happen if the + * current object is + * completely constructed + * already. + */ + void queue_task (); /** * Join a task, i.e. wait @@ -3909,8 +3909,8 @@ namespace Threads void join (); - template friend struct TaskEntryPoint; - template friend struct Task; + template friend struct TaskEntryPoint; + template friend struct Task; }; @@ -3918,9 +3918,9 @@ namespace Threads template inline TaskDescriptor::TaskDescriptor (const std_cxx1x::function &function) - : - function (function), - task_is_done (false) + : + function (function), + task_is_done (false) {} @@ -3929,11 +3929,11 @@ namespace Threads void TaskDescriptor::queue_task () { - // use the pattern described in - // the TBB book on pages - // 230/231 ("Start a large task - // in parallel with the main - // program) + // use the pattern described in + // the TBB book on pages + // 230/231 ("Start a large task + // in parallel with the main + // program) task = new (tbb::task::allocate_root()) tbb::empty_task; task->set_ref_count (2); @@ -3963,28 +3963,28 @@ namespace Threads inline TaskDescriptor::~TaskDescriptor () { - // wait for the task to - // complete for sure + // wait for the task to + // complete for sure join (); - // now destroy the empty task - // structure. the book recommends to - // spawn it as well and let the - // scheduler destroy the object when - // done, but this has the disadvantage - // that the scheduler may not get to - // actually finishing the task before - // it goes out of scope (at the end of - // the program, or if a thread is done - // on which it was run) and then we - // would get a hard-to-decipher warning - // about unfinished tasks when the - // scheduler "goes out of the - // arena". rather, let's explicitly - // destroy the empty task - // object. before that, make sure that - // the task has been shut down, - // expressed by a zero reference count + // now destroy the empty task + // structure. the book recommends to + // spawn it as well and let the + // scheduler destroy the object when + // done, but this has the disadvantage + // that the scheduler may not get to + // actually finishing the task before + // it goes out of scope (at the end of + // the program, or if a thread is done + // on which it was run) and then we + // would get a hard-to-decipher warning + // about unfinished tasks when the + // scheduler "goes out of the + // arena". rather, let's explicitly + // destroy the empty task + // object. before that, make sure that + // the task has been shut down, + // expressed by a zero reference count Assert (task != 0, ExcInternalError()); Assert (task->ref_count()==0, ExcInternalError()); task->destroy (*task); @@ -3996,24 +3996,24 @@ namespace Threads void TaskDescriptor::join () { - // if the task is already done, just - // return. this makes sure we call - // tbb::Task::wait_for_all() exactly - // once, as required by TBB. we could - // also get the reference count of task - // for doing this, but that is usually - // slower. note that this does not work - // when the thread calling this - // function is not the same as the one - // that initialized the task. - // - // TODO: can we assert that no other - // thread tries to end the task? + // if the task is already done, just + // return. this makes sure we call + // tbb::Task::wait_for_all() exactly + // once, as required by TBB. we could + // also get the reference count of task + // for doing this, but that is usually + // slower. note that this does not work + // when the thread calling this + // function is not the same as the one + // that initialized the task. + // + // TODO: can we assert that no other + // thread tries to end the task? if (task_is_done == true) - return; + return; - // let TBB wait for the task to - // complete. + // let TBB wait for the task to + // complete. task_is_done = true; task->wait_for_all(); } @@ -4022,48 +4022,48 @@ namespace Threads #else // no threading enabled - /** - * A way to describe tasks. Since - * we are in non-MT mode at this - * place, things are a lot - * simpler than in MT mode. - */ + /** + * A way to describe tasks. Since + * we are in non-MT mode at this + * place, things are a lot + * simpler than in MT mode. + */ template struct TaskDescriptor { - /** - * A place where the task will - * deposit its return value. - */ + /** + * A place where the task will + * deposit its return value. + */ return_value ret_val; - /** - * Constructor. Call the - * given function and emplace - * the return value into the - * slot reserved for this - * purpose. - */ - TaskDescriptor (const std_cxx1x::function &function) - { - call (function, ret_val); - } - /** - * Wait for the task to - * return. Since we are in - * non-MT mode here, there is - * nothing to do. - */ - static void join () {} - - /** - * Run the task. Since we are - * here in non-MT mode, there - * is nothing to do that the - * constructor hasn't already - * done. - */ - static void queue_task () {} + /** + * Constructor. Call the + * given function and emplace + * the return value into the + * slot reserved for this + * purpose. + */ + TaskDescriptor (const std_cxx1x::function &function) + { + call (function, ret_val); + } + /** + * Wait for the task to + * return. Since we are in + * non-MT mode here, there is + * nothing to do. + */ + static void join () {} + + /** + * Run the task. Since we are + * here in non-MT mode, there + * is nothing to do that the + * constructor hasn't already + * done. + */ + static void queue_task () {} }; #endif @@ -4083,7 +4083,7 @@ namespace Threads * task for calling the join() method. * * @author Wolfgang Bangerth, 2009 - * @ingroup threads + * @ingroup threads */ template class Task @@ -4095,15 +4095,15 @@ namespace Threads */ public: Task (const std_cxx1x::function &function_object) - { - // create a task descriptor and tell it - // to queue itself up with the scheduling - // system - task_descriptor = - std_cxx1x::shared_ptr > - (new internal::TaskDescriptor(function_object)); - task_descriptor->queue_task (); - } + { + // create a task descriptor and tell it + // to queue itself up with the scheduling + // system + task_descriptor = + std_cxx1x::shared_ptr > + (new internal::TaskDescriptor(function_object)); + task_descriptor->queue_task (); + } /** * Default constructor. You @@ -4127,12 +4127,12 @@ namespace Threads * task object to it. */ void join () const - { - AssertThrow (task_descriptor != - std_cxx1x::shared_ptr >(), - ExcNoTask()); - task_descriptor->join (); - } + { + AssertThrow (task_descriptor != + std_cxx1x::shared_ptr >(), + ExcNoTask()); + task_descriptor->join (); + } /** * Get the return value of the @@ -4143,10 +4143,10 @@ namespace Threads * also calls join(). */ RT return_value () - { - join (); - return task_descriptor->ret_val.get(); - } + { + join (); + return task_descriptor->ret_val.get(); + } /** @@ -4159,21 +4159,21 @@ namespace Threads * to compare these pointers. */ bool operator == (const Task &t) - { - AssertThrow (task_descriptor != - std_cxx1x::shared_ptr >(), - ExcNoTask()); - return task_descriptor == t.task_descriptor; - } + { + AssertThrow (task_descriptor != + std_cxx1x::shared_ptr >(), + ExcNoTask()); + return task_descriptor == t.task_descriptor; + } - /** @addtogroup Exceptions - * @{ */ + /** @addtogroup Exceptions + * @{ */ /** * Exception */ DeclException0 (ExcNoTask); - //@} + //@} private: /** * Shared pointer to the object @@ -4196,8 +4196,8 @@ namespace Threads * object without arguments and returning * an object of type RT (or void). * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task @@ -4211,8 +4211,8 @@ namespace Threads * non-member or static member * functions with no arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task @@ -4227,13 +4227,13 @@ namespace Threads * function for member functions with * no arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (C::*fun_ptr)(), - typename identity::type &c) + typename identity::type &c) { return new_task @@ -4246,13 +4246,13 @@ namespace Threads * const member functions with no * arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (C::*fun_ptr)() const, - const typename identity::type &c) + const typename identity::type &c) { return new_task @@ -4269,61 +4269,61 @@ namespace Threads * non-member or static member * functions with 1 argument. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (*fun_ptr)(Arg1), - typename identity::type arg1) + typename identity::type arg1) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1))); + internal::maybe_make_ref::act(arg1))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 1 argument. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 1 argument. + * + * @ingroup threads + */ template inline Task new_task (RT (C::*fun_ptr)(Arg1), - typename identity::type &c, - typename identity::type arg1) + typename identity::type &c, + typename identity::type arg1) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1))); + internal::maybe_make_ref::act(arg1))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 1 - * argument. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 1 + * argument. + * + * @ingroup threads + */ template inline Task new_task (RT (C::*fun_ptr)(Arg1) const, - typename identity::type &c, - typename identity::type arg1) + typename identity::type &c, + typename identity::type arg1) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1))); + internal::maybe_make_ref::act(arg1))); } #endif @@ -4334,67 +4334,67 @@ namespace Threads * non-member or static member * functions with 2 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (*fun_ptr)(Arg1,Arg2), - typename identity::type arg1, - typename identity::type arg2) + typename identity::type arg1, + typename identity::type arg2) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 2 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 2 arguments. + * + * @ingroup threads + */ template inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 2 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 2 + * arguments. + * + * @ingroup threads + */ template inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2))); } #endif @@ -4405,76 +4405,76 @@ namespace Threads * non-member or static member * functions with 3 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 3 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 3 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 3 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 3 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3))); } #endif @@ -4486,82 +4486,82 @@ namespace Threads * non-member or static member * functions with 4 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 4 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 4 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 4 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 4 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4))); } #endif @@ -4572,91 +4572,91 @@ namespace Threads * non-member or static member * functions with 5 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 5 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 5 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 5 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 5 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5))); } #endif @@ -4667,97 +4667,97 @@ namespace Threads * non-member or static member * functions with 6 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template inline Task new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 6 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 6 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 6 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 6 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6))); } #endif @@ -4768,8 +4768,8 @@ namespace Threads * non-member or static member * functions with 7 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7) + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 7 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 7 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 7 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 7 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5,Arg6,Arg7) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7) + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7))); } #endif @@ -4878,8 +4878,8 @@ namespace Threads * non-member or static member * functions with 8 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8) + Arg6,Arg7,Arg8), + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 8 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 8 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8) + Arg6,Arg7,Arg8), + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 8 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 8 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8) + Arg6,Arg7,Arg8) const, + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8))); } #endif @@ -4997,8 +4997,8 @@ namespace Threads * non-member or static member * functions with 9 arguments. * - * @ingroup threads - */ + * @ingroup threads + */ template new_task (RT (*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9), - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8, - typename identity::type arg9) + Arg6,Arg7,Arg8,Arg9), + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8, + typename identity::type arg9) { return new_task (std_cxx1x::bind(fun_ptr, - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8), - internal::maybe_make_ref::act(arg9))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8), + internal::maybe_make_ref::act(arg9))); } - /** - * Overload of the non-const new_task - * function for member functions with - * 9 arguments. - * - * @ingroup threads - */ + /** + * Overload of the non-const new_task + * function for member functions with + * 9 arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9), - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8, - typename identity::type arg9) + Arg6,Arg7,Arg8,Arg9), + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8, + typename identity::type arg9) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::ref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8), - internal::maybe_make_ref::act(arg9))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8), + internal::maybe_make_ref::act(arg9))); } #ifndef DEAL_II_CONST_MEMBER_DEDUCTION_BUG - /** - * Overload of the new_task function for - * const member functions with 9 - * arguments. - * - * @ingroup threads - */ + /** + * Overload of the new_task function for + * const member functions with 9 + * arguments. + * + * @ingroup threads + */ template + typename Arg1, typename Arg2, typename Arg3, + typename Arg4, typename Arg5, typename Arg6, + typename Arg7, typename Arg8, typename Arg9> inline Task new_task (RT (C::*fun_ptr)(Arg1,Arg2,Arg3,Arg4,Arg5, - Arg6,Arg7,Arg8,Arg9) const, - typename identity::type &c, - typename identity::type arg1, - typename identity::type arg2, - typename identity::type arg3, - typename identity::type arg4, - typename identity::type arg5, - typename identity::type arg6, - typename identity::type arg7, - typename identity::type arg8, - typename identity::type arg9) + Arg6,Arg7,Arg8,Arg9) const, + typename identity::type &c, + typename identity::type arg1, + typename identity::type arg2, + typename identity::type arg3, + typename identity::type arg4, + typename identity::type arg5, + typename identity::type arg6, + typename identity::type arg7, + typename identity::type arg8, + typename identity::type arg9) { return new_task (std_cxx1x::bind(fun_ptr, std_cxx1x::cref(c), - internal::maybe_make_ref::act(arg1), - internal::maybe_make_ref::act(arg2), - internal::maybe_make_ref::act(arg3), - internal::maybe_make_ref::act(arg4), - internal::maybe_make_ref::act(arg5), - internal::maybe_make_ref::act(arg6), - internal::maybe_make_ref::act(arg7), - internal::maybe_make_ref::act(arg8), - internal::maybe_make_ref::act(arg9))); + internal::maybe_make_ref::act(arg1), + internal::maybe_make_ref::act(arg2), + internal::maybe_make_ref::act(arg3), + internal::maybe_make_ref::act(arg4), + internal::maybe_make_ref::act(arg5), + internal::maybe_make_ref::act(arg6), + internal::maybe_make_ref::act(arg7), + internal::maybe_make_ref::act(arg8), + internal::maybe_make_ref::act(arg9))); } #endif @@ -5126,16 +5126,16 @@ namespace Threads * need to have the same return * value for the called function. * - * Note that the call to join_all() must be - * executed on the same thread as the calls - * that add subtasks. Otherwise, there - * might be a deadlock. In other words, a - * Task object should never passed on to - * another task for calling the join() - * method. - * + * Note that the call to join_all() must be + * executed on the same thread as the calls + * that add subtasks. Otherwise, there + * might be a deadlock. In other words, a + * Task object should never passed on to + * another task for calling the join() + * method. + * * @author Wolfgang Bangerth, 2003 - * @ingroup tasks + * @ingroup tasks */ template class TaskGroup @@ -5146,10 +5146,10 @@ namespace Threads * the collection. */ TaskGroup & operator += (const Task &t) - { - tasks.push_back (t); - return *this; - } + { + tasks.push_back (t); + return *this; + } /** * Wait for all tasks in the diff --git a/deal.II/include/deal.II/base/timer.h b/deal.II/include/deal.II/base/timer.h index 7f43b6408a..1153a9b50e 100644 --- a/deal.II/include/deal.II/base/timer.h +++ b/deal.II/include/deal.II/base/timer.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -71,184 +71,184 @@ DEAL_II_NAMESPACE_OPEN class Timer { public: - /** - * Constructor. Starts the timer at 0 sec. - */ + /** + * Constructor. Starts the timer at 0 sec. + */ Timer (); #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - /** - * Constructor that takes an MPI - * communicator as input. A timer - * constructed this way will sum up the - * CPU times over all processors in the - * MPI network when requested by the - * operator (). - * - * Starts the timer at 0 sec. - * - * If @p sync_wall_time is true, the wall - * time is synchronized between all CPUs - * using a MPI_Barrier() and a collective - * operation. Note that this only works - * if you stop() the timer before - * querying for the wall time. The time - * for the MPI operations are not - * included in the timing but may slow - * down your program. - * - * This constructor is only available - * if the deal.II compiler is an MPI - * compiler. - */ + /** + * Constructor that takes an MPI + * communicator as input. A timer + * constructed this way will sum up the + * CPU times over all processors in the + * MPI network when requested by the + * operator (). + * + * Starts the timer at 0 sec. + * + * If @p sync_wall_time is true, the wall + * time is synchronized between all CPUs + * using a MPI_Barrier() and a collective + * operation. Note that this only works + * if you stop() the timer before + * querying for the wall time. The time + * for the MPI operations are not + * included in the timing but may slow + * down your program. + * + * This constructor is only available + * if the deal.II compiler is an MPI + * compiler. + */ Timer (MPI_Comm mpi_communicator, - bool sync_wall_time = false); - - /** - * Returns a reference to the data - * structure with global timing - * information. Filled after calling - * stop(). - */ + bool sync_wall_time = false); + + /** + * Returns a reference to the data + * structure with global timing + * information. Filled after calling + * stop(). + */ const Utilities::MPI::MinMaxAvg & get_data() const; - /** - * Prints the data to the given stream. - */ + /** + * Prints the data to the given stream. + */ template void print_data(STREAM & stream) const; #endif - /** - * Re-start the timer at the point where - * it was stopped. This way a cumulative - * measurement of time is possible. - */ + /** + * Re-start the timer at the point where + * it was stopped. This way a cumulative + * measurement of time is possible. + */ void start (); - /** - * Sets the current time as next - * starting time and return the - * elapsed time in seconds. - */ + /** + * Sets the current time as next + * starting time and return the + * elapsed time in seconds. + */ double stop (); - /** - * Stop the timer if necessary and reset - * the elapsed time to zero. - */ + /** + * Stop the timer if necessary and reset + * the elapsed time to zero. + */ void reset (); - /** - * Resets the elapsed time to zero and - * starts the timer. This corresponds to - * calling @p reset() and @p start() on - * the Timer object. - */ + /** + * Resets the elapsed time to zero and + * starts the timer. This corresponds to + * calling @p reset() and @p start() on + * the Timer object. + */ void restart(); - /** - * Access to the current CPU time - * without disturbing time - * measurement. The elapsed time is - * returned in units of seconds. - */ + /** + * Access to the current CPU time + * without disturbing time + * measurement. The elapsed time is + * returned in units of seconds. + */ double operator() () const; - /** - * Access to the current wall time - * without disturbing time - * measurement. The elapsed time is - * returned in units of seconds. - */ + /** + * Access to the current wall time + * without disturbing time + * measurement. The elapsed time is + * returned in units of seconds. + */ double wall_time () const; private: - /** - * Value of the user time when start() - * was called the last time or when the - * object was created and no stop() was - * issued in between. - */ + /** + * Value of the user time when start() + * was called the last time or when the + * object was created and no stop() was + * issued in between. + */ double start_time; - /** - * Similar to #start_time, but - * needed for children threads - * in multithread mode. Value of - * the user time when start() - * was called the last time or - * when the object was created - * and no stop() was issued in - * between. - * - * For some reason (error in - * operating system?) the - * function call - * getrusage(RUSAGE_CHILDREN,.) - * gives always 0 (at least - * on Solaris7). Hence the - * Timer class still does not - * yet work for multithreading - * mode. - */ + /** + * Similar to #start_time, but + * needed for children threads + * in multithread mode. Value of + * the user time when start() + * was called the last time or + * when the object was created + * and no stop() was issued in + * between. + * + * For some reason (error in + * operating system?) the + * function call + * getrusage(RUSAGE_CHILDREN,.) + * gives always 0 (at least + * on Solaris7). Hence the + * Timer class still does not + * yet work for multithreading + * mode. + */ double start_time_children; - /** - * Value of the wall time when start() - * was called the last time or when the - * object was created and no stop() was - * issued in between. - */ + /** + * Value of the wall time when start() + * was called the last time or when the + * object was created and no stop() was + * issued in between. + */ double start_wall_time; - /** - * Accumulated time for all previous - * start()/stop() cycles. The time for - * the present cycle is not included. - */ + /** + * Accumulated time for all previous + * start()/stop() cycles. The time for + * the present cycle is not included. + */ double cumulative_time; - /** - * Accumulated wall time for all - * previous start()/stop() cycles. The - * wall time for the present cycle is - * not included. - */ + /** + * Accumulated wall time for all + * previous start()/stop() cycles. The + * wall time for the present cycle is + * not included. + */ double cumulative_wall_time; - /** - * Store whether the timer is presently - * running. - */ + /** + * Store whether the timer is presently + * running. + */ bool running; - /** - * Store whether the timer is presently - * running. - */ + /** + * Store whether the timer is presently + * running. + */ MPI_Comm mpi_communicator; #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - /** - * Store whether the wall time is - * synchronized between machines. - */ + /** + * Store whether the wall time is + * synchronized between machines. + */ bool sync_wall_time; - /** - * A structure for parallel wall time - * measurement that includes the minimum - * time recorded among all processes, the - * maximum time as well as the average - * time defined as the sum of all - * individual times divided by the number - * of MPI processes in the MPI_Comm. - */ + /** + * A structure for parallel wall time + * measurement that includes the minimum + * time recorded among all processes, the + * maximum time as well as the average + * time defined as the sum of all + * individual times divided by the number + * of MPI processes in the MPI_Comm. + */ Utilities::System::MinMaxAvg mpi_data; #endif }; @@ -320,202 +320,202 @@ class Timer class TimerOutput { public: - /** - * Sets whether to generate output every - * time we exit a section, just in the - * end, or both. - */ + /** + * Sets whether to generate output every + * time we exit a section, just in the + * end, or both. + */ enum OutputFrequency {every_call, summary, every_call_and_summary} output_frequency; - /** - * Sets whether to show CPU times, wall - * times, or both CPU and wall times. - */ + /** + * Sets whether to show CPU times, wall + * times, or both CPU and wall times. + */ enum OutputType {cpu_times, wall_times, cpu_and_wall_times} output_type; - /** - * Constructor that takes std::cout as - * output stream. - */ + /** + * Constructor that takes std::cout as + * output stream. + */ TimerOutput (std::ostream &stream, - const enum OutputFrequency output_frequency, - const enum OutputType output_type); + const enum OutputFrequency output_frequency, + const enum OutputType output_type); - /** - * Constructor that takes a - * ConditionalOStream to write output to. - */ + /** + * Constructor that takes a + * ConditionalOStream to write output to. + */ TimerOutput (ConditionalOStream &stream, - const enum OutputFrequency output_frequency, - const enum OutputType output_type); + const enum OutputFrequency output_frequency, + const enum OutputType output_type); #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - /** - * Constructor that takes an MPI - * communicator as input. A timer - * constructed this way will sum up the - * CPU times over all processors in the - * MPI network for calculating the CPU - * time. - * - * Meant for using std::cout as output - * stream. - */ + /** + * Constructor that takes an MPI + * communicator as input. A timer + * constructed this way will sum up the + * CPU times over all processors in the + * MPI network for calculating the CPU + * time. + * + * Meant for using std::cout as output + * stream. + */ TimerOutput (MPI_Comm mpi_comm, - std::ostream &stream, - const enum OutputFrequency output_frequency, - const enum OutputType output_type); - - /** - * Constructor that takes an MPI - * communicator as input. A timer - * constructed this way will sum up the - * CPU times over all processors in the - * MPI network for calculating the CPU - * time. - * - * Constructor that takes a - * ConditionalOStream to write output to. - */ + std::ostream &stream, + const enum OutputFrequency output_frequency, + const enum OutputType output_type); + + /** + * Constructor that takes an MPI + * communicator as input. A timer + * constructed this way will sum up the + * CPU times over all processors in the + * MPI network for calculating the CPU + * time. + * + * Constructor that takes a + * ConditionalOStream to write output to. + */ TimerOutput (MPI_Comm mpi_comm, - ConditionalOStream &stream, - const enum OutputFrequency output_frequency, - const enum OutputType output_type); + ConditionalOStream &stream, + const enum OutputFrequency output_frequency, + const enum OutputType output_type); #endif - /** - * Destructor. Calls print_summary() in - * case the option for writing the - * summary output is set. - */ + /** + * Destructor. Calls print_summary() in + * case the option for writing the + * summary output is set. + */ ~TimerOutput(); - /** - * Open a section by given a string name - * of it. In case the name already - * exists, that section is done once - * again. - */ + /** + * Open a section by given a string name + * of it. In case the name already + * exists, that section is done once + * again. + */ void enter_subsection (const std::string §ion_name); - /** - * Same as @p enter_subsection. - */ + /** + * Same as @p enter_subsection. + */ void enter_section (const std::string §ion_name); - /** - * Leave a section. If no name is given, - * the last section that was entered is - * left. - */ + /** + * Leave a section. If no name is given, + * the last section that was entered is + * left. + */ void leave_subsection (const std::string §ion_name = std::string()); - /** - * Same as @p leave_subsection. - */ + /** + * Same as @p leave_subsection. + */ void exit_section (const std::string §ion_name = std::string()); - /** - * Print a formatted table that - * summarizes the time consumed in the - * various sections. - */ + /** + * Print a formatted table that + * summarizes the time consumed in the + * various sections. + */ void print_summary () const; - /** - * By calling this function, all output - * can be disabled. This function - * together with enable_output() can be - * useful if one wants to control the - * output in a flexible way without - * putting a lot of if clauses - * in the program. - */ + /** + * By calling this function, all output + * can be disabled. This function + * together with enable_output() can be + * useful if one wants to control the + * output in a flexible way without + * putting a lot of if clauses + * in the program. + */ void disable_output (); - /** - * This function re-enables output of - * this class if it was previously - * disabled with disable_output(). This - * function together with - * disable_output() can be useful if - * one wants to control the output in a - * flexible way without putting a lot - * of if clauses in the - * program. - */ + /** + * This function re-enables output of + * this class if it was previously + * disabled with disable_output(). This + * function together with + * disable_output() can be useful if + * one wants to control the output in a + * flexible way without putting a lot + * of if clauses in the + * program. + */ void enable_output (); private: - /** - * A timer object for the overall - * run time. If we are using MPI, - * this timer also accumulates - * over all MPI processes. - */ + /** + * A timer object for the overall + * run time. If we are using MPI, + * this timer also accumulates + * over all MPI processes. + */ Timer timer_all; - /** - * A structure that groups all - * information that we collect - * about each of the sections. - */ + /** + * A structure that groups all + * information that we collect + * about each of the sections. + */ struct Section { - Timer timer; - double total_cpu_time; - double total_wall_time; - unsigned int n_calls; + Timer timer; + double total_cpu_time; + double total_wall_time; + unsigned int n_calls; }; - /** - * A list of all the sections and - * their information. - */ + /** + * A list of all the sections and + * their information. + */ std::map sections; - /** - * The stream object to which we - * are to output. - */ + /** + * The stream object to which we + * are to output. + */ ConditionalOStream out_stream; - /** - * A boolean variable that sets whether - * output of this class is currently on - * or off. - */ + /** + * A boolean variable that sets whether + * output of this class is currently on + * or off. + */ bool output_is_enabled; - /** - * A list of the sections that - * have been entered and not - * exited. The list is kept in - * the order in which sections - * have been entered, but - * elements may be removed in the - * middle if an argument is given - * to the exit_section() - * function. - */ + /** + * A list of the sections that + * have been entered and not + * exited. The list is kept in + * the order in which sections + * have been entered, but + * elements may be removed in the + * middle if an argument is given + * to the exit_section() + * function. + */ std::list active_sections; - /** - * mpi communicator - */ + /** + * mpi communicator + */ MPI_Comm mpi_communicator; - /** - * A lock that makes sure that this - * class gives reasonable results even - * when used with several threads. - */ + /** + * A lock that makes sure that this + * class gives reasonable results even + * when used with several threads. + */ Threads::ThreadMutex mutex; }; @@ -552,10 +552,10 @@ Timer::print_data(STREAM & stream) const unsigned int my_id = dealii::Utilities::MPI::this_mpi_process(mpi_communicator); if (my_id==0) stream << mpi_data.max << " wall," - << " max @" << mpi_data.max_index - << ", min=" << mpi_data.min << " @" << mpi_data.min_index - << ", avg=" << mpi_data.avg - << std::endl; + << " max @" << mpi_data.max_index + << ", min=" << mpi_data.min << " @" << mpi_data.min_index + << ", avg=" << mpi_data.avg + << std::endl; } #endif diff --git a/deal.II/include/deal.II/base/types.h b/deal.II/include/deal.II/base/types.h index 34d67e1ece..a1d59a4418 100644 --- a/deal.II/include/deal.II/base/types.h +++ b/deal.II/include/deal.II/base/types.h @@ -23,58 +23,58 @@ DEAL_II_NAMESPACE_OPEN */ namespace types { - /** - * The type used to denote - * subdomain_ids of cells. - * - * See the @ref GlossSubdomainId - * "glossary" for more information. - */ + /** + * The type used to denote + * subdomain_ids of cells. + * + * See the @ref GlossSubdomainId + * "glossary" for more information. + */ typedef unsigned int subdomain_id_t; - /** - * A special id for an invalid - * subdomain id. This value may not - * be used as a valid id but is - * used, for example, for default - * arguments to indicate a - * subdomain id that is not to be - * used. - * - * See the @ref GlossSubdomainId - * "glossary" for more information. - */ + /** + * A special id for an invalid + * subdomain id. This value may not + * be used as a valid id but is + * used, for example, for default + * arguments to indicate a + * subdomain id that is not to be + * used. + * + * See the @ref GlossSubdomainId + * "glossary" for more information. + */ const unsigned int invalid_subdomain_id = static_cast(-1); - /** - * The subdomain id assigned to a - * cell whose true subdomain id we - * don't know, for example because - * it resides on a different - * processor on a mesh that is kept - * distributed on many - * processors. Such cells are - * called "artificial". - * - * See the glossary entries on @ref - * GlossSubdomainId "subdomain ids" - * and @ref GlossArtificialCell - * "artificial cells" as well as - * the @ref distributed module for - * more information. - */ + /** + * The subdomain id assigned to a + * cell whose true subdomain id we + * don't know, for example because + * it resides on a different + * processor on a mesh that is kept + * distributed on many + * processors. Such cells are + * called "artificial". + * + * See the glossary entries on @ref + * GlossSubdomainId "subdomain ids" + * and @ref GlossArtificialCell + * "artificial cells" as well as + * the @ref distributed module for + * more information. + */ const unsigned int artificial_subdomain_id = static_cast(-2); - /** - * The type used to denote global dof - * indices. - */ + /** + * The type used to denote global dof + * indices. + */ typedef unsigned int global_dof_index; - /** - * An invalid value for indices of degrees - * of freedom. - */ + /** + * An invalid value for indices of degrees + * of freedom. + */ const global_dof_index invalid_dof_index = static_cast(-1); /** diff --git a/deal.II/include/deal.II/base/utilities.h b/deal.II/include/deal.II/base/utilities.h index 30cb6728bd..8750535850 100644 --- a/deal.II/include/deal.II/base/utilities.h +++ b/deal.II/include/deal.II/base/utilities.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -49,16 +49,16 @@ namespace Utilities * Convert a number @p i to a string, with * as many digits as given to fill with * leading zeros. - * - * If the second parameter is left at its - * default value, the number is not padded - * with leading zeros. The result is then - * the same as of the standard C function - * itoa() had been called. + * + * If the second parameter is left at its + * default value, the number is not padded + * with leading zeros. The result is then + * the same as of the standard C function + * itoa() had been called. */ std::string int_to_string (const unsigned int i, - const unsigned int digits = numbers::invalid_unsigned_int); + const unsigned int digits = numbers::invalid_unsigned_int); /** * Determine how many digits are needed to @@ -135,31 +135,31 @@ namespace Utilities const unsigned int width, const char delimiter = ' '); - /** - * Return true if the given pattern - * string appears in the first - * position of the string. - */ + /** + * Return true if the given pattern + * string appears in the first + * position of the string. + */ bool match_at_string_start (const std::string &name, - const std::string &pattern); - - /** - * Read a (signed) integer starting - * at the position in @p name - * indicated by the second - * argument, and retun this integer - * as a pair together with how many - * characters it takes up in the - * string. - * - * If no integer can be read at the - * indicated position, return - * (-1,numbers::invalid_unsigned_int) - */ + const std::string &pattern); + + /** + * Read a (signed) integer starting + * at the position in @p name + * indicated by the second + * argument, and retun this integer + * as a pair together with how many + * characters it takes up in the + * string. + * + * If no integer can be read at the + * indicated position, return + * (-1,numbers::invalid_unsigned_int) + */ std::pair get_integer_at_position (const std::string &name, - const unsigned int position); + const unsigned int position); /** * Generate a random number from a @@ -169,105 +169,105 @@ namespace Utilities */ double generate_normal_random_number (const double a, - const double sigma); - - - /** - * Calculate a fixed power, provided as a - * template argument, of a number. - * - * This function provides an efficient way - * to calculate things like - * t^N where N is - * a known number at compile time. - * - * Use this function as in - * fixed_power@ (n). - */ + const double sigma); + + + /** + * Calculate a fixed power, provided as a + * template argument, of a number. + * + * This function provides an efficient way + * to calculate things like + * t^N where N is + * a known number at compile time. + * + * Use this function as in + * fixed_power@ (n). + */ template T fixed_power (const T t); - /** - * Optimized replacement for - * std::lower_bound for - * searching within the range of - * column indices. Slashes - * execution time by - * approximately one half for the - * present application, partly - * because because the - * binary search is replaced by a - * linear search for small loop - * lengths. - * - * Another reason for this function is - * rather obscure: - * when using the GCC libstdc++ - * function std::lower_bound, - * complexity is O(log(N)) as - * required. However, when using the - * debug version of the GCC libstdc++ - * as we do when running the testsuite, - * then std::lower_bound tests whether - * the sequence is in fact partitioned - * with respect to the pivot 'value' - * (i.e. in essence that the sequence - * is sorted as required for binary - * search to work). However, verifying - * this means that the complexity of - * std::lower_bound jumps to O(N); we - * call this function O(N) times below, - * making the overall complexity - * O(N**2). The consequence is that a - * few tests with big meshes completely - * run off the wall time limit for - * tests and fail with the libstdc++ - * debug mode - * - * This function simply makes the - * assumption that the sequence is - * sorted, and we simply don't do the - * additional check. - */ + /** + * Optimized replacement for + * std::lower_bound for + * searching within the range of + * column indices. Slashes + * execution time by + * approximately one half for the + * present application, partly + * because because the + * binary search is replaced by a + * linear search for small loop + * lengths. + * + * Another reason for this function is + * rather obscure: + * when using the GCC libstdc++ + * function std::lower_bound, + * complexity is O(log(N)) as + * required. However, when using the + * debug version of the GCC libstdc++ + * as we do when running the testsuite, + * then std::lower_bound tests whether + * the sequence is in fact partitioned + * with respect to the pivot 'value' + * (i.e. in essence that the sequence + * is sorted as required for binary + * search to work). However, verifying + * this means that the complexity of + * std::lower_bound jumps to O(N); we + * call this function O(N) times below, + * making the overall complexity + * O(N**2). The consequence is that a + * few tests with big meshes completely + * run off the wall time limit for + * tests and fail with the libstdc++ + * debug mode + * + * This function simply makes the + * assumption that the sequence is + * sorted, and we simply don't do the + * additional check. + */ template Iterator lower_bound (Iterator first, - Iterator last, - const T &val); + Iterator last, + const T &val); - /** - * The same function as above, but taking - * an argument that is used to compare - * individual elements of the sequence of - * objects pointed to by the iterators. - */ + /** + * The same function as above, but taking + * an argument that is used to compare + * individual elements of the sequence of + * objects pointed to by the iterators. + */ template Iterator lower_bound (Iterator first, - Iterator last, - const T &val, - const Comp comp); - - /** - * Given a permutation vector (i.e. a - * vector $p_0\ldots p_{N-1}$ where each - * $p_i\in [0,N)$ and $p_i\neq p_j$ for - * $i\neq j$), produce the reverse - * permutation $q_i=N-1-p_i$. - */ + Iterator last, + const T &val, + const Comp comp); + + /** + * Given a permutation vector (i.e. a + * vector $p_0\ldots p_{N-1}$ where each + * $p_i\in [0,N)$ and $p_i\neq p_j$ for + * $i\neq j$), produce the reverse + * permutation $q_i=N-1-p_i$. + */ std::vector reverse_permutation (const std::vector &permutation); - /** - * Given a permutation vector (i.e. a - * vector $p_0\ldots p_{N-1}$ where each - * $p_i\in [0,N)$ and $p_i\neq p_j$ for - * $i\neq j$), produce the inverse - * permutation $q_0\ldots q_{N-1}$ so that - * $q_{p_i}=p_{q_i}=i$. - */ + /** + * Given a permutation vector (i.e. a + * vector $p_0\ldots p_{N-1}$ where each + * $p_i\in [0,N)$ and $p_i\neq p_j$ for + * $i\neq j$), produce the inverse + * permutation $q_0\ldots q_{N-1}$ so that + * $q_{p_i}=p_{q_i}=i$. + */ std::vector invert_permutation (const std::vector &permutation); @@ -292,27 +292,27 @@ namespace Utilities */ double get_cpu_load (); - /** - * Structure that hold information about - * memory usage in kB. Used by - * get_memory_stats(). See man 5 proc - * entry /status for details. - */ + /** + * Structure that hold information about + * memory usage in kB. Used by + * get_memory_stats(). See man 5 proc + * entry /status for details. + */ struct MemoryStats { - unsigned long int VmPeak; /** peak virtual memory size in kB */ - unsigned long int VmSize; /** current virtual memory size in kB */ - unsigned long int VmHWM; /** peak resident memory size in kB */ - unsigned long int VmRSS; /** current resident memory size in kB */ + unsigned long int VmPeak; /** peak virtual memory size in kB */ + unsigned long int VmSize; /** current virtual memory size in kB */ + unsigned long int VmHWM; /** peak resident memory size in kB */ + unsigned long int VmRSS; /** current resident memory size in kB */ }; - /** - * Fills the @param stats structure with - * information about the memory - * consumption of this process. This is - * only implemented on Linux. - */ + /** + * Fills the @param stats structure with + * information about the memory + * consumption of this process. This is + * only implemented on Linux. + */ void get_memory_stats (MemoryStats & stats); @@ -328,107 +328,107 @@ namespace Utilities */ std::string get_time (); - /** - * Return whether (i) deal.II has - * been compiled to support MPI - * (for example by compiling with - * CXX=mpiCC) and if - * so whether (ii) - * MPI_Init() has - * been called (for example using - * the - * Utilities::System::MPI_InitFinalize - * class). In other words, the - * result indicates whether the - * current job is running under - * MPI. - * - * @note The function does not - * take into account whether an - * MPI job actually runs on more - * than one processor or is, in - * fact, a single-node job that - * happens to run under MPI. - */ + /** + * Return whether (i) deal.II has + * been compiled to support MPI + * (for example by compiling with + * CXX=mpiCC) and if + * so whether (ii) + * MPI_Init() has + * been called (for example using + * the + * Utilities::System::MPI_InitFinalize + * class). In other words, the + * result indicates whether the + * current job is running under + * MPI. + * + * @note The function does not + * take into account whether an + * MPI job actually runs on more + * than one processor or is, in + * fact, a single-node job that + * happens to run under MPI. + */ bool job_supports_mpi (); - /** - * Alias for job_supports_mpi(). - * - * @deprecated - */ + /** + * Alias for job_supports_mpi(). + * + * @deprecated + */ bool program_uses_mpi (); - /** - * @name Functions that work - * in parallel via MPI. The - * functions following here - * are all deprecated and have - * been moved to namespace - * Utilities::MPI. - */ - /** @{ */ - - /** - * This function is an alias for - * Utilities::MPI::n_mpi_processes. - * - * @deprecated - */ + /** + * @name Functions that work + * in parallel via MPI. The + * functions following here + * are all deprecated and have + * been moved to namespace + * Utilities::MPI. + */ + /** @{ */ + + /** + * This function is an alias for + * Utilities::MPI::n_mpi_processes. + * + * @deprecated + */ unsigned int get_n_mpi_processes (const MPI_Comm &mpi_communicator); - /** - * This function is an alias for - * Utilities::MPI::this_mpi_process. - * - * @deprecated - */ + /** + * This function is an alias for + * Utilities::MPI::this_mpi_process. + * + * @deprecated + */ unsigned int get_this_mpi_process (const MPI_Comm &mpi_communicator); - /** - * This function is an alias for - * Utilities::MPI::compute_point_to_point_communication_pattern. - * - * @deprecated - */ + /** + * This function is an alias for + * Utilities::MPI::compute_point_to_point_communication_pattern. + * + * @deprecated + */ using Utilities::MPI::compute_point_to_point_communication_pattern; - /** - * This function is an alias for - * Utilities::MPI::duplicate_communicator. - * - * @deprecated - */ + /** + * This function is an alias for + * Utilities::MPI::duplicate_communicator. + * + * @deprecated + */ using Utilities::MPI::duplicate_communicator; - /** - * An alias for Utilities::MPI::MinMaxAvg. - * - * @deprecated - */ + /** + * An alias for Utilities::MPI::MinMaxAvg. + * + * @deprecated + */ using Utilities::MPI::MinMaxAvg; - /** - * An alias for Utilities::MPI::min_max_avg. - * - * @deprecated - */ + /** + * An alias for Utilities::MPI::min_max_avg. + * + * @deprecated + */ void calculate_collective_mpi_min_max_avg (const MPI_Comm &mpi_communicator, - const double my_value, - MinMaxAvg & result); - - /** - * An alias for Utilities::MPI::MPI_InitFinalize. - * - * @deprecated - */ + const double my_value, + MinMaxAvg & result); + + /** + * An alias for Utilities::MPI::MPI_InitFinalize. + * + * @deprecated + */ using Utilities::MPI::MPI_InitFinalize; - /** @} */ + /** @} */ } @@ -440,175 +440,175 @@ namespace Utilities */ namespace Trilinos { - /** - * Returns a Trilinos Epetra_Comm - * object needed for creation of - * Epetra_Maps. - * - * If deal.II has been configured to use - * a compiler that does not support MPI - * then the resulting communicator will - * be a serial one. Otherwise, the - * communicator will correspond to - * MPI_COMM_WORLD, i.e. a communicator - * that encompasses all processes within - * this MPI universe. - */ + /** + * Returns a Trilinos Epetra_Comm + * object needed for creation of + * Epetra_Maps. + * + * If deal.II has been configured to use + * a compiler that does not support MPI + * then the resulting communicator will + * be a serial one. Otherwise, the + * communicator will correspond to + * MPI_COMM_WORLD, i.e. a communicator + * that encompasses all processes within + * this MPI universe. + */ const Epetra_Comm& comm_world(); - /** - * Returns a Trilinos Epetra_Comm - * object needed for creation of - * Epetra_Maps. - * - * If deal.II has been configured to use - * a compiler that does not support MPI - * then the resulting communicator will - * be a serial one. Otherwise, the - * communicator will correspond to - * MPI_COMM_SELF, i.e. a communicator - * that comprises only this one - * processor. - */ + /** + * Returns a Trilinos Epetra_Comm + * object needed for creation of + * Epetra_Maps. + * + * If deal.II has been configured to use + * a compiler that does not support MPI + * then the resulting communicator will + * be a serial one. Otherwise, the + * communicator will correspond to + * MPI_COMM_SELF, i.e. a communicator + * that comprises only this one + * processor. + */ const Epetra_Comm& comm_self(); - /** - * Given a communicator, duplicate it. If - * the given communicator is serial, that - * means to just return a copy of - * itself. On the other hand, if it is - * %parallel, we duplicate the underlying - * MPI_Comm object: we create a separate - * MPI communicator that contains the - * same processors and in the same order - * but has a separate identifier distinct - * from the given communicator. The - * function returns a pointer to a new - * object of a class derived from - * Epetra_Comm. The caller of this - * function needs to assume ownership of - * this function. The returned object - * should be destroyed using the - * destroy_communicator() function. - * - * This facility is used to separate - * streams of communication. For example, - * a program could simply use - * MPI_Comm_World for everything. But it - * is easy to come up with scenarios - * where sometimes not all processors - * participate in a communication that is - * intended to be global -- for example - * if we assemble a matrix on a coarse - * mesh with fewer cells than there are - * processors, some processors may not - * sync their matrices with the rest - * because they haven't written into it - * because they own no cells. That's - * clearly a bug. However, if these - * processors just continue their work, - * and the next %parallel operation - * happens to be a sync on a different - * matrix, then the sync could succeed -- - * by accident, since different - * processors are talking about different - * matrices. - * - * This kind of situation can be avoided - * if we use different communicators for - * different matrices which reduces the - * likelihood that communications meant - * to be separate aren't recognized as - * such just because they happen on the - * same communicator. In addition, it is - * conceivable that some MPI operations - * can be parallelized using multiple - * threads because their communicators - * identifies the communication in - * question, not their relative timing as - * is the case in a sequential program - * that just uses a single communicator. - */ + /** + * Given a communicator, duplicate it. If + * the given communicator is serial, that + * means to just return a copy of + * itself. On the other hand, if it is + * %parallel, we duplicate the underlying + * MPI_Comm object: we create a separate + * MPI communicator that contains the + * same processors and in the same order + * but has a separate identifier distinct + * from the given communicator. The + * function returns a pointer to a new + * object of a class derived from + * Epetra_Comm. The caller of this + * function needs to assume ownership of + * this function. The returned object + * should be destroyed using the + * destroy_communicator() function. + * + * This facility is used to separate + * streams of communication. For example, + * a program could simply use + * MPI_Comm_World for everything. But it + * is easy to come up with scenarios + * where sometimes not all processors + * participate in a communication that is + * intended to be global -- for example + * if we assemble a matrix on a coarse + * mesh with fewer cells than there are + * processors, some processors may not + * sync their matrices with the rest + * because they haven't written into it + * because they own no cells. That's + * clearly a bug. However, if these + * processors just continue their work, + * and the next %parallel operation + * happens to be a sync on a different + * matrix, then the sync could succeed -- + * by accident, since different + * processors are talking about different + * matrices. + * + * This kind of situation can be avoided + * if we use different communicators for + * different matrices which reduces the + * likelihood that communications meant + * to be separate aren't recognized as + * such just because they happen on the + * same communicator. In addition, it is + * conceivable that some MPI operations + * can be parallelized using multiple + * threads because their communicators + * identifies the communication in + * question, not their relative timing as + * is the case in a sequential program + * that just uses a single communicator. + */ Epetra_Comm * duplicate_communicator (const Epetra_Comm &communicator); - /** - * Given an Epetra communicator that was - * created by the - * duplicate_communicator() function, - * destroy the underlying MPI - * communicator object and reset the - * Epetra_Comm object to a the result of - * comm_self(). - * - * It is necessary to call this function - * at the time when the result of - * duplicate_communicator() is no longer - * needed. The reason is that in that - * function, we first create a new - * MPI_Comm object and then create an - * Epetra_Comm around it. While we can - * take care of destroying the latter, it - * doesn't destroy the communicator since - * it can only assume that it may also be - * still used by other objects in the - * program. Consequently, we have to take - * care of destroying it ourselves, - * explicitly. - * - * This function does exactly - * that. Because this has to happen while - * the Epetra_Comm object is still - * around, it first resets the latter and - * then destroys the communicator object. - * - * @note If you call this function on an - * Epetra_Comm object that is not created - * by duplicate_communicator(), you are - * likely doing something quite - * wrong. Don't do this. - */ + /** + * Given an Epetra communicator that was + * created by the + * duplicate_communicator() function, + * destroy the underlying MPI + * communicator object and reset the + * Epetra_Comm object to a the result of + * comm_self(). + * + * It is necessary to call this function + * at the time when the result of + * duplicate_communicator() is no longer + * needed. The reason is that in that + * function, we first create a new + * MPI_Comm object and then create an + * Epetra_Comm around it. While we can + * take care of destroying the latter, it + * doesn't destroy the communicator since + * it can only assume that it may also be + * still used by other objects in the + * program. Consequently, we have to take + * care of destroying it ourselves, + * explicitly. + * + * This function does exactly + * that. Because this has to happen while + * the Epetra_Comm object is still + * around, it first resets the latter and + * then destroys the communicator object. + * + * @note If you call this function on an + * Epetra_Comm object that is not created + * by duplicate_communicator(), you are + * likely doing something quite + * wrong. Don't do this. + */ void destroy_communicator (Epetra_Comm &communicator); - /** - * Return the number of MPI processes - * there exist in the given communicator - * object. If this is a sequential job, - * it returns 1. - */ + /** + * Return the number of MPI processes + * there exist in the given communicator + * object. If this is a sequential job, + * it returns 1. + */ unsigned int get_n_mpi_processes (const Epetra_Comm &mpi_communicator); - /** - * Return the number of the present MPI - * process in the space of processes - * described by the given - * communicator. This will be a unique - * value for each process between zero - * and (less than) the number of all - * processes (given by - * get_n_mpi_processes()). - */ + /** + * Return the number of the present MPI + * process in the space of processes + * described by the given + * communicator. This will be a unique + * value for each process between zero + * and (less than) the number of all + * processes (given by + * get_n_mpi_processes()). + */ unsigned int get_this_mpi_process (const Epetra_Comm &mpi_communicator); - /** - * Given a Trilinos Epetra map, create a - * new map that has the same subdivision - * of elements to processors but uses the - * given communicator object instead of - * the one stored in the first - * argument. In essence, this means that - * we create a map that communicates - * among the same processors in the same - * way, but using a separate channel. - * - * This function is typically used with a - * communicator that has been obtained by - * the duplicate_communicator() function. - */ + /** + * Given a Trilinos Epetra map, create a + * new map that has the same subdivision + * of elements to processors but uses the + * given communicator object instead of + * the one stored in the first + * argument. In essence, this means that + * we create a map that communicates + * among the same processors in the same + * way, but using a separate channel. + * + * This function is typically used with a + * communicator that has been obtained by + * the duplicate_communicator() function. + */ Epetra_Map duplicate_map (const Epetra_BlockMap &map, - const Epetra_Comm &comm); + const Epetra_Comm &comm); } #endif @@ -628,20 +628,20 @@ namespace Utilities switch (N) { case 0: - return 1; - case 1: - return n; - case 2: - return n*n; - case 3: - return n*n*n; - case 4: - return n*n*n*n; - default: - T result = 1; - for (int d=0;d()); + std::less()); } @@ -664,9 +664,9 @@ namespace Utilities inline Iterator lower_bound (Iterator first, - Iterator last, - const T &val, - const Comp comp) + Iterator last, + const T &val, + const Comp comp) { unsigned int len = last-first; @@ -675,74 +675,74 @@ namespace Utilities while (true) { - // if length equals 8 or less, - // then do a rolled out - // search. use a switch without - // breaks for that and roll-out - // the loop somehow - if (len < 8) - { - switch (len) - { - case 7: - if (!comp(*first, val)) - return first; - ++first; - case 6: - if (!comp(*first, val)) - return first; - ++first; - case 5: - if (!comp(*first, val)) - return first; - ++first; - case 4: - if (!comp(*first, val)) - return first; - ++first; - case 3: - if (!comp(*first, val)) - return first; - ++first; - case 2: - if (!comp(*first, val)) - return first; - ++first; - case 1: - if (!comp(*first, val)) - return first; - return first+1; - default: - // indices seem - // to not be - // sorted - // correctly!? or - // did len - // become==0 - // somehow? that - // shouln't have - // happened - Assert (false, ExcInternalError()); - } - } - - - - const unsigned int half = len >> 1; - const Iterator middle = first + half; - - // if the value is larger than - // that pointed to by the - // middle pointer, then the - // insertion point must be - // right of it - if (comp(*middle, val)) - { - first = middle + 1; - len -= half + 1; - } - else - len = half; + // if length equals 8 or less, + // then do a rolled out + // search. use a switch without + // breaks for that and roll-out + // the loop somehow + if (len < 8) + { + switch (len) + { + case 7: + if (!comp(*first, val)) + return first; + ++first; + case 6: + if (!comp(*first, val)) + return first; + ++first; + case 5: + if (!comp(*first, val)) + return first; + ++first; + case 4: + if (!comp(*first, val)) + return first; + ++first; + case 3: + if (!comp(*first, val)) + return first; + ++first; + case 2: + if (!comp(*first, val)) + return first; + ++first; + case 1: + if (!comp(*first, val)) + return first; + return first+1; + default: + // indices seem + // to not be + // sorted + // correctly!? or + // did len + // become==0 + // somehow? that + // shouln't have + // happened + Assert (false, ExcInternalError()); + } + } + + + + const unsigned int half = len >> 1; + const Iterator middle = first + half; + + // if the value is larger than + // that pointed to by the + // middle pointer, then the + // insertion point must be + // right of it + if (comp(*middle, val)) + { + first = middle + 1; + len -= half + 1; + } + else + len = half; } } } diff --git a/deal.II/include/deal.II/base/vector_slice.h b/deal.II/include/deal.II/base/vector_slice.h index 21789c364f..cb79d90cc8 100644 --- a/deal.II/include/deal.II/base/vector_slice.h +++ b/deal.II/include/deal.II/base/vector_slice.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2004, 2005, 2006, 2010 by the deal.II authors +// Copyright (C) 2004, 2005, 2006, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -45,82 +45,82 @@ template class VectorSlice { public: - /** - * Construct a vector slice - * containing the whole - * vector. Comes handy, if you - * did not want to have a slice - * at all, but the function you - * call wants it: just put in the - * vector itself as argument and - * let this constructor make a - * slice for you. - */ + /** + * Construct a vector slice + * containing the whole + * vector. Comes handy, if you + * did not want to have a slice + * at all, but the function you + * call wants it: just put in the + * vector itself as argument and + * let this constructor make a + * slice for you. + */ VectorSlice(VECTOR& v); - /** - * The real constructor for a - * vector slice, allowing you to - * specify the start index and - * the length of the slice. - */ + /** + * The real constructor for a + * vector slice, allowing you to + * specify the start index and + * the length of the slice. + */ VectorSlice(VECTOR& v, - unsigned int start, - unsigned int length); - - /** - * Return the length of the slice - * using the same interface as - * std::vector. - */ + unsigned int start, + unsigned int length); + + /** + * Return the length of the slice + * using the same interface as + * std::vector. + */ unsigned int size() const; - /** - * Access an element of the slice - * using the same interface as - * std::vector. - */ + /** + * Access an element of the slice + * using the same interface as + * std::vector. + */ typename VECTOR::reference operator[] (unsigned int i); - /** - * Access an element of a - * constant slice using the same - * interface as - * std::vector. - */ + /** + * Access an element of a + * constant slice using the same + * interface as + * std::vector. + */ typename VECTOR::const_reference operator[] (unsigned int i) const; - /** - * STL conforming iterator function. - */ + /** + * STL conforming iterator function. + */ typename VECTOR::iterator begin(); - /** - * STL conforming iterator function. - */ + /** + * STL conforming iterator function. + */ typename VECTOR::const_iterator begin() const; - /** - * STL conforming iterator function. - */ + /** + * STL conforming iterator function. + */ typename VECTOR::iterator end(); - /** - * STL conforming iterator function. - */ + /** + * STL conforming iterator function. + */ typename VECTOR::const_iterator end() const; private: - /** - * The vector we extract from. - */ + /** + * The vector we extract from. + */ VECTOR& v; - /** - * The start index of the slice. - */ + /** + * The start index of the slice. + */ const unsigned int start; - /** - * The length of the slice. - */ + /** + * The length of the slice. + */ const unsigned int length; }; @@ -154,8 +154,8 @@ template inline const VectorSlice make_slice (VECTOR& v, - const unsigned int start, - const unsigned int length) + const unsigned int start, + const unsigned int length) { const VectorSlice r(v, start, length); return r; @@ -169,21 +169,21 @@ make_slice (VECTOR& v, template inline VectorSlice::VectorSlice(VECTOR& v) - : - v(v), start(0), length(v.size()) + : + v(v), start(0), length(v.size()) {} template inline VectorSlice::VectorSlice(VECTOR& v, - unsigned int start, - unsigned int length) - : - v(v), start(start), length(length) + unsigned int start, + unsigned int length) + : + v(v), start(start), length(length) { Assert((start+length<=v.size()), - ExcIndexRange(length, 0, v.size()-start+1)); + ExcIndexRange(length, 0, v.size()-start+1)); } diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index 12157b8e28..1b39b5c8e7 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 2008, 2009, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -130,378 +130,378 @@ namespace WorkStream namespace internal { - /** - * A class that creates a sequence of - * items from a range of iterators. - */ + /** + * A class that creates a sequence of + * items from a range of iterators. + */ template + typename ScratchData, + typename CopyData> class IteratorRangeToItemStream : public tbb::filter { public: - /** - * A data type that we use to identify - * items to be worked on. - * - * The first element indicates an array - * of iterators to work on; the second - * the scratch space; the third an - * array of copy data spaces; and the - * last the number of elements to work - * on. This last argument is an integer - * between one and chunk_size. The - * arrays have a length of chunk_size. - */ - typedef - std_cxx1x::tuple, - ScratchData*, - std::vector, - unsigned int> - ItemType; - - - /** - * Constructor. Take an iterator - * range, the size of a buffer that - * can hold items, and the sample - * additional data object that will - * be passed to each worker and - * copier function invokation. - */ - IteratorRangeToItemStream (const Iterator &begin, - const Iterator &end, - const unsigned int buffer_size, - const unsigned int chunk_size, - const ScratchData &sample_scratch_data, - const CopyData &sample_copy_data) - : - tbb::filter (/*is_serial=*/true), - remaining_iterator_range (begin, end), - ring_buffer (buffer_size), - n_emitted_items (0), - chunk_size (chunk_size) - { - // initialize copies of - // additional_data. since - // this is frequently - // expensive (creating - // FEValues objects etc) do - // that in parallel - Threads::TaskGroup<> tasks; - for (unsigned int i=0; i(ring_buffer[i]); - } - - /** - * Create a item and return a - * pointer to it. - */ - virtual void * operator () (void *) - { - // store the current - // position of the pointer - ItemType *current_item - = &ring_buffer[n_emitted_items % ring_buffer.size()]; - - // initialize the next item. it may - // consist of at most chunk_size - // elements - std_cxx1x::get<3>(*current_item) = 0; - while ((remaining_iterator_range.first != - remaining_iterator_range.second) - && - (std_cxx1x::get<3>(*current_item) < chunk_size)) - { - std_cxx1x::get<0>(*current_item)[std_cxx1x::get<3>(*current_item)] - = remaining_iterator_range.first; - - ++remaining_iterator_range.first; - ++std_cxx1x::get<3>(*current_item); - } - - if (std_cxx1x::get<3>(*current_item) == 0) - // there were no items - // left. terminate the pipeline - return 0; - else - { - ++n_emitted_items; - return current_item; - } - } - + /** + * A data type that we use to identify + * items to be worked on. + * + * The first element indicates an array + * of iterators to work on; the second + * the scratch space; the third an + * array of copy data spaces; and the + * last the number of elements to work + * on. This last argument is an integer + * between one and chunk_size. The + * arrays have a length of chunk_size. + */ + typedef + std_cxx1x::tuple, + ScratchData*, + std::vector, + unsigned int> + ItemType; + + + /** + * Constructor. Take an iterator + * range, the size of a buffer that + * can hold items, and the sample + * additional data object that will + * be passed to each worker and + * copier function invokation. + */ + IteratorRangeToItemStream (const Iterator &begin, + const Iterator &end, + const unsigned int buffer_size, + const unsigned int chunk_size, + const ScratchData &sample_scratch_data, + const CopyData &sample_copy_data) + : + tbb::filter (/*is_serial=*/true), + remaining_iterator_range (begin, end), + ring_buffer (buffer_size), + n_emitted_items (0), + chunk_size (chunk_size) + { + // initialize copies of + // additional_data. since + // this is frequently + // expensive (creating + // FEValues objects etc) do + // that in parallel + Threads::TaskGroup<> tasks; + for (unsigned int i=0; i(ring_buffer[i]); + } + + /** + * Create a item and return a + * pointer to it. + */ + virtual void * operator () (void *) + { + // store the current + // position of the pointer + ItemType *current_item + = &ring_buffer[n_emitted_items % ring_buffer.size()]; + + // initialize the next item. it may + // consist of at most chunk_size + // elements + std_cxx1x::get<3>(*current_item) = 0; + while ((remaining_iterator_range.first != + remaining_iterator_range.second) + && + (std_cxx1x::get<3>(*current_item) < chunk_size)) + { + std_cxx1x::get<0>(*current_item)[std_cxx1x::get<3>(*current_item)] + = remaining_iterator_range.first; + + ++remaining_iterator_range.first; + ++std_cxx1x::get<3>(*current_item); + } + + if (std_cxx1x::get<3>(*current_item) == 0) + // there were no items + // left. terminate the pipeline + return 0; + else + { + ++n_emitted_items; + return current_item; + } + } + private: - /** - * The interval of iterators still to - * be worked on. This range will shrink - * over time. - */ - std::pair remaining_iterator_range; - - /** - * A ring buffer that will store items. - */ - std::vector ring_buffer; - - /** - * Counter for the number of emitted - * items. Each item may consist of up - * to chunk_size iterator elements. - */ - unsigned int n_emitted_items; - - /** - * Number of elements of the - * iterator range that each - * thread should work on - * sequentially; a large number - * makes sure that each thread - * gets a significant amount of - * work before the next task - * switch happens, whereas a - * small number is better for - * load balancing. - */ - const unsigned int chunk_size; - - /** - * Initialize the pointers and vector - * elements in the specified entry of - * the ring buffer. - */ - void init_buffer_elements (const unsigned int element, - const ScratchData &sample_scratch_data, - const CopyData &sample_copy_data) - { - Assert (std_cxx1x::get<1>(ring_buffer[element]) == 0, - ExcInternalError()); - - std_cxx1x::get<0>(ring_buffer[element]) - .resize (chunk_size, remaining_iterator_range.second); - std_cxx1x::get<1>(ring_buffer[element]) - = new ScratchData(sample_scratch_data); - std_cxx1x::get<2>(ring_buffer[element]) - .resize (chunk_size, sample_copy_data); - } + /** + * The interval of iterators still to + * be worked on. This range will shrink + * over time. + */ + std::pair remaining_iterator_range; + + /** + * A ring buffer that will store items. + */ + std::vector ring_buffer; + + /** + * Counter for the number of emitted + * items. Each item may consist of up + * to chunk_size iterator elements. + */ + unsigned int n_emitted_items; + + /** + * Number of elements of the + * iterator range that each + * thread should work on + * sequentially; a large number + * makes sure that each thread + * gets a significant amount of + * work before the next task + * switch happens, whereas a + * small number is better for + * load balancing. + */ + const unsigned int chunk_size; + + /** + * Initialize the pointers and vector + * elements in the specified entry of + * the ring buffer. + */ + void init_buffer_elements (const unsigned int element, + const ScratchData &sample_scratch_data, + const CopyData &sample_copy_data) + { + Assert (std_cxx1x::get<1>(ring_buffer[element]) == 0, + ExcInternalError()); + + std_cxx1x::get<0>(ring_buffer[element]) + .resize (chunk_size, remaining_iterator_range.second); + std_cxx1x::get<1>(ring_buffer[element]) + = new ScratchData(sample_scratch_data); + std_cxx1x::get<2>(ring_buffer[element]) + .resize (chunk_size, sample_copy_data); + } }; - /** - * A class that manages calling the - * worker function on a number of - * parallel threads. Note that it is, in - * the TBB notation, a filter that can - * run in parallel. - */ + /** + * A class that manages calling the + * worker function on a number of + * parallel threads. Note that it is, in + * the TBB notation, a filter that can + * run in parallel. + */ template + typename ScratchData, + typename CopyData> class Worker : public tbb::filter { public: - /** - * Constructor. Takes a - * reference to the object on - * which we will operate as - * well as a pointer to the - * function that will do the - * assembly. - */ - Worker (const std_cxx1x::function &worker) - : - tbb::filter (/* is_serial= */ false), - worker (worker) - {} - - - /** - * Work on an item. - */ - void * operator () (void *item) - { - // first unpack the current item - typedef - typename IteratorRangeToItemStream::ItemType - ItemType; - - ItemType *current_item = reinterpret_cast (item); - - // then call the worker function on - // each element of the chunk we - // were given - for (unsigned int i=0; i(*current_item); ++i) - worker (std_cxx1x::get<0>(*current_item)[i], - *std_cxx1x::get<1>(*current_item), - std_cxx1x::get<2>(*current_item)[i]); - - // then return the original pointer - // to the now modified object - return item; - } - + /** + * Constructor. Takes a + * reference to the object on + * which we will operate as + * well as a pointer to the + * function that will do the + * assembly. + */ + Worker (const std_cxx1x::function &worker) + : + tbb::filter (/* is_serial= */ false), + worker (worker) + {} + + + /** + * Work on an item. + */ + void * operator () (void *item) + { + // first unpack the current item + typedef + typename IteratorRangeToItemStream::ItemType + ItemType; + + ItemType *current_item = reinterpret_cast (item); + + // then call the worker function on + // each element of the chunk we + // were given + for (unsigned int i=0; i(*current_item); ++i) + worker (std_cxx1x::get<0>(*current_item)[i], + *std_cxx1x::get<1>(*current_item), + std_cxx1x::get<2>(*current_item)[i]); + + // then return the original pointer + // to the now modified object + return item; + } + private: - /** - * Pointer to the function - * that does the assembling - * on the sequence of cells. - */ - const std_cxx1x::function worker; + /** + * Pointer to the function + * that does the assembling + * on the sequence of cells. + */ + const std_cxx1x::function worker; }; - /** - * A class that manages calling the - * copier function. Note that it is, in - * the TBB notation, a filter that runs - * sequentially, ensuring that all items - * are copied in the same order in which - * they are created. - */ + /** + * A class that manages calling the + * copier function. Note that it is, in + * the TBB notation, a filter that runs + * sequentially, ensuring that all items + * are copied in the same order in which + * they are created. + */ template + typename ScratchData, + typename CopyData> class Copier : public tbb::filter { public: - /** - * Constructor. Takes a - * reference to the object on - * which we will operate as - * well as a pointer to the - * function that will do the - * copying from the - * additional data object to - * the global matrix or - * similar. - */ - Copier (const std_cxx1x::function &copier) - : - tbb::filter (/* is_serial= */ true), - copier (copier) - {} - - - /** - * Work on a single item. - */ - void * operator () (void *item) - { - // first unpack the current item - typedef - typename IteratorRangeToItemStream::ItemType - ItemType; - - ItemType *current_item = reinterpret_cast (item); - - // initiate copying data - for (unsigned int i=0; i(*current_item); ++i) - copier (std_cxx1x::get<2>(*current_item)[i]); - - // return an invalid - // item since we are at - // the end of the - // pipeline - return 0; - } - + /** + * Constructor. Takes a + * reference to the object on + * which we will operate as + * well as a pointer to the + * function that will do the + * copying from the + * additional data object to + * the global matrix or + * similar. + */ + Copier (const std_cxx1x::function &copier) + : + tbb::filter (/* is_serial= */ true), + copier (copier) + {} + + + /** + * Work on a single item. + */ + void * operator () (void *item) + { + // first unpack the current item + typedef + typename IteratorRangeToItemStream::ItemType + ItemType; + + ItemType *current_item = reinterpret_cast (item); + + // initiate copying data + for (unsigned int i=0; i(*current_item); ++i) + copier (std_cxx1x::get<2>(*current_item)[i]); + + // return an invalid + // item since we are at + // the end of the + // pipeline + return 0; + } + private: - /** - * Pointer to the function - * that does the copying of - * data. - */ - const std_cxx1x::function copier; + /** + * Pointer to the function + * that does the copying of + * data. + */ + const std_cxx1x::function copier; }; - + } - + #endif // DEAL_II_USE_MT - /** - * This is the main function of the - * WorkStream concept, doing work as - * described in the introduction to this - * namespace. - * - * This is the function that can be used - * for worker and copier objects that are - * either pointers to non-member - * functions or objects that allow to be - * called with an operator(), for example - * objects created by std::bind. - * - * The argument passed as @p end must be - * convertible to the same type as - * @p begin, but doesn't have to be of the - * same type itself. This allows to write - * code like - * WorkStream().run(dof_handler.begin_active(), - * dof_handler.end(), ... where - * the first is of type - * DoFHandler::active_cell_iterator - * whereas the second is of type - * DoFHandler::raw_cell_iterator. - * - * The two data types - * ScratchData and - * CopyData need to have a - * working copy - * constructor. ScratchData - * is only used in the - * worker function, while - * CopyData is the object - * passed from the worker - * to the copier. - * - * The @p queue_length argument indicates - * the number of items that can be live - * at any given time. Each item consists - * of @p chunk_size elements of the input - * stream that will be worked on by the - * worker and copier functions one after - * the other on the same thread. - * - * @note If your data objects are large, - * or their constructors are expensive, - * it is helpful to keep in mind - * that queue_length - * copies of the ScratchData - * object and - * queue_length*chunk_size - * copies of the CopyData - * object are generated. - */ + /** + * This is the main function of the + * WorkStream concept, doing work as + * described in the introduction to this + * namespace. + * + * This is the function that can be used + * for worker and copier objects that are + * either pointers to non-member + * functions or objects that allow to be + * called with an operator(), for example + * objects created by std::bind. + * + * The argument passed as @p end must be + * convertible to the same type as + * @p begin, but doesn't have to be of the + * same type itself. This allows to write + * code like + * WorkStream().run(dof_handler.begin_active(), + * dof_handler.end(), ... where + * the first is of type + * DoFHandler::active_cell_iterator + * whereas the second is of type + * DoFHandler::raw_cell_iterator. + * + * The two data types + * ScratchData and + * CopyData need to have a + * working copy + * constructor. ScratchData + * is only used in the + * worker function, while + * CopyData is the object + * passed from the worker + * to the copier. + * + * The @p queue_length argument indicates + * the number of items that can be live + * at any given time. Each item consists + * of @p chunk_size elements of the input + * stream that will be worked on by the + * worker and copier functions one after + * the other on the same thread. + * + * @note If your data objects are large, + * or their constructors are expensive, + * it is helpful to keep in mind + * that queue_length + * copies of the ScratchData + * object and + * queue_length*chunk_size + * copies of the CopyData + * object are generated. + */ template + typename Copier, + typename Iterator, + typename ScratchData, + typename CopyData> void run (const Iterator &begin, const typename identity::type &end, @@ -513,129 +513,129 @@ namespace WorkStream const unsigned int chunk_size = 8) { Assert (queue_length > 0, - ExcMessage ("The queue length must be at least one, and preferably " - "larger than the number of processors on this system.")); + ExcMessage ("The queue length must be at least one, and preferably " + "larger than the number of processors on this system.")); Assert (chunk_size > 0, - ExcMessage ("The chunk_size must be at least one.")); + ExcMessage ("The chunk_size must be at least one.")); - // if no work then skip. (only use - // operator!= for iterators since we may - // not have an equality comparison - // operator) + // if no work then skip. (only use + // operator!= for iterators since we may + // not have an equality comparison + // operator) if (!(begin != end)) return; - -#if DEAL_II_USE_MT == 1 - // create the three stages of the - // pipeline + +#if DEAL_II_USE_MT == 1 + // create the three stages of the + // pipeline internal::IteratorRangeToItemStream iterator_range_to_item_stream (begin, end, - queue_length, - chunk_size, - sample_scratch_data, - sample_copy_data); + queue_length, + chunk_size, + sample_scratch_data, + sample_copy_data); internal::Worker worker_filter (worker); internal::Copier copier_filter (copier); - // now create a pipeline from - // these stages + // now create a pipeline from + // these stages tbb::pipeline assembly_line; assembly_line.add_filter (iterator_range_to_item_stream); assembly_line.add_filter (worker_filter); assembly_line.add_filter (copier_filter); - // and run it - assembly_line.run (queue_length); + // and run it + assembly_line.run (queue_length); assembly_line.clear (); #else - // need to copy the sample since it is - // marked const + // need to copy the sample since it is + // marked const ScratchData scratch_data = sample_scratch_data; CopyData copy_data = sample_copy_data; - + for (Iterator i=begin; i!=end; ++i) { - worker (i, scratch_data, copy_data); - copier (copy_data); - } + worker (i, scratch_data, copy_data); + copier (copy_data); + } #endif } - /** - * This is the main function of the - * WorkStream concept, doing work as - * described in the introduction to this - * namespace. - * - * This is the function that can be - * used for worker and copier functions - * that are member functions of a class. - * - * The argument passed as @p end must be - * convertible to the same type as - * @p begin, but doesn't have to be of the - * same type itself. This allows to write - * code like - * WorkStream().run(dof_handler.begin_active(), - * dof_handler.end(), ... where - * the first is of type - * DoFHandler::active_cell_iterator - * whereas the second is of type - * DoFHandler::raw_cell_iterator. - * - * The @p queue_length argument indicates - * the number of items that can be live - * at any given time. Each item consists - * of @p chunk_size elements of the input - * stream that will be worked on by the - * worker and copier functions one after - * the other on the same thread. - * - * @note If your data objects are large, - * or their constructors are expensive, - * it is helpful to keep in mind - * that queue_length - * copies of the ScratchData - * object and - * queue_length*chunk_size - * copies of the CopyData - * object are generated. - */ + /** + * This is the main function of the + * WorkStream concept, doing work as + * described in the introduction to this + * namespace. + * + * This is the function that can be + * used for worker and copier functions + * that are member functions of a class. + * + * The argument passed as @p end must be + * convertible to the same type as + * @p begin, but doesn't have to be of the + * same type itself. This allows to write + * code like + * WorkStream().run(dof_handler.begin_active(), + * dof_handler.end(), ... where + * the first is of type + * DoFHandler::active_cell_iterator + * whereas the second is of type + * DoFHandler::raw_cell_iterator. + * + * The @p queue_length argument indicates + * the number of items that can be live + * at any given time. Each item consists + * of @p chunk_size elements of the input + * stream that will be worked on by the + * worker and copier functions one after + * the other on the same thread. + * + * @note If your data objects are large, + * or their constructors are expensive, + * it is helpful to keep in mind + * that queue_length + * copies of the ScratchData + * object and + * queue_length*chunk_size + * copies of the CopyData + * object are generated. + */ template + typename Iterator, + typename ScratchData, + typename CopyData> void run (const Iterator &begin, const typename identity::type &end, MainClass &main_object, void (MainClass::*worker) (const Iterator &, - ScratchData &, - CopyData &), + ScratchData &, + CopyData &), void (MainClass::*copier) (const CopyData &), const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length = 2*multithread_info.n_default_threads, const unsigned int chunk_size = 8) { - // forward to the other function + // forward to the other function run (begin, end, - std_cxx1x::bind (worker, - std_cxx1x::ref (main_object), - std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3), - std_cxx1x::bind (copier, - std_cxx1x::ref (main_object), - std_cxx1x::_1), - sample_scratch_data, - sample_copy_data, - queue_length, - chunk_size); + std_cxx1x::bind (worker, + std_cxx1x::ref (main_object), + std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3), + std_cxx1x::bind (copier, + std_cxx1x::ref (main_object), + std_cxx1x::_1), + sample_scratch_data, + sample_copy_data, + queue_length, + chunk_size); } } diff --git a/deal.II/include/deal.II/distributed/grid_refinement.h b/deal.II/include/deal.II/distributed/grid_refinement.h index f72e4341a4..2c65aae571 100644 --- a/deal.II/include/deal.II/distributed/grid_refinement.h +++ b/deal.II/include/deal.II/distributed/grid_refinement.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2009, 2010 by the deal.II authors +// Copyright (C) 2009, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -26,7 +26,7 @@ namespace parallel { namespace distributed { - // forward declarations + // forward declarations template class Triangulation; @@ -42,91 +42,91 @@ namespace parallel */ namespace GridRefinement { - /** - * Like - * dealii::GridRefinement::refine_and_coarsen_fixed_number, - * but for parallel distributed - * triangulation. - * - * The vector of criteria needs to be a - * vector of refinement criteria for - * all cells active on the current - * triangulation, - * i.e. tria.n_active_cells() - * (and not - * tria.n_locally_owned_active_cells()). However, - * the function will only look at the - * indicators that correspond to those - * cells that are actually locally - * owned, and ignore the indicators for - * all other cells. The function will - * then coordinate among all processors - * that store part of the triangulation - * so that at the end @p - * top_fraction_of_cells are refined, - * where the fraction is enforced as a - * fraction of - * Triangulation::n_global_active_cells, - * not - * Triangulation::n_locally_active_cells - * on each processor individually. In - * other words, it may be that on some - * processors, no cells are refined at - * all. - * - * The same is true for the fraction of - * cells that is coarsened. - */ + /** + * Like + * dealii::GridRefinement::refine_and_coarsen_fixed_number, + * but for parallel distributed + * triangulation. + * + * The vector of criteria needs to be a + * vector of refinement criteria for + * all cells active on the current + * triangulation, + * i.e. tria.n_active_cells() + * (and not + * tria.n_locally_owned_active_cells()). However, + * the function will only look at the + * indicators that correspond to those + * cells that are actually locally + * owned, and ignore the indicators for + * all other cells. The function will + * then coordinate among all processors + * that store part of the triangulation + * so that at the end @p + * top_fraction_of_cells are refined, + * where the fraction is enforced as a + * fraction of + * Triangulation::n_global_active_cells, + * not + * Triangulation::n_locally_active_cells + * on each processor individually. In + * other words, it may be that on some + * processors, no cells are refined at + * all. + * + * The same is true for the fraction of + * cells that is coarsened. + */ template void refine_and_coarsen_fixed_number ( - parallel::distributed::Triangulation &tria, - const Vector &criteria, - const double top_fraction_of_cells, - const double bottom_fraction_of_cells); + parallel::distributed::Triangulation &tria, + const Vector &criteria, + const double top_fraction_of_cells, + const double bottom_fraction_of_cells); - /** - * Like - * dealii::GridRefinement::refine_and_coarsen_fixed_fraction, - * but for parallel distributed - * triangulation. - * - * The vector of criteria needs to be a - * vector of refinement criteria for - * all cells active on the current - * triangulation, - * tria.n_active_cells() - * (and not - * tria.n_locally_owned_active_cells()). However, - * the function will only look at the - * indicators that correspond to those - * cells that are actually locally - * owned, and ignore the indicators for - * all other cells. The function will - * then coordinate among all processors - * that store part of the triangulation - * so that at the end the smallest - * fraction of - * Triangulation::n_global_active_cells - * (not - * Triangulation::n_locally_active_cells - * on each processor individually) is - * refined that together make up a - * total of @p top_fraction_of_error of - * the total error. In other words, it - * may be that on some processors, no - * cells are refined at all. - * - * The same is true for the fraction of - * cells that is coarsened. - */ + /** + * Like + * dealii::GridRefinement::refine_and_coarsen_fixed_fraction, + * but for parallel distributed + * triangulation. + * + * The vector of criteria needs to be a + * vector of refinement criteria for + * all cells active on the current + * triangulation, + * tria.n_active_cells() + * (and not + * tria.n_locally_owned_active_cells()). However, + * the function will only look at the + * indicators that correspond to those + * cells that are actually locally + * owned, and ignore the indicators for + * all other cells. The function will + * then coordinate among all processors + * that store part of the triangulation + * so that at the end the smallest + * fraction of + * Triangulation::n_global_active_cells + * (not + * Triangulation::n_locally_active_cells + * on each processor individually) is + * refined that together make up a + * total of @p top_fraction_of_error of + * the total error. In other words, it + * may be that on some processors, no + * cells are refined at all. + * + * The same is true for the fraction of + * cells that is coarsened. + */ template void refine_and_coarsen_fixed_fraction ( - parallel::distributed::Triangulation &tria, - const Vector &criteria, - const double top_fraction_of_error, - const double bottom_fraction_of_error); + parallel::distributed::Triangulation &tria, + const Vector &criteria, + const double top_fraction_of_error, + const double bottom_fraction_of_error); } } } diff --git a/deal.II/include/deal.II/distributed/solution_transfer.h b/deal.II/include/deal.II/distributed/solution_transfer.h index cf30c9ed44..22d79ccd92 100644 --- a/deal.II/include/deal.II/distributed/solution_transfer.h +++ b/deal.II/include/deal.II/distributed/solution_transfer.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2009, 2010 by the deal.II authors +// Copyright (C) 2009, 2010, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -44,7 +44,7 @@ namespace parallel * can be read. On the other hand, ghosted vectors are generally not writable, * so for calls to interpolate() or deserialize() you need to supply * distributed vectors without ghost elements. - * + * *

Transfering a solution

* Here VECTOR is your favorite vector type, e.g. PETScWrappers::MPI::Vector, * TrilinosWrappers::MPI::Vector, or corresponding blockvectors. @@ -78,7 +78,7 @@ namespace parallel * * If vector has the locally relevant DoFs, serialization works as follows: *@verbatim - + parallel::distributed::SolutionTransfer sol_trans(dof_handler); sol_trans.prepare_serialization (vector); @@ -92,7 +92,7 @@ triangulation.load(filename); parallel::distributed::SolutionTransfer sol_trans(dof_handler); sol_trans.deserialize (distributed_vector); @endverbatim - * + * * @ingroup distributed * @author Timo Heister, 2009-2011 */ @@ -100,160 +100,160 @@ sol_trans.deserialize (distributed_vector); class SolutionTransfer { public: - /** - * Constructor, takes the current DoFHandler - * as argument. - */ - SolutionTransfer(const DH &dof); - /** - * Destructor. - */ - ~SolutionTransfer(); - - /** - * Prepares the @p SolutionTransfer for - * coarsening and refinement. It - * stores the dof indices of each cell and - * stores the dof values of the vectors in - * @p all_in in each cell that'll be coarsened. - * @p all_in includes all vectors - * that are to be interpolated - * onto the new (refined and/or - * coarsenend) grid. - */ - void prepare_for_coarsening_and_refinement (const std::vector &all_in); - - /** - * Same as previous function - * but for only one discrete function - * to be interpolated. - */ - void prepare_for_coarsening_and_refinement (const VECTOR &in); - - /** - * - */ - void interpolate (std::vector &all_out); - - /** - * Same as the previous function. - * It interpolates only one function. - * It assumes the vectors having the - * right sizes (i.e. in.size()==n_dofs_old, - * out.size()==n_dofs_refined) - * - * Multiple calling of this function is - * NOT allowed. Interpolating - * several functions can be performed - * in one step by using - * interpolate (all_in, all_out) - */ - void interpolate (VECTOR &out); - - - /** - * Return the size in bytes that need - * to be stored per cell. - */ - unsigned int get_data_size() const; - - - /** - * Prepare the serialization of the - * given vector. The serialization is - * done by Triangulation::save(). The - * given vector needs all information - * on the locally active DoFs (it must - * be ghosted). See documentation of - * this class for more information. - */ - void prepare_serialization(const VECTOR &in); - - - /** - * Same as the function above, only - * for a list of vectors. - */ - void prepare_serialization(const std::vector &all_in); - - - /** - * Execute the deserialization of the - * given vector. This needs to be - * done after calling - * Triangulation::load(). The given - * vector must be a fully distributed - * vector without ghost elements. See - * documentation of this class for - * more information. - */ - void deserialize(VECTOR &in); - - - /** - * Same as the function above, only - * for a list of vectors. - */ - void deserialize(std::vector &all_in); + /** + * Constructor, takes the current DoFHandler + * as argument. + */ + SolutionTransfer(const DH &dof); + /** + * Destructor. + */ + ~SolutionTransfer(); + + /** + * Prepares the @p SolutionTransfer for + * coarsening and refinement. It + * stores the dof indices of each cell and + * stores the dof values of the vectors in + * @p all_in in each cell that'll be coarsened. + * @p all_in includes all vectors + * that are to be interpolated + * onto the new (refined and/or + * coarsenend) grid. + */ + void prepare_for_coarsening_and_refinement (const std::vector &all_in); + + /** + * Same as previous function + * but for only one discrete function + * to be interpolated. + */ + void prepare_for_coarsening_and_refinement (const VECTOR &in); + + /** + * + */ + void interpolate (std::vector &all_out); + + /** + * Same as the previous function. + * It interpolates only one function. + * It assumes the vectors having the + * right sizes (i.e. in.size()==n_dofs_old, + * out.size()==n_dofs_refined) + * + * Multiple calling of this function is + * NOT allowed. Interpolating + * several functions can be performed + * in one step by using + * interpolate (all_in, all_out) + */ + void interpolate (VECTOR &out); + + + /** + * Return the size in bytes that need + * to be stored per cell. + */ + unsigned int get_data_size() const; + + + /** + * Prepare the serialization of the + * given vector. The serialization is + * done by Triangulation::save(). The + * given vector needs all information + * on the locally active DoFs (it must + * be ghosted). See documentation of + * this class for more information. + */ + void prepare_serialization(const VECTOR &in); + + + /** + * Same as the function above, only + * for a list of vectors. + */ + void prepare_serialization(const std::vector &all_in); + + + /** + * Execute the deserialization of the + * given vector. This needs to be + * done after calling + * Triangulation::load(). The given + * vector must be a fully distributed + * vector without ghost elements. See + * documentation of this class for + * more information. + */ + void deserialize(VECTOR &in); + + + /** + * Same as the function above, only + * for a list of vectors. + */ + void deserialize(std::vector &all_in); private: - /** - * Pointer to the degree of - * freedom handler to work - * with. - */ - SmartPointer > dof_handler; - - /** - * A vector that stores - * pointers to all the - * vectors we are supposed to - * copy over from the old to - * the new mesh. - */ - std::vector input_vectors; - - /** - * The offset that the - * Triangulation has assigned - * to this object starting at - * which we are allowed to - * write. - */ - unsigned int offset; - - /** - * A callback function used - * to pack the data on the - * current mesh into objects - * that can later be - * retrieved after - * refinement, coarsening and - * repartitioning. - */ - void pack_callback(const typename Triangulation::cell_iterator &cell, - const typename Triangulation::CellStatus status, - void* data); - - /** - * A callback function used - * to unpack the data on the - * current mesh that has been - * packed up previously on - * the mesh before - * refinement, coarsening and - * repartitioning. - */ - void unpack_callback(const typename Triangulation::cell_iterator &cell, - const typename Triangulation::CellStatus status, - const void* data, - std::vector &all_out); - - - /** - * - */ - void register_data_attach(const std::size_t size); + /** + * Pointer to the degree of + * freedom handler to work + * with. + */ + SmartPointer > dof_handler; + + /** + * A vector that stores + * pointers to all the + * vectors we are supposed to + * copy over from the old to + * the new mesh. + */ + std::vector input_vectors; + + /** + * The offset that the + * Triangulation has assigned + * to this object starting at + * which we are allowed to + * write. + */ + unsigned int offset; + + /** + * A callback function used + * to pack the data on the + * current mesh into objects + * that can later be + * retrieved after + * refinement, coarsening and + * repartitioning. + */ + void pack_callback(const typename Triangulation::cell_iterator &cell, + const typename Triangulation::CellStatus status, + void* data); + + /** + * A callback function used + * to unpack the data on the + * current mesh that has been + * packed up previously on + * the mesh before + * refinement, coarsening and + * repartitioning. + */ + void unpack_callback(const typename Triangulation::cell_iterator &cell, + const typename Triangulation::CellStatus status, + const void* data, + std::vector &all_out); + + + /** + * + */ + void register_data_attach(const std::size_t size); }; diff --git a/deal.II/include/deal.II/distributed/tria.h b/deal.II/include/deal.II/distributed/tria.h index 9a3209508e..4ed683a59e 100644 --- a/deal.II/include/deal.II/distributed/tria.h +++ b/deal.II/include/deal.II/distributed/tria.h @@ -62,58 +62,58 @@ namespace internal { namespace p4est { - /** - * A structure whose explicit - * specializations contain - * typedefs to the relevant - * p4est_* and p8est_* - * types. Using this - * structure, for example by - * saying - * types@::connectivity - * we can write code in a - * dimension independent way, - * either referring to - * p4est_connectivity_t or - * p8est_connectivity_t, - * depending on template - * argument. - */ + /** + * A structure whose explicit + * specializations contain + * typedefs to the relevant + * p4est_* and p8est_* + * types. Using this + * structure, for example by + * saying + * types@::connectivity + * we can write code in a + * dimension independent way, + * either referring to + * p4est_connectivity_t or + * p8est_connectivity_t, + * depending on template + * argument. + */ template struct types; template <> struct types<2> { - typedef p4est_connectivity_t connectivity; - typedef p4est_t forest; - typedef p4est_tree_t tree; - typedef p4est_quadrant_t quadrant; - typedef p4est_topidx_t topidx; - typedef p4est_locidx_t locidx; - typedef p4est_balance_type_t balance_type; - typedef p4est_ghost_t ghost; + typedef p4est_connectivity_t connectivity; + typedef p4est_t forest; + typedef p4est_tree_t tree; + typedef p4est_quadrant_t quadrant; + typedef p4est_topidx_t topidx; + typedef p4est_locidx_t locidx; + typedef p4est_balance_type_t balance_type; + typedef p4est_ghost_t ghost; }; template <> struct types<3> { - typedef p8est_connectivity_t connectivity; - typedef p8est_t forest; - typedef p8est_tree_t tree; - typedef p8est_quadrant_t quadrant; - typedef p4est_topidx_t topidx; - typedef p4est_locidx_t locidx; - typedef p8est_balance_type_t balance_type; - typedef p8est_ghost_t ghost; + typedef p8est_connectivity_t connectivity; + typedef p8est_t forest; + typedef p8est_tree_t tree; + typedef p8est_quadrant_t quadrant; + typedef p4est_topidx_t topidx; + typedef p4est_locidx_t locidx; + typedef p8est_balance_type_t balance_type; + typedef p8est_ghost_t ghost; }; - /** - * Initialize the - * GeometryInfo::max_children_per_cell - * children of the cell - * p4est_cell. - */ + /** + * Initialize the + * GeometryInfo::max_children_per_cell + * children of the cell + * p4est_cell. + */ template void init_quadrant_children @@ -121,33 +121,33 @@ namespace internal typename types::quadrant (&p4est_children)[GeometryInfo::max_children_per_cell]); - /** - * Initialize quadrant to represent a coarse cell. - */ + /** + * Initialize quadrant to represent a coarse cell. + */ template void init_coarse_quadrant(typename types::quadrant & quad); - /** - * Returns whether q1 and q2 are equal - */ + /** + * Returns whether q1 and q2 are equal + */ template bool quadrant_is_equal (const typename types::quadrant & q1, - const typename types::quadrant & q2); + const typename types::quadrant & q2); - //TODO: remove these functions from - //public interface somehow? [TH] + //TODO: remove these functions from + //public interface somehow? [TH] - /** - * returns whether q1 is an ancestor of q2 - */ + /** + * returns whether q1 is an ancestor of q2 + */ template bool quadrant_is_ancestor (const typename types::quadrant & q1, - const typename types::quadrant & q2); + const typename types::quadrant & q2); } } @@ -181,649 +181,649 @@ namespace parallel class Triangulation : public dealii::Triangulation { public: - /** - * Import the various - * iterator typedefs from the - * base class. - */ - typedef typename dealii::Triangulation::active_cell_iterator active_cell_iterator; - typedef typename dealii::Triangulation::cell_iterator cell_iterator; - typedef typename dealii::Triangulation::raw_cell_iterator raw_cell_iterator; - - /** - * Generic settings for distributed - * Triangulations. If - * mesh_reconstruction_after_repartitioning - * is set, the deal.II mesh will be - * reconstructed from the coarse mesh - * every time a repartioning in p4est - * happens. This can be a bit more - * expensive, but guarantees the same - * memory layout and therefore cell - * ordering in the deal.II mesh. As - * assembly is done in the deal.II - * cell ordering, this flag is - * required to get reproducable - * behaviour after snapshot/resume. - */ - enum Settings - { - default_setting = 0x0, - mesh_reconstruction_after_repartitioning = 0x1 - }; - - - - /** - * Constructor. - * - * @param mpi_communicator denotes - * the MPI communicator to be used for - * the triangulation. - * - * @param smooth_grid Degree - * and kind of mesh smoothing - * to be applied to the - * mesh. See the - * dealii::Triangulation - * class for a description of - * the kinds of smoothing - * operations that can be - * applied. - * - * @param settings See the - * description of the Settings - * enumerator. - * - * @note This class does not - * currently support the - * check_for_distorted_cells - * argument provided by the - * base class. - * - * @note While it is possible to pass - * all of the mesh smoothing flags - * listed in the base class to - * objects of this type, it is not - * always possible to honor all of - * these smoothing options if they - * would require knowledge of - * refinement/coarsening flags on - * cells not locally owned by this - * processor. As a consequence, for - * some of these flags, the ultimate - * number of cells of the parallel - * triangulation may depend on the - * number of processors into which it - * is partitioned. On the other hand, - * if no smoothing flags are passed, - * if you always mark the same cells - * of the mesh, you will always get - * the exact same refined mesh - * independent of the number of - * processors into which the - * triangulation is partitioned. - */ - Triangulation (MPI_Comm mpi_communicator, - const typename dealii::Triangulation::MeshSmoothing - smooth_grid = (dealii::Triangulation::none), - const Settings settings = default_setting); - - /** - * Destructor. - */ - virtual ~Triangulation (); - - /** - * Reset this triangulation into a - * virgin state by deleting all data. - * - * Note that this operation is only - * allowed if no subscriptions to this - * object exist any more, such as - * DoFHandler objects using it. - */ - virtual void clear (); - - /** - * Implementation of the same - * function as in the base - * class. - */ - virtual void copy_triangulation (const dealii::Triangulation &old_tria); - - /** - * Create a triangulation as - * documented in the base - * class. - * - * This function also sets up - * the various data - * structures necessary to - * distribute a mesh across a - * number of processors. This - * will be necessary once the - * mesh is being refined, - * though we will always keep - * the entire coarse mesh - * that is generated by this - * function on all - * processors. - */ - virtual void create_triangulation (const std::vector > &vertices, - const std::vector > &cells, - const SubCellData &subcelldata); - - /** - * Coarsen and refine the - * mesh according to - * refinement and coarsening - * flags set. - * - * Since the current - * processor only has control - * over those cells it owns - * (i.e. the ones for which - * cell-@>subdomain_id() - * == - * this-@>locally_owned_subdomain()), - * refinement and coarsening - * flags are only respected - * for those locally owned - * cells. Flags may be set on - * other cells as well (and - * may often, in fact, if you - * call - * dealii::Triangulation::prepare_coarsening_and_refinement) - * but will be largely - * ignored: the decision to - * refine the global mesh - * will only be affected by - * flags set on locally owned - * cells. - */ - virtual void execute_coarsening_and_refinement (); - - /** - * Return the subdomain id of - * those cells that are owned - * by the current - * processor. All cells in - * the triangulation that do - * not have this subdomain id - * are either owned by - * another processor or have - * children that only exist - * on other processors. - */ - types::subdomain_id_t locally_owned_subdomain () const; - - /** - * Return the number of - * active cells in the - * triangulation that are - * locally owned, i.e. that - * have a subdomain_id equal - * to - * locally_owned_subdomain(). Note - * that there may be more - * active cells in the - * triangulation stored on - * the present processor, - * such as for example ghost - * cells, or cells further - * away from the locally - * owned block of cells but - * that are needed to ensure - * that the triangulation - * that stores this - * processor's set of active - * cells still remains - * balanced with respect to - * the 2:1 size ratio of - * adjacent cells. - * - * As a consequence of the remark - * above, the result of this function - * is always smaller or equal to the - * result of the function with the - * same name in the ::Triangulation - * base class, which includes the - * active ghost and artificial cells - * (see also @ref GlossArtificialCell - * and @ref GlossGhostCell). - */ - unsigned int n_locally_owned_active_cells () const; - - /** - * Return the sum over all - * processors of the number - * of active cells owned by - * each processor. This - * equals the overall number - * of active cells in the - * distributed triangulation. - */ - unsigned int n_global_active_cells () const; - - /** - * Return the number of - * active cells owned by each - * of the MPI processes that - * contribute to this - * triangulation. The element - * of this vector indexed by - * locally_owned_subdomain() - * equals the result of - * n_locally_owned_active_cells(). - */ - const std::vector & - n_locally_owned_active_cells_per_processor () const; - - /** - * Return the MPI - * communicator used by this - * triangulation. - */ - MPI_Comm get_communicator () const; - - /** - * Return the local memory - * consumption in bytes. - */ - virtual std::size_t memory_consumption () const; - - /** - * Return the local memory - * consumption contained in the p4est - * data structures alone. This is - * already contained in - * memory_consumption() but made - * available separately for debugging - * purposes. - */ - virtual std::size_t memory_consumption_p4est () const; - - /** - * A collective operation that produces - * a sequence of output files with the - * given file base name that contain - * the mesh in VTK format. - * - * More than anything else, this - * function is useful for debugging the - * interface between deal.II and p4est. - */ - void write_mesh_vtk (const char *file_basename) const; - - /** - * Produce a check sum of the - * triangulation. This is a - * collective operation and - * is mostly useful for - * debugging purposes. - */ - unsigned int get_checksum () const; - - /** - * Save the refinement information from the coarse mesh into the given - * file. This file needs to be reachable from all nodes in the computation - * on a shared network file system. See the SolutionTransfer class - * on how to store solution vectors into this file. - */ - void save(const char* filename) const; - - /** - * Load the refinement information saved with save() back in. The mesh - * must contain the same coarse mesh that was used in save(). You need - * to load with the same number of CPUs that you saved with. - */ - void load(const char* filename); - - /** - * Used to inform in the callbacks of - * register_data_attach() and - * notify_ready_to_unpack() how the - * cell with the given cell_iterator - * is going to change. Note that - * this may me different then the - * refine_flag() and coarsen_flag() - * in the cell_iterator because of - * refinement constraints that this - * machine does not see. - */ - enum CellStatus - { - CELL_PERSIST, CELL_REFINE, CELL_COARSEN, CELL_INVALID - }; - - /** - * Register a function with - * the current Triangulation - * object that will be used - * to attach data to active - * cells before - * execute_coarsening_and_refinement(). In - * execute_coarsening_and_refinement() - * the Triangulation will - * call the given function - * pointer and provide - * @p size bytes to store - * data. If necessary, this data will be - * transferred to the new - * owner of that cell during repartitioning - * the tree. See - * notify_ready_to_unpack() - * on how to retrieve the - * data. - * - * Callers need to store the - * return value. It - * specifies an offset of the - * position at which data can - * later be retrieved during - * a call to - * notify_ready_to_unpack(). - */ - unsigned int - register_data_attach (const std::size_t size, - const std_cxx1x::function & pack_callback); - - /** - * The given function is called for - * each new active cell and supplies - * a pointer to the data saved with - * register_data_attach(). - */ - void - notify_ready_to_unpack (const unsigned int offset, - const std_cxx1x::function & unpack_callback); - - /** - * Returns a permutation vector for the order the coarse - * cells are handed of to p4est. For example the first - * element i in this vector denotes that the first cell - * in hierarchical ordering is the ith deal cell starting - * from begin(0). - */ - const std::vector & - get_p4est_tree_to_coarse_cell_permutation() const; + /** + * Import the various + * iterator typedefs from the + * base class. + */ + typedef typename dealii::Triangulation::active_cell_iterator active_cell_iterator; + typedef typename dealii::Triangulation::cell_iterator cell_iterator; + typedef typename dealii::Triangulation::raw_cell_iterator raw_cell_iterator; + + /** + * Generic settings for distributed + * Triangulations. If + * mesh_reconstruction_after_repartitioning + * is set, the deal.II mesh will be + * reconstructed from the coarse mesh + * every time a repartioning in p4est + * happens. This can be a bit more + * expensive, but guarantees the same + * memory layout and therefore cell + * ordering in the deal.II mesh. As + * assembly is done in the deal.II + * cell ordering, this flag is + * required to get reproducable + * behaviour after snapshot/resume. + */ + enum Settings + { + default_setting = 0x0, + mesh_reconstruction_after_repartitioning = 0x1 + }; + + + + /** + * Constructor. + * + * @param mpi_communicator denotes + * the MPI communicator to be used for + * the triangulation. + * + * @param smooth_grid Degree + * and kind of mesh smoothing + * to be applied to the + * mesh. See the + * dealii::Triangulation + * class for a description of + * the kinds of smoothing + * operations that can be + * applied. + * + * @param settings See the + * description of the Settings + * enumerator. + * + * @note This class does not + * currently support the + * check_for_distorted_cells + * argument provided by the + * base class. + * + * @note While it is possible to pass + * all of the mesh smoothing flags + * listed in the base class to + * objects of this type, it is not + * always possible to honor all of + * these smoothing options if they + * would require knowledge of + * refinement/coarsening flags on + * cells not locally owned by this + * processor. As a consequence, for + * some of these flags, the ultimate + * number of cells of the parallel + * triangulation may depend on the + * number of processors into which it + * is partitioned. On the other hand, + * if no smoothing flags are passed, + * if you always mark the same cells + * of the mesh, you will always get + * the exact same refined mesh + * independent of the number of + * processors into which the + * triangulation is partitioned. + */ + Triangulation (MPI_Comm mpi_communicator, + const typename dealii::Triangulation::MeshSmoothing + smooth_grid = (dealii::Triangulation::none), + const Settings settings = default_setting); + + /** + * Destructor. + */ + virtual ~Triangulation (); + + /** + * Reset this triangulation into a + * virgin state by deleting all data. + * + * Note that this operation is only + * allowed if no subscriptions to this + * object exist any more, such as + * DoFHandler objects using it. + */ + virtual void clear (); + + /** + * Implementation of the same + * function as in the base + * class. + */ + virtual void copy_triangulation (const dealii::Triangulation &old_tria); + + /** + * Create a triangulation as + * documented in the base + * class. + * + * This function also sets up + * the various data + * structures necessary to + * distribute a mesh across a + * number of processors. This + * will be necessary once the + * mesh is being refined, + * though we will always keep + * the entire coarse mesh + * that is generated by this + * function on all + * processors. + */ + virtual void create_triangulation (const std::vector > &vertices, + const std::vector > &cells, + const SubCellData &subcelldata); + + /** + * Coarsen and refine the + * mesh according to + * refinement and coarsening + * flags set. + * + * Since the current + * processor only has control + * over those cells it owns + * (i.e. the ones for which + * cell-@>subdomain_id() + * == + * this-@>locally_owned_subdomain()), + * refinement and coarsening + * flags are only respected + * for those locally owned + * cells. Flags may be set on + * other cells as well (and + * may often, in fact, if you + * call + * dealii::Triangulation::prepare_coarsening_and_refinement) + * but will be largely + * ignored: the decision to + * refine the global mesh + * will only be affected by + * flags set on locally owned + * cells. + */ + virtual void execute_coarsening_and_refinement (); + + /** + * Return the subdomain id of + * those cells that are owned + * by the current + * processor. All cells in + * the triangulation that do + * not have this subdomain id + * are either owned by + * another processor or have + * children that only exist + * on other processors. + */ + types::subdomain_id_t locally_owned_subdomain () const; + + /** + * Return the number of + * active cells in the + * triangulation that are + * locally owned, i.e. that + * have a subdomain_id equal + * to + * locally_owned_subdomain(). Note + * that there may be more + * active cells in the + * triangulation stored on + * the present processor, + * such as for example ghost + * cells, or cells further + * away from the locally + * owned block of cells but + * that are needed to ensure + * that the triangulation + * that stores this + * processor's set of active + * cells still remains + * balanced with respect to + * the 2:1 size ratio of + * adjacent cells. + * + * As a consequence of the remark + * above, the result of this function + * is always smaller or equal to the + * result of the function with the + * same name in the ::Triangulation + * base class, which includes the + * active ghost and artificial cells + * (see also @ref GlossArtificialCell + * and @ref GlossGhostCell). + */ + unsigned int n_locally_owned_active_cells () const; + + /** + * Return the sum over all + * processors of the number + * of active cells owned by + * each processor. This + * equals the overall number + * of active cells in the + * distributed triangulation. + */ + unsigned int n_global_active_cells () const; + + /** + * Return the number of + * active cells owned by each + * of the MPI processes that + * contribute to this + * triangulation. The element + * of this vector indexed by + * locally_owned_subdomain() + * equals the result of + * n_locally_owned_active_cells(). + */ + const std::vector & + n_locally_owned_active_cells_per_processor () const; + + /** + * Return the MPI + * communicator used by this + * triangulation. + */ + MPI_Comm get_communicator () const; + + /** + * Return the local memory + * consumption in bytes. + */ + virtual std::size_t memory_consumption () const; + + /** + * Return the local memory + * consumption contained in the p4est + * data structures alone. This is + * already contained in + * memory_consumption() but made + * available separately for debugging + * purposes. + */ + virtual std::size_t memory_consumption_p4est () const; + + /** + * A collective operation that produces + * a sequence of output files with the + * given file base name that contain + * the mesh in VTK format. + * + * More than anything else, this + * function is useful for debugging the + * interface between deal.II and p4est. + */ + void write_mesh_vtk (const char *file_basename) const; + + /** + * Produce a check sum of the + * triangulation. This is a + * collective operation and + * is mostly useful for + * debugging purposes. + */ + unsigned int get_checksum () const; + + /** + * Save the refinement information from the coarse mesh into the given + * file. This file needs to be reachable from all nodes in the computation + * on a shared network file system. See the SolutionTransfer class + * on how to store solution vectors into this file. + */ + void save(const char* filename) const; + + /** + * Load the refinement information saved with save() back in. The mesh + * must contain the same coarse mesh that was used in save(). You need + * to load with the same number of CPUs that you saved with. + */ + void load(const char* filename); + + /** + * Used to inform in the callbacks of + * register_data_attach() and + * notify_ready_to_unpack() how the + * cell with the given cell_iterator + * is going to change. Note that + * this may me different then the + * refine_flag() and coarsen_flag() + * in the cell_iterator because of + * refinement constraints that this + * machine does not see. + */ + enum CellStatus + { + CELL_PERSIST, CELL_REFINE, CELL_COARSEN, CELL_INVALID + }; + + /** + * Register a function with + * the current Triangulation + * object that will be used + * to attach data to active + * cells before + * execute_coarsening_and_refinement(). In + * execute_coarsening_and_refinement() + * the Triangulation will + * call the given function + * pointer and provide + * @p size bytes to store + * data. If necessary, this data will be + * transferred to the new + * owner of that cell during repartitioning + * the tree. See + * notify_ready_to_unpack() + * on how to retrieve the + * data. + * + * Callers need to store the + * return value. It + * specifies an offset of the + * position at which data can + * later be retrieved during + * a call to + * notify_ready_to_unpack(). + */ + unsigned int + register_data_attach (const std::size_t size, + const std_cxx1x::function & pack_callback); + + /** + * The given function is called for + * each new active cell and supplies + * a pointer to the data saved with + * register_data_attach(). + */ + void + notify_ready_to_unpack (const unsigned int offset, + const std_cxx1x::function & unpack_callback); + + /** + * Returns a permutation vector for the order the coarse + * cells are handed of to p4est. For example the first + * element i in this vector denotes that the first cell + * in hierarchical ordering is the ith deal cell starting + * from begin(0). + */ + const std::vector & + get_p4est_tree_to_coarse_cell_permutation() const; private: - /** - * MPI communicator to be - * used for the - * triangulation. We create a - * unique communicator for - * this class, which is a - * duplicate of the one - * passed to the constructor. - */ - MPI_Comm mpi_communicator; - - /** - * store the Settings. - */ - Settings settings; - - /** - * The subdomain id to be - * used for the current - * processor. - */ - types::subdomain_id_t my_subdomain; - - /** - * A flag that indicates whether the - * triangulation has actual content. - */ - bool triangulation_has_content; - - /** - * A structure that contains - * some numbers about the - * distributed triangulation. - */ - struct NumberCache - { - std::vector n_locally_owned_active_cells; - unsigned int n_global_active_cells; - }; - - NumberCache number_cache; - - /** - * A data structure that holds the - * connectivity between trees. Since - * each tree is rooted in a coarse grid - * cell, this data structure holds the - * connectivity between the cells of - * the coarse grid. - */ - typename dealii::internal::p4est::types::connectivity *connectivity; - - /** - * A data structure that holds the - * local part of the global - * triangulation. - */ - typename dealii::internal::p4est::types::forest *parallel_forest; - - /** - * A flag that indicates - * whether refinement of a - * triangulation is currently - * in progress. This flag is - * used to disambiguate whether - * a call to execute_coarsening_and_triangulation - * came from the outside or - * through a recursive call. While the - * first time we want to take - * over work to copy things - * from a refined p4est, the - * other times we don't want to - * get in the way as these - * latter calls to - * Triangulation::execute_coarsening_and_refinement() - * are simply there in order to - * re-create a triangulation - * that matches the p4est. - */ - bool refinement_in_progress; - - - /** - * number of bytes that get attached to the Triangulation - * through register_data_attach() for example - * SolutionTransfer. - */ - unsigned int attached_data_size; - - /** - * number of functions that get attached to the Triangulation - * through register_data_attach() for example - * SolutionTransfer. - */ - unsigned int n_attached_datas; - - /** - * number of functions that need to unpack their data - * after a call from load() - */ - unsigned int n_attached_deserialize; - - typedef std_cxx1x::function< - void(typename Triangulation::cell_iterator, CellStatus, void*) - > pack_callback_t; - - typedef std::pair callback_pair_t; - - typedef std::list callback_list_t; - - /** - * List of callback functions registered by - * register_data_attach() that are going to be called - * for packing data. - */ - callback_list_t attached_data_pack_callbacks; - - - /** - * Two arrays that store which p4est - * tree corresponds to which coarse - * grid cell and vice versa. We need - * these arrays because p4est goes with - * the original order of coarse cells - * when it sets up its forest, and then - * applies the Morton ordering within - * each tree. But if coarse grid cells - * are badly ordered this may mean that - * individual parts of the forest - * stored on a local machine may be - * split across coarse grid cells that - * are not geometrically - * close. Consequently, we apply a - * Cuthill-McKee preordering to ensure - * that the part of the forest stored - * by p4est is located on geometrically - * close coarse grid cells. - */ - std::vector coarse_cell_to_p4est_tree_permutation; - std::vector p4est_tree_to_coarse_cell_permutation; - - /** - * Return a pointer to the p4est - * tree that belongs to the given - * dealii_coarse_cell_index() - */ - typename dealii::internal::p4est::types::tree * - init_tree(const int dealii_coarse_cell_index) const; - - /** - * The function that computes the - * permutation between the two data - * storage schemes. - */ - void setup_coarse_cell_to_p4est_tree_permutation (); - - /** - * Take the contents of a newly created - * triangulation we are attached to and - * copy it to p4est data structures. - * - * This function exists in 2d - * and 3d variants. - */ - void copy_new_triangulation_to_p4est (dealii::internal::int2type<2>); - void copy_new_triangulation_to_p4est (dealii::internal::int2type<3>); - - /** - * Copy the local part of the refined - * forest from p4est into the attached - * triangulation. - */ - void copy_local_forest_to_triangulation (); - - - /** - * Update the number_cache - * variable after mesh - * creation or refinement. - */ - void update_number_cache (); - - /** - * Internal function notifying all - * registered classes to attach their - * data before repartitioning - * occurs. Called from - * execute_coarsening_and_refinement(). - */ - void attach_mesh_data(); - - - template friend class dealii::internal::DoFHandler::Policy::ParallelDistributed; + /** + * MPI communicator to be + * used for the + * triangulation. We create a + * unique communicator for + * this class, which is a + * duplicate of the one + * passed to the constructor. + */ + MPI_Comm mpi_communicator; + + /** + * store the Settings. + */ + Settings settings; + + /** + * The subdomain id to be + * used for the current + * processor. + */ + types::subdomain_id_t my_subdomain; + + /** + * A flag that indicates whether the + * triangulation has actual content. + */ + bool triangulation_has_content; + + /** + * A structure that contains + * some numbers about the + * distributed triangulation. + */ + struct NumberCache + { + std::vector n_locally_owned_active_cells; + unsigned int n_global_active_cells; + }; + + NumberCache number_cache; + + /** + * A data structure that holds the + * connectivity between trees. Since + * each tree is rooted in a coarse grid + * cell, this data structure holds the + * connectivity between the cells of + * the coarse grid. + */ + typename dealii::internal::p4est::types::connectivity *connectivity; + + /** + * A data structure that holds the + * local part of the global + * triangulation. + */ + typename dealii::internal::p4est::types::forest *parallel_forest; + + /** + * A flag that indicates + * whether refinement of a + * triangulation is currently + * in progress. This flag is + * used to disambiguate whether + * a call to execute_coarsening_and_triangulation + * came from the outside or + * through a recursive call. While the + * first time we want to take + * over work to copy things + * from a refined p4est, the + * other times we don't want to + * get in the way as these + * latter calls to + * Triangulation::execute_coarsening_and_refinement() + * are simply there in order to + * re-create a triangulation + * that matches the p4est. + */ + bool refinement_in_progress; + + + /** + * number of bytes that get attached to the Triangulation + * through register_data_attach() for example + * SolutionTransfer. + */ + unsigned int attached_data_size; + + /** + * number of functions that get attached to the Triangulation + * through register_data_attach() for example + * SolutionTransfer. + */ + unsigned int n_attached_datas; + + /** + * number of functions that need to unpack their data + * after a call from load() + */ + unsigned int n_attached_deserialize; + + typedef std_cxx1x::function< + void(typename Triangulation::cell_iterator, CellStatus, void*) + > pack_callback_t; + + typedef std::pair callback_pair_t; + + typedef std::list callback_list_t; + + /** + * List of callback functions registered by + * register_data_attach() that are going to be called + * for packing data. + */ + callback_list_t attached_data_pack_callbacks; + + + /** + * Two arrays that store which p4est + * tree corresponds to which coarse + * grid cell and vice versa. We need + * these arrays because p4est goes with + * the original order of coarse cells + * when it sets up its forest, and then + * applies the Morton ordering within + * each tree. But if coarse grid cells + * are badly ordered this may mean that + * individual parts of the forest + * stored on a local machine may be + * split across coarse grid cells that + * are not geometrically + * close. Consequently, we apply a + * Cuthill-McKee preordering to ensure + * that the part of the forest stored + * by p4est is located on geometrically + * close coarse grid cells. + */ + std::vector coarse_cell_to_p4est_tree_permutation; + std::vector p4est_tree_to_coarse_cell_permutation; + + /** + * Return a pointer to the p4est + * tree that belongs to the given + * dealii_coarse_cell_index() + */ + typename dealii::internal::p4est::types::tree * + init_tree(const int dealii_coarse_cell_index) const; + + /** + * The function that computes the + * permutation between the two data + * storage schemes. + */ + void setup_coarse_cell_to_p4est_tree_permutation (); + + /** + * Take the contents of a newly created + * triangulation we are attached to and + * copy it to p4est data structures. + * + * This function exists in 2d + * and 3d variants. + */ + void copy_new_triangulation_to_p4est (dealii::internal::int2type<2>); + void copy_new_triangulation_to_p4est (dealii::internal::int2type<3>); + + /** + * Copy the local part of the refined + * forest from p4est into the attached + * triangulation. + */ + void copy_local_forest_to_triangulation (); + + + /** + * Update the number_cache + * variable after mesh + * creation or refinement. + */ + void update_number_cache (); + + /** + * Internal function notifying all + * registered classes to attach their + * data before repartitioning + * occurs. Called from + * execute_coarsening_and_refinement(). + */ + void attach_mesh_data(); + + + template friend class dealii::internal::DoFHandler::Policy::ParallelDistributed; }; - /** - * Specialization of the general template - * for the 1d case. There is currently no - * support for distributing 1d - * triangulations. Consequently, all this - * class does is throw an exception. - */ + /** + * Specialization of the general template + * for the 1d case. There is currently no + * support for distributing 1d + * triangulations. Consequently, all this + * class does is throw an exception. + */ template class Triangulation<1,spacedim> : public dealii::Triangulation<1,spacedim> { public: - /** - * Constructor. The argument denotes - * the MPI communicator to be used for - * the triangulation. - */ - Triangulation (MPI_Comm mpi_communicator); - - /** - * Destructor. - */ - virtual ~Triangulation (); - - /** - * Return the MPI - * communicator used by this - * triangulation. - */ - MPI_Comm get_communicator () const; - - /** - * Return the sum over all - * processors of the number - * of active cells owned by - * each processor. This - * equals the overall number - * of active cells in the - * distributed triangulation. - */ - unsigned int n_global_active_cells () const; - - /** - * Returns a permutation vector for the order the coarse - * cells are handed of to p4est. For example the first - * element i in this vector denotes that the first cell - * in hierarchical ordering is the ith deal cell starting - * from begin(0). - */ - const std::vector & - get_p4est_tree_to_coarse_cell_permutation() const; - - /** - * Return the subdomain id of - * those cells that are owned - * by the current - * processor. All cells in - * the triangulation that do - * not have this subdomain id - * are either owned by - * another processor or have - * children that only exist - * on other processors. - */ - types::subdomain_id_t locally_owned_subdomain () const; - - /** - * Dummy arrays. This class - * isn't usable but the - * compiler wants to see - * these variables at a - * couple places anyway. - */ - std::vector coarse_cell_to_p4est_tree_permutation; - std::vector p4est_tree_to_coarse_cell_permutation; + /** + * Constructor. The argument denotes + * the MPI communicator to be used for + * the triangulation. + */ + Triangulation (MPI_Comm mpi_communicator); + + /** + * Destructor. + */ + virtual ~Triangulation (); + + /** + * Return the MPI + * communicator used by this + * triangulation. + */ + MPI_Comm get_communicator () const; + + /** + * Return the sum over all + * processors of the number + * of active cells owned by + * each processor. This + * equals the overall number + * of active cells in the + * distributed triangulation. + */ + unsigned int n_global_active_cells () const; + + /** + * Returns a permutation vector for the order the coarse + * cells are handed of to p4est. For example the first + * element i in this vector denotes that the first cell + * in hierarchical ordering is the ith deal cell starting + * from begin(0). + */ + const std::vector & + get_p4est_tree_to_coarse_cell_permutation() const; + + /** + * Return the subdomain id of + * those cells that are owned + * by the current + * processor. All cells in + * the triangulation that do + * not have this subdomain id + * are either owned by + * another processor or have + * children that only exist + * on other processors. + */ + types::subdomain_id_t locally_owned_subdomain () const; + + /** + * Dummy arrays. This class + * isn't usable but the + * compiler wants to see + * these variables at a + * couple places anyway. + */ + std::vector coarse_cell_to_p4est_tree_permutation; + std::vector p4est_tree_to_coarse_cell_permutation; }; } } @@ -835,58 +835,58 @@ namespace parallel { namespace distributed { - /** - * Dummy class the compiler chooses for - * parallel distributed triangulations if - * we didn't actually configure deal.II - * with the p4est library. The existence - * of this class allows us to refer to - * parallel::distributed::Triangulation - * objects throughout the library even if - * it is disabled. - * - * Since the constructor of this class is - * private, no such objects can actually - * be created if we don't have p4est - * available. - */ + /** + * Dummy class the compiler chooses for + * parallel distributed triangulations if + * we didn't actually configure deal.II + * with the p4est library. The existence + * of this class allows us to refer to + * parallel::distributed::Triangulation + * objects throughout the library even if + * it is disabled. + * + * Since the constructor of this class is + * private, no such objects can actually + * be created if we don't have p4est + * available. + */ template class Triangulation : public dealii::Triangulation { private: - /** - * Constructor. - */ - Triangulation (); + /** + * Constructor. + */ + Triangulation (); public: - /** - * Destructor. - */ - virtual ~Triangulation (); - - /** - * Return the subdomain id of - * those cells that are owned - * by the current - * processor. All cells in - * the triangulation that do - * not have this subdomain id - * are either owned by - * another processor or have - * children that only exist - * on other processors. - */ - types::subdomain_id_t locally_owned_subdomain () const; - - /** - * Return the MPI - * communicator used by this - * triangulation. - */ + /** + * Destructor. + */ + virtual ~Triangulation (); + + /** + * Return the subdomain id of + * those cells that are owned + * by the current + * processor. All cells in + * the triangulation that do + * not have this subdomain id + * are either owned by + * another processor or have + * children that only exist + * on other processors. + */ + types::subdomain_id_t locally_owned_subdomain () const; + + /** + * Return the MPI + * communicator used by this + * triangulation. + */ #ifdef DEAL_II_COMPILER_SUPPORTS_MPI - MPI_Comm get_communicator () const; + MPI_Comm get_communicator () const; #endif }; } diff --git a/deal.II/include/deal.II/dofs/block_info.h b/deal.II/include/deal.II/dofs/block_info.h index 9bad283544..68448578e3 100644 --- a/deal.II/include/deal.II/dofs/block_info.h +++ b/deal.II/include/deal.II/dofs/block_info.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -89,145 +89,145 @@ namespace hp class BlockInfo : public Subscriptor { public: - /** - * @brief Fill the object with values - * describing block structure - * of the DoFHandler. - * - * This function will also clear - * the local() indices. - */ + /** + * @brief Fill the object with values + * describing block structure + * of the DoFHandler. + * + * This function will also clear + * the local() indices. + */ template void initialize(const DoFHandler&); - /** - * @brief Fill the object with values - * describing level block - * structure of the - * MGDoFHandler. If - * levels_only is false, - * the other initialize() is - * called as well. - * - * This function will also clear - * the local() indices. - */ + /** + * @brief Fill the object with values + * describing level block + * structure of the + * MGDoFHandler. If + * levels_only is false, + * the other initialize() is + * called as well. + * + * This function will also clear + * the local() indices. + */ template void initialize(const MGDoFHandler&, bool levels_only = false); - /** - * @brief Initialize block structure - * on cells and compute - * renumbering between cell - * dofs and block cell dofs. - */ + /** + * @brief Initialize block structure + * on cells and compute + * renumbering between cell + * dofs and block cell dofs. + */ template void initialize_local(const DoFHandler&); - /** - * Access the BlockIndices - * structure of the global - * system. - */ + /** + * Access the BlockIndices + * structure of the global + * system. + */ const BlockIndices& global() const; - /** - * Access BlockIndices for the - * local system on a cell. - */ + /** + * Access BlockIndices for the + * local system on a cell. + */ const BlockIndices& local() const; - /** - * Access the BlockIndices - * structure of a level in the - * multilevel hierarchy. - */ + /** + * Access the BlockIndices + * structure of a level in the + * multilevel hierarchy. + */ const BlockIndices& level(unsigned int level) const; - /** - * Return the index after local - * renumbering. - * - * The input of this function is - * an index between zero and the - * number of dofs per cell, - * numbered in local block - * ordering, that is first all - * indices of the first system - * block, then all of the second - * block and so forth. The - * function then outputs the index - * in the standard local - * numbering of DoFAccessor. - */ + /** + * Return the index after local + * renumbering. + * + * The input of this function is + * an index between zero and the + * number of dofs per cell, + * numbered in local block + * ordering, that is first all + * indices of the first system + * block, then all of the second + * block and so forth. The + * function then outputs the index + * in the standard local + * numbering of DoFAccessor. + */ unsigned int renumber (const unsigned int i) const; - /** - * The number of base elements. - */ + /** + * The number of base elements. + */ unsigned int n_base_elements() const; - /** - * Return the base element of - * this index. - */ + /** + * Return the base element of + * this index. + */ unsigned int base_element (const unsigned int i) const; - /** - * Write a summary of the block - * structure to the stream. - */ + /** + * Write a summary of the block + * structure to the stream. + */ template void print(OS& stream) const; - - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ + + /** + * Determine an estimate for the + * memory consumption (in bytes) + * of this object. + */ std::size_t memory_consumption () const; /** - * Read or write the data of this object to or + * Read or write the data of this object to or * from a stream for the purpose of serialization - */ + */ template - void serialize (Archive & ar, - const unsigned int version); - + void serialize (Archive & ar, + const unsigned int version); + private: - /** - * @brief The block structure - * of the global system. - */ + /** + * @brief The block structure + * of the global system. + */ BlockIndices bi_global; - /** - * @brief The multilevel block structure. - */ + /** + * @brief The multilevel block structure. + */ std::vector levels; - /** - * @brief The block structure - * of the cell systems. - */ + /** + * @brief The block structure + * of the cell systems. + */ BlockIndices bi_local; - /** - * The base element associated - * with each block. - */ + /** + * The base element associated + * with each block. + */ std::vector base_elements; - /** - * A vector containing the - * renumbering from the - * standard order of degrees of - * freedom on a cell to a - * component wise - * ordering. Filled by - * initialize(). - */ + /** + * A vector containing the + * renumbering from the + * standard order of degrees of + * freedom on a cell to a + * component wise + * ordering. Filled by + * initialize(). + */ std::vector local_renumbering; }; @@ -305,15 +305,15 @@ BlockInfo::print (OS& os) const { os << "local dofs " << std::setw(5) << local().total_size() << " blocks"; for (unsigned int i=0;i -void BlockInfo::serialize (Archive & ar, - const unsigned int version) +void BlockInfo::serialize (Archive & ar, + const unsigned int version) { ar & bi_global; ar & levels; diff --git a/deal.II/include/deal.II/dofs/dof_accessor.h b/deal.II/include/deal.II/dofs/dof_accessor.h index 90d89d861e..64a2581450 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -84,12 +84,12 @@ namespace internal template struct Inheritance { - /** - * Declaration of the @p typedef. - * See the full documentation for - * more information. - */ - typedef dealii::TriaAccessor BaseClass; + /** + * Declaration of the @p typedef. + * See the full documentation for + * more information. + */ + typedef dealii::TriaAccessor BaseClass; }; @@ -101,12 +101,12 @@ namespace internal template struct Inheritance { - /** - * Declaration of the @p typedef. - * See the full documentation for - * more information. - */ - typedef dealii::CellAccessor BaseClass; + /** + * Declaration of the @p typedef. + * See the full documentation for + * more information. + */ + typedef dealii::CellAccessor BaseClass; }; } } @@ -173,325 +173,325 @@ class DoFAccessor : public internal::DoFAccessor::Inheritance::BaseClass BaseClass; - /** - * Data type passed by the iterator class. - */ + /** + * Data type passed by the iterator class. + */ typedef DH AccessorData; - /** - * @name Constructors - */ - /** - * @{ - */ - - /** - * Default constructor. Provides - * an accessor that can't be - * used. - */ + /** + * @name Constructors + */ + /** + * @{ + */ + + /** + * Default constructor. Provides + * an accessor that can't be + * used. + */ DoFAccessor (); - /** - * Constructor - */ + /** + * Constructor + */ DoFAccessor (const Triangulation *tria, - const int level, - const int index, - const DH *local_data); - - /** - * Conversion constructor. This - * constructor exists to make certain - * constructs simpler to write in - * dimension independent code. For - * example, it allows assigning a face - * iterator to a line iterator, an - * operation that is useful in 2d but - * doesn't make any sense in 3d. The - * constructor here exists for the - * purpose of making the code conform to - * C++ but it will unconditionally abort; - * in other words, assigning a face - * iterator to a line iterator is better - * put into an if-statement that checks - * that the dimension is two, and assign - * to a quad iterator in 3d (an operator - * that, without this constructor would - * be illegal if we happen to compile for - * 2d). - */ + const int level, + const int index, + const DH *local_data); + + /** + * Conversion constructor. This + * constructor exists to make certain + * constructs simpler to write in + * dimension independent code. For + * example, it allows assigning a face + * iterator to a line iterator, an + * operation that is useful in 2d but + * doesn't make any sense in 3d. The + * constructor here exists for the + * purpose of making the code conform to + * C++ but it will unconditionally abort; + * in other words, assigning a face + * iterator to a line iterator is better + * put into an if-statement that checks + * that the dimension is two, and assign + * to a quad iterator in 3d (an operator + * that, without this constructor would + * be illegal if we happen to compile for + * 2d). + */ template DoFAccessor (const InvalidAccessor &); - /** - * Another conversion operator - * between objects that don't - * make sense, just like the - * previous one. - */ + /** + * Another conversion operator + * between objects that don't + * make sense, just like the + * previous one. + */ template DoFAccessor (const DoFAccessor &); - /** - * @} - */ + /** + * @} + */ - /** - * Return a handle on the - * DoFHandler object which we - * are using. - */ + /** + * Return a handle on the + * DoFHandler object which we + * are using. + */ const DH & get_dof_handler () const; - /** - * Implement the copy operator needed - * for the iterator classes. - */ + /** + * Implement the copy operator needed + * for the iterator classes. + */ void copy_from (const DoFAccessor &a); - /** - * Copy operator used by the - * iterator class. Keeps the - * previously set dof handler, - * but sets the object - * coordinates of the TriaAccessor. - */ + /** + * Copy operator used by the + * iterator class. Keeps the + * previously set dof handler, + * but sets the object + * coordinates of the TriaAccessor. + */ void copy_from (const TriaAccessorBase &da); - /** - * Return an iterator pointing to - * the the parent. - */ + /** + * Return an iterator pointing to + * the the parent. + */ TriaIterator > parent () const; - /** - * @name Accessing sub-objects - */ - /** - * @{ - */ - - /** - * Return an iterator pointing to - * the the @p c-th child. - */ + /** + * @name Accessing sub-objects + */ + /** + * @{ + */ + + /** + * Return an iterator pointing to + * the the @p c-th child. + */ TriaIterator > child (const unsigned int c) const; - /** - * Pointer to the @p ith line - * bounding this object. - */ + /** + * Pointer to the @p ith line + * bounding this object. + */ typename internal::DoFHandler::Iterators::line_iterator line (const unsigned int i) const; - /** - * Pointer to the @p ith quad - * bounding this object. - */ + /** + * Pointer to the @p ith quad + * bounding this object. + */ typename internal::DoFHandler::Iterators::quad_iterator quad (const unsigned int i) const; - /** - * @} - */ - - /** - * @name Accessing the DoF indices of this object - */ - /** - * @{ - */ - - /** - * Return the indices of the dofs of this - * object in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * The vector has to have the - * right size before being passed - * to this function. - * - * This function is most often - * used on active objects (edges, - * faces, cells). It can be used - * on non-active objects as well - * (i.e. objects that have - * children), but only if the - * finite element under - * consideration has degrees of - * freedom exclusively on - * vertices. Otherwise, the - * function doesn't make much - * sense, since for example - * inactive edges do not have - * degrees of freedom associated - * with them at all. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - * - * For cells, there is only a - * single possible finite element - * index (namely the one for that - * cell, returned by - * cell-@>active_fe_index. Consequently, - * the derived DoFCellAccessor - * class has an overloaded - * version of this function that - * calls the present function - * with - * cell-@>active_fe_index - * as last argument. - */ + /** + * @} + */ + + /** + * @name Accessing the DoF indices of this object + */ + /** + * @{ + */ + + /** + * Return the indices of the dofs of this + * object in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. + * + * The vector has to have the + * right size before being passed + * to this function. + * + * This function is most often + * used on active objects (edges, + * faces, cells). It can be used + * on non-active objects as well + * (i.e. objects that have + * children), but only if the + * finite element under + * consideration has degrees of + * freedom exclusively on + * vertices. Otherwise, the + * function doesn't make much + * sense, since for example + * inactive edges do not have + * degrees of freedom associated + * with them at all. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + * + * For cells, there is only a + * single possible finite element + * index (namely the one for that + * cell, returned by + * cell-@>active_fe_index. Consequently, + * the derived DoFCellAccessor + * class has an overloaded + * version of this function that + * calls the present function + * with + * cell-@>active_fe_index + * as last argument. + */ void get_dof_indices (std::vector &dof_indices, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Global DoF index of the i - * degree associated with the @p vertexth - * vertex of the present cell. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + const unsigned int fe_index = DH::default_fe_index) const; + + /** + * Global DoF index of the i + * degree associated with the @p vertexth + * vertex of the present cell. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Index of the ith degree - * of freedom of this object. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + const unsigned int i, + const unsigned int fe_index = DH::default_fe_index) const; + + /** + * Index of the ith degree + * of freedom of this object. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ unsigned int dof_index (const unsigned int i, - const unsigned int fe_index = DH::default_fe_index) const; + const unsigned int fe_index = DH::default_fe_index) const; - /** - * @} - */ + /** + * @} + */ - /** - * @name Accessing the finite element associated with this object - */ - /** - * @{ - */ + /** + * @name Accessing the finite element associated with this object + */ + /** + * @{ + */ /** * Return the number of finite @@ -516,200 +516,200 @@ class DoFAccessor : public internal::DoFAccessor::Inheritancefe_index_is_active(fe_index) - * must return true. - */ + /** + * Return a reference to the finite + * element used on this object with the + * given @p fe_index. @p fe_index must be + * used on this object, + * i.e. fe_index_is_active(fe_index) + * must return true. + */ const FiniteElement & get_fe (const unsigned int fe_index) const; - /** - * @} - */ + /** + * @} + */ /** - * Exceptions for child classes - * - * @ingroup Exceptions - */ + * Exceptions for child classes + * + * @ingroup Exceptions + */ DeclException0 (ExcInvalidObject); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcVectorNotEmpty); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcVectorDoesNotMatch); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcMatrixDoesNotMatch); - /** - * A function has been called for - * a cell which should be active, - * but is refined. @ref GlossActive - * - * @ingroup Exceptions - */ + /** + * A function has been called for + * a cell which should be active, + * but is refined. @ref GlossActive + * + * @ingroup Exceptions + */ DeclException0 (ExcNotActive); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcCantCompareIterators); protected: - /** - * Store the address of the DoFHandler object - * to be accessed. - */ + /** + * Store the address of the DoFHandler object + * to be accessed. + */ DH *dof_handler; - /** - * Compare for equality. - */ + /** + * Compare for equality. + */ bool operator == (const DoFAccessor &) const; - /** - * Compare for inequality. - */ + /** + * Compare for inequality. + */ bool operator != (const DoFAccessor &) const; - /** - * Reset the DoF handler pointer. - */ + /** + * Reset the DoF handler pointer. + */ void set_dof_handler (DH *dh); - /** - * Set the index of the - * ith degree of freedom - * of this object to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + /** + * Set the index of the + * ith degree of freedom + * of this object to @p index. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ void set_dof_index (const unsigned int i, - const unsigned int index, - const unsigned int fe_index = DH::default_fe_index) const; - - /** - * Set the global index of the i - * degree on the @p vertex-th vertex of - * the present cell to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; + + /** + * Set the global index of the i + * degree on the @p vertex-th vertex of + * the present cell to @p index. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ void set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index = DH::default_fe_index) const; + const unsigned int i, + const unsigned int index, + const unsigned int fe_index = DH::default_fe_index) const; /** * Iterator classes need to be friends @@ -720,31 +720,31 @@ class DoFAccessor : public internal::DoFAccessor::Inheritanceiterator a,b; - * *a=*b;. Presumably, the intent - * here is to copy the object pointed to - * by @p b to the object pointed to by - * @p a. However, the result of - * dereferencing an iterator is not an - * object but an accessor; consequently, - * this operation is not useful for - * iterators on triangulations. We - * declare this function here private, - * thus it may not be used from outside. - * Furthermore it is not implemented and - * will give a linker error if used - * anyway. - */ + /** + * Copy operator. This is normally used + * in a context like iterator a,b; + * *a=*b;. Presumably, the intent + * here is to copy the object pointed to + * by @p b to the object pointed to by + * @p a. However, the result of + * dereferencing an iterator is not an + * object but an accessor; consequently, + * this operation is not useful for + * iterators on triangulations. We + * declare this function here private, + * thus it may not be used from outside. + * Furthermore it is not implemented and + * will give a linker error if used + * anyway. + */ DoFAccessor & operator = (const DoFAccessor &da); - /** - * Make the DoFHandler class a friend so - * that it can call the set_xxx() - * functions. - */ + /** + * Make the DoFHandler class a friend so + * that it can call the set_xxx() + * functions. + */ template friend class DoFHandler; template friend class hp::DoFHandler; @@ -771,372 +771,372 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> { public: - /** - * A static variable that allows users of - * this class to discover the value of - * the second template argument. - */ + /** + * A static variable that allows users of + * this class to discover the value of + * the second template argument. + */ static const unsigned int dimension=1; - /** - * A static variable that allows users of - * this class to discover the value of - * the third template argument. - */ + /** + * A static variable that allows users of + * this class to discover the value of + * the third template argument. + */ static const unsigned int space_dimension=spacedim; - /** - * Declare a typedef to the base - * class to make accessing some - * of the exception classes - * simpler. - */ + /** + * Declare a typedef to the base + * class to make accessing some + * of the exception classes + * simpler. + */ typedef TriaAccessor<0,1,spacedim> BaseClass; - /** - * Data type passed by the iterator class. - */ + /** + * Data type passed by the iterator class. + */ typedef DH<1,spacedim> AccessorData; - /** - * @name Constructors - */ - /** - * @{ - */ - - /** - * Default constructor. Provides - * an accessor that can't be - * used. - */ + /** + * @name Constructors + */ + /** + * @{ + */ + + /** + * Default constructor. Provides + * an accessor that can't be + * used. + */ DoFAccessor (); - /** - * Constructor to be used if the - * object here refers to a vertex - * of a one-dimensional - * triangulation, i.e. a face of - * the triangulation. - * - * Since there is no mapping from - * vertices to cells, an accessor - * object for a point has no way - * to figure out whether it is at - * the boundary of the domain or - * not. Consequently, the second - * argument must be passed by the - * object that generates this - * accessor -- e.g. a 1d cell - * that can figure out whether - * its left or right vertex are - * at the boundary. - * - * The third argument is the - * global index of the vertex we - * point to. - * - * The fourth argument is a - * pointer to the DoFHandler - * object. - * - * This iterator can only be - * called for one-dimensional - * triangulations. - */ + /** + * Constructor to be used if the + * object here refers to a vertex + * of a one-dimensional + * triangulation, i.e. a face of + * the triangulation. + * + * Since there is no mapping from + * vertices to cells, an accessor + * object for a point has no way + * to figure out whether it is at + * the boundary of the domain or + * not. Consequently, the second + * argument must be passed by the + * object that generates this + * accessor -- e.g. a 1d cell + * that can figure out whether + * its left or right vertex are + * at the boundary. + * + * The third argument is the + * global index of the vertex we + * point to. + * + * The fourth argument is a + * pointer to the DoFHandler + * object. + * + * This iterator can only be + * called for one-dimensional + * triangulations. + */ DoFAccessor (const Triangulation<1,spacedim> * tria, - const typename TriaAccessor<0,1,spacedim>::VertexKind vertex_kind, - const unsigned int vertex_index, - const DH<1,spacedim> * dof_handler); - - /** - * Constructor. This constructor - * exists in order to maintain - * interface compatibility with - * the other accessor - * classes. However, it doesn't - * do anything useful here and so - * may not actually be called. - */ + const typename TriaAccessor<0,1,spacedim>::VertexKind vertex_kind, + const unsigned int vertex_index, + const DH<1,spacedim> * dof_handler); + + /** + * Constructor. This constructor + * exists in order to maintain + * interface compatibility with + * the other accessor + * classes. However, it doesn't + * do anything useful here and so + * may not actually be called. + */ DoFAccessor (const Triangulation<1,spacedim> *, - const int = 0, - const int = 0, - const DH<1,spacedim> * = 0); - - /** - * Conversion constructor. This - * constructor exists to make certain - * constructs simpler to write in - * dimension independent code. For - * example, it allows assigning a face - * iterator to a line iterator, an - * operation that is useful in 2d but - * doesn't make any sense in 3d. The - * constructor here exists for the - * purpose of making the code conform to - * C++ but it will unconditionally abort; - * in other words, assigning a face - * iterator to a line iterator is better - * put into an if-statement that checks - * that the dimension is two, and assign - * to a quad iterator in 3d (an operator - * that, without this constructor would - * be illegal if we happen to compile for - * 2d). - */ + const int = 0, + const int = 0, + const DH<1,spacedim> * = 0); + + /** + * Conversion constructor. This + * constructor exists to make certain + * constructs simpler to write in + * dimension independent code. For + * example, it allows assigning a face + * iterator to a line iterator, an + * operation that is useful in 2d but + * doesn't make any sense in 3d. The + * constructor here exists for the + * purpose of making the code conform to + * C++ but it will unconditionally abort; + * in other words, assigning a face + * iterator to a line iterator is better + * put into an if-statement that checks + * that the dimension is two, and assign + * to a quad iterator in 3d (an operator + * that, without this constructor would + * be illegal if we happen to compile for + * 2d). + */ template DoFAccessor (const InvalidAccessor &); - /** - * Another conversion operator - * between objects that don't - * make sense, just like the - * previous one. - */ + /** + * Another conversion operator + * between objects that don't + * make sense, just like the + * previous one. + */ template DoFAccessor (const DoFAccessor &); - /** - * @} - */ + /** + * @} + */ - /** - * Return a handle on the - * DoFHandler object which we - * are using. - */ + /** + * Return a handle on the + * DoFHandler object which we + * are using. + */ const DH<1,spacedim> & get_dof_handler () const; - /** - * Copy operator. - */ + /** + * Copy operator. + */ DoFAccessor<0,DH<1,spacedim> > & operator = (const DoFAccessor<0,DH<1,spacedim> > &da); - /** - * Implement the copy operator needed - * for the iterator classes. - */ + /** + * Implement the copy operator needed + * for the iterator classes. + */ void copy_from (const DoFAccessor<0, DH<1,spacedim> > &a); - /** - * Copy operator used by the - * iterator class. Keeps the - * previously set dof handler, - * but sets the object - * coordinates of the TriaAccessor. - */ + /** + * Copy operator used by the + * iterator class. Keeps the + * previously set dof handler, + * but sets the object + * coordinates of the TriaAccessor. + */ void copy_from (const TriaAccessorBase<0, 1, spacedim> &da); - /** - * Return an iterator pointing to - * the the parent. - */ + /** + * Return an iterator pointing to + * the the parent. + */ TriaIterator > > parent () const; - /** - * @name Accessing sub-objects - */ - /** - * @{ - */ - - /** - * Return an iterator pointing to - * the the @p c-th child. - */ + /** + * @name Accessing sub-objects + */ + /** + * @{ + */ + + /** + * Return an iterator pointing to + * the the @p c-th child. + */ TriaIterator > > child (const unsigned int c) const; - /** - * Pointer to the @p ith line - * bounding this object. - */ + /** + * Pointer to the @p ith line + * bounding this object. + */ typename internal::DoFHandler::Iterators >::line_iterator line (const unsigned int i) const; - /** - * Pointer to the @p ith quad - * bounding this object. - */ + /** + * Pointer to the @p ith quad + * bounding this object. + */ typename internal::DoFHandler::Iterators >::quad_iterator quad (const unsigned int i) const; - /** - * @} - */ - - /** - * @name Accessing the DoF indices of this object - */ - /** - * @{ - */ - - /** - * Return the indices of the dofs of this - * object in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * The vector has to have the - * right size before being passed - * to this function. - * - * This function is most often - * used on active objects (edges, - * faces, cells). It can be used - * on non-active objects as well - * (i.e. objects that have - * children), but only if the - * finite element under - * consideration has degrees of - * freedom exclusively on - * vertices. Otherwise, the - * function doesn't make much - * sense, since for example - * inactive edges do not have - * degrees of freedom associated - * with them at all. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - * - * For cells, there is only a - * single possible finite element - * index (namely the one for that - * cell, returned by - * cell-@>active_fe_index. Consequently, - * the derived DoFCellAccessor - * class has an overloaded - * version of this function that - * calls the present function - * with - * cell-@>active_fe_index - * as last argument. - */ + /** + * @} + */ + + /** + * @name Accessing the DoF indices of this object + */ + /** + * @{ + */ + + /** + * Return the indices of the dofs of this + * object in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. + * + * The vector has to have the + * right size before being passed + * to this function. + * + * This function is most often + * used on active objects (edges, + * faces, cells). It can be used + * on non-active objects as well + * (i.e. objects that have + * children), but only if the + * finite element under + * consideration has degrees of + * freedom exclusively on + * vertices. Otherwise, the + * function doesn't make much + * sense, since for example + * inactive edges do not have + * degrees of freedom associated + * with them at all. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + * + * For cells, there is only a + * single possible finite element + * index (namely the one for that + * cell, returned by + * cell-@>active_fe_index. Consequently, + * the derived DoFCellAccessor + * class has an overloaded + * version of this function that + * calls the present function + * with + * cell-@>active_fe_index + * as last argument. + */ void get_dof_indices (std::vector &dof_indices, - const unsigned int fe_index = AccessorData::default_fe_index) const; - - /** - * Global DoF index of the i - * degree associated with the @p vertexth - * vertex of the present cell. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + const unsigned int fe_index = AccessorData::default_fe_index) const; + + /** + * Global DoF index of the i + * degree associated with the @p vertexth + * vertex of the present cell. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ unsigned int vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index = AccessorData::default_fe_index) const; - - /** - * Index of the ith degree - * of freedom of this object. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + const unsigned int i, + const unsigned int fe_index = AccessorData::default_fe_index) const; + + /** + * Index of the ith degree + * of freedom of this object. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ unsigned int dof_index (const unsigned int i, - const unsigned int fe_index = AccessorData::default_fe_index) const; + const unsigned int fe_index = AccessorData::default_fe_index) const; - /** - * @} - */ + /** + * @} + */ - /** - * @name Accessing the finite element associated with this object - */ - /** - * @{ - */ + /** + * @name Accessing the finite element associated with this object + */ + /** + * @{ + */ /** * Return the number of finite @@ -1161,200 +1161,200 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> unsigned int n_active_fe_indices () const; - /** - * Return the @p n-th active fe - * index on this object. For - * cells and all non-hp objects, - * there is only a single active - * fe index, so the argument must - * be equal to zero. For - * lower-dimensional hp objects, - * there are - * n_active_fe_indices() active - * finite elements, and this - * function can be queried for - * their indices. - */ + /** + * Return the @p n-th active fe + * index on this object. For + * cells and all non-hp objects, + * there is only a single active + * fe index, so the argument must + * be equal to zero. For + * lower-dimensional hp objects, + * there are + * n_active_fe_indices() active + * finite elements, and this + * function can be queried for + * their indices. + */ unsigned int nth_active_fe_index (const unsigned int n) const; - /** - * Return true if the finite - * element with given index is - * active on the present - * object. For non-hp DoF - * accessors, this is of course - * the case only if @p fe_index - * equals zero. For cells, it is - * the case if @p fe_index equals - * active_fe_index() of this - * cell. For faces and other - * lower-dimensional objects, - * there may be more than one @p - * fe_index that are active on - * any given object (see - * n_active_fe_indices()). - */ + /** + * Return true if the finite + * element with given index is + * active on the present + * object. For non-hp DoF + * accessors, this is of course + * the case only if @p fe_index + * equals zero. For cells, it is + * the case if @p fe_index equals + * active_fe_index() of this + * cell. For faces and other + * lower-dimensional objects, + * there may be more than one @p + * fe_index that are active on + * any given object (see + * n_active_fe_indices()). + */ bool fe_index_is_active (const unsigned int fe_index) const; - /** - * Return a reference to the finite - * element used on this object with the - * given @p fe_index. @p fe_index must be - * used on this object, - * i.e. fe_index_is_active(fe_index) - * must return true. - */ + /** + * Return a reference to the finite + * element used on this object with the + * given @p fe_index. @p fe_index must be + * used on this object, + * i.e. fe_index_is_active(fe_index) + * must return true. + */ const FiniteElement::dimension,DH<1,spacedim>::space_dimension> & get_fe (const unsigned int fe_index) const; - /** - * @} - */ + /** + * @} + */ /** - * Exceptions for child classes - * - * @ingroup Exceptions - */ + * Exceptions for child classes + * + * @ingroup Exceptions + */ DeclException0 (ExcInvalidObject); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcVectorNotEmpty); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcVectorDoesNotMatch); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcMatrixDoesNotMatch); - /** - * A function has been called for - * a cell which should be active, - * but is refined. @ref GlossActive - * - * @ingroup Exceptions - */ + /** + * A function has been called for + * a cell which should be active, + * but is refined. @ref GlossActive + * + * @ingroup Exceptions + */ DeclException0 (ExcNotActive); - /** - * Exception - * - * @ingroup Exceptions - */ + /** + * Exception + * + * @ingroup Exceptions + */ DeclException0 (ExcCantCompareIterators); protected: - /** - * Store the address of the DoFHandler object - * to be accessed. - */ + /** + * Store the address of the DoFHandler object + * to be accessed. + */ DH<1,spacedim> *dof_handler; - /** - * Compare for equality. - */ + /** + * Compare for equality. + */ bool operator == (const DoFAccessor &) const; - /** - * Compare for inequality. - */ + /** + * Compare for inequality. + */ bool operator != (const DoFAccessor &) const; - /** - * Reset the DoF handler pointer. - */ + /** + * Reset the DoF handler pointer. + */ void set_dof_handler (DH<1,spacedim> *dh); - /** - * Set the index of the - * ith degree of freedom - * of this object to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + /** + * Set the index of the + * ith degree of freedom + * of this object to @p index. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ void set_dof_index (const unsigned int i, - const unsigned int index, - const unsigned int fe_index = AccessorData::default_fe_index) const; - - /** - * Set the global index of the i - * degree on the @p vertex-th vertex of - * the present cell to @p index. - * - * The last argument denotes the - * finite element index. For the - * standard ::DoFHandler class, - * this value must be equal to - * its default value since that - * class only supports the same - * finite element on all cells - * anyway. - * - * However, for hp objects - * (i.e. the hp::DoFHandler - * class), different finite - * element objects may be used on - * different cells. On faces - * between two cells, as well as - * vertices, there may therefore - * be two sets of degrees of - * freedom, one for each of the - * finite elements used on the - * adjacent cells. In order to - * specify which set of degrees - * of freedom to work on, the - * last argument is used to - * disambiguate. Finally, if this - * function is called for a cell - * object, there can only be a - * single set of degrees of - * freedom, and fe_index has to - * match the result of - * active_fe_index(). - */ + const unsigned int index, + const unsigned int fe_index = AccessorData::default_fe_index) const; + + /** + * Set the global index of the i + * degree on the @p vertex-th vertex of + * the present cell to @p index. + * + * The last argument denotes the + * finite element index. For the + * standard ::DoFHandler class, + * this value must be equal to + * its default value since that + * class only supports the same + * finite element on all cells + * anyway. + * + * However, for hp objects + * (i.e. the hp::DoFHandler + * class), different finite + * element objects may be used on + * different cells. On faces + * between two cells, as well as + * vertices, there may therefore + * be two sets of degrees of + * freedom, one for each of the + * finite elements used on the + * adjacent cells. In order to + * specify which set of degrees + * of freedom to work on, the + * last argument is used to + * disambiguate. Finally, if this + * function is called for a cell + * object, there can only be a + * single set of degrees of + * freedom, and fe_index has to + * match the result of + * active_fe_index(). + */ void set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index = AccessorData::default_fe_index) const; + const unsigned int i, + const unsigned int index, + const unsigned int fe_index = AccessorData::default_fe_index) const; /** * Iterator classes need to be friends @@ -1364,11 +1364,11 @@ class DoFAccessor<0,DH<1,spacedim> > : public TriaAccessor<0,1,spacedim> template friend class TriaRawIterator; - /** - * Make the DoFHandler class a friend so - * that it can call the set_xxx() - * functions. - */ + /** + * Make the DoFHandler class a friend so + * that it can call the set_xxx() + * functions. + */ template friend class DoFHandler; template friend class hp::DoFHandler; @@ -1398,601 +1398,601 @@ template class DoFCellAccessor : public DoFAccessor { public: - /** - * Extract dimension from DH. - */ + /** + * Extract dimension from DH. + */ static const unsigned int dim = DH::dimension; - /** - * Extract space dimension from DH. - */ + /** + * Extract space dimension from DH. + */ static const unsigned int spacedim = DH::space_dimension; - /** - * Declare the data type that - * this accessor class expects to - * get passed from the iterator - * classes. - */ + /** + * Declare the data type that + * this accessor class expects to + * get passed from the iterator + * classes. + */ typedef typename DoFAccessor::AccessorData AccessorData; - /** - * Declare a typedef to the base - * class to make accessing some - * of the exception classes - * simpler. - */ + /** + * Declare a typedef to the base + * class to make accessing some + * of the exception classes + * simpler. + */ typedef DoFAccessor BaseClass; - /** - * Define the type of the - * container this is part of. - */ + /** + * Define the type of the + * container this is part of. + */ typedef DH Container; - /** - * @name Constructors - */ - /** - * @{ - */ + /** + * @name Constructors + */ + /** + * @{ + */ - /** - * Constructor - */ + /** + * Constructor + */ DoFCellAccessor (const Triangulation *tria, - const int level, - const int index, - const AccessorData *local_data); - - /** - * Conversion constructor. This - * constructor exists to make certain - * constructs simpler to write in - * dimension independent code. For - * example, it allows assigning a face - * iterator to a line iterator, an - * operation that is useful in 2d but - * doesn't make any sense in 3d. The - * constructor here exists for the - * purpose of making the code conform to - * C++ but it will unconditionally abort; - * in other words, assigning a face - * iterator to a line iterator is better - * put into an if-statement that checks - * that the dimension is two, and assign - * to a quad iterator in 3d (an operator - * that, without this constructor would - * be illegal if we happen to compile for - * 2d). - */ + const int level, + const int index, + const AccessorData *local_data); + + /** + * Conversion constructor. This + * constructor exists to make certain + * constructs simpler to write in + * dimension independent code. For + * example, it allows assigning a face + * iterator to a line iterator, an + * operation that is useful in 2d but + * doesn't make any sense in 3d. The + * constructor here exists for the + * purpose of making the code conform to + * C++ but it will unconditionally abort; + * in other words, assigning a face + * iterator to a line iterator is better + * put into an if-statement that checks + * that the dimension is two, and assign + * to a quad iterator in 3d (an operator + * that, without this constructor would + * be illegal if we happen to compile for + * 2d). + */ template DoFCellAccessor (const InvalidAccessor &); - /** - * Another conversion operator - * between objects that don't - * make sense, just like the - * previous one. - */ + /** + * Another conversion operator + * between objects that don't + * make sense, just like the + * previous one. + */ template DoFCellAccessor (const DoFAccessor &); - /** - * @} - */ - - /** - * Return the parent as a DoF - * cell iterator. This - * function is needed since the - * parent function of the base - * class returns a cell accessor - * without access to the DoF - * data. - */ + /** + * @} + */ + + /** + * Return the parent as a DoF + * cell iterator. This + * function is needed since the + * parent function of the base + * class returns a cell accessor + * without access to the DoF + * data. + */ typename internal::DoFHandler::Iterators::cell_iterator parent () const; - /** - * @name Accessing sub-objects and neighbors - */ - /** - * @{ - */ - - /** - * Return the @p ith neighbor as - * a DoF cell iterator. This - * function is needed since the - * neighbor function of the base - * class returns a cell accessor - * without access to the DoF - * data. - */ + /** + * @name Accessing sub-objects and neighbors + */ + /** + * @{ + */ + + /** + * Return the @p ith neighbor as + * a DoF cell iterator. This + * function is needed since the + * neighbor function of the base + * class returns a cell accessor + * without access to the DoF + * data. + */ typename internal::DoFHandler::Iterators::cell_iterator neighbor (const unsigned int) const; - /** - * Return the @p ith child as a - * DoF cell iterator. This - * function is needed since the - * child function of the base - * class returns a cell accessor - * without access to the DoF - * data. - */ + /** + * Return the @p ith child as a + * DoF cell iterator. This + * function is needed since the + * child function of the base + * class returns a cell accessor + * without access to the DoF + * data. + */ typename internal::DoFHandler::Iterators::cell_iterator child (const unsigned int) const; - /** - * Return an iterator to the @p ith face - * of this cell. - * - * This function is not implemented in - * 1D, and maps to DoFAccessor::line - * in 2D. - */ + /** + * Return an iterator to the @p ith face + * of this cell. + * + * This function is not implemented in + * 1D, and maps to DoFAccessor::line + * in 2D. + */ typename internal::DoFHandler::Iterators::face_iterator face (const unsigned int i) const; /** - * Return the result of the - * @p neighbor_child_on_subface - * function of the base class, - * but convert it so that one can - * also access the DoF data (the - * function in the base class - * only returns an iterator with - * access to the triangulation - * data). - */ + * Return the result of the + * @p neighbor_child_on_subface + * function of the base class, + * but convert it so that one can + * also access the DoF data (the + * function in the base class + * only returns an iterator with + * access to the triangulation + * data). + */ typename internal::DoFHandler::Iterators::cell_iterator neighbor_child_on_subface (const unsigned int face_no, const unsigned int subface_no) const; - /** - * @} - */ - - /** - * @name Extracting values from global vectors - */ - /** - * @{ - */ - - /** - * Return the values of the given vector - * restricted to the dofs of this - * cell in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * The vector has to have the - * right size before being passed - * to this function. This - * function is only callable for - * active cells. - * - * The input vector may be either - * a Vector, - * Vector, or a - * BlockVector, or a - * PETSc or Trilinos vector if - * deal.II is compiled to support - * these libraries. It is in the - * responsibility of the caller - * to assure that the types of - * the numbers stored in input - * and output vectors are - * compatible and with similar - * accuracy. - */ + /** + * @} + */ + + /** + * @name Extracting values from global vectors + */ + /** + * @{ + */ + + /** + * Return the values of the given vector + * restricted to the dofs of this + * cell in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. + * + * The vector has to have the + * right size before being passed + * to this function. This + * function is only callable for + * active cells. + * + * The input vector may be either + * a Vector, + * Vector, or a + * BlockVector, or a + * PETSc or Trilinos vector if + * deal.II is compiled to support + * these libraries. It is in the + * responsibility of the caller + * to assure that the types of + * the numbers stored in input + * and output vectors are + * compatible and with similar + * accuracy. + */ template void get_dof_values (const InputVector &values, - Vector &local_values) const; - - /** - * Return the values of the given vector - * restricted to the dofs of this - * cell in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * The vector has to have the - * right size before being passed - * to this function. This - * function is only callable for - * active cells. - * - * The input vector may be either - * a Vector, - * Vector, or a - * BlockVector, or a - * PETSc or Trilinos vector if - * deal.II is compiled to support - * these libraries. It is in the - * responsibility of the caller - * to assure that the types of - * the numbers stored in input - * and output vectors are - * compatible and with similar - * accuracy. - */ + Vector &local_values) const; + + /** + * Return the values of the given vector + * restricted to the dofs of this + * cell in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. + * + * The vector has to have the + * right size before being passed + * to this function. This + * function is only callable for + * active cells. + * + * The input vector may be either + * a Vector, + * Vector, or a + * BlockVector, or a + * PETSc or Trilinos vector if + * deal.II is compiled to support + * these libraries. It is in the + * responsibility of the caller + * to assure that the types of + * the numbers stored in input + * and output vectors are + * compatible and with similar + * accuracy. + */ template void get_dof_values (const InputVector &values, - ForwardIterator local_values_begin, - ForwardIterator local_values_end) const; - - /** - * Return the values of the given vector - * restricted to the dofs of this - * cell in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * The vector has to have the - * right size before being passed - * to this function. This - * function is only callable for - * active cells. - * - * The input vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a PETSc or - * Trilinos vector if deal.II is - * compiled to support these - * libraries. It is in the - * responsibility of the caller to - * assure that the types of the numbers - * stored in input and output vectors - * are compatible and with similar - * accuracy. The ConstraintMatrix - * passed as an argument to this - * function makes sure that constraints - * are correctly distributed when the - * dof values are calculated. - */ + ForwardIterator local_values_begin, + ForwardIterator local_values_end) const; + + /** + * Return the values of the given vector + * restricted to the dofs of this + * cell in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. + * + * The vector has to have the + * right size before being passed + * to this function. This + * function is only callable for + * active cells. + * + * The input vector may be either a + * Vector, + * Vector, or a + * BlockVector, or a PETSc or + * Trilinos vector if deal.II is + * compiled to support these + * libraries. It is in the + * responsibility of the caller to + * assure that the types of the numbers + * stored in input and output vectors + * are compatible and with similar + * accuracy. The ConstraintMatrix + * passed as an argument to this + * function makes sure that constraints + * are correctly distributed when the + * dof values are calculated. + */ template void get_dof_values (const ConstraintMatrix &constraints, - const InputVector &values, - ForwardIterator local_values_begin, - ForwardIterator local_values_end) const; - - /** - * This function is the counterpart to - * get_dof_values(): it takes a vector - * of values for the degrees of freedom - * of the cell pointed to by this iterator - * and writes these values into the global - * data vector @p values. This function - * is only callable for active cells. - * - * Note that for continuous finite - * elements, calling this function affects - * the dof values on neighboring cells as - * well. It may also violate continuity - * requirements for hanging nodes, if - * neighboring cells are less refined than - * the present one. These requirements - * are not taken care of and must be - * enforced by the user afterwards. - * - * The vector has to have the - * right size before being passed - * to this function. - * - * The output vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support these libraries. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ + const InputVector &values, + ForwardIterator local_values_begin, + ForwardIterator local_values_end) const; + + /** + * This function is the counterpart to + * get_dof_values(): it takes a vector + * of values for the degrees of freedom + * of the cell pointed to by this iterator + * and writes these values into the global + * data vector @p values. This function + * is only callable for active cells. + * + * Note that for continuous finite + * elements, calling this function affects + * the dof values on neighboring cells as + * well. It may also violate continuity + * requirements for hanging nodes, if + * neighboring cells are less refined than + * the present one. These requirements + * are not taken care of and must be + * enforced by the user afterwards. + * + * The vector has to have the + * right size before being passed + * to this function. + * + * The output vector may be either a + * Vector, + * Vector, or a + * BlockVector, or a + * PETSc vector if deal.II is compiled to + * support these libraries. It is in the + * responsibility of the caller to assure + * that the types of the numbers stored + * in input and output vectors are + * compatible and with similar accuracy. + */ template void set_dof_values (const Vector &local_values, - OutputVector &values) const; - - /** - * Return the interpolation of - * the given finite element - * function to the present - * cell. In the simplest case, - * the cell is a terminal one, - * i.e. has no children; then, - * the returned value is the - * vector of nodal values on that - * cell. You could then as well - * get the desired values through - * the @p get_dof_values - * function. In the other case, - * when the cell has children, we - * use the restriction matrices - * provided by the finite element - * class to compute the - * interpolation from the - * children to the present cell. - * - * It is assumed that both - * vectors already have the right - * size beforehand. - * - * Unlike the get_dof_values() - * function, this function works - * on cells rather than to lines, - * quads, and hexes, since - * interpolation is presently - * only provided for cells by the - * finite element classes. - */ + OutputVector &values) const; + + /** + * Return the interpolation of + * the given finite element + * function to the present + * cell. In the simplest case, + * the cell is a terminal one, + * i.e. has no children; then, + * the returned value is the + * vector of nodal values on that + * cell. You could then as well + * get the desired values through + * the @p get_dof_values + * function. In the other case, + * when the cell has children, we + * use the restriction matrices + * provided by the finite element + * class to compute the + * interpolation from the + * children to the present cell. + * + * It is assumed that both + * vectors already have the right + * size beforehand. + * + * Unlike the get_dof_values() + * function, this function works + * on cells rather than to lines, + * quads, and hexes, since + * interpolation is presently + * only provided for cells by the + * finite element classes. + */ template void get_interpolated_dof_values (const InputVector &values, - Vector &interpolated_values) const; - - /** - * This, again, is the - * counterpart to - * get_interpolated_dof_values(): - * you specify the dof values on - * a cell and these are - * interpolated to the children - * of the present cell and set on - * the terminal cells. - * - * In principle, it works as - * follows: if the cell pointed - * to by this object is terminal, - * then the dof values are set in - * the global data vector by - * calling the set_dof_values() - * function; otherwise, the - * values are prolonged to each - * of the children and this - * function is called for each of - * them. - * - * Using the - * get_interpolated_dof_values() - * and this function, you can - * compute the interpolation of a - * finite element function to a - * coarser grid by first getting - * the interpolated solution on a - * cell of the coarse grid and - * afterwards redistributing it - * using this function. - * - * Note that for continuous - * finite elements, calling this - * function affects the dof - * values on neighboring cells as - * well. It may also violate - * continuity requirements for - * hanging nodes, if neighboring - * cells are less refined than - * the present one, or if their - * children are less refined than - * the children of this - * cell. These requirements are - * not taken care of and must be - * enforced by the user - * afterward. - * - * It is assumed that both - * vectors already have the right - * size beforehand. This function - * relies on the existence of a - * natural interpolation property - * of finite element spaces of a - * cell to its children, denoted - * by the prolongation matrices - * of finite element classes. For - * some elements, the spaces on - * coarse and fine grids are not - * nested, in which case the - * interpolation to a child is - * not the identity; refer to the - * documentation of the - * respective finite element - * class for a description of - * what the prolongation matrices - * represent in this case. - * - * Unlike the set_dof_values() - * function, this function is - * associated to cells rather - * than to lines, quads, and - * hexes, since interpolation is - * presently only provided for - * cells by the finite element - * objects. - * - * The output vector may be either a - * Vector, - * Vector, or a - * BlockVector, or a - * PETSc vector if deal.II is compiled to - * support these libraries. It is in the - * responsibility of the caller to assure - * that the types of the numbers stored - * in input and output vectors are - * compatible and with similar accuracy. - */ + Vector &interpolated_values) const; + + /** + * This, again, is the + * counterpart to + * get_interpolated_dof_values(): + * you specify the dof values on + * a cell and these are + * interpolated to the children + * of the present cell and set on + * the terminal cells. + * + * In principle, it works as + * follows: if the cell pointed + * to by this object is terminal, + * then the dof values are set in + * the global data vector by + * calling the set_dof_values() + * function; otherwise, the + * values are prolonged to each + * of the children and this + * function is called for each of + * them. + * + * Using the + * get_interpolated_dof_values() + * and this function, you can + * compute the interpolation of a + * finite element function to a + * coarser grid by first getting + * the interpolated solution on a + * cell of the coarse grid and + * afterwards redistributing it + * using this function. + * + * Note that for continuous + * finite elements, calling this + * function affects the dof + * values on neighboring cells as + * well. It may also violate + * continuity requirements for + * hanging nodes, if neighboring + * cells are less refined than + * the present one, or if their + * children are less refined than + * the children of this + * cell. These requirements are + * not taken care of and must be + * enforced by the user + * afterward. + * + * It is assumed that both + * vectors already have the right + * size beforehand. This function + * relies on the existence of a + * natural interpolation property + * of finite element spaces of a + * cell to its children, denoted + * by the prolongation matrices + * of finite element classes. For + * some elements, the spaces on + * coarse and fine grids are not + * nested, in which case the + * interpolation to a child is + * not the identity; refer to the + * documentation of the + * respective finite element + * class for a description of + * what the prolongation matrices + * represent in this case. + * + * Unlike the set_dof_values() + * function, this function is + * associated to cells rather + * than to lines, quads, and + * hexes, since interpolation is + * presently only provided for + * cells by the finite element + * objects. + * + * The output vector may be either a + * Vector, + * Vector, or a + * BlockVector, or a + * PETSc vector if deal.II is compiled to + * support these libraries. It is in the + * responsibility of the caller to assure + * that the types of the numbers stored + * in input and output vectors are + * compatible and with similar accuracy. + */ template void set_dof_values_by_interpolation (const Vector &local_values, - OutputVector &values) const; - - /** - * Distribute a local (cell - * based) vector to a global one - * by mapping the local numbering - * of the degrees of freedom to - * the global one and entering - * the local values into the - * global vector. - * - * The elements are - * added up to the - * elements in the global vector, - * rather than just set, since - * this is usually what one - * wants. - */ + OutputVector &values) const; + + /** + * Distribute a local (cell + * based) vector to a global one + * by mapping the local numbering + * of the degrees of freedom to + * the global one and entering + * the local values into the + * global vector. + * + * The elements are + * added up to the + * elements in the global vector, + * rather than just set, since + * this is usually what one + * wants. + */ template void distribute_local_to_global (const Vector &local_source, OutputVector &global_destination) const; - /** - * Distribute a local (cell based) - * vector in iterator format to a - * global one by mapping the local - * numbering of the degrees of freedom - * to the global one and entering the - * local values into the global vector. - * - * The elements are added up - * to the elements in the global - * vector, rather than just set, since - * this is usually what one wants. - */ + /** + * Distribute a local (cell based) + * vector in iterator format to a + * global one by mapping the local + * numbering of the degrees of freedom + * to the global one and entering the + * local values into the global vector. + * + * The elements are added up + * to the elements in the global + * vector, rather than just set, since + * this is usually what one wants. + */ template void distribute_local_to_global (ForwardIterator local_source_begin, - ForwardIterator local_source_end, - OutputVector &global_destination) const; - - /** - * Distribute a local (cell based) - * vector in iterator format to a - * global one by mapping the local - * numbering of the degrees of freedom - * to the global one and entering the - * local values into the global vector. - * - * The elements are added up - * to the elements in the global - * vector, rather than just set, since - * this is usually what one - * wants. Moreover, the - * ConstraintMatrix passed to this - * function makes sure that also - * constraints are eliminated in this - * process. - */ + ForwardIterator local_source_end, + OutputVector &global_destination) const; + + /** + * Distribute a local (cell based) + * vector in iterator format to a + * global one by mapping the local + * numbering of the degrees of freedom + * to the global one and entering the + * local values into the global vector. + * + * The elements are added up + * to the elements in the global + * vector, rather than just set, since + * this is usually what one + * wants. Moreover, the + * ConstraintMatrix passed to this + * function makes sure that also + * constraints are eliminated in this + * process. + */ template void distribute_local_to_global (const ConstraintMatrix &constraints, ForwardIterator local_source_begin, - ForwardIterator local_source_end, - OutputVector &global_destination) const; - - /** - * This function does much the - * same as the - * distribute_local_to_global(Vector,Vector) - * function, but operates on - * matrices instead of - * vectors. If the matrix type is - * a sparse matrix then it is - * supposed to have non-zero - * entry slots where required. - */ + ForwardIterator local_source_end, + OutputVector &global_destination) const; + + /** + * This function does much the + * same as the + * distribute_local_to_global(Vector,Vector) + * function, but operates on + * matrices instead of + * vectors. If the matrix type is + * a sparse matrix then it is + * supposed to have non-zero + * entry slots where required. + */ template void distribute_local_to_global (const FullMatrix &local_source, OutputMatrix &global_destination) const; - /** - * This function does what the two - * distribute_local_to_global - * functions with vector and matrix - * argument do, but all at once. - */ + /** + * This function does what the two + * distribute_local_to_global + * functions with vector and matrix + * argument do, but all at once. + */ template void distribute_local_to_global (const FullMatrix &local_matrix, - const Vector &local_vector, + const Vector &local_vector, OutputMatrix &global_matrix, - OutputVector &global_vector) const; - - /** - * @} - */ - - /** - * @name Accessing the DoF indices of this object - */ - /** - * @{ - */ - - /** - * Return the indices of the dofs of this - * quad in the standard ordering: dofs - * on vertex 0, dofs on vertex 1, etc, - * dofs on line 0, dofs on line 1, etc, - * dofs on quad 0, etc. - * - * It is assumed that the vector already - * has the right size beforehand. - * - * This function reimplements the - * same function in the base - * class. The functions in the - * base classes are available for - * all geometric objects, - * i.e. even in 3d they can be - * used to access the dof indices - * of edges, for example. On the - * other hand, the most common - * case is clearly the use on - * cells, which is why we cache - * the array for each cell, but - * not edge. To retrieve the - * cached values, rather than - * collect the necessary - * information every time, this - * function overwrites the one in - * the base class. - * - * This function is most often - * used on active objects (edges, - * faces, cells). It can be used - * on non-active objects as well - * (i.e. objects that have - * children), but only if the - * finite element under - * consideration has degrees of - * freedom exclusively on - * vertices. Otherwise, the - * function doesn't make much - * sense, since for example - * inactive edges do not have - * degrees of freedom associated - * with them at all. - */ + OutputVector &global_vector) const; + + /** + * @} + */ + + /** + * @name Accessing the DoF indices of this object + */ + /** + * @{ + */ + + /** + * Return the indices of the dofs of this + * quad in the standard ordering: dofs + * on vertex 0, dofs on vertex 1, etc, + * dofs on line 0, dofs on line 1, etc, + * dofs on quad 0, etc. + * + * It is assumed that the vector already + * has the right size beforehand. + * + * This function reimplements the + * same function in the base + * class. The functions in the + * base classes are available for + * all geometric objects, + * i.e. even in 3d they can be + * used to access the dof indices + * of edges, for example. On the + * other hand, the most common + * case is clearly the use on + * cells, which is why we cache + * the array for each cell, but + * not edge. To retrieve the + * cached values, rather than + * collect the necessary + * information every time, this + * function overwrites the one in + * the base class. + * + * This function is most often + * used on active objects (edges, + * faces, cells). It can be used + * on non-active objects as well + * (i.e. objects that have + * children), but only if the + * finite element under + * consideration has degrees of + * freedom exclusively on + * vertices. Otherwise, the + * function doesn't make much + * sense, since for example + * inactive edges do not have + * degrees of freedom associated + * with them at all. + */ void get_dof_indices (std::vector &dof_indices) const; - /** - * @} - */ + /** + * @} + */ - /** - * @name Accessing the finite element associated with this object - */ - /** - * @{ - */ + /** + * @name Accessing the finite element associated with this object + */ + /** + * @{ + */ /** * Return the finite element that @@ -2009,64 +2009,64 @@ class DoFCellAccessor : public DoFAccessor get_fe () const; /** - * Returns the index inside the - * hp::FECollection of the FiniteElement - * used for this cell. - */ + * Returns the index inside the + * hp::FECollection of the FiniteElement + * used for this cell. + */ unsigned int active_fe_index () const; /** - * Sets the index of the FiniteElement used for - * this cell. - */ + * Sets the index of the FiniteElement used for + * this cell. + */ void set_active_fe_index (const unsigned int i); - /** - * @} - */ - - /** - * Set the DoF indices of this - * cell to the given values. This - * function bypasses the DoF - * cache, if one exists for the - * given DoF handler class. - */ + /** + * @} + */ + + /** + * Set the DoF indices of this + * cell to the given values. This + * function bypasses the DoF + * cache, if one exists for the + * given DoF handler class. + */ void set_dof_indices (const std::vector &dof_indices); - /** - * Update the cache in which we - * store the dof indices of this - * cell. - */ + /** + * Update the cache in which we + * store the dof indices of this + * cell. + */ void update_cell_dof_indices_cache () const; private: - /** - * Copy operator. This is normally used - * in a context like iterator a,b; - * *a=*b;. Presumably, the intent - * here is to copy the object pointed to - * by @p b to the object pointed to by - * @p a. However, the result of - * dereferencing an iterator is not an - * object but an accessor; consequently, - * this operation is not useful for - * iterators on triangulations. We - * declare this function here private, - * thus it may not be used from outside. - * Furthermore it is not implemented and - * will give a linker error if used - * anyway. - */ + /** + * Copy operator. This is normally used + * in a context like iterator a,b; + * *a=*b;. Presumably, the intent + * here is to copy the object pointed to + * by @p b to the object pointed to by + * @p a. However, the result of + * dereferencing an iterator is not an + * object but an accessor; consequently, + * this operation is not useful for + * iterators on triangulations. We + * declare this function here private, + * thus it may not be used from outside. + * Furthermore it is not implemented and + * will give a linker error if used + * anyway. + */ DoFCellAccessor & operator = (const DoFCellAccessor &da); - /** - * Make the DoFHandler class a - * friend so that it can call the - * update_cell_dof_indices_cache() - * function - */ + /** + * Make the DoFHandler class a + * friend so that it can call the + * update_cell_dof_indices_cache() + * function + */ template friend class DoFHandler; friend struct internal::DoFCellAccessor::Implementation; }; diff --git a/deal.II/include/deal.II/dofs/dof_accessor.templates.h b/deal.II/include/deal.II/dofs/dof_accessor.templates.h index 96ea4ce717..9c4435ad90 100644 --- a/deal.II/include/deal.II/dofs/dof_accessor.templates.h +++ b/deal.II/include/deal.II/dofs/dof_accessor.templates.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -47,11 +47,11 @@ DoFAccessor::DoFAccessor ( const int level, const int index, const DH *dof_handler) - : - internal::DoFAccessor::Inheritance::BaseClass (tria, - level, - index), + level, + index), dof_handler(const_cast(dof_handler)) {} @@ -157,17 +157,17 @@ DoFAccessor::child (const unsigned int i) const next_level = 0; TriaIterator > q (this->tria, - next_level, - this->child_index (i), - this->dof_handler); + next_level, + this->child_index (i), + this->dof_handler); - // make sure that we either created - // a past-the-end iterator or one - // pointing to a used cell + // make sure that we either created + // a past-the-end iterator or one + // pointing to a used cell Assert ((q.state() == IteratorState::past_the_end) - || - q->used(), - TriaAccessorExceptions::ExcUnusedCellAsChild()); + || + q->used(), + TriaAccessorExceptions::ExcUnusedCellAsChild()); return q; } @@ -192,9 +192,9 @@ DoFAccessor::parent () const previous_level = 0; TriaIterator > q (this->tria, - previous_level, - this->parent_index (), - this->dof_handler); + previous_level, + this->parent_index (), + this->dof_handler); return q; } @@ -205,1226 +205,1226 @@ namespace internal { namespace DoFAccessor { - /** - * A class like the one with same - * name in tria.cc. See there for - * more information. - */ + /** + * A class like the one with same + * name in tria.cc. See there for + * more information. + */ struct Implementation { - /** - * Implementations of the - * get_dof_index/set_dof_index functions. - */ - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<1>) - { - return dof_handler.levels[obj_level]->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<1>, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<1>) - { - // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<1>, - const unsigned int global_index) - { - // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<2>) - { - return dof_handler.levels[obj_level]->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<2>, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<1>) - { - // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<1>, - const unsigned int global_index) - { - // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<2>) - { - // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - return dof_handler.faces->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<2>, - const unsigned int global_index) - { - // faces have no levels - Assert (obj_level == 0, ExcInternalError()); - dof_handler.faces->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - - template - static - unsigned int - get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<3>) - { - return dof_handler.levels[obj_level]->hexes. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index); - } - - - template - static - void - set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - internal::int2type<3>, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->hexes. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<1> &, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<1> &) - { - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<1> &, - const unsigned int global_index) - { - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<2> &, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<1> &) - { - return dof_handler.faces->lines. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<1> &, - const unsigned int global_index) - { - dof_handler.faces->lines. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<2> &) - { - return dof_handler.faces->quads. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<2> &, - const unsigned int global_index) - { - dof_handler.faces->quads. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - unsigned int - get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes. - get_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - obj_level); - } - - - template - static - void - set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const internal::int2type<3> &, - const unsigned int global_index) - { - dof_handler.levels[obj_level]->hexes. - set_dof_index (dof_handler, - obj_index, - fe_index, - local_index, - global_index, - obj_level); - } - - - template - static - bool - fe_index_is_active (const dealii::DoFHandler &, - const unsigned int, - const unsigned int, - const unsigned int fe_index, - const internal::int2type &) - { - return (fe_index == 0); - } - - - - template - static - unsigned int - n_active_fe_indices (const dealii::DoFHandler &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const internal::int2type &) - { - // check that the object we look - // at is in fact active. the - // problem is that we have - // templatized on the - // dimensionality of the object, - // so it may be a cell, a face, - // or a line. we have a bit of - // trouble doing this all in the - // generic case, so only check if - // it is either a cell or a - // line. the only case this - // leaves out is faces in 3d -- - // let's hope that this never is - // a problem - Assert ((dim==structdim - ? - typename - dealii::DoFHandler:: - raw_cell_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - (structdim==1 - ? - typename - dealii::DoFHandler:: - raw_line_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - true)) - == true, - ExcMessage ("This cell is not active and therefore can't be " - "queried for its active FE indices")); - return 1; - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::DoFHandler &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const internal::int2type &) - { - // check that the object we look - // at is in fact active. the - // problem is that we have - // templatized on the - // dimensionality of the object, - // so it may be a cell, a face, - // or a line. we have a bit of - // trouble doing this all in the - // generic case, so only check if - // it is either a cell or a - // line. the only case this - // leaves out is faces in 3d -- - // let's hope that this never is - // a problem - Assert ((dim==structdim - ? - typename - dealii::DoFHandler:: - raw_cell_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - (structdim==1 - ? - typename - dealii::DoFHandler:: - raw_line_iterator (&dof_handler.get_tria(), - obj_level, - obj_index, - &dof_handler)->used() - : - true)) - == true, - ExcMessage ("This cell is not active and therefore can't be " - "queried for its active FE indices")); - Assert (n == 0, ExcIndexRange (n, 0, 1)); - - return dealii::DoFHandler::default_fe_index; - } - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const internal::int2type<1> &) - { - return dof_handler.levels[obj_level]->lines.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const internal::int2type<1> &) - { - return dof_handler.faces->lines.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int , - const unsigned int obj_index, - const internal::int2type<1> &) - { - return dof_handler.faces->lines.n_active_fe_indices (dof_handler, - obj_index); - } - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const internal::int2type<1> &) - { - return dof_handler.faces->lines.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const internal::int2type<2> &) - { - return dof_handler.levels[obj_level]->quads.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const internal::int2type<1> &) - { - return dof_handler.faces->lines.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int, - const unsigned int obj_index, - const internal::int2type<1> &) - { - return dof_handler.faces->lines.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const internal::int2type<1> &) - { - return dof_handler.faces->lines.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const internal::int2type<2> &) - { - return dof_handler.faces->quads.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - template - static - bool - fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int fe_index, - const internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes.fe_index_is_active(dof_handler, - obj_index, - fe_index, - obj_level); - } - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int , - const unsigned int obj_index, - const internal::int2type<2> &) - { - return dof_handler.faces->quads.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const internal::int2type<2> &) - { - return dof_handler.faces->quads.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - - - template - static - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes.n_active_fe_indices (dof_handler, - obj_index); - } - - - - template - static - unsigned int - nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n, - const internal::int2type<3> &) - { - return dof_handler.levels[obj_level]->hexes.nth_active_fe_index (dof_handler, - obj_level, - obj_index, - n); - } - - /** - * Set the @p local_index-th - * degree of freedom - * corresponding to the finite - * element specified by @p - * fe_index on the vertex with - * global number @p - * vertex_index to @p - * global_index. - */ - template - static - void - set_vertex_dof_index (dealii::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) - { - Assert ((fe_index == dealii::DoFHandler::default_fe_index), - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (dof_handler.selected_fe != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, - ExcIndexRange(local_index, 0, - dof_handler.selected_fe->dofs_per_vertex)); - - dof_handler.vertex_dofs[vertex_index * - dof_handler.selected_fe->dofs_per_vertex - + local_index] - = global_index; - } - - - template - static - void - set_vertex_dof_index (dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int global_index) - { - Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, - ExcIndexRange(local_index, 0, - (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); - Assert (fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcMessage ("This vertex is unused and has no DoFs associated with it")); - - // hop along the list of index - // sets until we find the one - // with the correct fe_index, and - // then poke into that - // part. trigger an exception if - // we can't find a set for this - // particular fe_index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - - const unsigned int this_fe_index = *pointer; - - Assert (this_fe_index != numbers::invalid_unsigned_int, - ExcInternalError()); - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - - if (this_fe_index == fe_index) - { - *(pointer + 1 + local_index) = global_index; - return; - } - else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - } - } - - - /** - * Get the @p local_index-th - * degree of freedom - * corresponding to the finite - * element specified by @p - * fe_index on the vertex with - * global number @p - * vertex_index to @p - * global_index. - */ - - template - static - unsigned int - get_vertex_dof_index (const dealii::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index) - { - Assert ((fe_index == dealii::DoFHandler::default_fe_index), - ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); - Assert (dof_handler.selected_fe != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, - ExcIndexRange(local_index, 0, - dof_handler.selected_fe->dofs_per_vertex)); - - return - dof_handler.vertex_dofs[vertex_index * - dof_handler.selected_fe->dofs_per_vertex - + local_index]; - } - - - template - static - unsigned int - get_vertex_dof_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index, - const unsigned int local_index) - { - Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, - ExcIndexRange(local_index, 0, - (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); - Assert (vertex_index < dof_handler.vertex_dofs_offsets.size(), - ExcIndexRange (vertex_index, 0, - dof_handler.vertex_dofs_offsets.size())); - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcMessage ("This vertex is unused and has no DoFs associated with it")); - - // hop along the list of index - // sets until we find the one - // with the correct fe_index, and - // then poke into that - // part. trigger an exception if - // we can't find a set for this - // particular fe_index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - - const unsigned int this_fe_index = *pointer; - - Assert (this_fe_index != numbers::invalid_unsigned_int, - ExcInternalError()); - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - - if (this_fe_index == fe_index) - return *(pointer + 1 + local_index); - else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - } - } - - - /** - * Return the number of - * different finite elements - * that are active on a given - * vertex. - */ - template - static - unsigned int - n_active_vertex_fe_indices (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index) - { - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - - // if this vertex is unused, return 0 - if (dof_handler.vertex_dofs_offsets[vertex_index] == numbers::invalid_unsigned_int) - return 0; - - // hop along the list of index - // sets and count the number of - // hops - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - - Assert (*pointer != numbers::invalid_unsigned_int, - ExcInternalError()); - - unsigned int counter = 0; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - - const unsigned int this_fe_index = *pointer; - - if (this_fe_index == numbers::invalid_unsigned_int) - return counter; - else - { - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - ++counter; - } - } - } - - - - /** - * Return the fe index of the - * n-th finite element active - * on a given vertex. - */ - template - static - unsigned int - nth_active_vertex_fe_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int n) - { - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (n < n_active_vertex_fe_indices(dof_handler, vertex_index), - ExcIndexRange (n, 0, n_active_vertex_fe_indices(dof_handler, - vertex_index))); - // make sure we don't ask on - // unused vertices - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcInternalError()); - - // hop along the list of index - // sets and count the number of - // hops - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - - Assert (*pointer != numbers::invalid_unsigned_int, - ExcInternalError()); - - unsigned int counter = 0; - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - - const unsigned int this_fe_index = *pointer; - - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - - if (counter == n) - return this_fe_index; - - Assert (this_fe_index != numbers::invalid_unsigned_int, - ExcInternalError()); - - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - ++counter; - } - } - - - - /** - * Return whether a particular - * finite element index is - * active on the specified - * vertex. - */ - template - static - bool - fe_is_active_on_vertex (const dealii::hp::DoFHandler &dof_handler, - const unsigned int vertex_index, - const unsigned int fe_index) - { - Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (dof_handler.finite_elements != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - - // make sure we don't ask on - // unused vertices - Assert (dof_handler.vertex_dofs_offsets[vertex_index] != - numbers::invalid_unsigned_int, - ExcInternalError()); - - // hop along the list of index - // sets and see whether we find - // the given index - const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; - const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; - - Assert (*pointer != numbers::invalid_unsigned_int, - ExcInternalError()); - - while (true) - { - Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); - - const unsigned int this_fe_index = *pointer; - - Assert (this_fe_index < dof_handler.finite_elements->size(), - ExcInternalError()); - - if (this_fe_index == numbers::invalid_unsigned_int) - return false; - else - if (this_fe_index == fe_index) - return true; - else - pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; - } - } + /** + * Implementations of the + * get_dof_index/set_dof_index functions. + */ + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<1>) + { + return dof_handler.levels[obj_level]->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<1>, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<1>) + { + // faces have no levels + Assert (obj_level == 0, ExcInternalError()); + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<1>, + const unsigned int global_index) + { + // faces have no levels + Assert (obj_level == 0, ExcInternalError()); + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<2>) + { + return dof_handler.levels[obj_level]->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<2>, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<1>) + { + // faces have no levels + Assert (obj_level == 0, ExcInternalError()); + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<1>, + const unsigned int global_index) + { + // faces have no levels + Assert (obj_level == 0, ExcInternalError()); + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<2>) + { + // faces have no levels + Assert (obj_level == 0, ExcInternalError()); + return dof_handler.faces->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<2>, + const unsigned int global_index) + { + // faces have no levels + Assert (obj_level == 0, ExcInternalError()); + dof_handler.faces->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + + template + static + unsigned int + get_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<3>) + { + return dof_handler.levels[obj_level]->hexes. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index); + } + + + template + static + void + set_dof_index (const dealii::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + internal::int2type<3>, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->hexes. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<1> &, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<1> &, + const unsigned int global_index) + { + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<2> &, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<1> &, + const unsigned int global_index) + { + dof_handler.faces->lines. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<2> &) + { + return dof_handler.faces->quads. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<2> &, + const unsigned int global_index) + { + dof_handler.faces->quads. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + unsigned int + get_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes. + get_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + obj_level); + } + + + template + static + void + set_dof_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const internal::int2type<3> &, + const unsigned int global_index) + { + dof_handler.levels[obj_level]->hexes. + set_dof_index (dof_handler, + obj_index, + fe_index, + local_index, + global_index, + obj_level); + } + + + template + static + bool + fe_index_is_active (const dealii::DoFHandler &, + const unsigned int, + const unsigned int, + const unsigned int fe_index, + const internal::int2type &) + { + return (fe_index == 0); + } + + + + template + static + unsigned int + n_active_fe_indices (const dealii::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type &) + { + // check that the object we look + // at is in fact active. the + // problem is that we have + // templatized on the + // dimensionality of the object, + // so it may be a cell, a face, + // or a line. we have a bit of + // trouble doing this all in the + // generic case, so only check if + // it is either a cell or a + // line. the only case this + // leaves out is faces in 3d -- + // let's hope that this never is + // a problem + Assert ((dim==structdim + ? + typename + dealii::DoFHandler:: + raw_cell_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + (structdim==1 + ? + typename + dealii::DoFHandler:: + raw_line_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + true)) + == true, + ExcMessage ("This cell is not active and therefore can't be " + "queried for its active FE indices")); + return 1; + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type &) + { + // check that the object we look + // at is in fact active. the + // problem is that we have + // templatized on the + // dimensionality of the object, + // so it may be a cell, a face, + // or a line. we have a bit of + // trouble doing this all in the + // generic case, so only check if + // it is either a cell or a + // line. the only case this + // leaves out is faces in 3d -- + // let's hope that this never is + // a problem + Assert ((dim==structdim + ? + typename + dealii::DoFHandler:: + raw_cell_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + (structdim==1 + ? + typename + dealii::DoFHandler:: + raw_line_iterator (&dof_handler.get_tria(), + obj_level, + obj_index, + &dof_handler)->used() + : + true)) + == true, + ExcMessage ("This cell is not active and therefore can't be " + "queried for its active FE indices")); + Assert (n == 0, ExcIndexRange (n, 0, 1)); + + return dealii::DoFHandler::default_fe_index; + } + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<1,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<1> &) + { + return dof_handler.levels[obj_level]->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int , + const unsigned int obj_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<2,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<2> &) + { + return dof_handler.levels[obj_level]->quads.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int, + const unsigned int obj_index, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<1> &) + { + return dof_handler.faces->lines.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<2> &) + { + return dof_handler.faces->quads.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + template + static + bool + fe_index_is_active (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int fe_index, + const internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.fe_index_is_active(dof_handler, + obj_index, + fe_index, + obj_level); + } + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int , + const unsigned int obj_index, + const internal::int2type<2> &) + { + return dof_handler.faces->quads.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<2> &) + { + return dof_handler.faces->quads.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + + + template + static + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.n_active_fe_indices (dof_handler, + obj_index); + } + + + + template + static + unsigned int + nth_active_fe_index (const dealii::hp::DoFHandler<3,spacedim> &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n, + const internal::int2type<3> &) + { + return dof_handler.levels[obj_level]->hexes.nth_active_fe_index (dof_handler, + obj_level, + obj_index, + n); + } + + /** + * Set the @p local_index-th + * degree of freedom + * corresponding to the finite + * element specified by @p + * fe_index on the vertex with + * global number @p + * vertex_index to @p + * global_index. + */ + template + static + void + set_vertex_dof_index (dealii::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index) + { + Assert ((fe_index == dealii::DoFHandler::default_fe_index), + ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); + Assert (dof_handler.selected_fe != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, + ExcIndexRange(local_index, 0, + dof_handler.selected_fe->dofs_per_vertex)); + + dof_handler.vertex_dofs[vertex_index * + dof_handler.selected_fe->dofs_per_vertex + + local_index] + = global_index; + } + + + template + static + void + set_vertex_dof_index (dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int global_index) + { + Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, + ExcIndexRange(local_index, 0, + (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); + Assert (fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcMessage ("This vertex is unused and has no DoFs associated with it")); + + // hop along the list of index + // sets until we find the one + // with the correct fe_index, and + // then poke into that + // part. trigger an exception if + // we can't find a set for this + // particular fe_index + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + + const unsigned int this_fe_index = *pointer; + + Assert (this_fe_index != numbers::invalid_unsigned_int, + ExcInternalError()); + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + + if (this_fe_index == fe_index) + { + *(pointer + 1 + local_index) = global_index; + return; + } + else + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + } + } + + + /** + * Get the @p local_index-th + * degree of freedom + * corresponding to the finite + * element specified by @p + * fe_index on the vertex with + * global number @p + * vertex_index to @p + * global_index. + */ + + template + static + unsigned int + get_vertex_dof_index (const dealii::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) + { + Assert ((fe_index == dealii::DoFHandler::default_fe_index), + ExcMessage ("Only the default FE index is allowed for non-hp DoFHandler objects")); + Assert (dof_handler.selected_fe != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < dof_handler.selected_fe->dofs_per_vertex, + ExcIndexRange(local_index, 0, + dof_handler.selected_fe->dofs_per_vertex)); + + return + dof_handler.vertex_dofs[vertex_index * + dof_handler.selected_fe->dofs_per_vertex + + local_index]; + } + + + template + static + unsigned int + get_vertex_dof_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index, + const unsigned int local_index) + { + Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (local_index < (*dof_handler.finite_elements)[fe_index].dofs_per_vertex, + ExcIndexRange(local_index, 0, + (*dof_handler.finite_elements)[fe_index].dofs_per_vertex)); + Assert (vertex_index < dof_handler.vertex_dofs_offsets.size(), + ExcIndexRange (vertex_index, 0, + dof_handler.vertex_dofs_offsets.size())); + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcMessage ("This vertex is unused and has no DoFs associated with it")); + + // hop along the list of index + // sets until we find the one + // with the correct fe_index, and + // then poke into that + // part. trigger an exception if + // we can't find a set for this + // particular fe_index + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + + const unsigned int this_fe_index = *pointer; + + Assert (this_fe_index != numbers::invalid_unsigned_int, + ExcInternalError()); + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + + if (this_fe_index == fe_index) + return *(pointer + 1 + local_index); + else + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + } + } + + + /** + * Return the number of + * different finite elements + * that are active on a given + * vertex. + */ + template + static + unsigned int + n_active_vertex_fe_indices (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index) + { + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + + // if this vertex is unused, return 0 + if (dof_handler.vertex_dofs_offsets[vertex_index] == numbers::invalid_unsigned_int) + return 0; + + // hop along the list of index + // sets and count the number of + // hops + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + + Assert (*pointer != numbers::invalid_unsigned_int, + ExcInternalError()); + + unsigned int counter = 0; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + + const unsigned int this_fe_index = *pointer; + + if (this_fe_index == numbers::invalid_unsigned_int) + return counter; + else + { + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + ++counter; + } + } + } + + + + /** + * Return the fe index of the + * n-th finite element active + * on a given vertex. + */ + template + static + unsigned int + nth_active_vertex_fe_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int n) + { + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (n < n_active_vertex_fe_indices(dof_handler, vertex_index), + ExcIndexRange (n, 0, n_active_vertex_fe_indices(dof_handler, + vertex_index))); + // make sure we don't ask on + // unused vertices + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcInternalError()); + + // hop along the list of index + // sets and count the number of + // hops + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + + Assert (*pointer != numbers::invalid_unsigned_int, + ExcInternalError()); + + unsigned int counter = 0; + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + + const unsigned int this_fe_index = *pointer; + + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + + if (counter == n) + return this_fe_index; + + Assert (this_fe_index != numbers::invalid_unsigned_int, + ExcInternalError()); + + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + ++counter; + } + } + + + + /** + * Return whether a particular + * finite element index is + * active on the specified + * vertex. + */ + template + static + bool + fe_is_active_on_vertex (const dealii::hp::DoFHandler &dof_handler, + const unsigned int vertex_index, + const unsigned int fe_index) + { + Assert ( (fe_index != dealii::hp::DoFHandler::default_fe_index), + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (dof_handler.finite_elements != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + + // make sure we don't ask on + // unused vertices + Assert (dof_handler.vertex_dofs_offsets[vertex_index] != + numbers::invalid_unsigned_int, + ExcInternalError()); + + // hop along the list of index + // sets and see whether we find + // the given index + const unsigned int starting_offset = dof_handler.vertex_dofs_offsets[vertex_index]; + const unsigned int *pointer = &dof_handler.vertex_dofs[starting_offset]; + + Assert (*pointer != numbers::invalid_unsigned_int, + ExcInternalError()); + + while (true) + { + Assert (pointer <= &dof_handler.vertex_dofs.back(), ExcInternalError()); + + const unsigned int this_fe_index = *pointer; + + Assert (this_fe_index < dof_handler.finite_elements->size(), + ExcInternalError()); + + if (this_fe_index == numbers::invalid_unsigned_int) + return false; + else + if (this_fe_index == fe_index) + return true; + else + pointer += (*dof_handler.finite_elements)[this_fe_index].dofs_per_vertex + 1; + } + } }; } @@ -1436,15 +1436,15 @@ template inline unsigned int DoFAccessor::dof_index (const unsigned int i, - const unsigned int fe_index) const + const unsigned int fe_index) const { - // access the respective DoF + // access the respective DoF return internal::DoFAccessor::Implementation::get_dof_index (*this->dof_handler, - this->level(), - this->present_index, - fe_index, - i, - internal::int2type()); + this->level(), + this->present_index, + fe_index, + i, + internal::int2type()); } @@ -1453,17 +1453,17 @@ template inline void DoFAccessor::set_dof_index (const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const + const unsigned int index, + const unsigned int fe_index) const { - // access the respective DoF + // access the respective DoF internal::DoFAccessor::Implementation::set_dof_index (*this->dof_handler, - this->level(), - this->present_index, - fe_index, - i, - internal::int2type(), - index); + this->level(), + this->present_index, + fe_index, + i, + internal::int2type(), + index); } @@ -1473,13 +1473,13 @@ inline unsigned int DoFAccessor::n_active_fe_indices () const { - // access the respective DoF + // access the respective DoF return internal::DoFAccessor::Implementation:: n_active_fe_indices (*this->dof_handler, - this->level(), - this->present_index, - internal::int2type()); + this->level(), + this->present_index, + internal::int2type()); } @@ -1489,14 +1489,14 @@ inline unsigned int DoFAccessor::nth_active_fe_index (const unsigned int n) const { - // access the respective DoF + // access the respective DoF return internal::DoFAccessor::Implementation:: nth_active_fe_index (*this->dof_handler, - this->level(), - this->present_index, - n, - internal::int2type()); + this->level(), + this->present_index, + n, + internal::int2type()); } @@ -1506,14 +1506,14 @@ inline bool DoFAccessor::fe_index_is_active (const unsigned int fe_index) const { - // access the respective DoF + // access the respective DoF return internal::DoFAccessor::Implementation:: fe_index_is_active (*this->dof_handler, - this->level(), - this->present_index, - fe_index, - internal::int2type()); + this->level(), + this->present_index, + fe_index, + internal::int2type()); } @@ -1522,8 +1522,8 @@ template inline unsigned int DoFAccessor::vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int fe_index) const + const unsigned int i, + const unsigned int fe_index) const { return internal::DoFAccessor::Implementation::get_vertex_dof_index @@ -1539,9 +1539,9 @@ template inline void DoFAccessor::set_vertex_dof_index (const unsigned int vertex, - const unsigned int i, - const unsigned int index, - const unsigned int fe_index) const + const unsigned int i, + const unsigned int index, + const unsigned int fe_index) const { internal::DoFAccessor::Implementation::set_vertex_dof_index (*this->dof_handler, @@ -1564,7 +1564,7 @@ namespace internal inline const FiniteElement & get_fe (const FiniteElement &fe, - const unsigned int) + const unsigned int) { return fe; } @@ -1575,7 +1575,7 @@ namespace internal inline const FiniteElement & get_fe (const dealii::hp::FECollection &fe, - const unsigned int index) + const unsigned int index) { return fe[index]; } @@ -1589,7 +1589,7 @@ const FiniteElement & DoFAccessor::get_fe (const unsigned int fe_index) const { Assert (fe_index_is_active (fe_index) == true, - ExcMessage ("This function can only be called for active fe indices")); + ExcMessage ("This function can only be called for active fe indices")); return internal::DoFAccessor::get_fe (this->dof_handler->get_fe(), fe_index); } @@ -1602,108 +1602,108 @@ namespace internal { template void get_dof_indices (const dealii::DoFAccessor<1,DH> &accessor, - std::vector &dof_indices, - const unsigned int fe_index) + std::vector &dof_indices, + const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, - dofs_per_line = accessor.get_fe(fe_index).dofs_per_line; + dofs_per_line = accessor.get_fe(fe_index).dofs_per_line; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<2; ++vertex) - for (unsigned int d=0; d void get_dof_indices (const dealii::DoFAccessor<2,DH> &accessor, - std::vector &dof_indices, - const unsigned int fe_index) + std::vector &dof_indices, + const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, - dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, - dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad; + dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, + dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<4; ++vertex) - for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). - adjust_line_dof_index_for_line_orientation(d, - accessor.line_orientation(line)), - fe_index); + for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). + adjust_line_dof_index_for_line_orientation(d, + accessor.line_orientation(line)), + fe_index); for (unsigned int d=0; d void get_dof_indices (const dealii::DoFAccessor<3,DH> &accessor, - std::vector &dof_indices, - const unsigned int fe_index) + std::vector &dof_indices, + const unsigned int fe_index) { const unsigned int dofs_per_vertex = accessor.get_fe(fe_index).dofs_per_vertex, - dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, - dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad, - dofs_per_hex = accessor.get_fe(fe_index).dofs_per_hex; + dofs_per_line = accessor.get_fe(fe_index).dofs_per_line, + dofs_per_quad = accessor.get_fe(fe_index).dofs_per_quad, + dofs_per_hex = accessor.get_fe(fe_index).dofs_per_hex; std::vector::iterator next = dof_indices.begin(); for (unsigned int vertex=0; vertex<8; ++vertex) - for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). - adjust_line_dof_index_for_line_orientation(d, - accessor.line_orientation(line)),fe_index); - // now copy dof numbers from the face. for - // faces with the wrong orientation, we - // have already made sure that we're ok by - // picking the correct lines and vertices - // (this happens automatically in the - // line() and vertex() functions). however, - // if the face is in wrong orientation, we - // look at it in flipped orientation and we - // will have to adjust the shape function - // indices that we see to correspond to the - // correct (cell-local) ordering. The same - // applies, if the face_rotation or - // face_orientation is non-standard + for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). + adjust_line_dof_index_for_line_orientation(d, + accessor.line_orientation(line)),fe_index); + // now copy dof numbers from the face. for + // faces with the wrong orientation, we + // have already made sure that we're ok by + // picking the correct lines and vertices + // (this happens automatically in the + // line() and vertex() functions). however, + // if the face is in wrong orientation, we + // look at it in flipped orientation and we + // will have to adjust the shape function + // indices that we see to correspond to the + // correct (cell-local) ordering. The same + // applies, if the face_rotation or + // face_orientation is non-standard for (unsigned int quad=0; quad<6; ++quad) - for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). - adjust_quad_dof_index_for_face_orientation(d, - accessor.face_orientation(quad), - accessor.face_flip(quad), - accessor.face_rotation(quad)), - fe_index); + for (unsigned int d=0; ddof_index(accessor.get_fe(fe_index). + adjust_quad_dof_index_for_face_orientation(d, + accessor.face_orientation(quad), + accessor.face_flip(quad), + accessor.face_rotation(quad)), + fe_index); for (unsigned int d=0; d inline void DoFAccessor::get_dof_indices (std::vector &dof_indices, - const unsigned int fe_index) const + const unsigned int fe_index) const { Assert (static_cast(this->level()) < this->dof_handler->levels.size(), ExcMessage ("DoFHandler not initialized")); @@ -1726,50 +1726,50 @@ DoFAccessor::get_dof_indices (std::vector &dof_indic switch (structdim) { case 1: - Assert (dof_indices.size() == - (2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + - this->dof_handler->get_fe()[fe_index].dofs_per_line), - ExcVectorDoesNotMatch()); - break; + Assert (dof_indices.size() == + (2*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + this->dof_handler->get_fe()[fe_index].dofs_per_line), + ExcVectorDoesNotMatch()); + break; case 2: - Assert (dof_indices.size() == - (4*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + - 4*this->dof_handler->get_fe()[fe_index].dofs_per_line + - this->dof_handler->get_fe()[fe_index].dofs_per_quad), - ExcVectorDoesNotMatch()); - break; + Assert (dof_indices.size() == + (4*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + 4*this->dof_handler->get_fe()[fe_index].dofs_per_line + + this->dof_handler->get_fe()[fe_index].dofs_per_quad), + ExcVectorDoesNotMatch()); + break; case 3: - Assert (dof_indices.size() == - (8*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + - 12*this->dof_handler->get_fe()[fe_index].dofs_per_line + - 6*this->dof_handler->get_fe()[fe_index].dofs_per_quad + - this->dof_handler->get_fe()[fe_index].dofs_per_hex), - ExcVectorDoesNotMatch()); - break; + Assert (dof_indices.size() == + (8*this->dof_handler->get_fe()[fe_index].dofs_per_vertex + + 12*this->dof_handler->get_fe()[fe_index].dofs_per_line + + 6*this->dof_handler->get_fe()[fe_index].dofs_per_quad + + this->dof_handler->get_fe()[fe_index].dofs_per_hex), + ExcVectorDoesNotMatch()); + break; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } - // this function really only makes - // sense if either a) there are - // degrees of freedom defined on - // the present object, or b) the - // object is non-active objects but - // all degrees of freedom are - // located on vertices, since - // otherwise there are degrees of - // freedom on sub-objects which are - // not allocated for this - // non-active thing + // this function really only makes + // sense if either a) there are + // degrees of freedom defined on + // the present object, or b) the + // object is non-active objects but + // all degrees of freedom are + // located on vertices, since + // otherwise there are degrees of + // freedom on sub-objects which are + // not allocated for this + // non-active thing Assert (this->fe_index_is_active (fe_index) - || - (this->dof_handler->get_fe()[fe_index].dofs_per_cell == - GeometryInfo::vertices_per_cell * - this->dof_handler->get_fe()[fe_index].dofs_per_vertex), - ExcInternalError()); + || + (this->dof_handler->get_fe()[fe_index].dofs_per_cell == + GeometryInfo::vertices_per_cell * + this->dof_handler->get_fe()[fe_index].dofs_per_vertex), + ExcInternalError()); - // now do the actual work + // now do the actual work internal::DoFAccessor::get_dof_indices (*this, dof_indices, fe_index); } @@ -1783,8 +1783,8 @@ typename internal::DoFHandler::Iterators::line_iterator DoFAccessor::line (const unsigned int i) const { Assert (structdim > 1, ExcImpossibleInDim(structdim)); - // checking of 'i' happens in - // line_index(i) + // checking of 'i' happens in + // line_index(i) return typename internal::DoFHandler::Iterators::line_iterator ( @@ -1802,8 +1802,8 @@ typename internal::DoFHandler::Iterators::quad_iterator DoFAccessor::quad (const unsigned int i) const { Assert (structdim > 2, ExcImpossibleInDim(structdim)); - // checking of 'i' happens in - // quad_index(i) + // checking of 'i' happens in + // quad_index(i) return typename internal::DoFHandler::Iterators::quad_iterator ( @@ -1831,13 +1831,13 @@ template