From 674b411b722389bac101163bbcaaa31baf931bfe Mon Sep 17 00:00:00 2001 From: young Date: Mon, 30 Sep 2013 15:23:07 +0000 Subject: [PATCH] Merge from trunk to branch; mask data_out_dof_data. git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@31040 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/CMakeLists.txt | 74 +- deal.II/LICENSE | 44 - deal.II/VERSION | 2 +- deal.II/bundled/CMakeLists.txt | 29 +- .../tuple/detail/preprocessed/tuple.hpp | 2 +- .../tuple/detail/preprocessed/tuple_fwd.hpp | 2 +- .../boost/signals2/detail/foreign_ptr.hpp | 21 +- .../include/boost/thread/xtime.hpp | 4 +- .../libs/serialization/src/CMakeLists.txt | 18 +- .../libs/thread/example/starvephil.cpp | 6 +- .../libs/thread/example/tennis.cpp | 2 +- .../libs/thread/example/thread.cpp | 2 +- .../libs/thread/example/xtime.cpp | 2 +- .../libs/thread/src/CMakeLists.txt | 18 +- .../libs/thread/src/pthread/thread.cpp | 4 +- .../libs/thread/src/pthread/timeconv.inl | 16 +- .../libs/thread/src/win32/timeconv.inl | 16 +- deal.II/bundled/functionparser/CMakeLists.txt | 18 +- .../tbb41_20130401oss/src/CMakeLists.txt | 18 +- .../bundled/umfpack/AMD/Source/CMakeLists.txt | 18 +- .../umfpack/UMFPACK/Source/CMakeLists.txt | 18 +- deal.II/cmake/TODO.CMAKE | 7 - .../checks/check_01_compiler_features.cmake | 30 +- .../cmake/checks/check_01_cpu_features.cmake | 54 +- .../cmake/checks/check_01_cxx_features.cmake | 38 +- .../checks/check_02_system_features.cmake | 104 +- .../cmake/checks/check_03_compiler_bugs.cmake | 95 +- deal.II/cmake/config/CMakeLists.txt | 184 +- deal.II/cmake/config/Config.cmake.in | 74 +- deal.II/cmake/config/Make.global_options.in | 61 +- .../cmake/configure/configure_1_lapack.cmake | 89 +- deal.II/cmake/configure/configure_1_mpi.cmake | 71 +- .../cmake/configure/configure_1_threads.cmake | 85 +- .../cmake/configure/configure_1_umfpack.cmake | 18 +- .../cmake/configure/configure_2_metis.cmake | 46 + ...re_petsc.cmake => configure_2_petsc.cmake} | 28 +- ...linos.cmake => configure_2_trilinos.cmake} | 126 +- .../cmake/configure/configure_arpack.cmake | 18 +- deal.II/cmake/configure/configure_boost.cmake | 85 +- .../configure/configure_functionparser.cmake | 18 +- deal.II/cmake/configure/configure_hdf5.cmake | 24 +- deal.II/cmake/configure/configure_metis.cmake | 43 - deal.II/cmake/configure/configure_mumps.cmake | 20 +- .../cmake/configure/configure_netcdf.cmake | 18 +- deal.II/cmake/configure/configure_p4est.cmake | 27 +- deal.II/cmake/configure/configure_slepc.cmake | 30 +- deal.II/cmake/configure/configure_zlib.cmake | 18 +- deal.II/cmake/macros/macro_add_flags.cmake | 18 +- .../macros/macro_check_cxx_compiler_bug.cmake | 18 +- .../macros/macro_clear_cmake_required.cmake | 29 + .../cmake/macros/macro_cond_set_to_yes.cmake | 18 +- .../macros/macro_configure_feature.cmake | 42 +- .../macro_deal_ii_add_definitions.cmake | 18 +- .../macro_deal_ii_add_dependencies.cmake | 18 +- .../macros/macro_deal_ii_add_library.cmake | 24 +- .../macro_deal_ii_append_libraries.cmake | 47 + ..._deal_ii_initialize_cached_variables.cmake | 60 +- .../macro_deal_ii_invoke_autopilot.cmake | 200 +- .../macros/macro_deal_ii_setup_target.cmake | 43 +- .../cmake/macros/macro_enable_if_links.cmake | 20 +- .../macros/macro_enable_if_supported.cmake | 19 +- .../macro_enable_language_optional.cmake | 74 + .../macros/macro_expand_instantiations.cmake | 32 +- deal.II/cmake/macros/macro_find_package.cmake | 16 +- deal.II/cmake/macros/macro_item_matches.cmake | 18 +- .../cmake/macros/macro_pop_test_flag.cmake | 18 +- .../cmake/macros/macro_push_test_flag.cmake | 18 +- deal.II/cmake/macros/macro_replace_flag.cmake | 18 +- .../macros/macro_reset_cmake_required.cmake | 30 + deal.II/cmake/macros/macro_set_if_empty.cmake | 18 +- .../macros/macro_split_debug_release.cmake | 53 - deal.II/cmake/macros/macro_strip_flag.cmake | 18 +- .../macro_switch_library_preference.cmake | 33 + deal.II/cmake/macros/macro_to_string.cmake | 18 +- .../macro_to_string_and_add_prefix.cmake | 18 +- deal.II/cmake/modules/FindARPACK.cmake | 38 +- deal.II/cmake/modules/FindDEALII_LAPACK.cmake | 138 + deal.II/cmake/modules/FindHDF5.cmake | 36 +- deal.II/cmake/modules/FindMETIS.cmake | 88 +- deal.II/cmake/modules/FindMUMPS.cmake | 40 +- deal.II/cmake/modules/FindNETCDF.cmake | 31 +- deal.II/cmake/modules/FindP4EST.cmake | 159 +- deal.II/cmake/modules/FindPETSC.cmake | 144 +- deal.II/cmake/modules/FindSCALAPACK.cmake | 45 +- deal.II/cmake/modules/FindSLEPC.cmake | 38 +- deal.II/cmake/modules/FindTBB.cmake | 27 +- deal.II/cmake/modules/FindTRILINOS.cmake | 178 +- deal.II/cmake/modules/FindUMFPACK.cmake | 77 +- deal.II/cmake/scripts/CMakeLists.txt | 71 +- .../cmake/scripts/expand_instantiations.cc | 22 +- deal.II/cmake/scripts/make_dependencies.cc | 22 +- deal.II/cmake/scripts/report_features.cc.in | 23 +- deal.II/cmake/setup_cached_variables.cmake | 156 +- deal.II/cmake/setup_compiler_flags.cmake | 91 +- deal.II/cmake/setup_compiler_flags_gnu.cmake | 54 +- .../cmake/setup_compiler_flags_intel.cmake | 49 +- deal.II/cmake/setup_compiler_flags_msvc.cmake | 18 +- deal.II/cmake/setup_custom_targets.cmake | 44 - deal.II/cmake/setup_deal_ii.cmake | 80 +- deal.II/cmake/setup_external_macros.cmake | 19 +- deal.II/cmake/setup_finalize.cmake | 100 +- deal.II/cmake/setup_post_project_call.cmake | 58 + deal.II/contrib/CMakeLists.txt | 22 +- .../example_custom_target.cmake | 16 + .../lapack_templates/lapack_templates.pl | 47 +- .../contrib/mesh_conversion/CMakeLists.txt | 20 +- deal.II/contrib/mesh_conversion/README.txt | 2 +- deal.II/contrib/parameter_gui/CMakeLists.txt | 18 +- deal.II/contrib/parameter_gui/README | 2 +- .../contrib/parameter_gui/browse_lineedit.cpp | 20 +- .../contrib/parameter_gui/browse_lineedit.h | 20 +- .../contrib/parameter_gui/info_message.cpp | 20 +- deal.II/contrib/parameter_gui/info_message.h | 20 +- deal.II/contrib/parameter_gui/main.cpp | 20 +- deal.II/contrib/parameter_gui/mainwindow.cpp | 20 +- deal.II/contrib/parameter_gui/mainwindow.h | 20 +- .../parameter_gui/parameter_delegate.cpp | 22 +- .../parameter_gui/parameter_delegate.h | 22 +- .../parameter_gui/xml_parameter_reader.cpp | 20 +- .../parameter_gui/xml_parameter_reader.h | 20 +- .../parameter_gui/xml_parameter_writer.cpp | 20 +- .../parameter_gui/xml_parameter_writer.h | 20 +- deal.II/contrib/test_affinity/CMakeLists.txt | 46 + .../contrib/test_affinity/test_affinity.cc | 29 + deal.II/doc/CMakeLists.txt | 34 +- deal.II/doc/authors.html | 53 +- .../Toolchain.sample | 0 .../cmake-internals.html | 585 +- .../indentation.html | 13 + .../{development => developers}/index.html | 8 +- .../{development => developers}/navbar.html | 32 +- .../{development => developers}/porting.html | 15 +- .../doc/{development => developers}/svn.html | 13 + .../testsuite.html | 47 +- .../{development => developers}/title.html | 2 +- .../doc/{development => developers}/toc.html | 78 +- .../writing-documentation.html | 24 +- deal.II/doc/development/CMakeLists.txt.sample | 61 - deal.II/doc/development/cmakelists.html | 515 -- deal.II/doc/documentation.html | 305 +- deal.II/doc/doxygen/CMakeLists.txt | 20 +- deal.II/doc/doxygen/header.html.in | 4 +- deal.II/doc/doxygen/headers/boundary.h | 22 +- .../doc/doxygen/headers/coding_conventions.h | 22 +- deal.II/doc/doxygen/headers/constraints.h | 32 +- deal.II/doc/doxygen/headers/distributed.h | 22 +- deal.II/doc/doxygen/headers/dofs.h | 22 +- deal.II/doc/doxygen/headers/exceptions.h | 24 +- deal.II/doc/doxygen/headers/fe.h | 22 +- deal.II/doc/doxygen/headers/functions.h | 22 +- deal.II/doc/doxygen/headers/geodynamics.h | 22 +- .../doxygen/headers/geometry_and_primitives.h | 22 +- .../doc/doxygen/headers/global_dof_index.h | 25 +- deal.II/doc/doxygen/headers/glossary.h | 39 +- deal.II/doc/doxygen/headers/grid.h | 22 +- deal.II/doc/doxygen/headers/hp.h | 22 +- deal.II/doc/doxygen/headers/instantiations.h | 24 +- deal.II/doc/doxygen/headers/integrators.h | 22 +- deal.II/doc/doxygen/headers/io.h | 22 +- deal.II/doc/doxygen/headers/iterators.h | 16 + deal.II/doc/doxygen/headers/lac.h | 22 +- deal.II/doc/doxygen/headers/main.h | 22 +- deal.II/doc/doxygen/headers/matrices.h | 22 +- deal.II/doc/doxygen/headers/memory.h | 22 +- deal.II/doc/doxygen/headers/mesh_worker.h | 22 +- deal.II/doc/doxygen/headers/mg.h | 22 +- deal.II/doc/doxygen/headers/multithreading.h | 22 +- .../doc/doxygen/headers/namespace_dealii.h | 16 + .../doxygen/headers/numerical_algorithms.h | 22 +- deal.II/doc/doxygen/headers/parallel.h | 22 +- deal.II/doc/doxygen/headers/petsc.h | 22 +- deal.II/doc/doxygen/headers/polynomials.h | 22 +- deal.II/doc/doxygen/headers/preconditioners.h | 22 +- deal.II/doc/doxygen/headers/quadrature.h | 22 +- deal.II/doc/doxygen/headers/slepc.h | 22 +- deal.II/doc/doxygen/headers/solvers.h | 22 +- deal.II/doc/doxygen/headers/std_cxx1x.h | 22 +- deal.II/doc/doxygen/headers/trilinos.h | 22 +- deal.II/doc/doxygen/headers/tutorial.h | 22 +- deal.II/doc/doxygen/headers/update_flags.h | 22 +- deal.II/doc/doxygen/headers/utilities.h | 22 +- deal.II/doc/doxygen/headers/vector_memory.h | 22 +- deal.II/doc/doxygen/headers/vector_valued.h | 34 +- deal.II/doc/doxygen/headers/vectors.h | 22 +- deal.II/doc/doxygen/images/CMakeLists.txt | 15 + deal.II/doc/doxygen/options.dox.in | 6 +- deal.II/doc/doxygen/scripts/create_anchors | 27 +- deal.II/doc/doxygen/scripts/intro2toc | 27 +- deal.II/doc/doxygen/scripts/make_step.pl | 27 +- deal.II/doc/doxygen/scripts/program2doxygen | 28 +- deal.II/doc/doxygen/scripts/program2doxyplain | 27 +- deal.II/doc/doxygen/scripts/program2html | 27 +- deal.II/doc/doxygen/scripts/program2plain | 27 +- deal.II/doc/doxygen/scripts/program2toc | 27 +- deal.II/doc/doxygen/tutorial/CMakeLists.txt | 18 +- deal.II/doc/external-libs/arpack.html | 6 +- deal.II/doc/external-libs/mumps.html | 9 +- deal.II/doc/external-libs/p4est.html | 53 +- deal.II/doc/external-libs/petsc.html | 19 +- deal.II/doc/external-libs/slepc.html | 8 + deal.II/doc/external-libs/trilinos.html | 50 +- deal.II/doc/index.html | 2 +- deal.II/doc/license.html | 38 +- deal.II/doc/license/adjust.pl | 29 + deal.II/doc/license/header-template | 7 +- deal.II/doc/license/header-template.cmake | 15 + deal.II/doc/license/replace.sh | 51 + deal.II/doc/mail.html | 24 +- deal.II/doc/navbar.html | 19 +- deal.II/doc/news/2001/3.1.0-vs-3.2.0.html | 10 +- deal.II/doc/news/6.3.0-vs-7.0.0.h | 3 +- deal.II/doc/news/7.0.0-vs-7.1.0.h | 2 +- deal.II/doc/news/7.2.0-vs-7.3.0.h | 2 +- deal.II/doc/news/7.3.0-vs-8.0.0.h | 627 ++ deal.II/doc/news/changes.h | 812 +- deal.II/doc/news/news.html | 30 +- deal.II/doc/publications/index.html | 568 +- deal.II/doc/readme.html | 536 +- deal.II/doc/reports/index.html | 120 + deal.II/doc/screen.css | 85 +- deal.II/doc/users/CMakeLists.txt.sample | 11 + deal.II/doc/users/CMakeLists.txt.sample2 | 20 + deal.II/doc/users/CMakeLists.txt.sample3 | 33 + .../doc/{development => users}/Config.sample | 61 +- deal.II/doc/{development => users}/cmake.html | 163 +- deal.II/doc/users/cmakelists.html | 863 +++ .../doc/{development => users}/doxygen.html | 16 +- deal.II/doc/users/index.html | 34 + deal.II/doc/users/navbar.html | 62 + deal.II/doc/users/title.html | 31 + deal.II/doc/users/toc.html | 125 + deal.II/examples/CMakeLists.txt | 18 +- .../examples/doxygen/block_matrix_array.cc | 20 +- .../compressed_block_sparsity_pattern.cc | 21 +- deal.II/examples/doxygen/product_matrix.cc | 21 +- .../examples/doxygen/theta_timestepping.cc | 21 +- deal.II/examples/step-1/step-1.cc | 23 +- deal.II/examples/step-10/doc/results.dox | 153 +- deal.II/examples/step-10/step-10.cc | 30 +- deal.II/examples/step-11/doc/intro.dox | 4 +- deal.II/examples/step-11/doc/results.dox | 2 +- deal.II/examples/step-11/step-11.cc | 30 +- deal.II/examples/step-12/step-12.cc | 30 +- deal.II/examples/step-13/doc/intro.dox | 6 +- deal.II/examples/step-13/step-13.cc | 41 +- deal.II/examples/step-14/doc/results.dox | 2 +- deal.II/examples/step-14/step-14.cc | 51 +- deal.II/examples/step-15/doc/intro.dox | 10 +- deal.II/examples/step-15/doc/results.dox | 2 +- deal.II/examples/step-15/step-15.cc | 59 +- deal.II/examples/step-16/step-16.cc | 56 +- deal.II/examples/step-17/CMakeLists.txt | 2 +- deal.II/examples/step-17/step-17.cc | 48 +- deal.II/examples/step-18/CMakeLists.txt | 2 +- deal.II/examples/step-18/doc/intro.dox | 4 +- deal.II/examples/step-18/doc/results.dox | 6 +- deal.II/examples/step-18/step-18.cc | 73 +- deal.II/examples/step-19/doc/results.dox | 4 +- deal.II/examples/step-19/step-19.cc | 37 +- deal.II/examples/step-2/doc/intro.dox | 4 +- deal.II/examples/step-2/doc/results.dox | 2 +- deal.II/examples/step-2/step-2.cc | 30 +- deal.II/examples/step-20/doc/results.dox | 8 +- deal.II/examples/step-20/step-20.cc | 36 +- deal.II/examples/step-21/doc/intro.dox | 8 +- deal.II/examples/step-21/step-21.cc | 30 +- deal.II/examples/step-22/CMakeLists.txt | 2 +- deal.II/examples/step-22/doc/intro.dox | 10 +- deal.II/examples/step-22/doc/results.dox | 16 +- deal.II/examples/step-22/step-22.cc | 41 +- deal.II/examples/step-23/doc/intro.dox | 12 +- deal.II/examples/step-23/doc/results.dox | 4 +- deal.II/examples/step-23/step-23.cc | 38 +- deal.II/examples/step-24/doc/intro.dox | 6 +- deal.II/examples/step-24/doc/results.dox | 4 +- deal.II/examples/step-24/step-24.cc | 34 +- deal.II/examples/step-25/doc/intro.dox | 20 +- deal.II/examples/step-25/step-25.cc | 70 +- deal.II/examples/step-26/step-26.cc | 62 +- deal.II/examples/step-27/step-27.cc | 30 +- deal.II/examples/step-28/doc/intro.dox | 4 +- deal.II/examples/step-28/doc/results.dox | 4 +- deal.II/examples/step-28/step-28.cc | 34 +- deal.II/examples/step-29/CMakeLists.txt | 2 +- deal.II/examples/step-29/doc/intro.dox | 6 +- deal.II/examples/step-29/doc/results.dox | 2 +- deal.II/examples/step-29/step-29.cc | 35 +- deal.II/examples/step-3/doc/intro.dox | 74 +- deal.II/examples/step-3/doc/results.dox | 4 +- deal.II/examples/step-3/step-3.cc | 43 +- deal.II/examples/step-30/doc/intro.dox | 4 +- deal.II/examples/step-30/doc/results.dox | 2 +- deal.II/examples/step-30/step-30.cc | 57 +- deal.II/examples/step-31/CMakeLists.txt | 2 +- deal.II/examples/step-31/doc/intro.dox | 16 +- deal.II/examples/step-31/doc/results.dox | 8 +- deal.II/examples/step-31/step-31.cc | 203 +- deal.II/examples/step-32/CMakeLists.txt | 5 +- deal.II/examples/step-32/doc/intro.dox | 24 +- deal.II/examples/step-32/doc/results.dox | 11 +- deal.II/examples/step-32/step-32.cc | 79 +- deal.II/examples/step-33/CMakeLists.txt | 2 +- deal.II/examples/step-33/doc/intro.dox | 4 +- deal.II/examples/step-33/step-33.cc | 48 +- deal.II/examples/step-34/CMakeLists.txt | 2 +- deal.II/examples/step-34/doc/intro.dox | 4 +- deal.II/examples/step-34/doc/results.dox | 2 +- deal.II/examples/step-34/step-34.cc | 36 +- deal.II/examples/step-35/CMakeLists.txt | 2 +- deal.II/examples/step-35/step-35.cc | 35 +- deal.II/examples/step-36/CMakeLists.txt | 2 +- deal.II/examples/step-36/doc/intro.dox | 6 +- deal.II/examples/step-36/doc/results.dox | 2 +- deal.II/examples/step-36/step-36.cc | 30 +- deal.II/examples/step-37/CMakeLists.txt | 2 +- deal.II/examples/step-37/doc/intro.dox | 6 +- deal.II/examples/step-37/step-37.cc | 43 +- deal.II/examples/step-38/doc/intro.dox | 2 +- deal.II/examples/step-38/doc/results.dox | 4 +- deal.II/examples/step-38/step-38.cc | 30 +- deal.II/examples/step-39/doc/results.dox | 2 +- deal.II/examples/step-39/step-39.cc | 70 +- deal.II/examples/step-4/doc/intro.dox | 2 +- deal.II/examples/step-4/doc/results.dox | 2 +- deal.II/examples/step-4/step-4.cc | 32 +- deal.II/examples/step-40/CMakeLists.txt | 2 +- deal.II/examples/step-40/doc/intro.dox | 12 + deal.II/examples/step-40/doc/results.dox | 2 +- deal.II/examples/step-40/step-40.cc | 145 +- deal.II/examples/step-41/CMakeLists.txt | 2 +- deal.II/examples/step-41/doc/intro.dox | 8 +- deal.II/examples/step-41/step-41.cc | 38 +- deal.II/examples/step-42/CMakeLists.txt | 5 +- .../examples/step-42/doc/intro-step-42.tex | 405 - deal.II/examples/step-42/doc/intro.dox | 678 +- deal.II/examples/step-42/doc/results.dox | 16 +- .../step-42/doc/step-42-CellConstitution.png | Bin 52558 -> 0 bytes .../doc/step-42-CellConstitutionBall.png | Bin 52558 -> 0 bytes .../doc/step-42-CellConstitutionBall2.png | Bin 25917 -> 0 bytes .../doc/step-42-CellConstitutionColorbar.png | Bin 6614 -> 0 bytes .../doc/step-42-CellConstitutionLi2.png | Bin 48974 -> 0 bytes deal.II/examples/step-42/p1_adaptive.prm | 25 + deal.II/examples/step-42/p1_chinese.prm | 25 + deal.II/examples/step-42/p1_global.prm | 25 + deal.II/examples/step-42/p2_adaptive.prm | 25 + deal.II/examples/step-42/p2_global.prm | 25 + deal.II/examples/step-42/step-42.cc | 2731 ++++--- deal.II/examples/step-43/CMakeLists.txt | 2 +- deal.II/examples/step-43/doc/intro.dox | 8 +- deal.II/examples/step-43/step-43.cc | 37 +- deal.II/examples/step-44/doc/intro.dox | 4 +- deal.II/examples/step-44/doc/results.dox | 2 +- deal.II/examples/step-44/step-44.cc | 50 +- deal.II/examples/step-45/step-45.cc | 29 +- deal.II/examples/step-46/CMakeLists.txt | 2 +- deal.II/examples/step-46/doc/intro.dox | 2 +- deal.II/examples/step-46/step-46.cc | 33 +- deal.II/examples/step-47/step-47.cc | 33 +- deal.II/examples/step-48/doc/intro.dox | 2 +- deal.II/examples/step-48/doc/results.dox | 4 +- deal.II/examples/step-48/step-48.cc | 36 +- deal.II/examples/step-49/doc/intro.dox | 2 +- deal.II/examples/step-49/doc/results.dox | 2 +- deal.II/examples/step-49/step-49.cc | 54 +- deal.II/examples/step-5/step-5.cc | 30 +- deal.II/examples/step-50/CMakeLists.txt | 5 +- deal.II/examples/step-50/step-50.cc | 464 +- deal.II/examples/step-51/CMakeLists.txt | 31 + deal.II/examples/step-51/doc/builds-on | 1 + deal.II/examples/step-51/doc/intro.dox | 345 + deal.II/examples/step-51/doc/kind | 1 + deal.II/examples/step-51/doc/results.dox | 420 ++ deal.II/examples/step-51/doc/tooltip | 1 + deal.II/examples/step-51/step-51.cc | 1449 ++++ deal.II/examples/step-6/step-6.cc | 34 +- deal.II/examples/step-7/step-7.cc | 32 +- deal.II/examples/step-8/doc/intro.dox | 2 +- deal.II/examples/step-8/step-8.cc | 30 +- deal.II/examples/step-9/step-9.cc | 64 +- deal.II/include/CMakeLists.txt | 18 +- deal.II/include/deal.II/algorithms/newton.h | 21 +- .../deal.II/algorithms/newton.templates.h | 21 +- deal.II/include/deal.II/algorithms/operator.h | 32 +- .../deal.II/algorithms/operator.templates.h | 21 +- .../deal.II/algorithms/theta_timestepping.h | 21 +- .../algorithms/theta_timestepping.templates.h | 21 +- .../deal.II/algorithms/timestep_control.h | 21 +- .../deal.II/base/auto_derivative_function.h | 21 +- .../deal.II/base/conditional_ostream.h | 21 +- deal.II/include/deal.II/base/config.h.in | 49 +- .../include/deal.II/base/convergence_table.h | 23 +- deal.II/include/deal.II/base/data_out_base.h | 2229 +++--- .../include/deal.II/base/derivative_form.h | 21 +- deal.II/include/deal.II/base/event.h | 21 +- deal.II/include/deal.II/base/exceptions.h | 27 +- deal.II/include/deal.II/base/flow_function.h | 21 +- deal.II/include/deal.II/base/function.h | 655 +- .../include/deal.II/base/function_bessel.h | 21 +- .../deal.II/base/function_derivative.h | 21 +- deal.II/include/deal.II/base/function_lib.h | 21 +- .../include/deal.II/base/function_parser.h | 21 +- deal.II/include/deal.II/base/function_time.h | 21 +- deal.II/include/deal.II/base/geometry_info.h | 24 +- deal.II/include/deal.II/base/graph_coloring.h | 380 + deal.II/include/deal.II/base/index_set.h | 25 +- deal.II/include/deal.II/base/job_identifier.h | 21 +- deal.II/include/deal.II/base/logstream.h | 23 +- .../include/deal.II/base/memory_consumption.h | 33 +- .../include/deal.II/base/mg_level_object.h | 21 +- deal.II/include/deal.II/base/mpi.h | 28 +- .../include/deal.II/base/multithread_info.h | 23 +- deal.II/include/deal.II/base/named_data.h | 21 +- deal.II/include/deal.II/base/numbers.h | 21 +- deal.II/include/deal.II/base/parallel.h | 21 +- .../include/deal.II/base/parameter_handler.h | 1927 ++--- .../include/deal.II/base/parsed_function.h | 21 +- deal.II/include/deal.II/base/partitioner.h | 38 +- deal.II/include/deal.II/base/path_search.h | 21 +- deal.II/include/deal.II/base/point.h | 21 +- deal.II/include/deal.II/base/polynomial.h | 21 +- .../include/deal.II/base/polynomial_space.h | 23 +- .../include/deal.II/base/polynomials_abf.h | 21 +- .../include/deal.II/base/polynomials_adini.h | 21 +- .../include/deal.II/base/polynomials_bdm.h | 21 +- .../deal.II/base/polynomials_nedelec.h | 21 +- deal.II/include/deal.II/base/polynomials_p.h | 21 +- .../deal.II/base/polynomials_piecewise.h | 23 +- .../deal.II/base/polynomials_raviart_thomas.h | 21 +- deal.II/include/deal.II/base/qprojector.h | 21 +- deal.II/include/deal.II/base/quadrature.h | 21 +- deal.II/include/deal.II/base/quadrature_lib.h | 25 +- .../deal.II/base/quadrature_selector.h | 21 +- deal.II/include/deal.II/base/smartpointer.h | 21 +- .../include/deal.II/base/std_cxx1x/array.h | 22 +- deal.II/include/deal.II/base/std_cxx1x/bind.h | 22 +- .../base/std_cxx1x/condition_variable.h | 22 +- .../include/deal.II/base/std_cxx1x/function.h | 22 +- .../include/deal.II/base/std_cxx1x/mutex.h | 22 +- .../deal.II/base/std_cxx1x/shared_ptr.h | 22 +- .../include/deal.II/base/std_cxx1x/thread.h | 22 +- .../include/deal.II/base/std_cxx1x/tuple.h | 22 +- .../deal.II/base/std_cxx1x/type_traits.h | 22 +- deal.II/include/deal.II/base/subscriptor.h | 31 +- .../include/deal.II/base/symmetric_tensor.h | 85 +- .../deal.II/base/synchronous_iterator.h | 21 +- deal.II/include/deal.II/base/table.h | 21 +- deal.II/include/deal.II/base/table_handler.h | 37 +- deal.II/include/deal.II/base/table_indices.h | 35 +- .../deal.II/base/template_constraints.h | 25 +- deal.II/include/deal.II/base/tensor.h | 118 +- deal.II/include/deal.II/base/tensor_base.h | 97 +- .../include/deal.II/base/tensor_function.h | 126 +- .../deal.II/base/tensor_product_polynomials.h | 21 +- .../base/tensor_product_polynomials_const.h | 21 +- .../deal.II/base/thread_local_storage.h | 25 +- .../include/deal.II/base/thread_management.h | 97 +- deal.II/include/deal.II/base/timer.h | 27 +- deal.II/include/deal.II/base/types.h | 31 +- deal.II/include/deal.II/base/utilities.h | 23 +- deal.II/include/deal.II/base/vector_slice.h | 21 +- deal.II/include/deal.II/base/vectorization.h | 22 +- deal.II/include/deal.II/base/work_stream.h | 954 ++- .../deal.II/distributed/grid_refinement.h | 21 +- .../deal.II/distributed/solution_transfer.h | 21 +- deal.II/include/deal.II/distributed/tria.h | 97 +- deal.II/include/deal.II/dofs/block_info.h | 21 +- deal.II/include/deal.II/dofs/dof_accessor.h | 35 +- .../deal.II/dofs/dof_accessor.templates.h | 534 +- deal.II/include/deal.II/dofs/dof_faces.h | 25 +- deal.II/include/deal.II/dofs/dof_handler.h | 50 +- .../include/deal.II/dofs/dof_handler_policy.h | 21 +- .../deal.II/dofs/dof_iterator_selector.h | 21 +- deal.II/include/deal.II/dofs/dof_levels.h | 50 +- deal.II/include/deal.II/dofs/dof_objects.h | 21 +- .../include/deal.II/dofs/dof_renumbering.h | 23 +- deal.II/include/deal.II/dofs/dof_tools.h | 145 +- deal.II/include/deal.II/dofs/function_map.h | 21 +- deal.II/include/deal.II/dofs/number_cache.h | 21 +- deal.II/include/deal.II/fe/block_mask.h | 21 +- deal.II/include/deal.II/fe/component_mask.h | 26 +- deal.II/include/deal.II/fe/fe.h | 80 +- deal.II/include/deal.II/fe/fe_abf.h | 21 +- deal.II/include/deal.II/fe/fe_base.h | 116 +- deal.II/include/deal.II/fe/fe_bdm.h | 21 +- deal.II/include/deal.II/fe/fe_dg_vector.h | 21 +- .../deal.II/fe/fe_dg_vector.templates.h | 21 +- deal.II/include/deal.II/fe/fe_dgp.h | 21 +- deal.II/include/deal.II/fe/fe_dgp_monomial.h | 21 +- .../include/deal.II/fe/fe_dgp_nonparametric.h | 21 +- deal.II/include/deal.II/fe/fe_dgq.h | 21 +- deal.II/include/deal.II/fe/fe_face.h | 194 +- deal.II/include/deal.II/fe/fe_nedelec.h | 21 +- deal.II/include/deal.II/fe/fe_nothing.h | 21 +- deal.II/include/deal.II/fe/fe_poly.h | 21 +- .../include/deal.II/fe/fe_poly.templates.h | 21 +- deal.II/include/deal.II/fe/fe_poly_face.h | 21 +- .../deal.II/fe/fe_poly_face.templates.h | 21 +- deal.II/include/deal.II/fe/fe_poly_tensor.h | 21 +- deal.II/include/deal.II/fe/fe_q.h | 21 +- deal.II/include/deal.II/fe/fe_q_base.h | 87 +- deal.II/include/deal.II/fe/fe_q_dg0.h | 21 +- .../include/deal.II/fe/fe_q_hierarchical.h | 21 +- deal.II/include/deal.II/fe/fe_q_iso_q1.h | 21 +- .../include/deal.II/fe/fe_raviart_thomas.h | 21 +- deal.II/include/deal.II/fe/fe_system.h | 71 +- deal.II/include/deal.II/fe/fe_tools.h | 30 +- deal.II/include/deal.II/fe/fe_update_flags.h | 21 +- deal.II/include/deal.II/fe/fe_values.h | 464 +- .../include/deal.II/fe/fe_values_extractors.h | 92 +- deal.II/include/deal.II/fe/mapping.h | 48 +- deal.II/include/deal.II/fe/mapping_c1.h | 88 +- .../include/deal.II/fe/mapping_cartesian.h | 21 +- deal.II/include/deal.II/fe/mapping_q.h | 421 +- deal.II/include/deal.II/fe/mapping_q1.h | 21 +- .../include/deal.II/fe/mapping_q1_eulerian.h | 21 +- .../include/deal.II/fe/mapping_q_eulerian.h | 109 +- deal.II/include/deal.II/grid/cell_id.h | 134 + .../include/deal.II/grid/filtered_iterator.h | 187 +- deal.II/include/deal.II/grid/grid_generator.h | 326 +- deal.II/include/deal.II/grid/grid_in.h | 21 +- deal.II/include/deal.II/grid/grid_out.h | 105 +- .../include/deal.II/grid/grid_refinement.h | 21 +- .../include/deal.II/grid/grid_reordering.h | 21 +- .../deal.II/grid/grid_reordering_internal.h | 21 +- deal.II/include/deal.II/grid/grid_tools.h | 359 +- deal.II/include/deal.II/grid/intergrid_map.h | 21 +- deal.II/include/deal.II/grid/magic_numbers.h | 21 +- .../include/deal.II/grid/persistent_tria.h | 21 +- deal.II/include/deal.II/grid/tria.h | 76 +- deal.II/include/deal.II/grid/tria_accessor.h | 99 +- .../deal.II/grid/tria_accessor.templates.h | 76 +- deal.II/include/deal.II/grid/tria_boundary.h | 530 +- .../include/deal.II/grid/tria_boundary_lib.h | 21 +- deal.II/include/deal.II/grid/tria_faces.h | 21 +- deal.II/include/deal.II/grid/tria_iterator.h | 134 +- .../deal.II/grid/tria_iterator.templates.h | 21 +- .../include/deal.II/grid/tria_iterator_base.h | 21 +- .../deal.II/grid/tria_iterator_selector.h | 21 +- deal.II/include/deal.II/grid/tria_levels.h | 21 +- deal.II/include/deal.II/grid/tria_object.h | 21 +- deal.II/include/deal.II/grid/tria_objects.h | 21 +- deal.II/include/deal.II/hp/dof_faces.h | 572 +- deal.II/include/deal.II/hp/dof_handler.h | 70 +- deal.II/include/deal.II/hp/dof_level.h | 432 ++ deal.II/include/deal.II/hp/dof_levels.h | 236 - deal.II/include/deal.II/hp/dof_objects.h | 632 -- deal.II/include/deal.II/hp/fe_collection.h | 21 +- deal.II/include/deal.II/hp/fe_values.h | 785 +- .../include/deal.II/hp/mapping_collection.h | 21 +- deal.II/include/deal.II/hp/q_collection.h | 21 +- .../include/deal.II/integrators/advection.h | 37 +- .../include/deal.II/integrators/divergence.h | 147 +- .../include/deal.II/integrators/elasticity.h | 165 +- deal.II/include/deal.II/integrators/l2.h | 21 +- deal.II/include/deal.II/integrators/laplace.h | 92 +- .../deal.II/integrators/local_integrators.h | 21 +- deal.II/include/deal.II/integrators/maxwell.h | 21 +- deal.II/include/deal.II/integrators/patches.h | 21 +- deal.II/include/deal.II/lac/arpack_solver.h | 27 +- deal.II/include/deal.II/lac/block_indices.h | 23 +- deal.II/include/deal.II/lac/block_list.h | 27 +- deal.II/include/deal.II/lac/block_matrix.h | 21 +- .../include/deal.II/lac/block_matrix_array.h | 21 +- .../include/deal.II/lac/block_matrix_base.h | 194 +- .../include/deal.II/lac/block_sparse_matrix.h | 21 +- .../lac/block_sparse_matrix.templates.h | 21 +- .../deal.II/lac/block_sparse_matrix_ez.h | 27 +- .../lac/block_sparse_matrix_ez.templates.h | 21 +- .../deal.II/lac/block_sparsity_pattern.h | 27 +- deal.II/include/deal.II/lac/block_vector.h | 21 +- .../deal.II/lac/block_vector.templates.h | 21 +- .../include/deal.II/lac/block_vector_base.h | 71 +- .../include/deal.II/lac/chunk_sparse_matrix.h | 29 +- .../lac/chunk_sparse_matrix.templates.h | 35 +- .../deal.II/lac/chunk_sparsity_pattern.h | 59 +- .../lac/compressed_set_sparsity_pattern.h | 21 +- .../lac/compressed_simple_sparsity_pattern.h | 27 +- .../deal.II/lac/compressed_sparsity_pattern.h | 21 +- .../include/deal.II/lac/constraint_matrix.h | 58 +- .../deal.II/lac/constraint_matrix.templates.h | 78 +- deal.II/include/deal.II/lac/eigen.h | 21 +- deal.II/include/deal.II/lac/exceptions.h | 21 +- deal.II/include/deal.II/lac/filtered_matrix.h | 21 +- deal.II/include/deal.II/lac/full_matrix.h | 35 +- .../deal.II/lac/full_matrix.templates.h | 29 +- .../deal.II/lac/generic_linear_algebra.h | 214 + deal.II/include/deal.II/lac/householder.h | 21 +- deal.II/include/deal.II/lac/identity_matrix.h | 25 +- .../include/deal.II/lac/iterative_inverse.h | 21 +- .../include/deal.II/lac/lapack_full_matrix.h | 25 +- deal.II/include/deal.II/lac/lapack_support.h | 21 +- .../include/deal.II/lac/lapack_templates.h | 21 +- deal.II/include/deal.II/lac/matrix_block.h | 21 +- deal.II/include/deal.II/lac/matrix_iterator.h | 21 +- deal.II/include/deal.II/lac/matrix_lib.h | 21 +- .../deal.II/lac/matrix_lib.templates.h | 21 +- deal.II/include/deal.II/lac/matrix_out.h | 23 +- .../deal.II/lac/parallel_block_vector.h | 86 +- deal.II/include/deal.II/lac/parallel_vector.h | 125 +- .../deal.II/lac/parallel_vector.templates.h | 59 +- .../deal.II/lac/petsc_block_sparse_matrix.h | 21 +- .../include/deal.II/lac/petsc_block_vector.h | 21 +- .../include/deal.II/lac/petsc_full_matrix.h | 21 +- .../include/deal.II/lac/petsc_matrix_base.h | 87 +- .../include/deal.II/lac/petsc_matrix_free.h | 26 +- .../lac/petsc_parallel_block_sparse_matrix.h | 47 +- .../deal.II/lac/petsc_parallel_block_vector.h | 103 +- .../lac/petsc_parallel_sparse_matrix.h | 53 +- .../deal.II/lac/petsc_parallel_vector.h | 116 +- .../include/deal.II/lac/petsc_precondition.h | 21 +- deal.II/include/deal.II/lac/petsc_solver.h | 41 +- .../include/deal.II/lac/petsc_sparse_matrix.h | 36 +- deal.II/include/deal.II/lac/petsc_vector.h | 21 +- .../include/deal.II/lac/petsc_vector_base.h | 162 +- deal.II/include/deal.II/lac/pointer_matrix.h | 21 +- deal.II/include/deal.II/lac/precondition.h | 27 +- .../include/deal.II/lac/precondition_block.h | 23 +- .../lac/precondition_block.templates.h | 25 +- .../deal.II/lac/precondition_block_base.h | 21 +- .../deal.II/lac/precondition_selector.h | 21 +- .../include/deal.II/lac/relaxation_block.h | 21 +- .../deal.II/lac/relaxation_block.templates.h | 29 +- deal.II/include/deal.II/lac/schur_matrix.h | 23 +- deal.II/include/deal.II/lac/shifted_matrix.h | 21 +- deal.II/include/deal.II/lac/slepc_solver.h | 270 +- .../lac/slepc_spectral_transformation.h | 26 +- deal.II/include/deal.II/lac/solver.h | 21 +- deal.II/include/deal.II/lac/solver_bicgstab.h | 21 +- deal.II/include/deal.II/lac/solver_cg.h | 21 +- deal.II/include/deal.II/lac/solver_control.h | 21 +- deal.II/include/deal.II/lac/solver_gmres.h | 23 +- deal.II/include/deal.II/lac/solver_minres.h | 21 +- deal.II/include/deal.II/lac/solver_qmrs.h | 21 +- .../include/deal.II/lac/solver_relaxation.h | 21 +- .../include/deal.II/lac/solver_richardson.h | 21 +- deal.II/include/deal.II/lac/solver_selector.h | 21 +- .../deal.II/lac/sparse_decomposition.h | 22 +- .../lac/sparse_decomposition.templates.h | 46 +- deal.II/include/deal.II/lac/sparse_direct.h | 72 +- deal.II/include/deal.II/lac/sparse_ilu.h | 22 +- .../deal.II/lac/sparse_ilu.templates.h | 22 +- deal.II/include/deal.II/lac/sparse_matrix.h | 88 +- .../deal.II/lac/sparse_matrix.templates.h | 61 +- .../include/deal.II/lac/sparse_matrix_ez.h | 29 +- .../deal.II/lac/sparse_matrix_ez.templates.h | 27 +- deal.II/include/deal.II/lac/sparse_mic.h | 22 +- .../deal.II/lac/sparse_mic.templates.h | 22 +- deal.II/include/deal.II/lac/sparse_vanka.h | 21 +- .../deal.II/lac/sparse_vanka.templates.h | 33 +- .../include/deal.II/lac/sparsity_pattern.h | 57 +- deal.II/include/deal.II/lac/sparsity_tools.h | 38 +- .../include/deal.II/lac/swappable_vector.h | 21 +- .../deal.II/lac/swappable_vector.templates.h | 21 +- .../include/deal.II/lac/transpose_matrix.h | 21 +- .../include/deal.II/lac/tridiagonal_matrix.h | 21 +- .../lac/trilinos_block_sparse_matrix.h | 21 +- .../deal.II/lac/trilinos_block_vector.h | 21 +- .../lac/trilinos_parallel_block_vector.h | 66 +- .../deal.II/lac/trilinos_precondition.h | 101 +- deal.II/include/deal.II/lac/trilinos_solver.h | 73 +- .../deal.II/lac/trilinos_sparse_matrix.h | 64 +- .../deal.II/lac/trilinos_sparsity_pattern.h | 52 +- deal.II/include/deal.II/lac/trilinos_vector.h | 78 +- .../deal.II/lac/trilinos_vector_base.h | 73 +- deal.II/include/deal.II/lac/vector.h | 71 +- .../include/deal.II/lac/vector.templates.h | 63 +- deal.II/include/deal.II/lac/vector_memory.h | 21 +- deal.II/include/deal.II/lac/vector_view.h | 23 +- .../include/deal.II/matrix_free/dof_info.h | 109 +- .../deal.II/matrix_free/dof_info.templates.h | 249 +- .../deal.II/matrix_free/fe_evaluation.h | 314 +- .../deal.II/matrix_free/helper_functions.h | 22 +- .../deal.II/matrix_free/mapping_info.h | 22 +- .../matrix_free/mapping_info.templates.h | 22 +- .../include/deal.II/matrix_free/matrix_free.h | 50 +- .../matrix_free/matrix_free.templates.h | 45 +- .../include/deal.II/matrix_free/shape_info.h | 22 +- .../matrix_free/shape_info.templates.h | 28 +- .../include/deal.II/meshworker/assembler.h | 21 +- deal.II/include/deal.II/meshworker/dof_info.h | 31 +- .../deal.II/meshworker/dof_info.templates.h | 21 +- .../include/deal.II/meshworker/functional.h | 21 +- .../deal.II/meshworker/integration_info.h | 439 +- .../meshworker/integration_info.templates.h | 21 +- .../deal.II/meshworker/local_integrator.h | 81 +- .../deal.II/meshworker/local_results.h | 25 +- deal.II/include/deal.II/meshworker/loop.h | 28 +- deal.II/include/deal.II/meshworker/output.h | 21 +- deal.II/include/deal.II/meshworker/simple.h | 260 +- .../deal.II/meshworker/vector_selector.h | 21 +- .../meshworker/vector_selector.templates.h | 21 +- deal.II/include/deal.II/multigrid/mg_base.h | 21 +- .../deal.II/multigrid/mg_block_smoother.h | 21 +- deal.II/include/deal.II/multigrid/mg_coarse.h | 33 +- .../deal.II/multigrid/mg_constrained_dofs.h | 98 +- .../deal.II/multigrid/mg_dof_accessor.h | 21 +- .../deal.II/multigrid/mg_dof_handler.h | 21 +- .../multigrid/mg_dof_iterator_selector.h | 21 +- deal.II/include/deal.II/multigrid/mg_matrix.h | 21 +- .../include/deal.II/multigrid/mg_smoother.h | 39 +- deal.II/include/deal.II/multigrid/mg_tools.h | 21 +- .../include/deal.II/multigrid/mg_transfer.h | 51 +- .../deal.II/multigrid/mg_transfer.templates.h | 73 +- .../deal.II/multigrid/mg_transfer_block.h | 21 +- .../multigrid/mg_transfer_block.templates.h | 22 +- .../deal.II/multigrid/mg_transfer_component.h | 30 +- .../mg_transfer_component.templates.h | 22 +- deal.II/include/deal.II/multigrid/multigrid.h | 22 +- .../deal.II/multigrid/multigrid.templates.h | 21 +- .../multigrid/sparse_matrix_collection.h | 124 + .../numerics/data_component_interpretation.h | 21 +- deal.II/include/deal.II/numerics/data_out.h | 1244 +-- .../deal.II/numerics/data_out_dof_data.h | 920 +++ .../include/deal.II/numerics/data_out_faces.h | 32 +- .../deal.II/numerics/data_out_rotation.h | 34 +- .../include/deal.II/numerics/data_out_stack.h | 21 +- .../deal.II/numerics/data_postprocessor.h | 23 +- .../numerics/derivative_approximation.h | 22 +- .../deal.II/numerics/dof_output_operator.h | 21 +- .../numerics/dof_output_operator.templates.h | 21 +- .../deal.II/numerics/dof_print_solver_step.h | 21 +- .../deal.II/numerics/error_estimator.h | 359 +- .../deal.II/numerics/fe_field_function.h | 21 +- .../numerics/fe_field_function.templates.h | 53 +- deal.II/include/deal.II/numerics/histogram.h | 21 +- .../include/deal.II/numerics/matrix_tools.h | 21 +- .../deal.II/numerics/point_value_history.h | 21 +- .../deal.II/numerics/solution_transfer.h | 21 +- .../include/deal.II/numerics/time_dependent.h | 21 +- .../include/deal.II/numerics/vector_tools.h | 587 +- .../deal.II/numerics/vector_tools.templates.h | 1851 ++--- deal.II/source/CMakeLists.txt | 39 +- deal.II/source/algorithms/CMakeLists.txt | 24 +- deal.II/source/algorithms/operator.cc | 22 +- deal.II/source/algorithms/operator.inst.in | 22 +- deal.II/source/algorithms/timestep_control.cc | 21 +- deal.II/source/base/CMakeLists.txt | 30 +- .../source/base/auto_derivative_function.cc | 22 +- deal.II/source/base/conditional_ostream.cc | 22 +- deal.II/source/base/config.cc | 22 +- deal.II/source/base/convergence_table.cc | 34 +- deal.II/source/base/data_out_base.cc | 1930 ++--- deal.II/source/base/dummy.cc | 9 - deal.II/source/base/event.cc | 22 +- deal.II/source/base/exceptions.cc | 22 +- deal.II/source/base/flow_function.cc | 22 +- deal.II/source/base/function.cc | 24 +- deal.II/source/base/function_derivative.cc | 22 +- deal.II/source/base/function_lib.cc | 21 +- deal.II/source/base/function_lib_cutoff.cc | 22 +- deal.II/source/base/function_parser.cc | 22 +- deal.II/source/base/function_time.cc | 22 +- deal.II/source/base/geometry_info.cc | 26 +- deal.II/source/base/index_set.cc | 24 +- deal.II/source/base/job_identifier.cc | 22 +- deal.II/source/base/logstream.cc | 110 +- deal.II/source/base/memory_consumption.cc | 22 +- deal.II/source/base/mpi.cc | 86 +- deal.II/source/base/multithread_info.cc | 28 +- deal.II/source/base/parallel.cc | 22 +- deal.II/source/base/parameter_handler.cc | 248 +- deal.II/source/base/parsed_function.cc | 22 +- deal.II/source/base/partitioner.cc | 88 +- deal.II/source/base/path_search.cc | 22 +- deal.II/source/base/polynomial.cc | 22 +- deal.II/source/base/polynomial_space.cc | 22 +- deal.II/source/base/polynomials_abf.cc | 22 +- deal.II/source/base/polynomials_adini.cc | 22 +- deal.II/source/base/polynomials_bdm.cc | 22 +- deal.II/source/base/polynomials_nedelec.cc | 16 + deal.II/source/base/polynomials_p.cc | 22 +- deal.II/source/base/polynomials_piecewise.cc | 24 +- .../source/base/polynomials_raviart_thomas.cc | 22 +- deal.II/source/base/quadrature.cc | 22 +- deal.II/source/base/quadrature_lib.cc | 22 +- deal.II/source/base/quadrature_selector.cc | 22 +- deal.II/source/base/subscriptor.cc | 40 +- deal.II/source/base/symmetric_tensor.cc | 22 +- deal.II/source/base/table_handler.cc | 119 +- deal.II/source/base/tensor_function.cc | 134 +- .../source/base/tensor_product_polynomials.cc | 24 +- .../base/tensor_product_polynomials_const.cc | 22 +- deal.II/source/base/thread_management.cc | 22 +- deal.II/source/base/timer.cc | 24 +- deal.II/source/base/utilities.cc | 22 +- deal.II/source/distributed/CMakeLists.txt | 27 +- deal.II/source/distributed/grid_refinement.cc | 22 +- .../distributed/grid_refinement.inst.in | 22 +- .../source/distributed/solution_transfer.cc | 22 +- .../distributed/solution_transfer.inst.in | 22 +- deal.II/source/distributed/tria.cc | 1389 ++-- deal.II/source/distributed/tria.inst.in | 22 +- deal.II/source/dofs/CMakeLists.txt | 35 +- deal.II/source/dofs/block_info.cc | 22 +- deal.II/source/dofs/block_info.inst.in | 22 +- deal.II/source/dofs/dof_accessor.cc | 200 +- deal.II/source/dofs/dof_accessor.inst.in | 101 +- deal.II/source/dofs/dof_accessor_get.cc | 125 + deal.II/source/dofs/dof_accessor_get.inst.in | 72 + deal.II/source/dofs/dof_accessor_set.cc | 93 + deal.II/source/dofs/dof_accessor_set.inst.in | 72 + deal.II/source/dofs/dof_faces.cc | 22 +- deal.II/source/dofs/dof_handler.cc | 24 +- deal.II/source/dofs/dof_handler.inst.in | 22 +- deal.II/source/dofs/dof_handler_policy.cc | 126 +- .../source/dofs/dof_handler_policy.inst.in | 22 +- deal.II/source/dofs/dof_objects.cc | 22 +- deal.II/source/dofs/dof_objects.inst.in | 22 +- deal.II/source/dofs/dof_renumbering.cc | 124 +- deal.II/source/dofs/dof_renumbering.inst.in | 22 +- deal.II/source/dofs/dof_tools.cc | 4019 +--------- deal.II/source/dofs/dof_tools.inst.in | 500 +- deal.II/source/dofs/dof_tools_constraints.cc | 2880 +++++++ .../source/dofs/dof_tools_constraints.inst.in | 155 + deal.II/source/dofs/dof_tools_sparsity.cc | 1179 +++ .../source/dofs/dof_tools_sparsity.inst.in | 323 + deal.II/source/dofs/number_cache.cc | 22 +- deal.II/source/dummy.cc | 25 + deal.II/source/fe/CMakeLists.txt | 33 +- deal.II/source/fe/block_mask.cc | 22 +- deal.II/source/fe/component_mask.cc | 22 +- deal.II/source/fe/fe.cc | 128 +- deal.II/source/fe/fe.inst.in | 22 +- deal.II/source/fe/fe_abf.cc | 22 +- deal.II/source/fe/fe_abf.inst.in | 22 +- deal.II/source/fe/fe_bdm.cc | 22 +- deal.II/source/fe/fe_bdm.inst.in | 22 +- deal.II/source/fe/fe_data.cc | 70 +- deal.II/source/fe/fe_dg_vector.cc | 21 +- deal.II/source/fe/fe_dg_vector.inst.in | 22 +- deal.II/source/fe/fe_dgp.cc | 71 +- deal.II/source/fe/fe_dgp.inst.in | 22 +- deal.II/source/fe/fe_dgp_monomial.cc | 22 +- deal.II/source/fe/fe_dgp_monomial.inst.in | 22 +- deal.II/source/fe/fe_dgp_nonparametric.cc | 22 +- .../source/fe/fe_dgp_nonparametric.inst.in | 22 +- deal.II/source/fe/fe_dgq.cc | 22 +- deal.II/source/fe/fe_dgq.inst.in | 22 +- deal.II/source/fe/fe_face.cc | 435 +- deal.II/source/fe/fe_face.inst.in | 25 +- deal.II/source/fe/fe_nedelec.cc | 30 +- deal.II/source/fe/fe_nedelec.inst.in | 22 +- deal.II/source/fe/fe_nothing.cc | 22 +- deal.II/source/fe/fe_nothing.inst.in | 22 +- deal.II/source/fe/fe_poly.cc | 22 +- deal.II/source/fe/fe_poly.inst.in | 22 +- deal.II/source/fe/fe_poly_tensor.cc | 110 +- deal.II/source/fe/fe_poly_tensor.inst.in | 22 +- deal.II/source/fe/fe_q.cc | 22 +- deal.II/source/fe/fe_q.inst.in | 22 +- deal.II/source/fe/fe_q_base.cc | 365 +- deal.II/source/fe/fe_q_base.inst.in | 22 +- deal.II/source/fe/fe_q_dg0.cc | 24 +- deal.II/source/fe/fe_q_dg0.inst.in | 22 +- deal.II/source/fe/fe_q_hierarchical.cc | 22 +- deal.II/source/fe/fe_q_hierarchical.inst.in | 22 +- deal.II/source/fe/fe_q_iso_q1.cc | 24 +- deal.II/source/fe/fe_q_iso_q1.inst.in | 22 +- deal.II/source/fe/fe_raviart_thomas.cc | 22 +- deal.II/source/fe/fe_raviart_thomas.inst.in | 22 +- deal.II/source/fe/fe_raviart_thomas_nodal.cc | 22 +- .../source/fe/fe_raviart_thomas_nodal.inst.in | 22 +- deal.II/source/fe/fe_system.cc | 122 +- deal.II/source/fe/fe_system.inst.in | 22 +- deal.II/source/fe/fe_tools.cc | 733 +- deal.II/source/fe/fe_tools.inst.in | 119 +- deal.II/source/fe/fe_tools_interpolate.cc | 761 ++ .../source/fe/fe_tools_interpolate.inst.in | 107 + deal.II/source/fe/fe_values.cc | 433 +- deal.II/source/fe/fe_values.decl.1.inst.in | 22 +- deal.II/source/fe/fe_values.decl.2.inst.in | 22 +- deal.II/source/fe/fe_values.impl.1.inst.in | 22 +- deal.II/source/fe/fe_values.impl.2.inst.in | 22 +- deal.II/source/fe/fe_values.inst.in | 138 +- deal.II/source/fe/fe_values_inst2.cc | 22 +- deal.II/source/fe/mapping.cc | 22 +- deal.II/source/fe/mapping.inst.in | 22 +- deal.II/source/fe/mapping_c1.cc | 136 +- deal.II/source/fe/mapping_c1.inst.in | 22 +- deal.II/source/fe/mapping_cartesian.cc | 22 +- deal.II/source/fe/mapping_cartesian.inst.in | 22 +- deal.II/source/fe/mapping_q.cc | 703 +- deal.II/source/fe/mapping_q.inst.in | 22 +- deal.II/source/fe/mapping_q1.cc | 24 +- deal.II/source/fe/mapping_q1.inst.in | 22 +- deal.II/source/fe/mapping_q1_eulerian.cc | 22 +- deal.II/source/fe/mapping_q1_eulerian.inst.in | 22 +- deal.II/source/fe/mapping_q_eulerian.cc | 103 +- deal.II/source/fe/mapping_q_eulerian.inst.in | 33 +- deal.II/source/grid/CMakeLists.txt | 27 +- deal.II/source/grid/grid_generator.cc | 6679 +++++++++-------- deal.II/source/grid/grid_generator.inst.in | 58 +- deal.II/source/grid/grid_in.cc | 22 +- deal.II/source/grid/grid_in.inst.in | 22 +- deal.II/source/grid/grid_out.cc | 180 +- deal.II/source/grid/grid_out.inst.in | 22 +- deal.II/source/grid/grid_refinement.cc | 22 +- deal.II/source/grid/grid_refinement.inst.in | 22 +- deal.II/source/grid/grid_reordering.cc | 22 +- deal.II/source/grid/grid_tools.cc | 366 +- deal.II/source/grid/grid_tools.inst.in | 117 +- deal.II/source/grid/intergrid_map.cc | 22 +- deal.II/source/grid/intergrid_map.inst.in | 22 +- deal.II/source/grid/persistent_tria.cc | 22 +- deal.II/source/grid/tria.cc | 92 +- deal.II/source/grid/tria.inst.in | 22 +- deal.II/source/grid/tria_accessor.cc | 22 +- deal.II/source/grid/tria_accessor.inst.in | 22 +- deal.II/source/grid/tria_boundary.cc | 114 +- deal.II/source/grid/tria_boundary.inst.in | 22 +- deal.II/source/grid/tria_boundary_lib.cc | 252 +- deal.II/source/grid/tria_boundary_lib.inst.in | 22 +- deal.II/source/grid/tria_faces.cc | 22 +- deal.II/source/grid/tria_levels.cc | 22 +- deal.II/source/grid/tria_objects.cc | 22 +- deal.II/source/grid/tria_objects.inst.in | 22 +- deal.II/source/hp/CMakeLists.txt | 30 +- deal.II/source/hp/dof_faces.cc | 56 +- deal.II/source/hp/dof_handler.cc | 311 +- deal.II/source/hp/dof_handler.inst.in | 22 +- deal.II/source/hp/dof_level.cc | 244 + deal.II/source/hp/dof_levels.cc | 61 - deal.II/source/hp/dof_objects.cc | 48 - deal.II/source/hp/fe_collection.cc | 22 +- deal.II/source/hp/fe_collection.inst.in | 22 +- deal.II/source/hp/fe_values.cc | 22 +- deal.II/source/hp/fe_values.inst.in | 22 +- deal.II/source/hp/mapping_collection.cc | 22 +- deal.II/source/hp/mapping_collection.inst.in | 22 +- deal.II/source/integrators/CMakeLists.txt | 22 +- deal.II/source/lac/CMakeLists.txt | 31 +- deal.II/source/lac/block_matrix_array.cc | 21 +- deal.II/source/lac/block_sparse_matrix.cc | 22 +- .../source/lac/block_sparse_matrix.inst.in | 16 + deal.II/source/lac/block_sparse_matrix_ez.cc | 22 +- deal.II/source/lac/block_sparsity_pattern.cc | 22 +- deal.II/source/lac/block_vector.cc | 22 +- deal.II/source/lac/block_vector.inst.in | 22 +- deal.II/source/lac/chunk_sparse_matrix.cc | 22 +- .../source/lac/chunk_sparse_matrix.inst.in | 22 +- deal.II/source/lac/chunk_sparsity_pattern.cc | 161 +- .../lac/compressed_set_sparsity_pattern.cc | 28 +- .../lac/compressed_simple_sparsity_pattern.cc | 37 +- .../source/lac/compressed_sparsity_pattern.cc | 28 +- deal.II/source/lac/constraint_matrix.cc | 85 +- deal.II/source/lac/constraint_matrix.inst.in | 16 + deal.II/source/lac/full_matrix.cc | 22 +- deal.II/source/lac/full_matrix.inst.in | 22 +- deal.II/source/lac/lapack_full_matrix.cc | 22 +- deal.II/source/lac/lapack_full_matrix.inst.in | 22 +- deal.II/source/lac/matrix_lib.cc | 22 +- deal.II/source/lac/matrix_out.cc | 22 +- deal.II/source/lac/parallel_vector.cc | 22 +- deal.II/source/lac/parallel_vector.inst.in | 22 +- .../source/lac/petsc_block_sparse_matrix.cc | 22 +- deal.II/source/lac/petsc_full_matrix.cc | 22 +- deal.II/source/lac/petsc_matrix_base.cc | 77 +- deal.II/source/lac/petsc_matrix_free.cc | 24 +- .../lac/petsc_parallel_block_sparse_matrix.cc | 73 +- .../source/lac/petsc_parallel_block_vector.cc | 24 +- .../lac/petsc_parallel_sparse_matrix.cc | 245 +- deal.II/source/lac/petsc_parallel_vector.cc | 106 +- deal.II/source/lac/petsc_precondition.cc | 22 +- deal.II/source/lac/petsc_solver.cc | 30 +- deal.II/source/lac/petsc_sparse_matrix.cc | 24 +- deal.II/source/lac/petsc_vector.cc | 22 +- deal.II/source/lac/petsc_vector_base.cc | 50 +- deal.II/source/lac/precondition_block.cc | 22 +- deal.II/source/lac/precondition_block.inst.in | 21 +- deal.II/source/lac/precondition_block_ez.cc | 22 +- deal.II/source/lac/relaxation_block.cc | 22 +- deal.II/source/lac/relaxation_block.inst.in | 21 +- deal.II/source/lac/slepc_solver.cc | 91 +- .../lac/slepc_spectral_transformation.cc | 30 +- deal.II/source/lac/solver.cc | 22 +- deal.II/source/lac/solver.inst.in | 22 +- deal.II/source/lac/solver_control.cc | 22 +- deal.II/source/lac/sparse_decomposition.cc | 22 +- deal.II/source/lac/sparse_direct.cc | 108 +- deal.II/source/lac/sparse_ilu.cc | 21 +- deal.II/source/lac/sparse_matrix.cc | 22 +- deal.II/source/lac/sparse_matrix.inst.in | 22 +- deal.II/source/lac/sparse_matrix_ez.cc | 22 +- deal.II/source/lac/sparse_matrix_ez.inst.in | 22 +- deal.II/source/lac/sparse_mic.cc | 22 +- deal.II/source/lac/sparse_vanka.cc | 22 +- deal.II/source/lac/sparsity_pattern.cc | 43 +- deal.II/source/lac/sparsity_tools.cc | 157 +- deal.II/source/lac/swappable_vector.cc | 22 +- deal.II/source/lac/tridiagonal_matrix.cc | 22 +- .../lac/trilinos_block_sparse_matrix.cc | 27 +- deal.II/source/lac/trilinos_block_vector.cc | 49 +- deal.II/source/lac/trilinos_precondition.cc | 74 +- deal.II/source/lac/trilinos_solver.cc | 195 +- deal.II/source/lac/trilinos_sparse_matrix.cc | 38 +- .../source/lac/trilinos_sparse_matrix.inst.in | 22 +- .../source/lac/trilinos_sparsity_pattern.cc | 88 +- deal.II/source/lac/trilinos_vector.cc | 58 +- deal.II/source/lac/trilinos_vector_base.cc | 34 +- .../source/lac/trilinos_vector_base.inst.in | 22 +- deal.II/source/lac/vector.cc | 22 +- deal.II/source/lac/vector.inst.in | 22 +- deal.II/source/lac/vector_memory.cc | 22 +- deal.II/source/lac/vector_memory.inst.in | 22 +- deal.II/source/lac/vector_view.cc | 22 +- deal.II/source/lac/vector_view.inst.in | 22 +- deal.II/source/matrix_free/CMakeLists.txt | 24 +- deal.II/source/matrix_free/matrix_free.cc | 22 +- .../source/matrix_free/matrix_free.inst.in | 22 +- deal.II/source/meshworker/CMakeLists.txt | 24 +- deal.II/source/meshworker/mesh_worker.cc | 57 +- deal.II/source/meshworker/mesh_worker_info.cc | 21 +- .../meshworker/mesh_worker_info.inst.in | 21 +- .../meshworker/mesh_worker_vector_selector.cc | 22 +- .../mesh_worker_vector_selector.inst.in | 23 +- deal.II/source/multigrid/CMakeLists.txt | 26 +- deal.II/source/multigrid/mg_base.cc | 22 +- deal.II/source/multigrid/mg_base.inst.in | 21 +- deal.II/source/multigrid/mg_dof_handler.cc | 22 +- .../source/multigrid/mg_dof_handler.inst.in | 22 +- deal.II/source/multigrid/mg_tools.cc | 314 +- deal.II/source/multigrid/mg_tools.inst.in | 21 +- deal.II/source/multigrid/mg_transfer_block.cc | 22 +- .../multigrid/mg_transfer_block.inst.in | 22 +- .../source/multigrid/mg_transfer_component.cc | 22 +- .../multigrid/mg_transfer_component.inst.in | 22 +- .../source/multigrid/mg_transfer_prebuilt.cc | 105 +- .../multigrid/mg_transfer_prebuilt.inst.in | 21 +- deal.II/source/multigrid/multigrid.cc | 22 +- deal.II/source/multigrid/multigrid.inst.in | 21 +- deal.II/source/numerics/CMakeLists.txt | 53 +- deal.II/source/numerics/data_out.cc | 1035 +-- deal.II/source/numerics/data_out.inst.in | 249 +- deal.II/source/numerics/data_out_dof_data.cc | 1146 +++ .../source/numerics/data_out_dof_data.inst.in | 428 ++ deal.II/source/numerics/data_out_faces.cc | 213 +- .../source/numerics/data_out_faces.inst.in | 22 +- deal.II/source/numerics/data_out_rotation.cc | 154 +- .../source/numerics/data_out_rotation.inst.in | 22 +- deal.II/source/numerics/data_out_stack.cc | 22 +- .../source/numerics/data_out_stack.inst.in | 22 +- deal.II/source/numerics/data_postprocessor.cc | 22 +- .../numerics/data_postprocessor.inst.in | 22 +- .../numerics/derivative_approximation.cc | 22 +- .../numerics/derivative_approximation.inst.in | 22 +- .../source/numerics/dof_output_operator.cc | 22 +- .../numerics/dof_output_operator.inst.in | 22 +- deal.II/source/numerics/error_estimator.cc | 1117 +-- .../source/numerics/error_estimator.inst.in | 24 +- deal.II/source/numerics/error_estimator_1d.cc | 439 ++ .../numerics/error_estimator_1d.inst.in | 143 + deal.II/source/numerics/fe_field_function.cc | 22 +- .../source/numerics/fe_field_function.inst.in | 21 +- deal.II/source/numerics/histogram.cc | 29 +- deal.II/source/numerics/matrix_tools.cc | 28 +- deal.II/source/numerics/matrix_tools.inst.in | 156 +- .../source/numerics/point_value_history.cc | 22 +- .../numerics/point_value_history.inst.in | 22 +- deal.II/source/numerics/solution_transfer.cc | 105 +- .../source/numerics/solution_transfer.inst.in | 25 +- .../numerics/solution_transfer_inst2.cc | 27 +- .../numerics/solution_transfer_inst3.cc | 23 + .../numerics/solution_transfer_inst4.cc | 23 + deal.II/source/numerics/time_dependent.cc | 26 +- .../source/numerics/time_dependent.inst.in | 22 +- deal.II/source/numerics/vector_tools.cc | 21 - deal.II/source/numerics/vector_tools.inst.in | 655 -- .../source/numerics/vector_tools_boundary.cc | 25 + .../numerics/vector_tools_boundary.inst.in | 186 + .../numerics/vector_tools_constraints.cc | 25 + .../numerics/vector_tools_constraints.inst.in | 58 + .../vector_tools_integrate_difference.cc | 25 + .../vector_tools_integrate_difference.inst.in | 117 + .../numerics/vector_tools_interpolate.cc | 25 + .../numerics/vector_tools_interpolate.inst.in | 124 + .../numerics/vector_tools_mean_value.cc | 25 + .../numerics/vector_tools_mean_value.inst.in | 50 + .../numerics/vector_tools_point_value.cc | 25 + .../numerics/vector_tools_point_value.inst.in | 165 + .../source/numerics/vector_tools_project.cc | 25 + .../numerics/vector_tools_project.inst.in | 70 + deal.II/source/numerics/vector_tools_rhs.cc | 86 + .../source/numerics/vector_tools_rhs.inst.in | 108 + 1083 files changed, 54656 insertions(+), 39785 deletions(-) delete mode 100644 deal.II/cmake/TODO.CMAKE create mode 100644 deal.II/cmake/configure/configure_2_metis.cmake rename deal.II/cmake/configure/{configure_petsc.cmake => configure_2_petsc.cmake} (86%) rename deal.II/cmake/configure/{configure_trilinos.cmake => configure_2_trilinos.cmake} (69%) delete mode 100644 deal.II/cmake/configure/configure_metis.cmake create mode 100644 deal.II/cmake/macros/macro_clear_cmake_required.cmake create mode 100644 deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake create mode 100644 deal.II/cmake/macros/macro_enable_language_optional.cmake create mode 100644 deal.II/cmake/macros/macro_reset_cmake_required.cmake delete mode 100644 deal.II/cmake/macros/macro_split_debug_release.cmake create mode 100644 deal.II/cmake/macros/macro_switch_library_preference.cmake create mode 100644 deal.II/cmake/modules/FindDEALII_LAPACK.cmake delete mode 100644 deal.II/cmake/setup_custom_targets.cmake create mode 100644 deal.II/cmake/setup_post_project_call.cmake create mode 100644 deal.II/contrib/test_affinity/CMakeLists.txt create mode 100644 deal.II/contrib/test_affinity/test_affinity.cc rename deal.II/doc/{development => developers}/Toolchain.sample (100%) rename deal.II/doc/{development => developers}/cmake-internals.html (57%) rename deal.II/doc/{development => developers}/indentation.html (73%) rename deal.II/doc/{development => developers}/index.html (83%) rename deal.II/doc/{development => developers}/navbar.html (51%) rename deal.II/doc/{development => developers}/porting.html (90%) rename deal.II/doc/{development => developers}/svn.html (86%) rename deal.II/doc/{development => developers}/testsuite.html (93%) rename deal.II/doc/{development => developers}/title.html (94%) rename deal.II/doc/{development => developers}/toc.html (60%) rename deal.II/doc/{development => developers}/writing-documentation.html (96%) delete mode 100644 deal.II/doc/development/CMakeLists.txt.sample delete mode 100644 deal.II/doc/development/cmakelists.html create mode 100644 deal.II/doc/license/adjust.pl create mode 100644 deal.II/doc/license/header-template.cmake create mode 100755 deal.II/doc/license/replace.sh create mode 100644 deal.II/doc/news/7.3.0-vs-8.0.0.h create mode 100644 deal.II/doc/reports/index.html create mode 100644 deal.II/doc/users/CMakeLists.txt.sample create mode 100644 deal.II/doc/users/CMakeLists.txt.sample2 create mode 100644 deal.II/doc/users/CMakeLists.txt.sample3 rename deal.II/doc/{development => users}/Config.sample (89%) rename deal.II/doc/{development => users}/cmake.html (84%) create mode 100644 deal.II/doc/users/cmakelists.html rename deal.II/doc/{development => users}/doxygen.html (78%) create mode 100644 deal.II/doc/users/index.html create mode 100644 deal.II/doc/users/navbar.html create mode 100644 deal.II/doc/users/title.html create mode 100644 deal.II/doc/users/toc.html delete mode 100644 deal.II/examples/step-42/doc/intro-step-42.tex delete mode 100644 deal.II/examples/step-42/doc/step-42-CellConstitution.png delete mode 100644 deal.II/examples/step-42/doc/step-42-CellConstitutionBall.png delete mode 100644 deal.II/examples/step-42/doc/step-42-CellConstitutionBall2.png delete mode 100644 deal.II/examples/step-42/doc/step-42-CellConstitutionColorbar.png delete mode 100644 deal.II/examples/step-42/doc/step-42-CellConstitutionLi2.png create mode 100644 deal.II/examples/step-42/p1_adaptive.prm create mode 100644 deal.II/examples/step-42/p1_chinese.prm create mode 100644 deal.II/examples/step-42/p1_global.prm create mode 100644 deal.II/examples/step-42/p2_adaptive.prm create mode 100644 deal.II/examples/step-42/p2_global.prm create mode 100644 deal.II/examples/step-51/CMakeLists.txt create mode 100644 deal.II/examples/step-51/doc/builds-on create mode 100644 deal.II/examples/step-51/doc/intro.dox create mode 100644 deal.II/examples/step-51/doc/kind create mode 100644 deal.II/examples/step-51/doc/results.dox create mode 100644 deal.II/examples/step-51/doc/tooltip create mode 100644 deal.II/examples/step-51/step-51.cc create mode 100644 deal.II/include/deal.II/base/graph_coloring.h create mode 100644 deal.II/include/deal.II/grid/cell_id.h create mode 100644 deal.II/include/deal.II/hp/dof_level.h delete mode 100644 deal.II/include/deal.II/hp/dof_levels.h delete mode 100644 deal.II/include/deal.II/hp/dof_objects.h create mode 100644 deal.II/include/deal.II/lac/generic_linear_algebra.h create mode 100644 deal.II/include/deal.II/multigrid/sparse_matrix_collection.h create mode 100644 deal.II/include/deal.II/numerics/data_out_dof_data.h delete mode 100644 deal.II/source/base/dummy.cc create mode 100644 deal.II/source/dofs/dof_accessor_get.cc create mode 100644 deal.II/source/dofs/dof_accessor_get.inst.in create mode 100644 deal.II/source/dofs/dof_accessor_set.cc create mode 100644 deal.II/source/dofs/dof_accessor_set.inst.in create mode 100644 deal.II/source/dofs/dof_tools_constraints.cc create mode 100644 deal.II/source/dofs/dof_tools_constraints.inst.in create mode 100644 deal.II/source/dofs/dof_tools_sparsity.cc create mode 100644 deal.II/source/dofs/dof_tools_sparsity.inst.in create mode 100644 deal.II/source/dummy.cc create mode 100644 deal.II/source/fe/fe_tools_interpolate.cc create mode 100644 deal.II/source/fe/fe_tools_interpolate.inst.in create mode 100644 deal.II/source/hp/dof_level.cc delete mode 100644 deal.II/source/hp/dof_levels.cc delete mode 100644 deal.II/source/hp/dof_objects.cc create mode 100644 deal.II/source/numerics/data_out_dof_data.cc create mode 100644 deal.II/source/numerics/data_out_dof_data.inst.in create mode 100644 deal.II/source/numerics/error_estimator_1d.cc create mode 100644 deal.II/source/numerics/error_estimator_1d.inst.in create mode 100644 deal.II/source/numerics/solution_transfer_inst3.cc create mode 100644 deal.II/source/numerics/solution_transfer_inst4.cc delete mode 100644 deal.II/source/numerics/vector_tools.cc delete mode 100644 deal.II/source/numerics/vector_tools.inst.in create mode 100644 deal.II/source/numerics/vector_tools_boundary.cc create mode 100644 deal.II/source/numerics/vector_tools_boundary.inst.in create mode 100644 deal.II/source/numerics/vector_tools_constraints.cc create mode 100644 deal.II/source/numerics/vector_tools_constraints.inst.in create mode 100644 deal.II/source/numerics/vector_tools_integrate_difference.cc create mode 100644 deal.II/source/numerics/vector_tools_integrate_difference.inst.in create mode 100644 deal.II/source/numerics/vector_tools_interpolate.cc create mode 100644 deal.II/source/numerics/vector_tools_interpolate.inst.in create mode 100644 deal.II/source/numerics/vector_tools_mean_value.cc create mode 100644 deal.II/source/numerics/vector_tools_mean_value.inst.in create mode 100644 deal.II/source/numerics/vector_tools_point_value.cc create mode 100644 deal.II/source/numerics/vector_tools_point_value.inst.in create mode 100644 deal.II/source/numerics/vector_tools_project.cc create mode 100644 deal.II/source/numerics/vector_tools_project.inst.in create mode 100644 deal.II/source/numerics/vector_tools_rhs.cc create mode 100644 deal.II/source/numerics/vector_tools_rhs.inst.in diff --git a/deal.II/CMakeLists.txt b/deal.II/CMakeLists.txt index b665897d70..714613a8c7 100644 --- a/deal.II/CMakeLists.txt +++ b/deal.II/CMakeLists.txt @@ -1,30 +1,32 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- -## ## -# The cmake build system for the deal.II project # -# # -# See doc/readme.html and doc/development/cmake.html for further # -# details on how to use the cmake build system of deal.II. # -## ## +## ## +# The cmake build system for the deal.II project # +# # +# See doc/readme.html and doc/development/cmake.html for further # +# details on how to use the cmake build system of deal.II. # +## ## -########################################################################### -# # -# Configuration: # -# # -########################################################################### +######################################################################## +# # +# Configuration: # +# # +######################################################################## # # General configuration for cmake: @@ -47,7 +49,7 @@ FOREACH(_file ${_macro_files}) ENDFOREACH() # -# Check whether the doc and bundled folders are available: +# Check for the existence of various optional folders: # IF(EXISTS ${CMAKE_SOURCE_DIR}/bundled/CMakeLists.txt) SET(DEAL_II_HAVE_BUNDLED_DIRECTORY TRUE) @@ -57,6 +59,14 @@ IF(EXISTS ${CMAKE_SOURCE_DIR}/doc/CMakeLists.txt) SET(DEAL_II_HAVE_DOC_DIRECTORY TRUE) ENDIF() +IF(NOT DEFINED TEST_DIR) + GET_FILENAME_COMPONENT(TEST_DIR "${CMAKE_SOURCE_DIR}" PATH) + SET(TEST_DIR "${TEST_DIR}/tests") +ENDIF() +IF(EXISTS ${TEST_DIR}/CMakeLists.txt) + SET(DEAL_II_HAVE_TESTS_DIRECTORY TRUE) +ENDIF() + # # We have to initialize some cached variables before PROJECT is called, so # do it at this point: @@ -66,7 +76,12 @@ INCLUDE(setup_cached_variables) # # Now, set the project and set up the rest: # -PROJECT(deal.II) +PROJECT(deal.II CXX) +ENABLE_LANGUAGE_OPTIONAL(C) +ENABLE_LANGUAGE_OPTIONAL(Fortran) + +INCLUDE(setup_post_project_call) + INCLUDE(setup_deal_ii) INCLUDE(setup_compiler_flags) @@ -105,11 +120,11 @@ ENDFOREACH() INCLUDE(setup_finalize) -########################################################################### -# # -# Compilation and installation: # -# # -########################################################################### +######################################################################## +# # +# Compilation and installation: # +# # +######################################################################## MESSAGE(STATUS "") MESSAGE(STATUS "Configuring done. Proceed to target definitions now.") @@ -130,10 +145,9 @@ ADD_SUBDIRECTORY(cmake/config) # has to be included after source ADD_SUBDIRECTORY(contrib) # has to be included after source ADD_SUBDIRECTORY(examples) -# -# Define some custom targets for convenience -# -INCLUDE(setup_custom_targets) +IF(DEAL_II_HAVE_TESTS_DIRECTORY) + ADD_SUBDIRECTORY(${TEST_DIR} ${CMAKE_BINARY_DIR}/tests) +ENDIF() # # And finally, print the configuration: diff --git a/deal.II/LICENSE b/deal.II/LICENSE index 2d1d7b4a83..8b89d07dc6 100644 --- a/deal.II/LICENSE +++ b/deal.II/LICENSE @@ -477,47 +477,3 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/deal.II/VERSION b/deal.II/VERSION index 941ceb5b07..091a617214 100644 --- a/deal.II/VERSION +++ b/deal.II/VERSION @@ -1 +1 @@ -8.0.pre +8.1.pre diff --git a/deal.II/bundled/CMakeLists.txt b/deal.II/bundled/CMakeLists.txt index 44418f02d4..897b4632e1 100644 --- a/deal.II/bundled/CMakeLists.txt +++ b/deal.II/bundled/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Export information about bundled library locations and do the actual @@ -33,6 +35,9 @@ IF(FEATURE_BOOST_BUNDLED_CONFIGURED) COMPONENT library PATTERN ".svn" EXCLUDE ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes + "${BOOST_FOLDER}/include\n" + ) ADD_SUBDIRECTORY(${BOOST_FOLDER}/libs/serialization/src) @@ -66,9 +71,10 @@ ENDIF() # # Threading Building Blocks library # -IF(NOT CMAKE_SYSTEM_NAME MATCHES "CYGWIN") +IF(NOT CMAKE_SYSTEM_NAME MATCHES "CYGWIN" + AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows") # - # Cygwin is unsupported by tbb + # Cygwin is unsupported by tbb, Windows due to the way we compile tbb... # SET(FEATURE_THREADS_HAVE_BUNDLED TRUE) OPTION(DEAL_II_FORCE_BUNDLED_THREADS @@ -85,6 +91,9 @@ IF(FEATURE_THREADS_BUNDLED_CONFIGURED) FILES_MATCHING PATTERN "*.h" PATTERN ".svn" EXCLUDE ) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes + "${TBB_FOLDER}/include\n" + ) ADD_SUBDIRECTORY(${TBB_FOLDER}/src) ENDIF() diff --git a/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp b/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp index 8f9b94a5cd..e1cd851940 100644 --- a/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp +++ b/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple.hpp @@ -18,4 +18,4 @@ #include #else #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers" -#endif \ No newline at end of file +#endif diff --git a/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp b/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp index ec01d4b7fd..234936c587 100644 --- a/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp +++ b/deal.II/bundled/boost-1.49.0/include/boost/fusion/tuple/detail/preprocessed/tuple_fwd.hpp @@ -18,4 +18,4 @@ #include #else #error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers" -#endif \ No newline at end of file +#endif diff --git a/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp b/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp index 3e2357b8e8..2e7be17839 100644 --- a/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp +++ b/deal.II/bundled/boost-1.49.0/include/boost/signals2/detail/foreign_ptr.hpp @@ -18,14 +18,6 @@ #include #include -#if !defined(BOOST_INTEL_STDCXX0X) -namespace std -{ - template class shared_ptr; - template class weak_ptr; -} -#endif - namespace boost { template class shared_ptr; @@ -39,10 +31,20 @@ namespace boost { typedef boost::shared_ptr shared_type; }; + +// Workaround for a bug in boost: +// https://svn.boost.org/trac/boost/ticket/6655 +// +// It should be safe to depend on DEAL macros at this point as this header +// should only be used by deal.II and dependent projects... +// +// - Maier, 2013 +#ifdef DEAL_II_CAN_USE_CXX11 template struct weak_ptr_traits > { typedef std::shared_ptr shared_type; }; +#endif template struct shared_ptr_traits {}; @@ -51,10 +53,13 @@ namespace boost { typedef boost::weak_ptr weak_type; }; +// as above +#ifdef DEAL_II_CAN_USE_CXX11 template struct shared_ptr_traits > { typedef std::weak_ptr weak_type; }; +#endif namespace detail { diff --git a/deal.II/bundled/boost-1.49.0/include/boost/thread/xtime.hpp b/deal.II/bundled/boost-1.49.0/include/boost/thread/xtime.hpp index 7cc6272d6a..f908298647 100644 --- a/deal.II/bundled/boost-1.49.0/include/boost/thread/xtime.hpp +++ b/deal.II/bundled/boost-1.49.0/include/boost/thread/xtime.hpp @@ -20,7 +20,7 @@ namespace boost { enum xtime_clock_types { - TIME_UTC=1 + TIME_UTC_=1 // TIME_TAI, // TIME_MONOTONIC, // TIME_PROCESS, @@ -68,7 +68,7 @@ inline xtime get_xtime(boost::system_time const& abs_time) inline int xtime_get(struct xtime* xtp, int clock_type) { - if (clock_type == TIME_UTC) + if (clock_type == TIME_UTC_) { *xtp=get_xtime(get_system_time()); return clock_type; diff --git a/deal.II/bundled/boost-1.49.0/libs/serialization/src/CMakeLists.txt b/deal.II/bundled/boost-1.49.0/libs/serialization/src/CMakeLists.txt index 3daeece5c4..b06ba8bd6e 100644 --- a/deal.II/bundled/boost-1.49.0/libs/serialization/src/CMakeLists.txt +++ b/deal.II/bundled/boost-1.49.0/libs/serialization/src/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- SET(src_boost_serialization basic_archive.cpp diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/example/starvephil.cpp b/deal.II/bundled/boost-1.49.0/libs/thread/example/starvephil.cpp index 0ef2e0d32d..b37c503498 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/example/starvephil.cpp +++ b/deal.II/bundled/boost-1.49.0/libs/thread/example/starvephil.cpp @@ -50,7 +50,7 @@ public: << "very hot ..." << std::endl; } boost::xtime xt; - boost::xtime_get(&xt, boost::TIME_UTC); + boost::xtime_get(&xt, boost::TIME_UTC_); xt.sec += 3; boost::thread::sleep(xt); m_chickens += value; @@ -85,7 +85,7 @@ void chef() std::cout << "(" << clock() << ") Chef: cooking ..." << std::endl; } boost::xtime xt; - boost::xtime_get(&xt, boost::TIME_UTC); + boost::xtime_get(&xt, boost::TIME_UTC_); xt.sec += 2; boost::thread::sleep(xt); { @@ -111,7 +111,7 @@ struct phil if (m_id > 0) { boost::xtime xt; - boost::xtime_get(&xt, boost::TIME_UTC); + boost::xtime_get(&xt, boost::TIME_UTC_); xt.sec += 3; boost::thread::sleep(xt); } diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/example/tennis.cpp b/deal.II/bundled/boost-1.49.0/libs/thread/example/tennis.cpp index 798f55e5d8..621d0891ce 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/example/tennis.cpp +++ b/deal.II/bundled/boost-1.49.0/libs/thread/example/tennis.cpp @@ -104,7 +104,7 @@ int main(int argc, char* argv[]) boost::thread thrdb(thread_adapter(&player, (void*)PLAYER_B)); boost::xtime xt; - boost::xtime_get(&xt, boost::TIME_UTC); + boost::xtime_get(&xt, boost::TIME_UTC_); xt.sec += 1; boost::thread::sleep(xt); { diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/example/thread.cpp b/deal.II/bundled/boost-1.49.0/libs/thread/example/thread.cpp index c21a3b5ea8..09aa05a0cd 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/example/thread.cpp +++ b/deal.II/bundled/boost-1.49.0/libs/thread/example/thread.cpp @@ -14,7 +14,7 @@ struct thread_alarm void operator()() { boost::xtime xt; - boost::xtime_get(&xt, boost::TIME_UTC); + boost::xtime_get(&xt, boost::TIME_UTC_); xt.sec += m_secs; boost::thread::sleep(xt); diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/example/xtime.cpp b/deal.II/bundled/boost-1.49.0/libs/thread/example/xtime.cpp index a9b1933908..0c4fb7150d 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/example/xtime.cpp +++ b/deal.II/bundled/boost-1.49.0/libs/thread/example/xtime.cpp @@ -10,7 +10,7 @@ int main(int argc, char* argv[]) { boost::xtime xt; - boost::xtime_get(&xt, boost::TIME_UTC); + boost::xtime_get(&xt, boost::TIME_UTC_); xt.sec += 1; boost::thread::sleep(xt); // Sleep for 1 second } diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/src/CMakeLists.txt b/deal.II/bundled/boost-1.49.0/libs/thread/src/CMakeLists.txt index 7a87dfb931..2e3eb8839f 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/src/CMakeLists.txt +++ b/deal.II/bundled/boost-1.49.0/libs/thread/src/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- IF(DEAL_II_USE_MT_POSIX) SET(src_boost_thread diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/thread.cpp b/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/thread.cpp index 07b8458bce..847662b90f 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/thread.cpp +++ b/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/thread.cpp @@ -354,7 +354,7 @@ namespace boost cond.timed_wait(lock, xt); # endif xtime cur; - xtime_get(&cur, TIME_UTC); + xtime_get(&cur, TIME_UTC_); if (xtime_cmp(xt, cur) <= 0) return; } @@ -369,7 +369,7 @@ namespace boost BOOST_VERIFY(!pthread_yield()); # else xtime xt; - xtime_get(&xt, TIME_UTC); + xtime_get(&xt, TIME_UTC_); sleep(xt); # endif } diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/timeconv.inl b/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/timeconv.inl index 1c0a0cdca8..cab7c55a78 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/timeconv.inl +++ b/deal.II/bundled/boost-1.49.0/libs/thread/src/pthread/timeconv.inl @@ -20,8 +20,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000; inline void to_time(int milliseconds, boost::xtime& xt) { int res = 0; - res = boost::xtime_get(&xt, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); (void)res; + res = boost::xtime_get(&xt, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; xt.sec += (milliseconds / MILLISECONDS_PER_SECOND); xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) * @@ -56,8 +56,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); (void)res; + res = boost::xtime_get(&cur, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; if (boost::xtime_cmp(xt, cur) <= 0) { @@ -87,8 +87,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); (void)res; + res = boost::xtime_get(&cur, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; if (boost::xtime_cmp(xt, cur) <= 0) milliseconds = 0; @@ -109,8 +109,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); (void)res; + res = boost::xtime_get(&cur, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; if (boost::xtime_cmp(xt, cur) <= 0) microseconds = 0; diff --git a/deal.II/bundled/boost-1.49.0/libs/thread/src/win32/timeconv.inl b/deal.II/bundled/boost-1.49.0/libs/thread/src/win32/timeconv.inl index 5ec3b1798a..c6467832a7 100644 --- a/deal.II/bundled/boost-1.49.0/libs/thread/src/win32/timeconv.inl +++ b/deal.II/bundled/boost-1.49.0/libs/thread/src/win32/timeconv.inl @@ -17,8 +17,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000; inline void to_time(int milliseconds, boost::xtime& xt) { int res = 0; - res = boost::xtime_get(&xt, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&xt, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); xt.sec += (milliseconds / MILLISECONDS_PER_SECOND); xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) * @@ -54,8 +54,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); if (boost::xtime_cmp(xt, cur) <= 0) { @@ -85,8 +85,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); if (boost::xtime_cmp(xt, cur) <= 0) milliseconds = 0; @@ -107,8 +107,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); if (boost::xtime_cmp(xt, cur) <= 0) microseconds = 0; diff --git a/deal.II/bundled/functionparser/CMakeLists.txt b/deal.II/bundled/functionparser/CMakeLists.txt index 45afe46683..9fb68b95dc 100644 --- a/deal.II/bundled/functionparser/CMakeLists.txt +++ b/deal.II/bundled/functionparser/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Remove -Wall and -pedantic from CMAKE_CXX_FLAGS (in directory scope) to diff --git a/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt b/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt index 3d5aa530b7..1551dc14de 100644 --- a/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt +++ b/deal.II/bundled/tbb41_20130401oss/src/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Remove -Wall and -pedantic from CMAKE_CXX_FLAGS (in directory scope) to diff --git a/deal.II/bundled/umfpack/AMD/Source/CMakeLists.txt b/deal.II/bundled/umfpack/AMD/Source/CMakeLists.txt index 9739fd4fe4..5f3231de01 100644 --- a/deal.II/bundled/umfpack/AMD/Source/CMakeLists.txt +++ b/deal.II/bundled/umfpack/AMD/Source/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- SET(src_amd amd_1.cc diff --git a/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt b/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt index a413a24709..4761b3c041 100644 --- a/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt +++ b/deal.II/bundled/umfpack/UMFPACK/Source/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Logic copied from the distributed UMFPACK Makefile. diff --git a/deal.II/cmake/TODO.CMAKE b/deal.II/cmake/TODO.CMAKE deleted file mode 100644 index 944e639e52..0000000000 --- a/deal.II/cmake/TODO.CMAKE +++ /dev/null @@ -1,7 +0,0 @@ -Some last bits and thoughts: - -* A TECPLOT feature has to be written - -* Support debug;optimized;general for all FEATURES - -* document that we no longer need the two-lib installation of p4est diff --git a/deal.II/cmake/checks/check_01_compiler_features.cmake b/deal.II/cmake/checks/check_01_compiler_features.cmake index 17063b529e..c6678d6367 100644 --- a/deal.II/cmake/checks/check_01_compiler_features.cmake +++ b/deal.II/cmake/checks/check_01_compiler_features.cmake @@ -1,20 +1,24 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -##### +## --------------------------------------------------------------------- -########################################################################### -# # -# Check for various compiler features: # -# # -########################################################################### +######################################################################## +# # +# Check for various compiler features: # +# # +######################################################################## # # This file sets up: @@ -148,8 +152,8 @@ CHECK_CXX_SOURCE_COMPILES( " HAVE_GLIBC_STACKTRACE) -IF(HAVE_GLIBC_STACKTRACE) - ENABLE_IF_SUPPORTED(CMAKE_SHARED_LINKER_FLAGS "-rdynamic") +IF(HAVE_GLIBC_STACKTRACE AND NOT DEAL_II_STATIC_EXECUTABLE) + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-rdynamic") ENDIF() diff --git a/deal.II/cmake/checks/check_01_cpu_features.cmake b/deal.II/cmake/checks/check_01_cpu_features.cmake index 81ac8f6a2e..9639b89497 100644 --- a/deal.II/cmake/checks/check_01_cpu_features.cmake +++ b/deal.II/cmake/checks/check_01_cpu_features.cmake @@ -1,23 +1,25 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- -########################################################################### -# # -# Platform and CPU specific tests: # -# # -########################################################################### +######################################################################## +# # +# Platform and CPU specific tests: # +# # +######################################################################## # # This file sets up @@ -37,19 +39,21 @@ # # Determine the Endianess of the platform: # -INCLUDE(TestBigEndian) -TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN) - - -IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) +IF(CMAKE_C_COMPILER_WORKS) + INCLUDE(TestBigEndian) - # - # These tests depend on certain cpu instruction sets being enabled, so - # use the user supplied compiler flags for the tests as well: - # - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS_SAVED}") + CLEAR_CMAKE_REQUIRED() + TEST_BIG_ENDIAN(DEAL_II_WORDS_BIGENDIAN) + RESET_CMAKE_REQUIRED() +ELSE() + MESSAGE(STATUS + "No suitable C compiler was found! Assuming little endian platform." + ) + SET(DEAL_II_WORDS_BIGENDIAN "0") +ENDIF() +IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) # # Take care that the following tests are rerun if CMAKE_REQUIRED_FLAGS # changes.. @@ -135,10 +139,9 @@ IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) } " DEAL_II_HAVE_AVX) - - SET(CMAKE_REQUIRED_FLAGS "") ENDIF() + IF(DEAL_II_HAVE_SSE2) IF(DEAL_II_HAVE_AVX) SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 2) @@ -148,4 +151,3 @@ IF(DEAL_II_HAVE_SSE2) ELSE() SET(DEAL_II_COMPILER_VECTORIZATION_LEVEL 0) ENDIF() - diff --git a/deal.II/cmake/checks/check_01_cxx_features.cmake b/deal.II/cmake/checks/check_01_cxx_features.cmake index 374d296e36..7fcf064bfb 100644 --- a/deal.II/cmake/checks/check_01_cxx_features.cmake +++ b/deal.II/cmake/checks/check_01_cxx_features.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Check for various C++ language features @@ -26,11 +28,11 @@ # -########################################################################### -# # -# C++11 Support: # -# # -########################################################################### +######################################################################## +# # +# C++11 Support: # +# # +######################################################################## # # See if there is a compiler flag to enable C++11 features @@ -219,11 +221,11 @@ ELSE() ENDIF() -########################################################################### -# # -# Check for various C++ features: # -# # -########################################################################### +######################################################################## +# # +# Check for various C++ features: # +# # +######################################################################## CHECK_CXX_SOURCE_COMPILES( " diff --git a/deal.II/cmake/checks/check_02_system_features.cmake b/deal.II/cmake/checks/check_02_system_features.cmake index 4288bff50b..22e6a8a88b 100644 --- a/deal.II/cmake/checks/check_02_system_features.cmake +++ b/deal.II/cmake/checks/check_02_system_features.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # This file sets up: @@ -29,11 +31,11 @@ # -########################################################################### -# # -# POSIX and Linux specific tests: # -# # -########################################################################### +######################################################################## +# # +# POSIX and Linux specific tests: # +# # +######################################################################## # # Check for various posix (and linux) specific header files and symbols @@ -56,24 +58,30 @@ CHECK_CXX_SYMBOL_EXISTS("rand_r" "stdlib.h" HAVE_RAND_R) # # Do we have the Bessel function jn? # -FIND_LIBRARY(m_lib NAMES m) -MARK_AS_ADVANCED(m_lib) +# Switch the library preference back to prefer dynamic libraries if +# DEAL_II_PREFER_STATIC_LIBS=TRUE but DEAL_II_STATIC_EXECUTABLE=FALSE. In +# this case system libraries should be linked dynamically. +# +SWITCH_LIBRARY_PREFERENCE() +FIND_LIBRARY(m_LIBRARY NAMES m) +SWITCH_LIBRARY_PREFERENCE() +MARK_AS_ADVANCED(m_LIBRARY) -IF(NOT m_lib MATCHES "-NOTFOUND") - SET(CMAKE_REQUIRED_LIBRARIES ${m_lib}) +IF(NOT m_LIBRARY MATCHES "-NOTFOUND") + LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${m_LIBRARY}) CHECK_CXX_SYMBOL_EXISTS("jn" "math.h" HAVE_JN) - SET(CMAKE_REQUIRED_LIBRARIES) + RESET_CMAKE_REQUIRED() IF(HAVE_JN) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${m_lib}) + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${m_LIBRARY}) ENDIF() ENDIF() -########################################################################### -# # -# Mac OSX specific setup: # -# # -########################################################################### +######################################################################## +# # +# Mac OSX specific setup: # +# # +######################################################################## IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") # @@ -90,16 +98,16 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") # # TODO: MM: Check whether this is still necessary... # - STRIP_FLAG(CMAKE_SHARED_LINKER_FLAGS "-rdynamic") + STRIP_FLAG(DEAL_II_LINKER_FLAGS "-rdynamic") ENDIF() -########################################################################### -# # -# Windows and CYGWIN specific setup: # -# # -########################################################################### +######################################################################## +# # +# Windows and CYGWIN specific setup: # +# # +######################################################################## IF(CMAKE_SYSTEM_NAME MATCHES "Windows") # @@ -108,12 +116,32 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Windows") SET(DEAL_II_MSVC TRUE) # - # Disable shared libraries on native Windows targets for the moment. + # Shared library handling: # - MESSAGE(WARNING "\n" - "BUILD_SHARED_LIBS forced to OFF\n\n" - ) - SET(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + # + # With MinGW we're lucky: + # + ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--export-all-symbols") + ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--enable-auto-import") + ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--allow-multiple-definition") + + # + # Workaround for a miscompilation and linkage issue with shared libraries + # with MinGW. Replacing -O0 with -O1 seems to help.. + # + REPLACE_FLAG(DEAL_II_CXX_FLAGS_DEBUG "-O0" "-O1") + + ELSE() + + # + # Otherwise disable shared libraries: + # + MESSAGE(WARNING "\n" + "BUILD_SHARED_LIBS forced to OFF\n\n" + ) + SET(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + ENDIF() # # Disable -ggdb and -g on Windows/MinGW targets for the moment until the @@ -122,11 +150,12 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Windows") # - Matthias Maier, 2012 # STRIP_FLAG(DEAL_II_CXX_FLAGS_DEBUG "-ggdb") - STRIP_FLAG(DEAL_II_SHARED_LINKER_FLAGS_DEBUG "-ggdb") + STRIP_FLAG(DEAL_II_LINKER_FLAGS_DEBUG "-ggdb") STRIP_FLAG(DEAL_II_CXX_FLAGS_DEBUG "-g") - STRIP_FLAG(DEAL_II_SHARED_LINKER_FLAGS_DEBUG "-g") + STRIP_FLAG(DEAL_II_LINKER_FLAGS_DEBUG "-g") ENDIF() + IF(CMAKE_SYSTEM_NAME MATCHES "CYGWIN") # # Workaround for a miscompilation and linkage issue with shared libraries @@ -135,5 +164,4 @@ IF(CMAKE_SYSTEM_NAME MATCHES "CYGWIN") # - Matthias Maier, 2013 # REPLACE_FLAG(DEAL_II_CXX_FLAGS_DEBUG "-O0" "-O1") - ENDIF() diff --git a/deal.II/cmake/checks/check_03_compiler_bugs.cmake b/deal.II/cmake/checks/check_03_compiler_bugs.cmake index 3978679979..bb63ba0740 100644 --- a/deal.II/cmake/checks/check_03_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_03_compiler_bugs.cmake @@ -1,57 +1,24 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -##### +## --------------------------------------------------------------------- -########################################################################### -# # -# Check for various compiler bugs: # -# # -########################################################################### - - -# -# Some compiler versions, notably ICC, have trouble with the -# following code in which we explicitly call a destructor. -# This has to be worked around with a typedef. The problem is -# that the workaround fails with some other compilers, so that -# we can not unconditionally use the workaround... -# -# - Wolfgang Bangerth, Matthias Maier, rewritten 2012 -# -CHECK_CXX_COMPILER_BUG( - " - namespace dealii - { - namespace FEValuesViews - { - template struct Scalar {}; - } - - template - struct X - { - FEValuesViews::Scalar scalars[dim*spacedim]; - - void f() - { - scalars[0].dealii::FEValuesViews::Scalar::~Scalar (); - } - }; - - template struct X<2,2>; - } - int main() { return 0; } - " - DEAL_II_EXPLICIT_DESTRUCTOR_BUG - ) +######################################################################## +# # +# Check for various compiler bugs: # +# # +######################################################################## # @@ -96,38 +63,6 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ENDIF() -# -# Some gcc compiler versions have a problem when using an unsigned count -# in the std::advance function. Unfortunately, this also happens -# occasionally from within the standard library, so we can't prevent the -# warning messages. Since this is annoying, switch of the flag -W which -# causes this. -# -# - Matthias Maier, rewritten 2012 -# - -# TODO: We use the mpi.h header file for this check. We should test this -# bug directly... -CHECK_INCLUDE_FILE_CXX("mpi.h" HAVE_MPI_H) - -IF(HAVE_MPI_H) - PUSH_TEST_FLAG("-Wunused-parameter") - PUSH_TEST_FLAG("-Werror") - CHECK_CXX_COMPILER_BUG( - " - #include - int main() { return 0; } - " - DEAL_II_ADVANCE_WARNING_BUG) - POP_TEST_FLAG() - POP_TEST_FLAG() - - IF(DEAL_II_ADVANCE_WARNING_BUG) - ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused-parameter") - ENDIF() -ENDIF() - - # # In some cases, we would like to name partial specializations # as friends. However, the standard forbids us to do so. But diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index 02780e6ed2..48cf9f0c92 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -1,34 +1,61 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- +# +# This file sets up the project configuration consisting of +# +# Make.global_options (legacy) +# deal.IIConfig.cmake +# deal.IIVersionConfig.cmake +# +# and copies it (a) to the build directory and (b) prepares it for later +# installation (the copy in CMAKE_CURRENT_BINARY_DIR). +# + +# +# Read in auxiliary include directories for the build directory +# configuration: +# +FILE(STRINGS + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes + deal_ii_source_includes + ) # # Configure the template-arguments file # -CONFIGURE_FILE( +CONFIGURE_FILE( # for binary dir: ${CMAKE_CURRENT_SOURCE_DIR}/template-arguments.in - ${CMAKE_CURRENT_BINARY_DIR}/template-arguments + ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments ) -########################################################################### -# # -# Setup and install the convenience macros: # -# # -########################################################################### +######################################################################## +# # +# Setup and install the convenience macros: # +# # +######################################################################## -INSTALL(FILES +FILE(COPY # for binary dir: + ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake + ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_invoke_autopilot.cmake + ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake + DESTINATION ${CMAKE_BINARY_DIR}/${DEAL_II_CMAKE_MACROS_RELDIR} + ) +INSTALL(FILES # for installation: ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_invoke_autopilot.cmake ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake @@ -37,11 +64,11 @@ INSTALL(FILES ) -########################################################################### -# # -# Configure and install the cmake project configuration: # -# # -########################################################################### +######################################################################## +# # +# Configure and install the cmake project configuration: # +# # +######################################################################## # # Strip -Wno-deprecated from CMAKE_CXX_FLAGS so that deprecation warnings @@ -74,12 +101,12 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) SET(CONFIG_LIBRARIES_${_build} \${DEAL_II_PATH}/\${DEAL_II_LIBRARY_RELDIR}/${CONFIG_LIBRARY_${_build}} - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${_build}} + ${DEAL_II_EXTERNAL_LIBRARIES} ) LIST(APPEND CONFIG_LIBRARIES ${_keyword} - ${CONFIG_LIBRARIES_${_build}} + \${DEAL_II_LIBRARIES_${_build}} ) SET(CONFIG_TARGET_${_build} @@ -87,28 +114,41 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ) LIST(APPEND CONFIG_TARGET ${_keyword} - ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX} + \${DEAL_II_TARGET_${_build}} ) ENDFOREACH() -SET(CONFIG_INCLUDE_DIRS +# +# For binary dir: +# +SET(CONFIG_INCLUDE_DIRS_BINARY + \${DEAL_II_PATH}/include + \${DEAL_II_PATH}/include/deal.II + ${CMAKE_SOURCE_DIR}/include/ + ${CMAKE_SOURCE_DIR}/include/deal.II + ${deal_ii_source_includes} + ${DEAL_II_USER_INCLUDE_DIRS} + ) +# +# For installation: +# +SET(CONFIG_INCLUDE_DIRS_INSTALLATION \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR} \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II \${DEAL_II_PATH}/\${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled ${DEAL_II_USER_INCLUDE_DIRS} ) - CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake @ONLY ) - # # Append feature configuration: # - -SET(_file ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake) +SET(_file + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + ) FILE(APPEND ${_file} "\n\n#\n# Feature configuration:\n#\n\n" ) @@ -121,26 +161,25 @@ FOREACH(var ${res}) ENDIF() ENDFOREACH() - CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake @ONLY ) INSTALL(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake DESTINATION ${DEAL_II_PROJECT_CONFIG_RELDIR} COMPONENT library ) -########################################################################### -# # -# Configure and install the old Makefile configuration: # -# # -########################################################################### +######################################################################## +# # +# Configure and install the old Makefile configuration: # +# # +######################################################################## IF(DEAL_II_COMPONENT_COMPAT_FILES) @@ -148,13 +187,6 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # Transform some cmake lists into a string that the old Makefile # mechanism actually understands: # - TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS "${CMAKE_INCLUDE_FLAG_CXX}" - $(D)/${DEAL_II_INCLUDE_RELDIR} - $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II - $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled - ${DEAL_II_USER_INCLUDE_DIRS} - ${DEAL_II_INCLUDE_DIRS} - ) FOREACH(build ${DEAL_II_BUILD_TYPES}) TO_STRING_AND_ADD_PREFIX(MAKEFILE_DEFINITIONS_${build} @@ -170,8 +202,8 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # SET(_libs) FOREACH(_lib - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${build}} + ${DEAL_II_EXTERNAL_LIBRARIES} ) IF(_lib MATCHES "^/") LIST(APPEND _libs "${_lib}") @@ -186,8 +218,8 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) SET(_paths) FOREACH(_lib $(D)/${DEAL_II_LIBRARY_RELDIR}/${CONFIG_LIBRARY_${build}} - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${build}} + ${DEAL_II_EXTERNAL_LIBRARIES} ) LIST(APPEND MAKEFILE_LIBS_${build} ${_lib}) # @@ -214,7 +246,7 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # Set up our linker flags: # SET(MAKEFILE_LDFLAGS_${build} - "${CMAKE_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}} ${CMAKE_SHARED_LINKER_FLAGS} ${DEAL_II_SHARED_LINKER_FLAGS_${build}}" + "${CMAKE_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}} ${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}" ) ENDFOREACH() @@ -222,7 +254,7 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # Boilerplate: The Make.global_options expects variables to be set to # yes, as is common for Makefiles. # - COND_SET_TO_YES(DEAL_II_WITH_TBB MAKEFILE_enablethreads) + COND_SET_TO_YES(DEAL_II_WITH_THREADS MAKEFILE_enablethreads) COND_SET_TO_YES(DEAL_II_WITH_FUNCTIONPARSER MAKEFILE_enableparser) COND_SET_TO_YES(BUILD_SHARED_LIBS MAKEFILE_enableshared) @@ -239,16 +271,62 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) COND_SET_TO_YES(DEAL_II_WITH_P4EST MAKEFILE_P4EST) COND_SET_TO_YES(DEAL_II_WITH_MPI MAKEFILE_MPI) + # + # For binary dir: + # + SET(MAKEFILE_D_BINARY ${CMAKE_BINARY_DIR}) + TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS_BINARY "${CMAKE_INCLUDE_FLAG_CXX}" + $(D)/install + $(D)/install/deal.II + ${CMAKE_SOURCE_DIR}/include/ + ${CMAKE_SOURCE_DIR}/include/deal.II + ${deal_ii_source_includes} + ${DEAL_II_USER_INCLUDE_DIRS} + ) + # + # For installation: + # + SET(MAKEFILE_D_INSTALLATION ${CMAKE_INSTALL_PREFIX}) + TO_STRING_AND_ADD_PREFIX(MAKEFILE_INCLUDE_DIRS_INSTALLATION "${CMAKE_INCLUDE_FLAG_CXX}" + $(D)/${DEAL_II_INCLUDE_RELDIR} + $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II + $(D)/${DEAL_II_INCLUDE_RELDIR}/deal.II/bundled + ${DEAL_II_USER_INCLUDE_DIRS} + ) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/Make.global_options.in - ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options + ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options ) INSTALL(FILES - ${CMAKE_CURRENT_BINARY_DIR}/template-arguments - ${CMAKE_CURRENT_BINARY_DIR}/Make.global_options + ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments + ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/Make.global_options DESTINATION ${DEAL_II_COMMON_RELDIR} COMPONENT compat_files ) ENDIF() +# +# Finally, add a target to create the "binary" file in +# ${DEAL_II_PROJECT_CONFIG_RELDIR} and add it to the library target: +# +ADD_CUSTOM_TARGET(setup_build_dir ALL + COMMAND ${CMAKE_COMMAND} -E touch + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary + COMMAND ${CMAKE_COMMAND} -E touch + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + ) +ADD_DEPENDENCIES(library setup_build_dir) + +# +# And a script to remove it upon installation from the install prefix: +# +INSTALL(CODE + " + FILE(REMOVE ${CMAKE_INSTALL_PREFIX}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary) + EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E touch + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + ) + " + COMPONENT library + ) diff --git a/deal.II/cmake/config/Config.cmake.in b/deal.II/cmake/config/Config.cmake.in index c28eb39495..53417f2bdf 100644 --- a/deal.II/cmake/config/Config.cmake.in +++ b/deal.II/cmake/config/Config.cmake.in @@ -1,23 +1,25 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- -########################################################################## -## ## -## The deal.II project configuration file ## -## ## -########################################################################## +######################################################################## +## ## +## The deal.II project configuration file ## +## ## +######################################################################## # @@ -64,6 +66,14 @@ WHILE(NOT "${_path}" STREQUAL "") GET_FILENAME_COMPONENT(_path "${_path}" PATH) ENDWHILE() +# +# Is this project reside in a build directory or at an installed location? +# + +IF(EXISTS ${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary) + SET(DEAL_II_BUILD_DIR TRUE) +ENDIF() + # # Print a message after inclusion of this file: # @@ -71,9 +81,15 @@ ENDWHILE() SET(DEAL_II_PROJECT_CONFIG_INCLUDED TRUE) IF(NOT ${DEAL_II_PACKAGE_NAME}_FIND_QUIETLY) - MESSAGE(STATUS - "Using the ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} installation found at ${DEAL_II_PATH}" - ) + IF(DEAL_II_BUILD_DIR) + MESSAGE(STATUS + "Using the ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} build directory found at ${DEAL_II_PATH}" + ) + ELSE() + MESSAGE(STATUS + "Using the ${DEAL_II_PACKAGE_NAME}-${DEAL_II_PACKAGE_VERSION} installation found at ${DEAL_II_PATH}" + ) + ENDIF() ENDIF() @@ -108,13 +124,13 @@ SET(DEAL_II_CXX_FLAGS_DEBUG "@DEAL_II_CXX_FLAGS_DEBUG@") SET(DEAL_II_CXX_FLAGS_RELEASE "@DEAL_II_CXX_FLAGS_RELEASE@") # used for all targets: -SET(DEAL_II_LINKER_FLAGS "@CMAKE_SHARED_LINKER_FLAGS@") +SET(DEAL_II_LINKER_FLAGS "@DEAL_II_LINKER_FLAGS@") # _additionally_ used for debug targets: -SET(DEAL_II_LINKER_FLAGS_DEBUG "@DEAL_II_SHARED_LINKER_FLAGS_DEBUG@") +SET(DEAL_II_LINKER_FLAGS_DEBUG "@DEAL_II_LINKER_FLAGS_DEBUG@") # _additionally_ used for release targets: -SET(DEAL_II_LINKER_FLAGS_RELEASE "@DEAL_II_SHARED_LINKER_FLAGS_RELEASE@") +SET(DEAL_II_LINKER_FLAGS_RELEASE "@DEAL_II_LINKER_FLAGS_RELEASE@") # used for all targets: SET(DEAL_II_USER_DEFINITIONS "@DEAL_II_USER_DEFINITIONS@") @@ -127,10 +143,20 @@ SET(DEAL_II_USER_DEFINITIONS_RELEASE "@DEAL_II_USER_DEFINITIONS_RELEASE@") # -# Information about include directories and libraries +# Build a static executable: # -SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS@") +SET(DEAL_II_STATIC_EXECUTABLE "@DEAL_II_STATIC_EXECUTABLE@") + + +# +# Information about include directories and libraries +# +IF(DEAL_II_BUILD_DIR) + SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS_BINARY@") +ELSE() + SET(DEAL_II_INCLUDE_DIRS "@CONFIG_INCLUDE_DIRS_INSTALLATION@") +ENDIF() # Full list of libraries for the debug target: SET(DEAL_II_LIBRARIES_DEBUG "@CONFIG_LIBRARIES_DEBUG@") @@ -146,7 +172,11 @@ SET(DEAL_II_LIBRARIES "@CONFIG_LIBRARIES@") # Information about library targets # -SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake") +IF(DEAL_II_BUILD_DIR) + SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}BuildTargets.cmake") +ELSE() + SET(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake") +ENDIF() # The Debug target: SET(DEAL_II_TARGET_DEBUG "@CONFIG_TARGET_DEBUG@") diff --git a/deal.II/cmake/config/Make.global_options.in b/deal.II/cmake/config/Make.global_options.in index bcedebb257..3ebd2f232a 100644 --- a/deal.II/cmake/config/Make.global_options.in +++ b/deal.II/cmake/config/Make.global_options.in @@ -1,23 +1,34 @@ -# $Id$ - -# -# Compatibility Make.global_options file -# - -############################################################################### -## Please note: +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2012 - 2013 by the deal.II authors ## -## This is a compatibility Make.global_options file generated by CMake -## from the ./cmake/config/Make.global_options.in file. +## This file is part of the deal.II library. ## -############################################################################### +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- # -# the following lines will be replaced by cmake +# Please note: +# +# This is a compatibility Make.global_options file generated by CMake +# from the ./cmake/config/Make.global_options.in file. # -D = @CMAKE_INSTALL_PREFIX@ + +ifeq ($(wildcard $(D)/@DEAL_II_PROJECT_CONFIG_RELDIR@/binary),) + D = @MAKEFILE_D_INSTALLATION@ +else + D = @MAKEFILE_D_BINARY@ +endif + CXX = @CMAKE_CXX_COMPILER@ CXX-ID = @CMAKE_CXX_COMPILER_ID@ CXX-VERSION = @CMAKE_CXX_COMPILER_VERSION@ @@ -60,17 +71,27 @@ DEAL_II_USE_MPI = @MAKEFILE_MPI@ OBJEXT = o EXEEXT = +shared-lib-suffix = .so +static-lib-suffix = .a + +ifeq ($(enable-shared),yes) + lib-suffix = $(shared-lib-suffix) +else + lib-suffix = $(static-lib-suffix) +endif + # set paths to all the libraries we need: -lib-deal2.o = ${MAKEFILE_TARGETS_RELEASE} -lib-deal2.g = ${MAKEFILE_TARGETS_DEBUG} +lib-deal2.o = @MAKEFILE_TARGETS_RELEASE@ +lib-deal2.g = @MAKEFILE_TARGETS_DEBUG@ -# include paths as command line flags. while compilers allow a space between -# the '-I' and the actual path, we also send these flags to the -# make_dependencies program that doesn't support the extra space. -# -INCLUDE = ${MAKEFILE_INCLUDE_DIRS} +# Include paths as command line flags +ifeq ($(wildcard $(D)/@DEAL_II_PROJECT_CONFIG_RELDIR@/binary),) + INCLUDE = @MAKEFILE_INCLUDE_DIRS_INSTALLATION@ +else + INCLUDE = @MAKEFILE_INCLUDE_DIRS_BINARY@ +endif # compiler flags for debug and optimized mode diff --git a/deal.II/cmake/configure/configure_1_lapack.cmake b/deal.II/cmake/configure/configure_1_lapack.cmake index 6445f6b1f1..7c64e0dbe9 100644 --- a/deal.II/cmake/configure/configure_1_lapack.cmake +++ b/deal.II/cmake/configure/configure_1_lapack.cmake @@ -1,36 +1,27 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the lapack library: # MACRO(FEATURE_LAPACK_FIND_EXTERNAL var) - FIND_PACKAGE(LAPACK) + FIND_PACKAGE(DEALII_LAPACK) IF(LAPACK_FOUND) - MARK_AS_ADVANCED( - atlas_LIBRARY - blas_LIBRARY - gslcblas_LIBRARY - lapack_LIBRARY - m_LIBRARY - ptf77blas_LIBRARY - ptlapack_LIBRARY - refblas_LIBRARY - reflapack_LIBRARY - ) SET(${var} TRUE) ENDIF() ENDMACRO() @@ -51,25 +42,32 @@ SET(DEAL_II_LAPACK_FUNCTIONS ) MACRO(CHECK_FOR_LAPACK_FUNCTIONS) + # + # Clear the test flags because the following test will use a C compiler + # + CLEAR_CMAKE_REQUIRED() + SET(CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}") SET(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES}) # - # For some static lapack versions it is necessary to link with -lm. - # So link with it as well if -lm is already present in our link - # interface: + # Push -pthread as well: # - IF(NOT m_lib MATCHES "-NOTFOUND") - LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${m_lib}) + ENABLE_IF_SUPPORTED(CMAKE_REQUIRED_FLAGS "-pthread") + + IF(CMAKE_C_COMPILER_WORKS) + FOREACH(_func ${DEAL_II_LAPACK_FUNCTIONS}) + STRING(TOUPPER ${_func} _func_uppercase) + CHECK_FUNCTION_EXISTS(${_func} HAVE_${_func_uppercase}) + ENDFOREACH() + ELSE() + MESSAGE(STATUS + "No suitable C compiler was found! Skipping LAPACK symbol check." + ) + FOREACH(_func ${DEAL_II_LAPACK_FUNCTIONS}) + SET_IF_EMPTY(HAVE_${_func_uppercase} TRUE) + ENDFOREACH() ENDIF() - ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}") - - FOREACH(_func ${DEAL_II_LAPACK_FUNCTIONS}) - STRING(TOUPPER ${_func} _func_uppercase) - CHECK_FUNCTION_EXISTS(${_func} HAVE_${_func_uppercase}) - ENDFOREACH() - - SET(CMAKE_REQUIRED_LIBRARIES) - STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${LAPACK_LINKER_FLAGS}") + RESET_CMAKE_REQUIRED() ENDMACRO() @@ -81,28 +79,11 @@ MACRO(RESET_LAPACK_FUNCTIONS_CACHE) ENDMACRO() -MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL) - # - # So, well... LAPACK_LINKER_FLAGS and LAPACK_LIBRARIES should contain the - # complete link interface. But for invalid user overrides we include - # BLAS_LIBRARIES and BLAS_LINKER_FLAGS as well.. - # - IF(NOT LAPACK_LINKER_FLAGS MATCHES "${BLAS_LINKER_FLAGS}") - MESSAGE(STATUS - "Manually adding BLAS_LINKER_FLAGS to LAPACK_LINKER_FLAGS" - ) - ADD_FLAGS(LAPACK_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") - ENDIF() - IF(NOT "${LAPACK_LIBRARIES}" MATCHES "${BLAS_LIBRARIES}") - MESSAGE(STATUS - "Manually adding BLAS_LIBRARIES to LAPACK_LIBRARIES" - ) - LIST(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - ENDIF() - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${LAPACK_LIBRARIES}) +MACRO(FEATURE_LAPACK_CONFIGURE_EXTERNAL) + ADD_FLAGS(DEAL_II_LINKER_FLAGS "${LAPACK_LINKER_FLAGS}") + DEAL_II_APPEND_LIBRARIES(${LAPACK_LIBRARIES}) CHECK_FOR_LAPACK_FUNCTIONS() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake index e0c1766d41..5140848840 100644 --- a/deal.II/cmake/configure/configure_1_mpi.cmake +++ b/deal.II/cmake/configure/configure_1_mpi.cmake @@ -1,20 +1,25 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for mpi support: # +# We look for the C and Fortran libraries as well because they are needed +# by some external libraries: +# MACRO(FEATURE_MPI_FIND_EXTERNAL var) # @@ -31,7 +36,22 @@ MACRO(FEATURE_MPI_FIND_EXTERNAL var) # directly. # SET_IF_EMPTY(MPI_CXX_COMPILER ${CMAKE_CXX_COMPILER}) - SET_IF_EMPTY(MPI_C_COMPILER ${CMAKE_C_COMPILER}) # for good measure + IF(CMAKE_C_COMPILER_WORKS) + SET_IF_EMPTY(MPI_C_COMPILER ${CMAKE_C_COMPILER}) # for good measure + ELSE() + MESSAGE(STATUS + "No suitable C compiler was found! MPI C interface can not be " + "autodetected" + ) + ENDIF() + IF(CMAKE_Fortran_COMPILER_WORKS) + SET_IF_EMPTY(MPI_Fortran_COMPILER ${CMAKE_Fortran_COMPILER}) # for good measure + ELSE() + MESSAGE(STATUS + "No suitable Fortran compiler was found! MPI Fortran interface can " + "not be autodetected" + ) + ENDIF() FIND_PACKAGE(MPI) IF(NOT MPI_CXX_FOUND) @@ -48,14 +68,24 @@ MACRO(FEATURE_MPI_FIND_EXTERNAL var) SET(MPI_FOUND) # clear this value so that FIND_PACKAGE runs again. UNSET(MPI_CXX_COMPILER CACHE) UNSET(MPI_C_COMPILER CACHE) + UNSET(MPI_Fortran_COMPILER CACHE) FIND_PACKAGE(MPI) ENDIF() ENDIF() - IF(MPI_CXX_FOUND) - # Hide some variables: - MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY) + # + # Manually clean up variables: + # + FOREACH(_lang C CXX Fortran) + IF(MPI_${_lang}_LIBRARIES MATCHES "-NOTFOUND") + SET(MPI_${_lang}_LIBRARIES) + ENDIF() + ENDFOREACH() + # Hide some variables: + MARK_AS_ADVANCED(MPI_EXTRA_LIBRARY MPI_LIBRARY) + + IF(MPI_CXX_FOUND) SET(${var} TRUE) ENDIF() ENDMACRO() @@ -63,9 +93,9 @@ ENDMACRO() MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL) ADD_FLAGS(CMAKE_CXX_FLAGS "${MPI_CXX_COMPILE_FLAGS}") - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${MPI_CXX_LINK_FLAGS}") + ADD_FLAGS(DEAL_II_LINKER_FLAGS "${MPI_CXX_LINK_FLAGS}") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${MPI_CXX_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${MPI_CXX_LIBRARIES}) INCLUDE_DIRECTORIES(${MPI_CXX_INCLUDE_PATH}) # The user has to know the location of the mpi headers as well: @@ -77,10 +107,15 @@ MACRO(FEATURE_MPI_ERROR_MESSAGE) MESSAGE(FATAL_ERROR "\n" "Could not find any suitable mpi library!\n" "Please ensure that an mpi library is installed on your computer\n" - "and set CMAKE_CXX_COMPILER and CMAKE_C_COMPILER to the appropriate mpi\n" - "wrappers:\n" - " $ CC=\".../mpicc\" CXX=\".../mpicxx\" cmake <...>\n" - " $ cmake -DCMAKE_C_COMPILER=\".../mpicc\" -DCMAKE_CXX_COMPIER=\".../mpicxx\" <...>\n" + "and set CMAKE_CXX_COMPILER to the appropriate mpi wrappers:\n" + " $ CXX=\".../mpicxx\" cmake <...>\n" + " $ cmake -DCMAKE_CXX_COMPILER=\".../mpicxx\" <...>\n" + "Or with additional C and Fortran wrappers (recommended!):\n" + " $ CC=\".../mpicc\" CXX=\".../mpicxx\" F90=\".../mpif90\" cmake <...>\n" + " $ cmake -DCMAKE_C_COMPILER=\".../mpicc\"\\\n" + " -DCMAKE_CXX_COMPILER=\".../mpicxx\"\\\n" + " -DCMAKE_Fortran_COMPILER=\".../mpif90\"\\\n" + " <...>\n" ) ENDMACRO() diff --git a/deal.II/cmake/configure/configure_1_threads.cmake b/deal.II/cmake/configure/configure_1_threads.cmake index f2df405156..e6ddef4076 100644 --- a/deal.II/cmake/configure/configure_1_threads.cmake +++ b/deal.II/cmake/configure/configure_1_threads.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # @@ -24,10 +26,46 @@ # The macro will be included in CONFIGURE_FEATURE_THREADS_EXTERNAL/BUNDLED. # MACRO(SETUP_THREADING) - FIND_PACKAGE(Threads) + # + # Unfortunately the FindThreads macro needs a working C compiler + # + IF(CMAKE_C_COMPILER_WORKS) + # + # Switch the library preference back to prefer dynamic libraries if + # DEAL_II_PREFER_STATIC_LIBS=TRUE but DEAL_II_STATIC_EXECUTABLE=FALSE. In + # this case system libraries should be linked dynamically. + # + SWITCH_LIBRARY_PREFERENCE() + + # + # Clear the test flags because FindThreads.cmake will use a C compiler: + # + CLEAR_CMAKE_REQUIRED() + + FIND_PACKAGE(Threads) + + RESET_CMAKE_REQUIRED() + SWITCH_LIBRARY_PREFERENCE() + + ELSE() + + # + # We have no way to query for thread support. Just assume that it is + # provided by Pthreads... + # + MESSAGE(STATUS + "No suitable C compiler was found! Assuming threading is provided by Pthreads." + ) + SET_IF_EMPTY(Threads_FOUND TRUE) + SET_IF_EMPTY(CMAKE_THREAD_LIBS_INIT "-lpthread") + SET_IF_EMPTY(CMAKE_USE_PTHREADS_INIT TRUE) + ENDIF() IF(NOT Threads_FOUND) - # TODO: + # + # TODO: This is a dead end. Threading might be setup with internal TBB + # so we have no way of returning unsuccessfully... + # MESSAGE(FATAL_ERROR "\nInternal configuration error: No Threading support found\n\n" ) @@ -50,7 +88,7 @@ MACRO(SETUP_THREADING) ENDIF() ENDIF() - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT}") + ADD_FLAGS(DEAL_II_LINKER_FLAGS "${CMAKE_THREAD_LIBS_INIT}") # # Set up some posix thread specific configuration toggles: @@ -82,7 +120,7 @@ MACRO(SETUP_THREADING) } " DEAL_II_HAVE_MT_POSIX_BARRIERS) - STRIP_FLAG(CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}") + RESET_CMAKE_REQUIRED() IF(NOT DEAL_II_HAVE_MT_POSIX_BARRIERS) SET(DEAL_II_USE_MT_POSIX_NO_BARRIERS TRUE) ENDIF() @@ -115,7 +153,7 @@ ENDMACRO() MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL) INCLUDE_DIRECTORIES(${TBB_INCLUDE_DIR}) - SPLIT_DEBUG_RELEASE(_tbb_debug _tbb_release ${TBB_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${TBB_LIBRARIES}) IF(CMAKE_BUILD_TYPE MATCHES "Debug") IF(TBB_WITH_DEBUG_LIB) @@ -124,26 +162,13 @@ MACRO(FEATURE_THREADS_CONFIGURE_EXTERNAL) ) ENDIF() - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_tbb_debug}) ENDIF() - IF(CMAKE_BUILD_TYPE MATCHES "Release") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_tbb_release}) - ENDIF() SETUP_THREADING() ENDMACRO() -# -# Resolve a cache invalidation problem by searching for these flags -# unconditionally. They're used in FEATURE_THREADS_CONFIGURE_BUNDLED -# depending on cached variables. -# -ENABLE_IF_SUPPORTED(_dummy "-Wno-parentheses") -ENABLE_IF_SUPPORTED(_dummy "-Wno-long-long") - - MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED) # # Setup threading (before configuring our build...) @@ -168,10 +193,10 @@ MACRO(FEATURE_THREADS_CONFIGURE_BUNDLED) # # tbb uses dlopen/dlclose, so link against libdl.so as well: # - FIND_LIBRARY(dl_lib NAMES dl) - MARK_AS_ADVANCED(dl_lib) - IF(NOT dl_lib MATCHES "-NOTFOUND") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${dl_lib}) + FIND_LIBRARY(dl_LIBRARY NAMES dl) + MARK_AS_ADVANCED(dl_LIBRARY) + IF(NOT dl_LIBRARY MATCHES "-NOTFOUND") + DEAL_II_APPEND_LIBRARIES(${dl_LIBRARY}) ENDIF() INCLUDE_DIRECTORIES(${TBB_FOLDER}/include) diff --git a/deal.II/cmake/configure/configure_1_umfpack.cmake b/deal.II/cmake/configure/configure_1_umfpack.cmake index 0d8ebde0d4..56ac7e323d 100644 --- a/deal.II/cmake/configure/configure_1_umfpack.cmake +++ b/deal.II/cmake/configure/configure_1_umfpack.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the umfpack library: diff --git a/deal.II/cmake/configure/configure_2_metis.cmake b/deal.II/cmake/configure/configure_2_metis.cmake new file mode 100644 index 0000000000..1a49a2c7c2 --- /dev/null +++ b/deal.II/cmake/configure/configure_2_metis.cmake @@ -0,0 +1,46 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2012 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# Configuration for the metis library: +# + +MACRO(FEATURE_METIS_FIND_EXTERNAL var) + FIND_PACKAGE(METIS) + + IF(METIS_FOUND) + IF(METIS_VERSION_MAJOR GREATER 4) + SET(${var} TRUE) + ELSE() + MESSAGE(STATUS "Insufficient metis installation found: " + "Version 5.x required!" + ) + SET(METIS_ADDITIONAL_ERROR_STRING + "Could not find a sufficient modern metis installation: " + "Version 5.x required!\n" + ) + + UNSET(METIS_LIBRARY CACHE) + UNSET(METIS_INCLUDE_DIR CACHE) + SET(METIS_DIR "" CACHE PATH + "An optional hint to a metis directory" + ) + MARK_AS_ADVANCED(CLEAR METIS_DIR) + ENDIF() + ENDIF() +ENDMACRO() + +CONFIGURE_FEATURE(METIS) diff --git a/deal.II/cmake/configure/configure_petsc.cmake b/deal.II/cmake/configure/configure_2_petsc.cmake similarity index 86% rename from deal.II/cmake/configure/configure_petsc.cmake rename to deal.II/cmake/configure/configure_2_petsc.cmake index a7d8d6d626..23465a2eb0 100644 --- a/deal.II/cmake/configure/configure_petsc.cmake +++ b/deal.II/cmake/configure/configure_2_petsc.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the petsc library: @@ -102,25 +104,19 @@ MACRO(FEATURE_PETSC_FIND_EXTERNAL var) SET(PETSC_ARCH "" CACHE STRING "An optional hint to a PETSc arch" ) + MARK_AS_ADVANCED(CLEAR PETSC_DIR PETSC_ARCH) ENDIF() ENDIF() ENDMACRO() -# -# Resolve a cache invalidation problem by searching for this flag -# unconditionally. It is used in FEATURE_PETSC_CONFIGURE_EXTERNAL -# depending on cached variables. -# -ENABLE_IF_SUPPORTED(_dummy "-Wno-long-long") - MACRO(FEATURE_PETSC_CONFIGURE_EXTERNAL) INCLUDE_DIRECTORIES(${PETSC_INCLUDE_DIRS}) # The user has to know the location of the petsc headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${PETSC_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${PETSC_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${PETSC_LIBRARIES}) # # Disable a bunch of warnings when compiling with petsc: diff --git a/deal.II/cmake/configure/configure_trilinos.cmake b/deal.II/cmake/configure/configure_2_trilinos.cmake similarity index 69% rename from deal.II/cmake/configure/configure_trilinos.cmake rename to deal.II/cmake/configure/configure_2_trilinos.cmake index d7e08f752f..ac15b34051 100644 --- a/deal.II/cmake/configure/configure_trilinos.cmake +++ b/deal.II/cmake/configure/configure_2_trilinos.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the trilinos library: @@ -129,10 +131,10 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) "has to be configured to use the same number of bits as deal.II, but " "found:\n" " DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n" - " TRILINOS_WITH_NO_32BIT_INDICES = ${TRILINOS_WITH_NO_32_BIT_INDICES}\n" + " TRILINOS_WITH_NO_32BIT_INDICES = ${TRILINOS_WITH_NO_32_BIT_INDICES}\n" ) SET(${var} FALSE) - ENDIF() + ENDIF() # # Trilinos has to be configured with 64bit indices if deal.II uses unsigned long @@ -141,110 +143,64 @@ MACRO(FEATURE_TRILINOS_FIND_EXTERNAL var) IF(TRILINOS_WITH_NO_64BIT_INDICES AND DEAL_II_WITH_64BIT_INDICES) MESSAGE(STATUS "deal.II was configured to use 64bit global indices but " "Trilinos was not." - ) + ) SET(TRILINOS_ADDITIONAL_ERROR_STRING ${TRILINOS_ADDITIONAL_ERROR_STRING} "The Trilinos installation (found at \"${TRILINOS_DIR}\")\n" "has to be configured to use the same number of bits as deal.II, but " "found:\n" " DEAL_II_WITH_64BIT_INDICES = ${DEAL_II_WITH_64BIT_INDICES}\n" - " TRILINOS_WITH_NO_64BIT_INDICES = ${TRILINOS_WITH_NO_64_BIT_INDICES}\n" + " TRILINOS_WITH_NO_64BIT_INDICES = ${TRILINOS_WITH_NO_64_BIT_INDICES}\n" ) SET(${var} FALSE) - ENDIF() - + ENDIF() # # Some versions of Sacado_cmath.hpp do things that aren't compatible # with the -std=c++0x flag of GCC, see deal.II FAQ. # Test whether that is indeed the case # - IF(${var}) - SET(CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIRS}) - PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}") - - CHECK_CXX_SOURCE_COMPILES( - " - #include - int main(){ return 0; } - " - TRILINOS_SUPPORTS_CPP11) - - IF(DEAL_II_CAN_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11) - # - # Try whether exporting HAS_C99_TR1_CMATH helps: - # - PUSH_TEST_FLAG("-DHAS_C99_TR1_CMATH") - CHECK_CXX_SOURCE_COMPILES( - " - #include - int main(){ return 0; } - " - TRILINOS_HAS_C99_TR1_WORKAROUND) - POP_TEST_FLAG() + IF(DEAL_II_CAN_USE_CXX11 AND NOT TRILINOS_SUPPORTS_CPP11) - IF(TRILINOS_HAS_C99_TR1_WORKAROUND) - LIST(APPEND DEAL_II_DEFINITIONS "HAS_C99_TR1_CMATH") - LIST(APPEND DEAL_II_USER_DEFINITIONS "HAS_C99_TR1_CMATH") - ELSE() - MESSAGE(STATUS "Could not find a sufficient Trilinos installation: " - "The installation is not compatible with the C++ standard selected for " - "this compiler." - ) - SET(TRILINOS_ADDITIONAL_ERROR_STRING - ${TRILINOS_ADDITIONAL_ERROR_STRING} - "The Trilinos installation (found at \"${TRILINOS_DIR}\")\n" - "is not compatible with the C++ standard selected for\n" - "this compiler. See the deal.II FAQ page for a solution.\n\n" - ) - SET(${var} FALSE) - ENDIF() + IF(TRILINOS_HAS_C99_TR1_WORKAROUND) + LIST(APPEND DEAL_II_DEFINITIONS "HAS_C99_TR1_CMATH") + LIST(APPEND DEAL_II_USER_DEFINITIONS "HAS_C99_TR1_CMATH") + ELSE() + MESSAGE(STATUS "Could not find a sufficient Trilinos installation: " + "The installation is not compatible with the C++ standard selected for " + "this compiler." + ) + SET(TRILINOS_ADDITIONAL_ERROR_STRING + ${TRILINOS_ADDITIONAL_ERROR_STRING} + "The Trilinos installation (found at \"${TRILINOS_DIR}\")\n" + "is not compatible with the C++ standard selected for\n" + "this compiler. See the deal.II FAQ page for a solution.\n\n" + ) + SET(${var} FALSE) ENDIF() - - POP_TEST_FLAG() - SET(CMAKE_REQUIRED_INCLUDES) - - # - # Remove the following variables from the cache to force a recheck: - # - UNSET(TRILINOS_SUPPORTS_CPP11 CACHE) - UNSET(TRILINOS_HAS_C99_TR1_WORKAROUND CACHE) ENDIF() ENDIF(TRILINOS_FOUND) -ENDMACRO() + IF(NOT ${var}) + UNSET(TRILINOS_CONFIG CACHE) + SET(TRILINOS_DIR "" CACHE STRING + "An optional hint to a Trilinos installation" + ) + MARK_AS_ADVANCED(CLEAR TRILINOS_DIR) + ENDIF() + +ENDMACRO() -# -# Resolve a cache invalidation problem by searching for these flags -# unconditionally. They're used in FEATURE_TRILINOS_CONFIGURE_EXTERNAL -# depending on cached variables. -# -ENABLE_IF_SUPPORTED(_dummy "-Wno-unused") -ENABLE_IF_SUPPORTED(_dummy "-Wno-extra") -ENABLE_IF_SUPPORTED(_dummy "-Wno-overloaded-virtual") MACRO(FEATURE_TRILINOS_CONFIGURE_EXTERNAL) - # - # *Boy* Sanitize the include paths given by TrilinosConfig.cmake... - # - STRING(REGEX REPLACE - "(lib64|lib)\\/cmake\\/Trilinos\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/" "" - TRILINOS_INCLUDE_DIRS "${TRILINOS_INCLUDE_DIRS}" - ) INCLUDE_DIRECTORIES(${TRILINOS_INCLUDE_DIRS}) # The user has to know the location of the trilinos headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${TRILINOS_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES - # The Trilinos libraries: - ${TRILINOS_LIBRARIES} - # All external libraries necessary for the Trilinos libraries. Nice and - # easy :-) - ${Trilinos_TPL_LIBRARIES} - ) + DEAL_II_APPEND_LIBRARIES(${TRILINOS_LIBRARIES}) SET(DEAL_II_EXPAND_TRILINOS_VECTOR "TrilinosWrappers::Vector") SET(DEAL_II_EXPAND_TRILINOS_BLOCKVECTOR "TrilinosWrappers::BlockVector") diff --git a/deal.II/cmake/configure/configure_arpack.cmake b/deal.II/cmake/configure/configure_arpack.cmake index 2ce985674b..bf2f5f4aca 100644 --- a/deal.II/cmake/configure/configure_arpack.cmake +++ b/deal.II/cmake/configure/configure_arpack.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the ARPACK library: diff --git a/deal.II/cmake/configure/configure_boost.cmake b/deal.II/cmake/configure/configure_boost.cmake index 8e28bf83e5..b6ed7c3b2c 100644 --- a/deal.II/cmake/configure/configure_boost.cmake +++ b/deal.II/cmake/configure/configure_boost.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the boost library: @@ -24,7 +26,7 @@ IF(NOT FEATURE_THREADS_PROCESSED) MESSAGE(FATAL_ERROR "\n" "Internal build system error:\n" - "configure_boost.cmake included before configure_tbb.cmake\n\n" + "configure_boost.cmake included before configure_1_threads.cmake\n\n" ) ENDIF() @@ -35,21 +37,61 @@ SET(DEAL_II_WITH_BOOST ON # Always true. We need it :-] MACRO(FEATURE_BOOST_FIND_EXTERNAL var) - # - # We require at least version 1.44 - # + + IF(NOT DEFINED BOOST_DIR) + SET(BOOST_DIR "$ENV{BOOST_DIR}") + ELSE() + SET_IF_EMPTY(BOOST_DIR "$ENV{BOOST_DIR}") + ENDIF() + IF(NOT "${BOOST_DIR}" STREQUAL "") + SET(BOOST_ROOT "${BOOST_DIR}") + ENDIF() + IF(DEAL_II_WITH_THREADS) - FIND_PACKAGE(Boost 1.44 COMPONENTS serialization system thread) + SET(_boost_components serialization system thread) ELSE() - FIND_PACKAGE(Boost 1.44 COMPONENTS serialization system) + SET(_boost_components serialization system) ENDIF() + # + # Prefer static libs if BUILD_SHARED_LIBS=OFF: + # + IF(NOT BUILD_SHARED_LIBS) + SET(Boost_USE_STATIC_LIBS TRUE) + ENDIF() + + FIND_PACKAGE(Boost 1.44 COMPONENTS ${_boost_components}) + + # + # Fall back to dynamic libraries if no static libraries could be found: + # + IF( Boost_USE_STATIC_LIBS AND + (NOT Boost_SERIALIZATION_FOUND OR NOT Boost_SYSTEM_FOUND) + ) + SET(Boost_USE_STATIC_LIBS FALSE) + FIND_PACKAGE(Boost 1.44 COMPONENTS ${_boost_components}) + ENDIF() + + MARK_AS_ADVANCED(Boost_DIR) + + SET(BOOST_VERSION_MAJOR "${Boost_MAJOR_VERSION}") + SET(BOOST_VERSION_MINOR "${Boost_MINOR_VERSION}") + SET(BOOST_VERSION_SUBMINOR "${Boost_SUBMINOR_VERSION}") + SET(BOOST_VERSION + "${BOOST_VERSION_MAJOR}.${BOOST_VERSION_MINOR}.${BOOST_VERSION_SUBMINOR}" + ) + + IF( Boost_SERIALIZATION_FOUND AND Boost_SYSTEM_FOUND AND (NOT DEAL_II_WITH_THREADS OR Boost_THREAD_FOUND) ) + MARK_AS_ADVANCED(BOOST_DIR) SET(${var} TRUE) - MARK_AS_ADVANCED(Boost_DIR) + ELSE() + SET(BOOST_DIR "" CACHE PATH + "An optional hint to a boost directory" + ) ENDIF() ENDMACRO() @@ -66,19 +108,8 @@ MACRO(FEATURE_BOOST_CONFIGURE_EXTERNAL) # LIST(REMOVE_ITEM Boost_LIBRARIES "pthread") - # - # Transform Boost_LIBRARIES into a list of debug and release libraries - # without keywords: - # - SPLIT_DEBUG_RELEASE(_boost_debug _boost_release ${Boost_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${Boost_LIBRARIES}) - IF (CMAKE_BUILD_TYPE MATCHES "Debug") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_boost_debug}) - ENDIF() - - IF (CMAKE_BUILD_TYPE MATCHES "Release") - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_boost_release}) - ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_functionparser.cmake b/deal.II/cmake/configure/configure_functionparser.cmake index 191c33164e..c9abde129d 100644 --- a/deal.II/cmake/configure/configure_functionparser.cmake +++ b/deal.II/cmake/configure/configure_functionparser.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for functionparser diff --git a/deal.II/cmake/configure/configure_hdf5.cmake b/deal.II/cmake/configure/configure_hdf5.cmake index ff85fe9080..9816054301 100644 --- a/deal.II/cmake/configure/configure_hdf5.cmake +++ b/deal.II/cmake/configure/configure_hdf5.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the hdf5 library: @@ -35,6 +37,12 @@ MACRO(FEATURE_HDF5_FIND_EXTERNAL var) " HDF5_WITH_MPI = ${HDF5_WITH_MPI}\n" ) ENDIF() + + INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIRS}) + LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${HDF5_INCLUDE_DIRS}) + DEAL_II_APPEND_LIBRARIES(${HDF5_LIBRARIES}) + + ENDIF() ENDMACRO() diff --git a/deal.II/cmake/configure/configure_metis.cmake b/deal.II/cmake/configure/configure_metis.cmake deleted file mode 100644 index 14f76ca5f5..0000000000 --- a/deal.II/cmake/configure/configure_metis.cmake +++ /dev/null @@ -1,43 +0,0 @@ -##### -## -## Copyright (C) 2012, 2013 by the deal.II authors -## -## This file is part of the deal.II library. -## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. -## -## Author: Matthias Maier -## -##### - -# -# Configuration for the netcdf library: -# - -MACRO(FEATURE_METIS_FIND_EXTERNAL var) - FIND_PACKAGE(METIS) - - IF(METIS_FOUND) - IF(METIS_MAJOR GREATER 4) - SET(${var} TRUE) - ELSE() - MESSAGE(STATUS "Insufficient metis installation found: " - "Version 5.x required!" - ) - SET(METIS_ADDITIONAL_ERROR_STRING - "Could not find a sufficient modern metis installation: " - "Version 5.x required!\n" - ) - - UNSET(METIS_LIBRARY CACHE) - UNSET(METIS_INCLUDE_DIR CACHE) - SET(METIS_DIR "" CACHE PATH - "An optional hint to a metis directory" - ) - ENDIF() - ENDIF() -ENDMACRO() - -CONFIGURE_FEATURE(METIS) diff --git a/deal.II/cmake/configure/configure_mumps.cmake b/deal.II/cmake/configure/configure_mumps.cmake index 3757724b59..0739098602 100644 --- a/deal.II/cmake/configure/configure_mumps.cmake +++ b/deal.II/cmake/configure/configure_mumps.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the MUMPS library: @@ -24,7 +26,7 @@ MACRO(FEATURE_MUMPS_CONFIGURE_EXTERNAL) # The user has to know the location of the MUMPS headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${MUMPS_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${MUMPS_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${MUMPS_LIBRARIES}) ENDMACRO() CONFIGURE_FEATURE(MUMPS) diff --git a/deal.II/cmake/configure/configure_netcdf.cmake b/deal.II/cmake/configure/configure_netcdf.cmake index a8fb4ebc57..b29db310d4 100644 --- a/deal.II/cmake/configure/configure_netcdf.cmake +++ b/deal.II/cmake/configure/configure_netcdf.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the netcdf library: diff --git a/deal.II/cmake/configure/configure_p4est.cmake b/deal.II/cmake/configure/configure_p4est.cmake index a31ff138dd..9780127bc6 100644 --- a/deal.II/cmake/configure/configure_p4est.cmake +++ b/deal.II/cmake/configure/configure_p4est.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the p4est and sc libraries: @@ -34,13 +36,16 @@ MACRO(FEATURE_P4EST_FIND_EXTERNAL var) "p4est has to be configured with MPI enabled.\n" ) - UNSET(P4EST_LIBRARY CACHE) + UNSET(P4EST_LIBRARY_OPTIMIZED CACHE) + UNSET(P4EST_LIBRARY_DEBUG CACHE) UNSET(P4EST_INCLUDE_DIR CACHE) - UNSET(SC_LIBRARY CACHE) + UNSET(SC_LIBRARY_OPTIMIZED CACHE) + UNSET(SC_LIBRARY_DEBUG CACHE) UNSET(SC_INCLUDE_DIR CACHE) SET(P4EST_DIR "" CACHE PATH "An optional hint to a p4est installation/directory" ) + MARK_AS_ADVANCED(CLEAR P4EST_DIR) ELSE() SET(${var} TRUE) ENDIF() @@ -53,7 +58,7 @@ MACRO(FEATURE_P4EST_CONFIGURE_EXTERNAL) # The user has to know the location of the P4EST headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${P4EST_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${P4EST_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${P4EST_LIBRARIES}) ENDMACRO() CONFIGURE_FEATURE(P4EST) diff --git a/deal.II/cmake/configure/configure_slepc.cmake b/deal.II/cmake/configure/configure_slepc.cmake index cc1ff2b65e..bf5415a0ff 100644 --- a/deal.II/cmake/configure/configure_slepc.cmake +++ b/deal.II/cmake/configure/configure_slepc.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the SLEPC library: @@ -23,9 +25,14 @@ MACRO(FEATURE_SLEPC_FIND_EXTERNAL var) IF(SLEPC_FOUND) # - # Check whether SLEPc and PETSc are compatible. + # Check whether SLEPc and PETSc are compatible according to + # SLEPc's rules: This is equivalent to asking if the VERSION_MAJOR + # and VERSION_MINOR of PETSc and SLEPc are + # equivalent; and where VERSION_SUBMINORs are allowed to differ. # - IF("${SLEPC_VERSION}" STREQUAL "${PETSC_VERSION}") + IF( ("${SLEPC_VERSION_MAJOR}" STREQUAL "${PETSC_VERSION_MAJOR}") + AND + ("${SLEPC_VERSION_MINOR}" STREQUAL "${PETSC_VERSION_MINOR}")) SET(${var} TRUE) ELSE() @@ -43,6 +50,7 @@ MACRO(FEATURE_SLEPC_FIND_EXTERNAL var) SET(SLEPC_DIR "" CACHE PATH "An optional hint to a SLEPc directory" ) + MARK_AS_ADVANCED(CLEAR SLEPC_DIR) SET(${var} FALSE) ENDIF() @@ -55,7 +63,7 @@ MACRO(FEATURE_SLEPC_CONFIGURE_EXTERNAL) # The user has to know the location of the SLEPC headers as well: LIST(APPEND DEAL_II_USER_INCLUDE_DIRS ${SLEPC_INCLUDE_DIRS}) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${SLEPC_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${SLEPC_LIBRARIES}) ENDMACRO() diff --git a/deal.II/cmake/configure/configure_zlib.cmake b/deal.II/cmake/configure/configure_zlib.cmake index 88fb255111..250210beac 100644 --- a/deal.II/cmake/configure/configure_zlib.cmake +++ b/deal.II/cmake/configure/configure_zlib.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configuration for the zlib library: diff --git a/deal.II/cmake/macros/macro_add_flags.cmake b/deal.II/cmake/macros/macro_add_flags.cmake index a56bb3ae30..db70587a7d 100644 --- a/deal.II/cmake/macros/macro_add_flags.cmake +++ b/deal.II/cmake/macros/macro_add_flags.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small macro used for (string-)appending a string "${flags}" to a diff --git a/deal.II/cmake/macros/macro_check_cxx_compiler_bug.cmake b/deal.II/cmake/macros/macro_check_cxx_compiler_bug.cmake index ea2c41b433..6c600a2729 100644 --- a/deal.II/cmake/macros/macro_check_cxx_compiler_bug.cmake +++ b/deal.II/cmake/macros/macro_check_cxx_compiler_bug.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Check for a compiler bug. diff --git a/deal.II/cmake/macros/macro_clear_cmake_required.cmake b/deal.II/cmake/macros/macro_clear_cmake_required.cmake new file mode 100644 index 0000000000..186004f5d0 --- /dev/null +++ b/deal.II/cmake/macros/macro_clear_cmake_required.cmake @@ -0,0 +1,29 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# A small macro to clear the CMAKE_REQUIRED_* variables. +# +# Usage: +# CLEAR_CMAKE_REQUIRED_FLAGS +# + +MACRO(CLEAR_CMAKE_REQUIRED) + SET(CMAKE_REQUIRED_FLAGS) + SET(CMAKE_REQUIRED_INCLUDES) + SET(CMAKE_REQUIRED_LIBRARIES) +ENDMACRO() + diff --git a/deal.II/cmake/macros/macro_cond_set_to_yes.cmake b/deal.II/cmake/macros/macro_cond_set_to_yes.cmake index a0b6e40438..2eb3efaebc 100644 --- a/deal.II/cmake/macros/macro_cond_set_to_yes.cmake +++ b/deal.II/cmake/macros/macro_cond_set_to_yes.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # If bool is "true" (in a cmake fashion...), set variable to "yes", diff --git a/deal.II/cmake/macros/macro_configure_feature.cmake b/deal.II/cmake/macros/macro_configure_feature.cmake index 991531e19b..0ffbf4fb10 100644 --- a/deal.II/cmake/macros/macro_configure_feature.cmake +++ b/deal.II/cmake/macros/macro_configure_feature.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # This macro is used for the feature configuration in deal.II @@ -55,11 +57,11 @@ # -########################################################################### -# # -# Helper Macros: # -# # -########################################################################### +######################################################################## +# # +# Helper Macros: # +# # +######################################################################## # # Some black magic to have substitution in command names: @@ -140,19 +142,19 @@ MACRO(FEATURE_CONFIGURE_EXTERNAL _feature) INCLUDE_DIRECTORIES(${${_feature}_INCLUDE_DIRS}) ENDIF() IF(DEFINED ${_feature}_LIBRARIES) - LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${${_feature}_LIBRARIES}) + DEAL_II_APPEND_LIBRARIES(${${_feature}_LIBRARIES}) ENDIF() IF(DEFINED ${_feature}_LINKER_FLAGS) - ADD_FLAGS(CMAKE_SHARED_LINKER_FLAGS "${${_feature}_LINKER_FLAGS}") + ADD_FLAGS(DEAL_II_LINKER_FLAGS "${${_feature}_LINKER_FLAGS}") ENDIF() ENDMACRO() -########################################################################### -# # -# CONFIGURE_FEATURE: # -# # -########################################################################### +######################################################################## +# # +# CONFIGURE_FEATURE: # +# # +######################################################################## MACRO(CONFIGURE_FEATURE _feature) # diff --git a/deal.II/cmake/macros/macro_deal_ii_add_definitions.cmake b/deal.II/cmake/macros/macro_deal_ii_add_definitions.cmake index d626feafc8..01969882a1 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_definitions.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_add_definitions.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small wrapper around diff --git a/deal.II/cmake/macros/macro_deal_ii_add_dependencies.cmake b/deal.II/cmake/macros/macro_deal_ii_add_dependencies.cmake index 87ea359076..037885ff15 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_dependencies.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_add_dependencies.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small wrapper around ADD_DEPENDENCIES to add the specified dependencies diff --git a/deal.II/cmake/macros/macro_deal_ii_add_library.cmake b/deal.II/cmake/macros/macro_deal_ii_add_library.cmake index a86d4dba44..26c7ee3b81 100644 --- a/deal.II/cmake/macros/macro_deal_ii_add_library.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_add_library.cmake @@ -1,28 +1,30 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small wrapper around ADD_LIBRARY that will define a target for each # build type specified in DEAL_II_BUILD_TYPES # # It is assumed that the desired compilation configuration is set via -# DEAL_II_SHARED_LINKER_FLAGS_${build} +# DEAL_II_LINKER_FLAGS_${build} # DEAL_II_CXX_FLAGS_${build} # DEAL_II_DEFINITIONS_${build} # # as well as the global (for all build types) -# CMAKE_SHARED_LINKER_FLAGS +# DEAL_II_LINKER_FLAGS # CMAKE_CXX_FLAGS # DEAL_II_DEFINITIONS # @@ -37,7 +39,7 @@ MACRO(DEAL_II_ADD_LIBRARY _library) ) SET_TARGET_PROPERTIES(${_library}.${_build_lowercase} PROPERTIES - LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${_build}}" + LINK_FLAGS "${DEAL_II_LINKER_FLAGS};${DEAL_II_LINKER_FLAGS_${_build}}" COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" LINKER_LANGUAGE "CXX" diff --git a/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake b/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake new file mode 100644 index 0000000000..de291d39b6 --- /dev/null +++ b/deal.II/cmake/macros/macro_deal_ii_append_libraries.cmake @@ -0,0 +1,47 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# A small macro to add libraries to +# DEAL_II_EXTERNAL_LIBRARIES +# DEAL_II_EXTERNAL_LIBRARIES_DEBUG +# DEAL_II_EXTERNAL_LIBRARIES_RELEASE +# depending on the "optmized", "debug" or "general" keyword +# +# Usage: +# DEAL_II_APPEND_LIBRARIES() +# + +MACRO(DEAL_II_APPEND_LIBRARIES) + + SET(_toggle "general") + FOREACH(_tmp ${ARGN}) + IF( "${_tmp}" STREQUAL "debug" OR + "${_tmp}" STREQUAL "optimized" OR + "${_tmp}" STREQUAL "general" ) + SET(_toggle "${_tmp}") + ELSE() + IF("${_toggle}" STREQUAL "general") + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${_tmp}) + ELSEIF("${_toggle}" STREQUAL "debug") + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_DEBUG ${_tmp}) + ELSEIF("${_toggle}" STREQUAL "optimized") + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES_RELEASE ${_tmp}) + ENDIF() + ENDIF() + ENDFOREACH() + +ENDMACRO() diff --git a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake index 6aa654d35b..8f355ff1c9 100644 --- a/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # This file implements the DEAL_II_INITIALIZE_VARIABLES macro, which is @@ -49,24 +51,40 @@ MACRO(DEAL_II_INITIALIZE_CACHED_VARIABLES) ENDIF() # - # Bail out if build type is unknown... + # Reset build type if unsupported, i.e. if it is not (case insensitively + # equal to Debug or Release or unsupported by the current build type: # - IF( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND - NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" ) - MESSAGE(FATAL_ERROR - "\nCMAKE_BUILD_TYPE does neither match Release nor Debug!\n\n" + STRING(TOLOWER "${CMAKE_BUILD_TYPE}" _cmake_build_type) + STRING(TOLOWER "${DEAL_II_BUILD_TYPE}" _deal_ii_build_type) + + IF( NOT "${_cmake_build_type}" MATCHES "^(debug|release)$" + OR NOT _deal_ii_build_type MATCHES "${_cmake_build_type}" ) + + IF("${DEAL_II_BUILD_TYPE}" STREQUAL "DebugRelease") + SET(_new_build_type "Debug") + ELSE() + SET(_new_build_type "${DEAL_II_BUILD_TYPE}") + ENDIF() + + MESSAGE( +"### +# +# WARNING: +# +# CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\" unsupported by current installation! +# deal.II was built with CMAKE_BUILD_TYPE \"${DEAL_II_BUILD_TYPE}\". +# +# CMAKE_BUILD_TYPE is forced to \"${_new_build_type}\". +# +###" ) - ENDIF() - # - # ... or unsupported - # - IF(NOT DEAL_II_BUILD_TYPE MATCHES "${CMAKE_BUILD_TYPE}") - MESSAGE(FATAL_ERROR "\n" - "CMAKE_BUILD_TYPE \"${CMAKE_BUILD_TYPE}\" unsupported by current installation!\n" - "deal.II was build with \"${DEAL_II_BUILD_TYPE}\" only build type.\n\n" + SET(CMAKE_BUILD_TYPE "${_new_build_type}" CACHE STRING + "Choose the type of build, options are: Debug, Release" + FORCE ) ENDIF() + SET(CMAKE_CXX_COMPILER ${DEAL_II_CXX_COMPILER} CACHE STRING "CXX Compiler.") diff --git a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake index e643446317..a418855339 100644 --- a/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_invoke_autopilot.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # This file implements the DEAL_II_INVOKE_AUTOPILOT macro, which is @@ -40,95 +42,89 @@ MACRO(DEAL_II_INVOKE_AUTOPILOT) ADD_EXECUTABLE(${TARGET} ${TARGET_SRC}) DEAL_II_SETUP_TARGET(${TARGET}) - IF(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - MESSAGE(STATUS - "Out-of-source build. Target ${TARGET} defined but additional " - "autopilot funcionality is not available." - ) + MESSAGE(STATUS "Autopilot invoked") - ELSE() + # Define a custom target to easily run the program: + + IF(NOT DEFINED TARGET_RUN) + SET(TARGET_RUN ${TARGET}) + ENDIF() - MESSAGE(STATUS "Autopilot invoked") - - # Define a custom target to easily run the program: - - IF(NOT DEFINED TARGET_RUN) - SET(TARGET_RUN ${TARGET}) - ENDIF() - - # - # Hack for Cygwin targets: Export PATH to point to the dynamic library. - # This is more or less harmless, so do this unconditionally. - # - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake - "SET(ENV{PATH} \"${CMAKE_CURRENT_BINARY_DIR}:${DEAL_II_PATH}/${DEAL_II_LIBRARY_RELDIR}:\$ENV{PATH}\")\n" - "EXECUTE_PROCESS(COMMAND ${TARGET_RUN}\n" - " RESULT_VARIABLE _return_value\n" - " )\n" - "IF(NOT \"\${_return_value}\" STREQUAL "0")\n" - " MESSAGE(SEND_ERROR \"\nProgram terminated with exit code: \${_return_value}\")\n" - "ENDIF()\n" + # + # Hack for Cygwin targets: Export PATH to point to the dynamic library. + # This is more or less harmless, so do this unconditionally. + # + FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake + "SET(ENV{PATH} \"${CMAKE_CURRENT_BINARY_DIR}:${DEAL_II_PATH}/${DEAL_II_LIBRARY_RELDIR}:\$ENV{PATH}\")\n" + "EXECUTE_PROCESS(COMMAND ${TARGET_RUN}\n" + " RESULT_VARIABLE _return_value\n" + " )\n" + "IF(NOT \"\${_return_value}\" STREQUAL "0")\n" + " MESSAGE(SEND_ERROR \"\nProgram terminated with exit code: \${_return_value}\")\n" + "ENDIF()\n" + ) + IF(NOT "${TARGET_RUN}" STREQUAL "") + ADD_CUSTOM_TARGET(run + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake + DEPENDS ${TARGET} + COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration" ) - IF(NOT "${TARGET_RUN}" STREQUAL "") - ADD_CUSTOM_TARGET(run - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/run_target.cmake - DEPENDS ${TARGET} - COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration" - ) - SET(_run_targets - "# $ make run - to (compile, link and) run the program\n" - ) - ENDIF() - - # Define custom targets to easily switch the build type: - IF(${DEAL_II_BUILD_TYPE} MATCHES "Debug") - ADD_CUSTOM_TARGET(debug - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} - COMMENT "Switch CMAKE_BUILD_TYPE to Debug" - ) - SET(_switch_targets - "# $ make debug - to switch the build type to \"Debug\"\n" - ) - ENDIF() - IF(${DEAL_II_BUILD_TYPE} MATCHES "Release") - ADD_CUSTOM_TARGET(release - COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} - COMMENT "Switch CMAKE_BUILD_TYPE to Release" - ) - SET(_switch_targets - "${_switch_targets}# $ make release - to switch the build type to \"Release\"\n" - ) - ENDIF() - - # And another custom target to clean up all files generated by the program: - IF("${CLEAN_UP_FILES}" STREQUAL "") - SET(CLEAN_UP_FILES *.log *.gmv *.gnuplot *.gpl *.eps *.pov *.vtk *.ucd *.d2) - ENDIF() - ADD_CUSTOM_TARGET(runclean - COMMAND ${CMAKE_COMMAND} -E remove ${CLEAN_UP_FILES} - COMMENT "runclean invoked" + SET(_run_targets + "# $ make run - to (compile, link and) run the program\n" ) + ENDIF() - # Define a distclean target to remove every generated file: - ADD_CUSTOM_TARGET(distclean - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target runclean - COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles - COMMAND ${CMAKE_COMMAND} -E remove CMakeCache.txt cmake_install.cmake Makefile - COMMENT "distclean invoked" + # Define custom targets to easily switch the build type: + ADD_CUSTOM_TARGET(debug + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all + COMMENT "Switch CMAKE_BUILD_TYPE to Debug" + ) + + ADD_CUSTOM_TARGET(release + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all + COMMENT "Switch CMAKE_BUILD_TYPE to Release" + ) + + # Only mention release and debug targets if it is actuallay possible to + # switch between them: + IF(${DEAL_II_BUILD_TYPE} MATCHES "DebugRelease") + SET(_switch_targets +"# $ make debug - to switch the build type to \"Debug\" +# $ make release - to switch the build type to \"Release\"\n" ) + ENDIF() - # Define a strip-comments target: - FIND_PACKAGE(Perl QUIET) - IF(PERL_FOUND) - ADD_CUSTOM_TARGET(strip_comments - COMMAND ${PERL_EXECUTABLE} -pi -e 's\#^[ \\t]*//.*\\n\#\#g;' ${TARGET_SRC} - COMMENT "strip comments" - ) - ENDIF() - - # Print out some usage information to file: - FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake + # And another custom target to clean up all files generated by the program: + IF("${CLEAN_UP_FILES}" STREQUAL "") + SET(CLEAN_UP_FILES *.log *.gmv *.gnuplot *.gpl *.eps *.pov *.vtk *.ucd *.d2) + ENDIF() + ADD_CUSTOM_TARGET(runclean + COMMAND ${CMAKE_COMMAND} -E remove ${CLEAN_UP_FILES} + COMMENT "runclean invoked" + ) + + # Define a distclean target to remove every generated file: + ADD_CUSTOM_TARGET(distclean + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target runclean + COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles + COMMAND ${CMAKE_COMMAND} -E remove CMakeCache.txt cmake_install.cmake Makefile + COMMENT "distclean invoked" + ) + + # Define a strip-comments target: + FIND_PACKAGE(Perl QUIET) + IF(PERL_FOUND) + ADD_CUSTOM_TARGET(strip_comments + COMMAND ${PERL_EXECUTABLE} -pi -e 's\#^[ \\t]*//.*\\n\#\#g;' ${TARGET_SRC} + COMMENT "strip comments" + ) + ENDIF() + + # Print out some usage information to file: + FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake "MESSAGE( \"### # @@ -158,21 +154,19 @@ ${_switch_targets}# # Have a nice day! # ###\")" - ) + ) - # A custom target to print the message: - ADD_CUSTOM_TARGET(help - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake - ) - - # Print this message once: - IF(NOT USAGE_PRINTED) - INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake) - SET(USAGE_PRINTED TRUE CACHE INTERNAL "") - ELSE() - MESSAGE(STATUS "Run $ make help to print a detailed help message") - ENDIF() + # A custom target to print the message: + ADD_CUSTOM_TARGET(help + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake + ) + # Print this message once: + IF(NOT USAGE_PRINTED) + INCLUDE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/print_usage.cmake) + SET(USAGE_PRINTED TRUE CACHE INTERNAL "") + ELSE() + MESSAGE(STATUS "Run $ make help to print a detailed help message") ENDIF() ENDMACRO() diff --git a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake index ef17eb7e7f..28b88dd1d0 100644 --- a/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake +++ b/deal.II/cmake/macros/macro_deal_ii_setup_target.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # This file implements the DEAL_II_SETUP_TARGET macro, which is @@ -59,16 +61,16 @@ MACRO(DEAL_II_SETUP_TARGET _target) ) # - # Append build type dependend flags and definitions. + # Append build type dependent flags and definitions. # # # For this we obey the behaviour of the "optimized" and "debug" # keywords and this is a bit tricky: # - # If the global property DEBUG_CONFIGURATIONS is set all build - # types that (case insensitive) match one of the listed build types is - # considered a "debug" build. Ther rest is "optimized". + # If the global property DEBUG_CONFIGURATIONS is set all build types that + # (case insensitively) match one of the listed build types is considered + # a "debug" build. The rest is "optimized". # # Otherwise every build type that (case insensitively) matches "debug" is # considered a debug build. @@ -95,7 +97,12 @@ MACRO(DEAL_II_SETUP_TARGET _target) ENDIF() ENDIF() - IF(_on_debug_build) + # + # We can only append DEBUG link flags and compile definitions if deal.II + # was build with Debug or DebugRelease build type. So test for this: + # + IF( _on_debug_build + AND DEAL_II_BUILD_TYPE MATCHES "Debug" ) SET_PROPERTY(TARGET ${_target} APPEND_STRING PROPERTY LINK_FLAGS " ${DEAL_II_LINKER_FLAGS_DEBUG}" ) @@ -116,4 +123,14 @@ MACRO(DEAL_II_SETUP_TARGET _target) # TARGET_LINK_LIBRARIES(${_target} ${DEAL_II_TARGET}) + # + # If DEAL_II_STATIC_EXECUTABLE is set, switch the final link type to + # static: + # + IF(DEAL_II_STATIC_EXECUTABLE) + SET_PROPERTY(TARGET ${_target} PROPERTY + LINK_SEARCH_END_STATIC TRUE + ) + ENDIF() + ENDMACRO() diff --git a/deal.II/cmake/macros/macro_enable_if_links.cmake b/deal.II/cmake/macros/macro_enable_if_links.cmake index e2d2a2b9e3..6c2bfeb6d1 100644 --- a/deal.II/cmake/macros/macro_enable_if_links.cmake +++ b/deal.II/cmake/macros/macro_enable_if_links.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Tests whether it is possible to compile and link a dummy program with a @@ -28,7 +30,7 @@ MACRO(ENABLE_IF_LINKS _variable _flag) STRING(REPLACE "," "" _flag_name "${_flag_name}") STRING(REPLACE "--" "__" _flag_name "${_flag_name}") SET(_backup ${CMAKE_REQUIRED_LIBRARIES}) - SET(CMAKE_REQUIRED_LIBRARIES "${_flag_stripped}") + LIST(APPEND CMAKE_REQUIRED_LIBRARIES "${_flag_stripped}") CHECK_CXX_COMPILER_FLAG( "" DEAL_II_HAVE_FLAG_${_flag_name} diff --git a/deal.II/cmake/macros/macro_enable_if_supported.cmake b/deal.II/cmake/macros/macro_enable_if_supported.cmake index 9c98c9155e..8e26c7b0c7 100644 --- a/deal.II/cmake/macros/macro_enable_if_supported.cmake +++ b/deal.II/cmake/macros/macro_enable_if_supported.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Tests whether the cxx compiler understands a flag. @@ -26,6 +28,7 @@ MACRO(ENABLE_IF_SUPPORTED _variable _flag) STRING(REGEX REPLACE "^-" "" _flag_name "${_flag_stripped}") STRING(REPLACE "," "" _flag_name "${_flag_name}") STRING(REPLACE "--" "__" _flag_name "${_flag_name}") + STRING(REPLACE "++" "__" _flag_name "${_flag_name}") CHECK_CXX_COMPILER_FLAG( "${_flag_stripped}" DEAL_II_HAVE_FLAG_${_flag_name} diff --git a/deal.II/cmake/macros/macro_enable_language_optional.cmake b/deal.II/cmake/macros/macro_enable_language_optional.cmake new file mode 100644 index 0000000000..fccb978ae4 --- /dev/null +++ b/deal.II/cmake/macros/macro_enable_language_optional.cmake @@ -0,0 +1,74 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + + +# +# Test whether a usable language compiler is available and if yes, call +# ENABLE_LANGUAGE(language) +# +# This works around a severe bug [1] in +# +# ENABLE_LANGUAGE(Fortran OPTIONAL) +# +# [1] http://public.kitware.com/Bug/view.php?id=9220 +# +# Usage: +# ENABLE_LANGUAGE_FORTRAN_OPTIONAL(language) +# +# where language is either C or Fortran +# + +MACRO(ENABLE_LANGUAGE_OPTIONAL _language) + IF(NOT ${_language}_CHECKED) + # + # Run this check exactly once: + # + SET(${_language}_CHECKED TRUE CACHE INTERNAL "" FORCE) + + SET(_tmp ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/${_language}_test) + file(REMOVE ${_tmp}) + + IF(DEFINED CMAKE_${_language}_COMPILER) + SET(_hint "-DCMAKE_${_language}_COMPILER=${CMAKE_${_language}_COMPILER}") + ENDIF() + + FILE(WRITE ${_tmp}/CMakeLists.txt + "PROJECT(foobar ${_language})" + ) + + EXECUTE_PROCESS( + COMMAND ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${_hint} . + WORKING_DIRECTORY ${_tmp} + RESULT_VARIABLE _result + OUTPUT_QUIET + ERROR_QUIET + ) + + IF("${_result}" STREQUAL "0") + SET(DEAL_II_${_language}_COMPILER_WORKS TRUE CACHE INTERNAL "" FORCE) + ENABLE_LANGUAGE(${_language}) + ELSE() + MESSAGE(STATUS "No working ${_language} compiler found, disabling ${_language}") + ENDIF() + ELSE() + # + # Enable the language depending on the cached result from a former run: + # + IF(DEAL_II_${_language}_COMPILER_WORKS) + ENABLE_LANGUAGE(${_language}) + ENDIF() + ENDIF() +ENDMACRO() diff --git a/deal.II/cmake/macros/macro_expand_instantiations.cmake b/deal.II/cmake/macros/macro_expand_instantiations.cmake index f083500249..684860d475 100644 --- a/deal.II/cmake/macros/macro_expand_instantiations.cmake +++ b/deal.II/cmake/macros/macro_expand_instantiations.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A macro for the inst.in file expansion @@ -33,22 +35,16 @@ MACRO(EXPAND_INSTANTIATIONS _target _inst_in_files) - IF(CMAKE_CROSSCOMPILING) - SET(_ei_exec native-expand_instantiations) - ELSE() - SET(_ei_exec expand_instantiations) - ENDIF() - FOREACH (_inst_in_file ${_inst_in_files}) STRING(REGEX REPLACE "\\.in$" "" _inst_file "${_inst_in_file}" ) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file} - DEPENDS ${_ei_exec} - ${CMAKE_BINARY_DIR}/cmake/config/template-arguments + DEPENDS expand_instantiations + ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments ${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file} - COMMAND ${_ei_exec} - ARGS ${CMAKE_BINARY_DIR}/cmake/config/template-arguments + COMMAND expand_instantiations + ARGS ${CMAKE_BINARY_DIR}/${DEAL_II_COMMON_RELDIR}/template-arguments < ${CMAKE_CURRENT_SOURCE_DIR}/${_inst_in_file} > ${CMAKE_CURRENT_BINARY_DIR}/${_inst_file} ) diff --git a/deal.II/cmake/macros/macro_find_package.cmake b/deal.II/cmake/macros/macro_find_package.cmake index 01adf7a2bc..c7e65fbe85 100644 --- a/deal.II/cmake/macros/macro_find_package.cmake +++ b/deal.II/cmake/macros/macro_find_package.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small wrapper around FIND_PACKAGE. diff --git a/deal.II/cmake/macros/macro_item_matches.cmake b/deal.II/cmake/macros/macro_item_matches.cmake index 748661a2e6..3e747bb4c4 100644 --- a/deal.II/cmake/macros/macro_item_matches.cmake +++ b/deal.II/cmake/macros/macro_item_matches.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small macro to test whether a given list contains an element. diff --git a/deal.II/cmake/macros/macro_pop_test_flag.cmake b/deal.II/cmake/macros/macro_pop_test_flag.cmake index c39529c40e..045fe43e2f 100644 --- a/deal.II/cmake/macros/macro_pop_test_flag.cmake +++ b/deal.II/cmake/macros/macro_pop_test_flag.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small macro used in the platform checks to remove the right most flag in diff --git a/deal.II/cmake/macros/macro_push_test_flag.cmake b/deal.II/cmake/macros/macro_push_test_flag.cmake index 23f6f30f87..905ce92e16 100644 --- a/deal.II/cmake/macros/macro_push_test_flag.cmake +++ b/deal.II/cmake/macros/macro_push_test_flag.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small macro used in the platform checks to easily add a flag to diff --git a/deal.II/cmake/macros/macro_replace_flag.cmake b/deal.II/cmake/macros/macro_replace_flag.cmake index 5ab43cac49..22dd7bafa0 100644 --- a/deal.II/cmake/macros/macro_replace_flag.cmake +++ b/deal.II/cmake/macros/macro_replace_flag.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Replace all occurences of "${flag}" with "${replacement}" in the string diff --git a/deal.II/cmake/macros/macro_reset_cmake_required.cmake b/deal.II/cmake/macros/macro_reset_cmake_required.cmake new file mode 100644 index 0000000000..0f2865a3d7 --- /dev/null +++ b/deal.II/cmake/macros/macro_reset_cmake_required.cmake @@ -0,0 +1,30 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# A small macro to reset the CMAKE_REQUIRED_* variables to its default +# values +# +# Usage: +# RESET_CMAKE_REQUIRED_FLAGS +# + +MACRO(RESET_CMAKE_REQUIRED) + SET(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX_FLAGS_SAVED}) + SET(CMAKE_REQUIRED_INCLUDES) + SET(CMAKE_REQUIRED_LIBRARIES) +ENDMACRO() + diff --git a/deal.II/cmake/macros/macro_set_if_empty.cmake b/deal.II/cmake/macros/macro_set_if_empty.cmake index 98031b0492..43f0125445 100644 --- a/deal.II/cmake/macros/macro_set_if_empty.cmake +++ b/deal.II/cmake/macros/macro_set_if_empty.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # If 'variable' is empty it will be set to 'value' diff --git a/deal.II/cmake/macros/macro_split_debug_release.cmake b/deal.II/cmake/macros/macro_split_debug_release.cmake deleted file mode 100644 index c39c5fb4c5..0000000000 --- a/deal.II/cmake/macros/macro_split_debug_release.cmake +++ /dev/null @@ -1,53 +0,0 @@ -##### -## -## Copyright (C) 2013 by the deal.II authors -## -## This file is part of the deal.II library. -## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. -## -## Author: Matthias Maier -## -##### - - -# -# A small macro to split a list of libraries with debug, optimized and -# general keywords into two lists consisting of all libraries necessary for -# the debug and release target only. If no keyword is given "optimized" is -# assumed. -# -# Usage: -# SPLIT_DEBUG_RELEASE(list_debug list_release <...list of libraries...>) -# -# - -MACRO(SPLIT_DEBUG_RELEASE _list_debug _list_release) - - SET(_toggle "optimized") - FOREACH(_tmp ${ARGN}) - IF("${_tmp}" STREQUAL "debug" OR - "${_tmp}" STREQUAL "optimized" OR - "${_tmp}" STREQUAL "general") - SET(_toggle "${_tmp}") - ELSE() - IF("${_toggle}" STREQUAL "general") - LIST(APPEND ${_list_debug} "${_tmp}") - LIST(APPEND ${_list_release} "${_tmp}") - ELSEIF("${_toggle}" STREQUAL "debug") - LIST(APPEND ${_list_debug} "${_tmp}") - ELSEIF("${_toggle}" STREQUAL "optimized") - LIST(APPEND ${_list_release} "${_tmp}") - ENDIF() - ENDIF() - ENDFOREACH() - - IF("${${_list_debug}}" STREQUAL "") - SET(${_list_debug} ${${_list_release}}) - ELSEIF("${${_list_release}}" STREQUAL "") - SET(${_list_release} ${${_list_debug}}) - ENDIF() - -ENDMACRO() diff --git a/deal.II/cmake/macros/macro_strip_flag.cmake b/deal.II/cmake/macros/macro_strip_flag.cmake index d90979ad9b..c1eb32d8e0 100644 --- a/deal.II/cmake/macros/macro_strip_flag.cmake +++ b/deal.II/cmake/macros/macro_strip_flag.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Remove all occurences of "${flag}" in the string variable. diff --git a/deal.II/cmake/macros/macro_switch_library_preference.cmake b/deal.II/cmake/macros/macro_switch_library_preference.cmake new file mode 100644 index 0000000000..9f61f9b094 --- /dev/null +++ b/deal.II/cmake/macros/macro_switch_library_preference.cmake @@ -0,0 +1,33 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# This macro toggles the preference for static/shared libraries if +# DEAL_II_PREFER_STATIC_LIBS=TRUE but the final executable will still be +# dynamically linked, i.e. DEAL_II_STATIC_EXECUTABLE=OFF +# +# Usage: +# SWITCH_LIBRARY_PREFERENCE() +# + +MACRO(SWITCH_LIBRARY_PREFERENCE) + IF(DEAL_II_PREFER_STATIC_LIBS AND NOT DEAL_II_STATIC_EXECUTABLE) + # + # Invert the search order for libraries when DEAL_II_PREFER_STATIC_LIBS + # is set. This will prefer static archives instead of shared libraries: + LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) + ENDIF() +ENDMACRO() diff --git a/deal.II/cmake/macros/macro_to_string.cmake b/deal.II/cmake/macros/macro_to_string.cmake index 7f52449d38..95b6b06aea 100644 --- a/deal.II/cmake/macros/macro_to_string.cmake +++ b/deal.II/cmake/macros/macro_to_string.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small macro used for converting a list into a space diff --git a/deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake b/deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake index 8a7214f114..f382578a97 100644 --- a/deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake +++ b/deal.II/cmake/macros/macro_to_string_and_add_prefix.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # A small macro used for converting a cmake list into a space diff --git a/deal.II/cmake/modules/FindARPACK.cmake b/deal.II/cmake/modules/FindARPACK.cmake index a57f307961..f2bb51d628 100644 --- a/deal.II/cmake/modules/FindARPACK.cmake +++ b/deal.II/cmake/modules/FindARPACK.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the ARPACK library @@ -32,7 +34,7 @@ SET_IF_EMPTY(ARPACK_DIR "$ENV{ARPACK_DIR}") # # ARPACK needs LAPACK and BLAS as dependencies: # -FIND_PACKAGE(LAPACK) +FIND_PACKAGE(DEALII_LAPACK) FIND_LIBRARY(ARPACK_LIBRARY NAMES arpack @@ -46,21 +48,23 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ARPACK DEFAULT_MSG LAPACK_FOUND ) +MARK_AS_ADVANCED( + lapack_LIBRARY + atlas_LIBRARY + blas_LIBRARY + ARPACK_LIBRARY + ) + IF(ARPACK_FOUND) SET(ARPACK_LIBRARIES - ${ARPACK_LIBRARY} ${LAPACK_LIBRARIES} + ${ARPACK_LIBRARY} + ${LAPACK_LIBRARIES} ) SET(ARPACK_LINKER_FLAGS ${LAPACK_LINKER_FLAGS} ) - MARK_AS_ADVANCED( - lapack_LIBRARY - atlas_LIBRARY - blas_LIBRARY - ARPACK_LIBRARY - ARPACK_DIR - ) + MARK_AS_ADVANCED(ARPACK_DIR) ELSE() SET(ARPACK_DIR "" CACHE PATH "An optional hint to an ARPACK installation" diff --git a/deal.II/cmake/modules/FindDEALII_LAPACK.cmake b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake new file mode 100644 index 0000000000..b1c7630265 --- /dev/null +++ b/deal.II/cmake/modules/FindDEALII_LAPACK.cmake @@ -0,0 +1,138 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# This module is a wrapper around the FindLAPACK.cmake module provided by +# CMake. +# +# This module exports +# +# LAPACK_FOUND +# LAPACK_LIBRARIES +# LAPACK_LINKER_FLAGS +# BLAS_FOUND +# BLAS_LIBRARIES +# BLAS_LINKER_FLAGS +# METIS_INCLUDE_DIRS +# + + + +# +# We have to use a trick with CMAKE_PREFIX_PATH to make LAPACK_DIR and +# BLAS_DIR work... +# +SET_IF_EMPTY(BLAS_DIR "$ENV{BLAS_DIR}") +SET_IF_EMPTY(LAPACK_DIR "$ENV{LAPACK_DIR}") + +SET(_cmake_prefix_path_backup "${CMAKE_PREFIX_PATH}") + +SET(CMAKE_PREFIX_PATH ${BLAS_DIR} ${LAPACK_DIR} ${_cmake_prefix_path_backup}) + +FIND_PACKAGE(BLAS) + +SET(CMAKE_PREFIX_PATH ${LAPACK_DIR} ${_cmake_prefix_path_backup}) + +FIND_PACKAGE(LAPACK) + +SET(CMAKE_PREFIX_PATH ${_cmake_prefix_path_backup}) + +MARK_AS_ADVANCED( + atlas_LIBRARY + blas_LIBRARY + gslcblas_LIBRARY + lapack_LIBRARY + m_LIBRARY + ptf77blas_LIBRARY + ptlapack_LIBRARY + refblas_LIBRARY + reflapack_LIBRARY + ) + + +IF(LAPACK_FOUND) + SET(DEALII_LAPACK_FOUND TRUE) + + # + # So, well... LAPACK_LINKER_FLAGS and LAPACK_LIBRARIES should contain the + # complete link interface. But for invalid user overrides we include + # BLAS_LIBRARIES and BLAS_LINKER_FLAGS as well.. + # + IF(NOT LAPACK_LINKER_FLAGS MATCHES "${BLAS_LINKER_FLAGS}") + MESSAGE(STATUS + "Manually adding BLAS_LINKER_FLAGS to LAPACK_LINKER_FLAGS" + ) + ADD_FLAGS(LAPACK_LINKER_FLAGS "${BLAS_LINKER_FLAGS}") + ENDIF() + IF(NOT "${LAPACK_LIBRARIES}" MATCHES "${BLAS_LIBRARIES}") + MESSAGE(STATUS + "Manually adding BLAS_LIBRARIES to LAPACK_LIBRARIES" + ) + LIST(APPEND LAPACK_LIBRARIES ${BLAS_LIBRARIES}) + ENDIF() + + # + # Well, in case of static archives we have to manually pick up the + # complete link interface. *sigh* + # + # Do this unconditionally for the most common case: + # TODO: Non-GNU setups... + # + # Switch the library preference back to prefer dynamic libraries if + # DEAL_II_PREFER_STATIC_LIBS=TRUE but DEAL_II_STATIC_EXECUTABLE=FALSE. In + # this case system libraries should be linked dynamically. + # + SWITCH_LIBRARY_PREFERENCE() + FOREACH(_lib gfortran m quadmath) + FIND_LIBRARY(${_lib}_LIBRARY + NAMES ${_lib} + HINTS ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}) + MARK_AS_ADVANCED(${_lib}_LIBRARY) + + IF(NOT ${_lib}_LIBRARY MATCHES "-NOTFOUND") + LIST(APPEND BLAS_LIBRARIES ${${_lib}_LIBRARY}) + LIST(APPEND LAPACK_LIBRARIES ${${_lib}_LIBRARY}) + ENDIF() + ENDFOREACH() + SWITCH_LIBRARY_PREFERENCE() + + MARK_AS_ADVANCED( + BLAS_DIR + LAPACK_DIR + ) + +ELSE() + SET(DEALII_LAPACK_FOUND FALSE) + + SET(LAPACK_DIR "" CACHE PATH + "An optional hint to a LAPACK installation" + ) + SET(BLAS_DIR "" CACHE PATH + "An optional hint to a BLAS installation" + ) + + # + # If we couldn't find LAPACK, clean up the library variables: + # + + IF("${BLAS_LIBRARIES}" STREQUAL "FALSE") + SET(BLAS_LIBRARIES "") + ENDIF() + IF("${LAPACK_LIBRARIES}" STREQUAL "FALSE") + SET(LAPACK_LIBRARIES "") + ENDIF() + +ENDIF() diff --git a/deal.II/cmake/modules/FindHDF5.cmake b/deal.II/cmake/modules/FindHDF5.cmake index 12675f7ed2..bac83af2d6 100644 --- a/deal.II/cmake/modules/FindHDF5.cmake +++ b/deal.II/cmake/modules/FindHDF5.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the HDF5 library @@ -47,9 +49,15 @@ FIND_LIBRARY(HDF5_HL_LIBRARY NAMES hdf5_hl lib${LIB_SUFFIX} lib64 lib ) -SET(_output ${HDF5_LIBRARY} ${HDF5_HL_LIBRARY}) +SET(_output ${HDF5_HL_LIBRARY} ${HDF5_LIBRARY}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(HDF5 DEFAULT_MSG _output # Cosmetic: Gives nice output + HDF5_HL_LIBRARY + HDF5_LIBRARY + HDF5_INCLUDE_DIR + ) + +MARK_AS_ADVANCED( HDF5_LIBRARY HDF5_HL_LIBRARY HDF5_INCLUDE_DIR @@ -60,8 +68,9 @@ IF(HDF5_FOUND) ${HDF5_INCLUDE_DIR} ) SET(HDF5_LIBRARIES - ${HDF5_LIBRARY} ${HDF5_HL_LIBRARY} + ${HDF5_LIBRARY} + ${MPI_C_LIBRARIES} # for good measure ) # @@ -75,12 +84,7 @@ IF(HDF5_FOUND) SET(HDF5_WITH_MPI TRUE) ENDIF() - MARK_AS_ADVANCED( - HDF5_DIR - HDF5_LIBRARY - HDF5_HL_LIBRARY - HDF5_INCLUDE_DIR - ) + MARK_AS_ADVANCED(HDF5_DIR) ELSE() SET(HDF5_DIR "" CACHE PATH "An optional hint to an hdf5 directory" diff --git a/deal.II/cmake/modules/FindMETIS.cmake b/deal.II/cmake/modules/FindMETIS.cmake index b0a92789ee..29c9be531f 100644 --- a/deal.II/cmake/modules/FindMETIS.cmake +++ b/deal.II/cmake/modules/FindMETIS.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the (serial) METIS library @@ -19,6 +21,10 @@ # # METIS_LIBRARIES # METIS_INCLUDE_DIRS +# METIS_VERSION +# METIS_VERSION_MAJOR +# METIS_VERSION_MINOR +# METIS_VERSION_SUBMINOR # INCLUDE(FindPackageHandleStandardArgs) @@ -26,8 +32,10 @@ INCLUDE(FindPackageHandleStandardArgs) SET_IF_EMPTY(METIS_DIR "$ENV{METIS_DIR}") # -# TODO: Metis is usually pretty self contained. So no external dependencies -# so far... But there could be dependencies on pcre and mpi... +# Metis is usually pretty self contained. So no external dependencies +# so far. But there could be dependencies on pcre and mpi... +# +# Link in MPI unconditionally (if found). # FIND_PATH(METIS_INCLUDE_DIR metis.h @@ -47,31 +55,65 @@ FIND_LIBRARY(METIS_LIBRARY build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libmetis ) +FIND_LIBRARY(PARMETIS_LIBRARY + NAMES parmetis + HINTS + ${METIS_DIR} + PATH_SUFFIXES + lib${LIB_SUFFIX} lib64 lib + # This is a hint, isn't it? + build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libmetis + ) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(METIS DEFAULT_MSG METIS_LIBRARY METIS_INCLUDE_DIR ) +MARK_AS_ADVANCED( + METIS_LIBRARY + PARMETIS_LIBRARY + METIS_INCLUDE_DIR + ) + IF(METIS_FOUND) - SET(METIS_LIBRARIES ${METIS_LIBRARY}) + + IF(NOT PARMETIS_LIBRARY MATCHES "-NOTFOUND") + SET(METIS_LIBRARIES ${PARMETIS_LIBRARY}) + ENDIF() + + LIST(APPEND METIS_LIBRARIES + ${METIS_LIBRARY} + ${MPI_C_LIBRARIES} # for good measure + ) SET(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR}) # # Extract the version number out of metis.h # - FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" METIS_MAJOR_STRING - REGEX "METIS_VER_MAJOR") - STRING(REGEX REPLACE "^.*METIS_VER_MAJOR.* ([0-9]+).*" "\\1" METIS_MAJOR "${METIS_MAJOR_STRING}") - - FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" METIS_MINOR_STRING - REGEX "METIS_VER_MINOR") - STRING(REGEX REPLACE "^.*METIS_VER_MINOR.* ([0-9]+).*" "\\1" METIS_MINOR "${METIS_MINOR_STRING}") + FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" _metis_major_string + REGEX "METIS_VER_MAJOR" + ) + STRING(REGEX REPLACE "^.*METIS_VER_MAJOR.* ([0-9]+).*" "\\1" + METIS_VERSION_MAJOR "${_metis_major_string}" + ) + FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" _metis_minor_string + REGEX "METIS_VER_MINOR" + ) + STRING(REGEX REPLACE "^.*METIS_VER_MINOR.* ([0-9]+).*" "\\1" + METIS_VERSION_MINOR "${_metis_minor_string}" + ) + FILE(STRINGS "${METIS_INCLUDE_DIR}/metis.h" _metis_subminor_string + REGEX "METIS_VER_SUBMINOR" + ) + STRING(REGEX REPLACE "^.*METIS_VER_SUBMINOR.* ([0-9]+).*" "\\1" + METIS_VERSION_SUBMINOR "${_metis_subminor_string}" + ) + SET(METIS_VERSION + "${METIS_VERSION_MAJOR}.${METIS_VERSION_MINOR}.${METIS_VERSION_SUBMINOR}" + ) - MARK_AS_ADVANCED( - METIS_LIBRARY - METIS_INCLUDE_DIR - METIS_DIR - ) + MARK_AS_ADVANCED(METIS_DIR) ELSE() SET(METIS_DIR "" CACHE PATH "An optional hint to a metis directory" diff --git a/deal.II/cmake/modules/FindMUMPS.cmake b/deal.II/cmake/modules/FindMUMPS.cmake index 0a3299c541..24e48975de 100644 --- a/deal.II/cmake/modules/FindMUMPS.cmake +++ b/deal.II/cmake/modules/FindMUMPS.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the MUMPS library @@ -31,11 +33,8 @@ INCLUDE(FindPackageHandleStandardArgs) # (We'll rely on the user of FindMUMPS, setting up mpi *cough*) # FIND_PACKAGE(SCALAPACK) # which will also include lapack and blas +FIND_PACKAGE(METIS) -# -# TODO: mumps might link to scotch and or metis as well. Ignore this for -# now. :-] -# FIND_PATH(MUMPS_INCLUDE_DIR dmumps_c.h HINTS @@ -82,6 +81,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUMPS DEFAULT_MSG SCALAPACK_FOUND ) +MARK_AS_ADVANCED( + DMUMPS_LIBRARY + MUMPS_COMMON_LIBRARY + MUMPS_INCLUDE_DIR + PORT_LIBRARY + ) + IF(MUMPS_FOUND) SET(MUMPS_INCLUDE_DIRS ${MUMPS_INCLUDE_DIR} @@ -91,18 +97,14 @@ IF(MUMPS_FOUND) ${MUMPS_COMMON_LIBRARY} ${PORD_LIBRARY} ${SCALAPACK_LIBRARIES} - ${MPI_CXX_LIBRARIES} # For good measure + ${METIS_LIBRARIES} # for good measure + ${MPI_Fortran_LIBRARIES} # for good measure ) SET(MUMPS_LINKER_FLAGS ${SCALAPACK_LINKER_FLAGS} ) - MARK_AS_ADVANCED( - DMUMPS_LIBRARY - MUMPS_COMMON_LIBRARY - MUMPS_INCLUDE_DIR - PORT_LIBRARY - ) + MARK_AS_ADVANCED(MUMPS_DIR) ELSE() SET(MUMPS_DIR "" CACHE PATH "An optional hint to a mumps directory" diff --git a/deal.II/cmake/modules/FindNETCDF.cmake b/deal.II/cmake/modules/FindNETCDF.cmake index 0ae1cf535c..066decd95e 100644 --- a/deal.II/cmake/modules/FindNETCDF.cmake +++ b/deal.II/cmake/modules/FindNETCDF.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the NETCDF C and C++ libraries @@ -61,6 +63,12 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETCDF DEFAULT_MSG NETCDF_INCLUDE_DIR ) +MARK_AS_ADVANCED( + NETCDF_CPLUSPLUS_LIBRARY + NETCDF_C_LIBRARY + NETCDF_INCLUDE_DIR + ) + IF(NETCDF_FOUND) SET(NETCDF_INCLUDE_DIRS ${NETCDF_INCLUDE_DIR} @@ -70,12 +78,7 @@ IF(NETCDF_FOUND) ${NETCDF_C_LIBRARY} ) - MARK_AS_ADVANCED( - NETCDF_CPLUSPLUS_LIBRARY - NETCDF_C_LIBRARY - NETCDF_INCLUDE_DIR - NETCDF_DIR - ) + MARK_AS_ADVANCED(NETCDF_DIR) ELSE() SET(NETCDF_DIR "" CACHE PATH "An optional hint to a NETCDF installation" diff --git a/deal.II/cmake/modules/FindP4EST.cmake b/deal.II/cmake/modules/FindP4EST.cmake index e2c0727dc8..c7cab6ed1f 100644 --- a/deal.II/cmake/modules/FindP4EST.cmake +++ b/deal.II/cmake/modules/FindP4EST.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the P4EST library @@ -19,6 +21,11 @@ # P4EST_LIBRARIES # P4EST_INCLUDE_DIRS # P4EST_WITH_MPI +# P4EST_VERSION +# P4EST_VERSION_MAJOR +# P4EST_VERSION_MINOR +# P4EST_VERSION_SUBMINOR +# P4EST_VERSION_PATCH # INCLUDE(FindPackageHandleStandardArgs) @@ -26,30 +33,15 @@ INCLUDE(FindPackageHandleStandardArgs) SET_IF_EMPTY(P4EST_DIR "$ENV{P4EST_DIR}") SET_IF_EMPTY(SC_DIR "$ENV{SC_DIR}") -# -# We used to recommend installing p4est with a custom script that -# compiled p4est twice, once in debug and once in optimized mode. -# the installation would then have happened into directories -# $P4EST_DIR/DEBUG and $P4EST_DIR/FAST. If we can find these -# two directories, then use the FAST directory rather than trying -# to figure out how we can build deal.II against the two libraries -# depending on whether we are in debug or optimized mode. -# -IF(P4EST_DIR - AND EXISTS ${P4EST_DIR}/DEBUG - AND EXISTS ${P4EST_DIR}/FAST) - MESSAGE(STATUS "Found old-style p4est directory layout") - SET (P4EST_DIR ${P4EST_DIR}/FAST) -ENDIF() - - # # Search for the sc library, usually bundled with p4est. If no SC_DIR was # given, take what we chose for p4est. # -FIND_PATH(P4EST_INCLUDE_DIR p4est.h +FIND_PATH(P4EST_INCLUDE_DIR p4est_config.h HINTS + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES p4est include/p4est include src @@ -57,41 +49,101 @@ FIND_PATH(P4EST_INCLUDE_DIR p4est.h FIND_PATH(SC_INCLUDE_DIR sc.h HINTS + ${SC_DIR}/FAST + ${SC_DIR}/DEBUG ${SC_DIR} + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES sc include/p4est include src sc/src ) -FIND_LIBRARY(P4EST_LIBRARY +FIND_LIBRARY(P4EST_LIBRARY_OPTIMIZED NAMES p4est HINTS + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src ) -FIND_LIBRARY(SC_LIBRARY +FIND_LIBRARY(P4EST_LIBRARY_DEBUG + NAMES p4est + HINTS + ${P4EST_DIR}/DEBUG + PATH_SUFFIXES + lib${LIB_SUFFIX} lib64 lib src + ) + +FIND_LIBRARY(SC_LIBRARY_OPTIMIZED NAMES sc HINTS + ${SC_DIR}/FAST + ${SC_DIR}/DEBUG ${SC_DIR} + ${P4EST_DIR}/FAST + ${P4EST_DIR}/DEBUG ${P4EST_DIR} PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib src sc/src ) -SET(_output ${P4EST_LIBRARY} ${SC_LIBRARY}) +FIND_LIBRARY(SC_LIBRARY_DEBUG + NAMES sc + HINTS + ${SC_DIR}/DEBUG + ${P4EST_DIR}/DEBUG + PATH_SUFFIXES + lib${LIB_SUFFIX} lib64 lib src sc/src + ) + +SET(_output ${P4EST_LIBRARY_OPTMIZED} ${SC_LIBRARY_OPTIMIZED}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(P4EST DEFAULT_MSG - P4EST_LIBRARY - SC_LIBRARY + _output # Cosmetic: Gives nice output + P4EST_LIBRARY_OPTIMIZED + SC_LIBRARY_OPTIMIZED P4EST_INCLUDE_DIR SC_INCLUDE_DIR ) +MARK_AS_ADVANCED( + P4EST_LIBRARY_OPTIMIZED + P4EST_LIBRARY_DEBUG + P4EST_INCLUDE_DIR + SC_LIBRARY_OPTIMIZED + SC_LIBRARY_DEBUG + SC_INCLUDE_DIR + ) + + IF(P4EST_FOUND) - SET(P4EST_LIBRARIES - ${P4EST_LIBRARY} - ${SC_LIBRARY} + + IF( ( "${P4EST_LIBRARY_OPTIMIZED}" STREQUAL "${P4EST_LIBRARY_DEBUG}" + AND + "${SC_LIBRARY_OPTIMIZED}" STREQUAL "${SC_LIBRARY_DEBUG}" ) + OR P4EST_LIBRARY_DEBUG MATCHES "-NOTFOUND" + OR SC_LIBRARY_DEBUG MATCHES "-NOTFOUND" ) + SET(P4EST_LIBRARIES + ${P4EST_LIBRARY_OPTIMIZED} + ${SC_LIBRARY_OPTIMIZED} + ) + ELSE() + SET(P4EST_LIBRARIES + optimized + ${P4EST_LIBRARY_OPTIMIZED} + ${SC_LIBRARY_OPTIMIZED} + debug + ${P4EST_LIBRARY_DEBUG} + ${SC_LIBRARY_DEBUG} + general + ) + ENDIF() + + LIST(APPEND P4EST_LIBRARIES + ${LAPACK_LIBRARIES} # for good measure + ${MPI_C_LIBRARIES} # for good measure ) SET(P4EST_INCLUDE_DIRS ${P4EST_INCLUDE_DIR} @@ -106,16 +158,41 @@ IF(P4EST_FOUND) IF("${P4EST_MPI_STRING}" STREQUAL "") SET(P4EST_WITH_MPI FALSE) ELSE() + SET(P4EST_WITH_MPI TRUE) ENDIF() - MARK_AS_ADVANCED( - P4EST_DIR - P4EST_LIBRARY - P4EST_INCLUDE_DIR - SC_LIBRARY - SC_INCLUDE_DIR - ) + # + # Extract version numbers: + # + FILE(STRINGS "${P4EST_INCLUDE_DIR}/p4est_config.h" P4EST_VERSION + REGEX "#define P4EST_VERSION \"") + STRING(REGEX REPLACE "^.*P4EST_VERSION.*\"([0-9]+.*)\".*" "\\1" + P4EST_VERSION "${P4EST_VERSION}" + ) + STRING(REGEX REPLACE + "^([0-9]+).*$" "\\1" + P4EST_VERSION_MAJOR "${P4EST_VERSION}") + STRING(REGEX REPLACE + "^[0-9]+\\.([0-9]+).*$" "\\1" + P4EST_VERSION_MINOR "${P4EST_VERSION}") + STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" + P4EST_VERSION_SUBMINOR "${P4EST_VERSION}") + + # Now for the patch number such as in 0.3.4.1. If there + # is no patch number, then the REGEX REPLACE will fail, + # setting P4EST_VERSION_PATCH to P4EST_VERSION. If that + # is the case, then set the patch number to zero + STRING(REGEX REPLACE + "^[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)?.*$" "\\1" + P4EST_VERSION_PATCH "${P4EST_VERSION}") + IF(${P4EST_VERSION_PATCH} STREQUAL "${P4EST_VERSION}") + SET(P4EST_VERSION_PATCH "0") + ENDIF() + + + MARK_AS_ADVANCED(P4EST_DIR) ELSE() SET(P4EST_DIR "" CACHE PATH "An optional hint to a p4est installation/directory" diff --git a/deal.II/cmake/modules/FindPETSC.cmake b/deal.II/cmake/modules/FindPETSC.cmake index b3fddfac03..3bd673927c 100644 --- a/deal.II/cmake/modules/FindPETSC.cmake +++ b/deal.II/cmake/modules/FindPETSC.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the petsc library @@ -44,26 +46,88 @@ FIND_LIBRARY(PETSC_LIBRARY PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib ) +# +# Search for the first part of the includes: +# + +FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h + HINTS + # petsc is special. Account for that + ${PETSC_DIR} + ${PETSC_DIR}/${PETSC_ARCH} + ${PETSC_INCLUDE_DIRS} + PATH_SUFFIXES petsc include include/petsc +) + +# +# Sometimes, this is not enough... +# If petsc is not installed but in source tree layout, there will be +# ${PETSC_DIR}/${PETSC_ARCH}/include - which we should have found by now. +# ${PETSC_DIR}/include - which we still have to find. +# +# Or it is installed in a non standard layout in the system (e.g. in +# Gentoo), where there will be +# ${PETSC_DIR}/${PETSC_ARCH}/include +# /usr/include/petsc ... +# +# Either way, we must be able to find petscversion.h: +# + +FIND_PATH(PETSC_INCLUDE_DIR_COMMON petscversion.h + HINTS + ${PETSC_DIR} + ${PETSC_DIR}/${PETSC_ARCH} + ${PETSC_INCLUDE_DIRS} + PATH_SUFFIXES petsc include include/petsc +) # # So, up to this point it was easy. Now, the tricky part. Search for -# petscvariables and determine the link interface from that file: +# petscvariables and determine the includes and the link interface from +# that file: # + FIND_FILE(PETSC_PETSCVARIABLES NAMES petscvariables HINTS - ${PETSC_DIR} ${PETSC_DIR}/${PETSC_ARCH} + ${PETSC_DIR} PATH_SUFFIXES conf ) IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") + # + # Includes: + # + + FILE(STRINGS "${PETSC_PETSCVARIABLES}" _external_includes + REGEX "^PETSC_CC_INCLUDES =.*") + SEPARATE_ARGUMENTS(_external_includes) + + SET(_petsc_includes) + FOREACH(_token ${_external_includes}) + IF(_token MATCHES "^-I") + STRING(REGEX REPLACE "^-I" "" _token "${_token}") + LIST(APPEND _petsc_includes ${_token}) + ENDIF() + ENDFOREACH() + + # Remove petsc's own include directories: + IF(NOT "${_petsc_includes}" STREQUAL "") + LIST(REMOVE_AT _petsc_includes 0 1) + ENDIF() + + # + # Link line: + # + FILE(STRINGS "${PETSC_PETSCVARIABLES}" _external_link_line REGEX "^PETSC_WITH_EXTERNAL_LIB =.*") SEPARATE_ARGUMENTS(_external_link_line) SET(_hints) + SET(_petsc_libraries) FOREACH(_token ${_external_link_line}}) IF(_token MATCHES "^-L") # Build up hints with the help of all tokens passed with -L: @@ -75,7 +139,7 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") IF(NOT _token MATCHES "(petsc|stdc\\+\\+|gcc_s)") FIND_LIBRARY(PETSC_LIBRARY_${_token} NAMES ${_token} - HINTS ${_hintes} + HINTS ${_hints} ) IF(NOT PETSC_LIBRARY_${_token} MATCHES "-NOTFOUND") LIST(APPEND _petsc_libraries ${PETSC_LIBRARY_${_token}}) @@ -88,41 +152,10 @@ IF(NOT PETSC_PETSCVARIABLES MATCHES "-NOTFOUND") ENDIF() ENDIF() ENDFOREACH() + ENDIF() -# -# Search for the first part of the includes: -# -FIND_PATH(PETSC_INCLUDE_DIR_ARCH petscconf.h - HINTS - # petsc is special. Account for that - ${PETSC_DIR} - ${PETSC_DIR}/${PETSC_ARCH} - ${PETSC_INCLUDE_DIRS} - PATH_SUFFIXES petsc include include/petsc -) - -# -# Sometimes, this is not enough... -# If petsc is not installed but in source tree layout, there will be -# ${PETSC_DIR}/${PETSC_ARCH}/include - which we should have found by now. -# ${PETSC_DIR}/include - which we still have to find. -# -# Or it is installed in a non standard layout in the system (e.g. in -# Gentoo), where there will be -# ${PETSC_DIR}/${PETSC_ARCH}/include -# /usr/include/petsc ... -# -# Either way, we must be able to find petscversion.h: -# -FIND_PATH(PETSC_INCLUDE_DIR_COMMON petscversion.h - HINTS - ${PETSC_DIR} - ${PETSC_DIR}/${PETSC_ARCH} - ${PETSC_INCLUDE_DIRS} - PATH_SUFFIXES petsc include include/petsc -) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG PETSC_LIBRARY @@ -130,14 +163,23 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(PETSC DEFAULT_MSG PETSC_INCLUDE_DIR_COMMON ) +MARK_AS_ADVANCED( + PETSC_INCLUDE_DIR_ARCH + PETSC_INCLUDE_DIR_COMMON + PETSC_INCLUDE_DIRS + PETSC_LIBRARY + PETSC_PETSCVARIABLES + ) + IF(PETSC_FOUND) SET(PETSC_LIBRARIES ${PETSC_LIBRARY} ${_petsc_libraries} ) SET(PETSC_INCLUDE_DIRS - ${PETSC_INCLUDE_DIR_ARCH} ${PETSC_INCLUDE_DIR_COMMON} + ${PETSC_INCLUDE_DIR_ARCH} + ${_petsc_includes} ) SET(PETSC_PETSCCONF_H "${PETSC_INCLUDE_DIR_ARCH}/petscconf.h") @@ -189,17 +231,11 @@ IF(PETSC_FOUND) PETSC_VERSION_PATCH "${PETSC_VERSION_PATCH_STRING}" ) - SET(PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}") + SET(PETSC_VERSION + "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}.${PETSC_VERSION_PATCH}" + ) - MARK_AS_ADVANCED( - PETSC_ARCH - PETSC_DIR - PETSC_INCLUDE_DIR_ARCH - PETSC_INCLUDE_DIR_COMMON - PETSC_INCLUDE_DIRS - PETSC_LIBRARY - PETSC_PETSCVARIABLES - ) + MARK_AS_ADVANCED(PETSC_ARCH PETSC_DIR) ELSE() SET(PETSC_DIR "" CACHE PATH "An optional hint to a PETSc directory" diff --git a/deal.II/cmake/modules/FindSCALAPACK.cmake b/deal.II/cmake/modules/FindSCALAPACK.cmake index 5b06ce3233..96a6a539b3 100644 --- a/deal.II/cmake/modules/FindSCALAPACK.cmake +++ b/deal.II/cmake/modules/FindSCALAPACK.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the SCALAPACK library @@ -39,7 +41,7 @@ FIND_LIBRARY(SCALAPACK_LIBRARY NAMES scalapack # SCALAPACK needs LAPACK and BLAS as dependency, search for them with the help # of the LAPACK find module: # -FIND_PACKAGE(LAPACK) +FIND_PACKAGE(DEALII_LAPACK) # # Well, depending on the version of scalapack and the distribution it might @@ -49,7 +51,7 @@ FIND_PACKAGE(LAPACK) FOREACH(_lib blacs blacsCinit blacsF77init) STRING(TOUPPER "${_lib}" _lib_upper) FIND_LIBRARY(${_lib_upper}_LIBRARY - NAMES ${_lib} ${_lib}_MPI-LINUX-0 + NAMES ${_lib} ${_lib}_MPI-LINUX-0 ${_lib}_MPI-DARWIN-0 HINTS ${BLACS_DIR} ${SCALAPACK_DIR} @@ -71,27 +73,28 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SCALAPACK DEFAULT_MSG LAPACK_FOUND ) +MARK_AS_ADVANCED( + lapack_LIBRARY + atlas_LIBRARY + blas_LIBRARY + SCALAPACK_LIBRARY + BLACS_LIBRARY + BLACSCINIT_LIBRARY + BLACSF77INIT_LIBRARY + ) + IF(SCALAPACK_FOUND) SET(SCALAPACK_LIBRARIES ${SCALAPACK_LIBRARY} ${LAPACK_LIBRARIES} ${BLACS_LIBRARIES} + ${MPI_Fortran_LIBRARIES} # for good measure ) SET(SCALAPACK_LINKER_FLAGS ${LAPACK_LINKER_FLAGS} ) - MARK_AS_ADVANCED( - lapack_LIBRARY - atlas_LIBRARY - blas_LIBRARY - SCALAPACK_DIR - SCALAPACK_LIBRARY - BLACS_DIR - BLACS_LIBRARY - BLACSCINIT_LIBRARY - BLACSF77INIT_LIBRARY - ) + MARK_AS_ADVANCED(SCALAPACK_DIR BLACS_DIR) ELSE() SET(SCALAPACK_DIR "" CACHE PATH "An optional hint to a SCALAPACK directory" diff --git a/deal.II/cmake/modules/FindSLEPC.cmake b/deal.II/cmake/modules/FindSLEPC.cmake index b4c5c04676..9de3500f45 100644 --- a/deal.II/cmake/modules/FindSLEPC.cmake +++ b/deal.II/cmake/modules/FindSLEPC.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the SLEPC library @@ -75,6 +77,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(SLEPC DEFAULT_MSG PETSC_FOUND ) +MARK_AS_ADVANCED( + SLEPC_DIR + SLEPC_INCLUDE_DIR_ARCH + SLEPC_INCLUDE_DIR_COMMON + SLEPC_INCLUDE_DIRS + SLEPC_LIBRARY + ) + IF(SLEPC_FOUND) SET(SLEPC_INCLUDE_DIRS ${SLEPC_INCLUDE_DIR_ARCH} @@ -111,15 +121,11 @@ IF(SLEPC_FOUND) SLEPC_VERSION_PATCH "${SLEPC_VERSION_PATCH_STRING}" ) - SET(SLEPC_VERSION "${SLEPC_VERSION_MAJOR}.${SLEPC_VERSION_MINOR}.${SLEPC_VERSION_SUBMINOR}") + SET(SLEPC_VERSION + "${SLEPC_VERSION_MAJOR}.${SLEPC_VERSION_MINOR}.${SLEPC_VERSION_SUBMINOR}.${SLEPC_VERSION_PATCH}" + ) - MARK_AS_ADVANCED( - SLEPC_DIR - SLEPC_INCLUDE_DIR_ARCH - SLEPC_INCLUDE_DIR_COMMON - SLEPC_INCLUDE_DIRS - SLEPC_LIBRARY - ) + MARK_AS_ADVANCED(SLEPC_DIR) ELSE() SET(SLEPC_DIR "" CACHE PATH "An optional hint to a SLEPC directory" diff --git a/deal.II/cmake/modules/FindTBB.cmake b/deal.II/cmake/modules/FindTBB.cmake index b3bc3ad288..4c45373cec 100644 --- a/deal.II/cmake/modules/FindTBB.cmake +++ b/deal.II/cmake/modules/FindTBB.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the Threading Building Blocks library @@ -57,8 +59,13 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG TBB_INCLUDE_DIR ) +MARK_AS_ADVANCED( + TBB_LIBRARY + TBB_DEBUG_LIBRARY + TBB_INCLUDE_DIR + ) + IF(TBB_FOUND) - MARK_AS_ADVANCED(TBB_LIBRARY TBB_DEBUG_LIBRARY TBB_INCLUDE_DIR) IF(NOT TBB_DEBUG_LIBRARY MATCHES "-NOTFOUND") SET(TBB_WITH_DEBUGLIB TRUE) @@ -69,8 +76,8 @@ IF(TBB_FOUND) SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR}) + MARK_AS_ADVANCED(TBB_DIR) ELSE() - SET(TBB_DIR "" CACHE PATH "An optional hint to a TBB installation" ) diff --git a/deal.II/cmake/modules/FindTRILINOS.cmake b/deal.II/cmake/modules/FindTRILINOS.cmake index d038db322a..f36c514ed0 100644 --- a/deal.II/cmake/modules/FindTRILINOS.cmake +++ b/deal.II/cmake/modules/FindTRILINOS.cmake @@ -1,29 +1,34 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the Trilinos library # # This module exports: # -# TRILINOS_DIR (cached) +# TRILINOS_DIR # TRILINOS_INCLUDE_DIRS # TRILINOS_LIBRARIES +# TRILINOS_VERSION # TRILINOS_VERSION_MAJOR # TRILINOS_VERSION_MINOR # TRILINOS_VERSION_SUBMINOR # TRILINOS_WITH_MPI +# TRILINOS_SUPPORTS_CPP11 +# TRILINOS_HAS_C99_TR1_WORKAROUND # INCLUDE(FindPackageHandleStandardArgs) @@ -31,13 +36,13 @@ INCLUDE(FindPackageHandleStandardArgs) SET_IF_EMPTY(TRILINOS_DIR "$ENV{TRILINOS_DIR}") # -# Include the trilinos package configuration: +# Do not include TrilinosConfig.cmake directly, it is just too big o_O +# +# Just search for the file: # -FIND_PACKAGE(TRILINOS_CONFIG - CONFIG QUIET - NAMES Trilinos TRILINOS +FIND_FILE(TRILINOS_CONFIG + NAMES TrilinosConfig.cmake trilinos-config.cmake HINTS - ${TRILINOS_DIR}/lib/cmake/Trilinos ${TRILINOS_DIR} PATH_SUFFIXES lib64/cmake/Trilinos @@ -48,7 +53,72 @@ FIND_PACKAGE(TRILINOS_CONFIG NO_SYSTEM_ENVIRONMENT_PATH ) -SET(TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS}) +IF(NOT "${TRILINOS_CONFIG}" STREQUAL "${TRILINOS_CONFIG_SAVED}") + SET(_new_trilinos_config TRUE) +ENDIF() +SET(TRILINOS_CONFIG_SAVED "${TRILINOS_CONFIG}" CACHE INTERNAL "" FORCE) + + +IF(NOT TRILINOS_CONFIG MATCHES "-NOTFOUND") + + SET(_filtered_trilinos_config + "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/TrilinosConfig.cmake" + ) + + IF(_new_trilinos_config) + GET_FILENAME_COMPONENT(_trilinos_path "${TRILINOS_CONFIG}" PATH) + FILE(WRITE ${_filtered_trilinos_config} "SET(_cmake_current_list_dir ${_trilinos_path})\n") + + # + # Only pick up every line that starts with "^SET("... + # + FILE(STRINGS "${TRILINOS_CONFIG}" _trilinos_config_filtered REGEX "^SET") + + FOREACH(_line ${_trilinos_config_filtered}) + STRING(REPLACE "CMAKE_CURRENT_LIST_DIR" "_cmake_current_list_dir" + _line "${_line}" + ) + FILE(APPEND ${_filtered_trilinos_config} "${_line}\n") + ENDFOREACH() + ENDIF() + + # + # ... and include only that: + # + INCLUDE(${_filtered_trilinos_config}) + + SET(TRILINOS_CONFIG_FOUND TRUE) +ENDIF() + + +# +# Look for the one include file that we'll query for further information: +# +IF(_new_trilinos_config) + UNSET(EPETRA_CONFIG_H CACHE) +ENDIF() +FIND_FILE(EPETRA_CONFIG_H Epetra_config.h + HINTS ${Trilinos_INCLUDE_DIRS} + NO_DEFAULT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_CMAKE_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + NO_CMAKE_FIND_ROOT_PATH + ) +IF(EPETRA_CONFIG_H MATCHES "-NOTFOUND") + SET(TRILINOS_CONFIG_FOUND FALSE) +ELSE() + SET(TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS}) + # + # *Boy* Sanitize the include paths given by TrilinosConfig.cmake... + # + STRING(REGEX REPLACE + "(lib64|lib)\\/cmake\\/Trilinos\\/\\.\\.\\/\\.\\.\\/\\.\\.\\/" "" + TRILINOS_INCLUDE_DIRS "${TRILINOS_INCLUDE_DIRS}" + ) +ENDIF() + # # We'd like to have the full library names but the Trilinos package only @@ -56,6 +126,10 @@ SET(TRILINOS_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS}) # So we check again for every lib and store the full path: # FOREACH(_library ${Trilinos_LIBRARIES}) + IF(_new_trilinos_config) + UNSET(TRILINOS_LIBRARY_${_library} CACHE) + ENDIF() + FIND_LIBRARY(TRILINOS_LIBRARY_${_library} NAMES ${_library} HINTS ${Trilinos_LIBRARY_DIRS} @@ -67,25 +141,37 @@ FOREACH(_library ${Trilinos_LIBRARIES}) NO_CMAKE_FIND_ROOT_PATH ) - LIST(APPEND TRILINOS_LIBRARIES ${TRILINOS_LIBRARY_${_library}}) + MARK_AS_ADVANCED(TRILINOS_LIBRARY_${_library}) - # - # Remove the variables from the cache, so that updating TRILINOS_DIR will - # find the new libraries.. - # - UNSET(TRILINOS_LIBRARY_${_library} CACHE) + IF(TRILINOS_LIBRARY_${_library} MATCHES "-NOTFOUND") + SET(TRILINOS_CONFIG_FOUND FALSE) + ELSE() + LIST(APPEND TRILINOS_LIBRARIES ${TRILINOS_LIBRARY_${_library}}) + ENDIF() ENDFOREACH() +# +# Add the link interface: +# +LIST(APPEND TRILINOS_LIBRARIES + ${Trilinos_TPL_LIBRARIES} + ${MPI_CXX_LIBRARIES} # for good measure + ) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(TRILINOS DEFAULT_MSG TRILINOS_LIBRARIES # cosmetic: Gives nice output TRILINOS_CONFIG_FOUND ) +MARK_AS_ADVANCED(TRILINOS_CONFIG EPETRA_CONFIG_H) + IF(TRILINOS_FOUND) # - # Extract the major and minor version numbers: + # Extract version numbers: # + SET(TRILINOS_VERSION "${Trilinos_VERSION}") + STRING(REGEX REPLACE "^([0-9]+).*$" "\\1" TRILINOS_VERSION_MAJOR "${Trilinos_VERSION}") @@ -101,15 +187,6 @@ IF(TRILINOS_FOUND) # # Determine whether Trilinos was configured with MPI and 64bit indices: # - FIND_FILE(EPETRA_CONFIG_H Epetra_config.h - HINTS ${TRILINOS_INCLUDE_DIRS} - NO_DEFAULT_PATH - NO_CMAKE_ENVIRONMENT_PATH - NO_CMAKE_PATH - NO_SYSTEM_ENVIRONMENT_PATH - NO_CMAKE_SYSTEM_PATH - NO_CMAKE_FIND_ROOT_PATH - ) FILE(STRINGS "${EPETRA_CONFIG_H}" EPETRA_MPI_STRING REGEX "#define HAVE_MPI") IF("${EPETRA_MPI_STRING}" STREQUAL "") @@ -132,13 +209,44 @@ IF(TRILINOS_FOUND) SET(TRILINOS_WITH_NO_64BITS_INDICES FALSE) ENDIF() - UNSET(EPETRA_CONFIG_H CACHE) + # + # Some versions of Sacado_cmath.hpp do things that aren't compatible + # with the -std=c++0x flag of GCC, see deal.II FAQ. + # Test whether that is indeed the case: + # + IF(_new_trilinos_config) + UNSET(TRILINOS_SUPPORTS_CPP11 CACHE) + UNSET(TRILINOS_HAS_C99_TR1_WORKAROUND CACHE) + ENDIF() + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${TRILINOS_INCLUDE_DIRS}) + PUSH_TEST_FLAG("${DEAL_II_CXX11_FLAG}") - MARK_AS_ADVANCED( - TRILINOS_DIR - TRILINOS_CONFIG_DIR + CHECK_CXX_SOURCE_COMPILES( + " + #include + int main(){ return 0; } + " + TRILINOS_SUPPORTS_CPP11 ) + # + # Try whether exporting HAS_C99_TR1_CMATH helps: + # + PUSH_TEST_FLAG("-DHAS_C99_TR1_CMATH") + CHECK_CXX_SOURCE_COMPILES( + " + #include + int main(){ return 0; } + " + TRILINOS_HAS_C99_TR1_WORKAROUND + ) + + RESET_CMAKE_REQUIRED() + + + MARK_AS_ADVANCED(TRILINOS_DIR) + ELSE() SET(TRILINOS_DIR "" CACHE PATH diff --git a/deal.II/cmake/modules/FindUMFPACK.cmake b/deal.II/cmake/modules/FindUMFPACK.cmake index 029e8708db..746fdf0143 100644 --- a/deal.II/cmake/modules/FindUMFPACK.cmake +++ b/deal.II/cmake/modules/FindUMFPACK.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Try to find the UMFPACK library @@ -34,7 +36,8 @@ ENDFOREACH() # TODO: There might be an external dependency for metis, ignore this for # now. # -FIND_PACKAGE(LAPACK) +FIND_PACKAGE(DEALII_LAPACK) +FIND_PACKAGE(METIS) # # Two macros to make life easier: @@ -103,9 +106,11 @@ FIND_UMFPACK_LIBRARY(UMFPACK umfpack REQUIRED) FIND_UMFPACK_LIBRARY(AMD amd REQUIRED) FIND_UMFPACK_LIBRARY(CHOLMOD cholmod) FIND_UMFPACK_LIBRARY(COLAMD colamd) +FIND_UMFPACK_LIBRARY(CCOLAMD ccolamd) +FIND_UMFPACK_LIBRARY(CAMD camd) FIND_UMFPACK_LIBRARY(SuiteSparse_config suitesparseconfig) -SET(_output ${UMFPACK_LIBRARY} ${CHOLMOD_LIBRARY} ${COLAMD_LIBRARY} ${AMD_LIBRARY} ${SuiteSparse_config_LIBRARY}) +SET(_output ${UMFPACK_LIBRARY} ${CHOLMOD_LIBRARY} ${CCOLAMD_LIBRARY} ${COLAMD_LIBRARY} ${CAMD_LIBRARY} ${AMD_LIBRARY} ${SuiteSparse_config_LIBRARY}) FIND_PACKAGE_HANDLE_STANDARD_ARGS(UMFPACK DEFAULT_MSG _output # Cosmetic: Gives nice output UMFPACK_LIBRARY @@ -116,27 +121,54 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(UMFPACK DEFAULT_MSG LAPACK_FOUND ) +MARK_AS_ADVANCED( + AMD_INCLUDE_DIR + AMD_LIBRARY + atlas_LIBRARY + blas_LIBRARY + CAMD_LIBRARY + CHOLMOD_LIBRARY + CCOLAMD_LIBRARY + COLAMD_LIBRARY + SuiteSparse_config_INCLUDE_DIR + SuiteSparse_config_LIBRARY + UMFPACK_INCLUDE_DIR + UMFPACK_LIBRARY + ) + IF(UMFPACK_FOUND) SET(UMFPACK_LIBRARIES ${UMFPACK_LIBRARY} ${CHOLMOD_LIBRARY} + ${CCOLAMD_LIBRARY} ${COLAMD_LIBRARY} + ${CAMD_LIBRARY} ${AMD_LIBRARY} ${SuiteSparse_config_LIBRARY} - ${LAPACK_LIBRARIES} ) + # + # For good measure: + # + IF(METIS_FOUND) + LIST(APPEND UMFPACK_LIBRARIES ${METIS_LIBRARIES}) + ENDIF() + + LIST(APPEND UMFPACK_LIBRARIES ${LAPACK_LIBRARIES}) + # # Add rt to the link interface as well (for whatever reason, # libsuitesparse.so depends on clock_gettime but the shared # lib does not record its dependence on librt.so as evidenced # by ldd :-( ): # - FIND_LIBRARY(rt_lib NAMES rt) - MARK_AS_ADVANCED(rt_lib) - IF(NOT rt_lib MATCHES "-NOTFOUND") - LIST(APPEND UMFPACK_LIBRARIES ${rt_lib}) + SWITCH_LIBRARY_PREFERENCE() + FIND_LIBRARY(rt_LIBRARY NAMES rt) + SWITCH_LIBRARY_PREFERENCE() + MARK_AS_ADVANCED(rt_LIBRARY) + IF(NOT rt_LIBRARY MATCHES "-NOTFOUND") + LIST(APPEND UMFPACK_LIBRARIES ${rt_LIBRARY}) ENDIF() SET(UMFPACK_INCLUDE_DIRS @@ -148,20 +180,7 @@ IF(UMFPACK_FOUND) ${LAPACK_LINKER_FLAGS} ) - MARK_AS_ADVANCED( - atlas_LIBRARY - blas_LIBRARY - UMFPACK_LIBRARY - AMD_LIBRARY - CHOLMOD_LIBRARY - COLAMD_LIBRARY - SuiteSparse_config_LIBRARY - UMFPACK_INCLUDE_DIR - AMD_INCLUDE_DIR - SuiteSparse_config_INCLUDE_DIR - UMFPACK_DIR - SUITESPARSE_DIR - ) + MARK_AS_ADVANCED(UMFPACK_DIR SUITESPARSE_DIR) ELSE() SET(UMFPACK_DIR "" CACHE PATH "An optional hint to an UMFPACK directory" diff --git a/deal.II/cmake/scripts/CMakeLists.txt b/deal.II/cmake/scripts/CMakeLists.txt index 80272980de..96539b7835 100644 --- a/deal.II/cmake/scripts/CMakeLists.txt +++ b/deal.II/cmake/scripts/CMakeLists.txt @@ -1,25 +1,35 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- -ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc) IF(NOT CMAKE_CROSSCOMPILING) - # - # Export expand_instantiations for use in cross compilation: - # + ADD_EXECUTABLE(expand_instantiations expand_instantiations.cc) + + IF(DEAL_II_COMPONENT_COMPAT_FILES) + SET_TARGET_PROPERTIES(expand_instantiations + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/common/scripts + ) + INSTALL(TARGETS expand_instantiations + EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets + DESTINATION ${DEAL_II_COMMON_RELDIR}/scripts + COMPONENT compat_files + ) + ENDIF() + EXPORT(TARGETS expand_instantiations - FILE ${CMAKE_CURRENT_BINARY_DIR}/importExecutables.cmake - NAMESPACE native- # Prefix a namespace + FILE ${CMAKE_BINARY_DIR}/importExecutables.cmake ) ENDIF() @@ -28,10 +38,14 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) # Build and install the old dependency_resolution and report_features # executables: # + INCLUDE_DIRECTORIES( BEFORE # Ensure deal.II include directories come first - ${CMAKE_BINARY_DIR}/include/ + # + # Reverse order due to BEFORE: + # ${CMAKE_SOURCE_DIR}/include/ + ${CMAKE_BINARY_DIR}/include/ ) ADD_EXECUTABLE(make_dependencies make_dependencies.cc) @@ -49,18 +63,41 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) ADD_EXECUTABLE(report_features ${CMAKE_CURRENT_BINARY_DIR}/report_features.cc ) + + # + # Link report_features in the same way as the library/final executable: + # TARGET_LINK_LIBRARIES(report_features ${DEAL_II_EXTERNAL_LIBRARIES}) SET_TARGET_PROPERTIES(report_features PROPERTIES - LINK_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}" + LINK_FLAGS "${DEAL_II_LINKER_FLAGS}" COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS}" ) + IF(DEAL_II_STATIC_EXECUTABLE) + SET_PROPERTY(TARGET report_features PROPERTY + LINK_SEARCH_END_STATIC TRUE + ) + ENDIF() + + # + # A custom target with the same name as the component: + # + ADD_CUSTOM_TARGET(compat_files + DEPENDS + expand_instantiations + make_dependencies + report_features + ) IF(NOT CMAKE_CROSSCOMPILING) ADD_CUSTOM_TARGET(run_report_features COMMAND report_features) ENDIF() - INSTALL(TARGETS make_dependencies report_features expand_instantiations + SET_TARGET_PROPERTIES(make_dependencies report_features + PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/common/scripts + ) + + INSTALL(TARGETS make_dependencies report_features EXPORT ${DEAL_II_PROJECT_CONFIG_NAME}Targets DESTINATION ${DEAL_II_COMMON_RELDIR}/scripts COMPONENT compat_files diff --git a/deal.II/cmake/scripts/expand_instantiations.cc b/deal.II/cmake/scripts/expand_instantiations.cc index 8f62d4ed71..6f89828b70 100644 --- a/deal.II/cmake/scripts/expand_instantiations.cc +++ b/deal.II/cmake/scripts/expand_instantiations.cc @@ -1,15 +1,19 @@ -//---------------------------- expand_instantiations.cc ------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- expand_instantiations.cc ------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // This is the program that we use to generate explicit instantiations for a // variety of template arguments. It takes two kinds of input files. The first diff --git a/deal.II/cmake/scripts/make_dependencies.cc b/deal.II/cmake/scripts/make_dependencies.cc index 1e6e2bb2f6..b7796338bf 100644 --- a/deal.II/cmake/scripts/make_dependencies.cc +++ b/deal.II/cmake/scripts/make_dependencies.cc @@ -1,15 +1,19 @@ -//---------------------------- make_dependencies.cc ------------------------ -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2007, 2008, 2010, 2011 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- make_dependencies.cc ------------------------ +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // Make a dependency file tree // usage: make_depencies -Iinc_path1 -Iinc_path2 ... -Bbasepath files diff --git a/deal.II/cmake/scripts/report_features.cc.in b/deal.II/cmake/scripts/report_features.cc.in index 3b0c072a01..457d226e04 100644 --- a/deal.II/cmake/scripts/report_features.cc.in +++ b/deal.II/cmake/scripts/report_features.cc.in @@ -1,15 +1,18 @@ -//---------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -61,7 +64,7 @@ int main() if(${_shared_libs}) std::cout << "dealii-feature: shared_libs=yes" << std::endl; else - std::cout << "dealii-feature: shared_libs=yes" << std::endl; + std::cout << "dealii-feature: shared_libs=no" << std::endl; #ifdef DEAL_II_WITH_ARPACK std::cout << "dealii-feature: ARPACK=yes" << std::endl; diff --git a/deal.II/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake index 4213865644..c2e04fe20d 100644 --- a/deal.II/cmake/setup_cached_variables.cmake +++ b/deal.II/cmake/setup_cached_variables.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Setup cached variables (prior to the PROJECT(deal.II) call) @@ -30,31 +32,32 @@ # # Options regarding compilation and linking: # +# CMAKE_BUILD_TYPE # DEAL_II_ALLOW_PLATFORM_INTROSPECTION # DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS -# CMAKE_BUILD_TYPE # BUILD_SHARED_LIBS +# DEAL_II_PREFER_STATIC_LIBS +# DEAL_II_STATIC_EXECUTABLE # CMAKE_INSTALL_RPATH_USE_LINK_PATH -# CMAKE_C_FLAGS # CMAKE_CXX_FLAGS *) -# CMAKE_SHARED_LINKER_FLAGS *) +# DEAL_II_LINKER_FLAGS *) # DEAL_II_CXX_FLAGS_DEBUG -# DEAL_II_SHARED_LINKER_FLAGS_DEBUG +# DEAL_II_LINKER_FLAGS_DEBUG # DEAL_II_CXX_FLAGS_RELEASE -# DEAL_II_SHARED_LINKER_FLAGS_RELEASE +# DEAL_II_LINKER_FLAGS_RELEASE # DEAL_II_WITH_64BIT_INDICES # -# *) May also be set via environment variable (CFLAGS, CXXFLAGS, LDFLAGS) -# (nonempty cached variable has precedence will not be overwritten by -# environment) +# *) May also be set via environment variable (CXXFLAGS, LDFLAGS) +# (a nonempty cached variable has precedence and will not be +# overwritten by environment) # -########################################################################### -# # -# General configuration options: # -# # -########################################################################### +######################################################################## +# # +# General configuration options: # +# # +######################################################################## If(DEAL_II_HAVE_BUNDLED_DIRECTORY) OPTION(DEAL_II_ALLOW_BUNDLED @@ -109,23 +112,11 @@ IF("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") ENDIF() -########################################################################### -# # -# Compilation and linking: # -# # -########################################################################### - -OPTION(DEAL_II_ALLOW_PLATFORM_INTROSPECTION - "Allow platform introspection for CPU command set, SSE and AVX" - ON - ) -MARK_AS_ADVANCED(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) - -OPTION(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS - "Configure sensible default CFLAGS and CXXFLAGS depending on platform, compiler and build target." - ON - ) -MARK_AS_ADVANCED(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) +######################################################################## +# # +# Compilation and linking: # +# # +######################################################################## # # Setup CMAKE_BUILD_TYPE: @@ -148,10 +139,46 @@ IF( NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND ) ENDIF() + +OPTION(DEAL_II_ALLOW_PLATFORM_INTROSPECTION + "Allow platform introspection for CPU command sets, SSE and AVX" + ON + ) +MARK_AS_ADVANCED(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) + +OPTION(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS + "Configure sensible default CFLAGS and CXXFLAGS depending on platform, compiler and build target." + ON + ) +MARK_AS_ADVANCED(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) + SET(BUILD_SHARED_LIBS "ON" CACHE BOOL "Build a shared library" ) -MARK_AS_ADVANCED(BUILD_SHARED_LIBS) + +OPTION(DEAL_II_PREFER_STATIC_LIBS + "Prefer static libraries over dynamic libraries when searching for features and corresponding link interface" + OFF + ) +MARK_AS_ADVANCED(DEAL_II_PREFER_STATIC_LIBS) + +OPTION(DEAL_II_STATIC_EXECUTABLE + "Provide a link interface that is suitable for static linkage of executables. Enabling this option forces BUILD_SHARED_LIBS=OFF and DEAL_II_PREFER_STATIC_LIBS=ON" + OFF + ) +MARK_AS_ADVANCED(DEAL_II_STATIC_EXECUTABLE) + +IF(DEAL_II_STATIC_EXECUTABLE) + SET(BUILD_SHARED_LIBS "OFF" CACHE BOOL + "Build a shared library" + FORCE + ) + SET(DEAL_II_PREFER_STATIC_LIBS "ON" CACHE BOOL + "Prefer static libraries over dynamic libraries when searching for features and corresponding link interface" + FORCE + ) +ENDIF() + # # Set CMAKE_INSTALL_RPATH_USE_LINK_PATH to default to ON and promote to @@ -162,6 +189,7 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH "ON" CACHE BOOL ) MARK_AS_ADVANCED(CMAKE_INSTALL_RPATH_USE_LINK_PATH) + # # Define the variable that defines whether we should use 32- or 64-bit # global DoF indices. @@ -172,7 +200,6 @@ OPTION(DEAL_II_WITH_64BIT_INDICES ) - # # Tell the user very prominently, that we're doing things differently w.r.t # CMAKE_(C|CXX)_FLAGS_(DEBUG|RELEASE) @@ -184,6 +211,7 @@ FOREACH(_flag SHARED_LINKER_FLAGS_DEBUG ) IF(NOT "${CMAKE_${_flag}}" STREQUAL "") + UNSET(${CMAKE_${_flag}} CACHE) MESSAGE(FATAL_ERROR "\nThe deal.II cmake build system does not use CMAKE_${_flag}.\n" "Use DEAL_II_${_flag}, instead!\n\n" @@ -191,6 +219,7 @@ FOREACH(_flag ENDIF() ENDFOREACH() + # # Hide all unused compiler flag variables: # @@ -203,6 +232,11 @@ FOREACH(_flag CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_Fortran_FLAGS_RELEASE + CMAKE_Fortran_FLAGS_DEBUG + CMAKE_Fortran_FLAGS_MINSIZEREL + CMAKE_Fortran_FLAGS_RELWITHDEBINFO + CMAKE_SHARED_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS_DEBUG CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL CMAKE_SHARED_LINKER_FLAGS_RELEASE @@ -212,17 +246,17 @@ FOREACH(_flag SET(${_flag} "" CACHE INTERNAL "" FORCE) ENDFOREACH() + # # Set cached compiler flags to an empty string: # SET(DEAL_II_USED_FLAGS - CMAKE_C_FLAGS CMAKE_CXX_FLAGS DEAL_II_CXX_FLAGS_DEBUG DEAL_II_CXX_FLAGS_RELEASE - CMAKE_SHARED_LINKER_FLAGS - DEAL_II_SHARED_LINKER_FLAGS_DEBUG - DEAL_II_SHARED_LINKER_FLAGS_RELEASE + DEAL_II_LINKER_FLAGS + DEAL_II_LINKER_FLAGS_DEBUG + DEAL_II_LINKER_FLAGS_RELEASE ) FOREACH(_flag ${DEAL_II_USED_FLAGS}) @@ -250,40 +284,36 @@ ENDFOREACH() # -# Finally, read in CFLAGS, CXXFLAGS and LDFLAGS from environment and -# prepend them to the saved variables: +# Finally, read in CXXFLAGS and LDFLAGS from environment and prepend them +# to the saved variables: # -SET(CMAKE_C_FLAGS_SAVED "$ENV{CFLAGS} ${CMAKE_C_FLAGS_SAVED}") SET(CMAKE_CXX_FLAGS_SAVED "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_SAVED}") -SET(CMAKE_SHARED_LINKER_FLAGS_SAVED "$ENV{LDFLAGS} ${CMAKE_SHARED_LINKER_FLAGS_SAVED}") -UNSET(ENV{CFLAGS}) +SET(DEAL_II_LINKER_FLAGS_SAVED "$ENV{LDFLAGS} ${DEAL_II_LINKER_FLAGS_SAVED}") UNSET(ENV{CXXFLAGS}) UNSET(ENV{LDFLAGS}) -########################################################################### -# # -# Miscellaneous setup: # -# # -########################################################################### +######################################################################## +# # +# Miscellaneous setup: # +# # +######################################################################## GET_CMAKE_PROPERTY(_res VARIABLES) FOREACH(_var ${_res}) # - # Rename WITH_* by DEAL_II_WITH_* + # Rename (ALLOW|WITH|FORCE|COMPONENT)_* by DEAL_II_(ALLOW|WITH|FORCE|COMPONENT)_* # - IF(_var MATCHES "^WITH_") - SET(DEAL_II_${_var} ${${_var}} CACHE BOOL "" FORCE) - UNSET(${_var} CACHE) - ENDIF() + FOREACH(_match ALLOW_ WITH_ FORCE_ COMPONENT_) + IF(_var MATCHES "^${_match}") + SET(DEAL_II_${_var} ${${_var}} CACHE BOOL "" FORCE) + UNSET(${_var} CACHE) + ENDIF() + ENDFOREACH() # # Same for components: # - IF(_var MATCHES "^COMPONENT_") - SET(DEAL_II_${_var} ${${_var}} CACHE BOOL "" FORCE) - UNSET(${_var} CACHE) - ENDIF() IF(_var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI)") SET(DEAL_II_COMPONENT_${_var} ${${_var}} CACHE BOOL "" FORCE) UNSET(${_var} CACHE) diff --git a/deal.II/cmake/setup_compiler_flags.cmake b/deal.II/cmake/setup_compiler_flags.cmake index db784362b4..f82147f9e8 100644 --- a/deal.II/cmake/setup_compiler_flags.cmake +++ b/deal.II/cmake/setup_compiler_flags.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Setup default compiler flags: This file sets up sensible default compiler @@ -28,15 +30,15 @@ # CMAKE_CXX_FLAGS # DEAL_II_CXX_FLAGS_DEBUG # DEAL_II_CXX_FLAGS_RELEASE -# CMAKE_SHARED_LINKER_FLAGS -# DEAL_II_SHARED_LINKER_FLAGS_DEBUG -# DEAL_II_SHARED_LINKER_FLAGS_RELEASE +# DEAL_II_LINKER_FLAGS +# DEAL_II_LINKER_FLAGS_DEBUG +# DEAL_II_LINKER_FLAGS_RELEASE # # All modifications shall be guarded with the ENABLE_IF_SUPPORTED # or ENABLE_IF_LINKS macro, e.g. # # ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") -# ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") +# ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed") # # Checks for compiler features (such as C++11 support) and compiler # specific bugs that @@ -54,75 +56,44 @@ # -########################################################################### -# # -# Sanity checks: # -# # -########################################################################### +######################################################################## +# # +# Sanity checks: # +# # +######################################################################## # -# Check the user provided C and CXX flags: +# Check the user provided CXX flags: # -IF(NOT "${CMAKE_C_FLAGS_SAVED}" STREQUAL "${DEAL_II_C_FLAGS_SAVED}") - UNSET(DEAL_II_HAVE_USABLE_C_FLAGS CACHE) -ENDIF() -SET(DEAL_II_C_FLAGS_SAVED "${CMAKE_C_FLAGS_SAVED}" CACHE INTERNAL "" FORCE) - -SET(CMAKE_REQUIRED_FLAGS "${CMAKE_C_FLAGS_SAVED}") -CHECK_C_SOURCE_COMPILES( - "int main(){ return 0; }" - DEAL_II_HAVE_USABLE_C_FLAGS) -SET(CMAKE_REQUIRED_FLAGS "") - -IF(NOT DEAL_II_HAVE_USABLE_C_FLAGS) - UNSET(DEAL_II_HAVE_USABLE_C_FLAGS CACHE) - MESSAGE(FATAL_ERROR "\n" - "Configuration error: Cannot compile with the specified C flags: " - "${CMAKE_C_FLAGS_SAVED}\n" - ) -ENDIF() - - +MESSAGE(STATUS "") IF(NOT "${CMAKE_CXX_FLAGS_SAVED}" STREQUAL "${DEAL_II_CXX_FLAGS_SAVED}") + # Rerun this test if cxx flags changed: UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE) ENDIF() SET(DEAL_II_CXX_FLAGS_SAVED "${CMAKE_CXX_FLAGS_SAVED}" CACHE INTERNAL "" FORCE) -SET(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS_SAVED}") +# Initialize all CMAKE_REQUIRED_* variables a this point: +RESET_CMAKE_REQUIRED() + CHECK_CXX_SOURCE_COMPILES( "int main(){ return 0; }" DEAL_II_HAVE_USABLE_CXX_FLAGS) -SET(CMAKE_REQUIRED_FLAGS "") IF(NOT DEAL_II_HAVE_USABLE_CXX_FLAGS) UNSET(DEAL_II_HAVE_USABLE_CXX_FLAGS CACHE) MESSAGE(FATAL_ERROR "\n" - "Configuration error: Cannot compile with the specified CXX flags: " + "Configuration error: Cannot compile with the user supplied CXX flags:\n" "${CMAKE_CXX_FLAGS_SAVED}\n" ) ENDIF() -# -# CMAKE_C_COMPILER and CMAKE_CXX_COMPILER have to be of the same brand. -# -IF(NOT ( "${CMAKE_C_COMPILER_ID}" STREQUAL "${CMAKE_CXX_COMPILER_ID}" AND - "${CMAKE_C_COMPILER_VERSION}" STREQUAL "${CMAKE_CXX_COMPILER_VERSION}" ) ) - MESSAGE(FATAL_ERROR "\n" - "Configuration error: The specified C and CXX compiler have to be of the " - "same family, but cmake found:\n" - "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}\n" - "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}\n" - ) -ENDIF() - - -########################################################################### -# # -# Compiler setup: # -# # -########################################################################### +######################################################################## +# # +# Compiler setup: # +# # +######################################################################## IF(DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) # diff --git a/deal.II/cmake/setup_compiler_flags_gnu.cmake b/deal.II/cmake/setup_compiler_flags_gnu.cmake index 0b35afc511..14884e265d 100644 --- a/deal.II/cmake/setup_compiler_flags_gnu.cmake +++ b/deal.II/cmake/setup_compiler_flags_gnu.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # General setup for GCC and compilers sufficiently close to GCC @@ -51,7 +53,7 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") # Check whether the -as-needed flag is available. If so set it to link # the deal.II library with it. # -ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") +ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed") # # Setup various warnings: @@ -71,6 +73,12 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wswitch") # ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused-local-typedefs") +# +# Disable Wlong-long that will trigger a lot of warnings when compiling +# with disabled C++11 support: +# +ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-long-long") + # # Disable deprecation warnings # @@ -79,6 +87,11 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-deprecated-declarations") IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # + # Silence Clang warnings about unused parameters: + # + SET(CMAKE_CXX_FLAGS "-Qunused-arguments ${CMAKE_CXX_FLAGS}") + # # *Boy*, clang seems to be the very definition of "pedantic" in # "-pedantic" mode, so disable a bunch of harmless warnings @@ -95,6 +108,16 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") ENDIF() +IF(DEAL_II_STATIC_EXECUTABLE) + # + # To produce a static executable, we have to statically link libstdc++ + # and gcc's support libraries and glibc: + # + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-static") + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-pthread") +ENDIF() + + ############################# # # # For Release target: # @@ -108,6 +131,7 @@ IF (CMAKE_BUILD_TYPE MATCHES "Release") ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O2") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-funroll-loops") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-funroll-all-loops") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-fstrict-aliasing") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-felide-constructors") @@ -126,16 +150,22 @@ IF (CMAKE_BUILD_TYPE MATCHES "Debug") LIST(APPEND DEAL_II_DEFINITIONS_DEBUG "DEBUG") LIST(APPEND DEAL_II_USER_DEFINITIONS_DEBUG "DEBUG") - ADD_FLAGS(DEAL_II_CXX_FLAGS_DEBUG "-O0") + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-Og") + # + # If -Og is not available, fall back to -O0: + # + IF(NOT DEAL_II_HAVE_FLAG_Og) + ADD_FLAGS(DEAL_II_CXX_FLAGS_DEBUG "-O0") + ENDIF() ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-ggdb") - ENABLE_IF_SUPPORTED(DEAL_II_SHARED_LINKER_FLAGS_DEBUG "-ggdb") + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS_DEBUG "-ggdb") # # If -ggdb is not available, fall back to -g: # IF(NOT DEAL_II_HAVE_FLAG_ggdb) ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-g") - ENABLE_IF_SUPPORTED(DEAL_II_SHARED_LINKER_FLAGS_DEBUG "-g") + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS_DEBUG "-g") ENDIF() ENDIF() diff --git a/deal.II/cmake/setup_compiler_flags_intel.cmake b/deal.II/cmake/setup_compiler_flags_intel.cmake index 1c82c3ef5c..ed67d96ad3 100644 --- a/deal.II/cmake/setup_compiler_flags_intel.cmake +++ b/deal.II/cmake/setup_compiler_flags_intel.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # General setup for the Intel C++ Compiler @@ -42,7 +44,7 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic") # Check whether the -as-needed flag is available. If so set it to link # the deal.II library with it. # -ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed") +ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed") # # Set ansi mode: @@ -80,6 +82,18 @@ ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd1478") ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-wd1572") +IF(DEAL_II_STATIC_EXECUTABLE) + # + # To produce a static executable, we have to statically link intel's + # support libraries: + # + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-static") + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-static-intel") + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-static-gcc") + ENABLE_IF_SUPPORTED(DEAL_II_LINKER_FLAGS "-pthread") +ENDIF() + + ############################# # # # For Release target: # @@ -90,11 +104,24 @@ IF (CMAKE_BUILD_TYPE MATCHES "Release") # # General optimization flags: # - ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O2") + + IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13.0" ) + ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O2") + ELSE() + # + # Disable aggressive optimization for intel-13* compilers, until we + # resolve a lot of funny miscompilations... + # + # - Maier, 2013 + # + ADD_FLAGS(DEAL_II_CXX_FLAGS_RELEASE "-O1") + ENDIF() + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-ip") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-funroll-loops") - ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-ansi-alias") # equiv. -fstrict-aliasing + # equivalent to -fno-strict-aliasing: + ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_RELEASE "-no-ansi-alias") ENDIF() diff --git a/deal.II/cmake/setup_compiler_flags_msvc.cmake b/deal.II/cmake/setup_compiler_flags_msvc.cmake index b8871633f5..6aeaceb16d 100644 --- a/deal.II/cmake/setup_compiler_flags_msvc.cmake +++ b/deal.II/cmake/setup_compiler_flags_msvc.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Timo Heister -## -##### +## --------------------------------------------------------------------- # # General setup for the Microsoft Visual Studio C++ Compiler (Windows) diff --git a/deal.II/cmake/setup_custom_targets.cmake b/deal.II/cmake/setup_custom_targets.cmake deleted file mode 100644 index 2f7b56efa8..0000000000 --- a/deal.II/cmake/setup_custom_targets.cmake +++ /dev/null @@ -1,44 +0,0 @@ -##### -## -## Copyright (C) 2012, 2013 by the deal.II authors -## -## This file is part of the deal.II library. -## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. -## -## Author: Matthias Maier -## -##### - -# -# Setup some convenience custom targets for the build system: -# - - -########################################################################### -# # -# Custom targets for library, documentation and compat_files components: # -# # -########################################################################### - -ADD_CUSTOM_TARGET(library) -FOREACH(_build ${DEAL_II_BUILD_TYPES}) - ADD_DEPENDENCIES(library ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}) -ENDFOREACH() - -IF(DEAL_II_COMPONENT_DOCUMENTATION) - ADD_CUSTOM_TARGET(documentation - DEPENDS doxygen - ) -ENDIF() - -IF(DEAL_II_COMPONENT_COMPAT_FILES) - ADD_CUSTOM_TARGET(compat_files - DEPENDS - expand_instantiations - make_dependencies - report_features - ) -ENDIF() diff --git a/deal.II/cmake/setup_deal_ii.cmake b/deal.II/cmake/setup_deal_ii.cmake index 5b82eedd22..a07c54f465 100644 --- a/deal.II/cmake/setup_deal_ii.cmake +++ b/deal.II/cmake/setup_deal_ii.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Set up deal.II specific definitions @@ -49,17 +51,15 @@ # DEAL_II_PROJECT_CONFIG_RELDIR *) # # DEAL_II_BUILD_TYPES -# DEAL_II_WITH_BUNDLED_DIRECTORY -# DEAL_II_WITH_DOC_DIRECTORY # # *) Can be overwritten by the command line via -D<...> # -########################################################################### -# # -# General information about deal.II: # -# # -########################################################################### +######################################################################## +# # +# General information about deal.II: # +# # +######################################################################## SET_IF_EMPTY(DEAL_II_PACKAGE_NAME "deal.II") @@ -83,11 +83,11 @@ STRING(REGEX REPLACE SET(DEAL_II_VERSION ${DEAL_II_VERSION_MAJOR}.${DEAL_II_VERSION_MINOR}) -########################################################################### -# # -# Information about paths, install locations and names: # -# # -########################################################################### +######################################################################## +# # +# Information about paths, install locations and names: # +# # +######################################################################## SET(DEAL_II_PROJECT_CONFIG_NAME "${DEAL_II_PACKAGE_NAME}") @@ -110,7 +110,7 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") ) # # Ensure that in case of an out of source build BINARY_DIR/include != - # INSTALL_PREFIX/include us always true. Otherwise stale headers might + # INSTALL_PREFIX/include is always true. Otherwise stale headers might # get included resulting in a failing build. # SET_IF_EMPTY(DEAL_II_INCLUDE_RELDIR "include/install") @@ -144,41 +144,3 @@ IF(CMAKE_BUILD_TYPE MATCHES "Release") LIST(APPEND DEAL_II_BUILD_TYPES "RELEASE") ENDIF() - -########################################################################### -# # -# Cleanup and Includes that have to happen after the call to PROJECT(): # -# # -########################################################################### - -# -# Cleanup some files used for storing the names of all object targets that -# will be bundled to the deal.II library. -# (Right now, i.e. cmake 2.8.8, this is the only reliable way to get -# information into a global scope...) -# -FOREACH(_build ${DEAL_II_BUILD_TYPES}) - STRING(TOLOWER "${_build}" _build_lowercase) - FILE(REMOVE - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase} - ) -ENDFOREACH() - - -# -# Cross compilation stuff: -# -IF(CMAKE_CROSSCOMPILING) - # - # Disable platform introspection when cross compiling - # - SET(DEAL_II_ALLOW_PLATFORM_INTROSPECTION OFF CACHE BOOL "" FORCE) - - # - # Import native expand_instantiations for use in cross compilation: - # - SET(DEAL_II_NATIVE "DEAL_II_NATIVE-NOTFOUND" CACHE FILEPATH - "A pointer to a native deal.Ii build directory" - ) - INCLUDE(${DEAL_II_NATIVE}/cmake/scripts//importExecutables.cmake) -ENDIF() diff --git a/deal.II/cmake/setup_external_macros.cmake b/deal.II/cmake/setup_external_macros.cmake index f5c3a150a1..89dc60e9e4 100644 --- a/deal.II/cmake/setup_external_macros.cmake +++ b/deal.II/cmake/setup_external_macros.cmake @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Include all external (cmake) macros that we will use: @@ -18,7 +20,6 @@ INCLUDE(CheckCXXCompilerFlag) INCLUDE(CheckCXXSourceCompiles) -INCLUDE(CheckCSourceCompiles) INCLUDE(CheckCXXSourceRuns) INCLUDE(CheckCXXSymbolExists) INCLUDE(CheckIncludeFileCXX) diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index fbf44de466..0584cc7696 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -1,23 +1,25 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- -########################################################################### -# # -# Finalize the configuration: # -# # -########################################################################### +######################################################################## +# # +# Finalize the configuration: # +# # +######################################################################## # # Hide some cmake specific cached variables. This is annoying... @@ -58,12 +60,36 @@ FOREACH(_build ${DEAL_II_BUILD_TYPES}) ENDIF() ENDFOREACH() +# +# Cleanup some files used for storing the names of all object targets that +# will be bundled to the deal.II library. +# (Right now, i.e. cmake 2.8.8, this is the only reliable way to get +# information into a global scope...) +# +FOREACH(_build ${DEAL_II_BUILD_TYPES}) + STRING(TOLOWER "${_build}" _build_lowercase) + FILE(REMOVE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase} + ) +ENDFOREACH() +FILE(WRITE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_source_includes + "" + ) + +# +# Cleanup deal.IITargets.cmake in the build directory: +# +FILE(REMOVE + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}BuildTargets.cmake + ) + -########################################################################### -# # -# And write a nice configuration summary to file: # -# # -########################################################################### +######################################################################## +# # +# And write a nice configuration summary to file: # +# # +######################################################################## SET(_log_detailed "${CMAKE_BINARY_DIR}/detailed.log") SET(_log_summary "${CMAKE_BINARY_DIR}/summary.log") @@ -99,30 +125,36 @@ _both( ) IF(CMAKE_CROSSCOMPILING) _both( - "# CROSSCOMPILING!\n" + "#\n# CROSSCOMPILING!\n" "# DEAL_II_NATIVE: ${DEAL_II_NATIVE}\n" ) ENDIF() +IF(DEAL_II_STATIC_EXECUTABLE) + _both( + "#\n# STATIC LINKAGE!\n" + ) +ENDIF() + _both("#\n") _detailed( "# Compiler flags used for this build: -# CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS} +# CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS} " ) IF(CMAKE_BUILD_TYPE MATCHES "Release") - _detailed("# DEAL_II_CXX_FLAGS_RELEASE: ${DEAL_II_CXX_FLAGS_RELEASE}\n") + _detailed("# DEAL_II_CXX_FLAGS_RELEASE: ${DEAL_II_CXX_FLAGS_RELEASE}\n") ENDIF() IF(CMAKE_BUILD_TYPE MATCHES "Debug") - _detailed("# DEAL_II_CXX_FLAGS_DEBUG: ${DEAL_II_CXX_FLAGS_DEBUG}\n") + _detailed("# DEAL_II_CXX_FLAGS_DEBUG: ${DEAL_II_CXX_FLAGS_DEBUG}\n") ENDIF() -_detailed("# CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}\n") +_detailed("# DEAL_II_LINKER_FLAGS: ${DEAL_II_LINKER_FLAGS}\n") IF(CMAKE_BUILD_TYPE MATCHES "Release") - _detailed("# DEAL_II_SHARED_LINKER_FLAGS_RELEASE: ${DEAL_II_SHARED_LINKER_FLAGS_RELEASE}\n") + _detailed("# DEAL_II_LINKER_FLAGS_RELEASE: ${DEAL_II_LINKER_FLAGS_RELEASE}\n") ENDIF() IF(CMAKE_BUILD_TYPE MATCHES "Debug") - _detailed("# DEAL_II_SHARED_LINKER_FLAGS_DEBUG: ${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}\n") + _detailed("# DEAL_II_LINKER_FLAGS_DEBUG: ${DEAL_II_LINKER_FLAGS_DEBUG}\n") ENDIF() _detailed("#\n") @@ -151,9 +183,7 @@ FOREACH(_var ${_variables}) LIST(APPEND _components "${_var}") ELSEIF(_var MATCHES "(MPI_CXX_COMPILER|MPI_CXX_COMPILE_FLAGS|MPI_CXX_LINK_FLAGS)") LIST(APPEND _features_config ${_var}) - ELSEIF(_var MATCHES "(LIBRARIES|INCLUDE_PATH|INCLUDE_DIRS|LINKER_FLAGS)" - # Avoid a lot of Trilinos variables: - AND (NOT _var MATCHES "_TPL_|_MPI_") ) + ELSEIF(_var MATCHES "(LIBRARIES|INCLUDE_PATH|INCLUDE_DIRS|LINKER_FLAGS)") LIST(APPEND _features_config ${_var}) ENDIF() ENDFOREACH() @@ -165,6 +195,20 @@ FOREACH(_var ${_features}) IF(FEATURE_${_feature}_EXTERNAL_CONFIGURED) _both("# ${_var} set up with external dependencies\n") + # + # Print out version number: + # + IF(DEFINED ${_feature}_VERSION) + _detailed("# ${_feature}_VERSION = ${${_feature}_VERSION}\n") + ENDIF() + + # + # Print out ${_feature}_DIR: + # + IF(DEFINED ${_feature}_DIR) + _detailed("# ${_feature}_DIR = ${${_feature}_DIR}\n") + ENDIF() + # # Print the feature configuration: # diff --git a/deal.II/cmake/setup_post_project_call.cmake b/deal.II/cmake/setup_post_project_call.cmake new file mode 100644 index 0000000000..60aad894df --- /dev/null +++ b/deal.II/cmake/setup_post_project_call.cmake @@ -0,0 +1,58 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + + +######################################################################## +# # +# Setup that has to happen after the call to PROJECT(): # +# # +######################################################################## + +# +# Library search order: +# +IF(DEAL_II_PREFER_STATIC_LIBS) + # + # Invert the search order for libraries when DEAL_II_PREFER_STATIC_LIBS + # is set. This will prefer static archives instead of shared libraries: + # + # TODO: Does this work on a Windows or CYGWIN target? + LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) +ENDIF() + + +# +# Cross compilation stuff: +# +IF(CMAKE_CROSSCOMPILING) + # + # Disable platform introspection when cross compiling + # + SET(DEAL_II_ALLOW_PLATFORM_INTROSPECTION OFF CACHE BOOL "" FORCE) + + # + # Import native expand_instantiations for use in cross compilation: + # + SET(DEAL_II_NATIVE "DEAL_II_NATIVE-NOTFOUND" CACHE FILEPATH + "A pointer to a native deal.Ii build directory" + ) + IF(DEAL_II_NATIVE MATCHES "-NOTFOUND") + MESSAGE(FATAL_ERROR + "Please set the CMake variable DEAL_II_NATIVE to a valid path that points to a native deal.II build directory" + ) + ENDIF() + INCLUDE(${DEAL_II_NATIVE}/importExecutables.cmake) +ENDIF() diff --git a/deal.II/contrib/CMakeLists.txt b/deal.II/contrib/CMakeLists.txt index c6569084fb..f507b519eb 100644 --- a/deal.II/contrib/CMakeLists.txt +++ b/deal.II/contrib/CMakeLists.txt @@ -1,22 +1,26 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- IF(DEAL_II_COMPONENT_MESH_CONVERTER) ADD_SUBDIRECTORY(mesh_conversion) ENDIF() IF(DEAL_II_COMPONENT_PARAMETER_GUI) - ADD_SUBDIRECTorY(parameter_gui) + ADD_SUBDIRECTORY(parameter_gui) ENDIF() +#ADD_SUBDIRECTORY(test_affinity) + diff --git a/deal.II/contrib/lapack_templates/example_custom_target.cmake b/deal.II/contrib/lapack_templates/example_custom_target.cmake index fa77d9ed1b..108cad18f3 100644 --- a/deal.II/contrib/lapack_templates/example_custom_target.cmake +++ b/deal.II/contrib/lapack_templates/example_custom_target.cmake @@ -1,3 +1,19 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/deal.II/lac/lapack_templates.h COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/deal.II/lac/ diff --git a/deal.II/contrib/lapack_templates/lapack_templates.pl b/deal.II/contrib/lapack_templates/lapack_templates.pl index cbad825c04..acfd48c119 100644 --- a/deal.II/contrib/lapack_templates/lapack_templates.pl +++ b/deal.II/contrib/lapack_templates/lapack_templates.pl @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id$ -# Version: $Name$ -# -# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2005 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- #--------------------------------------------------------------------------- # This perl script translates lapack_templates.h.in to lapack_templates.h @@ -37,19 +40,21 @@ my $double; print << 'EOT' -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// This file was automatically generated from lapack_templates.h.in -// See blastemplates in the deal.II contrib directory +// Copyright (C) 2005 - 2013 by the deal.II authors // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 by the deal authors +// This file is part of the deal.II library. // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. // -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- #ifndef __LAPACK_TEMPLATES_H #define __LAPACK_TEMPLATES_H diff --git a/deal.II/contrib/mesh_conversion/CMakeLists.txt b/deal.II/contrib/mesh_conversion/CMakeLists.txt index c198104103..2c8dbc4c8f 100644 --- a/deal.II/contrib/mesh_conversion/CMakeLists.txt +++ b/deal.II/contrib/mesh_conversion/CMakeLists.txt @@ -1,18 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is multi licensed under -## - QPL 1.0, -## - GPL 2.0 or any later version, -## - LGL 2.1 or any later version. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- CMAKE_MINIMUM_REQUIRED(VERSION 2.8) #PROJECT(mesh_converter) diff --git a/deal.II/contrib/mesh_conversion/README.txt b/deal.II/contrib/mesh_conversion/README.txt index 77f4d27d0f..ef00b074b1 100644 --- a/deal.II/contrib/mesh_conversion/README.txt +++ b/deal.II/contrib/mesh_conversion/README.txt @@ -6,7 +6,7 @@ Use: Convert an ABAQUS .inp file to an AVS UCD file. Author: Jean-Paul Pelteret jppelteret.uct@gmail.com - modified by: Timo Heister, heister@math.tamu.edu + modified by: Timo Heister, heister@clemson.edu =================================================== diff --git a/deal.II/contrib/parameter_gui/CMakeLists.txt b/deal.II/contrib/parameter_gui/CMakeLists.txt index 929bb5e2a1..542b9a5766 100644 --- a/deal.II/contrib/parameter_gui/CMakeLists.txt +++ b/deal.II/contrib/parameter_gui/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by Martin Steigemann and Wolfgang Bangerth ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- CMAKE_MINIMUM_REQUIRED(VERSION 2.8) #PROJECT(parameter_gui) diff --git a/deal.II/contrib/parameter_gui/README b/deal.II/contrib/parameter_gui/README index 43f041a2bd..963da457f9 100644 --- a/deal.II/contrib/parameter_gui/README +++ b/deal.II/contrib/parameter_gui/README @@ -1,4 +1,4 @@ -This subdirectory contains the parameterr_gui project. +This subdirectory contains the parameter_gui project. It is copyrighted by Martin Steigemann and Wolfgang Bangerth and distributed under the same license as the deal.II library, i.e. diff --git a/deal.II/contrib/parameter_gui/browse_lineedit.cpp b/deal.II/contrib/parameter_gui/browse_lineedit.cpp index 33e89864c1..29d1db3ca0 100644 --- a/deal.II/contrib/parameter_gui/browse_lineedit.cpp +++ b/deal.II/contrib/parameter_gui/browse_lineedit.cpp @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/contrib/parameter_gui/browse_lineedit.h b/deal.II/contrib/parameter_gui/browse_lineedit.h index 2c0a97fada..b03c7a6f8b 100644 --- a/deal.II/contrib/parameter_gui/browse_lineedit.h +++ b/deal.II/contrib/parameter_gui/browse_lineedit.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef BROWSELINEEDIT_H #define BROWSELINEEDIT_H diff --git a/deal.II/contrib/parameter_gui/info_message.cpp b/deal.II/contrib/parameter_gui/info_message.cpp index db753bc0b1..ca5614c5ce 100644 --- a/deal.II/contrib/parameter_gui/info_message.cpp +++ b/deal.II/contrib/parameter_gui/info_message.cpp @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/contrib/parameter_gui/info_message.h b/deal.II/contrib/parameter_gui/info_message.h index f3ad3711e7..78969ef0c4 100644 --- a/deal.II/contrib/parameter_gui/info_message.h +++ b/deal.II/contrib/parameter_gui/info_message.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef INFOMESSAGE_H #define INFOMESSAGE_H diff --git a/deal.II/contrib/parameter_gui/main.cpp b/deal.II/contrib/parameter_gui/main.cpp index 461cd0c0aa..f7d1340482 100644 --- a/deal.II/contrib/parameter_gui/main.cpp +++ b/deal.II/contrib/parameter_gui/main.cpp @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/contrib/parameter_gui/mainwindow.cpp b/deal.II/contrib/parameter_gui/mainwindow.cpp index 4cef562f34..dbd2f430f0 100644 --- a/deal.II/contrib/parameter_gui/mainwindow.cpp +++ b/deal.II/contrib/parameter_gui/mainwindow.cpp @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/contrib/parameter_gui/mainwindow.h b/deal.II/contrib/parameter_gui/mainwindow.h index 54deeae047..617c3e3422 100644 --- a/deal.II/contrib/parameter_gui/mainwindow.h +++ b/deal.II/contrib/parameter_gui/mainwindow.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef MAINWINDOW_H #define MAINWINDOW_H diff --git a/deal.II/contrib/parameter_gui/parameter_delegate.cpp b/deal.II/contrib/parameter_gui/parameter_delegate.cpp index ec7106f526..1dd33b59cc 100644 --- a/deal.II/contrib/parameter_gui/parameter_delegate.cpp +++ b/deal.II/contrib/parameter_gui/parameter_delegate.cpp @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include @@ -96,7 +102,7 @@ namespace dealii { QString pattern_description = index.data(Qt::StatusTipRole).toString(); // load pattern description // stored in the StatusLine - QRegExp rx_string("\\b(Anything|MultipleSelection|List)\\b"), + QRegExp rx_string("\\b(Anything|MultipleSelection|List|Map)\\b"), rx_filename("\\b(FileName)\\b"), rx_dirname("\\b(DirectoryName)\\b"), rx_integer("\\b(Integer)\\b"), diff --git a/deal.II/contrib/parameter_gui/parameter_delegate.h b/deal.II/contrib/parameter_gui/parameter_delegate.h index a4bcb2b98f..3c41359266 100644 --- a/deal.II/contrib/parameter_gui/parameter_delegate.h +++ b/deal.II/contrib/parameter_gui/parameter_delegate.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef PARAMETERDELEGATE_H #define PARAMETERDELEGATE_H @@ -33,7 +39,7 @@ namespace dealii * The ParameterDelegate class implements special delegates for the QTreeWidget class used in the parameterGUI. * The QTreeWidget class provides some different standard delegates for editing parameters shown in the * tree structure. The ParameterDelegate class provides special editors for the different types of parameters defined in - * the ParameterHandler class. For all parameter types based on strings as "Anything", "MultipleSelection" and + * the ParameterHandler class. For all parameter types based on strings as "Anything", "MultipleSelection" "Map" and * "List" a simple line editor will be shown up. In the case of integer and double type parameters the editor is a spin box and for * "Selection" type parameters a combo box will be shown up. For parameters of type "FileName" and "DirectoryName" * the delegate shows a @ref BrowseLineEdit editor. The column of the tree structure with the parameter values has to be set diff --git a/deal.II/contrib/parameter_gui/xml_parameter_reader.cpp b/deal.II/contrib/parameter_gui/xml_parameter_reader.cpp index 115da80d12..144dce7e6a 100644 --- a/deal.II/contrib/parameter_gui/xml_parameter_reader.cpp +++ b/deal.II/contrib/parameter_gui/xml_parameter_reader.cpp @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/contrib/parameter_gui/xml_parameter_reader.h b/deal.II/contrib/parameter_gui/xml_parameter_reader.h index 6d90fd4d75..17d6f4a3d8 100644 --- a/deal.II/contrib/parameter_gui/xml_parameter_reader.h +++ b/deal.II/contrib/parameter_gui/xml_parameter_reader.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef XMLPARAMETERREADER_H #define XMLPARAMETERREADER_H diff --git a/deal.II/contrib/parameter_gui/xml_parameter_writer.cpp b/deal.II/contrib/parameter_gui/xml_parameter_writer.cpp index 553267d873..6bd10fce98 100644 --- a/deal.II/contrib/parameter_gui/xml_parameter_writer.cpp +++ b/deal.II/contrib/parameter_gui/xml_parameter_writer.cpp @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/contrib/parameter_gui/xml_parameter_writer.h b/deal.II/contrib/parameter_gui/xml_parameter_writer.h index 814b486b82..f2597cd4ef 100644 --- a/deal.II/contrib/parameter_gui/xml_parameter_writer.h +++ b/deal.II/contrib/parameter_gui/xml_parameter_writer.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by Martin Steigemann and Wolfgang Bangerth // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef XMLPARAMETERWRITER_H #define XMLPARAMETERWRITER_H diff --git a/deal.II/contrib/test_affinity/CMakeLists.txt b/deal.II/contrib/test_affinity/CMakeLists.txt new file mode 100644 index 0000000000..83075153c0 --- /dev/null +++ b/deal.II/contrib/test_affinity/CMakeLists.txt @@ -0,0 +1,46 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + +INCLUDE_DIRECTORIES( + BEFORE + ${CMAKE_SOURCE_DIR}/include/ + ${CMAKE_BINARY_DIR}/include/ + ) + +ADD_EXECUTABLE(test_affinity + test_affinity.cc + ) + +IF(CMAKE_BUILD_TYPE MATCHES "Debug") + SET(_build "DEBUG") +ELSE() + SET(_build "RELEASE") +ENDIF() + +SET_TARGET_PROPERTIES(test_affinity PROPERTIES + LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}" + COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" + COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}" + LINKER_LANGUAGE "CXX" + ) + +TARGET_LINK_LIBRARIES(test_affinity ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}) + +IF(NOT CMAKE_CROSSCOMPILING) + ADD_CUSTOM_TARGET(run_test_affinity COMMAND test_affinity) +ENDIF() diff --git a/deal.II/contrib/test_affinity/test_affinity.cc b/deal.II/contrib/test_affinity/test_affinity.cc new file mode 100644 index 0000000000..81549ae370 --- /dev/null +++ b/deal.II/contrib/test_affinity/test_affinity.cc @@ -0,0 +1,29 @@ +#include +#include + +int main () +{ + // we need this, otherwise gcc will not link against deal.II + dealii::Triangulation<2> test; + + cpu_set_t my_set; + CPU_ZERO(&my_set); + + unsigned int len = sizeof(my_set); + int ret = sched_getaffinity(0, len, &my_set); + + if (ret!=0) + { + printf("sched_getaffinity() failed, return value: %d\n", ret); + return -1; + } + + unsigned int bits_set = CPU_COUNT(&my_set); + + if (bits_set==1) + { + printf("Warning: sched_getaffinity() returns that we can only use one CPU.\n"); + return 1; + } + printf("ncpus=%d, mask=%08X\n", bits_set, *(unsigned int*)(&my_set)); +} diff --git a/deal.II/doc/CMakeLists.txt b/deal.II/doc/CMakeLists.txt index 6d9e9412de..8e63586481 100644 --- a/deal.II/doc/CMakeLists.txt +++ b/deal.II/doc/CMakeLists.txt @@ -1,23 +1,20 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- -# -# Required packages for the document generation: -# -FIND_PACKAGE(Perl) -FIND_PACKAGE(Doxygen) # @@ -25,6 +22,12 @@ FIND_PACKAGE(Doxygen) # IF(DEAL_II_COMPONENT_DOCUMENTATION) + # + # Required packages for the document generation: + # + FIND_PACKAGE(Perl) + FIND_PACKAGE(Doxygen) + # # Do we have all necessary dependencies? # @@ -44,6 +47,11 @@ IF(DEAL_II_COMPONENT_DOCUMENTATION) # ADD_SUBDIRECTORY(doxygen) + # + # A custom target with the same name as the component: + # + ADD_CUSTOM_TARGET(documentation DEPENDS doxygen) + # # Install the static elements of the html documentation: # diff --git a/deal.II/doc/authors.html b/deal.II/doc/authors.html index 033fb196dc..36750b7b3b 100644 --- a/deal.II/doc/authors.html +++ b/deal.II/doc/authors.html @@ -12,7 +12,7 @@ -

deal.II Credits

+

deal.II Authors

The deal.II project was initially started by @@ -30,9 +30,9 @@

  • - Timo Heister, - Texas A&M University, TX, USA + Clemson University, SC, USA
  • @@ -42,10 +42,6 @@
  • -

    In order to get in contact with them, send email to authors - at dealii.org. -

    -

    Many people have contributed to deal.II over the years, some of them very substantial parts of the library. Their work is greatly appreciated: no open source project can survice without a @@ -59,7 +55,7 @@ Step-29 tutorial program.

  • Fahad Alrashed: - work in PETScWrappers. + work in PETScWrappers, various other fixes.
  • Michael Anderson: Linear complexity grid reordering algorithm in 2d and 3d. @@ -94,6 +90,9 @@
  • Chih-Che Chueh: Step-43 tutorial program. +
  • Denis Davydov: + FEValuesExtractors::Tensor and associated functionality, various other changes. +
  • Kevin Dugan: Fixes in VectorTools::interpolate. @@ -161,6 +160,9 @@ Support for arbitrary nodes in FE_Q. Matrix-free framework. step-37 and step-48 tutorial programs. +
  • Oleh Krehel: + Many documentation fixes. +
  • Martin Kronbichler: step-22, step-31, step-32, step-37, step-48, interfaces to Trilinos, significant parts of ConstraintMatrix, matrix-free @@ -185,7 +187,8 @@ 2.5 format.
  • Matthias Maier: - CMake build system. Periodic boundary conditions. Enhancements throughout the library. + CMake build system for the library and the testsuite. Periodic + boundary conditions. Enhancements throughout the library.
  • Cataldo Manigrasso: Work on the codimension-one meshes, DoFHandler, and finite @@ -260,7 +263,9 @@ Eulerian mappings.
  • Martin Steigemann: - Graphical user interface for the ParameterHandler class. ParaSails preconditioner. + Graphical user interface for the ParameterHandler + class. ParaSails preconditioner. Functionality in various + places of the library.
  • Franz-Theo Suttmeier: Initial parts of the linear algebra libraries. @@ -272,11 +277,12 @@ Packaging and configuration issues.
  • Bruno Turcksin: - Extending deal.ii for 64-bit integer support. + Extending deal.ii for 64-bit integer support. Converting the + testsuite to CMake. Various other changes.
  • Kainan Wang: Extending deal.ii for 64-bit integer support. - +
  • Yaqi Wang: The step-28 tutorial program;   @@ -288,6 +294,9 @@
  • Joshua White: Arbitrary order Eulerian mappings. +
  • Christian Wülker: + GridOut::write_svg. +
  • Toby D. Young: Interfaces to SLEPc;   many changes in the interfaces to PETSc;   MUMPS interface; @@ -317,18 +326,16 @@ Siegen, Germany.

    - +
    +
    + The deal.II Authors + $Date$ +
    - Valid HTML 4.01! - Valid CSS! - + + Valid HTML 4.01! + + Valid CSS!
    diff --git a/deal.II/doc/development/Toolchain.sample b/deal.II/doc/developers/Toolchain.sample similarity index 100% rename from deal.II/doc/development/Toolchain.sample rename to deal.II/doc/developers/Toolchain.sample diff --git a/deal.II/doc/development/cmake-internals.html b/deal.II/doc/developers/cmake-internals.html similarity index 57% rename from deal.II/doc/development/cmake-internals.html rename to deal.II/doc/developers/cmake-internals.html index a21b8f0b79..b568a0527f 100644 --- a/deal.II/doc/development/cmake-internals.html +++ b/deal.II/doc/developers/cmake-internals.html @@ -11,158 +11,155 @@ - - - -

    Build system internals

    - -

    - This page provides details about the CMake build system. Files - processed by the top level CMakeLists.txt script are - listed in the TOC in cronological order. -

    - -

    - - - - -
    Table of contents
    - -
    Configuration: - -
    Target definition and installation - -
    -

    - - -

    Coding convention

    -

    - Coding conventions are always a matter of choice. Nevertheless, the - following rules should be considered: -

      -
    • - Statements and keywords are written in all caps. -
    • - Indenting is done by two spaces; the usual indenting rules apply. -
    • - The ELSE(), ENDIF(), - ENDFOREACH(), etc. statements shall not repeat the - corresponding condition in IF(), - FOREACH(), etc. -
    • - To emphasize a comment it may be enclosed by a leading and - trailing empty comment line. -
    - An example: -
    -
    -    FOREACH(_build ${DEAL_II_BUILD_TYPES})
    -      #
    -      # Set an appropriate keyword depending on target and build type:
    -      #
    -      IF(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease")
    -        SET(_keyword "general")
    -      ELSE()
    -        IF(_build MATCHES DEBUG)
    -          SET(_keyword "debug")
    -        ELSE()
    -          SET(_keyword "optimized")
    -        ENDIF()
    -      ENDIF()
    -    ENDFOREACH()
    -      
    -
      -
    • - Line break is at 78 characters and should be obeyed whenever - reasonable. -
    • - Long statements should be broken into several lines at reasonable - places. Additional lines for a statement are indented by 2 - spaces. -
    • - Multiline statements must end with the closing bracket at a - single line: -
    -
    -
    -    LIST(APPEND CONFIG_LIBRARIES
    -      ${_keyword}
    -      ${CONFIG_LIBRARIES_${_build}}
    -      )
    -
    -    SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
    -      PROPERTIES
    -      VERSION ${VERSION}
    -      SOVERSION ${VERSION}
    -      LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${build}}"
    -      COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}"
    -      COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}"
    -      )
    -      
    - CMake operates almost always with variables in global state. To guard - against accidential overwrite of variables the following naming - conventions must be followed at all times: -
      -
    • - Global (configuration) variables are written in all caps. When - introducing a new one, ensure that the name isn't already used - somewhere else. Unrelated global variables must never be - overwritten. -
    • - Global variables can be prefixed by DEAL_II_. - (Global variables defined by CMake are usually prefixed by - CMAKE_.) -
    • - Local variables should always be named in all lowercase with a - leading "_". Local variables cannot be assumed to remain valid. - The may get overwritten at any time. -
    -

    - - - -

    ./CMakeLists.txt and ./cmake/setup_*.cmake

    - -

    - The very first configuration steps after some initial setup in - ./CMakeLists.txt takes place in some - ./cmake/setup_*.cmake files: -

      -
    • setup_cached_variables.cmake: - This sets up all cached variables prior to the call to - PROJECT(deal.II). For details see the comment at the - top. Furthermore, some bookkeeping for compiler and linker flags - takes place, see the section - about compile flags. -
    • setup_deal_ii.cmake: - This file is included immediately after the call to - PROJECT(deal.II) and will set up all magic - numbers such as names, definitions, relative and absolute - paths used in the build system. Most of the definitions are - guarded with the help of the SET_IF_EMPTY macro so - that it is possible to override the values from the command line. -
    • setup_compiler_flags.cmake - sets up a suitable set of default compile flag for a known - compiler by including the appropriate - setup_compiler_flags_*.cmake file. When adding new - flags or compiler support, please respect the following note -
      +
      +

      Build system internals

      + +

      + This page provides details about the CMake build system. Files + processed by the top level CMakeLists.txt script are + listed in the TOC in chronological order. +

      + + + + +

      Coding convention

      +

      + Coding conventions are always a matter of choice. Nevertheless, the + following rules should be considered: +

        +
      • + Statements and keywords are written in all caps. +
      • + Indenting is done by two spaces; the usual indenting rules apply. +
      • + The ELSE(), ENDIF(), + ENDFOREACH(), etc. statements shall not repeat the + corresponding condition in IF(), + FOREACH(), etc. +
      • + To emphasize a comment it may be enclosed by a leading and + trailing empty comment line. +
      + An example: +
      +FOREACH(_build ${DEAL_II_BUILD_TYPES})
      +#
      +# Set an appropriate keyword depending on target and build type:
      +#
      +  IF(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "DebugRelease")
      +    SET(_keyword "general")
      +  ELSE()
      +    IF(_build MATCHES DEBUG)
      +      SET(_keyword "debug")
      +    ELSE()
      +      SET(_keyword "optimized")
      +    ENDIF()
      +  ENDIF()
      +ENDFOREACH()
      +
      + +
        +
      • + Line break is at 78 characters and should be obeyed whenever + reasonable. +
      • + Long statements should be broken into several lines at reasonable + places. Additional lines for a statement are indented by 2 + spaces. +
      • + Multiline statements must end with the closing bracket at a + single line: +
      +
      +LIST(APPEND CONFIG_LIBRARIES
      +  ${_keyword}
      +  ${CONFIG_LIBRARIES_${_build}}
      +)
      +
      +SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX}
      +  PROPERTIES
      +  VERSION ${VERSION}
      +  SOVERSION ${VERSION}
      +  LINK_FLAGS "${DEAL_II_LINKER_FLAGS_${build}}"
      +  COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}"
      +  COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}"
      +)
      +
      + +

      + CMake operates almost always with variables in global state. To + guard against accidental overwrite of variables the following naming + conventions must be followed at all times: +

      + +
        +
      • + Global (configuration) variables are written in all caps. When + introducing a new one, ensure that the name isn't already used + somewhere else. Unrelated global variables must never be + overwritten. +
      • + Global variables can be prefixed by DEAL_II_. + (Global variables defined by CMake are usually prefixed by + CMAKE_.) +
      • + Local variables should always be named in all lowercase with a + leading "_". Local variables cannot be assumed to remain valid. + The may get overwritten at any time. +
      +

      + +

      Configuration

      + + +

      ./CMakeLists.txt and ./cmake/setup_*.cmake

      + +

      + The very first configuration steps after some initial setup in + ./CMakeLists.txt takes place in some + ./cmake/setup_*.cmake files: +

        +
      • setup_cached_variables.cmake: + This sets up all cached variables prior to the call to + PROJECT(deal.II). For details see the comment at the + top. Furthermore, some bookkeeping for compiler and linker flags + takes place, see the section + about compile flags. +
      • setup_deal_ii.cmake: + This file is included immediately after the call to + PROJECT(deal.II) and will set up all magic + numbers such as names, definitions, relative and absolute + paths used in the build system. Most of the definitions are + guarded with the help of the SET_IF_EMPTY macro so + that it is possible to override the values from the command line. +
      • setup_compiler_flags.cmake + sets up a suitable set of default compile flag for a known + compiler by including the appropriate + setup_compiler_flags_*.cmake file. When adding new + flags or compiler support, please respect the following note + +
         
             #
             # (./cmake/setup_compiler_flags.cmake)
        @@ -177,15 +174,15 @@
             #   CMAKE_CXX_FLAGS
             #   DEAL_II_CXX_FLAGS_DEBUG
             #   DEAL_II_CXX_FLAGS_RELEASE
        -    #   CMAKE_SHARED_LINKER_FLAGS
        -    #   DEAL_II_SHARED_LINKER_FLAGS_DEBUG
        -    #   DEAL_II_SHARED_LINKER_FLAGS_RELEASE
        +    #   DEAL_II_LINKER_FLAGS
        +    #   DEAL_II_LINKER_FLAGS_DEBUG
        +    #   DEAL_II_LINKER_FLAGS_RELEASE
             #
             # All modifications shall be guarded with the ENABLE_IF_SUPPORTED
             # or ENABLE_IF_LINKS macro, e.g.
             #
             #   ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-fpic")
        -    #   ENABLE_IF_LINKS(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
        +    #   ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--as-needed")
             #
             # Compiler flags for platform dependent optimization (such as
             # -march=native) must always be guarded with
        @@ -209,20 +206,21 @@
             #   ./cmake/checks/check_01_system_features.cmake
             #   ./cmake/checks/check_02_compiler_bugs.cmake
             #
        -          
        -
      -

      +
      +
    +

    - -

    ./cmake/checks/check_*.cmake

    + +

    ./cmake/checks/check_*.cmake

    -

    - The next step in the configuration process is to include all - checks residing under ./cmake/checks. Currently - there are: -

    +

    + The next step in the configuration process is to include all + checks residing under ./cmake/checks. Currently + there are: +

    +    
         ./cmake/checks/check_01_compiler_features.cmake
           - Search for support for compiler dependent features such as stack
             trace support, demangler support, etc.
    @@ -241,31 +239,34 @@
     
         ./cmake/checks/check_02_compiler_bugs.cmake
           - Check for compiler bugs
    -      
    -
      -
    • - A check usually consists of a call to one of the macros below - that will set up a global variable. Please stick to the naming - convention HAVE_<..>, resp. - DEAL_II_(HAVE|USE)_<..>. It is forbidden to - use a variable name starting with - DEAL_II_WITH_<..> because this prefix is - exclusively reserved for the feature mechanism described - below. For some tests it might be necessary to manipulate global variables. -
    • - A platform check should have a prominent comment explaining what - it does and why it is there, and should state author and year. -
    • - There are a number of readily available platform check macros: -
      +
      +
      + +
        +
      • + A check usually consists of a call to one of the macros below + that will set up a global variable. Please stick to the naming + convention HAVE_<..>, resp. + DEAL_II_(HAVE|USE)_<..>. It is forbidden to + use a variable name starting with + DEAL_II_WITH_<..> because this prefix is + exclusively reserved for the feature mechanism described + below. For some tests it might be necessary to manipulate + global variables. +
      • + A platform check should have a prominent comment explaining what + it does and why it is there, and should state author and year. +
      • + There are a number of readily available platform check macros: + +
         
             CHECK_CXX_SOURCE_COMPILES(source variable)
        -      - Checks whether it is possible to compile _and_ link the code snipet
        -        <source>. If succesful, variable is set to 1.
        +      - Checks whether it is possible to compile _and_ link the code snippet
        +        <source>. If successful, variable is set to 1.
         
             CHECK_CXX_SOURCE_RUNS(source variable)
        -      - variable is set to 1 if <source> coulde be succesfully compiled and
        +      - variable is set to 1 if <source> could be successfully compiled and
                 linked and the resulting program ran and exited without error.
                 Avoid this macro outside of a DEAL_II_ALLOW_PLATFORM_INTROSPECTION
                 guard. A sensible fallback should be provided if the check cannot
        @@ -292,62 +293,67 @@
         
             CHECK_CXX_COMPILER_FLAG(flag variable)
               - Sets the variable to 1 if the compiler understands the flag.
        -	  
        -
      • Necessary compiler flags can easily set in the string variable - CMAKE_REQUIRED_FLAGS. There are two small macros - that do this job nicely: -
        +
        + +
      • Necessary compiler flags can easily set in the string variable + CMAKE_REQUIRED_FLAGS. There are two small macros + that do this job nicely: +
        +  
             PUSH_TEST_FLAG("-Werror")
             CHECK_CXX_SOURCE_COMPILES(...)
             POP_TEST_FLAG()
        -	  
        - -
      • Libraries necessary for linkage can be set in the list variable - CMAKE_REQUIRED_LIBRARIES. It is best two hard set - this variable to a specific value and later on cleaning it, - instead of appending/removing: -
        -
        -    SET(CMAKE_REQUIRED_LIBRARIES <a list of libraries>
        +
        + +
      • Necessary include directories and libraries necessary for + linkage can be set in the list variables + CMAKE_REQUIRED_INCLUDES and + CMAKE_REQUIRED_LIBRARIES. It is best to append these + lists and later on reset CMAKE_REQUIRED_* (including + CMAKE_REQUIRED_FLAGS) to their default values: + +
        +
        +    LIST(APPEND CMAKE_REQUIRED_INCLUDES <a list of includes>)
        +    LIST(APPEND CMAKE_REQUIRED_LIBRARIES <a list of libraries>)
             CHECK_CXX_SOURCE_COMPILES(...)
        -    SET(CMAKE_REQUIRED_LIBRARIES)
        -	  
        -
      -

      - - - - -

      ./cmake/modules/Find*.cmake

      - -

      - These are find modules for the configure_*.cmake files - and the CONFIGURE_FEATURE macro as will explained later. - It is crucial that a find module behaves correctly. Therefore, the - following rules are mandatory: -

        -
      • - The sole purpose of a find module is to find an external - library (no deal.II specific dependency checking, no - compatibility checking). -
      • - It should do so by appropriate FIND_LIBRARY and - FIND_PATH calls. The results of this calls should be the - only cached variables. -
      • - FIND_PACKAGE_HANDLE_STANDARD_ARGS should be used for - setting FEATURE_FOUND as this already respects the - QUIET and REQUIRED keywords. -
      • - A WARNING, SEND_ERROR or - FATAL_ERROR must be avoided (the only exception is - the REQUIRED keyword). -
      • - If successful, the following uncached variables might be set: -
        -
        +    RESET_CMAKE_REQUIRED()
        +
        +
      +

      + + +

      ./cmake/modules/Find*.cmake

      + +

      + These are find modules for the configure_*.cmake files + and the CONFIGURE_FEATURE macro as will explained later. + It is crucial that a find module behaves correctly. Therefore, the + following rules are mandatory: +

        +
      • + The sole purpose of a find module is to find an external + library (no deal.II specific dependency checking, no + compatibility checking). +
      • + It should do so by appropriate FIND_LIBRARY and + FIND_PATH calls. The results of this calls should be the + only cached variables. +
      • + FIND_PACKAGE_HANDLE_STANDARD_ARGS should be used for + setting FEATURE_FOUND as this already respects the + QUIET and REQUIRED keywords. +
      • + A WARNING, SEND_ERROR or + FATAL_ERROR must be avoided (the only exception is + the REQUIRED keyword). +
      • + If successful, the following uncached variables might be set: + +
        +	
             FEATURE_FOUND
             FEATURE_LIBRARIES
             FEATURE_INCLUDE_DIRS
        @@ -357,41 +363,43 @@
             FEATURE_VERSION_MAJOR
             FEATURE_VERSION_MINOR
             FEATURE_VERSION_SUBMINOR
        -          
        - There are obviously valid exceptions from this rule, though. -
      • - Only "local" variables "_<all lowercase>" or - "global" variables prefixed by FEATURE_ may be - altered. Do not set DEAL_II_* or CMAKE_* - variables directly! -
      • - A hint with FEATURE_DIR can be set up for - convenience. It is best to start the Find module by -
        -
        -    SET_IF_EMPTY(FEATURE_DIR "$ENV{FEATURE_DIR}")
        -          
        - and use FEATURE_DIR as a hint. If the external - library could be found, hide it via - MARK_AS_ADVANCED, if the external library could not - be found, set a cache value: -
        -
        -    SET(FEATURE_DIR "" CACHE PATH "An optional hint to a FEATURE directory")
        -          
        -
      +
    +There are obviously valid exceptions from this rule, though. +
  • + Only "local" variables "_<all lowercase>" or + "global" variables prefixed by FEATURE_ may be + altered. Do not set DEAL_II_* or CMAKE_* + variables directly! +
  • + A hint with FEATURE_DIR can be set up for + convenience. It is best to start the Find module by +
     
    -    
    -    

    ./cmake/configure/configure_*.cmake

    + SET_IF_EMPTY(FEATURE_DIR "$ENV{FEATURE_DIR}") +
    + +and use FEATURE_DIR as a hint. If the external +library could be found, hide it via +MARK_AS_ADVANCED, if the external library could not +be found, set a cache value: +
    +  
    +    SET(FEATURE_DIR "" CACHE PATH "An optional hint to a FEATURE directory")
    +
    + -

    - The final step in the configuration phase is the setup of features - (which refer to external or bundled libraries - deal.II can optionally interface with.) -

    + +

    ./cmake/configure/configure_*.cmake

    + +

    + The final step in the configuration phase is the setup of features + (which refer to external or bundled libraries + deal.II can optionally interface with.) + +

    At bare minimum configure_<feature>.cmake @@ -430,7 +438,7 @@ FEATURE_<FEATURE>_DEPENDS (a variable) - a variable which contains an optional list of other features - this feature depends on (and which have to be enbled for this feature + this feature depends on (and which have to be enabled for this feature to work.) The features must be given with the full option toggle: DEAL_II_WITH_[...] @@ -513,9 +521,9 @@

  • For internal use, for setting necessary linker flags for the deal.II library:
      -
    • CMAKE_SHARED_LINKER_FLAGS -
    • DEAL_II_SHARED_LINKER_FLAGS_DEBUG -
    • DEAL_II_SHARED_LINKER_FLAGS_RELEASE +
    • DEAL_II_LINKER_FLAGS +
    • DEAL_II_LINKER_FLAGS_DEBUG +
    • DEAL_II_LINKER_FLAGS_RELEASE
  • @@ -572,7 +580,8 @@

    - + +

    Target definition and installation

    ./include/deal.II/base/config.h.in

    @@ -601,10 +610,21 @@ two macros:
     
    +    #
    +    # Glob for all header files associated with the object target:
    +    # As this list is only for cosmetic reasons, so that associated header
    +    # files show up in IDEs, we don't manage an explicit list (with the
    +    # trade-off to have to run "make rebuild_cache" when a new header file
    +    # emerges...)
    +    #
    +    FILE(GLOB _header
    +      ${CMAKE_SOURCE_DIR}/include/deal.II/dofs/*.h
    +      )
    +
         #
         # A list of source files forming the object target:
         #
    -    SET(src
    +    SET(_src
           ...
           dof_tools.cc
           )
    @@ -612,7 +632,7 @@
         #
         # A list of instantiations that must be expanded:
         #
    -    SET(inst_in_files
    +    SET(_inst
           ...
           dof_tools.inst.in
           )
    @@ -625,7 +645,10 @@
         #   ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_(debug/release)
         # so that it is available in global scope.
         #
    -    DEAL_II_ADD_LIBRARY(obj_dofs OBJECT ${src})
    +    # Header files and instatiation files (${_header}, ${_inst}) are added
    +    # for cosmetic reasons, so that they show up in IDEs.
    +    #
    +    DEAL_II_ADD_LIBRARY(obj_dofs OBJECT ${_src} ${_header} ${_inst})
     
         #
         # This macro will set up an obj_dofs.inst target for expanding all
    @@ -656,11 +679,17 @@
           resides under ./cmake/config/template_arguments.in.
         

    -
    - +
    - The deal.II Group + The deal.II Authors $Date$
    +
    + + Valid HTML 4.01! + + Valid CSS! +
    + diff --git a/deal.II/doc/development/indentation.html b/deal.II/doc/developers/indentation.html similarity index 73% rename from deal.II/doc/development/indentation.html rename to deal.II/doc/developers/indentation.html index 136881c130..1341960ff3 100644 --- a/deal.II/doc/development/indentation.html +++ b/deal.II/doc/developers/indentation.html @@ -38,5 +38,18 @@ !! file style mismatch detected please re-indent the file. SVN may reject those files soon!

    + +
    +
    + The deal.II Authors + $Date$ +
    +
    + + Valid HTML 4.01! + + Valid CSS! +
    + diff --git a/deal.II/doc/development/index.html b/deal.II/doc/developers/index.html similarity index 83% rename from deal.II/doc/development/index.html rename to deal.II/doc/developers/index.html index e883492169..de8bad7977 100644 --- a/deal.II/doc/development/index.html +++ b/deal.II/doc/developers/index.html @@ -14,10 +14,10 @@ - - - - + + + + <h1>deal.II Development Information</h1> diff --git a/deal.II/doc/development/navbar.html b/deal.II/doc/developers/navbar.html similarity index 51% rename from deal.II/doc/development/navbar.html rename to deal.II/doc/developers/navbar.html index 82aa59cfce..cd3738072e 100644 --- a/deal.II/doc/development/navbar.html +++ b/deal.II/doc/developers/navbar.html @@ -14,33 +14,39 @@ <body class="navbar"> <p> - <a href="../index.html" target="_top">Homepage</a><br /> - <a href="toc.html" target="body">Overview</a> + <a href="http://www.dealii.org"target="_top">http://www.dealii.org</a><br /> + <a href="../index.html" target="_top">Home</a><br /> </p> <hr> - <b><small>Writing code</small></b> + <p> + <a href="../readme.html" target="body">README</a><br /> + <a href="../users/index.html" target="_top">Users' Corner</a><br /> + <a href="index.html" target="_top">Developers' Corner</a><br /> + </p> + + <hr> + + <b><small>Development</small></b> <p> - <a href="svn.html" target="body">SVN Archive</a> - <a href="makefiles.html" target="body">Makefiles</a><br /> - <a href="writing-documentation.html" - target="body">Documentation</a><br /> + <a href="svn.html" target="body">SVN Archive</a><br /> + <a href="cmake-internals.html" target="body">CMake internals</a><br /> + <a href="writing-documentation.html" target="body">Writing documentation</a><br /> <a href="porting.html" target="body">Porting</a><br /> <a href="../doxygen/deal.II/CodingConventions.html" target="body">Coding conventions</a><br /> - <a href="doxygen.html" target="body">Linking manuals</a><br /> + <a href="testsuite.html" target="body">Testsuite</a><br /> </p> <hr> - <b><small>Resources</small></b> + <b><small>Online Resources</small></b> <p> <a href="http://www.dealii.org/websvn/log.php?repname=deal.II+Repository&path=%2F&isdir=1&" target="_top">Recent changes</a><br /> - <a href="http://www.dealii.org/mail.html" target="body">Mailing lists</a><br /> - <a href="http://www.dealii.org/testsuite.html" target="body">Test suite</a><br /> - <a href="https://code.google.com/p/dealii/w/list" target="_top">Wiki</a><br /> - <a href="https://code.google.com/p/dealii/issues/list" target="_top">Bug tracker</a><br /> + <a href="http://www.dealii.org/cgi-bin/regression_quick.pl" target="body">Regression tests</a><br /> + <a href="http://www.dealii.org//cgi-bin/build.pl" target="body">Build tests</a><br /> + <a href="http://www.math.tamu.edu/~heister/bench" target="body">Performance tests</a><br /> </p> <hr> diff --git a/deal.II/doc/development/porting.html b/deal.II/doc/developers/porting.html similarity index 90% rename from deal.II/doc/development/porting.html rename to deal.II/doc/developers/porting.html index ee4d340d90..89efdc8665 100644 --- a/deal.II/doc/development/porting.html +++ b/deal.II/doc/developers/porting.html @@ -5,7 +5,7 @@ <title>Porting deal.II</title> <link href="../screen.css" rel="StyleSheet" media="screen"> <meta name="author" content="the deal.II authors <authors@dealii.org>"> - <meta name="copyright" content="Copyright (C) 2000, 2001, 2002, 2005, 2010, 2012 by the deal.II authors"> + <meta name="copyright" content="Copyright (C) 2000, 2001, 2002, 2005, 2010, 2012, 2013 by the deal.II authors"> <meta name="date" content="$Date$"> <meta name="svn_id" content="$Id$"> <meta name="keywords" content="deal.II porting"> @@ -23,7 +23,7 @@ Consequently, there is a good chance that <acronym>deal.II</acronym> will run on a reasonably well behaved system besides the ones listed - in the <a href="readme.html" target="body">ReadMe</a>. Nevertheless, + in the <a href="../readme.html" target="body">ReadMe</a>. Nevertheless, there are cases where some adjustments are necessary. </p> @@ -156,10 +156,17 @@ href="cmake.html">the documentation</a>. </p> - <hr> + <hr /> <address> - <a href="../mail.html" target="body">The deal.II Group</a> + <a href="../authors.html" target="body">The deal.II Authors</a> + $Date$ </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> </body> </html> diff --git a/deal.II/doc/development/svn.html b/deal.II/doc/developers/svn.html similarity index 86% rename from deal.II/doc/development/svn.html rename to deal.II/doc/developers/svn.html index 307e0eb798..40f50d86b8 100644 --- a/deal.II/doc/development/svn.html +++ b/deal.II/doc/developers/svn.html @@ -84,5 +84,18 @@ resolved, you can simply commit the result. </ol> </p> + + <hr /> + <address> + <a href="../authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> + </body> </html> diff --git a/deal.II/doc/development/testsuite.html b/deal.II/doc/developers/testsuite.html similarity index 93% rename from deal.II/doc/development/testsuite.html rename to deal.II/doc/developers/testsuite.html index 27b34d04ab..54229442f2 100644 --- a/deal.II/doc/development/testsuite.html +++ b/deal.II/doc/developers/testsuite.html @@ -69,7 +69,7 @@ RUN_EXAMPLES - defaults to "true" </pre> An example configuration file can be found <a - href="Config.sample">here</a>. Options can be passed either via + href="../users/Config.sample">here</a>. Options can be passed either via environment <pre> @@ -99,8 +99,8 @@ <h2>The regression tests</h2> <p> - deal.II has a testsuite that, at the time this article is written (mid-2011), - has some 2300 small programs (growing by roughly one per day) that we run + deal.II has a testsuite that, at the time this article is written (mid-2013), + has some 2,900 small programs (growing by roughly one per day) that we run every time we make a change to make sure that no existing functionality is broken. The expected output is also stored in our subversion archive, and when you @@ -110,7 +110,7 @@ in both cases to make sure that future changes do not break what we have just checked in. In addition, some machines run the tests every night and send the results back home; this is then converted - into <a href="http://www.dealii.org/cgi-bin/regression_quick.pl" + into <a href="http://dealii.mathsim.eu/cgi-bin/regression_quick.pl" target="body">a webpage showing the status of our regression tests</a>. </p> @@ -360,17 +360,21 @@ For the testcase, we usually start from a template like this: <pre> -//---------------------------- my_new_test.cc --------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- my_new_test.cc --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- // a short (a few lines) description of what the program does @@ -590,16 +594,17 @@ testname/cmp/generic contribute! </p> - + <hr /> <address> - <a href="../mail.html">The deal.II Group</a></address> -<div class="right"> - <p> - <a href="http://validator.w3.org/check?uri=referer"><img border="0" - src="http://www.w3.org/Icons/valid-html401" - alt="Valid HTML 4.01!" height="31" width="88"></a> - </p> -</div> + <a href="../authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> </body> </html> diff --git a/deal.II/doc/development/title.html b/deal.II/doc/developers/title.html similarity index 94% rename from deal.II/doc/development/title.html rename to deal.II/doc/developers/title.html index c935915100..c681f83537 100644 --- a/deal.II/doc/development/title.html +++ b/deal.II/doc/developers/title.html @@ -16,7 +16,7 @@ <body class="title"> <div class="fixedhead"> <h1 class="head"> - Development with <acronym>deal.II</acronym> + Developers' Corner </h1> </div> </body> diff --git a/deal.II/doc/development/toc.html b/deal.II/doc/developers/toc.html similarity index 60% rename from deal.II/doc/development/toc.html rename to deal.II/doc/developers/toc.html index a213bd675b..1f45fbe1f1 100644 --- a/deal.II/doc/development/toc.html +++ b/deal.II/doc/developers/toc.html @@ -14,41 +14,18 @@ </head> <body> - <h1>Information on development with <acronym>deal.II</acronym></h1> - <p> - Apart from the online API references (the "manual") and the tutorial, - which are covered elsewhere, this page gathers some information on - developing programs based on - <acronym>deal.II</acronym>, as well as on how to contribute - to the development of <acronym>deal.II</acronym> itself. In the - latter case, we encourage you to use the current development version - instead of a pre-packaged version of <acronym>deal.II</acronym>, as - described on our <a - href="http://www.dealii.org/download/">download page</a>. + <br /> + This page provides documentation for deal.II developers. At present, we + have the following resources available: </p> - <p> - At present, we have the following resources available: - </p> + <h2>Documentation</h2> <ul> <li> <p> Documentation of the <a href="svn.html">SVN Archive</a> and information on <a href="http://www.dealii.org/websvn/log.php?repname=deal.II+Repository&path=%2F&isdir=1&" target="_top">recent changes to the library</a>. - <li> <p> - <a href="cmake.html">deal.II CMake documentation</a>: - This page provides extensive information about configuration and - installation with the CMake build system. - - <li> <p><a href="cmakelists.html" target="body">Using - <acronym>deal.II</acronym> in a user project</a>: - This page covers how to use CMake in your own project. - An overview of how to retrieve necessary information - from a <acronym>deal.II</acronym> installation as well as how to - write a <code>CMakeLists.txt</code> for a client project is given. - </p> - <li> <p> <a href="cmake-internals.html">Build system internals</a>: This page provides implementation and development details about @@ -77,33 +54,22 @@ resource gives some hints for porting to unknown platforms. </p> - <li> <p><a href="https://code.google.com/p/dealii/issues/list" target="_top">Bugs</a>: - Though well tested, <acronym>deal.II</acronym> certainly has - bugs. If you want to report a bug (or enhancement request), - go to the <a href="https://code.google.com/p/dealii/issues/list" - target="_top">bug tracking system</a> and enter a new ticket - for your issue. - </p> - - <li> <p><a href="doxygen.html">Linking your online documentation - to the deal.II online manual</a>: After spending a lot of time - writing good documentation for your code and putting it online, - here we explain how to put links to the deal.II online manual into - your documentation, so that readers can click through. - </p> + <li> <p><a href="../doxygen/deal.II/CodingConventions.html" + target="body">Coding conventions</a>: We try to adhere to a + set of coding conventions to ensure that the use of different + parts of the library is as uniform as possible. Please read + through them if you think about contributing code. <li> <p><a href="testsuite.html" target="body">Running the testsuite</a>: <acronym>deal.II</acronym> has a testsuite that we run to make sure that our tests don't break any existing functionality. This page explains its use. </p> + </ul> - <li> <p><a href="../doxygen/deal.II/CodingConventions.html" - target="body">Coding conventions</a>: We try to adhere to a - set of coding conventions to ensure that the use of different - parts of the library is as uniform as possible. Please read - through them if you think about contributing code. + <h2>Resources</h2> + <ul> <li> <p><a href="http://www.dealii.org/cgi-bin/regression_quick.pl" target="body">Results of regression tests:</a> Every night, @@ -123,17 +89,17 @@ </p> </ul> - <hr> - + <hr /> <address> - <a href="../mail.html">The deal.II Group</a></address> -<div class="right"> - <p> - <a href="http://validator.w3.org/check?uri=referer"><img border="0" - src="http://www.w3.org/Icons/valid-html401" - alt="Valid HTML 4.01!" height="31" width="88"></a> - </p> -</div> + <a href="../authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> </body> </html> diff --git a/deal.II/doc/development/writing-documentation.html b/deal.II/doc/developers/writing-documentation.html similarity index 96% rename from deal.II/doc/development/writing-documentation.html rename to deal.II/doc/developers/writing-documentation.html index 4ab4d3e318..ab4913a3c3 100644 --- a/deal.II/doc/development/writing-documentation.html +++ b/deal.II/doc/developers/writing-documentation.html @@ -179,9 +179,9 @@ <li> <em>Typewriter font:</em> <p>In order to use typewriter font for instance for function - arguments or variables, use the <code>&lt;tt&gt;</code> HTML + arguments or variables, use the <code>&lt;code&gt;</code> HTML tag. For a single word, you can also use the form <code>@p - one_word_without_spaces</code>.</p> + one_word_without_spaces</code>. The <code>&lt;tt&gt;</code> is obsolete in HTML5</p> <p> If you refer to member variables and member functions @@ -455,17 +455,17 @@ </p> - <hr> - + <hr /> <address> - <a href="../mail.html">The deal.II Group</a></address> -<div class="right"> - <p> - <a href="http://validator.w3.org/check?uri=referer"><img border="0" - src="http://www.w3.org/Icons/valid-html401" - alt="Valid HTML 4.01!" height="31" width="88"></a> - </p> -</div> + <a href="../authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> </body> </html> diff --git a/deal.II/doc/development/CMakeLists.txt.sample b/deal.II/doc/development/CMakeLists.txt.sample deleted file mode 100644 index 549cf0d0bb..0000000000 --- a/deal.II/doc/development/CMakeLists.txt.sample +++ /dev/null @@ -1,61 +0,0 @@ -## ## -# A simple CMakeLists.txt file for use with deal.II # -## ## - -# -# Set the name of the project and target: -# -SET(TARGET "step-1") - -# -# Declare all source files the target consists of: -# -SET(TARGET_SRC - ${TARGET}.cc - # You can specify additional files here! - ) - -# -# (Optional) -# Specify a list of files (file globs) that will be removed -# with the "make runclean" and "make distclean" targets. -# If empty, sensible default values will be used. -# -SET(CLEAN_UP_FILES - # a custom list of globs, e.g. *.log *.vtk - ) - -# -# (Optional) -# A custom command line that should be invoked by "make run". If empty, -# ./${TARGET} will be invoked. -# -SET(TARGET_RUN - # a custom command line, e.g. mpirun -np 2 ${TARGET} - ) - -# -# It is good practice to specify a version requirement: -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) - -# -# Find and import the deal.II project configuration: -# -FIND_PACKAGE(deal.II 8.0 REQUIRED - HINTS - ${DEAL_II_DIRS} ../ ../../ $ENV{DEAL_II_DIR} - # - # If the deal.II library cannot be found (because it is not installed at a - # default location or your project resides at an uncommon place), you - # can specify additional hints for search paths here, e.g. - # "$ENV{HOME}/workspace/deal.II" - # - ) - -# -# And let deal.II do the rest: -# -DEAL_II_INITIALIZE_CACHED_VARIABLES() -PROJECT(${TARGET}) -DEAL_II_INVOKE_AUTOPILOT() diff --git a/deal.II/doc/development/cmakelists.html b/deal.II/doc/development/cmakelists.html deleted file mode 100644 index 5ebc8bc15f..0000000000 --- a/deal.II/doc/development/cmakelists.html +++ /dev/null @@ -1,515 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html> - <head> - <title>How to interface with deal.II in your own project</title> - <link href="../screen.css" rel="StyleSheet"> - <meta name="author" content="the deal.II authors <authors @ dealii.org>"> - <meta name="copyright" content="Copyright (C) 2012, 2013 by the deal.II authors"> - <meta name="date" content="$Date$"> - <meta name="svn_id" content="$Id$"> - <meta name="keywords" content="deal.II"> - </head> - - <body> - - <h1>How to interface with <acronym>deal.II</acronym> in your own - project</h1> - - <p> - <table class="tutorial" width="50%"> - <tr><th colspan="2"><b><small>Table of contents</small></b></th></tr> - <tr><td valign="top"> - <ul> - <li><a href="#cmake">Example <code>CMakeLists.txt</code> files</a> - <ul> - <li><a href="#cmakesimple">Simple <code>CMakeLists.txt</code></a> - <li><a href="#cmakeadvanced">Advanced <code>CMakeLists.txt</code></a> - </ul> - <li><a href="#ext">Advanced setup for <acronym>deal.II</acronym> in a CMake project</a> - <ul> - <li><a href="#extfinding">Finding the deal.II library</a> - <li><a href="#extcmake">deal.IIConfig.cmake</a> - <li><a href="#extsetup">Setting up necessary configuration variables</a> - </ul> - <li><a href="#legacy">Legacy - <code>Make.global_options</code></a> - </ul> - </td> - </tr> - </table> - </p> - - - <a name="cmake"></a> - <h3> Example <code>CMakeLists.txt</code> files </h3> - - <p> - <code>cmake</code> is the configuration and build tool we use - in <acronym>deal.II</acronym>. Its advantage is not only that it makes - configuration of <acronym>deal.II</acronym> itself simpler across - platforms (compared to the older <code>autoconf/make</code> combination) - but also that it <i>exports</i> information about the deal.II - configuration that makes it particularly simple for projects - using <acronym>deal.II</acronym> to configure and link against it. - </p> - - <p> - <code>cmake</code> is controlled by input files that by convention are - called <code>CMakeLists.txt</code>, listing both configuration commands - as well as dependencies between source files and targets. - This page presents some <code>CMakeLists.txt</code> examples for - potential use in your projects. A detailed description of the - <acronym>deal.II</acronym> project configuration is given in the - <a href="cmake.html" target="body">deal.II CMake ReadMe</a>. - </p> - - <a name="cmakesimple"></a> - <h4>Simple CMakeLists.txt</h4> - - <p> - The easiest way to write a <code>CMakeLists.txt</code> file is to use - an "autopilot" style macro. Here is an example for the step-1 - tutorial program (<a href="CMakeLists.txt.sample" - target="_top">plain text</a> version) that can be used for simple - projects: - <pre> - - # - # Set the name of the project and target: - # - SET(TARGET "step-1") - - # - # Declare all source files the target consists of: - # - SET(TARGET_SRC - ${TARGET}.cc - # You can specify additional files here! - ) - - # - # (Optional) - # Specify a list of files (file globs) that will be removed - # with the "make runclean" and "make distclean" targets. - # If empty, sensible default values will be used. - # - SET(CLEAN_UP_FILES - # a custom list of globs, e.g. *.log *.vtk - ) - - # - # (Optional) - # A custom command line that should be invoked by "make run". If empty, - # ./${TARGET} will be invoked. - # - SET(TARGET_RUN - # a custom command line, e.g. mpirun -np 2 ${TARGET} - ) - - # - # It is good practice to specify a version requirement: - # - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) - - # - # Find and import the deal.II project configuration: - # - FIND_PACKAGE(deal.II 8.0 REQUIRED - HINTS - ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} - # - # If the deal.II library cannot be found (because it is not installed at a - # default location or your project resides at an uncommon place), you - # can specify additional hints for search paths here, e.g. - # "$ENV{HOME}/workspace/deal.II" - # - ) - - # - # And let deal.II do the rest: - # - DEAL_II_INITIALIZE_CACHED_VARIABLES() - PROJECT(${TARGET}) - DEAL_II_INVOKE_AUTOPILOT() - </pre> - - This <code>CMakeLists.txt</code> is intended for use with a small - project and <i>in-source</i> build (i.e., one does not create a separate - build directory as we recommend for the <acronym>deal.II</acronym> build - in the <a href="../readme.html#configuration" target="_body">readme - file</a>). Using this input file, you can run <code>cmake</code> in the - source directory as follows: - <pre> - - $ cd step-1 - $ cmake . - - [...] - - ### - # - # Successfully set up project step-1 with deal.II-8.0.pre found at - # /usr/local - # - # CMAKE_BUILD_TYPE: Debug - # TARGET_SRC: step-1.cc - # - # You can now run - # $ make - to compile and link the program - # $ make run - to (compile, link and) run the program - # - # $ make debug - to switch the build type to "Debug" - # $ make release - to switch the build type to "Release" - # $ make edit_cache - to change (cached) configuration variables - # and rerun the configure and generate phases of CMake - # - # $ make clean - to remove the generated executable as well as - # all intermediate compilation files - # $ make runclean - to remove all output generated by the program - # $ make distclean - to clean the directory from _all_ generated - # files (includes clean, runclean and the removal - # of the generated build system) - # - # Have a nice day! - # - ### - </pre> - </p> - - <a name="cmakeadvanced"></a> - <h4>Advanced CMakeLists.txt</h4> - - <p> - For large projects the simple <code>CMakeLists.txt</code> presented - above tends to be too inflexible. - So, if you wish to have more control about targets the - <code>DEAL_II_SETUP_TARGET</code> macro might be of interest for you. - Here is a full example, again using the step-1 tutorial program as a - template: - <pre> - - # - # It is good practise to specify a version requirement: - # - CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) - - # - # Find and import the deal.II project configuration: - # - FIND_PACKAGE(deal.II 8.0 REQUIRED - HINTS - ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} - # - # If the deal.II library cannot be found (because it is not installed at a - # default location or your project resides at an uncommon place), you - # can specify additional hints for search paths here, e.g. - # "$ENV{HOME}/workspace/deal.II" - # - ) - - # - # Initialize cached variables: This will set the compiler and - # compiler flags to the values deal.II was configured with, as well as, - # CMAKE_BUILD_TYPE to "Debug". - # These values can be altered by editing the cache via - # $ make edit_cache - # - DEAL_II_INITIALIZE_CACHED_VARIABLES() - - # - # PROJECT has to be called after DEAL_II_INITIALIZE_CACHED_VARIABLES - # otherwise CMake will have already set the compiler and compiler - # flags. - # - PROJECT(step-1) - - # - # Specify a target: - # - ADD_EXECUTABLE(step-1 step-1.cc) - - # - # DEAL_II_SETUP_TARGET will set up all necessary include paths, - # preprocessor definitions and the link interface: - # - DEAL_II_SETUP_TARGET(step-1) - - # - # (Optional) - # If you wish to have a "run" target for make, specify one: - # - ADD_CUSTOM_TARGET(run - COMMAND step-1 - COMMENT "Run ${TARGET} with ${CMAKE_BUILD_TYPE} configuration" - ) - </pre> - </p> - - - <a name="ext"></a> - <h3> Advanced setup for <acronym>deal.II</acronym> in a CMake project </h3> - - <a name="extfinding"></a> - <h4> Finding the deal.II library </h4> - - <p> - Finding the <acronym>deal.II</acronym> library should be no more than - <pre> - - FIND_PACKAGE(deal.II REQUIRED) - </pre> - in your CMakeLists.txt file. You may have to hint for the location - of the <code>deal.IIConfig.cmake</code> file. Either by directly - specifying <code>deal.II_DIR</code> to point to the path were the - <code>deal.IIConfig.cmake</code> file is located: - <pre> - - cmake -Ddeal.II_DIR=/path/to/the/config/file &lt;...&gt; - </pre> - or by specifying a search path via <code>CMAKE_PREFIX_PATH</code>, - e.g. - <pre> - - cmake -DCMAKE_PREFIX_PATH=~/workspace/local - </pre> - In this case <code>deal.IIConfig.cmake</code> will be searched - for in - <pre> - - ~/workspace/local/ - ~/workspace/local/lib/cmake/deal.II/ - </pre> - </p> - - - <a name="extcmake"></a> - <h4> deal.IIConfig.cmake </h4> - - <p> - Importing the deal.IIConfig.cmake file via <code>FIND_PACKAGE</code> - will set a bunch of variables and macros; all of the form - <code>DEAL_II_*</code>. There is the usual duplet: - <pre> - - DEAL_II_INCLUDE_DIRS - DEAL_II_LIBRARIES - </pre> - (with <code>debug</code> and <code>optimized</code> keywords. For - compatibility there is also <code>DEAL_II_LIBRARIES_DEBUG</code> - and <code>DEAL_II_LIBRARIES_RELEASE</code> only specifying the - respective set of libraries.) - </p> - - <p> - Interesting additional variables might be: - <pre> - - DEAL_II_USER_DEFINITIONS - DEAL_II_USER_DEFINITIONS_DEBUG - DEAL_II_USER_DEFINITIONS_RELEASE - DEAL_II_LINKER_FLAGS - DEAL_II_LINKER_FLAGS_DEBUG - DEAL_II_LINKER_FLAGS_RELEASE - DEAL_II_CXX_FLAGS - DEAL_II_CXX_FLAGS_DEBUG - DEAL_II_CXX_FLAGS_RELEASE - - DEAL_II_TARGET_CONFIG - DEAL_II_TARGET - DEAL_II_TARGET_DEBUG - DEAL_II_TARGET_RELEASE - </pre> - </p> - - - - <a name="extsetup"></a> - <h4> Setting up necessary configuration variables </h4> - - <p> - For actually using <acronym>deal.II</acronym> in your CMake - project some configuration steps are necessary. These can be - either set via <a href="#extsetupmacro">macros</a> or by <a - href="#extsetuphand">hand</a>: - <ol> - <a name="extsetupmacro"></a><li> <b>Configuration with the help of - two convencience macros:</b> - <p> - <code>deal.IIConfig.cmake</code> includes some convenience macros - to automatically setup all necessary configuration. A fully - functional, minimal example for the step-1 tutorial program is: - <pre> - - FIND_PACKAGE(deal.II REQUIRED) - - DEAL_II_INITIALIZE_CACHED_VARIABLES() - - PROJECT(step-1) - - ADD_EXECUTABLE(step-1 step-1.cc) - DEAL_II_SETUP_TARGET(step-1) - </pre> - </p> - - - <a name="extsetuphand"></a><li> <b>Configuration by hand:</b> - <ul> - <li> Set up all include directories for header files: - <pre> - - INCLUDE_DIRECTORIES(${DEAL_II_INCLUDE_DIRS}) - </pre> - - <li> - deal.II usually ships with an optimized Release and a Debug version - of the library. So it is a good idea to set up - <code>CMAKE_BUILD_TYPE</code> accordingly: - <pre> - - SET(CMAKE_BUILD_TYPE "Debug" CACHE - "Choose the type of build, options are: Debug, Release" - ) - </pre> - - A cached variable ensures that we can later switch the build type - by editing the cache: - <pre> - - make edit_cache - </pre> - - <li> Often, it is a good idea to use the same compiler and linker - flags as the deal.II library. - <pre> - - SET(CMAKE_CXX_FLAGS ${DEAL_II_CXX_FLAGS}) - SET(CMAKE_CXX_FLAGS_RELEASE ${DEAL_II_CXX_FLAGS_RELEASE}) - SET(CMAKE_CXX_FLAGS_DEBUG ${DEAL_II_CXX_FLAGS_DEBUG}) - </pre> - (Optionally you can set up the variables with the - <code>CACHE</code> to be able to edit them via ccmake or - make edit_cache.) - - <li> - <i>After</i> this, specify your project name: - <pre> - - PROJECT(myProject) - </pre> - This ensures that the compiler detection and platform setup - that is issued by calling <code>PROJECT(...)</code> will run - after we have set up our cached variables. This way it is - our choice of variables that will be set and not the default - values determined by the <code>PROJECT(...)</code> call. - - <li> - After defining your targets, e.g. - <pre> - - ADD_EXECUTABLE(step-1 step-1.cc) - </pre> - you have to specify to link against deal.II and all external - libraries: - <pre> - - TARGET_LINK_LIBRARIES(step-1 ${DEAL_II_LIBRARIES}) - </pre> - - <li> as well as using some preprocessor definitions: - <pre> - - SET_TARGET_PROPERTIES(step-1 PROPERTIES - COMPILE_DEFINITIONS - "${DEAL_II_USER_DEFINITIONS}" - COMPILE_DEFINITIONS_DEBUG - "${DEAL_II_USER_DEFINITIONS_DEBUG}" - COMPILE_DEFINITIONS_RELEASE - "${DEAL_II_USER_DEFINITIONS_RELEASE}" - ) - </pre> - - <li> Optionally, you can set the link flags to the one used by the - deal.II library: - <pre> - - SET_TARGET_PROPERTIES(step-1 PROPERTIES - LINK_FLAGS - "${DEAL_II_LINKER_FLAGS}" - LINK_FLAGS_DEBUG - "${DEAL_II_LINKER_FLAGS_DEBUG}" - LINK_FLAGS_RELEASE - "${DEAL_II_LINKER_FLAGS_RELEASE}" - ) - </pre> - And this it is. - - </ul> - - <li> - <b>Exported targets:</b> - - <p> - For an advanced setup in a big CMake project - <code><a href="#extcmake">deal.IIConfig.cmake</a></code> - provides information about the <acronym>deal.II</acronym> - installation with traditional variables, see - <a href="#extcmake">here</a>, as well as <i>external CMake - targets</i> with link interface for direct inclusion: - <pre> - - INCLUDE(${DEAL_II_TARGET_CONFIG}) - - ADD_EXECUTABLE(step-1 - step-1.cc - ${DEAL_II_TARGET} - ) - </pre> - </p> - </ol> - </p> - - - - <a name="legacy"></a> - <h3> Legacy Make.global_options </h3> - - <p> - Before version 8.0, <acronym>deal.II</acronym> used the - traditional <code>autoconf/make</code> configuration and build - system. The interaction between these two programs, as well as - propagation of information from <acronym>deal.II</acronym> to user - programs happened through a number of files that were generated within - the <acronym>deal.II</acronym> directory tree. - The CMake build system sets up the following compatibility files (if - <code>DEAL_II_COMPONENT_COMPAT_FILES</code> is set, which is default): - <pre> - - ${CMAKE_INSTALL_PREFIX} - ./common/Make.global_options - ./common/scripts/expand_instantiations - ./common/scripts/make_dependencies - ./common/scripts/report_features - </pre> - - Therefore, it should be sufficient to set <code>D</code> in the old - user Makefiles to: - <pre> - - D=/path/install/dir - </pre> - where <code>/path/install/dir</code> is the directory set up via - <code>CMAKE_INSTALL_PREFIX</code> (the path - <acronym>deal.II</acronym> was installed to). - </p> - - - - <hr> - - <address> - <a href="mail.html" target="body">The deal.II Group</a> - $Date$ - </address> - </body> -</html> diff --git a/deal.II/doc/documentation.html b/deal.II/doc/documentation.html index cc3d35bffb..ddae33da74 100644 --- a/deal.II/doc/documentation.html +++ b/deal.II/doc/documentation.html @@ -2,225 +2,100 @@ "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> - <link href="screen.css" rel="StyleSheet" type="text/css"> <title>The deal.II Online Documentation</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > + <link href="screen.css" rel="StyleSheet" type="text/css"> <meta name="author" content="the deal.II authors <authors@dealii.org>"> - <meta name="copyright" content="Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors"> + <meta name="copyright" content="Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors"> <meta name="date" content="2006/02/07 22:49:01"> <meta name="keywords" content="deal.II"> <meta name="svn_id" content="$Id$"> </head> - <body> - - <h2>Online documentation</h2> - - <p> - <acronym>deal.II</acronym> comes with quite extensive online - documentation, which falls into several categories. They are - listed below. - </p> - - - <h3><a href="readme.html">README</a></h3> - - <p> - First, there is the <a href="readme.html" target="body">README file</a> of - the library. It gives information on system requirements, - installation, and copyright. - </p> - - <h3>Tutorials</h3> - - <p> - The <a href="doxygen/tutorial/index.html" - target="_top">tutorial</a> is - for new users of the library. It explains the basic elements of - finite element programs based on the library, and provides small - example programs. You can also reach the tutorial link from the menu bar - at the left. - </p> - - <p> - Note that along with the rest of the documentation, the local HTML pages - of the tutorials need to be generated first. Please follow the - instructions in the - <a href="readme.html" target="body">ReadMe file</a> on how to do - this. - </p> - - - <h3>Programming interface</h3> - - <p> - The <a href="doxygen/deal.II/index.html" target="_top">programming - interface/manual</a> pages are what you will need most often as a - reference of all classes, functions and variables in the library. They - are extensively documented (presently more than 5000 pages if - printed), and generated by <a href="http://www.doxygen.org/" - target="_top">Doxygen</a>. There is also a quick link to these pages from - the menu bar at the left. - </p> - - <p> - The documentation uses many of the features of Doxygen. In particular, - the link takes you straight to a page that lists <i>modules</i>, a way - to group classes with similar purposes. This may be what you are probably - interested in when you are not yet familiar with the library. If you - already know your way around and want to look up the signature of a - particular member function, for example, you may go to the class view or - choose any of the other ways in which Doxygen allows you to navigate - through the documentation. - </p> - - <p> - Just as for the tutorials, the API docs need to be generated first, - if you download <acronym>deal.II</acronym>. Please follow the - instructions in the - <a href="readme.html" target="body">ReadMe file</a> on how to do - this. - </p> - - - <h3>Development information</h3> - - <p> - If you plan to <a href="development/index.html" - target="_top">develop your own applications</a> using - <acronym>deal.II</acronym>, it might be worth to take a look - at <a href="development/index.html" target="_top">this - page</a>. - </p> - - - <h3>Reports</h3> - - <p> - There are a number of papers that describe the overall design or - individual aspects of <acronym>deal.II</acronym>. Please refer to the - papers listed at the top of the <a href="publications/index.html" - target="body">publications page</a> for full references. In addition, - there are the following reports: - <ul> - <li> <p> - A publication on the - <a href="reports/dimension-independent/index.html" - target="body">basics of dimension independent - programming</a> in <acronym>deal.II</acronym> (by Wolfgang - Bangerth). This explains some of the fundamentals of the - library's design, though rather briefly due to the page - limit imposed for the publication. - </p> - - <p> - This publication appeared in - the proceedings of the 16th IMACS World Congress, - Lausanne, Switzerland, 2000. See the - <a href="publications/index.html" target="body">publications</a> - page for the full reference as well as a way to obtain a - reprint of the original paper as a postscript or PDF file. - </p> - - <li> <p> - A brief report about the classes involved in the - <a href="reports/class-hierarchies/index.html" - target="body">iterators and accessors</a> - used to access cells in the triangulations and the data - thereon, such as their geometry, the number of the - degrees of freedom, data values, etc. You may want to - read this object or parts of it if you want to know what - information is available from iterators (by Wolfgang - Bangerth). - </p> - - <li> <p> - A brief report on <a href="reports/mapping_q/index.html" - target="body">mapping</a> functions of higher polynomial - degrees (by Ralf Hartmann). These allow the realisation - of higher order boundary approximations. This report - gives the theoretical background of the - <code>MappingQ</code> class. - </p> - - <li> <p> - A report on - <a href="reports/assemble/assemble.pdf" - target="body">assembling matrices</a> (by Wolfgang - Bangerth). This report looks in particular at how - matrices are assembled for vector-valued problems, and - how things change if vector-valued finite elements are - used for which the shape functions have more than one - non-zero vector component, such as Nedelec or - Raviart-Thomas elements. There are printable - versions of the report - <a href="reports/assemble/assemble.ps" - target="body">in postscript</a> and - <a href="reports/assemble/assemble.pdf" - target="body">PDF format</a>. - </p> - - <li> <p> - A very detailed report on - <a href="reports/nedelec/nedelec.pdf" - target="body">Nedelec elements</a> (by Anna - Schneebeli, University of Basel, Switzerland). It - explains the construction and application of Nedelec - edge elements for H-curl spaces, as used, for example, - in the numerical solution of the Maxwell equations. It - also gives numerical results obtained with deal.II. - There is also a <a href="reports/nedelec/nedelec.ps" - target="body">postscript version of the report</a>. - </p> - - <li> <p> - A report on the - <a href="reports/codimension-one/desimone-heltai-manigrasso.pdf" - target="body">codimension one</a> capabilities - of the library (by Antonio DeSimone, Luca Heltai - and Cataldo Manigrasso, SISSA, Trieste, Italy). It - explains in detail how to use the - library for the solution of problems defined on codimension - one manifolds, such as, for example, Boundary Element Methods. - </ul> - - - <h3>Publications</h3> - - <p> - A <a href="publications/index.html" target="body">list of - publications</a> about and based on - <acronym>deal.II</acronym> can be found on - <a href="publications/index.html" target="body">this</a> page. - </p> - - - <h3>Copyright and License</h3> - - <p> <acronym>deal.II</acronym> is copyright of the - <a href="authors.html" target="body">deal.II authors</a>. - It is a joint effort of the current maintainers, Wolfgang - Bangerth, Timo Heister, Guido Kanschat, and quite a number of - contributors. <acronym>deal.II</acronym> is distributed under an - <a href="http://www.opensource.org" target="_top">OpenSource</a> - license. The full text of the license can be found in - <a href="license.html"><tt>license.html</tt></a>. - </p> - - <h3>Contact</h3> - - <p>We have a <a href="mail.html">discussion group</a> for discussion - of issues of general interest to users and developers of - <acronym>deal.II</acronym>.</p> - - <p>More specific questions may be sent to the authors - immediately at the address <tt>firstName.lastname</tt><i> at - </i> <tt>dealii.org</tt>.</p> - - <div class="right"> - <p> - <a href="http://validator.w3.org/check?uri=referer"><img border="0" - src="http://www.w3.org/Icons/valid-html401" - alt="Valid HTML 4.01!" height="31" width="88"></a> - </p> - </div> - </body> +<body> + +<p> + <br /> + <acronym>deal.II</acronym> comes with quite extensive online + documentation, which falls into several categories. They are + listed below. +</p> + +<h2><a href="readme.html">ReadMe</a></h2> + +<p> + First, there is the <a href="readme.html" target="body">README</a> of + the library. It gives information on system requirements, + installation, and copyright. +</p> + + +<h2><a href="users/index.html" TARGET="_top">Users' Corner</a></h2> + +<p> + The <a href="users/index.html" TARGET="_top">Users' Corner</a> provides information about + configuration and usage of the library. +</p> + +<div class="quick"> + <ol> + <li><a href="users/cmake.html" target="body">CMake documentation</a></li> + <li><a href="users/cmakelists.html" target="body">CMake in user projects</a></li> + <li><a href="doxygen/tutorial/index.html" target="_top">Tutorial</a></li> + <li><a href="doxygen/deal.II/index.html" target="_top">Manual</a></li> + </ol> +</div> + + +<h2><a href="developers/index.html" TARGET="_top">Developers' Corner</a></h2> + +<p> + The <a href="developers/index.html" TARGET="_top">Developers' Corner</a> covers + topics for advanced users and developers. +</p> + +<div class="quick"> + <ol> + <li><a href="developers/svn.html" target="body">SVN Archive</a></li> + <li><a href="developers/cmake-internals.html" target="body">CMake internals</a></li> + <li><a href="developers/writing-documentation.html" target="body">Writing documentation</a></li> + <li><a href="developers/porting.html" target="body">Porting</a></li> + <li><a href="doxygen/deal.II/CodingConventions.html" target="body">Coding conventions</a></li> + <li><a href="developers/testsuite.html" target="body">Testsuite</a></li> + </ol> +</div> + + + +<h2><a href="reports/index.html" target="body">Reports</a></h2> + +<p> + There are a number of papers that describe the overall design or + individual aspects of <acronym>deal.II</acronym>. Please refer to the + papers listed at the top of the <a href="publications/index.html" + target="body">publications page</a> for full references. In addition, + <a href="reports/index.html" target="body">there are technical + reports</a>. + +<h2><a href="publications/index.html" target="body">Publications</a></h2> + +<p> + A <a href="publications/index.html" target="body">list of + publications</a> about and based on + <acronym>deal.II</acronym> can be found on + <a href="publications/index.html" target="body">this</a> page. +</p> + + <hr /> + <address> + <a href="authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> + +</body> </html> diff --git a/deal.II/doc/doxygen/CMakeLists.txt b/deal.II/doc/doxygen/CMakeLists.txt index fcbda0eb42..b7e726df44 100644 --- a/deal.II/doc/doxygen/CMakeLists.txt +++ b/deal.II/doc/doxygen/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## <TODO: Full License information> -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de> -## -##### +## --------------------------------------------------------------------- # # A glob. I'm sorry @@ -101,7 +103,7 @@ ADD_CUSTOM_COMMAND( images ${CMAKE_CURRENT_BINARY_DIR}/options.dox ${_doxygen_input} - COMMENT "Generating documentation via doxygen (This may take a _really_ long time)" + COMMENT "Generating documentation via doxygen. This may take a _really_ long time..." VERBATIM ) ADD_CUSTOM_TARGET(doxygen ALL diff --git a/deal.II/doc/doxygen/header.html.in b/deal.II/doc/doxygen/header.html.in index d09d6eb7b4..e848e926ea 100644 --- a/deal.II/doc/doxygen/header.html.in +++ b/deal.II/doc/doxygen/header.html.in @@ -12,9 +12,9 @@ <script type="text/javascript" src="$relpath$jquery.js"></script> <script type="text/javascript" src="$relpath$dynsections.js"></script> - <link rel="SHORTCUT ICON" href="http://www.dealii.org/deal.ico"> + <link rel="SHORTCUT ICON" href="http://www.dealii.org/favicon.ico"> <meta name="author" content="the deal.II authors <authors@dealii.org>"> - <meta name="copyright" content="Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors"> + <meta name="copyright" content="Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors"> <meta name="deal.II-version" content="@DEAL_II_PACKAGE_VERSION@"> </head> diff --git a/deal.II/doc/doxygen/headers/boundary.h b/deal.II/doc/doxygen/headers/boundary.h index 7ffad2ac01..adfe76abf7 100644 --- a/deal.II/doc/doxygen/headers/boundary.h +++ b/deal.II/doc/doxygen/headers/boundary.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup boundary Boundary description for triangulations diff --git a/deal.II/doc/doxygen/headers/coding_conventions.h b/deal.II/doc/doxygen/headers/coding_conventions.h index 1382e47390..f6fff10ef5 100644 --- a/deal.II/doc/doxygen/headers/coding_conventions.h +++ b/deal.II/doc/doxygen/headers/coding_conventions.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 2007, 2008, 2011 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @page CodingConventions Coding conventions used throughout deal.II diff --git a/deal.II/doc/doxygen/headers/constraints.h b/deal.II/doc/doxygen/headers/constraints.h index e4c4e6dbda..0925516053 100644 --- a/deal.II/doc/doxygen/headers/constraints.h +++ b/deal.II/doc/doxygen/headers/constraints.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup constraints Constraints on degrees of freedom @@ -22,7 +26,7 @@ * Constraints typically come from several sources, for example: * - If you have Dirichlet-type boundary conditions, $u|_{\partial\Omega}=g$, * one usually enforces - * them by requiring that that degrees of freedom on the boundary have + * them by requiring that degrees of freedom on the boundary have * particular values, for example $x_{12}=42$ if the boundary condition * $g(\mathbf x)$ requires that the finite element solution $u(\mathbf x)$ * at the location of degree @@ -109,6 +113,13 @@ * below. The resulting linear systems are equivalent to those one gets after * calling the ConstraintMatrix::condense() functions. * + * @note Both ways of applying constraints set the value of the matrix + * diagonals to constrained entries to a <i>positive</i> entry of the same + * magnitude as the other entries in the matrix. As a consequence, you need to + * set up your problem such that the weak form describing the main matrix + * contribution is not <i>negative definite</i>. Otherwise, iterative solvers + * such as CG will break down or be considerably slower as GMRES. + * * @note While these two ways are <i>equivalent</i>, i.e., the solution of * linear systems computed via either approach is the same, the linear * systems themselves do not necessarily have the same matrix and right @@ -117,7 +128,6 @@ * as a result of the way in which we compute them; they are, however, always * chosen in such a way that the solution to the linear system is the same. * - * * <h4>Condensing matrices and sparsity patterns</h4> * * As mentioned above, the first way of using constraints is to build linear diff --git a/deal.II/doc/doxygen/headers/distributed.h b/deal.II/doc/doxygen/headers/distributed.h index 93830f4e6a..d5a76f7850 100644 --- a/deal.II/doc/doxygen/headers/distributed.h +++ b/deal.II/doc/doxygen/headers/distributed.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup distributed Parallel computing with multiple processors using distributed memory diff --git a/deal.II/doc/doxygen/headers/dofs.h b/deal.II/doc/doxygen/headers/dofs.h index 9a324be081..6448f2b930 100644 --- a/deal.II/doc/doxygen/headers/dofs.h +++ b/deal.II/doc/doxygen/headers/dofs.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2010, 2011 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup dofs Degrees of Freedom diff --git a/deal.II/doc/doxygen/headers/exceptions.h b/deal.II/doc/doxygen/headers/exceptions.h index c39d08dd41..03594750c2 100644 --- a/deal.II/doc/doxygen/headers/exceptions.h +++ b/deal.II/doc/doxygen/headers/exceptions.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup Exceptions Exceptions and assertions @@ -245,7 +249,7 @@ * do_something (); * } * catch (exception &e) { - * std::cerr << "Exception occured:" << std::endl + * std::cerr << "Exception occurred:" << std::endl * << e.what () * << std::endl; * do_something_to_reciver (); diff --git a/deal.II/doc/doxygen/headers/fe.h b/deal.II/doc/doxygen/headers/fe.h index 499e2476aa..eb21a6d7b7 100644 --- a/deal.II/doc/doxygen/headers/fe.h +++ b/deal.II/doc/doxygen/headers/fe.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2007, 2008, 2011 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup feall Finite elements diff --git a/deal.II/doc/doxygen/headers/functions.h b/deal.II/doc/doxygen/headers/functions.h index cb84efad75..620fb25260 100644 --- a/deal.II/doc/doxygen/headers/functions.h +++ b/deal.II/doc/doxygen/headers/functions.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup functions Functions diff --git a/deal.II/doc/doxygen/headers/geodynamics.h b/deal.II/doc/doxygen/headers/geodynamics.h index 47afee7243..d67db9b198 100644 --- a/deal.II/doc/doxygen/headers/geodynamics.h +++ b/deal.II/doc/doxygen/headers/geodynamics.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** @defgroup geodynamics The geodynamics demonstration suite diff --git a/deal.II/doc/doxygen/headers/geometry_and_primitives.h b/deal.II/doc/doxygen/headers/geometry_and_primitives.h index aa90d31cb1..e52cb5a444 100644 --- a/deal.II/doc/doxygen/headers/geometry_and_primitives.h +++ b/deal.II/doc/doxygen/headers/geometry_and_primitives.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup geomprimitives Geometric and other primitives diff --git a/deal.II/doc/doxygen/headers/global_dof_index.h b/deal.II/doc/doxygen/headers/global_dof_index.h index f01770a050..51ebce36d7 100644 --- a/deal.II/doc/doxygen/headers/global_dof_index.h +++ b/deal.II/doc/doxygen/headers/global_dof_index.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id: coding_conventions.h 29312 2013-04-17 13:00:07Z turcksin $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @page GlobalDoFIndex When to use types::global_dof_index instead of unsigned int @@ -61,6 +65,7 @@ * can solve now, there is no reason for the number of non-zero entries in a * sparse matrix to go over four billions. Thus, we still use unsigned int * for, e.g., row_lengths in the object. + * </dd> * - * + * </dl> */ diff --git a/deal.II/doc/doxygen/headers/glossary.h b/deal.II/doc/doxygen/headers/glossary.h index c9dec751ae..a4acb8b8c6 100644 --- a/deal.II/doc/doxygen/headers/glossary.h +++ b/deal.II/doc/doxygen/headers/glossary.h @@ -1,16 +1,19 @@ - -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2005 - 2013 by the deal.II authors // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// This file is part of the deal.II library. // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. // -//------------------------------------------------------------------------- +// --------------------------------------------------------------------- + /** * @page DEALGlossary Glossary @@ -366,6 +369,11 @@ * faces and edges. In this case, the boundary object associated with a particular * boundary indicator is also used to move the new center points of cells back * onto the manifold that the triangulation describes whenever a cell is refined. + * + * @note For parallel triangulations of type parallel::distributed::Triangulation, + * it is not enough to set boundary indicators only once at the beginning. See + * the long discussion on this topic in the class documentation of + * parallel::distributed::Triangulation . * </dd> * * @see @ref boundary "The module on boundaries" @@ -541,7 +549,7 @@ * to adding elements or setting them. In some cases, not all processors may * be adding elements, for example if a processor does not own any cells when * using a very coarse (initial) mesh. For this reason, compress() takes an - * argument of type VectorOperation, which can be either ::add, or ::insert. + * argument of type VectorOperation, which can be either ::%add, or ::%insert. * This argument is required for vectors and matrices starting with the 7.3 * release. * @@ -829,7 +837,10 @@ * is pointing the other direction. There are not very many places in * application programs where you need this information actually, but * a few places in the library make use of this. Note that in 2d, the - * result is always @p true. + * result is always @p true. However, while every face in 2d is always + * in standard orientation, you can sometimes specify something to + * assume that this is not so; an example is the function + * DoFTools::make_periodicity_constraints(). * * There are two other flags that describe the orientation of a face: * face_flip and face_rotation. Some documentation for these @@ -1207,7 +1218,7 @@ Article{JK10, * // in 3d * for (cell=dof_handler.begin_active(); * cell!=dof_handler.end(); ++cell) - * for (unsigned int line=0; line<GeometryInfo<dim>::lines_per_cell; ++l) + * for (unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l) * if (cell->line(l)->at_boundary()) * { * do something with this line @@ -1263,7 +1274,7 @@ Article{JK10, * @code * for (cell=dof_handler.begin_active(); * cell!=dof_handler.end(); ++cell) - * for (unsigned int line=0; line<GeometryInfo<dim>::lines_per_cell; ++l) + * for (unsigned int l=0; l<GeometryInfo<dim>::lines_per_cell; ++l) * if (cell->line(l)->at_boundary()) * { * cell->line(l)->set_user_index(42); diff --git a/deal.II/doc/doxygen/headers/grid.h b/deal.II/doc/doxygen/headers/grid.h index cc800ac710..61395d223c 100644 --- a/deal.II/doc/doxygen/headers/grid.h +++ b/deal.II/doc/doxygen/headers/grid.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup grid Grid classes diff --git a/deal.II/doc/doxygen/headers/hp.h b/deal.II/doc/doxygen/headers/hp.h index 487e4dee4d..2cd5ac1e52 100644 --- a/deal.II/doc/doxygen/headers/hp.h +++ b/deal.II/doc/doxygen/headers/hp.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2007, 2011 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup hp hp finite element support diff --git a/deal.II/doc/doxygen/headers/instantiations.h b/deal.II/doc/doxygen/headers/instantiations.h index f53e2ae151..59c2b3424c 100644 --- a/deal.II/doc/doxygen/headers/instantiations.h +++ b/deal.II/doc/doxygen/headers/instantiations.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @page Instantiations Template instantiations @@ -107,7 +111,7 @@ * * @subsection Inst2p Provided instances * - * Like with the classes in section Inst1, the instances provided in the + * Like with the classes in section @ref Inst1, the instances provided in the * library are often listed in the documentation of that class in a form * similar to this: @verbatim diff --git a/deal.II/doc/doxygen/headers/integrators.h b/deal.II/doc/doxygen/headers/integrators.h index 0a649fc5c3..9f598c9684 100644 --- a/deal.II/doc/doxygen/headers/integrators.h +++ b/deal.II/doc/doxygen/headers/integrators.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup Integrators Integrators diff --git a/deal.II/doc/doxygen/headers/io.h b/deal.II/doc/doxygen/headers/io.h index 4fed985a4e..11382be961 100644 --- a/deal.II/doc/doxygen/headers/io.h +++ b/deal.II/doc/doxygen/headers/io.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2010 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup IO Input/Output diff --git a/deal.II/doc/doxygen/headers/iterators.h b/deal.II/doc/doxygen/headers/iterators.h index 52f44bea81..144ffeaa0f 100644 --- a/deal.II/doc/doxygen/headers/iterators.h +++ b/deal.II/doc/doxygen/headers/iterators.h @@ -1,3 +1,19 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** @defgroup Iterators Iterators on mesh-like containers @{ diff --git a/deal.II/doc/doxygen/headers/lac.h b/deal.II/doc/doxygen/headers/lac.h index 8f200ba5db..e697d1eb7a 100644 --- a/deal.II/doc/doxygen/headers/lac.h +++ b/deal.II/doc/doxygen/headers/lac.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/main.h b/deal.II/doc/doxygen/headers/main.h index 965c5ae618..8f4995fa9a 100644 --- a/deal.II/doc/doxygen/headers/main.h +++ b/deal.II/doc/doxygen/headers/main.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @mainpage diff --git a/deal.II/doc/doxygen/headers/matrices.h b/deal.II/doc/doxygen/headers/matrices.h index 1ec2f373fe..979bcaa9b0 100644 --- a/deal.II/doc/doxygen/headers/matrices.h +++ b/deal.II/doc/doxygen/headers/matrices.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/memory.h b/deal.II/doc/doxygen/headers/memory.h index 82d4748a2e..413040165f 100644 --- a/deal.II/doc/doxygen/headers/memory.h +++ b/deal.II/doc/doxygen/headers/memory.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup memory Memory handling diff --git a/deal.II/doc/doxygen/headers/mesh_worker.h b/deal.II/doc/doxygen/headers/mesh_worker.h index c23e4d46fd..937675e30f 100644 --- a/deal.II/doc/doxygen/headers/mesh_worker.h +++ b/deal.II/doc/doxygen/headers/mesh_worker.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id: lac.h 12034 2006-01-15 21:16:14Z wolf $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/mg.h b/deal.II/doc/doxygen/headers/mg.h index ab162e9d50..bebf6c7987 100644 --- a/deal.II/doc/doxygen/headers/mg.h +++ b/deal.II/doc/doxygen/headers/mg.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2009, 2010 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup mg Multilevel support diff --git a/deal.II/doc/doxygen/headers/multithreading.h b/deal.II/doc/doxygen/headers/multithreading.h index e4e9d99228..ca73ffd0a5 100644 --- a/deal.II/doc/doxygen/headers/multithreading.h +++ b/deal.II/doc/doxygen/headers/multithreading.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup threads Parallel computing with multiple processors accessing shared memory diff --git a/deal.II/doc/doxygen/headers/namespace_dealii.h b/deal.II/doc/doxygen/headers/namespace_dealii.h index 4edf5ab273..df80dbf758 100644 --- a/deal.II/doc/doxygen/headers/namespace_dealii.h +++ b/deal.II/doc/doxygen/headers/namespace_dealii.h @@ -1,3 +1,19 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * This is the namespace in which everything in deal.II is. To avoid prefixing * every class and function call with the namespace name, the @ref Tutorial diff --git a/deal.II/doc/doxygen/headers/numerical_algorithms.h b/deal.II/doc/doxygen/headers/numerical_algorithms.h index 34ac3d345a..86a018e324 100644 --- a/deal.II/doc/doxygen/headers/numerical_algorithms.h +++ b/deal.II/doc/doxygen/headers/numerical_algorithms.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup numerics Numerical algorithms diff --git a/deal.II/doc/doxygen/headers/parallel.h b/deal.II/doc/doxygen/headers/parallel.h index 83334380cc..b169b70043 100644 --- a/deal.II/doc/doxygen/headers/parallel.h +++ b/deal.II/doc/doxygen/headers/parallel.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup Parallel Parallel computing diff --git a/deal.II/doc/doxygen/headers/petsc.h b/deal.II/doc/doxygen/headers/petsc.h index 6b1aa90532..e47048c9a1 100644 --- a/deal.II/doc/doxygen/headers/petsc.h +++ b/deal.II/doc/doxygen/headers/petsc.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2010 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/polynomials.h b/deal.II/doc/doxygen/headers/polynomials.h index e56bf7a015..f98b898bfe 100644 --- a/deal.II/doc/doxygen/headers/polynomials.h +++ b/deal.II/doc/doxygen/headers/polynomials.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup Polynomials Polynomials and polynomial spaces diff --git a/deal.II/doc/doxygen/headers/preconditioners.h b/deal.II/doc/doxygen/headers/preconditioners.h index 0c7c7ccae0..a40f6ccde6 100644 --- a/deal.II/doc/doxygen/headers/preconditioners.h +++ b/deal.II/doc/doxygen/headers/preconditioners.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2007, 2009, 2010 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/quadrature.h b/deal.II/doc/doxygen/headers/quadrature.h index 5ef0b996eb..c40ac9b5f9 100644 --- a/deal.II/doc/doxygen/headers/quadrature.h +++ b/deal.II/doc/doxygen/headers/quadrature.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup Quadrature Quadrature formulas diff --git a/deal.II/doc/doxygen/headers/slepc.h b/deal.II/doc/doxygen/headers/slepc.h index b142d896f8..c9c227e336 100644 --- a/deal.II/doc/doxygen/headers/slepc.h +++ b/deal.II/doc/doxygen/headers/slepc.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id: slepc.h 22855 2011-01-01 15:01:47Z young $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/solvers.h b/deal.II/doc/doxygen/headers/solvers.h index 10b8fa0761..5057d7dae9 100644 --- a/deal.II/doc/doxygen/headers/solvers.h +++ b/deal.II/doc/doxygen/headers/solvers.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2007 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup Solvers Linear solver classes * diff --git a/deal.II/doc/doxygen/headers/std_cxx1x.h b/deal.II/doc/doxygen/headers/std_cxx1x.h index 94333162bf..5cc44b5fc5 100644 --- a/deal.II/doc/doxygen/headers/std_cxx1x.h +++ b/deal.II/doc/doxygen/headers/std_cxx1x.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * A namespace that contains a selection of classes and functions that will be part of the diff --git a/deal.II/doc/doxygen/headers/trilinos.h b/deal.II/doc/doxygen/headers/trilinos.h index 8c4077afe0..7f1f5724bf 100644 --- a/deal.II/doc/doxygen/headers/trilinos.h +++ b/deal.II/doc/doxygen/headers/trilinos.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2010 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/tutorial.h b/deal.II/doc/doxygen/headers/tutorial.h index e967a2c12a..0cb94932d6 100644 --- a/deal.II/doc/doxygen/headers/tutorial.h +++ b/deal.II/doc/doxygen/headers/tutorial.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @page Tutorial Tutorial programs diff --git a/deal.II/doc/doxygen/headers/update_flags.h b/deal.II/doc/doxygen/headers/update_flags.h index ed547b39cc..c1c6893cb2 100644 --- a/deal.II/doc/doxygen/headers/update_flags.h +++ b/deal.II/doc/doxygen/headers/update_flags.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/utilities.h b/deal.II/doc/doxygen/headers/utilities.h index 7ecc871bb3..3d0c87c15c 100644 --- a/deal.II/doc/doxygen/headers/utilities.h +++ b/deal.II/doc/doxygen/headers/utilities.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup utilities Utility functions and classes diff --git a/deal.II/doc/doxygen/headers/vector_memory.h b/deal.II/doc/doxygen/headers/vector_memory.h index 0c65f902b1..3ab9499eed 100644 --- a/deal.II/doc/doxygen/headers/vector_memory.h +++ b/deal.II/doc/doxygen/headers/vector_memory.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2008 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** diff --git a/deal.II/doc/doxygen/headers/vector_valued.h b/deal.II/doc/doxygen/headers/vector_valued.h index cf6c5ccdb5..2edcd2d5a8 100644 --- a/deal.II/doc/doxygen/headers/vector_valued.h +++ b/deal.II/doc/doxygen/headers/vector_valued.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2011, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** @@ -294,7 +298,7 @@ - (q, \mathrm{div}\ \mathbf u) = - (q,f) + (\mathbf n\cdot\mathbf v, p)_{\partial\Omega}. + (q,f) - (\mathbf n\cdot\mathbf v, p)_{\partial\Omega}. @f} * * It is this form that we will later use in assembling the discrete weak form @@ -455,9 +459,9 @@ fe_values[velocities].divergence (j, q)) * fe_values.JxW(q); - local_rhs(i) += - fe_values[pressure].value (i, q) - rhs_values[q] * - fe_values.JxW(q); + local_rhs(i) += fe_values[pressure].value (i, q) + rhs_values[q] * + fe_values.JxW(q); } * @endcode * @@ -528,7 +532,7 @@ * extractor. For example, <code>fe_values[pressure].gradient(i,q)</code> * would represent the gradient of the scalar pressure component, which * is of type <code>Tensor@<1,dim@></code>, whereas the gradient of the - * velocities components, <code>fe_values[velocities].value(i,q)</code> + * velocities components, <code>fe_values[velocities].gradient(i,q)</code> * is a <code>Tensor@<2,dim@></code>, i.e. a matrix $G_{ij}$ that consits * of entries $G_{ij}=\frac{\partial\phi_i}{\partial x_j}$. Finally, * both scalar and vector views can be asked for the second derivatives @@ -680,7 +684,7 @@ \right)_\Omega, @f} * where $\varepsilon(\mathbf u) = \frac 12 \left([\nabla\mathbf u] + - * [\nabla\mathbf u]^2\right)$ is the symmetrized gradient. + * [\nabla\mathbf u]^T\right)$ is the symmetrized gradient. * In the second to last step, we used that the scalar product between * an arbitrary tensor $\nabla\mathbf u$ and a symmetric tensor * $\frac 12[\partial_i v_j + \partial_j v_i]$ equals the scalar product diff --git a/deal.II/doc/doxygen/headers/vectors.h b/deal.II/doc/doxygen/headers/vectors.h index 24ed56085a..a82529b300 100644 --- a/deal.II/doc/doxygen/headers/vectors.h +++ b/deal.II/doc/doxygen/headers/vectors.h @@ -1,15 +1,19 @@ -//------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + /** * @defgroup Vectors Vector classes diff --git a/deal.II/doc/doxygen/images/CMakeLists.txt b/deal.II/doc/doxygen/images/CMakeLists.txt index ccb3313173..54a6589526 100644 --- a/deal.II/doc/doxygen/images/CMakeLists.txt +++ b/deal.II/doc/doxygen/images/CMakeLists.txt @@ -1,3 +1,18 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/structure.png diff --git a/deal.II/doc/doxygen/options.dox.in b/deal.II/doc/doxygen/options.dox.in index e17e334cbf..e30740fbdd 100644 --- a/deal.II/doc/doxygen/options.dox.in +++ b/deal.II/doc/doxygen/options.dox.in @@ -477,7 +477,8 @@ EXCLUDE_PATTERNS = *.templates.h # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = @CMAKE_BINARY_DIR@/doc/doxygen/tutorial +EXAMPLE_PATH = @CMAKE_BINARY_DIR@/doc/doxygen/tutorial \ + @CMAKE_SOURCE_DIR@/examples/doxygen # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -1000,7 +1001,8 @@ PREDEFINED = DOXYGEN=1 \ DEAL_II_WITH_ARPACK=1 \ DEAL_II_WITH_METIS=1 \ DEAL_II_WITH_MUMPS=1 \ - DEAL_II_WITH_P4EST=1 + DEAL_II_WITH_P4EST=1 \ + DEAL_II_WITH_MPI=1 # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. diff --git a/deal.II/doc/doxygen/scripts/create_anchors b/deal.II/doc/doxygen/scripts/create_anchors index 75fabccd19..0c1dcf57c9 100644 --- a/deal.II/doc/doxygen/scripts/create_anchors +++ b/deal.II/doc/doxygen/scripts/create_anchors @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id: create_anchors 14782 2007-06-15 16:37:12Z kanschat $ -# Version: $Name$ -# -# Copyright (C) 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 -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2007 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- # If we find a heading in a .dox file, create an HTML anchor for it. diff --git a/deal.II/doc/doxygen/scripts/intro2toc b/deal.II/doc/doxygen/scripts/intro2toc index 53839ab09a..0911ca1aee 100644 --- a/deal.II/doc/doxygen/scripts/intro2toc +++ b/deal.II/doc/doxygen/scripts/intro2toc @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id: intro2toc 14782 2007-06-15 16:37:12Z kanschat $ -# Version: $Name$ -# -# Copyright (C) 2006, 2007, 2008 by the deal.II authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2006 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- print " <ul>\n"; diff --git a/deal.II/doc/doxygen/scripts/make_step.pl b/deal.II/doc/doxygen/scripts/make_step.pl index 9c2569660e..d4a39193a8 100644 --- a/deal.II/doc/doxygen/scripts/make_step.pl +++ b/deal.II/doc/doxygen/scripts/make_step.pl @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id$ -# Version: $Name$ -# -# Copyright (C) 2013 by the deal.II authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- if ($#ARGV != 1) { print "\nUsage: make_step.pl step cmake_source_dir\n"; diff --git a/deal.II/doc/doxygen/scripts/program2doxygen b/deal.II/doc/doxygen/scripts/program2doxygen index 662bc8c749..67565a5513 100644 --- a/deal.II/doc/doxygen/scripts/program2doxygen +++ b/deal.II/doc/doxygen/scripts/program2doxygen @@ -1,16 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id$ -# Version: $Name$ -# -# Copyright (C) 2006, 2007, 2010, 2013 by the deal.II authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- - +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2006 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- print " * <a name=\"CommProg\"></a>\n"; diff --git a/deal.II/doc/doxygen/scripts/program2doxyplain b/deal.II/doc/doxygen/scripts/program2doxyplain index 73782b71a1..2d5529ed28 100644 --- a/deal.II/doc/doxygen/scripts/program2doxyplain +++ b/deal.II/doc/doxygen/scripts/program2doxyplain @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id$ -# Version: $Name$ -# -# Copyright (C) 2006, 2007 by the deal.II authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2006 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- print "\n"; diff --git a/deal.II/doc/doxygen/scripts/program2html b/deal.II/doc/doxygen/scripts/program2html index f5894dc8ff..9d3083c5f5 100644 --- a/deal.II/doc/doxygen/scripts/program2html +++ b/deal.II/doc/doxygen/scripts/program2html @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id$ -# Version: $Name$ -# -# Copyright (C) 2006, 2007, 2010 by the deal.II authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2006 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- print "<a name=\"CommProg\"></a>\n"; print "<h1> The commented program</h1>\n"; diff --git a/deal.II/doc/doxygen/scripts/program2plain b/deal.II/doc/doxygen/scripts/program2plain index d18bf8ca86..7e2e0f0fc5 100644 --- a/deal.II/doc/doxygen/scripts/program2plain +++ b/deal.II/doc/doxygen/scripts/program2plain @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id$ -# Version: $Name$ -# -# Copyright (C) 2010, 2011 by the deal.II authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2010 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- # Remove all comments from the source file diff --git a/deal.II/doc/doxygen/scripts/program2toc b/deal.II/doc/doxygen/scripts/program2toc index 8518966815..5a5927999b 100644 --- a/deal.II/doc/doxygen/scripts/program2toc +++ b/deal.II/doc/doxygen/scripts/program2toc @@ -1,15 +1,18 @@ -#--------------------------------------------------------------------------- -# $Id$ -# Version: $Name$ -# -# Copyright (C) 2006, 2007 by the deal.II authors -# -# This file is subject to QPL and may not be distributed -# without copyright and license information. Please refer -# to the file deal.II/doc/license.html for the text and -# further information on this license. -# -#--------------------------------------------------------------------------- +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2006 - 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- print " <ul>\n"; diff --git a/deal.II/doc/doxygen/tutorial/CMakeLists.txt b/deal.II/doc/doxygen/tutorial/CMakeLists.txt index 7a0050800c..f0c45fc022 100644 --- a/deal.II/doc/doxygen/tutorial/CMakeLists.txt +++ b/deal.II/doc/doxygen/tutorial/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## <TODO: Full License information> -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier <matthias.maier@iwr.uni-heidelberg.de> -## -##### +## --------------------------------------------------------------------- # diff --git a/deal.II/doc/external-libs/arpack.html b/deal.II/doc/external-libs/arpack.html index ef6593db09..52a6c37202 100644 --- a/deal.II/doc/external-libs/arpack.html +++ b/deal.II/doc/external-libs/arpack.html @@ -6,8 +6,8 @@ <title>The deal.II Readme on interfacing to ARPACK</title> <link href="../screen.css" rel="StyleSheet"> <meta name="author" content="the deal.II authors <authors @ dealii.org>"> - <meta name="copyright" content="Copyright (C) 2010 by the deal.II authors"> - <meta name="date" content="$Date: 2010-05-05 (Thu, 05 May 2010) $"> + <meta name="copyright" content="Copyright (C) 2010, 2013 by the deal.II authors"> + <meta name="date" content="$Date$"> <meta name="svn_id" content="$Id: readme-arpack.html$"> <meta name="keywords" content="deal.II"> </head> @@ -103,7 +103,7 @@ <hr> <address> - <a href="mail.html">The deal.II Group</a> + <a href="../mail.html">The deal.II Group</a> $Date$ </address> </body> diff --git a/deal.II/doc/external-libs/mumps.html b/deal.II/doc/external-libs/mumps.html index ad74a1e469..9459e54e4e 100644 --- a/deal.II/doc/external-libs/mumps.html +++ b/deal.II/doc/external-libs/mumps.html @@ -3,11 +3,11 @@ <html> <head> - <title>The deal.II Readme on interfacing to PETSc and Trilinos</title> - <link href="screen.css" rel="StyleSheet"> + <title>The deal.II Readme on interfacing to MUMPS</title> + <link href="../screen.css" rel="StyleSheet"> <meta name="author" content="the deal.II authors <authors @ dealii.org>"> <meta name="copyright" content="Copyright (C) 2010, 2011, 2012, 2013 by the deal.II authors"> - <meta name="date" content="$Date: 2010-05-05 (Thu, 05 May 2010) $"> + <meta name="date" content="$Date$"> <meta name="svn_id" content="$Id: readme-mumps.html$"> <meta name="keywords" content="deal.II"> </head> @@ -329,6 +329,7 @@ <p> You can override the autodetection by manually specifying <pre> + -DDEAL_II_WITH_MUMPS=OFF|ON </pre>. </p> @@ -346,7 +347,7 @@ <hr> <address> - <a href="mail.html">The deal.II Group</a> + <a href="../mail.html">The deal.II Group</a> $Date$ </address> </body> diff --git a/deal.II/doc/external-libs/p4est.html b/deal.II/doc/external-libs/p4est.html index 6f24b8d7d8..ab17ff2a35 100644 --- a/deal.II/doc/external-libs/p4est.html +++ b/deal.II/doc/external-libs/p4est.html @@ -2,8 +2,8 @@ "http://www.w3.org/TR/REC-html40/frameset.dtd"> <html> <head> - <link href="../screen.css" rel="StyleSheet" media="screen"> - <title>The deal.II Readme</title> + <title>The deal.II Readme on interfacing to p4est</title> + <link href="../screen.css" rel="StyleSheet"> <meta name="author" content="the deal.II authors <authors@dealii.org>"> <meta name="keywords" content="deal.II"> </head> @@ -23,39 +23,46 @@ <p> You need to install p4est before deal.II. To do so, you can - download it - from <a href="http://www.p4est.org/" target="_top">here</a>, copy it to - a fresh directory into which you should also copy - the <a href="p4est-setup.sh">p4est-setup.sh script</a> (the one - from this link, not one you may have gotten from the p4est webpage). Then - call the script as follows: - <code> - <pre> - ./p4est-setup.sh p4est-x-y-z.tar.gz /path/to/installation - </pre> - </code> + download it from <a href="http://www.p4est.org/" target="_top">here</a>. + You can either choose to manually compile and install p4est (as + explained in documentation of p4est), or alternatively use + <a href="p4est-setup.sh">a script</a> that will automatically compile + and install a debug and optimized version of p4est. + + </p> + + <p> + If you want to use the script, copy the tarball to a fresh directory + together with the <a href="p4est-setup.sh">p4est-setup.sh script</a> + (the one from this link, not one you may have gotten from the p4est + webpage). Then call the script as follows: + <pre> + + ./p4est-setup.sh p4est-x-y-z.tar.gz /path/to/installation + </pre> where <code>p4est-x-y-z.tar.gz</code> is the name of the p4est distribution file, and <code>/path/to/installation</code> is a directory into which you want to install p4est. </p> <p> - After this, you need to configure <acronym>deal.II</acronym> - using a line like - <code> - <pre> + In both cases, you can configure <acronym>deal.II</acronym> using a + line like + <pre> cmake -DP4EST_DIR=/path/to/installation -DDEAL_II_WITH_P4EST=ON -DDEAL_II_WITH_MPI=ON <...> - </pre> - </code> - Obviously, you can also add additional flags to - <code>cmake</code> as described in the general <a - href="../readme.html">ReadMe file</a>. + </pre> + if the p4est library isn't picked up automatically. Note the presence + of <code>/FAST</code> at the end of the path necessary when using + the <code>./p4est-setup.sh</code> script to select the release + version of p4est. Obviously, you + can also add additional flags to <code>cmake</code> as described in + the general <a href="../readme.html">ReadMe file</a>. </p> <hr> <address> - <a href="mail.html">The deal.II Group</a> + <a href="../mail.html">The deal.II Group</a> $Date$ </address> </body> diff --git a/deal.II/doc/external-libs/petsc.html b/deal.II/doc/external-libs/petsc.html index 8fb7e4474a..3fbc0b78f8 100644 --- a/deal.II/doc/external-libs/petsc.html +++ b/deal.II/doc/external-libs/petsc.html @@ -38,9 +38,9 @@ <h4>Installing <acronym>deal.II</acronym> with PETSc</h4> - <p> - For a general overview of building <acronym>deal.II</acronym> with - PETSc, first see the <a href="../readme.html">ReadMe file</a>. + <p style="color: red"><b>Note:</b> The latest version of PETSc tested is + 3.4.2. Major releases after this version may cause problems, so we + recommend sticking to this version if at all possible. </p> <p> @@ -68,16 +68,6 @@ during configuration. </p> - <p> - <b>Note:</b> PETSc appears not to co-operate - well when using threads and some programs crash when deal.II is - compiled in its usual mode supporting multithreading. If you see - this sort of behavior, disable - multithreading upon configuration of <acronym>deal.II</acronym> - using the <code>-DDEAL_II_WITH_THREADS=OFF</code> switch for - <code>cmake</code>. - </p> - <p><b>Note:</b> <acronym>deal.II</acronym> can be installed with both PETSc and Trilinos and they do not usually get in their respective ways. There are, however, occasions where this is not true @@ -113,7 +103,6 @@ cd petsc-x-y-z export PETSC_DIR=`pwd` export PETSC_ARCH=x86_64 # or any other identifying text for your machine - export LD_LIBRARY_PATH=$PETSC_DIR/$PETSC_ARCH/lib:$LD_LIBRARY_PATH ./config/configure.py --with-shared=1 --with-x=0 --with-mpi=1 --download-hypre=1 make </pre> @@ -121,7 +110,7 @@ <p> This automatically builds PETSc with both MPI and the algebraic - multigrid preconditioner package Hypre (which we use in step-40). + multigrid preconditioner package Hypre (which we use in step-40). <br> Now let PETSc check his own sanity: <pre> diff --git a/deal.II/doc/external-libs/slepc.html b/deal.II/doc/external-libs/slepc.html index 3009d4bdb7..5fd4ff0563 100644 --- a/deal.II/doc/external-libs/slepc.html +++ b/deal.II/doc/external-libs/slepc.html @@ -99,7 +99,15 @@ export SLEPC_DIR=/path/to/slepc-x-y-z </pre> + The <code>cmake</code> installation should then be able to pick + up where you installed SLEPc and include it automatically in the + deal.II build without any further need for instructions. You + will see at the bottom of the <code>cmake</code> output if that + is what actually happened. </p> + + + <hr> <!-- TODO: <h4>Using the ARPACK solvers with SLEPc</4> --> diff --git a/deal.II/doc/external-libs/trilinos.html b/deal.II/doc/external-libs/trilinos.html index 4871bf8e62..4efc8291a7 100644 --- a/deal.II/doc/external-libs/trilinos.html +++ b/deal.II/doc/external-libs/trilinos.html @@ -52,11 +52,10 @@ <h5>Installing Trilinos</h5> <p style="color: red"> - Note: Trilinos versions 10.8.0, 10.8.1, 10.10.2, 10.12.1 are not - compatible with deal.II. They contain subtle bugs related to (parallel) - matrices and vectors. Versions tested to work are 10.8.5, - 10.12.2, and 11.0.3. We recommend only using one of the tested versions - for the time being. + Note: Trilinos versions older than 10.12.2 can cause problems and are + therefore not recommended. The newest version tested to work is 11.4.1. + Major releases after this version may cause problems, so we recommend + sticking to this version if at all possible. </p> <p> @@ -65,41 +64,34 @@ reasonable configuration: <pre> - cd trilinos-10.12.2 + cd trilinos-11.4.1 mkdir build cd build - cmake -D Trilinos_ENABLE_OPTIONAL_PACKAGES:BOOL=ON \ - -D Trilinos_ENABLE_Sacado:BOOL=ON \ - -D Trilinos_ENABLE_Stratimikos:BOOL=ON \ - -D CMAKE_BUILD_TYPE:STRING=RELEASE \ - -D CMAKE_CXX_FLAGS:STRING="-g -O3" \ - -D CMAKE_C_FLAGS:STRING="-g -O3" \ - -D CMAKE_FORTRAN_FLAGS:STRING="-g -O5" \ - -D Trilinos_EXTRA_LINK_FLAGS:STRING="-lgfortran" \ - -D CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE \ - -D Trilinos_VERBOSE_CONFIGURE:BOOL=FALSE \ - -D TPL_ENABLE_MPI:BOOL=ON \ - -D BUILD_SHARED_LIBS:BOOL=ON \ - -D CMAKE_INSTALL_PREFIX:PATH=$HOME/share/trilinos .. - - make + cmake -D Trilinos_ENABLE_Sacado=ON \ + -D Trilinos_ENABLE_Stratimikos=ON \ + -D CMAKE_BUILD_TYPE=RELEASE \ + -D CMAKE_CXX_FLAGS="-g -O3" \ + -D CMAKE_C_FLAGS="-g -O3" \ + -D CMAKE_FORTRAN_FLAGS="-g -O5" \ + -D Trilinos_EXTRA_LINK_FLAGS="-lgfortran" \ + -D CMAKE_VERBOSE_MAKEFILE=FALSE \ + -D Trilinos_VERBOSE_CONFIGURE=FALSE \ + -D TPL_ENABLE_MPI=ON \ + -D BUILD_SHARED_LIBS=ON \ + -D CMAKE_INSTALL_PREFIX:PATH=$HOME/share/trilinos \ + .. + make install </pre> You will need to adjust the path into which you want to install Trilinos - in the second to last line of the cmake command. - </p> - - <p> - <b>Using MPI:</b> If you - want to use Trilinos with MPI on parallel machines, - use <code>TPL_ENABLE_MPI=ON</code> instead. + in the CMAKE_INSTALL_PREFIX line. </p> <p> <b>Parallel builds:</b> If your computer has more than one processor core, use - <code>make -jN</code> instead of <code>make</code> in the last two lines + <code>make -jN</code> instead of <code>make</code> in the last line above, where <code>N</code> is the number of processors you have. </p> diff --git a/deal.II/doc/index.html b/deal.II/doc/index.html index 409f112c4d..71c9b6349a 100644 --- a/deal.II/doc/index.html +++ b/deal.II/doc/index.html @@ -23,7 +23,7 @@ <frameset rows="70,*"> <frame name="title" src="title.html" frameborder="1"> - <frameset cols="120,*"> + <frameset cols="150,*"> <frame name="navbar" src="navbar.html" frameborder="0"> <frame name="body" src="documentation.html" frameborder="0"> </frameset> diff --git a/deal.II/doc/license.html b/deal.II/doc/license.html index 5470e7573f..dac21d73d7 100644 --- a/deal.II/doc/license.html +++ b/deal.II/doc/license.html @@ -44,13 +44,13 @@ In this document, as well as in the program files, the terms <i>authors of <acronym>deal.II</acronym></i> and <i><acronym>deal.II</acronym> authors</i> generally refer to all - people mentioned at the <a href="authors.html">deal.II Credits</a> + people mentioned at the <a href="authors.html">deal.II Authors</a> page. These are the maintainers Wolfgang Bangerth, Timo Heister, and Guido Kanschat and a <i>long</i> list of contributors. </p> - <h3>Contributions</h3> + <h2>Contributions</h2> <p> <b>As a contributor to this project, you agree that any of your @@ -66,7 +66,7 @@ </p> - <h3>Referencing the library</h3> + <h2>Referencing the library</h2> <p> In addition to the terms imposed by the LGPL v2.1 or later, we ask @@ -89,9 +89,8 @@ </p> - <a name="3rdparty"> - <h3>Parts of the deal.II distribution under a separate license</h3> - </a> + <a name="3rdparty"></a> + <h2>Parts of the deal.II distribution under a separate license</h2> <p> <acronym>deal.II</acronym> comes bundled with copies of @@ -123,20 +122,17 @@ <p> - <h3>Contact</h3> + <h2>Contact</h2> <p> For further questions regarding licensing and commercial use please contact the deal.II maintainers directly via one of the following mail addresses: <ul> - <li> - TODO - </li> <li> Wolfgang Bangerth &lt; bangerth@gmail.com &gt; </li> <li> - Timo Heister &lt; heister@math.tamu.edu &gt; + Timo Heister &lt; heister@clemson.edu &gt; </li> <li> Guido Kanschat &lt; dr.guido.kanschat@gmail.com &gt; @@ -145,7 +141,8 @@ </p> - <h3>Full license text</h3> + <a name="license-text"></a> + <h2>Full license text</h2> <pre> @@ -653,18 +650,17 @@ That's all there is to it! </pre> - <hr> - + <hr /> <address> - The deal.II authors + <a href="authors.html" target="body">The deal.II Authors</a> + $Date$ </address> - <div class="right"> - <p> - <a href="http://validator.w3.org/check?uri=referer"><img border="0" - src="http://www.w3.org/Icons/valid-html401" - alt="Valid HTML 4.01!" height="31" width="88"></a> - </p> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> </div> + </body> </html> diff --git a/deal.II/doc/license/adjust.pl b/deal.II/doc/license/adjust.pl new file mode 100644 index 0000000000..497170f753 --- /dev/null +++ b/deal.II/doc/license/adjust.pl @@ -0,0 +1,29 @@ +#!/bin/perl + +my $header=1; + +print << 'EOT' +//---------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +//---------------------------------------------------------------------- +EOT + ; + +while(<>) +{ + $header=0 unless m/\/\//; + next if $header; + print; +} diff --git a/deal.II/doc/license/header-template b/deal.II/doc/license/header-template index baa3862da6..7e1eec4cec 100644 --- a/deal.II/doc/license/header-template +++ b/deal.II/doc/license/header-template @@ -1,7 +1,7 @@ -//---------------------------------------------------------------------- +// --------------------------------------------------------------------- // $Id$ // -// Copyright (C) 1998 - 2013 by the deal.II authors +// Copyright (C) @YEAR@ by the deal.II authors // // This file is part of the deal.II library. // @@ -12,4 +12,5 @@ // The full text of the license can be found in the file LICENSE at // the top level of the deal.II distribution. // -//---------------------------------------------------------------------- +// --------------------------------------------------------------------- + diff --git a/deal.II/doc/license/header-template.cmake b/deal.II/doc/license/header-template.cmake new file mode 100644 index 0000000000..f5567b7570 --- /dev/null +++ b/deal.II/doc/license/header-template.cmake @@ -0,0 +1,15 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- diff --git a/deal.II/doc/license/replace.sh b/deal.II/doc/license/replace.sh new file mode 100755 index 0000000000..f43cf5241f --- /dev/null +++ b/deal.II/doc/license/replace.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +FILE=$1 + +FIRST_YEAR=$(grep Copyright $FILE | perl -pi -e 's/.*?(\d{4}).*/\1/') +if [ "$FIRST_YEAR" = "2013" ] || (! [[ "$FIRST_YEAR" =~ "^[0-9]+$" ]]) +then + YEAR="2013" +else if + YEAR="$FIRST_YEAR - 2013" +fi + +sed -e "s/@YEAR@/$YEAR/" doc/license/header-template > /tmp/foobar22.temp + +header_lines=1 +on_whitespace=true +whitespace_detected=false +while read line +do + if $on_whitespace && [[ $line =~ "^$" ]] + then + whitespace_detected=true + header_lines=$[$header_lines+1] + continue + else + on_whitespace=false + fi + + if ! [[ $line =~ "^//.*$" ]] + then + break + else + header_lines=$[$header_lines+1] + fi +done < $FILE + +if $whitespace_detected +then + echo "$FILE --> whitespace" + echo "$FILE --> $header_lines" +else + if [ $header_lines -lt 10 ] + then + echo "$FILE --> $header_lines" + fi +fi + +tail -n+$header_lines $FILE >> /tmp/foobar22.temp + +cp /tmp/foobar22.temp $FILE + diff --git a/deal.II/doc/mail.html b/deal.II/doc/mail.html index 66574112c1..6c05773ff5 100644 --- a/deal.II/doc/mail.html +++ b/deal.II/doc/mail.html @@ -67,17 +67,15 @@ <h2> Authors </h2> + <p> Everything you consider a personal matter between you and the authors (like - flaming them on missing items) should be sent to one of + flaming them on missing items) should be sent to one of the maintainers <ul> - <li> - TODO - </li> <li> Wolfgang Bangerth &lt; bangerth@gmail.com &gt; </li> <li> - Timo Heister &lt; heister@math.tamu.edu &gt; + Timo Heister &lt; heister@clemson.edu &gt; </li> <li> Guido Kanschat &lt; dr.guido.kanschat@gmail.com &gt; @@ -85,18 +83,20 @@ </ul> Everything, that is not directly related to the library is to be considered personal in this respect! <br> + </p> - <hr> + <hr /> <address> - <a href="mail.html" target="body">The deal.II Group</a> + <a href="authors.html" target="body">The deal.II Authors</a> + $Date$ </address> <div class="right"> - <p> - <a href="http://validator.w3.org/check?uri=referer"><img border="0" - src="http://www.w3.org/Icons/valid-html401" - alt="Valid HTML 4.01!" height="31" width="88"></a> - </p> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> </div> + </body> </html> diff --git a/deal.II/doc/navbar.html b/deal.II/doc/navbar.html index fcc7b54ec1..d142bdfeae 100644 --- a/deal.II/doc/navbar.html +++ b/deal.II/doc/navbar.html @@ -12,13 +12,21 @@ <body class="navbar"> <p> + <a href="http://www.dealii.org"target="_top">http://www.dealii.org</a><br /> <a href="index.html" target="_top">Home</a><br /> - <a href="http://www.dealii.org"target="_top">dealii.org</a><br /> + </p> + + <hr> + + <p> <a href="readme.html" target="body">README</a><br /> + <a href="users/index.html" target="_top">Users' Corner</a><br /> + <a href="developers/index.html" target="_top">Developers' Corner</a><br /> </p> <hr> + <b><small>Doxygen and Lectures</small></b> <p> <a href="doxygen/tutorial/index.html" target="_top">Tutorial</a><br /> <a href="doxygen/deal.II/index.html" target="_top">Manual</a><br /> @@ -28,6 +36,7 @@ <hr> + <b><small>Online Resources</small></b> <p> <a href="https://code.google.com/p/dealii/wiki/FrequentlyAskedQuestions" target="_top">FAQ</a><br /> <a href="news/news.html" target="body">News</a><br /> @@ -39,14 +48,14 @@ <hr> + <b><small>Resources</small></b> <p> - <a href="development/index.html" target="_top">Development</a><br /> + <a href="reports/index.html" target="body">Reports</a><br /> <a href="publications/index.html" target="body">Publications</a><br /> <a href="authors.html" target="body">Authors</a> <br /> - <a href="license.html" target="body">License</a> + <a href="license.html" target="body">License</a> <br /> + <a href="mail.html" target="body">Contact</a> </p> - <!-- Last modified: 2006/02/07 22:49:06 --> - </body> </html> diff --git a/deal.II/doc/news/2001/3.1.0-vs-3.2.0.html b/deal.II/doc/news/2001/3.1.0-vs-3.2.0.html index 2bacdd45b2..cd0b779b75 100644 --- a/deal.II/doc/news/2001/3.1.0-vs-3.2.0.html +++ b/deal.II/doc/news/2001/3.1.0-vs-3.2.0.html @@ -144,9 +144,6 @@ documentation, etc</a>. New: There is now some support to include and use routines from the <a href="http://www.cse.clrc.ac.uk/Activity/HSL" target="_top">Harwell Subroutine Library</a>. - (See the <a href="../../readme.html#hsl" target="body">ReadMe</a> - file for more information on installation of HSL - subroutines.) <br> (WB 2001/01/30) </p> @@ -156,9 +153,7 @@ documentation, etc</a>. existence of a Fortran 77 compiler, and sets its path, some compiler flags and the libraries to be linked in when mixing C++ and F77 in some variables in the file - <code>common/Make.global_options</code> (see also - <a href="../../development/makefiles.html" target="body">this - page</a>). + <code>common/Make.global_options</code>. <br> (WB 2000/12/30) </p> @@ -602,9 +597,6 @@ documentation, etc</a>. <code class="class">SparseDirectMA27</code> and <code class="class">SparseDirectMA47</code> for the sparse direct solvers MA27 and MA47. - (See the <a href="../../readme.html#hsl" target="body">ReadMe</a> - file for more information on installation of HSL - subroutines.) <br> (WB 2001/01/30) </p> diff --git a/deal.II/doc/news/6.3.0-vs-7.0.0.h b/deal.II/doc/news/6.3.0-vs-7.0.0.h index 6dc8e87c4b..df23b1594f 100644 --- a/deal.II/doc/news/6.3.0-vs-7.0.0.h +++ b/deal.II/doc/news/6.3.0-vs-7.0.0.h @@ -51,8 +51,7 @@ more naturally preserves consistency. <br> As a consequence, if your makefile makes any assumption on the location of deal.II include files or the name of the deal.II library - it will need to be changed. The <a - href="../../development/makefiles.html">sample Makefiles</a> have been + it will need to be changed. The sample Makefiles have been updated for this. <br> (WB 2010/10/25) diff --git a/deal.II/doc/news/7.0.0-vs-7.1.0.h b/deal.II/doc/news/7.0.0-vs-7.1.0.h index 6d4ef48ce1..5e6decd05c 100644 --- a/deal.II/doc/news/7.0.0-vs-7.1.0.h +++ b/deal.II/doc/news/7.0.0-vs-7.1.0.h @@ -727,7 +727,7 @@ were not properly mapped. This is now fixed. <li> New: Restructured the internals of <code>PETScWrappers::Precondition*</code> to allow a PETSc PC object to exist without a solver. New: Use -<code>Precondition*::vmult()</code> to apply the preconditioner once. +<code>Precondition*::%vmult()</code> to apply the preconditioner once. Preconditioners now have a default constructor and an <code>initialize()</code> function and are no longer initialized in the solver call, but in the constructor or <code>initialize()</code>. diff --git a/deal.II/doc/news/7.2.0-vs-7.3.0.h b/deal.II/doc/news/7.2.0-vs-7.3.0.h index e40b25cb19..52808bccd7 100644 --- a/deal.II/doc/news/7.2.0-vs-7.3.0.h +++ b/deal.II/doc/news/7.2.0-vs-7.3.0.h @@ -224,7 +224,7 @@ that takes a std::vector<IndexSet> (same interface as in Trilinos). <br> (Timo Heister, 2013/02/19) -<li> New: PETScWrappers::*Matrix::add(other, factor) to +<li> New: PETScWrappers::*Matrix::%add(other, factor) to add a scaled other matrix to the current matrix. <br> (Jose Javier Munoz Criollo, 2013/02/19) diff --git a/deal.II/doc/news/7.3.0-vs-8.0.0.h b/deal.II/doc/news/7.3.0-vs-8.0.0.h new file mode 100644 index 0000000000..e802b8a125 --- /dev/null +++ b/deal.II/doc/news/7.3.0-vs-8.0.0.h @@ -0,0 +1,627 @@ +/** + * @page changes_between_7_3_and_8_0 Changes between Version 7.3 and 8.0 + +<p> +This is the list of changes made between the release of +deal.II version 7.3.0 and that of 8.0.0. +All entries are signed with the names of the authors. +</p> + + + +<!-- ----------- INCOMPATIBILITIES ----------------- --> + +<a name="incompatible"></a> +<h3 style="color:red">Incompatibilities</h3> + +<p style="color:red"> +Following are a few modifications to the library that unfortunately +are incompatible with previous versions of the library, but which we +deem necessary for the future maintainability of the +library. Unfortunately, some of these changes will require +modifications to application programs. We apologize for the +inconvenience this causes. +</p> + +<ol> + +<li> Removed: it was possible to call get_dof_indices(), get_dof_values(), +set_dof_values(), and distribute_local_to_global() for cells that were not +active, if the finite element only had DoFs on vertices (i.e. Q1). This is +no longer allowed. +<br> +(Timo Heister, 2013/06/02) + +<li> Changed: Internal structures of ExceptionBase are now thread safe. The +Assert macro does not print an exception to deallog any more prior to +throwing if deal_II_exceptions::abort_on_exception==false. Removed: A +number of obsolete Exceptions that are not used in the library any more. +<br> +(Matthias Maier, 2013/04/16) + +<li> Removed: A number of header files that have been deprecated a long time +ago have been removed. All of them had previously only included the header file +that had superseded them. To upgrade, simply include the currently used +header file. This is also backward compatible with deal.II 7.3. +<br> +(Guido Kanschat, 2013/04/12) + +<li> Removed: The interfaces to the obsolete direct solvers MA27 and MA47 from +the Harwell Subroutine Library. Support for the HSL routines were not ported to +the new build system. However, the sparse direct solver UMFPACK remains to be +supported and is provided as part of the standard deal.II distribution, unlike +the HSL functions. +<br> +(Matthias Maier, 2013/04/01) + +<li> Changed: The TimeDependent::end_sweep function with an argument indicating +the number of threads has been removed. Use the corresponding function without +an argument. Since the argument had a default value, few users will have used +this function. +<br> +(Wolfgang Bangerth, 2013/03/17) + +</ol> + + +<!-- ----------- GENERAL IMPROVEMENTS ----------------- --> + +<a name="general"></a> +<h3>General</h3> + + +<ol> + <li> Improvements on the CMake build system: A Working C (or Fortran) compiler + is now fully optional; Improved support for static linkage with a toggle + "DEAL_II_PREFER_STATIC_LIBS" that will prefer static archives for non system + libraries and "DEAL_II_STATIC_EXECUTABLE" that will switch the complete link + interface to static linkage. + <br> + (Matthias Maier, 2013/07/16) + </li> + + <li> New: various functions for parallel computations got introduced to + make Trilinos and PETSc interfaces similar. Now step-40 can be used with + PETSc or Trilinos with just a few changes. This patch also introduces + better support for block systems in the PETSc interfaces. + <br> + (Timo Heister, 2013/07/15) + </li> + + <li> New: deal.II can now be compiled to 64-bit global dof indices. To turn + this feature on, use the cmake option -DDEAL_II_WITH_64BIT_INDICES=ON. If + PETSc and/or Trilinos are used, they must be compiled to support 64-bit + indices. To write a code that can use 32-bit and 64-bit indices depending on + deal.II compilation option, use types::global_dof_index for all the global + dof indices. + <br> + (Kainan Wang and Bruno Turcksin, 2013/06/05) + </li> + + <li> New: All vector classes now have a member function + <code>locally_owned_elements</code> that returns an index + set indicating which elements of this vector the current + processor owns. + <br> + (Wolfgang Bangerth, 2013/05/24) + </li> + + + <li> New: A new element FE_Q_iso_Q1 has been implemented that is defined by + a subdivision of the element into smaller Q1 elements. An element of order + @p p is similar to FE_Q of degree @p p with the same numbering of degrees of + freedom. The element is useful e.g. for defining a sparser preconditioner + matrix for AMG at higher order FE_Q elements or for representing a component + of a system of PDEs where higher resolution is preferred over high order. + <br> + (Martin Kronbichler, 2013/05/14) + </li> + + <li> New: The step-49 tutorial program now also has a discussion on + what to do once you have a coarse mesh and want to refine it. + <br> + (Wolfgang Bangerth, 2013/04/03) + </li> + + <li> New: The number of threads used by deal.II/TBB can now be limited at + run time. Using MPI based code using PETSc/Trilinos no longer requires you + to compile the library without threads. See MPI_InitFinalize and + MultithreadInfo::set_thread_limit for details. + <br> + (Timo Heister, 2013/03/26) + </li> + + <li> New: The results section of step-36 now explains how to use ARPACK + as an alternative to SLEPc as eigenvalue solver. + <br> + (Juan Carlos Araujo Cabarcas, 2013/03/25) + </li> + + <li> New: deal.II now uses <a href="http://www.cmake.org/">CMake</a> + as its configuration and build tool. Please read through the + readme and other installation files for information about how the + installation process has changed. + <br> + Because this touches the configuration of every external package we + interact with, there are a number of other changes as a result: + <ul> + <li>The minimum supported version for Trilinos is now 10.8.x. + <li>We no longer link with different versions of the p4est library + in debug and optimized mode. Rather, we now link with the same + library in both modes. The p4est installation instructions have + been updated. + </ul> + <br> + (Matthias Maier, 2013/03/07) + </li> +</ol> + + +<!-- ----------- SPECIFIC IMPROVEMENTS ----------------- --> + +<a name="specific"></a> +<h3>Specific improvements</h3> + +<ol> + +<li>New: VectorTools::project and a whole host of similar functions +are now also available for objects of type hp::DoFHandler. +<br> +(Wolfgang Bangerth, 2013/07/21) +</li> + +<li>Fixed: hp::DoFHandler::n_boundary_dofs() had a bug that always led +to a failed assertion. This is now fixed. +<br> +(Wolfgang Bangerth, 2013/07/21) +</li> + +<li>Fixed: VectorTools::project has an option to first project onto the +boundary. However, the implementation of this option ignored the mapping +that is provided to the function. This is now fixed. +<br> +(Wolfgang Bangerth, 2013/07/16) +</li> + +<li>Improved: The WorkStream class used throughout deal.II is now using +thread local variables and initializes temporary variables on the thread +that uses them, leading to better cache locality. +<br> +(Wolfgang Bangerth, 2013/07/16) +</li> + +<li>Improved: The "pure" functions in MeshWorker::LocalIntegrator are now implemented and throw +an exception if not overloaded. +<br> +(Guido Kanschat, 2013/07/16) +</li> + +<li> New: The function SparseDirectUMFPACK::Tvmult is now implemented. +<br> +(Matthias Maier, 2013/07/03) +</li> + +<li> New: In addition to the FEValuesExtractors::Scalar, +FEValuesExtractors::Vector, and FEValuesExtractors::SymmetricTensor classes, +there are now also fully featured FEValuesExtractors::Tensor extractors +for non-symmetric tensors of rank 2. +<br> +(Denis Davydov, 2013/07/02) +</li> + +<li> New: There are now functions Tensor::component_to_unrolled_index() +and Tensor::unrolled_to_component_indices() in the same way as they +already exist for the SymmetricTensor class. +<br> +(Denis Davydov, 2013/07/02) +</li> + +<li> New: There is now a read-write version of TableIndices::operator[]. +<br> +(Denis Davydov, 2013/07/02) +</li> + +<li> New: The function parallel::distributed::Triangulation::copy_triangulation() is +now implemented. +<br> +(Martin Steigemann, 2013/07/02) +</li> + +<li> New: TriaRawIterator::operator < (TriaRawIterator&) now implements a total ordering +relation for cells even on distributed::parallel::Triangulation across processors. +Additionally, TriaRawAccessor and CellAccessor now have an ordering relation. +<br> +(Guido Kanschat, 2013/06/24) +</li> + +<li> New: CellAccessor::id() that returns a unique CellId that +also works in parallel computations (where level and index is not +useful). +<br> +(Timo Heister, 2013/06/24) +</li> + +<li> New: added ConstantTensorFunction<rank, dim> and ZeroTensorFunction<rank, dim> to provide +a tensor valued analogue to ConstantFunction and ZeroFunction. +<br> +(Matthias Maier, 2013/06/20) +</li> + +<li> Fixed: BlockSparsityPattern::column_number was returning +wrong values. +<br> +(Timo Heister, 2013/06/16) +</li> + +<li> Fixed: The stabilization parameter for the artificial diffusion +in the step-31 tutorial program has been increased slightly to avoid +instabilities at later times (<i>t</i> > 60). +<br> +(Martin Kronbichler, 2013/06/04) +</li> + +<li> Fixed: If an exception was generated on a task created by +Threads::new_task, the program would terminate with a segmentation +fault, leaving little trace of what had happened. This is now handled +more gracefully. +<br> +(Wolfgang Bangerth, 2013/06/02) +</li> + +<li> Changed: subdomain ids can now only be queried/set on active cells. +Consequently, is_artificial(), is_ghost(), and is_locally_owned() is +now restricted to active cells. +<br> +(Timo Heister, 2013/05/31) +</li> + +<li> Improved: Triangulation::begin(level) and Triangulation::end(level) now return an +empty iterator range if the level is larger than the maximal locally owned level, +but still in the global level range of a distributed Triangulation. +<br> +(Timo Heister and Guido Kanschat, 2013/05/26) +</li> + +<li> New: The IndexSet::add_indices function that takes another IndexSet +object now has an additional argument <code>offset</code> that can be used +to offset the indices of first argument. +<br> +(Wolfgang Bangerth, 2013/05/25) +</li> + +<li> New: ConstraintMatrix::distribute is now also implemented for +arguments of type PETScWrappers::MPI::BlockVector. +<br> +(Wolfgang Bangerth, 2013/05/25) +</li> + +<li> Fixed: IndexSet::operator== returned the wrong results +in some cases. +<br> +(Wolfgang Bangerth, 2013/05/25) +</li> + +<li> New: The global function <code>complete_index_set()</code> +creates and returns an index set of given size that contains +every single index with this range. +<br> +(Wolfgang Bangerth, 2013/05/24) +</li> + +<li> New: All vector classes now have a static member variable +<code>supports_distributed_data</code> that indicates whether the +vector class supports data that is distributed across multiple +processors. This variable is provided as a <i>traits variable</i> +to allow generic algorithms working on general vector types to +query the capabilities of the vector class at compile time. +<br> +(Wolfgang Bangerth, 2013/05/23) +</li> + +<li> Fixed: FETools::back_interpolate has been revised to work correctly +also with parallel::distributed::Vector. +<br> +(Martin Steigemann, 2013/05/23) +</li> + +<li> Removed: The file <code>mesh_worker/vector_info.h</code> was unused and +untested. It has thus been removed. +<br> +(Wolfgang Bangerth, Guido Kanschat, 2013/05/21) +</li> + +<li> Fixed: The method parallel::distributed::Vector::compress +(VectorOperation::insert) previously set the elements of ghost elements +unconditionally on the owning processor, even if they had not been touched. +This led to a problem in certain library functions where vector entries became +zero in a spurious way. This is now fixed by discarding the elements in ghost +entries for the VectorOperation::insert operation. This is legitimate since we +assume consistency of set elements across processors, so the owning processor +sets the element already. +<br> +(Martin Kronbichler, 2013/05/21) +</li> + +<li> Improved: DoFTools::make_periodicity_constraints now also works +for meshes where the refinement level of the two sides of the domain +is not the same, i.e., one side is more refined than the other. +<br> +(Wolfgang Bangerth, 2013/05/20) +</li> + +<li> Improved: Through the fields DataOutBase::VtkFlags::time and +DataOutBase::VtkFlags::cycle, it is now possible to encode the time and/or +cycle within a nonlinear or other iteration in VTK and VTU files written +via DataOutBase::write_vtk and DataOutBase::write_vtu. +<br> +(Wolfgang Bangerth, 2013/05/12) +</li> + +<li> Fixed: The method ConvergenceTable::evaluate_convergence_rates with + reference column did not take the dimension of the reference column into + account, leading to wrong logarithmic rates for dim!=2. This can now be fixed + by specifying the dimension as a last argument. +<br> +(Martin Kronbichler, 2013/05/10) +</li> + +<li> Improved: The functions MatrixTools::create_mass_matrix and +MatrixTools::create_laplace_matrix take now an optional ConstraintMatrix +argument that allows to directly apply the constraints. This also helps +VectorTools::project. Note that not providing constraints remains the default +and recommended way to ensure consistency when several matrices are combined. +<br> +(Martin Kronbichler, 2013/05/08) +</li> + +<li> New: The classes TrilinosWrappers::SparseMatrix and +TrilinosWrappers::BlockSparseMatrix now fully implement vmult and Tvmult with +deal.II's own vector classes Vector<double> and +parallel::distributed::Vector<double>. +<br> +(Martin Kronbichler, 2013/05/08) +</li> + +<li> Improved: The matrix-vector product ChunkSparseMatrix::vmult now runs in +parallel in shared memory. +<br> +(Martin Kronbichler, 2013/05/07) +</li> + +<li> New: The class ChunkSparseMatrix and the associated +ChunkSparsityPattern now offer iterator classes to iterate over rows of the +matrix in an STL-like way. +<br> +(Martin Kronbichler, 2013/05/07) +</li> + +<li> Fixed: The stopping criterion for early exit in SolverBicgstab did not +work properly for systems with large values, leading to premature exit. This +is now fixed. +<br> +(Martin Kronbichler, 2013/05/07) +</li> + +<li> Changed: The SolverGMRES implementation previously applied two +iterations of the modified Gram&ndash;Schmidt algorithm for +orthogonalization. In many situations one iteration is enough. The algorithm +can now detect loss of orthogonality and enables re-orthogonalization only if +necessary. The second iteration (and, hence, old behavior) can be forced by +the flag SolverGMRES::AdditionalData::force_re_orthogonalization. +<br> +(Martin Kronbichler, 2013/05/06) +</li> + +<li> Changed: FETools::interpolate is now instantiated for all +vector types, not just dealii::Vector and dealii::BlockVector. +<br> +(Wolfgang Bangerth, 2013/05/06) +</li> + +<li> Fixed: setting values in TrilinosWrappers::SparseMatrix +in parallel was adding the values instead. +<br> +(Bruno Turcksin, Timo Heister, 2013/05/03) +</li> + +<li> Fixed: Generate an error if the user tries to refine a cell +that is already on the maximum level in a distributed triangulation. +<br> +(Timo Heister, 2013/05/01) +</li> + +<li> Fixed: The version of ParameterHandler::set that takes a boolean +as second argument was broken and did not work. This is now fixed. +<br> +(Ashkan Dorostkar, Wolfgang Bangerth, 2013/04/30) +</li> + +<li> Fixed: PETScWrappers::VectorBase::print now saves and restores +the precision +and width associated with the stream it prints to around setting +the values passed as arguments. +<br> +(Fahad Alrashed, 2013/04/22) +</li> + +<li> Fixed: FullMatrix::print now saves and restores the precision +and width associated with the stream it prints to around setting +the values passed as arguments. +<br> +(Fahad Alrashed, 2013/04/22) +</li> + +<li> New: LogStream now has member functions LogStream::width, +LogStream::precision and LogStream::flags that make it look more +like normal objects of type <code>std::ostream</code>. +<br> +(Fahad Alrashed, 2013/04/22) +</li> + +<li> New: SparseDirectUMFPACK has long had the ability to work with +BlockSparseMatrix objects, but couldn't deal with BlockVector objects. +This is now fixed. +<br> +(Wolfgang Bangerth, 2013/04/21) +</li> + +<li> New: Class TimerOutput::Scope does automatic scope based enter/ +exit_section of a TimerOutput object. +<br> +(Timo Heister, 2013/04/18) +</li> + +<li> Fixed: TimerOutput constructed with an MPI_COMM in wall_time +mode now constructs synchronized Timer objects. This gives reliable +parallel benchmark timings. +<br> +(Timo Heister, 2013/04/18) +</li> + +<li> Improved and Fixed: LogStream (and deallog) now respect std::flush in +addition to std::endl to write out content to the console/file. +Furthermore, LogStream::push(...) and LogStream::pop() now work in a thread +safe manner. Also allow to pop() the prefix "DEAL". +<br> +(Matthias Maier, 2013/04/18) +</li> + +<li> Fixed: The HalfHyperShellBoundary class got refining +the edges that sit at the perimeter of the circular face of the domain +wrong. This is now fixed. +<br> +(Wolfgang Bangerth, J&ouml;rg Frohne, 2013/04/17) +</li> + +<li> New: Functions::FEFieldFunction can now deal with +parallel::distributed::Triangulation objects. +<br> +(Wolfgang Bangerth, 2013/04/15) +</li> + +<li> New: There is now a version of SparseMatrix::copy_from that can copy +from TrilinosWrappers::SparseMatrix. +<br> +(Wolfgang Bangerth, J&ouml;rg Frohne, 2013/04/15) +</li> + +<li> Improved: The SolverCG implementation now uses only three auxiliary +vectors, down from previously four. Also, there are some shortcuts in case +PreconditionIdentity is used that improve the solver's performance. +<br> +(Martin Kronbichler, 2013/04/11) +</li> + +<li> Fixed: The results section of step-23 did not show the movie in release 7.3 +due to a poor HTML markup. This is now fixed. +<br> +(Wolfgang Bangerth, 2013/04/10) +</li> + +<li> Fixed: It is now possible to use the MeshWorker framework in 1d as well. +<br> +(Wolfgang Bangerth, Scott Miller, 2013/04/09) +</li> + +<li> Fixed: It was not possible to create a default-constructed object of +type Triangulation<1>::face_iterator. This is now fixed. +<br> +(Wolfgang Bangerth, Scott Miller, 2013/04/09) +</li> + +<li> New: VectorTools::subtract_mean_value can now be called without a +boolean mask. The vector type is templatified and instantiated for all +non distributed vectors. +<br> +(Matthias Maier, 2013/04/08) +</li> + +<li> Fixed: It is now possible to call ConvergenceTable::evaluate_convergence_rates +multiple times. +<br> +(Matthias Maier, 2013/04/08) +</li> + +<li> Fixed: GridTools::distort_random (previously called Triangulation::distort_random) +had a bug where points were only ever moved in <i>positive</i> coordinate +directions rather than with uniform probability in either direction. The 1d +implementation also had the problem that it did not move vertices if the +<i>cell</i> they were on was at the boundary, even if the <i>vertex</i> +itself was not. All of these problems are now fixed. +<br> +(Wolfgang Bangerth, 2013/04/05) +</li> + +<li> New: There is a class VectorFunctionFromTensorFunction that converts +between objects of type TensorFunction and Function. +<br> +(Spencer Patty, 2013/4/2) +</li> + +<li> Fixed: The ParameterHandler class could not deal with parameters named +<code>"value"</code> (and a few other names). This is now fixed. +<br> +(Denis Davydov, Matthias Maier, Wolfgang Bangerth, 2013/3/31) +</li> + +<li> Changed: TimerOutput no longer assumes that sections are not nested +when outputting percentage and total run time. +<br> +(Timo Heister, 2013/3/28) +</li> + +<li> New: MPI_InitFinalize can also initialize PETSc/Slepc when +not compiling with MPI. This is now the preferred way to initialize +MPI/PETSc/Slepc in all cases. +<br> +(Timo Heister, 2013/3/26) +</li> + +<li> Added/fixed: IterativeInverse::vmult() can now handle vectors +using a different number type than the matrix type. As usual, the +number types must be compatible. Addtitionally, the initial guess is +always set to zero, since starting with the incoming vector makes no +sense. +<br> +(Guido Kanschat, 2013/03/21) +</li> + +<li> Added GridOut::write_svg() to allow for the output of +two-dimensional triangulations in two space dimensions in the SVG +format (Scalable Vector Graphics, an generic XML-based vector image +format developed and maintained by the World Wide Web Consortium W3C). +This function also provides cell coloring and cell labeling for the +visualization of basic cell properties. Pespective view is further +possible and the cell level number may be converted into altitude, +revealing the inactive cells lying below. +<br> +(Christian Wülker, 2013/03/21) +</li> + +<li> Added TimerOutput::reset to remove the collected information so far and +added a new frequency TimerOutput::never to only output information if +triggered by print_summary(). +<br> +(Timo Heister, 2013/03/20) +</li> + +<li> Changed: FEValuesExtractors::Scalar, FEValuesExtractors::Vector and +FEValuesExtractors::SymmetricTensor could not be default constructed, and +consequently one could not easily put them into arrays (where they would +be default constructed when changing the size, and later assigned useful +values). These classes can now be default constructed to invalid +values, but can of course not be used in any useful way. +<br> +(Wolfgang Bangerth, 2013/03/15) +</li> + +<li> Fixed: FETools::interpolation_difference did not work with PETSc. +This is now fixed. +<br> +(Timo Heister, 2013/03/01) +</li> + +</ol> + + +*/ diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index dfb20d925c..16257eeffb 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -1,9 +1,9 @@ /** - * @page changes_after_7_3 Changes after Version 7.3 +// * @page changes_after_8_0 Changes after Version 8.0 <p> This is the list of changes made after the release of -deal.II version 7.3.0. +deal.II version 8.0.0. All entries are signed with the names of the authors. </p> @@ -24,43 +24,25 @@ inconvenience this causes. </p> <ol> + <li> + Removed: The member function face_to_equivalent_cell_index() in + FiniteElementData has been removed. It had been deprecated a while + back already. Please use FiniteElement::face_to_cell_index() instead. + <br> + (Wolfgang Bangerth, 2013/08/09) + </li> -<li> Removed: it was possible to call get_dof_indices(), get_dof_values(), -set_dof_values(), and distribute_local_to_global() for cells that were not -active, if the finite element only had DoFs on vertices (i.e. Q1). This is -no longer allowed. -<br> -(Timo Heister, 2013/06/02) - -<li> Changed: Internal structures of ExceptionBase are now thread safe. The -Assert macro does not print an exception to deallog any more prior to -throwing if deal_II_exceptions::abort_on_exception==false. Removed: A -number of obsolete Exceptions that are not used in the library any more. -<br> -(Matthias Maier, 2013/04/16) - -<li> Removed: A number of header files that have been deprecated a long time -ago have been removed. All of them had previously only included the header file -that had superseded them. To upgrade, simply include the currently used -header file. This is also backward compatible with deal.II 7.3. -<br> -(Guido Kanschat, 2013/04/12) - -<li> Removed: The interfaces to the obsolete direct solvers MA27 and MA47 from -the Harwell Subroutine Library. Support for the HSL routines were not ported to -the new build system. However, the sparse direct solver UMFPACK remains to be -supported and is provided as part of the standard deal.II distribution, unlike -the HSL functions. -<br> -(Matthias Maier, 2013/04/01) - -<li> Changed: The TimeDependent::end_sweep function with an argument indicating -the number of threads has been removed. Use the corresponding function without -an argument. Since the argument had a default value, few users will have used -this function. -<br> -(Wolfgang Bangerth, 2013/03/17) - + <li> + Changed: The typedefs DataOut::cell_iterator and + DataOut::active_cell_iterator were previously defined as + DoFHandler::(active)_cell_iterator, while they are now + Triangulation::(active)_cell_iterator. This is necessary to support DataOut + on multiple DoFHandler objects. This affects possible overloading of + DataOut::next_cell(cell_iterator). Use the typedef + DataOut::(active)_cell_iterator as argument type instead. + <br> + (Martin Kronbichler, 2013/07/24) + </li> </ol> @@ -71,459 +53,361 @@ this function. <ol> - <li> New: deal.II can now be compiled to 64-bit global dof indices. To turn - this feature on, use the cmake option -DDEAL_II_WITH_64BIT_INDICES=ON. If - PETSc and/or Trilinos are used, they must be compiled to support 64-bit - indices. To write a code that can use 32-bit and 64-bit indices depending on - deal.II compilation option, use types::global_dof_index for all the global - dof indices. + <li> + Fixed: The DataOutBase::XDMFEntry class now has a proper serialization + function to allow for checkpointing. + <br> + (Eric Heien, 2013/09/27) + </li> + + <li> + New: DataOutBase::DataOutFilter provides a way to remove duplicate vertices + and values from a solution vector when generating output. Currently it only + supports HDF5/XDMF output. <br> - (Kainan Wang and Bruno Turcksin, 2013/06/05) + (Eric Heien, 2013/09/27) </li> - <li> New: All vector classes now have a member function - <code>locally_owned_elements</code> that returns an index - set indicating which elements of this vector the current - processor owns. + <li> + Removed: DataOutBase::HDF5MemStream was removed and the functionality replaced + by DataOutBase::DataOutFilter. The user only manipulates these through + DataOutBase::write_hdf5_parallel so this change should be transparent. <br> - (Wolfgang Bangerth, 2013/05/24) + (Eric Heien, 2013/09/27) </li> + <li> + New: Like the usual DoFHandler class, the hp::DoFHandler class now also + has a cache that makes operations such as <code>cell-@>get_dof_indices(...)</code> + faster. This should accelerate many parts of the library that deal with + hp finite elements. + <br> + (Wolfgang Bangerth, 2013/09/10) + </li> - <li> New: A new element FE_Q_iso_Q1 has been implemented that is defined by - a subdivision of the element into smaller Q1 elements. An element of order - @p p is similar to FE_Q of degree @p p with the same numbering of degrees of - freedom. The element is useful e.g. for defining a sparser preconditioner - matrix for AMG at higher order FE_Q elements or for representing a component - of a system of PDEs where higher resolution is preferred over high order. + <li> + New: parallel::distributed::Triangulation now supports periodic boundaries. + DoFTools::make_periodicity_constraints and similar functions are now working + on parallel::distributed::Triangulation objects. <br> - (Martin Kronbichler, 2013/05/14) + (Tobin Isaac, Craig Michoski, Daniel Arndt, 2013/09/06) </li> - <li> New: The step-49 tutorial program now also has a discussion on - what to do once you have a coarse mesh and want to refine it. + <li> + New: It is now possible to compile and link deal.II against LLVM's libcxx. For + this, a few issues with C++ standard violations are resolved. <br> - (Wolfgang Bangerth, 2013/04/03) + (Matthias Maier, 2013/08/09) </li> +</ol> + + +<!-- ----------- SPECIFIC IMPROVEMENTS ----------------- --> + +<a name="specific"></a> +<h3>Specific improvements</h3> - <li> New: The number of threads used by deal.II/TBB can now be limited at - run time. Using MPI based code using PETSc/Trilinos no longer requires you - to compile the library without threads. See MPI_InitFinalize and - MultithreadInfo::set_thread_limit for details. +<ol> + <li> + Fixed: ConstraintMatrix would not compress() the IndexSet in the constructor + leading to crashes that only happen in release mode. This is now fixed. <br> - (Timo Heister, 2013/03/26) + (Timo Heister, 2013/09/27) </li> - <li> New: The results section of step-36 now explains how to use ARPACK - as an alternative to SLEPc as eigenvalue solver. + <li> + Fixed: PetscWrappers::MatrixBase::row_length() no longer worked after recent changes + to PETSc (around PETSc release 3.4). This is now fixed. <br> - (Juan Carlos Araujo Cabarcas, 2013/03/25) + (Wolfgang Bangerth, 2013/09/24) </li> - <li> New: deal.II now uses <a href="http://www.cmake.org/">CMake</a> - as its configuration and build tool. Please read through the - readme and other installation files for information about how the - installation process has changed. + <li> + New: Added write_visit_record that allows writing .visit files with multiple blocks + and multiple time steps. <br> - Because this touches the configuration of every external package we - interact with, there are a number of other changes as a result: - <ul> - <li>The minimum supported version for Trilinos is now 10.8.x. - <li>We no longer link with different versions of the p4est library - in debug and optimized mode. Rather, we now link with the same - library in both modes. The p4est installation instructions have - been updated. <blink>TODO TODO TODO</blink> - </ul> + (Fahad Alrashed, 2013/09/21) + </li> + + <li> + Changed: GridTools::have_same_coarse_mesh was only instantiated for + MGDoFHandler arguments in debug mode. This is now fixed. <br> - (Matthias Maier, 2013/03/07) + (Timo Heister, 2013/09/20) </li> -</ol> + <li> + Changed: GridTools::find_active_cell_around_point now throws the exception + GridTools::ExcPointNotFound + if the point is outside the Triangulation. This exception can be caught. + <br> + (Timo Heister, 2013/09/18) + </li> -<!-- ----------- SPECIFIC IMPROVEMENTS ----------------- --> + <li> + Changed: we now call MPI_Init_thread instead of MPI_Init. + <br> + (Timo Heister, 2013/09/17) + </li> -<a name="specific"></a> -<h3>Specific improvements</h3> + <li> + Enhancement: It is now possible to use the build directory directly without + the need to install first. For this, a second copy of all necessary project + configuration files (deal.IIConfig.cmake, ..., Make.global_options) are + generated and deployed in the build directory. (This is fully compatible with + the old possibility to install into the build dir.) + <br> + (Matthias Maier, 2013/09/15) + </li> -<ol> -<li> Fixed: The stabilization parameter for the artificial diffusion -in the step-31 tutorial program has been increased slightly to avoid -instabilities at later times (<i>t</i> > 60). -<br> -(Martin Kronbichler, 2013/06/04) -</li> - -<li> Fixed: If an exception was generated on a task created by -Threads::new_task, the program would terminate with a segmentation -fault, leaving little trace of what had happened. This is now handled -more gracefully. -<br> -(Wolfgang Bangerth, 2013/06/02) -</li> - -<li> Changed: subdomain ids can now only be queried/set on active cells. -Consequently, is_artificial(), is_ghost(), and is_locally_owned() is -now restricted to active cells. -<br> -(Timo Heister, 2013/05/31) -</li> - -<li> Improved: Triangulation::begin(level) and Triangulation::end(level) now return an -empty iterator range if the level is larger than the maximal locally owned level, -but still in the global level range of a distributed Triangulation. -<br> -(Timo Heister and Guido Kanschat, 2013/05/26) -</li> - -<li> New: The IndexSet::add_indices function that takes another IndexSet -object now has an additional argument <code>offset</code> that can be used -to offset the indices of first argument. -<br> -(Wolfgang Bangerth, 2013/05/25) -</li> - -<li> New: ConstraintMatrix::distribute is now also implemented for -arguments of type PETScWrappers::MPI::BlockVector. -<br> -(Wolfgang Bangerth, 2013/05/25) -</li> - -<li> Fixed: IndexSet::operator== returned the wrong results -in some cases. -<br> -(Wolfgang Bangerth, 2013/05/25) -</li> - -<li> New: The global function <code>complete_index_set()</code> -creates and returns an index set of given size that contains -every single index with this range. -<br> -(Wolfgang Bangerth, 2013/05/24) -</li> - -<li> New: All vector classes now have a static member variable -<code>supports_distributed_data</code> that indicates whether the -vector class supports data that is distributed across multiple -processors. This variable is provided as a <i>traits variable</i> -to allow generic algorithms working on general vector types to -query the capabilities of the vector class at compile time. -<br> -(Wolfgang Bangerth, 2013/05/23) -</li> - -<li> Fixed: FETools::back_interpolate has been revised to work correctly -also with parallel::distributed::Vector. -<br> -(Martin Steigemann, 2013/05/23) -</li> - -<li> Removed: The file <code>mesh_worker/vector_info.h</code> was unused and -untested. It has thus been removed. -<br> -(Wolfgang Bangerth, Guido Kanschat, 2013/05/21) -</li> - -<li> Fixed: The method parallel::distributed::Vector::compress -(VectorOperation::insert) previously set the elements of ghost elements -unconditionally on the owning processor, even if they had not been touched. -This led to a problem in certain library functions where vector entries became -zero in a spurious way. This is now fixed by discarding the elements in ghost -entries for the VectorOperation::insert operation. This is legitimate since we -assume consistency of set elements across processors, so the owning processor -sets the element already. -<br> -(Martin Kronbichler, 2013/05/21) -</li> - -<li> Improved: DoFTools::make_periodicity_constraints now also works -for meshes where the refinement level of the two sides of the domain -is not the same, i.e., one side is more refined than the other. -<br> -(Wolfgang Bangerth, 2013/05/20) -</li> - -<li> Improved: Through the fields DataOutBase::VtkFlags::time and -DataOutBase::VtkFlags::cycle, it is now possible to encode the time and/or -cycle within a nonlinear or other iteration in VTK and VTU files written -via DataOutBase::write_vtk and DataOutBase::write_vtu. -<br> -(Wolfgang Bangerth, 2013/05/12) -</li> - -<li> Fixed: The method ConvergenceTable::evaluate_convergence_rates with - reference column did not take the dimension of the reference column into - account, leading to wrong logarithmic rates for dim!=2. This can now be fixed - by specifying the dimension as a last argument. -<br> -(Martin Kronbichler, 2013/05/10) -</li> - -<li> Improved: The functions MatrixTools::create_mass_matrix and -MatrixTools::create_laplace_matrix take now an optional ConstraintMatrix -argument that allows to directly apply the constraints. This also helps -VectorTools::project. Note that not providing constraints remains the default -and recommended way to ensure consistency when several matrices are combined. -<br> -(Martin Kronbichler, 2013/05/08) -</li> - -<li> New: The classes TrilinosWrappers::SparseMatrix and -TrilinosWrappers::BlockSparseMatrix now fully implement vmult and Tvmult with -deal.II's own vector classes Vector<double> and -parallel::distributed::Vector<double>. -<br> -(Martin Kronbichler, 2013/05/08) -</li> - -<li> Improved: The matrix-vector product ChunkSparseMatrix::vmult now runs in -parallel in shared memory. -<br> -(Martin Kronbichler, 2013/05/07) -</li> - -<li> New: The class ChunkSparseMatrix and the associated -ChunkSparsityPattern now offer iterator classes to iterate over rows of the -matrix in an STL-like way. -<br> -(Martin Kronbichler, 2013/05/07) -</li> - -<li> Fixed: The stopping criterion for early exit in SolverBicgstab did not -work properly for systems with large values, leading to premature exit. This -is now fixed. -<br> -(Martin Kronbichler, 2013/05/07) -</li> - -<li> Changed: The SolverGMRES implementation previously applied two -iterations of the modified Gram&ndash;Schmidt algorithm for -orthogonalization. In many situations one iteration is enough. The algorithm -can now detect loss of orthogonality and enables re-orthogonalization only if -necessary. The second iteration (and, hence, old behavior) can be forced by -the flag SolverGMRES::AdditionalData::force_re_orthogonalization. -<br> -(Martin Kronbichler, 2013/05/06) -</li> - -<li> Changed: FETools::interpolate is now instantiated for all -vector types, not just dealii::Vector and dealii::BlockVector. -<br> -(Wolfgang Bangerth, 2013/05/06) -</li> - -<li> Fixed: setting values in TrilinosWrappers::SparseMatrix -in parallel was adding the values instead. -<br> -(Bruno Turcksin, Timo Heister, 2013/05/03) -</li> - -<li> Fixed: Generate an error if the user tries to refine a cell -that is already on the maximum level in a distributed triangulation. -<br> -(Timo Heister, 2013/05/01) -</li> - -<li> Fixed: The version of ParameterHandler::set that takes a boolean -as second argument was broken and did not work. This is now fixed. -<br> -(Ashkan Dorostkar, Wolfgang Bangerth, 2013/04/30) -</li> - -<li> Fixed: PETScWrappers::VectorBase::print now saves and restores -the precision -and width associated with the stream it prints to around setting -the values passed as arguments. -<br> -(Fahad Alrashed, 2013/04/22) -</li> - -<li> Fixed: FullMatrix::print now saves and restores the precision -and width associated with the stream it prints to around setting -the values passed as arguments. -<br> -(Fahad Alrashed, 2013/04/22) -</li> - -<li> New: LogStream now has member functions LogStream::width, -LogStream::precision and LogStream::flags that make it look more -like normal objects of type <code>std::ostream</code>. -<br> -(Fahad Alrashed, 2013/04/22) -</li> - -<li> New: SparseDirectUMFPACK has long had the ability to work with -BlockSparseMatrix objects, but couldn't deal with BlockVector objects. -This is now fixed. -<br> -(Wolfgang Bangerth, 2013/04/21) -</li> - -<li> New: Class TimerOutput::Scope does automatic scope based enter/ -exit_section of a TimerOutput object. -<br> -(Timo Heister, 2013/04/18) -</li> - -<li> Fixed: TimerOutput constructed with an MPI_COMM in wall_time -mode now constructs synchronized Timer objects. This gives reliable -parallel benchmark timings. -<br> -(Timo Heister, 2013/04/18) -</li> - -<li> Improved and Fixed: LogStream (and deallog) now respect std::flush in -addition to std::endl to write out content to the console/file. -Furthermore, LogStream::push(...) and LogStream::pop() now work in a thread -safe manner. -<br> -(Matthias Maier, 2013/04/18) -</li> - -<li> Fixed: The HalfHyperShellBoundary class got refining -the edges that sit at the perimeter of the circular face of the domain -wrong. This is now fixed. -<br> -(Wolfgang Bangerth, J&ouml;rg Frohne, 2013/04/17) -</li> - -<li> New: Functions::FEFieldFunction can now deal with -parallel::distributed::Triangulation objects. -<br> -(Wolfgang Bangerth, 2013/04/15) -</li> - -<li> New: There is now a version of SparseMatrix::copy_from that can copy -from TrilinosWrappers::SparseMatrix. -<br> -(Wolfgang Bangerth, J&ouml;rg Frohne, 2013/04/15) -</li> - -<li> Improved: The SolverCG implementation now uses only three auxiliary -vectors, down from previously four. Also, there are some shortcuts in case -PreconditionIdentity is used that improve the solver's performance. -<br> -(Martin Kronbichler, 2013/04/11) -</li> - -<li> Fixed: The results section of step-23 did not show the movie in release 7.3 -due to a poor HTML markup. This is now fixed. -<br> -(Wolfgang Bangerth, 2013/04/10) -</li> - -<li> Fixed: It is now possible to use the MeshWorker framework in 1d as well. -<br> -(Wolfgang Bangerth, Scott Miller, 2013/04/09) -</li> - -<li> Fixed: It was not possible to create a default-constructed object of -type Triangulation<1>::face_iterator. This is now fixed. -<br> -(Wolfgang Bangerth, Scott Miller, 2013/04/09) -</li> - -<li> New: VectorTools::subtract_mean_value can now be called without a -boolean mask. The vector type is templatified and instantiated for all -non distributed vectors. -<br> -(Matthias Maier, 2013/04/08) -</li> - -<li> Fixed: It is now possible to call ConvergenceTable::evaluate_convergence_rates -multiple times. -<br> -(Matthias Maier, 2013/04/08) -</li> - -<li> Fixed: GridTools::distort_random (previously called Triangulation::distort_random) -had a bug where points were only ever moved in <i>positive</i> coordinate -directions rather than with uniform probability in either direction. The 1d -implementation also had the problem that it did not move vertices if the -<i>cell</i> they were on was at the boundary, even if the <i>vertex</i> -itself was not. All of these problems are now fixed. -<br> -(Wolfgang Bangerth, 2013/04/05) -</li> - -<li> New: There is a class VectorFunctionFromTensorFunction that converts -between objects of type TensorFunction and Function. -<br> -(Spencer Patty, 2013/4/2) -</li> - -<li> Fixed: The ParameterHandler class could not deal with parameters named -<code>"value"</code> (and a few other names). This is now fixed. -<br> -(Denis Davydov, Matthias Maier, Wolfgang Bangerth, 2013/3/31) -</li> - -<li> Changed: TimerOutput no longer assumes that sections are not nested -when outputting percentage and total run time. -<br> -(Timo Heister, 2013/3/28) -</li> - -<li> New: MPI_InitFinalize can also initialize PETSc/Slepc when -not compiling with MPI. This is now the preferred way to initialize -MPI/PETSc/Slepc in all cases. -<br> -(Timo Heister, 2013/3/26) -</li> - -<li> Added/fixed: IterativeInverse::vmult() can now handle vectors -using a different number type than the matrix type. As usual, the -number types must be compatible. Addtitionally, the initial guess is -always set to zero, since starting with the incoming vector makes no -sense. -<br> -(Guido Kanschat, 2013/03/21) -</li> - -<li> Added GridOut::write_svg() to allow for the output of -two-dimensional triangulations in two space dimensions in the SVG -format (Scalable Vector Graphics, an generic XML-based vector image -format developed and maintained by the World Wide Web Consortium W3C). -This function also provides cell coloring and cell labeling for the -visualization of basic cell properties. Pespective view is further -possible and the cell level number may be converted into altitude, -revealing the inactive cells lying below. -<br> -(Christian Wülker, 2013/03/21) -</li> - -<li> Added TimerOutput::reset to remove the collected information so far and -added a new frequency TimerOutput::never to only output information if -triggered by print_summary(). -<br> -(Timo Heister, 2013/03/20) -</li> - -<li> Changed: FEValuesExtractors::Scalar, FEValuesExtractors::Vector and -FEValuesExtractors::SymmetricTensor could not be default constructed, and -consequently one could not easily put them into arrays (where they would -be default constructed when changing the size, and later assigned useful -values). These classes can now be default constructed to invalid -values, but can of course not be used in any useful way. -<br> -(Wolfgang Bangerth, 2013/03/15) -</li> - -<li> Fixed: FETools::interpolation_difference did not work with PETSc. -This is now fixed. -<br> -(Timo Heister, 2013/03/01) -</li> - -<li> Added DataOutBase::write_svg() to allow for the output of a given -list of patches in two space dimensions in the SVG format (Scalable Vector -Graphics, an generic XML-based vector image format developed and maintained -by the World Wide Web Consortium W3C). An additional dimension (z-direction) -is employed for the visualization of data values taken from a data vector. -This function also provides patch coloring for the visual enhancement. -<br> -(Christian Wülker, 2013/05/10) -</li> + <li> + Fixed: DoFTools::extract_locally_*_dofs now instantiated for hp::DofHandler. + <br> + (Jean-Paul Pelteret, 2013/09/11) + </li> + + <li> + Changed: distributed::parallel:BlockVector::operator= now allows importing + of ghost values like all other vector types. Also added some new constructors + for BlockVector and Vector using IndexSets to mirror the other linear algebra + classes. + <br> + (Timo Heister, 2013/09/04) + </li> + + <li> + Fixed: VectorTools::compute_no_normal_flux_constraints had a bug that + only manifested on complex meshes. This is now fixed. + <br> + (Chih-Che Chueh, Wolfgang Bangerth, 2013/09/04) + </li> + + <li> + New: All vector classes now have functions <code>extract_subvector_to()</code> + that allow extracting not just a single value but a whole set. + <br> + (Fahad Alrasched, 2013/09/02) + </li> + + <li> + Fixed: <code>common/Make.global_options</code> now exports enable-threads + correctly, furthermore, <code>lib-suffix</code>, <code>shared-lib-suffix</code> + and <code>static-lib-suffix</code> are now exported as well for better legacy + support. + <br> + (Matthias Maier, 2013/08/30) + </li> + + <li> + New: The ParameterHandler class can now deal with including one parameter + file from another. + <br> + (Wolfgang Bangerth, 2013/08/25) + </li> + + <li> + New: The method VectorTools::compute_normal_flux_constraints can be used to + force a vector finite element function to be normal to the boundary. + <br> + (Martin Kronbichler, 2013/08/23) + </li> + <li> + Improved: MappingQ now uses the points of the Gauss-Lobatto quadrature + formula as support points instead of equispaced ones. This allows its use + for high polynomial orders and also gives better interpolation of circular + boundaries. Beware that mappings of order three and higher will behave + slightly differently now (usually better). + <br> + (Martin Kronbichler, 2013/08/23) + </li> + + <li> + Improved: Several .cc files in the deal.II directory have been split in + order to better utilize multiple processors when compiling in parallel and + reduce memory requirements of the compilation stage. + <br> + (Martin Kronbichler, 2013/08/22) + </li> + + <li> + Fixed: The ParameterHandler::declare_entry() did not check that the + default value of a parameter indeed satisfies the pattern given for this + parameter (despite a statement in the documentation that this checking + would happen). This is now fixed. + <br> + (Wolfgang Bangerth, 2013/08/21) + </li> + + <li> + New: Patterns::List and Patterns::Map now accept a string + different than the default comma that denotes the separator + between entries of the list or map. + <br> + (Wolfgang Bangerth, 2013/08/21) + </li> + + <li> + Fixed: Some operations in the MappingQ class are now done in higher + precision arithmetic to mitigate the ill-conditioning that appears + when using mappings of high order (say, order 6 or 8 or 10). + <br> + (Juan Carlos Araujo Cabarcas, 2013/08/20) + </li> + + <li> + Fixed: The SLEPcWrappers classes could not be compiled for 64-bit + indices. This is now fixed. + <br> + (Denis Davydov, Wolfgang Bangerth, 2013/08/20) + </li> + + <li> + Fixed: SolutionTransfer used to crash whenever one transfered in the hp + context between cells that use FE_Nothing and FE_Q. This is now fixed. + <br> + (Krzyszof Bzowski, Wolfgang Bangerth, 2013/08/18) + </li> + + <li> + Fixed: Under some circumstances (see http://code.google.com/p/dealii/issues/detail?id=82) + the DoFTools::make_periodicity_constraints() function could create cycles in + the ConstraintMatrix object. This is now fixed. + <br> + (David Emerson, Wolfgang Bangerth, 2013/08/16) + </li> + + <li> + New: There is now a function ConstraintMatrix::are_identity_constrained(). + <br> + (Wolfgang Bangerth, 2013/08/16) + </li> + + <li> + New: TableHandler::write_text() now also supports output in + org-mode (http://orgmode.org/) format via a new entry in the + TableHandler::TextOutputFormat enumeration. + <br> + (Oleh Krehel, 2013/08/15) + </li> + + <li> + New: There are now global functions <code>scalar_product</code> + that compute the scalar product (double contraction) between + tensors of rank 2. + <br> + (Scott Miller, 2013/08/14) + </li> + + <li> + Fixed: Creating objects of type MappingQ was previously only possible + for low order polynomials. For orders higher than around 6, one ran + into assertions that tested for internal consistency. These assertions + have now been appropriately relaxes for the growth of round-off errors + with growing polynomial degrees. + <br> + (Juan Carlos Araujo Cabarcas, Wolfgang Bangerth, 2013/08/14) + </li> + + <li> + New: MappingQEulerian is now also instantiated for vector elements + of type TrilinosWrappers::Vector as well as the MPI and block + variants. + <br> + (Armin Ghajar Jazi, 2013/08/14) + </li> + + <li> + Fixed: The FiniteElement::face_to_cell_index() function had a bug + that made it work incorrectly for elements that have more than one + degree of freedom per line (in 2d) or per quad (in 3d). This is now + fixed for the most common cases, namely the FE_Q elements as well + as elements composed of FESystem elements. For all other cases, an + exception is generated reporting that this case is not implemented. + If you run into this, let us know. + <br> + (Wolfgang Bangerth, 2013/08/10) + </li> + + <li> + New: DataOutBase::VtkFlags now has a flag + DataOutBase::VtkFlags::print_date_and_time that can be used to suppress output + of date and time in output files. This is useful in test suites where a newer + run at a different time produces differences against previously stored files, + even though the actual data is exactly the same. + <br> + (Oleh Krehel, 2013/08/06) + </li> + + <li> + Fixed: The various block matrix classes are all derived from BlockMatrixBase + which had race conditions when the set() or add() functions were called from + different threads. This is now fixed. + <br> + (Wolfgang Bangerth, 2013/08/05) + </li> + + <li> + Fixed: various fixes with assignment and reinit of PETScWrappers::MPI::Vector. + <br> + (Timo Heister, 2013/08/05) + </li> + + <li>Fixed: An assertion wrongly triggered in + DoFTools::make_hanging_node_constraints when used with a particular + combination of FESystem elements containing FE_Nothing. This is now fixed. + <br> + (Denis Davydov, Wolfgang Bangerth, 2013/08/01) + </li> + + <li> + New: Add has_ghost_elements() for PETScWrappers::MPI::BlockVector and + TrilinosWrappers::MPI::BlockVector. + <br> + (Timo Heister, 2013/08/01) + </li> + + <li> + SparsityTools::distribute_sparsity_pattern did not work correctly for + block systems, this has been fixed (function has a different signature). + <br> + (Timo Heister, 2013/07/31) + </li> + + <li>Fixed: When typing <code>make run</code> in the step-32 directory, + the program was executed with <code>mpirun -np 2 ./step-32</code>. This + assumes that a program <code>mpirun</code> exists, but also does that + deal.II was in fact compiled with MPI support on. Neither was intended. + This is now fixed. + <br> + (Wolfgang Bangerth, 2013/07/24) + </li> + + <li>New: The DataOut, DataOutFaces, and DataOutRotation classes now allow + the output of data vectors using different DoFHandler objects (based on the + same triangulation), by new functions add_data_vector. This is used in the + step-31 tutorial program which avoids creating a joint DoFHandler just for + output. + <br> + (Martin Kronbichler, 2013/07/24) + </li> + + <li>Changed: GridGenerator used to be a class with only static members + but is now a namespace, like all other similar constructs in deal.II. + <br> + (Wolfgang Bangerth, 2013/07/24) + </li> + + <li>Changed: In GridGenerator, several functions had erroneously been changed + to take an argument of type <code>size_type</code> rather than <code>unsigned + int</code>. <code>GridGenerator::size_type</code> was a typedef to + types::global_dof_index, which for most users was <code>unsigned int</code> + anyway, but could also be set to be a 64-bit integer type. In any case, the + change has been reverted and these functions take just a regular + <code>unsigned int</code> again. + <br> + (Wolfgang Bangerth, 2013/07/24) + </li> </ol> diff --git a/deal.II/doc/news/news.html b/deal.II/doc/news/news.html index cb21552703..bd812602cd 100644 --- a/deal.II/doc/news/news.html +++ b/deal.II/doc/news/news.html @@ -32,19 +32,36 @@ <dt><strong>Recent changes</strong></dt> <dd> Changes in the library since the last major release are - <strong><a href="../doxygen/deal.II/changes_after_7_3.html">here.</a></strong> + <strong><a href="../doxygen/deal.II/changes_after_8_0.html">here.</a></strong> </dd> </p> <dl> + <dt> + <strong style="color:red">2013/07/24: Version 8.0 released</strong> + </dt> + <dd> + deal.II version 8.0 was released today. This is a major new + release, featuring the conversion of the configuration and + build system to <a href="http://www.cmake.org/">CMake</a>, + support for parallel computations with more than 4 billion + unknowns, and many more. A full list of changes can be + found <a href="../doxygen/deal.II/changes_between_7_3_and_8_0.html" + target="body">here</a>. + <br> + deal.II can be downloaded at + <a href="https://code.google.com/p/dealii/downloads/list" + target="_top">this site</a>. + </dd> + <dt> <strong>2013/06/05: 64-bit version of deal.II</strong> </dt> <dd> Because the global dof index variables in deal.II were of type - unsigned int, it was not possible to create a dof_handler with more than - 4.3 billions of unknowns. The 64-bit version of deal.II uses unsigned long - long int and thus, allows for 18e18 unknowns. + unsigned int, it was not possible to create a dof_handler with more than + 4.3 billions of unknowns. The 64-bit version of deal.II uses unsigned long + long int and thus, allows for 18e18 unknowns. </dd> @@ -53,7 +70,7 @@ </dt> <dd> After having used Autoconf as the configuration and build system - since the beginning of deal.II in 1997, we have now switch to + since the beginning of deal.II in 1997, we have now switched to <a href="http://www.cmake.org/">CMake</a>. This implementation, contributed by Matthias Maier of Heidelberg University, has taken more than half a year, consists of more than 10,000 lines, and @@ -881,9 +898,6 @@ library that, among much other functionality, offers some sparse direct solvers. We have added support for an interface to these solvers to the library. - (See the <a href="../readme.html#hsl" target="body">ReadMe</a> - file for more information on installation of HSL - subroutines.) </dd> <dt> diff --git a/deal.II/doc/publications/index.html b/deal.II/doc/publications/index.html index 77d0a3a83b..a6f8f87f8c 100644 --- a/deal.II/doc/publications/index.html +++ b/deal.II/doc/publications/index.html @@ -246,6 +246,63 @@ submitted, 2013. </li> + <li> G. Alam + <br> + <strong>Fast iterative solution of large scale statistical + inverse problems + </strong> + <br> + Master Thesis, Stockholm University, 2013. + </li> + + <li> J. C. Araujo-Cabarcas + <br> + <strong>Numerical methods for glacial isostatic adjustment models + </strong> + <br> + MSc thesis, Uppsala University, Uppsala, Sweden, 2013. + </li> + + <li> P. Argul, G. Ruocci, F. Freddi, K. Benzarti + <br> + <strong>An improved damage modelling to deal with the variability of + fracture mechanisms in FRP reinforced concrete structures + </strong> + <br> + International Journal of Adhesion and Adhesives 45 , 7-20, 2013. + </li> + + <li> D. Arndt + <br> + <strong>Augmented Taylor-Hood Elements for Incompressible Flow + </strong> + <br> + Msc thesis, University of G&ouml;ttingen, Germany, 2013. + </li> + + <li> A. Barker, T. Rees, M. Stoll + <br> + <strong>A fast solver for an H<sub>1</sub> regularized + PDE-constrained optimization problem</strong> + <br> + submitted, 2013. + </li> + + <li> S. Bartels, R. H. Nochetto, A. J. Salgado + <br> + <strong>A total variation diminishing interpolation operator + and applications</strong> + <br> + submitted, 2013. + </li> + + <li> P. Benner, M. Stoll + <br> + <strong>Optimal control for Allen-Cahn equations enhanced by model predictive control</strong> + <br> + Preprint, MPI Magdeburg, 2013. + </li> + <li> A. Bonito, R. DeVore, R. H. Nochetto <br> <strong>Adaptive Finite Element Methods for Elliptic Problems with Discontinuous Coefficients</strong> @@ -255,10 +312,25 @@ <li> A. Bonito, I. Kyza, R. H. Nochetto <br> - <strong>A DG approach to higher order ALE formulations in - time</strong> + <strong>A dG Approach to Higher Order ALE Formulations in Time + </strong> <br> - submitted, 2013. + 2012 Barrett Lectures, The IMA Volume in Mathematics and its Applications, Vol. 157, 36 pages, 2013, Springer. + </li> + + <li> A. Bonito, I. Kyza, R. H. Nochetto + <br> + <strong>Time-discrete higher order ALE formulations: A + priori error analysis</strong> + <br> + Numer. Math., 23 pages, 2013, 10.1007/s00211-013-0539-3. + </li> + + <li> A. Bonito, I. Kyza, R. H. Nochetto + <br> + <strong>Time-discrete higher order ALE formulations: Stability</strong> + <br> + SIAM J. Numer. Anal., 51(1), 577--608, 2013. </li> <li> J. Bosch, M. Stoll, P. Benner @@ -270,6 +342,23 @@ Preprint 13/01, MPI Magdeburg, 2013. </li> + <li> J. Bosch, D. Kay, M. Stoll, A. J. Wathen + <br> + <strong>Fast solvers for Cahn-Hilliard inpainting</strong> + <br> + Technical report 1705, The Mathematical Institute, + University of Oxford; submitted, 2013. + </li> + + <li> A. Cangiani, J. Chapman, E. Georgoulis, M. Jensen + <br> + <strong>Implementation of the Continuous-Discontinuous + Galerkin Finite Element Method</strong> + <br> + Numerical Mathematics and Advanced Applications 2011, + pp. 315-322, 2013. + </li> + <li> T. Carraro, J. Joos <br> <strong>Parameter estimation for a reconstructed SOFC @@ -287,6 +376,38 @@ arXiv:1301.6580v0, 2013. </li> + <li> C.-C. Chueh, N. Djilali, W. Bangerth + <br> + <strong>An h-adaptive Operator Splitting Method for + Two-phase Flow in 3D Heterogeneous Porous Media</strong> + <br> + SIAM Journal on Scientific Computing, vol. 35, pp. B149-175, 2013. + </li> + + <li> D. Devaud + <br> + <strong>Adaptive Methods for the Stokes System with Discontinuous Viscosities + </strong> + <br> + MSc thesis, EPFL, 2013. + </li> + + <li> T. Dohnal, W. D&ouml;rfler + <br> + <strong>Coupled Mode Equation Modeling for Out-of-Plane Gap + Solitons in 2D Photonic Crystals</strong> + <br> + Multiscale Modeling and Simulation, vol. 11, pp. 162-191, 2013. + </li> + + <li> I. Donev + <br> + <strong>Time Dependent Finite Element Simulations of a Generalized Oldroyd-B Fluid + </strong> + <br> + MSc Thesis, University of Cape Town, 2013. + </li> + <li> W. D&ouml;rfler, S. Findeisen <br> <strong>Numerical optimization of a waveguide transition @@ -315,6 +436,50 @@ Communications in Computational Physics, accepted, 2013. </li> + <li> E. Emmrich, A. Wr&#243;blewska-Kami&#324;ska + <br> + <strong>Convergence of a Full Discretization of Quasi-linear Parabolic Equations in Isotropic and Anisotropic Orlicz Spaces + </strong> + <br> + SIAM Journal on Numerical Analysis, vol. 51, pp. 1163-1184, 2013. + </li> + + <li> J. Fang, X. Gao, A. Zhou + <br> + <strong>A finite element recovery approach to eigenvalue + approximations with applications to electronic structure + calculations + </strong> + <br> + Journal of Scientific Computing, vol. 55, pp. 432-454, 2013. + </li> + + <li> T. Fankhauser, T. Wihler, M. Wirz + <br> + <strong>The hp-adaptive FEM based on continuous Sobolev embeddings: Isotropic + refinements</strong> + <br> + Computers & Mathematics with Applications (in press), 2013. + </li> + + <li> F. Freddi, G. Royer-Carfagni + <br> + <strong>Plastic flow as an energy minimization problem. Numerical + Experiments + </strong> + <br> + Journal of Elasticity, in press, 2013. + </li> + + <li> A. Geringer, B. Lenhof, S. Diebels + <br> + <strong>Macroscopic modeling of foams: an order-parameter + approach vs. a micropolar model + </strong> + <br> + Technische Mechanik, vol. 33, pp. 87-96, 2013. + </li> + <li> F. Gimbel <br> <strong>Modelling and numerical simulation of contact and lubrication @@ -339,6 +504,28 @@ arXiv:1303.5362, submitted, 2013. </li> + <li> + <a href="http://ganymed.iwr.uni-heidelberg.de/~hartmann/" + target="_top">R. Hartmann</a> + <br> + <strong>Higher-order and adaptive discontinuous Galerkin + methods with shock-capturing applied to transonic turbulent + delta wing flow + </strong> + <br> + International Journal for Numerical Methods in Fluids, + vol. 72, pp. 883-894, 2013. + </li> + + <li> T. Heister, G. Rapin + <br> + <strong>Efficient augmented Lagrangian-type preconditioning + for the Oseen problem using Grad-Div stabilization</strong> + <br> + Int. J. Num. Meth. Fluids, 71, 118–134, 2013 + (<a href="http://dx.doi.org/10.1002/fld.3654">DOI</a>) + </li> + <li> M. Hinze, U. Mathes <br> <strong>Model order reduction for networks of ODE and PDE systems @@ -349,6 +536,36 @@ pp 92-101, 2013. </li> + <li> S. Joshi, J, Walton + <br> + <strong>Reconstruction of the residual stresses in a hyperelastic body using ultrasound techniques + </strong> + <br> + International Journal on Engineering Science, vol. 70, + pp. 46-72, 2013. + </li> + + <li> S. Kim + <br> + <strong>Analysis of the convected Helmholtz equation with a + uniform mean flow in a waveguide with complete radiation + boundary conditions + </strong> + <br> + Journal of Mathematical Analysis and Applications, + in press, + <!-- http://www.sciencedirect.com/science/article/pii/S0022247X1300749X --> + 2013. + </li> + + <li> N. Klein + <br> + <strong>Consistent FE-Analysis of elliptic Variational Inequalities + </strong> + <br> + PhD thesis, University of Siegen, Germany, 2013. + </li> + <li> T. Kr&uuml;ger <br> <strong>Regularization-based fictitious domain methods @@ -357,6 +574,26 @@ PhD thesis, University of Siegen, Germany, 2013. </li> + <li> K. Kumar, M.F. Wheeler, T. Wick + <br> + <strong>Reactive flow in a thin channel +and reaction-induced boundary movement in +a monolithic ALE framework + </strong> + <br> + submitted to SISC, 2013. + </li> + + <li> B. Lenhof, A. Geringer, S. Diebels + <br> + <strong>Macroscopic modeling of size effects in foams using + an order parameter + </strong> + <br> + Generalized Continua as Models for Materials, + Advanced Structured Materials, vol. 22, pp. 237-254, 2013. + </li> + <li> S. H. Lim <br> <strong>Numerical Simulation of Two-phase Heat Flow and Transient @@ -366,6 +603,24 @@ Undergraduate honors thesis, University of Michigan, Ann Arbor, 2013. </li> + <li> A. Mikelic, M.F. Wheeler, T. Wick + <br> + <strong>A phase field approach to the fluid filled fracture surrounded by a poroelastic medium + </strong> + <br> + submitted, ICES preprint on http://www.ices.utexas.edu/research/reports/ + </li> + + <li> A. Mola, L. Heltai, A. DeSimone + <br> + <strong>A stable and adaptive semi-Lagrangian potential + model for unsteady and nonlinear ship-wave + interactions</strong> + <br> + Engineering Analysis with Boundary Elements, vol. 37, + pp. 128-143, 2013. + </li> + <li> R. H. Nochetto, A. J. Salgado, I. Tomas <br> <strong>The micropolar Navier-Stokes equations: A priori error analysis</strong> @@ -373,6 +628,31 @@ arXiv:1303.7005, submitted, 2013. </li> + <li> T. Povall + <br> + <strong>Single Crystal Plasticity at Finite Strains: A Computational Investigation of Hardening Relations</strong> + <br> + MSc Thesis, University of Cape Town, 2013. + </li> + + <li> T. Reis, W. Wollner + <br> + <strong>Iterative solution of operator Lyapunov equations + arising in heat transfer + </strong> + <br> + 2013 European Control Conference, Zurich Switzerland, + pp. 41-46, 2013. + </li> + + <li> T. Richter, T. Wick + <br> + <strong>Optimal Control and Parameter Estimation for Stationary Fluid-Structure Interaction Problems + </strong> + <br> + SISC, accepted in May, 2013. + </li> + <li> S. Roy, L. Heltai, D. Drapaca, F. Costanzo <br> <strong>An immersed finite element method approach for brain biomechanics</strong> @@ -398,6 +678,40 @@ (eds.), Spinger Verlag, pp. 293-303, 2013. </li> + <li> M. Sagebaum, N. R. Gauger, U. Naumann, J. Lotz, K. Leppkes + <br> + <strong>Algorithmic differentiation of a complex C++ code with underlying libraries + </strong> + <br> + Procedia Computer Science, vol. 18, pp. 208-217, 2013. + </li> + + <li> P. Siehr + <br> + <strong>Stabilisierungsmethoden für die Stokes-Gleichungen + </strong> + <br> + Bachelor thesis, University of Heidelberg, Germany, 2013. + </li> + + <li> + M. Steigemann, B. Schramm + <br> + <strong>Precise computation and error control of stress + intensity factors and certain integral characteristics in + anisotropic inhomogeneous materials + </strong> + <br> + International Journal of Fracture, vol. 182, pp. 67-91, 2013. + </li> + + <li> M. Stoll, T. Breiten + <br> + <strong>A low-rank in time approach to PDE-constrained optimization</strong> + <br> + Max Planck Institute Magdeburg, Preprint MPIMD/13-08, 2013. + </li> + <li> N. Vakulin, R. Shaw, T. Livingston <br> <strong>ELEC 490, final report: High performance computing with GPUs @@ -407,6 +721,88 @@ 2013 </li> + <li> A. Vidal-Ferrandiz, R. Fayez, D. Ginestar, G. Verd&uacute; + <br> + <strong>Solution of the Lambda modes problem of a nuclear + power reactor using an h-p finite element method + </strong> + <br> + Conference abstract, Mathematical Modelling in Engineering & + Human Behaviour 2013, 2013. + </li> + + <li> T. Wick, A. H. Elsheikh, M.F. Wheeler + <br> + <strong>Parameter Estimation for the Coupled Biot-Lam\'e-Navier Problem in Subsurface Modeling + </strong> + <br> + ARMA Conference in San Francisco, Jun 23-26, 2013. + </li> + + <li> J. Weinbub, K. Rupp, S. Selberherr + <br> + <strong>ViennaX: a parallel plugin execution framework for + scientific computing + </strong> + <br> + Engineering with Computers, DOI 10.1007/s00366-013-0314-1, February 2013. + </li> + + <li> T. Wick + <br> + <strong>Flapping and Contact FSI Computations with the + Fluid-Solid Interface-Tracking/Interface-Capturing Technique + and Mesh Adaptivity + </strong> + <br> + Comp. Mech., DOI: 10.1007/s00466-013-0890-3, 2013. + </li> + + <li> T. Wick + <br> + <strong>Coupling of fully Eulerian and arbitrary Lagrangian-Eulerian + methods for fluid-structure interaction computations + </strong> + <br> + Comp. Mech., DOI: 10.1007/s00466-013-0866-3, 2013. + </li> + + <li> T. Wick + <br> + <strong>Solving monolithic fluid-structure interaction + problems in arbitrary + Lagrangian Eulerian coordinates + with the deal.II library + </strong> + <br> + ANS, vol. 1, pp. 1-19, 2013. http://www.archnumsoft.org/ + </li> + + <li> T. Wick + <br> + <strong>Fully Eulerian fluid-structure interaction for time-dependent problems + </strong> + <br> + Comp. Methods Appl. Mech. Engrg., vol. 255, pp. 14-26, 2013. + </li> + + <li> J. Willems + <br> + <strong>Robust Multilevel Solvers for High-Contrast Anisotropic + Multiscale Problems + </strong> + <br> + Journal of Computational and Applied Mathematics, 251:47-60, 2013, doi:10.1016/j.cam.2013.03.030. + </li> + + <li> J. Willems + <br> + <strong>Spectral Coarse Spaces in Robust Two-Level Schwartz Methods + </strong> + <br> + O. Iliev, S. Margenov, P. Minev, P. Vassilevski, L. Zikatanov, editors, Numerical Solution of Partial Differential Equations: Theory, Algorithms and their Applications, 303-326, Springer Proceedings in Mathematics & Statistics, Springer, 2013. + </li> + <li> S. Yoon, Y. T. Kang <br> <strong>Mass transfer enhancement in non-Brownian particle @@ -416,6 +812,15 @@ pp. 114-124, 2013. </li> + <li> <a href="http://www.ippt.gov.pl/~tyoung" + target="_top">T. D. Young</a> + <br> + <strong>A finite basis grid analysis of the Hartree-Fock wavefunction method for one- and two-electron atoms + </strong> + <br> + AIP Conf. Proc., Accepted, 2013. + </li> + <li> <a href="http://www.ippt.gov.pl/~tyoung" target="_top">T. D. Young</a>, E. Romero, J. E. Roman <br> @@ -479,21 +884,6 @@ <!-- http://www-m1.ma.tum.de/bin/view/Lehrstuhl/PublikationenUlbrich --> </li> - <li> A. Bonito, I. Kyza, R. H. Nochetto - <br> - <strong>Time-discrete higher order ALE formulations: a - priori error analysis</strong> - <br> - Numer. Math., to appear, 2012. - </li> - - <li> A. Bonito, I. Kyza, R. H. Nochetto - <br> - <strong>Time-discrete higher order ALE formulations: stability</strong> - <br> - SIAM J. Numer. Anal., to appear, 2012. - </li> - <li> M. Braack, G. Lube, L. R&ouml;he <br> @@ -533,16 +923,6 @@ PhD Thesis, Karlsruhe Institute of Technology (KIT), 2012. </li> - <li> A. Cangiani, J. Chapman, E. Georgoulis, M. Jensen - <br> - <strong>Implementation of the Continuous-Discontinuous - Galerkin Finite Element Method</strong> - <br> - arXiv:1201.2878v1 [math.NA], 2012. - <!-- http://www2.le.ac.uk/departments/mathematics/extranet/staff-material/staff-profiles/eg64/publications --> - <!-- http://arxiv.org/abs/1201.2878 --> - </li> - <li> A. Cangiani, J. Chapman, E. Georgoulis, M. Jensen <br> <strong>On Local Super-Penalization of Interior Penalty Discontinuous Galerkin Methods</strong> @@ -589,15 +969,6 @@ Electrochimica Acta, Volume 77, pp. 309-314, 2012. </li> - <li> C.-C. Chueh, N. Djilali, W. Bangerth - <br> - <strong>An h-adaptive Operator Splitting Method for - Two-phase Flow in 3D Heterogeneous Porous Media</strong> - <br> - Preprint, Institute for Applied Mathematics and - Computational Science, Texas A&amp;M University, 2012. - </li> - <li> A. Demlow, A. H. Georgoulis <br> <strong>Pointwise a posteriori error control for @@ -615,14 +986,6 @@ Journal of the Electrochemical Society, 159(5), B1-B10, 2012. </li> - <li> T. Dohnal, W. D&ouml;rfler - <br> - <strong>Coupled Mode Equation Modeling for Out-of-Plane Gap - Solitons in 2D Photonic Crystals</strong> - <br> - arXiv:1202.3583v1 [nlin.PS], 2012. - </li> - <li> Y. Efendiev, J. Galvis, R. Lazarov, J. Willems <br> <strong>Robust domain decomposition preconditioners for abstract @@ -652,17 +1015,6 @@ Journal of Computational Physics, vol. 231, pp. 3166–3180, 2012. </li> - <li> J. Fang, X. Gao, A. Zhou - <br> - <strong>A finite element recovery approach to eigenvalue - approximations with applications to electronic structure - calculations - </strong> - <br> - Journal of Scientific Computing, in press, 2012. - <!-- http://link.springer.com/article/10.1007/s10915-012-9640-5?LI=true# --> - </li> - <li> T. Fankhauser <br> <strong>An hp-adaptive strategy based on smoothness @@ -717,6 +1069,15 @@ Submitted to ACM Trans. Math. Softw., 2011. </li> + <li> C. Goll, T. Wick, W. Wollner + <br> + <strong>DOpElib: Differential Equations and Optimization Environment; +A Goal Oriented Software Library for Solving PDEs and Optimization Problems with PDEs + </strong> + <br> + submitted in Dec 2012. + </li> + <li> N. Gupta, N. Nataraj <br> <strong>A posteriori error estimates for an optimal control @@ -753,15 +1114,6 @@ Springer. In press. </li> - <li> T. Heister, G. Rapin - <br> - <strong>Efficient augmented Lagrangian-type preconditioning - for the Oseen problem using Grad-Div stabilization</strong> - <br> - Int. J. Num. Meth. Fluids, 2013, 71, 118–134. - (<a href="http://dx.doi.org/10.1002/fld.3654">DOI</a>) - </li> - <li> L. Heltai, S. Roy, F. Costanzo <br> <strong>A Fully Coupled Immersed Finite Element Method for @@ -865,15 +1217,6 @@ Journal of the Mechanics and Physics of Solids, vol. 60, pp. 1221-1239, 2012. </li> - <li> A. Mola, L. Heltai, A. DeSimone - <br> - <strong>A stable and adaptive semi-Lagrangian potential - model for unsteady and nonlinear ship-wave - interactions</strong> - <br> - arXiv:1203.3384v1 [math.NA], 2012. - </li> - <li> C. Neuen, M. Griebel, J. Hamaekers <br> <strong>Multiscale simulation of ion migration for battery system @@ -1046,30 +1389,24 @@ 50<sup>th</sup> AIAA Aerospace Sciences Meeting, AIAA 2012-458, 2012. </li> - <li> J. Willems - <br> - <strong>Robust multilevel methods for general symmetric positive - definite operators - </strong> - <br> - RICAM Report 2012-06, 2012. - </li> - <li> J. Willems - <br> - <strong>Robust multilevel methods for high-contrast anisotropic - multiscale problems - </strong> + <li> T. Wick + <br> + <strong>Goal-oriented mesh adaptivity for fluid-structure interaction with application to heart-valve settings + </strong> <br> - RICAM Report 2012-07, 2012. - </li> + Arch. Mech. Engrg., vol. 59, pp. 73-99, 2012. + </li> + + <li> J. Willems <br> - <strong>Spectral coarse spaces in robust two-level methods + <strong>Robust multilevel methods for general symmetric positive + definite operators </strong> <br> - RICAM Report 2012-20, 2012. + RICAM Report 2012-06, 2012. </li> <li> S. Yoon, M. A. Walkley, O. G. Harlen @@ -1624,15 +1961,6 @@ Comp. Geosc., vol. 15, pp. 647-659, 2011. </li> - <li> T. Wick - <br> - <strong>Fluid-Structure Interaction based on Monolithic Variational - Formulations with Different Types of Pseudo-Structure Extension - </strong> - <br> - submitted, 2010 - </li> - <li> T. Wick <br> <strong>Fluid-structure interactions using different mesh motion techniques @@ -1641,15 +1969,6 @@ Computers and Structures, vol. 89, pp. 1456-1467, 2011. </li> - <li> T. Wick - <br> - <strong>Solving Monolithic Fluid-Structure Interaction Problems in - Arbitrary Lagrangian Eulerian Coordinates with the deal.II Library - </strong> - <br> - IWR Report, University of Heidelberg, Germany, 2011. - </li> - <li> T. Wick <br> <strong>Adaptive finite element simulation of fluid-structure @@ -2222,16 +2541,6 @@ Diploma Thesis, University of Heidelberg, Germany, 2010 </li> - <li> - T. Wick - <br> - <strong>Monolithic Fluid-Structure Interaction Modelling for - a Long Axis Heart Valve Simulation - </strong> - <br> - Preprint, IWR Heidelberg, Germany, 2010 - </li> - <li> <a href="http://www.ippt.gov.pl/~tyoung" target="_top">T. D. Young</a>, R. Armiento <Br> @@ -2671,12 +2980,7 @@ basis </strong> <br> - In George Maroulis and Theodore E. Simos, editors, - Computational Methods in Science and Engineering: Advances in - Computational Science, number 1108, New York, USA, Mar - 2009. Proceedings of the International Conference on Computational - Methods in Sciences and Engineering, American Institute of Physics - Conference Proceedings, 2009. + AIP Conf. Proc., vol. 1148, pp. 285-289 2009. </li> <li> R. Ziegler, B. Brendel, A. Schipper, R. Harbers, M. van Beek, @@ -4709,10 +5013,16 @@ </li> </ol> - <hr> - - <address> - <a href="../mail.html">The deal.II Group</a></address> + <hr /> + <address> + <a href="authors.html" target="body">The deal.II Authors</a> + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> </body> </html> diff --git a/deal.II/doc/readme.html b/deal.II/doc/readme.html index e80ebdac83..5c7ec6dc50 100644 --- a/deal.II/doc/readme.html +++ b/deal.II/doc/readme.html @@ -1,23 +1,25 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>The deal.II Readme</title> - <link href="screen.css" rel="StyleSheet"> - <meta name="author" content="the deal.II authors <authors @ dealii.org>"> - <meta name="copyright" content="Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors"> - <meta name="date" content="$Date$"> - <meta name="svn_id" content="$Id$"> - <meta name="keywords" content="deal.II"> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> + <link href="screen.css" rel="StyleSheet"/> + <meta name="author" content="the deal.II authors &lt;authors@dealii.org&gt;"/> + <meta name="copyright" content="Copyright (C) 1998 - 2013 by the deal.II authors"/> + <meta name="date" content="$Date$"/> + <meta name="svn_id" content="$Id$"/> + <meta name="keywords" content="deal.II"/> </head> <body> <h2 align="center" style="color: red"> - <strong class="red">Note: Current development sources - use <a href="http://www.cmake.org" target="_top">CMake</a> to - build <acronym>deal.II</acronym>. For using the previous build + <strong class="red">Note: <acronym>deal.II</acronym> uses + <a href="http://www.cmake.org" target="_top">CMake</a> to + configure and build. For using the previous build system used until <acronym>deal.II</acronym> version 7.3, see <a href="http://www.dealii.org/7.3.0/readme.html" target="_top">the old ReadMe file</a>. @@ -26,113 +28,112 @@ </h2> - <h1>Installation instructions and further information - on <acronym>deal.II</acronym> </h1> - - <table class="tutorial" width="60%"> - <tr><th colspan="2"><b><small>Table of contents</small></b></th></tr> - <tr><td valign="top"> - <ul> - <li> <a href="#prerequisites">System requirements</a> - <ul> - <li> <a href="#supported">Supported platforms</a> - <li> <a href="#additional-software">Additional software requirements</a> - </ul> - <li> <a href="#installation">Installation</a> - <ul> - <li> <a href="#unpacking">Unpacking</a> - <li> <a href="#configuration">Configuring and building the library</a> - <li> <a href="#documentation">Configuring and building the documentation</a> - <li> <a href="#configuration-options">Configuration options</a> - <ul> - <li> <a href="#optional">Selecting optional behavior</a> - <li> <a href="#optional-software">Optional interfaces to - other software packages</a> - <li> <a href="#conf-details">More information on configuring - and building the library</a> - </ul> - </ul> - <li> <a href="#problems">Problems, questions, mailing lists</a> - <li> <a href="#license">License</a> - </ul> - </td> - </tr> - </table> - - - <a name="prerequisites"></a> - <h2>System requirements</h2> - - <a name="supported"></a> - <h3>Supported platforms</h3> - - <p> - <acronym>deal.II</acronym> is mostly developed on Linux using the - <a href="http://gcc.gnu.org">GCC</a> compiler. However, it is not - platform specific and we strive to keep the source code C++ - Standard compliant. - </p> - - <p> - <acronym>deal.II</acronym> supports at least the following - platforms: - <ul> - <li>GNU/Linux: GCC version 4.0 or later; - Clang version 3.0 or later; ICC version 12 or later - <li>Mac OS X: GCC version 4.0 or later; Clang version 3.0 or later - (Please see the <a href="https://code.google.com/p/dealii/w/list" - target="_top">deal.II Wiki</a> for installation issues) - <li>Windows: <a href="http://www.cygwin.com" - target="_top">Cygwin</a> with recent GCC or Clang versions. - Native Windows support with recent <a - href="http://www.mingw.org/">MinGW</a> compiler. For <a - href="https://code.google.com/p/dealii/wiki/Windows" - target="_top">installing on Windows</a>, please refer to - additional information on the <a - href="https://code.google.com/p/dealii/w/list" +<h1>Installation instructions and further information + on <acronym>deal.II</acronym> </h1> + +<div class="toc"> + <ol> + <li> <a href="#prerequisites">System requirements</a> + <ol> + <li> <a href="#supported">Supported platforms</a></li> + <li> <a href="#additional-software">Additional software requirements</a></li> + </ol> + </li> + <li> <a href="#installation">Installation</a> + <ol> + <li> <a href="#unpacking">Unpacking</a></li> + <li> <a href="#configuration">Configuring and building the library</a></li> + <li> <a href="#documentation">Configuring and building the documentation</a></li> + <li> <a href="#configuration-options">Configuration options</a> + <ol> + <li> <a href="#optional">Selecting optional behavior</a></li> + <li> <a href="#optional-software">Optional interfaces to + other software packages</a></li> + <li> <a href="#conf-details">More information on configuring + and building the library</a></li> + </ol> + </li> + </ol> + </li> + <li> <a href="#problems">Problems, questions, mailing lists</a></li> + <li> <a href="#license">License</a></li> + </ol> +</div> + +<a name="prerequisites"/> +<h2>System requirements</h2> + +<a name="supported"/> +<h3>Supported platforms</h3> + +<p> + <acronym>deal.II</acronym> is mostly developed on Linux using the + <a href="http://gcc.gnu.org">GCC</a> compiler. However, it is not + platform specific and we strive to keep the source code C++ Standard + compliant. +</p> + +<p> + <acronym>deal.II</acronym> supports at least the following + platforms: +</p> +<ul> + <li>GNU/Linux: GCC version 4.0 or later; + Clang version 3.0 or later; ICC version 12 or later</li> + <li>Mac OS X: GCC version 4.0 or later; Clang version 3.0 or later + (Please see the <a href="https://code.google.com/p/dealii/w/list" + target="_top">deal.II Wiki</a> for installation issues)</li> + <li>Windows: <a href="http://www.cygwin.com" + target="_top">Cygwin</a> with recent GCC or Clang versions. + Native Windows support with recent + <a href="http://www.mingw.org/">MinGW</a> compiler. + For <a href="https://code.google.com/p/dealii/wiki/Windows" + target="_top">installing on Windows</a>, please refer to + additional information on the <a href="https://code.google.com/p/dealii/w/list" target="_top">deal.II Wiki</a> and have a look at the <a href="https://code.google.com/p/dealii/issues/list">bug - tracker</a>! - </ul> - Most other combinations of POSIX-style operating systems and C++ - Standard compliant compilers should also work. <i>If they don't, - please report it as a bug.</i> - </p> + tracker</a>!</li> +</ul> +<p> + Most other combinations of POSIX-style operating systems and C++ + Standard compliant compilers should also work. <i>If they don't, + please report it as a bug.</i> +</p> - <p> - Please note that the Microsoft Visual C++ compiler, that is widely - used on Microsoft Windows, is not supported. If you need a native - Windows target, use the MinGW compiler instead. - </p> +<p> + Please note that the Microsoft Visual C++ compiler, that is widely + used on Microsoft Windows, is not supported. If you need a native + Windows target, use the MinGW compiler instead. +</p> - <a name="additional-software"></a> - <h3>Additional software requirements</h3> +<a name="additional-software"></a> +<h3>Additional software requirements</h3> <p> In order to compile and use <acronym>deal.II</acronym> you need to have the following programs installed: </p> <ul> - <li> <p> - <a href="http://www.cmake.org/" target="_top">CMake</a> version 2.8.8 or later - </p> - - <li> <p> - <a href="http://www.gnu.org/software/make/" target="_top">GNU make</a>, version - 3.78 or later (or any other generator supported by CMake) - </p> + <li> + <a href="http://www.cmake.org/" target="_top">CMake</a> version 2.8.8 or later + </li> + + <li> + <a href="http://www.gnu.org/software/make/" target="_top">GNU make</a>, version + 3.78 or later (or any other generator supported by CMake) + </li> - <li> <p> - For generating the documentation: - <a href="http://www.perl.org/" target="_top">Perl 5.x</a>, - <a href="http://www.doxygen.org/" target="_top">doxygen</a> - and <code>dot</code>, which is part of the - <a href="http://www.graphviz.org" target="_top">GraphViz</a> - package - </p> + <li> + For generating the documentation: + <a href="http://www.perl.org/" target="_top">Perl 5.x</a>, + <a href="http://www.doxygen.org/" target="_top">doxygen</a> + and <code>dot</code>, which is part of the + <a href="http://www.graphviz.org" target="_top">GraphViz</a> + package + </li> - <li> <p> + <li> For debugging programs, we have found that the <a href="http://www.gnu.org/software/gdb/" target="_top">GNU debugger GDB</a> is an invaluable tool. GDB is a text-based tool @@ -142,21 +143,22 @@ like <a href="http://www.kdevelop.org/" target="_top">kdevelop</a> or <a href="http://eclipse.org/" target="_top">Eclipse</a> have built in debuggers as well. - </p> + </li> <li> <p> - The library generates output in formats readable by - <a href="http://www.ucc.ie/gnuplot/gnuplot-faq.html" target="_top">GNUPLOT</a>, - <a href="http://www-xdiv.lanl.gov/XCM/gmv/" target="_top">GMV - (general mesh viewer)</a>, - <a href="http://www.amtec.com" target="_top">Tecplot</a> (ASCII and binary), - <a href="http://public.kitware.com/VTK/" - target="_top">Visualization Toolkit (Vtk)</a>, - <a href="http://www.avs.com" target="_top">AVS Explorer</a>, - <a href="http://www.opendx.org" target="_top">Open DX</a>, - <a href="http://www.povray.org" target="_top">Povray</a>, - and directly to Encapsulated Postscript. - </p> + The library generates output in formats readable by + <a href="http://www.ucc.ie/gnuplot/gnuplot-faq.html" target="_top">GNUPLOT</a>, + <a href="http://www-xdiv.lanl.gov/XCM/gmv/" target="_top">GMV + (general mesh viewer)</a>, + <a href="http://www.amtec.com" target="_top">Tecplot</a> (ASCII and binary), + <a href="http://public.kitware.com/VTK/" + target="_top">Visualization Toolkit (Vtk)</a>, + <a href="http://www.avs.com" target="_top">AVS Explorer</a>, + <a href="http://www.opendx.org" target="_top">Open DX</a>, + <a href="http://www.povray.org" target="_top">Povray</a>, + and directly to Encapsulated Postscript. + </p> + <p> <code>gnuplot</code> and a postscript viewer (for <code>eps</code>) should be @@ -179,37 +181,35 @@ converted into output (without references to cells, nodes, types of finite elements, and the like). </p> + </li> </ul> - - - - <a name="installation"></a> + <a name="installation"/> <h2>Installation</h2> - - <a name="unpacking"></a> + + <a name="unpacking"/> <h3>Unpacking</h3> <p> The whole library usually comes as a <code>tar.gz</code> file, which is a file archive compressed with gzip. After downloading it, unpack it using either - <pre> - - gunzip deal.II-X.Y.Z.tar.gz - tar xf deal.II-X.Y.Z.tar - </pre> - or, if you have GNU tar with - <pre> - - tar -xvf deal.II-X.Y.Z.tar.gz - </pre> - <b>Note:</b> You will want to hang on to the source files - of <acronym>deal.II</acronym> after installation as it makes developing - much simpler. Consequently, you should do the steps above in a permanent - directory, not on <code>/tmp</code> as one often does when installing - software. </p> +<pre> + gunzip deal.II-X.Y.Z.tar.gz + tar xf deal.II-X.Y.Z.tar +</pre> +<p>or, if you have GNU tar with</p> +<pre> + tar -xvf deal.II-X.Y.Z.tar.gz +</pre> + +<p><b>Note:</b> You will want to hang on to the source files + of <acronym>deal.II</acronym> after installation as it makes + developing much simpler. Consequently, you should do the steps above + in a permanent directory, not on <code>/tmp</code> as one often does + when installing software. +</p> <a name="configuration"></a> <h3>Configuring and building the library</h3> @@ -219,38 +219,45 @@ <a href="http://www.cmake.org/" target="_top">CMake</a> integrated configuration and build system. Unpacking will create a subdirectory <tt>deal.II/</tt> in the current directory. Then do the - following steps: - <pre> - - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=/path/install/dir ../deal.II - make - make install - </pre> - These steps compile, link and install the deal.II library. The - whole process should take between a few minutes and an hour, depending - on your machine. - </p> + following steps:</p> + +<pre> + mkdir build + cd build + cmake -DCMAKE_INSTALL_PREFIX=/path/to/install/dir ../deal.II + make install +</pre> + +<p> + These steps compile, link and install the deal.II library. The + whole process should take between a few minutes and an hour, depending + on your machine. +</p> <p> - <b>Note:</b> + <b>Note:</b></p> <ul> - <li> <code>/path/install/dir</code> is the directory which deal.II + <li> <code>/path/to/install/dir</code> is the directory which deal.II should be installed into. This can be a directory in your home directory (e.g., <code>~/bin/deal.II</code>) or a directory - such as <code>/usr/local</code> if you have root privileges. + such as <code>/usr/local</code> if you have root privileges. + Another option is to use something like <code>`pwd`/../installed/</code> (note the + backticks). Make sure the installation directory is not the same + as the location where you unpacked <tt>deal.II/</tt>. + </li> <li> If your machine has multiple processors, use <code>make - -jN</code> in the last two steps, where <code>N</code> is the + -jN</code> in the last step, where <code>N</code> is the number of simultaneous build processes you want <code>make</code> to use at any given time. Allowing <code>make</code> to use more simultaneous build processes (assuming you have that many processor cores) will greatly lower the build time. + </li> <li> If you do not intend to modify the <acronym>deal.II</acronym> sources and recompile things, then you can remove the <code>build/</code> directory after the last step. + </li> <li> In principle, after installing <acronym>deal.II</acronym>, you can remove the source directory as well (i.e., the directory into @@ -260,10 +267,12 @@ files around anyway, for one reason: When debugging you often end up with assertions for which you'd like to see the place in the library's source files that triggered it. + </li> <li> The <acronym>deal.II</acronym> <code>CMake</code> system can accept a significant number of configuration parameters. See the discussion <a href="#configuration-options">below</a>. + </li> <li> If you are changing part of the <acronym>deal.II</acronym> code itself, you can re-compile the library using only the @@ -274,41 +283,41 @@ However, this sometimes leads to surprising results and you may not get exactly what you were hoping for. For more information, see <a href="development/cmake.html">here</a>. - + </li> </ul> - </p> <p> The commands above build and install the <acronym>deal.II</acronym> libraries in two variants: - <ul> - <li> - <p><i>Debug mode</i>: This version of the - library is compiled with compiler flags so - that the library contains information that can be used by debuggers. - </p> - - <p> - In addition, this library contains a great number of safety - checks on most arguments of all functions you could possibly call. - These assertions have proven to be an - invaluable means to finding programming bugs since they will - almost always abort your program if something goes wrong. In our - experience, more than ninety per cent of all errors are invalid - parameters (such as vectors having the wrong size, etc.) and they - are usually found almost instantaneously, displaying the file - name and line number of where the problem occurred. - </p> - + </p> + <ul> + <li> + <p><i>Debug mode</i>: This version of the + library is compiled with compiler flags so + that the library contains information that can be used by debuggers. + </p> + + <p> + In addition, this library contains a great number of safety + checks on most arguments of all functions you could possibly call. + These assertions have proven to be an + invaluable means to finding programming bugs since they will + almost always abort your program if something goes wrong. In our + experience, more than ninety per cent of all errors are invalid + parameters (such as vectors having the wrong size, etc.) and they + are usually found almost instantaneously, displaying the file + name and line number of where the problem occurred. + </p> + </li> + <li> <i>Optimized mode</i>: You will want to link with this version of the library once you know that your program is working as expected. It does not contain the safety checks any more and is compiled with aggressive compiler optimizations. The resulting executables are smaller and will run between 2 and 10 times faster than the debug executables. - </p> + </li> </ul> - </p> <p> At this point, you have generated everything necessary to write @@ -325,17 +334,20 @@ be found at the <a href="http://www.dealii.org/" target="_top"> http://www.dealii.org/</a> domain can also be generated locally. To do so, invoke <code>cmake</code> in the build instructions above as follows: - <pre> - - cmake -DDEAL_II_COMPONENT_DOCUMENTATION=ON -DCMAKE_INSTALL_PREFIX=/path/install/dir ../deal.II - </pre> - For this to succeed, you will need <a href="http://www.perl.org/" - target="_top">Perl 5.x</a>, - <a href="http://www.doxygen.org/" target="_top">doxygen</a> - and <code>dot</code> (which is part of - the <a href="http://www.graphviz.org" target="_top">GraphViz</a> - package) to be installed. </p> + +<pre> + cmake -DDEAL_II_COMPONENT_DOCUMENTATION=ON -DCMAKE_INSTALL_PREFIX=/path/install/dir ../deal.II +</pre> + +<p> + For this to succeed, you will need <a href="http://www.perl.org/" + target="_top">Perl 5.x</a>, + <a href="http://www.doxygen.org/" target="_top">doxygen</a> + and <code>dot</code> (which is part of + the <a href="http://www.graphviz.org" target="_top">GraphViz</a> + package) to be installed. +</p> <p> Upon calling <code>make</code> and <code>make install</code>, this will @@ -364,7 +376,7 @@ paths.</b> However, this behavior can be changed using command line switches to the initial call to <code>cmake</code>. A detailed description - can be found <a href="development/cmake.html">here</a>. + can be found here: <a href="development/cmake.html">Detailed build system description</a>. </p> <p> @@ -372,8 +384,8 @@ options. </p> - <a name="optional"> - <h4>Selecting optional behavior</h4></a> + <a name="optional"/> + <h4>Selecting optional behavior</h4> <ul> <li> @@ -386,6 +398,7 @@ threading off by passing the <code>-DDEAL_II_WITH_THREADS=OFF</code> argument to <code>cmake</code>. </p> + </li> <li> <p> @@ -397,6 +410,7 @@ specifically do not want to use it, then pass <code>-DDEAL_II_WITH_MPI=OFF</code>. </p> + </li> <li> <p> @@ -414,11 +428,30 @@ <code>-DDEAL_II_COMPONENT_PARAMETER_GUI=ON</code>. Beware of the fact that <code>parameter_gui</code> needs development packages for Qt. </p> + </li> + + <li> + <p> + <i>64bit indices</i>: By default, deal.II use unsigned int (32bit) + indices for degrees of freedom, using + the <code>types::global_dof_index</code> type. This limits the number of + unknowns to approximately four + billions. If larger problem must be solved, pass the + <code>-DDEAL_II_WITH_64BIT_INDICES=ON</code> argument to + <code>cmake</code>. You will not be able to solve problems of this size on + a single machine, but only when using clusters of computers and linear + algebra packages PETSc or Trilinos. + To use this option with PETSc, PESTc must be compiled + with the option <code>--with-64-bit-indices</code>. To use this option + with Trilinos, Trilinos 11.2 or later is needed (there is a bug in + Trilinos 11.0 that prevents the use of 64bit indices). + </p> + </li> </ul> - <a name="optional-software"></a> + <a name="optional-software"/> <h4>Optional interfaces to other software packages</h4> <p> @@ -440,8 +473,7 @@ can be configured. </p> - <p> - <b>Notes:</b> + <p><b>Notes:</b></p> <ul> <li> <b>The majority of libraries mentioned below should be readily @@ -450,6 +482,7 @@ e.g. ending in <code>-dev</code> or <code>-devel</code>. After that <code>cmake</code> will automatically find the library and use it.</b> + </li> <li> Configuring the interface to a self compiled package, say <code>foo</code> can usually be done by specifying @@ -460,17 +493,18 @@ you invoke <code>cmake</code> in a fresh build directory. Any value passed on the command line wins over a value that may be found in an environment variable. + </li> <li> To explicitly enable or disable support for a library <code>foo</code> use the argument <code>-DDEAL_II_WITH_FOO=ON</code> resp. <code>-DDEAL_II_WITH_FOO=OFF</code> for <code>cmake</code>. + </li> </ul> - </p> <dl> - <a name="ARPACK"></a> - <dt><a href="http://www.caam.rice.edu/software/ARPACK/" target="_top">ARPACK</a></dt> + <dt><a name="ARPACK"/> + <a href="http://www.caam.rice.edu/software/ARPACK/" target="_top">ARPACK</a></dt> <dd> <p> <a href="http://www.caam.rice.edu/software/ARPACK/" @@ -478,7 +512,7 @@ scale eigenvalue problems. <a href="http://www.caam.rice.edu/software/ARPACK/" target="_top">ARPACK</a> should be readily packaged by most Linux distributions. - (Don't forget to install a develpment version of the library). + (Don't forget to install a development version of the library). To use a self compiled version, specify <code>-DARPACK_DIR=/path/to/arpack</code> on the command line. @@ -487,8 +521,8 @@ </p> </dd> - <a name="blas"></a> <dt> + <a name="blas"></a> <a href="http://www.netlib.org/blas/" target="_top">BLAS</a>, <a href="http://www.netlib.org/lapack/" target="_top">LAPACK</a> </dt> @@ -502,7 +536,7 @@ matrices. Both libraries should be packaged by almost all Linux distributions and found automatically whenever available. - (You might have to install develpment versions of the libraries + (You might have to install development versions of the libraries for <acronym>deal.II</acronym> being able to use them). For details on how to set up <acronym>deal.II</acronym> with a non standard BLAS/LAPACK implementation, see the @@ -511,8 +545,10 @@ </p> </dd> - <a name="functionparser"></a> - <dt><a href="http://warp.povusers.org/FunctionParser/">FunctionParser</a></dt> + <dt> + <a name="functionparser"></a> + <a href="http://warp.povusers.org/FunctionParser/">FunctionParser</a> + </dt> <dd> <p> <a href="http://warp.povusers.org/FunctionParser/">FunctionParser</a> @@ -529,8 +565,8 @@ </p> </dd> - <a name="HDF5"></a> - <dt><a href="http://www.hdfgroup.org/HDF5/">HDF5</a></dt> + + <dt><a name="HDF5"></a><a href="http://www.hdfgroup.org/HDF5/">HDF5</a></dt> <dd> <p> The <a href="http://www.hdfgroup.org/HDF5/">HDF5 library</a> @@ -538,14 +574,14 @@ format. <a href="http://www.hdfgroup.org/HDF5/">HDF5</a> should be readily packaged by most Linux distributions. (Don't forget - to install a develpment version of the library). + to install a development version of the library). To use a self compiled version, specify <code>-DHDF5_DIR=/path/to/hdf5</code> on the command line. </p> </dd> - <a name="metis"></a> - <dt><a href="http://glaros.dtc.umn.edu/gkhome/metis/metis/overview" + + <dt><a name="metis"></a><a href="http://glaros.dtc.umn.edu/gkhome/metis/metis/overview" target="_top">METIS</a></dt> <dd> <p> @@ -567,8 +603,8 @@ </p> </dd> - <a name="mumps"></a> - <dt><a href="http://mumps.enseeiht.fr" target="_top">MUMPS</a></dt> + + <dt><a name="mumps"></a><a href="http://mumps.enseeiht.fr" target="_top">MUMPS</a></dt> <dd> <p> <a href="http://mumps.enseeiht.fr" target="_top">MUMPS</a> @@ -577,7 +613,7 @@ across nodes of a cluster. <a href="http://mumps.enseeiht.fr" target="_top">MUMPS</a> should be readily packaged by most Linux distributions. - (Don't forget to install a develpment version of the library). + (Don't forget to install a development version of the library). To use a self compiled version, provide the <code>-DMUMPS_DIR=/path/to/mumps</code> argument to <code>cmake</code>. For a detailed description on how to compile MUMPS (and @@ -586,24 +622,23 @@ </p> </dd> - <a name="netcdf"></a> - <dt><a href="http://www.unidata.ucar.edu/software/netcdf/" target="_top">NetCDF</a></dt> + + <dt><a name="netcdf"></a><a href="http://www.unidata.ucar.edu/software/netcdf/" target="_top">NetCDF</a></dt> <dd> - <p> - <a href="http://www.unidata.ucar.edu/software/netcdf/" - target="_top">NetCDF</a> is a library that provides services for - reading and writing mesh data (and many other - things). <acronym>deal.II</acronym> can use it to read meshes via - one of the functions of the <code>GridIn</code> class. - <a href="http://www.unidata.ucar.edu/software/netcdf/" - target="_top">NetCDF</a> should be readily packaged by most - Linux distributions. (Don't forget to install a develpment - version of the library). To use a self compiled version, pass - <code>-DNETCDF_DIR=/path/to/netcdf</code> to <code>cmake</code>. + <a href="http://www.unidata.ucar.edu/software/netcdf/" + target="_top">NetCDF</a> is a library that provides services for + reading and writing mesh data (and many other + things). <acronym>deal.II</acronym> can use it to read meshes via + one of the functions of the <code>GridIn</code> class. + <a href="http://www.unidata.ucar.edu/software/netcdf/" + target="_top">NetCDF</a> should be readily packaged by most + Linux distributions. (Don't forget to install a development + version of the library). To use a self compiled version, pass + <code>-DNETCDF_DIR=/path/to/netcdf</code> to <code>cmake</code>. </dd> - <a name="p4est"></a> - <dt><a href="http://www.p4est.org/" target="_top">p4est</a></dt> + + <dt><a name="p4est"></a><a href="http://www.p4est.org/" target="_top">p4est</a></dt> <dd> <p> <a href="http://www.p4est.org/" target="_top">p4est</a> @@ -618,8 +653,8 @@ </p> </dd> - <a name="petsc"></a> - <dt><a href="http://www.mcs.anl.gov/petsc/" + + <dt><a name="petsc"></a><a href="http://www.mcs.anl.gov/petsc/" target="_top">PETSc</a></dt> <dd> <p> @@ -629,7 +664,7 @@ <a href="http://www.mcs.anl.gov/petsc/" target="_top">PETSc</a> is already packaged by some Linux distributions and should be found automatically if present. (Don't forget to install a - develpment version of the library). To use a self compiled + development version of the library). To use a self compiled version of PETSc, add <code>-DPETSC_DIR=/path/to/petsc -DPETSC_ARCH=architecture</code> to the argument list for <code>cmake</code>. The values for these arguments must be @@ -644,8 +679,8 @@ </p> </dd> - <a name="slepc"></a> - <dt><a href="http://www.grycap.upv.es/slepc/" target="_top">SLEPc</a></dt> + + <dt><a name="slepc"></a><a href="http://www.grycap.upv.es/slepc/" target="_top">SLEPc</a></dt> <dd> <p> <a href="http://www.grycap.upv.es/slepc/" @@ -665,8 +700,8 @@ </p> </dd> - <a name="tbb"></a> - <dt><a href="http://www.threadingbuildingblocks.org/" + + <dt><a name="tbb"></a><a href="http://www.threadingbuildingblocks.org/" target="_top">Threading Building Blocks (TBB)</a></dt> <dd> <p> @@ -682,8 +717,8 @@ </p> </dd> - <a name="trilinos"></a> - <dt><a href="http://trilinos.sandia.gov" target="_top">Trilinos</a></dt> + + <dt><a name="trilinos"></a><a href="http://trilinos.sandia.gov" target="_top">Trilinos</a></dt> <dd> <p> <a href="http://trilinos.sandia.gov" target="_top">Trilinos</a> is a @@ -707,8 +742,8 @@ </p> </dd> - <a name="umfpack"></a> - <dt><a href="http://www.cise.ufl.edu/research/sparse/umfpack/" + + <dt><a name="umfpack"></a><a href="http://www.cise.ufl.edu/research/sparse/umfpack/" target="_top">UMFPACK</a></dt> <dd> <p> @@ -739,7 +774,7 @@ </dl> - <a name="conf-details"></a> + <a name="conf-details"/> <h4>More information on configuring and building the library</h4> <p> @@ -801,27 +836,31 @@ information. </p> <p> - Please note: + Please note:</p> <ul> <li> Detailed license information can be found following <a href="license.html" target="body">this link</a>. + </li> <li> <b>As a contributor to this project, you agree that any of your contributions be licensed under the same terms and conditions as the license of the deal.II project granted to you.</b> + </li> <li> We, <a href="authors.html">the deal.II authors</a>, do not require copyright assignments for contributions. This means that the copyright for code contributions in the deal.II project is held by its respective contributors who have each agreed to release their contributed code under the terms of the LGPL v2.1 or later. + </li> <li> In addition to the terms imposed by the LGPL (version 2.1 or later), we ask for the courtesy that scientific publications presenting results obtained with this libraries acknowledge its use. Please cite one of the papers referenced <a href="publications/index.html">here</a>. + </li> <li> <acronym>deal.II</acronym> can interface with a number of <a href="#optional-software">other packages</a> that you either @@ -836,13 +875,20 @@ target="_top">FunctionParser</a>, courtesy of their authors. These are also covered by their own licenses; please refer to their webpages for more information. + </li> </ul> - <hr> + <hr /> + <address> + <a href="authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> - <address> - <a href="mail.html" target="body">The deal.II Group</a> - $Date$ - </address> </body> </html> diff --git a/deal.II/doc/reports/index.html b/deal.II/doc/reports/index.html new file mode 100644 index 0000000000..e08c31a79c --- /dev/null +++ b/deal.II/doc/reports/index.html @@ -0,0 +1,120 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html> + <head> + <title>The deal.II Online Documentation</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8" > + <link href="../screen.css" rel="StyleSheet" type="text/css"> + <meta name="author" content="the deal.II authors <authors@dealii.org>"> + <meta name="copyright" content="Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors"> + <meta name="date" content="2006/02/07 22:49:01"> + <meta name="keywords" content="deal.II"> + <meta name="svn_id" content="$Id$"> + </head> +<body> + +<h1>Reports</h1> + +<p> + There are a number of papers that describe the overall design or + individual aspects of <acronym>deal.II</acronym>. Please refer to the + papers listed at the top of the <a href="publications/index.html" + target="body">publications page</a> for full references. In addition, + there are the following reports: + <ul> + <li> + <p> + A publication on the + <a href="reports/dimension-independent/index.html" + target="body">basics of dimension independent + programming</a> in <acronym>deal.II</acronym> (by Wolfgang + Bangerth). This explains some of the fundamentals of the + library's design, though rather briefly due to the page + limit imposed for the publication. + </p> + + <p> + This publication appeared in + the proceedings of the 16th IMACS World Congress, + Lausanne, Switzerland, 2000. See the + <a href="publications/index.html" target="body">publications</a> + page for the full reference as well as a way to obtain a + reprint of the original paper as a postscript or PDF file. + </p> + </li> + + <li> + A brief report about the classes involved in the + <a href="reports/class-hierarchies/index.html" + target="body">iterators and accessors</a> + used to access cells in the triangulations and the data + thereon, such as their geometry, the number of the + degrees of freedom, data values, etc. You may want to + read this object or parts of it if you want to know what + information is available from iterators (by Wolfgang + Bangerth). + </li> + + <li> + A brief report on <a href="reports/mapping_q/index.html" + target="body">mapping</a> functions of higher polynomial + degrees (by Ralf Hartmann). These allow the realisation + of higher order boundary approximations. This report + gives the theoretical background of the + <code>MappingQ</code> class. + </li> + + <li> + A report on + <a href="reports/assemble/assemble.pdf" + target="body">assembling matrices</a> (by Wolfgang + Bangerth). This report looks in particular at how + matrices are assembled for vector-valued problems, and + how things change if vector-valued finite elements are + used for which the shape functions have more than one + non-zero vector component, such as Nedelec or + Raviart-Thomas elements. There are printable + versions of the report + <a href="reports/assemble/assemble.ps" + target="body">in postscript</a> and + <a href="reports/assemble/assemble.pdf" + target="body">PDF format</a>. + </li> + + <li> + A very detailed report on + <a href="reports/nedelec/nedelec.pdf" + target="body">Nedelec elements</a> (by Anna + Schneebeli, University of Basel, Switzerland). It + explains the construction and application of Nedelec + edge elements for H-curl spaces, as used, for example, + in the numerical solution of the Maxwell equations. It + also gives numerical results obtained with deal.II. + There is also a <a href="reports/nedelec/nedelec.ps" + target="body">postscript version of the report</a>. + </li> + + <li> + A report on the + <a href="reports/codimension-one/desimone-heltai-manigrasso.pdf" + target="body">codimension one</a> capabilities of the library + (by Antonio DeSimone, Luca Heltai and Cataldo Manigrasso, + SISSA, Trieste, Italy). It explains in detail how to use the + library for the solution of problems defined on codimension + one manifolds, such as, for example, Boundary Element + Methods. + </li> + </ul> + + <hr /> + <address> + <a href="authors.html" target="body">The deal.II Authors</a> + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> +</body> +</html> diff --git a/deal.II/doc/screen.css b/deal.II/doc/screen.css index 65610cf281..51bfd69bac 100644 --- a/deal.II/doc/screen.css +++ b/deal.II/doc/screen.css @@ -6,6 +6,7 @@ body { margin: 10px; padding: 0; font-family: sans-serif; + counter-reset: section; } body.title { @@ -28,6 +29,40 @@ body.navbar { font-size: 12px; } +div.toc { + width: 50%; + color: black; + border: 1px solid #aaa; + background-color: #f9f9f9; + padding: 5px; + font-size: 88%; +} + +div.toc:before { + display: block; + content: "Table of contents"; + text-align: center; + font-size: 88%; + font-weight: bold; +} + +div.quick { + width: 30%; + color: black; + border: 1px solid #aaa; + background-color: #f9f9f9; + padding: 5px; + font-size: 88%; +} + +div.quick:before { + display: block; + content: "Quick links"; + text-align: center; + font-size: 88%; + font-weight: bold; +} + frameset { background-color: white; border-color: black; @@ -84,17 +119,20 @@ h1, h2, h3, h4, h5, h6 { } h1 { - font-size: 175%; + font-size: 175%; + counter-reset: section; } h2 { font-size: 150%; + counter-reset: subsection; } h3 { font-size: 140%; padding-top: 1.5em; padding-bottom: 0.17em; border-bottom: 1px dashed #aaaaaa; } + h4 { font-size: 110%; border-bottom: none; font-weight: bold; @@ -108,6 +146,16 @@ h6 { font-size: 80%; font-weight: bold; } +h2:before { + counter-increment: section; + content: counter(section) ". "; +} + +h3:before { + counter-increment: subsection; + content: counter(section) "." counter(subsection) ". "; +} + div.right { text-align: right; } @@ -121,13 +169,18 @@ ul { margin: 0.3em 0 0 1.5em; padding:0; } + ol { line-height: 1.5em; margin: 0.3em 0 0 3.2em; padding:0; list-style-image: none; } -li { margin-bottom: 0.1em; } + +li { + margin-bottom: 0.1em; +} + dt { font-weight: bold; margin-bottom: 0.1em; @@ -180,6 +233,26 @@ pre { line-height: 1.1em; } +pre.cmake { + padding: 1em; + text-align: left; + text-indent: 0; + border: 1px solid #d06fab; + color: Black; + background-color: #f9f9f9; + line-height: 1.1em; +} + +pre.sample { + padding: 1em; + text-align: left; + text-indent: 0; + border: 1px dashed #2f6fab; + color: Black; + background-color: #f9f9f9; + line-height: 1.1em; +} + table.navbar { } table.tutorial { color: black; @@ -239,6 +312,14 @@ td.build { text-decoration: line-through; } +.todo:before { + content: "TODO: "; +} + +.todo { + color: Red; +} + .deprecated { text-decoration: line-through; } diff --git a/deal.II/doc/users/CMakeLists.txt.sample b/deal.II/doc/users/CMakeLists.txt.sample new file mode 100644 index 0000000000..58dde0ac2c --- /dev/null +++ b/deal.II/doc/users/CMakeLists.txt.sample @@ -0,0 +1,11 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) + +FIND_PACKAGE(deal.II 8.0 REQUIRED + HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} + ) +DEAL_II_INITIALIZE_CACHED_VARIABLES() + +PROJECT(myproject) + +ADD_EXECUTABLE(mycode mycode.cc) +DEAL_II_SETUP_TARGET(mycode) diff --git a/deal.II/doc/users/CMakeLists.txt.sample2 b/deal.II/doc/users/CMakeLists.txt.sample2 new file mode 100644 index 0000000000..fda35efbf6 --- /dev/null +++ b/deal.II/doc/users/CMakeLists.txt.sample2 @@ -0,0 +1,20 @@ +FIND_PACKAGE(deal.II 8.0 REQUIRED + HINTS + ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} + # You can specify additional hints for search paths here, e.g. + # $ENV{HOME}/workspace/deal.II + ) + +# Set the name of the project and target: +SET(TARGET "step-1") + +# Declare all source files the target consists of: +SET(TARGET_SRC + step-1.cc + # You can specify additional files here! + ) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +DEAL_II_INITIALIZE_CACHED_VARIABLES() +PROJECT(${TARGET} CXX) +DEAL_II_INVOKE_AUTOPILOT() diff --git a/deal.II/doc/users/CMakeLists.txt.sample3 b/deal.II/doc/users/CMakeLists.txt.sample3 new file mode 100644 index 0000000000..2003f225e9 --- /dev/null +++ b/deal.II/doc/users/CMakeLists.txt.sample3 @@ -0,0 +1,33 @@ +FIND_PACKAGE(deal.II 8.0 REQUIRED + HINTS + ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} + # You can specify additional hints for search paths here, e.g. + # $ENV{HOME}/workspace/deal.II + ) + +# Set the name of the project and target: +SET(TARGET "step-1") + +# Declare all source files the target consists of: +SET(TARGET_SRC + step-1.cc + # You can specify additional files here! + ) + +# Specify a list of files (file globs) that will be removed +# with the "make runclean" and "make distclean" targets. +# (If empty, sensible default values will be used.) +SET(CLEAN_UP_FILES + # a custom list of globs, e.g. *.log *.vtk + ) + +# A custom command line that should be invoked by "make run". +# (If empty, ./${TARGET} will be invoked.) +SET(TARGET_RUN + # a custom command line, e.g. mpirun -np 2 ${TARGET} + ) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +DEAL_II_INITIALIZE_CACHED_VARIABLES() +PROJECT(${TARGET} CXX) +DEAL_II_INVOKE_AUTOPILOT() diff --git a/deal.II/doc/development/Config.sample b/deal.II/doc/users/Config.sample similarity index 89% rename from deal.II/doc/development/Config.sample rename to deal.II/doc/users/Config.sample index 393634f337..df14dc07d3 100644 --- a/deal.II/doc/development/Config.sample +++ b/deal.II/doc/users/Config.sample @@ -83,6 +83,10 @@ # "C Compiler." # ) # +# SET(CMAKE_Fortran_COMPILER "" CACHE STRING +# "Fortran Compiler." +# ) +# # SET(CMAKE_CXX_FLAGS "" CACHE STRING # "The user supplied cache variable will be appended _at the end_ of the auto generated CMAKE_CXX_FLAGS variable" # ) @@ -95,22 +99,30 @@ # "The user supplied cache variable will be appended _at the end_ of the auto generated DEAL_II_CXX_FLAGS_RELEASE variable" # ) # -# SET(CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING -# "The user supplied cache variable will be appended _at the end_ of the auto generated CMAKE_SHARED_LINKER_FLAGS variable" +# SET(DEAL_II_LINKER_FLAGS "" CACHE STRING +# "The user supplied cache variable will be appended _at the end_ of the auto generated DEAL_II_LINKER_FLAGS variable" # ) # -# SET(DEAL_II_SHARED_LINKER_FLAGS_DEBUG "" CACHE STRING -# "The user supplied cache variable will be appended _at the end_ of the auto generated DEAL_II_SHARED_LINKER_FLAGS_DEBUG variable" +# SET(DEAL_II_LINKER_FLAGS_DEBUG "" CACHE STRING +# "The user supplied cache variable will be appended _at the end_ of the auto generated DEAL_II_LINKER_FLAGS_DEBUG variable" # ) # -# SET(DEAL_II_SHARED_LINKER_FLAGS_RELEASE "" CACHE STRING -# "The user supplied cache variable will be appended _at the end_ of the auto generated DEAL_II_SHARED_LINKER_FLAGS_RELEASE variable" +# SET(DEAL_II_LINKER_FLAGS_RELEASE "" CACHE STRING +# "The user supplied cache variable will be appended _at the end_ of the auto generated DEAL_II_LINKER_FLAGS_RELEASE variable" # ) # # SET(BUILD_SHARED_LIBS "ON" CACHE BOOL # "Build a shared library" # ) # +# SET(DEAL_II_PREFER_STATIC_LIBS "OFF" CACHE BOOL +# "Prefer static libraries over dynamic libraries when searching for features and corresponding link interface" +# ) +# +# OPTION(DEAL_II_STATIC_EXECUTABLE "OFF" CACHE BOOL +# "Provide a link interface that is suitable for static linkage of executables. Enabling this option forces BUILD_SHARED_LIBS=OFF and DEAL_II_PREFER_STATIC_LIBS=ON" +# ) +# # SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH "ON" CACHE BOOL # "Set the rpath of the library to the external link pathes on installation" # ) @@ -231,7 +243,15 @@ # BLA_VENDOR will also be recognized by FindLAPACK.cmake. # # If your BLAS/LAPACK installation resides at a non system location, specify -# a hint with CMAKE_PREFIX_PATH. +# a hint with LAPACK_DIR and BLAS_DIR, or CMAKE_PREFIX_PATH: +# +# SET(LAPACK_DIR "..." CACHE PATH +# "The preferred installation prefix for searching for LAPACK" +# ) +# +# SET(BLAS_DIR "..." CACHE PATH +# "The preferred installation prefix for searching for BLAS" +# ) # # # Manual setup: @@ -263,6 +283,10 @@ # SET(METIS_FOUND TRUE CACHE BOOL "") # SET(METIS_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") # SET(METIS_INCLUDE_DIRS "semicolon;separated;list;of;include;dirs" CACHE STRING "") +# SET(METIS_VERSION "x.y.z" CACHE STRING "") +# SET(METIS_VERSION_MAJOR "x" CACHE STRING "") +# SET(METIS_VERSION_MINOR "y" CACHE STRING "") +# SET(METIS_VERSION_SUBMINOR "z" CACHE STRING "") # @@ -280,17 +304,23 @@ # conservative. Only the current compiler and the variable MPI_CXX_COMPILER # is used to find MPI. (MPI_CXX_COMPILER takes precedence.) # +# (MPI_C_COMPILER and MPI_Fortran_COMPILER are considered, too) +# +# # DEAL_II_WITH_MPI=ON will trigger a more sophisticated search for MPI. # # The best way to force a specific MPI implementation to be used is to set -# CMAKE_C_COMPILER and CMAKE_CXX_COMPILER to the appropriate MPI wrapper -# (See above). +# CMAKE_CXX_COMPILER, CMAKE_C_COMPILER and CMAKE_Fortran_COMPILER to the +# appropriate MPI wrapper (See above). # # Alternatively, specify the mpi wrapper that will be queried for the mpi # link interface: # # SET(MPI_CXX_COMPILER "mpicxx" CACHE STRING "") # +# SET(MPI_C_COMPILER "mpicc" CACHE STRING "") +# SET(MPI_Fortran_COMPILER "mpif90" CACHE STRING "") +# # # Manual setup: # @@ -305,6 +335,12 @@ # SET(MPI_CXX_COMPILE_FLAGS "..." CACHE STRING "") # SET(MPI_CXX_LINK_FLAGS "..." CACHE STRING "") # +# Additionally: +# +# SET(MPI_C_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") +# SET(MPI_Fortran_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") +# +# # @@ -368,6 +404,11 @@ # SET(P4EST_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") # SET(P4EST_INCLUDE_DIRS "semicolon;separated;list;of;include;dirs" CACHE STRING "") # SET(P4EST_WITH_MPI TRUE CACHE BOOL "") +# SET(P4EST_VERSION "x.y.z.p" CACHE STRING "") +# SET(P4EST_VERSION_MAJOR "x" CACHE STRING "") +# SET(P4EST_VERSION_MINOR "y" CACHE STRING "") +# SET(P4EST_VERSION_SUBMINOR "z" CACHE STRING "") +# SET(P4EST_VERSION_PATCH "p" CACHE STRING "") # @@ -393,6 +434,7 @@ # SET(PETSC_VERSION_MAJOR "x" CACHE STRING "") # SET(PETSC_VERSION_MINOR "y" CACHE STRING "") # SET(PETSC_VERSION_SUBMINOR "z" CACHE STRING "") +# SET(PETSC_VERSION_PATCH "" CACHE STRING "") # SET(PETSC_WITH_MPI_UNI FALSE CACHE BOOL "") # @@ -418,6 +460,7 @@ # SET(SLEPC_VERSION_MAJOR "x" CACHE STRING "") # SET(SLEPC_VERSION_MINOR "y" CACHE STRING "") # SET(SLEPC_VERSION_SUBMINOR "z" CACHE STRING "") +# SET(SLEPC_VERSION_PATCH "" CACHE STRING "") # SET(SLEPC_WITH_MPI_UNI FALSE CACHE BOOL "") # diff --git a/deal.II/doc/development/cmake.html b/deal.II/doc/users/cmake.html similarity index 84% rename from deal.II/doc/development/cmake.html rename to deal.II/doc/users/cmake.html index 0b1c072f98..5524e0eda8 100644 --- a/deal.II/doc/development/cmake.html +++ b/deal.II/doc/users/cmake.html @@ -24,38 +24,34 @@ <acronym>deal.II</acronym> CMake build system. </p> - <p> - <table class="tutorial" width="50%"> - <tr><th colspan="2"><b><small>Table of contents</small></b></th></tr> - <tr><td valign="top"> - <ul> - <li><a href="#operating">Operating cmake</a> - <ul> - <li><a href="#operatingmanip">Manipulating the cache</a> - <li><a href="#operatingccmake"><code>ccmake</code> and special build targets </a> - <li><a href="#operatingshortcuts">Shortcuts</a> - </ul> - <li><a href="#configure">Configuration options</a> - <ul> - <li><a href="#configurefeature">Feature configuration</a> - <li><a href="#configureautoconf">Autoconfiguration</a> - <li><a href="#configureext">External library locations</a> - <li><a href="#configureoverride">Manual override</a> - <li><a href="#configurecomp">Component selection</a> - <li><a href="#configurebuild">Build configuration</a> - <li><a href="#compiler">Selecting a compiler</a> - <li><a href="#configureinstall">Installation</a> - </ul> - <li><a href="#advanced">Initial cache file and advanced options</a> - <li><a href="#compiling">Compiling only certain parts</a> - </ul> - </td> - </tr> - </table> - </p> - + <div class="toc"> + <ol> + <li><a href="#operating">Operating cmake</a> + <ol> + <li><a href="#operatingmanip">Manipulating the cache</a></li> + <li><a href="#operatingccmake"><code>ccmake</code> and special build targets </a></li> + <li><a href="#operatingshortcuts">Shortcuts</a></li> + </ol> + </li> + <li><a href="#configure">Configuration options</a> + <ol> + <li><a href="#configurefeature">Feature configuration</a></li> + <li><a href="#configureautoconf">Autoconfiguration</a></li> + <li><a href="#configureext">External library locations</a></li> + <li><a href="#configureoverride">Manual override</a></li> + <li><a href="#configurecomp">Component selection</a></li> + <li><a href="#configurebuild">Build configuration</a></li> + <li><a href="#compiler">Selecting a compiler</a></li> + <li><a href="#configureinstall">Installation</a></li> + </ol> + </li> + <li><a href="#advanced">Initial cache file and advanced options</a></li> + <li><a href="#compiling">Compiling only certain parts</a></li> + </ol> + </div> + <a name="operating"></a> - <h3>Operating cmake</h3> + <h2>Operating cmake</h2> <p> When configuring <acronym>deal.II</acronym> by @@ -123,13 +119,13 @@ </pre> switches off support for the METIS library that may have been automatically detected during the first invocation of - <code>cmake</code> and enables support for Trilinos by enablind + <code>cmake</code> and enables support for Trilinos by enabling <code>DEAL_II_WITH_TRILINOS</code> and setting <code>TRILINOS_DIR</code>. </p> <a name="operatingmanip"></a> - <h4> Manipulating the cache </h4> + <h3> Manipulating the cache </h3> <p> A cached variable can be set on the command line via @@ -153,7 +149,7 @@ </p> <a name="operatingccmake"></a> - <h4> <code>ccmake</code> and special build targets </h4> + <h3> <code>ccmake</code> and special build targets </h3> <p> A very convenient way to alter the configuration is to use the graphical @@ -177,7 +173,7 @@ </p> <a name="operatingshortcuts"></a> - <h4> Shortcuts </h4> + <h3> Shortcuts </h3> <p> All variables starting with <code>WITH_</code> will be automatically @@ -199,7 +195,7 @@ </p> <a name="configure"></a> - <h3>Configuration options</h3> + <h2>Configuration options</h2> <p> The various configuration options of the @@ -212,7 +208,7 @@ <a name="configurefeature"></a> - <h4>Feature configuration</h4> + <h3>Feature configuration</h3> <p> <acronym>deal.II</acronym> provides (optional) interfaces to quite @@ -304,7 +300,7 @@ <a name="configureautoconf"></a> - <h4> Autoconfiguration </h4> + <h3> Autoconfiguration </h3> <p> As long as <code>DEAL_II_WITH_&lt;FEATURE&gt;</code> is @@ -339,7 +335,7 @@ <a name="configureext"></a> - <h4> External library locations </h4> + <h3> External library locations </h3> <p> External libraries will be searched depending on hints in the following @@ -380,7 +376,9 @@ <pre> ARPACK_DIR, + BOOST_DIR, HDF5_DIR, + LAPACK_DIR (and BLAS_DIR), METIS_DIR, MUMPS_DIR (and SCALAPACK_DIR, BLACS_DIR), P4EST_DIR (and SC_DIR), @@ -403,7 +401,7 @@ Alternatively, cached variables set by the <code>Find&lt;Module&gt;</code> mechanism may be set, hinted or overwritten directly (variable names are highly - dependend on the actual library). You can get a list via + dependent on the actual library). You can get a list via <pre> make edit_cache @@ -413,8 +411,37 @@ <code>-NOTFOUND</code> and may be set by hand. </p> + <h4>Library conflicts</h4> + <p>Caveat: if you have a set of standard libraries in the default + location, say <code>/usr/lib</code> and a set of + private versions of the same libraries, for instance because you + need different revisions sometimes, in your own library directory, + you may receive an error message of the form:</p> + +<pre> + + CMake Warning at source/CMakeLists.txt:65 (ADD_LIBRARY): + Cannot generate a safe runtime search path for target deal_II.g because + files in some directories may conflict with libraries in implicit + directories: + + runtime library [libtbb.so.2] in /usr/lib may be hidden by files in: + /my/private/lib + + Some of these libraries may not be found correctly. + +</pre> + +<p>This is not a problem of CMake or deal.II, but rather a general + Linux problem. In order to fix this, you have two options:</p> +<ol> +<li>Choose all libraries either from your private directory or from + the standard one.</li> +<li>Install all your private library versions in different directories.</li> +</ol> + <a name="configureoverride"></a> - <h4> Manual override </h4> + <h3> Manual override </h3> <p><b>Warning:</b> Do not do this unless absolutely necessary!</p> <p> It is possible to override the CMake find mechanism for external @@ -460,7 +487,7 @@ <a name="configurecomp"></a> - <h4> Component selection </h4> + <h3> Component selection </h3> <p> The following options control which components of @@ -530,7 +557,7 @@ <a name="configurebuild"></a> - <h4> Build configuration </h4> + <h3> Build configuration </h3> <p> The <code>cmake</code> variable <code>CMAKE_BUILD_TYPE</code> @@ -570,6 +597,19 @@ <code>BUILD_SHARED_LIBS</code>: If set (default), <acronym>deal.II</acronym> will be linked as a shared library + <li> + <code>DEAL_II_PREFER_STATIC_LIBS</code> (defaults to off): If set + to true, static archives will be preferred over dynamic libraries when + searching for features and corresponding link interface. + + <li> + <code>DEAL_II_STATIC_EXECUTABLE</code> (defaults to off): + If set to true, <acronym>deal.II</acronym> will be configured in + a way to provide a link interface that is suitable for static + linkage of executables. Enabling this option forces + <code>BUILD_SHARED_LIBS=OFF</code> and + <code>DEAL_II_PERFER_STATIC_LIBS</code>. + <li> <code>CMAKE_INSTALL_RPATH_USE_LINK_PATH</code>: If set (default), the <acronym>deal.II</acronym> library will be @@ -580,32 +620,32 @@ <a name="compiler"></a> - <h4> Selecting a compiler </h4> + <h3> Selecting a compiler </h3> </p> Compilers can be switched either by command line or by setting - <code>CMAKE_(C|CXX)_COMPILER</code>: + <code>CMAKE_(C|CXX|Fortran)_COMPILER</code>: <pre> CC=mpicc CXX=mpicxx cmake &lt;...&gt; - cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" &lt;...&gt; + cmake -DCMAKE_C_COMPILER="mpicc" -DCMAKE_CXX_COMPILER="mpicxx" -DCMAKE_Fortran_COMPILER="mpif90" &lt;...&gt; </pre> Please note that <ul> <li> The compiler <i>must</i> be specified at the very first - invokation of <code>cmake</code>. + invocation of <code>cmake</code>. <li> - The specified C and CXX compilers must be the same compiler - brand and the same compiler version. + A working CXX compiler is needed. It is optional to provide a C + or Fortran compiler. </ul> </p> <p> - deal.II will configure sensible default <code>CFLAGS</code> and - <code>CXXFLAGS</code> depending on platform, compiler and build - target. There are two options to override this behaviour: + deal.II will configure sensible default <code>CXXFLAGS</code> + depending on platform, compiler and build target. There are two + options to override this behaviour: <ol> <li> @@ -644,7 +684,7 @@ <a name="configureinstall"></a> - <h4> Installation </h4> + <h3> Installation </h3> <p> the location, @@ -711,7 +751,7 @@ <a name="advanced"></a> - <h3>Initial cache file and advanced options</h3> + <h2>Initial cache file and advanced options</h2> A sample configuration file for preloading the CMake cache with <pre> @@ -725,7 +765,7 @@ <a name="compiling"></a> - <h3> Compiling only certain parts </h3> + <h2> Compiling only certain parts </h2> <p> <p> @@ -779,12 +819,17 @@ will be installed, see <a href="#configurebuild">this section</a>. </p> - - <hr> - + <hr /> <address> - <a href="mail.html" target="body">The deal.II Group</a> + <a href="../authors.html" target="body">The deal.II Authors</a> $Date$ </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> + </body> </html> diff --git a/deal.II/doc/users/cmakelists.html b/deal.II/doc/users/cmakelists.html new file mode 100644 index 0000000000..60e5b260f4 --- /dev/null +++ b/deal.II/doc/users/cmakelists.html @@ -0,0 +1,863 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html> + <head> + <title>How to use CMake to configure your projects with deal.II</title> + <link href="../screen.css" rel="StyleSheet"> + <meta name="author" content="the deal.II authors <authors @ dealii.org>"> + <meta name="copyright" content="Copyright (C) 2012, 2013 by the deal.II authors"> + <meta name="date" content="$Date$"> + <meta name="svn_id" content="$Id$"> + <meta name="keywords" content="deal.II"> + </head> + +<body> +<h1>How to use CMake to configure your projects with <acronym>deal.II</acronym></h1> + +<div class="toc"> + <ol> + <li><a href="#cmakesimple">Simple <code>CMakeLists.txt</code></a> + <ol> + <li><a href="#cmakesimple.multiple">Adding multiple executable targets</a></li> + <li><a href="#cmakesimple.libs">Adding libraries and common source files</a></li> + <li><a href="#cmakesimple.build_type">Switching build types</a></li> + <li><a href="#cmakesimple.run">Adding a "run" target</a></li> + </ol> + </li> + <li><a href="#cmakeadvanced">Advanced <code>CMakeLists.txt</code></a> + <ol> + <li><a href="#cmakeadvanced.layout">Source directory layout</a></li> + <li><a href="#cmakeadvanced.control">Control statements</a></li> + <li><a href="#cmakeadvanced.globs">File globs</a></li> + <li><a href="#cmakeadvanced.setup_target"><code>DEAL_II_SETUP_TARGET</code> revisited</a></li> + <li><a href="#cmakeadvanced.cached_variables"><code>DEAL_II_INITIALIZE_CACHED_VARIABLES</code> revisited</a></li> + <li><a href="#cmakeadvanced.properties">Customizing include directories and compile definitions</a></li> + <li><a href="#cmakeadvanced.external_libraries">External libraries</a></li> + <li><a href="#cmakeadvanced.run">The "run" target revisited</a></li> + <li><a href="#cmakeadvanced.install">Install a project</a></li> + </ol> + </li> + <li><a href="#cmakeauto">Autopilot style <code>CMakeLists.txt</code></li> + <li><a href="#dealiiconfig"><code>deal.IIConfig.cmake</code></a></li> + <li><a href="#legacy">Legacy <code>Make.global_options</code></a></li> + </ol> +</div> + +<p> + <code>cmake</code> is the configuration and build tool we use + in <acronym>deal.II</acronym>. Its advantage is not only that it makes + configuration of <acronym>deal.II</acronym> itself simpler across + platforms (compared to the older <code>autoconf/make</code> combination) + but also that it <i>exports</i> information about the deal.II + configuration that makes it particularly simple for projects + using <acronym>deal.II</acronym> to configure and link against it. +</p> + +<p> + <code>cmake</code> is controlled by input files that by convention are + called <code>CMakeLists.txt</code>, listing both configuration commands + as well as dependencies between source files and targets. + This page presents some <code>CMakeLists.txt</code> examples for + potential use in your projects. (A detailed description of the + <acronym>deal.II</acronym> project configuration is given in the + <a href="cmake.html" target="body">deal.II CMake ReadMe</a>.) +</p> + +<a name="cmakesimple"></a> +<h2>Simple CMakeLists.txt</h2> + +<p> + In this section, we start out with a minimal <code>CMakeLists.txt</code> + based on the <code>DEAL_II_SETUP_TARGET</code> macro. This method gives + full control of what's happening and is easily extensible to more complex + projects, as exemplified in the subsections here and later in the section + on <a href="cmakeadvanced">advanced topics</a>. Here is a full example + (<a href="CMakeLists.txt.sample" target="_top">plain text</a> + version): + +<pre class="cmake"> +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) + +FIND_PACKAGE(deal.II 8.0 REQUIRED + HINTS ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} + ) +DEAL_II_INITIALIZE_CACHED_VARIABLES() + +PROJECT(myproject) + +ADD_EXECUTABLE(mycode mycode.cc) +DEAL_II_SETUP_TARGET(mycode) +</pre> + +<p> + The first line of this code makes sure that a sufficiently high + version of CMake is installed. 2.8.8 is the minimal version required + to set up <acronym>deal.II</acronym>, therefore it is safe to use this + number here. +</p> + +<p> + Next, we find our deal.II installation with the help of the + <code>FIND_PACKAGE</code> command. In this case requiring at least + version 8.0, which is the first version using CMake. The + <code>HINTS</code> are a list of directories where the install directory + of deal.II is likely to be found. First, the location possibly defined in + the CMake variable <code>DEAL_II_DIR</code> is considered. After that, we + check whether we are in a subdirectory (first and second level) of the + deal.II installation and otherwise use the environment variable + <code>DEAL_II_DIR</code>. If all of these hints fail the default system + locations <code>/usr/</code> and <code>/usr/local/</code> are considered. + The list after <code>HINTS</code> can be changed according to your + preferences. +</p> + +<p> + After finding the deal.II project, we fetch a set of cached variables + with the <a href="#cmakeadvanced.cached_variables"> + <code>DEAL_II_INITIALIZE_CACHED_VARIABLES</code></a> macro. You + can inspect these for instance with <code>ccmake</code>. +</p> + +<p> + Every <code>CMakeLists.txt</code> must contain a project definition, + which we do next. +</p> + +<p> + Finally, the last two lines define the executable that is to be produced + and its source code. The <a href="#cmakeadvanced.setup_target"> + <code>DEAL_II_SETUP_TARGET</code></a> macro will set up necessary + incllude directories, compile defintions and the link interface. +</p> + +<a name="cmakesimple.multiple"></a> +<h3>Adding multiple executable targets</h3> + +<p> + In order to specify multiple executable targets, simply repeat + the last two lines of the simple <code>CMakeLists.txt</code>: +</p> + +<pre class="cmake"> +ADD_EXECUTABLE(mycode2 mycode2.cc) +DEAL_II_SETUP_TARGET(mycode2) + +ADD_EXECUTABLE(mycode3 mycode3.cc) +DEAL_II_SETUP_TARGET(mycode3) +</pre> + +If the list gets longer, consider using +a <a href="#cmakeadvanced.foreach">loop</a>, possibly +with <a href="#cmakeadvanced.glob">GLOB</a>. + + <a name="cmakesimple.libs"></a> + <h3>Adding libraries and common source files</h3> + + <p> + Adding a library is as simple as adding an executable target. We + specify the library name and then have to tell cmake that the + executables depend on it. The code in the simple file below the + project definition accordingly changes for instance to: + </p> + +<pre class="cmake"> +ADD_LIBRARY(mylib libsrc1.cc libsrc2.cc libsrc3.cc) +DEAL_II_SETUP_TARGET(mylib) + +ADD_EXECUTABLE(mycode mycode.cc) +DEAL_II_SETUP_TARGET(mycode) +TARGET_LINK_LIBRARIES(mycode mylib) +</pre> + +<p>When you have <a href="#cmakesimple.multiple">multiple targets</a>, +repeat the last line of code for each of them. Accordingly, +a <a href="#cmakeadvanced.foreach">loop</a> becomes even more +attractive.</p> + +<p>If you only have a single file or few files with common source +code, an alternative to creating a library might be the option:</p> + +<pre class="cmake"> +ADD_EXECUTABLE(mycode mycode.cc common.cc) +DEAL_II_SETUP_TARGET(mycode) + +ADD_EXECUTABLE(mycode2 mycode2.cc common.cc) +DEAL_II_SETUP_TARGET(mycode2) +</pre> + +<p>You should be aware though that in this case <code>common.cc</code> will +be compiled for each target, not only once. If you want to avoid this and +still don't want to use a shared library or static archive, another option +is to create an <code>OBJECT</code> "library":</p> + +<pre class="cmake"> +ADD_LIBRARY(common OBJECT common.cc) +DEAL_II_SETUP_TARGET(common) + +ADD_EXECUTABLE(mycode mycode.cc $&lt;TARGET_OBJECTS:common&gt;) +DEAL_II_SETUP_TARGET(mycode) + +ADD_EXECUTABLE(mycode2 mycode2.cc $&lt;TARGET_OBJECTS:common&gt;) +DEAL_II_SETUP_TARGET(mycode2) +</pre> +This will compile <code>common.cc</code> once for the object target +<code>common</code> and link the resulting object file into the two +executables. + +<a name="cmakesimple.build_type"></a> +<h3>Switching build types</h3> + +<p> The build type is controlled via the variable +<code>CMAKE_BUILD_TYPE</code>. If it is set to <code>Debug</code> +executables and libraries specified in your <code>CMakeLists.txt</code> +file will be compiled in debug mode and linked against the debug version of +the deal.II library. Contrary <code>Release</code> will build in optimized +mode and link against the optimized release version of deal.II. You can set +<code>CMAKE_BUILD_TYPE</code> with the help of <code>ccmake</code> or via +<code>cmake</code> on the command line: </p> + +<pre class="cmake"> +$ cmake -DCMAKE_BUILD_TYPE="Debug" . + +$ cmake -DCMAKE_BUILD_TYPE="Release" . +</pre> + +Alternatively, you can specify custom targets to switch the build type and +compile automatically: + +<pre class="cmake"> +ADD_CUSTOM_TARGET(debug + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Debug ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all + COMMENT "Switch CMAKE_BUILD_TYPE to Debug" + ) + +ADD_CUSTOM_TARGET(release + COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=Release ${CMAKE_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all + COMMENT "Switch CMAKE_BUILD_TYPE to Release" + ) +</pre> +With that, switching the build type and compiling the project can be done +very conveniently via: +<pre class="cmake"> +$ make debug + +$ make release +</pre> + +<a name="cmakesimple.run"></a> +<h3>Adding a "run" target</h3> + +<p> If you wish to have a "run" target for make, like in the deal.II +tutorial, specify one this way (obviously, a single "run" target can only +run a single executable): </p> + +<pre class="cmake"> +ADD_CUSTOM_TARGET(run COMMAND mycode + COMMENT "Run with ${CMAKE_BUILD_TYPE} configuration" + ) +</pre> + + +<a name="cmakeadvanced"></a> +<h2> Advanced <code>CMakeLists.txt</code></h2> + +<p>This section covers some advanced topics for a user +<code>CMakeLists.txt</code> file.</p> + +<a name="cmakeadvanced.layout"></a> +<h3>Source directory layout</h3> + +<p>For complex projects it is desirable to organize source code and header +files in subdirectories. Assume the following project structure with a +library "mylib" and an executable "mycode": + +<pre class="cmake"> +mylib/source/*.cc +mylib/include/*.h + +mycode/source/*.cc +mycode/include/*.h +</pre> + +In this case the top level <code>CMakeLists.txt</code> file may be: +<pre class="cmake"> +# top level CMakeLists.txt +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +FIND_PACKAGE(deal.II 8.0 REQUIRED) + +DEAL_II_INITIALIZE_CACHED_VARIABLES() +PROJECT(myproject) + +ADD_SUBDIRECTORY(mylib) +ADD_SUBDIRECTORY(mycode) +</pre> +The <code>ADD_SUBDIRECTORY</code> statement will include the CMakeLists.txt +file in the specified subdirectory. In our case: + +<pre class="cmake"> +# mylib/CMakeLists.txt + +INCLUDE_DIRECTORIES(include) + +ADD_LIBRARY(mylib + source/mylib1.cc + source/mylib2.cc + ) + +DEAL_II_SETUP_TARGET(mylib) +</pre> + +We have to add the directory <code>include</code> for the header files to +the current include directories with the <code>INCLUDE_DIRECTORIES</code> +statement (see <a href="#cmakeadvanced.properties">this section</a> for +details). The corresponding configuration file for the executable looks +like: + +<pre class="cmake"> +# mycode/CMakeLists.txt + +INCLUDE_DIRECTORIES( + include + ${CMAKE_SOURCE_DIR}/mylib/include + ) + +ADD_EXECUTABLE(mycode source/mycode.cc) +DEAL_II_SETUP_TARGET(mycode) + +TARGET_LINK_LIBRARIES(mycode mylib) +</pre> + +<p> +Please note that <code>CMakeLists.txt</code> files have directory scope. +Any manipulation of properties and variables have only effect in the +current directory (and subdirectories, included with +<code>ADD_SUBDIRECTORY</code>. The level above will not be affected. +Therefore, we have to specify the include directories for "mylib" again in +the subdirectory <code>mycode</code> - this time with full path +<code>${CMAKE_SOURCE_DIR}/mylib/include</code>. +</p> + +<p> +CMake defines the following variables for access to important directories: + +<pre class="cmake"> +CMAKE_SOURCE_DIR + - the source directory (i.e. the directory of the top level + CMakeLists.txt file) + +CMAKE_BINARY_DIR + - the (top level) build directory + +CMAKE_CURRENT_SOURCE_DIR + - the current source directory, i.e. location of the currently processed + CMakeLists.txt file (top level or included via ADD_SUBDIRECTORY) + +CMAKE_CURRENT_BINARY_DIR + - the build (sub)directory corresponding to CMAKE_CURRENT_SOURCE_DIR +</pre> + +</p> + +<a name="cmakeadvanced.control"></a> +<h3>Control statements</h3> + +<p>Control statements in CMake take the following form: +<pre class="cmake"> +IF(&lt;expression&gt;) + ... +ENDIF() +</pre> +or in long form: +<pre class="cmake"> +IF(&lt;expression1&gt;) + ... +ELSEIF(&lt;expression2&gt;) + ... +ELSE() + ... +ENDIF() +</pre> +Please note the (somehow uncommon) empty, opening and closing brackets +behind <code>ELSE()</code> and <code>ENDIF()</code>. +<code>&lt;expression&gt;</code> can take a multitude of different forms, +have a look at the +<a href="http://cmake.org/cmake/help/v2.8.8/cmake.html">CMake +documentation</a> for a complete list. Important examples are: +<pre class="cmake"> +IF(${variable}) + - the body will be evaluated if the variable "variable" is defined and + synonymous to true, e.g. 1, TRUE, ON, YES (modulo case insensitivity) + +IF(variable MATCHES &lt;regular expression&gt;) + - the body will be evaluated if the variable "variable" is defined and + matches the specified regular expression + +IF("${variable}" STREQUAL "foobar") + - the body will be evaluated if both strings are equal. Note that + "${variable}" will be replaced by the content of the (string) + variable "variable" +</pre> +<p>An expression can be negated by prefixing <code>NOT</code>:</p> +<pre class="cmake"> +IF(NOT &lt;expression&gt;) + ... +ENDIF() +</pre> + +<p>Loops are implemented with the help of <code>WHILE</code> and +<code>FOR</code> statements. The former takes the same +<code>&lt;expression&gt;</code> as the <code>IF</code> statement:</p> +<pre class="cmake"> +WHILE(&lt;expression&gt;) + ... +ENDWHILE() +</pre> +Given a variable <code>list</code> containing a list, the individual +elements <code>element</code> can be accessed with a <code>FOREACH</code> +statement: +<pre class="cmake"> +FOREACH(element ${list}) + ... +ENDFOREACH +</pre> +Note: It is also possible to specify the list directly: +<pre class="cmake"> +FOREACH(element foo bar baz) + # The variable element will iterate through foo, bar and baz. +ENDFOREACH +</pre> + + +<a name="cmakeadvanced.globs"></a> +<h3>File globs</h3> + +<p>A very common task is to pick up a list of source files from a +directory. You can either manage a list of source files in +<code>CMakeLists.txt</code> by hand, e.g. by manually updating all source +files for a given target, or you can use a glob to automate this process. +The following example will pick up every source file under +<code>SOURCE_DIR/sources/</code> and add it to an executable:</p> + +<pre class="cmake"> +FILE(GLOB sources ${CMAKE_SOURCE_DIR}/source/*.cc) +ADD_EXECUTABLE(mycode ${sources}) +</pre> + +<p>Please be aware of one caveat of this approach: Due to the fact that +CMake is a <i>build system generator</i> the resulting build configuration +(for make) has no way to detect whether a new source file was added (or +removed) and that it has to call back to cmake. So, after adding a new +source file you have to touch a <code>CMakeLists.txt</code> file or to run +<code>cmake .</code> again by hand. + + +<a name="cmakeadvanced.setup_target"></a> +<h3><code>DEAL_II_SETUP_TARGET</code> revisited</h3> +<p> +The <code>DEAL_II_SETUP_TARGET</code> macro is responsible for setting up a +target to compile and link against deal.II. It will <i>append</i> the +<code>INCLUDE_DIRECTORIES</code> property with the location of the deal.II +include directories, and the compile definitions and linker flags property +<code>COMPILE_DEFINITIONS</code> and <code>LINK_FLAGS</code> by their +respective values (depending on build type and available debug and/or +optimized flavor of the library). +</p> +<p> +Except in the case of an object library, the specified target will be set +up to link against deal.II (and its transitive link interface) as well. +</p> + + +<a name="cmakeadvanced.cached_variables"></a> +<h3><code>DEAL_II_INITIALIZE_CACHED_VARIABLES</code> revisited</h3> + +<p> +The <code>DEAL_II_INITIALIZE_CACHED_VARIABLES</code> macro is responsible +for setting up cached variables and has to invoked before the +<code>PROJECT</code> call: +<pre class="cmake"> +FIND_PACKAGE(deal.II 8.0 REQUIRED) + +DEAL_II_INITIALIZE_CACHED_VARIABLES() + +PROJECT(myproject) +</pre> +The macro will set an uninitialized <code>CMAKE_BUILD_TYPE</code> variable +to <code>Debug</code> (or <code>Release</code> if the debug library is not +available). If <code>CMAKE_BUILD_TYPE</code> is specified it will +automatically be reset if the given value is unsupported by the deal.II +installation. +</p> +<p> +Furthermore, this macro sets the C++ compiler and the compile flags to +default values (the same values that were used to compile deal.II itself). +These are <code>CMAKE_CXX_COMPILER</code> and <code>CMAKE_CXX_FLAGS</code>, +as well as - depending on the configuration - +<code>DEAL_II_FLAGS_DEBUG</code>, or <code>DEAL_II_FLAGS_RELEASE</code>, or +both. +</p> + +<a name="cmakeadvanced.properties"></a> +<h3>Customizing include directories and compile definitions</h3> + +<p> +You can specify custom include directories and compile definitions prior to +a target definition on a per directory basis (have a look at the <a +href="http://cmake.org/cmake/help/v2.8.8/cmake.html">CMake +documentation</a> for further details): + +<pre class="cmake"> +INCLUDE_DIRECTORIES(include1 include2) + +ADD_DEFINITIONS(-DFOO -DBAR="BAZ") + +ADD_EXECUTABLE(...) # or ADD_LIBRARY(...) +</pre> +</p> + +<a name="cmakeadvanced.external_libraries"></a> +<h3>External libraries</h3> + +<p> +For external libraries that provide a CMake project configuration or where +a CMake find module is available, including this external library in your +project is more or less straightforward. E.g. to require an external +project "foo" at least of version 8.0 write: +<pre class="cmake"> +FIND_PACKAGE(foo 8.0 REQUIRED) +</pre> +Alternatively, the version number and <code>REQUIRED</code> keyword can be +omitted. (Depending on the external library) the project configuration or +find macro will usually define variables like <code>FOO_INCLUDE_DIRS</code> +and <code>FOO_LIBRARIES</code> that can be directly used in your +<code>CMakeLists.txt</code> file: + +<pre class="cmake"> +INCLUDE_DIRECTORIES(${FOO_INCLUDE_DIRS}) + +ADD_EXECUTABLE(mycode mycode.cc) +DEAL_II_SETUP_TARGET(mycode) + +TARGET_LINK_LIBRARIES(mycode ${FOO_LIBRARIES}) +</pre> +The first statement will set up the include directories for the following +targets as explained above. The last statement with +<code>TARGET_LINK_LIBRARIES</code> will <i>add</i> the libraries in the +<code>FOO_LIBRARIES</code> variable to the link interface of the target +<code>mycode</code>. +</p> + +<a name="cmakeadvanced.run"></a> +<h3>The "run" target revisited</h3> + +<p>The simple run statement as explained <a +href="#cmakesimple.run">above</a> will run the generated executable in the +build directory. Sometimes it is more desirable to run the executable in a +dedicated <code>run</code> directory within in the build directory which is +a copy of a skeleton <code>run</code> folder from the source directory: + +<pre class="cmake"> +# Copy folder run from the source to the build directory: +FILE(COPY ${CMAKE_SOURCE_DIR}/run DESTINATION ${CMAKE_BINARY_DIR}) + +ADD_EXECUTABLE(mycode mycode.cc) +SET_PROPERTY(TARGET mycode + PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/run + ) +ADD_CUSTOM_TARGET(run + COMMAND mycode + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/run + ) +</pre> +Here, we modify the <code>RUNTIME_OUTPUT_DIRECTORY</code> property of our +target so that the executable is linked inside our designated +<code>run</code> folder, so that it is conveniently available as an +executable inside the run folder. Furthermore, we specify a +<code>WORKING_DIRECTORY</code> for the <code>run</code> target, so that +<code>make run</code> invokes the executable inside the intendet run +directory. +</p> + +<a name="cmakeadvanced.install"></a> +<h3>Install a project</h3> + +<p>If you want the <code>make install</code> to install your project to +<code>CMAKE_INSTALL_PREFIX</code> (that may be set on command line or in +the cache during the configuration stage), add appropriate +<code>INSTALL</code> statements. To install e.g. a project consisting of a +library and an executable as well as a run folder: + +<pre class="cmake"> +# [...] all the target definitions + +INSTALL(TARGETS mylib DESTINATION lib) +INSTALL(TARGETS mycode DESTINATION bin) + +INSTALL(DIRECTORY run DESTINATION share/mycode/run) +</pre> + +<a name="cmakesauto"></a> +<h2>Autopilot style CMakeLists.txt</h2> + +<p> + If you want a make interface similar to the deal.II library and + its tutorial, namely maker targets for debug and release + versions, running the code and cleaning, the easiest way to + write a <code>CMakeLists.txt</code> file may be to use + an "autopilot" style macro. Here is a minimalistic example for the + step-1 tutorial program (<a href="CMakeLists.txt.sample2" + target="_top">plain text</a> version) that can be used for simple + projects: +</p> + +<pre class="cmake"> +FIND_PACKAGE(deal.II 8.0 REQUIRED + HINTS + ${DEAL_II_DIR} ../ ../../ $ENV{DEAL_II_DIR} + # You can specify additional hints for search paths here, e.g. + # $ENV{HOME}/workspace/deal.II +) + +# Set the name of the project and target: +SET(TARGET "step-1") + +# Declare all source files the target consists of: +SET(TARGET_SRC + step-1.cc + # You can specify additional files here! +) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8) +DEAL_II_INITIALIZE_CACHED_VARIABLES() +PROJECT(${TARGET} CXX) +DEAL_II_INVOKE_AUTOPILOT() +</pre> + + + This <code>CMakeLists.txt</code> is intended for use with a small + project and <i>in-source</i> build (i.e., one does not create a separate + build directory as we recommend for the <acronym>deal.II</acronym> build + in the <a href="../readme.html#configuration" target="_body">readme + file</a>). Using this input file, you can run <code>cmake</code> in the + source directory as follows: + +<pre class="sample"> +$ cd step-1 +$ cmake . + +[...] + +### +# +# Successfully set up project step-1 with deal.II-99.99.svn30300 found at +# /usr +# +# CMAKE_BUILD_TYPE: Debug +# +# You can now run +# $ make - to compile and link the program +# $ make run - to (compile, link and) run the program +# +# $ make debug - to switch the build type to Debug +# $ make release - to switch the build type to Release +# +# $ make edit_cache - to change (cached) configuration variables +# and rerun the configure and generate phases of CMake +# +# $ make strip_comments - strip the source files in this +# directory off the documentation comments +# $ make clean - to remove the generated executable as well as +# all intermediate compilation files +# $ make runclean - to remove all output generated by the program +# $ make distclean - to clean the directory from _all_ generated +# files (includes clean, runclean and the removal +# of the generated build system) +# +# $ make help - to view this message again +# +# Have a nice day! +# +### +</pre> + + There are two additional configuration options (in addition to + <code>TARGET</code> and <code>TARGET_SRC</code>) that can be set via + variables before <code>DEAL_II_INVOKE_AUTOPILOT()</code> is called + (<a href="CMakeLists.txt.sample3" target="_top">plain text</a> version): + +<pre class="cmake"> +# (Optional) +# Specify a list of files (file globs) that will be removed +# with the "make runclean" and "make distclean" targets. +# (If empty, sensible default values will be used.) +SET(CLEAN_UP_FILES + # a custom list of globs, e.g. *.log *.vtk +) + +# (Optional) +# A custom command line that should be invoked by "make run". +# (If empty, ./${TARGET} will be invoked.) +SET(TARGET_RUN + # a custom command line, e.g. mpirun -np 2 ${TARGET} +) +</pre> + + +<a name="dealiiconfig"></a> +<h2> <code>deal.IIConfig.cmake</code> </h2> + +<p> + Importing the deal.IIConfig.cmake file via <code>FIND_PACKAGE</code> + will set the following variables and macros; all of the form + <code>DEAL_II_*</code>: +</p> +<pre class="cmake"> +# +# General package information: +# + +DEAL_II_PACKAGE_NAME +DEAL_II_PACKAGE_VERSION - the full package version string, e.g. "8.1.pre" +DEAL_II_PACKAGE_VENDOR +DEAL_II_PACKAGE_DESCRIPTION + +DEAL_II_VERSION - version string without suffix, e.g. "8.1" +DEAL_II_VERSION_MAJOR - the major number, e.g. "8" +DEAL_II_VERSION_MINOR - the minor version number, e.g. "1" + +DEAL_II_BUILD_TYPE - the configured build type, e.g. "DebugRelease" +DEAL_II_BUILD_TYPES - an all caps list of available configurations, + e.g. "DEBUG;RELEASE" + +# +# Information about component locations: +# + +DEAL_II_PATH +DEAL_II_CMAKE_MACROS_RELDIR +DEAL_II_COMMON_RELDIR +DEAL_II_DOCREADME_RELDIR +DEAL_II_DOCHTML_RELDIR +DEAL_II_EXAMPLES_RELDIR +DEAL_II_EXECUTABLE_RELDIR +DEAL_II_INCLUDE_RELDIR +DEAL_II_LIBRARY_RELDIR +DEAL_II_PROJECT_CONFIG_RELDIR + +DEAL_II_BUILD_DIR - true if deal.II was picked up from a build + dir, false if the configuration is from an installation + +# +# Compiler and linker configuration +# + +DEAL_II_CXX_COMPILER - the compiler used to compile deal.II + +DEAL_II_CXX_FLAGS - compile flags for all configurations +DEAL_II_CXX_FLAGS_DEBUG - _additional_ compile flags for the debug configuration +DEAL_II_CXX_FLAGS_RELEASE - _additional_ compile flags for the release configuration + +DEAL_II_LINKER_FLAGS - link flags for all configurations +DEAL_II_LINKER_FLAGS_DEBUG - _additional_ link flags for debug configuration +DEAL_II_LINKER_FLAGS_RELEASE - _additional_ link flags for release configuration + +DEAL_II_USER_DEFINITIONS - compile definitions for all configurations +DEAL_II_USER_DEFINITIONS_DEBUG - _additional_ compile definitions for debug configuration +DEAL_II_USER_DEFINITIONS_RELEASE - _additional_ compile definitions for release configuration + +DEAL_II_STATIC_EXECUTABLE - true if the link interface is set up to + compile resulting executables statically + +# +# Information about include directories and libraries +# + +DEAL_II_INCLUDE_DIRS + +DEAL_II_LIBRARIES_DEBUG - a list of the full link interface for the debug configuration +DEAL_II_LIBRARIES_RELEASE - a list of the full link interface for the release configuration +DEAL_II_LIBRARIES - full list of libraries with "debug" and "optimized" keywords + +# +# Information about library targets +# + +DEAL_II_TARGET_CONFIG - the target config file + +DEAL_II_TARGET_DEBUG - the name of the debug target that is available after inclusion + of the target config file +DEAL_II_TARGET_RELEASE - the name of the release target +DEAL_II_TARGET - full list of targets with "debug" and "optimized" keywords + +# +# Feature configuration: The following booleans are set to "ON" or "OFF" depending +# on the current feature configuration: +# + +DEAL_II_WITH_64BIT_INDICES +DEAL_II_WITH_ARPACK +DEAL_II_WITH_BOOST +DEAL_II_WITH_FUNCTIONPARSER +DEAL_II_WITH_HDF5 +DEAL_II_WITH_LAPACK +DEAL_II_WITH_METIS +DEAL_II_WITH_MPI +DEAL_II_WITH_MUMPS +DEAL_II_WITH_NETCDF +DEAL_II_WITH_P4EST +DEAL_II_WITH_PETSC +DEAL_II_WITH_SLEPC +DEAL_II_WITH_THREADS +DEAL_II_WITH_TRILINOS +DEAL_II_WITH_UMFPACK +DEAL_II_WITH_ZLIB +</pre> + + <a name="legacy"></a> + <h2> Legacy Make.global_options </h2> + + <p> + Before version 8.0, <acronym>deal.II</acronym> used the + traditional <code>autoconf/make</code> configuration and build + system. The interaction between these two programs, as well as + propagation of information from <acronym>deal.II</acronym> to user + programs happened through a number of files that were generated within + the <acronym>deal.II</acronym> directory tree. + The CMake build system sets up the following compatibility files (if + <code>DEAL_II_COMPONENT_COMPAT_FILES</code> is set, which is default): + <pre> + + ${CMAKE_INSTALL_PREFIX} + ./common/Make.global_options + ./common/scripts/expand_instantiations + ./common/scripts/make_dependencies + ./common/scripts/report_features + </pre> + + Therefore, it should be sufficient to set <code>D</code> in the old + user Makefiles to: + <pre> + + D=/path/install/dir + </pre> + where <code>/path/install/dir</code> is the directory set up via + <code>CMAKE_INSTALL_PREFIX</code> (the path + <acronym>deal.II</acronym> was installed to). + </p> + + <hr /> + <address> + <a href="../authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> + + </body> +</html> diff --git a/deal.II/doc/development/doxygen.html b/deal.II/doc/users/doxygen.html similarity index 78% rename from deal.II/doc/development/doxygen.html rename to deal.II/doc/users/doxygen.html index 2db340d6a2..b9c70b428f 100644 --- a/deal.II/doc/development/doxygen.html +++ b/deal.II/doc/users/doxygen.html @@ -18,7 +18,7 @@ <p>deal.II has an extensive reference documentation generated by <a href="http://www.doxygen.org">Doxygen</a>. One of the many - features of Doxygen is, that all class names, function noames and so + features of Doxygen is, that all class names, function names and so on are cross-linked in the documentation, and a single click suffices to jump to the documentation of an object.</p> @@ -49,11 +49,17 @@ TAGFILES = deal.tag=http://www.dealii.org/X.Y.Z/doxygen/deal.II </li> </ol> - <hr> - + <hr /> <address> - <a href="../mail.html">The deal.II Group</a></address> - + <a href="../authors.html" target="body">The deal.II Authors</a> + $Date$ + </address> + <div class="right"> + <a href="http://validator.w3.org/check?uri=referer" target="_top"> + <img style="border:0" src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a> + <a href="http://jigsaw.w3.org/css-validator/check/referer" target="_top"> + <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> + </div> </body> </html> diff --git a/deal.II/doc/users/index.html b/deal.II/doc/users/index.html new file mode 100644 index 0000000000..de8bad7977 --- /dev/null +++ b/deal.II/doc/users/index.html @@ -0,0 +1,34 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" + "http://www.w3.org/TR/REC-html40/frameset.dtd"> +<html> +<head> + <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> + <title>deal.II Development Information</title> + <link href="../screen.css" type="text/css" rel="StyleSheet"> + <link rel="SHORTCUT ICON" href="../deal.ico"> + <meta name="author" content="the deal.II authors <authors@dealii.org>"> + <meta name="copyright" content="Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2007, 2012 by the deal.II authors"> + <meta name="date" content="$Date$"> + <meta name="svn_id" content="$Id$"> + <meta http-equiv="content-language" content="en"> +</head> + +<frameset rows="70,*"> + <frame name="title" src="title.html" frameborder="1"> + <frameset cols="150,*"> + <frame name="navbar" src="navbar.html" frameborder="0"> + <frame name="body" src="toc.html" frameborder="0"> + </frameset> + <noframes> + <h1>deal.II Development Information</h1> + Your browser does not seem to understand frames. A version of this + page that does not use frames can be found at + <a href="toc.html">toc.html</a>. + + + + + + + + diff --git a/deal.II/doc/users/navbar.html b/deal.II/doc/users/navbar.html new file mode 100644 index 0000000000..24cce95169 --- /dev/null +++ b/deal.II/doc/users/navbar.html @@ -0,0 +1,62 @@ + + + + + deal.II Development Navigation Bar + + + + + + + + + +

    + http://www.dealii.org
    + Home
    +

    + +
    + +

    + README
    + Users' Corner
    + Developers' Corner
    +

    + +
    + + Documentation + +

    + CMake documentation
    + CMake in user projects
    + Linking manuals
    +

    + +
    + + Doxygen +

    + Tutorial
    + Manual
    + Video lectures
    +

    + +
    + + Online Resources +

    + FAQ
    + News
    + Download
    + Mailing list
    + Wiki
    + Bug tracker
    +

    + + + diff --git a/deal.II/doc/users/title.html b/deal.II/doc/users/title.html new file mode 100644 index 0000000000..86ff2ea4f7 --- /dev/null +++ b/deal.II/doc/users/title.html @@ -0,0 +1,31 @@ + + + + + deal.II Tutorial + + + + + + + + + + +
    +

    + Users' Corner +

    +
    + + + + + + + + + + diff --git a/deal.II/doc/users/toc.html b/deal.II/doc/users/toc.html new file mode 100644 index 0000000000..88be29bf63 --- /dev/null +++ b/deal.II/doc/users/toc.html @@ -0,0 +1,125 @@ + + + + + The deal.II Development Page + + + + + + + + + + +

    +
    + This page gathers some information on developing programs based on + deal.II, as well as on how to configure and use + deal.II. At present, we have the following resources + available: +

    + + +

    Documentation

    + +
      + +
    • + deal.II CMake documentation: + This page provides extensive information about configuration and + installation with the CMake build system. + +

    • Using CMake and + deal.II in a user project: + This page covers how to use CMake in your own project. + An overview of how to retrieve necessary information + from a deal.II installation as well as how to + write a CMakeLists.txt for a client project is given. +

      + +
    • Linking your online documentation + to the deal.II online manual: After spending a lot of time + writing good documentation for your code and putting it online, + here we explain how to put links to the deal.II online manual into + your documentation, so that readers can click through. +

      + +
    • Bugs: + Though well tested, deal.II certainly has + bugs. If you want to report a bug (or enhancement request), + go to the bug tracking system and enter a new ticket + for your issue. +

      + +
    + + +

    Tutorials

    + +

    + The tutorial is + for new users of the library. It explains the basic elements of + finite element programs based on the library, and provides small + example programs. You can also reach the tutorial link from the menu bar + at the left. +

    + +

    + Note that along with the rest of the documentation, the local HTML pages + of the tutorials need to be generated first. Please follow the + instructions in the + ReadMe on how to do + this. +

    + + +

    Programming interface

    + +

    + The programming + interface/manual pages are what you will need most often as a + reference of all classes, functions and variables in the library. They + are extensively documented (presently more than 5000 pages if + printed), and generated by Doxygen. There is also a quick link to these pages from + the menu bar at the left. +

    + +

    + The documentation uses many of the features of Doxygen. In particular, + the link takes you straight to a page that lists modules, a way + to group classes with similar purposes. This may be what you are probably + interested in when you are not yet familiar with the library. If you + already know your way around and want to look up the signature of a + particular member function, for example, you may go to the class view or + choose any of the other ways in which Doxygen allows you to navigate + through the documentation. +

    + +

    + Just as for the tutorials, the API docs need to be generated first, + if you download deal.II. Please follow the + instructions in the + ReadMe on how to do + this. +

    + +
    +
    + The deal.II Authors + $Date$ +
    +
    + + Valid HTML 4.01! + + Valid CSS! +
    + + + diff --git a/deal.II/examples/CMakeLists.txt b/deal.II/examples/CMakeLists.txt index 2f000368c2..3655a42bf1 100644 --- a/deal.II/examples/CMakeLists.txt +++ b/deal.II/examples/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- IF(DEAL_II_COMPONENT_EXAMPLES) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ diff --git a/deal.II/examples/doxygen/block_matrix_array.cc b/deal.II/examples/doxygen/block_matrix_array.cc index 9bd247f98f..6a38408631 100644 --- a/deal.II/examples/doxygen/block_matrix_array.cc +++ b/deal.II/examples/doxygen/block_matrix_array.cc @@ -1,13 +1,19 @@ -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005-2006, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed without copyright -// and license information. Please refer to the file -// deal.II/doc/license.html for the text and further information on this -// license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // See documentation of BlockMatrixArray for documentation of this example diff --git a/deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc b/deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc index f7a894dbc8..65b9386800 100644 --- a/deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc +++ b/deal.II/examples/doxygen/compressed_block_sparsity_pattern.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006-2007 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // See documentation of BlockCompressedSparsityPattern for documentation of this example diff --git a/deal.II/examples/doxygen/product_matrix.cc b/deal.II/examples/doxygen/product_matrix.cc index 6a2012ed14..b3487b5925 100644 --- a/deal.II/examples/doxygen/product_matrix.cc +++ b/deal.II/examples/doxygen/product_matrix.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005-2006, 2010, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed without copyright -// and license information. Please refer to the file -// deal.II/doc/license.html for the text and further information on this -// license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // See documentation of ProductMatrix for documentation of this example diff --git a/deal.II/examples/doxygen/theta_timestepping.cc b/deal.II/examples/doxygen/theta_timestepping.cc index f0900ba50a..94871bd102 100644 --- a/deal.II/examples/doxygen/theta_timestepping.cc +++ b/deal.II/examples/doxygen/theta_timestepping.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005-2006, 2010, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // See documentation of ThetaTimestepping for documentation of this example diff --git a/deal.II/examples/step-1/step-1.cc b/deal.II/examples/step-1/step-1.cc index 26f93aa863..09599c7935 100644 --- a/deal.II/examples/step-1/step-1.cc +++ b/deal.II/examples/step-1/step-1.cc @@ -1,13 +1,22 @@ -/* $Id$ +/* --------------------------------------------------------------------- + * $Id$ * - * Copyright (C) 1999-2003, 2005-2007, 2009, 2011-2013 by the deal.II authors + * Copyright (C) 1999 - 2013 by the deal.II authors * - * This file is subject to QPL and may not be distributed - * without copyright and license information. Please refer - * to the file deal.II/doc/license.html for the text and - * further information on this license. + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + */ + // @sect3{Include files} // The most fundamental class in the library is the Triangulation class, which @@ -84,7 +93,7 @@ void second_grid () // We then fill it with a ring domain. The center of the ring shall be the // point (1,0), and inner and outer radius shall be 0.5 and 1. The number of // circumferential cells could be adjusted automatically by this function, - // but we choose to set it explicitely to 10 as the last argument: + // but we choose to set it explicitly to 10 as the last argument: const Point<2> center (1,0); const double inner_radius = 0.5, outer_radius = 1.0; diff --git a/deal.II/examples/step-10/doc/results.dox b/deal.II/examples/step-10/doc/results.dox index 2e25ba40fa..dcc5dac011 100644 --- a/deal.II/examples/step-10/doc/results.dox +++ b/deal.II/examples/step-10/doc/results.dox @@ -9,7 +9,7 @@ the commands @code set style data lines set size 0.721, 1 -set nokey +unset key plot [-1:1][-1:1] "ball0_mapping_q1.dat" @endcode or using one of the other filenames. The second line makes sure that @@ -90,104 +90,101 @@ good accuracy. This is the output of this part of the program: Computation of Pi by the area: ============================== Degree = 1 -cells eval.pi error -5 1.9999999999999998 1.1416e+00 - -20 2.8284271247461898 3.1317e-01 1.87 -80 3.0614674589207178 8.0125e-02 1.97 -320 3.1214451522580520 2.0148e-02 1.99 -1280 3.1365484905459389 5.0442e-03 2.00 -5120 3.1403311569547521 1.2615e-03 2.00 +cells eval.pi error + 5 1.9999999999999993 1.1416e+00 - + 20 2.8284271247461894 3.1317e-01 1.87 + 80 3.0614674589207178 8.0125e-02 1.97 + 320 3.1214451522580520 2.0148e-02 1.99 + 1280 3.1365484905459393 5.0442e-03 2.00 + 5120 3.1403311569547534 1.2615e-03 2.00 Degree = 2 -cells eval.pi error -5 3.1045694996615869 3.7023e-02 - -20 3.1391475703122276 2.4451e-03 3.92 -80 3.1414377167038303 1.5494e-04 3.98 -320 3.1415829366419019 9.7169e-06 4.00 -1280 3.1415920457576907 6.0783e-07 4.00 -5120 3.1415926155921126 3.7998e-08 4.00 +cells eval.pi error + 5 3.1045694996615865 3.7023e-02 - + 20 3.1391475703122271 2.4451e-03 3.92 + 80 3.1414377167038303 1.5494e-04 3.98 + 320 3.1415829366419015 9.7169e-06 4.00 + 1280 3.1415920457576911 6.0783e-07 4.00 + 5120 3.1415926155921139 3.7998e-08 4.00 Degree = 3 -cells eval.pi error -5 3.1465390309173475 4.9464e-03 - -20 3.1419461263297386 3.5347e-04 3.81 -80 3.1416154689089382 2.2815e-05 3.95 -320 3.1415940909713274 1.4374e-06 3.99 -1280 3.1415927436051230 9.0015e-08 4.00 -5120 3.1415926592185492 5.6288e-09 4.00 +cells eval.pi error + 5 3.1410033851499310 5.8927e-04 - + 20 3.1415830393583861 9.6142e-06 5.94 + 80 3.1415925017363837 1.5185e-07 5.98 + 320 3.1415926512106722 2.3791e-09 6.00 + 1280 3.1415926535525962 3.7197e-11 6.00 + 5120 3.1415926535892140 5.7923e-13 6.00 Degree = 4 -cells eval.pi error -5 3.1418185737113964 2.2592e-04 - -20 3.1415963919525050 3.7384e-06 5.92 -80 3.1415927128397780 5.9250e-08 5.98 -320 3.1415926545188264 9.2903e-10 5.99 -1280 3.1415926536042722 1.4479e-11 6.00 -5120 3.1415926535899668 1.7343e-13 6.38 - +cells eval.pi error + 5 3.1415871927401127 5.4608e-06 - + 20 3.1415926314742437 2.2116e-08 7.95 + 80 3.1415926535026228 8.7170e-11 7.99 + 320 3.1415926535894529 3.4036e-13 8.00 + 1280 3.1415926535897927 2.9187e-16 10.19 + 5120 3.1415926535897944 1.3509e-15 -2.21 Computation of Pi by the perimeter: =================================== Degree = 1 -cells eval.pi error -5 2.8284271247461903 3.1317e-01 - -20 3.0614674589207183 8.0125e-02 1.97 -80 3.1214451522580524 2.0148e-02 1.99 -320 3.1365484905459393 5.0442e-03 2.00 -1280 3.1403311569547525 1.2615e-03 2.00 -5120 3.1412772509327729 3.1540e-04 2.00 +cells eval.pi error + 5 2.8284271247461898 3.1317e-01 - + 20 3.0614674589207178 8.0125e-02 1.97 + 80 3.1214451522580520 2.0148e-02 1.99 + 320 3.1365484905459393 5.0442e-03 2.00 + 1280 3.1403311569547525 1.2615e-03 2.00 + 5120 3.1412772509327729 3.1540e-04 2.00 Degree = 2 -cells eval.pi error -5 3.1248930668550599 1.6700e-02 - -20 3.1404050605605454 1.1876e-03 3.81 -80 3.1415157631807014 7.6890e-05 3.95 -320 3.1415878042798613 4.8493e-06 3.99 -1280 3.1415923498174538 3.0377e-07 4.00 -5120 3.1415926345932004 1.8997e-08 4.00 +cells eval.pi error + 5 3.1248930668550594 1.6700e-02 - + 20 3.1404050605605449 1.1876e-03 3.81 + 80 3.1415157631807014 7.6890e-05 3.95 + 320 3.1415878042798617 4.8493e-06 3.99 + 1280 3.1415923498174534 3.0377e-07 4.00 + 5120 3.1415926345932004 1.8997e-08 4.00 Degree = 3 -cells eval.pi error -5 3.1442603311164286 2.6677e-03 - -20 3.1417729561193588 1.8030e-04 3.89 -80 3.1416041192612365 1.1466e-05 3.98 -320 3.1415933731961760 7.1961e-07 3.99 -1280 3.1415926986118001 4.5022e-08 4.00 -5120 3.1415926564043946 2.8146e-09 4.00 +cells eval.pi error + 5 3.1414940401456057 9.8613e-05 - + 20 3.1415913432549156 1.3103e-06 6.23 + 80 3.1415926341726914 1.9417e-08 6.08 + 320 3.1415926532906893 2.9910e-10 6.02 + 1280 3.1415926535851360 4.6571e-12 6.01 + 5120 3.1415926535897203 7.2845e-14 6.00 Degree = 4 -cells eval.pi error -5 3.1417078926581086 1.1524e-04 - -20 3.1415945317216001 1.8781e-06 5.94 -80 3.1415926832497720 2.9660e-08 5.98 -320 3.1415926540544636 4.6467e-10 6.00 -1280 3.1415926535970535 7.2602e-12 6.00 -5120 3.1415926535899010 1.0805e-13 6.07 +cells eval.pi error + 5 3.1415921029432576 5.5065e-07 - + 20 3.1415926513737600 2.2160e-09 7.96 + 80 3.1415926535810712 8.7218e-12 7.99 + 320 3.1415926535897594 3.3668e-14 8.02 + 1280 3.1415926535897922 1.0617e-15 4.99 + 5120 3.1415926535897931 1.0061e-16 3.40 @endcode -One of the immediate observations from the output is that in all cases -the values converge quickly to the true value of -$\pi=3.141592653589793238462643$. Note that for the $Q_4$ mapping, the last -number is correct to 13 digits in both computations, which is already -quite a lot. However, also note that for the $Q_1$ mapping, even on the -finest grid the accuracy is significantly worse than on the coarse -grid for a $Q_4$ mapping! +One of the immediate observations from the output is that in all cases the +values converge quickly to the true value of +$\pi=3.141592653589793238462643$. Note that for the $Q_4$ mapping, we are +already in the regime of roundoff errors and the convergence rate levels off, +which is already quite a lot. However, also note that for the $Q_1$ mapping, +even on the finest grid the accuracy is significantly worse than on the coarse +grid for a $Q_3$ mapping! -The last column of the output shows the convergence order, in powers -of the mesh width $h$. In the introduction, we had stated that -the convergence order for a $Q_p$ mapping should be -$h^{p+1}$. However, in the example shown, the $Q_2$ and $Q_4$ -mappings show a convergence order of $h^{p+2}$! This at -first surprising fact is readily explained by the particular boundary -we have chosen in this example. In fact, the circle is described by the function -$\sqrt{1-x^2}$, which has the series expansion -$1-x^2/2-x^4/8-x^6/16+\ldots$ -around $x=0$. Thus, for the quadratic mapping where the -truncation error of the quadratic approximation should be cubic, there -is no such term but only a quartic one, which raises the convergence -order to 4, instead of 3. The same happens for the $Q_4$ mapping. +The last column of the output shows the convergence order, in powers of the +mesh width $h$. In the introduction, we had stated that the convergence order +for a $Q_p$ mapping should be $h^{p+1}$. However, in the example shown, the +order is rather $h^{2p}$! This at first surprising fact is explained by the +properties of the $Q_p$ mapping. At order p, it uses support points +that are based on the p+1 point Gauss-Lobatto quadrature rule that +selects the support points in such a way that the quadrature rule converges at +order 2p. Even though these points are here only used for interpolation +of a pth order polynomial, we get a superconvergence effect when +numerically evaluating the integral that actually gives this high order of +convergence. diff --git a/deal.II/examples/step-10/step-10.cc b/deal.II/examples/step-10/step-10.cc index d9bf4843a7..90c70d633b 100644 --- a/deal.II/examples/step-10/step-10.cc +++ b/deal.II/examples/step-10/step-10.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, Ralf Hartmann, University of Heidelberg, 2001 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2001 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Wolfgang Bangerth, Ralf Hartmann, University of Heidelberg, 2001 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2001-2004, 2006-2007, 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // The first of the following include files are probably well-known by now and // need no further explanation. @@ -124,7 +134,7 @@ namespace Step10 // will generate Gnuplot output, which consists of a set of lines // describing the mapped triangulation. By default, only one line // is drawn for each face of the triangulation, but since we want - // to explicitely see the effect of the mapping, we want to have + // to explicitly see the effect of the mapping, we want to have // the faces in more detail. This can be done by passing the // output object a structure which contains some flags. In the // present case, since Gnuplot can only draw straight lines, we diff --git a/deal.II/examples/step-11/doc/intro.dox b/deal.II/examples/step-11/doc/intro.dox index d4671fcffd..50f8b60653 100644 --- a/deal.II/examples/step-11/doc/intro.dox +++ b/deal.II/examples/step-11/doc/intro.dox @@ -31,7 +31,7 @@ For this, there are various possibilities: solutions of Laplace's equation are only in $H^1$, which does not allow for the definition of point values because it is not a subset of the continuous functions. Therefore, even though fixing one node is allowed for - discretitized functions, it is not for continuous functions, and one can + discretized functions, it is not for continuous functions, and one can often see this in a resulting error spike at this point in the numerical solution. @@ -57,7 +57,7 @@ various places where we use it; in almost all conceivable cases, you will only consider the objects describing mappings as a black box which you need not worry about, because their only uses seem to be to be passed to places deep inside the library where functions know how to handle them (i.e. in the -FEValues classes and their descendents). +FEValues classes and their descendants). The tricky point in this program is the use of the mean value constraint. Fortunately, there is a class in the library which knows how to diff --git a/deal.II/examples/step-11/doc/results.dox b/deal.II/examples/step-11/doc/results.dox index c8b0c67829..d76412f842 100644 --- a/deal.II/examples/step-11/doc/results.dox +++ b/deal.II/examples/step-11/doc/results.dox @@ -40,5 +40,5 @@ higher order mappings; it is therefore clearly advantageous in this case to use a higher order mapping, not because it improves the order of convergence but just to reduce the constant before the convergence order. On the other hand, using a cubic mapping only improves the -result further insignicantly, except for the case of very coarse +result further insignificantly, except for the case of very coarse grids. diff --git a/deal.II/examples/step-11/step-11.cc b/deal.II/examples/step-11/step-11.cc index d27b6d1fda..c5b2276390 100644 --- a/deal.II/examples/step-11/step-11.cc +++ b/deal.II/examples/step-11/step-11.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 2001 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2001 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 2001 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2001-2004, 2006, 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // As usual, the program starts with a rather long list of include files which // you are probably already used to by now: @@ -130,7 +140,7 @@ namespace Step11 // the mean value of the degrees of freedom on the boundary shall be // zero. For this, we first want a list of those nodes which are actually // at the boundary. The DoFTools class has a function that - // returns an array of boolean values where true indicates + // returns an array of Boolean values where true indicates // that the node is at the boundary. The second argument denotes a mask // selecting which components of vector valued finite elements we want to // be considered. This sort of information is encoded using the diff --git a/deal.II/examples/step-12/step-12.cc b/deal.II/examples/step-12/step-12.cc index 2ad4fc7d51..26c26d3acf 100644 --- a/deal.II/examples/step-12/step-12.cc +++ b/deal.II/examples/step-12/step-12.cc @@ -1,13 +1,23 @@ -/* Author: Guido Kanschat, Texas A&M University, 2009 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2010-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2009 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Guido Kanschat, Texas A&M University, 2009 + */ + // The first few files have already been covered in previous examples and will // thus not be further commented on: diff --git a/deal.II/examples/step-13/doc/intro.dox b/deal.II/examples/step-13/doc/intro.dox index 7362602221..de67cb0faf 100644 --- a/deal.II/examples/step-13/doc/intro.dox +++ b/deal.II/examples/step-13/doc/intro.dox @@ -43,7 +43,7 @@ a different module if they were not cleanly separated. In previous examples, you have seen how the library itself is broken -up into several complexes each building atop the underying ones, but +up into several complexes each building atop the underlying ones, but relatively independent of the other ones:
    1. the triangulation class complex, with associated iterator classes; @@ -133,7 +133,7 @@ applications, there would of course be comments and class documentation, which would bring that to maybe 1200 lines. Yet, compared to the applications listed above, this is still small, as they are 20 to 25 times as large. For programs as large, a proper design right from -the start is thus indispensible. Otherwise, it will have to be +the start is thus indispensable. Otherwise, it will have to be redesigned at one point in its life, once it becomes too large to be manageable. @@ -149,7 +149,7 @@ dependent application, the major concern is when to store data to disk and when to reload it again; if this is not done in an organized fashion, then you end up with data released too early, loaded too late, or not released at all). Although the present example program -thus draws from sevelar years of experience, it is certainly not +thus draws from several years of experience, it is certainly not without flaws in its design, and in particular might not be suited for an application where the objective is different. It should serve as an inspiration for writing your own application in a modular way, to diff --git a/deal.II/examples/step-13/step-13.cc b/deal.II/examples/step-13/step-13.cc index bc0412e6a5..8e88ee8ad8 100644 --- a/deal.II/examples/step-13/step-13.cc +++ b/deal.II/examples/step-13/step-13.cc @@ -1,13 +1,22 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 2001, 2002 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2001-2004, 2006-2009, 2011-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2001 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 2001, 2002 + */ // As in all programs, we start with a list of include files from the library, @@ -161,7 +170,7 @@ namespace Step13 // macros. We use this mechanism here again. // // From this, the actual declaration of this class should be evident. Note - // that of course even if we do not list a destructor explicitely, an + // that of course even if we do not list a destructor explicitly, an // implicit destructor is generated from the compiler, and it is virtual // just as the one of the base class. template @@ -791,7 +800,7 @@ namespace Step13 // The second of this pair of functions takes a range of cell iterators, // and assembles the system matrix on this part of the domain. Since it's // actions have all been explained in previous programs, we do not comment - // on it any more, except for one pointe below. + // on it any more, except for one point below. template void Solver::assemble_matrix (LinearSystem &linear_system, @@ -839,8 +848,8 @@ namespace Step13 // lead to deadlocks. A similar situation arises, when one changes // the code to have a return statement somewhere in the middle of // the locked block, and forgets that before we call - // return, we also have to unlock the mutex. This all - // is not be a problem here, but we want to show the general + // return, we also have to unlock the mutex. All this + // is no problem here, but we want to show the general // technique to cope with these problems nevertheless: have an // object that upon initialization (i.e. in its constructor) locks // the mutex, and on running the destructor unlocks it again. This @@ -852,7 +861,7 @@ namespace Step13 // will always be unlocked when we exit this part of the program, // whether the operation completed successfully or not, whether the // exit path was something we implemented willfully or whether the - // function was exited by an exception that we did not forsee. + // function was exited by an exception that we did not foresee. // // deal.II implements the scoped locking pattern in the // Treads::Mutex::ScopedLock class: it takes the mutex in the @@ -1111,7 +1120,7 @@ namespace Step13 // @sect4{Local refinement by the Kelly error indicator} // The second class implementing refinement strategies uses the Kelly - // refinemet indicator used in various example programs before. Since this + // refinement indicator used in various example programs before. Since this // indicator is already implemented in a class of its own inside the // deal.II library, there is not much t do here except cal the function // computing the indicator, then using it to select a number of cells for diff --git a/deal.II/examples/step-14/doc/results.dox b/deal.II/examples/step-14/doc/results.dox index b572963139..16af19d8e7 100644 --- a/deal.II/examples/step-14/doc/results.dox +++ b/deal.II/examples/step-14/doc/results.dox @@ -286,7 +286,7 @@ like this: -Note the assymetry of the grids compared with those we obtained for +Note the asymmetry of the grids compared with those we obtained for the point evaluation, which is due to the directionality of the x-derivative for which we tailored the refinement criterion. diff --git a/deal.II/examples/step-14/step-14.cc b/deal.II/examples/step-14/step-14.cc index 7c26dd5c6a..32d5710ce1 100644 --- a/deal.II/examples/step-14/step-14.cc +++ b/deal.II/examples/step-14/step-14.cc @@ -1,13 +1,22 @@ -/* Author: Wolfgang Bangerth, ETH Zurich, 2002 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2002-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2002 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, ETH Zurich, 2002 + */ // Start out with well known things... @@ -205,7 +214,7 @@ namespace Step14 // afterwards... double point_derivative = 0; - // ...then have some objects of which the meaning wil become clear + // ...then have some objects of which the meaning will become clear // below... QTrapez vertex_quadrature; FEValues fe_values (dof_handler.get_fe(), @@ -1456,7 +1465,7 @@ namespace Step14 // We will then implement two such classes, for the evaluation of a point // value and of the derivative of the solution at that point. For these // functionals we already have the corresponding evaluation objects, so they - // are comlementary. + // are complementary. namespace DualFunctional { // @sect4{The DualFunctionalBase class} @@ -1683,7 +1692,7 @@ namespace Step14 // Finally, we have by now only integrated the gradients of the shape // functions, not taking their mean value. We fix this by dividing by // the measure of the volume over which we have integrated: - rhs.scale (1./total_volume); + rhs /= total_volume; } @@ -2362,7 +2371,7 @@ namespace Step14 // Next we have the function that is called to estimate the error on a // subset of cells. The function may be called multiply if the library was - // configured to use multi-threading. Here it goes: + // configured to use multithreading. Here it goes: template void WeightedResidual:: @@ -2391,7 +2400,7 @@ namespace Step14 // Then calculate the start cell for this thread. We let the different // threads run on interleaved cells, i.e. for example if we have 4 - // threads, then the first thread treates cells 0, 4, 8, etc, while the + // threads, then the first thread treats cells 0, 4, 8, etc, while the // second threads works on cells 1, 5, 9, and so on. The reason is that // it takes vastly more time to work on cells with hanging nodes than on // regular cells, but such cells are not evenly distributed across the @@ -2573,20 +2582,20 @@ namespace Step14 // element solution at the quadrature points on the other side of the // face, i.e. from the neighboring cell. // - // For this, do a sanity check before: make sure that the neigbor + // For this, do a sanity check before: make sure that the neighbor // actually exists (yes, we should not have come here if the neighbor // did not exist, but in complicated software there are bugs, so better // check this), and if this is not the case throw an error. Assert (cell->neighbor(face_no).state() == IteratorState::valid, ExcInternalError()); // If we have that, then we need to find out with which face of the - // neighboring cell we have to work, i.e. the home-manythe + // neighboring cell we have to work, i.e. the how-many'th the // neighbor the present cell is of the cell behind the present face. For // this, there is a function, and we put the result into a variable with // the name neighbor_neighbor: const unsigned int neighbor_neighbor = cell->neighbor_of_neighbor (face_no); - // Then define an abbreviation for the neigbor cell, initialize the + // Then define an abbreviation for the neighbor cell, initialize the // FEFaceValues object on that cell, and extract the // gradients on that cell: const active_cell_iterator neighbor = cell->neighbor(face_no); @@ -2662,9 +2671,9 @@ namespace Step14 ExcInternalError()); // Then find out which neighbor the present cell is of the adjacent - // cell. Note that we will operator on the children of this adjacent + // cell. Note that we will operate on the children of this adjacent // cell, but that their orientation is the same as that of their mother, - // i.e. the neigbor direction is the same. + // i.e. the neighbor direction is the same. const unsigned int neighbor_neighbor = cell->neighbor_of_neighbor (face_no); @@ -2827,7 +2836,7 @@ namespace Step14 // Finally, we have a variable that denotes the maximum number of // degrees of freedom we allow for the (primal) discretization. If it is - // exceeded, we stop the process of solving and intermittend mesh + // exceeded, we stop the process of solving and intermittent mesh // refinement. Its default value is 20,000. unsigned int max_degrees_of_freedom; diff --git a/deal.II/examples/step-15/doc/intro.dox b/deal.II/examples/step-15/doc/intro.dox index 33494379eb..2cebf0f9f1 100644 --- a/deal.II/examples/step-15/doc/intro.dox +++ b/deal.II/examples/step-15/doc/intro.dox @@ -84,7 +84,7 @@ boundary condition of this problem. Assuming that $u^{n}$ already has the right boundary values, the Newton update $\delta u^{n}$ should have zero boundary conditions, in order to have the right boundary condition after adding both. In the first Newton step, we are starting with the solution -$u^{0}\equiv 0$, the Newton update still has to deliever the right boundary +$u^{0}\equiv 0$, the Newton update still has to deliver the right boundary condition to the solution $u^{1}$. @@ -95,7 +95,7 @@ u^{0}=g$ in the first step and with $\delta u^{n}=0$ in all the following steps.

      Weak formulation of the problem

      Starting with the strong formulation above, we get the weak formulation by multiplying -both sides of the PDE with a testfunction $\varphi$ and integrating by parts on both sides: +both sides of the PDE with a test function $\varphi$ and integrating by parts on both sides: @f[ \left( \nabla \varphi , \frac{1}{(1+|\nabla u^{n}|^{2})^{\frac{1}{2}}}\nabla \delta u^{n} \right)-\left(\nabla \varphi ,\frac{\nabla u^{n} \cdot \nabla @@ -112,8 +112,8 @@ Reducing this space to a finite dimensional space with basis $\left\{ \delta u^{n}=\sum_{j=0}^{N-1} U_{j} \varphi_{j} @f] -Using the basis functions as testfunctions and defining $a_{n}:=\frac{1} -{\sqrt{1+|\nabla u^{n}|^{2}}}$, we can rewrite the weak formualtion: +Using the basis functions as test functions and defining $a_{n}:=\frac{1} +{\sqrt{1+|\nabla u^{n}|^{2}}}$, we can rewrite the weak formulation: @f[ \sum_{j=0}^{N-1}\left[ \left( \nabla \varphi_{i} , a_{n} \nabla \varphi_{j} \right) - @@ -122,7 +122,7 @@ Using the basis functions as testfunctions and defining $a_{n}:=\frac{1} \nabla u^{n}\right) \qquad \forall i=0,\dots ,N-1 @f] -where the solution $\delta u^{n}$ is given by the coefficents $\delta U^{n}_{j}$. +where the solution $\delta u^{n}$ is given by the coefficients $\delta U^{n}_{j}$. This linear system of equations can be rewritten as: @f[ diff --git a/deal.II/examples/step-15/doc/results.dox b/deal.II/examples/step-15/doc/results.dox index 59c7ba414d..75e78a1104 100644 --- a/deal.II/examples/step-15/doc/results.dox +++ b/deal.II/examples/step-15/doc/results.dox @@ -72,7 +72,7 @@ solution. This yields the following set of images: It is clearly visible, that the solution minimizes the surface after each refinement. The solution converges to a picture one -would imagine a soapbubble to be that is located inside a wire loop +would imagine a soap bubble to be that is located inside a wire loop that is bent like the boundary. Also it is visible, how the boundary is smoothed out after each refinement. On the coarse mesh, diff --git a/deal.II/examples/step-15/step-15.cc b/deal.II/examples/step-15/step-15.cc index 5a8890056c..02ae8914e6 100644 --- a/deal.II/examples/step-15/step-15.cc +++ b/deal.II/examples/step-15/step-15.cc @@ -1,14 +1,23 @@ -/* $Id$ */ -/* Author: Sven Wetterauer, University of Heidelberg, 2012 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2012 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2012 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Sven Wetterauer, University of Heidelberg, 2012 + */ + // @sect3{Include files} @@ -50,14 +59,14 @@ #include #include -// We will use adaptive mesh refinement between Newton interations. To do so, +// We will use adaptive mesh refinement between Newton iterations. To do so, // we need to be able to work with a solution on the new mesh, although it was // computed on the old one. The SolutionTransfer class transfers the solution // from the old to the new mesh: #include -// We then open a namepsace for this program and import everything from the +// We then open a namespace for this program and import everything from the // dealii namespace into it, as in previous programs: namespace Step15 { @@ -72,7 +81,7 @@ namespace Step15 // $\delta u^n$, and one for the current iterate $u^n$. // - The setup_system function takes an argument that denotes whether // this is the first time it is called or not. The difference is that the - // first time around we need to distributed degrees of freedom and set the + // first time around we need to distribute the degrees of freedom and set the // solution vector for $u^n$ to the correct size. The following times, the // function is called after we have already done these steps as part of // refining the mesh in refine_mesh. @@ -258,12 +267,12 @@ namespace Step15 // For the assembly of the linear system, we have to obtain the values // of the previous solution's gradients at the quadrature // points. There is a standard way of doing this: the - // FEValues::get_function function takes a vector that represents a - // finite element field defined on a DoFHandler, and evaluates the - // gradients of this field at the quadrature points of the cell with - // which the FEValues object has last been reinitialized. The values - // of the gradients at all quadrature points are then written into the - // second argument: + // FEValues::get_function_gradients function takes a vector that + // represents a finite element field defined on a DoFHandler, and + // evaluates the gradients of this field at the quadrature points of the + // cell with which the FEValues object has last been reinitialized. + // The values of the gradients at all quadrature points are then written + // into the second argument: fe_values.get_function_gradients(present_solution, old_solution_gradients); @@ -511,7 +520,7 @@ namespace Step15 const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.size(); - Vector cell_rhs (dofs_per_cell); + Vector cell_residual (dofs_per_cell); std::vector > gradients(n_q_points); std::vector local_dof_indices (dofs_per_cell); @@ -521,7 +530,7 @@ namespace Step15 endc = dof_handler.end(); for (; cell!=endc; ++cell) { - cell_rhs = 0; + cell_residual = 0; fe_values.reinit (cell); // The actual computation is much as in @@ -540,7 +549,7 @@ namespace Step15 gradients[q_point]); for (unsigned int i = 0; i < dofs_per_cell; ++i) - cell_rhs(i) -= (fe_values.shape_grad(i, q_point) + cell_residual(i) -= (fe_values.shape_grad(i, q_point) * coeff * gradients[q_point] * fe_values.JxW(q_point)); @@ -548,7 +557,7 @@ namespace Step15 cell->get_dof_indices (local_dof_indices); for (unsigned int i=0; i #include -// These, now, are the include necessary for the multi-level methods. The +// These, now, are the include necessary for the multilevel methods. The // first two declare classes that allow us to enumerate degrees of freedom not // only on the finest mesh level, but also on intermediate levels (that's what // the MGDoFHandler class does) as well as allow to access this information @@ -89,7 +99,7 @@ namespace Step16 class LaplaceProblem { public: - LaplaceProblem (const unsigned int deg); + LaplaceProblem (const unsigned int degree); void run (); private: @@ -120,7 +130,7 @@ namespace Step16 const unsigned int degree; // The following four objects are the only additional member variables, - // compared to step-6. They first three represent the operators that act + // compared to step-6. The first three represent the operators that act // on individual levels of the multilevel hierarchy, rather than on the // finest mesh as do the objects above while the last object stores // information about the boundary indices on each level and information @@ -293,7 +303,7 @@ namespace Step16 // Now for the things that concern the multigrid data structures. First, - // we resize the multi-level objects to hold matrices and sparsity + // we resize the multilevel objects to hold matrices and sparsity // patterns for every level. The coarse level is zero (this is mandatory // right now but may change in a future revision). Note that these // functions take a complete, inclusive range here (not a starting index @@ -341,7 +351,7 @@ namespace Step16 // @sect4{LaplaceProblem::assemble_system} - // The following function assembles the linear system on the finesh level of + // The following function assembles the linear system on the finest level of // the mesh. It is almost exactly the same as in step-6, with the exception // that we don't eliminate hanging nodes and boundary values after // assembling, but while copying local contributions into the global @@ -414,7 +424,7 @@ namespace Step16 // integration core is the same as above, but the loop below will go over // all existing cells instead of just the active ones, and the results must // be entered into the correct matrix. Note also that since we only do - // multi-level preconditioning, no right-hand side needs to be assembled + // multilevel preconditioning, no right-hand side needs to be assembled // here. // // Before we go there, however, we have to take care of a significant amount @@ -450,7 +460,7 @@ namespace Step16 // that are located on interfaces between adaptively refined levels, and // those that lie on the interface but also on the exterior boundary of // the domain. As in many other parts of the library, we do this by using - // boolean masks, i.e. vectors of booleans each element of which indicates + // Boolean masks, i.e. vectors of Booleans each element of which indicates // whether the corresponding degree of freedom index is an interface DoF // or not. The MGConstraints already computed the information // for us when we called initialize in setup_system(). @@ -462,9 +472,9 @@ namespace Step16 // The indices just identified will later be used to decide where the // assembled value has to be added into on each level. On the other hand, // we also have to impose zero boundary conditions on the external - // boundary of each level. But this the MGConstraints knows - // it. So we simply ask for them by calling get_boundary_indices - // (). The third step is to construct constraints on all those + // boundary of each level. But this the MGConstraints knows. + // So we simply ask for them by calling get_boundary_indices(). + // The third step is to construct constraints on all those // degrees of freedom: their value should be zero after each application // of the level operators. To this end, we construct ConstraintMatrix // objects for each level, and add to each of these constraints for each @@ -605,7 +615,7 @@ namespace Step16 MGTransferPrebuilt > mg_transfer(hanging_node_constraints, mg_constrained_dofs); // Now the prolongation matrix has to be built. This matrix needs to take // the boundary values on each level into account and needs to know about - // the indices at the refinement egdes. The MGConstraints + // the indices at the refinement edges. The MGConstraints // knows about that so pass it as an argument. mg_transfer.build_matrices(mg_dof_handler); diff --git a/deal.II/examples/step-17/CMakeLists.txt b/deal.II/examples/step-17/CMakeLists.txt index 77d825f29b..c32373d483 100644 --- a/deal.II/examples/step-17/CMakeLists.txt +++ b/deal.II/examples/step-17/CMakeLists.txt @@ -34,7 +34,7 @@ IF(NOT DEAL_II_WITH_PETSC) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_PETSC = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-17/step-17.cc b/deal.II/examples/step-17/step-17.cc index 5511277bbb..cf4745d3f7 100644 --- a/deal.II/examples/step-17/step-17.cc +++ b/deal.II/examples/step-17/step-17.cc @@ -1,13 +1,22 @@ -/* Author: Wolfgang Bangerth, University of Texas at Austin, 2000, 2004 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2000, 2004-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2000 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Texas at Austin, 2000, 2004 + */ // First the usual assortment of header files we have already used in previous @@ -236,10 +245,11 @@ namespace Step17 // communicator object that only links a subset of all processes), and call // the Utilities helper functions to determine the number of processes and // where the present one fits into this picture. In addition, we make sure - // that output is only generated by the (globally) first process. As, - // this_mpi_process is determined after creation of pcout, we cannot set the - // condition through the constructor, i.e. by pcout(std::cout, - // this_mpi_process==0), but set the condition separately. + // that output is only generated by the (globally) first process. As + // this_mpi_process is determined after creation of pcout, we + // cannot set the condition through the constructor, i.e. by + // pcout(std::cout, this_mpi_process==0), but set the + // condition separately. template ElasticProblem::ElasticProblem () : @@ -503,8 +513,8 @@ namespace Step17 cell->get_dof_indices (local_dof_indices); hanging_node_constraints .distribute_local_to_global(cell_matrix, cell_rhs, - local_dof_indices, - system_matrix, system_rhs); + local_dof_indices, + system_matrix, system_rhs); } // Now compress the vector and the system matrix: @@ -528,7 +538,7 @@ namespace Step17 // The last argument to the call just performed allows for some // optimizations. It controls whether we should also delete the column // corresponding to a boundary node, or keep it (and passing - // true as above means: yes, do eliminate the column). If we + // true means: yes, do eliminate the column). If we // do, then the resulting matrix will be symmetric again if it was before; // if we don't, then it won't. The solution of the resulting system should // be the same, though. The only reason why we may want to make the system @@ -740,7 +750,7 @@ namespace Step17 // to the present process, but then we need to distribute the refinement // indicators into a distributed vector so that all processes have the // values of the refinement indicator for all cells. But then, in order for - // each process to refine its copy of the mesh, they need to have acces to + // each process to refine its copy of the mesh, they need to have access to // all refinement indicators locally, so they have to copy the global vector // back into a local one. That's a little convoluted, but thinking about it // quite straightforward nevertheless. So here's how we do it: @@ -778,7 +788,7 @@ namespace Step17 // local_error_per_cell vector. The elements of this vector // for cells not on the present process are zero. However, since all // processes have a copy of a copy of the entire triangulation and need to - // keep these copies in synch, they need the values of refinement + // keep these copies in sync, they need the values of refinement // indicators for all cells of the triangulation. Thus, we need to // distribute our results. We do this by creating a distributed vector // where each process has its share, and sets the elements it has diff --git a/deal.II/examples/step-18/CMakeLists.txt b/deal.II/examples/step-18/CMakeLists.txt index c1e1076991..33af07ee5a 100644 --- a/deal.II/examples/step-18/CMakeLists.txt +++ b/deal.II/examples/step-18/CMakeLists.txt @@ -34,7 +34,7 @@ IF(NOT DEAL_II_WITH_PETSC) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_PETSC = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-18/doc/intro.dox b/deal.II/examples/step-18/doc/intro.dox index 2c37a1d863..2d54bda4a9 100644 --- a/deal.II/examples/step-18/doc/intro.dox +++ b/deal.II/examples/step-18/doc/intro.dox @@ -107,7 +107,7 @@ following, let us consider some of the tools one would employ when simulating problems in which the deformation becomes large. @note The model we will consider below is not founded on anything that -would be mathematical sound: we will consider a model in which we +would be mathematically sound: we will consider a model in which we produce a small deformation, deform the physical coordinates of the body by this deformation, and then consider the next loading step again as a linear problem. This isn't consistent, since the assumption @@ -299,7 +299,7 @@ simply translated along. The dilational or compressional change produces a corresponding stress update. However, the rotational component does not necessarily induce a nonzero stress update (think, in 2d, for example of the situation where $\Delta\mathbf{u}=(y, -x)^T$, with which $\varepsilon(\Delta -\mathbf{u})=0$). Nevertheless, if the the material was pre-stressed in a certain +\mathbf{u})=0$). Nevertheless, if the the material was prestressed in a certain direction, then this direction will be rotated along with the material. To this end, we have to define a rotation matrix $R(\Delta \mathbf{u}^n)$ that describes, in each point the rotation due to the displacement increments. It diff --git a/deal.II/examples/step-18/doc/results.dox b/deal.II/examples/step-18/doc/results.dox index 7c3c022825..b59460a793 100644 --- a/deal.II/examples/step-18/doc/results.dox +++ b/deal.II/examples/step-18/doc/results.dox @@ -111,10 +111,10 @@ examples/\step-18> ../\step-19/\step-19 Converter from deal.II intermediate format to other graphics formats. -Usage: ./\step-19 [-p parameter_file] list_of_input_files [-x output_format] output_file +Usage: ./\step-19 [-p parameter_file] list_of_input_files [-x output_format] -o output_file -examples/\step-18> ../\step-19/\step-19 solution-0001.0000.d2 -x gmv solution-0001.0000.gmv -examples/\step-18> ../\step-19/\step-19 solution-0002.0000.d2 -x gmv solution-0002.0000.gmv +examples/\step-18> ../\step-19/\step-19 solution-0001.0000.d2 -x gmv -o solution-0001.0000.gmv +examples/\step-18> ../\step-19/\step-19 solution-0002.0000.d2 -x gmv -o solution-0002.0000.gmv [...] @endcode Of course, since we have run the program only in sequential mode, we diff --git a/deal.II/examples/step-18/step-18.cc b/deal.II/examples/step-18/step-18.cc index eea5121994..46a8ed4e53 100644 --- a/deal.II/examples/step-18/step-18.cc +++ b/deal.II/examples/step-18/step-18.cc @@ -1,13 +1,22 @@ -/* Author: Wolfgang Bangerth, University of Texas at Austin, 2000, 2004, 2005 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2000, 2004-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2000 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Texas at Austin, 2000, 2004, 2005 + */ // First the usual list of header files that have already been used in @@ -97,8 +106,8 @@ namespace Step18 // in the form $C_{ijkl} = \mu (\delta_{ik} \delta_{jl} + \delta_{il} // \delta_{jk}) + \lambda \delta_{ij} \delta_{kl}$. This tensor maps // symmetric tensor of rank 2 to symmetric tensors of rank 2. A function - // implementing its creation for given values of the Lame constants lambda - // and mu is straightforward: + // implementing its creation for given values of the Lame constants $\lambda$ + // and $\mu$ is straightforward: template SymmetricTensor<4,dim> get_stress_strain_tensor (const double lambda, const double mu) @@ -374,7 +383,7 @@ namespace Step18 // the system, direct what has to be solved in each time step, a function // that solves the linear system that arises in each timestep (and returns // the number of iterations it took), and finally output the solution - // vector on the currect mesh: + // vector on the correct mesh: void create_coarse_grid (); void setup_system (); @@ -434,7 +443,7 @@ namespace Step18 // One difference of this program is that we declare the quadrature // formula in the class declaration. The reason is that in all the other // programs, it didn't do much harm if we had used different quadrature - // formulas when computing the matrix and the righ hand side, for + // formulas when computing the matrix and the right hand side, for // example. However, in the present case it does: we store information in // the quadrature points, so we have to make sure all parts of the program // agree on where they are and how many there are on each cell. Thus, let @@ -734,7 +743,7 @@ namespace Step18 // @sect4{The public interface} - // The next step is the definition of constructors and descructors. There + // The next step is the definition of constructors and destructors. There // are no surprises here: we choose linear and continuous finite elements // for each of the dim vector components of the solution, and a // Gaussian quadrature formula with 2 points in each coordinate @@ -901,7 +910,7 @@ namespace Step18 // The next function is the one that sets up the data structures for a given // mesh. This is done in most the same way as in step-17: distribute the // degrees of freedom, then sort these degrees of freedom in such a way that - // each processor gets a contiguous chunk of them. Note that subdivions into + // each processor gets a contiguous chunk of them. Note that subdivisions into // chunks for each processor is handled in the functions that create or // refine grids, unlike in the previous example program (the point where // this happens is mostly a matter of taste; here, we chose to do it when @@ -1000,7 +1009,7 @@ namespace Step18 // adaptively refined). // // With this data structure, we can then go to the PETSc sparse matrix and - // tell it to pre-allocate all the entries we will later want to write to: + // tell it to preallocate all the entries we will later want to write to: system_matrix.reinit (mpi_communicator, sparsity_pattern, local_dofs_per_process, @@ -1135,16 +1144,16 @@ namespace Step18 cell->get_dof_indices (local_dof_indices); hanging_node_constraints - .distribute_local_to_global (cell_matrix, cell_rhs, + .distribute_local_to_global (cell_matrix, cell_rhs, local_dof_indices, - system_matrix, system_rhs); + system_matrix, system_rhs); } // Now compress the vector and the system matrix: system_matrix.compress(VectorOperation::add); system_rhs.compress(VectorOperation::add); - + // The last step is to again fix up boundary values, just as we already // did in previous programs. A slight complication is that the // apply_boundary_values function wants to have a solution @@ -1321,10 +1330,10 @@ namespace Step18 subdomain_id (subdomain_id) {} - virtual typename DoFHandler::cell_iterator + virtual typename DataOut::cell_iterator first_cell () { - typename DoFHandler::active_cell_iterator + typename DataOut::active_cell_iterator cell = this->dofs->begin_active(); while ((cell != this->dofs->end()) && (cell->subdomain_id() != subdomain_id)) @@ -1333,8 +1342,8 @@ namespace Step18 return cell; } - virtual typename DoFHandler::cell_iterator - next_cell (const typename DoFHandler::cell_iterator &old_cell) + virtual typename DataOut::cell_iterator + next_cell (const typename DataOut::cell_iterator &old_cell) { if (old_cell != this->dofs->end()) { @@ -1343,7 +1352,7 @@ namespace Step18 return ++(FilteredIterator - ::active_cell_iterator> + ::active_cell_iterator> (predicate,old_cell)); } else @@ -1447,7 +1456,7 @@ namespace Step18 // As a last piece of data, let us also add the partitioning of the domain // into subdomains associated with the processors if this is a parallel // job. This works in the exact same way as in the step-17 program: - std::vector partition_int (triangulation.n_active_cells()); + std::vector partition_int (triangulation.n_active_cells()); GridTools::get_subdomain_association (triangulation, partition_int); const Vector partitioning(partition_int.begin(), partition_int.end()); @@ -1671,13 +1680,13 @@ namespace Step18 // cell-@>vertex_dof_index(v,d) function that returns the index // of the dth degree of freedom at vertex v of the // given cell. In the present case, displacement in the k-th coordinate - // direction corresonds to the kth component of the finite element. Using a + // direction corresponds to the k-th component of the finite element. Using a // function like this bears a certain risk, because it uses knowledge of the // order of elements that we have taken together for this program in the // FESystem element. If we decided to add an additional // variable, for example a pressure variable for stabilization, and happened // to insert it as the first variable of the element, then the computation - // below will start to produce non-sensical results. In addition, this + // below will start to produce nonsensical results. In addition, this // computation rests on other assumptions: first, that the element we use // has, indeed, degrees of freedom that are associated with vertices. This // is indeed the case for the present Q1 element, as would be for all Qp @@ -1764,7 +1773,7 @@ namespace Step18 // To put this into larger perspective, we note that if we had previously // available stresses in our model (which we assume do not exist for the // purpose of this program), then we would need to interpolate the field of - // pre-existing stresses to the quadrature points. Likewise, if we were to + // preexisting stresses to the quadrature points. Likewise, if we were to // simulate elasto-plastic materials with hardening/softening, then we would // have to store additional history variables like the present yield stress // of the accumulated plastic strains in each quadrature @@ -1847,9 +1856,9 @@ namespace Step18 // displacement update so that the material in its new configuration // accommodates for the difference between the external body and boundary // forces applied during this time step minus the forces exerted through - // pre-existing internal stresses. In order to have the pre-existing + // preexisting internal stresses. In order to have the preexisting // stresses available at the next time step, we therefore have to update the - // pre-existing stresses with the stresses due to the incremental + // preexisting stresses with the stresses due to the incremental // displacement computed during the present time step. Ideally, the // resulting sum of internal stresses would exactly counter all external // forces. Indeed, a simple experiment can make sure that this is so: if we @@ -1960,7 +1969,7 @@ namespace Step18 // three matrices should be symmetric, it is not due to floating // point round off: we get an asymmetry on the order of 1e-16 of // the off-diagonal elements of the result. When assigning the - // result to a SymmetricTensor, the constuctor of + // result to a SymmetricTensor, the constructor of // that class checks the symmetry and realizes that it isn't // exactly symmetric; it will then raise an exception. To avoid // that, we explicitly symmetrize the result to make it exactly diff --git a/deal.II/examples/step-19/doc/results.dox b/deal.II/examples/step-19/doc/results.dox index 233fbff3b1..39fe3634b4 100644 --- a/deal.II/examples/step-19/doc/results.dox +++ b/deal.II/examples/step-19/doc/results.dox @@ -33,7 +33,7 @@ set Output format = gnuplot subsection DX output parameters - # A boolean field indicating whether neighborship information between cells + # A Boolean field indicating whether neighborship information between cells # is to be written to the OpenDX output file set Write neighbors = true end @@ -93,7 +93,7 @@ subsection Eps output parameters end subsection Povray output parameters - # Whether camera and lightling information should be put into an external + # Whether camera and lighting information should be put into an external # file "data.inc" or into the POVRAY input file set Include external file = true diff --git a/deal.II/examples/step-19/step-19.cc b/deal.II/examples/step-19/step-19.cc index cac451597d..3a61b279ae 100644 --- a/deal.II/examples/step-19/step-19.cc +++ b/deal.II/examples/step-19/step-19.cc @@ -1,13 +1,22 @@ -/* Author: Luca Heltai, Wolfgang Bangerth, 2005 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2005 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Luca Heltai, Wolfgang Bangerth, 2005 + */ // @sect4{Preliminaries} @@ -133,7 +142,7 @@ namespace Step19 // this program, I realized that there aren't all that many parameters this // program can usefully ask for, or better, it turned out: declaring and // querying these parameters was already done centralized in one place of - // the libray, namely the DataOutInterface class that handles + // the library, namely the DataOutInterface class that handles // exactly this -- managing parameters for input and output. // // So the second function call in this function is to let the @@ -187,7 +196,7 @@ namespace Step19 // with the subsection name, I like to use curly braces to force my editor // to indent everything that goes into this sub-section by one level of // indentation. In this sub-section, we shall have two entries, one that - // takes a boolean parameter and one that takes a selection list of + // takes a Boolean parameter and one that takes a selection list of // values, separated by the '|' character: prm.enter_subsection ("Dummy subsection"); { @@ -279,7 +288,7 @@ namespace Step19 // Finally, let us note that if we were interested in the values // of the parameters declared above in the dummy subsection, we // would write something like this to extract the value of the - // boolean flag (the prm.get function returns the + // Boolean flag (the prm.get function returns the // value of a parameter as a string, whereas the // prm.get_X functions return a value already // converted to a different type): @@ -288,7 +297,7 @@ namespace Step19 prm.get_bool ("Dummy generate output"); } prm.leave_subsection (); - // We would assign the result to a variable, or course, but don't + // We would assign the result to a variable, of course, but don't // here in order not to generate an unused variable that the // compiler might warn about. // diff --git a/deal.II/examples/step-2/doc/intro.dox b/deal.II/examples/step-2/doc/intro.dox index bef310a19a..3c2412609a 100644 --- a/deal.II/examples/step-2/doc/intro.dox +++ b/deal.II/examples/step-2/doc/intro.dox @@ -13,7 +13,7 @@ The term "degree of freedom" is commonly used in the finite element community to indicate two slightly different, but related things. The first is that we'd like to represent the finite element solution as a linear combination of shape function, in the form $u_h(\mathbf x) = \sum_{j=0}^{N-1} U_j \varphi_j(\mathbf -x)$. Here, $U_j$ is a vector of expension coefficients. Because we don't know +x)$. Here, $U_j$ is a vector of expansion coefficients. Because we don't know their values yet (we will compute them as the solution of a linear or nonlinear system), they are called "unknowns" or "degrees of freedom". The second meaning of the term con be explained as follows: A mathematical @@ -62,7 +62,7 @@ approximation of the Laplace equation leads to a sparse matrix since the number of nonzero entries per row is five, and therefore independent of the total size of the matrix.) Sparsity is one of the distinguishing feature of the finite element method compared to, say, approximating the solution of a -partial differential equation using a Taylor expension and matching +partial differential equation using a Taylor expansion and matching coefficients, or using a Fourier basis. In practical terms, it is the sparsity of matrices that enables us to solve diff --git a/deal.II/examples/step-2/doc/results.dox b/deal.II/examples/step-2/doc/results.dox index af9891d631..d07d5bc643 100644 --- a/deal.II/examples/step-2/doc/results.dox +++ b/deal.II/examples/step-2/doc/results.dox @@ -4,7 +4,7 @@ The program has, after having been run, produced two sparsity patterns. We can visualize them using GNUPLOT (one of the simpler visualization programs; maybe not the easiest to use since it is command line driven, but -also universally available on all linux and other unix-like systems): +also universally available on all Linux and other Unix-like systems): @code examples/\step-2> gnuplot diff --git a/deal.II/examples/step-2/step-2.cc b/deal.II/examples/step-2/step-2.cc index ad6fd4a15e..b3c9d2debb 100644 --- a/deal.II/examples/step-2/step-2.cc +++ b/deal.II/examples/step-2/step-2.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 1999 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 1999 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 1999 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 1999-2003, 2006, 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // The first few includes are just like in the previous program, so do not // require additional comments: @@ -141,7 +151,7 @@ void make_grid (Triangulation<2> &triangulation) // least as long as that of the DoFHandler; one way to make sure // this is so is to make it static as well, in order to prevent its preemptive // destruction. (However, the library would warn us if we forgot about this -// and abort the program if that occured. You can check this, if you want, by +// and abort the program if that occurred. You can check this, if you want, by // removing the 'static' declaration.) void distribute_dofs (DoFHandler<2> &dof_handler) { diff --git a/deal.II/examples/step-20/doc/results.dox b/deal.II/examples/step-20/doc/results.dox index 29842cdfee..20ece4a3e2 100644 --- a/deal.II/examples/step-20/doc/results.dox +++ b/deal.II/examples/step-20/doc/results.dox @@ -40,7 +40,7 @@ flow first channels towards the center and then outward again. Consequently, the x-velocity has to increase to get the flow through the narrow part, something that can easily be seen in the left image. The middle image represents inward flow in y-direction at the left end of the domain, and -outward flow in y-directino at the right end of the domain. +outward flow in y-direction at the right end of the domain. @@ -180,11 +180,11 @@ The result concerning the convergence order is the same here. Realistic flow computations for ground water or oil reservoir simulations will not use a constant permeability. Here's a first, rather simple way to change this situation: we use a permeability that decays very rapidly away from a -central flowline until it hits a background value of 0.001. This is to mimick +central flowline until it hits a background value of 0.001. This is to mimic the behavior of fluids in sandstone: in most of the domain, the sandstone is -homogenous and, while permeably to fluids, not overly so; on the other stone, +homogeneous and, while permeable to fluids, not overly so; on the other stone, the stone has cracked, or faulted, along one line, and the fluids flow much -easier along this large crask. Here is how we could implement something like +easier along this large crack. Here is how we could implement something like this: @code template diff --git a/deal.II/examples/step-20/step-20.cc b/deal.II/examples/step-20/step-20.cc index 4101153ee3..dc5e35de97 100644 --- a/deal.II/examples/step-20/step-20.cc +++ b/deal.II/examples/step-20/step-20.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, Texas A&M University, 2005, 2006 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2005 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, Texas A&M University, 2005, 2006 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2005-2008, 2010-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -270,10 +280,10 @@ namespace Step20 // binding simpler elements together into one larger element. In the present // case, we want to couple a single RT(degree) element with a single // DQ(degree) element. The constructor to FESystem that does - // this requires us to specity first the first base element (the + // this requires us to specify first the first base element (the // FE_RaviartThomas object of given degree) and then the number // of copies for this base element, and then similarly the kind and number - // of FE_DGQ elements. Note that the Raviart Thomas element + // of FE_DGQ elements. Note that the Raviart-Thomas element // already has dim vector components, so that the coupled // element will have dim+1 vector components, the first // dim of which correspond to the velocity variable whereas the @@ -796,7 +806,7 @@ namespace Step20 // used here, the Gauss points happen to be superconvergence points in // which the pointwise error is much smaller (and converges with higher // order) than anywhere else. These are therefore not particularly good - // points for ingration. To avoid this problem, we simply use a + // points for integration. To avoid this problem, we simply use a // trapezoidal rule and iterate it degree+2 times in each // coordinate direction (again as explained in step-7): QTrapez<1> q_trapez; @@ -903,7 +913,7 @@ namespace Step20 // The main function we stole from step-6 instead of step-4. It is almost // equal to the one in step-6 (apart from the changed class names, of course), // the only exception is that we pass the degree of the finite element space -// to the constructor of the mixed laplace problem (here, we use zero-th order +// to the constructor of the mixed Laplace problem (here, we use zero-th order // elements). int main () { diff --git a/deal.II/examples/step-21/doc/intro.dox b/deal.II/examples/step-21/doc/intro.dox index 85ce8f313a..2ee80de1b5 100644 --- a/deal.II/examples/step-21/doc/intro.dox +++ b/deal.II/examples/step-21/doc/intro.dox @@ -114,7 +114,7 @@ In summary, what we get are the following two equations: Here, $p=p(\mathbf x, t), S=S(\mathbf x, t)$ are now time dependent functions: while at every time instant the flow field is in equilibrium with the pressure (i.e. we neglect dynamic -accellerations), the saturation is transported along with the flow and +accelerations), the saturation is transported along with the flow and therefore changes over time, in turn affected the flow field again through the dependence of the first equation on $S$. @@ -411,8 +411,8 @@ one is harder to justify: on a microscopic level, most rocks are isotropic, because they consist of a network of interconnected pores. However, this microscopic scale is out of the range of today's computer simulations, and we have to be content with simulating things on the scale of meters. On that -scale, however, fluid transport typically happens through a network of crasks -in the rock, rather than throuh pores. However, cracks often result from +scale, however, fluid transport typically happens through a network of cracks +in the rock, rather than through pores. However, cracks often result from external stress fields in the rock layer (for example from tectonic faulting) and the cracks are therefore roughly aligned. This leads to a situation where the permeability is often orders of magnitude larger in the direction parallel @@ -499,7 +499,7 @@ functions introduced at the end of the results section of @ref step_20 "step-20":
      • A function that models a single, winding crack that snakes through the - domain. In analgy to step-20, but taking care of the slightly + domain. In analogy to step-20, but taking care of the slightly different geometry we have here, we describe this by the following function: @f[ k(\mathbf x) diff --git a/deal.II/examples/step-21/step-21.cc b/deal.II/examples/step-21/step-21.cc index 23297051f4..24c95d3bef 100644 --- a/deal.II/examples/step-21/step-21.cc +++ b/deal.II/examples/step-21/step-21.cc @@ -1,13 +1,23 @@ -/* Author: Yan Li, Wolfgang Bangerth, Texas A&M University, 2006 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2006-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2006 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Yan Li, Wolfgang Bangerth, Texas A&M University, 2006 + */ + // This program is an adaptation of step-20 and includes some technique of DG // methods from step-12. A good part of the program is therefore very similar diff --git a/deal.II/examples/step-22/CMakeLists.txt b/deal.II/examples/step-22/CMakeLists.txt index 00923478ae..03e2ef3408 100644 --- a/deal.II/examples/step-22/CMakeLists.txt +++ b/deal.II/examples/step-22/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_UMFPACK) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_UMFPACK = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-22/doc/intro.dox b/deal.II/examples/step-22/doc/intro.dox index 73a5674dac..ee94320e65 100644 --- a/deal.II/examples/step-22/doc/intro.dox +++ b/deal.II/examples/step-22/doc/intro.dox @@ -302,7 +302,7 @@ possibilities for imposing boundary conditions:
    Despite this wealth of possibilities, we will only use Dirichlet and -(homogenous) Neumann boundary conditions in this tutorial program. +(homogeneous) Neumann boundary conditions in this tutorial program.

    Discretization

    @@ -539,7 +539,7 @@ matrix. It is therefore an operation that can efficiently also be computed in represent an exact inverse of the matrix $A$. Consequently, preconditioning with the ILU will still require more than one iteration, unlike preconditioning with the sparse direct solver. The inner solver will therefore -take more time when multiplying with the Schur complement, a tradeoff +take more time when multiplying with the Schur complement, a trade-off unavoidable. @@ -566,7 +566,7 @@ struct InnerPreconditioner<3> @endcode From hereon, we can refer to the type typename -InnerPreconditioner@::type and automatically get the correct +InnerPreconditioner@::%type and automatically get the correct preconditioner class. Because of the similarity of the interfaces of the two classes, we will be able to use them interchangeably using the same syntax in all places. @@ -678,7 +678,7 @@ conditions. Frequently, a sparse matrix contains a substantial amount of elements that -acutally are zero when we are about to start a linear solve. Such elements are +actually are zero when we are about to start a linear solve. Such elements are introduced when we eliminate constraints or implement Dirichlet conditions, where we usually delete all entries in constrained rows and columns, i.e., we set them to zero. The fraction of elements that are present in the sparsity @@ -751,7 +751,7 @@ removed this bottleneck at the price of a slightly higher memory consumption. Likewise, the implementation of the decomposition step in the SparseILU class was very inefficient and has been replaced by one that is about 10 times faster. Even the vmult function of the SparseILU has been -improved to save about twenty precent of time. Small improvements were +improved to save about twenty percent of time. Small improvements were applied here and there. Moreover, the ConstraintMatrix object has been used to eliminate a lot of entries in the sparse matrix that are eventually going to be zero, see the section on using advanced diff --git a/deal.II/examples/step-22/doc/results.dox b/deal.II/examples/step-22/doc/results.dox index 3524d69293..d544b2f21e 100644 --- a/deal.II/examples/step-22/doc/results.dox +++ b/deal.II/examples/step-22/doc/results.dox @@ -73,7 +73,7 @@ In the images below, we show the grids for the first six refinement steps in the program. Observe how the grid is refined in regions where the solution rapidly changes: On the upper boundary, we have Dirichlet boundary conditions that are -1 in the left half of the line -and 1 in the right one, so there is an aprupt change at $x=0$. Likewise, +and 1 in the right one, so there is an abrupt change at $x=0$. Likewise, there are changes from Dirichlet to Neumann data in the two upper corners, so there is need for refinement there as well: @@ -119,7 +119,7 @@ This plot uses the capability of VTK-based visualization programs (in this case of VisIt) to show vector data; this is the result of us declaring the velocity components of the finite element in use to be a set of vector components, rather than independent scalar components in -the StokesProblem@::output_results function of this +the StokesProblem@::%output_results function of this tutorial program. @@ -226,7 +226,7 @@ interesting graph: -The isocountours shown here as well are those of the pressure +The isocontours shown here as well are those of the pressure variable, showing the singularity at the point of discontinuous velocity boundary conditions. @@ -315,8 +315,8 @@ the number of iterations for applying the inverse pressure mass matrix is always around five, both in two and three dimensions.) To summarize, most work is spent on solving linear systems with the same matrix $A$ over and over again. What makes this look even worse is the fact that we -actually invert a matrix that is about 95 precent the size of the total system -matrix and stands for 85 precent of the non-zero entries in the sparsity +actually invert a matrix that is about 95 percent the size of the total system +matrix and stands for 85 percent of the non-zero entries in the sparsity pattern. Hence, the natural question is whether it is reasonable to solve a linear system with matrix $A$ for about 15 times when calculating the solution to the block system. @@ -357,7 +357,7 @@ unknowns. Another idea to improve the situation even more would be to choose a preconditioner that makes CG for the (0,0) matrix $A$ converge in a mesh-independent number of iterations, say 10 to 30. We have seen such a -canditate in step-16: multigrid. +candidate in step-16: multigrid.
    Block Schur complement preconditioner
    Even with a good preconditioner for $A$, we still @@ -492,7 +492,7 @@ are problems where one of the two candidates clearly outperforms the other, and vice versa.
    Wikipedia's article on the GMRES method gives a comparative presentation. -A more comprehensive and well-founded comparsion can be read e.g. in the book by +A more comprehensive and well-founded comparison can be read e.g. in the book by J.W. Demmel (Applied Numerical Linear Algebra, SIAM, 1997, section 6.6.6). For our specific problem with the ILU preconditioner for $A$, we certainly need @@ -756,7 +756,7 @@ example mid-ocean ridges). Of course, in such places, the geometry is more complicated than the examples shown above, but it is not hard to accommodate for that. -For example, by using the folllowing modification of the boundary values +For example, by using the following modification of the boundary values function @code template diff --git a/deal.II/examples/step-22/step-22.cc b/deal.II/examples/step-22/step-22.cc index 8e30a64059..e63bae370c 100644 --- a/deal.II/examples/step-22/step-22.cc +++ b/deal.II/examples/step-22/step-22.cc @@ -1,13 +1,22 @@ -/* Author: Wolfgang Bangerth, Texas A&M University, 2008 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2008 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, Texas A&M University, 2008 + */ // @sect3{Include files} @@ -147,7 +156,7 @@ namespace Step22 // As in step-20 and most other example programs, the next task is to define // the data for the PDE: For the Stokes problem, we are going to use natural - // boundary values on parts of the boundary (i.e. homogenous Neumann-type) + // boundary values on parts of the boundary (i.e. homogeneous Neumann-type) // for which we won't have to do anything special (the homogeneity implies // that the corresponding terms in the weak form are simply zero), and // boundary conditions on the velocity (Dirichlet-type) on the rest of the @@ -370,7 +379,7 @@ namespace Step22 // Note that we initialize the triangulation with a MeshSmoothing argument, // which ensures that the refinement of cells is done in a way that the // approximation of the PDE solution remains well-behaved (problems arise if - // grids are too unstructered), see the documentation of + // grids are too unstructured), see the documentation of // Triangulation::MeshSmoothing for details. template StokesProblem::StokesProblem (const unsigned int degree) @@ -509,7 +518,7 @@ namespace Step22 // require allocating more memory than necessary but isn't suitable for // use as a basis of SparseMatrix or BlockSparseMatrix objects; in a // second step we then copy this object into an object of - // BlockSparsityPattern. This is entirely analgous to what we already did + // BlockSparsityPattern. This is entirely analogous to what we already did // in step-11 and step-18. // // There is one snag again here, though: it turns out that using the @@ -726,7 +735,7 @@ namespace Step22 // After the discussion in the introduction and the definition of the // respective classes above, the implementation of the solve - // function is rather straigt-forward and done in a similar way as in + // function is rather straight-forward and done in a similar way as in // step-20. To start with, we need an object of the // InverseMatrix class that represents the inverse of the // matrix A. As described in the introduction, the inverse is generated with @@ -781,7 +790,7 @@ namespace Step22 // An alternative that is cheaper to build, but needs more iterations // afterwards, would be to choose a SSOR preconditioner with factor // 1.2. It needs about twice the number of iterations, but the costs for - // its generation are almost neglible. + // its generation are almost negligible. SparseILU preconditioner; preconditioner.initialize (system_matrix.block(1,1), SparseILU::AdditionalData()); @@ -811,7 +820,7 @@ namespace Step22 // objects we already know - so we simply multiply $p$ by $B^T$, subtract // the right hand side and multiply by the inverse of $A$. At the end, we // need to distribute the constraints from hanging nodes in order to - // obtain a constistent flow field: + // obtain a consistent flow field: { system_matrix.block(0,1).vmult (tmp, solution.block(1)); tmp *= -1; diff --git a/deal.II/examples/step-23/doc/intro.dox b/deal.II/examples/step-23/doc/intro.dox index c7b70487af..90becf9b9b 100644 --- a/deal.II/examples/step-23/doc/intro.dox +++ b/deal.II/examples/step-23/doc/intro.dox @@ -63,7 +63,7 @@ one of the usual ODE solvers (this is called the method of lines). Both of these methods have advantages and disadvantages. Traditionally, people have preferred the method of lines, since it allows to use the very well developed machinery of high-order ODE -solvers avaiable for the rather stiff ODEs resulting from this +solvers available for the rather stiff ODEs resulting from this approach, including step length control and estimation of the temporal error. @@ -84,7 +84,7 @@ other time dependent problems, we find that the character of a solution changes as time progresses. For example, for the wave equation, we may have a single wave travelling through the domain, where the solution is smooth or even constant in front of and behind -the wave &mdash& adaptivity would be really useful for such cases, but the +the wave — adaptivity would be really useful for such cases, but the key is that the area where we need to refine the mesh changes from time step to time step! @@ -156,7 +156,7 @@ time derivatives for both variables, for which it is simple to write down time stepping schemes. Note that we do not have boundary conditions for $v$ at first. However, we could enforce $v=\frac{\partial g}{\partial t}$ on the boundary. It turns out in numerical examples that this -as actually necessary: without doing so the solution doesn't look particularly +is actually necessary: without doing so the solution doesn't look particularly wrong, but the Crank-Nicolson scheme does not conserve energy if one doesn't enforce these boundary conditions. @@ -296,9 +296,9 @@ where \\ A^{n,n-1}_{ij} &=& (\nabla\phi_i^n, \nabla\phi_j^{n-1}), \\ - F^n_{ij} &=& (f^n,\phi_i^n), + F^n_{i} &=& (f^n,\phi_i^n), \\ - F^{n-1}_{ij} &=& (f^{n-1},\phi_i^n). + F^{n-1}_{i} &=& (f^{n-1},\phi_i^n). @f} If we solve these two equations, we can move the solution one step @@ -388,7 +388,7 @@ $[-1,1]^2$ seven times uniformly, giving a mesh size of $h=\frac 1{64}$, which is what we set the time step to. The fact that we set the time step and mesh size individually in two different places is error prone: it is too easy to refine the mesh once more but forget to also adjust the time step. @ref -step_24 "step-24" shows a better way how to keep these things in synch. +step_24 "step-24" shows a better way how to keep these things in sync.

    The test case

    diff --git a/deal.II/examples/step-23/doc/results.dox b/deal.II/examples/step-23/doc/results.dox index 513699f9f9..1c86e3eb7d 100644 --- a/deal.II/examples/step-23/doc/results.dox +++ b/deal.II/examples/step-23/doc/results.dox @@ -105,8 +105,8 @@ If you want to explore a bit, try out some of the following things: To make such a change, we would have to compute the mass and Laplace matrices with a variable coefficient. Fortunately, this isn't too hard: the - functions MatrixTools::create_laplace_matrix and - MatrixTools::create_vector_tools have additional default parameters that can + functions MatrixCreator::create_laplace_matrix and + MatrixCreator::create_mass_matrix have additional default parameters that can be used to pass non-constant coefficient functions to them. The required changes are therefore relatively small. On the other hand, care must be taken again to make sure the time step is within the allowed range. diff --git a/deal.II/examples/step-23/step-23.cc b/deal.II/examples/step-23/step-23.cc index 331c3b1bd4..b0a50390d3 100644 --- a/deal.II/examples/step-23/step-23.cc +++ b/deal.II/examples/step-23/step-23.cc @@ -1,14 +1,22 @@ -/* Author: Wolfgang Bangerth, Texas A&M University, 2006 */ - -/* $Id$ */ -/* Version: $Name: $ */ -/* */ -/* Copyright (C) 2006-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2006 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, Texas A&M University, 2006 + */ // @sect3{Include files} @@ -46,7 +54,7 @@ // Here are the only three include files of some new interest: The first one // is already used, for example, for the // VectorTools::interpolate_boundary_values and -// VectorTools::apply_boundary_values functions. However, we here use another +// MatrixTools::apply_boundary_values functions. However, we here use another // function in that class, VectorTools::project to compute our initial values // as the $L^2$ projection of the continuous initial values. Furthermore, we // use VectorTools::create_right_hand_side to generate the integrals @@ -60,8 +68,8 @@ // mass and Laplace matrices, although it would have only taken copying the // relevant code from any number of previous tutorial programs. Rather, we // want to focus on the things that are truly new to this program and -// therefore use the MatrixTools::create_mass_matrix and -// MatrixTools::create_laplace_matrix functions. They are declared here: +// therefore use the MatrixCreator::create_mass_matrix and +// MatrixCreator::create_laplace_matrix functions. They are declared here: #include // Finally, here is an include file that contains all sorts of tool functions @@ -332,7 +340,7 @@ namespace Step23 sparsity_pattern.compress(); // Then comes a block where we have to initialize the 3 matrices we need - // in the course of the program: the mass matrix, the laplace matrix, and + // in the course of the program: the mass matrix, the Laplace matrix, and // the matrix $M+k^2\theta^2A$ used when solving for $U^n$ in each time // step. // diff --git a/deal.II/examples/step-24/doc/intro.dox b/deal.II/examples/step-24/doc/intro.dox index 4ee0f37f70..cbaf189e27 100644 --- a/deal.II/examples/step-24/doc/intro.dox +++ b/deal.II/examples/step-24/doc/intro.dox @@ -41,7 +41,7 @@ Let us assume that tissues have heterogeneous dielectric properties but homogeneous acoustic properties. The basic acoustic generation equation in an acoustically homogeneous medium can be described as follows: if $u$ is the vector-valued displacement, then tissue certainly reacts to changes in -pressure by accelleration: +pressure by acceleration: @f[ \rho \frac{\partial^2}{\partial t^2}u(t,\mathbf r) = -\nabla p(t,\mathbf r). @@ -118,7 +118,7 @@ defined as the derivative of the pressure potential: v = \frac{\partial\bar{p}}{\partial t} @f] -With the second variables, one then transform the forward problem into +With the second variable, one then transforms the forward problem into two separate equations: @f{eqnarray*} \bar{p}_{t} - v & = & 0 \\ @@ -168,7 +168,7 @@ boundary mass matrix results from the use of absorbing boundary conditions. Above two equations can be rewritten in a matrix form with the pressure and its derivative as -an unknown vecotor: +an unknown vector: @f[ \left(\begin{array}{cc} M & -k\theta M \\ diff --git a/deal.II/examples/step-24/doc/results.dox b/deal.II/examples/step-24/doc/results.dox index d3139965bc..67101997f1 100644 --- a/deal.II/examples/step-24/doc/results.dox +++ b/deal.II/examples/step-24/doc/results.dox @@ -4,7 +4,7 @@ The program writes both graphical data for each time step as well as the values evaluated at each detector location to disk. We then draw them in plots. Experimental data were also collected for comparison. Currently our experiments have only been done in two dimensions by -circually scanning a single detector. The tissue sample here is a thin slice +circularly scanning a single detector. The tissue sample here is a thin slice in the X-Y plane (Z=0), and we assume that signals from other Z directions won't contribute to the data. Consequently, we only have to compare our experimental data with two dimensional simulated data. @@ -136,7 +136,7 @@ plots), but are bulged out in certain directions. To make things worse, the circular mesh we use (see for example step-6 for a view of the coarse mesh) is not isotropic either. The net result is that the signal fronts are not sinusoidal unless the mesh is sufficiently fine. The right image is a -lot better in this respect, though artificts in the form of trailing spurious +lot better in this respect, though artifacts in the form of trailing spurious waves can still be seen. diff --git a/deal.II/examples/step-24/step-24.cc b/deal.II/examples/step-24/step-24.cc index 42d49c6fe1..e44ea21f12 100644 --- a/deal.II/examples/step-24/step-24.cc +++ b/deal.II/examples/step-24/step-24.cc @@ -1,12 +1,22 @@ -/* Author: Xing Jin, Wolfgang Bangerth, Texas A&M University, 2006 */ - -/* $Id$ */ -/* Copyright (C) 2006-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2006 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Xing Jin, Wolfgang Bangerth, Texas A&M University, 2006 + */ // @sect3{Include files} @@ -122,7 +132,7 @@ namespace Step24 // pressure. In the physical setting considered in this program, these are // small absorbers, which we model as a series of little circles where we // assume that the pressure surplus is one, whereas no absorption and - // therefore no pressure surplus is anywhere else. This is how we do things + // therefore no pressure surplus is everywhere else. This is how we do things // (note that if we wanted to expand this program to not only compile but // also to run, we would have to initialize the sources with // three-dimensional source locations): @@ -301,7 +311,7 @@ namespace Step24 // // A first observation would be that this matrix is much sparser than the // regular mass matrix, since none of the shape functions with purely - // interior support contributes to this matrix. We could therefore + // interior support contribute to this matrix. We could therefore // optimize the storage pattern to this situation and build up a second // sparsity pattern that only contains the nonzero entries that we // need. There is a trade-off to make here: first, we would have to have a @@ -465,7 +475,7 @@ namespace Step24 // consumption of the program, the introduction of a few temporary vectors // isn't doing much harm. // - // The only changes to this function are: First, that we do not have to + // The only changes to this function are: first, that we do not have to // project initial values for the velocity $v$, since we know that it is // zero. And second that we evaluate the solution at the detector locations // computed in the constructor. This is done using the diff --git a/deal.II/examples/step-25/doc/intro.dox b/deal.II/examples/step-25/doc/intro.dox index f43b6a3178..41a133cc8c 100644 --- a/deal.II/examples/step-25/doc/intro.dox +++ b/deal.II/examples/step-25/doc/intro.dox @@ -101,9 +101,9 @@ To this end, we can use Newton's method. Given the nonlinear equation $F(u^n) = \mbox{ Find } \delta u^n_l \mbox{ s.t. } F'(u^n_l)\delta u^n_l = -F(u^n_l) \mbox{, set } u^n_{l+1} = u^n_l + \delta u^n_l. \f} -The iteration can be initialized with the old time step, i.e. $u^{n,0} = -u^{n-1}$, and eventually it will produce a solution to the first equation of -the split formulation (see above). For the time discretizaion of the +The iteration can be initialized with the old time step, i.e. $u^n_0 = u^{n-1}$, +and eventually it will produce a solution to the first equation of +the split formulation (see above). For the time discretization of the sine-Gordon equation under consideration here, we have that \f{eqnarray*} F(u^n_l) &=& \left[ 1-k^2\theta^2\Delta \right] u^n_l - @@ -120,7 +120,7 @@ With hindsight, we choose both the solution and the test space to be $H^1(\Omega &\mbox{ Find}& \delta u^n_l \in H^1(\Omega) \mbox{ s.t. } \left( F'(u^n_l)\delta u^n_l, \varphi \right)_{\Omega} = -\left(F(u^n_l), \varphi \right)_{\Omega} \;\forall\varphi\in H^1(\Omega), - \mbox{ set } u^n_{l+1} = u^n_l + \delta u^n_l,\; u^{n,0} = u^{n-1}.\\ + \mbox{ set } u^n_{l+1} = u^n_l + \delta u^n_l,\; u^n_0 = u^{n-1}.\\ &\mbox{ Find}& v^n \in H^1(\Omega) \mbox{ s.t. } \left( v^n, \varphi \right)_{\Omega} = \left( v^{n-1}, \varphi \right)_{\Omega} - k\theta\left( \nabla u^n, \nabla\varphi \right)_{\Omega} @@ -147,7 +147,7 @@ terms of the nodal basis. Henceforth, we shall denote by a capital letter the vector of coefficients (in the nodal basis) of a function denoted by the same letter in lower case; e.g., $u^n = \sum_{i=1}^N U^n_i \varphi_i$ where $U^n \in {R}^N$ and $u^n \in -H^1(\Omega)$. Thus, the finite-dimensional version of the variational fomulation requires that we solve the following matrix equations at each time step: +H^1(\Omega)$. Thus, the finite-dimensional version of the variational formulation requires that we solve the following matrix equations at each time step: @f{eqnarray*} F_h'(U^{n,l})\delta U^{n,l} &=& -F_h(U^{n,l}), \qquad U^{n,l+1} = U^{n,l} + \delta U^{n,l}, \qquad U^{n,0} = U^{n-1}; \\ @@ -157,12 +157,12 @@ Above, the matrix $F_h'(\cdot)$ and the vector $F_h(\cdot)$ denote the discrete \f{eqnarray*} F_h(U^{n,l}) &=& \left[ M+k^2\theta^2A \right] U^{n,l} - \left[ M-k^2\theta(1-\theta)A \right] U^{n-1} - k MV^{n-1} - + k^2\theta S(u^{n,l}, u^{n-1}),\\ + + k^2\theta S(u^n_l, u^{n-1}),\\ F_h'(U^{n,l}) &=& M+k^2\theta^2A - - k^2\theta^2N(u^{n,l},u^{n-1}) + - k^2\theta^2N(u^n_l,u^{n-1}) \f} Again, note that the first matrix equation above is, in fact, the -defition of an iterative procedure, so it is solved multiple times +definition of an iterative procedure, so it is solved multiple times until a stopping criterion is met. Moreover, $M$ is the mass matrix, i.e. $M_{ij} = \left( \varphi_i,\varphi_j \right)_{\Omega}$, $A$ is the Laplace matrix, i.e. $A_{ij} = \left( \nabla \varphi_i, \nabla @@ -176,9 +176,9 @@ i.e. $N_{ij}(f,g) = \left( \cos\left[ \theta f + (1-\theta) g\right]\varphi_i, What solvers can we use for the first equation? Let's look at the matrix we have to invert: @f[ - (M-k^2\theta^2N)_{ij} = + (M+k^2\theta^2(A-N))_{ij} = \int_\Omega (1-k^2\theta^2 \cos \alpha) - \varphi_i\varphi_j \; dx, + \varphi_i\varphi_j \; dx+\int_\Omega \nabla\varphi_i\nabla\varphi_j \; dx, @f] for some $\alpha$ that depends on the present and previous solution. First, note that the matrix is symmetric. In addition, if the time step $k$ is small diff --git a/deal.II/examples/step-25/step-25.cc b/deal.II/examples/step-25/step-25.cc index c7e1326ae7..c3ad5131f1 100644 --- a/deal.II/examples/step-25/step-25.cc +++ b/deal.II/examples/step-25/step-25.cc @@ -1,12 +1,22 @@ -/* Author: Ivan Christov, Wolfgang Bangerth, Texas A&M University, 2006 */ - -/* $Id$ */ -/* Copyright (C) 2006-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2006 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Ivan Christov, Wolfgang Bangerth, Texas A&M University, 2006 + */ // @sect3{Include files and global variables} @@ -323,7 +333,7 @@ namespace Step25 // @sect4{SineGordonProblem::assemble_system} - // This functions assembles the system matrix and right-hand side vector for + // This function assembles the system matrix and right-hand side vector for // each iteration of Newton's method. The reader should refer to the // Introduction for the explicit formulas for the system matrix and // right-hand side. @@ -340,7 +350,6 @@ namespace Step25 { // First we assemble the Jacobian matrix $F'_h(U^{n,l})$, where $U^{n,l}$ // is stored in the vector solution for convenience. - system_matrix = 0; system_matrix.copy_from (mass_matrix); system_matrix.add (std::pow(time_step*theta,2), laplace_matrix); @@ -349,9 +358,23 @@ namespace Step25 system_matrix.add (-std::pow(time_step*theta,2), tmp_matrix); // Then, we compute the right-hand side vector $-F_h(U^{n,l})$. + // + // We have to first build up the matrix + // $M+k^2\theta^2 A$, which we put into tmp_matrix + // use it to compute a contribution to the right hand side vector, and + // then build the matrix $M-k^2\theta(1-\theta) A$. We could + // build it in the same way as before, i.e., using code like + // @code + // tmp_matrix.copy_from (mass_matrix); + // tmp_matrix.add (-std::pow(time_step,2)*theta*(1-theta), laplace_matrix); + // @endcode + // but we can save the expense of the copy_from operation + // by starting from what is already in the tmp_matrix + // variable (i.e., $M+k^2\theta^2 A$) and subtracting from this + // $k^2\theta^2 A+k^2\theta(1-\theta) A=k^2\theta A$ when computing the + // second matrix: system_rhs = 0; - tmp_matrix = 0; tmp_matrix.copy_from (mass_matrix); tmp_matrix.add (std::pow(time_step*theta,2), laplace_matrix); @@ -359,17 +382,14 @@ namespace Step25 tmp_matrix.vmult (tmp_vector, solution); system_rhs += tmp_vector; - tmp_matrix = 0; - tmp_matrix.copy_from (mass_matrix); - tmp_matrix.add (-std::pow(time_step,2)*theta*(1-theta), laplace_matrix); - tmp_vector = 0; + tmp_matrix.add(-std::pow(time_step, 2) * theta, laplace_matrix); + tmp_matrix.vmult (tmp_vector, old_solution); system_rhs -= tmp_vector; system_rhs.add (-time_step, M_x_velocity); - tmp_vector = 0; compute_nl_term (old_solution, solution, tmp_vector); system_rhs.add (std::pow(time_step,2)*theta, tmp_vector); @@ -396,13 +416,14 @@ namespace Step25 // integrate these terms exactly. It is usually sufficient to just make sure // that the right hand side is integrated up to the same order of accuracy // as the discretization scheme is, but it may be possible to improve on the - // constant in the asympotitic statement of convergence by choosing a more + // constant in the asymptotic statement of convergence by choosing a more // accurate quadrature formula. template void SineGordonProblem::compute_nl_term (const Vector &old_data, const Vector &new_data, Vector &nl_term) const { + nl_term = 0; const QGauss quadrature_formula (3); FEValues fe_values (fe, quadrature_formula, update_values | @@ -423,6 +444,7 @@ namespace Step25 for (; cell!=endc; ++cell) { + local_nl_term = 0; // Once we re-initialize our FEValues instantiation to // the current cell, we make use of the // get_function_values routine to get the values of the @@ -449,15 +471,13 @@ namespace Step25 for (unsigned int i=0; icompute_nl_term, // we must allow this function to receive as input an "old" and a "new" // solution, which we again call $w_{\mathrm{old}}$ and $w_{\mathrm{new}}$ @@ -485,6 +505,7 @@ namespace Step25 for (; cell!=endc; ++cell) { + local_nl_matrix = 0; // Again, first we re-initialize our FEValues // instantiation to the current cell. fe_values.reinit (cell); @@ -511,8 +532,6 @@ namespace Step25 for (unsigned int j=0; j preconditioner; preconditioner.initialize(system_matrix, 1.2); - solution_update = 0; cg.solve (system_matrix, solution_update, system_rhs, preconditioner); @@ -592,7 +610,7 @@ namespace Step25 { make_grid_and_dofs (); - // To aknowledge the initial condition, we must use the function $u_0(x)$ + // To acknowledge the initial condition, we must use the function $u_0(x)$ // to compute $U^0$. To this end, below we will create an object of type // InitialValues; note that when we create this object (which // is derived from the Function class), we set its internal @@ -676,11 +694,9 @@ namespace Step25 laplace_matrix.vmult (tmp_vector, solution); M_x_velocity.add (-time_step*theta, tmp_vector); - tmp_vector = 0; laplace_matrix.vmult (tmp_vector, old_solution); M_x_velocity.add (-time_step*(1-theta), tmp_vector); - tmp_vector = 0; compute_nl_term (old_solution, solution, tmp_vector); M_x_velocity.add (-time_step, tmp_vector); diff --git a/deal.II/examples/step-26/step-26.cc b/deal.II/examples/step-26/step-26.cc index 00422f8d43..d047fc7b5c 100644 --- a/deal.II/examples/step-26/step-26.cc +++ b/deal.II/examples/step-26/step-26.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, Texas A&M University, 2013 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, Texas A&M University, 2013 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ #include #include @@ -59,7 +69,7 @@ namespace Step26 void solve_time_step(); void output_results() const; void refine_mesh (const unsigned int min_grid_level, - const unsigned int max_grid_level); + const unsigned int max_grid_level); Triangulation triangulation; FE_Q fe; @@ -176,13 +186,13 @@ namespace Step26 dof_handler.distribute_dofs(fe); std::cout << std::endl - << "===========================================" - << std::endl - << "Number of active cells: " << triangulation.n_active_cells() + << "===========================================" << std::endl - << "Number of degrees of freedom: " << dof_handler.n_dofs() + << "Number of active cells: " << triangulation.n_active_cells() << std::endl - << std::endl; + << "Number of degrees of freedom: " << dof_handler.n_dofs() + << std::endl + << std::endl; constraints.clear (); DoFTools::make_hanging_node_constraints (dof_handler, @@ -203,12 +213,12 @@ namespace Step26 MatrixCreator::create_mass_matrix(dof_handler, QGauss(fe.degree+1), mass_matrix, - (const Function*)0, + (const Function *)0, constraints); MatrixCreator::create_laplace_matrix(dof_handler, QGauss(fe.degree+1), laplace_matrix, - (const Function*)0, + (const Function *)0, constraints); solution.reinit(dof_handler.n_dofs()); @@ -291,7 +301,7 @@ namespace Step26 // too high a mesh level. template void HeatEquation::refine_mesh (const unsigned int min_grid_level, - const unsigned int max_grid_level) + const unsigned int max_grid_level) { Vector estimated_error_per_cell (triangulation.n_active_cells()); @@ -310,8 +320,8 @@ namespace Step26 cell != triangulation.end(); ++cell) cell->clear_refine_flag (); for (typename Triangulation::active_cell_iterator - cell = triangulation.begin_active(min_grid_level); - cell != triangulation.end_active(min_grid_level); ++cell) + cell = triangulation.begin_active(min_grid_level); + cell != triangulation.end_active(min_grid_level); ++cell) cell->clear_coarsen_flag (); @@ -320,7 +330,7 @@ namespace Step26 // SolutionTransfer class and we have to prepare the solution vectors that // should be transferred to the new grid (we will lose the old grid once // we have done the refinement so the transfer has to happen concurrently - // with refinement). What we definetely need are the current and the old + // with refinement). What we definitely need are the current and the old // temperature (BDF-2 time stepping requires two old solutions). Since the // SolutionTransfer objects only support to transfer one object per dof // handler, we need to collect the two temperature solutions in one data @@ -403,8 +413,8 @@ start_time_iteration: std::cout << "Time step " << timestep_number << " at t=" << time << std::endl; - tmp.reinit (solution.size()); - forcing_terms.reinit (solution.size()); + tmp.reinit (solution.size()); + forcing_terms.reinit (solution.size()); mass_matrix.vmult(system_rhs, old_solution); @@ -458,16 +468,16 @@ start_time_iteration: (pre_refinement_step < n_adaptive_pre_refinement_steps)) { refine_mesh (initial_global_refinement, - initial_global_refinement + n_adaptive_pre_refinement_steps); + initial_global_refinement + n_adaptive_pre_refinement_steps); ++pre_refinement_step; - std::cout << std::endl; + std::cout << std::endl; goto start_time_iteration; } else if ((timestep_number > 0) && (timestep_number % 5 == 0)) refine_mesh (initial_global_refinement, - initial_global_refinement + n_adaptive_pre_refinement_steps); + initial_global_refinement + n_adaptive_pre_refinement_steps); old_solution = solution; } diff --git a/deal.II/examples/step-27/step-27.cc b/deal.II/examples/step-27/step-27.cc index 8400b3c6e7..1a4beaca1f 100644 --- a/deal.II/examples/step-27/step-27.cc +++ b/deal.II/examples/step-27/step-27.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, Texas A&M University, 2006, 2007 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2006 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, Texas A&M University, 2006, 2007 + */ + // @sect3{Include files} diff --git a/deal.II/examples/step-28/doc/intro.dox b/deal.II/examples/step-28/doc/intro.dox index 179a8fa239..b7076cbc86 100644 --- a/deal.II/examples/step-28/doc/intro.dox +++ b/deal.II/examples/step-28/doc/intro.dox @@ -179,7 +179,7 @@ one. A stable reactor should have $k_{\mathrm{eff}}=1$. [For those who wonder how this can be achieved in practice without inadvertently getting slightly larger than one and triggering a nuclear bomb: first, fission processes happen on different time scales. While most neutrons -are releases very quickly after a fission event, a small number of neutrons +are released very quickly after a fission event, a small number of neutrons are only released by daughter nuclei after several further decays, up to 10-60 seconds after the fission was initiated. If one is therefore slightly beyond $k_{\mathrm{eff}}=1$, one therefore has many seconds to react until all the @@ -431,7 +431,7 @@ these three cases, as follows:
  • If the cell $K$ is active on mesh $g$, but not $g'$, then the basis functions $\varphi_{g'}^j$ are only defined either on the children $K_c,0\le c<2^{\texttt{dim}}$, or on children of these children if cell $K$ - is refined more than once more on mesh $g'$. + is refined more than once on mesh $g'$. Let us assume for a second that $K$ is only once more refined on mesh $g'$ than on mesh $g$. Using the fact that we use embedded finite element spaces diff --git a/deal.II/examples/step-28/doc/results.dox b/deal.II/examples/step-28/doc/results.dox index 1a48da48b7..edbacad443 100644 --- a/deal.II/examples/step-28/doc/results.dox +++ b/deal.II/examples/step-28/doc/results.dox @@ -61,7 +61,7 @@ in following figure. -We see that the grid of thermal group is much finner than the one of fast group. +We see that the grid of thermal group is much finer than the one of fast group. The solutions on these grids are, (Note: flux are normalized with total fission source equal to 1) @@ -77,4 +77,4 @@ The estimated ``exact'' k-effective = 0.906834721253 which is simply from last mesh iteration of polynomial order 3 minus 2e-10. We see that h-adaptive calculations deliver an algebraic convergence. And the higher polynomial order is, the faster mesh iteration converges. In our problem, we need smaller number of DoFs to achieve same -accuracy with higher polynoimal order. +accuracy with higher polynomial order. diff --git a/deal.II/examples/step-28/step-28.cc b/deal.II/examples/step-28/step-28.cc index fe9100ccda..5e108c3b19 100644 --- a/deal.II/examples/step-28/step-28.cc +++ b/deal.II/examples/step-28/step-28.cc @@ -1,13 +1,23 @@ -/* Author: Yaqi Wang, Texas A&M University, 2009, 2010 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2009 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Yaqi Wang, Texas A&M University, 2009, 2010 + */ -/* $Id$ */ -/* */ -/* 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -142,7 +152,7 @@ namespace Step28 // arrays. It takes the number of energy groups as an argument (an throws an // error if that value is not equal to two, since at presently only data for // two energy groups is implemented; however, using this, the function - // remains flexible and extendible into the future). In the member + // remains flexible and extendable into the future). In the member // initialization part at the beginning, it also resizes the arrays to their // correct sizes. // @@ -496,7 +506,7 @@ namespace Step28 ConstraintMatrix hanging_node_constraints; - // @sect5{Private member functionss} + // @sect5{Private member functions} // // There is one private member function in this class. It recursively // walks over cells of two meshes to compute the cross-group right hand @@ -790,7 +800,7 @@ namespace Step28 // groups. First we call get_finest_common_cells to obtain this // list of pairs of common cells from both meshes. Both cells in a pair may // not be active but at least one of them is. We then hand each of these - // cell pairs off to a function tha computes the right hand side terms + // cell pairs off to a function that computes the right hand side terms // recursively. // // Note that ingroup coupling is handled already before, so we exit the diff --git a/deal.II/examples/step-29/CMakeLists.txt b/deal.II/examples/step-29/CMakeLists.txt index 14a0f1000d..6872bc4bfb 100644 --- a/deal.II/examples/step-29/CMakeLists.txt +++ b/deal.II/examples/step-29/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_UMFPACK) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_UMFPACK = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-29/doc/intro.dox b/deal.II/examples/step-29/doc/intro.dox index 73cd997c5e..32c62b84e3 100644 --- a/deal.II/examples/step-29/doc/intro.dox +++ b/deal.II/examples/step-29/doc/intro.dox @@ -38,7 +38,7 @@ toplevel overview of this topic can be found in the @ref vector_valued module. The original purpose of this program is to simulate the focussing properties of an ultrasound wave generated by a transducer lens with variable geometry. Recent applications in medical imaging use ultrasound waves not only -for imaging porposes, but also to excite certain local effects in a +for imaging purposes, but also to excite certain local effects in a material, like changes in optical properties, that can then be measured by other imaging techniques. A vital ingredient for these methods is the ability to focus the intensity of the ultrasound wave in a particular part of the @@ -96,7 +96,7 @@ boundary condition will yield partial reflections, i.e. only parts of the wave will pass through the boundary as if it wasn't here whereas the remaining fraction of the wave will be reflected back into the domain. -If we are willing to accept this as a suffient approximation to an absorbing boundary we finally arrive at the following problem for $u$: +If we are willing to accept this as a sufficient approximation to an absorbing boundary we finally arrive at the following problem for $u$: @f{eqnarray*} -\omega^2 u - c^2\Delta u &=& 0, \qquad x\in\Omega,\\ c (n\cdot\nabla u) + i\,\omega\,u &=&0, \qquad x\in\Gamma_2,\\ @@ -180,7 +180,7 @@ of the circle with center at $(0.5, d)$ and a radius slightly greater than $d$; this shape should lead to a focusing of the sound wave at the center of the circle. Varying $d$ changes the "focus" of the lens and affects the spatial distribution of the intensity of $u$, where our main -concern is how well $|u|=\sqrt{v^2+w^2}$ is.focussed. +concern is how well $|u|=\sqrt{v^2+w^2}$ is focussed. In the program below, we will implement the complex-valued Helmholtz equations using the formulation with split real and imaginary parts. We will also diff --git a/deal.II/examples/step-29/doc/results.dox b/deal.II/examples/step-29/doc/results.dox index cf9a8790dc..68c64e64bb 100644 --- a/deal.II/examples/step-29/doc/results.dox +++ b/deal.II/examples/step-29/doc/results.dox @@ -160,7 +160,7 @@ and the effort to solve a banded linear system using LU decomposition is ${\cal O}(BN)$. This also explains why the program does run in 3d as well (after changing the dimension on the UltrasoundProblem object), but scales very badly and -takes extraordinate patience before it finishes solving the linear +takes extraordinary patience before it finishes solving the linear system on a mesh with appreciable resolution, even though all the other parts of the program scale very nicely. diff --git a/deal.II/examples/step-29/step-29.cc b/deal.II/examples/step-29/step-29.cc index 5c428f66ef..de6f652035 100644 --- a/deal.II/examples/step-29/step-29.cc +++ b/deal.II/examples/step-29/step-29.cc @@ -1,13 +1,22 @@ -/* Author: Moritz Allmaras, Texas A&M University, 2007 */ - -/* $Id$ */ -/* Copyright (C) 2007-2008, 2010-2012 by the deal.II authors and M. Allmaras */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ - +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2007 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Moritz Allmaras, Texas A&M University, 2007 + */ // @sect3{Include files} @@ -321,7 +330,7 @@ namespace Step29 {} - // The actual prostprocessing happens in the following function. Its inputs + // The actual postprocessing happens in the following function. Its inputs // are a vector representing values of the function (which is here // vector-valued) representing the data vector given to // DataOut::add_data_vector, evaluated at all evaluation points where we @@ -358,7 +367,7 @@ namespace Step29 ExcDimensionMismatch (computed_quantities[i].size(), 1)); Assert(uh[i].size() == 2, ExcDimensionMismatch (uh[i].size(), 2)); - computed_quantities[i](0) = sqrt(uh[i](0)*uh[i](0) + uh[i](1)*uh[i](1)); + computed_quantities[i](0) = std::sqrt(uh[i](0)*uh[i](0) + uh[i](1)*uh[i](1)); } } @@ -625,7 +634,7 @@ namespace Step29 // At this point, it is important to keep in mind that we are // dealing with a finite element system with two // components. Due to the way we constructed this FESystem, - // namely as the cartesian product of two scalar finite + // namely as the Cartesian product of two scalar finite // element fields, each shape function has only a single // nonzero component (they are, in deal.II lingo, @ref // GlossPrimitive "primitive"). Hence, each shape function diff --git a/deal.II/examples/step-3/doc/intro.dox b/deal.II/examples/step-3/doc/intro.dox index ad3f4abe64..741e2e2d85 100644 --- a/deal.II/examples/step-3/doc/intro.dox +++ b/deal.II/examples/step-3/doc/intro.dox @@ -264,18 +264,18 @@ Secondly, let's look at the member functions. These, as well, already form the common structure that almost all following tutorial programs will use:
    • make_grid(): This is what one could call a - pre-processing function. As its name suggests, it sets up the + preprocessing function. As its name suggests, it sets up the object that stores the triangulation. In later examples, it could also deal with boundary conditions, geometries, etc.
    • setup_system(): This then is the function in which all the other data structures are set up that are needed to solve the problem. In particular, it will initialize the DoFHandler object and correctly size the various objects that have to do with the linear - algebra. This function is often separated from the pre-processing + algebra. This function is often separated from the preprocessing function above because, in a time dependent program, it may be called at least every few time steps whenever the mesh is adaptively refined (something we will see how to do in step-6). On - the other hand, setting up the mesh itself in the pre-processing + the other hand, setting up the mesh itself in the preprocessing function above is done only once at the beginning of the program and is, therefore, separated into its own function.
    • assemble_system(): This, then is where the contents of the @@ -315,4 +315,72 @@ separation of functionality — again in many of the following tutorial programs. +

      A note on types

      + +deal.II defines a number of integral %types via typedefs in +namespace types. In particular, in this program you will see +types::global_dof_index in a couple of places: an integer type that is used to +denote the global index of a degree of freedom, i.e., the index of a +particular degree of freedom within the DoFHandler object that is defined on +top of a triangulation (as opposed to the index of a particular degree of +freedom within a particular cell). For the current program +(as well as almost all of the tutorial programs), you will have a few thousand +to maybe a few million unknowns globally (and, for $Q_1$ elements, you will +have 4 locally on each cell in 2d and 8 in 3d). Consequently, a data +type that allows to store sufficiently large numbers for global DoF indices is +unsigned int given that it allows to store numbers between 0 and +slightly more than 4 billion (on most systems, where integers are 32-bit). In +fact, this is what types::global_dof_index is. + +So, why not just use unsigned int right away? deal.II used to do +this until version 7.3. However, deal.II supports very large computations (via +the framework discussed in step-40) that may have more than 4 billion unknowns +when spread across a few thousand processors. Consequently, there are +situations where unsigned int is not sufficiently large and we +need a 64-bit unsigned integral type. To make this possible, we introduced +types::global_dof_index which by default is defined as simply unsigned +int whereas it is possible to define it as unsigned long long +int if necessary, by passing a particular flag during configuration +(see the ReadMe file). + +This covers the technical aspect. But there is also a documentation purpose: +everywhere in the library and codes that are built on it, if you see a place +using the data type types::global_dof_index, you immediately know that the +quantity that is being referenced is, in fact, a global dof index. No such +meaning would be apparent if we had just used unsigned int (which +may also be a local index, a boundary indicator, a material id, +etc.). Immediately knowing what a variable refers to also helps avoid errors: +it's quite clear that there must be a bug if you see an object of type +types::global_dof_index being assigned to variable of type +types::subdomain_id, even though they are both represented by unsigned +integers and the compiler will, consequently, not complain. + +In more practical terms what the presence of this type means is that during +assembly, we create a $4\times 4$ matrix (in 2d, using a $Q_1$ element) of the +contributions of the cell we are currently sitting on, and then we need to add +the elements of this matrix to the appropriate elements of the global (system) +matrix. For this, we need to get at the global indices of the degrees of +freedom that are local to the current cell, for which we will always use the +following piece of the code: +@code + cell->get_dof_indices (local_dof_indices); +@endcode +where local_dof_indices is declared as +@code + std::vector local_dof_indices (fe.dofs_per_cell); +@endcode +The name of this variable might be a bit of a misnomer -- it stands for "the +global indices of those degrees of freedom locally defined on the current +cell" -- but variables that hold this information are universally named this +way throughout the library. + +@note types::global_dof_index is not the only type defined in this +namespace. Rather, there is a whole family, including types::subdomain_id, +types::boundary_id, and types::material_id. All of these are +typedefs for integer data types but, as explained above, they are +used throughout the library so that (i) the intent of a variable becomes more +easily discerned, and (ii) so that it becomes possible to change the actual +type to a larger one if necessary without having to go through the entire +library and figure out whether a particular use of unsigned int +corresponds to, say, a material indicator. diff --git a/deal.II/examples/step-3/doc/results.dox b/deal.II/examples/step-3/doc/results.dox index 4f8b502688..50012fae17 100644 --- a/deal.II/examples/step-3/doc/results.dox +++ b/deal.II/examples/step-3/doc/results.dox @@ -120,7 +120,7 @@ suggestions: values for those faces that have zero boundary indicator, and leave those faces alone that have a different boundary indicator. What this then does is to impose Dirichlet boundary conditions on the - former, and homogenous Neumann conditions on the latter (i.e. zero + former, and homogeneous Neumann conditions on the latter (i.e. zero normal derivative of the solution, unless one adds additional terms to the right hand side of the variational equality that deal with potentially non-zero Neumann conditions). You will see this if you @@ -187,7 +187,7 @@ suggestions: LaplaceProblem::LaplaceProblem.
    • Convergence of the mean: A different way to see that the solution - actually converges (to something &mdash we can't tell whether it's really + actually converges (to something — we can't tell whether it's really the correct value!) is to compute the mean of the solution. To this end, add the following code to LaplaceProblem::output_results: @code diff --git a/deal.II/examples/step-3/step-3.cc b/deal.II/examples/step-3/step-3.cc index 7d83c5211c..f6ab655810 100644 --- a/deal.II/examples/step-3/step-3.cc +++ b/deal.II/examples/step-3/step-3.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, 1999, Guido Kanschat, 2011 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 1999-2004, 2006-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 1999 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Wolfgang Bangerth, 1999, + * Guido Kanschat, 2011 + */ // @sect3{Many new include files} @@ -265,7 +275,7 @@ void Step3::assemble_system () // mentioned, we use the implied Q1 mapping, rather than specifying one // ourselves explicitly. Finally, we have to tell it what we want it to // compute on each cell: we need the values of the shape functions at the - // quadrature points (for the right hand side $(\varphi,f)$), their + // quadrature points (for the right hand side $(\varphi_i,f)$), their // gradients (for the matrix entries $(\nabla \varphi_i, \nabla // \varphi_j)$), and also the weights of the quadrature points and the // determinants of the Jacobian transformations from the reference cell to @@ -286,12 +296,12 @@ void Step3::assemble_system () update_values | update_gradients | update_JxW_values); // The advantage of this approach is that we can specify what kind of // information we actually need on each cell. It is easily understandable - // that this approach can significant speed up finite element computations, + // that this approach can significantly speed up finite element computations, // compared to approaches where everything, including second derivatives, - // normal vectors to cells, etc are computed on each cell, regardless + // normal vectors to cells, etc are computed on each cell, regardless of // whether they are needed or not. - // For use further down below, we define two short cuts for values that will + // For use further down below, we define two shortcuts for values that will // be used very frequently. First, an abbreviation for the number of degrees // of freedom on each cell (since we are in 2D and degrees of freedom are // associated with vertices only, this number is four, but we rather want to @@ -302,7 +312,7 @@ void Step3::assemble_system () // // Secondly, we also define an abbreviation for the number of quadrature // points (here that should be four). In general, it is a good idea to use - // their symbolic names instead of hard-coding these number even if you know + // their symbolic names instead of hard-coding these numbers even if you know // them, since you may want to change the quadrature formula and/or finite // element at some time; the program will just work with these changes, // without the need to change anything in this function. @@ -333,7 +343,8 @@ void Step3::assemble_system () // through dofs_per_cell-1). However, when we transfer the result into the // global matrix, we have to know the global numbers of the degrees of // freedom. When we query them, we need a scratch (temporary) array for - // these numbers: + // these numbers (see the discussion at the end of the introduction for + // the type, types::global_dof_index, used here): std::vector local_dof_indices (dofs_per_cell); // Now for the loop over all cells. We have seen before how this works, so diff --git a/deal.II/examples/step-30/doc/intro.dox b/deal.II/examples/step-30/doc/intro.dox index dc8ea2fa18..3e21d47e34 100644 --- a/deal.II/examples/step-30/doc/intro.dox +++ b/deal.II/examples/step-30/doc/intro.dox @@ -192,7 +192,7 @@ affects some of the most fundamental assumptions. Consequently, some of the usual code found in application programs will need modifications to exploit the features of meshes which were created using anisotropic refinement. For those interested in how deal.II evolved, it may be of -interest that the losening of such invariants required some +interest that the loosening of such invariants required some incompatible changes. For example, the library used to have a member GeometryInfo::children_per_cell that specified how many children a cell has once it is refined. For isotropic refinement, this number @@ -202,7 +202,7 @@ does not exist, as is can be either two or four in 2D and two, four or eight in consequently been removed. It has now been replaced by GeometryInfo::max_children_per_cell which specifies the maximum number of children a cell can have. How many children a -refined cell has was previously available as static informtion, but +refined cell has was previously available as static information, but now it depends on the actual refinement state of a cell and can be retrieved using the function call cell-@>n_children(), a call that works equally well for both isotropic and anisotropic diff --git a/deal.II/examples/step-30/doc/results.dox b/deal.II/examples/step-30/doc/results.dox index 9c928eea18..a98bb187c4 100644 --- a/deal.II/examples/step-30/doc/results.dox +++ b/deal.II/examples/step-30/doc/results.dox @@ -146,6 +146,6 @@ It might seem that the necessary alignment of anisotropic features and the coarse mesh can decrease performance significantly for real world problems. However, that is not always the case. Considering boundary layers in compressible viscous flows, for example, the mesh is always aligned with the -anisotropic features, thus anisotropic refinement will almost alway increase the +anisotropic features, thus anisotropic refinement will almost always increase the efficiency of computations on adapted grids for these cases. diff --git a/deal.II/examples/step-30/step-30.cc b/deal.II/examples/step-30/step-30.cc index 4319302767..0afa9f2543 100644 --- a/deal.II/examples/step-30/step-30.cc +++ b/deal.II/examples/step-30/step-30.cc @@ -1,14 +1,23 @@ -/* Author: Tobias Leicht, 2007 */ - -/* $Id$ */ -/* Version: $Name$ */ -/* */ -/* Copyright (C) 2007-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2007 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Tobias Leicht, 2007 + */ + // The deal.II include files have already been covered in previous examples // and will thus not be further commented on. @@ -97,7 +106,7 @@ namespace Step30 // in the left part of the domain at a velocity that matches the one coming // in from the right. In the circular part the magnitude of the flow // velocity is proportional to the distance from the origin. This is a - // difference to step-12, where the magnitude was 1 evereywhere. the new + // difference to step-12, where the magnitude was 1 everywhere. the new // definition leads to a linear variation of $\beta$ along each given face // of a cell. On the other hand, the solution $u(x,y)$ is exactly the same // as before. @@ -376,7 +385,7 @@ namespace Step30 anisotropic(anisotropic), // As beta is a linear function, we can choose the degree of the // quadrature for which the resulting integration is correct. Thus, we - // choose to use degree+1 gauss points, which enables us to + // choose to use degree+1 Gauss points, which enables us to // integrate exactly polynomials of degree 2*degree+1, enough // for all the integrals we will perform in this program. quadrature (degree+1), @@ -498,7 +507,7 @@ namespace Step30 // Case b), we decide that there are finer cells as neighbors // by asking the face, whether it has children. if so, then // there must also be finer cells which are children or - // farther offsprings of our neighbor. + // farther offspring of our neighbor. if (face->has_children()) { // We need to know, which of the neighbors faces points in @@ -567,7 +576,7 @@ namespace Step30 (neighbor->level() < cell->level() && neighbor->index() == cell->index()))) { - // Here we know, that the neigbor is not coarser so we + // Here we know, that the neighbor is not coarser so we // can use the usual @p neighbor_of_neighbor // function. However, we could also use the more // general @p neighbor_face_no function. @@ -675,9 +684,9 @@ namespace Step30 triangulation.execute_coarsening_and_refinement (); } - // Once an error indicator has been evaluated and the cells with largerst + // Once an error indicator has been evaluated and the cells with largest // error are flagged for refinement we want to loop over the flagged cells - // again to decide whether they need isotropic refinemnt or whether + // again to decide whether they need isotropic refinement or whether // anisotropic refinement is more appropriate. This is the anisotropic jump // indicator explained in the introduction. template @@ -697,7 +706,7 @@ namespace Step30 endc=dof_handler.end(); for (; cell!=endc; ++cell) - // We only need to consider cells which are flaged for refinement. + // We only need to consider cells which are flagged for refinement. if (cell->refine_flag_set()) { Point jump; @@ -715,7 +724,7 @@ namespace Step30 std::vector u (fe_v_face.n_quadrature_points); std::vector u_neighbor (fe_v_face.n_quadrature_points); - // The four cases of different neighbor relations senn in + // The four cases of different neighbor relations seen in // the assembly routines are repeated much in the same way // here. if (face->has_children()) @@ -732,7 +741,7 @@ namespace Step30 // present subface... typename DoFHandler::cell_iterator neighbor_child = cell->neighbor_child_on_subface(face_no,subface_no); Assert (!neighbor_child->has_children(), ExcInternalError()); - // ... and reinit the respective FEFaceValues und + // ... and reinit the respective FEFaceValues and // FESubFaceValues objects. fe_v_subface.reinit (cell, face_no, subface_no); fe_v_face_neighbor.reinit (neighbor_child, neighbor2); @@ -740,7 +749,7 @@ namespace Step30 fe_v_subface.get_function_values(solution2, u); fe_v_face_neighbor.get_function_values(solution2, u_neighbor); // as well as the quadrature weights, multiplied by - // the jacobian determinant. + // the Jacobian determinant. const std::vector &JxW = fe_v_subface.get_JxW_values (); // Now we loop over all quadrature points for (unsigned int x=0; xdim components. jump[face_no/2]+=std::fabs(u[x]-u_neighbor[x])*JxW[x]; // We also sum up the scaled weights to obtain @@ -835,8 +844,8 @@ namespace Step30 // Now we loop over the dim coordinate directions of // the unit cell and compare the average jump over the faces - // orthogional to that direction with the average jumnps over faces - // orthogonal to the remining direction(s). If the first is larger + // orthogonal to that direction with the average jumps over faces + // orthogonal to the remaining direction(s). If the first is larger // than the latter by a given factor, we refine only along hat // axis. Otherwise we leave the refinement flag unchanged, resulting // in isotropic refinement. diff --git a/deal.II/examples/step-31/CMakeLists.txt b/deal.II/examples/step-31/CMakeLists.txt index 645efcfc55..f21c9612ea 100644 --- a/deal.II/examples/step-31/CMakeLists.txt +++ b/deal.II/examples/step-31/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_TRILINOS) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_TRILINOS = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-31/doc/intro.dox b/deal.II/examples/step-31/doc/intro.dox index e14e4c87b5..7676de331c 100644 --- a/deal.II/examples/step-31/doc/intro.dox +++ b/deal.II/examples/step-31/doc/intro.dox @@ -77,7 +77,7 @@ sometimes, as in the case of rock minerals at temperatures close to their melting point, $\eta$ may change by orders of magnitude over the typical range of temperatures. -We note that the Stokes equation above could be non-dimensionalized by +We note that the Stokes equation above could be nondimensionalized by introducing the Rayleigh number $\mathrm{Ra}=\frac{\|g\| \beta \rho}{\eta \kappa} \delta T L^3$ using a @@ -117,6 +117,12 @@ shorter than for the same amount of heat to be distributed by thermal conductivity and a time scale of relevance to affect the evolution of the earth's interior and surface structure. +@note If you are interested in using the program as the basis for your own +experiments, you will also want to take a look at its continuation in +step-32. Furthermore, step-32 later was developed into the much larger open +source code Aspect (see http://aspect.dealii.org/ ) that can solve realistic +problems and that you may want to investigate before trying to morph step-31 +into something that can solve whatever you want to solve.

      %Boundary and initial conditions

      @@ -476,7 +482,7 @@ diffusion into the equations we would like to solve. Note that the numerical viscosity $\nu(T)$ is temperature-dependent, so the equation we want to solve is nonlinear in T — not what one desires from a simple method to stabilize an equation, and even less so if we realize -that $\nu(T)$ is non-differentiable in T. However, there is no +that $\nu(T)$ is nondifferentiable in T. However, there is no reason to despair: we still have to discretize in time and we can treat the term explicitly. @@ -551,7 +557,7 @@ artificial diffusion operates on the extrapolated temperature at the current time in the same way as we have discussed the advection works in the section on time stepping. -The form for non-uniform time steps that we will have to use in +The form for nonuniform time steps that we will have to use in reality is a bit more complicated (which is why we showed the simpler form above first) and reads: @f{eqnarray*} @@ -993,7 +999,7 @@ boundary, we will require no-normal flux for the velocity introduction of step-22 and fixes one component of the velocity while allowing flow to be %parallel to the boundary. There remain dim-1 components to be fixed, namely the tangential components of -the normal stress; for these, we choose homogenous conditions which means that +the normal stress; for these, we choose homogeneous conditions which means that we do not have to anything special. Initial conditions are only necessary for the temperature field, and we choose it to be constant zero. @@ -1005,6 +1011,6 @@ are allowed. We therefore choose three spherical heat sources unequally spaced close to the bottom of the domain, imitating three candles. The fluid located at these sources, initially at rest, is then heated up and as the temperature rises gains buoyancy, rising up; more fluid is dragged up and through the -sources, leading to three hote plumes that rise up until they are captured by +sources, leading to three hot plumes that rise up until they are captured by the recirculation of fluid that sinks down on the outside, replacing the air that rises due to heating. diff --git a/deal.II/examples/step-31/doc/results.dox b/deal.II/examples/step-31/doc/results.dox index 55b0db1520..acccb42087 100644 --- a/deal.II/examples/step-31/doc/results.dox +++ b/deal.II/examples/step-31/doc/results.dox @@ -512,8 +512,8 @@ half the size for the $Q_1$ element, a fact that may not be surprising if we state the CFL condition as the requirement that the time step be small enough so that the distance transport advects in each time step is no longer than one grid point away (which for $Q_1$ elements -is $h_K$, but for $Q_2$ elements is $h_K/2$). It turns out that $\beta$ -needs to be sligthly larger for obtaining stable results also late in +is $h_K$, but for $Q_2$ elements is $h_K/2$). It turns out that $\beta$ +needs to be slightly larger for obtaining stable results also late in the simulation at times larger than 60, so we actually choose it as $\beta = 0.034$ in the code. @@ -593,7 +593,9 @@ There are various ways to extend the current program. Of particular interest is, of course, to make it faster and/or increase the resolution of the program, in particular in 3d. This is the topic of the step-32 tutorial program which will implement strategies to solve this problem in -%parallel on a cluster. +%parallel on a cluster. It is also the basis of the much larger open +source code Aspect (see http://aspect.dealii.org/ ) that can solve realistic +problems and that constitutes the further development of step-32. Another direction would be to make the fluid flow more realistic. The program was initially written to simulate various cases simulating the convection of diff --git a/deal.II/examples/step-31/step-31.cc b/deal.II/examples/step-31/step-31.cc index 14f06d743f..c40b9bd5a6 100644 --- a/deal.II/examples/step-31/step-31.cc +++ b/deal.II/examples/step-31/step-31.cc @@ -1,14 +1,24 @@ -/* Author: Martin Kronbichler, Uppsala University, - Wolfgang Bangerth, Texas A&M University 2007, 2008 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2007-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2007 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Martin Kronbichler, Uppsala University, + * Wolfgang Bangerth, Texas A&M University 2007, 2008 + */ + // @sect3{Include files} @@ -78,12 +88,12 @@ namespace Step31 // same as in step-22. Regarding the details, though, there are some // differences. - // The first thing is that we don't set any non-homogenous boundary + // The first thing is that we don't set any nonhomogeneous boundary // conditions on the velocity, since as is explained in the introduction we // will use no-flux conditions $\mathbf{n}\cdot\mathbf{u}=0$. So what is // left are dim-1 conditions for the tangential part of the // normal component of the stress tensor, $\textbf{n} \cdot [p \textbf{1} - - // \eta\varepsilon(\textbf{u})]$; we assume homogenous values for these + // \eta\varepsilon(\textbf{u})]$; we assume homogeneous values for these // components, i.e. a natural boundary condition that requires no specific // action (it appears as a zero term in the right hand side of the weak // form). @@ -236,7 +246,7 @@ namespace Step31 // // Secondly, we catch any exceptions that the solver may have thrown. The // reason is as follows: When debugging a program like this one - // occasionally makes a mistake of passing an indefinite or non-symmetric + // occasionally makes a mistake of passing an indefinite or nonsymmetric // matrix or preconditioner to the current class. The solver will, in that // case, not converge and throw a run-time exception. If not caught here // it will propagate up the call stack and may end up in @@ -754,7 +764,7 @@ namespace Step31 // detail in the results section of this tutorial program. The second is the // exponent $\alpha$; $\alpha=1$ appears to work fine for the current // program, even though some additional benefit might be expected from - // chosing $\alpha = 2$. Finally, there is one thing that requires special + // choosing $\alpha = 2$. Finally, there is one thing that requires special // casing: In the first time step, the velocity equals zero, and the formula // for $\nu|_K$ is not defined. In that case, we return $\nu|_K=5\cdot 10^3 // \cdot h_K$, a choice admittedly more motivated by heuristics than @@ -940,7 +950,7 @@ namespace Step31 // dofs. Consequently, there will be no data written at positions of // constrained degrees of freedom, so we can let the // DoFTools::make_sparsity_pattern function omit these entries by setting - // the last boolean flag to false. Once the sparsity pattern + // the last Boolean flag to false. Once the sparsity pattern // is ready, we can use it to initialize the Trilinos matrices. Since the // Trilinos matrices store the sparsity pattern internally, there is no // need to keep the sparsity pattern around after the initialization of @@ -1180,15 +1190,15 @@ namespace Step31 // Next, we set some more options of the AMG preconditioner. In // particular, we need to tell the AMG setup that we use quadratic basis // functions for the velocity matrix (this implies more nonzero elements - // in the matrix, so that a more rubust algorithm needs to be chosen + // in the matrix, so that a more robust algorithm needs to be chosen // internally). Moreover, we want to be able to control how the coarsening // structure is build up. The way the Trilinos smoothed aggregation AMG // does this is to look which matrix entries are of similar size as the // diagonal entry in order to algebraically build a coarse-grid // structure. By setting the parameter aggregation_threshold - // to 0.02, we specify that all entries that are more than two precent of + // to 0.02, we specify that all entries that are more than two percent of // size of some diagonal pivots in that row should form one coarse grid - // point. This parameter is rather ad-hoc, and some fine-tuning of it can + // point. This parameter is rather ad hoc, and some fine-tuning of it can // influence the performance of the preconditioner. As a rule of thumb, // larger values of aggregation_threshold will decrease the // number of iterations, but increase the costs per iteration. A look at @@ -1198,7 +1208,7 @@ namespace Step31 // // Finally, we also initialize the preconditioner for the inversion of the // pressure mass matrix. This matrix is symmetric and well-behaved, so we - // can chose a simple preconditioner. We stick with an incomple Cholesky + // can chose a simple preconditioner. We stick with an incomplete Cholesky // (IC) factorization preconditioner, which is designed for symmetric // matrices. We could have also chosen an SSOR preconditioner with // relaxation factor around 1.2, but IC is cheaper for our example. We @@ -1576,8 +1586,8 @@ namespace Step31 // Next comes the declaration of vectors to hold the old and older // solution values (as a notation for time levels n-1 and // n-2, respectively) and gradients at quadrature points of the - // current cell. We also declarate an object to hold the temperature right - // hande side values (gamma_values), and we again use + // current cell. We also declare an object to hold the temperature right + // hand side values (gamma_values), and we again use // shortcuts for the temperature basis functions. Eventually, we need to // find the temperature extrema and the diameter of the computational // domain which will be used for the definition of the stabilization @@ -1655,7 +1665,7 @@ namespace Step31 // according to the discussion in the introduction using the dedicated // function. With that at hand, we can get into the loop over // quadrature points and local rhs vector components. The terms here - // are quite lenghty, but their definition follows the time-discrete + // are quite lengthy, but their definition follows the time-discrete // system developed in the introduction of this program. The BDF-2 // scheme needs one more term from the old time step (and involves // more complicated factors) than the backward Euler scheme that is @@ -1814,7 +1824,7 @@ namespace Step31 // There is a snatch here. The formula contains a division by the maximum // value of the velocity. However, at the start of the computation, we // have a constant temperature field (we start with a constant - // temperature, and it will be non-constant only after the first time step + // temperature, and it will be nonconstant only after the first time step // during which the source acts). Constant temperature means that no // buoyancy acts, and so the velocity is zero. Dividing by it will not // likely lead to anything good. @@ -1908,133 +1918,42 @@ namespace Step31 // This function writes the solution to a VTK output file for visualization, // which is done every tenth time step. This is usually quite a simple task, // since the deal.II library provides functions that do almost all the job - // for us. In this case, the situation is a bit more complicated, since we - // want to visualize both the Stokes solution and the temperature as one - // data set, but we have done all the calculations based on two different - // DoFHandler objects, a situation the DataOut class usually used for output - // is not prepared to deal with. The way we're going to achieve this - // recombination is to create a joint DoFHandler that collects both - // components, the Stokes solution and the temperature solution. This can be - // nicely done by combining the finite elements from the two systems to form - // one FESystem, and let this collective system define a new DoFHandler - // object. To be sure that everything was done correctly, we perform a - // sanity check that ensures that we got all the dofs from both Stokes and - // temperature even in the combined system. - // - // Next, we create a vector that will collect the actual solution - // values. Since this vector is only going to be used for output, we create - // it as a deal.II vector that nicely cooperate with the data output - // classes. Remember that we used Trilinos vectors for assembly and solving. + // for us. There is one new function compared to previous examples: We want + // to visualize both the Stokes solution and the temperature as one data + // set, but we have done all the calculations based on two different + // DoFHandler objects. Luckily, the DataOut class is prepared to deal with + // it. All we have to do is to not attach one single DoFHandler at the + // beginning and then use that for all added vector, but specify the + // DoFHandler to each vector separately. The rest is done as in step-22. We + // create solution names (that are going to appear in the visualization + // program for the individual components). The first dim + // components are the vector velocity, and then we have pressure for the + // Stokes part, whereas temperature is scalar. This information is read out + // using the DataComponentInterpretation helper class. Next, we actually + // attach the data vectors with their DoFHandler objects, build patches + // according to the degree of freedom, which are (sub-) elements that + // describe the data for visualization programs. Finally, we set a file name + // (that includes the time step number) and write the vtk file. template void BoussinesqFlowProblem::output_results () const { if (timestep_number % 10 != 0) return; - const FESystem joint_fe (stokes_fe, 1, - temperature_fe, 1); - DoFHandler joint_dof_handler (triangulation); - joint_dof_handler.distribute_dofs (joint_fe); - Assert (joint_dof_handler.n_dofs() == - stokes_dof_handler.n_dofs() + temperature_dof_handler.n_dofs(), - ExcInternalError()); - - Vector joint_solution (joint_dof_handler.n_dofs()); - - // Unfortunately, there is no straight-forward relation that tells us how - // to sort Stokes and temperature vector into the joint vector. The way we - // can get around this trouble is to rely on the information collected in - // the FESystem. For each dof in a cell, the joint finite element knows to - // which equation component (velocity component, pressure, or temperature) - // it belongs – that's the information we need! So we step through - // all cells (with iterators into all three DoFHandlers moving in synch), - // and for each joint cell dof, we read out that component using the - // FiniteElement::system_to_base_index function (see there for a - // description of what the various parts of its return value contain). We - // also need to keep track whether we're on a Stokes dof or a temperature - // dof, which is contained in - // joint_fe.system_to_base_index(i).first.first. Eventually, - // the dof_indices data structures on either of the three systems tell us - // how the relation between global vector and local dofs looks like on the - // present cell, which concludes this tedious work. - // - // There's one thing worth remembering when looking at the output: In our - // algorithm, we first solve for the Stokes system at time level - // n-1 in each time step and then for the temperature at time level - // n using the previously computed velocity. These are the two - // components we join for output, so these two parts of the output file - // are actually misaligned by one time step. Since we consider graphical - // output as only a qualititative means to understand a solution, we - // ignore this $\mathcal{O}(h)$ error. - { - std::vector local_joint_dof_indices (joint_fe.dofs_per_cell); - std::vector local_stokes_dof_indices (stokes_fe.dofs_per_cell); - std::vector local_temperature_dof_indices (temperature_fe.dofs_per_cell); - - typename DoFHandler::active_cell_iterator - joint_cell = joint_dof_handler.begin_active(), - joint_endc = joint_dof_handler.end(), - stokes_cell = stokes_dof_handler.begin_active(), - temperature_cell = temperature_dof_handler.begin_active(); - for (; joint_cell!=joint_endc; ++joint_cell, ++stokes_cell, ++temperature_cell) - { - joint_cell->get_dof_indices (local_joint_dof_indices); - stokes_cell->get_dof_indices (local_stokes_dof_indices); - temperature_cell->get_dof_indices (local_temperature_dof_indices); - - for (unsigned int i=0; idim components are the vector velocity, - // and then we have pressure and temperature. This information is read out - // using the DataComponentInterpretation helper class. Next, we attach the - // solution values together with the names of its components to the output - // object, and build patches according to the degree of freedom, which are - // (sub-) elements that describe the data for visualization - // programs. Finally, we set a file name (that includes the time step - // number) and write the vtk file. - std::vector joint_solution_names (dim, "velocity"); - joint_solution_names.push_back ("p"); - joint_solution_names.push_back ("T"); - - DataOut data_out; - - data_out.attach_dof_handler (joint_dof_handler); - + std::vector stokes_names (dim, "velocity"); + stokes_names.push_back ("p"); std::vector - data_component_interpretation - (dim+2, DataComponentInterpretation::component_is_scalar); + stokes_component_interpretation + (dim+1, DataComponentInterpretation::component_is_scalar); for (unsigned int i=0; i::type_dof_data, - data_component_interpretation); + DataOut data_out; + data_out.add_data_vector (stokes_dof_handler, stokes_solution, + stokes_names, stokes_component_interpretation); + data_out.add_data_vector (temperature_dof_handler, temperature_solution, + "T"); data_out.build_patches (std::min(stokes_degree, temperature_degree)); std::ostringstream filename; @@ -2105,7 +2024,7 @@ namespace Step31 // SolutionTransfer class and we have to prepare the solution vectors that // should be transferred to the new grid (we will lose the old grid once // we have done the refinement so the transfer has to happen concurrently - // with refinement). What we definetely need are the current and the old + // with refinement). What we definitely need are the current and the old // temperature (BDF-2 time stepping requires two old solutions). Since the // SolutionTransfer objects only support to transfer one object per dof // handler, we need to collect the two temperature solutions in one data diff --git a/deal.II/examples/step-32/CMakeLists.txt b/deal.II/examples/step-32/CMakeLists.txt index 4e68fdb217..7a72d94c82 100644 --- a/deal.II/examples/step-32/CMakeLists.txt +++ b/deal.II/examples/step-32/CMakeLists.txt @@ -11,9 +11,6 @@ SET(TARGET_SRC # You can specify additional files here! ) -# A custom command line to run the program -SET(TARGET_RUN mpirun -np 2 ${TARGET}) - # Define the output that should be cleaned: SET(CLEAN_UP_FILES *.vtu *.pvtu *.visit) @@ -43,7 +40,7 @@ Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_MPI = ON DEAL_II_WITH_P4EST = ON DEAL_II_WITH_TRILINOS = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-32/doc/intro.dox b/deal.II/examples/step-32/doc/intro.dox index 1620308066..25317c67cb 100644 --- a/deal.II/examples/step-32/doc/intro.dox +++ b/deal.II/examples/step-32/doc/intro.dox @@ -17,9 +17,13 @@ The work discussed here is also presented in the following publication: M. Kronbichler, T. Heister, W. Bangerth: High Accuracy Mantle Convection Simulation through Modern Numerical - Methods, Geophysical Journal International, 2012, 191, 12-29. + Methods, Geophysical Journal International, 2012, 191, 12-29. [DOI] + +The continuation of development of this program has led to the much larger +open source code Aspect (see http://aspect.dealii.org/ ) which is much more +flexible in solving many kinds of related problems. @@ -237,7 +241,7 @@ So why is this an issue here, but not in step-31? The reason back there is that everything was nicely balanced: velocities were on the order of one, the pressure likewise, the viscosity was one, and the domain had a diameter of $\sqrt{2}$. As a result, while -non-sensical, nothing bad happened. On the other hand, as we will explain +nonsensical, nothing bad happened. On the other hand, as we will explain below, things here will not be that simply scaled: $\eta$ will be around $10^{21}$, velocities on the order of $10^{-8}$, pressure around $10^8$, and the diameter of the domain is $10^7$. In other words, the order of magnitude @@ -293,7 +297,7 @@ $\frac{\eta}{L}$, and we will use this factor in the assembly of the system matrix and preconditioner. Because it is annoying and error prone, we will recover the unscaled pressure immediately following the solution of the linear system, i.e., the solution vector's pressure component will immediately be -un-scaled to retrieve the physical pressure. Since the solver uses the fact that +unscaled to retrieve the physical pressure. Since the solver uses the fact that we can use a good initial guess by extrapolating the previous solutions, we also have to scale the pressure immediately before solving. @@ -521,8 +525,8 @@ becomes unstable? Looking at the graphical output, we can see that with the unreasonably coarse mesh chosen for these experiments, around time $t=10^{15}$ seconds the plumes of hot material that have been rising towards the cold outer boundary and have then spread sideways -are starting to get close to each other, squezzing out the cold -material inbetween. This creates a layer of cells into which fluids +are starting to get close to each other, squeezing out the cold +material in-between. This creates a layer of cells into which fluids flows from two opposite sides and flows out toward a third, apparently a scenario that then produce these instabilities without sufficient stabilization. Second: In step-31, we used @@ -845,7 +849,7 @@ convection in the earth mantle: for that, more and more difficult physics would have to be implemented, and several other aspects are currently missing from this program as well. We will come back to this issue in the results section again, but state for now that providing a -realistic description is a goal of the Apect code in +realistic description is a goal of the Aspect code in development at the time of writing this. As a reminder, let us again state the equations we want to solve are these: @@ -887,7 +891,7 @@ the following quantities: entry). In Kelvin, we therefore choose $T_0=(4000+273)\text{K}$, $T_1=(500+273)\text{K}$ as boundary conditions at the inner and outer edge. - In addition to this, we also have to specifiy some initial conditions for + In addition to this, we also have to specify some initial conditions for the temperature field. The real temperature field of the earth is quite complicated as a consequence of the convection that has been going on for more than four billion years -- in fact, it is the properties of this @@ -1081,7 +1085,7 @@ the following quantities: @f] - There are two problems with this, however: (i) The Earth is not homogenous, + There are two problems with this, however: (i) The Earth is not homogeneous, i.e. the density $\rho$ depends on $\mathbf x$; in fact it is not even a function that only depends on the radius $r=\|\mathbf x\|$. In reality, gravity therefore does not always decrease as we get deeper: because the earth core is so much @@ -1152,7 +1156,7 @@ the following quantities: changes as temperature and pressure change: depending on temperature and pressure, different crystal configurations are thermodynamically favored over others, even if the chemical composition of the mantle were - homogenous. For example, the common mantle material MgSiO3 exists + homogeneous. For example, the common mantle material MgSiO3 exists in its perovskite structure throughout most of the mantle, but in the lower mantle the @@ -1213,7 +1217,7 @@ Compared to step-31, this program has a number of noteworthy differences: program just because one wants to play with a single parameter (think, for example, of parameter studies determining the best values of the stabilization constants discussed above), in particular given that it takes - a non-trivial amount of time to re-compile programs of the current size. To + a nontrivial amount of time to re-compile programs of the current size. To just give an overview of the kinds of parameters we have moved from fixed values into the input file, here is a listing of a typical \step-32.prm file: diff --git a/deal.II/examples/step-32/doc/results.dox b/deal.II/examples/step-32/doc/results.dox index 000f778dcc..ca0d584e14 100644 --- a/deal.II/examples/step-32/doc/results.dox +++ b/deal.II/examples/step-32/doc/results.dox @@ -449,7 +449,7 @@ address to make the program more useful: trivial. An additional complexity is introduced by the fact that one may want to change the number of processors between runs, for example because one may wish to continue computing on a mesh that is finer than the one used - to pre-compute a starting temperature field at an intermediate time. + to precompute a starting temperature field at an intermediate time.
    • Predictive postprocessing: The point of computations like this is not simply to solve the equations. Rather, it is typically the exploration @@ -471,3 +471,12 @@ solution we are really interested in better than the criterion used here, namely the KellyErrorEstimator applied to the temperature, is able to.
    + + +

    Possible extensions

    + +There are many ways to extend the current program. However, rather than +discussing them here, let us point to the much larger open +source code Aspect (see http://aspect.dealii.org/ ) that constitutes the +further development of step-32 and that already includes many such possible +extensions. diff --git a/deal.II/examples/step-32/step-32.cc b/deal.II/examples/step-32/step-32.cc index c22c7a0e77..c993c97868 100644 --- a/deal.II/examples/step-32/step-32.cc +++ b/deal.II/examples/step-32/step-32.cc @@ -1,13 +1,25 @@ -/* Author: Martin Kronbichler, Uppsala University, - Wolfgang Bangerth, Texas A&M University, - Timo Heister, University of Goettingen, 2008-2011 */ -/* */ -/* Copyright (C) 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2008 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Martin Kronbichler, Uppsala University, + * Wolfgang Bangerth, Texas A&M University, + * Timo Heister, University of Goettingen, 2008-2011 + */ + // @sect3{Include files} @@ -93,7 +105,7 @@ namespace Step32 // In the following namespace, we define the various pieces of equation data // that describe the problem. This corresponds to the various aspects of - // making the problem at least slightly realistc and that were exhaustively + // making the problem at least slightly realistic and that were exhaustively // discussed in the description of the testcase in the introduction. // // We start with a few coefficients that have constant values (the comment @@ -101,7 +113,7 @@ namespace Step32 namespace EquationData { const double eta = 1e21; /* Pa s */ - const double kappa = 1e-6; /* m / s */ + const double kappa = 1e-6; /* m^2 / s */ const double reference_density = 3300; /* kg / m^3 */ const double reference_temperature = 293; /* K */ const double expansion_coefficient = 2e-5; /* 1/K */ @@ -217,7 +229,7 @@ namespace Step32 // block. The three code blocks of the vmult function implement // the multiplications with the three blocks of this preconditioner matrix // and should be self explanatory if you have read through step-31 or the - // discussion of compositing solvers in step-20. + // discussion of composing solvers in step-20. namespace LinearSolvers { template @@ -1993,7 +2005,7 @@ namespace Step32 } // Following this, we can compute constraints for the solution vectors, - // including hanging node constraints and homogenous and inhomogenous + // including hanging node constraints and homogeneous and inhomogeneous // boundary values for the Stokes and temperature fields. Note that as for // everything else, the constraint objects can not hold all // constraints on every processor. Rather, each processor needs to store @@ -3213,14 +3225,36 @@ namespace Step32 } - // The output_results() function does mostly what the - // corresponding one did in to step-31, in particular the merging data from - // the two DoFHandler objects (for the Stokes and the temperature parts of - // the problem) into one. There is one minor change: we make sure that each - // processor only works on the subdomain it owns locally (and not on ghost - // or artificial cells) when building the joint solution vector. The same - // will then have to be done in DataOut::build_patches(), but that function - // does so automatically. + // The output_results() function has a similar task to the one + // in step-31. However, here we are going to demonstrate a different + // technique on how to merge output from different DoFHandler objects. The + // way we're going to achieve this recombination is to create a joint + // DoFHandler that collects both components, the Stokes solution and the + // temperature solution. This can be nicely done by combining the finite + // elements from the two systems to form one FESystem, and let this + // collective system define a new DoFHandler object. To be sure that + // everything was done correctly, we perform a sanity check that ensures + // that we got all the dofs from both Stokes and temperature even in the + // combined system. We then combine the data vectors. Unfortunately, there + // is no straight-forward relation that tells us how to sort Stokes and + // temperature vector into the joint vector. The way we can get around this + // trouble is to rely on the information collected in the FESystem. For each + // dof on a cell, the joint finite element knows to which equation component + // (velocity component, pressure, or temperature) it belongs – that's the + // information we need! So we step through all cells (with iterators into + // all three DoFHandlers moving in sync), and for each joint cell dof, we + // read out that component using the FiniteElement::system_to_base_index + // function (see there for a description of what the various parts of its + // return value contain). We also need to keep track whether we're on a + // Stokes dof or a temperature dof, which is contained in + // joint_fe.system_to_base_index(i).first.first. Eventually, the dof_indices + // data structures on either of the three systems tell us how the relation + // between global vector and local dofs looks like on the present cell, + // which concludes this tedious work. We make sure that each processor only + // works on the subdomain it owns locally (and not on ghost or artificial + // cells) when building the joint solution vector. The same will then have + // to be done in DataOut::build_patches(), but that function does so + // automatically. // // What we end up with is a set of patches that we can write using the // functions in DataOutBase in a variety of output formats. Here, we then @@ -3295,6 +3329,7 @@ namespace Step32 } } + joint_solution.compress(VectorOperation::insert); IndexSet locally_relevant_joint_dofs(joint_dof_handler.n_dofs()); DoFTools::extract_locally_relevant_dofs (joint_dof_handler, locally_relevant_joint_dofs); diff --git a/deal.II/examples/step-33/CMakeLists.txt b/deal.II/examples/step-33/CMakeLists.txt index 3264dbd6c8..308db41050 100644 --- a/deal.II/examples/step-33/CMakeLists.txt +++ b/deal.II/examples/step-33/CMakeLists.txt @@ -36,7 +36,7 @@ IF(NOT DEAL_II_WITH_TRILINOS) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_TRILINOS = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-33/doc/intro.dox b/deal.II/examples/step-33/doc/intro.dox index acafeee5dc..c35476df7b 100644 --- a/deal.II/examples/step-33/doc/intro.dox +++ b/deal.II/examples/step-33/doc/intro.dox @@ -270,7 +270,7 @@ main() { The output are the derivatives $\frac{\partial c(a,b)}{\partial a}, \frac{\partial c(a,b)}{\partial b}$ of $c(a,b)=2a+\cos(ab)$ at $a=1,b=2$. -It should be noted that Sacado provides more auto-differentation capabilities than the small subset +It should be noted that Sacado provides more auto-differentiation capabilities than the small subset used in this program. However, understanding the example above is enough to understand the use of Sacado in this Euler flow program. @@ -285,7 +285,7 @@ on these vectors. Please view the commented code for more details on how these within the example.

    Adaptivity

    -The example uses an ad-hoc refinement indicator that shows some usefulness in shock-type problems, and +The example uses an ad hoc refinement indicator that shows some usefulness in shock-type problems, and in the downhill flow example included. We refine according to the squared gradient of the density. Hanging nodes are handled by computing the numerical flux across cells that are of differing refinement levels, rather than using the ConstraintMatrix class as in diff --git a/deal.II/examples/step-33/step-33.cc b/deal.II/examples/step-33/step-33.cc index 16967816da..0f7d82b82d 100644 --- a/deal.II/examples/step-33/step-33.cc +++ b/deal.II/examples/step-33/step-33.cc @@ -1,13 +1,23 @@ -/* Author: David Neckels, Boulder, Colorado, 2007, 2008 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2007 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: David Neckels, Boulder, Colorado, 2007, 2008 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2007-2012 by the deal.II authors and David Neckels */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -425,7 +435,7 @@ namespace Step33 { // We prescribe the velocity (we are dealing with a particular // component here so that the average of the velocities is - // orthogonal to the surface normal. This creates sensitivies of + // orthogonal to the surface normal. This creates sensitivities of // across the velocity components. Sacado::Fad::DFad vdotn = 0; for (unsigned int d = 0; d < dim; d++) @@ -575,12 +585,12 @@ namespace Step33 // This is the only function worth commenting on. When generating graphical // output, the DataOut and related classes will call this function on each - // cell, with values, gradients, hessians, and normal vectors (in case we're + // cell, with values, gradients, Hessians, and normal vectors (in case we're // working on faces) at each quadrature point. Note that the data at each // quadrature point is itself vector-valued, namely the conserved // variables. What we're going to do here is to compute the quantities we're // interested in at each quadrature point. Note that for this we can ignore - // the hessians ("dduh") and normal vectors; to avoid compiler warnings + // the Hessians ("dduh") and normal vectors; to avoid compiler warnings // about unused variables, we comment out their names. template void @@ -1029,7 +1039,7 @@ namespace Step33 // we allow up to max_n_boundaries boundary indicators to be // used in the input file, and each of these boundary indicators can be // associated with an inflow, outflow, or pressure boundary condition, - // with inhomogenous boundary conditions being specified for each + // with homogeneous boundary conditions being specified for each // component and each boundary indicator separately. // // The data structure used to store the boundary indicators is a bit @@ -1345,7 +1355,7 @@ namespace Step33 // This final set of member variables (except for the object holding all // run-time parameters at the very bottom and a screen output stream that // only prints something if verbose output has been requested) deals with - // the inteface we have in this program to the Trilinos library that + // the interface we have in this program to the Trilinos library that // provides us with linear solvers. Similarly to including PETSc matrices // in step-17, step-18, and step-19, all we need to do is to create a // Trilinos sparse matrix instead of the standard deal.II class. The @@ -1692,7 +1702,7 @@ namespace Step33 // whereas all the other ones remain dependent functions. These are // precisely the local degrees of freedom just extracted. All calculations // that reference them (either directly or indirectly) will accumulate - // sensitivies with respect to these variables. + // sensitivities with respect to these variables. // // In order to mark the variables as independent, the following does the // trick, marking independent_local_dof_values[i] as the @@ -1791,7 +1801,7 @@ namespace Step33 // (\mathbf{z}_i)_{\text{component\_i}})_K$, where integrals are // understood to be evaluated through summation over quadrature points. // - // We initialy sum all contributions of the residual in the positive + // We initially sum all contributions of the residual in the positive // sense, so that we don't need to negative the Jacobian entries. Then, // when we sum into the right_hand_side vector, we negate // this residual. @@ -2004,7 +2014,7 @@ namespace Step33 // Now assemble the face term in exactly the same way as for the cell // contributions in the previous function. The only difference is that if // this is an internal face, we also have to take into account the - // sensitivies of the residual contributions to the degrees of freedom on + // sensitivities of the residual contributions to the degrees of freedom on // the neighboring cell: std::vector residual_derivatives (dofs_per_cell); for (unsigned int i=0; i void ConservationLaw::output_results () const { @@ -2481,7 +2491,7 @@ int main (int argc, char *argv[]) std::exit(1); } - Utilities::System::MPI_InitFinalize mpi_initialization (argc, argv); + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, dealii::numbers::invalid_unsigned_int); ConservationLaw<2> cons (argv[1]); cons.run (); diff --git a/deal.II/examples/step-34/CMakeLists.txt b/deal.II/examples/step-34/CMakeLists.txt index 9f2b2ca256..b3b025bd9b 100644 --- a/deal.II/examples/step-34/CMakeLists.txt +++ b/deal.II/examples/step-34/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_FUNCTIONPARSER) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_FUNCTIONPARSER = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-34/doc/intro.dox b/deal.II/examples/step-34/doc/intro.dox index c7dd04c28b..8aeaebc2c9 100644 --- a/deal.II/examples/step-34/doc/intro.dox +++ b/deal.II/examples/step-34/doc/intro.dox @@ -99,7 +99,7 @@ gradient of a scalar function: \mathbf{\tilde{v}}=\nabla\phi, \f] and so the second part of Euler equations above can be rewritten -as the homogenous Laplace equation for the unknown $\phi$: +as the homogeneous Laplace equation for the unknown $\phi$: \f{align*} \label{laplace} \Delta\phi &= 0 \qquad &&\text{in}\ \mathbb{R}^n\backslash\Omega, @@ -612,7 +612,7 @@ iterative solver, without providing any preconditioner. If this were a production code rather than a demonstration of principles, there are techniques that are available to not store full matrices but instead store only those entries that are large and/or relevant. In the literature on -boundary element methods, a plethory of methods is available that allows to +boundary element methods, a plethora of methods is available that allows to determine which elements are important and which are not, leading to a significantly sparser representation of these matrices that also facilitates rapid evaluations of the scalar product between vectors and matrices. This not diff --git a/deal.II/examples/step-34/doc/results.dox b/deal.II/examples/step-34/doc/results.dox index 47e65a30d2..dec4c54823 100644 --- a/deal.II/examples/step-34/doc/results.dox +++ b/deal.II/examples/step-34/doc/results.dox @@ -200,7 +200,7 @@ like while in three dimensions we show first the potential on the surface, -together with a contur plot, +together with a contour plot, diff --git a/deal.II/examples/step-34/step-34.cc b/deal.II/examples/step-34/step-34.cc index 08b3a319d9..f675772db7 100644 --- a/deal.II/examples/step-34/step-34.cc +++ b/deal.II/examples/step-34/step-34.cc @@ -1,13 +1,23 @@ -/* Author: Luca Heltai, Cataldo Manigrasso, 2009 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2009 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Luca Heltai, Cataldo Manigrasso, 2009 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2009-2012 by deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -292,7 +302,7 @@ namespace Step34 // @sect4{BEMProblem::BEMProblem and BEMProblem::read_parameters} - // The constructor initializes the variuous object in much the same way as + // The constructor initializes the various object in much the same way as // done in the finite element programs such as step-4 or step-6. The only // new ingredient here is the ParsedFunction object, which needs, at // construction time, the specification of the number of components. @@ -599,7 +609,7 @@ namespace Step34 // the current cell, a deviation from the usual finite element // integrals). The integral that we need to perform is singular if one // of the local degrees of freedom is the same as the support point - // $i$. A the beginning of the loop we therefore check wether this is + // $i$. A the beginning of the loop we therefore check whether this is // the case, and we store which one is the singular index: for (unsigned int i=0; idim solves are all taken care of and are // scheduled to available processors: if your machine has more than one @@ -1252,8 +1261,8 @@ namespace Step35 // pieces of data into a single DoFHandler object, and then use that to // drive graphical output. // - // We will not elaborate on this process here, but rather refer to step-31 - // and step-32, where a similar procedure is used (and is documented) to + // We will not elaborate on this process here, but rather refer to step-32, + // where a similar procedure is used (and is documented) to // create a joint DoFHandler object for all variables. // // Let us also note that we here compute the vorticity as a scalar quantity diff --git a/deal.II/examples/step-36/CMakeLists.txt b/deal.II/examples/step-36/CMakeLists.txt index 5e72c8ca3e..4d1eed8b19 100644 --- a/deal.II/examples/step-36/CMakeLists.txt +++ b/deal.II/examples/step-36/CMakeLists.txt @@ -34,7 +34,7 @@ IF(NOT DEAL_II_WITH_PETSC OR NOT DEAL_II_WITH_SLEPC) Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_PETSC = ON DEAL_II_WITH_SLEPC = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-36/doc/intro.dox b/deal.II/examples/step-36/doc/intro.dox index 69a89c4574..c5e4aecf00 100644 --- a/deal.II/examples/step-36/doc/intro.dox +++ b/deal.II/examples/step-36/doc/intro.dox @@ -56,7 +56,7 @@ The basic equation of stationary quantum mechanics is the Schrödinger equation which models the motion of particles in an external potential $V(\mathbf x)$. The particle is described by a wave function $\Psi(\mathbf x)$ that satisfies a relation of the -(non-dimensionalized) form +(nondimensionalized) form @f{align*} [-\Delta + V(\mathbf x)] \Psi(\mathbf x) &= \varepsilon \Psi(\mathbf x) \qquad &&\text{in}\ \Omega\quad, \\ \Psi &= 0 &&\text{on}\ \partial\Omega\quad. @@ -72,7 +72,7 @@ eigenvalue. In order to numerically find solutions to this equation, i.e. a set of pairs of eigenvalues/eigenfunctions, we use the usual finite element -approach of multiplying the equation from the left with testfunctions, +approach of multiplying the equation from the left with test functions, integrating by parts, and searching for solutions in finite dimensional spaces by approximating $\Psi(\mathbf x)\approx\Psi_h(\mathbf x)=\sum_{j}\phi_j(\mathbf x)\tilde\psi_j$, @@ -105,7 +105,7 @@ longer has a single solution vector, but a whole set of vectors for the various eigenfunctions we want to compute. Moreover, the main function, which has the top-level control over everything here, initializes and finalizes the interface to SLEPc and -PETSc simultaneouly via SlepcInitialize and +PETSc simultaneously via SlepcInitialize and SlepFinalize.
  • We use PETSc matrices and vectors as in step-17 and diff --git a/deal.II/examples/step-36/doc/results.dox b/deal.II/examples/step-36/doc/results.dox index 9684b72a4e..93eb53b18b 100644 --- a/deal.II/examples/step-36/doc/results.dox +++ b/deal.II/examples/step-36/doc/results.dox @@ -190,7 +190,7 @@ PETScWrappers and SLEPcWrappers and is suitable for running on serial machine architecture. However, for larger grids and with a larger number of degrees-of-freedom, we may want to run our application on parallel architectures. A parallel implementation of the above code -can be particularily useful here since the generalized eigenspectrum +can be particularly useful here since the generalized eigenspectrum problem is somewhat more expensive to solve than the standard problems considered in most of the earlier tutorials. Fortunately, modifying the above program to be MPI compliant is a relatively straightforward diff --git a/deal.II/examples/step-36/step-36.cc b/deal.II/examples/step-36/step-36.cc index a2f132f026..13869b83ef 100644 --- a/deal.II/examples/step-36/step-36.cc +++ b/deal.II/examples/step-36/step-36.cc @@ -1,13 +1,23 @@ -/* Author: Toby D. Young, Polish Academy of Sciences, */ -/* Wolfgang Bangerth, Texas A&M University */ -/* $Id$*/ -/* */ -/* Copyright (C) 2009, 2011-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2009 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Toby D. Young, Polish Academy of Sciences, + * Wolfgang Bangerth, Texas A&M University + */ // @sect3{Include files} diff --git a/deal.II/examples/step-37/CMakeLists.txt b/deal.II/examples/step-37/CMakeLists.txt index 4b4e8f3f32..07a25bc701 100644 --- a/deal.II/examples/step-37/CMakeLists.txt +++ b/deal.II/examples/step-37/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_LAPACK) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_LAPACK = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-37/doc/intro.dox b/deal.II/examples/step-37/doc/intro.dox index 08add8cb9c..1cd4efa584 100644 --- a/deal.II/examples/step-37/doc/intro.dox +++ b/deal.II/examples/step-37/doc/intro.dox @@ -20,7 +20,7 @@ International Conference on e-Science, 2011. This example shows how to implement a matrix-free method, that is, a method that does not explicitly store the matrix elements, for a second-order Poisson equation with variable coefficients on a -hypercube. The eliptic equation will be solved with a multigrid +hypercube. The elliptic equation will be solved with a multigrid method. The major motivation for matrix-free methods is the fact that today @@ -280,7 +280,7 @@ v_\mathrm{cell}. for (unsigned int q=0; q temp; for (unsigned int d=0; d @@ -208,7 +217,7 @@ namespace Step37 // would have to have two classes like the current one for each of the // operators (maybe with a common base class). However, in that case, we // would not store a MatrixFree object in this class to avoid doing the - // expensive work of pre-computing everything MatrixFree stores + // expensive work of precomputing everything MatrixFree stores // twice. Rather, we would keep this object in the main class and simply // store a reference. // @@ -323,8 +332,8 @@ namespace Step37 // @sect4{Initialization} - // Once we have created the multi-grid dof_handler and the constraints, we - // can call the reinit function for each level of the multi-grid routine + // Once we have created the multigrid dof_handler and the constraints, we + // can call the reinit function for each level of the multigrid routine // (and the active cells). The main purpose of the reinit function is to // setup the MatrixFree instance for the problem. Also, the // coefficient is evaluated. For this, we need to activate the update flag @@ -587,7 +596,7 @@ namespace Step37 { data.cell_loop (&LaplaceOperator::local_apply, this, dst, src); - const std::vector & + const std::vector & constrained_dofs = data.get_constrained_dofs(); for (unsigned int i=0; i & + const std::vector & constrained_dofs = data.get_constrained_dofs(); for (unsigned int i=0; i > SMOOTHER; MGSmootherPrecondition > - mg_smoother; + mg_smoother; // Then, we initialize the smoother with our level matrices and the // mandatory additional data for the Chebyshev smoother. We use quite a diff --git a/deal.II/examples/step-38/doc/intro.dox b/deal.II/examples/step-38/doc/intro.dox index 0985bc59b7..8ff7796b1e 100644 --- a/deal.II/examples/step-38/doc/intro.dox +++ b/deal.II/examples/step-38/doc/intro.dox @@ -224,7 +224,7 @@ looks. In essence, we will simply declare an appropriate object of type MappingQ that will automatically obtain the boundary description from the Triangulation. The mapping object will then be passed to the appropriate functions, and we will get a boundary description for half circles or half -spheres that is pre-defined in the library. +spheres that is predefined in the library. The rest of the program follows closely step-4 and, as far as computing the error, step-7. Some aspects of this program, in particular the use of two diff --git a/deal.II/examples/step-38/doc/results.dox b/deal.II/examples/step-38/doc/results.dox index b52ea38440..eb51b19fc8 100644 --- a/deal.II/examples/step-38/doc/results.dox +++ b/deal.II/examples/step-38/doc/results.dox @@ -144,11 +144,11 @@ void LaplaceBeltrami::make_grid_and_dofs () Note that the only essential addition has been the three lines marked with asterisks. It is worth pointing out one other thing here, though: because we -un-attach the manifold description from the surface mesh, whenever we use a +detach the manifold description from the surface mesh, whenever we use a mapping object in the rest of the program, it has no curves boundary description to go on any more. Rather, it will have to use the implicit, StraightBoundary class that is used on all parts of the boundary not -explicitly assigned a different mannifold object. Consequently, whether we use +explicitly assigned a different manifold object. Consequently, whether we use MappingQ(2), MappingQ(15) or MappingQ1, each cell of our mesh will be mapped using a bilinear approximation. diff --git a/deal.II/examples/step-38/step-38.cc b/deal.II/examples/step-38/step-38.cc index 3071898f6d..a88ebe3865 100644 --- a/deal.II/examples/step-38/step-38.cc +++ b/deal.II/examples/step-38/step-38.cc @@ -1,13 +1,23 @@ -/* Authors: Andrea Bonito, Sebastian Pauletti. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2010 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Andrea Bonito, Sebastian Pauletti. + */ -/* $Id$ */ -/* */ -/* 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -78,7 +88,7 @@ namespace Step38 // boundary of the domain -- this is what we did in step-11, for // example. However, here we have a curved domain, not just a curved // boundary, and while we can approximate it with bilinearly mapped cells, - // it is really only prodent to use a higher order mapping for all + // it is really only prudent to use a higher order mapping for all // cells. Consequently, this class has a member variable of type MappingQ; // we will choose the polynomial degree of the mapping equal to the // polynomial degree of the finite element used in the computations to diff --git a/deal.II/examples/step-39/doc/results.dox b/deal.II/examples/step-39/doc/results.dox index f0aa08444e..1e7de4afd1 100644 --- a/deal.II/examples/step-39/doc/results.dox +++ b/deal.II/examples/step-39/doc/results.dox @@ -1,7 +1,7 @@

    Results

    Logfile output

    -First, the program produces the usual logfile here stored in deallog. It reads (with ommission of intermediate steps) +First, the program produces the usual logfile here stored in deallog. It reads (with omission of intermediate steps) @code DEAL::Element: FE_DGQ<2>(3) diff --git a/deal.II/examples/step-39/step-39.cc b/deal.II/examples/step-39/step-39.cc index c1544a4d5c..18bb795f8c 100644 --- a/deal.II/examples/step-39/step-39.cc +++ b/deal.II/examples/step-39/step-39.cc @@ -1,13 +1,23 @@ -/* Author: Guido Kanschat, Texas A&M University, 2009 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2010 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Guido Kanschat, Texas A&M University, 2009 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2010-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // The include files for the linear algebra: A regular SparseMatrix, which in // turn will include the necessary files for SparsityPattern and Vector @@ -88,13 +98,13 @@ namespace Step39 { public: void cell(MeshWorker::DoFInfo &dinfo, - typename MeshWorker::IntegrationInfo &info) const; + typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, - typename MeshWorker::IntegrationInfo &info) const; + typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; @@ -103,7 +113,7 @@ namespace Step39 // ourselves. Similarly, we implement Nitsche boundary conditions and the // interior penalty fluxes between cells. // - // The boundary und flux terms need a penalty parameter, which should be + // The boundary and flux terms need a penalty parameter, which should be // adjusted to the cell size and the polynomial degree. A safe choice of // this parameter for constant coefficients can be found in // LocalIntegrators::Laplace::compute_penalty() and we use this below. @@ -153,9 +163,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; @@ -202,9 +212,9 @@ namespace Step39 void cell(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; @@ -298,13 +308,13 @@ namespace Step39 void cell(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void boundary(MeshWorker::DoFInfo &dinfo, typename MeshWorker::IntegrationInfo &info) const; void face(MeshWorker::DoFInfo &dinfo1, - MeshWorker::DoFInfo &dinfo2, - typename MeshWorker::IntegrationInfo &info1, - typename MeshWorker::IntegrationInfo &info2) const; + MeshWorker::DoFInfo &dinfo2, + typename MeshWorker::IntegrationInfo &info1, + typename MeshWorker::IntegrationInfo &info2) const; }; // Here we have the integration on cells. There is currently no good - // interfce in MeshWorker that would allow us to access values of regular + // interface in MeshWorker that would allow us to access values of regular // functions in the quadrature points. Thus, we have to create the vectors // for the exact function's values and gradients inside the cell // integrator. After that, everything is as before and we just add up the @@ -511,7 +521,7 @@ namespace Step39 mg_matrix_dg_down.clear(); // It is important to update the sparsity patterns after clear() // was called for the level matrices, since the matrices lock the sparsity - // pattern through the Smartpointer ans Subscriptor mechanism. + // pattern through the Smartpointer and Subscriptor mechanism. mg_sparsity.resize(0, n_levels-1); mg_sparsity_dg_interface.resize(0, n_levels-1); @@ -614,7 +624,7 @@ namespace Step39 MeshWorker::Assembler::MGMatrixSimple > assembler; assembler.initialize(mg_matrix); assembler.initialize_fluxes(mg_matrix_dg_up, mg_matrix_dg_down); - + MatrixIntegrator integrator; // Here is the other difference to the previous function: we run over all // cells, not only the active ones. And we use mg_dof_handler, @@ -640,7 +650,7 @@ namespace Step39 MeshWorker::DoFInfo dof_info(dof_handler); - // Since this assembler alows us to fill several vectors, the interface is + // Since this assembler allows us to fill several vectors, the interface is // a little more complicated as above. The pointers to the vectors have to // be stored in a NamedData object. While this seems to cause two extra // lines of code here, it actually comes handy in more complex @@ -755,7 +765,7 @@ namespace Step39 const unsigned int n_gauss_points = dof_handler.get_fe().tensor_degree()+1; info_box.initialize_gauss_quadrature(n_gauss_points, n_gauss_points+1, n_gauss_points); - // but now we need to notify the info box of the finite element functio we + // but now we need to notify the info box of the finite element function we // want to evaluate in the quadrature points. First, we create a NamedData // object with this vector, which is the solution we just computed. NamedData* > solution_data; @@ -763,7 +773,7 @@ namespace Step39 // Then, we tell the Meshworker::VectorSelector for cells, that we need // the second derivatives of this solution (to compute the - // Laplacian). Therefore, the boolean arguments selecting function values + // Laplacian). Therefore, the Boolean arguments selecting function values // and first derivatives a false, only the last one selecting second // derivatives is true. info_box.cell_selector.add("solution", false, false, true); diff --git a/deal.II/examples/step-4/doc/intro.dox b/deal.II/examples/step-4/doc/intro.dox index 83df40d5c2..2b2467a383 100644 --- a/deal.II/examples/step-4/doc/intro.dox +++ b/deal.II/examples/step-4/doc/intro.dox @@ -20,7 +20,7 @@ a look at the code below - there are almost no distinctions between 2d and 3d!). We would have to write the same function twice, once working on Triangulation2d and once working with a Triangulation3d. This is an unnecessary obstacle in -programming and leads to a nuisance to keep the two function in synch +programming and leads to a nuisance to keep the two function in sync (at best) or difficult to find errors if the two versions get out of sync (at worst; this would probably the more common case). diff --git a/deal.II/examples/step-4/doc/results.dox b/deal.II/examples/step-4/doc/results.dox index 4c7bf53bce..2a4402097f 100644 --- a/deal.II/examples/step-4/doc/results.dox +++ b/deal.II/examples/step-4/doc/results.dox @@ -64,7 +64,7 @@ the domain. This is nice, but it has the drawback that it completely hides what is happening on the inside. The picture on the right is an attempt at visualizing the interior as well, by showing surfaces where the solution has constant values (as indicated by the legend at the top left). Isosurface -pictures look best if one makes the individual surfaces slightly transparaent +pictures look best if one makes the individual surfaces slightly transparent so that it is possible to see through them and see what's behind. diff --git a/deal.II/examples/step-4/step-4.cc b/deal.II/examples/step-4/step-4.cc index ade3b41bfc..d6ed24c0e9 100644 --- a/deal.II/examples/step-4/step-4.cc +++ b/deal.II/examples/step-4/step-4.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 1999 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 1999 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 1999 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 1999-2012 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -154,7 +164,7 @@ public: // formulas above right away. // // The last thing to note is that a Point@ denotes a point -// in dim-dimensionsal space, and its individual components (i.e. $x$, $y$, +// in dim-dimensional space, and its individual components (i.e. $x$, $y$, // ... coordinates) can be accessed using the () operator (in fact, the [] // operator will work just as well) with indices starting at zero as usual in // C and C++. @@ -446,7 +456,7 @@ void Step4::solve () // data_out.write_gnuplot call by // data_out.write_vtk. // -// Since the program will run both 2d and 3d versions of the laplace solver, +// Since the program will run both 2d and 3d versions of the Laplace solver, // we use the dimension in the filename to generate distinct filenames for // each run (in a better program, one would check whether dim can // have other values than 2 or 3, but we neglect this here for the sake of diff --git a/deal.II/examples/step-40/CMakeLists.txt b/deal.II/examples/step-40/CMakeLists.txt index ed9f3e4c1d..f024774a4e 100644 --- a/deal.II/examples/step-40/CMakeLists.txt +++ b/deal.II/examples/step-40/CMakeLists.txt @@ -34,7 +34,7 @@ IF(NOT DEAL_II_WITH_PETSC OR NOT DEAL_II_WITH_P4EST) Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_PETSC = ON DEAL_II_WITH_P4EST = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-40/doc/intro.dox b/deal.II/examples/step-40/doc/intro.dox index 5e098c7890..0fec405ec8 100644 --- a/deal.II/examples/step-40/doc/intro.dox +++ b/deal.II/examples/step-40/doc/intro.dox @@ -135,3 +135,15 @@ same number of lines of code (though step-6 spends more space on dealing with coefficients and output). In either case, the comments below will only be on the things that set step-40 apart from step-6 and that aren't already covered in the @ref distributed documentation module. + + +@note This program will be able to compute on as many processors as you want +to throw at it, and for as large a problem as you have the memory and patience +to solve. However, there is a limit: the number of unknowns can not +exceed the largest number that can be stored with an object of type +types::global_dof_index. By default, this is a typedef for unsigned +int, which on most machines today is a 32-bit integer, limiting you to +some 4 billion (in reality, since this program uses PETSc, you will be limited +to half that as PETSc uses signed integers). However, this can be changed +during configuration to use 64-bit integers, see the ReadMe file. This will +give problem sizes you are unlikely to exceed anytime soon. diff --git a/deal.II/examples/step-40/doc/results.dox b/deal.II/examples/step-40/doc/results.dox index f43355fce5..8b62cec1e7 100644 --- a/deal.II/examples/step-40/doc/results.dox +++ b/deal.II/examples/step-40/doc/results.dox @@ -126,7 +126,7 @@ So how large are the largest problems one can solve? At the time of writing this problem, the limiting factor is that the program uses the BoomerAMG algebraic multigrid method from the hypre package as +href="http://acts.nersc.gov/hypre/" target="_top">Hypre package as a preconditioner, which unfortunately uses signed 32-bit integers to index the elements of a %distributed matrix. This limits the size of problems to $2^31-1=2,147,483,647$ degrees of freedom. From the graphs diff --git a/deal.II/examples/step-40/step-40.cc b/deal.II/examples/step-40/step-40.cc index c7d02af070..d02184477e 100644 --- a/deal.II/examples/step-40/step-40.cc +++ b/deal.II/examples/step-40/step-40.cc @@ -1,14 +1,23 @@ -/* Author: Wolfgang Bangerth, Texas A&M University, 2009, 2010 */ -/* Timo Heister, University of Goettingen, 2009, 2010 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2009-2012 by Timo Heister and the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2009 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, Texas A&M University, 2009, 2010 + * Timo Heister, University of Goettingen, 2009, 2010 + */ // @sect3{Include files} @@ -18,6 +27,21 @@ // already be familiar friends: #include #include +#include + +#include + +#define USE_PETSC_LA + +namespace LA +{ +#ifdef USE_PETSC_LA + using namespace dealii::LinearAlgebraPETSc; +#else + using namespace dealii::LinearAlgebraTrilinos; +#endif +} + #include #include #include @@ -133,23 +157,24 @@ namespace Step40 void refine_grid (); void output_results (const unsigned int cycle) const; - MPI_Comm mpi_communicator; + MPI_Comm mpi_communicator; - parallel::distributed::Triangulation triangulation; + parallel::distributed::Triangulation triangulation; - DoFHandler dof_handler; - FE_Q fe; + DoFHandler dof_handler; + FE_Q fe; - IndexSet locally_owned_dofs; - IndexSet locally_relevant_dofs; + IndexSet locally_owned_dofs; + IndexSet locally_relevant_dofs; - ConstraintMatrix constraints; + ConstraintMatrix constraints; - PETScWrappers::MPI::SparseMatrix system_matrix; - PETScWrappers::MPI::Vector locally_relevant_solution; - PETScWrappers::MPI::Vector system_rhs; + LA::MPI::SparseMatrix system_matrix; + LA::MPI::Vector locally_relevant_solution; + LA::MPI::Vector system_rhs; - ConditionalOStream pcout; + ConditionalOStream pcout; + TimerOutput computing_timer; }; @@ -175,7 +200,10 @@ namespace Step40 fe (2), pcout (std::cout, (Utilities::MPI::this_mpi_process(mpi_communicator) - == 0)) + == 0)), + computing_timer (pcout, + TimerOutput::summary, + TimerOutput::wall_times) {} @@ -206,9 +234,11 @@ namespace Step40 template void LaplaceProblem::setup_system () { + TimerOutput::Scope t(computing_timer, "setup"); + dof_handler.distribute_dofs (fe); - // The next two lines extract some informatino we will need later on, + // The next two lines extract some information we will need later on, // namely two index sets that provide information about which degrees of // freedom are owned by the current processor (this information will be // used to initialize solution and right hand side vectors, and the system @@ -230,12 +260,10 @@ namespace Step40 // locally owned cells (of course the linear solvers will read from it, // but they do not care about the geometric location of degrees of // freedom). - locally_relevant_solution.reinit (mpi_communicator, - locally_owned_dofs, - locally_relevant_dofs); - system_rhs.reinit (mpi_communicator, - dof_handler.n_dofs(), - dof_handler.n_locally_owned_dofs()); + locally_relevant_solution.reinit (locally_owned_dofs, + locally_relevant_dofs, mpi_communicator); + system_rhs.reinit (locally_owned_dofs, mpi_communicator); + system_rhs = 0; // The next step is to compute hanging node and boundary value @@ -287,21 +315,19 @@ namespace Step40 // entries that will exist in that part of the finite element matrix that // it will own. The final step is to initialize the matrix with the // sparsity pattern. - CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(), - dof_handler.n_dofs(), - locally_relevant_dofs); - DoFTools::make_sparsity_pattern (dof_handler, - csp, + CompressedSimpleSparsityPattern csp (locally_relevant_dofs); + + DoFTools::make_sparsity_pattern (dof_handler, csp, constraints, false); SparsityTools::distribute_sparsity_pattern (csp, dof_handler.n_locally_owned_dofs_per_processor(), mpi_communicator, locally_relevant_dofs); - system_matrix.reinit (mpi_communicator, + + system_matrix.reinit (locally_owned_dofs, + locally_owned_dofs, csp, - dof_handler.n_locally_owned_dofs_per_processor(), - dof_handler.n_locally_owned_dofs_per_processor(), - Utilities::MPI::this_mpi_process(mpi_communicator)); + mpi_communicator); } @@ -334,6 +360,8 @@ namespace Step40 template void LaplaceProblem::assemble_system () { + TimerOutput::Scope t(computing_timer, "assembly"); + const QGauss quadrature_formula(3); FEValues fe_values (fe, quadrature_formula, @@ -428,20 +456,23 @@ namespace Step40 template void LaplaceProblem::solve () { - PETScWrappers::MPI::Vector - completely_distributed_solution (mpi_communicator, - dof_handler.n_dofs(), - dof_handler.n_locally_owned_dofs()); + TimerOutput::Scope t(computing_timer, "solve"); + LA::MPI::Vector + completely_distributed_solution (locally_owned_dofs, mpi_communicator); SolverControl solver_control (dof_handler.n_dofs(), 1e-12); - PETScWrappers::SolverCG solver(solver_control, mpi_communicator); + LA::SolverCG solver(solver_control, mpi_communicator); + LA::MPI::PreconditionAMG preconditioner; + + LA::MPI::PreconditionAMG::AdditionalData data; - // Ask for a symmetric preconditioner by setting the first parameter in - // AdditionalData to true. - PETScWrappers::PreconditionBoomerAMG - preconditioner(system_matrix, - PETScWrappers::PreconditionBoomerAMG::AdditionalData(true)); +#ifdef USE_PETSC_LA + data.symmetric_operator = true; +#else + //trilinos defaults are good +#endif + preconditioner.initialize(system_matrix, data); solver.solve (system_matrix, completely_distributed_solution, system_rhs, preconditioner); @@ -473,6 +504,8 @@ namespace Step40 template void LaplaceProblem::refine_grid () { + TimerOutput::Scope t(computing_timer, "refine"); + Vector estimated_error_per_cell (triangulation.n_active_cells()); KellyErrorEstimator::estimate (dof_handler, QGauss(3), @@ -511,7 +544,7 @@ namespace Step40 // that stores, for each cell, the subdomain the cell belongs to. This is // slightly tricky, because of course not every processor knows about every // cell. The vector we attach therefore has an entry for every cell that the - // current processor has in its mesh (locally owned onces, ghost cells, and + // current processor has in its mesh (locally owned ones, ghost cells, and // artificial cells), but the DataOut class will ignore all entries that // correspond to cells that are not owned by the current processor. As a // consequence, it doesn't actually matter what values we write into these @@ -620,10 +653,16 @@ namespace Step40 solve (); if (Utilities::MPI::n_mpi_processes(mpi_communicator) <= 32) - output_results (cycle); + { + TimerOutput::Scope t(computing_timer, "output"); + output_results (cycle); + } pcout << std::endl; + computing_timer.print_summary (); + computing_timer.reset (); } + } } @@ -633,12 +672,12 @@ namespace Step40 // The final function, main(), again has the same structure as in // all other programs, in particular step-6. Like in the other programs that -// use PETSc, we have to inialize and finalize PETSc, which is done using the +// use PETSc, we have to initialize and finalize PETSc, which is done using the // helper object MPI_InitFinalize. // // Note how we enclose the use the use of the LaplaceProblem class in a pair // of braces. This makes sure that all member variables of the object are -// destroyed by the time we destroy the mpi_intialization object. Not doing +// destroyed by the time we destroy the mpi_initialization object. Not doing // this will lead to strange and hard to debug errors when // PetscFinalize first deletes all PETSc vectors that are still // around, and the destructor of the LaplaceProblem class then tries to delete diff --git a/deal.II/examples/step-41/CMakeLists.txt b/deal.II/examples/step-41/CMakeLists.txt index c4e08a8cf3..1ecef89b0a 100644 --- a/deal.II/examples/step-41/CMakeLists.txt +++ b/deal.II/examples/step-41/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_TRILINOS) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_TRILINOS = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-41/doc/intro.dox b/deal.II/examples/step-41/doc/intro.dox index f98bbc5674..84afbba1f6 100644 --- a/deal.II/examples/step-41/doc/intro.dox +++ b/deal.II/examples/step-41/doc/intro.dox @@ -21,7 +21,7 @@ the current example program, we will consider that under the membrane is a stair step obstacle against which gravity pushes the membrane. This problem is typically called the "obstacle problem" (see also this wikipedia article), and it results in a +href="http://en.wikipedia.org/wiki/Obstacle_problem">this Wikipedia article), and it results in a variational inequality, rather than a variational equation when put into the weak form. We will below derive it from the classical formulation, but before we go on to discuss the mathematics let us show how the solution of the problem we @@ -98,7 +98,7 @@ We have to find a solution $u\in G$ of the following minimization problem: @f{equation*} E(u)\leq E(v)\quad \forall v\in G, @f} -with the convex set of admissble displacements: +with the convex set of admissible displacements: @f{equation*} G:=\lbrace v\in V: v\geq g \text{ a.e. in } \Omega\rbrace,\quad V:=H^1_0(\Omega). @f} @@ -132,7 +132,7 @@ sides are in fact equal, i.e., we obtain a variational equality. On the other hand, if $u=g$ then $G$ only allows test functions $v$ so that in fact $v-u\ge 0$. This means that we can't test the equation with both $v-u$ and $-(v-u)$ as above, and so we can no longer conclude that the two sides are in -fact equal. Thus, this mimicks the way we have discussed the complementarity +fact equal. Thus, this mimics the way we have discussed the complementarity condition above. @@ -222,7 +222,7 @@ penalty parameter which depends on the problem itself and needs to be chosen large enough; for example there is no convergence for $c = 1$ using the current program if we use 7 global refinements.) -After some headscratching one can then convince oneself that the inequalities +After some head-scratching one can then convince oneself that the inequalities above can equivalently be rewritten as @f{equation*} C([BU]_i,\Lambda_i) = 0, \qquad \forall i\in{\cal S}. diff --git a/deal.II/examples/step-41/step-41.cc b/deal.II/examples/step-41/step-41.cc index 2bd479c3bd..4df6507cb8 100644 --- a/deal.II/examples/step-41/step-41.cc +++ b/deal.II/examples/step-41/step-41.cc @@ -1,15 +1,25 @@ -/* Authors: Joerg Frohne, Texas A&M University and */ -/* University of Siegen, 2011, 2012 */ -/* Wolfgang Bangerth, Texas A&M University, 2012 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2011 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Joerg Frohne, Texas A&M University and + * University of Siegen, 2011, 2012 + * Wolfgang Bangerth, Texas A&M University, 2012 + */ + // @sect3{Include files} @@ -484,7 +494,7 @@ namespace Step41 // function given above and in the introduction. // // If we decide that the DoF should be part of the active set, we - // add its index to the active set, introduce a nonhomogeneous + // add its index to the active set, introduce an inhomogeneous // equality constraint in the ConstraintMatrix object, and reset the // solution value to the height of the obstacle. Finally, the // residual of the non-contact part of the system serves as an @@ -566,7 +576,7 @@ namespace Step41 // @sect4{ObstacleProblem::output_results} // We use the vtk-format for the output. The file contains the displacement - // and a numerical represenation of the active set. The function looks + // and a numerical representation of the active set. The function looks // standard but note that we can add an IndexSet object to the DataOut // object in exactly the same way as a regular solution vector: it is simply // interpreted as a function that is either zero (when a degree of freedom diff --git a/deal.II/examples/step-42/CMakeLists.txt b/deal.II/examples/step-42/CMakeLists.txt index dc468213e4..78a6df2f1f 100644 --- a/deal.II/examples/step-42/CMakeLists.txt +++ b/deal.II/examples/step-42/CMakeLists.txt @@ -11,9 +11,6 @@ SET(TARGET_SRC # You can specify additional files here! ) -# A custom command line to run the program -SET(TARGET_RUN mpirun -np 2 ${TARGET}) - # Define the output that should be cleaned: SET(CLEAN_UP_FILES *.vtu *.pvtu *.visit) @@ -43,7 +40,7 @@ Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_MPI = ON DEAL_II_WITH_P4EST = ON DEAL_II_WITH_TRILINOS = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-42/doc/intro-step-42.tex b/deal.II/examples/step-42/doc/intro-step-42.tex deleted file mode 100644 index a6c6b1f752..0000000000 --- a/deal.II/examples/step-42/doc/intro-step-42.tex +++ /dev/null @@ -1,405 +0,0 @@ -\documentclass{article} - -\usepackage{amsmath} -\usepackage{amssymb} - -\title{Documentation of step-42, An obstacle problem for elasto-plastic material behavior in three dimensions} -\author{Joerg Frohne} -\date{Juni, 2012} - -\begin{document} - -\section{Introduction} - -This example is an extension of step-41, considering a contact problem with an -elasto-plastic material behavior with isotropic hardening in three dimensions. -That means that we have to take care of an additional nonlinearity: the -material behavior. Since we consider a three dimensional problem here, a -separate difference to step-41 is that the contact area is at the boundary of -the deformable body now, rather than in the interior. Finally, compared to -step-41, we also have to deal with -hanging nodes because of the adaptive mesh in both the handling of the linear -system as well as of the inequality constraints; in the latter case, we will -have to deal with prioritizing whether the constraints from the hanging nodes -or from the inequalities are more important. - -Since you can very easily reach a few million degrees of freedom in three -dimensions, even with adaptive mesh refinement, we decided to use Trilinos and -p4est to run our code in parallel, building on the framework of step-40 for -the parallelization.\\ - -\begin{huge} -{distributed} -\end{huge} - - -\section{Classical formulation} - -The classical formulation of the problem possesses the following form: -\begin{align*} - \varepsilon(u) &= A\sigma + \lambda & &\quad\text{in } \Omega,\\ - \lambda(\tau - \sigma) &\geq 0\quad\forall\tau\text{ with - }\mathcal{F}(\tau)\leq 0 & &\quad\text{in } \Omega,\\ - -\textrm{\textrm{div}}\ \sigma &= f & &\quad\text{in } \Omega,\\ - u(\mathbf x) &= 0 & &\quad\text{on }\Gamma_D,\\ - \sigma_t(u) &= 0,\quad\sigma_n(u)\leq 0 & &\quad\text{on }\Gamma_C,\\ -\sigma_n(u)(u_n - g) &= 0,\quad u_n(\mathbf x) - g(\mathbf x) \leq 0 & &\quad\text{on } \Gamma_C -\end{align*} -with $u\in H^2(\Omega),\Omega\subset\mathbb{R}^3$. The vector valued -function $u$ denotes the displacement in the deformable body. The first two lines describe the -elasto-plastic material behavior. Therein the equation shows the -strain of the deformation $\varepsilon (u)$ as the additive decomposition of the -elastic part $A\sigma$ and the plastic part $\lambda$. $A$ is defined as the -compliance tensor of fourth order which contains some material constants and -$\sigma$ as the symmetric stress tensor of second order. So we have to consider -the inequality in the second row in a pointwise sense where $\lambda(\tau - -\sigma)$ is the inner product of two symmetric tensors of second order. -Furthermore we have to distinguish two cases.\\ -The continuous and convex function $\mathcal{F}$ denotes the von Mises flow function -$$\mathcal{F}(\tau) = \vert\tau^D\vert - \sigma_0¸\quad\text{with}\quad \tau^D -= \tau - \dfrac{1}{3}tr(\tau)I,$$ -$\sigma_0$ as yield stress and $\vert .\vert$ as the frobenius norm. If there -are no plastic deformations in a particular point - that is $\lambda=0$ - this yields $\vert\sigma^D\vert < -\sigma_0$ and otherwise if $\lambda > 0$ it follows that $\vert\sigma^D\vert = \sigma_0$. -That means if the stress is smaller than the yield stress there are only elastic -deformations in that point.\\ -To consider it the other way around if the deviator stress $\sigma^D$ is in a -norm bigger than the yield stress then $\sigma^D$ has to be projected back to the yield surface and there are plastic deformations which means $\lambda$ -would be positiv for that particular point. We refer that the stresses are -computed by Hooke's law for isotorpic materials. You can find the description at the end of section 3. Else if the norm of the deviator stress tensor is smaller or equal the yield stress then $\lambda$ is zero and there are no plastic deformations in -that point.\\ -There the index $D$ denotes the deviator part of for example the stress where -$tr(.)$ is the trace of a tensor. The definition shows an additive decomposition -of the stress $\sigma$ into a hydrostatic part (or volumetric part) $\dfrac{1}{3}tr(\tau)I$ and the deviator -part $\sigma^D$. For metal the deviator stress composes the main indicator for -plastic deformations.\\ -The third equation is called equilibrium condition with a force of volume -density $f$ which we will neglect in our example. -The boundary of $\Omega$ separates as follows $\Gamma=\Gamma_D\bigcup\Gamma_C$ and $\Gamma_D\bigcap\Gamma_C=\emptyset$. -At the boundary $\Gamma_D$ we have zero Dirichlet conditions. $\Gamma_C$ denotes the potential contact boundary.\\ -The last two lines decribe the so-called Signorini contact conditions. If there is no contact the normal stress -$$ \sigma_n = \sigma n\cdot n$$ -is zero with the outward normal $n$. If there is contact ($u_n = g$) the tangential stress $\sigma_t = \sigma\cdot n - \sigma_n n$ -vanishes, because we consider a frictionless situation and the normal stress is -negative. The gap $g$ comes with the start configuration of the obstacle and the -deformable body. We refer that you have to ensure that the obstacle does not hit -the boundary of $\Gamma_C$ - -\section{Derivation of the variational inequality} - -As a starting point to derive the equations above, let us imagine that we want -to minimise an energy functional: -$$E(\tau) := \dfrac{1}{2}\int\limits_{\Omega}\tau A \tau d\tau,\quad \tau\in \Pi W^{\textrm{div}}$$ -with -$$W^{\textrm{div}}:=\lbrace \tau\in -L^2(\Omega,\mathbb{R}^{\textrm{dim}\times\textrm{dim}}_{\textrm{sym}}):\textrm{div}(\tau)\in L^2(\Omega,\mathbb{R}^{\textrm{dim}})\rbrace$$ and -$$\Pi \Sigma:=\lbrace \tau\in \Sigma, \mathcal{F}(\tau)\leq 0\rbrace$$ -as the set of admissible stresses which is defined -by a continious, convex flow function $\mathcal{F}$. - -With the goal of deriving the dual formulation of the minimisation -problem, we define a lagrange function: -$$L(\tau,\varphi) := E(\tau) + (\varphi, \textrm{div}(\tau)),\quad \lbrace\tau,\varphi\rbrace\in\Pi W^{\textrm{div}}\times V^+$$ -with -$$V^+ := \lbrace u\in V: u_n\leq g \text{ on } \Gamma_C \rbrace$$ -$$V:=\left[ H_0^1 \right]^{\textrm{dim}}:=\lbrace u\in \left[H^1(\Omega)\right]^{\textrm{dim}}: u -= 0 \text{ on } \Gamma_D\rbrace$$ -By building the Fr\'echet derivatives of $L$ for both components we obtain the -dual formulation for the stationary case which is known as \textbf{Hencky-Type-Model}:\\ -Find a pair $\lbrace\sigma,u\rbrace\in \Pi W\times V^+$ with -$$\left(A\sigma,\tau - \sigma\right) + \left(u, \textrm{div}(\tau) - \textrm{div}(\sigma)\right) \geq 0,\quad \forall \tau\in \Pi W^{\textrm{div}}$$ -$$-\left(\textrm{div}(\sigma),\varphi - u\right) \geq 0,\quad \forall \varphi\in V^+.$$ -By integrating by parts and multiplying the first inequality by the elastic -tensor $C=A^{-1}$ we achieve the primal-mixed version of our problem:\\ -Find a pair $\lbrace\sigma,u\rbrace\in \Pi W\times V^+$ with -$$\left(\sigma,\tau - \sigma\right) - \left(C\varepsilon(u), \tau - \sigma\right) \geq 0,\quad \forall \tau\in \Pi W$$ -$$\left(\sigma,\varepsilon(\varphi) - \varepsilon(u)\right) \geq 0,\quad \forall \varphi\in V^+.$$ -Therein $\varepsilon$ denotes the linearised deformation tensor with $\varepsilon(u) := \dfrac{1}{2}\left(\nabla u + \nabla u^T\right)$ for small deformations.\\ -Most materials - especially metals - have the property that they show some hardening effects during the forming process. -There are different constitutive laws to describe those material behaviors. The -simplest one is called linear isotropic hardening described by the flow function -$\mathcal{F}(\tau,\eta) = \vert\tau^D\vert - (\sigma_0 + \gamma^{\text{iso}}\eta)$ where -$\eta$ is the norm of the plastic strain $\eta = \vert \varepsilon - -A\sigma\vert$. -It can be considered by establishing an additional term in our primal-mixed formulation:\\ -Find a pair $\lbrace(\sigma,\xi),u\rbrace\in \Pi (W\times L^2(\Omega,\mathbb{R}))\times V^+$ with -$$\left(\sigma,\tau - \sigma\right) - \left(C\varepsilon(u), \tau - \sigma\right) + \gamma^{\text{iso}}\left( \xi, \eta - \xi\right) \geq 0,\quad \forall (\tau,\eta)\in \Pi (W,L^2(\Omega,\mathbb{R}))$$ -$$\left(\sigma,\varepsilon(\varphi) - \varepsilon(u)\right) \geq 0,\quad \forall \varphi\in V^+,$$ -with the hardening parameter $\gamma^{\text{iso}} > 0$.\\ -Now we want to derive a primal problem which only depends on the displacement $u$. For that purpose we -set $\eta = \xi$ and eliminate the stress $\sigma$ by applying the projection -theorem (see Grossmann, Roos: Numerical Treatment of Partial Differential -Equations, Springer-Verlag Berlin Heidelberg, 2007 and Frohne: FEM-Simulation -der Umformtechnik metallischer Oberflächen im Mikrokosmos, Ph.D. thesis, -University of Siegen, Germany, 2011) on\\ -$$\left(\sigma - C\varepsilon(u), \tau - \sigma\right) \geq 0,\quad \forall \tau\in \Pi W,$$ -which yields with the second inequality:\\ -Find the displacement $u\in V^+$ with -$$\left(P_{\Pi}(C\varepsilon(u)),\varepsilon(\varphi) - \varepsilon(u)\right) \geq 0,\quad \forall \varphi\in V^+,$$ -with the projection: -$$P_{\Pi}(\tau):=\begin{cases} - \tau, & \text{if }\vert\tau^D\vert \leq \sigma_0 + \gamma^{\text{iso}}\xi,\\ - \hat\alpha\dfrac{\tau^D}{\vert\tau^D\vert} + \dfrac{1}{3}tr(\tau), & \text{if }\vert\tau^D\vert > \sigma_0 + \gamma^{\text{iso}}\xi, - \end{cases}$$ -with the radius -$$\hat\alpha := \sigma_0 + \gamma^{\text{iso}}\xi .$$ -With the relation $\xi = \vert\varepsilon(u) - A\sigma\vert$ it is possible to eliminate $\xi$ inside the projection $P_{\Pi}$:\\ -$$P_{\Pi}(\tau):=\begin{cases} - \tau, & \text{if }\vert\tau^D\vert \leq \sigma_0,\\ - \alpha\dfrac{\tau^D}{\vert\tau^D\vert} + \dfrac{1}{3}tr(\tau), & \text{if }\vert\tau^D\vert > \sigma_0, - \end{cases}$$ -$$\alpha := \sigma_0 + \dfrac{\gamma^{\text{iso}}}{2\mu+\gamma^{\text{iso}}}\left(\vert\tau^D\vert - \sigma_0\right) ,$$ -with a further material parameter $\mu>0$ called shear modulus. We refer that -this only possible for isotropic plasticity.\\ -To make things a bit easier from now on we denote -$$\gamma := \dfrac{\gamma^{\text{iso}}}{2\mu + -\gamma^{\text{iso}}}\in[0,1)\text{ with }\gamma^{\text{iso}}\in[0,\infty),$$ -$$\beta :=\dfrac{\sigma_0}{\vert\tau^D\vert}.$$ If $\gamma^{\text{iso}}$ tends to zero $\gamma$ tends also to zero. And if $\gamma^{\text{iso}}$ tends to -infinity $\gamma$ tends to one. This allows us to reformulate our problem as -follows $$P_{\Pi}(\tau):=\begin{cases} - \tau, & \text{if }\vert\tau^D\vert \leq \sigma_0,\\ - \gamma\tau^D + (1-\gamma)\beta\tau^D - + \dfrac{1}{3}tr(\tau), & \text{if }\vert\tau^D\vert > - \sigma_0, \end{cases}.$$ -For further details see Suttmeier: On Plasticity with Hardening: -An Adaptive Finite Element Discretisation, International Mathematical Forum, 5, -2010, no. 52, 2591-2601.\\ -So what we do is to calculate the stresses -by using Hooke's law for linear elastic, isotropic materials $$\sigma = C \varepsilon(u) = 2\mu \varepsilon^D(u) + \kappa tr(\varepsilon(u))I = \left[2\mu\left(\mathbb{I} -\dfrac{1}{3} I\otimes I\right) + \kappa I\otimes I\right]\varepsilon(u)$$ -with the material parameter $\kappa>0$ (bulk modulus). The variables $I$ and -$\mathbb{I}$ denote the identity tensors of second and forth order. In that -notation $2\mu \varepsilon^D(u)$ is the deviatoric part and $\kappa -tr(\varepsilon(u))$ the volumetric part of the stress tensor.\\ -In the next step we test in a pointwise sense where the deviator part of the -stress in a norm is bigger than the yield stress. If there are such points we -project the deviator stress in those points back to the yield surface. Methods of this kind are called projections algorithm or radial-return-algorithm.\\ -Now we have a primal formulation of our elasto-plastic contact problem which only depends on the displacement $u$. -It consists of a nonlinear variational inequality and has a unique solution as -it satisfies the theorem of Lions and Stampaccia. A proof can be found in -Rodrigues: Obstacle Problems in Mathematical Physics, North-Holland, Amsterdam, -1987.\\ -To handle the nonlinearity of the constitutive law we use a Newton method and to deal with the contact we apply an -active set method like in step-41. To be more concrete we combine both methods to an inexact semi smooth Newton -method - inexact since we use an iterative solver for the linearised problems in each Newton step. - -\section{Linearization of the constitutive law for the Newton method} - -To apply Newton method we have to linearise the following semi-linearform -$$a(\psi;\varphi) := -\left(P_{\Pi}(C\varepsilon(\psi)),\varepsilon(\varphi)\right).$$ Because we have -to find the solution $u$ in the convex set $V^+$, we have to apply an SQP-method (SQP: sequential quadratic programming). That means we have -to solve a minimisation problem for a known $u^i$ in every SQP-step of the form -\begin{eqnarray*} - & & a(u^{i};u^{i+1} - u^i) + \dfrac{1}{2}a'(u^i;u^{i+1} - u^i,u^{i+1} - u^i)\\ - &=& a(u^i;u^{i+1}) - a(u^i;u^i) +\\ - & & \dfrac{1}{2}\left( a'(u^i;u^{i+1},u^{i+1}) - 2a'(u^i;u^i,u^{i+1}) - a'(u^i;u^i,u^i)\right)\\ - &\rightarrow& \textrm{min},\quad u^{i+1}\in V^+. -\end{eqnarray*} -Neglecting the constant terms $ a(u^i;u^i)$ and $ a'(u^i;u^i,u^i)$ we obtain the -following minimisation problem $$\dfrac{1}{2} a'(u^i;u^{i+1},u^{i+1}) - -F(u^{i+1})\rightarrow \textrm{min},\quad u^{i+1}\in V^+$$ with $$F(\varphi) := -\left(a'(u^{i};u^{i},\varphi) - a(u^{i},\varphi) \right).$$ -In the case of our constitutive law the Fr\'echet derivative of the -semi-linearform $a(.;.)$ at the point $u^i$ is - -$$a'(u^i;\psi,\varphi) = -(I(x)\varepsilon(\psi),\varepsilon(\varphi)),\quad x\in\Omega,$$ $$ -I(x) := \begin{cases} -C_{\mu} + C_{\kappa}, & -\quad \vert \tau^D \vert \leq \sigma_0\\ -\gamma C_{\mu} + (1-\gamma)\beta\left(C_{\mu} - -2\mu\dfrac{\tau^D\otimes\tau^D}{\vert\tau^D\vert^2}\right) + C_{\kappa}, &\quad -\vert \tau^D \vert > \sigma_0 -\end{cases} -$$ -with -$$C_{\mu} := 2\mu\left(\mathbb{I} - \dfrac{1}{3} I\otimes -I\right)\quad\text{(shear part of the stress strain tensor)},$$ -$$C_{\kappa} := \kappa I\otimes I\quad\text{(bulk part of the stress strain -tensor)},$$ -$$\tau^D := C\varepsilon^D(u^i).$$ -Remark that $a(.;.)$ is not differentiable in the common sense but it is -slantly differentiable like the function for the contact problem and again we refer to -Hintermueller, Ito, Kunisch: The primal-dual active set strategy as a semismooth newton method, SIAM J. OPTIM., 2003, Vol. 13, No. 3, pp. 865-888. -Again the first case is for elastic and the second for plastic deformation. - -\section{Formulation as a saddle point problem} - -Just as in step-41 we compose a saddle point problem out of the minimisation -problem. Again we do so to gain a formulation that allows us to solve a linear -system of equations finally.\\ -We introduce a Lagrange multiplier $\lambda$ and the convex cone $K\subset W'$, -$W'$ dual space of the trace space $W:=\left[ H_0^{\frac{1}{2}}(\Gamma_C) -\right]^{\textrm{dim}}$ of $V$ restricted to $\Gamma_C$, $$K:=\{\mu\in W':\mu_T = 0,\quad\langle\mu n,v\rangle_{\Gamma_C}\geq 0,\quad -\forall v\in H_0^{\frac{1}{2}}(\Gamma_C), v \ge 0\text{ on }\Gamma_C \}$$ -of Lagrange multipliers, where $\langle\cdot,\cdot\rangle$ -denotes the duality pairing, i.e. a boundary integral, between $W'$ and $W$. -Intuitively, $K$ is the cone of all "non-positive functions", except that $ K\subset -\left( \left[ H_0^{\frac{1}{2}}(\Gamma_C) \right]^{\textrm{dim}} \right)' $ and -so contains other objects besides regular functions as well. This yields:\\ - -\noindent -\textit{Find $u\in V$ and $\lambda\in K$ such that} -\begin{align*} - \hat{a}(u,v) + b(v,\lambda) &= f(v),\quad &&v\in V\\ - b(u,\mu - \lambda) &\leq \langle g,(\mu - - \lambda)n\rangle_{\Gamma_C},\quad&&\mu\in K, -\end{align*} -\textit{with} -\begin{align*} - \hat{a}(u,v) &:= a'(u^i;u,v)\\ - b(u,\mu) &:= \langle un,\mu n\rangle_{\Gamma_C},\quad &&u\in V,\quad\mu\in W'. -\end{align*} -As in the section before $u^i$ denotes the linearization point for the -semi-linearform $a(.;.)$. In contrast to step-41 we directly consider $\lambda$ -as the additional, positive force $\sigma(u)n$ that the obstacle -exerts on the boundary $\Gamma_C$ of the body.\\ - -\noindent -The existence and uniqueness of the analytical solution $(u,\lambda)\in V\times -K$ of this saddle point problem has been stated in Glowinski, Lions and Tr\'{e}moli\`{e}res: Numerical -Analysis of Variational Inequalities, North-Holland, 1981.\\ - -\noindent -NOTE: In this example as well as in the further documentation we make the -assumption that the normal vector $n$ equals to $(0,0,1)$. This comes up with -the starting condition of our deformable body. - -\section{Active Set methods to solve the saddle point problem} - -The linearized problem is essentially like a pure elastic problem with contact like -in step-41. The only difference consists in the fact that the contact area -is at the boundary instead of in the domain. But this has no further consequence -so that we refer to the documentation of step-41 with the only hint that -$\mathcal{S}$ containts all the vertices at the contact boundary $\Gamma_C$ this -time. - -\section{The primal-dual active set algorithm combined with the inexact semi smooth -Newton method} - -Now we describe an algorithm that combines the damped semismooth Newton-method, -which we use for the nonlinear constitutive law, with the semismooth Newton -method for the contact. It sums up the results of the sections before and works as follows: -\begin{itemize} - \item[(0)] Initialize $\mathcal{A}_k$ and $\mathcal{F}_k$, such that - $\mathcal{S} = \mathcal{A}_k \cup \mathcal{F}_k$ and $\mathcal{A}_k \cap - \mathcal{F}_k = \emptyset$ and set $k = 1$. The start value $\hat U^0 := - P_{\mathcal{A}_k}(0)$ fullfills our obstacle condition. - \item[(1)] Assemble the Newton matrix $A := a'(\hat - U^{k-1};\varphi_p,\varphi_q)$ and the right-hand-side $F(\hat U^{k-1})$. - \item[(2)] Find the primal-dual pair $(\bar U^k,\Lambda^k)$ that satisfies - \begin{align*} - A\bar U^k + B\Lambda^k & = F, &\\ - \left[B^T\bar U^k\right]_p & = G_p & \forall p\in\mathcal{A}_k,\\ - \Lambda^k_p & = 0 & \forall p\in\mathcal{F}_k. - \end{align*} - \item[(3)] Damping for $k>2$ by applying a line search and calculating a linear - combination of $U^{k-1}$ and $\bar U^k$. Find an - $\alpha_i:=2^{-i},(i=0,\ldots,10)$ so that $$U^k := \alpha_i\bar U^k + - (1-\alpha_i)U^{k-1}$$ yields $$\vert - F\left(U^{k}\right) \vert < \vert F\left(U^{k-1}\right) \vert.$$ - \item[(4)] Define the new active and inactive sets by - $$\mathcal{A}_{k+1}:=\lbrace p\in\mathcal{S}:\Lambda^k_p + - c\left(\left[B^TU^k\right]_p - G_p\right) > 0\rbrace,$$ - $$\mathcal{F}_{k+1}:=\lbrace p\in\mathcal{S}:\Lambda^k_p + - c\left(\left[B^TU^k\right]_p - G_p\right) \leq 0\rbrace.$$ - Projection $U^k$ so that it holds the second equation in (2) - $$\hat U^K := P_{\mathcal{A}_{k+1}}(U^k).$$ - \item[(5)] If $\mathcal{A}_{k+1} = \mathcal{A}_k$ and $\vert - F\left(U^{k}\right) \vert < \delta$ then stop, else set $k=k+1$ and go to - step (1). -\end{itemize} -\noindent -The subscript $p$ denotes a vertex and the meaning of the -decorated and none decorated $U$ is as follows: $\bar U$ denotes the solution of the linear system of equations in (2), $U$ is the -damped solution and equals to $\bar U$ if the damping parameter $\alpha_0 = -1$ and $\hat U := P_{\mathcal{A}}(U)$ is the projection of the active -components in $\mathcal{A}$ to the gap -$$P_{\mathcal{A}}(U):=\begin{cases} -U_p, & \textrm{if}\quad p\notin\mathcal{A}\\ -g_{h,p}, & \textrm{if}\quad -p\in\mathcal{A}. -\end{cases}$$\\ -The matrix $B\in\mathbb{R}^{n\times m}$, $n>m$ describes the coupling of the -bases for the displacements and lagrange multiplier (contact forces) -and it is not quadratic in our situation since $\Lambda^k$ is only defined on -$\Gamma_C$. Due to the ansatz functions $\psi_i$ (scalar valued) of the -lagrange multiplier are fullfilling the following biorthogonal condition (see Hüeber, Wohlmuth: A primal–dual active -set strategy for non-linear multibody contact problems, Comput. Methods Appl. Mech. Engrg. -194, 2005, pp. 3147-3166) -$$ \int\limits_{\Gamma_C}\psi_i(x)\varphi_j(x)dx = -\delta_{ij}\int\limits_{\Gamma_C}\varphi_j(x)dx$$ -this yields -$$B_{pq} = \begin{cases} -\int\limits_{\Gamma_C}\varphi_p(x)dxI_3, & \text{if}\quad p=q,\quad -p,q\in\mathcal{S}\\ -0I_3, & \text{if}\quad p\neq q,\quad p\textrm{ or }q\notin\mathcal{S}. -\end{cases}$$ -Here $I_3$ denotes the threedimensional identity matrix. -In our programm we use the structure of a quadratic sparse for -$B\in\mathbb{R}^{n\times n}$ and for $\Lambda^k$ a vector with length $n$ where -$\Lambda^k_p = 0$ for $p\notin \mathcal{S}$. -The vector $G$ is defined by a suitable approximation $g_h$ of the gap $g$ -$$G_p = \begin{cases} -g_{h,p}\int\limits_{\Gamma_C}\varphi_p(x)dx, & \text{if}\quad p\in\mathcal{S}\\ -0, & \text{if}\quad p\notin\mathcal{S}. -\end{cases}$$\\ -Note that $G_p$ is a threedimensional vector and that again we applied the -biorthogonal property of the lagrange multiplier ansatz functions to the -integral $\int\limits_{\Gamma_C}g_h(x)\varphi_p(x)dx$ with $g_h(x)=\sum\limits_i -g_{h,p}\varphi_p(x)$ (see the reference mentioned above).\\ -Compared to step-41, step (1) is added but it should be clear from the sections -above that we only linearize the problem. In step (2) we have to solve a linear system of equations again. And now the solution has to fulfill two stopping -criteria. $\mathcal{A}_{k+1} = \mathcal{A}_k$ makes sure that the contact zones -are iterated out and the second ensures an accurate enough residual which means that the plastic zones are also iterated out.\\ -A similar method can also be found in Brunssen, Schmid, Schaefer, Wohlmuth: A -fast and robust iterative solver for nonlinear contact problems using a -primal-dual active set strategy and algebraic multigrid, Int. J. Numer. -Meth. Engng, 2007, 69, pp. 524-543. But in advance we apply a line search to -obtain a more robust method regarding the start value. Solving an elastic -problem in the very first step ($k=1$) we get a reasonable start value but as -you can see in the results damping is important if we choose for example a ball as -obstacle.\\ -Damping our Newton method is more important for the nonlinearity cause by the -constitutive law as for the contact. For this reason we start to damp our method -for $k>2$ when we have two plastic iterations. Note that $U^1$ is a solution of -an elastic problem and $U^2$ is the first plastic solution. A linear combination -between these both results in stresses which are not in the convex set -of the feasible stresses. - -\section{Adaptive mesh refinement} - -Since we run our program in 3d, there is a good reason to use adaptive -mesh refined. To make life a bit easier we are choosing the -KellyErrorEstimator that is already implemented in deal.II. We hand the -solution vector to it which contains the displacement $u$. As we will see in the -results it yields a quite reasonable adaptive mesh for the contact zone. - -\section{Implementation} - -This tutorial is essentailly a mixture of step-40 and step-41 but instead of -PETSc we let the Trilinos library deal with parallelizing the linear algebra -(like in step-32). Since we are trying to solve a similar problem like in -step-41 we will use the same methods but now in parallel. - -Another difficulty is the handling of the different constraints from -(the dirichlet conditons), the hanging nodes and the inequality condition that -arises from the contact. For this purpose we create three objects of type -ConstraintMatrix. - -Beside the ConstitutiveLaw class there is another new class called Input. This -class allows us to read in an obstacle from a file. In our example the file -'obstacle\_file.dat' containts data which describe an Chinese, Japanese or -Korean symbol for force or power. (See www.orientaloutpost.com/: ``This word can be used for motivation - it -can also mean power / motion / propulsion / force. It can be anything -internal or external that keeps you going. This is the safest way to express -motivation in Chinese. If your audience is Japanese, please see the other entry -for motivation. This is a word in Japanese and Korean, but it means "motive -power" or "kinetic energy" (without the motivation meaning that you are -probably looking for)''). - -\section{Results} - - - -\end{document} diff --git a/deal.II/examples/step-42/doc/intro.dox b/deal.II/examples/step-42/doc/intro.dox index e968148ad2..6bd0446da6 100644 --- a/deal.II/examples/step-42/doc/intro.dox +++ b/deal.II/examples/step-42/doc/intro.dox @@ -1,8 +1,16 @@
    This program was contributed by Jörg Frohne (University of Siegen, -Germany) while on a long-term visit to Texas A&M University. +Germany) while on a long-term visit to Texas A&M University, with significant +contributions by Timo Heister and Wolfgang Bangerth.
    +
    +The code described here provides the basis for the numerical experiments shown +in the following paper: +
    + J. Frohne, T. Heister, W. Bangerth: Efficient numerical methods for the large-scale, parallel + solution of elastoplastic contact problems. Submitted, 2013. +
    @@ -10,396 +18,340 @@ Germany) while on a long-term visit to Texas A&M University.

    Introduction

    -This example is an extension of step-41, considering a contact problem with an +This example is an extension of step-41, considering a 3d contact problem with an elasto-plastic material behavior with isotropic hardening in three dimensions. -That means that we have to take care of an additional nonlinearity: the -material behavior. Since we consider a three dimensional problem here, a -separate difference to step-41 is that the contact area is at the boundary of +In other words, it considers how a three-dimensional body deforms if one pushes +into it a rigid obstacle (the contact problem) where deformation is governed +by an elasto-plastic material law (a material that can only accommodate a certain +maximal stress) that hardens as deformation accumulates. To show we we intend to +do before going into too many details, let us just show a picture of what the +solution will look like (the deformable body is a cube - only half of +which is actually shown -, the obstacle corresponds +to a Chinese character that is discussed below): + + + + +This problem description implies that we have to take care of an additional +nonlinearity compared to step-41: the +material behavior. Since we consider a three dimensional problem here, we also +have to account for the fact that the contact area is at the boundary of the deformable body now, rather than in the interior. Finally, compared to -step-41, we also have to deal with hanging nodes because of the adaptive mesh -in both the handling of the linear -system as well as of the inequality constraints; in the latter case, we will +step-41, we also have to deal with hanging nodes in both the handling of the linear +system as well as of the inequality constraints as we would like to use an +adaptive mesh; in the latter case, we will have to deal with prioritizing whether the constraints from the hanging nodes or from the inequalities are more important. Since you can very easily reach a few million degrees of freedom in three dimensions, even with adaptive mesh refinement, we decided to use Trilinos and p4est to run our code in parallel, building on the framework of step-40 for -the parallelization. - -@f{huge} -{distributed} -@f} +the parallelization. Additional pointers for parallelization can be found in +step-32.

    Classical formulation

    The classical formulation of the problem possesses the following form: @f{align*} - \varepsilon(u) &= A\sigma + \lambda & &\quad\text{in } \Omega,\\ - \lambda(\tau - \sigma) &\geq 0\quad\forall\tau\text{ with - }\mathcal{F}(\tau)\leq 0 & &\quad\text{in } \Omega,\\ - -\textrm{\textrm{div}}\ \sigma &= f & &\quad\text{in } \Omega,\\ - u(\mathbf x) &= 0 & &\quad\text{on }\Gamma_D,\\ - \sigma_t(u) &= 0,\quad\sigma_n(u)\leq 0 & &\quad\text{on }\Gamma_C,\\ -\sigma_n(u)(u_n - g) &= 0,\quad u_n(\mathbf x) - g(\mathbf x) \leq 0 & &\quad\text{on } \Gamma_C + \varepsilon(\mathbf u) &= A\sigma + \varepsilon^p & &\quad\text{in } \Omega,\\ + -\textrm{\textrm{div}}\ \sigma &= \mathbf f & &\quad\text{in } \Omega,\\ + \varepsilon^p:(\tau - \sigma) &\geq 0\quad\forall\tau\text{ with + }\mathcal{F}(\tau)\leq 0 & &\quad\text{in } \Omega,\\ + \mathbf u &= 0 & &\quad\text{on }\Gamma_D,\\ + \sigma \cdot \mathbf n - [\mathbf n \cdot(\sigma \cdot \mathbf n)]\mathbf n &= 0, + \quad \mathbf n \cdot (\sigma \cdot + \mathbf n) \leq 0 & &\quad\text{on }\Gamma_C,\\ + (\mathbf n \cdot (\sigma \cdot + \mathbf n))(\mathbf n \cdot \mathbf u - g) &= 0,\quad \mathbf n + \cdot \mathbf u - g \leq 0 & &\quad\text{on } \Gamma_C. @f} -with $u\in H^2(\Omega),\Omega\subset\mathbb{R}^3$. The vector valued -function $u$ denotes the displacement in the deformable body. The first two lines describe the -elasto-plastic material behavior. Therein the equation shows the -strain of the deformation $\varepsilon (u)$ as the additive decomposition of the -elastic part $A\sigma$ and the plastic part $\lambda$. $A$ is defined as the compliance tensor of fourth order which contains some material constants and $\sigma$ as the -symmetric stress tensor of second order. So we have to consider -the inequality in the second row in a pointwise sense where $\lambda(\tau - -\sigma)$ is the inner product of two symmetric tensors of second order. Furthermore we have to -distinguish two cases. - -The continuous and convex function $\mathcal{F}$ denotes the von Mises flow function -@f{gather*}\mathcal{F}(\tau) = \vert\tau^D\vert - \sigma_0�\quad\text{with}\quad \tau^D -= \tau - \dfrac{1}{3}tr(\tau)I,@f} -$\sigma_0$ as yield stress and $\vert .\vert$ as the Frobenius norm. If there -are no plastic deformations in a particular point - that is $\lambda=0$ - this yields $\vert\sigma^D\vert < -\sigma_0$ and otherwise if $\lambda > 0$ it follows that $\vert\sigma^D\vert = \sigma_0$. -That means if the stress is smaller than the yield stress there are only elastic -deformations in that point. - -To consider it the other way around if the deviator stress $\sigma^D$ is in a -norm bigger than the yield stress then $\sigma^D$ has to be projected back to the yield surface and there are plastic deformations which means $\lambda$ -would be positiv for that particular point. We refer that the stresses are -computed by Hooke's law for isotorpic materials. You can find the description at the end of section 3. Else if the norm of the deviator stress tensor is smaller or equal the yield stress then $\lambda$ is zero and there are no plastic deformations in -that point. - -There the index $D$ denotes the deviator part of for example the stress where -$tr(.)$ is the trace of a tensor. The definition shows an additive decomposition -of the stress $\sigma$ into a hydrostatic part (or volumetric part) $\dfrac{1}{3}tr(\tau)I$ and the deviator -part $\sigma^D$. For metal the deviator stress composes the main indicator for -plastic deformations. - -The third equation is called equilibrium condition with a force of volume -density $f$ which we will neglect in our example. -The boundary of $\Omega$ separates as follows $\Gamma=\Gamma_D\bigcup\Gamma_C$ and $\Gamma_D\bigcap\Gamma_C=\emptyset$. -At the boundary $\Gamma_D$ we have zero Dirichlet conditions. $\Gamma_C$ denotes the potential contact boundary. - -The last two lines decribe the so-called Signorini contact conditions. If there is no contact the normal stress -@f{gather*} \sigma_n = \sigma n\cdot n@f} -is zero with the outward normal $n$. If there is contact ($u_n = g$) the tangential stress $\sigma_t = \sigma\cdot n - \sigma_n n$ -vanishes, because we consider a frictionless situation and the normal stress is -negative. The gap $g$ comes with the start configuration of the obstacle and the -deformable body. - - -

    Derivation of the variational inequality

    - -As a starting point to derive the equations above, let us imagine that we want -to minimise an energy functional: -@f{gather*}E(\tau) := \dfrac{1}{2}\int\limits_{\Omega}\tau A \tau d\tau,\quad \tau\in \Pi W^{\textrm{div}}@f} -with -@f{gather*}W^{\textrm{div}}:=\lbrace \tau\in -L^2(\Omega,\mathbb{R}^{\textrm{dim}\times\textrm{dim}}_{\textrm{sym}}):\textrm{div}(\tau)\in L^2(\Omega,\mathbb{R}^{\textrm{dim}})\rbrace@f} and -@f{gather*}\Pi \Sigma:=\lbrace \tau\in \Sigma, \mathcal{F}(\tau)\leq 0\rbrace@f} -as the set of admissible stresses which is defined -by a continious, convex flow function $\mathcal{F}$. - -With the goal of deriving the dual formulation of the minimisation -problem, we define a lagrange function: -@f{gather*}L(\tau,\varphi) := E(\tau) + (\varphi, \textrm{div}(\tau)),\quad \lbrace\tau,\varphi\rbrace\in\Pi W^{\textrm{div}}\times V^+@f} -with -@f{gather*}V^+ := \lbrace u\in V: u_n\leq g \text{ on } \Gamma_C \rbrace@f} -@f{gather*}V:=\left[ H_0^1 \right]^{\textrm{dim}}:=\lbrace u\in \left[H^1(\Omega)\right]^{\textrm{dim}}: u -= 0 \text{ on } \Gamma_D\rbrace@f} -By building the Fréchet derivatives of $L$ for both components we obtain the -dual formulation for the stationary case which is known as Hencky-Type-Model:\\ -Find a pair $\lbrace\sigma,u\rbrace\in \Pi W\times V^+$ with -@f{gather*}\left(A\sigma,\tau - \sigma\right) + \left(u, \textrm{div}(\tau) - \textrm{div}(\sigma)\right) \geq 0,\quad \forall \tau\in \Pi W^{\textrm{div}}@f} -@f{gather*}-\left(\textrm{div}(\sigma),\varphi - u\right) \geq 0,\quad \forall \varphi\in V^+.@f} -By integrating by parts and multiplying the first inequality by the elastic -tensor $C=A^{-1}$ we achieve the primal-mixed version of our problem: -Find a pair $\lbrace\sigma,u\rbrace\in \Pi W\times V^+$ with -@f{gather*}\left(\sigma,\tau - \sigma\right) - \left(C\varepsilon(u), \tau - \sigma\right) \geq 0,\quad \forall \tau\in \Pi W@f} -@f{gather*}\left(\sigma,\varepsilon(\varphi) - \varepsilon(u)\right) \geq 0,\quad \forall \varphi\in V^+.@f} -Therein $\varepsilon$ denotes the linearised deformation tensor with $\varepsilon(u) := \dfrac{1}{2}\left(\nabla u + \nabla u^T\right)$ for small deformations. - -Most materials - especially metals - have the property that they show some hardening effects during the forming process. +Here, the first of these equations defines the +relationship between strain $\varepsilon(\mathbf u)=\frac{1}{2}\left(\nabla \mathbf u + + \nabla \mathbf u^T\right)$ and stress $\sigma$ via +the fourth-order compliance tensor $A$; $\varepsilon^p$ provides the plastic +component of the strain to ensure that the stress does not exceed the yield +stress. We will only consider isotropic +materials for which $A$ can be expressed in terms of the Lam\'e moduli +$\lambda$ and $\mu$ or alternatively in terms of the bulk modulus +$\kappa$ and $\mu$. +The second equation is the force balance; we will here +not consider any body forces and henceforth assume that $\mathbf f=0$. The +complementarity condition in the third line implies that $\varepsilon^p=0$ if +$\mathcal{F}(\sigma)< 0$ but that $\varepsilon^p$ may be a nonzero tensor if and +only if $\mathcal{F}(\sigma) = 0$, and in particular that in this case +$\varepsilon^p$ must point in the direction $\partial +\mathcal{F}(\sigma)/\partial \sigma$. The inequality $\mathcal{F}(\sigma)\le 0$ is +a statement of the fact that plastic materials can only support a finite amount +of stress; in other words, they react with plastic deformations $\varepsilon^p$ +if external forces would result in a stress $\sigma$ for which $\mathcal{F}(\sigma)> 0$ +would result. A typical form for this yield function is +$\mathcal{F}(\sigma)=|\sigma^D|-\sigma_{\text{yield}}$ where $\tau^D += \tau - \dfrac{1}{3}tr(\tau)I$ is the deviatoric part of a tensor +and $|\cdot|$ denotes the Frobenius norm. + +Further equations describe a +fixed, zero displacement on $\Gamma_D$ and +that on the surface $\Gamma_C=\partial\Omega\backslash\Gamma_D$ where contact may appear, the normal +force $\sigma_n=\mathbf n \cdot (\sigma(\mathbf u) \cdot + \mathbf n)$ exerted by the obstacle is inward (no "pull" by the obstacle on our +body) and with zero tangential component $\mathbf \sigma_t= \sigma \cdot \mathbf n - \mathbf \sigma_n \mathbf n += \sigma \cdot \mathbf n - [\mathbf n \cdot(\sigma \cdot \mathbf n)]\mathbf n$. +The last condition is again a complementarity condition that +implies that on $\Gamma_C$, the normal +force can only be nonzero if the body is in contact with the obstacle; the +second part describes the impenetrability of the obstacle and the body. +The last two equations are commonly referred to as the Signorini contact +conditions. + +Most materials - especially metals - have the property that they show some hardening as a result of +deformation. In other words, $\sigma_{\text{yield}}$ increases with deformation. +In practice, it is not the elastic deformation that results in hardening, +but the plastic component. There are different constitutive laws to describe those material behaviors. The simplest one is called linear isotropic hardening described by the flow function -$\mathcal{F}(\tau,\eta) = \vert\tau^D\vert - (\sigma_0 + \gamma^{\text{iso}}\eta)$ where -$\eta$ is the norm of the plastic strain $\eta = \vert \varepsilon - -A\sigma\vert$. -It can be considered by establishing an additional term in our primal-mixed formulation: -Find a pair $\lbrace(\sigma,\xi),u\rbrace\in \Pi (W\times L^2(\Omega,\mathbb{R}))\times V^+$ with -@f{gather*}\left(\sigma,\tau - \sigma\right) - \left(C\varepsilon(u), \tau - \sigma\right) + \gamma^{\text{iso}}\left( \xi, \eta - \xi\right) \geq 0,\quad \forall (\tau,\eta)\in \Pi (W,L^2(\Omega,\mathbb{R}))@f} -@f{gather*}\left(\sigma,\varepsilon(\varphi) - \varepsilon(u)\right) \geq 0,\quad \forall \varphi\in V^+,@f} -with the hardening parameter $\gamma^{\text{iso}} > 0$. - -Now we want to derive a primal problem which only depends on the displacement $u$. For that purpose we -set $\eta = \xi$ and eliminate the stress $\sigma$ by applying the projection -theorem (see Grossmann, Roos: Numerical Treatment of Partial Differential -Equations, Springer-Verlag Berlin Heidelberg, 2007 and Frohne: FEM-Simulation -der Umformtechnik metallischer Oberflächen im Mikrokosmos, Ph.D. thesis, -University of Siegen, Germany, 2011) on -@f{gather*}\left(\sigma - C\varepsilon(u), \tau - \sigma\right) \geq 0,\quad \forall \tau\in \Pi W,@f} -which yields with the second inequality:\\ -Find the displacement $u\in V^+$ with -@f{gather*}\left(P_{\Pi}(C\varepsilon(u)),\varepsilon(\varphi) - \varepsilon(u)\right) \geq 0,\quad \forall \varphi\in V^+,@f} -with the projection: -@f{gather*}P_{\Pi}(\tau):=\begin{cases} - \tau, & \text{if }\vert\tau^D\vert \leq \sigma_0 + \gamma^{\text{iso}}\xi,\\ - \hat\alpha\dfrac{\tau^D}{\vert\tau^D\vert} + \dfrac{1}{3}tr(\tau), & \text{if }\vert\tau^D\vert > \sigma_0 + \gamma^{\text{iso}}\xi, - \end{cases}@f} -with the radius -@f{gather*}\hat\alpha := \sigma_0 + \gamma^{\text{iso}}\xi .@f} -With the relation $\xi = \vert\varepsilon(u) - A\sigma\vert$ it is possible to eliminate $\xi$ inside the projection $P_{\Pi}$:\\ -@f{gather*}P_{\Pi}(\tau):=\begin{cases} - \tau, & \text{if }\vert\tau^D\vert \leq \sigma_0,\\ - \alpha\dfrac{\tau^D}{\vert\tau^D\vert} + \dfrac{1}{3}tr(\tau), & \text{if }\vert\tau^D\vert > \sigma_0, - \end{cases}@f} -@f{gather*}\alpha := \sigma_0 + \dfrac{\gamma^{\text{iso}}}{2\mu+\gamma^{\text{iso}}}\left(\vert\tau^D\vert - \sigma_0\right) ,@f} -with a further material parameter $\mu>0$ called shear modulus. We refer that -this only possible for isotropic plasticity. - -To make things a bit easier from now on we denote -@f{gather*}\gamma := \dfrac{\gamma^{\text{iso}}}{2\mu + -\gamma^{\text{iso}}}\in[0,1)\text{ with }\gamma^{\text{iso}}\in[0,\infty),@f} -@f{gather*}\beta :=\dfrac{\sigma_0}{\vert\tau^D\vert}.@f} -If $\gamma^{\text{iso}}$ tends to zero $\gamma$ tends also to zero. And if $\gamma^{\text{iso}}$ tends to -infinity $\gamma$ tends to one. This allows us to reformulate our problem as -follows -@f{gather*}P_{\Pi}(\tau):=\begin{cases} - \tau, & \text{if }\vert\tau^D\vert \leq \sigma_0,\\ - \gamma\tau^D + (1-\gamma)\beta\tau^D - + \dfrac{1}{3}tr(\tau), & \text{if }\vert\tau^D\vert > - \sigma_0, \end{cases}.@f} -For further details e.g., see Suttmeier: On Plasticity with Hardening: -An Adaptive Finite Element Discretisation, International Mathematical Forum, 5, -2010, no. 52, 2591-2601. - -So what we do is to calculate the stresses by using Hooke's law for linear elastic, isotropic materials -@f{gather*}\sigma = C \varepsilon(u) = 2\mu \varepsilon^D(u) + \kappa tr(\varepsilon(u))I = \left[2\mu\left(\mathbb{I} -\dfrac{1}{3} I\otimes I\right) + \kappa I\otimes I\right]\varepsilon(u)@f} -with the material parameter $\kappa>0$ (bulk modulus). The variables $I$ and -$\mathbb{I}$ denote the identity tensors of second and forth order. In that -notation $2\mu \varepsilon^D(u)$ is the deviatoric part and $\kappa -tr(\varepsilon(u))$ the volumetric part of the stress tensor. - -In the next step we test in a pointwise sense where the deviator part of the -stress in a norm is bigger than the yield stress. If there are such points we -project the deviator stress in those points back to the yield surface. Methods of this kind are called projections algorithm or radial-return-algorithm. - -Now we have a primal formulation of our elasto-plastic contact problem which only depends on the displacement $u$. -It consists of a nonlinear variational inequality and has a unique solution as -it satisfies the theorem of Lions and Stampaccia. A proof can be found in -Rodrigues: Obstacle Problems in Mathematical Physics, North-Holland, Amsterdam, -1987. - -To handle the nonlinearity of the constitutive law we use a Newton method and to deal with the contact we apply an -active set method like in step-41. To be more concrete we combine both methods to an inexact semi smooth Newton -method - inexact since we use an iterative solver for the linearised problems in each Newton step. - - -

    Linearisation of the constitutive law for the Newton method

    - -For the Newton method we have to linearise the following semi-linearform -@f{gather*}a(\psi;\varphi) := \left(P_{\Pi}(C\varepsilon(\psi)),\varepsilon(\varphi)\right).@f} -Because we have to find the solution $u$ in the convex set $V^+$, we have to -apply an SQP-method (SQP: sequential quadratic programming). That means we have -to solve a minimisation problem for a known $u^i$ in every SQP-step of the form -@f{eqnarray*} - & & a(u^{i};u^{i+1} - u^i) + \dfrac{1}{2}a'(u^i;u^{i+1} - u^i,u^{i+1} - u^i)\\ - &=& a(u^i;u^{i+1}) - a(u^i;u^i) +\\ - & & \dfrac{1}{2}\left( a'(u^i;u^{i+1},u^{i+1}) - 2a'(u^i;u^i,u^{i+1}) - a'(u^i;u^i,u^i)\right)\\ - &\rightarrow& \textrm{min},\quad u^{i+1}\in V^+. -@f} -Neglecting the constant terms $ a(u^i;u^i)$ and $ a'(u^i;u^i,u^i)$ we obtain the -following minimisation problem @f{gather*}\dfrac{1}{2} a'(u^i;u^{i+1},u^{i+1}) - F(u^i)\rightarrow \textrm{min},\quad u^{i+1}\in V^+@f} with -@f{gather*}F(\varphi) := \left(a'(\varphi;\varphi,u^{i+1}) - a(\varphi;u^{i+1}) \right).@f} -In the case of our constitutive law the Fréchet derivative of the -semi-linearform $a(.;.)$ at the point $u^i$ is - -@f{gather*}a'(u^i;\psi,\varphi) = -(I(x)\varepsilon(\psi),\varepsilon(\varphi)),\quad x\in\Omega,@f} -@f{gather*} -I(x) := \begin{cases} -C_{\mu} + C_{\kappa}, & -\quad \vert \tau^D \vert \leq \sigma_0\\ -\gamma C_{\mu} + (1-\gamma)\beta\left(C_{\mu} - -2\mu\dfrac{\tau^D\otimes\tau^D}{\vert\tau^D\vert^2}\right) + C_{\kappa}, &\quad -\vert \tau^D \vert > \sigma_0 -\end{cases} +$\mathcal{F}(\sigma,\varepsilon^p) = \vert\sigma^D\vert - (\sigma_0 + +\gamma^{\text{iso}}|\varepsilon^p|)$. + + +

    Reformulation as a variational inequality

    + +It is generally rather awkward to deal with inequalities. Here, we have to deal with +two: plasticity and the contact problem. +As described in more detail in the paper mentioned at the top of this page, one +can at least reformulate the plasticity in a way that makes it look like a +nonlinearity that we can then treat with Newton's method. This is slightly +tricky mathematically since the nonlinearity is not just some smooth +function but instead has kinks where the stress reaches the yield stress; +however, it can be shown for such semismooth functions that Newton's +method still converges. + +Without going into details, we will also get rid of the stress as an independent +variable and instead work exclusively with the displacements $\mathbf u$. Ultimately, +the goal of this reformulation is that we will want to end up with a symmetric, +positive definite problem - such as a linearized elasticity problem with spatially +variable coefficients resulting from the plastic behavior - that needs to be solved +in each Newton step. We want this because there are efficient and scalable methods +for the solution of such linear systems, such as CG preconditioned with an +algebraic multigrid. This is opposed to the saddle point problem akin to the mixed +Laplace (see step-20) we would get were we to continue with the mixed formulation +containing both displacements and stresses, and for which step-20 already gives a +hint at how difficult it is to construct good solvers and preconditioners. + +With this said, let us simply state the problem we obtain after reformulation +(again, details can be found in the paper): Find a displacement $\mathbf u \in +V^+$ so that +@f{align*} +\left(P_{\Pi}(C\varepsilon(\mathbf u)),\varepsilon(\varphi) - \varepsilon(\mathbf u)\right) \geq 0,\quad \forall \varphi\in V^+. @f} -with -@f{gather*}C_{\mu} := 2\mu\left(\mathbb{I} - \dfrac{1}{3} I\otimes -I\right)\quad\text{(shear part of the stress strain tensor)},@f} -@f{gather*}C_{\kappa} := \kappa I\otimes I\quad\text{(bulk part of the stress strain -tensor)},@f} -@f{gather*}\tau^D := C\varepsilon^D(u^i).@f} -Remark that $a(.;.)$ is not differentiable in the common sense but it is -slantly differentiable like the function for the contact problem and again we refer to -Hintermueller, Ito, Kunisch: The primal-dual active set strategy as a semismooth newton method, SIAM J. OPTIM., 2003, Vol. 13, No. 3, pp. 865-888. -Again the first case is for elastic and the second for plastic deformation. - - -

    Formulation as a saddle point problem

    - -Just as in step-41 we compose a saddle point problem out of the minimisation -problem. Again we do so to gain a formulation that allows us to solve a linear -system of equations finally. - -We introduce a Lagrange multiplier $\lambda$ and the convex cone $K\subset W'$, -$W'$ dual space of the trace space $W:=\left[ H_0^{\frac{1}{2}}(\Gamma_C) -\right]^{\textrm{dim}}$ of $V$ restricted to $\Gamma_C$, -@f{gather*}K:=\{\mu\in W':\mu_T = 0,\quad\langle\mu n,v\rangle_{\Gamma_C}\geq 0,\quad -\forall v\in H_0^{\frac{1}{2}}(\Gamma_C), v \ge 0\text{ on }\Gamma_C \}@f} -of Lagrange multipliers, where $\langle\cdot,\cdot\rangle$ -denotes the duality pairing, i.e. a boundary integral, between $W'$ and $W$. -Intuitively, $K$ is the cone of all "non-positive functions", except that $ K\subset -\left( \left[ H_0^{\frac{1}{2}}(\Gamma_C) \right]^{\textrm{dim}} \right)' $ and so contains other -objects besides regular functions as well. This yields: - -Find $u\in V$ and $\lambda\in K$ such that +where the projector $P_\Pi$ is defined as @f{align*} - \hat{a}(u,v) + b(v,\lambda) &= f(v),\quad &&v\in V\\ - b(u,\mu - \lambda) &\leq \langle g,(\mu - - \lambda)n\rangle_{\Gamma_C},\quad&&\mu\in K, + P_{\Pi}(\tau):=\begin{cases} + \tau, & \text{if }\vert\tau^D\vert \leq \sigma_0,\\ + \left[ + \dfrac{\gamma^{\text{iso}}}{2\mu + \gamma^{\text{iso}}} + + \left(1-\dfrac{\gamma^{\text{iso}}}{2\mu + \gamma^{\text{iso}}}\right)\dfrac{\sigma_0}{\vert\tau^D\vert} + \right]\tau^D + + \dfrac{1}{3}\text{trace}(\tau) I, & \text{if }\vert\tau^D\vert > + \sigma_0, + \end{cases} @f} -with +and the space $V^+$ is the space of all displacements that satisfy the contact +condition: @f{align*} - \hat{a}(u,v) &:= a'(u^i;u,v)\\ - b(u,\mu) &:= \langle un,\mu n\rangle_{\Gamma_C},\quad &&u\in V,\quad\mu\in W'. + V + &= + \left\{ \mathbf u\in \left[H^1(\Omega)\right]^{d}: + \mathbf u = 0 \text{ on } \Gamma_D\right\}, + \\ + V^+ + &= + \left\{ \mathbf u\in V: \mathbf n \cdot \mathbf u\leq g \text{ on } \Gamma_C \right\}. @f} -As in the section before $u^i$ denotes the linearization point for the -semi-linearform $a(.;.)$. In contrast to step-41 we directly consider $\lambda$ -as the additional, positive force $\sigma(u)n$ that the obstacle -exerts on the boundary $\Gamma_C$ of the body. -The existence and uniqueness of the analytical solution $(u,\lambda)\in V\times -K$ of this saddle point problem has been stated in Glowinski, Lions and Tr\'{e}moli\`{e}res: Numerical -Analysis of Variational Inequalities, North-Holland, 1981. +Given this formulation, we will apply two techniques: +- Run a Newton method to iterate out the nonlinearity in the projector. +- Run an active set method for the contact condition, in much the same + way as we did in step-41. + +A strict approach would keep the active set fixed while we iterate +the Newton method to convergence (or maybe the other way around: find the +final active set before moving on to the next Newton iteration). +In practice, it turns out that it is sufficient to do only a single +Newton step per active set iteration, and so we will iterate over them +concurrently. We will also, every once in a while, refine the mesh. -NOTE: In this example as well as in the further documentation we make the -assumption that the normal vector $n$ equals to $(0,0,1)$. This comes up with -the starting condition of our deformable body. + +

    A Newton method for the plastic nonlinearity

    + +As mentioned, we will treat the nonlinearity of the operator $P_\Pi$ by +applying a Newton method, despite the fact that the operator is not differentiable +in the strict sense. However, it satisfies the conditions of slant +differentiability and this turns out to be enough for Newton's method to work. +The resulting method then goes by the name semi-smooth Newton method, +which sounds impressive but is, in reality, just a Newton method applied to +a semi-smooth function with an appropriately chosen "derivative". + +In the current case, we will run our iteration by solving in each iteration $i$ +the following equation (still an inequality, but linearized): +@f{align*} + \label{eq:linearization} + \left(I_{\Pi}\varepsilon(\tilde {\mathbf u}^{i}), + \varepsilon(\varphi) - \varepsilon(\tilde {\mathbf u}^{i})\right) \geq 0, + \quad \forall \varphi\in V^+, +@f} +where the rank-4 tensor $I_\Pi=I_\Pi(\varepsilon^D(\mathbf u^{i-1}))$ given by +@f{align} + I_\Pi = \begin{cases} + C_{\mu} + C_{\kappa}, & \hspace{-8em}\hfill \text{if } \vert C\varepsilon^D(\mathbf u^{i-1}) \vert \leq \sigma_0, + \\ + \frac{\gamma^{\text{iso}}}{2\mu + \gamma^{\text{iso}}} C_{\mu} + \frac{\left(1-\frac{\gamma^{\text{iso}}}{2\mu + \gamma^{\text{iso}}}\right)\sigma_0}{\vert C\varepsilon^D(\mathbf u^{i-1}) \vert}\left(C_{\mu} - + 2\mu\dfrac{C\varepsilon^D(\mathbf u^{i-1})\otimes C\varepsilon^D(\mathbf + u^{i-1})}{\vert C\varepsilon^D(\mathbf u^{i-1})\vert^2}\right) + C_{\kappa}, & \text{ else.} +\end{cases} +@f} +This tensor is the (formal) linearization of $P_\Pi(C\cdot)$ around $\varepsilon^D(\mathbf u^{i-1})$. +For the linear isotropic material we consider here, +the bulk and shear components of the projector are given by +@f{gather*} + C_{\kappa} = \kappa I\otimes I, + \qquad\qquad\qquad\qquad + C_{\mu} = 2\mu\left(\mathbb{I} - \dfrac{1}{3} I\otimes + I\right), +@f} +where $I$ +and $\mathbb{I}$ are the identity tensors of rank 2 and 4, respectively. + +Note that this problem corresponds to a linear elastic contact problem +where $I_\Pi$ plays the role of the elasticity tensor $C=A^{-1}$. Indeed, +if the material is not plastic at a point, then $I_\Pi=C$. However, at +places where the material is plastic, $I_\Pi$ is a spatially varying +function. In any case, the system we have to solve for the Newton iterate +$\tilde {\mathbf u}^{i}$ gets us closer to the goal of rewriting our problem in +a way that allows us to use well-known solvers and preconditioners for +elliptic systems. + +As a final note about the Newton method let us mention that as is common with +Newton methods we need to globalize it by controlling the step length. In +other words, while the system above solves for $\tilde {\mathbf u}^{i}$, the final +iterate will rather be +@f{align*} + {\mathbf u}^{i} = {\mathbf u}^{i-1} + \alpha_i (\tilde {\mathbf u}^{i} - {\mathbf u}^{i-1}) +@f} +where the difference in parentheses on the right takes the role of the +traditional Newton direction, $\delta {\mathbf u}^{i}$. We will determine +$\alpha^i$ using a standard line search.

    Active Set methods to solve the saddle point problem

    -The linearized problem is essentially like a pure elastic problem with contact like +This linearized problem to be solved in each Newton step is essentially like in step-41. The only difference consists in the fact that the contact area is at the boundary instead of in the domain. But this has no further consequence so that we refer to the documentation of step-41 with the only hint that -$\mathcal{S}$ containts all the vertices at the contact boundary $\Gamma_C$ this -time. +$\mathcal{S}$ contains all the vertices at the contact boundary $\Gamma_C$ this +time. As there, what we need to do is keep a subset of degrees of freedom fixed, +leading to additional constraints that one can write as a saddle point problem. +However, as discussed in the paper, by writing these constraints in an +appropriate way that removes the coupling between degrees of freedom, +we end up with a set of nodes that essentially just have Dirichlet values +attached to them. -

    The primal-dual active set algorithm combined with the inexact semi smooth -Newton method

    +

    Overall algorithm

    -Now we describe an algorithm that combines the damped semismooth Newton-method, +The algorithm outlined above combines the damped semismooth Newton-method, which we use for the nonlinear constitutive law, with the semismooth Newton -method for the contact. It sums up the results of the sections before and works as follows: +method for the contact. It works as follows:
      -
    1. Initialize $\mathcal{A}_k$ and $\mathcal{F}_k$, such that - $\mathcal{S} = \mathcal{A}_k \cup \mathcal{F}_k$ and $\mathcal{A}_k \cap - \mathcal{F}_k = \emptyset$ and set $k = 1$. The start value $\hat U^0 := - P_{\mathcal{A}_k}(0)$ fullfills our obstacle condition. -
    2. Assemble the Newton matrix $A := a'(\hat - U^{k-1};\varphi_p,\varphi_q)$ and the right-hand-side $F(\hat U^{k-1})$. -
    3. Find the primal-dual pair $(\bar U^k,\Lambda^k)$ that satisfies +
    4. Initialize the active and inactive sets $\mathcal{A}_i$ and $\mathcal{F}_i$ + such that $\mathcal{S} = \mathcal{A}_i \cup \mathcal{F}_i$ and $\mathcal{A}_i \cap + \mathcal{F}_i = \emptyset$ and set $i = 1$. Here, $\mathcal{S}$ is the set of + all degrees of freedom located at the surface of the domain where contact + may happen. + The start value $\hat U^0 := + P_{\mathcal{A}_k}(0)$ fulfills our obstacle condition, i.e., we project an + initial zero displacement onto the set of feasible displacements. + +
    5. Assemble the Newton matrix $A_{pq} := a'( + U^{i-1};\varphi_p,\varphi_q)$ and the right-hand-side $F(\hat U^{i-1})$. + These correspond to the linearized Newton step, ignoring for the moment + the contact inequality. + +
    6. Find the primal-dual pair $(\tilde U^i,\Lambda^i)$ that satisfies @f{align*} - A\bar U^k + B\Lambda^k & = F, &\\ - \left[B^T\bar U^k\right]_p & = G_p & \forall p\in\mathcal{A}_k,\\ - \Lambda^k_p & = 0 & \forall p\in\mathcal{F}_k. + A\tilde U^i + B\Lambda^i & = F, &\\ + \left[B^T\tilde U^i\right]_p & = G_p & \forall p\in\mathcal{A}_i,\\ + \Lambda^i_p & = 0 & \forall p\in\mathcal{F}_i. @f} -
    7. Damping for $k>2$ by applying a line search and calculating a linear - combination of $U^{k-1}$ and $\bar U^k$. Find an - $\alpha_i:=2^{-i},(i=0,\ldots,10)$ so that - @f{gather*}U^k := \alpha_i\bar U^k + - (1-\alpha_i)U^{k-1}@f} - yields - @f{gather*}\vert F\left(U^{k}\right) \vert < \vert F\left(U^{k-1}\right) \vert.\f} + As in step-41, we can obtain the solution to this problem by eliminating + those degrees of freedom in ${\cal A}_i$ from the first equation and + obtain a linear system $\hat {\hat A}(U^{i-1}) \tilde U^i = \hat {\hat H}(U^{i-1})$. + + + +
    8. Damp the Newton iteration for $i>2$ by applying a line search and + calculating a linear combination of $U^{i-1}$ and $\tilde U^i$. This + requires finding an + $\alpha^i_l:=2^{-l},(l=0,\ldots,10)$ so that + @f{gather*}U^i := \alpha^i_l\bar U^i + + (1-\alpha^i_l)U^{i-1}@f} + satisfies + @f{gather*} + \vert F\left(U^{i}\right) \vert < \vert F\left(U^{i-1}\right) \vert. + \f} +
    9. Define the new active and inactive sets by - @f{gather*}\mathcal{A}_{k+1}:=\lbrace p\in\mathcal{S}:\Lambda^k_p + - c\left(\left[B^TU^k\right]_p - G_p\right) > 0\rbrace,@f} - @f{gather*}\mathcal{F}_{k+1}:=\lbrace p\in\mathcal{S}:\Lambda^k_p + - c\left(\left[B^TU^k\right]_p - G_p\right) \leq 0\rbrace.@f} - Projection $U^k$ so that it holds the second equation in (2) - @f{gather*}\hat U^K := P_{\mathcal{A}_{k+1}}(U^k).@f} -
    10. If $\mathcal{A}_{k+1} = \mathcal{A}_k$ and $\vert - F\left(U^{k}\right) \vert < \delta$ then stop, else set $k=k+1$ and go to - step (1). + @f{gather*}\mathcal{A}_{i+1}:=\lbrace p\in\mathcal{S}:\Lambda^i_p + + c\left(\left[B^TU^i\right]_p - G_p\right) > 0\rbrace,@f} + @f{gather*}\mathcal{F}_{i+1}:=\lbrace p\in\mathcal{S}:\Lambda^i_p + + c\left(\left[B^TU^i\right]_p - G_p\right) \leq 0\rbrace.@f} + +
    11. Project $U^i$ so that it satisfies the contact inequality, + @f{gather*}\hat U^i := P_{\mathcal{A}_{i+1}}(U^i).@f} + Here, + $P_{\mathcal{A}}(U)$ is the projection of the active + components in $\mathcal{A}$ to the gap + @f{gather*}P_{\mathcal{A}}(U)_p:=\begin{cases} + U_p, & \textrm{if}\quad p\notin\mathcal{A}\\ + g_{h,p}, & \textrm{if}\quad + p\in\mathcal{A}, + \end{cases}@f} + where $g_{h,p}$ is the gap denoting the distance of the obstacle + from the undisplaced configuration of the body. + +
    12. If $\mathcal{A}_{i+1} = \mathcal{A}_k$ and $\vert + F\left(U^{i}\right) \vert < \delta$ then stop, else set $i=i+1$ and go to + step (1). This step ensures that we only stop iterations if both the correct + active set has been found and the plasticity has been iterated to sufficient + accuracy.
    -The subscript $p$ denotes a vertex and the meaning of the -decorated and none decorated $U$ is as follows: $\bar U$ denotes the solution of the linear system of equations in (2), $U$ is the -damped solution and equals to $\bar U$ if the damping parameter $\alpha_0 = -1$ and $\hat U := P_{\mathcal{A}}(U)$ is the projection of the active -components in $\mathcal{A}$ to the gap - -@f{gather*}P_{\mathcal{A}}(U):=\begin{cases} -U_p, & \textrm{if}\quad p\notin\mathcal{A}\\ -g_{h,p}, & \textrm{if}\quad -p\in\mathcal{A}. -\end{cases}@f}\\ -The matrix $B\in\mathbb{R}^{n\times m}$, $n>m$ describes the coupling of the -bases for the displacements and lagrange multiplier (contact forces) +In step 3 of this algorithm, +the matrix $B\in\mathbb{R}^{n\times m}$, $n>m$ describes the coupling of the +bases for the displacements and Lagrange multiplier (contact forces) and it is not quadratic in our situation since $\Lambda^k$ is only defined on -$\Gamma_C$. Due to the ansatz functions $\psi_i$ (scalar valued) of the -lagrange multiplier are fullfilling the following biorthogonal condition (see Hüeber, Wohlmuth: A primal–dual active +$\Gamma_C$, i.e., the surface where contact may happen. As shown in the paper, +we can choose $B$ to be a matrix that has only one entry per row, +(see also Hüeber, Wohlmuth: A primal-dual active set strategy for non-linear multibody contact problems, Comput. Methods Appl. Mech. Engrg. -194, 2005, pp. 3147-3166) -@f{gather} \int\limits_{\Gamma_C}\psi_i(x)\varphi_j(x)dx = -\delta_{ij}\int\limits_{\Gamma_C}\varphi_j(x)dx@f} -this yields -@f{gather*}B_{pq} = \begin{cases} -\int\limits_{\Gamma_C}\varphi_p(x)dxI_3, & \text{if}\quad p=q,\quad -p,q\in\mathcal{S}\\ -0I_3, & \text{if}\quad p\neq q,\quad p\textrm{ or }q\notin\mathcal{S}. -\end{cases}@f} -Here $I_3$ denotes the threedimensional identity matrix. -In our programm we use the structure of a quadratic sparse for -$B\in\mathbb{R}^{n\times n}$ and for $\Lambda^k$ a vector with length $n$ where -$\Lambda^k_p = 0$ for $p\notin \mathcal{S}$. +194, 2005, pp. 3147-3166). The vector $G$ is defined by a suitable approximation $g_h$ of the gap $g$ @f{gather*}G_p = \begin{cases} -g_{h,p}\int\limits_{\Gamma_C}\varphi_p(x)dx, & \text{if}\quad p\in\mathcal{S}\\ +g_{h,p}, & \text{if}\quad p\in\mathcal{S}\\ 0, & \text{if}\quad p\notin\mathcal{S}. \end{cases}@f} -Note that $G_p$ is a threedimensional vector and that again we applied the -biorthogonal property of the lagrange multiplier ansatz functions to the -integral $\int\limits_{\Gamma_C}g_h(x)\varphi_p(x)dx$ with $g_h(x)=\sum\limits_i -g_{h,p}\varphi_p(x)$ (see the reference mentioned above). - -Compared to step-41, step (1) is added but it should be clear -from the sections above that we only linearize the problem. In step (2) we have -to solve a linear system of equations again. And now the solution has to fulfill two stopping -criteria. $\mathcal{A}_{k+1} = \mathcal{A}_k$ makes sure that the contact zones -are iterated out and the second ensures an accurate enough residual which means -that the plastic zones are also iterated out. - -A similar method can also be found in Brunssen, Schmid, Schäfer, -Wohlmuth: A fast and robust iterative solver for nonlinear contact problems -using a primal-dual active set strategy and algebraic multigrid, Int. J. Numer. -Meth. Engng, 2007, 69, pp. 524-543. But in advance we apply a line search to -obtain a more robust method regarding the start value. Solving an elastic -problem in the very first step ($k=1$) we get a reasonable start value but as -you can see in the results damping is important if we choose for example a ball as -obstacle. - -Damping our Newton method is more important for the nonlinearity cause by the -constitutive law as for the contact. For this reason we start to damp our method -for $k>2$ when we have two plastic iterations. Note that $U^1$ is a solution of -an elastic problem and $U^2$ is the first plastic solution. A linear combination -between these both results in stresses which are not in the convex set -of the feasible stresses. -

    Adaptive mesh refinement

    -Since we run our program in 3d, there is a good reason to use adaptive -mesh refinement. To make things a bit easier we are choosing the +Since we run our program in 3d, the computations the program performs are +expensive. Consequently using adaptive mesh refinement is an important step towards +staying within acceptable run-times. To make our lives easier we simply choose the KellyErrorEstimator that is already implemented in deal.II. We hand the solution vector to it which contains the displacement $u$. As we will see in the results it yields a quite reasonable adaptive mesh for the contact zone as well -as for plasticity! +as for plasticity.

    Implementation

    @@ -409,19 +361,41 @@ PETSc we let the Trilinos library deal with parallelizing the linear algebra (like in step-32). Since we are trying to solve a similar problem like in step-41 we will use the same methods but now in parallel. -Another difficulty is the handling of the different constraints from -(the dirichlet conditons), the hanging nodes and the inequality condition that +A difficulty is handling of the constraints from +the Dirichlet conditions, hanging nodes and the inequality condition that arises from the contact. For this purpose we create three objects of type -ConstraintMatrix. - -Beside the ConstitutiveLaw class there is another new class called Input. This -class allows us to read in an obstacle from a file. In our example the file -'obstacle_file.dat' containts data which describe an Chinese, Japanese or -Korean symbol for force or power. (See http://www.orientaloutpost.com/ : -"This word can be used for motivation - it -can also mean power/motion/propulsion/force. It can be anything -internal or external that keeps you going. This is the safest way to express -motivation in Chinese. If your audience is Japanese, please see the other entry -for motivation. This is a word in Japanese and Korean, but it means "motive -power" or "kinetic energy" (without the motivation meaning that you are -probably looking for)".) +ConstraintMatrix that describe the various constraints and that we will +combine as appropriate in each iteration. + +Compared to step-41, the programs has a few new classes: + +
      +
    • ConstitutiveLaw describes the plastic behavior of the + material + +
    • SphereObstacle describes a sphere that serves as the + obstacle that is pushed into the deformable, elastoplastic body. + Whether this or the next class is used to describe the obstacle is + determined from the input parameter file. + +
    • ChineseObstacle (and a helper class) is a class that + allows us to read in an obstacle from a file. In the example we + will show in the results section, this file will be + 'obstacle_file.dat' and will correspond to data that shows the + Chinese, Japanese or + Korean symbol for force or power (see http://www.orientaloutpost.com/ : + "This word can be used for motivation - it + can also mean power/motion/propulsion/force. It can be anything + internal or external that keeps you going. This is the safest way to express + motivation in Chinese. If your audience is Japanese, please see the other entry + for motivation. This is a word in Japanese and Korean, but it means "motive + power" or "kinetic energy" (without the motivation meaning that you are + probably looking for)"). In essence, we will pretend that we have a stamp + (i.e., a mask that corresponds to a flat bottomed obstacle with no pieces + of intermediate height) that we press into the body. The symbol in question + looks as follows (see also the picture at + the top of this section on how the end result looks like): + + +
    + diff --git a/deal.II/examples/step-42/doc/results.dox b/deal.II/examples/step-42/doc/results.dox index 11104ccc74..8ed6a6087c 100644 --- a/deal.II/examples/step-42/doc/results.dox +++ b/deal.II/examples/step-42/doc/results.dox @@ -347,7 +347,7 @@ Cycle 5: For each adaptive refinement cycle the iterations end if the active set doesn't change anymore and if the residual is accurate enough. In the tables -at the end of each cycle you find informations about computing time and the +at the end of each cycle you find information about computing time and the number of calls of different parts of the program like Assembling or calculating the residual. In the second cycle there are 12 calls for the residual function and only 10 calls for Solving or Assembling what means that two damping steps were @@ -359,7 +359,7 @@ we used a pure elastic solution). That worked out well for the ball but for the Chinese symbol as obstacle it turns out that an elastic start solution for each cycle results in fewer Newton iterations. -In every refinement step you can observe that the acitve set - the contact points - +In every refinement step you can observe that the active set - the contact points - are iterated out at first. After that the Newton method has only to struggle with the plasticity. For the finer meshes there is quadratic convergence not until the last 4 or 5 Newton iterations. @@ -367,22 +367,22 @@ last 4 or 5 Newton iterations.
    - @image html step-42-CellConstitutionColorbar.png + - @image html step-42-CellConstitutionBall2.png +   - @image html step-42-CellConstitutionLi2.png +
    The picture shows the adaptive refinement and as well how much a cell is -plastified druing the contact with the ball. Remember that we consider the +plastified during the contact with the ball. Remember that we consider the norm of the deviator part of the stress in each quadrature point to see if there is elastic or plastic behavior. In the middle of the top - where the mesh is finest - you can see the hollow caused by the ball. The blue @@ -399,7 +399,7 @@ Problems, preprint.

    Possibilities for extensions

    Extend the program from a static to a quasi-static problem, perhaps by choosing a -backward-euler-scheme for the time discretization (for theoretical results see Frohne: FEM-Simulation +backward-Euler-scheme for the time discretization (for theoretical results see Frohne: FEM-Simulation der Umformtechnik metallischer Oberflächen im Mikrokosmos, Ph.D. thesis, University of Siegen, Germany, 2011). @@ -415,4 +415,4 @@ between two bodies rises up the temperature in the deformable body and entails a change of some material parameters. It might be of interest to implement more accurate, problem-adapted error -estimators for contact as well as for the plasticity. \ No newline at end of file +estimators for contact as well as for the plasticity. diff --git a/deal.II/examples/step-42/doc/step-42-CellConstitution.png b/deal.II/examples/step-42/doc/step-42-CellConstitution.png deleted file mode 100644 index be03288e5b2839880c14a247b36f82785e2d78c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52558 zcmeFZgSj>1G>(lnMyaWe^Gif=UPs3F(j& zL^`CA&h7UapKmbKXQ7+|r)saIE5HDeSP$s46K8MWH3+URXybFqk;Gw zac$r`QP2N;v&>q3_65mqti{;}%+U>zvk$0KZq~C8xuFSEXCDl3ZLqTsh1UOXnExBk zX4!b@5(!D}4{0gg^CzLdzh+R?GlC0OA=-)r;{^!&cHXIwLLv`UO^0_TAh=30e+q(aWOK~FT{BqS&Z(b&ES8gpUTuxC@ss}p}H(9DNS04!n^&`)nNd# zzeIBP=aSee!@aPD7sS1wxL8RrV@#EF$O6AVE$>JLTidaVx}rs1`Dpo0XX5ZAV7Y@~ zNkybC^ZIaT0ja%DlY=Il+YsaG{?Z%#cRUpd>Q%eD59*`h66*VtxtZRyDi&m%H;SAb z9JLN{0WJvC1x|UJ}>X(e~jo=Kbd-lqsb_HU-sE@5M@%+>;e#Jg_7KesDawP;UW) zM)BYyNt594%t_~6xr%i9_(|6Y*X!*4U?P_bU?L;b^`>T0nh-tp39C{5g1hTfI`DD? zSBfN}&4-?Bo1vwE^aW0tcytC${~1#R$?aacdin7D6mRc+pO14*vt$L&rHw=mXPr1^ z#K4f4vFpI5m~9rI+7ttjl$1G#3qJ}JA9cL;Y#)I14*U!RJ2(IagMuA+LGr?uQ0dbi z%z318LkdYeh%yyKCkq(k?4BUD)tEad`6-jJA-ev|VToHJ?V8Hna)}P?Lgru)#j^#i zR%2e;%Ew!?(D{Chc}Gg|qrEzrXKrkm>-4Z9#P@9Fb;JiBh`h$I$RMJmF~tWlPX+Ze zhUN|#jO8``(-RjmZB1-}&5-Oq0|ptxa+TGfu^+4J*lD68Z}3}(t2wYnTiE5oemK!U zj9}nNfqP*VsM|}J_g$BplAKbPe%XOQ!ID9~AV0__)GMq;%1aDxLo2;9zDXS!=CqI2OJoIqn$`og}Zahpwvz9>Sm`XqV4e=)M!7p42k&>4vbms?8${{%mhzF0V($KT=BUR zTZQ9NuwpYysczma*@Dy09;7t=M5|#qTR?XpSpu9To+h>Yo{lKa6GL|0Y~L!dC2o!} z$2dzeF#vMdZHz>ML*PC;gz5!opuU!pCzTH5!zXs6+j_k9UxPX4ZF4f!EiG{Y&i{E3 zHU|wPC>}vmj|UYljIPaicCZVgaQ1(ykSnG`b(-bY4m{wS(Iq*yJsz4B>7FzZq6sM z{q4T3RzD=@Iq4U0u}m0n`IN5)?vshMexUWR-dGgp)A!wCxOLq|Fq~{rx9>Qfcv^EY z#K-P_w?H8-Rr1<~+Ie=i3o8Vbq)w-Kr9X{7RE%{oqg0)A;)_M5F7kluMVb>`zA$DH zdZf{A+vc*K8L(rJH$XRjiENHdURE1D23;^FdTqQg@g9t{JRzrfNpGbw^KX{)t)4oQ z%L#used^uti5=qrU{>HiPrdhq)U|I@TT*QM|EQu(9jKvLzprG{;l+0oAOtG#Y)Xa& zsG3RRs#}v+^^Q}I`^$*8%|%={vn99xgGHL*XFD0Qz?6i0_=%LCs+OE0xJ6T@{1!uB zDfVa)2NF6PsJR-IZh+i+T*Dy0zKXkV?BpBJ(3o9P#sR6$P9$QU#(%ar2Tf@Gv8*i+ z5!Zfd@|n~8_W<2}A4c-pNZny;@A1*w9bWhFNFs(t5yMV|%Y)QHgH6-~HJ)JX3%V7( zALBkRUNOr`CT@X|XxIG3)fnLOPl@ie6m^ zUYX)K1%#yS67h#xC%pTzX_EL^`>bQGyDJ*r`a3(I-OgL zEX3Xa2bgB-HD99zvg@soW;0VS*`mBCYCOAlmGcRc+*L0_YKPB{~*Q=wvnih^*dAR`ogZ&dpq5 z;*))}@cN0uJz8Lp6hwo(RcwL!*>vD~OqIHXdin>x6Z2GiF4X{?>WSu=BI!{Pa>=-xV zk*s|V=$R2G?4_!j1 zN{#w61C-N{cm+06Jd3`OPYwpvL%@j4y zfeftzKR}<{Jt9zfNVLOtWM-0Ss!~YFvL)T5Rc&-_tScJq^GTK~+I8VZ+*2yUI2=F1 z;B5%uHdY}vfw+g*9NCU<1i{Yc06w)W{p*`?zqcPS#!ov(5RW7F>^LqiK#zi=wc!ls zS6c!Q;cY|ILY5S-IK8uM^&yJ0zT2o{eD=m^>$&w(KP$yKLH#frxoR-WPfUL0(PdKJ z;d{??uSW$jCkvC1G!ThoOk#jY{G@TK58cUg+QtQX|Eg!pr>d9<4R=p1$oi7}b@lr7 z;|a8iEk)Qo-n`$r4$m^5_(YV_MS?L~5qdEqWtDo^rP240}Nl^b6 zUvS&|RRt^OUqS!U;t@Oog5<{&9Ax7I)w?UhVG%9*?DOw0#|LITjX&V%@1<#b`xZiU zt|8*GC|}Al(M4LIHu&COB0H!YyACI$ykN#-uOF5Dte?-qr9sKoXSYI%$-aB#F49RN z9t)w$^sh%*(5c4dSWe`m*s_HkPbqF(gCqfaMiMb06$+5EqS=`)zMLH?2HQjnz6xE; z8IbEnoE-l$Bo!|92|H4DRSj=QBZnoC{-W*jWeaoKQ=jN$vG>0PA|Q&H$iBjulBxb) zZ?0CwobvGXYGYk)lcZ?j@9ROlJ28zDhvxMu-V|YkhBEI4uWO(3&s{-mmPW^Gn5cOb zoq7Vi!WkI9e)8?S{z?D~amc$wa0_F~1c9mr3`s!IryWj3A9d0@sR-9UK!qirXPQ(a z4d`NPy9|r+akalP?VsyZ8LbyQYze3!iFq(;Fsf`|9-W(_9{fA%DX9ZNvX>KH2|0+JMv$_dCm5T!vZ;{^o)PjBZ+K_qSJ&KiLv(Ow0yk!x&x+e-?PJUKk58mk9@~8 zRl2I;+;-&?nsK8K>reKM|4o{P!6`DL>Av0%JM!BrkXvS5{1t~RN(d;H2+v&S5=U#P zh0Sv{-O?eh_0ri|Tf86ynPe@p4^|D^b+c-u3@ja8uCAzRaepghoq(`%l0Ca`{#56{xw4Z<7!~ zz?cZXsvXHxZ7*O@Tj6s<@e*P*WtA7skMq2@ZZy9()Nll|o#b~5vk9R5v;Td&X#X8) zd&km%Xp}*hRCsd{?c87w1_M?_Pqf|m{spLr@VT|?r)?}xlA98#J9&R1<@f_e=y|Ll z;_-Ey*n`mBB@A6UE6!&9ebg#F)7k?eV%*Tqne(9R)!Dw&jUNfV9?Pep@+Swn@&;wgL zyICxp!++-!|%lAby?)(~*Q}S~MNKS1sLvL+X~IPM(yMR8*U7Bx3J) zk}!cA!pAwQTr+oGXZ(UC;!ds_w&4}@^8A=JO0pm~^2>#1uIx6YtmIc&;)^5uc#XDt zBC?ZO8L2fvE+^ornVIXRVkST3`PyP~+sWtNwyGw4xx<=pG_n!8|IIL8*9;e0=TN!+ z=bN=>JMZMd51GLI^{kcCckQr_J)u`>A{ZA{08}@`Vqr7+q-OKbY^2S}pMt2icR%$t z4XowG`?03iLpu3%PSK za%slVgi{l%fcZ%R-tV+qyp`PxoWcI;XvM>kk|N`e_rACc6_wT>;g2_pK7L!TS@Emi z&Jwr#;l0$)TVSr8NtLu|b|u1sWaundPUWaiWz*PaP!-BHG$qpb*PQ2b6R~llRIH65 zF2`fBQ3^(m#pRck(|2k|CV-H;71Z0a_XgwY6=~0|f2s2Id>aP0@f(U^ZN$1-6uGAbg8DiK@bqqeCJ=8+{(D7 zr_RR4=2rXf$G_QDzm17Mp@WjWieA$ZtR+@;_tfi;hDs;E0lQeFe5|TQrRC(^S)EX#5R-<6uf91Dd#@#eJ5>eyLmZjTA z^%m15@*~PxhHRhtfVJZA1ToUdeqE}`xQZFkG4Y^U|QPSl#IFZ5&u ztyeGpkPmK&VI~}v5{}}~CwBXP{Ls5YCP90vX=`gO9WZVD|6%`+E#CFz&;a@~2(M!b ziy>76TE(xOt+oYdb_jO{)vsO);d|eD*sWd+BF#t}n}umlrTOlqBaz$ZAng;sS`j}K ztawMhFi?r)%sFVjt$~pC{@Yg?x?2>u-o&V{=&}61 zU@Ql~8K=_e&cKa#@82&CnOHL?=w)1MQMxvqi6)e(bcdY#a8P|T%-UAV-1 zR{tP}oZFX2qBJ`{XaC17^4vviMwu#)kk<#k^;Ajq@H+Zr$hkiJiy=h*akLt*9y)Oq zuUP4#hw+g|^V9G=2>9DeE>t=rt<;I!-ov&4{vtit`{gZU3B_#o&G%7nwo>Jz-(P|M zmRM91O}^)ZffH;JeL8~v6R??m@%FW+N6}&#kDx55CoiBb@XSY5_DspF~fdEXX+JgzV+u zcldkv`Ln$H!(dcK{1H-i#~}FZJ$yB7@??h?A;~{^LRx}<=d8ZLpGhGL7Y8Hs0JUd^ zm#2Fem^reG6|HpHD!iCOT*i$4xhFa%uQ<#Fi~81YTig?Y^>|r;Lz&Xqn0Ykdyi!fy z?qmW?Rg=do4HQ`WjyiBl_^$o}?ss{6oA56V%`RczR_^dSaZ)+tDEMEjH2~Meu`dr( zM6K&xN6U$K?=k>xE9Cd1%C+)Nk!;DTMQDIZr_%no7qB#24xM#1Lr zdzCn0>-yS{AJ>{_Rg5x9s%ByoHfjfOh1mMF_C$X4cE%)Af~DV|-FJz%mIn&-E8YI! z4_Z}}59bom$G;~Bd#n#TOdNZ&*8*Bjzr#6$_bPJk>e0QBoryBMB{vT)BUQ$I0t6+K z?eCNRv(FE=7gyfa|9kEp)yA)K*uGNo?G`#<*vtvx*~T?<+^XwUoTb9rwtUawUZy~~)ondmf*rSHZkdG-yg$r&z!TwX_ zSYdKZh4Iu!+86L51ga}~m5*OXaxf$~Wd|(iSRdW_%J1&(PB>XqAuMFL$Fy-pvU?t{ zRpxm7xagQe*j*XX&sMCit`3;}@tj-2^;cP%q*EXZ^l>lDGbEV^EiqS1400lA5b_=~ z&0u@K#-~fsrz>;qiSD@5J>YgRZ4N1xzP(EO;YzVlAl?VhUYe}>_v4bvzi9oxh->Z> ziVht~0JT-0+m+(*M_P$|X--wAd%s(sU*hL>%JLb`l=B)q@CBHDdbDf)&G%!}=gP_r z5WccAdfl@cld4gCBUjo>&!rKGGB*h3gOOyBMHZ+WE|9Q?%wQZ^ux&KZXc>n#4?GSh z)e!P2IJVoLnmYW^3h=ms-Tdud74-UeHTPDe%E`23&fzmW{>LTv6Qad( z$0=^LU3AKvmb0Z^gw7xSx3TQ(LT#y7)Hxoyiy(*bPzrf+%|&}M{V?QoBK=l!m2~b! z_^-Fvs_`NUiC%IB8MbG?%aG-_BTlK&#jj{cTi9F|WvIE5cbsUW#-&g zrzj50bz{za@@SY^W;_>17++N0pNSQXY0Cj-YgHGxwDJ4*@1eP{Cp7YHlNU;jy|8yq zUCtDWHp>|URPZ+W{XEia3)DX;R=UaDKWL7W1?Wr5ON}lGNI~*qp~8b_PspC1TZ4}g zIG~;I#)Zw}{iFl;5lcsI9#cB5f|Qd_>)*Zj_udL{3S?yYO&kJbI9WvF7w;AsI|Ml@ zg`J*mpwYi_e10L^XI~s~uH79r z|ImB{7DQ+f4W0JX3<^4iz}d@uR)*2Xm1skE4D-GPvcT!0O6bYQ%84u7et&#M{{DPx zNpsk)A1dL$X+tl!QM(-q5ct^r_?3y(((lUB`SUBoAAbXWq(0X`N^3;TmIR|>$qZOX zTizyu^njjB$W~&`v)Y{h-!{`0p$QrGtqV}wEErF4!$QI%IQIS+-8tha{%pgkHeJf{ z=cHRj$fyjc|DM*UA4*FyQpJ;yBuU?qNMm15Bt;GguP$-iVYj=w{o2?U5DN8;3$g$Z zgAmEjJ=+?GJD7<@#IebF&JpeS$B&ysmew9;7W@4PoG{0)LZ85V)tEi>U|J*+V4yAV zfsMa^{|*%N0{*^?TLT8F|6I7q6@bJD2oALY+kl$@hbH_PmkQkZOE}CS+|Ka>({1-C zxX-mESRXX93f$&t(b$!XR(L`FKT;UYd$jM(g$fs4UI%)4*1-VJ}FZhDfQQeb2+7v!sL+M}gc*$NpUu?G)o6m464> zAiOmVwvaOr+xv9|>o)!hc5gEH zCI9cpuU`*Tu7f{-l@N9cR6>ZBq(?Lhz}W&ig)3_TtebyzttNnk2S>o?=jWTdRXczL z@gj?MlJ#h)v}PPg`#z-F>8K4^qY6mzAbxejy28+es-7ICzaL*@T={K*bW_1ib3QLq zCta8t_sA`2-CH=A#OLLsyULi~Tp-1lc_We2?_7bTbJhzWp}M(|dw||p;QYO}k#p+r zh~+rvG^E{ddH8~|*h6v!u|#j=_Ycq8QGKZrB5$z4#(;*YjU{vE{ct z3@J@ikkPH)H;geaUeN5nt?^mma9P6&FqAkI{J|f; zNx&8LW83=kbckqY?bR(kdAjZw`|Mne_tG2XU_dALmQD$PI!NFG|7Yt~_VPA+Z09qT zZ7!Cjx#LeCLGKHjn|AGBQFtb#7*km!3~zw^UQ8AwjXh4Ojwxn+tWU?3VxbihWs%)L z$a`tS7dCrA`MXp&*%D@!9jo|(VJ85f)-S<=%>KHdeZW|ij{d$Ctv{Fn$!KD`vro|p zF-U>zrE@Mb0RS}MlLXGv%89^E>`w^rG?GfSH?k)f57fy;ga@g_8cT(;8ns8Tys*h;A=b`MD?FCH@>xU`aoYzXWyV%He;6g+2wA7zI3%p!!y<7V+Rkm0qCh}E- z)U`|a%ma<%YznA{6TA9?whn)>1g(2IvV68`#3KxYUbMIKKNe6b8t3xBVKNtl#Hw>` z07p3fFX|WF213g>|9|&)uSq8Z$SFMMT96&M47d(AH=q@U8QEz3VWTGzu>lb@E3?5y zDeev$zIf8htCL(96MZ>OQDU9C*$3R(q~BynBuC)i=4i$nbHK|*Bv|_%a(}I?{Otu% z`oeRamoS8c9MM2g>kRvd&-<)poQ2Bg6`cm&9R9h{%t?JFC-9hth{frB;Yl2RihWMH zlaltCSrhp$<|%eEC-M|3Tj0fA&P1W?siva!?DoXWu<2jJd%!g(?UD06J>8Va8U=nU?| zO~1Op-K`yKQ(WjNkPHq%O0-tJm<{k@JM#*z{s|HL0Q0-??#mY+fRf3r)l2yq^}8S4 z&2GJ#QtsR?QZ+t{TP=&w{)^P$R1%LofMOuemMS&&ZMn2FJz_5avKP$dYPefI$S3O= zN4qMBy3rUWb(L*-gEWQTU;Bt0rJ-!ix3%J+}8TWMnVMOtuk%IrP9^n4H%qA9G+(c~#c8YYlve028Ykl9(pPvBw z1LnFy*wH7Ow02_?iR#$;mLZx`7sbaGe>R39uIA ztVX{oK&E~;05~4VTZ9X=ALkJH+f_jJh!qx5n(QOb&#iyndfxD!#Cqno2 zU>OrW3wd(Sa=Mq!CBKIY7Ev(J;s@XtwdWecvk}~k;SDO!(rB~)jy`H0)z|SyW68V@ zENOHZmFy)Lxk|cHgf~w>MPbft70I*&;?y2)@WgKMMUV!<5{GmE3cu`>z5Q5rjX*c4@ z)q=3vitrl;n$smVHpi}1@!*5aGQ+y9j;kPjeEA_QN5Y{aRosp{hxZwJ5om@}jZ~sc z30F(1?vH(TUg&WL+7C#ggt!5V{(K}OGoM0LY+hLcRDz6aj~Eibw>to2_ctm4ul!`! zN|ddZTh9YMr@Qo=8BvQLf5p#w!Dlc;xbvyDffO=p2@{FFRpnIF$tS4FZlIRdC0iJ! zy9`t8GSxo)5}rqz?nK9N?ZPdyrks7<@U8(YDBxRAW4)1Hzy!X5=vDe{U0(Xy#G}eT zCDjY*^p|fI%I)Ppza)d-AmH7-ytc2F*1oAfT=&BTt$i6e>OCAbcL&?|a1pO&yd`Vf z|4z$M6)Qg!7rOH{!@d4+t#Xnj0Suy>qx{Fv4AidLX3fAMc`W6neCWL%NmF;YkU^`o zW8f7Dfcwkm&*R<$ddohia*LVUvz&xqh9BZXIldFK1(4$BzJ6_sKRE;mQ}Pjh15G$K zbISSx0FS;J@Hij7H{j@^+JIZ|>!u>Pl>&DjxVhDzY;|^jr2$%G-9q|9uqMvk16Z9J%I`CU~GGGGb)vR-Wld)+CZ`OwWoWn1(K`z@R1_=T9Df z+F=#L#j(F}k~V7q_O(qz?lGVAARgG)zZswc1^)w7-RV?svOeS(q?AP_rNk6k6n)sa zHQ$NeEwX+D#HvSs05M#z+qY6e?FND5Jo5a-H}{5P+kgd}01EmETszR5{ZDsC08u_9 zQm#ieKzMfQ$s}^>fF9xjE}4M=CW=aGT!7NF+)89~tsFtC%7F5D%>Ed$Mu+@-bE5`B zsNL>)_~_BD-(5|W11TM@`kg${(@xw;=h5y8h=(4#sURvG@0Oz1oRyGri%|1Qx4Nk? zDu6Miq2oX%I7iLq4H7`N(Q*f%s}YqaVB$CC+WB+Xr5?ne8bxnZoX4@*6LniplZ5&w zaQ36I-&c=+0bxivq@j-5c53)e3*>Icr{Y}hA-FTJKnk@v>w8n*9ul^~u?prqR(fJv zYP_Inq4cQ@$1VBzkHE+#fSZBHTohtkZRtBY4-)T#IKlyK5NjYkkhV|5DH!u_Wz~Rf zHXs7`R*8h`*#&X#GPvrD1v1X*aLpZk+zn)(rGgxq-?kt*{|3xU;|2Q?UdR^eHvwc< z8NiSi790t9u=xy0r=ICZ&h^QphoG&8$lAcuAf@*mTAs86fB{Z92)Fm8^hWlT?hxY> zlP9{wT0%WTB=qHVkzADw=CR8?q4HvE@wrdK)(0rtAgvJ8G~Oy((b-6Klpw z_mu;yK17w;SYs3Z6at~X%Ngj1J#veyKs)=C z&HKFv;C&j-kMHk~@83K3<*EXWY|q48AYc*Nu~Ldt2G*E!GRF_p{Xk-( z4Auw|)U42>r4*~c_vzmg9*X1|fzwJN#zAY|c9^%oR8EC(*1%UucY#!Y;U|H~?HKEv zW&&5yx$t}T{EcO&mdmileu!|>4=nyvauspm+Cs0rD%pOKQ_wvEFQ}#GY7<4rdNwvb z(3+xgAP5Qsc0MWC8{6NkA1|GwPm`>RJm`n$E6Ak0!8C~D91;T-8uSWXq7~?$4pI5{ zLnLWZK}8YU$r!G6ty_7R%i}G)RcCHYS?pihWl?QVf4dtA%y=tr1vW_cC!{b(OC%S~ zME{CPfGD9?mgBF5?|rZ3RewAl{((hys`mrq>voTSjba`JqfQfu+_p6GPka2J0C#2{ zireJl16Y92yU)|8qUfnjhlPsQ?oxRAxQ|>+8TxML5*VKY#H|b1r2E#jVsSsPF9XX_ z3zGB_?wl9)ugzo=+c7>siMVvN42S7V#bGQ^!uoyXu7x2iekFD1R`>-AugZP25Ku*5 zS!fLZ#0DSR-{;Ig2DY8#h1^;rot?NjK0pbYACide8FN>QH*D;uQJ|M>waWGN%l&ak zAa#Dy05^GB)KGLE9?tl1UM+f5whxEPa&Xc)ZYX{edBT7-txVYJ0{vbFw}>%X^f-_# z**mu^fGlQxo~6q1_2T>^2o(#`V0?)p5KV}zb(n}2o9~EVX+O95f>k?>#x#&@;g7Od zk>oKWbw8-05UZPQDV_2W*dE0eit;JCy+$t|@jdUP$H187>6cx{^oO7MLtOh5s~R% zfHnn-`s2woaO54t{->?^Y*4C@_|$|z&!AvV7^oK;oFkrHscALlO+UoLyhm*F z@iEr6?i?6uezMwG&E4YxRZjZ{GF$W8%;n3M>C9~2yw?Ne=LOk{297Ckb6VK)J9HBRYYukkUxW!hT)<7)bzoait7W`U)c>4)g<#y z_?huz@`JeDV8PpxR69n{8@T6{Ciri)D?L7ZYN4bDinpv#g~Td3GqE5j2MTe2KZS&i zl7W7`-BDe*kOzjT{0cUN@xAK%X0|mQBY%6)k&73zSRn8h1?eZ#$XfB@Ucq>LwEvQW^yO_-0y_2y z0g-I)NMH2>C<9?8uznoKB0wCmNH~VX!_SsYY!$QuH zSX6jQE>O+w!~!~A+_LS5QqhK89V-8;^BIL&LrVYcwK+}8b^{MsGhWc4YZAAmGKJYKn$vjmR2!q&+iunMR%*dsKSoW&XKOw+iEFjMT4Re**AI znh1QJN!B8{evH=gbStLxpsy3GT_v*a<6ZVx*wzDm3}tyM3Li2P>W-i2-T>ZoV8T7f z{+n8MeM9A%u{@n0flTtUMai8pW=2aEbtF;%^hg>c62V^sM2tWua3ABe!JtfpU36tg z0GPcZdRN}27uK9=jJ&W7REI_%-AB6h-d4LMB1A~rvpnm4zv5aIq52jMI zf}nRWF*=(HF~#to7LF`rGzV*^P^cgIxQeR$)Iq=Ue3@KRG9+z;aIC-1k>0E%xrCZ% zgJIH%4SI4{Bv_+@a(n1O(N}8`8lw$Y1WgQDsx|{yT|RQnemX2B*Cqj%zoUh9Dng^Z zl%U5%FDfdZ^TyBEVgLIZ?B|K-AcEc00``zKa8bJ}7MFR{L z95-63a_kaal-CVR9bEO-?ZzE!jHmOtgxq^PtCj8>qPg}HzeLN=egEXhwSL%Cawq$U zP*u=9+odKS&+iGzvf-7e^tY zfr{t)pGmG{Q2piP4VJr(29(KVUJb-Zd4w1(tqvvV88&4kYxd7uom>V8hW^>`Hr|xu z5v=Lj;fkuF#-Y9gO#$Q1rf5?-tUaFsGzvdvKU`FL1Tqg$^g-!?#&}F^5*KS3`n?xq zRGf{@T0Zv;#3S2mD$N*Kp9Wh8V^0r>E0Jq+o0+Tb=W0~IQS0-kEO_w`AxYV-=`iP; zZOnj7?kgh^#Ll1pI+Tt?DoulFj0&p(=T3MSIEI25lHKpC5(4j8g)}8UqS#+TJv2Fm z=t=KujT(!s8i@?Rlm7YT+;>X{&2#Nipt<#>lruQ$GyB`>?-RS7 zX+kYEpFs8Z<8t!J>xL@B9HSfn$9FgtTc9sG84qxub^t~sG@h5KE;{6hT-VWjXBIBu z`|UfI{(D+d4rQ(2pO_0vs4$TbUh4{E2^3JE-$g*G20ifqaUjtTR><#26&&aQd#jv! z3R7=ZV%s#Kt`ah}5na%)(0m>8uzctB*T^FZ9udm;%@jg(6AVH5Aln-i0Zs2@BjYuz zKo0ZXZx4R9Ry}>6MY`+cGbIG8@IR-sqZrnf2T|PWfxYu$z{Zdc!v9D-9)GWYO_cqe zMA$;albuGgK=c9!ceG1jEt=MXvqFqYei_T zlQ{I>5cJ?79Eb^$=}gPs4YlgyFsh_7ksZ9=eT03CS983^k-<>cF7hR>s2THv15!j> zneUT5)?IAk;dZKEyd#*dlF6iadoe4!`Q>Cf`8!gP|MuhnidBWbri<40z-B*Kp`KAd zQP5QlNcx)}DqK&TS}pVo6ed zgr>bCP5$S^*U4?)nfH?WAGMJp=(+8?yo3Ug@4pPLarknS5PPAfNUn0>(kNgY2}stz zBj~I&nyOwQQ+eB01ey%Kon-Gnl$MT=s<=Z^8JJu5w{Ba$mtSliuOc3dGMO<=F%)+N zZ>kd*pUWOQQ*gdHmN9#mDHy*}4tsIj>X5CneGPuMh7V}|XVdx=?NF1T{%8$*BUQ2u zkkrg9U5_r!hPDB7bWIm)^3jFkNR85zry02%|$9iR` z3+h+x%e!NLaUmrw(@gm4Wze7Rg4hN3no<@BF`T-DpE;%~?7f1#0Ek!g3QTb_s;LY5 zXUf1=h}~cp%BQo23audFspKHL=!@FPQ9R{qrJDcq1m#X?jsd#3BX|6e6t>~|>c$(% z>TuJm2nlu@bNS6z6)Ugj!!KqJcyfWZQ!A3f+h>-PVu1>dAcYCtL~?;Be!KV-#(o`J z-};dyVP0pCb)^g18?m#PMjP<3MI&?fvt6Z{M=a?Khv{S5uwu1v=vGAY0DLt=7rTUU zfIwrLulwy&<<*9Feu~!Ec+q=jYb?BW#QU>#WzPWQzpq(@{W?UifHYzr+F#v_;b*0@ zmZGcX!2(j+<=rsX4(ob&=mnv_=rKINAT?;zbVFKOSMtJ(Z-Seig1u=g`I%c0AZnz+ z{6o$7dT%FC(U~?c-%FWHht24aZB>QyAT(2i5rszVbpDroGHCuM`I`mzD;Nlnqh)ZYb6=YlAJym{gSzHlO*{#+5*!M;gF8{^}gJ)0=a2q z2BR|@`ekwrA>f*ivN-y&EQ|zo=(9H==D5v7kV|i{Rn?f89F3`qb+O{v1b?okSgSjn z-tsn9jX6}BPEyDppP~PuLzlL`?5odB!}mD;OR&QQ>XBS=CGf;jk)CvI!I%#ZlrDIEY$ ziuIC@FJ8*6nuj{hqP(tQqY5ctfo2e9YO+06I(i>}(>m0DUX}^>zRFbDzMLK6QV&-( zJu*PihP8cw6KY<8B3NTGj})_*9&$C_HAOfIxH>Qe4|l=tQJxz&4HFm6T%X3+d}Q)*^uo9)6uH55-pJWAf9Po_%}ZyuHfzZv=6nHP91+7C?#vNv6N7 zZ&hQeptb#FOOd}<4%V;C$Q~K5SRCz3A;~PN9Fuj19!Mc+K*W*1kD?)k&@xV%! zZ|8y&=r1ON$eS5p8!?fQM{lt`uV^0GjWkRbIdzGuc2n)d%RV-o!e-z8oR@<(wZ_0*fZDuV=P)Sk6Rxh_BALSmg0$zx*Ij5f=I_`8%F==FsYWlQR@w)T}gq%Fr@MGxw?4W+;#J-WOdF|KNfq3*Sp8 z)0|u2&B_~Ztbls(tOTKHC~I?#W@o#Lu&;Zy%n+gq+OzQQ$!sgd{qU_iTpwNsb$V~e zS_d3p>u$Vr7&Smk(Z$LKH#A+}l>zS#v{dxYza>3alJI1rf!=*8RmCi$sabThiH+C4 z$2pndAgoPl4l=<1NL42B@_LP?RC2jBFogFkE9R5s>t@N$#hvRY8NVvNHykQ#oK z(=~iXw=bYmPgmt+lhrcMX~|GIg$o-X6OxIay0S+#FTc}m=e?FANPMjh@11Mw1OS~w zJPxE239cNfVOL19Xqx4X5zN=(8YCa0Ldrz7au?~(dfOlal)jnjNbc^63}}H^>f4ZG zGKjQv11?Us)J=ACyeB($yC$~O#isu+|Bllu*a5X{fLVuI1O-jfGZyll%sx-a>=2luDSxDoHD{E4aeHiSeC2xtv2vdA+Ez*1_l}2FRRrg>nG{n;P(qO&f zh62RkEOD?3?S=`#wNJ(%6+baYHfGOIEf5z37IfbgLU7tFpsU>%ywD+2Zb!uZ!6BUg zQOzR9Lnfuy$PXTv4}6+ARIWH|fP#^J@V^}&?yYgV=SKmg0}%8yraEJcP41R)V>;_m zT)7OJ=C~emc;4cL1n2fM5knU5XLoZhTQ?TCZf&T%4v{hBD55wJO&Yk%&>5tMtxAb1 z3S^Z|dijOJf7y_b)9J>4dibh#gAA3BssY}%MGa9kKW84ieR@=CE`|H4qP^d@gkjrW zQHH)4Ve{|d8+y=ZEt^|tfRfjk6^@HAKFD|)yjB;<`O92b|H7}A$YkuI+dV1w<4695 zi-^bNQR1tW{Llp%(p&XBWieJd2B8}&+RtuKTGUXeTZtsT?fENlGnvqAp`Ex7Z>H;}|olMT;HS1M8^L!MnwBHuBtxUQ=0D39cBiY)EV zxMv;|$5#D=k^KQsHU=??bqGpbmxuOEYQ2=PF19yPu0`TWEo-jCwDnVPs@M&XjdZ>j zvQcd{MNs;)KmPkrRC(pJpM9+Ez%>XIRQ%lnON4r|Lq}cv! z_PnAc-#3*^<)18UpQV;N2J(?0Lte}O?gc;z_q~FCGQMii0$r{++Pq`_*6FSqYmF~b zf{pI&=pCh^swnBlP_QQXcS)K zicxW&?~agGjDBy`pbpUX)rEKcJM49opCR_Krb)yX*xDP!>wOINtrUnK| zfg|_3nHl8E5SQ{de%o^i478%L7nc{aXu^lw?ENXY5af6MdFSekh=_cnCnJ%53UYZD zgY+TFn+PB4&hj``nr9w1i##WqAFg7TB_5>VHi>r1G5Ek*-G~cQK-SPDVFV}B*HYVF z&A-|kq#BYfFZ1Nf`BlKX5|Ly*8e#!6BzmW^HlL&1GjaZHhQu@rA-nyWv0HDs72{ApzcR)>ul53nCq1 z+8lAS=PmddG{u&DH;Lx&vHOEm(|^t|l4YVKH^{f`;5zP|Td`=p)d)!$gX}t5bz5(~ zBMm&laBQxupSwc8S!~ui$Jt`T`&(x>5P2Y8DZXQ&04Gyw} z>F9IKn()Cw{48l)>QK%7UqIC~fI;`XQJk_TQD)rzHTP4ao`JMLUn)0ra0xXKJ`p(Z zij*U##{Y5gG6t0`&nk%^XCDhV&hQf zeCKpu{;valz~b}ER~aa!yz_7*2605yhBexH#ObPod@d!N0UXMweh32omkCvO!fMyR zxtDF-{RGsgSM)f*bt!JVB)f5kpp6~H)?AhLYtV)7xQ2n3#NOT9<#1_?P(c_>9?%*& zH|~Y>gx(_(|H&v#uwoM$f5mmu^sf9TwkJUEJeW{coy2A)%WYcl0&V``LE`fu%XB1} z75DJn@x07C^Z`bYxcF!MG=;JNu9b;mhsgczZPD%S1C50jqdAF>Yv^jkX8iLpGW|m2dU&;ONBL zW*LtrL!o%N{WMs12*W$lgvfWIQ-19K@{6bSgPHwcJ12hn@Rv%OkhrNrR}aiEcxB=2 zW%l^DQrjm~RcYWQ^0mCL%KdVgG_x1eGOjWm!D|5F2pWJWAoOLIgT`I zj$gF=VeZ^E@>ROU)CIVa3j@|blw|NKQBE>R*T&bnFMyX5yi4(+rz3TP!w;5zEM81& zy#fbNyL`FqLFmidB{kSKY1p8ql{{#ywunQi=l3WLj}Isg6~0~HPU1*4l0w$AH(OXE z&CFDdyOv1Of&er4!%v@ThMJt6_?eR;y7X!a2a`m^XBO@A;!`V9sq%0!$JkFyi8Pwo zw0BJ94aSy9R9XWe!-8Zk#NWNZ^gZt-u1pKQu&H~|@8_M?FQlYYWKbNfVxOVHl;Bf8 zGj0!{G{k6bs})GYj8M58kCw;nPXAEec$fF6uyc%T*$5P0JTPoAE0rs9H%RgKu^^az z)`e>ddVIoYlRcA<^@I9t6AsfF@mCGRjf;IrqObPP`c8>1s5zI+c;cJ4F5P3@L&6l* z4rfU|zK%5%*+k<4x&Awv3f!V7VE!w!e1$D4_|k?`jxpWW3ZVF_hCY1gu4Jytp3E#Z z04c~gkA4Hr^vmb!?1BxCq7>0lmDTQ(_|m$?Lq9Pp%H~7s_xDosAbalxLXU8;ec7)5 zSAE>&B@^hc_HUc-i`dJ(EB|vKS*xAL!4s!Z_(m4>@b6e&e4mV2q>HXhjn#H^JxrNU9YmSOAjiSX9 zi+JJ}u23X13z*Bt-(@%W4wTdWmXB5>sOQ8!f@k1YbaSA8&6^%FrZ7F!=p{2mT;A8toOf%YhLeZS>rhY_*-nB$b zX-umA2M-*QK5)Ly2_4H3&?n`)E-1MOup3zZ+xZ2g3ifZzE+0@R(EJe4*f#Bl zB)mK2vJTn+i6~7p{{%ffTHfZX-KOZ5$MXTAQEh`utugL;kh%_=sYgYB076w?du{c~ zparr(U`oi9kDXe8vK--}fXr@h`oc|x$2BQ?GD5<+g>!!b5V;X2!K#0@znY(qMUhIi z;-MsG-e7cRG@tq4y~h`hwEY!ak2qVr>;R>ZNlK41EVP>no))s@BR|zkf8Xb7QjfRI z;mgyz+*8)?%6tOdDcBq{?3}-q88lQy#tmTC)-JqA<>mf(^{LsgwbTG4MAFGStsD>@ zrA}b5K2w{Q9lw-Z$Y+Fz&ye^qI{=^3p!TnAF)shv>1mmWr~Tg5$xT=R@hI29>czSo z53Xk4o>e;+(+-0v>U`IKJqw&8T6*jkD5pBzA6!yv`C2bY<6R7Wu@Y?Mk34;2j zp(QI!3}hrod-xZkR>SuglC3hBPDrL6VYlP!NfO zA|P=Hl9Ni#Ij12D2&f=ANlt=*ARv+jCFdkrG6+h}cg_2L-~XPvb#L8Mhbk#c3-+G9 z*Xq^%>+Yu&o4sr8MbK_+P@l|Zu}b$dfsJ0y3tp0rNSKyM$m9KnGy};_=(8$bY=woO zM+$!ggw-z1s4!0NVu7;8venfCIJ!?V(x96r1-{7r2T z<)~~-Xru0|GP}vK`0Q19!fhAs1E-{~I^yL}kP}#Hee_V0pL02;XI=St7LTyc3E+JC zR3sj!xxCq8Y=2zB`K4wUJiAi^%p0M6Ha{_PC^yzE1i6tW2mm4(?9H+XVW z4GSrYgdiZ?ZypVUeJuL)XSf1YgnN;>f%U8!hMU=F4PrqS7J5{gghc60Sq;abG1m=I zWM4zz?~ig#!sE>6X*@NxM;^Pv3yTj1ol}t44`B?^tL}9`<)b9vBD*PNml#>oze#@_ zR~rQ9;h~2cm<(R9l_H=iNqs<$EBe;;QF*>7Vn_;W67$HWR>aCNE5cx!N?^)>6=${d ze81u6gF0R>F7%TLM4n&RZ>e(Rt6q08QwvB*U;x`J0bXX~cOg}g9s=OX|Hjwrlka{< zgO@&J{v+7?1#=;}mjyRy#2mPi-%=wcP{q5E^vCkdt>sc5UyFsldsiRufqY8f&Pb+B zoS-vI#_TE6g!PZvhjn|2>dTEm&%4e# z5Ahi*!kd)%pNeC7zIz_=Jd>leR6vjELpYzRKOR0bh!%qe(gWO&$^`yZ zY)6iRm&8dZ_I~Y#*ZL|nz?sl^X`GftsY~by9-Y!wDJ#8G7ANYj zTaYM|;3^r`Atr%Zq81+AQko!>fjVT;n&-E-)p`q8_W4zYw}uglbMGPj2UnGMbHa-+ zW8}g?h$~bb1kQKkuV&YuZAnGHj)7JD?ep&S;a$Ge3CU6`CMwtX3cMqmvk;qvg@9}+ zE^Q8`JNOSF)F3IJQ0ak;d$9a&BuRu`;iqV}9Y`_Lq592n6op= zS~d)kJkU`3Bm7v!c_PGhgYNM_3WJeoHZ(YCnid2}$C3`8uG5!9zDsKtKcp>j`Fdw4 z=(%-5@(4QYrEvE^ZM~eXIa&$0Hxo^N^I&6#vhPZN8PTKqIc~GZ?!&Q0LBa&^zBVG1 zL5klca3K9!_l3I}N2TBQD=|U=iiqx8sEPyD#^69{O5#XIkESU{ei;wYl$@PPnD^C0 zZ%|MK6kpsTP3@tOy_%6a)?MCvR;q7#DAL^Pz8GUT;Aq_W7V&E|v^f~`s7k*MEXR9R zg)9Iv$SC_i*G(ZxL5LoFdS~q~_sTGr7E+_UH6_uQ7088-usi{{)md0d`9gsfpSZ@O^(87fCy!CQqj3J~k6+QDsjs51MRB!|+Wqv)#2FT{9le znjo(^E#_`ipSU5pE)}KQ2{#T;ODzG0DJzTP)vB^yb5Du6A`bO}~Cf>UV&?JHDQw zW)_I0{im!(sVsMNtM3OqmjTs4Aa>EYGBKHv!y$2LXXPd2(qj~ zR!v{I^usySTp`aSq5qnDl_w*GD#!F%%Pl*E=Y0&!cdp!8=BWss-ha` zK-=IX6I3e-05v+jxzAM$P`6)$#(z{`lyxxIIhqpq$Zv_dhTlEKt!|1ps(0VPyZZ$>%y@BMy@qMDuTK{0+Fno*unbGxsZ1kG1v=&`l7h1 z2&fOa4BKC06ta+nFG+z;LrY1FwA2}SIszG|Erb6zeHKr6ju-;8#h)-QsvtLG5Omn|SIs$fYIEP78WM!c}a$W%r#H3jFj zM(w14p6dG%^p{-7OIjt%&t*s&P+j1RQ5!Zq1CAmev-f#06x~P2 zTp_htbguu7n0V`#C7H-eCe*^6$knam?n9_cek!4vm&lu^=rH zW20MXWt^M;J@A*e)`(0GqQME7F;X_L>vtjZY$(Wq;-=EVt@FxND88zLh~YtCadHoZ zj}PglXbY$k=wN(hP*tJ~SNfm z!&4g^nZwf`kT~BeEO)zK(f)S{QI6YzKLzE)sF@XboKj%b_mIKk@}n|9gY;U$>gj;= zFzQY=UVbU044qY5)%h+!U#Uh_q}3X@WNU6fkJ5ETi>1qAWjkQpn;gZbqVZ1^a=v}r zD5S*xy)i!uN+RnU&}SDwnSt3rt= zBCBF(QZtg6lq`uf3x~4JmLM;Sma(3OEa(Zf7{&mh>|*y6cwbXoA&y}p9M zW-53t8vS2kob%tP0W-;@M-Z`K@AqKHle9<;i1DN2XPr2Eqnu#<5qJe?92*mPJ&R)t+Kh-xm&uR1V$fr?20?5@p=OpP)ek@ zG7QO277bd3db=9N{YRf5=kz{pxv$^s^=t_!SyhbY_F#!(rQ|CwHAa?@v zKVBK-yRMm`j*E?!;o6-n$)3L%6D$3zVK3-%AkTPU>L zP8$k3J)2d2^7ozH>xW4+1XV9)f`JoxerQ7dSt2Jw5gX(&B*`!dHlqgX0=rcmWwH2q zm+-TPW0{B(YFd^X3I*wJ;T`qHK}=Xhf|%D!<=iEGN^IKuEb}XOB0Rb0Z?P5feRx*` zW6s)n3l!~4&1;`YpTUfYW@SOTp(l2u~4Ey+Up#xx6aMBdnk$m)j%mEpK{R>R@@i)U7Uku4hs#n#Bqe#oOpIO61{ha;fxT= z9pf4P$hW(MAFhGC(ml0vQCfjC=tSbFLz@B$NfWK&Czq2FC*xEdZT=*O65xu(eJWJNpSjnVY17%tOE3fuB zmi$eBc=?yLiDzv9B$B=)o${2;%YVv)ncK4Jw!p75?#F5|D*o;6w8hv*zJH>^70D~- zW@5o`Z%}8HHFgKbbuI2eMNfte*6y4$lCFSqy$uovGObVPvWsQB7VyQH!{dBeedd1o z>N9}4(YM)!m}IPe!C`uXSLNC_7Bi{fZBf=%x^({ao2A#pW6}vAIkJ07-8a)|CwcRm zW(cXL)I(tLKpZ)m6V%ud*z)?NZg5*@RH5CoV^pyl(_ek_Xc)o5OV~l2d*mVf-!O>v zX-NSLP(oi&z1!*!gbhsH^SnA5^8I0r1MxMksqyyE{N;8G^c;z}$a@10sSRFxiEB;S z%~@i{x}Wx*^#~Ofwe>R+Sbbc2vi-T#TiI}E2`H{EFyuCIt5YpL2&CVj%tC}xB065dY;vVc9%JE1D_Exy z!nZ&OfZ;eQmfMXGfTwXlH1u?_1$6JZH)9nFf=0v8?xD|oRwOaFqb$$?Z}9E9--5$b zXao}1@|a*p@)SC?#;l7i!jHOU+YBsmLwc0Sto!~H?@2oN8w$lwr7lRaH4lLF&`=e0 zyMeOsB*1u0)6ln3J-`O^Lcl!bbZlXawNJGJKDT2=P+ z(WyB9rDRE!eIV&@2v&KV7)T4750Qn;0>Ro=Ph`|&-$d`q{Dy=UD8HDV&!b{ia19qY ztElryy2}%zibnv%KV!ezCVkv*DS7yO&Pe-F8J1OD{uZ&Yf91|i)SEU)BUs}#%F*}B z7lM`UM@A~*ZO1_NHiMKH-LuTakRZcU`5Y3rDBo+7abNj;D$cv~Lfw`&J0xlS*)mwS z2h*WvN&`U>+iEqHID{@@fv;VR`Ujf_O;?jRax|XeC3piJ?cP1nF+$S+B)UqTumP7O zoUj2RQ)Z2mv4M=!NMGRP$P;G;eeT^2BEtys-kUbEF>|H947zyXmy03#3!e<1BfV;b^3P>Ks<#3m1?DY zNeb?X0@`IhtYp7={EJik52ysty`ESWwwR5&1s$wSWg^OM9syx4a}~#?mvNF*eZVl%p>XZt4sAaUiD@viKD#zkG5`52`J_l=?N0Jcu%3YAvhcLp`SBZP4aG&p3 zf$R?nQ8Nb#ztq*2zj|KFYN=Gu|Pfe&!M5Ad?f($m|DRwV}89+`p~dh z0)Pk)rcyv(;G`}E&C$PLh=J?NGQH|>5=I8^6VPK@<+7r9+yfbl1lx*>^AD<{Z2q01 za*=~Z-`?7NIXT$ygTxkpeRO8W74TMQh(m>`;Ug8-V)TMVJjkiJa;IOZ@2nrSTTqBr z@!YFy;t8BPTC9mBIzT+*#RBCuHQq-EnkX8)qT|!oFJFR|coKs#u~N_API&EnGa24z zl9O5PQ`enhJ;xrJabvoLqNoy>;+!GVqiV~6ub>lgqQb;6U<$Nxg3hTVlYrCt>&tme z<00V91g>zK6pzwJbpx)DQEMqIAA{)}E7xEh`CpIvZ|hCD1(cx}TkAUWO;>zz$B}VT z-i@2CzQBAMwXv;|y-xNCyFBP-opTU_QK>A_qzDw1^r!6?E7&V<<`iCpnP-282g#=+vsj-*k|%>&O246c0i7*?WJr zdv^ST(ahW&-yQLt8qEa+hK?{A0azSvpu3A$d;k!c7>^O?5{xX9QoOyihC||;3hET5 z$BU$s-|iR`91`(_fchDf5iYEe=${;!;2tnWr6gAySRXAI-RAaD8_L*j6s_aqbD6%X z%zDoNlaQc6KKo3)3z94M0jTD8wK+_q?2x7dITG_-DtL7BJB`;7s~bT~i2yZiUI2UJ zre!$Rhog1JRQhSKZ6eEVQRV2?4NN1d*o{emmHB$P-vsM1O@o;BGX9dbE7X$yf*mr+kixKn# zCw9E04VuQ(;iPZ|IQ_0~xFNo+u8FTDmQ4XsW0WGfu7Q4fm;;VN+lAtZ!x<%_>2Hx_ zcvSbar%d-Y<~@#p4$n(*06u!G;tE>NB;hz%m^7$H=dB!S zR~V)Xaky6M&iexLBApzeaz2fKTH*;>NjmrJbKhl$o~a2Xw(3<%_aD!S*ni7zS13E;CrGLrV)h!H-e@*8b0n+FtDwq9bn;iPUFch= zQxMsqy<^xVl4M19IL`_FuFvOn7(wei{M^fTEyI&R#BQ?2dPMdYpeFqgq1J8m*x?WO zLr4aC?3E@{sQCs2cM_cem5e?{7`vk&oe^UhM(lF*@JinHD#8 z<4zdXKCY7GootZZVBU(Dom;M~mN5l!%%*lbNJ@~m2FHF}-3;Gk;i4U6zxD$EF|#X@ z=biJ$8`L{iPy`c9bc03_3EaYpA3 zvd#8)yavODqc27ZQ~-^q^6cmEFnR3^fE!xtk~pOnr1k6sT9+!{veT9yTfB<+&2^%Pj`!iGu`lye0OGQ283b1@>iJ z|4B9xrWQE1HWsy7crY_RFp$A0Sq?%~H@fT}Cu6BN=oi+}plJRg4C^QuKC=_XLjxT7 zVH&(h1x$kXYaR%KPU42Aq7<>u7>;9aDp7VU6)QSjpFg2`TpzP|XyOtu6f&wOh9dto ztunZ8_*9dhbl7C!dUk(=KH%#y=RW&vII3KR!{O}_rl%CZMnKDZvFEv7Jpc~?E(aF| zFodDq!Hzf9*LCY0G9m#*awR(ip%0K*b2Z>>JDv}`_MJbU10X)oJ?jA;hsTo%S4a^7 zCcFy$tIVz7o!PDamVwF#n1{R;sVMFCfJDUP2I*}VEor}#5@5#B)n|vg`dPAJ@KmLw z(DZ|?=HH<4LAY|@h~u0EN{<&KL>~XHGvvjql>N-QEN@C>VLnS;mU2 zb`*Woj%VY=47$(80MaUZ#sE#FAU9MQ81Rb)JZV%`^KsK|*v=7P0TcQP9k>pdMmwJpB#0aSAoj*wll_>2$>f(Q=T<29j6YPkTU? z$n?BI+e5brA?s~uaQ~}SI6i&BtJaW>meJ0Tv54-5V2qC^*30w;A)!r1>)n4^AZ?O2{!0`o8M~NknQ4wI9 zIkbS+%SocMf&6jz#IgP2;}gnu&jOea1DfxSQ+-s=md__S)5#dD!z*c*S1tV$+oiC& z)QzB6*a1rzaL|)mWflxW6dLN0UvjmHl$;X2S33kVyOuO(T)izq;}DXkH`l1(aSOkY zZmq26N+tZvLO=HLVa}UFWRvMzHWdv*PtDC?O1AfP00iYEuhEk}W z0ECe=;6eaKjG?SC0EGg+fyO5VY#U091C4w_fTuBsoP2`O?ep!grF}ga?H;?cUIb>f zQ<5GK7~WHVMvkJ$hT9~*Q+888bqNjWCZxnHt((G^FFJ~2R@I|8wSFYUcl@NKC?^xp zP<%$j_B9VXf|K0+VWzCS5E)!XFgrJxg!yZHno>*8O8Puw+Kk9rzFOAr*`|rP%gcno zbiy@{-QTVX=Hf#Fg+mQXO+;> z5O)M04IKX6x#=Ax+zD?r;mmJHqSF>7H6zvf65ZGRj#{;dQS4?O%);?{c%##f8V45~Dx@hIsiHo6St^DwK5y@nACz79oZjc6j_6j#x1~)p% zPeQ^CH30wl*}=@M_Kt*`z~pS@iX%?&X_yTYefH(S>krsCi0^p=a*x%%5;6WfY35O% zg0P1Zein1*$CWrAsn=w{5jnbkP-}Z^yZEcU^MNU%|mNYMF9!ShUs&4Vc ze@3?Cvq4v!npyzKq0VvsLxR{+B(npc9f&rQXWT$3Cibk@eyEol;5TgY5%z|7#eBiS z(q&tGkXL*ldnwbVbAPYqLNR|-=f|;I#c2aUA6pE?eqg>|++29}qIh7vk691praJW2 z#49b>N4MubpOFU58r!%^b-t5MEOLZ-Nv(G_wm(ae1=PNkP?@e3&QHF)@Bf4vbjM&aeXpD0Jw=ybpQLfIgtwXUD6 zY?*M*=YpjK$?u|&3P96NS|RI5tQLbzuE*6Ft{YT|L$4LrsP$E8v=ldz{gxXjHZ@@e z#-hf}@LiK4+8sAi`D%17f+I^Yz805)F z@11Z@2l4jQ5bl``iQ5uOGd3e-Hs8&`yQ^ef1u|~000{}<7 zqSL%3?qOGN_(6-y;#d0XcR0V~nhs(N!IAIg z!9=&WrPY>T&3IupJCUeyR_C^e^cpoeP9-b=H-v&|;xa3zo*jL2kH{>=+X&i&2X!h< zm%<~h?pW#c>~FFKr%DrDv2?@B3`NQc%(8P#6`!Zqs4ELL3$$jximYa5^J|9|e)o%V z$a{%g&98sHKA7Y0@2^-47?yyPnZi3CxVIp~yaw3Gwxwew8a9AX0~)4dz1I3O!~tI^ zAb%7<8+`z~<=cbL{eau0GF8pWw4&kzdRpKyKc2t5Cs#SJ$bBt1iZ#Ibl$F{c8X1WF)3)gN!y_vpRSk9m{&?X0wX z+yhnYGy4*Cf0@2xfkyTV=dVY9uGQ}u)H2?pnxqvgT3*8ztd92x60PDOb+Y>$q>=CC zkKKo{P?D08T*k(x0PrC;$ya#GW^iWaobmb(A$d^8yEYQdVOna zYj;;i(cO*oeygQlGX#0(dl*a(@%}!)gceifYVcWYFkEI4*;8jEvfgBmQ zcK1M9Vz&W=Bn2MYw8~VseJF_W@<)qVE3Ofd3Kv;htDl!8nrV8X7($sUOlqgBYhpsW zPjUZbg(ypK>&Nw3$Sq~66C?3#n8o5U02?SZJFy17F2{TVH+T1)pY@uYp8$gJonye& z>Dpm5fNB;#*uZRzEd-lN>OJe>y!HEWx9&RtG6x-O{2PtGWyy^@_6hajddu8WE)rD75h)i~|YK)5Nvykm^TqmoM(n59&7fpgA=Q z?51m;Z~`oN35IZc*4N4u1bE;qQZMo~yiXP%8NKj9nkrGSDW3r1WJQ90rD-ehcys4} z&d!#b0E&?0pF5D#ZbGaeD;IDyGqC)8B(?fWT4Mi%bIsqoxgP=khN86L9xR4PTJVb* zP6#&7{T1+mye+tDezg@#507eo|BzlbF+qwZyA>acSb9$QS!F zI;$T3p}*NI0}`Nt~W9TU&t-p1zh6!pUr{I z8k+z;*}M=u-Z;mV?*ItJfV^VJc?iHqCqQJn1PsuL?F?@1GA|%bC2Hhr6q~2QoM^ov zSn(g&hs+t+8y$m-Z2CPbX( zfrCn^xQVo^N4E z^x`W&C8Gg^nfl+ihfZjVxIv1pf%nke3qtJlTLAMi?N87ZOD`U9aWY}-TdrT8>3=je zQ|IU?ic_gkjNy{`9{+xdIgr3%JJxL39e-P~xWB)Dw$W3*jHQU|GXOU&ml<-pPnjpV zdwO24-fu3}F2%5vfEVVn^pbtN*&e_wG2p$!EsR*TshJh!?bq`77Y>-);gO4jfB5|+ zBUf+MRPTZf!PPh_|<*@iUh$)`=fJ!imL~l%rhXdj7s+dfN)17*p1utqW1LaLH_~TqAkni zVjJmE%)LD1?ruO#Tu+NjOTScxye?f7oo4QuVku`#{XCP2T3$BOF{@sP5F89t|XSCI*lLGQJ`q9?ooGt$h)CCBSK zBNO>>YpTj@VX)%Mg*tQzEcfvQqI-EG5Pdh9)<-?k-u5xx*yxiLu2%77zsECYw1h7| z7}$8IyNvIGs+jb{NN=>>v8d>jZ1!+J{V0fZ?t*O%7^3T!$MZUh^b%f97_gED{ZVt& zii`Kr_LTJ-C;$eIJjRo!bM64@@zn1MHGsE$b$?D2h?gJ&DN5Mf-JSpVLcY(pUu>)F zlkJ3uhXX9$xO!;=62;yq_UBi1nH6kpfoDI@k#~2|HVV(3%DQ zm0m_g=L?=Xo5!Je1SReA_@PRdx#v6W3_jl4?ZHsqbb9!%N;a+-A%p(achMONYJ+M;D`!7hxd<@1DdL{L0XNyl#|J?tisDO(AYqhp-yEHBZ1xA&u-1l) zh60!Mrl~DecDd$6#qAZD;I5vtAnv3Lm(z(WKk(;g6VFd=Co7ShfZ4s2W>w-MG#HU0 zhadXzxU)xEOaTRtN4Dc&r%_`Ai%y*x~fTb5lsZ*E@;gJh6`+Ez%IT!Re_gy(FeG=x2Im)Dklpp z0+PD03rC9)#u8yg=XSCv3oAW1WIE~GlMClg^4AirbeXC|8OTJJZC9Pm;&w+e?LTGuUblb37oMRA?ZJCr$BsEk-30=loSvVlEwSJP0B_u1 zPqtDpM@#~#l4V`;;Ne;Ow~F2*5jO$-@hP;ESW8dx)Hz{Iu33RGR*(VaV5FgHC&wpy zJ>?zRYMViiQrwtEr)meoF$>0ewmY>CXNFRCSBx2zg`<1Xh)awkbH>y^WlKx&Jofge zFtjzU!Inu(d{14kqh2lIF7!|+l|I=B%01<&ri$C@<<5DBT zh9Rxr@bE>bi5h*D{yrMRRyiXJrio}}4A&$VtYe4c?e`H7v`s;Tsw}KY>#`G35#*8bYv}fpRb!13{{0LLi1oQj~O8-1#n@eM2(GFi;Mxi4tD!6*N4*t z!_qQO8O`xjhl6v z$I3SH;*k2bet!`(m@SxNbrk`1f`eDk9W{GmsAV8?7J_Y$)7k;aphdxEh#mCrYmAxW z*@V7@3cCd(83iO_1a4B@+(x19K1Wd#jwbMi$`j$HzPerJ-Orc@b7Os&ZWBx^V;#is zXmFcwQ2T;TI>vE}FspqK&4b7ci9BRiz!SaywxZnD?e}J0t}zw|3&zjnZKS|U2x^1S ztCi$=W(U+k^GEN-WxdB;x&VP{fjje-CQK&pvUm9rvj$8*x||r#g9ENcAt0p4#6bst zgIL@lNyQH*EJ9h_{_<3&hq)%P@%vKGPoW^SeH@1)HKyFa8{bF_MqF>(_#tcVeH3$+ z!uk~ljD%VLZwH$V#_2+n@~K&ZVDHcYiGUy8CUb#vNyi{4M`e%=&XBGj<85HgqAFLy zDBOtVg@j3E&f3NrZqq3d#`j zN5NfO_bxMjA`e|7#KwmT?|GTf&uNkp?dbe@e@rEelcNr8)jQw`vABx}nY_wLvK-@S zoWcrTcyFO%_#r|6>Mu{mjiUOx%{~6i;tCTvlhy4i*oQjGlM*(1(u?H7Cp3JdIkXjV zLH-1g0dQ6Z8R`)Yu}TOF8;E83G#v5BFRd;X(bxOH2ECxHxA;+JcXnAjpgQxwuP*w?8BH+ zdaL|2CCP*;`tAR$BHqBUBp!iY^S>5#PDp$&8yl8PJ5e{&>~hmQT6o*jBD#fdr6OEF zbxJRJah1xxC!@#{IkOO!4;Ni7(mfgc~Wr znwQxwM|`?Tv}5dCqOl3Cj~fOX0*XvMZ02hAKB@2gN!TaF;@_;)_inM0TDClEyhXge z48mwr*h66_isu2jHd6k~CLu9ZFx*>=ZEaomy!;xkv#U(^)cw-ku+*;dO{JmP@fZ^; z?6JJ>M@})MW4VbKHSCGCFT8L$>|RI~)5~7oV-g>1S{i+|Wy3gq|3)56HRGuDn>%yk zgkg39=0k_Hp;NB{FMnO9bg7|KXbIYuiI(6(2;niv;eFl!zf2nLX8-^8b3Ah z42XjZC>zs09OAo#XBj}=*mQx2b!MkpvK~MYJBFeHJ}AIgG5j;9#<-!FWsg5+aYRVE zHd1qyNJuek_?FCoWO09kI=h33!W>j=+`&ZoN0d2E*(1j_p+Us{7A=s=^tdRZwJ*{&*qd9A4aE2 zLT|kz$9C&Ap_sf+$9Pj>Z=(M^?Q%fEW4#U-a{pnb#Oy%Un+e$?kj01#t`LPeyTu?E z-eC{tJ{s#|bw97@R_rGb>C6k?LD}r*$7J#US<7#@6CGU5BWjZ^E8-$ujAM#hc-{wo z{mOD%fdG48v*PmFV`COOR};o{Fe&|>W-(_aEB!q2P_g(tz@^~o?f#WTvj$f;q6nSP z0rb_u=KN!R%(fHb9NeZ5%%r#SYDu0)M;a*d}e^zah8h>gA% zV8$ra^;72G6(&l~hR}WB+ispGt&pyIPCuhM^|uYbb%u)nbR9A3##n@EslXM27K%8^ zC4-wdzWmk8#Js0N9SA=3+GXDra1()_Ba8H6kV#jEIy)#dor%BQ=!aUwr3l}CeDAs5 zE;Up40D&tW`XT1!lBc|SLhiP4OTzbg!Rk!h%a5~0?R%mZx&4UHyHIp?qUnoVi%{@6 zEl`Bn2?QdFUaKE9N0Ez2H+SR(e()PSZ1|H0pL#lD&)R*+;d#ei z{w}Qrm@>rDBYX1a*L>U}R8gHD>juW#AXRDWfZPV>{-8u#LYH-I=9xw486&f{dEOnS z5e2E}*P)28sjwf2P?-DHC6t&|f%W9Ie>db1iWI~|QFxR7Zdsx{0}WM8D}R{J)dxGqqhetudQ#@8Chu9~7G)|8mH_oGc{$=fGRQZN!<> zX4tc!9ZTb)6R2Vs>tDOIZ^&B#9v$v`#$@(J{8*__&-Zh;|13MF;6U+5^F)OD5GNzD zq>aWwvRDf=7*C%Z-yY|O2i!8xr_JtrQ}N96qy0WNKT|63uSYtiybp1mlF4J=zYQC7 z2`3ya6tTJkbPtRbkfd66y?xuTGRDt?JF=Ojk7sgI&X*uRe%-I>B6=|JBW=2~^ zr)>~LG2wsoVpMyzoRnV8N0mhop4@nNevi1dfy*26?<#Gt;-ga#;pMlKd-u#w1Nr0d zrpZ&MmY8XR7&=}*-DQ%+YSkAnOFXSkWsOeBA1ZY_oZK@+az1^!Esu4B47^4sgPuXb z5hn$O#h^*=&_5)UMy8Ge({|i%9Jk)lUeKBylSym~y^BSs&;?}V=9lMk>AwL)7=a&FK6HU`^X9(2O1Dv&ja5#ZOeMdvYRu39+WYt1^D#M(uyng}v0Z$jd)s_vFi;Y4r9qfd<0X%1c-Mdg;C1 zfR)!2fA*>KW0%fSY9=x)uW<0>ygJj`(D!6adyAw7;*Ga~XVf+k)8?g4viM2VGn4Ru2{;#2aQ* zG^gmT6VA>l7nozBjzDna_8i$kv!dxquY}1sIs>qgGML>mpqC|@-AhbZ=}Vfp?vmQ{ zz>gzDoTorf<8r!JZdUF?&7xqUW*DqwtSUEx@bgV+c~`;K+xER^nO||a)KsR;P2Jbl&N$teZ3>e_AzLNj@J{*x}wmDO@#4Bzg){?UbZ?F|A%bOQ1b6)e zQ~zxDnzK(Pewdk#ng8dYXm?`#j&y$H9jrYfu;@5Qw|J*;3Grfhm?br3KEIA*li(1H z_6{vT+;mpH&3gNRt=E0O9cmOTjcw9M*{@FuE*(Kw37mc{u=BE=TsY_=0}LzlaZ;R@ z#I9G#Xr&Y0G#SXqb!pWqy&xwHG#k%)m1e&3#P`fsHy(%}27QE{aa zOxD0K)j?YI5X|N&)8Yb31CY}IV}2OW_W`uM0VGfgA6x+*G?1Y--#LnJvyZN zNHUCjxKw5Awlgo$hTUa-5&$lKB6aIa?@9A>fBr{nVuXg47f*bpibJ1M!OhG7?;E7Z z0Arf?`dPll6wr27`_h`h1h1biJ-h%q-nd=WL!Pw+aQNPv=FoqFbryB5*;SR~#Sw{z zTX^bnA$upTRLgXVG{j%3;q}D*{&4IbW?|A+tTayp7_VUz3feQBvJpzmXfw65*z4Zki$ zabF!dULTEWs?CC-G#Z=XV0hSONvW8)_>8`#iAk1&#`^X)3nx~dJTQZMWLs#>^cE>G zEY-l!y&0|Bp4^dvfx&fp*Q*^#0mVWFAx zm>^R|c_o+gyw?w$h``x#xo}~%wkA$GtJ-69g*}d-uVg|{{ttHhU}R`&&EuZL#^lv* zRo2;`GPAV6*9LWu247D%ODl}4%wB5P9RHr($+QC4_p?qgv1;=7F0=^q^vK_w-WcWC zQh(b54xl*Az~Qsy4n5rixo~^lVwzm4couJ}uS6y9 zk5_1c1Imk)GlibQR3tg+OVYD~CBG->pW{z9DG2%qu+tX~mcoieHkiE*x}*`;Uc)DU zi08G7wGN{HsLY{qb90#$SUc(hE`2f-!A@GtL-r{$fa*Aq(!%I}KmxZpzJVOV*d(no zY1M&Ohup${@6C+T$%GU`wjSZxU^6-&3{79M>8kN|t_^DRxzr(<(h*j5Zo!LCVU6GN zq&LOftkUZe$zR>oZSrwH=~|8zcL1LYOyE2LGntw|t^pL?IIa9h1VekW5;Z_VLK@T! z8v7qUEy4ZQe+pW{CLgb;SsB?*&RvbEp-fJdFY2hHWRc45Y$CEJE_YK6w%i6j*RS-R zy{|8U%Tg{zDt*1F(>%ib^9HbdZa{hu9Ae z*)N$S+5bYpECDb;W)95Ik+vBvimU^}9yGyf0?C`5-Q8v|6#-MOv{L)9I*sCT)mRkjsXHWxxHU1ys0^T?tMWqEay<71wa)e71OJY$3ADz!d9onl1*-3g^w2 zAUhkQ{FaeE+ z?@GA|sG@^@jh~s}Ac&~rP5#eo1&ERwe&)S639n^gq1A*K*;PDzx$(W4+J2VR8 zUz&XomBdNyj2?4NjhBQItMZ{%j|lIb+uw6}MRhD>r*vsfa8by+5Ap4Ve_^9v7(anI z=B4vH0cHO9;GhU3t1i!vx15>`V;dhlH!+z9Ls&kj-C*Y*1j(lP`HFkM&Eu6!`Var$rHfb{j30L=88<2RivU4@UVE={g1)i!n}*zvaNny5JPwVoy}VUCkR<&^g(W%{2=R_Zas zRW6@{F+6{CM4z=`Up{XQ#^L?Hv&UDQK~M}M(Pd>YWbmNOr0lh2J^qLHi)nXlxCK6w zJ?ee*_zSP!D=MX1cK$2m6(Un!ftPJVPSYo6)wlRiH6G!~u6SvBHC96yCoBQfM~r~2 z!>;Dwb9{Dw4zfU{CIiWW%vYTM8`<2ASn=PHfdtt>7)1#OI`anh?M2B6b(*@UB@5I2 z!`Dyd%9$>6f?=utb`FxQqwmUeZt>Nt(N(SL<(s(jrBIM=hTWy^w7!EXKIWto_t-x9 zvupwqhc=&lj;1U@I?f;D-42_Li?#ZtuP=Zf#g+eKf{;teZ4n%hGZUOm=P$ z4EX;{zFwb!aZSxCV`#3DDZ2^N$-t^FDm1ZnWot(J0f0IvtQ$2(y5@H^Aen*ga4CG<=z1G8e3Z~I`rRV@x#0h`jLEo;2r(RFx%0Dt5p)V5EPwoPG$wlEmJ`K?_+AC15p3V zoey@~XE5jpBqGD+HTjajMKYK;vq8bg|8L$=9OobZIa@M+*q-LFrSb2LdrdKXB5RWH z5jvKB+)(^jyIQA~(Go3@fzvc2z^0bzxGal%Tpg=kt;#X#wyK1vT{hz*5H>`n6j2Xi zCiH-l12eM*yv8Z8;;t^w!Ix6LhP-?i7@vumeEJhKCxAiJ?8E8LK^;71<`I~O4kmdw zT8|WDW@f_h5D7gipz=j6L+tQq#xYCGz2vnmBq|6PM+J4p2i-AFG4XrdbyAi0$fMX} z(Qw25t*QDN}BCZeQ zy~@AYJQWWDEC@K4n4*j4+}U+2-UyKErbemu9YJsM(+RlTtF|RX6bbbs%rbhM?#R7D zOk{k)p8r0i%7by-1B{wJSSv6L#LxnW^=LHyj@NDkOK}^+IEoN;ut|i zO&nX!x7(}4M7tX|13x{sy@UFA4o}_Dgtw?;e!-o(;PeBQyocY2?0BfjifemKIvyyb zCl;Yqu43#mOu2U6bPf$O7G5PIp8jM3G<{17<^0=A67JM*{ub%kh{^={B#t|(M*(q( z9`ix;`^}HUva2YypRDHyRN-n;KR*&xv|$dCY26`jd`M!ZAK@sHi0nZ^3oscZLX51| zr70@SPhkoW!E%C5A zpMdjOe9Y;8rL|v-yasmXYE-SMMkTL%27DNvRn1Z;(<^>gSdx9){E!_EX0*KUn3I7- z5MsIk-(%!Q2d5&izKWlIotSYNXg=7$2lwg`4Z&}u{I$R6^MAGX<@{jM^~!I9W#9 zo0eH0EvL#=*hKc7mKF7pU^`NG(Xb+FUwLoF2KcDQWp$EMf6)Nqw~ZV4vqw^ucauXV zNY9vYCj=zgUWUuYj`mg-%_WU8?rUnqVx%i+@MkMXaca*00(>1&7L)tqf6OWcOYnP2 zeor=2Ay1Z&Qr{_mWptVPYP6F5fZj(krhUdgEFo@QfltP)>7v?II zZocEbOFiAkEd<`JWW?0gb&jjcpZs}O%C&;zaC&vp<}in*F&6;m+nAn8yH(()Znjhv zv+5|fopgLJuhAwxluy+MbLt~|sGz9ZorNyn52PjkS9W@YPmx^ZvBamQLfgbHj;M{mCJJnelXkdL>cy^A{qiytGb=9DYCSY3Ki{C`-Eg>c+|d-z5si8jf@v z<=!sw@A&Y-f9#UI6*_CusT)Dh%n+GCyFtoqhO)v>0CmTs#7ns{ko{|0R(xue;> z+*2WB7uBq3GJ(S$LYAraC&sorKjR9B{)92HVsN|7=0Cg;nb#o6^B>%;$#;mp zZF9L9YP9du?tK@-kvt`nyDCk zVcIn4;T&mDoas`=i``|6ABNx3#&YeRn^hWdGz|%SsA;n7AM6%)Uh*_K4fdyMo9fO$BL4b(i_WeRM0H-%m{i5S#;U09ou|$YhL2uIh<~ zIeS_DlECFVO1<{PYt+9*Gk1y&)q5M(36DKvY7h;st-F1@I&}#i6ku9Je4KHTgWVLcNpk7Y)WhA~_hLNOfUW>fhQ$?pxA zc#j>jA_p>B&PHm@8ma++E$w$WBi`69%x`xJ*{SK?W`OXlN9{$iLYt#G>^nJ;Mk1&+ zhPXP6WVY@I`>dgMr>~W^od=zF)bdV^ki~qCT%qKy==r3cJ^DveghQw)k|4ay964Ef zlg=xC?WQpbRR5OH`%Kq%L-uIP{i}8Qi%O!wt!~uACmro8Ln< zuIb;UXJ^)u=L~b7ep;o~>=iF3;w*u$@0l0fx?q!0?;pnBHk=0c`Y#&$Ow(S;03EN<@= z1R#3*cqNgSQ+qfa>TxNb>8jb;)!5}ZT{}y;FtFm1wNN9adYW`!-jX-uw-K`KT>n1P zpeac4?u`piK6LGJDZr|Jz}b4q#cKO}5iYc2sBfHqK6VEzEQ8R)UcxxJi>%wAG1-Va z%yHAz_75+ktqMW(x3ZdAYP#CTKXJQ4^rej#BNFx^T}rS1!;P{-e*gL2EplL| zibKzs;}DVi1z_|m=9Wgr{7qXkLnp-y#rJwm)8Bkueqp!FWa6** zrJv=`Si)T*v1MFUacTd-_ucApo3f))3>mccu!v#$!X{4gyw*L#!lmJrG}uwQcuJB` zX-c^{CROUdbcEV2jtLAunntSJo56-S^R+3LQ;~@zVokXe%zy_2$?FaDGB3}{yy4FWs`L2-p5{hHj z*Va0plw0IW*+26fs5qm)>pXx#GATxAQW~TluKW(&`VI4geLpxmR|Q`ZkAj)(s(&mn zL+F+I9ud9UOW48TWByVXDPo6JlYCwFNy$3VC#@CpRLlM)yLS2Y2T9H8v^_}eT;wdY zeL4)efN2_`n{Th}{0$|i`BupmDMly33jttZ^R05#J^&WLBvfo&K#PZ9m0%N7V8DFn z^6a2Pk#&m2pFe+K_Tq9Jm!$gg)5O+$2bI@w8e6OFpQMm^`YY53nZvpA-VYX$XSODO za(hfO@0cI2vQdA|WqVuR?6&IL>OCINDwhn=RPO*xvjx@v6|Nj^xq(i`gt4zbDDS}P zOcYRiWswg9G!LQ$#ukr(hR0s7RHGgLr>i#$`ZPn<`@c=$0kK?wA-H`rr!)V|cyJW5 zZW~cers=HqCf@=b*mZLCiWQGorH5d;&vMktCztpuPy3j^H#VvlvEAZteLp@Fdglkb z)$0VLo+jW{NM_y90&5z>Fd^+IbUYb4$y5K`{Vd>gq2tSiSJTD)WgdwZQx4zOx`BOx zFm(L+^Cm&4Ue~ms+=PjY0R874xy!xr1L_84pmzO7{|m{SV^EL-!)AwJonC?I%HM)5 ztI^DAjlg+Ic{hkabu7|!_t_Ue%K({EJ07S^k1c93bk+BTEi$>E7R@%98e7gEQ#~gq z)?~Brp1RJHmt1IZZRwjI3tqhre61X3G-LhC^Xa!c{g{%lM)?6RgB!VQX1>0;47JH? zroI(JQDDyRx3lz6EI!#%8{*#fU);5r#NR*1*#F=ym^D> z2%98f5zuiZL<7+@8ptj38MK&w89Q&JbLF{DYi@$bO4sN>afA2TFOG--)kC*DVn`g1 zKih68{Q}T+<7Z;1l~IaO4pfOJ^6Yys)DP$x;4HhHUWHO>!l1lIb(3Lh$$9H&422yWfsF_i~@U z2hNUA2?MijTpMyiTk{bwV#f$N``kA3vo@N^=o`SlW>7FM&vMA)Z;z1Xz z3%c4K@*qCQ*poR7`8>`PU?s9G*TCV6$r3SC{drdtO!l*H-N#Fx zAJu92nEhEk!tj_wy34^nstZ>W$DEpR9XcJxW!LBhUyiiQC+_$b()*3}A>EQdgv7B= zAs!yNAsK=nQ_bceAP@qDp(q+3U`qj99)Oz^i=oh zKv!_<+F^qBAGkH4Ff@F}p?P8%8!gEcJq(=IchY~+JJN82@i4?5ZXBkxfjz~GW%so? zk~OPS@}oicqeU6+%JR$9jKc-iZ#Z7{R;?phWFMqnrg;QZdZtg>pMofIGxfr=xjS)HnF0a`45mO=U^1JtL_W zY}i?ol)Vhc(c)4;;`;1PL-m|*oCd315xp16{RxPnj;2*K%eC{#7V#sZ z<$y!ZU75SQwxqF9uhF&fW9oB3y@mjg9<~gn3UATD%YY1PtWd5(Ky2ez<`!UHfN#U# z*kz!jg%VPY28hqZby$+OE~OmgpkpXyKT=n}iu3Zdc|U|T(P`|$t?c!+C!(^{RGE$c z(&!DC?|Z8C+vfijm>#23V>9{&JY=DRUr*K!M=iV0c~{!es;&<;+ZhrzljL_D=rt=T z51vi^+G)C*q5SOO-4k3413_|oq8N4ZtWW&eJFqzU35tjxCrhLl!LCfF_p&(#4n>OS zUzbWTLV2np&N=~Q#W4LH5S8pu$8sOL`XkJUABy4Mr>6CDw=)d3tu6?VS6?j@)qEEn zao18d+V6TBZdB0gMamHzcfPy~hyMe|y2GCXePqk>fpx3xp_>|8zciK-0bs9$;mT9r z_WON(jaDhcfw~8{e#6I%ps9S&IFdPV4ADRlQ#Yf5CNNm%Cck)&+diEgJ;e^Hm*=0} z30k{1qr$9#tyGih=1~4vy7D_u$r{ zn1WcYQK%wO3T$`^WTCJ<4(1T7eJR?I*^SQ<-7SuN*(ze}=*{-0@}oALQ|vP*yS+@0 z8xAx57XYt*@BWvoRaI3`DKwD=8U;qQ=MQy}sQ&}WSFVd=eNjlhjm+BM{;vD8o$R}k zD$-g?uall_YwHdF+jZ>0US;vmZhl@?-jJSN7wOC;Xg+_CY>~77^7UwzU0-^7a+AM6 zMRuA;M&H68sG%}0t*8g2&Lmys43x91y+cc|A;xo}OnGkLe&!pJ2YRSNh2G zYtm>w12G7N5q7&j6mc-OF8lTN^((1cr`5)fU%|LOvOYd_lU@A`v9aRBPm$A=LTA#? zvp-uevX5PRn)5JG{Z($Re&YwmnQzt3bp2xi3pYH#3Y&$t7T>P?cFM8Jx3UKjZUeY$ z%#k?@P*>!Vc=gfk4%Tf``lqCCnrd`w=$yH{f8|hbo0_5t@aI53WTvz3Qw+r@(Lf&C;;9=$!bM7{f^EpOyRLx0rw8&BN-W4*k~=eFdujyi@J-SJz-f= zz-LeHr1k5ysRA@ye(v3_i_aIn$59Dw4#m7YLA>?f6M3O>inR@o}6cR5sEI4$?s zWo>a1?FKWPiS=gz)5$+$gGYRKnGJr6?dj6aQ&%uck~d0HNj1CaAq_q92cJs?kw3*q zsV%fx)o}%fR`X_TTL$4bi+6vbgT*1f z`Uc9T9)F&S77PjebVRuoBIs!I7oZCG59`oPW^y?6G=yW|lh;D$LB&kJmwdv+$E$aZ zZwbV(dYi28muKP|BLF`;L%^-9?Lfhc7cZVX@q_RXBVJ}><(&qUBF(E^UPd)ltvIAw zpr!2hwWHrUi&BJ9X|{u&>POj$pHto@_qO;JRQ*~;J~UfW>sDx(c=EC!* zx@YM`MH9)pMx?1s=zb`&H6#bjy14vPyEA%2AK>|*E^~b-*%8ZuST-AYgBw5J!Ftx8 z_Z(ZV-4T*?ki~~r$-4{ON;LHb%I+?nKfenal5AV|5Mx9w=cQi|?t|_XWKN&&n*Z)= zr8}UbLF~;G&ktZFLh+zo*}K2?&Bo|C5@+hk9%;ox9aLWO zbQb;Ac%goY-6_f6uFLASrj^vYmbx_@)7G(pTVp*7ms)0L>x1tpx>gX4_Z2J}QX|`0 zgOOQO2F?#33gcPCv?u9BZWA8I33beG8my0#2~&^svU0Ktgez=3^N;&hAxJbDl^26x z%7gG|#X^mNHhXn^uUv+Y@{i*ZV$9b?gw)vNjx~}u%^u8}1`P>ezv{eppJq$XD08{} zGaoGNZNRLdY$7iMkc4S3JpHLWyM%}oYMsGMH}5*9i>KDhEHl|$qU*{bt?h3WOqRdY z?4eB4EKf<{6!L`|B~kudSD&dI`eYJq9L@6O3NovM4d=sL4R@k{pOZA0f;7>Agb))} z{WT?je4lU%E7M_H?GpBr2Tebc^8%t`^6m;@&yd;V^4v4E%B86p!odvZG-qXNroWbO zg2#13$?c7m>ZLfjv;qcBiS8qgiDr3~$vc+Cskig}IPc7Nh`pJo`OcqrxZ(wSH*2BJ z?k`PppG=Q@Uyf^db*ACX<0+qF(eP*2=Sv~V8uQ0tI}gXzUCOuoo=a*TMO2e z-s9qSR4DH=g5+g=B$n_chDJ8mITn{~~ezJmzP=lo4DD zu<<%-1^DNwMD+rO{d{H-l{Y%wsCi__$WGS35RaMU!wLhFSG7TE)p>Oo^Z0z%Q>W9~ zL<;H8)zgQUvkd?7$9Pj0qICi&Fp2PyS@*dg(HbH}6fuaB{k5kWw`^F?P7uO;jR(Zy zkAJ5z_~&>XffSC|IE#h73igK|xt{ZQ;ZJDIzgE~sF=3vJJ)+CIYSSUrk+OeEBNV1A zx#*GhguDHVigB7a+`rxH*_xFamU-i@*;!VhG`!_0gV6ZWDxqfU)bGxi#Htg+di1rB zTE4v~d&xREtuc21>6OI#c^P&W#t9V;rt4k^EB2_TX~M~K z@az1NQIi?9&NU63qH$Ii6CU>+$39W6qqp7se>(;cbJ%Jim8}xsOj5t31V+?*UzmHQ zRi(M_jc7)j&nikhY;#8Jkxj2b0-h39BTW~8gv@4+PC-<%W-vF%!htomkoZB z^y6cU@zH`56~7aiTHEmg3!2`Ci)vCWTwcP#w=-O1+1>`Lspq|KCzU;+%{N(GT3fNvtf)=88kvl zIoL7tIOob(fDE_)^%On~xV7e%vNb$fSp<}a7HsU5?navpVQ$0DH}XvFx{BjsFKse?*v#vDENrvkQbw+b{~fh^g-AKIg;m>{>WG7^nk9sk1;ANN*z&nX@m)-1i6o&RFM zo`qJgj%c-v2%Br3(3_d<5*uRi;Jdb0r7+?$d!{MM!@x%<6Sqm7YQv%UZ`pGdJqj+K}9e!u*IG8<(PcL@d?NAV$rj5sDfF_O{v4 zbakml>C`Iq+g9I)5hacWQNrYRT%v#|HDv#NwRHIj zP;K@`R_n3wv#nCy^>b^_BKvlK)FJR+`6nzks$)R8qg2VuO23NtI=P{>|DuohfsOLg z$gm|*ngx8>e-%YxZ?N(i;vCDYGcnD-+TJx+kCq6idS%U5@feNbOh&w;KF0s}e`Sy3s`=NiNs&qMQ5neg2j)gVXX2XgN80 zQ@y0$noQVeTf>Buh|)U<)ye!zvl7EE^`kSkg^8>IH;bf1hR>}&(YL=wsu^SjPBakn z9ZM_Nk(a0g#GGvO;*#K_IN{N>3*8aM{3XvxcTVC~3xC-qKBHS;R^UwFB0au)kmoFu z5YmI*yBGp|lDiIn^0)ktwu5=jQRMblgG=*Z-{0OIPv!Rb?cIY0|728?q-g6En#F0o+FOe9Ueb5ZMdhC~ zh_A^hqDw-NZd44LaduxVUWw3&RgG~L9Qrwk+o3KeIlhaZ`uflKOg3`I2pN!c_oF;w z2q!yeCeJK;r=|%_kxrem&Z!m!3-X7AJ#O=wgySOhQS~#LnlzIJ+3540ZSJn|eZ zH9=XDwa}mAg%P(LyO8qikgPEGlNuA|)r$cBIw! z`UCaZJMFqIEB68n?eME*+V{0L=N`8!t?m>Kt?@utLh~o|fH;3ivC6)(XL-GGF)UlD z386>B+Z%He5a_#`zm5IxeEc~wAnE~^-A3P%i3jW3^o{8Glml0!y}AbI=#z9Qc8BCb zQRu%U@(2UjqMZuWkQbko;*WjM>1VY|8CXAo zgZRg}#I*jJ_Q8YJ>86M5xp^@!q8KCQ5J;Lj;OngQ@7CR{({-cnz0Zm;9oN7j2F3PH6SL|x z8LiJg-5&YGrDT~dd2Nq>0rqNmpvrVMsdorFQ%=wUq@nF%)!8pzx!{xe0DPEZ;RSyI z2U~CPP)BoE!8z_bMnDu$CfOI~((*e6zwytS_^rL1Ln1$KUsEpefKTxb5j?kuQ;FuG|r=}V9(?zha%ScAYd zb4i-c$LQm~nVrG9Z>d+hIkqJA7Ny~VQQh=m&?fY6t~n$Lq3DMGJN=_?0eg;@anUOjH9en}u{IyVGLaUBYJ$(?dVs zX>6K{1L)NK#96S5rV9|XKxhvHp0q(uR~QwYFCbcuHuN=O=x=41FgL{-e_{Bj#wg3k zC5PX;gZ;=#w253{=OFbRTxt2gXgTmFK5+bh2h7u+FcIBT58{xtj;$BZtzNaRDg2^- z&FhJupNqTWwco%(YgJFXPr8K?oe@|;JaQ?x+6_+VB-BTDpj2sQNXZ-pq`3Y%+P5` zdH-}5n5mwA3BDKddmR%lezoJgvhe7`O zVY^=D(3aw`yXiWcxvld&CL>?s@8LsN^ihRU@d$05IhxF@ACbMe)%AN5`iyBu`2E3u@9yrV0%9L}h>wS768oGbNkAw8NyY^34n*7g8Sc7;tTLy6P6pwvBD9kC%WkJ-F z$11V~xR> zlQ+v(1viKn`4NBnXh;JDzIZ$OP(>P8-$_=$B81~bo4OX?^@lyV+JO# zH(1|{J1&~Q)gQeIA!7fOjf`;5D)kexZII&Nxgwk&!Kd0V#e}Cuw)5^;;=k6Jg&^O@ z47MJer{I4C4YIpY`#^#@fe%9Wl>I>rZk_i_8{^-v&Zr;ZpFdGS%;;w(2O&rgRP-Y1 zpcTXKm<@dJj=^!V;D(O$fV+VZltD0&_KMC}lE3qwe^1vYFUb;I6ct0U93q{)^BFgP zNDyH~_ zs1Y?(q3%m;E_kE-oCjKWC|BwR$k;W3BXbfv$u-1>sgVZ4WyQSit23jI+1n~Xv0Q{F zX}^7VGEA4wjT#|t8~To47dd;6#a!xS5DqZQJ6s&w>y&VdLv+{h2E!3*#DxZEBBr<_ zh#`3Fl%@_WwKSeLjG7@J4cYEjXLfFpGbSag=IfIFY~!T3m_eQ+`2+P|??o)-Rc=iX zVf@UYNzLwugY7VsrS0s5i~9Z2CDhaYn}v%+qnogsGH)MB5b#jD^K&8Td|u%|;;n}_ zSz;BiOdzY!E;)$$aBT%e%8-QWUq#dk13rx2yy|H(G9~56=9wN_^))g-7gEhlwSyY z#D73cLWG<@>?n?KvI1v_jsmdhx(tP#+4U#9Zr{@8e%t+)gMQde|I}PF?Cv+ZyDuZ} zK#%{f!)(b&Yqine&}wYH{#_nHPP@($kgU@|?Dv-*FC~9`^6vDifU~{AOJ)&Hb-NB1 zp3HuKC>%jZ=iy!>NpR;?5@n^eDs2Y4{lkWn={d)ZFbLY+ju=oYr*$z${5Aeqv2$+* z_T<{*YYojNoTE3{5Yln9`hXlK!|(sbdvK)ga{O)geY@{JIq)Zv?)joFE+zhK4npEX zpV0Xrx8~IZZea58VX2ctqHLdhbb{vSlgA4ne+vg!M?;3*L_oOZ{o(4%pGcCyUK@0&m zeIf;VbaWW~Itb&SS9ahDvOe#86*5zUz4=iR;&gz5 zL{`5&Y}^-kgv76sZZK@QRAdPnf}LxOo+-DFBecou?fvKHXV#7?j(FPXWN6b_##xHg z_`^ro&{H+sVMzg-QhwO7hsb;f2T~DTjMhg>)*}W)(4J)zpqsXP7ZHogm&Kd(OFakH z&rpRpyI|=hHm;gu`|bfzq5$4SVyr(|5=MnCVMBg%is8SD$Lx}!oB2$4R`9fyL*zvtwxAEAh8L&U_YRZ_{8M|#)6y! zWXG{ZJ9aU7Q!}IjQ*ru0u^L0T^8uj^_kNeHy{@jg#oz#o_eUi?sbE6fKk_%8M<`ws zL1k|$bk9O+PS03U;=-9kn8KGA>uKK90`XX{2f@dGoih!iYkzR!)=@`fHk zMz-H-%soRTpkZSZ;zW2zEsRoW6g>l!oqpwVR#feu)hfvDjvJJU|2%+!?jU zLPiHHy6bTYd;MsKf|i2MrzwMuwHi%N zs3H#acuE2th!;@eAM$Wx)D|+G++8SSnH0??@5qW!B*BV6HpV|ygbB;3Sk!{1)q@3Z zp!(j7Gbj^lL1oeu#N%rGKpxw6R1#gZqb5)M-H`i_efYz@D>2m!uLQ&2;b6ten=k zJbY@DgnpJ~M8_0^Jz=t`-4aWczz*tF2o{QT!9sU=cYdCWnCL$di68wBK?ca*`}7CraWA;jsCh-)S-8kq z!iz~q@A|eoj(pKJ#h97;(bFUTXgd=miJ(L(RD~WVHVkG`2yz`YC5c+uv?LI!#_K?u z;`(J+j=$~mS0#Yqi|cMxvoh^!x#r7HfRiGCo*<&c0U3!DUlAqJa2A}oV8ELZgx0Oc zvc{ddQS?Fua*Yb12u=Yd<-qI>OaweJ5bd#nyzQ`b!PnE2)+>V1iTbDr6Aa|YrlrsU zp($!8K~wcjF`Z-uN77rc!LaCm-0BQWG1_#lj39{3_@ONeLX0Zy2Pt`7hJzpuCMBAR zMDn@8*F>jHcgpGf*`Eu-buS&`IEZ9;)RWyU0sFs z+16KJMvawOQ2h~sx(cKtKCUsrW_u9C^O04N_30l~g~3*dhf(=Ppi!fdi;;(y+o29t(cZd_Wi85nr#+x_5JVXbs*_Z7&i&lyn6;@Q z3IslVA2yG~o-@TT)5IjAKO~QyVAi-ZR56Ks@bWnNk}S!iO!P)t(KQ*wqKh^F^XTj0 zLyn}=I1Dnmy=tlnanGi^_pj2UpOTA2`Q@9Hi}1l>Np|S!DC|KD4Ag3YKxqC;Sl5p9uO~}+M(v?A}42U{}a0NUI z*n%veyhC2>^R4k}jbb!|Z)`gxNV-i82*VxtEMr)_0xE+j^lzC1w^zH0N<}0TB#F#> zxM$mDNR1@TjJW@80U08&#RZSvzrdIbtWAdsf|OiGw-U0TqC|Pup^1J)YnzTQc$5ho z=;pTja?JCN&}M(UMpbSDvR{9D?V$p{IaNlXlJ_R6M64cL7nJwFFD+2OIe&R3w zqz75KH4KkH$Zfkg#HSOk5!ti>=u#-u=-SOx5_UF)!36>$kP|@;B5^U&Ol8_>Kp<)8 zbcAGe3`~iWHO`S&!x3a0T^;fMM@tumepW2Pk7^@CSKn0A2&Gs$DteKUNY{Wac)sJi zV0d$$tvMg#RZk-ZLUkn!{r!2iAco@)fOr&U^a@er7CChuqA$^oPT(0hsSv#h32@45 z4nxEaoPiUJ^>TwMM6kXnf)Eh`qG-Kkw&g!yfUeOGjI-qkI!veod)(7eZRd}Br-4s~mr%eAn4Sz2wu^+UlGBXXj zwYUV7Q3iE)&rqRzW7y`KLDP~nlQ?XQ2w@uVIBt7+6CU2bnhey=LXR!d8BmZ*f-8g6 zp`sO`N}m8#0v}g{NIys%191BP-pwppsHZ_luCxWT2~683i-cQb+t~UsSbMr&j+3UA zb9A%6S^E46B_2a{WA}|@(mnALwOcrZ=|aIv%z8L7ui*q8U*}lPQf1I1HOl8Oh|8^> z`miN0B1n|ENi0&MGwsK~&w|v*T%f~{xL6MH_Z~bj0Tkq?WNINUk$uiQYf-Go^)o;V zDf!7qH41<_Y6Eq;dDl(Dgn{*a@Is~}jduS#ni)oH4eK(LUofVp?Oa*E5(A-=xPu@j z`RKmWq7U(Z1yVZA=`7V(98$wH3!YE>>93qB{0QmN3~=zpe2C?|`hh%n(+YjlVdb@W z3EXVPK%m;dhv}i3M0n!i2{;c($4Qj7$Sc?qf=qM*nUJi*C|5}`u;u^%#{V0VWTb3f V&S?G09)gn8P}fAKSj#2+e*p}P{V4zd diff --git a/deal.II/examples/step-42/doc/step-42-CellConstitutionBall.png b/deal.II/examples/step-42/doc/step-42-CellConstitutionBall.png deleted file mode 100644 index be03288e5b2839880c14a247b36f82785e2d78c4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 52558 zcmeFZgSj>1G>(lnMyaWe^Gif=UPs3F(j& zL^`CA&h7UapKmbKXQ7+|r)saIE5HDeSP$s46K8MWH3+URXybFqk;Gw zac$r`QP2N;v&>q3_65mqti{;}%+U>zvk$0KZq~C8xuFSEXCDl3ZLqTsh1UOXnExBk zX4!b@5(!D}4{0gg^CzLdzh+R?GlC0OA=-)r;{^!&cHXIwLLv`UO^0_TAh=30e+q(aWOK~FT{BqS&Z(b&ES8gpUTuxC@ss}p}H(9DNS04!n^&`)nNd# zzeIBP=aSee!@aPD7sS1wxL8RrV@#EF$O6AVE$>JLTidaVx}rs1`Dpo0XX5ZAV7Y@~ zNkybC^ZIaT0ja%DlY=Il+YsaG{?Z%#cRUpd>Q%eD59*`h66*VtxtZRyDi&m%H;SAb z9JLN{0WJvC1x|UJ}>X(e~jo=Kbd-lqsb_HU-sE@5M@%+>;e#Jg_7KesDawP;UW) zM)BYyNt594%t_~6xr%i9_(|6Y*X!*4U?P_bU?L;b^`>T0nh-tp39C{5g1hTfI`DD? zSBfN}&4-?Bo1vwE^aW0tcytC${~1#R$?aacdin7D6mRc+pO14*vt$L&rHw=mXPr1^ z#K4f4vFpI5m~9rI+7ttjl$1G#3qJ}JA9cL;Y#)I14*U!RJ2(IagMuA+LGr?uQ0dbi z%z318LkdYeh%yyKCkq(k?4BUD)tEad`6-jJA-ev|VToHJ?V8Hna)}P?Lgru)#j^#i zR%2e;%Ew!?(D{Chc}Gg|qrEzrXKrkm>-4Z9#P@9Fb;JiBh`h$I$RMJmF~tWlPX+Ze zhUN|#jO8``(-RjmZB1-}&5-Oq0|ptxa+TGfu^+4J*lD68Z}3}(t2wYnTiE5oemK!U zj9}nNfqP*VsM|}J_g$BplAKbPe%XOQ!ID9~AV0__)GMq;%1aDxLo2;9zDXS!=CqI2OJoIqn$`og}Zahpwvz9>Sm`XqV4e=)M!7p42k&>4vbms?8${{%mhzF0V($KT=BUR zTZQ9NuwpYysczma*@Dy09;7t=M5|#qTR?XpSpu9To+h>Yo{lKa6GL|0Y~L!dC2o!} z$2dzeF#vMdZHz>ML*PC;gz5!opuU!pCzTH5!zXs6+j_k9UxPX4ZF4f!EiG{Y&i{E3 zHU|wPC>}vmj|UYljIPaicCZVgaQ1(ykSnG`b(-bY4m{wS(Iq*yJsz4B>7FzZq6sM z{q4T3RzD=@Iq4U0u}m0n`IN5)?vshMexUWR-dGgp)A!wCxOLq|Fq~{rx9>Qfcv^EY z#K-P_w?H8-Rr1<~+Ie=i3o8Vbq)w-Kr9X{7RE%{oqg0)A;)_M5F7kluMVb>`zA$DH zdZf{A+vc*K8L(rJH$XRjiENHdURE1D23;^FdTqQg@g9t{JRzrfNpGbw^KX{)t)4oQ z%L#used^uti5=qrU{>HiPrdhq)U|I@TT*QM|EQu(9jKvLzprG{;l+0oAOtG#Y)Xa& zsG3RRs#}v+^^Q}I`^$*8%|%={vn99xgGHL*XFD0Qz?6i0_=%LCs+OE0xJ6T@{1!uB zDfVa)2NF6PsJR-IZh+i+T*Dy0zKXkV?BpBJ(3o9P#sR6$P9$QU#(%ar2Tf@Gv8*i+ z5!Zfd@|n~8_W<2}A4c-pNZny;@A1*w9bWhFNFs(t5yMV|%Y)QHgH6-~HJ)JX3%V7( zALBkRUNOr`CT@X|XxIG3)fnLOPl@ie6m^ zUYX)K1%#yS67h#xC%pTzX_EL^`>bQGyDJ*r`a3(I-OgL zEX3Xa2bgB-HD99zvg@soW;0VS*`mBCYCOAlmGcRc+*L0_YKPB{~*Q=wvnih^*dAR`ogZ&dpq5 z;*))}@cN0uJz8Lp6hwo(RcwL!*>vD~OqIHXdin>x6Z2GiF4X{?>WSu=BI!{Pa>=-xV zk*s|V=$R2G?4_!j1 zN{#w61C-N{cm+06Jd3`OPYwpvL%@j4y zfeftzKR}<{Jt9zfNVLOtWM-0Ss!~YFvL)T5Rc&-_tScJq^GTK~+I8VZ+*2yUI2=F1 z;B5%uHdY}vfw+g*9NCU<1i{Yc06w)W{p*`?zqcPS#!ov(5RW7F>^LqiK#zi=wc!ls zS6c!Q;cY|ILY5S-IK8uM^&yJ0zT2o{eD=m^>$&w(KP$yKLH#frxoR-WPfUL0(PdKJ z;d{??uSW$jCkvC1G!ThoOk#jY{G@TK58cUg+QtQX|Eg!pr>d9<4R=p1$oi7}b@lr7 z;|a8iEk)Qo-n`$r4$m^5_(YV_MS?L~5qdEqWtDo^rP240}Nl^b6 zUvS&|RRt^OUqS!U;t@Oog5<{&9Ax7I)w?UhVG%9*?DOw0#|LITjX&V%@1<#b`xZiU zt|8*GC|}Al(M4LIHu&COB0H!YyACI$ykN#-uOF5Dte?-qr9sKoXSYI%$-aB#F49RN z9t)w$^sh%*(5c4dSWe`m*s_HkPbqF(gCqfaMiMb06$+5EqS=`)zMLH?2HQjnz6xE; z8IbEnoE-l$Bo!|92|H4DRSj=QBZnoC{-W*jWeaoKQ=jN$vG>0PA|Q&H$iBjulBxb) zZ?0CwobvGXYGYk)lcZ?j@9ROlJ28zDhvxMu-V|YkhBEI4uWO(3&s{-mmPW^Gn5cOb zoq7Vi!WkI9e)8?S{z?D~amc$wa0_F~1c9mr3`s!IryWj3A9d0@sR-9UK!qirXPQ(a z4d`NPy9|r+akalP?VsyZ8LbyQYze3!iFq(;Fsf`|9-W(_9{fA%DX9ZNvX>KH2|0+JMv$_dCm5T!vZ;{^o)PjBZ+K_qSJ&KiLv(Ow0yk!x&x+e-?PJUKk58mk9@~8 zRl2I;+;-&?nsK8K>reKM|4o{P!6`DL>Av0%JM!BrkXvS5{1t~RN(d;H2+v&S5=U#P zh0Sv{-O?eh_0ri|Tf86ynPe@p4^|D^b+c-u3@ja8uCAzRaepghoq(`%l0Ca`{#56{xw4Z<7!~ zz?cZXsvXHxZ7*O@Tj6s<@e*P*WtA7skMq2@ZZy9()Nll|o#b~5vk9R5v;Td&X#X8) zd&km%Xp}*hRCsd{?c87w1_M?_Pqf|m{spLr@VT|?r)?}xlA98#J9&R1<@f_e=y|Ll z;_-Ey*n`mBB@A6UE6!&9ebg#F)7k?eV%*Tqne(9R)!Dw&jUNfV9?Pep@+Swn@&;wgL zyICxp!++-!|%lAby?)(~*Q}S~MNKS1sLvL+X~IPM(yMR8*U7Bx3J) zk}!cA!pAwQTr+oGXZ(UC;!ds_w&4}@^8A=JO0pm~^2>#1uIx6YtmIc&;)^5uc#XDt zBC?ZO8L2fvE+^ornVIXRVkST3`PyP~+sWtNwyGw4xx<=pG_n!8|IIL8*9;e0=TN!+ z=bN=>JMZMd51GLI^{kcCckQr_J)u`>A{ZA{08}@`Vqr7+q-OKbY^2S}pMt2icR%$t z4XowG`?03iLpu3%PSK za%slVgi{l%fcZ%R-tV+qyp`PxoWcI;XvM>kk|N`e_rACc6_wT>;g2_pK7L!TS@Emi z&Jwr#;l0$)TVSr8NtLu|b|u1sWaundPUWaiWz*PaP!-BHG$qpb*PQ2b6R~llRIH65 zF2`fBQ3^(m#pRck(|2k|CV-H;71Z0a_XgwY6=~0|f2s2Id>aP0@f(U^ZN$1-6uGAbg8DiK@bqqeCJ=8+{(D7 zr_RR4=2rXf$G_QDzm17Mp@WjWieA$ZtR+@;_tfi;hDs;E0lQeFe5|TQrRC(^S)EX#5R-<6uf91Dd#@#eJ5>eyLmZjTA z^%m15@*~PxhHRhtfVJZA1ToUdeqE}`xQZFkG4Y^U|QPSl#IFZ5&u ztyeGpkPmK&VI~}v5{}}~CwBXP{Ls5YCP90vX=`gO9WZVD|6%`+E#CFz&;a@~2(M!b ziy>76TE(xOt+oYdb_jO{)vsO);d|eD*sWd+BF#t}n}umlrTOlqBaz$ZAng;sS`j}K ztawMhFi?r)%sFVjt$~pC{@Yg?x?2>u-o&V{=&}61 zU@Ql~8K=_e&cKa#@82&CnOHL?=w)1MQMxvqi6)e(bcdY#a8P|T%-UAV-1 zR{tP}oZFX2qBJ`{XaC17^4vviMwu#)kk<#k^;Ajq@H+Zr$hkiJiy=h*akLt*9y)Oq zuUP4#hw+g|^V9G=2>9DeE>t=rt<;I!-ov&4{vtit`{gZU3B_#o&G%7nwo>Jz-(P|M zmRM91O}^)ZffH;JeL8~v6R??m@%FW+N6}&#kDx55CoiBb@XSY5_DspF~fdEXX+JgzV+u zcldkv`Ln$H!(dcK{1H-i#~}FZJ$yB7@??h?A;~{^LRx}<=d8ZLpGhGL7Y8Hs0JUd^ zm#2Fem^reG6|HpHD!iCOT*i$4xhFa%uQ<#Fi~81YTig?Y^>|r;Lz&Xqn0Ykdyi!fy z?qmW?Rg=do4HQ`WjyiBl_^$o}?ss{6oA56V%`RczR_^dSaZ)+tDEMEjH2~Meu`dr( zM6K&xN6U$K?=k>xE9Cd1%C+)Nk!;DTMQDIZr_%no7qB#24xM#1Lr zdzCn0>-yS{AJ>{_Rg5x9s%ByoHfjfOh1mMF_C$X4cE%)Af~DV|-FJz%mIn&-E8YI! z4_Z}}59bom$G;~Bd#n#TOdNZ&*8*Bjzr#6$_bPJk>e0QBoryBMB{vT)BUQ$I0t6+K z?eCNRv(FE=7gyfa|9kEp)yA)K*uGNo?G`#<*vtvx*~T?<+^XwUoTb9rwtUawUZy~~)ondmf*rSHZkdG-yg$r&z!TwX_ zSYdKZh4Iu!+86L51ga}~m5*OXaxf$~Wd|(iSRdW_%J1&(PB>XqAuMFL$Fy-pvU?t{ zRpxm7xagQe*j*XX&sMCit`3;}@tj-2^;cP%q*EXZ^l>lDGbEV^EiqS1400lA5b_=~ z&0u@K#-~fsrz>;qiSD@5J>YgRZ4N1xzP(EO;YzVlAl?VhUYe}>_v4bvzi9oxh->Z> ziVht~0JT-0+m+(*M_P$|X--wAd%s(sU*hL>%JLb`l=B)q@CBHDdbDf)&G%!}=gP_r z5WccAdfl@cld4gCBUjo>&!rKGGB*h3gOOyBMHZ+WE|9Q?%wQZ^ux&KZXc>n#4?GSh z)e!P2IJVoLnmYW^3h=ms-Tdud74-UeHTPDe%E`23&fzmW{>LTv6Qad( z$0=^LU3AKvmb0Z^gw7xSx3TQ(LT#y7)Hxoyiy(*bPzrf+%|&}M{V?QoBK=l!m2~b! z_^-Fvs_`NUiC%IB8MbG?%aG-_BTlK&#jj{cTi9F|WvIE5cbsUW#-&g zrzj50bz{za@@SY^W;_>17++N0pNSQXY0Cj-YgHGxwDJ4*@1eP{Cp7YHlNU;jy|8yq zUCtDWHp>|URPZ+W{XEia3)DX;R=UaDKWL7W1?Wr5ON}lGNI~*qp~8b_PspC1TZ4}g zIG~;I#)Zw}{iFl;5lcsI9#cB5f|Qd_>)*Zj_udL{3S?yYO&kJbI9WvF7w;AsI|Ml@ zg`J*mpwYi_e10L^XI~s~uH79r z|ImB{7DQ+f4W0JX3<^4iz}d@uR)*2Xm1skE4D-GPvcT!0O6bYQ%84u7et&#M{{DPx zNpsk)A1dL$X+tl!QM(-q5ct^r_?3y(((lUB`SUBoAAbXWq(0X`N^3;TmIR|>$qZOX zTizyu^njjB$W~&`v)Y{h-!{`0p$QrGtqV}wEErF4!$QI%IQIS+-8tha{%pgkHeJf{ z=cHRj$fyjc|DM*UA4*FyQpJ;yBuU?qNMm15Bt;GguP$-iVYj=w{o2?U5DN8;3$g$Z zgAmEjJ=+?GJD7<@#IebF&JpeS$B&ysmew9;7W@4PoG{0)LZ85V)tEi>U|J*+V4yAV zfsMa^{|*%N0{*^?TLT8F|6I7q6@bJD2oALY+kl$@hbH_PmkQkZOE}CS+|Ka>({1-C zxX-mESRXX93f$&t(b$!XR(L`FKT;UYd$jM(g$fs4UI%)4*1-VJ}FZhDfQQeb2+7v!sL+M}gc*$NpUu?G)o6m464> zAiOmVwvaOr+xv9|>o)!hc5gEH zCI9cpuU`*Tu7f{-l@N9cR6>ZBq(?Lhz}W&ig)3_TtebyzttNnk2S>o?=jWTdRXczL z@gj?MlJ#h)v}PPg`#z-F>8K4^qY6mzAbxejy28+es-7ICzaL*@T={K*bW_1ib3QLq zCta8t_sA`2-CH=A#OLLsyULi~Tp-1lc_We2?_7bTbJhzWp}M(|dw||p;QYO}k#p+r zh~+rvG^E{ddH8~|*h6v!u|#j=_Ycq8QGKZrB5$z4#(;*YjU{vE{ct z3@J@ikkPH)H;geaUeN5nt?^mma9P6&FqAkI{J|f; zNx&8LW83=kbckqY?bR(kdAjZw`|Mne_tG2XU_dALmQD$PI!NFG|7Yt~_VPA+Z09qT zZ7!Cjx#LeCLGKHjn|AGBQFtb#7*km!3~zw^UQ8AwjXh4Ojwxn+tWU?3VxbihWs%)L z$a`tS7dCrA`MXp&*%D@!9jo|(VJ85f)-S<=%>KHdeZW|ij{d$Ctv{Fn$!KD`vro|p zF-U>zrE@Mb0RS}MlLXGv%89^E>`w^rG?GfSH?k)f57fy;ga@g_8cT(;8ns8Tys*h;A=b`MD?FCH@>xU`aoYzXWyV%He;6g+2wA7zI3%p!!y<7V+Rkm0qCh}E- z)U`|a%ma<%YznA{6TA9?whn)>1g(2IvV68`#3KxYUbMIKKNe6b8t3xBVKNtl#Hw>` z07p3fFX|WF213g>|9|&)uSq8Z$SFMMT96&M47d(AH=q@U8QEz3VWTGzu>lb@E3?5y zDeev$zIf8htCL(96MZ>OQDU9C*$3R(q~BynBuC)i=4i$nbHK|*Bv|_%a(}I?{Otu% z`oeRamoS8c9MM2g>kRvd&-<)poQ2Bg6`cm&9R9h{%t?JFC-9hth{frB;Yl2RihWMH zlaltCSrhp$<|%eEC-M|3Tj0fA&P1W?siva!?DoXWu<2jJd%!g(?UD06J>8Va8U=nU?| zO~1Op-K`yKQ(WjNkPHq%O0-tJm<{k@JM#*z{s|HL0Q0-??#mY+fRf3r)l2yq^}8S4 z&2GJ#QtsR?QZ+t{TP=&w{)^P$R1%LofMOuemMS&&ZMn2FJz_5avKP$dYPefI$S3O= zN4qMBy3rUWb(L*-gEWQTU;Bt0rJ-!ix3%J+}8TWMnVMOtuk%IrP9^n4H%qA9G+(c~#c8YYlve028Ykl9(pPvBw z1LnFy*wH7Ow02_?iR#$;mLZx`7sbaGe>R39uIA ztVX{oK&E~;05~4VTZ9X=ALkJH+f_jJh!qx5n(QOb&#iyndfxD!#Cqno2 zU>OrW3wd(Sa=Mq!CBKIY7Ev(J;s@XtwdWecvk}~k;SDO!(rB~)jy`H0)z|SyW68V@ zENOHZmFy)Lxk|cHgf~w>MPbft70I*&;?y2)@WgKMMUV!<5{GmE3cu`>z5Q5rjX*c4@ z)q=3vitrl;n$smVHpi}1@!*5aGQ+y9j;kPjeEA_QN5Y{aRosp{hxZwJ5om@}jZ~sc z30F(1?vH(TUg&WL+7C#ggt!5V{(K}OGoM0LY+hLcRDz6aj~Eibw>to2_ctm4ul!`! zN|ddZTh9YMr@Qo=8BvQLf5p#w!Dlc;xbvyDffO=p2@{FFRpnIF$tS4FZlIRdC0iJ! zy9`t8GSxo)5}rqz?nK9N?ZPdyrks7<@U8(YDBxRAW4)1Hzy!X5=vDe{U0(Xy#G}eT zCDjY*^p|fI%I)Ppza)d-AmH7-ytc2F*1oAfT=&BTt$i6e>OCAbcL&?|a1pO&yd`Vf z|4z$M6)Qg!7rOH{!@d4+t#Xnj0Suy>qx{Fv4AidLX3fAMc`W6neCWL%NmF;YkU^`o zW8f7Dfcwkm&*R<$ddohia*LVUvz&xqh9BZXIldFK1(4$BzJ6_sKRE;mQ}Pjh15G$K zbISSx0FS;J@Hij7H{j@^+JIZ|>!u>Pl>&DjxVhDzY;|^jr2$%G-9q|9uqMvk16Z9J%I`CU~GGGGb)vR-Wld)+CZ`OwWoWn1(K`z@R1_=T9Df z+F=#L#j(F}k~V7q_O(qz?lGVAARgG)zZswc1^)w7-RV?svOeS(q?AP_rNk6k6n)sa zHQ$NeEwX+D#HvSs05M#z+qY6e?FND5Jo5a-H}{5P+kgd}01EmETszR5{ZDsC08u_9 zQm#ieKzMfQ$s}^>fF9xjE}4M=CW=aGT!7NF+)89~tsFtC%7F5D%>Ed$Mu+@-bE5`B zsNL>)_~_BD-(5|W11TM@`kg${(@xw;=h5y8h=(4#sURvG@0Oz1oRyGri%|1Qx4Nk? zDu6Miq2oX%I7iLq4H7`N(Q*f%s}YqaVB$CC+WB+Xr5?ne8bxnZoX4@*6LniplZ5&w zaQ36I-&c=+0bxivq@j-5c53)e3*>Icr{Y}hA-FTJKnk@v>w8n*9ul^~u?prqR(fJv zYP_Inq4cQ@$1VBzkHE+#fSZBHTohtkZRtBY4-)T#IKlyK5NjYkkhV|5DH!u_Wz~Rf zHXs7`R*8h`*#&X#GPvrD1v1X*aLpZk+zn)(rGgxq-?kt*{|3xU;|2Q?UdR^eHvwc< z8NiSi790t9u=xy0r=ICZ&h^QphoG&8$lAcuAf@*mTAs86fB{Z92)Fm8^hWlT?hxY> zlP9{wT0%WTB=qHVkzADw=CR8?q4HvE@wrdK)(0rtAgvJ8G~Oy((b-6Klpw z_mu;yK17w;SYs3Z6at~X%Ngj1J#veyKs)=C z&HKFv;C&j-kMHk~@83K3<*EXWY|q48AYc*Nu~Ldt2G*E!GRF_p{Xk-( z4Auw|)U42>r4*~c_vzmg9*X1|fzwJN#zAY|c9^%oR8EC(*1%UucY#!Y;U|H~?HKEv zW&&5yx$t}T{EcO&mdmileu!|>4=nyvauspm+Cs0rD%pOKQ_wvEFQ}#GY7<4rdNwvb z(3+xgAP5Qsc0MWC8{6NkA1|GwPm`>RJm`n$E6Ak0!8C~D91;T-8uSWXq7~?$4pI5{ zLnLWZK}8YU$r!G6ty_7R%i}G)RcCHYS?pihWl?QVf4dtA%y=tr1vW_cC!{b(OC%S~ zME{CPfGD9?mgBF5?|rZ3RewAl{((hys`mrq>voTSjba`JqfQfu+_p6GPka2J0C#2{ zireJl16Y92yU)|8qUfnjhlPsQ?oxRAxQ|>+8TxML5*VKY#H|b1r2E#jVsSsPF9XX_ z3zGB_?wl9)ugzo=+c7>siMVvN42S7V#bGQ^!uoyXu7x2iekFD1R`>-AugZP25Ku*5 zS!fLZ#0DSR-{;Ig2DY8#h1^;rot?NjK0pbYACide8FN>QH*D;uQJ|M>waWGN%l&ak zAa#Dy05^GB)KGLE9?tl1UM+f5whxEPa&Xc)ZYX{edBT7-txVYJ0{vbFw}>%X^f-_# z**mu^fGlQxo~6q1_2T>^2o(#`V0?)p5KV}zb(n}2o9~EVX+O95f>k?>#x#&@;g7Od zk>oKWbw8-05UZPQDV_2W*dE0eit;JCy+$t|@jdUP$H187>6cx{^oO7MLtOh5s~R% zfHnn-`s2woaO54t{->?^Y*4C@_|$|z&!AvV7^oK;oFkrHscALlO+UoLyhm*F z@iEr6?i?6uezMwG&E4YxRZjZ{GF$W8%;n3M>C9~2yw?Ne=LOk{297Ckb6VK)J9HBRYYukkUxW!hT)<7)bzoait7W`U)c>4)g<#y z_?huz@`JeDV8PpxR69n{8@T6{Ciri)D?L7ZYN4bDinpv#g~Td3GqE5j2MTe2KZS&i zl7W7`-BDe*kOzjT{0cUN@xAK%X0|mQBY%6)k&73zSRn8h1?eZ#$XfB@Ucq>LwEvQW^yO_-0y_2y z0g-I)NMH2>C<9?8uznoKB0wCmNH~VX!_SsYY!$QuH zSX6jQE>O+w!~!~A+_LS5QqhK89V-8;^BIL&LrVYcwK+}8b^{MsGhWc4YZAAmGKJYKn$vjmR2!q&+iunMR%*dsKSoW&XKOw+iEFjMT4Re**AI znh1QJN!B8{evH=gbStLxpsy3GT_v*a<6ZVx*wzDm3}tyM3Li2P>W-i2-T>ZoV8T7f z{+n8MeM9A%u{@n0flTtUMai8pW=2aEbtF;%^hg>c62V^sM2tWua3ABe!JtfpU36tg z0GPcZdRN}27uK9=jJ&W7REI_%-AB6h-d4LMB1A~rvpnm4zv5aIq52jMI zf}nRWF*=(HF~#to7LF`rGzV*^P^cgIxQeR$)Iq=Ue3@KRG9+z;aIC-1k>0E%xrCZ% zgJIH%4SI4{Bv_+@a(n1O(N}8`8lw$Y1WgQDsx|{yT|RQnemX2B*Cqj%zoUh9Dng^Z zl%U5%FDfdZ^TyBEVgLIZ?B|K-AcEc00``zKa8bJ}7MFR{L z95-63a_kaal-CVR9bEO-?ZzE!jHmOtgxq^PtCj8>qPg}HzeLN=egEXhwSL%Cawq$U zP*u=9+odKS&+iGzvf-7e^tY zfr{t)pGmG{Q2piP4VJr(29(KVUJb-Zd4w1(tqvvV88&4kYxd7uom>V8hW^>`Hr|xu z5v=Lj;fkuF#-Y9gO#$Q1rf5?-tUaFsGzvdvKU`FL1Tqg$^g-!?#&}F^5*KS3`n?xq zRGf{@T0Zv;#3S2mD$N*Kp9Wh8V^0r>E0Jq+o0+Tb=W0~IQS0-kEO_w`AxYV-=`iP; zZOnj7?kgh^#Ll1pI+Tt?DoulFj0&p(=T3MSIEI25lHKpC5(4j8g)}8UqS#+TJv2Fm z=t=KujT(!s8i@?Rlm7YT+;>X{&2#Nipt<#>lruQ$GyB`>?-RS7 zX+kYEpFs8Z<8t!J>xL@B9HSfn$9FgtTc9sG84qxub^t~sG@h5KE;{6hT-VWjXBIBu z`|UfI{(D+d4rQ(2pO_0vs4$TbUh4{E2^3JE-$g*G20ifqaUjtTR><#26&&aQd#jv! z3R7=ZV%s#Kt`ah}5na%)(0m>8uzctB*T^FZ9udm;%@jg(6AVH5Aln-i0Zs2@BjYuz zKo0ZXZx4R9Ry}>6MY`+cGbIG8@IR-sqZrnf2T|PWfxYu$z{Zdc!v9D-9)GWYO_cqe zMA$;albuGgK=c9!ceG1jEt=MXvqFqYei_T zlQ{I>5cJ?79Eb^$=}gPs4YlgyFsh_7ksZ9=eT03CS983^k-<>cF7hR>s2THv15!j> zneUT5)?IAk;dZKEyd#*dlF6iadoe4!`Q>Cf`8!gP|MuhnidBWbri<40z-B*Kp`KAd zQP5QlNcx)}DqK&TS}pVo6ed zgr>bCP5$S^*U4?)nfH?WAGMJp=(+8?yo3Ug@4pPLarknS5PPAfNUn0>(kNgY2}stz zBj~I&nyOwQQ+eB01ey%Kon-Gnl$MT=s<=Z^8JJu5w{Ba$mtSliuOc3dGMO<=F%)+N zZ>kd*pUWOQQ*gdHmN9#mDHy*}4tsIj>X5CneGPuMh7V}|XVdx=?NF1T{%8$*BUQ2u zkkrg9U5_r!hPDB7bWIm)^3jFkNR85zry02%|$9iR` z3+h+x%e!NLaUmrw(@gm4Wze7Rg4hN3no<@BF`T-DpE;%~?7f1#0Ek!g3QTb_s;LY5 zXUf1=h}~cp%BQo23audFspKHL=!@FPQ9R{qrJDcq1m#X?jsd#3BX|6e6t>~|>c$(% z>TuJm2nlu@bNS6z6)Ugj!!KqJcyfWZQ!A3f+h>-PVu1>dAcYCtL~?;Be!KV-#(o`J z-};dyVP0pCb)^g18?m#PMjP<3MI&?fvt6Z{M=a?Khv{S5uwu1v=vGAY0DLt=7rTUU zfIwrLulwy&<<*9Feu~!Ec+q=jYb?BW#QU>#WzPWQzpq(@{W?UifHYzr+F#v_;b*0@ zmZGcX!2(j+<=rsX4(ob&=mnv_=rKINAT?;zbVFKOSMtJ(Z-Seig1u=g`I%c0AZnz+ z{6o$7dT%FC(U~?c-%FWHht24aZB>QyAT(2i5rszVbpDroGHCuM`I`mzD;Nlnqh)ZYb6=YlAJym{gSzHlO*{#+5*!M;gF8{^}gJ)0=a2q z2BR|@`ekwrA>f*ivN-y&EQ|zo=(9H==D5v7kV|i{Rn?f89F3`qb+O{v1b?okSgSjn z-tsn9jX6}BPEyDppP~PuLzlL`?5odB!}mD;OR&QQ>XBS=CGf;jk)CvI!I%#ZlrDIEY$ ziuIC@FJ8*6nuj{hqP(tQqY5ctfo2e9YO+06I(i>}(>m0DUX}^>zRFbDzMLK6QV&-( zJu*PihP8cw6KY<8B3NTGj})_*9&$C_HAOfIxH>Qe4|l=tQJxz&4HFm6T%X3+d}Q)*^uo9)6uH55-pJWAf9Po_%}ZyuHfzZv=6nHP91+7C?#vNv6N7 zZ&hQeptb#FOOd}<4%V;C$Q~K5SRCz3A;~PN9Fuj19!Mc+K*W*1kD?)k&@xV%! zZ|8y&=r1ON$eS5p8!?fQM{lt`uV^0GjWkRbIdzGuc2n)d%RV-o!e-z8oR@<(wZ_0*fZDuV=P)Sk6Rxh_BALSmg0$zx*Ij5f=I_`8%F==FsYWlQR@w)T}gq%Fr@MGxw?4W+;#J-WOdF|KNfq3*Sp8 z)0|u2&B_~Ztbls(tOTKHC~I?#W@o#Lu&;Zy%n+gq+OzQQ$!sgd{qU_iTpwNsb$V~e zS_d3p>u$Vr7&Smk(Z$LKH#A+}l>zS#v{dxYza>3alJI1rf!=*8RmCi$sabThiH+C4 z$2pndAgoPl4l=<1NL42B@_LP?RC2jBFogFkE9R5s>t@N$#hvRY8NVvNHykQ#oK z(=~iXw=bYmPgmt+lhrcMX~|GIg$o-X6OxIay0S+#FTc}m=e?FANPMjh@11Mw1OS~w zJPxE239cNfVOL19Xqx4X5zN=(8YCa0Ldrz7au?~(dfOlal)jnjNbc^63}}H^>f4ZG zGKjQv11?Us)J=ACyeB($yC$~O#isu+|Bllu*a5X{fLVuI1O-jfGZyll%sx-a>=2luDSxDoHD{E4aeHiSeC2xtv2vdA+Ez*1_l}2FRRrg>nG{n;P(qO&f zh62RkEOD?3?S=`#wNJ(%6+baYHfGOIEf5z37IfbgLU7tFpsU>%ywD+2Zb!uZ!6BUg zQOzR9Lnfuy$PXTv4}6+ARIWH|fP#^J@V^}&?yYgV=SKmg0}%8yraEJcP41R)V>;_m zT)7OJ=C~emc;4cL1n2fM5knU5XLoZhTQ?TCZf&T%4v{hBD55wJO&Yk%&>5tMtxAb1 z3S^Z|dijOJf7y_b)9J>4dibh#gAA3BssY}%MGa9kKW84ieR@=CE`|H4qP^d@gkjrW zQHH)4Ve{|d8+y=ZEt^|tfRfjk6^@HAKFD|)yjB;<`O92b|H7}A$YkuI+dV1w<4695 zi-^bNQR1tW{Llp%(p&XBWieJd2B8}&+RtuKTGUXeTZtsT?fENlGnvqAp`Ex7Z>H;}|olMT;HS1M8^L!MnwBHuBtxUQ=0D39cBiY)EV zxMv;|$5#D=k^KQsHU=??bqGpbmxuOEYQ2=PF19yPu0`TWEo-jCwDnVPs@M&XjdZ>j zvQcd{MNs;)KmPkrRC(pJpM9+Ez%>XIRQ%lnON4r|Lq}cv! z_PnAc-#3*^<)18UpQV;N2J(?0Lte}O?gc;z_q~FCGQMii0$r{++Pq`_*6FSqYmF~b zf{pI&=pCh^swnBlP_QQXcS)K zicxW&?~agGjDBy`pbpUX)rEKcJM49opCR_Krb)yX*xDP!>wOINtrUnK| zfg|_3nHl8E5SQ{de%o^i478%L7nc{aXu^lw?ENXY5af6MdFSekh=_cnCnJ%53UYZD zgY+TFn+PB4&hj``nr9w1i##WqAFg7TB_5>VHi>r1G5Ek*-G~cQK-SPDVFV}B*HYVF z&A-|kq#BYfFZ1Nf`BlKX5|Ly*8e#!6BzmW^HlL&1GjaZHhQu@rA-nyWv0HDs72{ApzcR)>ul53nCq1 z+8lAS=PmddG{u&DH;Lx&vHOEm(|^t|l4YVKH^{f`;5zP|Td`=p)d)!$gX}t5bz5(~ zBMm&laBQxupSwc8S!~ui$Jt`T`&(x>5P2Y8DZXQ&04Gyw} z>F9IKn()Cw{48l)>QK%7UqIC~fI;`XQJk_TQD)rzHTP4ao`JMLUn)0ra0xXKJ`p(Z zij*U##{Y5gG6t0`&nk%^XCDhV&hQf zeCKpu{;valz~b}ER~aa!yz_7*2605yhBexH#ObPod@d!N0UXMweh32omkCvO!fMyR zxtDF-{RGsgSM)f*bt!JVB)f5kpp6~H)?AhLYtV)7xQ2n3#NOT9<#1_?P(c_>9?%*& zH|~Y>gx(_(|H&v#uwoM$f5mmu^sf9TwkJUEJeW{coy2A)%WYcl0&V``LE`fu%XB1} z75DJn@x07C^Z`bYxcF!MG=;JNu9b;mhsgczZPD%S1C50jqdAF>Yv^jkX8iLpGW|m2dU&;ONBL zW*LtrL!o%N{WMs12*W$lgvfWIQ-19K@{6bSgPHwcJ12hn@Rv%OkhrNrR}aiEcxB=2 zW%l^DQrjm~RcYWQ^0mCL%KdVgG_x1eGOjWm!D|5F2pWJWAoOLIgT`I zj$gF=VeZ^E@>ROU)CIVa3j@|blw|NKQBE>R*T&bnFMyX5yi4(+rz3TP!w;5zEM81& zy#fbNyL`FqLFmidB{kSKY1p8ql{{#ywunQi=l3WLj}Isg6~0~HPU1*4l0w$AH(OXE z&CFDdyOv1Of&er4!%v@ThMJt6_?eR;y7X!a2a`m^XBO@A;!`V9sq%0!$JkFyi8Pwo zw0BJ94aSy9R9XWe!-8Zk#NWNZ^gZt-u1pKQu&H~|@8_M?FQlYYWKbNfVxOVHl;Bf8 zGj0!{G{k6bs})GYj8M58kCw;nPXAEec$fF6uyc%T*$5P0JTPoAE0rs9H%RgKu^^az z)`e>ddVIoYlRcA<^@I9t6AsfF@mCGRjf;IrqObPP`c8>1s5zI+c;cJ4F5P3@L&6l* z4rfU|zK%5%*+k<4x&Awv3f!V7VE!w!e1$D4_|k?`jxpWW3ZVF_hCY1gu4Jytp3E#Z z04c~gkA4Hr^vmb!?1BxCq7>0lmDTQ(_|m$?Lq9Pp%H~7s_xDosAbalxLXU8;ec7)5 zSAE>&B@^hc_HUc-i`dJ(EB|vKS*xAL!4s!Z_(m4>@b6e&e4mV2q>HXhjn#H^JxrNU9YmSOAjiSX9 zi+JJ}u23X13z*Bt-(@%W4wTdWmXB5>sOQ8!f@k1YbaSA8&6^%FrZ7F!=p{2mT;A8toOf%YhLeZS>rhY_*-nB$b zX-umA2M-*QK5)Ly2_4H3&?n`)E-1MOup3zZ+xZ2g3ifZzE+0@R(EJe4*f#Bl zB)mK2vJTn+i6~7p{{%ffTHfZX-KOZ5$MXTAQEh`utugL;kh%_=sYgYB076w?du{c~ zparr(U`oi9kDXe8vK--}fXr@h`oc|x$2BQ?GD5<+g>!!b5V;X2!K#0@znY(qMUhIi z;-MsG-e7cRG@tq4y~h`hwEY!ak2qVr>;R>ZNlK41EVP>no))s@BR|zkf8Xb7QjfRI z;mgyz+*8)?%6tOdDcBq{?3}-q88lQy#tmTC)-JqA<>mf(^{LsgwbTG4MAFGStsD>@ zrA}b5K2w{Q9lw-Z$Y+Fz&ye^qI{=^3p!TnAF)shv>1mmWr~Tg5$xT=R@hI29>czSo z53Xk4o>e;+(+-0v>U`IKJqw&8T6*jkD5pBzA6!yv`C2bY<6R7Wu@Y?Mk34;2j zp(QI!3}hrod-xZkR>SuglC3hBPDrL6VYlP!NfO zA|P=Hl9Ni#Ij12D2&f=ANlt=*ARv+jCFdkrG6+h}cg_2L-~XPvb#L8Mhbk#c3-+G9 z*Xq^%>+Yu&o4sr8MbK_+P@l|Zu}b$dfsJ0y3tp0rNSKyM$m9KnGy};_=(8$bY=woO zM+$!ggw-z1s4!0NVu7;8venfCIJ!?V(x96r1-{7r2T z<)~~-Xru0|GP}vK`0Q19!fhAs1E-{~I^yL}kP}#Hee_V0pL02;XI=St7LTyc3E+JC zR3sj!xxCq8Y=2zB`K4wUJiAi^%p0M6Ha{_PC^yzE1i6tW2mm4(?9H+XVW z4GSrYgdiZ?ZypVUeJuL)XSf1YgnN;>f%U8!hMU=F4PrqS7J5{gghc60Sq;abG1m=I zWM4zz?~ig#!sE>6X*@NxM;^Pv3yTj1ol}t44`B?^tL}9`<)b9vBD*PNml#>oze#@_ zR~rQ9;h~2cm<(R9l_H=iNqs<$EBe;;QF*>7Vn_;W67$HWR>aCNE5cx!N?^)>6=${d ze81u6gF0R>F7%TLM4n&RZ>e(Rt6q08QwvB*U;x`J0bXX~cOg}g9s=OX|Hjwrlka{< zgO@&J{v+7?1#=;}mjyRy#2mPi-%=wcP{q5E^vCkdt>sc5UyFsldsiRufqY8f&Pb+B zoS-vI#_TE6g!PZvhjn|2>dTEm&%4e# z5Ahi*!kd)%pNeC7zIz_=Jd>leR6vjELpYzRKOR0bh!%qe(gWO&$^`yZ zY)6iRm&8dZ_I~Y#*ZL|nz?sl^X`GftsY~by9-Y!wDJ#8G7ANYj zTaYM|;3^r`Atr%Zq81+AQko!>fjVT;n&-E-)p`q8_W4zYw}uglbMGPj2UnGMbHa-+ zW8}g?h$~bb1kQKkuV&YuZAnGHj)7JD?ep&S;a$Ge3CU6`CMwtX3cMqmvk;qvg@9}+ zE^Q8`JNOSF)F3IJQ0ak;d$9a&BuRu`;iqV}9Y`_Lq592n6op= zS~d)kJkU`3Bm7v!c_PGhgYNM_3WJeoHZ(YCnid2}$C3`8uG5!9zDsKtKcp>j`Fdw4 z=(%-5@(4QYrEvE^ZM~eXIa&$0Hxo^N^I&6#vhPZN8PTKqIc~GZ?!&Q0LBa&^zBVG1 zL5klca3K9!_l3I}N2TBQD=|U=iiqx8sEPyD#^69{O5#XIkESU{ei;wYl$@PPnD^C0 zZ%|MK6kpsTP3@tOy_%6a)?MCvR;q7#DAL^Pz8GUT;Aq_W7V&E|v^f~`s7k*MEXR9R zg)9Iv$SC_i*G(ZxL5LoFdS~q~_sTGr7E+_UH6_uQ7088-usi{{)md0d`9gsfpSZ@O^(87fCy!CQqj3J~k6+QDsjs51MRB!|+Wqv)#2FT{9le znjo(^E#_`ipSU5pE)}KQ2{#T;ODzG0DJzTP)vB^yb5Du6A`bO}~Cf>UV&?JHDQw zW)_I0{im!(sVsMNtM3OqmjTs4Aa>EYGBKHv!y$2LXXPd2(qj~ zR!v{I^usySTp`aSq5qnDl_w*GD#!F%%Pl*E=Y0&!cdp!8=BWss-ha` zK-=IX6I3e-05v+jxzAM$P`6)$#(z{`lyxxIIhqpq$Zv_dhTlEKt!|1ps(0VPyZZ$>%y@BMy@qMDuTK{0+Fno*unbGxsZ1kG1v=&`l7h1 z2&fOa4BKC06ta+nFG+z;LrY1FwA2}SIszG|Erb6zeHKr6ju-;8#h)-QsvtLG5Omn|SIs$fYIEP78WM!c}a$W%r#H3jFj zM(w14p6dG%^p{-7OIjt%&t*s&P+j1RQ5!Zq1CAmev-f#06x~P2 zTp_htbguu7n0V`#C7H-eCe*^6$knam?n9_cek!4vm&lu^=rH zW20MXWt^M;J@A*e)`(0GqQME7F;X_L>vtjZY$(Wq;-=EVt@FxND88zLh~YtCadHoZ zj}PglXbY$k=wN(hP*tJ~SNfm z!&4g^nZwf`kT~BeEO)zK(f)S{QI6YzKLzE)sF@XboKj%b_mIKk@}n|9gY;U$>gj;= zFzQY=UVbU044qY5)%h+!U#Uh_q}3X@WNU6fkJ5ETi>1qAWjkQpn;gZbqVZ1^a=v}r zD5S*xy)i!uN+RnU&}SDwnSt3rt= zBCBF(QZtg6lq`uf3x~4JmLM;Sma(3OEa(Zf7{&mh>|*y6cwbXoA&y}p9M zW-53t8vS2kob%tP0W-;@M-Z`K@AqKHle9<;i1DN2XPr2Eqnu#<5qJe?92*mPJ&R)t+Kh-xm&uR1V$fr?20?5@p=OpP)ek@ zG7QO277bd3db=9N{YRf5=kz{pxv$^s^=t_!SyhbY_F#!(rQ|CwHAa?@v zKVBK-yRMm`j*E?!;o6-n$)3L%6D$3zVK3-%AkTPU>L zP8$k3J)2d2^7ozH>xW4+1XV9)f`JoxerQ7dSt2Jw5gX(&B*`!dHlqgX0=rcmWwH2q zm+-TPW0{B(YFd^X3I*wJ;T`qHK}=Xhf|%D!<=iEGN^IKuEb}XOB0Rb0Z?P5feRx*` zW6s)n3l!~4&1;`YpTUfYW@SOTp(l2u~4Ey+Up#xx6aMBdnk$m)j%mEpK{R>R@@i)U7Uku4hs#n#Bqe#oOpIO61{ha;fxT= z9pf4P$hW(MAFhGC(ml0vQCfjC=tSbFLz@B$NfWK&Czq2FC*xEdZT=*O65xu(eJWJNpSjnVY17%tOE3fuB zmi$eBc=?yLiDzv9B$B=)o${2;%YVv)ncK4Jw!p75?#F5|D*o;6w8hv*zJH>^70D~- zW@5o`Z%}8HHFgKbbuI2eMNfte*6y4$lCFSqy$uovGObVPvWsQB7VyQH!{dBeedd1o z>N9}4(YM)!m}IPe!C`uXSLNC_7Bi{fZBf=%x^({ao2A#pW6}vAIkJ07-8a)|CwcRm zW(cXL)I(tLKpZ)m6V%ud*z)?NZg5*@RH5CoV^pyl(_ek_Xc)o5OV~l2d*mVf-!O>v zX-NSLP(oi&z1!*!gbhsH^SnA5^8I0r1MxMksqyyE{N;8G^c;z}$a@10sSRFxiEB;S z%~@i{x}Wx*^#~Ofwe>R+Sbbc2vi-T#TiI}E2`H{EFyuCIt5YpL2&CVj%tC}xB065dY;vVc9%JE1D_Exy z!nZ&OfZ;eQmfMXGfTwXlH1u?_1$6JZH)9nFf=0v8?xD|oRwOaFqb$$?Z}9E9--5$b zXao}1@|a*p@)SC?#;l7i!jHOU+YBsmLwc0Sto!~H?@2oN8w$lwr7lRaH4lLF&`=e0 zyMeOsB*1u0)6ln3J-`O^Lcl!bbZlXawNJGJKDT2=P+ z(WyB9rDRE!eIV&@2v&KV7)T4750Qn;0>Ro=Ph`|&-$d`q{Dy=UD8HDV&!b{ia19qY ztElryy2}%zibnv%KV!ezCVkv*DS7yO&Pe-F8J1OD{uZ&Yf91|i)SEU)BUs}#%F*}B z7lM`UM@A~*ZO1_NHiMKH-LuTakRZcU`5Y3rDBo+7abNj;D$cv~Lfw`&J0xlS*)mwS z2h*WvN&`U>+iEqHID{@@fv;VR`Ujf_O;?jRax|XeC3piJ?cP1nF+$S+B)UqTumP7O zoUj2RQ)Z2mv4M=!NMGRP$P;G;eeT^2BEtys-kUbEF>|H947zyXmy03#3!e<1BfV;b^3P>Ks<#3m1?DY zNeb?X0@`IhtYp7={EJik52ysty`ESWwwR5&1s$wSWg^OM9syx4a}~#?mvNF*eZVl%p>XZt4sAaUiD@viKD#zkG5`52`J_l=?N0Jcu%3YAvhcLp`SBZP4aG&p3 zf$R?nQ8Nb#ztq*2zj|KFYN=Gu|Pfe&!M5Ad?f($m|DRwV}89+`p~dh z0)Pk)rcyv(;G`}E&C$PLh=J?NGQH|>5=I8^6VPK@<+7r9+yfbl1lx*>^AD<{Z2q01 za*=~Z-`?7NIXT$ygTxkpeRO8W74TMQh(m>`;Ug8-V)TMVJjkiJa;IOZ@2nrSTTqBr z@!YFy;t8BPTC9mBIzT+*#RBCuHQq-EnkX8)qT|!oFJFR|coKs#u~N_API&EnGa24z zl9O5PQ`enhJ;xrJabvoLqNoy>;+!GVqiV~6ub>lgqQb;6U<$Nxg3hTVlYrCt>&tme z<00V91g>zK6pzwJbpx)DQEMqIAA{)}E7xEh`CpIvZ|hCD1(cx}TkAUWO;>zz$B}VT z-i@2CzQBAMwXv;|y-xNCyFBP-opTU_QK>A_qzDw1^r!6?E7&V<<`iCpnP-282g#=+vsj-*k|%>&O246c0i7*?WJr zdv^ST(ahW&-yQLt8qEa+hK?{A0azSvpu3A$d;k!c7>^O?5{xX9QoOyihC||;3hET5 z$BU$s-|iR`91`(_fchDf5iYEe=${;!;2tnWr6gAySRXAI-RAaD8_L*j6s_aqbD6%X z%zDoNlaQc6KKo3)3z94M0jTD8wK+_q?2x7dITG_-DtL7BJB`;7s~bT~i2yZiUI2UJ zre!$Rhog1JRQhSKZ6eEVQRV2?4NN1d*o{emmHB$P-vsM1O@o;BGX9dbE7X$yf*mr+kixKn# zCw9E04VuQ(;iPZ|IQ_0~xFNo+u8FTDmQ4XsW0WGfu7Q4fm;;VN+lAtZ!x<%_>2Hx_ zcvSbar%d-Y<~@#p4$n(*06u!G;tE>NB;hz%m^7$H=dB!S zR~V)Xaky6M&iexLBApzeaz2fKTH*;>NjmrJbKhl$o~a2Xw(3<%_aD!S*ni7zS13E;CrGLrV)h!H-e@*8b0n+FtDwq9bn;iPUFch= zQxMsqy<^xVl4M19IL`_FuFvOn7(wei{M^fTEyI&R#BQ?2dPMdYpeFqgq1J8m*x?WO zLr4aC?3E@{sQCs2cM_cem5e?{7`vk&oe^UhM(lF*@JinHD#8 z<4zdXKCY7GootZZVBU(Dom;M~mN5l!%%*lbNJ@~m2FHF}-3;Gk;i4U6zxD$EF|#X@ z=biJ$8`L{iPy`c9bc03_3EaYpA3 zvd#8)yavODqc27ZQ~-^q^6cmEFnR3^fE!xtk~pOnr1k6sT9+!{veT9yTfB<+&2^%Pj`!iGu`lye0OGQ283b1@>iJ z|4B9xrWQE1HWsy7crY_RFp$A0Sq?%~H@fT}Cu6BN=oi+}plJRg4C^QuKC=_XLjxT7 zVH&(h1x$kXYaR%KPU42Aq7<>u7>;9aDp7VU6)QSjpFg2`TpzP|XyOtu6f&wOh9dto ztunZ8_*9dhbl7C!dUk(=KH%#y=RW&vII3KR!{O}_rl%CZMnKDZvFEv7Jpc~?E(aF| zFodDq!Hzf9*LCY0G9m#*awR(ip%0K*b2Z>>JDv}`_MJbU10X)oJ?jA;hsTo%S4a^7 zCcFy$tIVz7o!PDamVwF#n1{R;sVMFCfJDUP2I*}VEor}#5@5#B)n|vg`dPAJ@KmLw z(DZ|?=HH<4LAY|@h~u0EN{<&KL>~XHGvvjql>N-QEN@C>VLnS;mU2 zb`*Woj%VY=47$(80MaUZ#sE#FAU9MQ81Rb)JZV%`^KsK|*v=7P0TcQP9k>pdMmwJpB#0aSAoj*wll_>2$>f(Q=T<29j6YPkTU? z$n?BI+e5brA?s~uaQ~}SI6i&BtJaW>meJ0Tv54-5V2qC^*30w;A)!r1>)n4^AZ?O2{!0`o8M~NknQ4wI9 zIkbS+%SocMf&6jz#IgP2;}gnu&jOea1DfxSQ+-s=md__S)5#dD!z*c*S1tV$+oiC& z)QzB6*a1rzaL|)mWflxW6dLN0UvjmHl$;X2S33kVyOuO(T)izq;}DXkH`l1(aSOkY zZmq26N+tZvLO=HLVa}UFWRvMzHWdv*PtDC?O1AfP00iYEuhEk}W z0ECe=;6eaKjG?SC0EGg+fyO5VY#U091C4w_fTuBsoP2`O?ep!grF}ga?H;?cUIb>f zQ<5GK7~WHVMvkJ$hT9~*Q+888bqNjWCZxnHt((G^FFJ~2R@I|8wSFYUcl@NKC?^xp zP<%$j_B9VXf|K0+VWzCS5E)!XFgrJxg!yZHno>*8O8Puw+Kk9rzFOAr*`|rP%gcno zbiy@{-QTVX=Hf#Fg+mQXO+;> z5O)M04IKX6x#=Ax+zD?r;mmJHqSF>7H6zvf65ZGRj#{;dQS4?O%);?{c%##f8V45~Dx@hIsiHo6St^DwK5y@nACz79oZjc6j_6j#x1~)p% zPeQ^CH30wl*}=@M_Kt*`z~pS@iX%?&X_yTYefH(S>krsCi0^p=a*x%%5;6WfY35O% zg0P1Zein1*$CWrAsn=w{5jnbkP-}Z^yZEcU^MNU%|mNYMF9!ShUs&4Vc ze@3?Cvq4v!npyzKq0VvsLxR{+B(npc9f&rQXWT$3Cibk@eyEol;5TgY5%z|7#eBiS z(q&tGkXL*ldnwbVbAPYqLNR|-=f|;I#c2aUA6pE?eqg>|++29}qIh7vk691praJW2 z#49b>N4MubpOFU58r!%^b-t5MEOLZ-Nv(G_wm(ae1=PNkP?@e3&QHF)@Bf4vbjM&aeXpD0Jw=ybpQLfIgtwXUD6 zY?*M*=YpjK$?u|&3P96NS|RI5tQLbzuE*6Ft{YT|L$4LrsP$E8v=ldz{gxXjHZ@@e z#-hf}@LiK4+8sAi`D%17f+I^Yz805)F z@11Z@2l4jQ5bl``iQ5uOGd3e-Hs8&`yQ^ef1u|~000{}<7 zqSL%3?qOGN_(6-y;#d0XcR0V~nhs(N!IAIg z!9=&WrPY>T&3IupJCUeyR_C^e^cpoeP9-b=H-v&|;xa3zo*jL2kH{>=+X&i&2X!h< zm%<~h?pW#c>~FFKr%DrDv2?@B3`NQc%(8P#6`!Zqs4ELL3$$jximYa5^J|9|e)o%V z$a{%g&98sHKA7Y0@2^-47?yyPnZi3CxVIp~yaw3Gwxwew8a9AX0~)4dz1I3O!~tI^ zAb%7<8+`z~<=cbL{eau0GF8pWw4&kzdRpKyKc2t5Cs#SJ$bBt1iZ#Ibl$F{c8X1WF)3)gN!y_vpRSk9m{&?X0wX z+yhnYGy4*Cf0@2xfkyTV=dVY9uGQ}u)H2?pnxqvgT3*8ztd92x60PDOb+Y>$q>=CC zkKKo{P?D08T*k(x0PrC;$ya#GW^iWaobmb(A$d^8yEYQdVOna zYj;;i(cO*oeygQlGX#0(dl*a(@%}!)gceifYVcWYFkEI4*;8jEvfgBmQ zcK1M9Vz&W=Bn2MYw8~VseJF_W@<)qVE3Ofd3Kv;htDl!8nrV8X7($sUOlqgBYhpsW zPjUZbg(ypK>&Nw3$Sq~66C?3#n8o5U02?SZJFy17F2{TVH+T1)pY@uYp8$gJonye& z>Dpm5fNB;#*uZRzEd-lN>OJe>y!HEWx9&RtG6x-O{2PtGWyy^@_6hajddu8WE)rD75h)i~|YK)5Nvykm^TqmoM(n59&7fpgA=Q z?51m;Z~`oN35IZc*4N4u1bE;qQZMo~yiXP%8NKj9nkrGSDW3r1WJQ90rD-ehcys4} z&d!#b0E&?0pF5D#ZbGaeD;IDyGqC)8B(?fWT4Mi%bIsqoxgP=khN86L9xR4PTJVb* zP6#&7{T1+mye+tDezg@#507eo|BzlbF+qwZyA>acSb9$QS!F zI;$T3p}*NI0}`Nt~W9TU&t-p1zh6!pUr{I z8k+z;*}M=u-Z;mV?*ItJfV^VJc?iHqCqQJn1PsuL?F?@1GA|%bC2Hhr6q~2QoM^ov zSn(g&hs+t+8y$m-Z2CPbX( zfrCn^xQVo^N4E z^x`W&C8Gg^nfl+ihfZjVxIv1pf%nke3qtJlTLAMi?N87ZOD`U9aWY}-TdrT8>3=je zQ|IU?ic_gkjNy{`9{+xdIgr3%JJxL39e-P~xWB)Dw$W3*jHQU|GXOU&ml<-pPnjpV zdwO24-fu3}F2%5vfEVVn^pbtN*&e_wG2p$!EsR*TshJh!?bq`77Y>-);gO4jfB5|+ zBUf+MRPTZf!PPh_|<*@iUh$)`=fJ!imL~l%rhXdj7s+dfN)17*p1utqW1LaLH_~TqAkni zVjJmE%)LD1?ruO#Tu+NjOTScxye?f7oo4QuVku`#{XCP2T3$BOF{@sP5F89t|XSCI*lLGQJ`q9?ooGt$h)CCBSK zBNO>>YpTj@VX)%Mg*tQzEcfvQqI-EG5Pdh9)<-?k-u5xx*yxiLu2%77zsECYw1h7| z7}$8IyNvIGs+jb{NN=>>v8d>jZ1!+J{V0fZ?t*O%7^3T!$MZUh^b%f97_gED{ZVt& zii`Kr_LTJ-C;$eIJjRo!bM64@@zn1MHGsE$b$?D2h?gJ&DN5Mf-JSpVLcY(pUu>)F zlkJ3uhXX9$xO!;=62;yq_UBi1nH6kpfoDI@k#~2|HVV(3%DQ zm0m_g=L?=Xo5!Je1SReA_@PRdx#v6W3_jl4?ZHsqbb9!%N;a+-A%p(achMONYJ+M;D`!7hxd<@1DdL{L0XNyl#|J?tisDO(AYqhp-yEHBZ1xA&u-1l) zh60!Mrl~DecDd$6#qAZD;I5vtAnv3Lm(z(WKk(;g6VFd=Co7ShfZ4s2W>w-MG#HU0 zhadXzxU)xEOaTRtN4Dc&r%_`Ai%y*x~fTb5lsZ*E@;gJh6`+Ez%IT!Re_gy(FeG=x2Im)Dklpp z0+PD03rC9)#u8yg=XSCv3oAW1WIE~GlMClg^4AirbeXC|8OTJJZC9Pm;&w+e?LTGuUblb37oMRA?ZJCr$BsEk-30=loSvVlEwSJP0B_u1 zPqtDpM@#~#l4V`;;Ne;Ow~F2*5jO$-@hP;ESW8dx)Hz{Iu33RGR*(VaV5FgHC&wpy zJ>?zRYMViiQrwtEr)meoF$>0ewmY>CXNFRCSBx2zg`<1Xh)awkbH>y^WlKx&Jofge zFtjzU!Inu(d{14kqh2lIF7!|+l|I=B%01<&ri$C@<<5DBT zh9Rxr@bE>bi5h*D{yrMRRyiXJrio}}4A&$VtYe4c?e`H7v`s;Tsw}KY>#`G35#*8bYv}fpRb!13{{0LLi1oQj~O8-1#n@eM2(GFi;Mxi4tD!6*N4*t z!_qQO8O`xjhl6v z$I3SH;*k2bet!`(m@SxNbrk`1f`eDk9W{GmsAV8?7J_Y$)7k;aphdxEh#mCrYmAxW z*@V7@3cCd(83iO_1a4B@+(x19K1Wd#jwbMi$`j$HzPerJ-Orc@b7Os&ZWBx^V;#is zXmFcwQ2T;TI>vE}FspqK&4b7ci9BRiz!SaywxZnD?e}J0t}zw|3&zjnZKS|U2x^1S ztCi$=W(U+k^GEN-WxdB;x&VP{fjje-CQK&pvUm9rvj$8*x||r#g9ENcAt0p4#6bst zgIL@lNyQH*EJ9h_{_<3&hq)%P@%vKGPoW^SeH@1)HKyFa8{bF_MqF>(_#tcVeH3$+ z!uk~ljD%VLZwH$V#_2+n@~K&ZVDHcYiGUy8CUb#vNyi{4M`e%=&XBGj<85HgqAFLy zDBOtVg@j3E&f3NrZqq3d#`j zN5NfO_bxMjA`e|7#KwmT?|GTf&uNkp?dbe@e@rEelcNr8)jQw`vABx}nY_wLvK-@S zoWcrTcyFO%_#r|6>Mu{mjiUOx%{~6i;tCTvlhy4i*oQjGlM*(1(u?H7Cp3JdIkXjV zLH-1g0dQ6Z8R`)Yu}TOF8;E83G#v5BFRd;X(bxOH2ECxHxA;+JcXnAjpgQxwuP*w?8BH+ zdaL|2CCP*;`tAR$BHqBUBp!iY^S>5#PDp$&8yl8PJ5e{&>~hmQT6o*jBD#fdr6OEF zbxJRJah1xxC!@#{IkOO!4;Ni7(mfgc~Wr znwQxwM|`?Tv}5dCqOl3Cj~fOX0*XvMZ02hAKB@2gN!TaF;@_;)_inM0TDClEyhXge z48mwr*h66_isu2jHd6k~CLu9ZFx*>=ZEaomy!;xkv#U(^)cw-ku+*;dO{JmP@fZ^; z?6JJ>M@})MW4VbKHSCGCFT8L$>|RI~)5~7oV-g>1S{i+|Wy3gq|3)56HRGuDn>%yk zgkg39=0k_Hp;NB{FMnO9bg7|KXbIYuiI(6(2;niv;eFl!zf2nLX8-^8b3Ah z42XjZC>zs09OAo#XBj}=*mQx2b!MkpvK~MYJBFeHJ}AIgG5j;9#<-!FWsg5+aYRVE zHd1qyNJuek_?FCoWO09kI=h33!W>j=+`&ZoN0d2E*(1j_p+Us{7A=s=^tdRZwJ*{&*qd9A4aE2 zLT|kz$9C&Ap_sf+$9Pj>Z=(M^?Q%fEW4#U-a{pnb#Oy%Un+e$?kj01#t`LPeyTu?E z-eC{tJ{s#|bw97@R_rGb>C6k?LD}r*$7J#US<7#@6CGU5BWjZ^E8-$ujAM#hc-{wo z{mOD%fdG48v*PmFV`COOR};o{Fe&|>W-(_aEB!q2P_g(tz@^~o?f#WTvj$f;q6nSP z0rb_u=KN!R%(fHb9NeZ5%%r#SYDu0)M;a*d}e^zah8h>gA% zV8$ra^;72G6(&l~hR}WB+ispGt&pyIPCuhM^|uYbb%u)nbR9A3##n@EslXM27K%8^ zC4-wdzWmk8#Js0N9SA=3+GXDra1()_Ba8H6kV#jEIy)#dor%BQ=!aUwr3l}CeDAs5 zE;Up40D&tW`XT1!lBc|SLhiP4OTzbg!Rk!h%a5~0?R%mZx&4UHyHIp?qUnoVi%{@6 zEl`Bn2?QdFUaKE9N0Ez2H+SR(e()PSZ1|H0pL#lD&)R*+;d#ei z{w}Qrm@>rDBYX1a*L>U}R8gHD>juW#AXRDWfZPV>{-8u#LYH-I=9xw486&f{dEOnS z5e2E}*P)28sjwf2P?-DHC6t&|f%W9Ie>db1iWI~|QFxR7Zdsx{0}WM8D}R{J)dxGqqhetudQ#@8Chu9~7G)|8mH_oGc{$=fGRQZN!<> zX4tc!9ZTb)6R2Vs>tDOIZ^&B#9v$v`#$@(J{8*__&-Zh;|13MF;6U+5^F)OD5GNzD zq>aWwvRDf=7*C%Z-yY|O2i!8xr_JtrQ}N96qy0WNKT|63uSYtiybp1mlF4J=zYQC7 z2`3ya6tTJkbPtRbkfd66y?xuTGRDt?JF=Ojk7sgI&X*uRe%-I>B6=|JBW=2~^ zr)>~LG2wsoVpMyzoRnV8N0mhop4@nNevi1dfy*26?<#Gt;-ga#;pMlKd-u#w1Nr0d zrpZ&MmY8XR7&=}*-DQ%+YSkAnOFXSkWsOeBA1ZY_oZK@+az1^!Esu4B47^4sgPuXb z5hn$O#h^*=&_5)UMy8Ge({|i%9Jk)lUeKBylSym~y^BSs&;?}V=9lMk>AwL)7=a&FK6HU`^X9(2O1Dv&ja5#ZOeMdvYRu39+WYt1^D#M(uyng}v0Z$jd)s_vFi;Y4r9qfd<0X%1c-Mdg;C1 zfR)!2fA*>KW0%fSY9=x)uW<0>ygJj`(D!6adyAw7;*Ga~XVf+k)8?g4viM2VGn4Ru2{;#2aQ* zG^gmT6VA>l7nozBjzDna_8i$kv!dxquY}1sIs>qgGML>mpqC|@-AhbZ=}Vfp?vmQ{ zz>gzDoTorf<8r!JZdUF?&7xqUW*DqwtSUEx@bgV+c~`;K+xER^nO||a)KsR;P2Jbl&N$teZ3>e_AzLNj@J{*x}wmDO@#4Bzg){?UbZ?F|A%bOQ1b6)e zQ~zxDnzK(Pewdk#ng8dYXm?`#j&y$H9jrYfu;@5Qw|J*;3Grfhm?br3KEIA*li(1H z_6{vT+;mpH&3gNRt=E0O9cmOTjcw9M*{@FuE*(Kw37mc{u=BE=TsY_=0}LzlaZ;R@ z#I9G#Xr&Y0G#SXqb!pWqy&xwHG#k%)m1e&3#P`fsHy(%}27QE{aa zOxD0K)j?YI5X|N&)8Yb31CY}IV}2OW_W`uM0VGfgA6x+*G?1Y--#LnJvyZN zNHUCjxKw5Awlgo$hTUa-5&$lKB6aIa?@9A>fBr{nVuXg47f*bpibJ1M!OhG7?;E7Z z0Arf?`dPll6wr27`_h`h1h1biJ-h%q-nd=WL!Pw+aQNPv=FoqFbryB5*;SR~#Sw{z zTX^bnA$upTRLgXVG{j%3;q}D*{&4IbW?|A+tTayp7_VUz3feQBvJpzmXfw65*z4Zki$ zabF!dULTEWs?CC-G#Z=XV0hSONvW8)_>8`#iAk1&#`^X)3nx~dJTQZMWLs#>^cE>G zEY-l!y&0|Bp4^dvfx&fp*Q*^#0mVWFAx zm>^R|c_o+gyw?w$h``x#xo}~%wkA$GtJ-69g*}d-uVg|{{ttHhU}R`&&EuZL#^lv* zRo2;`GPAV6*9LWu247D%ODl}4%wB5P9RHr($+QC4_p?qgv1;=7F0=^q^vK_w-WcWC zQh(b54xl*Az~Qsy4n5rixo~^lVwzm4couJ}uS6y9 zk5_1c1Imk)GlibQR3tg+OVYD~CBG->pW{z9DG2%qu+tX~mcoieHkiE*x}*`;Uc)DU zi08G7wGN{HsLY{qb90#$SUc(hE`2f-!A@GtL-r{$fa*Aq(!%I}KmxZpzJVOV*d(no zY1M&Ohup${@6C+T$%GU`wjSZxU^6-&3{79M>8kN|t_^DRxzr(<(h*j5Zo!LCVU6GN zq&LOftkUZe$zR>oZSrwH=~|8zcL1LYOyE2LGntw|t^pL?IIa9h1VekW5;Z_VLK@T! z8v7qUEy4ZQe+pW{CLgb;SsB?*&RvbEp-fJdFY2hHWRc45Y$CEJE_YK6w%i6j*RS-R zy{|8U%Tg{zDt*1F(>%ib^9HbdZa{hu9Ae z*)N$S+5bYpECDb;W)95Ik+vBvimU^}9yGyf0?C`5-Q8v|6#-MOv{L)9I*sCT)mRkjsXHWxxHU1ys0^T?tMWqEay<71wa)e71OJY$3ADz!d9onl1*-3g^w2 zAUhkQ{FaeE+ z?@GA|sG@^@jh~s}Ac&~rP5#eo1&ERwe&)S639n^gq1A*K*;PDzx$(W4+J2VR8 zUz&XomBdNyj2?4NjhBQItMZ{%j|lIb+uw6}MRhD>r*vsfa8by+5Ap4Ve_^9v7(anI z=B4vH0cHO9;GhU3t1i!vx15>`V;dhlH!+z9Ls&kj-C*Y*1j(lP`HFkM&Eu6!`Var$rHfb{j30L=88<2RivU4@UVE={g1)i!n}*zvaNny5JPwVoy}VUCkR<&^g(W%{2=R_Zas zRW6@{F+6{CM4z=`Up{XQ#^L?Hv&UDQK~M}M(Pd>YWbmNOr0lh2J^qLHi)nXlxCK6w zJ?ee*_zSP!D=MX1cK$2m6(Un!ftPJVPSYo6)wlRiH6G!~u6SvBHC96yCoBQfM~r~2 z!>;Dwb9{Dw4zfU{CIiWW%vYTM8`<2ASn=PHfdtt>7)1#OI`anh?M2B6b(*@UB@5I2 z!`Dyd%9$>6f?=utb`FxQqwmUeZt>Nt(N(SL<(s(jrBIM=hTWy^w7!EXKIWto_t-x9 zvupwqhc=&lj;1U@I?f;D-42_Li?#ZtuP=Zf#g+eKf{;teZ4n%hGZUOm=P$ z4EX;{zFwb!aZSxCV`#3DDZ2^N$-t^FDm1ZnWot(J0f0IvtQ$2(y5@H^Aen*ga4CG<=z1G8e3Z~I`rRV@x#0h`jLEo;2r(RFx%0Dt5p)V5EPwoPG$wlEmJ`K?_+AC15p3V zoey@~XE5jpBqGD+HTjajMKYK;vq8bg|8L$=9OobZIa@M+*q-LFrSb2LdrdKXB5RWH z5jvKB+)(^jyIQA~(Go3@fzvc2z^0bzxGal%Tpg=kt;#X#wyK1vT{hz*5H>`n6j2Xi zCiH-l12eM*yv8Z8;;t^w!Ix6LhP-?i7@vumeEJhKCxAiJ?8E8LK^;71<`I~O4kmdw zT8|WDW@f_h5D7gipz=j6L+tQq#xYCGz2vnmBq|6PM+J4p2i-AFG4XrdbyAi0$fMX} z(Qw25t*QDN}BCZeQ zy~@AYJQWWDEC@K4n4*j4+}U+2-UyKErbemu9YJsM(+RlTtF|RX6bbbs%rbhM?#R7D zOk{k)p8r0i%7by-1B{wJSSv6L#LxnW^=LHyj@NDkOK}^+IEoN;ut|i zO&nX!x7(}4M7tX|13x{sy@UFA4o}_Dgtw?;e!-o(;PeBQyocY2?0BfjifemKIvyyb zCl;Yqu43#mOu2U6bPf$O7G5PIp8jM3G<{17<^0=A67JM*{ub%kh{^={B#t|(M*(q( z9`ix;`^}HUva2YypRDHyRN-n;KR*&xv|$dCY26`jd`M!ZAK@sHi0nZ^3oscZLX51| zr70@SPhkoW!E%C5A zpMdjOe9Y;8rL|v-yasmXYE-SMMkTL%27DNvRn1Z;(<^>gSdx9){E!_EX0*KUn3I7- z5MsIk-(%!Q2d5&izKWlIotSYNXg=7$2lwg`4Z&}u{I$R6^MAGX<@{jM^~!I9W#9 zo0eH0EvL#=*hKc7mKF7pU^`NG(Xb+FUwLoF2KcDQWp$EMf6)Nqw~ZV4vqw^ucauXV zNY9vYCj=zgUWUuYj`mg-%_WU8?rUnqVx%i+@MkMXaca*00(>1&7L)tqf6OWcOYnP2 zeor=2Ay1Z&Qr{_mWptVPYP6F5fZj(krhUdgEFo@QfltP)>7v?II zZocEbOFiAkEd<`JWW?0gb&jjcpZs}O%C&;zaC&vp<}in*F&6;m+nAn8yH(()Znjhv zv+5|fopgLJuhAwxluy+MbLt~|sGz9ZorNyn52PjkS9W@YPmx^ZvBamQLfgbHj;M{mCJJnelXkdL>cy^A{qiytGb=9DYCSY3Ki{C`-Eg>c+|d-z5si8jf@v z<=!sw@A&Y-f9#UI6*_CusT)Dh%n+GCyFtoqhO)v>0CmTs#7ns{ko{|0R(xue;> z+*2WB7uBq3GJ(S$LYAraC&sorKjR9B{)92HVsN|7=0Cg;nb#o6^B>%;$#;mp zZF9L9YP9du?tK@-kvt`nyDCk zVcIn4;T&mDoas`=i``|6ABNx3#&YeRn^hWdGz|%SsA;n7AM6%)Uh*_K4fdyMo9fO$BL4b(i_WeRM0H-%m{i5S#;U09ou|$YhL2uIh<~ zIeS_DlECFVO1<{PYt+9*Gk1y&)q5M(36DKvY7h;st-F1@I&}#i6ku9Je4KHTgWVLcNpk7Y)WhA~_hLNOfUW>fhQ$?pxA zc#j>jA_p>B&PHm@8ma++E$w$WBi`69%x`xJ*{SK?W`OXlN9{$iLYt#G>^nJ;Mk1&+ zhPXP6WVY@I`>dgMr>~W^od=zF)bdV^ki~qCT%qKy==r3cJ^DveghQw)k|4ay964Ef zlg=xC?WQpbRR5OH`%Kq%L-uIP{i}8Qi%O!wt!~uACmro8Ln< zuIb;UXJ^)u=L~b7ep;o~>=iF3;w*u$@0l0fx?q!0?;pnBHk=0c`Y#&$Ow(S;03EN<@= z1R#3*cqNgSQ+qfa>TxNb>8jb;)!5}ZT{}y;FtFm1wNN9adYW`!-jX-uw-K`KT>n1P zpeac4?u`piK6LGJDZr|Jz}b4q#cKO}5iYc2sBfHqK6VEzEQ8R)UcxxJi>%wAG1-Va z%yHAz_75+ktqMW(x3ZdAYP#CTKXJQ4^rej#BNFx^T}rS1!;P{-e*gL2EplL| zibKzs;}DVi1z_|m=9Wgr{7qXkLnp-y#rJwm)8Bkueqp!FWa6** zrJv=`Si)T*v1MFUacTd-_ucApo3f))3>mccu!v#$!X{4gyw*L#!lmJrG}uwQcuJB` zX-c^{CROUdbcEV2jtLAunntSJo56-S^R+3LQ;~@zVokXe%zy_2$?FaDGB3}{yy4FWs`L2-p5{hHj z*Va0plw0IW*+26fs5qm)>pXx#GATxAQW~TluKW(&`VI4geLpxmR|Q`ZkAj)(s(&mn zL+F+I9ud9UOW48TWByVXDPo6JlYCwFNy$3VC#@CpRLlM)yLS2Y2T9H8v^_}eT;wdY zeL4)efN2_`n{Th}{0$|i`BupmDMly33jttZ^R05#J^&WLBvfo&K#PZ9m0%N7V8DFn z^6a2Pk#&m2pFe+K_Tq9Jm!$gg)5O+$2bI@w8e6OFpQMm^`YY53nZvpA-VYX$XSODO za(hfO@0cI2vQdA|WqVuR?6&IL>OCINDwhn=RPO*xvjx@v6|Nj^xq(i`gt4zbDDS}P zOcYRiWswg9G!LQ$#ukr(hR0s7RHGgLr>i#$`ZPn<`@c=$0kK?wA-H`rr!)V|cyJW5 zZW~cers=HqCf@=b*mZLCiWQGorH5d;&vMktCztpuPy3j^H#VvlvEAZteLp@Fdglkb z)$0VLo+jW{NM_y90&5z>Fd^+IbUYb4$y5K`{Vd>gq2tSiSJTD)WgdwZQx4zOx`BOx zFm(L+^Cm&4Ue~ms+=PjY0R874xy!xr1L_84pmzO7{|m{SV^EL-!)AwJonC?I%HM)5 ztI^DAjlg+Ic{hkabu7|!_t_Ue%K({EJ07S^k1c93bk+BTEi$>E7R@%98e7gEQ#~gq z)?~Brp1RJHmt1IZZRwjI3tqhre61X3G-LhC^Xa!c{g{%lM)?6RgB!VQX1>0;47JH? zroI(JQDDyRx3lz6EI!#%8{*#fU);5r#NR*1*#F=ym^D> z2%98f5zuiZL<7+@8ptj38MK&w89Q&JbLF{DYi@$bO4sN>afA2TFOG--)kC*DVn`g1 zKih68{Q}T+<7Z;1l~IaO4pfOJ^6Yys)DP$x;4HhHUWHO>!l1lIb(3Lh$$9H&422yWfsF_i~@U z2hNUA2?MijTpMyiTk{bwV#f$N``kA3vo@N^=o`SlW>7FM&vMA)Z;z1Xz z3%c4K@*qCQ*poR7`8>`PU?s9G*TCV6$r3SC{drdtO!l*H-N#Fx zAJu92nEhEk!tj_wy34^nstZ>W$DEpR9XcJxW!LBhUyiiQC+_$b()*3}A>EQdgv7B= zAs!yNAsK=nQ_bceAP@qDp(q+3U`qj99)Oz^i=oh zKv!_<+F^qBAGkH4Ff@F}p?P8%8!gEcJq(=IchY~+JJN82@i4?5ZXBkxfjz~GW%so? zk~OPS@}oicqeU6+%JR$9jKc-iZ#Z7{R;?phWFMqnrg;QZdZtg>pMofIGxfr=xjS)HnF0a`45mO=U^1JtL_W zY}i?ol)Vhc(c)4;;`;1PL-m|*oCd315xp16{RxPnj;2*K%eC{#7V#sZ z<$y!ZU75SQwxqF9uhF&fW9oB3y@mjg9<~gn3UATD%YY1PtWd5(Ky2ez<`!UHfN#U# z*kz!jg%VPY28hqZby$+OE~OmgpkpXyKT=n}iu3Zdc|U|T(P`|$t?c!+C!(^{RGE$c z(&!DC?|Z8C+vfijm>#23V>9{&JY=DRUr*K!M=iV0c~{!es;&<;+ZhrzljL_D=rt=T z51vi^+G)C*q5SOO-4k3413_|oq8N4ZtWW&eJFqzU35tjxCrhLl!LCfF_p&(#4n>OS zUzbWTLV2np&N=~Q#W4LH5S8pu$8sOL`XkJUABy4Mr>6CDw=)d3tu6?VS6?j@)qEEn zao18d+V6TBZdB0gMamHzcfPy~hyMe|y2GCXePqk>fpx3xp_>|8zciK-0bs9$;mT9r z_WON(jaDhcfw~8{e#6I%ps9S&IFdPV4ADRlQ#Yf5CNNm%Cck)&+diEgJ;e^Hm*=0} z30k{1qr$9#tyGih=1~4vy7D_u$r{ zn1WcYQK%wO3T$`^WTCJ<4(1T7eJR?I*^SQ<-7SuN*(ze}=*{-0@}oALQ|vP*yS+@0 z8xAx57XYt*@BWvoRaI3`DKwD=8U;qQ=MQy}sQ&}WSFVd=eNjlhjm+BM{;vD8o$R}k zD$-g?uall_YwHdF+jZ>0US;vmZhl@?-jJSN7wOC;Xg+_CY>~77^7UwzU0-^7a+AM6 zMRuA;M&H68sG%}0t*8g2&Lmys43x91y+cc|A;xo}OnGkLe&!pJ2YRSNh2G zYtm>w12G7N5q7&j6mc-OF8lTN^((1cr`5)fU%|LOvOYd_lU@A`v9aRBPm$A=LTA#? zvp-uevX5PRn)5JG{Z($Re&YwmnQzt3bp2xi3pYH#3Y&$t7T>P?cFM8Jx3UKjZUeY$ z%#k?@P*>!Vc=gfk4%Tf``lqCCnrd`w=$yH{f8|hbo0_5t@aI53WTvz3Qw+r@(Lf&C;;9=$!bM7{f^EpOyRLx0rw8&BN-W4*k~=eFdujyi@J-SJz-f= zz-LeHr1k5ysRA@ye(v3_i_aIn$59Dw4#m7YLA>?f6M3O>inR@o}6cR5sEI4$?s zWo>a1?FKWPiS=gz)5$+$gGYRKnGJr6?dj6aQ&%uck~d0HNj1CaAq_q92cJs?kw3*q zsV%fx)o}%fR`X_TTL$4bi+6vbgT*1f z`Uc9T9)F&S77PjebVRuoBIs!I7oZCG59`oPW^y?6G=yW|lh;D$LB&kJmwdv+$E$aZ zZwbV(dYi28muKP|BLF`;L%^-9?Lfhc7cZVX@q_RXBVJ}><(&qUBF(E^UPd)ltvIAw zpr!2hwWHrUi&BJ9X|{u&>POj$pHto@_qO;JRQ*~;J~UfW>sDx(c=EC!* zx@YM`MH9)pMx?1s=zb`&H6#bjy14vPyEA%2AK>|*E^~b-*%8ZuST-AYgBw5J!Ftx8 z_Z(ZV-4T*?ki~~r$-4{ON;LHb%I+?nKfenal5AV|5Mx9w=cQi|?t|_XWKN&&n*Z)= zr8}UbLF~;G&ktZFLh+zo*}K2?&Bo|C5@+hk9%;ox9aLWO zbQb;Ac%goY-6_f6uFLASrj^vYmbx_@)7G(pTVp*7ms)0L>x1tpx>gX4_Z2J}QX|`0 zgOOQO2F?#33gcPCv?u9BZWA8I33beG8my0#2~&^svU0Ktgez=3^N;&hAxJbDl^26x z%7gG|#X^mNHhXn^uUv+Y@{i*ZV$9b?gw)vNjx~}u%^u8}1`P>ezv{eppJq$XD08{} zGaoGNZNRLdY$7iMkc4S3JpHLWyM%}oYMsGMH}5*9i>KDhEHl|$qU*{bt?h3WOqRdY z?4eB4EKf<{6!L`|B~kudSD&dI`eYJq9L@6O3NovM4d=sL4R@k{pOZA0f;7>Agb))} z{WT?je4lU%E7M_H?GpBr2Tebc^8%t`^6m;@&yd;V^4v4E%B86p!odvZG-qXNroWbO zg2#13$?c7m>ZLfjv;qcBiS8qgiDr3~$vc+Cskig}IPc7Nh`pJo`OcqrxZ(wSH*2BJ z?k`PppG=Q@Uyf^db*ACX<0+qF(eP*2=Sv~V8uQ0tI}gXzUCOuoo=a*TMO2e z-s9qSR4DH=g5+g=B$n_chDJ8mITn{~~ezJmzP=lo4DD zu<<%-1^DNwMD+rO{d{H-l{Y%wsCi__$WGS35RaMU!wLhFSG7TE)p>Oo^Z0z%Q>W9~ zL<;H8)zgQUvkd?7$9Pj0qICi&Fp2PyS@*dg(HbH}6fuaB{k5kWw`^F?P7uO;jR(Zy zkAJ5z_~&>XffSC|IE#h73igK|xt{ZQ;ZJDIzgE~sF=3vJJ)+CIYSSUrk+OeEBNV1A zx#*GhguDHVigB7a+`rxH*_xFamU-i@*;!VhG`!_0gV6ZWDxqfU)bGxi#Htg+di1rB zTE4v~d&xREtuc21>6OI#c^P&W#t9V;rt4k^EB2_TX~M~K z@az1NQIi?9&NU63qH$Ii6CU>+$39W6qqp7se>(;cbJ%Jim8}xsOj5t31V+?*UzmHQ zRi(M_jc7)j&nikhY;#8Jkxj2b0-h39BTW~8gv@4+PC-<%W-vF%!htomkoZB z^y6cU@zH`56~7aiTHEmg3!2`Ci)vCWTwcP#w=-O1+1>`Lspq|KCzU;+%{N(GT3fNvtf)=88kvl zIoL7tIOob(fDE_)^%On~xV7e%vNb$fSp<}a7HsU5?navpVQ$0DH}XvFx{BjsFKse?*v#vDENrvkQbw+b{~fh^g-AKIg;m>{>WG7^nk9sk1;ANN*z&nX@m)-1i6o&RFM zo`qJgj%c-v2%Br3(3_d<5*uRi;Jdb0r7+?$d!{MM!@x%<6Sqm7YQv%UZ`pGdJqj+K}9e!u*IG8<(PcL@d?NAV$rj5sDfF_O{v4 zbakml>C`Iq+g9I)5hacWQNrYRT%v#|HDv#NwRHIj zP;K@`R_n3wv#nCy^>b^_BKvlK)FJR+`6nzks$)R8qg2VuO23NtI=P{>|DuohfsOLg z$gm|*ngx8>e-%YxZ?N(i;vCDYGcnD-+TJx+kCq6idS%U5@feNbOh&w;KF0s}e`Sy3s`=NiNs&qMQ5neg2j)gVXX2XgN80 zQ@y0$noQVeTf>Buh|)U<)ye!zvl7EE^`kSkg^8>IH;bf1hR>}&(YL=wsu^SjPBakn z9ZM_Nk(a0g#GGvO;*#K_IN{N>3*8aM{3XvxcTVC~3xC-qKBHS;R^UwFB0au)kmoFu z5YmI*yBGp|lDiIn^0)ktwu5=jQRMblgG=*Z-{0OIPv!Rb?cIY0|728?q-g6En#F0o+FOe9Ueb5ZMdhC~ zh_A^hqDw-NZd44LaduxVUWw3&RgG~L9Qrwk+o3KeIlhaZ`uflKOg3`I2pN!c_oF;w z2q!yeCeJK;r=|%_kxrem&Z!m!3-X7AJ#O=wgySOhQS~#LnlzIJ+3540ZSJn|eZ zH9=XDwa}mAg%P(LyO8qikgPEGlNuA|)r$cBIw! z`UCaZJMFqIEB68n?eME*+V{0L=N`8!t?m>Kt?@utLh~o|fH;3ivC6)(XL-GGF)UlD z386>B+Z%He5a_#`zm5IxeEc~wAnE~^-A3P%i3jW3^o{8Glml0!y}AbI=#z9Qc8BCb zQRu%U@(2UjqMZuWkQbko;*WjM>1VY|8CXAo zgZRg}#I*jJ_Q8YJ>86M5xp^@!q8KCQ5J;Lj;OngQ@7CR{({-cnz0Zm;9oN7j2F3PH6SL|x z8LiJg-5&YGrDT~dd2Nq>0rqNmpvrVMsdorFQ%=wUq@nF%)!8pzx!{xe0DPEZ;RSyI z2U~CPP)BoE!8z_bMnDu$CfOI~((*e6zwytS_^rL1Ln1$KUsEpefKTxb5j?kuQ;FuG|r=}V9(?zha%ScAYd zb4i-c$LQm~nVrG9Z>d+hIkqJA7Ny~VQQh=m&?fY6t~n$Lq3DMGJN=_?0eg;@anUOjH9en}u{IyVGLaUBYJ$(?dVs zX>6K{1L)NK#96S5rV9|XKxhvHp0q(uR~QwYFCbcuHuN=O=x=41FgL{-e_{Bj#wg3k zC5PX;gZ;=#w253{=OFbRTxt2gXgTmFK5+bh2h7u+FcIBT58{xtj;$BZtzNaRDg2^- z&FhJupNqTWwco%(YgJFXPr8K?oe@|;JaQ?x+6_+VB-BTDpj2sQNXZ-pq`3Y%+P5` zdH-}5n5mwA3BDKddmR%lezoJgvhe7`O zVY^=D(3aw`yXiWcxvld&CL>?s@8LsN^ihRU@d$05IhxF@ACbMe)%AN5`iyBu`2E3u@9yrV0%9L}h>wS768oGbNkAw8NyY^34n*7g8Sc7;tTLy6P6pwvBD9kC%WkJ-F z$11V~xR> zlQ+v(1viKn`4NBnXh;JDzIZ$OP(>P8-$_=$B81~bo4OX?^@lyV+JO# zH(1|{J1&~Q)gQeIA!7fOjf`;5D)kexZII&Nxgwk&!Kd0V#e}Cuw)5^;;=k6Jg&^O@ z47MJer{I4C4YIpY`#^#@fe%9Wl>I>rZk_i_8{^-v&Zr;ZpFdGS%;;w(2O&rgRP-Y1 zpcTXKm<@dJj=^!V;D(O$fV+VZltD0&_KMC}lE3qwe^1vYFUb;I6ct0U93q{)^BFgP zNDyH~_ zs1Y?(q3%m;E_kE-oCjKWC|BwR$k;W3BXbfv$u-1>sgVZ4WyQSit23jI+1n~Xv0Q{F zX}^7VGEA4wjT#|t8~To47dd;6#a!xS5DqZQJ6s&w>y&VdLv+{h2E!3*#DxZEBBr<_ zh#`3Fl%@_WwKSeLjG7@J4cYEjXLfFpGbSag=IfIFY~!T3m_eQ+`2+P|??o)-Rc=iX zVf@UYNzLwugY7VsrS0s5i~9Z2CDhaYn}v%+qnogsGH)MB5b#jD^K&8Td|u%|;;n}_ zSz;BiOdzY!E;)$$aBT%e%8-QWUq#dk13rx2yy|H(G9~56=9wN_^))g-7gEhlwSyY z#D73cLWG<@>?n?KvI1v_jsmdhx(tP#+4U#9Zr{@8e%t+)gMQde|I}PF?Cv+ZyDuZ} zK#%{f!)(b&Yqine&}wYH{#_nHPP@($kgU@|?Dv-*FC~9`^6vDifU~{AOJ)&Hb-NB1 zp3HuKC>%jZ=iy!>NpR;?5@n^eDs2Y4{lkWn={d)ZFbLY+ju=oYr*$z${5Aeqv2$+* z_T<{*YYojNoTE3{5Yln9`hXlK!|(sbdvK)ga{O)geY@{JIq)Zv?)joFE+zhK4npEX zpV0Xrx8~IZZea58VX2ctqHLdhbb{vSlgA4ne+vg!M?;3*L_oOZ{o(4%pGcCyUK@0&m zeIf;VbaWW~Itb&SS9ahDvOe#86*5zUz4=iR;&gz5 zL{`5&Y}^-kgv76sZZK@QRAdPnf}LxOo+-DFBecou?fvKHXV#7?j(FPXWN6b_##xHg z_`^ro&{H+sVMzg-QhwO7hsb;f2T~DTjMhg>)*}W)(4J)zpqsXP7ZHogm&Kd(OFakH z&rpRpyI|=hHm;gu`|bfzq5$4SVyr(|5=MnCVMBg%is8SD$Lx}!oB2$4R`9fyL*zvtwxAEAh8L&U_YRZ_{8M|#)6y! zWXG{ZJ9aU7Q!}IjQ*ru0u^L0T^8uj^_kNeHy{@jg#oz#o_eUi?sbE6fKk_%8M<`ws zL1k|$bk9O+PS03U;=-9kn8KGA>uKK90`XX{2f@dGoih!iYkzR!)=@`fHk zMz-H-%soRTpkZSZ;zW2zEsRoW6g>l!oqpwVR#feu)hfvDjvJJU|2%+!?jU zLPiHHy6bTYd;MsKf|i2MrzwMuwHi%N zs3H#acuE2th!;@eAM$Wx)D|+G++8SSnH0??@5qW!B*BV6HpV|ygbB;3Sk!{1)q@3Z zp!(j7Gbj^lL1oeu#N%rGKpxw6R1#gZqb5)M-H`i_efYz@D>2m!uLQ&2;b6ten=k zJbY@DgnpJ~M8_0^Jz=t`-4aWczz*tF2o{QT!9sU=cYdCWnCL$di68wBK?ca*`}7CraWA;jsCh-)S-8kq z!iz~q@A|eoj(pKJ#h97;(bFUTXgd=miJ(L(RD~WVHVkG`2yz`YC5c+uv?LI!#_K?u z;`(J+j=$~mS0#Yqi|cMxvoh^!x#r7HfRiGCo*<&c0U3!DUlAqJa2A}oV8ELZgx0Oc zvc{ddQS?Fua*Yb12u=Yd<-qI>OaweJ5bd#nyzQ`b!PnE2)+>V1iTbDr6Aa|YrlrsU zp($!8K~wcjF`Z-uN77rc!LaCm-0BQWG1_#lj39{3_@ONeLX0Zy2Pt`7hJzpuCMBAR zMDn@8*F>jHcgpGf*`Eu-buS&`IEZ9;)RWyU0sFs z+16KJMvawOQ2h~sx(cKtKCUsrW_u9C^O04N_30l~g~3*dhf(=Ppi!fdi;;(y+o29t(cZd_Wi85nr#+x_5JVXbs*_Z7&i&lyn6;@Q z3IslVA2yG~o-@TT)5IjAKO~QyVAi-ZR56Ks@bWnNk}S!iO!P)t(KQ*wqKh^F^XTj0 zLyn}=I1Dnmy=tlnanGi^_pj2UpOTA2`Q@9Hi}1l>Np|S!DC|KD4Ag3YKxqC;Sl5p9uO~}+M(v?A}42U{}a0NUI z*n%veyhC2>^R4k}jbb!|Z)`gxNV-i82*VxtEMr)_0xE+j^lzC1w^zH0N<}0TB#F#> zxM$mDNR1@TjJW@80U08&#RZSvzrdIbtWAdsf|OiGw-U0TqC|Pup^1J)YnzTQc$5ho z=;pTja?JCN&}M(UMpbSDvR{9D?V$p{IaNlXlJ_R6M64cL7nJwFFD+2OIe&R3w zqz75KH4KkH$Zfkg#HSOk5!ti>=u#-u=-SOx5_UF)!36>$kP|@;B5^U&Ol8_>Kp<)8 zbcAGe3`~iWHO`S&!x3a0T^;fMM@tumepW2Pk7^@CSKn0A2&Gs$DteKUNY{Wac)sJi zV0d$$tvMg#RZk-ZLUkn!{r!2iAco@)fOr&U^a@er7CChuqA$^oPT(0hsSv#h32@45 z4nxEaoPiUJ^>TwMM6kXnf)Eh`qG-Kkw&g!yfUeOGjI-qkI!veod)(7eZRd}Br-4s~mr%eAn4Sz2wu^+UlGBXXj zwYUV7Q3iE)&rqRzW7y`KLDP~nlQ?XQ2w@uVIBt7+6CU2bnhey=LXR!d8BmZ*f-8g6 zp`sO`N}m8#0v}g{NIys%191BP-pwppsHZ_luCxWT2~683i-cQb+t~UsSbMr&j+3UA zb9A%6S^E46B_2a{WA}|@(mnALwOcrZ=|aIv%z8L7ui*q8U*}lPQf1I1HOl8Oh|8^> z`miN0B1n|ENi0&MGwsK~&w|v*T%f~{xL6MH_Z~bj0Tkq?WNINUk$uiQYf-Go^)o;V zDf!7qH41<_Y6Eq;dDl(Dgn{*a@Is~}jduS#ni)oH4eK(LUofVp?Oa*E5(A-=xPu@j z`RKmWq7U(Z1yVZA=`7V(98$wH3!YE>>93qB{0QmN3~=zpe2C?|`hh%n(+YjlVdb@W z3EXVPK%m;dhv}i3M0n!i2{;c($4Qj7$Sc?qf=qM*nUJi*C|5}`u;u^%#{V0VWTb3f V&S?G09)gn8P}fAKSj#2+e*p}P{V4zd diff --git a/deal.II/examples/step-42/doc/step-42-CellConstitutionBall2.png b/deal.II/examples/step-42/doc/step-42-CellConstitutionBall2.png deleted file mode 100644 index e4509806c3f9c85c1482f8279145a1e94c79edfa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25917 zcmb4q^;cVM(>1O|3X~Ry;uMMocXw}r0)gW0uEnirad#;aG&mHeP+Wq$7J?HTzVv?9 z`v-hKWSy0)lXJ<;wP(+sIZ^7WayVF|SO^FRI12L8ng|Gpy9fwK0vJf}U+`s{9^n^c zS4jnJ3=E9rO|=d9S4<~)Jy!$--2Q(b#FP)XWC#e<2nx~?+Fsev&WQ=bfs~te4?#S+a5c}-xYHp?9O|M#WM^$I~d=4her?b*P7-plqvV!3vM zl6SR9Dk9I{{+E^^avifuZGd3uQA9b*8{|gNQTH7R&*bL{#gdNCyT1##=@2QBHT6qa zeq4NMqVc)SrY`|2rhM3K8u>&kj_&@%m&a89iKQ?Z^0Vd}tRx7mD3g5Q6HkhLke|H7 zGFO@mX;*(W2?@N6LeV9w5GmB8FYW+pwE{d`%B$fwzxi?D^ZL^laz*?km9w2$EFldvmCsj+QV!FO z=NNnlXoe4wqzR;Y{UBLXjSSsliF-C*%97gcOoVUWk@aZ@E>fllkHzVjyo+LkUAaNg zw77m#uE)?(RhX>zlOFN9abdE>Zl^T#b;`)peFyQbgq9DjrdlaZZ1a!JA}o)R+0SD& zsNQUgA-J&5gsCug=?wZ3l8%2**Rn+gHh&C8>!IY~c}Hfd_`}v1m3gc`R=T1(Q~UDV zNB*^&d4$9c=J`;F;iB05x~f?zPs-BILmouX?z>4n3QdM@!_3mwmQp&ntP3d`=89U0 z)tO3?-uB#IG7%|`)FqjDI-AFNdHjv*zP_s~`}bcxxhcRLeMIBdGH+=kx%L2u3#3m2WXVwHDf6K zZW5H6z5h+m&dRtm=L}f%UZ4K+v^Ney-qRuC2GCUihC?M3)|TH#!|UeksEW^4pe!_> zqNz`>PIyK-$293dM>nG6R<1WTHuFifrVf&zVN)q>O$tQT${)*OeC1K2r&2`IOjz?9 zkPnMgOt;tqu<%W;(M4uk13d7?6GhAb`sho7t+Igjy={OUP5XwefZwy=ZfVjS&90k) zo=S2;-JK!H+`3Zo($BigB#6^2+2;Kh*sI3T_Xj~uO#LMSW~w!tr0JUafX@vVqys>~ zX`V?{TJ}+QsBt_|JNgr{eIa2rAn@m66B4LEr^!e{3>M$-?Qbx4z(tX&@+Ine5C9%q zR(Ppb!fE^@#Ulb*9t#b9JoP}D)SEJC`#upj?@gG+)sWfY(Fz{}M7#;O%K2={R~uLy zI*4jM8kOr>mrhw*Ud6EEhl?swDN>lJdUUo#ZcSk|l-vIS=U}U1CrkHF6K<#(Amo&Q zt5cL;18yUm>NzhQsHLPsQsTJuU?Db{*)>?Xxr%{kRrTG_VEUZ4P30F`37}LHAHj}c z2_nUDYgeD~L#8j$aAUt||GWpFLx$#~{w9EeeSa~+geOxAzI!n0sg!`D4P!2sc#1;X)Jd~p z%-hIa4~n$<3?CvXm7rH_(IR#_HkG=K*g&aLz9e(vkPR-;HuFCwqx^ieG)+tf?p(*s zgfiftK*GyRT-)JnOp?c%`4Hy$X-|uV(Oaeva`RChoW>7hR)clc`PDxmab7t>gh?Wp z)?YM}5)Qcszc8F>yOJH4j&hhJcB(bWX%jRG0i}d7^%P3nMv>xbg}BXMyKS+-m+j1v zC2u$K+opHQnWg>{D#3^?LOyH7mqA5&e6{s- zX%MFk>sKSJ9fM?2&WG|(KltgF%-t+T>_`+x4di#fh}1R958FtN?+*EB*;MkPWNXkw>8KZU#P@u_;YO-<5m}uEPYiDJCgWwxMqGBME z77TPd+9-q%X7L_;=p@J7t85@PEf2hM_LL}`g+r}MIqg**bP&x>?AgT<`62P&dl5(r zQ(f-S_6#v1Xx-jFLeD>y9&h@*T~mMV%gh<+u5|x#2igf8-A+WCo@Lq9pOZhc=pEzB zt#%|e?b;b6W2*Kt;E^e_4zv%GH9PKkbaX@_{Dev;2U90|i(~@a$o3hT?badWBBksH>F8?1 z+Y(4p2_8a~g#j)WSc2c(m*3+l948cxtOe^il)%OTe4ulgd1ZMazi~xLBt&J_f|?mA z=e&T4)~Sy?P8JKuYZ~BJ8hV`?xg|u4zVj;`sy`r()-Sqwp;roDyBq;w=sk{JpU)g# ztWJ0a{CQn0ypY!%z{)`f%}n=!5t_bv1Vcyl10X&=v`ZiTCeZ>?QD2{E=JshCvNIIj#*-p;eu_EYYnz=a9-XxvQ=1Y@TYijI z)kJ7qBk@N>l``d|TEXmE z)aPyYvs;G#hNOfpz9cj)!KT|Ov8S@9?I*E2Te5!nuSM&Dr;xpC+U`dW{KcMBUXX@7 zR6jP*ckA=0qhZ-H|G>Di`sfZ#ls`+;C)6(qkPUB&19xZM{z>{$@Y z=Zo)swg@dRjDb)-(aSW;4W=-}jYOk><>%LAT3<}I_1W-hyXG$RAwd?dGdSl}W{2Os zhfP2soy4fgOG>sXKp~t+2Fxi$&o&&@N@skFAG3Q+0tY;};QqnxmopJ0>-AV>HU)3l(qBLLfV zVLDPKdD#@!9|v3tIxlOPu@`loW$L!QRg%o46^)yrRvMZbK*uI!^h+moWmuS|UapZ` zY-}~X2zs}ztwK3{0?vok$m}`Ir2g)0)AU7D*a1uuuYI_bid2x#o5B=Zdaj#puZ`C_ z`{JRwReQ+md0f%U{2>%=<|c&AdnTOK)d@?w(YziGHfn599Sk-0hQ~(eN;iJoq)7oh zzC#l=$0;${Xfh>d#a6e9tStf-imZgO=T(SK&fXI zRXw&4H{4W72pMSt;l3nS3v7t|(cXb>Tt2XEj3O&f0rU{g_PVkaj$#R_GA<=JPnYvb zDo_RbG)Qd|Gh!kHQ}PmGo%Jm zZkQggvr(D!PXdB5TkZMYvSbT5u?QOKdfEQ~@?YEpcwKh4y7=qG`pRy#GMWoSvedSQ z43U(vBYn;7gfi&t(YVfpXHgK#SBRuBYyc9{P%v2rZ4t!Hgucs8<=93pzYf?Y>AUQ2 zb-`98U{q1g_v}4G$$wfGWLvCkow2;is?(jei9i1A3OBe?Fp3N(h|n#(%R~CD zSKt~wWI`M;w{n<@YAprBaxR>uTr4Qv1Vne0DW9?J% z|Ez1>#5WOAlQf7CpDV*@VCg4GG+h7cG~cDEU&R3DFl@#9e7qp&&|kM4k~5k1SW-x3 z)kY|PuPkqK9!`w}*jvPXsWxA#aH43IxctrwN8g<`V042U@Ls5Hvi!+(W+QXDrQ+Qa ziL9Iu|95FbJUe=1(+_q|B{(_bd_r_!x@d>%NlO`)`VwnJATr5f05e7jQZd3OHqv;_ zs*U16dj$^A**^d=vLvZQy2`uJiw5yk!Z$UvzvBcU0sAcfF&(@W0Q%g!i zz))}7&57;vHLvG=vw3dR9h)-)c3nwPa99Z%+7i>Cb*iF0W@Z*dT(^!CcTuKMG?*sq z$@FEz2iU{`3L+n7bm%-JGWyKLVMVK5-!hn?kQY-Y)g34Ub5fbGeUR%`XHVBT&Y)D* z{#M0S^S-w}B$*UCcF5~tYGm#`JSOV8KVJMW`x_8rO#uvPzTiT5JZ|NCY;`S1QKx3i zOSS6oexvkLp9GWqdLFtRzT`2Rf#9Yh!RHIOu^6rT^Od$+rb0wo>74ZaFfWKO4#hOK ze{aLH61PGrl8m-|K1N(3yR4N)z;{m_nz-163+g^UC_^|~n`0MXGo^XgpEv(BGw^rX zn842#&h4J7<1LtSOn{4C zRUcRGMh-2A_6U3@b5xm^d)x&HF;Zu8fG9Q%=4Y|V?)l+rH3~PT#j__xhu*Qp9^k-% zP9wr=_F=I!@=k8URHBDI_$zY$<%sS2_G4G8z6T;eacy z0-gU71X0Urb3UJTmIjYmJqVpLaq5I&;0A^HcrfL>`HUwA)~HcaK@=%b_H6*OuX2^k z&TK`oMJc+a3k9wQq-nM%e%@&E7v3|x7hr1lR~d81E@=qdKlR%^9CmC-$Z^<^>R_JN z*D-rQkJ@urkBtT$`t#PywQyxCLS-}4A$v{s;ldZyM|I!e04Lg$&OiPheevo(_Fa95 z+qjH}7GL&Mnd;>F@J9+}reriEKI}6{q1uRoH=Mb$)O*t>LT*i5zvBCC3PB?6@>;L5 zzY5MD?FA9hwrlFCJII}R^Z-~iN>>ZjeeCk;8u2APV;#$?312DxU@ywvJeRLkSc=Gz}$>{NYPyh0#lxB}cBWriUJZ!pO6#A6|mLUTp{@AM7E?el0 zlel~1cPR*uAsHV6`s47Fg&kNRbOolF1ah8CCu>&~L4A}8UbG1UVIp2DX)|1gdc$js z8nMwBZx#oV#%+@+tje%!u>Y1a4-u-ZKh4b!*GO|HnNeu@OLFbiEG*A&SYXsGbrBCh zk{$G~6q1){UEsuU(+Y9DLW}RC9=It{%g_F0BmiYRXYn9g2BRs=if}R@B(U{zm+BeR zp$3v6x2JLglZ4!=n(Cc!m(*ko$TOe(_(<&A@0pOiq?a^cJF<5$3?~O>0uUy$q37i? zc@8k)>Z$`NEriKlLF)n^7Q1*tf+r{xTM(@z_se9(VnN@7aUq+8{VVZ9X-M&KsVxIA zgii=9C6`vq&Zm?xe)+9dSuk~DgGVCfpM*MWCK^o;KgQJQg17LM{+Ua#2Cectc>o|~Y&5^|18=~ixk zI(1x|#kDFt&s9FAcl@1u+g6&&@^geDwDDgCX|IS-0z`lEip4@wpt-OXb<(rP01uNj#3H@?Dc`6XWvI<4o41T>Qx=Rc$f))cDw?PbqP505VC;qM*I z3b$lrYw$iM!_OVXF$#%B%f$;^#rw&E?q9||wzqg}l z4lB>W0_z_(F2#d${(NZr)QfGt-@z&xP-p<+zri@~W+L`1^n%aM;n06C$qZ)p9kHcbwV%idIEDs^5r?Q)Oy&O(| zo3m(<3oukau?}L9_zWBHo^nRoF}W}@-HES}><`FdnM!IxUjtPJZTYE%U^4H~hFd8k z|J>sPOZxt1=C`9wCQk@kg>a1fzM6-Zer&QpV;~UhZOH! z*bWUG=}vpKJCpTI@;Eeu=bpx2%MQ`r&Q2`Y>v=7+P0mLh6T#Pm3_lVVOKCYtqO=db zZz|6Vll|-|jXuq+{;0lx2ejnOY-nSAF+4KNB8)W@3`zPKsr6m1D7&p(5i6j-K~ET|7@0+jxd*)N!cafX(zTGSoc=I80TfD{vrmomdc!q4 zkieD+VG^4Jv%U6>E?Q-PnQv!qm1}@eKB=0!kuv_VC2}CSA8xK;#ClM7A&>V6@~B~R;?MT* zQkF2sdTjZl?eZYc&+{Ah&Nz3ejXt!!Z`z|6PFnhX2m(`!r0k`6oy1PxE?^`N8koEG zh04>&KEtY#=Hvgf9U&oOvw_)6PRm#(`W4FG{~ z70l4?acUEQ(BXgS-R_^tm*l&GyZ*SH1u10Fs^e5~w8I{=^@IKr{2Jd_dA^Yox|Qr* zn-8|8D0scCUX~9ZpBJ?G&93j?afXmpu%3o^p_Em~w~aWsOALh^m^^r1_0y92*DDuI zzh2ALPxE$iUk;uPcxE6LlAu9=M-9$lC9kV%F(teNllSyH@b6ep`pXaF{y!^RsfZmfoCP z4Gx!6{r7clrPv6^sVjrAqI~@=?vXVH2x~8VmdpEq$&S|>!%TwI91p}?CmfaapAJnJ zl{qe#JZfU?u-gYNsIMHD*+#z;`IxrxwzFMME|>6?X!ugV9iM4=^SYD|NrsqLI=BA3 zCDvN#035%+v|_8fJn(yArBDQ;+KXgzJHkM0cg}A#X+df|lxf?R||eKVy|DV69P@&s2vG59RKfkO>F{ms;i#+6Ng7 zh1?RS-kkt4OPERy`3p?*;RuVL;gc)RyJg!h-48dn46idT-HsU%U%ZgW(AEu-GPY;u z*x3P{3RSa^<+<{!3i}*U@5KqKLR~E3Uwv*4+PUu(V$#Tw5t`9TnV`2ZZq#~w}sh}53b~g7Lgel~Z71&4PklZ@YcGAZe)XfYl{AiAJv_T(a)qG&DC$T?0LOkTNi$o z!fWqQqxN6E<|c?X7sPPoLXN1LdRzv_oG%@Zz0MRvKDurZ4hxJSMlcfYq|)ikv{6H|_n)Q!iJQJoIfQnyX4scUwwwp-j#{Sa?GpRJ@F ztj?9rw#N9JhkT@+)Ev9P=VQ522I``^1hmx~N3PEvfrDADn;#xgwaOe2ehnxM^+<9f zWIwDDPKbI#SIF=lI%H{@x-Uasxa8LSuCdi90`InBW8H(9e*dQap6v;6?=$6%@n2D+ zB&amXWO!pblw+%G79RwwT8*SN2iv8lC51I;1bM{%5Y@@Yktu~GKR2;8h!P>J1a58L z)U4UI*qQm#f^!AkkrSZ@i;SQg-)&6(XctrW%)cwDYdLNw{dMQQN3GnYe#*EN)(QNS5&=P|Jvx1}nv0@P`#2hEsrwg_k2l z?~6{!j}|G(lzJOh)5$7+&E|@Bf#Vq&ded7EjRznbVGHk!)_tA^`)+%qKomezKmW>R zvI+5(LojB&-fx5q^#-Xg`z@=VN}eQ1Fi)LdqTyLi>$>{Z;r*ez}uq zgr*o0(jrZN_E&598G=_sQ3Hq$4*E`iGtTsXy#R*%q|^^OL_(BD^Uv?>O$L!{_T`n6 zk-i)Ij_8jtbWfs7>2Q$OBtHr8uqg&9l*fh$dmM+Un6VGr&Q@%*8@0U_=S8@k1w-xR z*1fJ~{^^Ujb$q+jSxMQCPd5Sf2^2iR6!u&E9tNTwIa*~PCa;gQGixu?_muKMA@vH|C2>$?H#Qo76p~Y>Rg#Q+TVatEE#IbZO z%PQ8-%>2)1!A}W%Mo&mxwNLm`9)FZ216*8Y$T;Pup)^!O0Ed>Ds$T&LdE-<-)-c;f zz1X*=Zi~vP9_Frf`bxcoj(?4bia+wL)7K_DB@@7g1v|ovh+!4TQm+@CFlrDtwg$Ej zVvW0|_5h^Ra5V%HcPuCd7j5Xlk=wK#YVe{aPP;nnw|)VAl*tdCO&zdZ$ZWz;0QMm+;)0%Tmw08# zfgv)MSrELJzCh$(P0c64>S)vbOCEkuouu2}3V{#yX913>%?id4OaHBw8E^dd zqK#b(G_+Xu8=`1VN#LwKv;>y5Rf^to#A1g%j>fxVv|)^lqEui<$`S@pLn zMa&nSgg-n;G*}F4#^1yrH_DG;w|qY^%8yjmq<=X8)86b1EHz)kqqV8w2x}1d31XhW z_HjKOxRd$*JBWSNYj5_PcKuGDayV%AwP8 zA=~Ol+UXyDYyR$Y#qRz2#k_<$xraa0MkB#8j_0RR1-k8iTe3-p^ZSYrg8hgEIhUJd z)a7nbcVvW*hJv^S_X!I}>4?GX$A86rNpVN$2%HgM<;qBxL+ej{?7+auM!$opiQ1la zol_5ae`t04anRFqGo$kHjpuHDDPZZ3_ZIh^s zv!5{x{ge|ohXQESfI^)_8VJc-3 z!slPFuNHCaudCMZD4m+Jw|umkwWD3m2)W!oecpTvLN7cHxF{m!Opq88^FIy~MTSBt+Wi+1$x+k*$z$Y7(u?M$B7-LNY{BL2fa ziafsTw^RH;+^#z1js5KP@_Q6klfKt10qSG22I~$t5xp7gQ;ozy5PLqMLfCi<60>4WB;EYRhwQYhArSc7WvmlOw-;7ZVPda>MV5*Bw%R=s$jZzze#Ie?BofA5c0KR_y=^oy0wTwL@F#!cL4awi0gT zTn(I*4u90g=;R5j@xT-jBexLNm=QL^DUF3!bAGOoVG>8s#i5_SjVW~=D0l4^A^>DP z;gg%aY+a*|9l?)3lzLhEsxC+)v`>k^&5n4h>o9@t>; zJ6P$d1cV2UwMu2B?k`dC?1q8?f7J_bU}O7JIm0ZtQJ9GouNt8gcy|8Kqr459KzSSA zkv~t2q5(I5JB`0Ctv!TC9_u>Uf0+MOql#E5K5%}-sXGWk>oFb!^8q-zUhU?* zqWiD(0Jujd6ojK3(l;@Jl+l-Kbn@DR>;0$+y#n(>{8}O*+ z5072r*RsJ}Ymp7rJ^!pp@nL@L51(#utW<0er6V2u;O0K_D$MIbc5oy3c4lg{V$ahu{>Xa#o@FHCP zDOF~e=Cp{^sM8xR+IfR#aP0AdogY%4F@wwL)CXxz25ble}`~>*Qd(O5dQUa-`eb1``D&inh~rT`WJ~AN+vLT^&De+k%_j1 z-%TIMHX1WmBEJ1?X{x^?9HYLjc%r}+e-R(E(R9~2YFeCX@$he>l!yYqz+KP7O>dAQ zj8(3xZ}dxEKjtrc_S@A;&%Of1eqsyK*Ih814YB(ZDxeQk;>_XI^HQjjujv*-y<>AT zN9<9_JKbfj=cJxS8kZ%K(Q2~u-Q}Tcpj@r1YiP;KeP%~#5U*DrqtffIRj#s&?#v>b z_B?zb8cK8YyrK}y%FrAN?W$tDL>zQYDz>EdxnB-}aLZ9gY5rDl)b=>Mg5nV7!fQ-h z&eCQa2t$LsRVr2YCv*CNGo{o!S2{+B->|82&qoIn%jE4{VLv=O($ga&hr!Ev&woF> z6%|HCR~}mP+UbZ8U+(6Usz(t*yb9&(HKCI7MQ>%k#v0U`Y(-hmfG3y}&)bgSzetHU z0McElhBF=)a)i5pFi zN%BK0bm&0cvxw4JIP0&`4|KWHG*)wOBJ?}T>Y6TUWal@dGyZ2QByYwnOYFp0kddJB zsB+^_vw;`%6}h~F%234=!?ZzR=w99bQTkI1DR>2w`lzoIl9R?Qb? zB21^PfUasP>kNM3jBf2@K#NvuT850;Fr?6?$k9lCnFKt1beB) zu3xr}tGnosID!+ot!C>_pC2^V=7_u}IVa;{741}jwXQVj42r~{qqpu{Sj1?z+5it; zji{}Jjq}Ff$`E3=FvJ!-w|Va$L8{Iif<*wP&$+ep^ku9xRQJ{Ll3F?mtRrm zG~koypJK*$`(7*IdFzW7)^xhRUDl`-B4G-^lYNsT)2H? z88XLuIFOZHQdtKM?Mgiki~Oy%5sMEfUW%viZk1x;NA-POuqwdwuG`--=Y1)dJ`4iZ zg)up`aY^3vsqsEPQM^3DuJ@UV?VTVz?ZC~u z$<`0Hzn5Iz8G?D`Ne{{!LDLOOYIZ96>OIqr9?r4rnB@_2BN8QJwh6y&Hx}quPgri< zanOfp%!Vw)h6-JFSi3xuEb2(0oC3ohKBfh&3TXGAK14N}HSw7*jnBvMk1>KDn?<^b za&pR%%M(9qPcMcb$nhHEqKIu&i#un|ASU z-#=E5S($$O7O})r59)MJ`yqvmws&ZVh4b{Zmix2^8aMRsmGG#l>a{jy6gZcuot#Xx ze*8z(8unMhFim3Cou331$xI)K!j#y>pDedK(pPN@Diy z(lZ;-b*h7y2ij*dBX1~TnGc?4s54Ur5b|5}8IDTTV%*9PPg38%A}|1o4{gH7x(3(6)WXl6WNV2ya_rEzA1=T0I#`2WPEC z1`0>I3`WPz571x^Y{X=VpzSYewKe73kGX5SDs`5$SX`pUe7*io*wLZMC`b@}iEUx& zieT?r#D)h4M6=$ae1%+a^~I@qC7q8zs&!EeGHjtY&ogW+l6T0KNa=T&Gjv!o)+%Wx zWZ@&&0y~mYc9yr}<`(J~h11@#CJC0#M5H&`4{r{n_a3jgaGH${E=Di@J|t5||08Ln z1N`XI1>6K2R^P>|o=^8Kp98*I=opz*ioBtp53G{z|A^Z|%aA+Jj@?=QvDD2SOJ_nN ze|dmLm4`xE%%KKH)6Q9&fu>+lORNzy;Hf>PQMin~#s`mPTs8w<#Xh4EYAKhWd>7P$ zelZI#@dN$P#%#+xgjz774%Y`sRBv(TGw4d!_=mwWA%|P|XVFlXG;sx{cPc}q50$=U zDFK5l&wb_Dg(>=iNgqC%(wyT{(@h+H*z|Ry1(Elw{kAohfwflBnWAh_V!Y1^nAVkv zfOg{N*mBSQqhoGXkNAN|1yM7mCCqibPBWkE@`9wBn%1Ym67|t{>QOKL5gk`zN#m$X zs4TdRhrrnE;9kSU8EI~mya;d zGUIoY{vBNcPJ|&9;>MUxw=RseNl!g_O}ukpDZoH+g5;}!?_uxqe=_4{blirrBwdpcl?y!n=K8?p zvY1x`H0s(^lA-QxqW#BR;q^t)lemLX43oGt&mQ||Gyl@Kfb;v1{sAd<(fXYGgsLlJXJ`4z zSI&ip>G~#ER1_vHP}dA{45a9?>GilFETgb%3O?|&|f#s`P`0Vnk2W=i) z+v!i&=_POC+`jUkKcwFGDP$d%Jm-oY-*|~yHVpNP9$~&wqX(VK22)J0>r+{kIWG=5 zjEl(7D)YsTB+mNpsaa&uP)9?4>6~gzD!f~KfrXyN`t75?xSxD_yI4-`+kW$!S@Lx z_P@XXnP&PYhFS2T?|SXVubywE6lIB%esu&}cIxTqY{!~)j&?K;k|Da}8yXx>4Uq-O z=ZkE&m3oM?8NizkOfs;wKJySP%x^dbx}P*LW`ENCm!Ba0BezJMmvAn4?8}TvQ-9vn zb5$*)1SW2_Eo=05e(vM$dV(&qN7`K$AwL=Obn00e!XVQmH??o98sLHDOqRN_g9@WG zH_&n6Re9KosvYJo;FSz7+U&$L)P7$u(k}EGo=KLdB}kZMQT_9Wy{2vlBIln$=*nWp2gpFd(-Q^WrlN ziZ9=Ypk$)O5&vpTbOR!PsHf?+LV;(`>$&2($iM#ee;Ep%pme;;xF4X4xR$J_yrKVl zNid9ymH3~kI=W=W1t7?-yQ5`)`vj?4;UeN8;_<-Zx2}S(un_ z;F5@M8}dQysfN?XjGF>XFC2GZ!73)vn^=_nalh>;we>E=)r&;i>#l{R6$7kZ(y-z1 z5cd#t=C`}X_lkR0H(QoP^%XmNZaEYLFl&Is80uD{=Jb$t zwVt;Z(Rd|H!Qt|i)TmVX-?;(pBF=CW3F|)^S#n%L}g{2xHZEs zf8q{_b0J43um?(U;mPrVM*JD$)NgG8Ufl4AZ)>^VHJYc6eD1@aXA7J5=M`~g=j`tM z(baHW)cpWSs}aQ|E;XeT98s_kyuqVdL~APRd@L5z<{nSa**Y4T(mR!nQkKH;3!%_l z&QHPvP=SI@W3(@K+x`q{bw_(NEV2JLrwYu|87(?RW)P694doZKBQW&Gyt}7nG7MyA&R7SP|lB)@gP( z+F&&<&&3vtkXW6@<`)ahVv>A6Va)g7p$C0+n~Lmq^03QeljiN>B^rExw1GlWH4dwM z`lIP53;SEaN>=hv_Pp`r`?%rbS}rkAXsyrQdC9*k7Q7Wpr#rz_R;sqL`f)PX^X@Q; z{4ep-#E9*N6ffLeZii)cyFIU!L`UGn`fcwL+7(+q1qg=$}dPk^dSS z8ah`{p+Rm*p@;uCQILy|T-cZvnQ~sh{W^Pg_e3LJCYsCR!DNuKxBSZ4qI4hN1i4GO%Tle#qsiRX=oe1-U%?sAiICe%ukw6gItqVL zV-p?*TAiMhk7wbci0i#oM9-YMO6imy!RUMzC}1ib!dnXE9e`=Sv?Y#oH*dAe%)3+- zBFIg#cA>u_-NfpU<+Pw4?UE00=MCiw;>3dkgqQOXwl$03cpkf+_}pRz#rvaF>iUo} z@K^uMM}Pk1fvWJoZ$k~dp`(~)A^W~|#6kF<4r7VXm!>-sQ;_~@^vSb=u;ys1IHio~ zfynEP*ITutpz-G=h*;Dc$6MJ@!#8h#B6Y;tEl(QjVUz9mF1U`(^p<3vHBkV>JceR) zfI`^7{Md}a=b>a`?HNT4ZN}F@5$be){U^|d#o++7?{_oONTwa_wqkp zz%~fHG8jhd`a|%3S=1!kXb4#W!cJSiS#B9ia~7t46|1baFyqmh%UQv9=*SW4&K}^u zR_!hcAF3c2zuP~-r%pzT@6&1QpZePMRrm%~Uj`f#p!TH0U*`i$pJf^rMa!NUQW*wP z6Y!%W*<6V`49xzo9Ndim3Ybjs!y3;c<)&w{Wux`IEZPi1qu4)`Fc99(yXn1qK-hpo zw8h;#bye&!0=Y^G_Wo&1liG^;=<{2c7T?8U9wk01QS=Tdl`&zq9N;~szpryv6JN6) zkVXMO7r`f+mqj0>$T*24v=5dCD5Jz*h}MrK6nel0xc6ec&fp4!%IU0w8T+!EAW-yR zB2K}V_Lnwa(sLhEfG8P(l^Tj|JCWLPx^n{b1Se$=Pz670HJ2Z}-Xi$H%FzF{8vF=_ zLm>Y+WtA7h`V$Q}or6=%7xTUo-zBr5-SkE_xg zgzQ^j5lVeQ8oUK+Q()(ni#&&@qH5KWJ$L53`K%PYGZpHHv>jrjf*GV2`6g@_W@=-q zMz)9nV+3U}Eui_Z-h*YBuXsfjd^SJxe>s&{iCpcVZ{{zqk_}*Vrxp3sfzkAb)TTT= zeg^LBOFFwZL#lof)_-<&EYVH%8!Xn?P^i{ioEoKupU+-N7dra+2iaL>1>4ph+Zmuv z%JB}4vv;~a=$!f-joeFWF7vz!_?b1lCY*Rl%oOY>_`2;*wmblA`?FN-=@)4^_?=B) zMBCb{AdxfDTg8Tg_j_2W_oyQH+Wlm$0LWl}H~giB+Ouuqv7=)(rq;rmqni<(uosJ=z&q04h-Xws zPo=kn4U#~s-!2Kb`SsP5l*p&Y1A(%!VX8J9xxOc+f*mLv7ZZU}WS76VIOq&Rc4`kt z=|B(;x41tKjb5L2_}bl1Hb!EJ*Ontw-r(Z%8L z_)_)G3T|Yh@Em_PUYsso)FoaZAJmS{T@ZnDq8p+)7ph*+<0tgaSl$uNm8U# z&M*^Ny!dNETg4}nJ}a6UF=65q38!e?Cc6Z!bV#ifP-;NRxt1z*-yln?MFSM|X^i({ zfXf9qhk~Dy9p}pGWMPrXt$e1kx-_Qi$<%s)Jv!oNYF&cubap(gr)St2FEj=ZABg)7`qE-SsCdReA&vZ1Y7*G5?RZETuzEt2bA*4 zs8n{&f^~y*%vw)T_jF_=Y+>`eA=LbT_qn8un>%FB=kGXi{=(7((zAIyzygtoUWGi9 zK>*!$#moSLEY2nF)euVDIv>HC8CT6T&5yXgbQfMPT%96eB%Gbh?^Qp?{>psjScnXR1vdrJJuX4TXFhiMJ!IythLNV0QU~XY1#BiFb%c^m!G-Iho4zPG z5y8I%AY_N!IR3_~@-N*lQAl%oCrn-M;L2Oy5lxV64C3TN0nhRymk?r$bvQa7pOn+m z5U+ARN=NIO^T)CgR_wvHM32C{*5=fEGgHgQxnw*r*yU$in2L@e87X|6uMG&o3= zP=zU9AxMsfM&P0ow-K#+n+=hYKW{$yYE-}Znjk%Ai<|lTK#evd3w6K4cW71}=N}ut z34#mrJ?kkSYZIG+Juq)+MHi{@Wc#BKuj}KA<`+#F@m>!~i>4p-yyensxJ&_cZ|fX2<^QabUO90dBkbM9o#}3$>$Vtl z&zRgU`UART!ZQ3h2(LI&Jm%~CD?g;Yr3*9qcUvEb0I^eM^s_7~dV zK4A8TDoodAt_)b{X?6xGWNv5WV5)8O`j~@)TVf#eb|!(`cwd*qm;kMT+%xKh9j*17 zk5CW!G)icF21Ca-!*seL|A)#bjN+1iU~+z@v0lCs<-E-*a44DCIfMN-JHE&Snai!| zpDUt5XbIx$Xm3ejS%4ZDHj}e#lI-Yj0+lY|T^c0{7cLah>7CFow3b&1M=UoOmmi_U z=825Z{g#iG9|Rb9zFIFlBr#pRc~tEs@6?}4UWi<%KKm6d7_RemI=1DVxmHlqVs!2? zHr>8UPVS{HU3(pu6~?9jfFG&ClV$QwdlF_?TQRnlDR_Q$mc22{@n(gqxaMRtZ4+vQ zbFmw-5z-lj34K9?4l@7bfpBBAC*c8WkU+!(yEBKVi2TZ^`7tGZS8CbV^#CMjUqwbU zU%m%2ltMW46z(k0Vc%JE%+a?jW_d_7T2O3eTM6+@(u;*amu63QwbwR|Z?^lV!B$E`7N{?zMs z@g;j5MPHS<_W-@c(^-F`0Skn>`d+c+1N!#E)>T4_0NBQIp3hiuG|&Jy&0rHtHM1<4 z^Wu?qz9*{o{o_#M5P0@H+Q{Hq2TOje?~iMrROMzicFn*d3%X{3q+CIxE~qADJ1QA0 zLiU@-o;I1*3wgNX^vd1Z)#6?-ie^7-`4iJ>tla+MN~+4ts0=@ySh*B%$s;oIU$BRM zm=ynZ{KW01=iL$&6;%4M^2PI)N?7c8Br~_(z#>yYn1ioq9g}068q24}CH3`yb=acy$ttyl4}EVLbs zU!sMR+}+angd!7fkB}~6kpMXAXQpn<9?0S$Z}9mF=t=1VBdvj&1s<1X>w_y8vjQDW zLQ0-?^uqX#Z0ZK`6+9d~I7AYWy?GHAwfJDpWto-4p99&zhOv!^@R3=+1b2TI&~-Z( z^4U9Vn}4pNnOTv?6rAKG|giJ)sk%IIV(K z5J92tBe$nQ^;3Ecr)5Lg_{S&EE z(%&ls*%&Ua^xGguJ+$bHLDr##J7vpJeUHoOB1VQoSk`;2>XGri<8?bs4<5fm zaP%Q^Z)p34Dlrm*l!kwkeZ5ug9ldoA`_wyTU!y=ctu0@hU?U`a*hCV)Nc{1K@v{bA z5q?3jwnY#qbk917+!W`{)I6W2b;(#cdtpwxhRXl~n;UJ-Wp?UcBIn*je{2Hf^K3}a zRqmZ#5dfr(Zf(TcL|gSiX)7|A|Bf08UKe{XlNXiVp^=~Mc~k2F1GWOc>}Y9e(JWz) zzE>|gcQFC&+QIIn27B5uXEIcG;XB9W<`R_-K~)Xb+$h4UVHr?LTdOg5k%d1~Uo+F# z?~mivrUq|ov}W0}Z6R!WZx!01cgz4&;B>zd$>Ah%|C}A!Oxl z#VpEp-g4^qf>WOttVfKbAr};&H49Ij*Hruo6ALP(bc*e2IsKuV1)=Ty;$F$i;9zCE z&eeZKH!0Im?)P$<&YlJ|mJrbnJ?IEwHb6pV2dpexwLwI+rwHj}AHsyjt?yCz155<5I*(>f7(0)g2#^$ZD1EfYYTTznK@AOL|*^{0im}`!ICDmRofT=fp%}5^y4_4{tYmo{FW^RzNQO0$tWsc1&-UYWJ#ujW{eX zOf5x#WwJ4ar;)1#U#3ISpF~y#00)j{#0h*mZm-Iz4i;+Y<6(T6-(tBo%yQvd#;|F5 zI$NvwgNf+#{7-C^YQGmGQcKAzCuagpd~$QHa&<~*bYILhzrD(ZJ9(6(-q#~0ZRq$q z@e{`uXyuF2-E^b~cxdA~b!Y59xn(y==I1Fg8(Hw~O6{V*j~JOUb~Ei7!n$cr$q${u zwp$aD<p&t8Z)HH8vtpTqbx&Qif?efWxqqg=Id&8U}OnHt9MSA4Es)i>L z2-zh{28oG`q5qS0WNahJ+-TGudmBtp-xj)^R)WmQe7PmwTakM+u^2em_~!Uy!C=*8 zvTU4NSNX*zO~>ov9R}lTxg9-&KTDeX2W*cnu`Fc?tc0lJqMHV;DMV`CQy<-Mo&)`G zuQoMd@$O{3+;k!K80@3riLdNZGby(zFi^ttwIfyfI^yv}Wc zq()2yO_AQMGZN6&R>Y>U4ms%adRi7ZnL>9HZen4SpL_-!NME_58~|tUeE)NsR5?1* z(2y-HII|LV_9PfK@PnZuj;7fj*L^j3J&4hi4d-v!&U8q9o8JBY%lFWQZSXIhTVWU1z%PWvG#EfH9bsB+|3|; zw-|YDV!^?r=I;{N<5fFj0i!uR58+1@7cJQ{{6k*KBnUUAOGWN$(BSmz5+4 zL&xxDq$pfvqtoP-+0T}hMvnuYYdrYYN$ge?#}*uHVrd;_9O)9Td>?%H?E;r(wI zL79;pbRbW&R?HNu9Dcg1e6Ds}q3f*IT@C%NUA!-*2x<|Hg0*Cx^LDj#` zm^SLxMhi^KlbA;y#Lv-^DPbGP7^2J@K5r5&rAuBW-|*HO@-nJtG_);@G_Bu}5=xEP;#d;Z4h-1Q{K#vne_LEgPrN zvWf&*1za#hdV|~&N>jZQ69~{mY}q|tlb6JIOqE%d?$CJGC6=gvbc|mR_K2!2S@+#^ zhV1v7RklEs3uTDY{%33eGLek$zNGT3%Ni=!=c+eA)>n+fipm%>N7YYfcfZ5Y9p&D4 zKz40>J}lN>-H|tUTJ^q9zW0{6xqhU4*dYBZ%O4)pObBhx;x&?)W<9+e9E(bz7yrN1 zUtTwO&xc?*)BXh8`=0?_!Cu%#F+sx~>kq^jXU*40?JnFck>5b>!oLO-hBg@Y5Ob&r z=5Up@a|H$iBXcyj(WFI&nYh+syaQ)0Z&}9$cI7D z`$(6Le3gM*q*EM;iUskw2jy3zn_cAUT%SEv@O9K(?OEcAdL;OUxEBYN#3R}g<@!Ro ziDTMn|6K@5t4m3USaADjk(cY#(7Zq{t|WTA|Bt+~;hD-RrZ{)0=+@^aa9q(SpP>mW@n<+~qy*wRgIR9-EbMc1lFhZFvgAkSm zS^KGIr`R|7C*UbazB{k;oqLz{<87OEC4%M>K;gJF&M`9iYiG`e>5ZVff-F0u1viHB zXsqX&bqCvo=LGt`%FAN^{3%JyE}A|q9*0povmVZeJ#c3Wy>%z|lcwB0%ZLizMH;X5 z_edy1Aj0MIDUdfCoZ-{FqDJwP7RuKtEpO{z#p)i>Z+hW44s&DDqsoUOfB*XcqB}>Q z{Lwn+5LM>XpN9=#GPBqt-4b+CFRYiUo)bYS&sX^6`SP{NTM7*g%RhqBR-cWbc7G-N@1L?u3yigRCL$aQ#3*C;r(ap_kgH0X$1|TV#HfG# z5rh18e)z#meMRv-^R++LN{~`o1#5Z5Xw~Azxq`-SYE9((N9>q9J`;p_(1TnV(5%rp zyo)2;_$DOqQ+CbvXAtL4&q-!l|KFc8Q(SP)ck5P07|sENjQ~x}vm185Q@|rkAgW`> z+Nk&Lw!MGDsV}p_ajEB@4-%O~PTCq{olqY{iI5--0@EAU9TIW=3xP=ZyV%PAq!t-`UxL}@}1k?Jb>p-l+HpOS`$AuQ3`=+oa_ z0sqjzbGiqVQDp!|3$%a83~kx!j$H>`0|vK8BxX{=e*aWxH{CWB691MXB3WfG03$c_ z&lwM1h*8N0WPlFE52T(dJbKStsH`oRRXHPj^lijk35*)4I;j!(Z^0% z!OwR2Sbl{ak^C;4=`fw0eB*v`#L?wi20OL@O?`inc6_=HNY(B0{q?vaI@EP$?#Vti z*!m4ps}kBvL4GFl17tKf_OPybmOhC*)uPG|mKK`;5DMtB2_$GY>=&`FbIm4YA^aUE zO0Qso$ke=^WJdADWSvMwu{yiOBUp*`ob71@+I>*$d#h{N7#aRG&75(Kw168FhHDs&bXiJ=@jL9BG&ir(Fq^=(FhT?bUPQiR@iIi_OaA1#+r7_PtLef5+zoe$c z1NZ!yL4p}|ExQw;!E9e~aq&#~SXZ=-48iUMrVte1k!i%L{H=K5CJ^ekceEOw}Fba7O$? z)L{6@Y(VZGPWytQXEYo9$;GB4afbU-1R|3GDo+kA5QD!w@{@&lmm*@h^vbmOI5SbIExV#o^vbU^2Wj=S3PEgn^E(;0YJ5sp6X$x{3% zS0aKuidK0)_A34Wj>~)&t|k*C0_jS|!!&SocF*6YYPb8aH<_GePSjsHe&;9&uY5M^ zK&E3OYq|%hHGVKJ2}ovR~`>QXzmQg zk`G4p+LJK?kUBj;`Po|v#)^gB;|W+0OadD%o^VO6gn=du{&b!M6XrT-qO zN%nvUh%$3c)YeqzSVlIIo>Az2>JBke=^bLGOz6qlO6r?<64|vsnY(eTxbi(RAE<(J zY=vL=k%TY$2YpH~C+vAZL{`1*f~?f4m871qU+_*~?T4+>6xS@MUX=*R>4h*h3z3NOr=&zV6l;&& zlEH?QL65ZFn#f99_N-wT+xrkfjA#U%=ZVjKMFMMW67VCJi6)?Ci+0*wQHd_i6Hxaz zE!ZQX4uX{qOuwsQ`R)AnCv6>y51}hc5_sPYkz)xF0Pw`pc-97Fy67XKN^5548kT^g z18lbwn`FUIrx)dpBJgeZ3wNKywbq{S(Umuxjf!$NXR)FYT5ilx`Wya6{SL_Z*|dC- zQX)GvYd(mzKWQ;-xxdzVS8aC7uENPfAr>J2O{ygSP-bH3|K)z}Hsr!mvTH^0#jxGB zcehSN%$@F3l8YbnV41cvBT{BmQ_+S3Q8HW5u%c{!c!!hD3xjb5_I~QGSfHh1Dxo-x zZFt>eNN0DGGvW`9sj9+S)!fM+ae@3Jz-buVCr@s=tL!mh^72ntm`vZ>8_;1yHo*GG zmx%XcxWtom85~S$llD%G*({JX*j-3mtpEPzau92)89pJ0%4-fcRYXI0XD=&#tYs#lHL?^7 zCeCQv?+bRBh)34%h*uJ2@0-H)TH2&1#jp%eRq(@swzog@vm;f{7XlbJSqj0y<{>}a z^~Ma<)Kw*KbcxRb#mQ`=?z6Sgj`hoXQT(A!L*R#EE*bMxcJ#ojSQ3?WGBv9>TY>Y= zKI@qg#xjiTozeCGB=KPt`mUaMG1Z3kZjnhVwpVopP(Uw9(Z0&~; z_jZUK7xYm>uEC>Ki7g@OX`tVaNWRV<#I78pu+at$eVUtTw<ER+VsQJZ3271&E$Q z(UHWf8)ePg215E|)$THy`v?7U56RPbMlB^eS*0Q~6|+w`4SiBQ_=8L(@rSirCrpK{ zKC99rr`EPv z=*f&wPO}uZ{Dr3ma!bAO7AIE)cC{t(XAQIFo$JSJOSrVcr={E_R8$o=-=Me9O{3SWWn-ga2Ch&_L(ZVLW7kU2a9#FELd zOMttb{uv+2-fz?$R4XKEhe2m;zrxY0!O-+PwoxYVw4PV9NnWbsFyeawWkmLTE)}v% zBo>A&r5S~3#9lSnMSF$}p!N#dlXX9nLl91Jo8gxw3733)BB^6l`O}bRAxr0t!!$5l zG#nS-T{Rk++%BH-6yM`R9f>D+R)HW_ZFJ$vhkEg ze$8N4LYztA#!oxshe{u@<((YPbmYRB(g1jf4feHwQSix#1Mpd$D}3CBx9A+QYdm$J z_jBk~Osx*QY@rI}_fI4rmJGsuwJtDG@7=vM-m|ZRB=M`cqV@)P+2JTje083veOoP~ zVWS7L1fH5H8euhM|8DDtEpD@t=%lZ%zf0bD@Ny4{tf0C1V8P2fYMf8#nv8t^HoFGq zzPnt*JECP-Xzp}FT!g$Ze(H?R>H66`fNE)Z#|H{7)DRZ9_imBFtNP<9)jSF)#`N0q z&Xa$B%}&0``j5F2UeW-ip7JkxrT8TBNaFJVzwf&dOSyh$cpY0wcCy;3u-*!XNaC;D z_k{Pm_+nsoOf7 z;6uu~6J}mObLJ(gtnav+OXBxL^>>>*{KwOftTiFuqHdWh3}kJF-vMM2-FQx^E6t%E zW{cXtY(3J$W^RUu_#`2lqt0I;6kg@)!bX2Pe&7WBg#?CR;9ZgsUTD5Go3|NWZ4Nii z%(ladFYiQElI>PjtWTXfL;QC~fS`nUTb=gsx}$NHhCYLlMp{^-hoRZVp*=i4Gvp?Yt zFUllQuipo`ABtX1^1ACNy{*kP?JbG7It>gP@z-Xi^k2Vl7UmWeQOVb(l_1IH3>7v$ zF-y>}#?;hw`uEg7oaJD9BS$c%_Iw4=x)N}tX3#Z|w~b?iTM3Z-eUq!HKwP3p4N@U1 z<#hPhii*pwPExf}m46^p?TW|AlbabJZ$`sz$^}?ftEbzUDz^Fr!+sxGKmf}PUK$jr zGSr3vR|>d$m5{Bu4UOh?3;ZqJM|5_xhafn{C+jCekj5#5*r-Y!p>2E{mnvG+Fk=Zo z0j(eb{sJT{Q1QF1&J5&Uk8ZWbXDIeqW6$I06F9R<$}DmE#j9%I0)p#}7&>D%W}~9w z$BpH-I_ov}pC-^XnE7A3LE#<39=NUUETHX|EK&Q?&{0I=6rU`BBGTLqZdH3)R3GGA zf2++rr*R090}>7dAdo|d!+$#X#27w35V;;zD<`U>w9*C=mIstj$`Xw*m#h^xKIX8J zs+E&3qSRfM#o(>#Vs>+plo#RW0Ik_7o5&IqqX_XGeRD1SDeJXV!(5PX5YUr8vIgzi z-i-_Bf6w)N&}2ZpE$E)V<<19ban< z9&=#1YUOnE?4}NLHtoa>Q|TtPR^6Vp(T&;SI|Mg#2K~z4ZP4e6!@HGC$>(yY*YnNc ze6^>`kP7akn$zWh6(?=bCe*sSRIQZ`pbBTB00``3RqqPiW>JCAB3swn zVRH{e>R4Kda^+0PsiJ@tRKYCZ7w#(i+-(#E#F$dF8|Q&B=wro!E>rO4b<=0#u!;q& zz@&X~I;Ubu-YBQ`^}dXh2w>e>Qj-CPxT+iUC>F&;G+$6y*26S295B>%iIo zAY@$zU~!ccz_NX;OaYzjOycLSb4k=X$9id6jZ2$PGVl%K)EGC+yq@Ww76m?w zsX!ATU^4Tul@ql`>{xOFi|+NO%d>9)f}^gX2_^(szt5C30Pb#$ x+gqobcr2yP7O$ diff --git a/deal.II/examples/step-42/doc/step-42-CellConstitutionColorbar.png b/deal.II/examples/step-42/doc/step-42-CellConstitutionColorbar.png deleted file mode 100644 index ec9790ff6ef1a9dbef53cb42f71b3935c9f543d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6614 zcmbtZbyQSQw;w`Ex*S5fMPL8{k&qfnLZm@rXz7sd?obIuBnA{jx)ebiQc4(7>28oN ziFfAJ_pR@}wca0ZF>`0uT+Y4coW1ui_KnllR3;&!CxSpAB&sTkI^Z)JysrrG!10A=j9{yyg!t!7qevDn_0V2!0&qjdkW}*bIKe_fpkR!k@;$#l@l<9Pmqk zKyzLH##lYW%9wxUwFG1hNF4!@8PLmdG^>~K-` zfz`JGq)jI)GaM%`SA%u}GGnX~VdRQbxQ8_49C&hwe?3$bLdlqA6#e}rU%Ysc`sPi1 zcz8JJ@42X(w+=%>t}joTt{I*f7{qLCIhlS7r0eeP{_*oC+}XKIHOQ}XCSbUJHK;Rr zN;9VIP3p^+ZTb~v{iaW!zSiZl5fBh?n)@E+^dpsZD}qeMLfmD_LQw75Gd`+>j;)Kc zgG5*-xKma|g`g{4j%L^K&U7y}4$f;NlHJqY-BPFI6$zbiq(-(_()LVq_PUqkvB~gZ zjp(@TmdLlnZ7FKPToHy(S-gOixCG5_} zFeAo38Qm5rfg{6oO4`TDOsYJV)%eZ7G3u01L$q~uBSq|fvIq-PrZ7o|%jbtawD6bC zFD>0Ht;)eu2)@`;7JD|rQ}4B|b3BK_LDG(nj8xup9II4)$yL?b+De)NC5j3+GB&Pu zo~*z3HCgc6Y538`XhP5-TAAw>3~KeMxH$IYx;GZuS${CZ)|symqit*) h~7jk_C z=d7-+jWiWdR#PMLKiTQezQxR(a`Tn|3pY1Dq6#V_Ba;QQ!owq>AK{a8ooR}@{CmRA z#)eHnLD4VJV2@@~DbjIc#P5VkB;!D&e0L$-TJPGIdov%KnUUJr*`1!A&XqOHglqGR zv;+abmA-#;zN;M~Q<1?QtZsZf~XhC^H3~%DcD-@ZY^VzrCF#J{w5Y7EQ9aEJYNB zSkDvxKk~ zyHdv0-7ikv`?AH!@X44IE6kdOZ2O?Py1Fc)qSTJ#$FfJ$ z*}zUtPP?n%X#)&P9}9mW@b%sG0)1%N+(FVswzAjd!{Mq?=j58#DtcPuKVUTc37zMbYptM*3X;=uT?k@ ze^36{CBo`K?TC4A8S0yu^g^w+{)AjVxJgQCJ6>V#>a%~=v{SU+H0ESC{9dDPXz0cE zud0X!vUgH`tsr5t03?i;KV57V6B0@-(dE0W=H%pbnrZUuo1M)~&&UwQf)tNF1201( zqdH#M$EBmEE7`7mG=PPS!6iiJ`6E;7Vl|_B|@Zki~b%OcPirh||K4G`3PUYw4H`!$J8)0i{X%!Y0LLldd>k(5^ zri_wa1V=|lhM(P7lbL0c$IU~g3tvokr7$m^?k)NP0Hk1I`Z6*470ZX5w0hGmx@V%>lO< z#GHgA&H2(>J34NF8{uttX6TiU7JvNc&()bH7lBE74sLF%j(D0T+&-vr87+1g1ia+) z$!BI}KzVu8^n!KOo?yIub`kV;VLRWJTphvy(|*tc&O!B$fZttspAxz%qbw3 z0pc05dIknKkn`j11TC2}+_12)*n|WHUtfv+gM&S^GP4{9Wu4=yiII`qhhe$W(S1rQ z$oX~yZSo?qjQQ|cXJk!nt*GHxYb!RGgJjN*(Y}MNZS?H*)rrLO4eENA>GLV^YP$g@ zTs*vmp7c9zZf@U;A0sVnY@+7oEFv5>MoM`2_*xw+n#UIK-^v6@hDSuWZ~cNTEid2u zYWn>7y|D`O6e@1bhe-58u9x#5rB4AdywP|DV%2{$`)*JiBsC)=`r}8wNAINQ9{B9E zgR$lKSBYs$a0&yk+M7^P`<<1{4bQ@1s3eHD`SEjf~=O@JaK&ePaSZ>}*_7yjP(l zkg32!z3@E@2gEfZCI+AJ_U*@j$$%^wZ3WfjvonR#lD&*XMc_C11v!p=l5=*x zyX0|SSXg*&W8>p2KEM+KGP0P=%<+UcEKEIkd|{N6lauh-VH_GBc0b#<0TIG^$)$mz z1DMN{L`1qG9FAy>Bs@KybWKZ3!x9k@!7K|PlIUq((#sJvQkmhf`7U7oEwQOdiWtB|$mOOvW~Kj?$Pk zxOAl7F(A%xb$9?)q*g>J{F)fhaqDQQfhDN2I4W*LZ^qr--CcY4AdOXbFLOfl`{5nj zIJy6jirWuIelzrSccTD*nxwN*Jyl5r->d+bLqZo85N~Be-Yw;o;~F-4@&3$}B`eZ7 zn}P)wBq$LF1O)t=oJ1BDMt%#5hl1;+{^#KzB6N=^4s2RjVj}VRu|}5Wm)Z&mUYZ7( ziGC`DMgiiLYD+Kde#P}yo}6!E6^zCzC=jub-TmY6?a%01{Ki_SJSm%Fz8nL3w1eD@ z+=z%|B33{UkA?D}<40f5Lo(L!6_eFigS!aB-Hu{ptQG#a68Add)LWD#9;4Q;%YF3t*x)$NMLQVC(~}vV~l7Q zQh^b(<0S>YfVObtM&p>;a_TiPTFrh7Qc+WDMJlJTP{v^}8KgjiA%!IfhD5;er#&(r zN=$-)4zg4GrQ(=n{&ytuqP*P%$OCtpfvO$H<rKN4} zqyyXl`Z@io#JWk#Z|{8x$P1p^;y2%V1F%EpiJ@(}T2y2tZr_`GH>CrPM;g>QC=b_% zV-oH2L_T7T&JNgUS?TY-KmYsX{0!(MYsN0v7t?Y<92C^*gJuo_D0_YumQX!?{d$LN z`lRR^czD&nYwQlx?(w9ntt>6I?@WDZi(R4c(l=-Y1W~dl0r&6_c5-qOavbBIVSjDc zmlfuBu)+$1RsFV$67K>f;(mVU@aTH~)YD7$TDhDlXbl}Au8<{?XHO^wLZ)YOmY zS+=vKU|wxc4ZZMB1(aFYLHJq&A9fE9BlSy_fa)h^x-p$fEjA+Scz1Omx68mh=*Ab* zWS8m2^~r<%eYd~I&QqV=ae(mwc&lBaTm0#hqM;!apava!9dY6Dd1Kz5j7&MeunBgf zH5i9s|1GI>WKv2BMji5lsjCU?x{R_)c&i=>WESjz(l@wUU4x2J}Kk(sV|=M3kyTb9czV4 zRPYyC!QW6&1?4H~6ClMHp4HKd*!BrY&USTm*;@nVRe1cEf=MP&Wxk-MeNG}Q3~Gvu zwRCWZ8yeCOJCf!cs#hCgT_%gd9+Jw zi<@^Y$RDxO)+T?imFset>NixV3JQY10Ex^WeRgzE?>d|O^s6_ksOT#JoV6_^C4o}3 za}r)P{YDihH}_^tJ426oOl0Kui3#JDKvPr3NO{(ZkrTiOUY z!~>GfjPPUh6bl>M!k1ND`ufGKtwgZesg@9CVBSpXolpxM2}#LFFFncSGic*bjJDnG zK=6#BAc51l&e~27MTGR%M{j4}BR65icd+osIJ$NZcf%_`NNDzdX4dij?J;Wl_rRYtm5igm+9Js{69fi+Zf@V=cv+;vf#9&`mt z{K`tZea?ad0TphPr{>&!vzXDwRidMJ8uKN^w^Y?n4~0E&o2iUO?N^Y30gv06v=k^CtxagM)(u;1qV~)zAYgVAJJ_ zbmp5+X4-PEFYIQdB$Hfvo)Sv5l@~rX-va1;%az^(yxD z3b^CE>S{`bXyP!<4+=_3H@1IYCzUHgoRP67rVh2ZVmw?NC0;N#=-n>A$}*RL-_8EYT?$d>d7 zbp-te!v>cevv@pOK{MhK-FVPJ7c7zB5sGbA5eX*JryUxL+{0`lElwxfQP~U+Ks30YQF#YcSjz%!{9k zE851|x)R8kYOv*ap-OQ0{@6(;gKOpY?+-7piK66Nrhu?9gv0SBYaOU+>g#O*h*>Nz zFCTKe5*y-0NR@rG%k=E=9Ug`wggSqL>9=9p9k!O1C=N=(n(Ar_L_~SR>lV(=Nsp26$C?BhCYRjJg&9F8YCp1AfWFGh4<#J9b?5qTNH_t+3@1f9?7f+hmp;Z<F{n@ zq(M14YnEQlX1q%a`zDQMwc&;2)z{O0_1>1((V+zT99?Q4czS-0_+4$&bmx09e-!WS zbfJgHMJ?gi+*)9Z!$1>d0bu9a^jGmuWo1>sg!R1^!B1e^#K)aqe)sJFlA&-ZE?^6V;Kptudz+)$ysVM@Lav zStL!RUFPc4%FKx9i|J2DC7^p9Bcdn#>L_U5sPN2)#F>+p5mB9SQhU21E-tP`|C@W~ z-uc?GCo=(LKY#vgy3+*atP18F!MJGT8!~p%@PS_mFfJY`qkZkC$g;A#PR`E2sSt(s z=wz)(L?0W)`UVP8rTnpZXxfe%9>iBOx8OVd4Vb$Qyy3Rhe=nX%&@7{1eRLk;c6}9uAxf=y@Od||uA zp#A9+fB(j-t!K*VMZiV1Ha_1ZXJAMGjnMfvGTEghb8WCYjC0S};ER7+*n4zLn|vvN z!)vQ^9Iv$Lr3J(mFP;mQ>eN2C$MyQrn57LbXjoKvZyUeL$UuPq1YHc6FB!O-;!CYE z__)*l?|0SIetv!!E(8~uo1YH@(hy+vZvFDkPBQ2xJ~1MC$v7uW9x2p`d>fu}uaQ3T?Q}r;ZlR@%a0_44Xtox-+C;<`g9>cm5_;-X}8!dUOGEfBh&r zKiL-O_6x|krw4I?`YLo{bp@(;i$*~mF(?7|yboV2+55qb)?<$*9Td}$k(Po5#&T|B zZK#Qkq^CloV>mU)4Av_n+lA<1z>VdXSH8z87Z8L?-v(##y166XcXu=ilhIAZpm|;5 zp+~QP-uBX!N7Nn{TSsozJcBnjO08||r+VLKkgVh8%;i%1@Yb9A>Ljmgg@Oam^4Wbj z`@|EIbYGx9tR8wjyxviaD7jVy-TKwy3 zWSUqL=9pnAY7-{^Jv_V;vE$Q%lt!?5Z5%=4;^HvPM)$)t&`dG}U5xKj zQ;fZtg38v`)(I(3*vuZoLdVASIUBQ}xSYBFtJC_2=lZ8_|7FPjVa@*e+rK_3_@7S? u{$Jz&X`26h*MD5||G5AE9G@k5O%_pQF5*?Zm<^u5Kvb1970cxuyl9xdp_UydjHsK z`|O;VIrq%mGtY)A%1ff55TSrTAhfSi;>sWp+$sq427>ekc*OzUcL%tGcM|=oiiCu; zw4tyLJVmyb(sTlW(EI+o!6h)DgFzs2&{uI0Rrj=`b`N*8f9--V8BT9Fv5*b#lGzmC z`qf$c^pflSWg{Hk5XO_EtHF)V!7X|HWLjP2yZ}x98^znvb<}dR}BVt!vK}6Iu+4nwrRDg5Gy$ zSTabnF7UvEjowhC%oHEs0p-rRN-YNPZXdC?IYMIO%#;WJZM9OtiA7Qllaa<`1u{BJfW zwa$v~a{|U0Z`NgyTDN%xW_kzj0D(f`1UdER?NcYs=pxZ{j?|6b2fy(SxY-ax2G(Fr z!dc`8*5%5LP2JGQKDE0$%MMb2R-=3AqAL6o9Sm zISJbk#T-g2KmkwD8!DIg{!4I^XW~u>p7nnQb}6_5$2Y-~g5Ct{Do*8HF+W#$k-fte z3mZ$uTs%uh)Y3cPj{mnANjOMuCgG2kdL-+BV*$)mS1onZ=z;q4@iXMbK@1c@POl%< zc!xzJ)>vJov&AK6|4M7S zmeFguMgSVP+vqAZ<2(rZ8EmY}GrF4RpnCKnwM64r^Zz73>@M7)*AdnsUfJ+Ylq(nD z>mPtB&hFRN{{BfIq+=On$_xqJPobdH>byyFy%+rY)Slxk%o>J>L4*+b;{nC&TX@uf|o}otnRJw)GOfmjd*qW71Sq zbRRm_|CF%UsE(ZP-N4agQ!=Fn#>HPXHz&hKWHzu=2W*pJ!otW5sS`nR`t`xUPKSGz zQ1?4(A=v7)=Mh+6bTC*PDy{Sj$%HybgmCVq4c9-?Rfjk`x^ZK3PitU=^}eWRo=&t% zgoxqyHJSw(K8{gJiVZ3Xw?p+toMx0cEK$eX20CCJU($ZFTMm)vRdwj^&tNjvWj|;r z{2W_}1~{@#Rv43IR3GDwV$t#!lM;ryZ6i~SPX!S?pL?ew)YK0(`wtJ|S-O|qQ&AFZ zs=gPpWCC9)GPZ0;BS3nfnT-93*6NO1#$X6@r0_$6-*TYPlU%qmpFy+rY7bxhcD_?U zPnn>`)1ubm`T*?cji{_*ZK-cnk$pAQF&nZqPURw8+kZ3ybsR7_BE6_qy4-{I@Ycgn(+Lr_(x3yp6$q# zgCbP&HpB^1%Qjx$%dFtnc-+f|MgK&r%3CSw63p$LT+oowL8To0ml5$h zrlBb}Uff!Vz2_o%y<2B?Utc`IwXi)y@VT2foAvdkP4D!2jwDBAnU`5zFANbE zIXnTCcz38DVi;9^y;I~4NNR@9f`8*y%?S@*2FhC0 z=$kjUX;1^dDP}x=8fGwPse_OBJ4UZeuwicSJ%~%Ej9)SASI|$aA94<>DF>tGWS_%Y z3e7+!rbEOeJovkn@`o;BaE~eqtpj4Xww3 z&Uhtd71?_j$41Sid;(i&6lvrW>K^+~FRpA zn-8o%SVG)cTBIhv(my!~A+S_p;nrS3@tz>{SX4y*|D5KuZcI4{QNlI z<=Ki4sj4GC`py;mB2nuKp|PWVe@Ndtp7Ar=Z?GxFT|8tws_}MnrDX}gb?#T-AcUBF zX1{0rX$o@sh6?7he&>IrIIF3;>UN?>|IKrdjo)O8kaj|LZ;WXp)uc*sEEgyE;xbv+ z{EQ5>c_V~%#icpLz3=F6?_QC+)YBONcODWerDhpFm8KWS&-~C^x9od83wI_?`{r`5 zIL0&w%H~#M3j}^znGR-AG7d`-?o+g)6MZM%U?m)ssio0uR@+%bjcMW0B1Gk(|4&4_ zA}`C3kv`Di5I-jd`U~CnZADPuI6s|v$Z85E-ruJRH+58F38y-Xxv3?X4{oCe(T*sB zh}Q^7U|H}EMACF9$JDZ6%O#oSM?_16Tk72gV8l!Rq%1QjLLzCgtyS$=GQAfMkOhb1 z-tYwi10L5mbq4!7DpV9LccYE?F@uJ@1WIJ&ilWHpVpP|ekQ<$&d2GAl1+y(t8h2>< z^;y7qqQNeJ#)}fDO0~+=mwwos@JOIYUh0e%v%QOVf4~R3JX$nbOkNY1KMK3+YL^Ku zc(#;P*~k<}1LlMaMB&E-(j4pm9$3%l#_wL)0Oxmx)aYl5AqR(q%Lx5~wzO9qFLg-3 zkLFf3;t96f%HEDnm}_$G{f~eUXNJ*pJIFBj?==U%xnP$7z8H&qu+u)#dc@D;Qe3U~ zxcqLAMHA;PAT-to&O;~tKV>2!zV?y581}R1rrWOAc(ngfbwf=FkL~Wb{q>uR{rV*M zj|E}XX@*cN3Dc4Hx&i?B)F?L)D%$359W@gWU%PJ^Wn&MD zO72mcn%c3ztgLTyMtN86(K-#oi{=@91JVKK0FYMo(u_4g-a7F^ff?vWUR3zw652-b zLQEDiLdwk~7t&T9j;#WgM@9(Sl<-1E>tE+!1lCwJ^mXU7_u5IO+T^xWft@6OTvncj z5l(IxE11>>|I5rml7=P~<=>)&>v^H_#x_|B@}(4-1qe^JU8DXHaM|e);U7nnF0$Jc0nE&Kp<(pxY`AwS2CDnAi%!UUf0O2W$858 zy4TzNxGq}uZiv3@{ND2hbNplONNYz2;<<8`iWG zU7?LYs(BQ|cE2cRm;H5jAD{Lg?K2UR{8-js4;syfe=E+$S-MN8lhFC*@o&P`zDvnM zX7{+{3>L$TwY+`7-8LjOw1H;`UC3vfpyhV4t{Q$hJa>zf%X{lmS zq&^tvxE60}RMSp%JdXe$UphP#7W7jy8)hC|O6&wquKZ*%`bh@xz$$T6C3cPrLglsf zcAr0R!pbV3`_L4`!0gz{-@HUbtT$+)EcN`iXha7eEM577yF0ishV4Ui-cfY+*i+o7 zR2{f#VtWR)*&(-p6P>DPCr)tcFyH|!*r<~tKbE#moMG6=l(J0m+ZzN0baUsJ1?nY! zUo7Wid>pTFyud-Z@C`UVj7& zq82@(q6JWN6UM@&&od$mSK_@I&5VJGywiExiHDm+bT1G-o`B=6TuTip$GmEtS@{V@ zNPiiRb|)qp3%3=Ut(0(#fMG>h!G}iOfDcAv{VZ8hTF zm8S!@p^MvTpm5aXcsnOhHY60GEk>Gj>ABJ}P_@_F(h)W;;xT_s#88>Fe#JQpu3$8? z2x^vV2qE49woY0t3bjuOh(b3EPM?klOG#iXW9Nu(4N~{m19M_w9J7 zz6*3L3PZ0qR6p}OKyV}I*_K*4wbE<+)m@fC;==^sRVbxVaLT)ZAU(nN3G+>ORfk~b ze+pD_@lmb`JZg^hBe=B$mS5RMgUz_3`aXY<*u3Anm_l{^!93;749~fwJ%%us$}$st ze{=-@`3qFFNH(K3en3%^Q2JC9-yrK7Nt~#$^j=>~jW21fnC8~9$qWxVN!?X3p*w>n z&z?lcvk&{}Mb`yF$K|>XPK}u64^X@@r>d|jQgMitSCQ#iDG(RW^AZl zt4+rgO2~VAUqQj{h{yG-Kf$JuwP_Dk)yv<4X9*CXU$R8=1Rq)y(*>WPI7w<^cj z?-$WRuq10Lmd;uuf+aIMlc|QX^9v>3*&+ROYQ)P^4|o=aQyN@)x9XC+hhn%l3v_Di zO5n%e(k5Qn1C{n(q)U222d0Y#ZrT}*;ze>*D)YrKK5{Mvk1ustNKa8@MX;@p5@khZ zsc+52*2sU&B9f8YfnA&Byc_16rDoo0#eTguJ(1_`s`9MNIltJ>OB z_Y!2R3~fvCL$g|shrkj`hj+&wmNp?#1$G*V?swOZk~^HYXp5~A*22=NypwlVAPlD& zk+_d&bY64IF2gCih8L#al5s~wQ_(eC8*^6$EHHW*AA3CRg6O$kewP!D;7~JV=myoQU`49vlHVDlCr+c` z=vGC7sK+~?gZ4kqpxj7d=eQHyOHP;m$id+rpf1?OxVCVXUGCkrU7|x}eOBcyK&x$9 zF{z!IK}9D?TLCTHQ81q^Oyp!RWLKY5>m zrk8}gf40XMP4p*L(WsF0(jR}*4Ww*CX`Gor@tD&)!R3gnsS&04)qQ3s9HqL-o0-Le z-bc(i&76Kz&+!=*?&#=-I^-VnF$isNSMK(lL0EC~SEY;Qu-Vi`KWA;;eZ5sem^k@m zkkQt$`{GoyAx%BbBvg@k$!o+T_ z#Rep_==*oP@6zDkoTkLY5M<_wX3Fz}WzOb3lr;#~`{V3HVaGAy8ImFt>uMW`P0k%@ zr6y33rwLzJ1geB8>NRF(Hp`!%)5!SYjR|CC*gRPlCc5EyPc)zZw^XWl&{Td#_m8&| z!QHzq0usBj`^SrN&NhQPZ7f4Sy02uwuPe?ZTbkJ-l&NeomYXyyY6ddkP{wwMXtsJp zM}(2v{mN1ui5dvb)@o#i)BlLbCqbXAHHQiZx!m`+`OCV70$@^IN_?xWdz zj}8QcfK+RRCNoIrz%uI<8t=m>!~`0sKx%&|h%*K$%EliJbjU7S*0C_tu-Kco$x}Ru z%u;bQuLk$%2XFWkmnD-iScL3y>SZ_cn317QMViJ4^66`YQCLba(Qt#`So9W5D>U0A z*BZuEWnU3z8=5rh6wNY`cpWa+?vDhH%6ArNPrb#cl(_WzyMyj^NE(!35-c^UfTJ&{ zuTdmpS%5Zbg8Gfo`n%E4^?SLRnW3mW*{Y3qy3LwwmsE}!1IxI*10^9=mz>-k^mn48 ziCt8^^pr5CFPmN1)&)OiKc`P32zGwq`4{r6_`yQYMVf0FlRB;EmWx^Ozmqyi`$d95 ztXD}ow?K5a6j$CbZid3Yk@JpJR6~*UwNSHxZ=pZQZQW)o{#?f#kbmcPIWb zIh^p^V@ukIifniQHp%MP*kw}CS&7G zurgArF|ifqqFHa1Qe7SvT=Ix9C-kJYJ9ekqYr`~M!dq;q%`(bFS7dMPYlR?p5Nl?Z zF&SMj|~T9M^K1lxe5WYNzzb`6Gh=BzUC;XbO@{ z{N~L~4n=(A7R_By%e#M$|GB)T9 z97x#o+I}N`Srg>D=68gM+qrEQ+|CvdqkmVM3Po#1sGYD{(Ax8;h5RyWhRa|=3Xw`Y zNwhM%(EK`Cr4F6!+$Dd;OJva+MDYoz(EhI$>u(M*L6ww4Bh_kZ%U}trv5M-b2KNP?l2E$o!Us=#lKj$lN%m%lbPca7E%pTz<$ZN{T*!B{bdIZ^+Ko=V7hf#ldXVpEND-Ve= zCH5s(n4s81TcY)0QZ~iR%@Yt2M;V%0o9L;cqnAH)?I(Ua;Y&oy(*3KC)1uS-?2HIv z;pa)}@mx{NI)Vg6h{r1{5e{SIp79%2^UNzdRbL=Qnq~I|{gn@w9CnZKJYY0^xwlIS0X%1l-g;iaI;dzn@Cbu5s;u7Vbj-lWSqnO?B%&2Avj zL>=`vX=i>5t1FvL{fkQZmmBi$NHBFHBFpgD8fkyxhD;5C86w`oR_Ws^C={k^DZwET zKTkjesqxfkJS~VKylVW*POs`_rDRIypC=y~JsT=b|9+O*xf#1F#`D-#zwIMc`!&N7 z#s`kQxpIYpXhOmx;RA}iPf?w6qruaC==NgFH=}>{N?;ocSRonQIcnuK%hrg5g4@B` z**ciBm*!|JT>$UcLK7eoSbxCDrw%}X4W(-_5B)H~sw`?p8W*$W&^B;p1eaIdbnS%N zg3dZ8mf^CR%pZQ4{;?g+Txx}F47N4`z7bW$L4DTfE~hXp7yd;l+7P=Sc>Lr}GxtfC0Dq~-toOO@_lJs= zfi|-<6u?)$aAUT=XzSh8EKV6O^PEXpk_L_siDUxD#5dJN6=4tnbg~3_ZC|8Gw4vVosn4YP8uD{6A%joG|VwdJ{;-DgoXcD zM6LOaMX}+@`q}pG?<~b52$!yKdpxE3NEuZ4;?1ytk0D3U+(Gq*a5ZObJnk>y>mP2oRTNxOOlJJbAlq0 zSO7jJdCZQL-yn}iyRU^rB_D&bJUo9-Bg?_n9bUeItbO+oYFMO4S-cL8gifDp+9&%% ztCXpeWetpy3wHo!z?H8GL3pnLD|cYc&-IRkQE+S7ouYm`!3KpKpy360^cQXs7iX+} zd(gV0(oD0Gv`S_ZOm?zUvA)veqm?A9Q8}ZsvHoKun5-Z+G0p3q$D*(M{L?!i>LU>0 zm7H|K72g=Mg|rtG96v2xf|7hpYCMrE&6wxi7(eglHoGBUC(9!2vhaPhUD$kQXRgMW zBI!r%VyRm5D6U*6@#WaoaxTvq&@-QqUBa@N(?R`kuztq=e1UI&Y;c=>MWgj+|Ia0` zTxW&W=GL!LRi?jlY7kN@J`up$pkfty@VcygpJFYKeNe%L^T!*G6puce+G{@qunp2+@;I<0^g~xbX&(QirwQ-JVyGwb!1m zs6k?<+&Xu#d;KAF|>{tGaPu(JwZz{F=|2*nVop}`}GiX zRGTw1j?s?DNVmS&gLs*IB(CYF24j0-4hwdx^pnMeKc^H^1A!MXr){A76f#GcmOVA2 zDpjkEDZ7s+?EQyfxCV4K85C1j-FbB3wl=<~ef2ye*9@7%{ZC={To~K$Z}V6Fb{KsA z4+KX-O%h1-;x$fF?*jSY+V1z|W{yY$qv~wDFHAfFBdFd>B47tw4!g-W5O5VS1f_oe zXYjY4>XgmvJr-|I29v52I7piR4y-h`V8B@E1i@@Ch8$5IGm)>Yg?-#SXo2G-cSEfa z<-z9UNx`VNiP>s6*h`|Kw)5Q!`NR=%>ImCf(SEC3;V;UkkC3%m)6WsDkT@K4D@C`) z&+5Lrr!=Y#CDVhBN2cnDf~i^+j;y$E5A=*3u9!G%L$)M?)zug^?{?i@-wVGK{prm` z|7-lvmHN%bLxoeJ^WvwnySwk@1JeY5(+7XY0O=L3V)?U+?w(u=Rx(u1p@@GrXggA3 zz3x;DMOq!v&&6e-h@+aSC1!)71sw^m7Vng){~g_kU#ze{e&Jn{4f}wUBIH7T#+R8c zK;EEQ8>(ZbK7ZOk2cq`lj8urkoHTwA{^9*S>L;S0-YOsl{x=&q{{d*tN1WyVKMRoL zO3Lbo=I=R**BN&`5Oyo1KD+SQjoM%6sxy@Zb(JS2nE(K?cf##{pqu;^d2qWn>A-pJ z=+BgC*e8h9a?>yss6|KF+5LVEFp8!gqW_a1bm#$eTXDg76{KX7n2>ZFP=uJegtua; z+m8FT4R@sFTU^G`fmHB)2R&=|r*Ny#DW z9nc_tq|BZcUn6$|?#XMo&j!cxaz-fFqO70)SOEb(l%z5x#6lB?&8p!oeZolO3k}&t z2I3o$U3)_r*keQ-8kyQh34+uGeI(?h;SAUBtT{jv;pe-G>IE@daata>EX+Ccvs)Mn z`bBWrwl(|2Oex;*{Bt*~BJ*5M=p7K^Ry`~EyYmY>Iz_0HN z4{HJfAm3&sW&hG$O+;Tg*`&2(bWyUoM$S$T%fws%iuOT)X=4@OG+^P4$G3BpyN@+I zHS-BodLp=6y4HCn<4xyV(z-Mz7kljKj3WgmM5x^;xcoaHDsvV^{c~htdsb^B%!yUB zg^>r3)gGHQF`=4cOKFovm6;9=%l@&*YiTw-1Pb^e99+=dr}K71&@5}&WU=6?{%*U# zL?_zxd?S(_gnHr}cDiX?1oE873h9jR z*1SO03MC*aD$m`xcbc?MiR7OM$#2(Z@CmDB`{(t^(f}-z!(}121FEanyW1BHIvbbYNSjt;s zPp~-jymmS*`hwcA8+@K$^GRN*xxGXsL2dRYJbqI^uK$zWoXxVLWX)FEH?ainP>^Bf z6Q$vw?w0aM1If{zRUsEOCNevg{E6PA5AHQ=cR~vZi);Uo+RaS!6eigYRwoss$UG>l zbriRpr9FUL)+rkKH^ve5w!tJZeteRS-NL3WV(I0(LA;58)eiUHV1t#5*$hy}N(cOR zA2{np-AsPidU|fc%yOIE;PLq!=XVV_azOWRldE~u=b#}Yye7_SP2)v*IUbdo^}wkg zZZ6?0ylqFPqEVM%uGKNiXokLfegA;>iJ2CQ`Hh=epLHDq?T{2 z6H7BMGRCM##h>Ay^*+%ThS*SwDRXl;ps#`i9&y^NSy**SQAehB9BzYsO(zm?R%5^( zH&{%T@iz{X1o1yEB7&mQQ4c~iGsR4i;Qp%x9<~A$&^tO`zIixFQHPqR9%{4M5&krH zGCG?XLqJO$)0Ph>I~-}jro)lqoQAA5eig&(T&yN{_}BWCGBiWu>_=LOh?_rk7yQ{m z>>uaLvxWD(@YciJvQ@4mtb03G?mYdt?0bFKNu!6oNydY3wH z-TG}#FV;VIz<>(jI1Z=K^T6yl)5M#*O#__~%Kg4JfwlA}H`|ZKBqZ#L2j}}|Q!_}r zB)bJ~-8X*Oqa*wfG8rlw230)Yup7RCp{Twodb?W5|22|4d70AO>!ipR$hM2ue7B5( z3aN|`Ph?u#eY(8>y(GAjqyUM9C&M7TfmM3nAKXggVn@TDntKm8s|xAUH(a)kUpGtK zZrv&!lm7^u<7C&zJJop2h1=Xa!O{Ad!?;NhdT}b^?Vj|c+9X)-aQ~t}!0EPu0*&1U zC=7-?NYhWs*`hnv+$rN>tExFMl8c!uw_F64KU3!X8a8uTN@(z;JjBz(cBBT8SWbiN z4?bVU+!x0cYyZA}d(pv8qP%*fXQ;&u2bkxLu#XQKsSnu(DlG4BZ?+?A5ubxf?~9vk zlE&3kxi}PbP)^LE!d^{-JA&|;!Ms7D70UD2TBxtm@<0~OHB?LltT8gQh>^8D|Ggxw zGTNrriSBFPzn&!s3}LpSeO<~L$IhlIzL6hjVXWg-R&!~@3#B=tX_Brkn_otj#|@Ej zi%3dC4~2C9UOpJswVR*6lG-d1g5Jz?8GIx&6YJ*3a}Z>KFFzAkXA^Q^^Fspjyvdqd z%)Pp=lnLhxl?KVsD@$VP}eHxzsiJB$v5A&eVEJkj)7*$cxJhLqG>(iS8RJeu(ki-N^sN-nTck@`^#wU z>vQXz^8yiT3i#<;L$r)J<=VC*>CHgEuE94_873Zz#9KsWL=+Slf`_eCiE))CO>igk z;2Kw~)Jv*tnCiokkcsP!D6l`+PEp!DaSso6rjV}j8*(tO{8u~Zz#`p#(nN6)gtGjuwE;eET*%Gp5GYOwBnRCODI~GgTqRfCrT!@?k&z z$SZ&BY<79_pgIMVps>_~eQHMB7n7xD+teDq%`N# z_7f+aL&W9$)+nt2rP3!0UZJmEFG>z_IvBRJJi*rg^nMp$uYh7C>nSeMkB|1yG{2dG zGB%lPtlQq0aYnBy(v)II&1q84{2yA z`;okBQwUwPJg+8H*1k<&I4MV?KI9r+e@SoKc~{n~Rurkq4q6A(e?4{%Ifg+^11j|8 zGlt?NMKv9k2D-kNrKJg2NFac)$LaRVKVS0nHRf0OHp&_PtfOvRSO${POs0h~`ft>~ zzy-OrhKQpRe%bINPlks)^G~Kscg?E-!5HrzwZ(&_8P;CxO?iZ7Sn1jS4eutjBaPy< zv<)g3u`9(jYlcXyH z4rjp)Meep57RQB?vewMxcQQ3tdBm})3Xp~2&{&YS(&Ttrp$H~#F~PPuLCSBp7urVO zV8uPA`Sa05wJK9E{~d`20mO zCM^Ut`VrlElP0h5+})c%Vesh;6M~GzbYIPQ`vIgo@Xk)BjSRwEROC=7G1$9<9M^6= zHnhR%1?GPcr0PPRSqAc$eae2&O?@jJQ0yicuEB3qeXV>Hc+X;D24j1u4qYlY# z1Io^sxKf!)()gz1T)$7N_Hz3NYf)e%HH94@+%D%C_OIrg!ZG?hjpV*hyz#8``>)qs zOb5duBVdx<>LQ;w13_CVisatENs;_~z#Qb0`Yy%QG&Six@`a}XR)lo37RF)M#lI02 z`qbOy`*0IOd;t+YmCL=q#vzgEJ(W~iQ6rv61n8f$2CsgA3(AeyuVr5>iSGMJNaasI z`>fY(eg;uvyyCHE_VyKnGTdK!fdWTUefgX*>UR2_8XY^bG;n4(zCdOT`noOSzIaAQ=vtr+~TEE z=!HyARYPEa4LzxzF3(zg^5IV{wd-n(G$476SPRfPBD{^0Jbnih z6^5)j>;?8SNyzVWweRz7%?7PzL|p=2%8U8!4R2B+Vu z+)b-097hfEadNCecr?BRb|V^G@`P=D>`L& zGX1`{$Ffi{(XZW05<0V%A12bT)r zd;QCHA!d;**n#t##qgt+Bos(b^j54G{ekGbgxe-LqvM)4KhSq(VCyW;aFB4O0OH&7 zlb}>=xgkaLcT0o2N)y_*sAaIgn{G>!g^ZkI%;~I^D2*?r>q~n9Azh2{p*Nrlmw@e*ik` zP`f_udN9nNcRj4FjY3lrEaMcY%I^O({jJcI|MGYHHQW^tCyR3tFEY`s3Cn?7FDv+epVw-S<+JM@o#Ky-NHnh7xm^;Ya&Kkr|e=O zKHH(co)GvMYt3&^&q`Y%(7MhSSXNI-?BT8gbpfp;RS(JoBmJn72aL(amHAn@h~3}P z4ECLm**mKWItV{h%QMHwu(9G}So+(7IdNvC+3;L-Z7^Q<;%z{m?`S5xg)LYpN{4B%^tR&<~1ILALNJ=sFdR8n3t&r-F}_?Qv=6HPwJ(Z z+!=keh_me2Tto%HpSP~qPqS1B$t#`Ar7OHW-#D@IO%=5hk$-K!z5zXs#e8kQuB5d0t+ zhJ5Om>*47a|5%UA6)OMD!LD3y`*j)gJ2KeNI9@ERU&7(ftd<_KL753=& zHPl+`TKb~1l-ftAts**z-QNHd;$Vs}V$ACIGN;Fy2aI5LlcEwzl8gjKN>DHipEJ=m zb~6q@jo;bmwM2D9VlsMRA-pcC1VqIC-w$pKXWWvJjqmj%c# zsh*J_;?cna>pz`V3i-Iqt!_2ICXS~s&TdY5LBPymC7@W%6kS@(tZXVYNp!T}O*Rl#uYETa@`J-071;pVlk1ZoqO@Bt8$CGoF|Qq>ey z0pn1LIt4neD=YX)7ZcF{@$Bg|fCe!i#e<0BaS$kbTiw!=R;v*&>qrNqy!HK?kL#}~ zWQmK?kCvp*DgKd*N>T6=!};hg9P!A)e@eVxutN}Y5PEsI97J$knZL#d`M!=F1~|yB z7ca0{jK+}qf6Q6Ts9&Ov-dlO{%b&3v-`y(=+f_hG;f5KQ zV&BkP$IxkQG+T!+PuaRER4rWF-!-%_C%y5(@i98h##Q4Q ziVdF*y3LmQ3_Ov{x1AswIl;RSRz)>_&fjTMc5AafPvjq(PO&*UqsR1uLZu$v3W+^L zaO%`9h!vnvuSTKihZ2A&Rv;0So{^P(hQ1yny@TJa*uNiw&(#~%2@9wP0gSQ@(8{7Q zWbm)W#dYX5ScowK0UsF-ax%QV5+<+kIb1LL^$5q96!*^G%mGIon*!;BY@$PG==3{Y z+q1pLrHi%f?pdVD6s^UbVSs|E|Kj=kc+F)``KA$|E1o}f*dKTAAe;sinn9+u>ts-dvC4j^r;&m5o?6x zy^D%rl9ghEh`FsWJ9+=Pj{PN@z4yfVtM$ilj!f0CHeuvN*DP0W&Cg1#J@92RH;FIb zR*8e~O;BF+5srPBoG5IbHvj!O^>T!K{SL;Y!)Yi>B|+`G{#x{K3D6p#BNA4u*pK77 z7oMyi8hLc2jPIjo-Be!qyft9wxu6D;v?WsR_}XllwUW0c4Po?P>z-UU(d(QQIiifE z#=t1ceBuXGD3KP>(hjk>Y>?P^IbDM5)zfM-8X?ISzNDBKrxW38L-n16RP9YP0wjaa zoxeV)DF?Q|U(sOK`idnCULPenec|`%NyDxqnC|Q+0HAF|zi|2Qd372O)t1f zCbLv5db&eborK%Z#zc1gS*A}60`LvJh(JP-0@)W0SlNoigwvmfyP<#jcH(m1Hc|e0 zEi?Mt29Vec&vrw_Gp;Ne8)OjEA@HI8sfv74yuP;58!%I<6el ztjWCtI|j#0RGRp*h(6$=cGqJS_XX2trWZHwu7}1lmy+uN^%s#Z#~&r9%hhAC z?)Bz~2(&d_`0$jkrZ@l{ro?XZ3iL(06?Oj9bi$EanjJg<4)-$oYTJRf>tDe62cKe@ zP)f)BkUVEcY-4zXAXZ{c$C>{;TXF!}=|P^Vm#oCjv@9u>h8&+KyM(;_hN?Jyyp6pv zu$^wB+)h!GW(_9^(7`lQ#k^nJhW`?28y}tBN|EJ;tkiJ&H8AHeK?=& zITM$uEdO9!*aAX&cc^>wHw_2=l*oOF<;M4+rw>s=h4mi}>UxVu9O%l&2+gv?(K(~| ziCj~#+WwOEfW8sK^@@R9>G!Tds@*%n9XQIwqhdyrI6i$YJ2n|tb%fOZrrgf#pW+-( zXkzf|LGOQNr5Ah5r(?X4Ds!`ZJrCivM1L0uLN8kw-MhZ{pRTeCigO3oI@gaGV|!m8 z$By%2G(k2v`YN6XnVsGC;}xyHf0P5G+imN|WdPw0qCMuVTbekfA(7jXbHz`57pUfP zSd_feQ)t6eE2?RcK^v%M$}FkD?RFSfZF+p9hrAS)^3N%#pb_EB(py{0#0vIA2tpXs z?=2z}R%-43z~6e>yes%>Ip}u$Uw4N$n+^hlH)uZS7XBw|22|bCL9Qd)Rv8J5RG+Re zVnu#Sex8?bYR0xO^Xok_rX9UcPG30kPvj(!AN-9pmp{Gm(_y6_1$VLYV7cSN$^*EE zsfB!gVZ@4g`PIh~g_q;8!F}}txB?*C03>{Vf)hG-{QfJUbuN&voeeu-yt$hWlmFeW z3nTBmI`I?Wb0UqoOaIZwiMN};WJZt0QIGv;6%6;DxpaN>(vdChzYgL}I_jGt?+w=m zUSx{wvZj{U%F^9|X*94y+OZ1r+`n8#Np1#05CqnEyjpsHJ%NW_98;*&Ke~j0I)8~P zA&0_f)l=6jH3UPMeSdu{x z@T;jr1gT}gV=F`DXBBXe>+^c>aCPf{Gr~Ni~Fcd zf8}CM$Bsdfuj|mVGj;h4g!}$(T*AH8QPyTbPzv>jv=!9#T&(t?`YacOljj-%5QIE9 zqeTQiD!2J?kMGZhxXQWNIe)#YUmym2jUpI@v3BTITpUr!%8UroFRQqKc2)1T#ny~%&Q6daL{Rstuz8>9p^yU z=;tu!)oI0Xi0N0^i~ac?V>3x@ZpA|71e+o;zuxouZ1FMdx?|OcT)sw56?UG6W3AAv zoE^Zxg&!*5TUT2TuGW&6&79kIW)uRtG3CDL*F5&E&N!Du%e_ia#s45@grgGHU@HN( zJDj`vR#+>RtzfIkrIITYKPpEkc;geRnW8&bCWlYG5x4+?jx*o;GUK5x?NA8YZtvfw zzJlJ8Gy#q1@X*B3Q^t{55KY65i1U~uBxApNf5A;quGir60a2E?$PwXWg9o&4lnsa^1OmRq{=hH>9Jkv^8Kz>sAD4i{^jx*9ArbwX z^`WQ7LCz?BoSopLHHQc%hu#*)RQb87cfgpt!YjdCM3vzc*quTJb2$5qE?TDqqYK!Ie|4A|GGt#%3YEKmvXh;?9HLtQ;kBtgD;vI* zvtho=8(1)nb-7~D39sRxgP+rBuE7?oY7T}ZXdu+es83noNv4lE;8lDn>YjpRyDQ zDq{)_tr6AyD%lzECjtNOe*uUy00Jy4mKts1FG6a1g+&371iNypmb@DG0VYQ^7{p0ohMrU}#wcYyR z{oCWHl(<)2(E3@6DCjE*n4+w}!xEuu0L^w8_f1#L^iU;8ao&s-lv0Nz{Fu}EQ5MR% z$(No@#c#p3nc0Uwl_dza6s$92(GJ@lg3V2ZM5WACT2qIqf1?hu<%`%EKobDRCvs(B zE#dao0ByXkXwh4svwY#mcK>$wv7iGOOe>)lY`+cvV%Kg@!xvPrQAjoHAr?4ci^r_* zu7n&uAsQD{*z@8L-0wud#NG#7lP)@?RwZvhRD|;Yw|rA60P9~}a$C^03Xx<(4`#Ww z7T^1r@K54IYo3oH49%}MF$E5_^-|>jXu7JnsJduBG)M|4-6ew3-Q6YK&CuOBN+?Qq zw{%H&2+~7$cXtnY&v)B-~8kn)>$85LT8hNE^Sq9X>zz}%qDs$*}9@RoGsc$mE?=Xh)nusz!feXu5YMTWYGMZ zq^mFYJau$8`Mc=zkT~zNj;o*hoqCg^c2*(=2}4M9xx_b5F(`=s`e?L4g@O;+#H|Ma zRcw1&43AXJ+SP$ByRHomvJzUP7N2%t@ow(A0FGH>wL^|k>AS|f)%k__+MoO1(Z;a9 ztv(>EJ$u$V`3}hY0D(7Q$Ok)~8;Lq48DYlh&ufd^Z1y9V(oj&;w4MGRi;b7lgQ4bh z#-P*iJrRE@QzjR8BW3zXnIeqlZVDA-R^U;G7E%PCme$7f_^qB0K=<#a&@{vP*pHw5 z6gq^&8<2nT+>;>oNO-WNQbl!-s}^Al&8k+aTY4Hgtio|0kF6Qi5`GUe8jJ3XrB7WM zdN6&O`z=tajJin1h4&-pYB(^>_fkDIt-EA*CDc+hr_WgcB>Im_2*$c;DQgRiwc?As zN*v4t<(3PsVbYB;ZC3IQ$fEJ5Jj*R{@2~T1*hpJp+q3$70&V&0LcXyZc%GOoN~9 z+6Lz6{p0Fn^&<+4H270$S~i<9@&Yg1t$*=Bq?xfikd-zQ5_k)QWiLn&=j+C8#E@D?W{>mTtX7~^5C zuxWpvms|=w0ifUz$Nd#|4RR2)G@VPJey$w=Dvr{sCQMuQ&e=p;^KfH+Qy27;CkW1j zYH{jgC2;tD4tSEk-hVpo#AvKP##UL@(f6=Fld@!2-XvR|i=t$X8+H`=A2ebq^ApxhKjUtI_ar!6 zkc?)J#V4DW_+2sC5m2YAYKPa*`3rF(k%1^b{`7v9w}xJ&X5M~d<%?@k+M z@Lffr;gw|g!aydwZk+h6gb@mgKl63>PnCyAlAHJbAq#*|^OX?+3n&+pepK4!f?BHh zOe!)@DNf&>(m}R(e%1*7){vA3Gmm-^^o{0j8njz6on&`bb(O70ALl{e;><}WaLW6N z2Ln_66v>NX6kE&>h#xR~*%Af`1^R=!4l<2FsK{lrW);Q71tRFg*XYPwAKZRPCxdvW zITITTNE{92c91Y1;H)Q)*=r~Xv)OIwak!2MQ@^TAit?%i@9mVj+DT!wZ3%s5sa^7BKFEI0agcct~2}|79e{!~Vtx!vQ)Zj;Ci==lr_w zBLg4&=@`5Q?G`rZ3_=x*){2NYI7tN%5*w8doSGgA{)JkF>BLn<@xP^q4|MqGmKCgN^uMrrlT{WQfVFs&nC{|ao|Kjz?!Dk3$WmjKor0MISbg{jqeot$DS^!mvmxK42xs_fa3@$64%COd?aK}AtF95uy>|>Zg%aqGDP<%|CIgjZ4$Mi zR>@zPFn^SUdd9LD7zzJQrCsn=;-UamaX=6awJp8Hu7B@*>YQU6o}rp&Qj!?F^JN-= zvq^`+*kGlEst$ef*(d&BPtEYb!JWrMhk5cKGMel0%zT}f%WyGs6_7o1I9$}oUzt35 zIkdI2p)?vsFaT66E`a#!DuNyc{@Ar-`&=?qe7rl3^Kb;TQkf8dmKq=L2jo4v?Vb6C z%uWB8_`I)FP*pq{3bpZe{slI*N=;mZ$tBO_`$(n4kMd~VtNUP=#CT=<#A^g%gvhKs z$uT|R-X;~3GB+X;&*D^yf96bPazdhw*$_3m{k2AMY~Ti!eo4$RmzLl_6)MCY$(26EV;$GX?Z!aOMeC*3%B<^2 z^@AkoP{gk=eeF0nYEq*UdsbWFzy#evL}AQeH4YKAx69u6+|RCRJZ$bernZ&rzkKQJ z1^(AVedzs+SIlQlntPr|3Ifz&?kd*PYuicNxUc041?MbBQ)6;IduVU)u6OV@TMAXnRT>mW<{jg-{ed}ZTh~}tw@L}zdMZk? zw5xO~#62r)gE^`*Z8=N!+eznF_aDpLY#JmU-=eEh!H z!@yzBv;;6?Rrd4GAULI4By8@b8YU_G0e)3vnTg)<#2~ftN;kc?s&dC|94}ypKQ+{_ zmu0%Dv8?g8R}2*-H|($NlN%e?fF_a8&wokZs60z$s{ILA4eG@fTu2V3>4(bO_EQBR(Z@O(kqBsD~~EILPMgUWH@Q zHwf*|W64D9+^eHGITZ+$P~{`aSexxP=sp46>#@jcwZm3Cn&m&(_w=b0QP8*lRsUUE z>K9?24aqzDxG<<)9U&lNqgE}ySszDHw~-uk3W|fI5fR@ceL@E0Y1kE?j)v4ZPU=<0 zoH=<+?!pgm<7Y4PSHmnk_@i7tQ;guTsdT`L)rzOq5N*r-kX9~v$VmWSCRDA=3^RTV zM)2UYr6{)p)4qho?R=8@^LhR$Dm)`6-^%)YzMicWzzu9#^OuCZY{(emwztVH#aYpnt+Ai;c-9pD&FKNU=tnQ#^!CSn61s%!! z{%<`1atWlkQWtzOWO%7}^x2DS`DWFU0@@6)({Rg~3E$HgCjnkyZNlxPz>DQoH~TU# zGrJLY^~1L-^HH0L8_bVahxW4S1T2Dokm3wYUgeB(&PvQ_Th-J@Kbpo7;W7?~KHUP* zFimb-j9@I$zUGT*u6_>oYeg`lE9^*9`FHOe(0W>Q*w`oM`b1H%xmLG#nvSoGukq7u zGjZ`!fvC@@%HPc}2OD7Vmh3u`DWmjksp4Xt8n_*P5?_Jw=Q$EktQ{Xv7s zrc#~2fCSJY5F_l*f(?KI@U7JVfusH%DWPO7H4dnb zBtULuMsVd4kQ@&PlB}8SyZJ{`6Gbu6TO!ClUBV{0RRSBf>1GLkTT*$UT>_~}!pxoi zrpL1!M>74_Bu6#iHI&_?#kf~RW}=6Jf6m<^-%0Bd}8RwT+YeeeL27b1}!i& z<9VR>0yLDo3bzhO52BsH$3SKgoVE!xtFR=~s}k*|BK1J*mmgMY?1jOiXbuwAsAhu_ zrL|!#5{G27HXl=`V%oa3Y@opoctn(%dq=)j2SP`4X5>u-QKsn-gIZRA`z<2{1jtRl zNJHJNHf0q4I3<#6aWEf$K^;qu$eF|N+6k2)-2GxUcU1e@Ex!aD+&rVtc zE`Hvf5=w`*qId4p4g=kqj+^@4lY~g2INw6>hpbt-SmPKglpg2ysM+t9Dp<@lZxd=p z-`%hBeTjuN?%nuSi6rh@-<>ouJ5M2hO)rxr_l9Z@7#Hp^^-lIpq*5VT64yf)V6OdZ z-&mq&tL%HClMqizm4|J8S{lK7R~FXuT{TNkO+sd7be+d{w_q71yq z=xcwNqXAe~**QzYGDugr0v5P)R!7J5=^Edn^aEsBk0rkzh5d34jD$!UMj!NoXF*PT zero%2SZBn84@$vHj^t`0A);&u;Iq>q^=;?LVmlK8moXr>e2?$C3t2%6ks~r?Ty%S( zjo|&~MzKa7Y!1To+V8lqq<%kivZk5T5d%x4BrUTi=X?qKZF4#wcy$-@8#lQuF?fgH z5JtjQkcJdXD0h}2R#9e+e;Jjr7T&b} z@z{>y_|rqyd;3f+!NTM7yp_;3>I@Iz%@^Yu?}ecpO=ZYosB#XFW~EP%+YDC~0Qr_H zXR@|C&hQiZe~D%eN88n>I=XLxKr*`);qRFmIqwu&XAM5D5%ss4T5;a4nw@0<#=Ccp zE8sOfzaWG(o=En2lQ8dE<`M9nRxRu@)E0_J<~BX@5)$f>GhJ|N+9KO*fHmvT`o^;! zYBfoDWjfrl(60Ya) zIlZu74C`>Q3^@0Lt__Tn)X3x5jE0xB@OfoJ*BgNll3Y=UL$CrP0vK*MV&tlW&VaFd zz`?+9=W<0|*`0xBsZdYUB`=mxR9Sbk7mDxjgwRet_P)x)XK?GvP`^* zQ*nK=C~3G^PK=LKq{TFiUkIVAL}YDoed5l>Pyb~ZsGQ#y7rnz8S*_dkqSfS(_E2NY zj~W_ZmN^1$&jKHl!9jk0eI(UxtO>0qies!#{DWLY+dO{dmojCPM}#XlSGaI1&}JM# zIyM6F`S;bpY+&>-l9ilj_3IKICZ0+bG6pXbB+)@)1uIu@d#}foE#;UCJ51>27m>kA zTEnwK!zjA@igA_v)1R+$1ZM^Hj9(oZl_fgu_e32LK|5a&PL+&4o#A^q1r6tkXgX5^ zIZ$*UiGC1-z0C!*c7U6PRiCJf43GZvXa*W2Y&6~$nbl8xXzI-A{Vw-rtUxIRWVwFE zj(~8PRwnxIQueXdfN@RKY_6ivll+Y8fmz2~6c!ssKSUCTUxoA|xjS9_jyIj#A8)^< zuTBtW*k9U-DDAgsK?m36q{l;Rtj?ApRzDW%e@F_?>GI@63VYD~Jo#N|8G0KK%s;^O z;a#4x#^nx>p`)rU;B_SQ*=z8~aP!w`mWb|c8jqrW=%9HBoN(Pfn*PQ1zaq!LCxD^p zxVq>yRz{AA6Hu@Mr&aOg9$R-V0sHoxz-)hWYK8x*D6Cnz*mb!Rh!ay1@RW+telYBYW~gQd)n${pfHP$Fu#3>*9NgTUGaH0KbQuM3u1Hpf4>?GkpOKC0olf|WdUJg$3k!NS9 zQf66HDl9`4?S>A%$$$K{9GX$m#y>MyF@m|W_iMw8)(t_qk4Xso__h40MC#kuO?4v8_iT}iw%)=^Je_7X}p(KymdMoLa|4~j8ih`*ddCI4$swPM+-V|2SgKl=ELn5i_?WN@^)w#eZx zv&!KoT->6j#6fxKtzm`eBwB8TkL|vygK?o8t7MV+trmm-nLn7EJ!eN2f_zSA!N$XS z5BG_nn*K)Uz@kd65}dWCI{_q>#&;sS#^|#@U6C^nD1nFMb#PJ<1W3Iv0cXTLiP?Qy zOqH6jYR4DrK$%;H=WGg|Vt;oiX>YX1E{fJNkj)pOj{l#0S)tTy)I|Y1dx}|tnZ>(w zIvnXen!{!NfFf=36~j%R0T6*>(#G5tvVHXKE?B3i|~Ok2X@U zykO1L+Ly8P1_!?lzY!Z}l=;Z!jAM)iIqS`z{wIe0^};(VrRo0pJL^kAdf98=?48fmY#c-u&;P|}glumj|RAa*O% zWX$TvM!dLVE=JEIP@-dxz*}JDV3$}?=O}MqDX!(Xwm~5OxE-8tZH8*%>2?}7hn>B; zEHf1W_yy&V18X;wIgbL}yE#GDE18~99nS;cxkiCMfFhF2cyQtI0G;ENu@GE6IIZv5 zVc7A8Xh^@{xL=*Tn8uNC1q|}PMDCuT5LK$wXpol%GV%Bo&gh=KSnMIyr@N0vK4R^F zX*%cU1bra45CRt>*OKQp^Kj!YrqmH0QLpw9Fu@QM)7d{1wKbvOeJ)WRhSpDCx{)eG zI?_-+!y{giKt-J{xMvl)c599uWxNWic=c%?vtPs1e_1WEP(tHO}-r!;=CL^E4xNZ6vBF zkqJ2mKk@>@;pN*hFB3v$Xi@Ajzl6Am*!r1>`tyRjcj^HS4iGK%D zCCQT{eO`L(zo3$q32i0}loz;a313C}IJL7rtTMcZYXUO!?u5AvGiJoCyNY?@UD+A1 zUvGi`Oc4IHY%U7Jwmv^y(%t#BD(BBx#C5*ZvG?(=xWA%cd-Nl6wXK2;%(CmwwI|`O z+kqfkDbx8OGR`hak%~}~C~upJFocSw(ozgFiAjjYTx|X{rj`bA^Vj*w=7&L`A!uJE ziB2mu=1B|dM3e9DO1un>g;KGZJETzY>-Y{$P+N)vaTT^j{bO;NrpbZd2QCjuEoabtsmddNNx_^4MF}Z8F7k$d;h1 z75Gn>g6Q#b;sdg(%Tkt~z4(;JM6gONU-q>@z}>+ZP#Sg|vHSqpF0u@vC!dv8JCyjt z`kL4!EZE3_eG;sEgC0@t_9^Q4%+`rB9}C5{NA?@rDjTX@-}l&S%<@n68k&=CJP@F% z?^yh^?v8#VUKRpG6D-1=>_?vy#y6lD;|UZ2k(m6PB_)$X^FaKC*)dur|U9Z9G~=a8*xT)2eCBK zZHe#1JgZUoM*2~W5KZqP$nl+}4eawvd9GuhyP+lo19MevXhVJHtqG*Ifn&{IhPYX5 z6r`9DuatiNlulCPnYM?CO8+q*k2^AjZtco$NLrw;R)wyj0}4U zXlg}*Fl4=+hcck3`vCDBaDsOeyO|erQBALJ{RNxPj5}GiZ^p|wz|1{>6;&>oCw`9c zd;J^k&JcHxG$pE@Dw{xfGAW`aaP+e=thn_OCjnR+hQypvEXzdfu^}v~ExMST_s1rg z#rTVbZok#Iz7>A-i_`tQzKoGh5}HP8oA1BVx6l0JLmE|>LN%4OXP+Lm<=;>?;`67w zd#U*qFlqy1!tmn?H0#hH=6ZQX_eP*`7pKnuu!l5?fGJrIz(fo0NHqcHIt z4Jb}lMGCiyD%2FrB2OPjrn3l>x?#?l63IXU#V) zFQx^GrNJE}IvF=~Cps8(DORa&h|lk8MMh5!npLM-`z52PSJPB4{` zw0EfJqGO9NSkGnVaJQm$S#x5iQfRVE#ctMlrC0a+D60)EoVJGxIBblx_wt=Q(d@JJ(@xb-L_U^ zZ>bMC^XiqLkdG^dC5YY4o`RD-Uyiz=sjL?<=>L+5R@CyUX2kLnFvxe2|Et~Q4hV^5H@$z{5#cj6{Jb(*17+q9%@uQMZ|b-(V?FnwpGky`0=``ZN%hP5W&&Llk5Tu#Qa zP+*4}02j@8u9gvH?$r-I9*fd5Z&lOv4dksf%S>;RrDz!A9uwl^QL@hIQb~Jx#ipcYXL?uzg259)?naM zwzdG!6`sSE>eaoOY4E72SSFD#QwYSh#%AZb=<)#s#6)vEpWa=Q4n6JD5K{t`Zhz5ZVq%OWj z0%v}8IMIcIapaOY;=YZQ6gTV>cDMHppxGdd|L(UTG90tvH2jXZe2cxP=Gqs`kyO~5 z@t5(mc4*Y;$JEC1?tD#^vjN6uNT7dd*ut{vDf^RXmXO_wk?_AzU=F;*Q)NkXmkJIi>R7qi+BK`@kD0U90AI8EbJofee6`% zxu8bbqKUr(R|3Eyafwg23XSA|c_pm}~qL|s($ zAHChhbmqjScMB6u7OaFhNpD6kT344EK!LKRk)(%d>idHc8AQHE8SV)fS4-lQW`1Lh zqEnctGiPS^5$9GPuE1}Lrzj&o<*E-Q0ZDH3^GBOk%WV4}aUB(HdDUP^^$XK*s5uUQ z=Qxs|ZvG)J#jX-}Rc5e+-YAuZS>I7GX#gkCDDeG=1!8^)8agknH|K}?=w-j&%;uQ} z?Sr#|he}PjFm(er>#~P}6${Zc%YlphUF(92@+`MzW3e0-jbz zvn6i%BnawSXYj9p8szc23I*P};>g3h- ziT0GHN=1Z|hOM!8jEX$trFl@KPI8JdGP9>Iw3!o&@;;ed_0+0sVFiMZvjSQ*RRx1B z+SOs2R3AV;GwD}E7GOzd2CwhW8`-v&rYRjc5qKAmTK1IBJjElv6$LoqSGVphA}f-m zdXKwR^R+t8Z!d=D^OXDeo_DX!VIG9fI!Z5s>3j&dM=<%=n@KA4kEpL>`-m^PZ5+7< zB&+y^l`~_{@W>9UQE4*rmh7m4oHYw5bJ+5T>21ygo|>-SFz zOG0bzKe*8}W&Jed+%75e*+SOa1#@e1iR}_aQHa%6FtT5>8HP*wTSE#m;kOZcou1uw zBr@S_kE0an4egJSZ+U)wuj{C;>u~HZH3er)T#Jnbw^!PAdU40i>r#h=e@wZ@t-Hm1 zqnaXgfh`cfNWB$HyB4#f#T2QcxYV1g?9Y-TcT=~F+h3GQD;qlqywizGWfH|A**DqJ zgt}w(FWp8Y772S#dZ}OQ23q}q=3kR zK5`E;7&Na%3YmBsOEz$ubWo_?nqx4y9V1~dY}*>o=thW+w(&o^xABUL<{Z1l_$fMC zj#;YLW5ceyDS!3A5U$KQksEgX7e_Aa{<-&v=psLVc#ji~96L*Hh}c(4QSPW|U8>m& zLHdn6i~w0|%cZ#5&D*&tlcuk2SC*m(5=hZ){8*Hz$pns#kZzwQq0*At%4%C1Asm=|iO8srB$k0KY zO42k&Jj+^e`H3wdHwc%!R=5nYXiv3P_C_%XVKQ2I%MD$BaNW8NmC_}i=njnXp#wt} z3?3p>IA%`G8`{cQDD2k9dIPCyyY8L*a{?)vqgpU~@9j0ykc!ZH!mEM3jt}Z8Wm49^ zxpwNfi&Xdrxl*6!v*+|WgSmhxjs=*F-pqlfz9goQ#ObDzhfYe$ikQBs#WNfpfZU55 z)K}f(;=dxw;qqP`_0}nEJEv(R`{Re($*m^)`!CM?3yIqDCmyhn&Kr}wm}VBeGsWx| zjm;D@nH-SiiylUy6+a%UEGc=rhX;rDPOy#;ihiccdBDN2=7P%eVwK92ItGEW(C#qiDm=kMH2J6<)Nr+jRIW7L`gaUm#;(j`2HC|3)kF8j5`y z_+1}0>iCsHoZ-P+5q1~u%Bxgb6oCKZkI00)JSoKs&=AgS#?0Mem|OjQXG=dxXZ|l* zc9W6-neiZ0TiXl_+QZ^y-`aCydE80s)m{>*wH7+3z*c%r(^ym8Tjm{T|E8&Fp zLF_bmR`8Whnw%pS%5vU$>4nYMQ z8pna=z0eChNg5gGMleYs)HwXK{jl-{2_kgm2y)I@%j7r$)9muv2@sZ^5V?QNXfWHv zRvtYzrTv1YwofH>#0aB`y|7{YO_xF6!}ub%IA^mpq32Sz%GN7_QZTS>qNrzxWg$uX z=~qB*3j!ThW3et|SZmi3+;W34Yq$uXynJIlRv%4&iuV>(IsLJ9F>%fJSV;}E{36@) z(-``29VE!QCE~0*S>8}=W6M_3hyd!)z1qN2%7kkhSAC7AcsjrE3qoDDt~vs7Rz?X! zK3){X*c?ofMcgxM>ZvHOzm!TEq&Ln2Khs+2ODR2MIbil&rOwhd?O5|6@O;9?oo*OS zPmYGk;R*p|xV4pJ9Qv1%j_t!`6YcKT_DDm&nZT2<*P90cLioCp622tYA9l`*q>wSs zWpdKr+07h}-+UV3Q*H;IpqYoQ6^pZ19T%-CdNnwEdmqE1#Lx%@0Z~t8 zGCJJM*rH`jGWR>}M~zDf_I?Rp2U!ldZG|Pz?|5!W1Gnn}E^&#&7Sv<7GGD}{*b{h8 z-bPwAb&|yVW<~wRK2sgeaaB}65T1H}$n{8W#A6BL&rwqPiyRN~^UHkcz1~&d*=MjS zZ})vzWXl%2Q<-sqc@%9RkQ;QAc$zelolzjG&TZXScUfx0yhKOHw7|1;)x#zg;(eRsnbXuk5>uJ!M&n|A!7F5C zaUPm!gpf8TA3p-s6kbnnTxFhzg&(OPfy(WDw{CiSL=Z4C`CUIaKMMV_Me#(a_M2%C z<1j9_^Ep3SQxHhQyHfFEoa)Y*lL{x7+WZ(7%09JUF{6j_?xWOX(H? zQZ%MJiOps;;Yd;o*R+XT3$c0Y3iO_v704yE%Kam7Dan60|Kqk9;Klm;sHkPlW7rvF z(>`MD6P0c4lcn1U%JlWTpK=M%cRM@?cawrUhsq>5qO7KS^{kkS@U*W@BY?CbmmVHo zyo`+7YWv|pV8d~L2=Yay_`hY;cvroyb=P+=3_9P8`_gSgiyDqEPpUY@s)NMHk#DHl zxd)zO&es(QcrWAB+4&q;*=hupGiJG>Msr$;2C~z(RI>A`IR>H-Gc$LB0^MQp zHLMbhNvIV*_#9nehbYjixBcK;;&Dj%xY-wa_+n4jG@09N$;9v?C6!=96)NUCVzM2y zdS60;J4*ZJV<6}-Y^B5PM&;k!TJvGYeXuT)tvDH(&J{hx@5Qk{~}Aq z&yc~I-@olGQk);zgOH?NS6wnKUj50h4E>`R$vwD6jmuncc9mIyFVnFiE9Z_YQJ+BMg44AwM=y(1|6S-}koCKPtwK>p z-mljZv%3p*$(y%G&t{7Ln&PJsMYCT;9b&#vnH`sSImFykxx7l2*cVII#4=v6;ioEw zoaA$8G)A|ILvz%qVi%hPE%TDaRTOQuH}F(CclyFpduFq*96&`|G#4YHAcjC#pvmt7 zH2(c7>xcDdP?XWj{Am!`9ISyZbM*mDQsyetI9s=qGLCz?BBG9`Y{SH2mlF2OR+mNh zi&~4MK-E-_g9yLE)Z#5aZzZP9Q`uofFlD@E_A37DbW+slIIresXk;!4)cI$cSiU&j ziT&rE*qfp<{)o6$DdWtiaLhHKh$*U-7lQ5shJfn_ffGsazs0vDU`zjyLQ{2?%&Dv0 zlde-u0+r$e-=O3oHVeVo5x9qG?rENmAl{MTU=;Fju(C`c&a5XZuCaI$TV_&t16!o3 z1CB*2NSE3Eln^n@!wLn-nw^jB`-mOdg|qTc$;1H*KN+xf&w2SXd~xcBNV>PQ2;Vv> z@`lt)@7a+DZNQdOCs>Wu_=!vvWa4hn9|@s)g7>A-RX7vH9s4F zjnDZSZ>{OJkLPQCet&=e97w4P>B_Mk)O35nbL9E-&@CaPLMogCMI&qJxI9A{ePK5e z+j{)|dh+7()poVIUP6bm&V;07RX2>>2dnvLo6A>FR zrixr`9Gx!RE@kq}bv)kzJKu!YXq_bcTR#3^-d}{QFL80{U*Rz$*U#iD14bMy`32Nn z3(HZZc7H}M*IRaXO?9?A4qb9{aoMETs*o++X{?{kjll79M%Y-51(3W#78?6+E-!S= zA6{HuCX3GH)SiFkxEuvyd|kJMz1SDm);{%PGEzwg@|)_-Q7%y86&PFJqzI)@FYjek z0NaZM2^O6dLdY0nYhqiR^8iJ?@fgr3xekx`JL`h zGkZ`>*Lsd78(-nP^G)Y&Wr+I_ejS3#(`%lRw?04j)$?p-ShQoT({R>HKpTFyYGvpl zX8!7m&ZYDEo-v-6c^SY;&e!*wL8!hK>YsiOv; z5NvtcuX}3*=m87dx3$_eAJVF`pvRkkUJg1FFR4<-BtkFyaci=D*y+BEkmNDgZ8Bu9 zL%?+6_Uy{fs4P@FdKDt?GeCt%blH2|m$@^K^M$ZdUuk z>f8nvmnIf({>f`Ce#Ir1bIC@Ko-LcR{HscDcYHWYW4Dw!`p?VSB92~aY;u7}SF(im z=Z?9kg3)?jmGXP(t7o@lZ2ctP-S)2W5}NOu2Y(dOK~JvBzt>{0UQm@B)M`D4E+iQw0WY~le z(F0%wEmwcXYSQ+Rl-=*NL)%(sJnf8xy5ANX6blQe20yV;vVAp4DxJU}C?--YL{u{d z_vP*({QGONd2Mo9I1{bXeD@wC!7cQ2ESvd2Uf9Ea4XCqo)wL3^A!LGvAA8~Y1Gmse zz8=~A9X=r^VK{HogJVbZ>_h*hxb88drGs7$5b3_#Ual9x=<<{2IY<;l$gcP#vT0@A zCNqSOi9&OMk|3K9*5~f6_S;UyyV63Nr$A7)F|ONd+>lqJ3FUJhI6QLj0`9Ha$SFO; zuE_^i8f{{~$65qlF=&pQ-p`K0YmW&fTsh&`_wet_EKbckQ>wRN9->QWX$@RlK?-bX zYu57~hd;k}28$qgU#Wu8!V#?DXO(q39KBiA!=Pl}J^fA@FPkF1D| z5aUuZ+cBef=-*bVa#+V{nK9Bw#r9L}N(>rwnDK%Oo^Fih59$TR$U@v?D${EOBNGtD z?{cR>z}zoL;q447bQ}}nvfllrZ@k80^pJh;tYy6oX^9SJX=!*>KUZooBu~v_U`5(Y z>~pUB@kWbI-X|Y*qGR0q9Tki@SJ{n;Pgtr)-cdOvpH263JV!87CacT{-=}u(ktZTP zh{QB=j9i-gE|u_l-oIdFW>CeN(wCTo3rUZPzG~Z{%u5IaXd&Pxo!&?$a#JF zIdcpN;`LH}9~=;L&>1*U9=y_Vz5cgPjYeRtVf({48pwHnB{aVBl^>E*pSlk(wOZ)8 z7Z%nW`yS^&TkGe*Zv#8JSiJr_tom88KTLeF9f|y(6Ur@qzvuL!`aCISuR@>R$N;Ws zi%X}COUxhXPw&vj5$mL&Fm)NM zrMvUsVIGH5_f?d$SER14DgD6{Bo*OVtG|*HfBk2X=0NieS5>_kJ3nw*COw!qh=q85 zvVEFci7~>xZnJ6jSH6nf+QKWU))}->EuEtZ=jSkdOP8v+{7F2>j+uF^CiS0`ZPJ?S z8&!KtYJp%;Qg<~)w$_OUme+2XQ@HV}7o5K9l?F};baV^(U1F22lny_hC%CR%<-KsH z+aR9_bRpr@lV-mANiGoo?J3_uAc9LlAxWz91AB`%$ZNF5AW@Po^ZS zq$G_%4K%u*An2^RgRYVhsCj1?#5_bp7H(r-Ct6J~cBr|~s|g7rJP{4em@atrN`sba zN`oX(DI|_R6IGk_mCH2-x?D;Cn2SGvzzF*TNhHt4Erm;NZv4PnQJ#-;ct1W@24lap zX!;@dxBiOI_C=42PRsk&v&P9;7))tXHMC~9TPDk|t^x7xLP{y$zQ5&e@3Y|d=sOVR zU@kDIlAk(`$k^ZBZzggEd^$s;ZK2(Y&r*9;zeHY!J}E^KF5N|j8HN=wk7IFtrC32U z88|0Mn%z>EJJz{!4_Y6Q=oIokMc_RdGI<&-G7it|)Y21=&QyBB`HlF2Tx!u(wwYY^ z@6c7Of>X#yBq&^w%%@(INtay*a{ANySZC0FaX18Rc-X<+3|^8~3A)~p7|cfh2{A(c z>F{gxir-oVrN-+IoK}Sf?&HM^*`9O}k~xh|RsWz#=$gU#wt2e%=6@Ir+4o&glU>hG zaOYJMD_dBmPaotKdO`&BwGuvrCQmCasp1!mr4!p9b;eS-(U@?uNQj6elj2eD^P}+(504hei^MjCM|V8n1mcnV|+UW#dpw0!QlxQU(XEogUoKCe{l5O z;u#-UB&9zXx~>Ic3m!5yGH8w zu~aO6_DQk*$&l6PF11N<^U}MFG3xRyB5jQgtDEJo^UO}5IiF`3;uvbBr zaTJQ0k2uYoLWpDz~-T^oPQ#zs@ef;`2tQ^~Y7cT$X zERXGLa60D&_eSXhy$H{zl0Pzy4LML`h0!^`jR-vVGR8*FRck23j>)rxnir-n5;Nh> zDG8`^V)|;i-alSk*mStD8p%QQ69;jT_Z)(MS;&%BIdJAnPGc12WtSFZFjmD#ZQ6YK z)%ZXljYsME?9t&cSo4m8d~CaYEudDWpF-qLFM9(4bj*tgLO2wjJ$xF=gc>g`_yc7UyeACG@igH9p^OEXh_3X1BZIi?|8da!plPLHD5bpY zdzrfVQ}zp2!Ap)a!*@dIvyi2$-32(eiNq>G#XZSQlkUIQu`%pTgzv*`%q&ClcRD{+ zr=Y0XG)2OFSWK^g4 zNaj?NFm#@-rZy}otpt=p#l^w^5m`x^ZzL*Qgz)%}dC z{PA?q0y8PPwjr_vm1@i zgmQ#Ovo%X(19y79LKcB>V@1gzDT_?4QC7fXIn?P)hlUvBNYVCXL+UCB0?3MnWhkLqz zi}b|9@VuUKr|<4oy3ZmoA{JY9>w7wH=$D%rt!`JMbZ+|E4u-K=*(hf(IvUAMVlo0q zp`!9H#pJuwBM6Cz5M*{25O}g?FxkDzA!U;dQ(wJFu_Jm?#UaifIpu$xQ^g~J)Tt!UooLoe}F4-+A2 zl}lg$y9&nyI+4!%jg0+VA9}t;$+S(>;qU@C5(7elL!j%v?igRwjP>&sCXYD8#8DRD zPLgF_Iz9w?#pu)Dws8%_q$d!^(`<#)^aMLx)05mPgv@cdkPt@N@cq<=!ZRGo2 zz+vNjzKrson{3~I2{$*YXS9akChM3`vpEhXjr#+0!Ciwr{@ z=d_+ibB$S&eT5B0+6bYM1}5gUYSN^OR)ve(u&#(q5DrquPeq_c4qR4>kvRWI>)sRC z>l>vUpNe>0^jP4A*}fsvWP*xSnMF_m9*7Uk0(|`Gt5%|Fe#f zIGB+p)?<#s=`y}QVLQI5a)Ta!CJe`@NeXIG@n$G!&cS==?GMLh9%;dBqL6R&l;z1H z^DVE>fdMiNq>1CA>=(n|O39@qVX?;$z3kPri3gZi}n>ME#yjP@ulm4%u z@;A%>YXN+>f5&oU&T2O6lWWC&dMhu4fuBkWHZ5c4YlPqzH?+<}+@_gLPVFs_bC2vW zaXasyMnP6j{->6m2Ej>Md=3&@AJRY>d=17rEMCA}_^7{&9`xUN@q8cGiEu71Ap}{t zi|l;PY9^fj#NpZ&%J&qN5QunvLF~aQm#8AFQ1eDgn5jLX*^G1padOvc7L>dCyK6Ot zl)RiFe&>P5&9IK%(qWF8T%HU5*8~Q*L|6X<9WtAN)EI5^&cG5#huj$V+8oih`D(`t zo_GAd(KM4Al%g5rJU&8z0>{ER?RDmAzj&z>5Qgo2Fn(dY545WG)-J5vjwdmF0~cNe zN}0X)z1_r&Qn*v7gfA;UoQnnNCs_njwb93grSk-swL5kL@FAa46)9}?^#&vu>!&XM zs@Y1Wwv{J=}ih-l93cy!(;9j3*XoBUmcY~kq)3YGa_ulMYo&VBN4u2tKi zEYrI%W^ARE6yY2S!2aR?!T#mwX%xDXb%FKL2P!x4B}MfI7h?3+l8s{Itg+HtxwK_C zS0fndF5Rlj9)(5zJHZF!e;O1=+thGOY_?6%{+;@5%R{-i?n+BdB0Fz+so!qGO})fy z-lgN8wC(<*0<98WjrHMNle;53R$Z1eq+J=Anp{<$8C4lq$*tu3 zZJxc*wD1PeAC{mK)hWk=JfD0Sc;2_|pthD<8_tcMLWIq12YN+=Cg;zPc;#01Cq%}H zL@MH4Zu=9QUC7$&sfDIE@HOc=DCP{spN8gG8=)x$e@Qoq=*-}OTgU7vi<&mWuZ}O5 zz=&bGB;X#SzTvX{0gj7?#dG#50Rf}kek{{?f9bmK2-Itn?dz+1eo18ha6{}*3`zdV zjYogF^4ch7+9n%*jzCxj)*znka#SV^E#iYFw%t+VB1o4slG3n%(%m49fWXqVN=tW2*DfiI)JiEG zlDl*)Af=>Bw;;av`+NC^=h?k`&YU?jb7np>XYSc{$nnMr=uSL@H8?B{S4<*0A>?JC zi}LWA?7#I|#QnE>6Zmqg`})6aWsI<6B41n~AeIJ&it8jf|3ja8bmXkVLiNd+D%4Z2X5sq|+TK0$K;6#59GwUfkV*-Ulk zqLa4w>+WNiUFuxc(Wl_*#7K-#{c0y=pS_y-!1R;0|CVDNU309$xdwdEbP2PD0mQ4-GJm5#MYfmFIzcZ!k6h zyMyWP^M~yl{Q`n+>GQd}rZkpQfR8u^`kproK$TX2_?gwsu?<>ysl^PXv25s)FHBeQ zptJJuzEg<&rhYs|vn=zwSgV39P2Jc`EE~8TV5b)CG3{sEJ5}AA}NYR9O7m947fK4FqKeVi1fZ zI&VWEmIwCN8r1MGT+l2mmf_FAtD7_q&I*$)k<+@YbfaiowpcvyjMI+Vibu0cP_qm7 z3WppaGzjDAHkqmQ`xlep>8U3#Fl-hx-y3Ep3byEG5#|2^qJh(mGm|6h+qr_+KrDZc zwTmCMt@9+ScpDYj{GrK^9K@4Ys;)~4jK7P5)+hD{kxeE2-ht^E_{P2q5R3~-KmQV? zwkTKr^7x?UD@+YZ4*2e~)wdt3v5i+mzBn`&a+X)B5|`7({y@B{W_~qfO!H}J?DR!} zb)el;IJM`k<(pI8uIwbQjMcEGA|b(}>z}RG?t^YuJNNNYeC2i%Gk(Wtuie7ElP#_% zYyLSL4(dxV20|7F^_}FtRO$Y^Or&7*bNRPBtWi$x_mDP7TAfCy>hP;;j0xsOvTQ z$W_GFj@>PBXw~+WRcy|BVmFb7-L2_lX5Z$G9@oVnPaspdgiMNB=-Ga1GSl>Jf-5H$0Bq;n=sJHcbCOP|NS%5IMABH_FRbR? zy^`T{8QX(bB*_u=mgsb0XchFF4K^w2N*`)?Z-5yJK!tvQXD5A`$082K>isjHiGB5v zS+7)nTjM4E{Ar+E^Y>$wieR0f(Wwudv{PRy52nd)kb{kxX{WhqIYwA2F?lv*x0o?` z@)5yHKz6t|ABS)enaNT~56bx&r ztt@(Zyx@Fp60-lN`dlR$E$YiX$kfwRRImnq65i+tU5i=}rMz00?} zLoZjfa{c$RLh-@`K1?+aA5-)0V%(f^46ENROotXeOmIz|nN}}<V5e<%;IO%}LFv6L=FXXD!%fL-p==kbI$d+$&?wf>fjV9wjkt%<*V`G$)rY@3NQ3 zM%*HUd{Z}seFVVR69whaq1Ql$LPkcbIT{lZ8u37BiiA7{A%%g{YCp^avNR z>_EOGueJExH>NNPp5H(*D%*f2*u@?~o!eb%@bR8reANJmV7f(&Jp3t0#uB@w1Lp9X zi0F#yfu8=Y<-;F{OM8Mpl|ybPUi`(l*Bo%g*pa(BZ*^bsTnS*OX$7L0{vfJLS~(1U z`hTn>nXhtmx)>O@f7( zM8-DFGl^>LU~s~-SNos}KizRd!t0eL`mx)#*^a9GzD+k8mA&O!s$S}c`y%FKrhn6W zr?v(a#RN`|Qi`jwTn0l~`;Eu5L)}L`BW!`m=}uJ)fBfQzbnM38_+h+q@RhmhcSy0V z7M!UkXdC+d^BsNLQL5nSLB14yn=j2fF9-M36v2PKK$$+yR=T#%<9EIbd#fy@NTn@h z(Mcr9JWt@bvP;;siLfY zMSj1RYb(o?g?SHo3834DsiKzRCyW@9QA0m_gl`fh+@SBg|7F|Sy%|++5}DjDqGh0j}r{E z*3w!zXXOOPJRlu*%mGQ~x1Ea&(H+K>&-+wT_k!PD+-ww)^Rgvp4kWFXDD!z*e69T< zlBhGFieZg`!C)at-Afeef@Smn<$RC4W;)1%Z&n$i?zi)gy1ej#xKZ%&`o6f(EuZ7n zmA$df96UWs%d4EZ%a;gVNXXe*H<)2hiS(9`f&@E4zSJB~aA$}uXBe++MEI#D8RA=3 zI$~z`vpD=Ip1jt%51C3LFL692^QKdY)qDHjnQY#@dcIS#_8)-q01^m2*YmXe@EdUa zhj4qMUooGy_lQA+evO?jt~WPD=le<2xwe9EQ#91hHpXD@P3k_hf&u3+=z2wyosGj+ zh3LcMf&*@XstR(ZNrUZiG-n0)X`5;>_lCu}1 zJYY=S1ARYNMQ$>$#Nm=}T928pPi?*Z5U ztk+|wf9RIIi2vwnE_q1L6U0rE(D~Xvxl|HsA;^_7LL+LwlrsM$cuf{mU5Y zxv5$ih2lV93}Kq{xA|ola8q98j3Y`|9P@$##GC#b57v29?s!NmQdU?hj+y->h9{D;UGff(k%s%GwRKTCpp~d5PgaSbQD- z{gx!|Fd*KW-lho~FZ`EMMO*Jyg{RkcevLQTZAo1GGExjeLm7%)qpOFOih~O zXTvj<2b%P2Odu9GyDztRIA7I`4;4pR;o6+^dTjA5&SrZahy?fcL6{%oJ;iKqoaH@! z1R$9Nv@($Kl_g;h@QD48pH7khP>NaD#5^Yv!n|#hCao^7{J5ue~*BMnzsh8Ri$n5O)ZE2kX!o7Y_a>O zx7Pzxka_ZIuK;81*n2F6{~LgmsmU}er3||2F3T!8emU7-SjuC1^EScYwcfp0nZ%}g zx?76PrV-nGMPg%dHnFCrfxv( zlJ1T(kS?}8V;@jpFh~s;_jd1@As}+$cMI6ByiN|ig?eH+g}fs0@}HE$*n5Nl1jaH; z;C>+K{NO%sdFpc5>p>$-d@P~s8T`+yZI>ErDHtUNYDGWton9A%v1H0vo=;jbnK{e& zct0mbko=9eHz@0@Sw4nJ8F)s<$QZF>{<%20R0QRf5<3tOdK5xpVV*a`K_>SH)7rJn z|CUMq5%DX~Z0%R|{*6?Lwj+xG2RW(Drov$si8b1Xoik+Adxq*yzZLk5~1 z#)H2SXj9qs;oY7{c|?`xmTqyvm^`9^2;htHA@#r|taNPeLt?zXKhQsgJ?#nnQlSmP zXu$~6t}Sw!t>6!%Z8&sUslcsV=v=)mg_u`(e)#Y*tnH2Gk!p8SbSAYpqbWR?0t0%2 z6Q@JW;zRkp)^+E8mdxXkM?T1fJ%%`uUA(v+%itCGg)w!1%$pKI5(pcfZ_Jj1Vh}%- zlb4f+hp=Z*v+e7ovm(YJLlLO$F8Q0k;^vZH$IlVFM#M`?EJ&v1tBnMk1b+nP~Zqlr#tPH_0AMqK`y(pU2&Q|D>MBzTAQ z+U^iVvg|)F1lhMR%siFSCQ)j`HIt^`Lu|3gYVg2G+nbNgEPFXcMHCMYaSb6si#%mt z<2^|qnHRmF{60UP{cjg53!^@VVfEUTfe${V-Bv)XC)bqF&vy zC`&dEZ4)GXL+ns)miF6F4ye=sAlXMTvg6CMe%%iqP}qOf1G=7*6mJ$u(N~xl#X+el zrAGKH-^X8#`*sWIFoalgEMDy`-R)f=Vs!(0jtDW5kD0CS(4$>Hn`)xxA7+thz1B?ynh>8sEk&Tp=xCl9&*fXam_CJ-ut+pi zijQHo<~>umWvJ2xTiJWp?r}DL^KkD8p82%DD9qK;9Z6!(4CCFH!yU0$xg2q~(4YDn zPEeQW{t=9+nJ3qI13frlIyZvEw_3x81!P6dZ^!EyotW!yO-^iwbO zz^*Jag0A#$<~O{M@^~gkXm4f1@!B7SMR3SS7S@5ZP5=BB`d;Vwp6ONPLfT^2<+_M^ zRQZ-Fn9w@a^xKj$bDb(|$b3>sGYZD0mCLJ>Xt_X`bNDg0q@#q-OjM$bR;t#~{Y91t zhj{@WWNZZ<7xn=otHWgJt;++X( z>p%@I*)eZ;?T7ca^KPW|rIs>uns!QZ#)PFgDw{FQ*c}FNb?*jl-}=L8eaU`IGd%y$ zGl!W zqF#2Aci$@atf7u+O~l1M-j($`#?g zN8#Lk&vl*gE#}utC&ul!G&!HM+Y*2T!aM(IiRH`ic2Vt*2#`^gGo2xHQ{w)~0!(gyao5L| z?@YNxSz!53c%T^$e?A(Mp>M9H`(W`$sPD(IWv1UVlOvp?Nr6uHvN~O<7oSWNQ*3N$ zIlu#h7}ME78isqeR`9~C?6AJwQ3nsvVZJXE0{oP3N2hB_+&rbJ$NpqeKu&*?g1{-5 z9sVPl!5vR=JE#)gjJA7dZ`J<#j`U%yba!ateHGDq3mQMPSc>Bx3EA|hZQf&wV z%ARed2EMWv(_U8eN(XT%5c^_Kp4--oMvWIr9BMFQns#fNTAlhGpG5J??#(Lc|(?ZAj9c{s7EKQ$WMJ+O1iMZc!;f(~WbmbKq6 zN6V=kE4;lNxft}@%q+mft494g?y2h7#22dfctNP{tL@Sd0gk+G;r+h(gqtxifqvf_ zjynN+98Xf(Rwn3P`h7cmNN*w60v}rDNQpoSZ7_DdbXMow5t{zwjM-=2_tT{#4R}Re z<5xl=!4+;A;X*%sn?&!@%96QIgScs8iE3Ic;#vu6aS-0t$DlNunaXWpiOg#4p-s$N zHbkAGTE6dIEseq?L0XhXQUxqMek#R2edWPTHE^Gy+>vq^8KVhN#+ZGtpqTNzg$s|Z zBiDSAt^zJX>Dt4&0H5JAc7p4gdrx#eQwp{n)q9PQe;eA$c87tpTJA^#ylLCeY7;#{ z6DyHf9=6%Ya-Q#7k}AjKXe=kIc42e=B=}n?ke{$N&{pvYXmsJ`?dmIC-oZYT(|B_^ z+1@)=2nGkfs(0FK9QhL+|Bl1L0i4Vc!49Bd@rWmMCB#2zVw!EadHMM_;!H_DUhDrU zge4{q&_Bn=PuT+7*$2HAo(nK+$d0>kB`(LUk`L`9ln_a=R<+u?+Y-*q%D=UAEua`# znL0tc(F_Zzu~Rls>-*d4&1+aS3fT1kBKXG2|w? zP9lc`^Sf4mNw0PVoo7Zj7&~D>L>7-k1Uu?ml$ut#aorK^3!Y}$)(9G5(D=JQyRVC< ziHo(L)gI_45xk&Hr=zaTUx+rpD7F<&t7|Vs;nPGJCqQq{HGXN&*Ilf-jMm9|7V1vMK#^4AVQ$HF1+?Ta8Grx)wB75Wkicp>&=Jm1M zk1oltDO^~n;&98;2!Arlh`WE}R*;U%phtSe&UVH5zIsl$dCWh-_pZ z$TeVRVSpF9CoL942vx$bW|o&k3~W9EF8PZ#Qwc0(S~|=x$D!L49HGy5kTD&CeeV~G zXjRL)!qapQ^XN7FbOIOPDjGG0kH4y$xr>9_%B^#je1yKR)&A z-)Co(ei3;;gP;Y;#Q~D~w6*z-}==@hOAw_06$0 zfEB1f1m3LSLW>k_sl>%2e7{?<|2KwoUu&X-o9~*~B`9;<2w`8`=Hnpdp?+(}p z_EKCP5MJcfu1?&)wZQ>*QoTUGMZGv*amsj0ByQ3-MEh1$Syq)h)^ktGfmJ>2g5NM8 zEjV9rJ>q|!@>NOI)YyT|>cr85#1ESGpEFlw=ZiZ_BBu#uq2n+j70u}=J)oCpDvYN< zG-SpbmD(mXqxrwMaBEiN(vO|$o!JVs(*nhv&;B0f{4>tXhjl~`84#!ga#X> zp~C>prvITz%DQL8L+ff7^Nxy4fuYC|Z7!CH+NC0*uBK&3_6`tm=@#X{lg+A(8su=J zAxB%cTHALi6j?8djE0HJv9apEb%`|L`EBKv*_qOQZP%RDWGbnFI6+$~O~zwqFN>qi zCY^1~%+t019DFpwvQKLh;=K0%_{E-P3@DZdU@*Id? z*Zg*p-?HU*Pifj=FjseDIWS@59zK?Vw~UiNmO66tP2>q2QRs z)U4vEu2lGz;5+?pk%>9zojZL%{#mAZUipp(#qT^1vsZ}~{D-tJlHM-q4?A(Myag|= z5>tkpL1TpE>`II7%%geN1uM2nF>2IBOWmaDHPurBZvoXM{I5QYRlskaiUA)@yPV*yC znrFM7+}}DfRZ!rW-aysPjyKx!8!(!s#CR3A^K<<{hKv9y^R5JkB^z7VtaxFlC z{XfN#sVJg?Q-wJwR7yVAGzUnD&dBfOPZL*G(K>3s2W~<0#=u(6(+c3?OL;GB*qe=g zRen!CZ<4P3V1qL;0&7w<`xX#s)ix&hO#HQdti@cCiyhd@4Yl#!AN6_H=f9Zt=8!!E zeRfT+Wvd@bKFvkT>8&<{`&fkC!%E-k#}kc3io=9OhM2WCHqYGYce>$HKZL$E-F|V; zeKSeOzIS3XpIYlTzE3MX+7dRdN0qnaQS|Xk%B$@%p=aI!tsY-#y)yFkanMliJ}n!X zs4gi%sIeJgq+aNq#!m{@uut*)bnsqxHYfh~B&n>;H8}(B(^891X*apW2Et(HmdIcM z6YP4HB<~0(OH5P)I356;>F{}1AE~31oT!%q^;Hb0ymInwPc+|99Zt}P^WyVWS<&B@ z*O>AvFVHZn=I<6%3-DlNsy%=5QP`?b@!=COR>OBjplX=A0A3>T0`k80FIKuFkge<( znxkPz;tKg>={eO}0#(crE%PYP;Sj4y^Pod`73J%Tf@Ym{lHSRKB2(GeZ=ED&yndC_ z&bpLL-rKdt{(KiqzoOz_38zPNbSwq*ckFa185yfGCZZiY19seN-V!`bRaZA?Io6(B zjZ+=3!_+YM-nYiCyOcD9Qk*J31l93ICb9w54Fg&r>VBk9z4~i*Q0y^3&9}m!S~QU{ z9kHCRP889Kiq_0XkD^p({icQQ0^(JCl^J~ux~_|Rg3g~7Ma#fGQV%P+xz)qv<*5FX zk}0P?#^u?bN@`%9=_wwM{)lUPoxqM+`w6;4>mH;}ttadvFo@EFIdlt*U$Efkw%(pL z!;{0DU(CMNFZWUB{^PHb=k_GZJGAvcDM-pBX*y{}U&IFtrhFdK0W}MtqiehBT!4_G z`Iz~bDUK^S4MOc@5?9$grjf*@%cI5bD9Hsi-kspEX-t)n$HpH+SA3FY`=-77M$S6R zWrBdN0*%?rGW|cr0-0E$BTM>RZ#0Fw+7`l#0&P$p8B{2TGFpyuM!buuU3tpgh* z30D-~q-CnI$da(1vswLIMPFHAnEL%Xki<8Jhqe0hT7oFZZ3*#UB-S1p#7_N-HIH5j z=l(T#rm7@zpl;=KyBtsO3kx!=;>>@QE3Oyl5>sztv*$+BDpOD_jmqQT{1N#25BWI7 znj(lO(=W00yCru%7vJ3Idk(#34K1oMl5KI(N578U!W75$5ja2z1thb)nzTvRdghGy zb1O+QRLtWS8zlwc_Dn=HKR-mz5Ylj%K-d76CvZR_qe1jZ z-u{Yx=G0LxTq^lyX*5btpdny>3FbKYI07epaPr@%)A#PhcCDm4E>6EHVCR0~7o2qU z^eG>~wn7)W&A)v1{8JLDPBzpR!VyhT2S(l#b7 z=iwiA?1%wZzin!lQE7LPYFbr(msKwA5If*(!x87f`@QU8#;gAuha4vplh+hfFtMFJ zN!se})tA;^?DF)5_TYA-SiP5`8OS{l>rFL@13|+6RF$Kzc;^r@$}^yqalwGpHkaAL zwt9oJ$UyCP^kH;@g6#)H)`1(1#^T7uy*ur9mQB4KZ&plHD5RY*GDfJuPO5!4KS!}; z-6lTCk#c3x60wY0dzXzb|G0if#y54z+K{oy1U4hBu!^@NlglZ!o$$1S`cHzpLA?!S z=k}ntFET*6e*XeL4?VEv+V?aey!R3eaRfM__jaRZ+?%mkpH%`&Ku=`Van}w;a@fH~!2W&uJYayN-+_mC z8QF(pu&^d&*KV9D*%XLQlmz@ue_x&0MdU3Wad8a{eg`r4RU0UFdW~pI>92w|N#>snt5Gz7H36~)Chcon$onL_rjdLxV&-jH0YDXm-r}$yH8B&bOF}H z{jR9BNh?-Kdnar!l%Ie->-f9H2))ugOPu6$VZs%QugV~bougQ$N4%XMkBB(b>q~~m zaj2`MBu4%%aX*B8PoRTOENT3Q?RfC!j` zBs|!SgoXwukRt1-g(9{|vWC-Yt?%o_O7IwsHBm%&{qwk@o*B8`9UdG;Q8)iO*ul*z zDL%>T)0#Zm+a)?~BudEn*2Z~7D32-SXS1((&m)c)oZrarE=y7o!C5{y7ygnp`8Z>x zu*=ujvE?>5n~i%KDt+ViFx1_vh{mb44-_-$M_;TdyP+M^mUFSr1V=TF;Ra5-_tXw~ z|J#owPabU6?}Y zKJKBVB#7GSbK`ImIYOn^YiaHXy`{#!3m0u!ueLr`-N`)rO3O_yHUNiEtph4naxDFhgxI?lkTt&5A(MI((t;t^YB)FRf&Eg}P z?=>a9J#Pq;b1=?K%HIS6;9xDYB`N+#lKBVz1)+!r>C>>mv>GQJv0X_&K)4^7Rc|RGv1% z*Obo710wOA2Gef%Q>bwv*%MCAdbKjT9TDFIxw(186mwu=bKKORS^+CJRYsG?-z6K@ z&)f#K8pCD$QmVvj^VoOPrC!BX(;64UWI?-+5h|~Yxf#7_Kbj!XZq@4o+(!=er58L| z%ZOK~YT81WyN(3e6O_;)3Wd#=U~pNLz~J)1nun|OVvcwc8C6#P!!4kd9MRZ=Q>QxS z{Veos3}G1a7qQBr%%LZu(T}_pq|@5{fou0@xCL&jbwy{huV!}nitK9SX(VBZV`ex^ zf0aiqMG1d+(>=hEz(K6yIm0st`U2Iuz-`tLRI;Pd6R|R4v?W@{gPIlFo4v$HS(bWn z1@c{F!5yKeWZ?L#Wy~pl{I=6@g?ruOm6YWQ?}+5ImxpA;)rA-KIa!`JUMopK?uST! zPPfI?tqJ3il}vf7zSwGew^;pAb^*=1Toy8#(x-Mm z<|U$+HkXuO1J;CKHA2%%K7{KhC=N4aRc<|z?;&-b!{FDq-$}SQvdKWOokbHPViSzU zY>hG(8C2xDA-yZ)e83nSG z=W8!aZ|9Pp+w5xih%YIcxvazuYSm(9r)B;ytNPEl)$agi2-`^&9ce2=bsawH&JRc!3nc`_FFl>rVUNb%X5KAi})%HH2(;UxDzFH!n=@ItV4YM6duty})jLmD8_)&DaJ3JWB*xp8&m}ex;2YBvD8|K7Nf;@_qNg&&NN2n5(u?B*h094?) zlM-yG{wOC7W?bHtTp?XMay~fT%)LFPa%muP<^ayT? zcw*LAzG5A0s`oc**Rgo4n${5wEqKK5;(-Af&rO4&5G3__=#iq#zf#vn#mj&R^Aab7 zjz0xF{2*@33@7J1;8OmQ98_xPiq?PgrVzG&GDqz1i{wyn{CNMtOLLlgYH1qG7JFkJ zavsNaGPeq7m=xeg_A@2O=Hn7_Z9f@Gtuqc#5s?v#)h9vMNjszt4A0?|v>*5@H^I3a zQYB@?s3RX;dTu*|Gxp;b3s>>Y<41^-9qB*Os;e`t(<3y1K?yquz`2)_`B$+m;sluJi>RmmA7(p&fMJ8Y~x?6 zm5?p?oBcfWFEe{um~W`hfkyW~D}59wujR{RP>)xkY|@=E&#lumk6_!;JSmMxcJz12 zE~8t@bNCwRPA}yI4j^evH{Uul>t`d@MbM7q!L)ap;gEpT>YpSyLj_n;iKlDJIT4v% z1tple2$Y&V7`Qx@W%NHsyq}5iO956xCPdNU8|}%QR+OLkSri=2N8pq-v;_hQFB&|p zq0{s?jjnWjE(2Ogv@sZir==RaYRHsz>otTw(f}^%f#k=w+;ZItMVmfFgmqkg%*x5^ zny$msMYsUrT@sieOCMB;;|)~88$hPaxHDDzm(dpHi*3aDA}K%YpzCCFIKo-* ze}1P@op{Ik#gA+ToOQa%7UU+!I?m|tvLIh*g0|BY_K^pPeBUH-AiI^J{q&BEndfJ; z5DTqx40)w5PeOs%G4UfX~yo^j!O^EEtUJWQ{B5fUrcUB9=2h&&x}!( zj)s}hFk454An*XL@P7Kx;}OVDN$Q%h*E&kyN-3(aMaBLWSM00>AEjL)Cy6U^CC>Ai zFE-VV@jNwZ8b9Rv6xOP}UUU_d4@4So0dgcleFg?}39zvYC#I|=z$xv*;vk#(0vvP_ zgG*m?nW-u6CB@njpj6(Pz0aT3!B)r=v+Oc1a2IhJXW z42HurT>M7nBp^nxt3BQW3IYS=E4F_b!btDjAn5e zF^gCtv=-D90L4o_Aa=}vhSveza#*^+WId%VB8pyc4%(am#>HU)`^JQuzYB*=ONVB_#Fm|%B7HKklhn6`X3Abo6lK=VI>l7(*ln_aD&x&iNTM?jMZ3b+kwV|6!-zD@?mF}+A>TEf z1^gR2Z1C5m+P1YO*84wzbDLZ`Z>3GXt>;Ve;!nE-Yo^JvpVV~t{|fGT?F+`z3h^dg zmSWLfkqeW(D>b#~aQQ*(@8XM1DoroGldmh$;3CYa7=HLU@`_F<_;Z7)ze~MAW)6%t za_Xnk90tV6c;Up?U4}Y=2Bk<)m~SPI?5B-x79oPpBRkv=C_I3AK?Q3b&?8+0X-UnJ z6!?%&@K00T2C1kGjmi#*YlMq<{w7G&66;t+KG4Df6(m0K^2LB;Ya1VEEo_tSvk8Wb z7%29>%^R=o)37$*E~tRHrEdsXGb)r`k*s>4zI9hGnX_4qQl=b2azeD1XhlPEl5FjF zZxo!xdZCl-8VtoBo_vw<*{t%Bz$(m#DH}Jz*~s@w2)P{a*dTptFaB*uR66?U7sGAe z*9Qx>6UD}9r1J>!5G}2wj6A{Prwxp_Vx-e4s|gfuXB~`egtFDlF_tWP6T9l_dpBaT zJz8(04zF}v+(dO$v2038p})k4ssEPa8UCGN>>&zB6VC=8h^uCr@GaOhgsE8k{qo9U z4*lw6<11j77^Y5OM0GW&s(okdiGTi597Zaib??4DYO76)27co;Q7 z5|GuV_dRs`be%2&%r%A}S6vD9$nAiz*V-|5jKqX1UyqyG2^#V>sjXZ*O8g3hWo>X8wz)Mh+4TZ-HipvG|-8#fLE9{`CS z& z?!7^XrxEubz%)*fKc~0p_(?%Hms^c8?`l4!d{$dIW!D6(WLBh)G0y(%A?%p=N1_r= z+wV8yUVUS|oLbB#Xe z`%CQkIjLJ}{L2blqHkLu8)Z8D2*y~K9C=)~$ zF_2aLYqN;V zn=^AWe*FE@gpU@aHcXv$P9AGQH+ZpL6h&8w9Gcwlm6d0eb zkb0S2VEUUE`g6=6qs|-{N;)$UMoYoc?QlqEV>VLH7w}rDvqV3c8wTI>e{{vW5yqQ}M@0@QaWaQCibw{B7*B{*V9D40;M zb3^N6jP1F#>yBYE7>%8Ls>Anm@~5djKBa-^k8Tx z7O`2&<0j~>%yWN(Rt#MP)948rP09TU+LM3P+AQnua;2smj)v|gJVJh@U3*=x1AOxF z*#xpLY`xJ9gXaDRnyX>fxJy#OqcW>h~n19?!zpmvh)UU9LuArjSyC z<^kOzX)c!x#49pKLq14=G4c`MU4{*Jhg6KUsgvT;h)I-J3GUtofd(c|kTsGSppa6p z4{gcP`58?fDr6#^c67F+2^#^`@o zMnEmmZHI)J?GO@kb<-j2Bn_FGfRo7t{5rJSLBlh!!}|qJIxy-6lg_Gvt}r zt79Ags(xT;0;R%GlK-fnwiXMLOh}iew=MgR^~?V~E1)rk1k^M31+Y}fWZ`Bw^*Gbc z3D;ymCWd731-mjDSc}pJ03Ehu z!0?#_M^0d1V$*0rtiVjNz~#JJ+`XY@Rnn7~7}Z<7O!y{nyh!}VMUFGM59=Ats@;G9 ztD2=19HRj>xd)`7Y_Ji5?0$hPP5j{47}e -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +// The set of include files is not much of a surprise any more at this time: +#include +#include +#include +#include #include #include -#include -#include +#include + #include #include +#include #include #include -#include -#include #include #include #include - #include #include #include @@ -47,515 +46,622 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include + #include #include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include #include #include -#include -#include +#include + #include #include -#include -#include - -#include +// This final include file provides the mkdir function +// that we will use to create a directory for output files, if necessary: +#include namespace Step42 { using namespace dealii; - // @sect3{The Input class template} + // @sect3{The ConstitutiveLaw class template} - // This class has the the only purpose - // to read in data from a picture file - // that has to be stored in pbm ascii - // format. This data will be bilinear - // interpolated and provides in this way - // a function which describes an obstacle. + // This class provides an interface for a constitutive law, i.e., for the + // relationship between strain $\varepsilon(\mathbf u)$ and stress + // $\sigma$. In this example we are using an elastoplastic material behavior + // with linear, isotropic hardening. Such materials are characterized by + // Young's modulus $E$, Poisson's ratio $\nu$, the initial yield stress + // $\sigma_0$ and the isotropic hardening parameter $\gamma$. For $\gamma = + // 0$ we obtain perfect elastoplastic behavior. // - // The data which we read in by the - // function read_obstacle () from the file - // "obstacle_file.pbm" will be stored - // in a double std::vector named - // obstacle_data. - // This vector composes the base - // to calculate a piecewise bilinear - // function as a polynomial interpolation. - // This will be done by obstacle_function (). - // - // In the function run () of the class - // PlasticityContactProblem we create - // an object of the class Input which will - // be used in the class Obstacle to - // supply the obstacle function in - // update_solution_and_constraints () of - // the class PlasticityContactProblem. - + // As explained in the paper that describes this program, the first Newton + // steps are solved with a completely elastic material model to avoid having + // to deal with both nonlinearities (plasticity and contact) at once. To this + // end, this class has a function set_sigma_0() that we use later + // on to simply set $\sigma_0$ to a very large value -- essentially + // guaranteeing that the actual stress will not exceed it, and thereby + // producing an elastic material. When we are ready to use a plastic model, we + // set $\sigma_0$ back to its proper value, using the same function. As a + // result of this approach, we need to leave sigma_0 as the only + // non-const member variable of this class. template - class Input + class ConstitutiveLaw { - public: - Input (const char* _name) : - name (_name), - mpi_communicator (MPI_COMM_WORLD), - pcout (std::cout, - (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)), - obstacle_data (0), - hx (0), - hy (0), - nx (0), - ny (0) - {read_obstacle (name);} - - double hv (int i, int j); - - double obstacle_function (double x,double y); - - void read_obstacle (const char* name); - - private: - const char* name; - MPI_Comm mpi_communicator; - ConditionalOStream pcout; - std::vector obstacle_data; - double hx, hy; - int nx, ny; - }; + public: + ConstitutiveLaw (const double E, + const double nu, + const double sigma_0, + const double gamma); - // This function is used in obstacle_function () - // to provide the proper value of the obstacle. - template - double Input::hv (int i, int j) - { - assert(i>=0 && i=0 && j - double Input::obstacle_function (double x,double y) - { - int ix = (int)(x/hx); - int iy = (int)(y/hy); + bool + get_stress_strain_tensor (const SymmetricTensor<2, dim> &strain_tensor, + SymmetricTensor<4, dim> &stress_strain_tensor) const; - if (ix<0) - ix = 0; + void + get_linearized_stress_strain_tensors (const SymmetricTensor<2, dim> &strain_tensor, + SymmetricTensor<4, dim> &stress_strain_tensor_linearized, + SymmetricTensor<4, dim> &stress_strain_tensor) const; - if (iy<0) - iy = 0; + private: + const double kappa; + const double mu; + double sigma_0; + const double gamma; - if (ix>=nx-1) - ix = nx-2; + const SymmetricTensor<4, dim> stress_strain_tensor_kappa; + const SymmetricTensor<4, dim> stress_strain_tensor_mu; + }; - if (iy>=ny-1) - iy = ny-2; + // The constructor of the ConstitutiveLaw class sets the required material + // parameter for our deformable body. Material parameters for elastic + // isotropic media can be defined in a variety of ways, such as the pair $E, + // \nu$ (elastic modulus and Poisson's number), using the Lame parameters + // $\lambda,mu$ or several other commonly used conventions. Here, the + // constructor takes a description of material parameters in the form of + // $E,\nu$, but since this turns out to these are not the coefficients that + // appear in the equations of the plastic projector, we immediately convert + // them into the more suitable set $\kappa,\mu$ of bulk and shear moduli. In + // addition, the constructor takes $\sigma_0$ (the yield stress absent any + // plastic strain) and $\gamma$ (the hardening parameter) as arguments. In + // this constructor, we also compute the two principal components of the + // stress-strain relation and its linearization. + template + ConstitutiveLaw::ConstitutiveLaw (double E, + double nu, + double sigma_0, + double gamma) + : + kappa (E / (3 * (1 - 2 * nu))), + mu (E / (2 * (1 + nu))), + sigma_0(sigma_0), + gamma(gamma), + stress_strain_tensor_kappa (kappa + * outer_product(unit_symmetric_tensor(), + unit_symmetric_tensor())), + stress_strain_tensor_mu (2 * mu + * (identity_tensor() + - outer_product(unit_symmetric_tensor(), + unit_symmetric_tensor()) / 3.0)) + {} - double val = 0.0; - { - FullMatrix H(4,4); - Vector X(4); - Vector b(4); - - double xx = 0.0; - double yy = 0.0; - - xx = ix*hx; - yy = iy*hy; - H(0,0) = xx; - H(0,1) = yy; - H(0,2) = xx*yy; - H(0,3) = 1.0; - b(0) = hv (ix, iy); - - xx = (ix + 1)*hx; - yy = iy*hy; - H(1,0) = xx; - H(1,1) = yy; - H(1,2) = xx*yy; - H(1,3) = 1.0; - b(1) = hv (ix + 1, iy); - - xx = (ix + 1)*hx; - yy = (iy + 1)*hy; - H(2,0) = xx; - H(2,1) = yy; - H(2,2) = xx*yy; - H(2,3) = 1.0; - b(2) = hv (ix + 1, iy + 1); - - xx = ix*hx; - yy = (iy + 1)*hy; - H(3,0) = xx; - H(3,1) = yy; - H(3,2) = xx*yy; - H(3,3) = 1.0; - b(3) = hv (ix, iy + 1); - - H.gauss_jordan (); - H.vmult (X, b); - - val = X(0)*x + X(1)*y + X(2)*x*y + X(3); - } - return val; + template + void + ConstitutiveLaw::set_sigma_0 (double sigma_zero) + { + sigma_0 = sigma_zero; } - // As mentioned above this function reads in the - // obstacle datas and stores them in the std::vector - // obstacle_data. It will be used only in run (). + + // @sect4{ConstitutiveLaw::get_stress_strain_tensor} + + // This is the principal component of the constitutive law. It projects the + // deviatoric part of the stresses in a quadrature point back to the yield + // stress (i.e., the original yield stress $\sigma_0$ plus the term that + // describes linear isotropic hardening). We need this function to calculate + // the nonlinear residual in PlasticityContactProblem::residual_nl_system. The + // computations follow the formulas laid out in the introduction. + // + // The function returns whether the quadrature point is plastic to allow for + // some statistics downstream on how many of the quadrature points are + // plastic and how many are elastic. template - void Input::read_obstacle (const char* name) + bool + ConstitutiveLaw:: + get_stress_strain_tensor (const SymmetricTensor<2, dim> &strain_tensor, + SymmetricTensor<4, dim> &stress_strain_tensor) const { - std::ifstream f(name); + Assert (dim == 3, ExcNotImplemented()); + + SymmetricTensor<2, dim> stress_tensor; + stress_tensor = (stress_strain_tensor_kappa + stress_strain_tensor_mu) + * strain_tensor; - std::string temp; - f >> temp >> nx >> ny; - assert(nx>0 && ny>0); + const SymmetricTensor<2, dim> deviator_stress_tensor = deviator(stress_tensor); + const double deviator_stress_tensor_norm = deviator_stress_tensor.norm(); - for (int k=0; k sigma_0) { - double val; - f >> val; - obstacle_data.push_back(val); + const double beta = sigma_0 / deviator_stress_tensor_norm; + stress_strain_tensor *= (gamma + (1 - gamma) * beta); } - hx = 1.0/(nx - 1); - hy = 1.0/(ny - 1); + stress_strain_tensor += stress_strain_tensor_kappa; - pcout << "Resolution of the scanned obstacle picture: " << nx << " x " << ny << std::endl; + return (deviator_stress_tensor_norm > sigma_0); } - // @sect3{The ConstitutiveLaw class template} - // This class provides an interface - // for a constitutive law. In this - // example we are using an elasto - // plastic material behavior with linear, - // isotropic hardening. - // For gamma = 0 we obtain perfect elasto - // plasticity behavior. + // @sect4{ConstitutiveLaw::get_linearized_stress_strain_tensors} + + // This function returns the linearized stress strain tensor, linearized + // around the solution $u^{i-1}$ of the previous Newton step $i-1$. The + // parameter strain_tensor (commonly denoted + // $\varepsilon(u^{i-1})$) must be passed as an argument, and serves as the + // linearization point. The function returns the derivative of the nonlinear + // constitutive law in the variable stress_strain_tensor, as well as the + // stress-strain tensor of the linearized problem in + // stress_strain_tensor_linearized. See + // PlasticityContactProblem::assemble_nl_system where this function is used. template - class ConstitutiveLaw + void + ConstitutiveLaw:: + get_linearized_stress_strain_tensors (const SymmetricTensor<2, dim> &strain_tensor, + SymmetricTensor<4, dim> &stress_strain_tensor_linearized, + SymmetricTensor<4, dim> &stress_strain_tensor) const { - public: - ConstitutiveLaw (double _E, - double _nu, - double _sigma_0, - double _gamma, - MPI_Comm _mpi_communicator, - ConditionalOStream _pcout); - - void plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, - const SymmetricTensor<2,dim> &strain_tensor, - unsigned int &elast_points, - unsigned int &plast_points, - double &yield); - void linearized_plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor_linearized, - SymmetricTensor<4,dim> &stress_strain_tensor, - const SymmetricTensor<2,dim> &strain_tensor); - inline SymmetricTensor<2,dim> get_strain (const FEValues &fe_values, - const unsigned int shape_func, - const unsigned int q_point) const; - void set_sigma_0 (double sigma_hlp) {sigma_0 = sigma_hlp;} + Assert (dim == 3, ExcNotImplemented()); - private: - SymmetricTensor<4,dim> stress_strain_tensor_mu; - SymmetricTensor<4,dim> stress_strain_tensor_kappa; - double E; - double nu; - double sigma_0; - double gamma; - double mu; - double kappa; - MPI_Comm mpi_communicator; - ConditionalOStream pcout; - }; + SymmetricTensor<2, dim> stress_tensor; + stress_tensor = (stress_strain_tensor_kappa + stress_strain_tensor_mu) + * strain_tensor; - // The constructor of the ConstitutiveLaw class sets the - // required material parameter for our deformable body: - // E -> elastic modulus - // nu -> Passion's number - // sigma_0 -> yield stress - // gamma -> hardening parameter. - // Also it supplies the stress strain tensor of forth order - // of the volumetric and deviator part. For further details - // see the documentation above. - template - ConstitutiveLaw::ConstitutiveLaw(double _E, double _nu, double _sigma_0, double _gamma, MPI_Comm _mpi_communicator, ConditionalOStream _pcout) - :E (_E), - nu (_nu), - sigma_0 (_sigma_0), - gamma (_gamma), - mpi_communicator (_mpi_communicator), - pcout (_pcout) - { - mu = E/(2*(1+nu)); - kappa = E/(3*(1-2*nu)); - stress_strain_tensor_kappa = kappa*outer_product(unit_symmetric_tensor(), unit_symmetric_tensor()); - stress_strain_tensor_mu = 2*mu*(identity_tensor() - outer_product(unit_symmetric_tensor(), unit_symmetric_tensor())/3.0); - } + stress_strain_tensor = stress_strain_tensor_mu; + stress_strain_tensor_linearized = stress_strain_tensor_mu; - // Calculates the strain for the shape functions. - template - inline - SymmetricTensor<2,dim> ConstitutiveLaw::get_strain (const FEValues &fe_values, - const unsigned int shape_func, - const unsigned int q_point) const - { - const FEValuesExtractors::Vector displacement (0); - SymmetricTensor<2,dim> tmp; + SymmetricTensor<2, dim> deviator_stress_tensor = deviator(stress_tensor); + const double deviator_stress_tensor_norm = deviator_stress_tensor.norm(); - tmp = fe_values[displacement].symmetric_gradient (shape_func,q_point); + if (deviator_stress_tensor_norm > sigma_0) + { + const double beta = sigma_0 / deviator_stress_tensor_norm; + stress_strain_tensor *= (gamma + (1 - gamma) * beta); + stress_strain_tensor_linearized *= (gamma + (1 - gamma) * beta); + deviator_stress_tensor /= deviator_stress_tensor_norm; + stress_strain_tensor_linearized -= (1 - gamma) * beta * 2 * mu + * outer_product(deviator_stress_tensor, + deviator_stress_tensor); + } - return tmp; + stress_strain_tensor += stress_strain_tensor_kappa; + stress_strain_tensor_linearized += stress_strain_tensor_kappa; } - // This is the implemented constitutive law. It projects the - // deviator part of the stresses in a quadrature point back to - // the yield stress plus the linear isotropic hardening. - // Also we sum up the elastic and the plastic quadrature - // points. - template - void ConstitutiveLaw::plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor, - const SymmetricTensor<2,dim> &strain_tensor, - unsigned int &elast_points, - unsigned int &plast_points, - double &yield) + //

    Equation data: boundary forces, boundary values, obstacles

    + // + // The following should be relatively standard. We need classes for + // the boundary forcing term (which we here choose to be zero) + // and boundary values on those part of the boundary that are not part + // of the contact surface (also chosen to be zero here). + namespace EquationData { - if (dim == 3) - { - SymmetricTensor<2,dim> stress_tensor; - stress_tensor = (stress_strain_tensor_kappa + stress_strain_tensor_mu)*strain_tensor; - - SymmetricTensor<2,dim> deviator_stress_tensor = deviator(stress_tensor); + template + class BoundaryForce : public Function + { + public: + BoundaryForce (); - double deviator_stress_tensor_norm = deviator_stress_tensor.norm (); + virtual + double value (const Point &p, + const unsigned int component = 0) const; - yield = 0; - stress_strain_tensor = stress_strain_tensor_mu; - double beta = 1.0; - if (deviator_stress_tensor_norm > sigma_0) - { - beta = sigma_0/deviator_stress_tensor_norm; - stress_strain_tensor *= (gamma + (1 - gamma)*beta); - yield = 1; - plast_points += 1; - } - else - elast_points += 1; + virtual + void vector_value (const Point &p, + Vector &values) const; + }; - stress_strain_tensor += stress_strain_tensor_kappa; - } - } + template + BoundaryForce::BoundaryForce () + : + Function(dim) + {} - // This function returns the linearized stress strain tensor. - // It contains the derivative of the nonlinear constitutive law. - template - void ConstitutiveLaw::linearized_plast_linear_hardening (SymmetricTensor<4,dim> &stress_strain_tensor_linearized, - SymmetricTensor<4,dim> &stress_strain_tensor, - const SymmetricTensor<2,dim> &strain_tensor) - { - if (dim == 3) - { - SymmetricTensor<2,dim> stress_tensor; - stress_tensor = (stress_strain_tensor_kappa + stress_strain_tensor_mu)*strain_tensor; - SymmetricTensor<2,dim> deviator_stress_tensor = deviator(stress_tensor); + template + double + BoundaryForce::value (const Point &, + const unsigned int) const + { + return 0.; + } - double deviator_stress_tensor_norm = deviator_stress_tensor.norm (); + template + void + BoundaryForce::vector_value (const Point &p, + Vector &values) const + { + for (unsigned int c = 0; c < this->n_components; ++c) + values(c) = BoundaryForce::value(p, c); + } - stress_strain_tensor = stress_strain_tensor_mu; - stress_strain_tensor_linearized = stress_strain_tensor_mu; - double beta = 1.0; - if (deviator_stress_tensor_norm > sigma_0) - { - beta = sigma_0/deviator_stress_tensor_norm; - stress_strain_tensor *= (gamma + (1 - gamma)*beta); - stress_strain_tensor_linearized *= (gamma + (1 - gamma)*beta); - deviator_stress_tensor /= deviator_stress_tensor_norm; - stress_strain_tensor_linearized -= (1 - gamma)*beta*2*mu*outer_product(deviator_stress_tensor, deviator_stress_tensor); - } - stress_strain_tensor += stress_strain_tensor_kappa; - stress_strain_tensor_linearized += stress_strain_tensor_kappa; - } - } - // In this namespace we provide three functions: - // one for the body force, one for the boundary displacement - // and one for the Obstacle. - namespace EquationData - { - // It possible to apply an additional body force - // but in here it is set to zero. template - class RightHandSide : public Function + class BoundaryValues : public Function { public: - RightHandSide () : Function(dim) {} + BoundaryValues (); - virtual double value (const Point &p, - const unsigned int component = 0) const; + virtual double value (const Point &p, + const unsigned int component = 0) const; - virtual void vector_value (const Point &p, - Vector &values) const; + virtual + void vector_value (const Point &p, + Vector &values) const; }; + + template + BoundaryValues::BoundaryValues () + : + Function(dim) + {} + + + template + double + BoundaryValues::value (const Point &, + const unsigned int) const + { + return 0.; + } + template - double RightHandSide::value (const Point &p, - const unsigned int component) const + void + BoundaryValues::vector_value (const Point &p, + Vector &values) const { - double return_value = 0.0; + for (unsigned int c = 0; c < this->n_components; ++c) + values(c) = BoundaryValues::value(p, c); + } + + + // @sect4{The SphereObstacle class} + + // The following class is the first of two obstacles that can be + // selected from the input file. It describes a sphere centered + // at position $x=y=0.5, z=z_{\text{surface}}+0.59$ and radius $r=0.6$, + // where $z_{\text{surface}}$ is the vertical position of the (flat) + // surface of the deformable body. The function's value + // returns the location of the obstacle for a given $x,y$ value if the + // point actually lies below the sphere, or a large positive value that + // can't possibly interfere with the deformation if it lies outside + // the "shadow" of the sphere. + template + class SphereObstacle : public Function + { + public: + SphereObstacle (const double z_surface); + + virtual + double value (const Point &p, + const unsigned int component = 0) const; + + virtual + void vector_value (const Point &p, + Vector &values) const; + private: + const double z_surface; + }; + + + template + SphereObstacle::SphereObstacle (const double z_surface) + : + Function(dim), + z_surface(z_surface) + {} + + + template + double + SphereObstacle::value ( + const Point &p, const unsigned int component) const + { if (component == 0) - return_value = 0.0; - if (component == 1) - return_value = 0.0; - if (component == 2) - return_value = 0.0; + return p(0); + else if (component == 1) + return p(1); + else if (component == 2) + { + if ((p(0) - 0.5) * (p(0) - 0.5) + (p(1) - 0.5) * (p(1) - 0.5) + < 0.36) + return (-std::sqrt( + 0.36 - (p(0) - 0.5) * (p(0) - 0.5) + - (p(1) - 0.5) * (p(1) - 0.5)) + z_surface + 0.59); + else + return 1000; + } - return return_value; + Assert(false, ExcNotImplemented()); + return 1e9; // an unreasonable value; ignored in debug mode because of the preceding Assert } + template - void RightHandSide::vector_value (const Point &p, - Vector &values) const + void + SphereObstacle::vector_value (const Point &p, + Vector &values) const { - for (unsigned int c=0; cn_components; ++c) - values(c) = RightHandSide::value (p, c); + for (unsigned int c = 0; c < this->n_components; ++c) + values(c) = SphereObstacle::value(p, c); } - // This function class is used to describe the prescribed displacements - // at the boundary. But again we set this to zero. + // @sect4{The BitmapFile and ChineseObstacle classes} + + // The following two classes describe the obstacle outlined in the introduction, + // i.e., the Chinese character. The first of the two, BitmapFile + // is responsible for reading in data from a picture file + // stored in pbm ascii format. This data will be bilinearly interpolated and + // provides in this way a function which describes an obstacle. + // + // The data which we read from the file will be stored in a double std::vector + // named obstacle_data. This vector composes the base to calculate a + // piecewise bilinear function as a polynomial interpolation. The data we will + // read from a file consists of zeros (white) and ones (black). + // + // The hx,hy variables denote the spacing between pixels in $x$ + // and $y$ directions. nx,ny are the numbers of pixels in each of + // these directions. get_value() returns the value of the image + // at a given location, interpolated from the adjacent pixel values. template - class BoundaryValues : public Function + class BitmapFile { public: - BoundaryValues () : Function(dim) {}; + BitmapFile(const std::string &name); - virtual double value (const Point &p, - const unsigned int component = 0) const; + double + get_value(const double x, const double y) const; - virtual void vector_value (const Point &p, - Vector &values) const; + private: + std::vector obstacle_data; + double hx, hy; + int nx, ny; + + double + get_pixel_value(const int i, const int j) const; }; + // The constructor of this class reads in the data that describes + // the obstacle from the given file name. template - double BoundaryValues::value (const Point &p, - const unsigned int component) const + BitmapFile::BitmapFile(const std::string &name) + : + obstacle_data(0), + hx(0), + hy(0), + nx(0), + ny(0) { - double return_value = 0; + std::ifstream f(name.c_str()); - if (component == 0) - return_value = 0.0; - if (component == 1) - return_value = 0.0; - if (component == 2) - return_value = 0.0; + std::string temp; + f >> temp >> nx >> ny; + + AssertThrow(nx > 0 && ny > 0, ExcMessage("Invalid file format.")); + + for (int k = 0; k < nx * ny; k++) + { + double val; + f >> val; + obstacle_data.push_back(val); + } - return return_value; + hx = 1.0 / (nx - 1); + hy = 1.0 / (ny - 1); + + if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) + std::cout << "Read obstacle from file <" << name << ">" << std::endl + << "Resolution of the scanned obstacle picture: " << nx + << " x " << ny << std::endl; + } + + template + double + BitmapFile::get_pixel_value(const int i, const int j) const + { + assert(i >= 0 && i < nx); + assert(j >= 0 && j < ny); + return obstacle_data[nx * (ny - 1 - j) + i]; } template - void BoundaryValues::vector_value (const Point &p, - Vector &values) const + double + BitmapFile::get_value(const double x, const double y) const { - for (unsigned int c=0; cn_components; ++c) - values(c) = BoundaryValues::value (p, c); + const int ix = std::min(std::max((int) (x / hx), 0), nx - 2); + const int iy = std::min(std::max((int) (y / hy), 0), ny - 2); + + FullMatrix H(4, 4); + Vector X(4); + Vector b(4); + + double xx, yy; + + xx = ix * hx; + yy = iy * hy; + H(0, 0) = xx; + H(0, 1) = yy; + H(0, 2) = xx * yy; + H(0, 3) = 1.0; + b(0) = get_pixel_value(ix, iy); + + xx = (ix + 1) * hx; + yy = iy * hy; + H(1, 0) = xx; + H(1, 1) = yy; + H(1, 2) = xx * yy; + H(1, 3) = 1.0; + b(1) = get_pixel_value(ix + 1, iy); + + xx = (ix + 1) * hx; + yy = (iy + 1) * hy; + H(2, 0) = xx; + H(2, 1) = yy; + H(2, 2) = xx * yy; + H(2, 3) = 1.0; + b(2) = get_pixel_value(ix + 1, iy + 1); + + xx = ix * hx; + yy = (iy + 1) * hy; + H(3, 0) = xx; + H(3, 1) = yy; + H(3, 2) = xx * yy; + H(3, 3) = 1.0; + b(3) = get_pixel_value(ix, iy + 1); + + H.gauss_jordan(); + H.vmult(X, b); + + return (X(0) * x + X(1) * y + X(2) * x * y + X(3)); } - // This function is obviously implemented to - // define the obstacle that penetrates our deformable - // body. You can choose between two ways to define - // your obstacle: to read it from a file or to use - // a function (here a ball). + // Finally, this is the class that actually uses the class above. It + // has a BitmapFile object as a member that describes the height of the + // obstacle. As mentioned above, the BitmapFile class will provide us + // with a mask, i.e., values that are either zero or one (and, if you + // ask for locations between pixels, values that are interpolated between + // zero and one). This class translates this to heights that are either + // 0.001 below the surface of the deformable body (if the BitmapFile + // class reports a one at this location) or 0.999 above the obstacle (if + // the BitmapFile class reports a zero). The following function should then + // be self-explanatory. template - class Obstacle : public Function + class ChineseObstacle : public Function { public: - Obstacle (std_cxx1x::shared_ptr > const &_input, bool _use_read_obstacle) : - Function(dim), - input_obstacle_copy(_input), - use_read_obstacle(_use_read_obstacle) - {} + ChineseObstacle(const std::string &filename, + const double z_surface); - virtual double value (const Point &p, - const unsigned int component = 0) const; + virtual + double value (const Point &p, + const unsigned int component = 0) const; - virtual void vector_value (const Point &p, - Vector &values) const; + virtual + void vector_value (const Point &p, + Vector &values) const; private: - std_cxx1x::shared_ptr > const &input_obstacle_copy; - bool use_read_obstacle; + const BitmapFile input_obstacle; + double z_surface; }; + template - double Obstacle::value (const Point &p, + ChineseObstacle::ChineseObstacle(const std::string &filename, + const double z_surface) + : + Function(dim), + input_obstacle(filename), + z_surface(z_surface) + {} + + + template + double + ChineseObstacle::value (const Point &p, const unsigned int component) const { - double R = 0.03; - double return_value = 100.0; if (component == 0) - return_value = p(0); + return p(0); if (component == 1) - return_value = p(1); - if (component == 2) + return p(1); + else if (component==2) { - if (use_read_obstacle) - return_value = 1.999 - input_obstacle_copy->obstacle_function (p(0), p(1)); - else - return_value = -std::sqrt (0.36 - (p(0)-0.5)*(p(0)-0.5) - (p(1)-0.5)*(p(1)-0.5)) + 1.59; + if (p(0) >= 0.0 && p(0) <= 1.0 && p(1) >= 0.0 && p(1) <= 1.0) + return z_surface + 0.999 - input_obstacle.get_value(p(0), p(1)); } - return return_value; + + Assert (false, ExcNotImplemented()); + return 1e9; // an unreasonable value; ignored in debug mode because of the preceding Assert } template - void Obstacle::vector_value (const Point &p, - Vector &values) const + void + ChineseObstacle::vector_value (const Point &p, + Vector &values) const { - for (unsigned int c=0; cn_components; ++c) - values(c) = Obstacle::value (p, c); + for (unsigned int c = 0; c < this->n_components; ++c) + values(c) = ChineseObstacle::value(p, c); } } // @sect3{The PlasticityContactProblem class template} - // This class supplies all function + // This is the main class of this program and supplies all functions // and variables needed to describe // the nonlinear contact problem. It is // close to step-41 but with some additional - // features like: handling hanging nodes, + // features like handling hanging nodes, // a Newton method, using Trilinos and p4est // for parallel distributed computing. // To deal with hanging nodes makes // life a bit more complicated since - // we need an other ConstraintMatrix now. + // we need another ConstraintMatrix now. // We create a Newton method for the // active set method for the contact // situation and to handle the nonlinear // operator for the constitutive law. - + // + // The general layout of this class is very much like for most other tutorial programs. + // To make our life a bit easier, this class reads a set of input parameters from an input file. These + // parameters, using the ParameterHandler class, are declared in the declare_parameters + // function (which is static so that it can be called before we even create an object of the current + // type), and a ParameterHandler object that has been used to read an input file will then be passed + // to the constructor of this class. + // + // The remaining member functions are by and large as we have seen in several of the other tutorial + // programs, though with additions for the current nonlinear system. We will comment on their purpose + // as we get to them further below. template class PlasticityContactProblem { public: - PlasticityContactProblem (int _n_refinements_global); + PlasticityContactProblem (const ParameterHandler &prm); + void run (); + static void declare_parameters (ParameterHandler &prm); + private: void make_grid (); - void setup_system(); - void assemble_nl_system (TrilinosWrappers::MPI::Vector &u); - void residual_nl_system (TrilinosWrappers::MPI::Vector &u); + void setup_system (); + void assemble_nl_system (const TrilinosWrappers::MPI::Vector &u); + void compute_nonlinear_residual (const TrilinosWrappers::MPI::Vector ¤t_solution); void assemble_mass_matrix_diagonal (TrilinosWrappers::SparseMatrix &mass_matrix); void update_solution_and_constraints (); void dirichlet_constraints (); @@ -563,797 +669,997 @@ namespace Step42 void solve_newton (); void refine_grid (); void move_mesh (const TrilinosWrappers::MPI::Vector &_complete_displacement) const; - void output_results (const std::string &title) const; - - unsigned int n_refinements_global; - unsigned int cycle; - bool use_read_obstacle; - - MPI_Comm mpi_communicator; - - parallel::distributed::Triangulation triangulation; - - FESystem fe; - DoFHandler dof_handler; - - std_cxx1x::shared_ptr > soltrans; - - IndexSet locally_owned_dofs; - IndexSet locally_relevant_dofs; + void output_results (const std::string &filename_base); + void output_contact_force () const; + + // As far as member variables are concerned, we start with ones that we use to + // indicate the MPI universe this program runs on, a stream we use to let + // exactly one processor produce output to the console (see step-17) and + // a variable that is used to time the various sections of the program: + MPI_Comm mpi_communicator; + ConditionalOStream pcout; + TimerOutput computing_timer; + + // The next group describes the mesh and the finite element space. + // In particular, for this parallel program, the finite element + // space has associated with it variables that indicate which degrees + // of freedom live on the current processor (the index sets, see + // also step-40 and the @ref distributed documentation module) as + // well as a variety of constraints: those imposed by hanging nodes, + // by Dirichlet boundary conditions, and by the active set of + // contact nodes. Of the three ConstraintMatrix variables defined + // here, the first only contains hanging node constraints, the + // second also those associated with Dirichlet boundary conditions, + // and the third these plus the contact constraints. + // + // The variable active_set consists of those degrees + // of freedom constrained by the contact, and we use + // fraction_of_plastic_q_points_per_cell to keep + // track of the fraction of quadrature points on each cell where + // the stress equals the yield stress. The latter is only used to + // create graphical output showing the plastic zone, but not for + // any further computation; the variable is a member variable of + // this class since the information is computed as a by-product + // of computing the residual, but is used only much later. (Note + // that the vector is a vector of length equal to the number of + // active cells on the local mesh; it is never used to + // exchange information between processors and can therefore be + // a regular deal.II vector.) + const unsigned int n_initial_global_refinements; + parallel::distributed::Triangulation triangulation; + + const unsigned int fe_degree; + FESystem fe; + DoFHandler dof_handler; + + IndexSet locally_owned_dofs; + IndexSet locally_relevant_dofs; + + ConstraintMatrix constraints_hanging_nodes; + ConstraintMatrix constraints_dirichlet_and_hanging_nodes; + ConstraintMatrix all_constraints; + + IndexSet active_set; + Vector fraction_of_plastic_q_points_per_cell; + + + // The next block of variables corresponds to the solution + // and the linear systems we need to form. In particular, this + // includes the Newton matrix and right hand side; the vector + // that corresponds to the residual (i.e., the Newton right hand + // side) but from which we have not eliminated the various + // constraints and that is used to determine which degrees of + // freedom need to be constrained in the next iteration; and + // a vector that corresponds to the diagonal of the $B$ matrix + // briefly mentioned in the introduction and discussed in the + // accompanying paper. + TrilinosWrappers::SparseMatrix system_matrix_newton; + + TrilinosWrappers::MPI::Vector solution; + TrilinosWrappers::MPI::Vector system_rhs_newton; + TrilinosWrappers::MPI::Vector system_rhs_lambda; + TrilinosWrappers::MPI::Vector resid_vector; + TrilinosWrappers::MPI::Vector diag_mass_matrix_vector; + + // The next block contains the variables that describe the material + // response: + const double e_modulus, nu, gamma, sigma_0; + ConstitutiveLaw constitutive_law; + + // And then there is an assortment of other variables that are used + // to identify the mesh we are asked to build as selected by the + // parameter file, the obstacle that is being pushed into the + // deformable body, the mesh refinement strategy, whether to transfer + // the solution from one mesh to the next, and how many mesh + // refinement cycles to perform. As possible, we mark these kinds + // of variables as const to help the reader identify + // which ones may or may not be modified later on (the output directory + // being an exception -- it is never modified outside the constructor + // but it is awkward to initialize in the member-initializer-list + // following the colon in the constructor since there we have only + // one shot at setting it; the same is true for the mesh refinement + // criterion): + const std::string base_mesh; + const std_cxx1x::shared_ptr > obstacle; + + struct RefinementStrategy + { + enum value + { + refine_global, + refine_percentage, + refine_fix_dofs + }; + }; + typename RefinementStrategy::value refinement_strategy; - unsigned int number_iterations; + const bool transfer_solution; + std::string output_dir; + const unsigned int n_refinement_cycles; + unsigned int current_refinement_cycle; + }; - ConstraintMatrix constraints; - ConstraintMatrix constraints_hanging_nodes; - ConstraintMatrix constraints_dirichlet_hanging_nodes; - TrilinosWrappers::SparseMatrix system_matrix_newton; + // @sect3{Implementation of the PlasticityContactProblem class} - TrilinosWrappers::MPI::Vector solution; - TrilinosWrappers::MPI::Vector system_rhs_newton; - TrilinosWrappers::MPI::Vector resid_vector; - TrilinosWrappers::MPI::Vector diag_mass_matrix_vector; - Vector cell_constitution; - IndexSet active_set; + // @sect4{PlasticityContactProblem::declare_parameters} - ConditionalOStream pcout; + // Let us start with the declaration of run-time parameters that can be + // selected in the input file. These values will be read back in the + // constructor of this class to initialize the member variables of this + // class: + template + void + PlasticityContactProblem::declare_parameters (ParameterHandler &prm) + { + prm.declare_entry("polynomial degree", "1", Patterns::Integer(), + "Polynomial degree of the FE_Q finite element space, typically 1 or 2."); + prm.declare_entry("number of initial refinements", "2", + Patterns::Integer(), + "Number of initial global mesh refinement steps before " + "the first computation."); + prm.declare_entry("refinement strategy", "percentage", + Patterns::Selection("global|percentage|fix dofs"), + "Mesh refinement strategy:\n" + " global: one global refinement\n" + " percentage: fixed percentage gets refined using the Kelly estimator\n" + " fix dofs: tries to achieve 2^initial_refinement*300 dofs after " + "refinement cycle 1 (only use 2 cycles!). This requires the code to " + "make some changes to the coarse mesh as well."); + prm.declare_entry("number of cycles", "5", Patterns::Integer(), + "Number of adaptive mesh refinement cycles to run."); + prm.declare_entry("obstacle filename", "", Patterns::Anything(), + "Obstacle file to read, use 'obstacle_file.pbm' or leave empty to use a sphere."); + prm.declare_entry("output directory", "", Patterns::Anything(), + "Directory for output files (graphical output and benchmark " + "statistics). If empty, use the current directory."); + prm.declare_entry("transfer solution", "false", Patterns::Bool(), + "Whether the solution should be used as a starting guess " + "for the next finer mesh. If false, then the iteration starts at " + "zero on every mesh."); + prm.declare_entry("base mesh", "box", + Patterns::Selection("box|half sphere"), + "Select the shape of the domain: 'box' or 'half sphere'"); + } - TrilinosWrappers::PreconditionAMG::AdditionalData additional_data; - TrilinosWrappers::PreconditionAMG preconditioner_u; - std_cxx1x::shared_ptr > input_obstacle; - std_cxx1x::shared_ptr > plast_lin_hard; + // @sect4{The PlasticityContactProblem constructor} - double sigma_0; // Yield stress - double gamma; // Parameter for the linear isotropic hardening - double e_modul; // E-Modul - double nu; // Poisson ratio + // Given the declarations of member variables as well as the + // declarations of run-time parameters that are read from the input + // file, there is nothing surprising in this constructor. In the body + // we initialize the mesh refinement strategy and the output directory, + // creating such a directory if necessary. + template + PlasticityContactProblem:: + PlasticityContactProblem (const ParameterHandler &prm) + : + mpi_communicator(MPI_COMM_WORLD), + pcout(std::cout, + (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)), + computing_timer(MPI_COMM_WORLD, pcout, TimerOutput::never, + TimerOutput::wall_times), + + n_initial_global_refinements (prm.get_integer("number of initial refinements")), + triangulation(mpi_communicator), + fe_degree (prm.get_integer("polynomial degree")), + fe(FE_Q(QGaussLobatto<1>(fe_degree+1)), dim), + dof_handler(triangulation), + + e_modulus (200000), + nu (0.3), + gamma (0.01), + sigma_0(400.0), + constitutive_law (e_modulus, + nu, + sigma_0, + gamma), + + base_mesh (prm.get("base mesh")), + obstacle (prm.get("obstacle filename") != "" + ? + static_cast*> + (new EquationData::ChineseObstacle(prm.get("obstacle filename"), (base_mesh == "box" ? 1.0 : 0.5))) + : + static_cast*> + (new EquationData::SphereObstacle(base_mesh == "box" ? 1.0 : 0.5))), + + transfer_solution (prm.get_bool("transfer solution")), + n_refinement_cycles (prm.get_integer("number of cycles")) + { + std::string strat = prm.get("refinement strategy"); + if (strat == "global") + refinement_strategy = RefinementStrategy::refine_global; + else if (strat == "percentage") + refinement_strategy = RefinementStrategy::refine_percentage; + else + AssertThrow (false, ExcNotImplemented()); + + output_dir = prm.get("output directory"); + if (output_dir != "" && *(output_dir.rbegin()) != '/') + output_dir += "/"; + mkdir(output_dir.c_str(), 0777); + + pcout << " Using output directory '" << output_dir << "'" << std::endl; + pcout << " FE degree " << fe_degree << std::endl; + pcout << " transfer solution " + << (transfer_solution ? "true" : "false") << std::endl; + } - TimerOutput computing_timer; - }; - // @sect3{Implementation of the PlasticityContactProblem class} - // Next for the implementation of the class - // template that makes use of the functions - // above. As before, we will write everything + // @sect4{PlasticityContactProblem::make_grid} - template - PlasticityContactProblem::PlasticityContactProblem (int _n_refinements_global) - : - n_refinements_global (_n_refinements_global), - mpi_communicator (MPI_COMM_WORLD), - triangulation (mpi_communicator), - fe (FE_Q(1), dim), - dof_handler (triangulation), - pcout (std::cout, - (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)), - sigma_0 (400), - gamma (0.01), - e_modul (2.0e+5), - nu (0.3), - computing_timer (MPI_COMM_WORLD, - pcout, - TimerOutput::never, - TimerOutput::wall_times) + // The next block deals with constructing the starting mesh. + // We will use the following helper function and the first + // block of the make_grid() to construct a + // mesh that corresponds to a half sphere. deal.II has a function + // that creates such a mesh, but it is in the wrong location + // and facing the wrong direction, so we need to shift and rotate + // it a bit before using it: + Point<3> + rotate_half_sphere (const Point<3> &in) { - plast_lin_hard.reset (new ConstitutiveLaw (e_modul, nu, sigma_0, gamma, mpi_communicator, pcout)); + return Point<3>(in(2), in(1), -in(0)); } template - void PlasticityContactProblem::make_grid () + void + PlasticityContactProblem::make_grid () { - std::vector repet(3); - repet[0] = 1; - repet[1] = 1; - repet[2] = 1; + if (base_mesh == "half sphere") + { + const Point center(0, 0, 0); + const double radius = 0.8; + GridGenerator::half_hyper_ball(triangulation, center, radius); - Point p1 (0,0,0); - Point p2 (1.0, 1.0, 1.0); - GridGenerator::subdivided_hyper_rectangle (triangulation, repet, p1, p2); + GridTools::transform(&rotate_half_sphere, triangulation); + GridTools::shift(Point(0.5, 0.5, 0.5), triangulation); - Triangulation<3>::active_cell_iterator - cell = triangulation.begin_active(), - endc = triangulation.end(); + static HyperBallBoundary boundary_description(Point(0.5, 0.5, 0.5), radius); + triangulation.set_boundary(0, boundary_description); + } + // Alternatively, create a hypercube mesh. After creating it, + // assign boundary indicators as follows: + // @code + // _______ + // / 1 /| + // /______ / | + // | | 8| + // | 8 | / + // |_______|/ + // 6 + // @endcode + // In other words, the boundary indicators of the sides of the cube are 8. + // The boundary indicator of the bottom is 6 and the top has indicator 1. + else + { + const Point p1(0, 0, 0); + const Point p2(1.0, 1.0, 1.0); - /* boundary_indicators: - _______ - / 9 /| - /______ / | - 8| | 8| - | 8 | / - |_______|/ - 6 - */ + GridGenerator::hyper_rectangle(triangulation, p1, p2); - for (; cell!=endc; ++cell) - for (unsigned int face=0; face::faces_per_cell; ++face) - { - if (cell->face (face)->center ()[2] == p2(2)) - cell->face (face)->set_boundary_indicator (9); - if (cell->face (face)->center ()[0] == p1(0) || - cell->face (face)->center ()[0] == p2(0) || - cell->face (face)->center ()[1] == p1(1) || - cell->face (face)->center ()[1] == p2(1)) - cell->face (face)->set_boundary_indicator (8); - if (cell->face (face)->center ()[2] == p1(2)) - cell->face (face)->set_boundary_indicator (6); - } + /* boundary_indicators: - triangulation.refine_global (n_refinements_global); + */ + Triangulation<3>::active_cell_iterator + cell = triangulation.begin_active(), + endc = triangulation.end(); + for (; cell != endc; ++cell) + for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; + ++face) + { + if (cell->face(face)->center()[2] == p2(2)) + cell->face(face)->set_boundary_indicator(1); + if (cell->face(face)->center()[0] == p1(0) + || cell->face(face)->center()[0] == p2(0) + || cell->face(face)->center()[1] == p1(1) + || cell->face(face)->center()[1] == p2(1)) + cell->face(face)->set_boundary_indicator(8); + if (cell->face(face)->center()[2] == p1(2)) + cell->face(face)->set_boundary_indicator(6); + } + } + + triangulation.refine_global(n_initial_global_refinements); } - // In following function we setup the degrees of freedom before each refinement - // cycle. Except that we are using Trilinos here instead of PETSc most of it - // is similar to step-40. - // We are using TimerOutput to control the scaling for the distributing the dofs - // and setting of the sparsity pattern and the system matrix. + template - void PlasticityContactProblem::setup_system () + void + PlasticityContactProblem::setup_system () { + // setup dofs { - computing_timer.enter_section("Setup: distribute DoFs"); - dof_handler.distribute_dofs (fe); + TimerOutput::Scope t(computing_timer, "Setup: distribute DoFs"); + dof_handler.distribute_dofs(fe); - locally_owned_dofs = dof_handler.locally_owned_dofs (); + locally_owned_dofs = dof_handler.locally_owned_dofs(); locally_relevant_dofs.clear(); - DoFTools::extract_locally_relevant_dofs (dof_handler, - locally_relevant_dofs); - computing_timer.exit_section("Setup: distribute DoFs"); + DoFTools::extract_locally_relevant_dofs(dof_handler, + locally_relevant_dofs); } - // Setup of the hanging nodes and the Dirichlet constraints. + // setup hanging nodes and Dirichlet constraints { - constraints_hanging_nodes.clear (); - constraints_hanging_nodes.reinit (locally_relevant_dofs); - DoFTools::make_hanging_node_constraints (dof_handler, - constraints_hanging_nodes); - constraints_hanging_nodes.close (); + TimerOutput::Scope t(computing_timer, "Setup: constraints"); + constraints_hanging_nodes.reinit(locally_relevant_dofs); + DoFTools::make_hanging_node_constraints(dof_handler, + constraints_hanging_nodes); + constraints_hanging_nodes.close(); pcout << " Number of active cells: " - << triangulation.n_global_active_cells() - << std::endl - << " Number of degrees of freedom: " - << dof_handler.n_dofs () + << triangulation.n_global_active_cells() << std::endl + << " Number of degrees of freedom: " << dof_handler.n_dofs() << std::endl; - dirichlet_constraints (); + dirichlet_constraints(); } - // Initialization for matrices and vectors. + // Initialization for matrices and vectors { - solution.reinit (locally_relevant_dofs, mpi_communicator); - system_rhs_newton.reinit (locally_owned_dofs, mpi_communicator); - resid_vector.reinit (system_rhs_newton); - diag_mass_matrix_vector.reinit (system_rhs_newton); - cell_constitution.reinit (triangulation.n_active_cells ()); - active_set.clear (); - active_set.set_size (locally_relevant_dofs.size ()); + TimerOutput::Scope t(computing_timer, "Setup: vectors"); + solution.reinit(locally_relevant_dofs, mpi_communicator); + system_rhs_newton.reinit(locally_owned_dofs, mpi_communicator); + system_rhs_lambda.reinit(system_rhs_newton); + resid_vector.reinit(system_rhs_newton); + diag_mass_matrix_vector.reinit(system_rhs_newton); + fraction_of_plastic_q_points_per_cell.reinit(triangulation.n_active_cells()); + active_set.clear(); + active_set.set_size(locally_relevant_dofs.size()); } - // Here we setup sparsity pattern. + // setup sparsity pattern { - computing_timer.enter_section("Setup: matrix"); - TrilinosWrappers::SparsityPattern sp (locally_owned_dofs, - mpi_communicator); + TimerOutput::Scope t(computing_timer, "Setup: matrix"); + TrilinosWrappers::SparsityPattern sp(locally_owned_dofs, + mpi_communicator); - DoFTools::make_sparsity_pattern (dof_handler, sp, constraints_dirichlet_hanging_nodes, false, - Utilities::MPI::this_mpi_process(mpi_communicator)); + DoFTools::make_sparsity_pattern(dof_handler, sp, + constraints_dirichlet_and_hanging_nodes, false, + Utilities::MPI::this_mpi_process(mpi_communicator)); sp.compress(); - system_matrix_newton.reinit (sp); - - // we are going to reuse the system - // matrix for assembling the diagonal - // of the mass matrix so that we do not - // need to allocate two sparse matrices - // at the same time: - TrilinosWrappers::SparseMatrix & mass_matrix = system_matrix_newton; - assemble_mass_matrix_diagonal (mass_matrix); - const unsigned int - start = (system_rhs_newton.local_range().first), - end = (system_rhs_newton.local_range().second); - for (unsigned int j=start; j - void PlasticityContactProblem::assemble_nl_system (TrilinosWrappers::MPI::Vector &u) + void + PlasticityContactProblem::assemble_nl_system (const TrilinosWrappers::MPI::Vector &u) { - computing_timer.enter_section("Assembling"); + TimerOutput::Scope t(computing_timer, "Assembling"); - QGauss quadrature_formula(2); - QGauss face_quadrature_formula(2); + QGauss quadrature_formula(fe.degree + 1); + QGauss face_quadrature_formula(fe.degree + 1); - FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + FEValues fe_values(fe, quadrature_formula, + UpdateFlags( + update_values | update_gradients | update_q_points + | update_JxW_values)); - FEFaceValues fe_values_face (fe, face_quadrature_formula, - update_values | update_quadrature_points | - update_JxW_values); + FEFaceValues fe_values_face(fe, face_quadrature_formula, + update_values | update_quadrature_points | update_JxW_values); - const unsigned int dofs_per_cell = fe.dofs_per_cell; - const unsigned int n_q_points = quadrature_formula.size (); - const unsigned int n_face_q_points = face_quadrature_formula.size(); + const unsigned int dofs_per_cell = fe.dofs_per_cell; + const unsigned int n_q_points = quadrature_formula.size(); + const unsigned int n_face_q_points = face_quadrature_formula.size(); - const EquationData::RightHandSide right_hand_side; - std::vector > right_hand_side_values (n_q_points, - Vector(dim)); - std::vector > right_hand_side_values_face (n_face_q_points, - Vector(dim)); + const EquationData::BoundaryForce boundary_force; + std::vector > boundary_force_values(n_face_q_points, + Vector(dim)); - FullMatrix cell_matrix (dofs_per_cell, dofs_per_cell); - Vector cell_rhs (dofs_per_cell); + FullMatrix cell_matrix(dofs_per_cell, dofs_per_cell); + Vector cell_rhs(dofs_per_cell); - std::vector local_dof_indices (dofs_per_cell); + std::vector local_dof_indices(dofs_per_cell); - typename DoFHandler::active_cell_iterator cell = dof_handler.begin_active(), - endc = dof_handler.end(); + typename DoFHandler::active_cell_iterator cell = + dof_handler.begin_active(), endc = dof_handler.end(); - const FEValuesExtractors::Vector displacement (0); + const FEValuesExtractors::Vector displacement(0); const double kappa = 1.0; - for (; cell!=endc; ++cell) + for (; cell != endc; ++cell) if (cell->is_locally_owned()) { - fe_values.reinit (cell); + fe_values.reinit(cell); cell_matrix = 0; cell_rhs = 0; - right_hand_side.vector_value_list (fe_values.get_quadrature_points(), - right_hand_side_values); - - std::vector > strain_tensor (n_q_points); - fe_values[displacement].get_function_symmetric_gradients (u, strain_tensor); + std::vector > strain_tensor(n_q_points); + fe_values[displacement].get_function_symmetric_gradients(u, + strain_tensor); - for (unsigned int q_point=0; q_point stress_strain_tensor_linearized; - SymmetricTensor<4,dim> stress_strain_tensor; - SymmetricTensor<2,dim> stress_tensor; + SymmetricTensor<4, dim> stress_strain_tensor_linearized; + SymmetricTensor<4, dim> stress_strain_tensor; + SymmetricTensor<2, dim> stress_tensor; - plast_lin_hard->linearized_plast_linear_hardening (stress_strain_tensor_linearized, - stress_strain_tensor, - strain_tensor[q_point]); + constitutive_law.get_linearized_stress_strain_tensors(strain_tensor[q_point], + stress_strain_tensor_linearized, + stress_strain_tensor); - for (unsigned int i=0; iget_strain(fe_values, i, q_point); + stress_tensor = stress_strain_tensor_linearized + * fe_values[displacement].symmetric_gradient(i, q_point); - for (unsigned int j=0; jget_strain(fe_values, j, q_point) * - fe_values.JxW (q_point)); - } + for (unsigned int j = 0; j < dofs_per_cell; ++j) + cell_matrix(i, j) += (stress_tensor + * fe_values[displacement].symmetric_gradient(j, q_point) + * fe_values.JxW(q_point)); // the linearized part a(v^i;v^i,v) of the rhs - cell_rhs(i) += (stress_tensor * - strain_tensor[q_point] * - fe_values.JxW (q_point)); + cell_rhs(i) += (stress_tensor * strain_tensor[q_point] + * fe_values.JxW(q_point)); // the residual part a(v^i;v) of the rhs - cell_rhs(i) -= (strain_tensor[q_point] * stress_strain_tensor * - plast_lin_hard->get_strain(fe_values, i, q_point) * - fe_values.JxW (q_point)); + cell_rhs(i) -= (strain_tensor[q_point] + * stress_strain_tensor + * fe_values[displacement].symmetric_gradient(i, q_point) + * fe_values.JxW(q_point)); // the residual part F(v) of the rhs - Tensor<1,dim> rhs_values; + Tensor<1, dim> rhs_values; rhs_values = 0; - cell_rhs(i) += (fe_values[displacement].value (i, q_point) * - rhs_values * - fe_values.JxW (q_point)); + cell_rhs(i) += (fe_values[displacement].value(i, q_point) + * rhs_values * fe_values.JxW(q_point)); } } - for (unsigned int face=0; face::faces_per_cell; ++face) + for (unsigned int face = 0; + face < GeometryInfo::faces_per_cell; ++face) { - if (cell->face (face)->at_boundary() - && cell->face (face)->boundary_indicator () == 9) + if (cell->face(face)->at_boundary() + && cell->face(face)->boundary_indicator() == 1) { - fe_values_face.reinit (cell, face); + fe_values_face.reinit(cell, face); - right_hand_side.vector_value_list (fe_values_face.get_quadrature_points(), - right_hand_side_values_face); + boundary_force.vector_value_list(fe_values_face.get_quadrature_points(), + boundary_force_values); - for (unsigned int q_point=0; q_point rhs_values; - rhs_values = 0; - for (unsigned int i=0; i rhs_values; + rhs_values[2] = boundary_force_values[q_point][2]; + for (unsigned int i = 0; i < dofs_per_cell; ++i) + cell_rhs(i) += (fe_values_face[displacement].value(i, + q_point) * rhs_values + * fe_values_face.JxW(q_point)); } } } - cell->get_dof_indices (local_dof_indices); - constraints.distribute_local_to_global (cell_matrix, cell_rhs, - local_dof_indices, - system_matrix_newton, system_rhs_newton, true); - }; + cell->get_dof_indices(local_dof_indices); + all_constraints.distribute_local_to_global(cell_matrix, cell_rhs, + local_dof_indices, + system_matrix_newton, + system_rhs_newton, + true); - system_matrix_newton.compress (VectorOperation::add); - system_rhs_newton.compress (VectorOperation::add); + } - computing_timer.exit_section("Assembling"); + system_matrix_newton.compress(VectorOperation::add); + system_rhs_newton.compress(VectorOperation::add); } + + template - void PlasticityContactProblem::residual_nl_system (TrilinosWrappers::MPI::Vector &u) + void + PlasticityContactProblem::compute_nonlinear_residual (const TrilinosWrappers::MPI::Vector ¤t_solution) { - QGauss quadrature_formula(2); - QGauss face_quadrature_formula(2); + QGauss quadrature_formula(fe.degree + 1); + QGauss face_quadrature_formula(fe.degree + 1); - FEValues fe_values (fe, quadrature_formula, - UpdateFlags(update_values | - update_gradients | - update_q_points | - update_JxW_values)); + FEValues fe_values(fe, quadrature_formula, + update_values | update_gradients | + update_q_points | update_JxW_values); - FEFaceValues fe_values_face (fe, face_quadrature_formula, - update_values | update_quadrature_points | - update_JxW_values); + FEFaceValues fe_values_face(fe, face_quadrature_formula, + update_values | update_quadrature_points | + update_JxW_values); - const unsigned int dofs_per_cell = fe.dofs_per_cell; - const unsigned int n_q_points = quadrature_formula.size (); - const unsigned int n_face_q_points = face_quadrature_formula.size(); + const unsigned int dofs_per_cell = fe.dofs_per_cell; + const unsigned int n_q_points = quadrature_formula.size(); + const unsigned int n_face_q_points = face_quadrature_formula.size(); - const EquationData::RightHandSide right_hand_side; - std::vector > right_hand_side_values (n_q_points, - Vector(dim)); - std::vector > right_hand_side_values_face (n_face_q_points, - Vector(dim)); + const EquationData::BoundaryForce boundary_force; + std::vector > boundary_force_values(n_face_q_points, + Vector(dim)); - Vector cell_rhs (dofs_per_cell); + Vector cell_rhs(dofs_per_cell); - std::vector local_dof_indices (dofs_per_cell); + std::vector local_dof_indices(dofs_per_cell); - const FEValuesExtractors::Vector displacement (0); + const FEValuesExtractors::Vector displacement(0); - typename DoFHandler::active_cell_iterator cell = dof_handler.begin_active(), - endc = dof_handler.end(); + typename DoFHandler::active_cell_iterator cell = + dof_handler.begin_active(), endc = dof_handler.end(); unsigned int elast_points = 0; unsigned int plast_points = 0; - double yield = 0; + double yield = 0; unsigned int cell_number = 0; - cell_constitution = 0; + fraction_of_plastic_q_points_per_cell = 0; - for (; cell!=endc; ++cell) + for (; cell != endc; ++cell, ++cell_number) if (cell->is_locally_owned()) { - fe_values.reinit (cell); + fe_values.reinit(cell); cell_rhs = 0; - right_hand_side.vector_value_list (fe_values.get_quadrature_points(), - right_hand_side_values); - - std::vector > strain_tensor (n_q_points); - fe_values[displacement].get_function_symmetric_gradients (u, strain_tensor); + std::vector > strain_tensor(n_q_points); + fe_values[displacement].get_function_symmetric_gradients(current_solution, + strain_tensor); - for (unsigned int q_point=0; q_point stress_strain_tensor; - SymmetricTensor<2,dim> stress_tensor; - - plast_lin_hard->plast_linear_hardening (stress_strain_tensor, strain_tensor[q_point], - elast_points, plast_points, yield); + SymmetricTensor<4, dim> stress_strain_tensor; + const bool q_point_is_plastic + = constitutive_law.get_stress_strain_tensor(strain_tensor[q_point], + stress_strain_tensor); + if (q_point_is_plastic) + { + ++plast_points; + ++fraction_of_plastic_q_points_per_cell(cell_number); + } + else + ++elast_points; - cell_constitution (cell_number) += yield; - for (unsigned int i=0; iget_strain(fe_values, i, q_point) * - fe_values.JxW (q_point)); + cell_rhs(i) -= (strain_tensor[q_point] + * stress_strain_tensor + * fe_values[displacement].symmetric_gradient(i, q_point) + * fe_values.JxW(q_point)); - Tensor<1,dim> rhs_values; + Tensor<1, dim> rhs_values; rhs_values = 0; - cell_rhs(i) += ((fe_values[displacement].value (i, q_point) * - rhs_values) * - fe_values.JxW (q_point)); - }; - }; + cell_rhs(i) += (fe_values[displacement].value(i, q_point) + * rhs_values * fe_values.JxW(q_point)); + } + } - for (unsigned int face=0; face::faces_per_cell; ++face) + for (unsigned int face = 0; + face < GeometryInfo::faces_per_cell; ++face) { - if (cell->face (face)->at_boundary() - && cell->face (face)->boundary_indicator () == 9) + if (cell->face(face)->at_boundary() + && cell->face(face)->boundary_indicator() == 1) { - fe_values_face.reinit (cell, face); + fe_values_face.reinit(cell, face); - right_hand_side.vector_value_list (fe_values_face.get_quadrature_points(), - right_hand_side_values_face); + boundary_force.vector_value_list(fe_values_face.get_quadrature_points(), + boundary_force_values); - for (unsigned int q_point=0; q_point rhs_values; - rhs_values = 0; - for (unsigned int i=0; i rhs_values; + rhs_values[2] = boundary_force_values[q_point][2]; + for (unsigned int i = 0; i < dofs_per_cell; ++i) + cell_rhs(i) += (fe_values_face[displacement].value(i, q_point) * rhs_values + * fe_values_face.JxW(q_point)); } } } - cell->get_dof_indices (local_dof_indices); - constraints_dirichlet_hanging_nodes.distribute_local_to_global (cell_rhs, + cell->get_dof_indices(local_dof_indices); + constraints_dirichlet_and_hanging_nodes.distribute_local_to_global(cell_rhs, local_dof_indices, system_rhs_newton); - cell_number += 1; + for (unsigned int i = 0; i < dofs_per_cell; i++) + system_rhs_lambda(local_dof_indices[i]) += cell_rhs(i); } - else - { - cell_constitution (cell_number) = 0; - cell_number += 1; - }; - cell_constitution /= n_q_points; - cell_constitution.compress (VectorOperation::add); - system_rhs_newton.compress (VectorOperation::add); + fraction_of_plastic_q_points_per_cell /= quadrature_formula.size(); + system_rhs_newton.compress(VectorOperation::add); + system_rhs_lambda.compress(VectorOperation::add); - unsigned int sum_elast_points = Utilities::MPI::sum(elast_points, mpi_communicator); - unsigned int sum_plast_points = Utilities::MPI::sum(plast_points, mpi_communicator); + const unsigned int sum_elast_points = Utilities::MPI::sum(elast_points, + mpi_communicator); + const unsigned int sum_plast_points = Utilities::MPI::sum(plast_points, + mpi_communicator); pcout << " Number of elastic quadrature points: " << sum_elast_points - << " and plastic quadrature points: " << sum_plast_points << std::endl; + << " and plastic quadrature points: " << sum_plast_points + << std::endl; } + + template - void PlasticityContactProblem::assemble_mass_matrix_diagonal (TrilinosWrappers::SparseMatrix &mass_matrix) + void + PlasticityContactProblem::assemble_mass_matrix_diagonal (TrilinosWrappers::SparseMatrix &mass_matrix) { - QTrapez face_quadrature_formula; + QGaussLobatto face_quadrature_formula(fe.degree + 1); - FEFaceValues fe_values_face (fe, face_quadrature_formula, - update_values | - update_quadrature_points | - update_JxW_values); + FEFaceValues fe_values_face(fe, face_quadrature_formula, + update_values | update_quadrature_points | update_JxW_values); - const unsigned int dofs_per_cell = fe.dofs_per_cell; - const unsigned int n_face_q_points = face_quadrature_formula.size(); + const unsigned int dofs_per_cell = fe.dofs_per_cell; + const unsigned int n_face_q_points = face_quadrature_formula.size(); - FullMatrix cell_matrix (dofs_per_cell, dofs_per_cell); - Tensor<1,dim,double> ones (dim); - for (unsigned i=0; i cell_matrix(dofs_per_cell, dofs_per_cell); + Tensor<1, dim, double> ones(dim); + for (unsigned i = 0; i < dim; i++) + ones[i] = 1.0; - std::vector local_dof_indices (dofs_per_cell); + std::vector local_dof_indices(dofs_per_cell); - const FEValuesExtractors::Vector displacement (0); + const FEValuesExtractors::Vector displacement(0); - typename DoFHandler::active_cell_iterator - cell = dof_handler.begin_active(), - endc = dof_handler.end(); + typename DoFHandler::active_cell_iterator cell = + dof_handler.begin_active(), endc = dof_handler.end(); - for (; cell!=endc; ++cell) + for (; cell != endc; ++cell) if (cell->is_locally_owned()) - for (unsigned int face=0; face::faces_per_cell; ++face) - if (cell->face (face)->at_boundary() - && cell->face (face)->boundary_indicator () == 9) + for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; + ++face) + if (cell->face(face)->at_boundary() + && cell->face(face)->boundary_indicator() == 1) { - fe_values_face.reinit (cell, face); + fe_values_face.reinit(cell, face); cell_matrix = 0; - for (unsigned int q_point=0; q_pointget_dof_indices (local_dof_indices); + cell->get_dof_indices(local_dof_indices); - constraints_dirichlet_hanging_nodes.distribute_local_to_global (cell_matrix, - local_dof_indices, - mass_matrix); + for (unsigned int i = 0; i < dofs_per_cell; i++) + mass_matrix.add(local_dof_indices[i], local_dof_indices[i], + cell_matrix(i, i)); } - - mass_matrix.compress (VectorOperation::add); + mass_matrix.compress(VectorOperation::add); } - // @sect4{PlasticityContactProblem::update_solution_and_constraints} +// @sect4{PlasticityContactProblem::update_solution_and_constraints} - // Projection and updating of the active set - // for the dofs which penetrates the obstacle. +// Projection and updating of the active set +// for the dofs which penetrates the obstacle. template - void PlasticityContactProblem::update_solution_and_constraints () + void + PlasticityContactProblem::update_solution_and_constraints () { - computing_timer.enter_section("Update solution and constraints"); - - const EquationData::Obstacle obstacle (input_obstacle, use_read_obstacle); - std::vector vertex_touched (dof_handler.n_dofs (), false); + std::vector vertex_touched(dof_handler.n_dofs(), false); typename DoFHandler::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); - TrilinosWrappers::MPI::Vector distributed_solution (system_rhs_newton); + TrilinosWrappers::MPI::Vector distributed_solution(system_rhs_newton); distributed_solution = solution; - TrilinosWrappers::MPI::Vector lambda (solution); + TrilinosWrappers::MPI::Vector lambda(solution); lambda = resid_vector; - TrilinosWrappers::MPI::Vector diag_mass_matrix_vector_relevant (solution); + TrilinosWrappers::MPI::Vector diag_mass_matrix_vector_relevant(solution); diag_mass_matrix_vector_relevant = diag_mass_matrix_vector; - constraints.reinit(locally_relevant_dofs); - active_set.clear (); - IndexSet active_set_locally_owned; - active_set_locally_owned.set_size (locally_owned_dofs.size ()); - const double c = 100.0*e_modul; - - for (; cell!=endc; ++cell) - if (cell->is_locally_owned()) - for (unsigned int face=0; face::faces_per_cell; ++face) - if (cell->face (face)->at_boundary() - && cell->face (face)->boundary_indicator () == 9) - for (unsigned int v=0; v::vertices_per_cell; ++v) - { - unsigned int index_z = cell->face (face)->vertex_dof_index (v,2); - - if (vertex_touched[cell->face (face)->vertex_index(v)] == false) - vertex_touched[cell->face (face)->vertex_index(v)] = true; - else - continue; - - // the local row where - Point point (cell->face (face)->vertex (v)[0], - cell->face (face)->vertex (v)[1], - cell->face (face)->vertex (v)[2]); - - double obstacle_value = obstacle.value (point, 2); - double solution_index_z = solution (index_z); - double gap = obstacle_value - point (2); - - -// std::cout << "lambda = " << lambda (index_z) -// << ", solution_index_z - gap = " << solution_index_z - gap -// << ", diag_mass_matrix_vector_relevant = " << diag_mass_matrix_vector_relevant (index_z) -// << std::endl; - - if (lambda (index_z) + - c * - diag_mass_matrix_vector_relevant (index_z) * - (solution_index_z - gap) - > 0 && - !(constraints_hanging_nodes.is_constrained(index_z))) - { - constraints.add_line (index_z); - constraints.set_inhomogeneity (index_z, gap); - - distributed_solution (index_z) = gap; + all_constraints.reinit(locally_relevant_dofs); + active_set.clear(); + IndexSet active_set_locally_owned; + active_set_locally_owned.set_size(locally_owned_dofs.size()); + const double c = 100.0 * e_modulus; + + Quadrature face_quadrature(fe.get_unit_face_support_points()); + FEFaceValues fe_values_face(fe, face_quadrature, + update_quadrature_points); + + const unsigned int dofs_per_face = fe.dofs_per_face; + const unsigned int n_face_q_points = face_quadrature.size(); + + std::vector dof_indices(dofs_per_face); + + // pcout<< "dofs_per_face = " << dofs_per_face + // << "n_face_q_points = " << n_face_q_points + // <is_artificial()) + for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; + ++face) + if (cell->face(face)->at_boundary() + && cell->face(face)->boundary_indicator() == 1) + { + fe_values_face.reinit(cell, face); + cell->face(face)->get_dof_indices(dof_indices); - if (locally_relevant_dofs.is_element (index_z)) - active_set.add_index (index_z); + for (unsigned int q_point = 0; q_point < n_face_q_points; + ++q_point) + { + unsigned int component = fe.face_system_to_component_index( + q_point).first; - if (locally_owned_dofs.is_element (index_z)) - active_set_locally_owned.add_index (index_z); - } - } - distributed_solution.compress (VectorOperation::insert); + if (component == 2) + { + unsigned int index_z = dof_indices[q_point]; + + if (vertex_touched[index_z] == false) + vertex_touched[index_z] = true; + else + continue; + + // the local row where + Point point( + fe_values_face.quadrature_point(q_point)); + + double obstacle_value = obstacle->value(point, 2); + double solution_index_z = solution(index_z); + double gap = obstacle_value - point(2); + + if (lambda(index_z) + / diag_mass_matrix_vector_relevant(index_z) + + c * (solution_index_z - gap) > 0 + && !(constraints_hanging_nodes.is_constrained(index_z))) + { + all_constraints.add_line(index_z); + all_constraints.set_inhomogeneity(index_z, gap); + distributed_solution(index_z) = gap; + + if (locally_owned_dofs.is_element(index_z)) + { + active_set_locally_owned.add_index(index_z); + if (locally_relevant_dofs.is_element(index_z)) + active_set.add_index(index_z); + } + + } + else if (lambda(index_z) + / diag_mass_matrix_vector_relevant(index_z) + + c * (solution_index_z - gap) > 0 + && constraints_hanging_nodes.is_constrained(index_z)) + { + if (locally_owned_dofs.is_element(index_z)) + counter_hanging_nodes += 1; + } + } + } + } + distributed_solution.compress(VectorOperation::insert); - unsigned int sum_contact_constraints = Utilities::MPI::sum(active_set_locally_owned.n_elements (), - mpi_communicator); - pcout << " Size of active set: " << sum_contact_constraints < - void PlasticityContactProblem::dirichlet_constraints () + void + PlasticityContactProblem::dirichlet_constraints () { /* boundary_indicators: - _______ - / 9 /| - /______ / | - 8| | 8| - | 8 | / - |_______|/ - 6 + _______ + / 1 /| + /______ / | + 8| | 8| + | 8 | / + |_______|/ + 6 */ - constraints_dirichlet_hanging_nodes.reinit (locally_relevant_dofs); - constraints_dirichlet_hanging_nodes.merge (constraints_hanging_nodes); + constraints_dirichlet_and_hanging_nodes.reinit(locally_relevant_dofs); + constraints_dirichlet_and_hanging_nodes.merge(constraints_hanging_nodes); // interpolate all components of the solution - VectorTools::interpolate_boundary_values (dof_handler, - 6, - EquationData::BoundaryValues(), - constraints_dirichlet_hanging_nodes, - ComponentMask()); + VectorTools::interpolate_boundary_values(dof_handler, + base_mesh == "box" ? 6 : 0, EquationData::BoundaryValues(), + constraints_dirichlet_and_hanging_nodes, ComponentMask()); // interpolate x- and y-components of the // solution (this is a bit mask, so apply // operator| ) - FEValuesExtractors::Scalar x_displacement(0); - FEValuesExtractors::Scalar y_displacement(1); - VectorTools::interpolate_boundary_values (dof_handler, - 8, - EquationData::BoundaryValues(), - constraints_dirichlet_hanging_nodes, - (fe.component_mask(x_displacement) - | - fe.component_mask(y_displacement))); - constraints_dirichlet_hanging_nodes.close (); + const FEValuesExtractors::Scalar x_displacement(0); + const FEValuesExtractors::Scalar y_displacement(1); + VectorTools::interpolate_boundary_values(dof_handler, 8, + EquationData::BoundaryValues(), + constraints_dirichlet_and_hanging_nodes, + (fe.component_mask(x_displacement) | fe.component_mask(y_displacement))); + constraints_dirichlet_and_hanging_nodes.close(); } - // @sect4{PlasticityContactProblem::solve} +// @sect4{PlasticityContactProblem::solve} - // In addition to step-41 we have - // to deal with the hanging node - // constraints. Again we also consider - // the locally_owned_dofs only by - // creating the vector distributed_solution. - // - // For the hanging nodes we have to apply - // the set_zero function to system_rhs_newton. - // This is necessary if a hanging node value x_0 - // has one neighbor which is in contact with - // value x_0 and one neighbor which is not with - // value x_1. This leads to an inhomogeneity - // constraint with value x_1/2 = gap/2 in the - // ConstraintMatrix. - // So the corresponding entries in the - // ride-hang-side are non-zero with a - // meaningless value. These values have to - // to set to zero. - - // The rest of the function is similar to - // step-41 except that we use a FGMRES-solver - // instead of CG. For a very small hardening - // value gamma the linear system becomes - // almost semi definite but still symmetric. +// In addition to step-41 we have +// to deal with the hanging node +// constraints. Again we also consider +// the locally_owned_dofs only by +// creating the vector distributed_solution. +// +// For the hanging nodes we have to apply +// the set_zero function to system_rhs_newton. +// This is necessary if a hanging node value x_0 +// has one neighbor which is in contact with +// value x_0 and one neighbor which is not with +// value x_1. This leads to an inhomogeneity +// constraint with value x_1/2 = gap/2 in the +// ConstraintMatrix. +// So the corresponding entries in the +// ride-hang-side are non-zero with a +// meaningless value. These values have to +// to set to zero. + +// The rest of the function is similar to +// step-41 except that we use a FGMRES-solver +// instead of CG. For a very small hardening +// value gamma the linear system becomes +// almost semi definite but still symmetric. template - void PlasticityContactProblem::solve () + void + PlasticityContactProblem::solve () { - computing_timer.enter_section ("Solve"); + TimerOutput::Scope t(computing_timer, "Solve"); - TrilinosWrappers::MPI::Vector distributed_solution (system_rhs_newton); + TrilinosWrappers::MPI::Vector distributed_solution(system_rhs_newton); distributed_solution = solution; - constraints_hanging_nodes.set_zero (distributed_solution); - constraints_hanging_nodes.set_zero (system_rhs_newton); + constraints_hanging_nodes.set_zero(distributed_solution); + constraints_hanging_nodes.set_zero(system_rhs_newton); distributed_solution.compress(VectorOperation::insert); system_rhs_newton.compress(VectorOperation::insert); - computing_timer.enter_section("Solve: setup preconditioner"); - - preconditioner_u.initialize (system_matrix_newton, additional_data); - - computing_timer.exit_section("Solve: setup preconditioner"); - - computing_timer.enter_section("Solve: iterate"); - - PrimitiveVectorMemory mem; - TrilinosWrappers::MPI::Vector tmp (system_rhs_newton); - const double solver_tolerance = 1e-3 * - system_matrix_newton.residual (tmp, distributed_solution, system_rhs_newton); - -// SolverControl solver_control (system_matrix_newton.m(), solver_tolerance); -// SolverFGMRES -// solver(solver_control, mem, -// SolverFGMRES:: -// AdditionalData(30, true)); -// -// solver.solve(system_matrix_newton, distributed_solution, system_rhs_newton, preconditioner_u); -// -// pcout << " Error: " << solver_control.initial_value() -// << " -> " << solver_control.last_value() -// << " in " << solver_control.last_step() -// << " FGMRES iterations." -// << std::endl; - - SolverControl solver_control (system_matrix_newton.m(), solver_tolerance); - SolverBicgstab - solver(solver_control, mem, - SolverBicgstab:: - AdditionalData(false, 1.e-10)); - - solver.solve(system_matrix_newton, distributed_solution, system_rhs_newton, preconditioner_u); - - pcout << " Error: " << solver_control.initial_value() - << " -> " << solver_control.last_value() - << " in " << solver_control.last_step() - << " Bicgstab iterations." - << std::endl; - - computing_timer.exit_section("Solve: iterate"); + TrilinosWrappers::PreconditionAMG preconditioner; + { + TimerOutput::Scope t(computing_timer, "Solve: setup preconditioner"); + + std::vector < std::vector > constant_modes; + DoFTools::extract_constant_modes(dof_handler, ComponentMask(), + constant_modes); + + TrilinosWrappers::PreconditionAMG::AdditionalData additional_data; + additional_data.constant_modes = constant_modes; + additional_data.elliptic = true; + additional_data.n_cycles = 1; + additional_data.w_cycle = false; + additional_data.output_details = false; + additional_data.smoother_sweeps = 2; + additional_data.aggregation_threshold = 1e-2; + + preconditioner.initialize(system_matrix_newton, additional_data); + } - number_iterations += solver_control.last_step(); + { + TimerOutput::Scope t(computing_timer, "Solve: iterate"); + + PrimitiveVectorMemory mem; + TrilinosWrappers::MPI::Vector tmp(system_rhs_newton); + // 1e-4 seems to be the fasted option altogether, but to get more + // reproducible parallel benchmark results, we use a small residual: + double relative_accuracy = 1e-8; + if (output_dir.compare("its/") == 0) + relative_accuracy = 1e-4; + + const double solver_tolerance = relative_accuracy + * system_matrix_newton.residual(tmp, distributed_solution, + system_rhs_newton); + + SolverControl solver_control(system_matrix_newton.m(), + solver_tolerance); + SolverBicgstab solver(solver_control, + mem/*, + SolverFGMRES:: + AdditionalData(30, true)*/); + solver.solve(system_matrix_newton, distributed_solution, + system_rhs_newton, preconditioner); + + pcout << " Error: " << solver_control.initial_value() + << " -> " << solver_control.last_value() << " in " + << solver_control.last_step() << " Bicgstab iterations." + << std::endl; + } - constraints.distribute (distributed_solution); + all_constraints.distribute(distributed_solution); solution = distributed_solution; - - computing_timer.exit_section("Solve"); } - // @sect4{PlasticityContactProblem::solve_newton} +// @sect4{PlasticityContactProblem::solve_newton} - // In this function the damped Newton method is implemented. - // That means two nested loops: the outer loop for the newton - // iteration and the inner loop for the damping steps which - // will be used only if necessary. To obtain a good and reasonable - // starting value we solve an elastic problem in very first step (j=1). +// In this function the damped Newton method is implemented. +// That means two nested loops: the outer loop for the newton +// iteration and the inner loop for the damping steps which +// will be used only if necessary. To obtain a good and reasonable +// starting value we solve an elastic problem in very first step (j=1). template - void PlasticityContactProblem::solve_newton () + void + PlasticityContactProblem::solve_newton () { - double resid=0; - double resid_old=100000; - TrilinosWrappers::MPI::Vector old_solution (system_rhs_newton); - TrilinosWrappers::MPI::Vector res (system_rhs_newton); - TrilinosWrappers::MPI::Vector tmp_vector (system_rhs_newton); + TimerOutput::Scope t(computing_timer, "solve newton setup"); - std::vector > constant_modes; - DoFTools::extract_constant_modes (dof_handler, - ComponentMask(), - constant_modes); + double resid = 0; + double resid_old = 100000; + TrilinosWrappers::MPI::Vector old_solution(system_rhs_newton); + TrilinosWrappers::MPI::Vector res(system_rhs_newton); + TrilinosWrappers::MPI::Vector tmp_vector(system_rhs_newton); double sigma_hlp = sigma_0; - additional_data.constant_modes = constant_modes; - additional_data.elliptic = true; - additional_data.n_cycles = 1; - additional_data.w_cycle = false; - additional_data.output_details = false; - additional_data.smoother_sweeps = 2; - additional_data.aggregation_threshold = 1e-2; + IndexSet active_set_old(active_set); + + t.stop(); // stop newton setup timer - IndexSet active_set_old (active_set); unsigned int j = 1; unsigned int number_assemble_system = 0; - for (; j<=100; j++) + for (; j <= 100; j++) { - if (j == 1 && cycle == 0) - plast_lin_hard->set_sigma_0 (1e+10); - else if (j == 2 || cycle > 0) - plast_lin_hard->set_sigma_0 (sigma_hlp); + if (transfer_solution) + { + if (transfer_solution && j == 1 && current_refinement_cycle == 0) + constitutive_law.set_sigma_0(1e+10); + else if (transfer_solution && (j == 2 || current_refinement_cycle > 0)) + constitutive_law.set_sigma_0(sigma_hlp); + } + else + { + if (j == 1) + constitutive_law.set_sigma_0(1e+10); + else + constitutive_law.set_sigma_0(sigma_hlp); + } - pcout << " " <(i)); + a = std::pow(0.5, static_cast(i)); old_solution = tmp_vector; - old_solution.sadd(1-a,a, distributed_solution); - old_solution.compress (VectorOperation::add); + old_solution.sadd(1 - a, a, distributed_solution); + old_solution.compress(VectorOperation::add); - computing_timer.enter_section("Residual and lambda"); + TimerOutput::Scope t(computing_timer, "Residual and lambda"); system_rhs_newton = 0; + system_rhs_lambda = 0; solution = old_solution; - residual_nl_system (solution); + compute_nonlinear_residual(solution); res = system_rhs_newton; - const unsigned int - start_res = (res.local_range().first), - end_res = (res.local_range().second); - for (unsigned int n=start_res; n data_out; - data_out.attach_dof_handler (dof_handler); - - const std::vector - data_component_interpretation - (dim, DataComponentInterpretation::component_is_part_of_vector); - data_out.add_data_vector (solution, std::vector(dim, "Displacement"), - DataOut::type_dof_data, - data_component_interpretation); - data_out.add_data_vector (lambda, std::vector(dim, "Residual"), - DataOut::type_dof_data, - data_component_interpretation); - data_out.add_data_vector (active_set, std::vector(dim, "ActiveSet"), - DataOut::type_dof_data, - data_component_interpretation); - - Vector subdomain (triangulation.n_active_cells()); - for (unsigned int i=0; i data_component_interpretation( + dim, DataComponentInterpretation::component_is_part_of_vector); + data_out.add_data_vector(solution, + std::vector < std::string > (dim, "Displacement"), + DataOut::type_dof_data, data_component_interpretation); + data_out.add_data_vector(lambda, + std::vector < std::string > (dim, "ContactForce"), + DataOut::type_dof_data, data_component_interpretation); + data_out.add_data_vector(active_set, + std::vector < std::string > (dim, "ActiveSet"), + DataOut::type_dof_data, data_component_interpretation); + data_out.add_data_vector(resid_vector_relevant, + std::vector < std::string > (dim, "Residual"), + DataOut::type_dof_data, data_component_interpretation); + + Vector subdomain(triangulation.n_active_cells()); + for (unsigned int i = 0; i < subdomain.size(); ++i) subdomain(i) = triangulation.locally_owned_subdomain(); - data_out.add_data_vector (subdomain, "subdomain"); + data_out.add_data_vector(subdomain, "subdomain"); - data_out.add_data_vector (cell_constitution, "CellConstitution"); + data_out.add_data_vector(fraction_of_plastic_q_points_per_cell, "FractionOfPlasticQPoints"); - data_out.build_patches (); + data_out.build_patches(); - const std::string filename = (title + "-" + - Utilities::int_to_string - (triangulation.locally_owned_subdomain(), 4)); + const std::string filename = + (output_dir + filename_base + "-" + + Utilities::int_to_string(triangulation.locally_owned_subdomain(), 4)); - std::ofstream output_vtu ((filename + ".vtu").c_str ()); - data_out.write_vtu (output_vtu); + std::ofstream output_vtu((filename + ".vtu").c_str()); + data_out.write_vtu(output_vtu); + pcout << output_dir + filename_base << ".pvtu" << std::endl; if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0) { - std::vector filenames; - for (unsigned int i=0; - i filenames; + for (unsigned int i = 0; + i < Utilities::MPI::n_mpi_processes(mpi_communicator); ++i) + filenames.push_back( + filename_base + "-" + Utilities::int_to_string(i, 4) + ".vtu"); + + std::ofstream master_output((output_dir + filename_base + ".pvtu").c_str()); + data_out.write_pvtu_record(master_output, filenames); } - TrilinosWrappers::MPI::Vector tmp (solution); + TrilinosWrappers::MPI::Vector tmp(solution); tmp *= -1; - move_mesh (tmp); + move_mesh(tmp); } - - +// @sect4{PlasticityContactProblem::output_contact_force} + +// This function provides the contact force by calculating +// an integral over the contact pressure in z-directions +// over the contact area. For this purpose we set the contact +// pressure lambda to 0 for all inactive dofs. For all +// active dofs we lambda contains the quotient of the nonlinear +// residual (resid_vector) and corresponding diagonal entry +// of the mass matrix (diag_mass_matrix_vector). Because it is +// not unlikely that hanging nodes shows up in the contact area +// it is important to apply contraints_hanging_nodes.distribute +// to the distributed_lambda vector. +// To calculate the contact pressure in a certain point in the +// contact area, we apply the Functions::FEFieldFunction. +// In parallel this is a little tricky because we have to find the +// process with the right cell which contains this point. If +// a processor does not own the cell with the point we have to +// catch these cases. template - void PlasticityContactProblem::run () + void + PlasticityContactProblem::output_contact_force () const { - use_read_obstacle = false; - if (use_read_obstacle) - { - pcout << "Read the obstacle from a file." << std::endl; - input_obstacle.reset (new Input("obstacle_file.pbm")); - pcout << "Obstacle is available now." << std::endl; - } - - const unsigned int n_cycles = 6; - for (cycle=0; cycle, + TrilinosWrappers::MPI::Vector> solution_function(dof_handler, + solution); + std::cout.precision(10); + + Vector solution_p1(dim); + std::vector > solution_gradient_p1(dim); + + // Here we calculate the contact pressure as a vector lambda. + // If a dof is element of the active set lambda contains the + // nonlinear residual this dof divided by the according entry + // of the mass matrix. In all other dofs lambda will be set to + // zero. + TrilinosWrappers::MPI::Vector lambda(solution); + TrilinosWrappers::MPI::Vector distributed_lambda(system_rhs_newton); + const unsigned int start_res = (resid_vector.local_range().first), + end_res = (resid_vector.local_range().second); + for (unsigned int n = start_res; n < end_res; ++n) + if (all_constraints.is_inhomogeneously_constrained(n)) + distributed_lambda(n) = resid_vector(n) / diag_mass_matrix_vector(n); + else + distributed_lambda(n) = 0; + distributed_lambda.compress(VectorOperation::insert); + constraints_hanging_nodes.distribute(distributed_lambda); + lambda = distributed_lambda; + Functions::FEFieldFunction, + TrilinosWrappers::MPI::Vector> lambda_function(dof_handler, lambda); + + // Here we try to find the MPI-process which owns the cell + // with the point_of_interest. If it is the wrong MPI-process + // we catch this case and set point_found to false. + const Point point_of_interest(0.49, 0.5001, 1.0); + Vector contact_pressure_in_point(dim); + bool point_found = true; + + MPI_Barrier(MPI_COMM_WORLD); + try { - computing_timer.enter_section("Setup"); + lambda_function.vector_value(point_of_interest, + contact_pressure_in_point); + } + catch (const typename Functions::FEFieldFunction, + TrilinosWrappers::MPI::Vector>::ExcPointNotAvailableHere &) + { + point_found = false; + } - pcout << std::endl; - pcout << "Cycle " << cycle << ':' << std::endl; + if (point_found == true) + { + std::cout << "PoI contact pressure: " << contact_pressure_in_point(2) + << std::endl; + } - if (cycle == 0) - { - make_grid(); - } - else - { - computing_timer.enter_section("Setup: refine mesh"); - soltrans.reset (new parallel::distributed::SolutionTransfer(dof_handler)); - refine_grid (); - computing_timer.exit_section("Setup: refine mesh"); - } + // To obtain the contact force we have to compute an integral of the contact pressure + // in z-direction over the whole contact area. To be accurate enough we use the + // Gaussian quadrature rule with fe.degree + 1. + double contact_force = 0.0; + { + QGauss face_quadrature_formula(fe.degree + 1); - setup_system (); + FEFaceValues fe_values_face(fe, face_quadrature_formula, + update_values | update_quadrature_points | update_JxW_values); - if (cycle > 0) - { - TrilinosWrappers::MPI::Vector distributed_solution (system_rhs_newton); - distributed_solution = solution; - soltrans->interpolate(distributed_solution); - solution = distributed_solution; - } + const unsigned int n_face_q_points = face_quadrature_formula.size(); + + const FEValuesExtractors::Vector displacement(0); + + typename DoFHandler::active_cell_iterator cell = + dof_handler.begin_active(), endc = dof_handler.end(); + for (; cell != endc; ++cell) + if (cell->is_locally_owned()) + for (unsigned int face = 0; + face < GeometryInfo::faces_per_cell; ++face) + if (cell->face(face)->at_boundary() + && cell->face(face)->boundary_indicator() == 1) + { + fe_values_face.reinit(cell, face); + + std::vector > lambda_values(n_face_q_points); + fe_values_face[displacement].get_function_values(lambda, + lambda_values); - computing_timer.exit_section("Setup"); + for (unsigned int q_point = 0; q_point < n_face_q_points; + ++q_point) + { + contact_force += lambda_values[q_point][2] + * fe_values_face.JxW(q_point); + } + } + contact_force = Utilities::MPI::sum(contact_force, MPI_COMM_WORLD); + pcout << "Contact force = " << contact_force << std::endl; + } + MPI_Barrier(MPI_COMM_WORLD); + } + + + // @sect4{PlasticityContactProblem::run} + + // As in all other tutorial programs, the run() function contains + // the overall logic. There is not very much to it here: in essence, it + // performs the loops over all mesh refinement cycles, and within each, hands + // things over to the Newton solver in solve_newton() on the + // current mesh and calls the function that creates graphical output for + // the so-computed solution. It then outputs some statistics concerning both + // run times and memory consumption that has been collected over the course of + // computations on this mesh. + template + void + PlasticityContactProblem::run () + { + computing_timer.reset(); + for (current_refinement_cycle = 0; + current_refinement_cycle < n_refinement_cycles; + ++current_refinement_cycle) + { + { + TimerOutput::Scope t(computing_timer, "Setup"); - solve_newton (); + pcout << std::endl; + pcout << "Cycle " << current_refinement_cycle << ':' << std::endl; - pcout << " Writing graphical output..." << std::endl; - computing_timer.enter_section("Graphical output"); + if (current_refinement_cycle == 0) + { + make_grid(); + setup_system(); + } + else + { + TimerOutput::Scope t(computing_timer, "Setup: refine mesh"); + refine_grid(); + } + } - std::ostringstream filename_solution; - filename_solution << "solution-"; - filename_solution << cycle; - output_results (filename_solution.str ()); + solve_newton(); - computing_timer.exit_section("Graphical output"); + output_results((std::string("solution-") + + Utilities::int_to_string(current_refinement_cycle, 2)).c_str()); computing_timer.print_summary(); computing_timer.reset(); + + Utilities::System::MemoryStats stats; + Utilities::System::get_memory_stats(stats); + pcout << "Peak virtual memory used, resident in kB: " << stats.VmSize << " " + << stats.VmRSS << std::endl; + + if (base_mesh == "box") + output_contact_force(); } } } // @sect3{The main function} +// There really isn't much to the main() function. It looks +// like they always do: int main (int argc, char *argv[]) { using namespace dealii; using namespace Step42; - deallog.depth_console (0); - - Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv); - { - int _n_refinements_global = 3; - - if (argc == 2) - _n_refinements_global = atoi(argv[1]); + try + { + deallog.depth_console(0); + ParameterHandler prm; + PlasticityContactProblem<3>::declare_parameters(prm); + if (argc != 2) + { + std::cerr << "*** Call this program as <./step-42 input.prm>" << std::endl; + return 1; + } - PlasticityContactProblem<3> laplace_problem_3d (_n_refinements_global); - laplace_problem_3d.run (); - } + prm.read_input(argv[1]); + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv); + { + PlasticityContactProblem<3> problem(prm); + problem.run(); + } + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + } return 0; } diff --git a/deal.II/examples/step-43/CMakeLists.txt b/deal.II/examples/step-43/CMakeLists.txt index 96f94caed0..62b492245f 100644 --- a/deal.II/examples/step-43/CMakeLists.txt +++ b/deal.II/examples/step-43/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_TRILINOS) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_TRILINOS = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-43/doc/intro.dox b/deal.II/examples/step-43/doc/intro.dox index f0532e4bd1..658f1971f4 100644 --- a/deal.II/examples/step-43/doc/intro.dox +++ b/deal.II/examples/step-43/doc/intro.dox @@ -9,7 +9,7 @@ following publications (in particular in the second one): media. Computers & Fluids, 39:1585-1596, 2010 - Chih-Che Chueh, Ned Djilali, Wolfgang Bangerth. An h-adaptive operator splitting method for two-phase flow in 3D heterogeneous porous - media. Submitted. + media. SIAM Journal on Scientific Computing, 35:B149-B175, 2013. The implementation discussed here uses and extends parts of the step-21 and step-31 tutorial programs. @@ -548,13 +548,13 @@ cases are listed in the following table: CC Chueh, N Djilali and W Bangerth.
    An h-adaptive operator splitting method for two-phase flow in 3D heterogeneous porous media. -
    Submitted, 2012. +
    SIAM Journal on Scientific Computing, vol. 35 (2013), pp. B149-B175
  • M. Kronbichler, T. Heister, and W. Bangerth
    High Accuracy Mantle Convection Simulation through Modern Numerical Methods. -
    Submitted to Geophysics Journal International, 2011. +
    Geophysics Journal International, vol. 191 (2012), pp. 12-29
  • F Brezzi and M Fortin. @@ -568,7 +568,7 @@ Z Chen.
  • JL Guermond and R Pasquetti. -
    Entropy-based nonlinear viscosity for fourier approximations of +
    Entropy-based nonlinear viscosity for Fourier approximations of conservation laws.
    Comptes Rendus Mathematique, 346(13-14):801-806, 2008. diff --git a/deal.II/examples/step-43/step-43.cc b/deal.II/examples/step-43/step-43.cc index c1e6046961..5647ece9ec 100644 --- a/deal.II/examples/step-43/step-43.cc +++ b/deal.II/examples/step-43/step-43.cc @@ -1,14 +1,23 @@ -/* Author: Chih-Che Chueh, University of Victoria, 2010 */ -/* Wolfgang Bangerth, Texas A&M University, 2010 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2010-2012 by Chih-Che Chueh and the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2010 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Authors: Chih-Che Chueh, University of Victoria, 2010 + * Wolfgang Bangerth, Texas A&M University, 2010 + */ // @sect3{Include files} @@ -474,7 +483,7 @@ namespace Step43 // Unlike step-31, this step uses one more ConstraintMatrix object called // darcy_preconditioner_constraints. This constraint object is used only for // assembling the matrix for the Darcy preconditioner and includes hanging - // node constrants as well as Dirichlet boundary value constraints for the + // node constraints as well as Dirichlet boundary value constraints for the // pressure variable. We need this because we are building a Laplace matrix // for the pressure as an approximation of the Schur complement) which is // only positive definite if boundary conditions are applied. @@ -1501,7 +1510,7 @@ namespace Step43 // the run() function, the central one in this program. // // At the beginning of the function, we ask whether to solve the - // pressure-velocity part by evaluating the posteriori criterion (see the + // pressure-velocity part by evaluating the a posteriori criterion (see the // following function). If necessary, we will solve the pressure-velocity // part using the GMRES solver with the Schur complement block // preconditioner as is described in the introduction. @@ -2163,7 +2172,7 @@ namespace Step43 // // With the exception of the startup code that loops back to the beginning // of the function through the goto start_time_iteration label, - // everything should be relatively straightforward. In any case, it mimicks + // everything should be relatively straightforward. In any case, it mimics // the corresponding function in step-31. template void TwoPhaseFlowProblem::run () diff --git a/deal.II/examples/step-44/doc/intro.dox b/deal.II/examples/step-44/doc/intro.dox index 79b68b3582..d33136b696 100644 --- a/deal.II/examples/step-44/doc/intro.dox +++ b/deal.II/examples/step-44/doc/intro.dox @@ -13,7 +13,7 @@ The subject of this tutorial is nonlinear solid mechanics. Classical single-field approaches (see e.g. step-18) can not correctly describe the response of quasi-incompressible materials. The response is overly stiff; a phenomenon known as locking. Locking problems can be circumvented using a variety of alternative strategies. -One such straegy is the three-field formulation. +One such strategy is the three-field formulation. It is used here to model the three-dimensional, fully-nonlinear (geometrical and material) response of an isotropic continuum body. The material response is approximated as hyperelastic. Additionally, the three-field formulation employed is valid for quasi-incompressible as well as compressible materials. @@ -573,7 +573,7 @@ where @f} There are no derivatives of the pressure and dilatation (primary) variables present in the formulation. -Thus the discontinuous finite element interpolation of the pressure ana dilatation yields a block +Thus the discontinuous finite element interpolation of the pressure and dilatation yields a block diagonal matrix for $\mathbf{\mathsf{K}}_{\widetilde{p}\widetilde{J}}$, $\mathbf{\mathsf{K}}_{\widetilde{J}\widetilde{p}}$ and diff --git a/deal.II/examples/step-44/doc/results.dox b/deal.II/examples/step-44/doc/results.dox index 55e5746456..22756ccaa3 100644 --- a/deal.II/examples/step-44/doc/results.dox +++ b/deal.II/examples/step-44/doc/results.dox @@ -89,7 +89,7 @@ Much of the code in the tutorial has been developed based on the optimisations d discussed and demonstrated in Step-18 and others. With over 93% of the time being spent in the linear solver, it is obvious that it may be necessary to invest in a better solver for large three-dimensional problems. -The SSOR preconditioner is not multi-threaded but is effective for this class of solid problems. +The SSOR preconditioner is not multithreaded but is effective for this class of solid problems. It may be beneficial to investigate the use of another solver such as those available through the Trilinos library. diff --git a/deal.II/examples/step-44/step-44.cc b/deal.II/examples/step-44/step-44.cc index 187f6ccd55..c6cda8ee36 100644 --- a/deal.II/examples/step-44/step-44.cc +++ b/deal.II/examples/step-44/step-44.cc @@ -1,13 +1,25 @@ -/* Authors: Jean-Paul Pelteret, University of Cape Town, */ -/* Andrew McBride, University of Erlangen-Nuremberg, 2010 */ -/* */ -/* Copyright (C) 2010-2012 by the deal.II authors */ -/* & Jean-Paul Pelteret and Andrew McBride */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2010 - 2013 by the deal.II authors and + * & Jean-Paul Pelteret and Andrew McBride + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + +/* + * Authors: Jean-Paul Pelteret, University of Cape Town, + * Andrew McBride, University of Erlangen-Nuremberg, 2010 + */ + // We start by including all the necessary deal.II header files and some C++ // related ones. They have been discussed in detail in previous tutorial @@ -608,7 +620,7 @@ namespace Step44 } protected: - // Define constitutive model paramaters $\kappa$ (bulk modulus) and the + // Define constitutive model parameters $\kappa$ (bulk modulus) and the // neo-Hookean model parameter $c_1$: const double kappa; const double c_1; @@ -730,11 +742,11 @@ namespace Step44 // \textrm{Grad}\ \mathbf{u}$: Since $I$ has data type SymmetricTensor, // just writing I + Grad_u_n would convert the second // argument to a symmetric tensor, perform the sum, and then cast the - // result to a Tensor (i.e., the type of a possibly non-symmetric + // result to a Tensor (i.e., the type of a possibly nonsymmetric // tensor). However, since Grad_u_n is nonsymmetric in // general, the conversion to SymmetricTensor will fail. We can avoid this // back and forth by converting $I$ to Tensor first, and then performing - // the addition as between non-symmetric tensors: + // the addition as between nonsymmetric tensors: void update_values (const Tensor<2, dim> &Grad_u_n, const double p_tilde, const double J_tilde) @@ -873,7 +885,7 @@ namespace Step44 determine_component_extractors(); // Several functions to assemble the system and right hand side matrices - // using multi-threading. Each of them comes as a wrapper function, one + // using multithreading. Each of them comes as a wrapper function, one // that is executed to do the work in the WorkStream model on one cell, // and one that copies the work done on this one cell into the global // object that represents it: @@ -969,7 +981,7 @@ namespace Step44 std::vector > quadrature_point_history; // A description of the finite-element system including the displacement - // polynomial degree, the degree-of-freedom handler, number of dof's per + // polynomial degree, the degree-of-freedom handler, number of DoFs per // cell and the extractor objects used to retrieve information from the // solution vectors: const unsigned int degree; @@ -1552,7 +1564,7 @@ namespace Step44 block_component[J_component] = J_dof; // Dilatation // The DOF handler is then initialised and we renumber the grid in an - // efficient manner. We also record the number of DOF's per block. + // efficient manner. We also record the number of DOFs per block. dof_handler_ref.distribute_dofs(fe); DoFRenumbering::Cuthill_McKee(dof_handler_ref); DoFRenumbering::component_wise(dof_handler_ref, block_component); @@ -1727,7 +1739,7 @@ namespace Step44 // @sect4{Solid::update_qph_incremental} // As the update of QP information occurs frequently and involves a number of -// expensive operations, we define a multi-threaded approach to distributing +// expensive operations, we define a multithreaded approach to distributing // the task across a number of CPU cores. // // To start this, we first we need to obtain the total solution as it stands @@ -2550,7 +2562,7 @@ namespace Step44 // @sect4{Solid::solve_linear_system} // Solving the entire block system is a bit problematic as there are no // contributions to the $\mathsf{\mathbf{k}}_{ \widetilde{J} \widetilde{J}}$ -// block, rendering it non-invertible. +// block, rendering it noninvertible. // Since the pressure and dilatation variables DOFs are discontinuous, we can // condense them out to form a smaller displacement-only system which // we will then solve and subsequently post-process to retrieve the @@ -3161,7 +3173,7 @@ int main (int argc, char *argv[]) using namespace dealii; using namespace Step44; - Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv); + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, dealii::numbers::invalid_unsigned_int); try { diff --git a/deal.II/examples/step-45/step-45.cc b/deal.II/examples/step-45/step-45.cc index d2e11901f1..301a851e67 100644 --- a/deal.II/examples/step-45/step-45.cc +++ b/deal.II/examples/step-45/step-45.cc @@ -1,13 +1,22 @@ -/* Author: Markus Buerg, University of Karlsruhe, 2010 */ - -/* $Id$ */ -/* */ -/* 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2010 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Markus Buerg, University of Karlsruhe, 2010 + */ // @sect3{Include files} diff --git a/deal.II/examples/step-46/CMakeLists.txt b/deal.II/examples/step-46/CMakeLists.txt index a2c8f5fbc5..02ff830ab7 100644 --- a/deal.II/examples/step-46/CMakeLists.txt +++ b/deal.II/examples/step-46/CMakeLists.txt @@ -33,7 +33,7 @@ IF(NOT DEAL_II_WITH_UMFPACK) MESSAGE(FATAL_ERROR " Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_UMFPACK = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-46/doc/intro.dox b/deal.II/examples/step-46/doc/intro.dox index dd7a984fba..45d36183a7 100644 --- a/deal.II/examples/step-46/doc/intro.dox +++ b/deal.II/examples/step-46/doc/intro.dox @@ -290,7 +290,7 @@ points: - Implementing the bilinear form, and in particular dealing with the interface term, both in the matrix and the sparsity pattern. - Implementing Dirichlet boundary conditions on the external and - internal parts of the boundaryies + internal parts of the boundaries $\partial\Omega_f,\partial\Omega_s$. diff --git a/deal.II/examples/step-46/step-46.cc b/deal.II/examples/step-46/step-46.cc index 7fdc20b2a8..22a2696cde 100644 --- a/deal.II/examples/step-46/step-46.cc +++ b/deal.II/examples/step-46/step-46.cc @@ -1,13 +1,22 @@ -/* Author: Wolfgang Bangerth, Texas A&M University, 2011 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2011 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, Texas A&M University, 2011 + */ // @sect3{Include files} @@ -144,7 +153,7 @@ namespace Step46 // The following classes do as their names suggest. The boundary values for // the velocity are $\mathbf u=(0, \sin(\pi x))^T$ in 2d and $\mathbf u=(0, // 0, \sin(\pi x)\sin(\pi y))^T$ in 3d, respectively. The remaining boundary - // conditions for this problem are all homogenous and have been discussed in + // conditions for this problem are all homogeneous and have been discussed in // the introduction. The right hand side forcing term is zero for both the // fluid and the solid. template @@ -365,7 +374,7 @@ namespace Step46 // this end, we first have to set the active FE indices with the function // immediately above, then distribute degrees of freedom, and then determine // constraints on the linear system. The latter includes hanging node - // constraints as usual, but also the inhomogenous boundary values at the + // constraints as usual, but also the inhomogeneous boundary values at the // top fluid boundary, and zero boundary values along the perimeter of the // solid subdomain. template diff --git a/deal.II/examples/step-47/step-47.cc b/deal.II/examples/step-47/step-47.cc index de57709e15..87707ba908 100644 --- a/deal.II/examples/step-47/step-47.cc +++ b/deal.II/examples/step-47/step-47.cc @@ -1,13 +1,22 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 2000 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2011 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 2000 + */ #include @@ -439,7 +448,7 @@ namespace Step47 // To integrate the enriched elements we have to find the geometrical // decomposition of the original element in subelements. The subelements are // used to integrate the elements on both sides of the discontinuity. The -// disontinuity line is approximated by a piece-wise linear interpolation +// discontinuity line is approximated by a piece-wise linear interpolation // between the intersection of the discontinuity with the edges of the // elements. The vector level_set_values has the values of the level set // function at the vertices of the elements. From these values can be found by @@ -467,7 +476,7 @@ namespace Step47 // the sign of the level set function at the 4 nodes of the elements can // be positive + or negative - depending on the sign of the level set - // function we have the folloing three classes of decomposition type 1: + // function we have the following three classes of decomposition type 1: // ++++, ---- type 2: -+++, +-++, ++-+, +++-, +---, -+--, --+-, ---+ type // 3: +--+, ++--, +-+-, -++-, --++, -+-+ diff --git a/deal.II/examples/step-48/doc/intro.dox b/deal.II/examples/step-48/doc/intro.dox index 59b9fab473..6a89c11ca8 100644 --- a/deal.II/examples/step-48/doc/intro.dox +++ b/deal.II/examples/step-48/doc/intro.dox @@ -125,7 +125,7 @@ the indices_local_to_global variable contains the global indices of the DoFs that it is constrained to. Then, we have another variable constraint_indicator at hand that holds, for each cell, the local indices of DoFs that are constrained as well as -the identifer of the type of constraint. Actually, you will not see +the identifier of the type of constraint. Actually, you will not see these data structures in the example program since the class FEEvaluationGL takes care of the constraints without user interaction. diff --git a/deal.II/examples/step-48/doc/results.dox b/deal.II/examples/step-48/doc/results.dox index 52308a1754..213aced063 100644 --- a/deal.II/examples/step-48/doc/results.dox +++ b/deal.II/examples/step-48/doc/results.dox @@ -66,7 +66,7 @@ product.

    Parallel run in 3D

    -To demonstrate how the example scales for a parallel run and to demsonstrate +To demonstrate how the example scales for a parallel run and to demonstrate that hanging node constraints can be handled in an efficient way, we run the example in 3D with $\mathcal{Q}_4$ elements. First, we run it on a notebook with 2 cores (Sandy Bridge CPU) at 2.7 GHz. @@ -106,7 +106,7 @@ cluster with 2 nodes and each node runs 8 threads, we get the following times: @endcode We observe a considerable speedup over the notebook (16 cores versus 2 cores; -nonethess, one notebook core is considerably faster than one core of the +nonetheless, one notebook core is considerably faster than one core of the cluster because of a newer processor architecture). If we run the same program on 4 nodes with 8 threads on each node, we get: @code diff --git a/deal.II/examples/step-48/step-48.cc b/deal.II/examples/step-48/step-48.cc index 9e2f4a2466..95d9d67d9d 100644 --- a/deal.II/examples/step-48/step-48.cc +++ b/deal.II/examples/step-48/step-48.cc @@ -1,14 +1,22 @@ -/* $Id$ */ -/* Author: Katharina Kormann, Martin Kronbichler, Uppsala University, 2011-2012 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2011-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2011 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Katharina Kormann, Martin Kronbichler, Uppsala University, 2011-2012 + */ // The necessary files from the deal.II library. @@ -337,7 +345,7 @@ namespace Step48 // dimensions of extent $[-15,15]$. We refine the mesh more in the center of // the domain since the solution is concentrated there. We first refine all // cells whose center is within a radius of 11, and then refine once more - // for a radius 6. This is simple ad-hoc refinement could be done better by + // for a radius 6. This simple ad hoc refinement could be done better by // adapting the mesh to the solution using error estimators during the time // stepping as done in other example programs, and using // parallel::distributed::SolutionTransfer to transfer the solution to the @@ -473,8 +481,8 @@ namespace Step48 "solution-" + Utilities::int_to_string (timestep_number, 3); std::ofstream output ((filename + - "." + Utilities::int_to_string (Utilities::MPI:: - this_mpi_process(MPI_COMM_WORLD),4) + ".vtu").c_str()); + "." + Utilities::int_to_string (Utilities::MPI:: + this_mpi_process(MPI_COMM_WORLD),4) + ".vtu").c_str()); data_out.write_vtu (output); if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0) diff --git a/deal.II/examples/step-49/doc/intro.dox b/deal.II/examples/step-49/doc/intro.dox index 8bac7c1f8a..992764b57b 100644 --- a/deal.II/examples/step-49/doc/intro.dox +++ b/deal.II/examples/step-49/doc/intro.dox @@ -130,7 +130,7 @@ of the current program):

    Modifying a Mesh

    -After aquiring one (or several) meshes in the ways described above, there are +After acquiring one (or several) meshes in the ways described above, there are many ways to manipulate them before using them in a finite element computation. diff --git a/deal.II/examples/step-49/doc/results.dox b/deal.II/examples/step-49/doc/results.dox index 30e01d4f99..f418c219a4 100644 --- a/deal.II/examples/step-49/doc/results.dox +++ b/deal.II/examples/step-49/doc/results.dox @@ -1,7 +1,7 @@

    Results

    The program produces a series of .eps files of the -Triangulations. The methods are discussed above. +triangulations. The methods are discussed above.

    Next steps: Curved boundaries

    diff --git a/deal.II/examples/step-49/step-49.cc b/deal.II/examples/step-49/step-49.cc index 2592717ce2..a1139eb765 100644 --- a/deal.II/examples/step-49/step-49.cc +++ b/deal.II/examples/step-49/step-49.cc @@ -1,11 +1,21 @@ -/* $Id$ +/* --------------------------------------------------------------------- + * $Id$ * * Copyright (C) 2013 by the deal.II authors * - * This file is subject to QPL and may not be distributed - * without copyright and license information. Please refer - * to the file deal.II/doc/license.html for the text and - * further information on this license. + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Timo Heister, Texas A&M University, 2013 */ @@ -49,7 +59,7 @@ using namespace dealii; // format that can easily be visualized in the same way as was done in step-1. template void mesh_info(const Triangulation &tria, - const std::string &filename) + const std::string &filename) { std::cout << "Mesh info:" << std::endl << " dimension: " << dim << std::endl @@ -87,8 +97,8 @@ void mesh_info(const Triangulation &tria, GridOut grid_out; grid_out.write_eps (tria, out); std::cout << " written to " << filename - << std::endl - << std::endl; + << std::endl + << std::endl; } // @sect3{Main routines} @@ -129,7 +139,7 @@ void grid_2 () repetitions[1]=2; GridGenerator::subdivided_hyper_rectangle (tria2, repetitions, Point<2>(1.0,-1.0), - Point<2>(4.0,1.0)); + Point<2>(4.0,1.0)); Triangulation<2> triangulation; GridGenerator::merge_triangulations (tria1, tria2, triangulation); @@ -244,7 +254,7 @@ void grid_4() Point<2> grid_5_transform (const Point<2> &in) { return Point<2>(in(0), - in(1) + std::sin(in(0)/5.0*3.14159)); + in(1) + std::sin(in(0)/5.0*3.14159)); } @@ -256,7 +266,7 @@ void grid_5() repetitions[1] = 2; GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), - Point<2>(10.0,1.0)); + Point<2>(10.0,1.0)); GridTools::transform(&grid_5_transform, tria); mesh_info(tria, "grid-5.eps"); @@ -276,16 +286,16 @@ void grid_5() // vertices. struct Grid6Func { - double trans(const double y) const - { - return std::tanh(2*y)/tanh(2); - } + double trans(const double y) const + { + return std::tanh(2*y)/tanh(2); + } - Point<2> operator() (const Point<2> & in) const - { - return Point<2> (in(0), - trans(in(1))); - } + Point<2> operator() (const Point<2> &in) const + { + return Point<2> (in(0), + trans(in(1))); + } }; @@ -296,7 +306,7 @@ void grid_6() repetitions[0] = repetitions[1] = 40; GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), - Point<2>(1.0,1.0)); + Point<2>(1.0,1.0)); GridTools::transform(Grid6Func(), tria); mesh_info(tria, "grid-6.eps"); @@ -318,7 +328,7 @@ void grid_7() repetitions[0] = repetitions[1] = 16; GridGenerator::subdivided_hyper_rectangle (tria, repetitions, Point<2>(0.0,0.0), - Point<2>(1.0,1.0)); + Point<2>(1.0,1.0)); GridTools::distort_random (0.3, tria, true); mesh_info(tria, "grid-7.eps"); diff --git a/deal.II/examples/step-5/step-5.cc b/deal.II/examples/step-5/step-5.cc index 18dfd8036e..f1d146935b 100644 --- a/deal.II/examples/step-5/step-5.cc +++ b/deal.II/examples/step-5/step-5.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 1999 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 1999 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 1999 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 1999-2004, 2006-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -533,7 +543,7 @@ void Step5::output_results (const unsigned int cycle) const // The second to last thing in this program is the definition of the // run() function. In contrast to the previous programs, we will -// compute on a sequence of meshes that after each iteration is globall +// compute on a sequence of meshes that after each iteration is globally // refined. The function therefore consists of a loop over 6 cycles. In each // cycle, we first print the cycle number, and then have to decide what to do // with the mesh. If this is not the first cycle, we simply refine the diff --git a/deal.II/examples/step-50/CMakeLists.txt b/deal.II/examples/step-50/CMakeLists.txt index babcd817e0..3a16b1326e 100644 --- a/deal.II/examples/step-50/CMakeLists.txt +++ b/deal.II/examples/step-50/CMakeLists.txt @@ -11,9 +11,6 @@ SET(TARGET_SRC # You can specify additional files here! ) -# A custom command line to run the program -SET(TARGET_RUN mpirun -np 2 ${TARGET}) - # Define the output that should be cleaned: SET(CLEAN_UP_FILES *.vtu *.pvtu *.visit) @@ -43,7 +40,7 @@ Error! The deal.II library found at ${DEAL_II_PATH} was not configured with DEAL_II_WITH_MPI = ON DEAL_II_WITH_P4EST = ON DEAL_II_WITH_TRILINOS = ON -which is required for this tutorial step." +One or all of these are OFF in your installation but are required for this tutorial step." ) ENDIF() diff --git a/deal.II/examples/step-50/step-50.cc b/deal.II/examples/step-50/step-50.cc index c3ffb9c064..768281e4e7 100644 --- a/deal.II/examples/step-50/step-50.cc +++ b/deal.II/examples/step-50/step-50.cc @@ -1,17 +1,27 @@ -/* Author: Guido Kanschat, University of Heidelberg, 2003 */ -/* Baerbel Janssen, University of Heidelberg, 2010 */ -/* Wolfgang Bangerth, Texas A&M University, 2010 */ - -/* $Id$ */ -/* */ -/* Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ - -// parallel geometric multi-grid. work in progress! +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2003 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Guido Kanschat, University of Heidelberg, 2003 + * Baerbel Janssen, University of Heidelberg, 2010 + * Wolfgang Bangerth, Texas A&M University, 2010 + */ + + +// parallel geometric multigrid. work in progress! // As discussed in the introduction, most of // this program is copied almost verbatim @@ -72,7 +82,7 @@ #include // These, now, are the include necessary for -// the multi-level methods. The first two +// the multilevel methods. The first two // declare classes that allow us to enumerate // degrees of freedom not only on the finest // mesh level, but also on intermediate @@ -314,13 +324,13 @@ namespace Step50 deallog << "Number of degrees of freedom: " << mg_dof_handler.n_dofs(); - for (unsigned int l=0; l cell_matrix (dofs_per_cell, dofs_per_cell); Vector cell_rhs (dofs_per_cell); - std::vector local_dof_indices (dofs_per_cell); + std::vector local_dof_indices (dofs_per_cell); const Coefficient coefficient; std::vector coefficient_values (n_q_points); @@ -530,7 +540,7 @@ namespace Step50 // over all existing cells instead of just // the active ones, and the results must be // entered into the correct matrix. Note also - // that since we only do multi-level + // that since we only do multilevel // preconditioning, no right-hand side needs // to be assembled here. // @@ -551,72 +561,54 @@ namespace Step50 FullMatrix cell_matrix (dofs_per_cell, dofs_per_cell); - std::vector local_dof_indices (dofs_per_cell); + std::vector local_dof_indices (dofs_per_cell); const Coefficient coefficient; std::vector coefficient_values (n_q_points); - // Next a few things that are specific to - // building the multigrid data structures - // (since we only need them in the current - // function, rather than also elsewhere, we - // build them here instead of the - // setup_system - // function). Some of the following may be - // a bit obscure if you're not familiar - // with the algorithm actually implemented - // in deal.II to support multilevel - // algorithms on adaptive meshes; if some - // of the things below seem strange, take a - // look at the @ref mg_paper. + // Next a few things that are specific to building the multigrid + // data structures (since we only need them in the current + // function, rather than also elsewhere, we build them here + // instead of the setup_system function). Some of the + // following may be a bit obscure if you're not familiar with the + // algorithm actually implemented in deal.II to support multilevel + // algorithms on adaptive meshes; if some of the things below seem + // strange, take a look at the @ref mg_paper. // - // Our first job is to identify those - // degrees of freedom on each level that - // are located on interfaces between - // adaptively refined levels, and those - // that lie on the interface but also on - // the exterior boundary of the domain. As - // in many other parts of the library, we - // do this by using boolean masks, - // i.e. vectors of booleans each element of - // which indicates whether the - // corresponding degree of freedom index is - // an interface DoF or not. The MGConstraints - // already computed the information for us - // when we called initialize in setup_system(). + // Our first job is to identify those degrees of freedom on each + // level that are located on interfaces between adaptively refined + // levels, and those that lie on the interface but also on the + // exterior boundary of the domain. As in many other parts of the + // library, we do this by using Boolean masks, i.e. vectors of + // Booleans each element of which indicates whether the + // corresponding degree of freedom index is an interface DoF or + // not. The MGConstraints already computed the + // information for us when we called initialize in + // setup_system(). std::vector > interface_dofs = mg_constrained_dofs.get_refinement_edge_indices (); std::vector > boundary_interface_dofs = mg_constrained_dofs.get_refinement_edge_boundary_indices (); - // The indices just identified will later - // be used to decide where the assembled value - // has to be added into on each level. - // On the other hand, - // we also have to impose zero boundary - // conditions on the external boundary of - // each level. But this the MGConstraints - // knows it. So we simply ask for them by calling - // get_boundary_indices (). - // The third step is to construct - // constraints on all those degrees of - // freedom: their value should be zero - // after each application of the level - // operators. To this end, we construct - // ConstraintMatrix objects for each level, - // and add to each of these constraints for - // each degree of freedom. Due to the way - // the ConstraintMatrix stores its data, - // the function to add a constraint on a - // single degree of freedom and force it to - // be zero is called - // Constraintmatrix::add_line(); doing so - // for several degrees of freedom at once - // can be done using + // The indices just identified will later be used to decide where + // the assembled value has to be added into on each level. On the + // other hand, we also have to impose zero boundary conditions on + // the external boundary of each level. But this the + // MGConstraints knows it. So we simply ask for them + // by calling get_boundary_indices (). The third + // step is to construct constraints on all those degrees of + // freedom: their value should be zero after each application of + // the level operators. To this end, we construct ConstraintMatrix + // objects for each level, and add to each of these constraints + // for each degree of freedom. Due to the way the ConstraintMatrix + // stores its data, the function to add a constraint on a single + // degree of freedom and force it to be zero is called + // Constraintmatrix::add_line(); doing so for several degrees of + // freedom at once can be done using // Constraintmatrix::add_lines(): - std::vector boundary_constraints (triangulation.n_levels()); - std::vector boundary_interface_constraints (triangulation.n_levels()); - for (unsigned int level=0; level boundary_constraints (triangulation.n_global_levels()); + std::vector boundary_interface_constraints (triangulation.n_global_levels()); + for (unsigned int level=0; levelassemble_system, with two - // exceptions: (i) we don't need a right - // hand side, and more significantly (ii) we - // don't just loop over all active cells, - // but in fact all cells, active or - // not. Consequently, the correct iterator - // to use is MGDoFHandler::cell_iterator - // rather than - // MGDoFHandler::active_cell_iterator. Let's - // go about it: + // Now that we're done with most of our preliminaries, let's start + // the integration loop. It looks mostly like the loop in + // assemble_system, with two exceptions: (i) we don't + // need a right hand side, and more significantly (ii) we don't + // just loop over all active cells, but in fact all cells, active + // or not. Consequently, the correct iterator to use is + // MGDoFHandler::cell_iterator rather than + // MGDoFHandler::active_cell_iterator. Let's go about it: typename DoFHandler::cell_iterator cell = mg_dof_handler.begin(), endc = mg_dof_handler.end(); @@ -661,85 +647,60 @@ namespace Step50 fe_values.shape_grad(j,q_point) * fe_values.JxW(q_point)); - // The rest of the assembly is again - // slightly different. This starts with - // a gotcha that is easily forgotten: - // The indices of global degrees of - // freedom we want here are the ones - // for current level, not for the - // global matrix. We therefore need the - // function - // MGDoFAccessorLLget_mg_dof_indices, - // not MGDoFAccessor::get_dof_indices - // as used in the assembly of the - // global system: + // The rest of the assembly is again slightly + // different. This starts with a gotcha that is easily + // forgotten: The indices of global degrees of freedom we + // want here are the ones for current level, not for the + // global matrix. We therefore need the function + // MGDoFAccessorLLget_mg_dof_indices, not + // MGDoFAccessor::get_dof_indices as used in the assembly of + // the global system: cell->get_mg_dof_indices (local_dof_indices); - // Next, we need to copy local - // contributions into the level - // objects. We can do this in the same - // way as in the global assembly, using - // a constraint object that takes care - // of constrained degrees (which here - // are only boundary nodes, as the - // individual levels have no hanging - // node constraints). Note that the - // boundary_constraints - // object makes sure that the level - // matrices contains no contributions - // from degrees of freedom at the - // interface between cells of different + // Next, we need to copy local contributions into the level + // objects. We can do this in the same way as in the global + // assembly, using a constraint object that takes care of + // constrained degrees (which here are only boundary nodes, + // as the individual levels have no hanging node + // constraints). Note that the + // boundary_constraints object makes sure that + // the level matrices contains no contributions from degrees + // of freedom at the interface between cells of different // refinement level. boundary_constraints[cell->level()] .distribute_local_to_global (cell_matrix, local_dof_indices, mg_matrices[cell->level()]); - // The next step is again slightly more - // obscure (but explained in the @ref - // mg_paper): We need the remainder of - // the operator that we just copied - // into the mg_matrices - // object, namely the part on the - // interface between cells at the - // current level and cells one level - // coarser. This matrix exists in two - // directions: for interior DoFs (index - // $i$) of the current level to those - // sitting on the interface (index - // $j$), and the other way around. Of - // course, since we have a symmetric - // operator, one of these matrices is - // the transpose of the other. + // The next step is again slightly more obscure (but + // explained in the @ref mg_paper): We need the remainder of + // the operator that we just copied into the + // mg_matrices object, namely the part on the + // interface between cells at the current level and cells + // one level coarser. This matrix exists in two directions: + // for interior DoFs (index $i$) of the current level to + // those sitting on the interface (index $j$), and the other + // way around. Of course, since we have a symmetric + // operator, one of these matrices is the transpose of the + // other. // - // The way we assemble these matrices - // is as follows: since the are formed - // from parts of the local - // contributions, we first delete all - // those parts of the local - // contributions that we are not - // interested in, namely all those - // elements of the local matrix for - // which not $i$ is an interface DoF - // and $j$ is not. The result is one of - // the two matrices that we are - // interested in, and we then copy it - // into the - // mg_interface_matrices - // object. The - // boundary_interface_constraints - // object at the same time makes sure - // that we delete contributions from - // all degrees of freedom that are not - // only on the interface but also on - // the external boundary of the domain. + // The way we assemble these matrices is as follows: since + // the are formed from parts of the local contributions, we + // first delete all those parts of the local contributions + // that we are not interested in, namely all those elements + // of the local matrix for which not $i$ is an interface DoF + // and $j$ is not. The result is one of the two matrices + // that we are interested in, and we then copy it into the + // mg_interface_matrices object. The + // boundary_interface_constraints object at the + // same time makes sure that we delete contributions from + // all degrees of freedom that are not only on the interface + // but also on the external boundary of the domain. // - // The last part to remember is how to - // get the other matrix. Since it is - // only the transpose, we will later - // (in the solve() - // function) be able to just pass the - // transpose matrix where necessary. + // The last part to remember is how to get the other + // matrix. Since it is only the transpose, we will later (in + // the solve() function) be able to just pass + // the transpose matrix where necessary. for (unsigned int i=0; ilevel()][local_dof_indices[i]]==true && @@ -752,7 +713,7 @@ namespace Step50 mg_interface_matrices[cell->level()]); } - for (unsigned int i=0;i void LaplaceProblem::solve () { - // Create the object that deals with the transfer - // between different refinement levels. We need to - // pass it the hanging node constraints. + // Create the object that deals with the transfer between + // different refinement levels. We need to pass it the hanging + // node constraints. MGTransferPrebuilt mg_transfer(hanging_node_constraints, mg_constrained_dofs); - // Now the prolongation matrix has to be built. - // This matrix needs to take the boundary values on - // each level into account and needs to know about - // the indices at the refinement egdes. The - // MGConstraints knows about that so - // pass it as an argument. + // Now the prolongation matrix has to be built. This matrix needs + // to take the boundary values on each level into account and + // needs to know about the indices at the refinement edges. The + // MGConstraints knows about that so pass it as an + // argument. mg_transfer.build_matrices(mg_dof_handler); - matrix_t & coarse_matrix = mg_matrices[0]; + matrix_t &coarse_matrix = mg_matrices[0]; //coarse_matrix.copy_from (mg_matrices[0]); //MGCoarseGridHouseholder coarse_grid_solver; //coarse_grid_solver.initialize (coarse_matrix); @@ -822,38 +772,27 @@ namespace Step50 coarse_matrix, id); - // The next component of a multilevel - // solver or preconditioner is that we need - // a smoother on each level. A common - // choice for this is to use the - // application of a relaxation method (such - // as the SOR, Jacobi or Richardson method). The - // MGSmootherPrecondition class provides - // support for this kind of - // smoother. Here, we opt for the - // application of a single SOR - // iteration. To this end, we define an - // appropriate typedef and - // then setup a smoother object. + // The next component of a multilevel solver or preconditioner is + // that we need a smoother on each level. A common choice for this + // is to use the application of a relaxation method (such as the + // SOR, Jacobi or Richardson method). The MGSmootherPrecondition + // class provides support for this kind of smoother. Here, we opt + // for the application of a single SOR iteration. To this end, we + // define an appropriate typedef and then setup a + // smoother object. // - // The last step is to initialize the - // smoother object with our level matrices - // and to set some smoothing parameters. - // The initialize() function - // can optionally take additional arguments - // that will be passed to the smoother - // object on each level. In the current - // case for the SOR smoother, this could, - // for example, include a relaxation - // parameter. However, we here leave these - // at their default values. The call to - // set_steps() indicates that - // we will use two pre- and two - // post-smoothing steps on each level; to - // use a variable number of smoother steps - // on different levels, more options can be - // set in the constructor call to the - // mg_smoother object. + // The last step is to initialize the smoother object with our + // level matrices and to set some smoothing parameters. The + // initialize() function can optionally take + // additional arguments that will be passed to the smoother object + // on each level. In the current case for the SOR smoother, this + // could, for example, include a relaxation parameter. However, we + // here leave these at their default values. The call to + // set_steps() indicates that we will use two pre- + // and two post-smoothing steps on each level; to use a variable + // number of smoother steps on different levels, more options can + // be set in the constructor call to the mg_smoother + // object. // // The last step results from the fact that // we use the SOR method as a smoother - @@ -905,35 +844,35 @@ namespace Step50 // With all this together, we can finally // get about solving the linear system in // the usual way: - SolverControl solver_control (500, 1e-12, false); + SolverControl solver_control (500, 1e-8*system_rhs.l2_norm(), false); SolverCG cg (solver_control); solution = 0; if (false) { - // code to optionally compare to Trilinos ML - TrilinosWrappers::PreconditionAMG prec; - - TrilinosWrappers::PreconditionAMG::AdditionalData Amg_data; - // Amg_data.constant_modes = constant_modes; - Amg_data.elliptic = true; - Amg_data.higher_order_elements = true; - Amg_data.smoother_sweeps = 2; - Amg_data.aggregation_threshold = 0.02; - // Amg_data.symmetric = true; - - prec.initialize (system_matrix, - Amg_data); - cg.solve (system_matrix, solution, system_rhs, - prec); + // code to optionally compare to Trilinos ML + TrilinosWrappers::PreconditionAMG prec; + + TrilinosWrappers::PreconditionAMG::AdditionalData Amg_data; + // Amg_data.constant_modes = constant_modes; + Amg_data.elliptic = true; + Amg_data.higher_order_elements = true; + Amg_data.smoother_sweeps = 2; + Amg_data.aggregation_threshold = 0.02; + // Amg_data.symmetric = true; + + prec.initialize (system_matrix, + Amg_data); + cg.solve (system_matrix, solution, system_rhs, + prec); } else { - cg.solve (system_matrix, solution, system_rhs, - preconditioner); + cg.solve (system_matrix, solution, system_rhs, + preconditioner); } - + constraints.distribute (solution); } @@ -965,15 +904,16 @@ namespace Step50 TrilinosWrappers::MPI::Vector temp_solution; temp_solution.reinit(locally_relevant_set, MPI_COMM_WORLD); temp_solution = solution; - + KellyErrorEstimator::estimate (static_cast&>(mg_dof_handler), QGauss(3), typename FunctionMap::type(), temp_solution, estimated_error_per_cell); - GridRefinement::refine_and_coarsen_fixed_number (triangulation, - estimated_error_per_cell, - 0.3, 0.03); + parallel::distributed::GridRefinement:: + refine_and_coarsen_fixed_fraction (triangulation, + estimated_error_per_cell, + 0.3, 0.03); triangulation.execute_coarsening_and_refinement (); } @@ -1063,7 +1003,7 @@ namespace Step50 triangulation.refine_global (3); } else - refine_grid (); + refine_grid (); deallog << " Number of active cells: " << triangulation.n_global_active_cells() @@ -1074,9 +1014,9 @@ namespace Step50 deallog << " Number of degrees of freedom: " << mg_dof_handler.n_dofs() << " (by level: "; - for (unsigned int level=0; level + + +This program was contributed by Martin Kronbichler and Scott Miller. + + +
    +

    Introduction

    + +This tutorial program presents the implementation of a hybridizable +discontinuous Galkerin method for the convection-diffusion equation. + +

    Hybridizable discontinuous Galerkin methods

    + +One common argument against the use of discontinuous Galerkin elements +is the large number of globally coupled degrees of freedom that one +must solve in an implicit system. This is because, unlike continuous finite +elements, in typical discontinuous elements there is one degree of freedom at +each vertex for each of the adjacent elements, rather than just one, +and similarly for edges and faces. As an example of how fast the number of +unknowns grows, +consider the FE_DGP_Monomial basis: each +scalar solution component is represented by polynomials of degree $p$ +with $(1/dim!)*\prod_{i=1}^{dim}(p+i)$ degrees of freedom per +element. Typically, all degrees of freedom in an element are coupled +to all of the degrees of freedom in the adjacent elements. The resulting +discrete equations yield very large linear systems very quickly, especially +for systems of equations in 2 or 3 dimensions. + +

    Reducing the size of the linear system

    +To alleviate the computational cost of solving such large linear systems, +the hybridizable discontinuous Galerkin (HDG) methodology was introduced +by Cockburn and co-workers +(see the references in the recent HDG overview article by + N.C. Nguyen and J. Peraire: + Hybridizable discontinuous Galerkin methods for partial differential + equations in continuum mechanics, Journal of Computational Physics, + 2012, 231:18, 5955-5988. + [DOI]). +The HDG method achieves +this goal by formulating the mathematical problem using Dirichlet-to-Neumann +mappings. The partial differential equations are first written as a first +order system, and each field is then discretized via a DG method. At this +point the single-valued "trace" values on the skeleton of the +mesh, i.e. element faces, are taken to be independent unknown quantities. +The Dirichlet-to-Neumann map concept then permits the following solution procedure: +
      +
    1. Use local element interior data to enforce a Neumann condition on the +skeleton of the triangulation. The global problem is then to solve for the +trace values, which are the only globally coupled unknowns. +
    2. Use the known skeleton values as Dirichlet data for solving local +element-level solutions. This is known as the +'local solver', and is an embarrassingly parallel element-by-element +solution process. +
    + +The above procedure also has a linear algebra interpretation and is referred to +as static condensation. Let us write the complete linear system associated to +the HDG problem as a block system with the discrete DG variables U as +first block and the skeleton variables $\Lambda$ as the second block: +@f{eqnarray*} +\begin{pmatrix} A & B \\ C & D \end{pmatrix} +\begin{pmatrix} U \\ \Lambda \end{pmatrix} += +\begin{pmatrix} F \\ G \end{pmatrix}. +@f} +Our aim is now to eliminate the U block with a Schur complement +approach similar to step-20, which results in the following two steps: +@f{eqnarray*} +(D - C A^{-1} B) \Lambda &=& G - C A^{-1} F, \\ +A U &=& F - B \Lambda. +@f} +The point is that the presence of $A^{-1}$ is not a problem because $A$ is a +block diagonal matrix where each block corresponds to one cell and is +therefore easy enough to invert. +The coupling to other cells is introduced by the matrices +B and C over the skeleton variable. The block-diagonality of +A and the structure in B and C allow us to invert the +matrix A element by element (the local solution of the Dirichlet +problem) and subtract $CA^{-1}B$ from $D$. The steps in the Dirichlet-to-Neumann map concept hence correspond to +
      +
    1. constructing the Schur complement matrix $D-C A^{-1} B$ and right hand side $G - C A^{-1} F$ locally on each cell + and inserting the contribution into the global trace matrix in the usual way, +
    2. solving the Schur complement system for $\Lambda$, and +
    3. solving for U using the second equation, given $\Lambda$. +
    + + +

    Solution quality and rates of convergence

    +Another criticism of traditional DG methods is that the approximate fluxes +converge suboptimally. The local HDG solutions can be shown to converge +as $\mathcal{O}(h^{p+1})$, i.e., at optimal order. Additionally, a +super-convergence property can be used to post-process a new approximate +solution that converges at the rate $\mathcal{O}(h^{p+2})$. + + + +

    HDG applied to the convection-diffusion problem

    + +The HDG formulation used for this example is taken from +
    + + N.C. Nguyen, J. Peraire, B. Cockburn: + An implicit high-order hybridizable discontinuous Galerkin method + for linear convection–diffusion equations, + Journal of Computational Physics, 2009, 228:9, 3232-3254. + [DOI] + + +We consider the convection-diffusion equation over the domain $\Omega$ +with Dirichlet boundary $\partial \Omega_D$ and Neumann boundary +$\partial \Omega_N$: +@f{eqnarray*} + \nabla \cdot (\mathbf{c} u) - \nabla \cdot (\kappa \nabla u) &=& f, + \quad \text{ in } \Omega, \\ + u &=& g_D, \quad \text{ on } \partial \Omega_D, \\ + (\mathbf{c} u - \kappa \nabla u)\cdot \mathbf{n} &=& g_N, + \quad \text{ on } \partial \Omega_N. +@f} + +Introduce the auxiliary variable $\mathbf{q}=-\kappa \nabla u$ and rewrite +the above equation as the first order system: +@f{eqnarray*} + \mathbf{q} + \kappa \nabla u &=& 0, \quad \text{ in } \Omega, \\ + \nabla \cdot (\mathbf{c} u + \mathbf{q}) &=& f, \quad \text{ in } \Omega, \\ + u &=& g_D, \quad \text{ on } \partial \Omega_D, \\ + (\mathbf{q} + \mathbf{c}u)\cdot\mathbf{n} &=& g_N, + \quad \text{ on } \partial \Omega_N. +@f} + +We multiply these equations by the weight functions $\mathbf{v}, w$ +and integrate by parts over every element $K$ to obtain: +@f{eqnarray*} + (\mathbf{v}, \kappa^{-1} \mathbf{q})_K - (\nabla\cdot\mathbf{v}, u)_K + + \left<\mathbf{v}\cdot\mathbf{n}, \hat{u}\right>_{\partial K} &=& 0, \\ + - (\nabla w, \mathbf{c} u + \mathbf{q})_K + + \left<(w, \widehat{\mathbf{c} u}+\hat{\mathbf{q}})\cdot\mathbf{n}\right>_{\partial K} + &=& (w,f)_K. +@f} + +The terms decorated with a hat denote the numerical traces (also commonly referred +to as numerical fluxes). They are approximations +to the interior values on the boundary of the element. To ensure conservation, +these terms must be single-valued on any given element edge $\partial K$ even +though, with discontinuous shape functions, there may of course be multiple +values coming from the cells adjacent to an interface. +We eliminate the numerical trace $\hat{\mathbf{q}}$ by using traces of the form: +@f{eqnarray*} + \widehat{\mathbf{c} u}+\hat{\mathbf{q}} = \mathbf{c}\hat{u} + \mathbf{q} + + \tau(u - \hat{u})\mathbf{n} \quad \text{ on } \partial K. +@f} + +The variable $\hat {u}$ is introduced as an additional independent variable +and is the one for which we finally set up a globally coupled linear +system. As mentioned above, it is defined on the element faces and +discontinuous from one face to another. +Values for $u$ and $\mathbf{q}$ appearing in the numerical trace function +are taken to be the cell's interior solution restricted +to the boundary $\partial K$. + +The local stabilization parameter $\tau$ has effects on stability and accuracy +of HDG solutions; see the literature for a further discussion. A stabilization +parameter of unity is reported to be the choice which gives best results. A +stabilization parameter $\tau$ that tends to infinity prohibits jumps in the +solution over the element boundaries, making the HDG solution approach the +approximation with continuous finite elements. In the program below, we choose +the stabilization parameter as +@f{eqnarray*} + \tau = \frac{\kappa}{\ell} + |\mathbf{c} \cdot \mathbf{n}| +@f} +where we set the diffusion $\kappa=1$ and the diffusion length scale to +$\ell = \frac{1}{5}$. + +The trace/skeleton variables in HDG methods are single-valued on element +faces. As such, they must strongly represent the Dirichlet data on +$\partial\Omega_D$. This means that +@f{equation*} + \hat{u}|_{\partial \Omega_D} = g_D, +@f} +where the equal sign actually means an $L_2$ projection of the boundary +function $g$ onto the space of the face variables (e.g. linear functions on +the faces). This constraint is then applied to the skeleton variable $\hat{u}$ +using inhomogeneous constraints by the method +VectorTools::project_boundary_values. + +Summing the elemental +contributions across all elements in the triangulation, enforcing the normal +component of the numerical flux, and integrating by parts +on the equation weighted by $w$, we arrive at the final form of the problem: +Find $(\mathbf{q}_h, u_h, \hat{u}_h) \in +\mathcal{V}_h^p \times \mathcal{W}_h^p \times \mathcal{M}_h^p$ such that +@f{eqnarray*} + (\mathbf{v}, \kappa^{-1} \mathbf{q}_h)_{\mathcal{T}} + - ( \nabla\cdot\mathbf{v}, u_h)_{\mathcal{T}} + + \left<\mathbf{v}\cdot\mathbf{n}, \hat{u}_h\right>_{\partial\mathcal{T}} + &=& 0, + \quad \forall \mathbf{v} \in \mathcal{V}_h^p, +\\ + - (\nabla w, \mathbf{c} u_h)_{\mathcal{T}} + + (w, \nabla \cdot \mathbf{q}_h)_{\mathcal{T}} + + (w, (\mathbf{c}\cdot\mathbf{n}) \hat{u}_H)_{\mathcal{T}} + + \left_{\partial \mathcal{T}} + &=& + (w, f)_{\mathcal{T}}, + \quad \forall w \in \mathcal{W}_h^p, +\\ + \left< \mu, \hat{u}_h\mathbf{c} \cdot \mathbf{n} + + \mathbf{q}_h\cdot \mathbf{n} + + \tau (u_h - \hat{u}_h)\right>_{\partial \mathcal{T}} + &=& + \left<\mu, g_N\right>_{\partial\Omega_N}, + \quad \forall \mu \in \mathcal{M}_h^p. +@f} + +The unknowns $(\mathbf{q}_h, u_h)$ are referred to as local variables; they are +represented as standard DG variables. The unknown $\hat{u}_h$ is the skeleton +variable which has support on the codimension-1 surfaces (faces) of the mesh. + +We use the notation $(\cdot, \cdot)_{\mathcal{T}} = \sum_K (\cdot, \cdot)_K$ +to denote the sum of integrals over all cells and $\left<\cdot, +\cdot\right>_{\partial \mathcal{T}} = \sum_K \left<\cdot, +\cdot\right>_{\partial K}$ to denote integration over all faces of all cells, +i.e., interior faces are visited twice. When combining the contribution from +both elements sharing a face, the above equation yields terms familiar for DG +with jumps of the solution over the cell boundaries. + +In the equation above, the space $\mathcal {W}_h^{p}$ for the scalar variable +uh is defined as the space of functions that are tensor +product polynomials of degree p on each cell and discontinuous over the +element boundaries $\mathcal Q_{-p}$, i.e., the space described by +FE_DGQ(p). The space for the gradient or flux variable +qh is a vector element space where each component is +a locally polynomial and discontinuous $\mathcal Q_{-p}$. In the code below, +we collect these two local parts together in one FESystem where the first @p +dim components denote the gradient part and the last scalar component +corresponds to the scalar variable. For the skeleton component $\hat{u}_h$, we +define a space that consists of discontinuous tensor product polynomials that +live on the element faces, which in deal.II is implemented by the class +FE_FaceQ. This space is otherwise similar to FE_DGQ, i.e., the solution +function is not continuous between two neighboring faces, see also the results +section below for an illustration. + +In the weak form given above, we can note the following coupling patterns: +
      +
    1. The matrix $A$ consists of local-local coupling terms. These arise when the + local weighting functions $(\mathbf{v}, w)$ multiply the local solution terms + $(\mathbf{q}_h, u_h)$. +
    2. The matrix $B$ represents the local-face coupling. These are the terms + with weighting functions $(\mathbf{v}, w)$ multiplying the skeleton variable + $\hat{u}_h$. +
    3. The matrix $C$ represents the face-local coupling, which involves the + weighting function $\mu$ multiplying the local solutions $(\mathbf{q}_h, u_h)$. +
    4. The matrix $D$ is the face-face coupling; + terms involve both $\mu$ and $\hat{u}_h$. +
    + +

    Post-processing and super-convergence

    + +One special feature of the HDG methods is that they typically allow for +constructing an enriched solution that gains accuracy. This post-processing +takes the HDG solution in an element-by-element fashion and combines it such +that one can get $\mathcal O(h^{p+2})$ order of accuracy when using +polynomials of degree p. For this to happen, there are two necessary +ingredients: +
      +
    1. The computed solution gradient $\mathbf{q}_h$ converges at optimal rate, + i.e., $\mathcal{O}(h^{p+1})$. +
    2. The average of the scalar part of the solution, uh, + on each cell K super-converges at rate $\mathcal{O}(h^{p+2})$. +
    + +We now introduce a new variable $u_h^* \in \mathcal{V}_h^{p+1}$, which we find +by the expression $|\kappa \nabla u_h^* + \mathbf{q}_h|^2$ over the cell +K under the constraint $\left(1, u_h^*\right)_K &=& \left(1, +u_h\right)_K$. This translates to the following system of equations: +@f{eqnarray*} +\left(1, u_h^*\right)_K &=& \left(1, u_h\right)_K\\ +\left(\nabla w_h^*, \kappa \nabla u_h^*\right)_K &=& +-\left(\nabla w_h^*, \mathbf{q}_h\right)_K +\quad \text{for all } w_h^* \in \mathcal Q^{p+1}. +@f} + +Since we test by the whole set of basis functions in the space of tensor +product polynomials of degree p+1 in the second set of equations, this +is an overdetermined system with one more equation than unknowns. We fix this +in the code below by omitting one of these equations (since the rows in the +Laplacian are linearly dependent when representing a constant function). As we +will see below, this form of the post-processing gives the desired +super-convergence result with rate $\mathcal {O}(h^{p+2})$. It should be +noted that there is some freedom in constructing $u_h^*$ and this minimization +approach to extract the information from the gradient is not the only one. In +particular, the post-processed solution defined here does not satisfy the +convection-diffusion equation in any sense. As an alternative, the paper by +Nguyen, Peraire and Cockburn cited above suggests another somewhat more +involved formula for convection-diffusion that can also post-process the flux +variable into an $H(\Omega,\mathrm{div})$-conforming variant and better +represents the local convection-diffusion operator when the diffusion is +small. We leave the implementation of a more sophisticated post-processing as +a possible extension to the interested reader. + +Note that for vector-valued problems, the post-processing works similarly. One +simply sets the constraint for the mean value of each vector component +separately and uses the gradient as the main source of information. + +

    Problem specific data

    + +For this tutorial program, we consider almost the same test case as in +step-7. The computational domain is $\Omega := [-1,1]^d$ and the exact +solution corresponds to the one in step-7, except for a scaling. We use the +following source centers xi for the exponentials +
      +
    • 1D: $\{x_i\}^1 = \{ -\frac{1}{3}, 0, \frac{1}{3} \}$, +
    • 2D: $\{\mathbf{x}_i\}^2 = \{ (-\frac{1}{2},\frac{1}{2}), + (-\frac{1}{2},-\frac{1}{2}), + (\frac{1}{2},-\frac{1}{2}) + \}$, +
    • 3D: $\{\mathbf{x}_i\}^3 = \{ (-\frac{1}{2},\frac{1}{2}, \frac{1}{4}), + (-\frac{3}{5},-\frac{1}{2}, -\frac{1}{8}), + (\frac{1}{2},-\frac{1}{2}, \frac{1}{2}) + \}$. +
    + +With the exact solution given, we then choose the forcing on the right hand +side and the Neumann boundary condition such that we obtain this solution +(manufactured solution technique). In this example, we choose the diffusion +equal to one and the convection as +\f[ +\mathbf{c} = \begin{cases} +1, & \textrm{dim}=1 \\ +(y, -x), & \textrm{dim}=2 \\ +(y, -x, 1), & \textrm{dim}=3 +\end{cases} +\f] +Note that the convection is divergence-free, $\nabla \cdot c = 0$. + +

    Implementation

    + +Besides implementing the above equations, the implementation below provides the following features: +
      +
    • WorkStream to parallelize local solvers. Workstream is already used in + step-32, step-44. +
    • Reconstruct the local DG solution from the trace. +
    • Post-processing the solution for superconvergence. +
    • DataOutFaces for direct output of the global skeleton solution. +
    diff --git a/deal.II/examples/step-51/doc/kind b/deal.II/examples/step-51/doc/kind new file mode 100644 index 0000000000..c1d9154931 --- /dev/null +++ b/deal.II/examples/step-51/doc/kind @@ -0,0 +1 @@ +techniques diff --git a/deal.II/examples/step-51/doc/results.dox b/deal.II/examples/step-51/doc/results.dox new file mode 100644 index 0000000000..f41ab66065 --- /dev/null +++ b/deal.II/examples/step-51/doc/results.dox @@ -0,0 +1,420 @@ +

    Results

    + +

    Program output

    + +We first have a look at the output generated by the program when run in 2D. In +the four images below, we show the solution for polynomial degree p=1 +and cycles 2, 3, 4, and 8 of the program. In the plots, we overlay the data +generated from the internal data (DG part) with the skeleton part ($\hat{u}$) +into the same plot. We had to generate two different data sets because cells +and faces represent different geometric entities, the combination of which (in +the same file) is not supported in the VTK output of deal.II. + +The images show the distinctive features of HDG: The cell solution (colored +surfaces) is discontinuous between the cells. The solution on the skeleton +variable sits on the faces and ties together the local parts. The skeleton +solution is not continuous on the vertices where the faces meet, even though +its values are quite close along lines in the same coordinate direction. The +skeleton solution can be interpreted as a rubber spring between the two sides +that balances the jumps in the solution (or rather, the flux $\kappa \nabla u ++ \mathbf{c} u$). As the mesh is refined, the jumps between the cells get +small (we represent a smooth solution), and the skeleton solution approaches +the interior parts. For cycle 8, there is no visible difference in the two +variables. We also see how boundary conditions are implemented weakly and that +the interior variables do not exactly satisfy boundary conditions. On the +lower and left boundaries, we set Neumann boundary conditions, whereas we set +Dirichlet conditions on the right and top boundaries. + + + + + + + + + + +
    + + + +
    + + + +
    + +Next, we have a look at the post-processed solution, again at cycles 2, 3, 4, +and 8. This is a discontinuous solution that is locally described by second +order polynomials. While the solution does not look very good on the mesh of +cycle two, it looks much better for cycles three and four. As shown by the +convergence table below, we find that is also converges more quickly to the +analytical solution. + + + + + + + + + + +
    + + + +
    + + + +
    + +Finally, we look at the solution for p=3 at cycle 2. Despite the coarse +mesh with only 64 cells, the post-processed solution is similar in quality +to the linear solution (not post-processed) at cycle 8 with 4,096 +cells. This clearly shows the superiority of high order methods for smooth +solutions. + + + + + + +
    + + + +
    + +

    Convergence tables

    + +When the program is run, it also outputs information about the respective +steps and convergence tables with errors in the various components in the +end. In 2D, the convergence tables look the following: + +@code +Q1 elements, adaptive refinement: +cells dofs val L2 grad L2 val L2-post + 16 80 1.804e+01 2.207e+01 1.798e+01 + 31 170 9.874e+00 1.322e+01 9.798e+00 + 61 314 7.452e-01 3.793e+00 4.891e-01 + 121 634 3.240e-01 1.511e+00 2.616e-01 + 238 1198 8.585e-02 8.212e-01 1.808e-02 + 454 2290 4.802e-02 5.178e-01 2.195e-02 + 898 4378 2.561e-02 2.947e-01 4.318e-03 + 1720 7864 1.306e-02 1.664e-01 2.978e-03 + 3271 14638 7.025e-03 9.815e-02 1.075e-03 + 6217 27214 4.119e-03 6.407e-02 9.975e-04 + +Q1 elements, global refinement: +cells dofs val L2 grad L2 val L2-post + 16 80 1.804e+01 - 2.207e+01 - 1.798e+01 - + 36 168 6.125e+00 2.66 9.472e+00 2.09 6.084e+00 2.67 + 64 288 9.785e-01 6.38 4.260e+00 2.78 7.102e-01 7.47 + 144 624 2.730e-01 3.15 1.866e+00 2.04 6.115e-02 6.05 + 256 1088 1.493e-01 2.10 1.046e+00 2.01 2.880e-02 2.62 + 576 2400 6.965e-02 1.88 4.846e-01 1.90 9.204e-03 2.81 + 1024 4224 4.018e-02 1.91 2.784e-01 1.93 4.027e-03 2.87 + 2304 9408 1.831e-02 1.94 1.264e-01 1.95 1.236e-03 2.91 + 4096 16640 1.043e-02 1.96 7.185e-02 1.96 5.306e-04 2.94 + 9216 37248 4.690e-03 1.97 3.228e-02 1.97 1.599e-04 2.96 + +Q3 elements, global refinement: +cells dofs val L2 grad L2 val L2-post + 16 160 3.613e-01 - 1.891e+00 - 3.020e-01 - + 36 336 6.411e-02 4.26 5.081e-01 3.24 3.238e-02 5.51 + 64 576 3.480e-02 2.12 2.533e-01 2.42 5.277e-03 6.31 + 144 1248 8.297e-03 3.54 5.924e-02 3.58 6.330e-04 5.23 + 256 2176 2.254e-03 4.53 1.636e-02 4.47 1.403e-04 5.24 + 576 4800 4.558e-04 3.94 3.277e-03 3.96 1.844e-05 5.01 + 1024 8448 1.471e-04 3.93 1.052e-03 3.95 4.378e-06 5.00 + 2304 18816 2.956e-05 3.96 2.104e-04 3.97 5.750e-07 5.01 + 4096 33280 9.428e-06 3.97 6.697e-05 3.98 1.362e-07 5.01 + 9216 74496 1.876e-06 3.98 1.330e-05 3.99 1.788e-08 5.01 +@endcode + + +One can see the error reduction upon grid refinement, and for the cases where +global refinement was performed, also the convergence rates. The quadratic +convergence rates of Q1 elements in the $L_2$ norm for both the scalar +variable and the gradient variable is apparent, as is the cubic rate for the +postprocessed scalar variable in the $L_2$ norm. Note that is is a distinctive +feature of an HDG solution. In typical continuous finite elements, the +gradient of the solution of order p converges at rate p only, as +opposed to p+1 for the actual solution. Even though superconvergence +results for finite elements are also available (e.g. superconvergent patch +recovery first introduced by Zienkiewicz and Zhu), these are typically limited +to structured meshes and other special cases. For Q3 HDG variables, the scalar +variable and gradient converge at fourth order and the postprocessed scalar +variable at fifth order. + +The same convergence rates are observed in 3d. +@code +Q1 elements, adaptive refinement: +cells dofs val L2 grad L2 val L2-post + 8 144 7.122e+00 1.941e+01 6.102e+00 + 29 500 3.309e+00 1.023e+01 2.145e+00 + 113 1792 2.204e+00 1.023e+01 1.912e+00 + 379 5732 6.085e-01 5.008e+00 2.233e-01 + 1317 19412 1.543e-01 1.464e+00 4.196e-02 + 4579 64768 5.058e-02 5.611e-01 9.521e-03 + 14596 199552 2.129e-02 3.122e-01 4.569e-03 + 46180 611400 1.033e-02 1.622e-01 1.684e-03 +144859 1864212 5.007e-03 8.371e-02 7.364e-04 +451060 5684508 2.518e-03 4.562e-02 3.070e-04 + +Q1 elements, global refinement: +cells dofs val L2 grad L2 val L2-post + 8 144 7.122e+00 - 1.941e+01 - 6.102e+00 - + 27 432 5.491e+00 0.64 2.184e+01 -0.29 4.448e+00 0.78 + 64 960 3.646e+00 1.42 1.299e+01 1.81 3.306e+00 1.03 + 216 3024 1.595e+00 2.04 8.550e+00 1.03 1.441e+00 2.05 + 512 6912 6.922e-01 2.90 5.306e+00 1.66 2.511e-01 6.07 + 1728 22464 2.915e-01 2.13 2.490e+00 1.87 8.588e-02 2.65 + 4096 52224 1.684e-01 1.91 1.453e+00 1.87 4.055e-02 2.61 + 13824 172800 7.972e-02 1.84 6.861e-01 1.85 1.335e-02 2.74 + 32768 405504 4.637e-02 1.88 3.984e-01 1.89 5.932e-03 2.82 +110592 1354752 2.133e-02 1.92 1.830e-01 1.92 1.851e-03 2.87 + +Q3 elements, global refinement: +cells dofs val L2 grad L2 val L2-post + 8 576 5.670e+00 - 1.868e+01 - 5.462e+00 - + 27 1728 1.048e+00 4.16 6.988e+00 2.42 8.011e-01 4.73 + 64 3840 2.831e-01 4.55 2.710e+00 3.29 1.363e-01 6.16 + 216 12096 7.883e-02 3.15 7.721e-01 3.10 2.158e-02 4.55 + 512 27648 3.642e-02 2.68 3.305e-01 2.95 5.231e-03 4.93 + 1728 89856 8.546e-03 3.58 7.581e-02 3.63 7.640e-04 4.74 + 4096 208896 2.598e-03 4.14 2.313e-02 4.13 1.783e-04 5.06 + 13824 691200 5.314e-04 3.91 4.697e-03 3.93 2.355e-05 4.99 + 32768 1622016 1.723e-04 3.91 1.517e-03 3.93 5.602e-06 4.99 +110592 5419008 3.482e-05 3.94 3.055e-04 3.95 7.374e-07 5.00 +@endcode + +

    Comparison with continuous finite elements

    + +

    Results for 2D

    + +The convergence tables verify the expected convergence rates stated in the +introduction. Now, we want to show a quick comparison of the computational +efficiency of the HDG method compared to a usual finite element (continuous +Galkerin) method on the problem of this tutorial. Of course, stability aspects +of the HDG method compared to continuous finite elements for +transport-dominated problems are also important in practice, which is an +aspect not seen on a problem with smooth analytic solution. In the picture +below, we compare the $L_2$ error as a function of the number of degrees of +freedom (left) and of the computing time spent in the linear solver (right) +for two space dimensions of continuous finite elements (CG) and the hybridized +discontinuous Galerkin method presented in this tutorial. As opposed to the +tutorial where we only use unpreconditioned BiCGStab, the times shown in the +figures below use the Trilinos algebraic multigrid preconditioner in +TrilinosWrappers::PreconditionAMG. For the HDG part, a wrapper around +ChunkSparseMatrix for the trace variable has been used in order to utilize the +block structure in the matrix on the finest level. + + + + + + +
    + + + +
    + +The results in the graphs show that the HDG method is slower than continuous +finite elements at p=1, about equally fast for cubic elements and +faster for sixth order elements. However, we have seen above that the HDG +method actually produces solutions which are more accurate than what is +represented in the original variables. Therefore, in the next two plots below +we instead display the error of the post-processed solution for HDG (denoted +by $p=1^*$ for example). We now see a clear advantage of HDG for the same +amount of work for both p=3 and p=6, and about the same quality +for p=1. + + + + + + +
    + + + +
    + +Since the HDG method actually produces results converging as +hp+2, we should compare it to a continuous Galerkin +solution with the same asymptotic convergence behavior, i.e., FE_Q with degree +p+1. If we do this, we get the convergence curves below. We see that +CG with second order polynomials is again clearly better than HDG with +linears. However, the advantage of HDG for higher orders remains. + + + + + + +
    + + + +
    + +The results are in line with properties of DG methods in general: Best +performance is typically not achieved for linear elements, but rather at +somewhat higher order, usually around p=3. This is because of a +volume-to-surface effect for discontinuous solutions with too much of the +solution living on the surfaces and hence duplicating work when the elements +are linear. Put in other words, DG methods are often most efficient when used +at relatively high order, despite their focus on discontinuous (and hence, +seemingly low accurate) representation of solutions. + +

    Resuls for 3D

    + +We now show the same figures in 3D: The first row shows the number of degrees +of freedom and computing time versus the $L_2$ error in the scalar variable +u for CG and HDG at order p, the second row shows the +post-processed HDG solution instead of the original one, and the third row +compares the post-processed HDG solution with CG at order p+1. In 3D, +the volume-to-surface effect makes the cost of HDG somewhat higher and the CG +solution is clearly better than HDG for linears by any metric. For cubics, HDG +and CG are of similar quality, whereas HDG is again more efficient for sixth +order polynomials. One can alternatively also use the combination of FE_DGP +and FE_FaceP instead of (FE_DGQ, FE_FaceQ), which do not use tensor product +polynomials of degree p but Legendre polynomials of complete +degree p. There are fewer degrees of freedom on the skeleton variable +for FE_FaceP for a given mesh size, but the solution quality (error vs. number +of DoFs) is very similar to the results for FE_FaceQ. + + + + + + + + + + + + + + +
    + + + +
    + + + +
    + + + +
    + +One final note on the efficiency comparison: We tried to use general-purpose +sparse matrix structures and similar solvers (optimal AMG preconditioners for +both without particular tuning of the AMG parameters on any of them) to give a +fair picture of the cost versus accuracy of two methods, on a toy example. It +should be noted however that GMG for continuous finite elements is about a +factor four to five faster for p=3 and p=6. The authors of this +tutorial have not seen similarly advanced solvers for the HDG linear +systems. Also, there are other implementation aspects for CG available such as +fast matrix-free approaches as shown in step-37 that make higher order +continuous elements more competitive. Again, it is not clear to the authors of +the tutorial whether similar improvements could be made for HDG. + +

    Possibilities for improvements

    + +As already mentioned in the introduction, one possibility is to implement +another post-processing technique as discussed in the literature. + +A second item that is not done optimally relates to the performance of this +program, which is of course an issue in practical applications (weighing in +also the better solution quality of (H)DG methods for transport-dominated +problems). Let us look at +the computing time of the tutorial program and the share of the individual +components: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      SetupAssembleSolveTrace reconstructPost-processingOutput
     Total timeRelative share
    2D, Q1, cycle 9, 37,248 dofs5.34s0.7%1.2%89.5%0.9%2.3%5.4%
    2D, Q3, cycle 9, 74,496 dofs22.2s0.4%4.3%84.1%4.1%3.5%3.6%
    3D, Q1, cycle 7, 172,800 dofs9.06s3.1%8.9%42.7%7.0%20.6%17.7%
    3D, Q3, cycle 7, 691,200 dofs516s0.6%34.5%13.4%32.8%17.1%1.5%
    + +As can be seen from the table, the solver and assembly calls dominate the +runtime of the program. This also gives a clear indication of where an +improvement makes most sense. + +
      +
    1. Better linear solvers: We use a BiCGStab iterative solver without + preconditioner, where the number of iteration increases with increasing + problem size (the number of iterations for Q1 elements and global + refinements start at 35 for the small sizes but increase up to 701 for the + largest size). To do better, one could for example use an algebraic + multigrid preconditioner from Trilinos. For diffusion-dominated problems as + the problem at hand with finer meshes, such a solver can be designed that + uses the matrix-vector products from the more efficient ChunkSparseMatrix on + the finest level, as long as we are not working in parallel with MPI. For + MPI-parallelized computation, a standard TrilinosWrappers::SparseMatrix can + be used. + +
    2. Speed up assembly by pre-assembling parts that do not change from one + cell to another (those that do neither contain variable coefficients nor + mapping-dependent terms). +
    diff --git a/deal.II/examples/step-51/doc/tooltip b/deal.II/examples/step-51/doc/tooltip new file mode 100644 index 0000000000..784e257e2f --- /dev/null +++ b/deal.II/examples/step-51/doc/tooltip @@ -0,0 +1 @@ +Convection-diffusion equation. Hybridizable discontinuous Galerkin methods. Face elements. diff --git a/deal.II/examples/step-51/step-51.cc b/deal.II/examples/step-51/step-51.cc new file mode 100644 index 0000000000..14be9e7875 --- /dev/null +++ b/deal.II/examples/step-51/step-51.cc @@ -0,0 +1,1449 @@ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2013 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Martin Kronbichler, Technische Universität München, + * Scott T. Miller, The Pennsylvania State University, 2013 + */ + +// @sect3{Include files} +// +// Most of the deal.II include files have already been covered in previous +// examples and are not commented on. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// However, we do have a few new includes for the example. +// The first one defines finite element spaces on the faces +// of the triangulation, which we refer to as the 'skeleton'. +// These finite elements do not have any support on the element +// interior, and they represent polynomials that have a single +// value on each codimension-1 surface, but admit discontinuities +// on codimension-2 surfaces. +#include + +// The second new file we include defines a new type of sparse matrix. The +// regular SparseMatrix type stores indices to all non-zero +// entries. The ChunkSparseMatrix takes advantage of the coupled +// nature of DG solutions. It stores an index to a matrix sub-block of a +// specified size. In the HDG context, this sub-block-size is actually the +// number of degrees of freedom per face defined by the skeleton solution +// field. This reduces the memory consumption of the matrix by up to one third +// and results in similar speedups when using the matrix in solvers. +#include + +// The final new include for this example deals with data output. Since +// we have a finite element field defined on the skeleton of the mesh, +// we would like to visualize what that solution actually is. +// DataOutFaces does exactly this; the interface is the almost the same +// as the familiar DataOut, but the output only has codimension-1 data for +// the simulation. +#include + + +// We start by putting the class into its own namespace. +namespace Step51 +{ + + using namespace dealii; + +// @sect3{Equation data} +// +// The structure of the analytic solution is the same as in step-7. There are +// two exceptions. Firstly, we also create a solution for the 3d case, and +// secondly, we scale the solution so its norm is of order unity for all +// values of the solution width. + template + class SolutionBase + { + protected: + static const unsigned int n_source_centers = 3; + static const Point source_centers[n_source_centers]; + static const double width; + }; + + + template <> + const Point<1> + SolutionBase<1>::source_centers[SolutionBase<1>::n_source_centers] + = { Point<1>(-1.0 / 3.0), + Point<1>(0.0), + Point<1>(+1.0 / 3.0) + }; + + + template <> + const Point<2> + SolutionBase<2>::source_centers[SolutionBase<2>::n_source_centers] + = { Point<2>(-0.5, +0.5), + Point<2>(-0.5, -0.5), + Point<2>(+0.5, -0.5) + }; + + template <> + const Point<3> + SolutionBase<3>::source_centers[SolutionBase<3>::n_source_centers] + = { Point<3>(-0.5, +0.5, 0.25), + Point<3>(-0.6, -0.5, -0.125), + Point<3>(+0.5, -0.5, 0.5) + }; + + template + const double SolutionBase::width = 1./5.; + + + template + class Solution : public Function, + protected SolutionBase + { + public: + Solution () : Function() {} + + virtual double value (const Point &p, + const unsigned int component = 0) const; + + virtual Tensor<1,dim> gradient (const Point &p, + const unsigned int component = 0) const; + }; + + + + template + double Solution::value (const Point &p, + const unsigned int) const + { + double return_value = 0; + for (unsigned int i=0; in_source_centers; ++i) + { + const Point x_minus_xi = p - this->source_centers[i]; + return_value += std::exp(-x_minus_xi.square() / + (this->width * this->width)); + } + + return return_value / + Utilities::fixed_power(std::sqrt(2. * numbers::PI) * this->width); + } + + + + template + Tensor<1,dim> Solution::gradient (const Point &p, + const unsigned int) const + { + Tensor<1,dim> return_value; + + for (unsigned int i=0; in_source_centers; ++i) + { + const Point x_minus_xi = p - this->source_centers[i]; + + return_value += (-2 / (this->width * this->width) * + std::exp(-x_minus_xi.square() / + (this->width * this->width)) * + x_minus_xi); + } + + return return_value / Utilities::fixed_power(std::sqrt(2 * numbers::PI) * + this->width); + } + + + +// This class implements a function where the scalar solution and its negative +// gradient are collected together. This function is used when computing the +// error of the HDG approximation and its implementation is to simply call +// value and gradient function of the Solution class. + template + class SolutionAndGradient : public Function, + protected SolutionBase + { + public: + SolutionAndGradient () : Function(dim) {} + + virtual void vector_value (const Point &p, + Vector &v) const; + }; + + template + void SolutionAndGradient::vector_value (const Point &p, + Vector &v) const + { + AssertDimension(v.size(), dim+1); + Solution solution; + Tensor<1,dim> grad = solution.gradient(p); + for (unsigned int d=0; d + class ConvectionVelocity : public TensorFunction<1,dim> + { + public: + ConvectionVelocity() : TensorFunction<1,dim>() {} + + virtual Tensor<1,dim> value (const Point &p) const; + }; + + + + template + Tensor<1,dim> + ConvectionVelocity::value(const Point &p) const + { + Tensor<1,dim> convection; + switch (dim) + { + case 1: + convection[0] = 1; + break; + case 2: + convection[0] = p[1]; + convection[1] = -p[0]; + break; + case 3: + convection[0] = p[1]; + convection[1] = -p[0]; + convection[2] = 1; + break; + default: + Assert(false, ExcNotImplemented()); + } + return convection; + } + + + +// The last function we implement is the right hand side for the manufactured +// solution. It is very similar to step-7, with the exception that we now have +// a convection term instead of the reaction term. Since the velocity field is +// incompressible, i.e. $\nabla \cdot \mathbf{c} = 0$, this term simply reads +// $\mathbf{c} \nabla \ve u$. + template + class RightHandSide : public Function, + protected SolutionBase + { + public: + RightHandSide () : Function() {} + + virtual double value (const Point &p, + const unsigned int component = 0) const; + + private: + const ConvectionVelocity convection_velocity; + }; + + + template + double RightHandSide::value (const Point &p, + const unsigned int) const + { + Tensor<1,dim> convection = convection_velocity.value(p); + double return_value = 0; + for (unsigned int i=0; in_source_centers; ++i) + { + const Point x_minus_xi = p - this->source_centers[i]; + + return_value += + ((2*dim - 2*convection*x_minus_xi - 4*x_minus_xi.square()/ + (this->width * this->width)) / + (this->width * this->width) * + std::exp(-x_minus_xi.square() / + (this->width * this->width))); + } + + return return_value / Utilities::fixed_power(std::sqrt(2 * numbers::PI) + * this->width); + } + +// @sect3{The HDG solver class} + +// The HDG solution procedure follows closely that of step-7. The major +// difference is the use of three different sets of DoFHandler and FE +// objects, along with the ChunkSparseMatrix and the +// corresponding solutions vectors. We also use WorkStream to enable a +// multithreaded local solution process which exploits the embarrassingly +// parallel nature of the local solver. For WorkStream, we define the local +// operations on a cell and a copy function into the global matrix and +// vector. We do this both for the assembly (which is run twice, once when we +// generate the system matrix and once when we compute the element-interior +// solutions from the skeleton values) and for the postprocessing where +// we extract a solution that converges at higher order. + template + class HDG + { + public: + enum RefinementMode + { + global_refinement, adaptive_refinement + }; + + HDG (const unsigned int degree, + const RefinementMode refinement_mode); + void run (); + + private: + + void setup_system (); + void assemble_system (const bool reconstruct_trace = false); + void solve (); + void postprocess (); + void refine_grid (const unsigned int cylce); + void output_results (const unsigned int cycle); + + // Data for the assembly and solution of the primal variables. + struct PerTaskData; + struct ScratchData; + + // Post-processing the solution to obtain $u^*$ is an element-by-element + // procedure; as such, we do not need to assemble any global data and do + // not declare any 'task data' for WorkStream to use. + struct PostProcessScratchData; + + // The following three functions are used by WorkStream to do the actual + // work of the program. + void assemble_system_one_cell (const typename DoFHandler::active_cell_iterator &cell, + ScratchData &scratch, + PerTaskData &task_data); + + void copy_local_to_global(const PerTaskData &data); + + void postprocess_one_cell (const typename DoFHandler::active_cell_iterator &cell, + PostProcessScratchData &scratch, + unsigned int &empty_data); + + + Triangulation triangulation; + + // The 'local' solutions are interior to each element. These + // represent the primal solution field $u$ as well as the auxiliary + // field $\mathbf{q}$. + FESystem fe_local; + DoFHandler dof_handler_local; + Vector solution_local; + + // The new finite element type and corresponding DoFHandler are + // used for the global skeleton solution that couples the element-level local + // solutions. + FE_FaceQ fe; + DoFHandler dof_handler; + Vector solution; + Vector system_rhs; + + // As stated in the introduction, HDG solutions can be post-processed to + // attain superconvergence rates of $\mathcal{O}(h^{p+2})$. The + // post-processed solution is a discontinuous finite element solution + // representing the primal variable on the interior of each cell. We define + // a FE type of degree $p+1$ to represent this post-processed solution, + // which we only use for output after constructing it. + FE_DGQ fe_u_post; + DoFHandler dof_handler_u_post; + Vector solution_u_post; + + // The degrees of freedom corresponding to the skeleton strongly enforce + // Dirichlet boundary conditions, just as in a continuous Galerkin finite + // element method. We can enforce the boundary conditions in an analogous + // manner through the use of ConstrainMatrix constructs. In + // addition, hanging nodes are handled in the same way as for + // continuous finite elements: For the face elements which + // only define degrees of freedom on the face, this process sets the + // solution on the refined to be the one from the coarse side. + ConstraintMatrix constraints; + + // The usage of the ChunkSparseMatrix class is similar to the usual sparse + // matrices: You need a sparsity pattern of type ChunkSparsityPattern and + // the actual matrix object. When creating the sparsity pattern, we just + // have to additionally pass the size of local blocks. + ChunkSparsityPattern sparsity_pattern; + ChunkSparseMatrix system_matrix; + + // Same as step-7: + const RefinementMode refinement_mode; + ConvergenceTable convergence_table; + }; + + // @sect3{The HDG class implementation} + + // @sect4{Constructor} + // The constructor is similar to those in other examples, + // with the exception of handling multiple DoFHandler and + // FiniteElement objects. Note that we create a system of finite + // elements for the local DG part, including the gradient/flux part and the + // scalar part. + template + HDG::HDG (const unsigned int degree, + const RefinementMode refinement_mode) : + fe_local (FE_DGQ(degree), dim, + FE_DGQ(degree), 1), + dof_handler_local (triangulation), + fe (degree), + dof_handler (triangulation), + fe_u_post (degree+1), + dof_handler_u_post (triangulation), + refinement_mode (refinement_mode) + {} + + + + // @sect4{HDG::setup_system} + // The system for an HDG solution is setup in an analogous manner to most + // of the other tutorial programs. We are careful to distribute dofs with + // all of our DoFHandler objects. The @p solution and @p system_matrix + // objects go with the global skeleton solution. + template + void + HDG::setup_system () + { + dof_handler_local.distribute_dofs(fe_local); + dof_handler.distribute_dofs(fe); + dof_handler_u_post.distribute_dofs(fe_u_post); + + std::cout << " Number of degrees of freedom: " + << dof_handler.n_dofs() + << std::endl; + + solution.reinit (dof_handler.n_dofs()); + system_rhs.reinit (dof_handler.n_dofs()); + + solution_local.reinit (dof_handler_local.n_dofs()); + solution_u_post.reinit (dof_handler_u_post.n_dofs()); + + constraints.clear (); + DoFTools::make_hanging_node_constraints (dof_handler, constraints); + typename FunctionMap::type boundary_functions; + Solution solution_function; + boundary_functions[0] = &solution_function; + VectorTools::project_boundary_values (dof_handler, + boundary_functions, + QGauss(fe.degree+1), + constraints); + constraints.close (); + + // When creating the chunk sparsity pattern, we first create the usual + // compressed sparsity pattern and then set the chunk size, which is equal + // to the number of dofs on a face, when copying this into the final + // sparsity pattern. + { + CompressedSimpleSparsityPattern csp (dof_handler.n_dofs()); + DoFTools::make_sparsity_pattern (dof_handler, csp, + constraints, false); + sparsity_pattern.copy_from(csp, fe.dofs_per_face); + } + system_matrix.reinit (sparsity_pattern); + } + + + + // @sect4{HDG::PerTaskData} + // Next comes the definition of the local data structures for the parallel + // assembly. The first structure @p PerTaskData contains the local vector + // and matrix that are written into the global matrix, whereas the + // ScratchData contains all data that we need for the local assembly. There + // is one variable worth noting here, namely the boolean variable @p + // trace_reconstruct. As mentioned in the introdution, we solve the HDG + // system in two steps. First, we create a linear system for the skeleton + // system where we condense the local part into it via the Schur complement + // $D-CA^{-1}B$. Then, we solve for the local part using the skeleton + // solution. For these two steps, we need the same matrices on the elements + // twice, which we want to compute by two assembly steps. Since most of the + // code is similar, we do this with the same function but only switch + // between the two based on a flag that we set when starting the + // assembly. Since we need to pass this information on to the local worker + // routines, we store it once in the task data. + template + struct HDG::PerTaskData + { + FullMatrix cell_matrix; + Vector cell_vector; + std::vector dof_indices; + + bool trace_reconstruct; + + PerTaskData(const unsigned int n_dofs, const bool trace_reconstruct) + : cell_matrix(n_dofs, n_dofs), + cell_vector(n_dofs), + dof_indices(n_dofs), + trace_reconstruct(trace_reconstruct) + {} + }; + + + + // @sect4{HDG::ScratchData} + // @p ScratchData contains persistent data for each + // thread within WorkStream. The FEValues, matrix, + // and vector objects should be familiar by now. There are two objects that + // need to be discussed: @p std::vector > + // fe_local_support_on_face and @p std::vector > + // fe_support_on_face. These are used to indicate whether or not the finite + // elements chosen have support (non-zero values) on a given face of the + // reference cell for the local part associated to @p fe_local and the + // skeleton part @p fe. We extract this information in the + // constructor and store it once for all cells that we work on. Had we not + // stored this information, we would be forced to assemble a large number of + // zero terms on each cell, which would significantly slow the program. + template + struct HDG::ScratchData + { + FEValues fe_values_local; + FEFaceValues fe_face_values_local; + FEFaceValues fe_face_values; + + FullMatrix ll_matrix; + FullMatrix lf_matrix; + FullMatrix fl_matrix; + FullMatrix tmp_matrix; + Vector l_rhs; + Vector tmp_rhs; + + std::vector > q_phi; + std::vector q_phi_div; + std::vector u_phi; + std::vector > u_phi_grad; + std::vector tr_phi; + std::vector trace_values; + + std::vector > fe_local_support_on_face; + std::vector > fe_support_on_face; + + ConvectionVelocity convection_velocity; + RightHandSide right_hand_side; + const Solution exact_solution; + + ScratchData(const FiniteElement &fe, + const FiniteElement &fe_local, + const QGauss &quadrature_formula, + const QGauss &face_quadrature_formula, + const UpdateFlags local_flags, + const UpdateFlags local_face_flags, + const UpdateFlags flags) + : + fe_values_local (fe_local, quadrature_formula, local_flags), + fe_face_values_local (fe_local, face_quadrature_formula, local_face_flags), + fe_face_values (fe, face_quadrature_formula, flags), + ll_matrix (fe_local.dofs_per_cell, fe_local.dofs_per_cell), + lf_matrix (fe_local.dofs_per_cell, fe.dofs_per_cell), + fl_matrix (fe.dofs_per_cell, fe_local.dofs_per_cell), + tmp_matrix (fe.dofs_per_cell, fe_local.dofs_per_cell), + l_rhs (fe_local.dofs_per_cell), + tmp_rhs (fe_local.dofs_per_cell), + q_phi (fe_local.dofs_per_cell), + q_phi_div (fe_local.dofs_per_cell), + u_phi (fe_local.dofs_per_cell), + u_phi_grad (fe_local.dofs_per_cell), + tr_phi (fe.dofs_per_cell), + trace_values(face_quadrature_formula.size()), + fe_local_support_on_face(GeometryInfo::faces_per_cell), + fe_support_on_face(GeometryInfo::faces_per_cell) + { + for (unsigned int face=0; face::faces_per_cell; ++face) + for (unsigned int i=0; i::faces_per_cell; ++face) + for (unsigned int i=0; iWorkStream + // when post-processing the local solution $u^*$. It is similar, but much + // simpler, than @p ScratchData. + template + struct HDG::PostProcessScratchData + { + FEValues fe_values_local; + FEValues fe_values; + + std::vector u_values; + std::vector > u_gradients; + FullMatrix cell_matrix; + + Vector cell_rhs; + Vector cell_sol; + + PostProcessScratchData(const FiniteElement &fe, + const FiniteElement &fe_local, + const QGauss &quadrature_formula, + const UpdateFlags local_flags, + const UpdateFlags flags) + : + fe_values_local (fe_local, quadrature_formula, local_flags), + fe_values (fe, quadrature_formula, flags), + u_values (quadrature_formula.size()), + u_gradients (quadrature_formula.size()), + cell_matrix (fe.dofs_per_cell, fe.dofs_per_cell), + cell_rhs (fe.dofs_per_cell), + cell_sol (fe.dofs_per_cell) + {} + + PostProcessScratchData(const PostProcessScratchData &sd) + : + fe_values_local (sd.fe_values_local.get_fe(), + sd.fe_values_local.get_quadrature(), + sd.fe_values_local.get_update_flags()), + fe_values (sd.fe_values.get_fe(), + sd.fe_values.get_quadrature(), + sd.fe_values.get_update_flags()), + u_values (sd.u_values), + u_gradients (sd.u_gradients), + cell_matrix (sd.cell_matrix), + cell_rhs (sd.cell_rhs), + cell_sol (sd.cell_sol) + {} + }; + + + + // @sect4{HDG::assemble_system} + // The @p assemble_system function is similar to Step-32, where + // the quadrature formula and the update flags are set up, and then + // WorkStream is used to do the work in a multi-threaded + // manner. The @p trace_reconstruct input parameter is used to decide + // whether we are solving for the global skeleton solution (false) or the + // local solution (true). + template + void + HDG::assemble_system (const bool trace_reconstruct) + { + const QGauss quadrature_formula(fe.degree+1); + const QGauss face_quadrature_formula(fe.degree+1); + + const UpdateFlags local_flags (update_values | update_gradients | + update_JxW_values | update_quadrature_points); + + const UpdateFlags local_face_flags (update_values); + + const UpdateFlags flags ( update_values | update_normal_vectors | + update_quadrature_points | + update_JxW_values); + + PerTaskData task_data (fe.dofs_per_cell, + trace_reconstruct); + ScratchData scratch (fe, fe_local, + quadrature_formula, + face_quadrature_formula, + local_flags, + local_face_flags, + flags); + + WorkStream::run(dof_handler.begin_active(), + dof_handler.end(), + *this, + &HDG::assemble_system_one_cell, + &HDG::copy_local_to_global, + scratch, + task_data); + } + + + + // @sect4{HDG::assemble_system_one_cell} + // The real work of the HDG program is done by @p assemble_system_one_cell. + // Assembling the local matrices $A, B, C$ is done here, along with the + // local contributions of the global matrix $D$. + template + void + HDG::assemble_system_one_cell (const typename DoFHandler::active_cell_iterator &cell, + ScratchData &scratch, + PerTaskData &task_data) + { + // Construct iterator for dof_handler_local for FEValues reinit function. + typename DoFHandler::active_cell_iterator + loc_cell (&triangulation, + cell->level(), + cell->index(), + &dof_handler_local); + + const unsigned int n_q_points = scratch.fe_values_local.get_quadrature().size(); + const unsigned int n_face_q_points = scratch.fe_face_values_local.get_quadrature().size(); + + const unsigned int loc_dofs_per_cell = scratch.fe_values_local.get_fe().dofs_per_cell; + + const FEValuesExtractors::Vector fluxes (0); + const FEValuesExtractors::Scalar scalar (dim); + + scratch.ll_matrix = 0; + scratch.l_rhs = 0; + if (!task_data.trace_reconstruct) + { + scratch.lf_matrix = 0; + scratch.fl_matrix = 0; + task_data.cell_matrix = 0; + task_data.cell_vector = 0; + } + scratch.fe_values_local.reinit (loc_cell); + + // We first compute the cell-interior contribution to @p ll_matrix matrix + // (referred to as matrix $A$ in the introduction) corresponding to + // local-local coupling, as well as the local right-hand-side vector. We + // store the values at each quadrature point for the basis functions, the + // right-hand-side value, and the convection velocity, in order to have + // quick access to these fields. + for (unsigned int q=0; q convection + = scratch.convection_velocity.value(scratch.fe_values_local.quadrature_point(q)); + const double JxW = scratch.fe_values_local.JxW(q); + for (unsigned int k=0; k::faces_per_cell; ++face) + { + scratch.fe_face_values_local.reinit(loc_cell, face); + scratch.fe_face_values.reinit(cell, face); + + // The already obtained $\hat{u}$ values are needed when solving for the + // local variables. + if (task_data.trace_reconstruct) + scratch.fe_face_values.get_function_values (solution, scratch.trace_values); + + for (unsigned int q=0; q quadrature_point = + scratch.fe_face_values.quadrature_point(q); + const Point normal = scratch.fe_face_values.normal_vector(q); + const Tensor<1,dim> convection + = scratch.convection_velocity.value(quadrature_point); + + // Here we compute the stabilization parameter discussed in the + // introduction: since the diffusion is one and the diffusion + // length scale is set to 1/5, it simply results in a contribution + // of 5 for the diffusion part and the magnitude of convection + // through the element boundary in a centered scheme for the + // convection part. + const double tau_stab = (5. + + std::abs(convection * normal)); + + // We store the non-zero flux and scalar values, making use of the + // support_on_face information we created in @p ScratchData. + for (unsigned int k=0; kface(face)->at_boundary() + && + (cell->face(face)->boundary_indicator() == 1)) + { + const double neumann_value = + - scratch.exact_solution.gradient (quadrature_point) * normal + + convection * normal * scratch.exact_solution.value(quadrature_point); + for (unsigned int i=0; i_{\partial \mathcal T}$ to the local matrix. As opposed + // to the face matrices above, we need it in both assembly stages. + for (unsigned int i=0; iget_dof_indices(task_data.dof_indices); + } + // For (2), we are simply solving (ll_matrix).(solution_local) = (l_rhs). + // Hence, we multiply @p l_rhs by our already inverted local-local matrix + // and store the result using the set_dof_values function. + else + { + scratch.ll_matrix.vmult(scratch.tmp_rhs, scratch.l_rhs); + loc_cell->set_dof_values(scratch.tmp_rhs, solution_local); + } + } + + + + // @sect4{HDG::copy_local_to_global} + // If we are in the first step of the solution, i.e. @p trace_reconstruct=false, + // then we assemble the local matrices into the global system. + template + void HDG::copy_local_to_global(const PerTaskData &data) + { + if (data.trace_reconstruct == false) + constraints.distribute_local_to_global (data.cell_matrix, + data.cell_vector, + data.dof_indices, + system_matrix, system_rhs); + } + + + + // @sect4{HDG::solve} + // The skeleton solution is solved for by using a BiCGStab solver with + // identity preconditioner. + template + void HDG::solve () + { + SolverControl solver_control (system_matrix.m()*10, + 1e-11*system_rhs.l2_norm()); + SolverBicgstab<> solver (solver_control, false); + solver.solve (system_matrix, solution, system_rhs, + PreconditionIdentity()); + + std::cout << " Number of BiCGStab iterations: " << solver_control.last_step() + << std::endl; + + system_matrix.clear(); + sparsity_pattern.reinit(0,0,0,1); + + constraints.distribute(solution); + + // Once we have solved for the skeleton solution, + // we can solve for the local solutions in an element-by-element + // fashion. We do this by re-using the same @p assemble_system function + // but switching @p trace_reconstruct to true. + assemble_system(true); + } + + + + // @sect4{HDG::postprocess} + + // The postprocess method serves two purposes. First, we want to construct a + // post-processed scalar variables in the element space of degree $p+1$ that + // we hope will converge at order $p+2$. This is again an element-by-element + // process and only involves the scalar solution as well as the gradient on + // the local cell. To do this, we introduce the already defined scratch data + // together with some update flags and run the work stream to do this in + // parallel. + // + // Secondly, we want to compute discretization errors just as we did in + // step-7. The overall procedure is similar with calls to + // VectorTools::integrate_difference. The difference is in how we compute + // the errors for the scalar variable and the gradient variable. In step-7, + // we did this by computing @p L2_norm or @p H1_seminorm + // contributions. Here, we have a DoFHandler with these two contributions + // computed and sorted by their vector component, [0, dim) for the + // gradient and @p dim for the scalar. To compute their value, we hence use + // a ComponentSelectFunction with either of them, together with the @p + // SolutionAndGradient class introduced above that contains the analytic + // parts of either of them. Eventually, we also compute the L2-error of the + // post-processed solution and add the results into the convergence table. + template + void + HDG::postprocess() + { + { + const QGauss quadrature_formula(fe_u_post.degree+1); + const UpdateFlags local_flags (update_values); + const UpdateFlags flags ( update_values | update_gradients | + update_JxW_values); + + PostProcessScratchData scratch (fe_u_post, fe_local, + quadrature_formula, + local_flags, + flags); + + WorkStream::run(dof_handler_u_post.begin_active(), + dof_handler_u_post.end(), + std_cxx1x::bind (&HDG::postprocess_one_cell, + std_cxx1x::ref(*this), + std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3), + std_cxx1x::function(), + scratch, + 0U); + } + + Vector difference_per_cell (triangulation.n_active_cells()); + + ComponentSelectFunction value_select (dim, dim+1); + VectorTools::integrate_difference (dof_handler_local, + solution_local, + SolutionAndGradient(), + difference_per_cell, + QGauss(fe.degree+2), + VectorTools::L2_norm, + &value_select); + const double L2_error = difference_per_cell.l2_norm(); + + ComponentSelectFunction gradient_select (std::pair(0, dim), + dim+1); + VectorTools::integrate_difference (dof_handler_local, + solution_local, + SolutionAndGradient(), + difference_per_cell, + QGauss(fe.degree+2), + VectorTools::L2_norm, + &gradient_select); + const double grad_error = difference_per_cell.l2_norm(); + + VectorTools::integrate_difference (dof_handler_u_post, + solution_u_post, + Solution(), + difference_per_cell, + QGauss(fe.degree+3), + VectorTools::L2_norm); + const double post_error = difference_per_cell.l2_norm(); + + convergence_table.add_value("cells", triangulation.n_active_cells()); + convergence_table.add_value("dofs", dof_handler.n_dofs()); + convergence_table.add_value("val L2", L2_error); + convergence_table.add_value("grad L2", grad_error); + convergence_table.add_value("val L2-post", post_error); + } + + + + // @sect4{HDG::postprocess_one_cell} + // + // This is the actual work done for the postprocessing. According to the + // discussion in the introduction, we need to set up a system that projects + // the gradient part of the DG solution onto the gradient of the + // post-processed variable. Moreover, we need to set the average of the new + // post-processed variable to equal the average of the scalar DG solution + // on the cell. + // + // More technically speaking, the projection of the gradient is a system + // that would potentially fills our @p dofs_per_cell times @p dofs_per_cell + // matrix but is singular (the sum of all rows would be zero because the + // constant function has zero gradient). Therefore, we take one row away and + // use it for imposing the average of the scalar value. We pick the first + // row for the scalar part, even though we could pick any row for $\mathcal + // Q_{-p}$ elements. However, had we used FE_DGP elements instead, the first + // row would correspond to the constant part already and deleting e.g. the + // last row would give us a singular system. This way, our program can also + // be used for those elements. + template + void + HDG::postprocess_one_cell (const typename DoFHandler::active_cell_iterator &cell, + PostProcessScratchData &scratch, + unsigned int &) + { + typename DoFHandler::active_cell_iterator + loc_cell (&triangulation, + cell->level(), + cell->index(), + &dof_handler_local); + + scratch.fe_values_local.reinit (loc_cell); + scratch.fe_values.reinit(cell); + + FEValuesExtractors::Vector fluxes(0); + FEValuesExtractors::Scalar scalar(dim); + + const unsigned int n_q_points = scratch.fe_values.get_quadrature().size(); + const unsigned int dofs_per_cell = scratch.fe_values.dofs_per_cell; + + scratch.fe_values_local[scalar].get_function_values(solution_local, scratch.u_values); + scratch.fe_values_local[fluxes].get_function_values(solution_local, scratch.u_gradients); + + double sum = 0; + for (unsigned int i=1; idistribute_local_to_global(scratch.cell_sol, solution_u_post); + } + + + + // @sect4{HDG::output_results} + // We have 3 sets of results that we would like to output: the local solution, + // the post-processed local solution, and the skeleton solution. The former 2 + // both 'live' on element volumes, wheras the latter lives on codimention-1 surfaces + // of the triangulation. Our @p output_results function writes all local solutions + // to the same vtk file, even though they correspond to different DoFHandler + // objects. The graphical output for the skeleton variable is done through + // use of the DataOutFaces class. + template + void HDG::output_results (const unsigned int cycle) + { + std::string filename; + switch (refinement_mode) + { + case global_refinement: + filename = "solution-global"; + break; + case adaptive_refinement: + filename = "solution-adaptive"; + break; + default: + Assert (false, ExcNotImplemented()); + } + + std::string face_out(filename); + face_out += "-face"; + + filename += "-q" + Utilities::int_to_string(fe.degree,1); + filename += "-" + Utilities::int_to_string(cycle,2); + filename += ".vtk"; + std::ofstream output (filename.c_str()); + + DataOut data_out; + + // We first define the names and types of the local solution, + // and add the data to @p data_out. + std::vector names (dim, "gradient"); + names.push_back ("solution"); + std::vector + component_interpretation + (dim+1, DataComponentInterpretation::component_is_part_of_vector); + component_interpretation[dim] + = DataComponentInterpretation::component_is_scalar; + data_out.add_data_vector (dof_handler_local, solution_local, + names, component_interpretation); + + // The second data item we add is the post-processed solution. + // In this case, it is a single scalar variable belonging to + // a different DoFHandler. + std::vector post_name(1,"u_post"); + std::vector + post_comp_type(1, DataComponentInterpretation::component_is_scalar); + data_out.add_data_vector (dof_handler_u_post, solution_u_post, + post_name, post_comp_type); + + data_out.build_patches (fe.degree); + data_out.write_vtk (output); + + face_out += "-q" + Utilities::int_to_string(fe.degree,1); + face_out += "-" + Utilities::int_to_string(cycle,2); + face_out += ".vtk"; + std::ofstream face_output (face_out.c_str()); + +// The DataOutFaces class works analagously to the DataOut +// class when we have a DoFHandler that defines the solution on +// the skeleton of the triangulation. We treat it as such here, and the code is +// similar to that above. + DataOutFaces data_out_face(false); + std::vector face_name(1,"u_hat"); + std::vector + face_component_type(1, DataComponentInterpretation::component_is_scalar); + + data_out_face.add_data_vector (dof_handler, + solution, + face_name, + face_component_type); + + data_out_face.build_patches (fe.degree); + data_out_face.write_vtk (face_output); + } + +// @sect4{HDG::refine_grid} + +// We implement two different refinement cases for HDG, just as in +// Step-7: adaptive_refinement and global_refinement. The +// global_refinement option recreates the entire triangulation every +// time. This is because we want to use a finer sequence of meshes than what +// we would get with one refinement step, namely 2, 3, 4, 6, 8, 12, 16, ... +// elements per direction. + +// The adaptive_refinement mode uses the KellyErrorEstimator to +// give a decent indication of the non-regular regions in the scalar local +// solutions. + template + void HDG::refine_grid (const unsigned int cycle) + { + if (cycle == 0) + { + GridGenerator::subdivided_hyper_cube (triangulation, 2, -1, 1); + triangulation.refine_global(3-dim); + } + else + switch (refinement_mode) + { + case global_refinement: + { + triangulation.clear(); + GridGenerator::subdivided_hyper_cube (triangulation, 2+(cycle%2), -1, 1); + triangulation.refine_global(3-dim+cycle/2); + break; + } + + case adaptive_refinement: + { + Vector estimated_error_per_cell (triangulation.n_active_cells()); + + FEValuesExtractors::Scalar scalar(dim); + typename FunctionMap::type neumann_boundary; + KellyErrorEstimator::estimate (dof_handler_local, + QGauss(3), + neumann_boundary, + solution_local, + estimated_error_per_cell, + fe_local.component_mask(scalar)); + + GridRefinement::refine_and_coarsen_fixed_number (triangulation, + estimated_error_per_cell, + 0.3, 0.); + + triangulation.execute_coarsening_and_refinement (); + + break; + } + + default: + { + Assert (false, ExcNotImplemented()); + } + } + + // Just as in step-7, we set the boundary indicator of two of the faces to 1 + // where we want to specify Neumann boundary conditions instead of Dirichlet + // conditions. Since we re-create the triangulation every time for global + // refinement, the flags are set in every refinement step, not just at the + // beginning. + typename Triangulation::cell_iterator + cell = triangulation.begin (), + endc = triangulation.end(); + for (; cell!=endc; ++cell) + for (unsigned int face=0; face::faces_per_cell; ++face) + if (cell->face(face)->at_boundary()) + if ((std::fabs(cell->face(face)->center()(0) - (-1)) < 1e-12) + || + (std::fabs(cell->face(face)->center()(1) - (-1)) < 1e-12)) + cell->face(face)->set_boundary_indicator (1); + } + + // @sect4{HDG::run} + // The functionality here is basically the same as Step-7. + // We loop over 10 cycles, refining the grid on each one. At the end, + // convergence tables are created. + template + void HDG::run () + { + for (unsigned int cycle=0; cycle<10; ++cycle) + { + std::cout << "Cycle " << cycle << ':' << std::endl; + + refine_grid (cycle); + setup_system (); + assemble_system (false); + solve (); + postprocess(); + output_results (cycle); + } + + + + convergence_table.set_precision("val L2", 3); + convergence_table.set_scientific("val L2", true); + convergence_table.set_precision("grad L2", 3); + convergence_table.set_scientific("grad L2", true); + convergence_table.set_precision("val L2-post", 3); + convergence_table.set_scientific("val L2-post", true); + + // There is one minor change for the convergence table compared to step-7: + // Since we did not refine our mesh by a factor two in each cycle (but + // rather used the sequence 2, 3, 4, 6, 8, 12, ...), we need to tell the + // convergence rate evaluation about this. We do this by setting the + // number of cells as a reference column and additionally specifying the + // dimension of the problem, which gives the necessary information for the + // relation between number of cells and mesh size. + if (refinement_mode == global_refinement) + { + convergence_table + .evaluate_convergence_rates("val L2", "cells", ConvergenceTable::reduction_rate_log2, dim); + convergence_table + .evaluate_convergence_rates("grad L2", "cells", ConvergenceTable::reduction_rate_log2, dim); + convergence_table + .evaluate_convergence_rates("val L2-post", "cells", ConvergenceTable::reduction_rate_log2, dim); + } + convergence_table.write_text(std::cout); + } + +} // end of namespace Step51 + + + +int main (int argc, char **argv) +{ + const unsigned int dim = 2; + + try + { + using namespace dealii; + + deallog.depth_console (0); + + // Now for the three calls to the main class in complete analogy to + // step-7. + { + std::cout << "Solving with Q1 elements, adaptive refinement" << std::endl + << "=============================================" << std::endl + << std::endl; + + Step51::HDG hdg_problem (1, Step51::HDG::adaptive_refinement); + hdg_problem.run (); + + std::cout << std::endl; + } + + { + std::cout << "Solving with Q1 elements, global refinement" << std::endl + << "===========================================" << std::endl + << std::endl; + + Step51::HDG hdg_problem (1, Step51::HDG::global_refinement); + hdg_problem.run (); + + std::cout << std::endl; + } + + { + std::cout << "Solving with Q3 elements, global refinement" << std::endl + << "===========================================" << std::endl + << std::endl; + + Step51::HDG hdg_problem (3, Step51::HDG::global_refinement); + hdg_problem.run (); + + std::cout << std::endl; + } + + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + } + + return 0; +} diff --git a/deal.II/examples/step-6/step-6.cc b/deal.II/examples/step-6/step-6.cc index 75b32ce2e1..a36acefb00 100644 --- a/deal.II/examples/step-6/step-6.cc +++ b/deal.II/examples/step-6/step-6.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 2000 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2000 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 2000 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2000-2004, 2006-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -67,7 +77,7 @@ #include // Finally, we need a simple way to actually compute the refinement indicators -// based on some error estimat. While in general, adaptivity is very +// based on some error estimate. While in general, adaptivity is very // problem-specific, the error indicator in the following file often yields // quite nicely adapted grids for a wide class of problems. #include @@ -289,7 +299,7 @@ void Step6::setup_system () // After setting up all the degrees of freedoms, here are now the // differences compared to step-5, all of which are related to constraints - // associated with the hanging nodes. In the class desclaration, we have + // associated with the hanging nodes. In the class declaration, we have // already allocated space for an object constraints that will // hold a list of these constraints (they form a matrix, which is reflected // in the name of the class, but that is immaterial for the moment). Now we @@ -754,7 +764,7 @@ int main () // approximately the same string as would be generated if the exception was // thrown using the Assert macro. You have seen the output of // such an exception in the previous example, and you then know that it - // contains the file and line number of where the exception occured, and + // contains the file and line number of where the exception occurred, and // some other information. This is also what the following statements would // print. // diff --git a/deal.II/examples/step-7/step-7.cc b/deal.II/examples/step-7/step-7.cc index 85393fd733..058e7cf1cd 100644 --- a/deal.II/examples/step-7/step-7.cc +++ b/deal.II/examples/step-7/step-7.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth and Ralf Hartmann, University of Heidelberg, 2000 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2000 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth and Ralf Hartmann, University of Heidelberg, 2000 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2000-2004, 2006-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 */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // @sect3{Include files} @@ -233,7 +243,7 @@ namespace Step7 // share the same connotation that points have and are only objects in a // more abstract space than the one spanned by the coordinate // directions. (In fact, gradients live in `reciprocal' space, since the - // dimension of their components is not that of a length, but one over + // dimension of their components is not that of a length, but of one over // length). template Tensor<1,dim> Solution::gradient (const Point &p, @@ -940,7 +950,7 @@ namespace Step7 // // For this, we will use the following convention: Faces belonging to Gamma1 // will have the boundary indicator 0 (which is the default, so - // we don't have to set it explicitely), and faces belonging to Gamma2 will + // we don't have to set it explicitly), and faces belonging to Gamma2 will // use 1 as boundary indicator. To set these values, we loop // over all cells, then over all faces of a given cell, check whether it is // part of the boundary that we want to denote by Gamma2, and if so set its diff --git a/deal.II/examples/step-8/doc/intro.dox b/deal.II/examples/step-8/doc/intro.dox index 9c04cb3435..5dd3e7bff4 100644 --- a/deal.II/examples/step-8/doc/intro.dox +++ b/deal.II/examples/step-8/doc/intro.dox @@ -96,7 +96,7 @@ the $z$ direction; this is in contrast to many other two-dimensional equations that can be obtained by assuming that the body has infinite extent in $z$-direction and that the solution function does not depend on the $z$ coordinate. On the other hand, there are equations for two-dimensional models -of elasticity; see for example the wikipedia article on plane strain, antiplane shear and DoFHandler class and all other // classes used here are fully aware that the finite element we want to use // is vector-valued, and take care of the vector-valuedness of the finite diff --git a/deal.II/examples/step-9/step-9.cc b/deal.II/examples/step-9/step-9.cc index b5589551e5..e95c474a59 100644 --- a/deal.II/examples/step-9/step-9.cc +++ b/deal.II/examples/step-9/step-9.cc @@ -1,13 +1,23 @@ -/* Author: Wolfgang Bangerth, University of Heidelberg, 2000 */ +/* --------------------------------------------------------------------- + * $Id$ + * + * Copyright (C) 2000 - 2013 by the deal.II authors + * + * This file is part of the deal.II library. + * + * The deal.II library is free software; you can use it, redistribute + * it, and/or modify it under the terms of the GNU Lesser General + * Public License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * The full text of the license can be found in the file LICENSE at + * the top level of the deal.II distribution. + * + * --------------------------------------------------------------------- + + * + * Author: Wolfgang Bangerth, University of Heidelberg, 2000 + */ -/* $Id$ */ -/* */ -/* Copyright (C) 2000-2004, 2006-2008, 2010-2013 by the deal.II authors */ -/* */ -/* This file is subject to QPL and may not be distributed */ -/* without copyright and license information. Please refer */ -/* to the file deal.II/doc/license.html for the text and */ -/* further information on this license. */ // Just as in previous examples, we have to include several files of which the // meaning has already been discussed: @@ -36,7 +46,7 @@ #include #include -// The following two files provide classes and information for multi-threaded +// The following two files provide classes and information for multithreaded // programs. In the first one, the classes and functions are declared which we // need to start new threads and to wait for threads to return (i.e. the // Thread class and the new_thread functions). The @@ -142,7 +152,7 @@ namespace Step9 // @sect3{Equation data declaration} // Next we declare a class that describes the advection field. This, of - // course, is a vector field with as many compents as there are space + // course, is a vector field with as many components as there are space // dimensions. One could now use a class derived from the // Function base class, as we have done for boundary values and // coefficients in previous examples, but there is another possibility in @@ -391,7 +401,7 @@ namespace Step9 // rather than the common vectors of doubles, as the additional accuracy is // not necessary for estimated values. // - // In addition to these two functions, the class declares to exceptions + // In addition to these two functions, the class declares two exceptions // which are raised when a cell has no neighbors in each of the space // directions (in which case the matrix described in the introduction would // be singular and can't be inverted), while the other one is used in the @@ -507,14 +517,14 @@ namespace Step9 // information, we could use the value of the global variable // multithread_info.n_cpus, which is determined at start-up // time of your program automatically. (Note that if the library was not - // configured for multi-threading, then the number of CPUs is set to one.) + // configured for multithreading, then the number of CPUs is set to one.) // However, sometimes there might be reasons to use another value. For // example, you might want to use less processors than there are in your - // system in order not to use too many computational ressources. On the + // system in order not to use too many computational resources. On the // other hand, if there are several jobs running on a computer and you // want to get a higher percentage of CPU time, it might be worth to start // more threads than there are CPUs, as most operating systems assign - // roughly the same CPU ressources to all threads presently running. For + // roughly the same CPU resources to all threads presently running. For // this reason, the MultithreadInfo class contains a // read-write variable n_default_threads which is set to // n_cpus by default, but can be set to another value. This @@ -545,7 +555,7 @@ namespace Step9 // can be omitted. (However, you still need to write the angle brackets, // even if they are empty.) // - // If you did not configure for multi-threading, then the + // If you did not configure for multithreading, then the // new_thread function that is supposed to start a new thread // in parallel only executes the function which should be run in parallel, // waits for it to return (i.e. the function is executed sequentially), @@ -559,7 +569,7 @@ namespace Step9 // the same size. Each thread will then assemble the local contributions // of the cells within its chunk and transfer these contributions to the // global matrix. As splitting a range of cells is a rather common task - // when using multi-threading, there is a function in the + // when using multithreading, there is a function in the // Threads namespace that does exactly this. In fact, it does // this not only for a range of cell iterators, but for iterators in // general, so you could use it for std::vector::iterator or @@ -576,7 +586,7 @@ namespace Step9 // differ (begin_active returns an // active_iterator, while end returns a // raw_iterator), and in this case the C++ language requires - // us to specify the template type explicitely. For brevity, we first + // us to specify the template type explicitly. For brevity, we first // typedef this data type to an alias. typedef typename DoFHandler::active_cell_iterator active_cell_iterator; std::vector > @@ -586,7 +596,7 @@ namespace Step9 n_threads); // Finally, for each of the chunks of iterators we have computed, start - // one thread (or if not in multi-thread mode: execute assembly on these + // one thread (or if not in multithread mode: execute assembly on these // chunks sequentially). This is done using the following sequence of // function calls: for (unsigned int thread=0; threadassemble_system_interval function on the present object // (the this pointer), with the arguments following in the @@ -611,17 +621,17 @@ namespace Step9 // When all the threads are running, the only thing we have to do is wait // for them to finish. This is necessary of course, as we can't proceed // with our tasks before the matrix and right hand side are - // assemblesd. Waiting for all the threads to finish can be done using the - // joint_all function in the ThreadGroup + // assembled. Waiting for all the threads to finish can be done using the + // join_all function in the ThreadGroup // container, which just calls join on each of the thread // objects it stores. // - // Again, if the library was not configured to use multi-threading, then + // Again, if the library was not configured to use multithreading, then // no threads can run in parallel and the function returns immediately. threads.join_all (); - // After the matrix has been assembled in parallel, we stil have to + // After the matrix has been assembled in parallel, we still have to // eliminate hanging node constraints. This is something that can't be // done on each of the threads separately, so we have to do it now. hanging_node_constraints.condense (system_matrix); @@ -816,7 +826,7 @@ namespace Step9 // // On the other hand, we would now like to write the local // contributions to the global system of equations into the global - // objects. This needs some kind of synchronisation, as if we would + // objects. This needs some kind of synchronization, as if we would // not take care of the fact that multiple threads write into the // matrix at the same time, we might be surprised that one threads // reads data from the matrix that another thread is presently @@ -845,7 +855,7 @@ namespace Step9 // i.e. other threads can now enter into the protected section by // acquiring the lock. Two final notes are in place here, however: // - // 1. If the library was not configured for multi-threading, then + // 1. If the library was not configured for multithreading, then // there can't be parallel threads and there is no need to // synchronize. Thus, the lock and release // functions are no-ops, i.e. they return without doing anything. @@ -1273,7 +1283,7 @@ namespace Step9 // can determine an approximation of the gradient for the present // cell, then we need to have passed over vectors y which // span the whole space, otherwise we would not have all components of - // the gradient. This is indicated by the invertability of the matrix. + // the gradient. This is indicated by the invertibility of the matrix. // // If the matrix should not be invertible, this means that the present // cell had an insufficient number of active neighbors. In contrast to diff --git a/deal.II/include/CMakeLists.txt b/deal.II/include/CMakeLists.txt index 8cf4306ebd..973a950db4 100644 --- a/deal.II/include/CMakeLists.txt +++ b/deal.II/include/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Configure config.h diff --git a/deal.II/include/deal.II/algorithms/newton.h b/deal.II/include/deal.II/algorithms/newton.h index 46810d0beb..23ac4519a4 100644 --- a/deal.II/include/deal.II/algorithms/newton.h +++ b/deal.II/include/deal.II/algorithms/newton.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__newton_h #define __deal2__newton_h diff --git a/deal.II/include/deal.II/algorithms/newton.templates.h b/deal.II/include/deal.II/algorithms/newton.templates.h index a7b81721bb..a57c34d233 100644 --- a/deal.II/include/deal.II/algorithms/newton.templates.h +++ b/deal.II/include/deal.II/algorithms/newton.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Guido Kanschat +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/include/deal.II/algorithms/operator.h b/deal.II/include/deal.II/algorithms/operator.h index f4e407d1e1..de940de86f 100644 --- a/deal.II/include/deal.II/algorithms/operator.h +++ b/deal.II/include/deal.II/algorithms/operator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__operator_h #define __deal2__operator_h @@ -21,6 +26,17 @@ DEAL_II_NAMESPACE_OPEN +/** + * Namespace containing numerical algorithms in a unified form. + * + * All algorithmic classes in this namespace are derived from either + * Operator or OutputOperator, depending on whether they return a + * value or not. See the documentation of those classes for more + * detailed information on how to use them. + * + * @author Guido Kanschat + * @date 2012, 2013 + */ namespace Algorithms { /** diff --git a/deal.II/include/deal.II/algorithms/operator.templates.h b/deal.II/include/deal.II/algorithms/operator.templates.h index bfab37b2d9..173d10b9b7 100644 --- a/deal.II/include/deal.II/algorithms/operator.templates.h +++ b/deal.II/include/deal.II/algorithms/operator.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Guido Kanschat +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/include/deal.II/algorithms/theta_timestepping.h b/deal.II/include/deal.II/algorithms/theta_timestepping.h index 3dc9fa5d82..e1a2d0c40d 100644 --- a/deal.II/include/deal.II/algorithms/theta_timestepping.h +++ b/deal.II/include/deal.II/algorithms/theta_timestepping.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__theta_timestepping_h #define __deal2__theta_timestepping_h 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 5dd1d33e12..b0f1366641 100644 --- a/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h +++ b/deal.II/include/deal.II/algorithms/theta_timestepping.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Guido Kanschat +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/include/deal.II/algorithms/timestep_control.h b/deal.II/include/deal.II/algorithms/timestep_control.h index 4a2b28a874..551caadb27 100644 --- a/deal.II/include/deal.II/algorithms/timestep_control.h +++ b/deal.II/include/deal.II/algorithms/timestep_control.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by Guido Kanschat +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__time_step_control_h #define __deal2__time_step_control_h 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 c85d9ff928..1275360d54 100644 --- a/deal.II/include/deal.II/base/auto_derivative_function.h +++ b/deal.II/include/deal.II/base/auto_derivative_function.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__auto_derivative_function_h #define __deal2__auto_derivative_function_h diff --git a/deal.II/include/deal.II/base/conditional_ostream.h b/deal.II/include/deal.II/base/conditional_ostream.h index 753ade963e..0a105240df 100644 --- a/deal.II/include/deal.II/base/conditional_ostream.h +++ b/deal.II/include/deal.II/base/conditional_ostream.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__conditional_ostream_h #define __deal2__conditional_ostream_h diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 43d4365906..ad1681b62e 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -1,14 +1,18 @@ -//---------------------------- config.h.in --------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012, 2013 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// TODO: Header +// This file is part of the deal.II library. // -// Author: Matthias Maier +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. // -//---------------------------- config.h.in --------------------------- +// --------------------------------------------------------------------- #ifndef __deal2__config_h #define __deal2__config_h @@ -184,12 +188,6 @@ * Configured in check_2_compiler_bugs: * ****************************************/ -/* Defined if we have to work around a bug where the compiler doesn't accept - * an explicit destructor call. See the aclocal.m4 file in the top-level - * directory for a description of this bug. - */ -#cmakedefine DEAL_II_EXPLICIT_DESTRUCTOR_BUG - /* Defined if we have to work around a bug with some compilers that will not * allow us to specify a fully specialized class of a template as a friend. * See the aclocal.m4 file in the top-level directory for a description of @@ -349,6 +347,31 @@ #cmakedefine DEAL_II_WITH_P4EST #ifdef DEAL_II_WITH_P4EST # define DEAL_II_USE_P4EST + +# define DEAL_II_P4EST_VERSION_MAJOR @P4EST_VERSION_MAJOR@ +# define DEAL_II_P4EST_VERSION_MINOR @P4EST_VERSION_MINOR@ +# define DEAL_II_P4EST_VERSION_SUBMINOR @P4EST_VERSION_SUBMINOR@ +# define DEAL_II_P4EST_VERSION_PATCH @P4EST_VERSION_PATCH@ + +# define DEAL_II_P4EST_VERSION_GTE(major,minor,subminor,patch) \ + ((DEAL_II_P4EST_VERSION_MAJOR * 1000000 + \ + DEAL_II_P4EST_VERSION_MINOR * 10000 + \ + DEAL_II_P4EST_VERSION_SUBMINOR * 100 + \ + DEAL_II_P4EST_VERSION_PATCH) \ + >= \ + (major)*1000000 + (minor)*10000 + (subminor)*100 + (patch)) +#else + // p4est up to 0.3.4.1 didn't define P4EST_VERSION_*. since + // we didn't supports anything before 0.3.4, we assume 0.3.4 + // This means that we can't use the new features in 0.3.4.1 +# define DEAL_II_P4EST_VERSION_GTE(major,minor,subminor,patch) \ + ((0 * 1000000 + \ + 3 * 10000 + \ + 4 * 100 + \ + 0) \ + >= \ + (major)*1000000 + (minor)*10000 + (subminor)*100 + (patch)) + #endif diff --git a/deal.II/include/deal.II/base/convergence_table.h b/deal.II/include/deal.II/base/convergence_table.h index a262a6be3b..70c940c482 100644 --- a/deal.II/include/deal.II/base/convergence_table.h +++ b/deal.II/include/deal.II/base/convergence_table.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__convergence_table_h #define __deal2__convergence_table_h @@ -188,7 +193,7 @@ public: * 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. + * evaluate_convergence_rates() for each column separately. * * Example: * Columns like n cells or n dofs columns may be wanted to 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 0ce000d902..5ea4eb017b 100644 --- a/deal.II/include/deal.II/base/data_out_base.h +++ b/deal.II/include/deal.II/base/data_out_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__data_out_base_h #define __deal2__data_out_base_h @@ -39,6 +44,7 @@ DEAL_II_NAMESPACE_OPEN class ParameterHandler; class XDMFEntry; +class DataOutFilter; /** * This is a base class for output of data on meshes of very general @@ -214,33 +220,24 @@ class DataOutBase { public: /** - * Data structure describing a patch of - * data in dim space + * 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 + *
    • 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. + * 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 2dim. * * @ingroup output * @@ -250,34 +247,23 @@ public: struct Patch { /** - * Make the spacedim template - * parameter available. + * 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. + * 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. + * 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[dim > 0 ? @@ -286,124 +272,77 @@ public: 1]; /** - * Number of this - * patch. Since we are not - * sure patches are handled - * in the same order, always, - * we better store this. + * 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. + * 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. + * 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. + * 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. + * 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. + * Bool flag indicating, whether the coordinates of the inner + * patch points are appended to the @p data table (@p true) or not + * (@p 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. + * 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. + * 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. + * 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. + * 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. + * 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 @@ -421,47 +360,36 @@ public: }; /** - * Flags controlling the details of - * output in OpenDX format. + * 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. + * 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. + * Write integer values of the Triangulation in binary format. */ bool int_binary; /** - * Write coordinate vectors in - * binary format. + * Write coordinate vectors in binary format. */ bool coordinates_binary; /** - * Write data vectors in - * binary format. + * Write data vectors in binary format. */ bool data_binary; /** - * Write binary coordinate - * vectors as double (64 bit) - * numbers instead of float (32 bit). + * Write binary coordinate vectors as double (64 bit) numbers + * instead of float (32 bit). */ bool data_double; @@ -474,56 +402,40 @@ public: const bool data_binary = false); /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. + * 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. + * 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. + * 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. + * 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. + * 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. + * 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. */ @@ -535,45 +447,33 @@ public: UcdFlags (const bool write_preamble = false); /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. + * 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. + * 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. + * 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. + * 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 + * Flags controlling the details of output in Gnuplot format. At * present no flags are implemented. * * @ingroup output @@ -582,12 +482,9 @@ public: { 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). + * 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; @@ -598,74 +495,56 @@ public: GnuplotFlags (); /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. + * 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. + * 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. + * 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. + * 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. + * 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 + * Normal vector interpolation, if set to true * * default = false */ bool smooth; /** - * Use bicubic patches (b-splines) - * instead of triangles. + * 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. + * include external "data.inc" with camera, light and texture + * definition for the scene. * * default = false */ @@ -679,79 +558,59 @@ public: const bool external_data = false); /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. + * 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. + * 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. + * 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. + * 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. + * 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 + * 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. + * 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 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 { @@ -767,49 +626,34 @@ public: 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. + * 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. + * 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. + * 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. + * Angle of the line origin-viewer against the z-axis in degrees. * - * Default is the Gnuplot-default - * of 60. + * 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. + * 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 example of a - * Gnuplot-default of 0 is - * the following: + * Default is the Gnuplot-default of 30. An example of a + * Gnuplot-default of 0 is the following: * * @verbatim * @@ -828,75 +672,58 @@ public: 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. + * 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. + * 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. + * 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 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). + * 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. + * 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 + * #color_function. * * Default is true. */ bool shade_cells; /** - * Structure keeping the three color - * values in the RGB system. + * Structure keeping the three color values in the RGB system. */ struct RgbValues { @@ -905,52 +732,39 @@ public: float blue; /** - * Return true if the - * color represented by - * the three color values - * is a grey scale, - * i.e. all components - * are equal. + * 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. + * 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. + * 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. + * 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. + * 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. + * This function was originally written by Stefan Nauber. */ static RgbValues default_color_function (const double value, @@ -958,12 +772,9 @@ public: 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 + * 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 @@ -972,18 +783,11 @@ public: 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. + * 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, @@ -1007,51 +811,37 @@ public: const ColorFunction color_function= &default_color_function); /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. + * 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. + * 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. + * 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. + * 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. + * 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. + * Flags controlling the details of output in GMV format. At present + * no flags are implemented. * * @ingroup output */ @@ -1059,12 +849,9 @@ public: { 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). + * 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; @@ -1075,46 +862,33 @@ public: GmvFlags (); /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. + * 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. + * 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. + * 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. + * 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. + * Flags controlling the details of output in Tecplot format. * * @ingroup output */ @@ -1124,20 +898,16 @@ public: 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. + * Tecplot allows to assign names to zones. This variable stores + * this name. */ const char *zone_name; @@ -1148,46 +918,33 @@ public: const char *zone_name = NULL); /** - * Declare all flags with name - * and type as offered by this - * class, for use in input files. + * 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. + * 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. + * 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. + * 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. + * Flags controlling the details of output in VTK format. * * @ingroup output */ @@ -1195,38 +952,48 @@ public: { public: /** - * The time of the time step if this file is part of a - * time dependent simulation. + * The time of the time step if this file is part of a time + * dependent simulation. * - * The value of this variable is written into the output file according - * to the instructions provided in + * The value of this variable is written into the output file + * according to the instructions provided in * http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files - * unless it is at its default value of std::numeric_limits::min(). + * unless it is at its default value of + * std::numeric_limits::min(). */ double time; /** - * The number of the time step if this file is part of a - * time dependent simulation, or the cycle within a nonlinear or other + * The number of the time step if this file is part of a time + * dependent simulation, or the cycle within a nonlinear or other * iteration. * - * The value of this variable is written into the output file according - * to the instructions provided in + * The value of this variable is written into the output file + * according to the instructions provided in * http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files - * unless it is at its default value of std::numeric_limits::min(). + * unless it is at its default value of + * std::numeric_limits::min(). */ unsigned int cycle; + /** + * Flag to determine whether the current date and time shall be + * printed as a comment in the file's second line. + * + * Default is true. + */ + bool print_date_and_time; + /** * Default constructor. */ - VtkFlags (const double time = std::numeric_limits::min(), - const unsigned int cycle = std::numeric_limits::min()); + VtkFlags (const double time = std::numeric_limits::min(), + const unsigned int cycle = std::numeric_limits::min(), + const bool print_date_and_time = true); /** - * Declare the flags with name - * and type as offered by this - * class, for use in input files. + * Declare the flags with name and type as offered by this class, + * for use in input files. * * Unlike the flags in many of the other classes similar to this one, we do * not actually declare parameters for the #cycle and #time member variables @@ -1239,31 +1006,21 @@ public: static void declare_parameters (ParameterHandler &prm); /** - * Read the parameters declared in - * declare_parameters and set the - * flags for this output format - * accordingly. + * 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. + * 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. + * 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; }; @@ -1274,103 +1031,91 @@ public: */ struct SvgFlags { - public: - /** - * 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; + public: + /** + * Height of the image in SVG + * units. Default value is 4000. + */ + unsigned int height; - /* - * Angles for the perspective view - */ - int azimuth_angle, polar_angle; - - unsigned int line_thickness; + /** + * Width of the image in SVG + units. If left zero, the width is computed from the height. + */ + unsigned int width; - /* - * Draw a margin of 5% around the plotted area - */ - bool margin; + /** + * 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; - /* - * Draw a colorbar encoding the cell coloring - */ - bool draw_colorbar; + /** + * Angles for the perspective view + */ + int azimuth_angle, polar_angle; - /* - * Constructor. - */ - SvgFlags(const unsigned int height_vector = 0, - const int azimuth_angle = 37, - const int polar_angle = 45, - const unsigned int line_thickness = 1, - const bool margin = true, - const bool draw_colorbar = true); + unsigned int line_thickness; - /** - * 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; - - private: + /** + * Draw a margin of 5% around the plotted area + */ + bool margin; + + /** + * Draw a colorbar encoding the cell coloring + */ + bool draw_colorbar; + + /** + * Constructor. + */ + SvgFlags(const unsigned int height_vector = 0, + const int azimuth_angle = 37, + const int polar_angle = 45, + const unsigned int line_thickness = 1, + const bool margin = true, + const bool draw_colorbar = true); + + /** + * 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; + + private: }; /** - * Flags controlling the details - * of output in deal.II - * intermediate format. At - * present no flags are - * implemented. + * 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). + * 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; @@ -1380,6 +1125,59 @@ public: */ 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; + }; + + /** + * Flags controlling the DataOutFilter. + * + * @ingroup output + */ + + struct DataOutFilterFlags + { + /** + * Filter duplicate vertices and associated values. This will + * drastically reduce the output data size but may affect the + * correctness of some calculated values. + */ + bool filter_duplicate_vertices; + + /** + * Whether the XDMF output refers to HDF5 files. + * This affects how output is structured. + */ + bool xdmf_hdf5_output; + + /** + * Constructor. + */ + DataOutFilterFlags (const bool filter_duplicate_vertices = false, + const bool xdmf_hdf5_output = false); + /** * Declare all flags with name * and type as offered by this @@ -1396,37 +1194,198 @@ public: * The flags thus obtained overwrite * all previous contents of this object. */ - void parse_parameters (const ParameterHandler &prm) const; + 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. + * object. */ std::size_t memory_consumption () const; }; /** - * Provide a data type specifying - * the presently supported output + * DataOutFilter provides a way to remove redundant vertices and values + * generated by the deal.II output. By default, DataOutBase and the classes + * that build on it output data at each corner of each cell. This means + * that data is output multiple times for each vertex of the mesh. The + * purpose of this scheme is to support output of discontinuous quantities, + * either because the finite element space is discontinuous or because the + * quantity that is output is computed from a solution field and is + * discontinuous across faces. + * + * This class is an attempt to rein in the amount of data that is written. + * If the fields that are written to files are indeed discontinuous, the + * only way to faithfully represent them is indeed to write multiple + * values for each vertex (this is typically done by writing multiple + * node locations for the same vertex and defining data at these nodes). + * However, for fine meshes, one may not necessarily be interested in an + * exact representation of output fields that will likely only have + * small discontinuities. Rather, it may be sufficient to just output one + * value per vertex, which may be chosen arbitrarily from among those that + * are defined at this vertex from any of the adjacent cells. + */ + class DataOutFilter + { + private: + /** + * Empty class to provide comparison function for Map3DPoint. + */ + struct Point3Comp + { + bool operator() (const Point<3> &lhs, const Point<3> &rhs) const + { + return (lhs(0) < rhs(0) || (!(rhs(0) < lhs(0)) && (lhs(1) < rhs(1) || (!(rhs(1) < lhs(1)) && lhs(2) < rhs(2))))); + } + }; + + typedef std::multimap, unsigned int, Point3Comp> Map3DPoint; + + /// Flags used to specify filtering behavior + DataOutBase::DataOutFilterFlags flags; + + /// Dimensionality of the nodes, used to properly output filtered data + int node_dim; + + /// Number of vertices per cell + int n_cell_verts; + + /// Map of points to an internal index + Map3DPoint existing_points; + + /// Map of actual point index to internal point index + std::map filtered_points; + + /// Map of cells to the filtered points + std::map filtered_cells; + + /// Data set names + std::vector data_set_names; + + /// Data set dimensions + std::vector data_set_dims; + + /// Data set data + std::vector > data_sets; + + /** + * Record a cell vertex index based on the internal reordering. + */ + void internal_add_cell(const unsigned int &cell_index, const unsigned int &pt_index); + + public: + DataOutFilter() : flags(false, true) {}; + DataOutFilter(const DataOutBase::DataOutFilterFlags &flags) : flags(flags) {}; + + /** + * Write a point with the specified index into the filtered + * data set. If the point already exists and we are filtering + * redundant values, the provided index will internally refer + * to another recorded point. + */ + template + void write_point(const unsigned int &index, const Point &p); + + /** + * Record a deal.II cell in the internal reordered format. + */ + template + void write_cell(unsigned int index, unsigned int start, unsigned int d1, unsigned int d2, unsigned int d3); + + /** + * Filter and record a data set. If there are multiple values + * at a given vertex and redundant values are being removed, one + * is arbitrarily chosen as the recorded value. In the future + * this can be expanded to average/min/max multiple values + * at a given vertex. + */ + void write_data_set(const std::string &name, const unsigned int &dimension, const unsigned int &set_num, const Table<2,double> &data_vectors); + + /** + * Resize and fill a vector with all the filtered + * node vertex points, for output to a file. + */ + void fill_node_data(std::vector &node_data) const; + + /** + * Resize and fill a vector with all the filtered + * cell vertex indices, for output to a file. + */ + void fill_cell_data(const unsigned int &local_node_offset, std::vector &cell_data) const; + + /** + * Get the name of the data set indicated by the set number. + */ + std::string get_data_set_name(const unsigned int &set_num) const + { + return data_set_names.at(set_num); + }; + + /** + * Get the dimensionality of the data set indicated by the set number. + */ + unsigned int get_data_set_dim(const unsigned int &set_num) const + { + return data_set_dims.at(set_num); + }; + + /** + * Get the raw double valued data of the data set indicated by the set number. + */ + const double *get_data_set(const unsigned int &set_num) const + { + return &data_sets[set_num][0]; + }; + + /** + * Return the number of nodes in this DataOutFilter. This may be smaller + * than the original number of nodes if filtering is enabled. + */ + unsigned int n_nodes() const + { + return existing_points.size(); + }; + + /** + * Return the number of filtered cells in this DataOutFilter. Cells are + * not filtered so this will be the original number of cells. + */ + unsigned int n_cells() const + { + return filtered_cells.size()/n_cell_verts; + }; + + /** + * Return the number of filtered data sets in this DataOutFilter. Data sets are + * not filtered so this will be the original number of data sets. + */ + unsigned int n_data_sets() const + { + return data_set_names.size(); + }; + + /** + * Empty functions to do base class inheritance. + */ + void flush_points () {}; + + /** + * Empty functions to do base class inheritance. + */ + void flush_cells () {}; + + }; + + + /** + * Provide a data type specifying the presently supported output * formats. */ enum OutputFormat { /** - * Use the format already - * stored in the object. + * Use the format already stored in the object. */ default_format, /** @@ -1438,24 +1397,19 @@ public: */ dx, /** - * Output in the UCD format - * for AVS. + * Output in the UCD format for AVS. */ ucd, /** - * Output for the - * Gnuplot tool. + * Output for the Gnuplot tool. */ gnuplot, /** - * Output for the - * Povray - * raytracer. + * Output for the Povray raytracer. */ povray, /** - * Output in encapsulated - * PostScript. + * Output in encapsulated PostScript. */ eps, /** @@ -1463,56 +1417,46 @@ public: */ gmv, /** - * Output for - * Tecplot in text - * format. + * Output for Tecplot in text format. */ tecplot, /** - * Output for - * Tecplot in - * binary format. Faster - * and smaller than text - * format. + * Output for Tecplot in binary format. Faster and smaller than + * text format. */ tecplot_binary, /** - * Output in - * VTK format. + * Output in VTK format. */ vtk, /** - * Output in - * VTK format. + * Output in VTK format. */ vtu, /** - * Output in - * SVG format. + * Output in SVG format. */ svg, /** - * Output in deal.II - * intermediate format. + * Output in deal.II intermediate format. */ deal_II_intermediate, /** - * Output in - * HDF5 format. + * Output in HDF5 format. */ hdf5 }; /** - * Write the given list of patches to the output stream in - * OpenDX format. + * Write the given list of patches to the output stream in OpenDX + * format. * * Since OpenDX uses some kind of visual data flow oriented * programming language, some of these programs are provided in @@ -1529,15 +1473,15 @@ public: * Write the given list of patches to the output stream in eps format. * * Output in this format circumvents the use of auxiliary graphic - * programs converting some output format into a graphics format. This - * has the advantage that output is easy and fast, and the - * disadvantage that you have to give a whole bunch of parameters - * which determine the direction of sight, the mode of colorization, - * the scaling of the height axis, etc. (Of course, all these - * parameters have reasonable default values, which you may want to - * change from time to time.) At present, this format only supports - * output for two-dimensional data, with values in the third direction - * taken from a data vector. + * programs converting some output format into a graphics + * format. This has the advantage that output is easy and fast, and + * the disadvantage that you have to give a whole bunch of + * parameters which determine the direction of sight, the mode of + * colorization, the scaling of the height axis, etc. (Of course, + * all these parameters have reasonable default values, which you + * may want to change from time to time.) At present, this format + * only supports output for two-dimensional data, with values in the + * third direction taken from a data vector. * * Basically, output consists of the mesh and the cells in between * them. You can draw either of these, or both, or none if you are @@ -1843,7 +1787,8 @@ public: * DataOutInterface::write_vtu_footer() and DataOutInterface::write_vtu_main() * by DataOutBase::write_vtu(). */ - static void write_vtu_header (std::ostream &out); + static void write_vtu_header (std::ostream &out, + const VtkFlags &flags); /** * This writes the footer for the xml based vtu file format. This @@ -1865,23 +1810,23 @@ public: const std::vector > &vector_data_ranges, const VtkFlags &flags, std::ostream &out); - + /** * Write the given list of patches to the output stream in SVG format. * - * SVG (Scalable Vector Graphics) is an XML-based vector image format - * developed and maintained by the World Wide Web Consortium (W3C). - * This function conforms to the latest specification SVG 1.1, + * SVG (Scalable Vector Graphics) is an XML-based vector image format + * developed and maintained by the World Wide Web Consortium (W3C). + * This function conforms to the latest specification SVG 1.1, * released on August 16, 2011. Controlling the graphic output is - * possible by setting or clearing the respective flags (see the - * SvgFlags struct). At present, this format only supports output + * possible by setting or clearing the respective flags (see the + * SvgFlags struct). At present, this format only supports output * for two-dimensional data, with values in the third direction * taken from a data vector. - * - * For the output, each patch is subdivided into four triangles - * which are then written as polygons and filled with a linear - * color gradient. The arising coloring of the patches visualizes - * the data values at the vertices taken from the specified data + * + * For the output, each patch is subdivided into four triangles + * which are then written as polygons and filled with a linear + * color gradient. The arising coloring of the patches visualizes + * the data values at the vertices taken from the specified data * vector. A colorbar can be drawn to encode the coloring. * * @note Yet only implemented for two dimensions with an additional @@ -1893,7 +1838,7 @@ public: const std::vector > &vector_data_ranges, const SvgFlags &flags, std::ostream &out); - + /** * Write the given list of patches to the output stream in deal.II * intermediate format. This is not a format understood by any other @@ -1942,95 +1887,87 @@ public: const Deal_II_IntermediateFlags &flags, std::ostream &out); + /** + * Write the data in data_filter to a single HDF5 file containing both + * the mesh and solution values. + */ template - static void write_hdf5_parallel ( - const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const char *filename, - MPI_Comm comm); + static void write_hdf5_parallel (const std::vector > &patches, + const DataOutFilter &data_filter, + const std::string &filename, + MPI_Comm comm); + /** + * Write the data in data_filter to HDF5 file(s). If write_mesh_file + * is false, the mesh data will not be written and the solution + * file will contain only the solution values. If write_mesh_file + * is true and the filenames are the same, the resulting file will + * contain both mesh data and solution values. + */ template - static XDMFEntry create_xdmf_entry (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const char *h5_filename, - const double cur_time, - MPI_Comm comm); + static void write_hdf5_parallel (const std::vector > &patches, + const DataOutFilter &data_filter, + const bool write_mesh_file, + const std::string &mesh_filename, + const std::string &solution_filename, + MPI_Comm comm); + /** + * DataOutFilter is an intermediate data format that reduces the amount of + * data that will be written to files. The object filled by this function + * can then later be used again to write data in a concrete file format; + * see, for example, DataOutBase::write_hdf5_parallel(). + */ template - static void write_xdmf_file ( - const std::vector > &patches, - const std::vector &entries, - const char *filename, - MPI_Comm comm); - - /** - * Given an input stream that contains - * data written by - * write_deal_II_intermediate, determine - * the dim and spacedim - * template parameters with which that - * function was called, and return them - * as a pair of values. - * - * Note that this function eats a number - * of elements at the present position of - * the stream, and therefore alters - * it. In order to read from it using, - * for example, the DataOutReader class, - * you may wish to either reset the - * stream to its previous position, or - * close and reopen it. + static void write_filtered_data (const std::vector > &patches, + const std::vector &data_names, + const std::vector > &vector_data_ranges, + DataOutFilter &filtered_data); + + /** + * Given an input stream that contains data written by + * write_deal_II_intermediate(), determine the dim and + * spacedim template parameters with which that function + * was called, and return them as a pair of values. + * + * Note that this function eats a number of elements at the present + * position of the stream, and therefore alters it. In order to read + * from it using, for example, the DataOutReader class, you may wish + * to either reset the stream to its previous position, or close and + * reopen it. */ static 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 + * 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 + * 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: + * Provide a function which tells us which suffix a file with a + * given output format usually has. At present the following formats + * are defined: *
    @note It would have been more reasonable to make this transform a template function - with the rank in DerivativeForm<1, dim, rank>. Unfortunately C++ does not - allow templatized virtual functions. This is why we identified - DerivativeForm<1, dim, 1> with a Tensor<1,dim> when using mapping_covariant - in the function transform above this one. + with the rank in DerivativeForm@<1, dim, rank@>. Unfortunately C++ does not + allow templatized virtual functions. This is why we identify + DerivativeForm@<1, dim, 1@> with a Tensor@<1,dim@> + when using mapping_covariant() in the function transform above this one. */ virtual @@ -580,12 +587,11 @@ public: @f] - @todo The formulas for @p mapping_covariant_gradient, - @p mapping_contravariant_gradient and @p mapping_piola_gradient - are only true as stated for linear mappings, - if the mapping is bilinear for example then there is a missing + @todo The formulas for mapping_covariant_gradient(), + mapping_contravariant_gradient() and mapping_piola_gradient() + are only true as stated for linear mappings. + If, for example, the mapping is bilinear then there is a missing term associated with the derivative of of J. - */ virtual void @@ -594,14 +600,6 @@ public: const InternalDataBase &internal, const MappingType type) const = 0; - - - - - - - - /** * @deprecated Use transform() instead. */ diff --git a/deal.II/include/deal.II/fe/mapping_c1.h b/deal.II/include/deal.II/fe/mapping_c1.h index a56e3c24d5..62bbafecda 100644 --- a/deal.II/include/deal.II/fe/mapping_c1.h +++ b/deal.II/include/deal.II/fe/mapping_c1.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mapping_c1_h #define __deal2__mapping_c1_h @@ -32,7 +37,7 @@ DEAL_II_NAMESPACE_OPEN * * To use this class, make sure that the * Boundary::@p get_normals_at_vertices function is implemented - * for the users boundary object. + * for the user's boundary object. * * For more information about the spacedim template parameter * check the documentation of FiniteElement or the one of @@ -45,71 +50,46 @@ class MappingC1 : public MappingQ { public: /** - * Constructor. Pass the fixed - * degree @p 3 down to the base - * class, as a cubic mapping - * suffices to generate a - * continuous mapping of the - * boundary. + * Constructor. Pass the fixed degree @p 3 down to the base class, as a + * cubic mapping suffices to generate a continuous mapping of the boundary. */ MappingC1 (); /** - * Return a pointer to a copy of the - * present object. The caller of this - * copy then assumes ownership of it. + * Return a pointer to a copy of the present object. The caller of this copy + * then assumes ownership of it. */ virtual Mapping *clone () const; protected: /** - * For dim=2,3. Append the - * support points of all shape - * functions located on bounding - * lines to the vector - * @p a. Points located on the - * line but on vertices are not - * included. + * For dim=2,3. Append the support points of all shape functions + * located on bounding lines to the vector @p a. Points located on the line + * but on vertices are not included. * - * Needed by the - * compute_support_points_simple(laplace) - * functions. For dim=1 this - * function is empty. + * Needed by the compute_support_points_simple(laplace) + * functions. For dim=1 this function is empty. * - * This function chooses the - * respective points not such - * that they are interpolating - * the boundary (as does the base - * class), but rather such that - * the resulting cubic mapping is - * a continuous one. + * This function chooses the respective points not such that they are + * interpolating the boundary (as does the base class), but rather such that + * the resulting cubic mapping is a continuous one. */ virtual void add_line_support_points (const typename Triangulation::cell_iterator &cell, std::vector > &a) const; /** - * For dim=3. Append the - * support points of all shape - * functions located on bounding - * faces (quads in 3d) to the - * vector @p a. Points located - * on the line but on vertices - * are not included. + * For dim=3. Append the support points of all shape functions + * located on bounding faces (quads in 3d) to the vector @p a. Points + * located on the line but on vertices are not included. * - * Needed by the - * @p compute_support_points_laplace - * function. For dim=1 and 2 - * this function is empty. + * Needed by the @p compute_support_points_laplace function. For + * dim=1 and 2 this function is empty. * - * This function chooses the - * respective points not such - * that they are interpolating - * the boundary (as does the base - * class), but rather such that - * the resulting cubic mapping is - * a continuous one. + * This function chooses the respective points not such that they are + * interpolating the boundary (as does the base class), but rather such that + * the resulting cubic mapping is a continuous one. */ virtual void add_quad_support_points(const typename Triangulation::cell_iterator &cell, diff --git a/deal.II/include/deal.II/fe/mapping_cartesian.h b/deal.II/include/deal.II/fe/mapping_cartesian.h index a08d2caa52..c7be0546c7 100644 --- a/deal.II/include/deal.II/fe/mapping_cartesian.h +++ b/deal.II/include/deal.II/fe/mapping_cartesian.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mapping_cartesian_h #define __deal2__mapping_cartesian_h diff --git a/deal.II/include/deal.II/fe/mapping_q.h b/deal.II/include/deal.II/fe/mapping_q.h index 3e1ae95444..28e4aefcbf 100644 --- a/deal.II/include/deal.II/fe/mapping_q.h +++ b/deal.II/include/deal.II/fe/mapping_q.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mapping_q_h #define __deal2__mapping_q_h @@ -27,9 +32,11 @@ template class TensorProductPolynomials; /*@{*/ /** - * Mapping class that uses Qp-mappings on boundary cells. The mapping - * shape functions make use of tensor product polynomials with - * equidistant (on the unit cell) support points. + * Mapping class that uses Qp-mappings on boundary cells. The mapping shape + * functions make use of tensor product polynomials with unit cell support + * points equal to the points of the Gauss-Lobatto quadrature formula. These + * points give a well-conditioned interpolation also for very high orders and + * are therefore preferred over equidistant support points. * * For more details about Qp-mappings, see the `mapping' report at * deal.II/doc/reports/mapping_q/index.html in the `Reports' @@ -39,6 +46,10 @@ template class TensorProductPolynomials; * check the documentation of FiniteElement or the one of * Triangulation. * + * @note Since the boundary description is closely tied to the unit cell + * support points, new boundary descriptions need to explicitly use the + * Gauss-Lobatto points. + * * @author Ralf Hartmann, 2000, 2001, 2005; Guido Kanschat 2000, 2001 */ template @@ -46,41 +57,25 @@ class MappingQ : public MappingQ1 { public: /** - * Constructor. @p p gives the - * degree of mapping polynomials - * on boundary cells. + * Constructor. @p p gives the degree of mapping polynomials on boundary + * cells. * - * The second argument determines - * whether the higher order - * mapping should also be used on - * interior cells. If its value - * is false (the - * default), the a lower-order - * mapping is used in the - * interior. This is sufficient - * for most cases where higher - * order mappings are only used - * to better approximate the - * boundary. In that case, cells - * bounded by straight lines are - * acceptable in the - * interior. However, there are - * cases where one would also - * like to use a higher order - * mapping in the interior. The - * MappingQEulerian class is one - * such case. + * The second argument determines whether the higher order mapping should + * also be used on interior cells. If its value is false (the + * default), the a lower-order mapping is used in the interior. This is + * sufficient for most cases where higher order mappings are only used to + * better approximate the boundary. In that case, cells bounded by straight + * lines are acceptable in the interior. However, there are cases where one + * would also like to use a higher order mapping in the interior. The + * MappingQEulerian class is one such case. */ MappingQ (const unsigned int p, const bool use_mapping_q_on_all_cells = false); /** - * Copy constructor. Performs a - * deep copy, i.e. duplicates - * what #tensor_pols points to - * instead of simply copying the - * #tensor_pols pointer as done - * by a default copy constructor. + * Copy constructor. Performs a deep copy, i.e. duplicates what #tensor_pols + * points to instead of simply copying the #tensor_pols pointer as done by a + * default copy constructor. */ MappingQ (const MappingQ &mapping); @@ -90,10 +85,8 @@ public: virtual ~MappingQ (); /** - * Transforms the point @p p on - * the unit cell to the point - * @p p_real on the real cell - * @p cell and returns @p p_real. + * Transforms the point @p p on the unit cell to the point @p p_real on the + * real cell @p cell and returns @p p_real. */ virtual Point transform_unit_to_real_cell ( @@ -101,46 +94,25 @@ public: const Point &p) const; /** - * Transforms the point @p p on - * the real cell to the point - * @p p_unit on the unit cell - * @p cell and returns @p p_unit. + * Transforms the point @p p on the real cell to the point @p p_unit on the + * unit cell @p cell and returns @p p_unit. * - * Uses Newton iteration and the - * @p transform_unit_to_real_cell - * function. + * Uses Newton iteration and the @p transform_unit_to_real_cell function. * - * In the codimension one case, - * this function returns the - * normal projection of the real - * point @p p on the curve or - * surface identified by the @p - * cell. + * In the codimension one case, this function returns the normal projection + * of the real point @p p on the curve or surface identified by the @p cell. * - * @note Polynomial mappings from - * the reference (unit) cell coordinates - * to the coordinate system of a real - * cell are not always invertible if - * the point for which the inverse - * mapping is to be computed lies - * outside the cell's boundaries. - * In such cases, the current function - * may fail to compute a point on - * the reference cell whose image - * under the mapping equals the given - * point @p p. If this is the case - * then this function throws an - * exception of type - * Mapping::ExcTransformationFailed . - * Whether the given point @p p lies - * outside the cell can therefore be - * determined by checking whether the - * return reference coordinates lie - * inside of outside the reference - * cell (e.g., using - * GeometryInfo::is_inside_unit_cell) - * or whether the exception mentioned - * above has been thrown. + * @note Polynomial mappings from the reference (unit) cell coordinates to + * the coordinate system of a real cell are not always invertible if the + * point for which the inverse mapping is to be computed lies outside the + * cell's boundaries. In such cases, the current function may fail to + * compute a point on the reference cell whose image under the mapping + * equals the given point @p p. If this is the case then this function + * throws an exception of type Mapping::ExcTransformationFailed . Whether + * the given point @p p lies outside the cell can therefore be determined by + * checking whether the return reference coordinates lie inside of outside + * the reference cell (e.g., using GeometryInfo::is_inside_unit_cell) or + * whether the exception mentioned above has been thrown. */ virtual Point transform_real_to_unit_cell ( @@ -167,23 +139,20 @@ public: const MappingType type) const; /** - * Return the degree of the - * mapping, i.e. the value which - * was passed to the constructor. + * Return the degree of the mapping, i.e. the value which was passed to the + * constructor. */ unsigned int get_degree () const; /** - * Return a pointer to a copy of the - * present object. The caller of this - * copy then assumes ownership of it. + * Return a pointer to a copy of the present object. The caller of this copy + * then assumes ownership of it. */ virtual Mapping *clone () const; /** - * Storage for internal data of - * Q_degree transformation. + * Storage for internal data of Q_degree transformation. */ class InternalData : public MappingQ1::InternalData { @@ -195,50 +164,35 @@ public: /** - * Return an estimate (in - * bytes) or the memory - * consumption of this - * object. + * Return an estimate (in bytes) or the memory consumption of this object. */ virtual std::size_t memory_consumption () const; /** - * Unit normal vectors. Used - * for the alternative - * computation of the normal - * vectors. See doc of the - * @p alternative_normals_computation - * flag. + * Unit normal vectors. Used for the alternative computation of the normal + * vectors. See doc of the @p alternative_normals_computation flag. * - * Filled (hardcoded) once in - * @p get_face_data. + * Filled (hardcoded) once in @p get_face_data. */ std::vector > > unit_normals; /** - * Flag that is set by the - * fill_fe_[[sub]face]_values - * function. + * Flag that is set by the fill_fe_[[sub]face]_values function. * - * If this flag is @p true - * we are on an interior cell - * and the - * @p mapping_q1_data is - * used. + * If this flag is @p true we are on an interior cell and the @p + * mapping_q1_data is used. */ bool use_mapping_q1_on_current_cell; /** - * On interior cells - * @p MappingQ1 is used. + * On interior cells @p MappingQ1 is used. */ typename MappingQ1::InternalData mapping_q1_data; }; protected: /** - * Implementation of the interface in - * Mapping. + * Implementation of the interface in Mapping. */ virtual void fill_fe_values (const typename Triangulation::cell_iterator &cell, @@ -253,8 +207,7 @@ protected: CellSimilarity::Similarity &cell_similarity) const ; /** - * Implementation of the interface in - * Mapping. + * Implementation of the interface in Mapping. */ virtual void fill_fe_face_values (const typename Triangulation::cell_iterator &cell, @@ -267,8 +220,7 @@ protected: typename std::vector > &normal_vectors) const ; /** - * Implementation of the interface in - * Mapping. + * Implementation of the interface in Mapping. */ virtual void fill_fe_subface_values (const typename Triangulation::cell_iterator &cell, @@ -282,55 +234,32 @@ protected: typename std::vector > &normal_vectors) const ; /** - * For dim=2,3. Append the - * support points of all shape - * functions located on bounding - * lines to the vector - * @p a. Points located on the - * line but not on vertices are not - * included. + * For dim=2,3. Append the support points of all shape functions + * located on bounding lines to the vector @p a. Points located on the line + * but not on vertices are not included. * - * Needed by the - * @p compute_support_points_laplace - * function . For dim=1 this - * function is empty. + * Needed by the @p compute_support_points_laplace function . For + * dim=1 this function is empty. * - * This function is made virtual - * in order to allow derived - * classes to choose shape - * function support points - * differently than the present - * class, which chooses the - * points as interpolation points - * on the boundary. + * This function is made virtual in order to allow derived classes to choose + * shape function support points differently than the present class, which + * chooses the points as interpolation points on the boundary. */ virtual void add_line_support_points (const typename Triangulation::cell_iterator &cell, std::vector > &a) const; /** - * For dim=3. Append the - * support points of all shape - * functions located on bounding - * faces (quads in 3d) to the - * vector @p a. Points located - * on the quad but not on vertices - * are not included. + * For dim=3. Append the support points of all shape functions + * located on bounding faces (quads in 3d) to the vector @p a. Points + * located on the quad but not on vertices are not included. * - * Needed by the - * @p compute_support_points_laplace - * function. For dim=1 and - * dim=2 this function is - * empty. + * Needed by the @p compute_support_points_laplace function. For + * dim=1 and dim=2 this function is empty. * - * This function is made virtual - * in order to allow derived - * classes to choose shape - * function support points - * differently than the present - * class, which chooses the - * points as interpolation points - * on the boundary. + * This function is made virtual in order to allow derived classes to choose + * shape function support points differently than the present class, which + * chooses the points as interpolation points on the boundary. */ virtual void add_quad_support_points(const typename Triangulation::cell_iterator &cell, @@ -354,145 +283,99 @@ private: const Quadrature& quadrature) const; /** - * Compute shape values and/or - * derivatives. + * Compute shape values and/or derivatives. */ virtual void compute_shapes_virtual (const std::vector > &unit_points, typename MappingQ1::InternalData &data) const; /** - * This function is needed by the - * constructor of MappingQ - * for dim= 2 and 3. + * This function is needed by the constructor of + * MappingQ for dim= 2 and 3. * - * For degree<4 this function - * sets the - * @p laplace_on_quad_vector to - * the hardcoded data. For - * degree>=4 and MappingQ<2> - * this vector is computed. + * For degree<4 this function sets the @p laplace_on_quad_vector to + * the hardcoded data. For degree>=4 and MappingQ<2> this vector is + * computed. * - * For the definition of the - * @p laplace_on_quad_vector - * please refer to equation (8) - * of the `mapping' report. + * For the definition of the @p laplace_on_quad_vector please refer to + * equation (8) of the `mapping' report. */ void set_laplace_on_quad_vector(Table<2,double> &loqvs) const; /** - * This function is needed by the - * constructor of MappingQ<3>. + * This function is needed by the constructor of MappingQ<3>. * - * For degree==2 this function - * sets the - * @p laplace_on_hex_vector to - * the hardcoded data. For - * degree>2 this vector is - * computed. + * For degree==2 this function sets the @p laplace_on_hex_vector to + * the hardcoded data. For degree>2 this vector is computed. * - * For the definition of the - * @p laplace_on_hex_vector - * please refer to equation (8) - * of the `mapping' report. + * For the definition of the @p laplace_on_hex_vector please refer to + * equation (8) of the `mapping' report. */ void set_laplace_on_hex_vector(Table<2,double> &lohvs) const; /** - * Computes the - * laplace_on_quad(hex)_vector. + * Computes the laplace_on_quad(hex)_vector. * - * Called by the - * set_laplace_on_quad(hex)_vector - * functions if the data is not - * yet hardcoded. + * Called by the set_laplace_on_quad(hex)_vector functions if the + * data is not yet hardcoded. * - * For the definition of the - * laplace_on_quad(hex)_vector - * please refer to equation (8) - * of the `mapping' report. + * For the definition of the laplace_on_quad(hex)_vector please + * refer to equation (8) of the `mapping' report. */ void compute_laplace_vector(Table<2,double> &lvs) const; /** - * Takes a - * laplace_on_hex(quad)_vector - * and applies it to the vector - * @p a to compute the inner - * support points as a linear - * combination of the exterior - * points. + * Takes a laplace_on_hex(quad)_vector and applies it to the vector + * @p a to compute the inner support points as a linear combination of the + * exterior points. * - * The vector @p a initially - * contains the locations of the - * @p n_outer points, the - * @p n_inner computed inner - * points are appended. + * The vector @p a initially contains the locations of the @p n_outer + * points, the @p n_inner computed inner points are appended. * - * See equation (7) of the - * `mapping' report. + * See equation (7) of the `mapping' report. */ void apply_laplace_vector(const Table<2,double> &lvs, std::vector > &a) const; /** - * Computes the support points of - * the mapping. + * Computes the support points of the mapping. */ virtual void compute_mapping_support_points( const typename Triangulation::cell_iterator &cell, std::vector > &a) const; /** - * Computes all support points of - * the mapping shape - * functions. The inner support - * points (ie. support points in - * quads for 2d, in hexes for 3d) - * are computed using the - * solution of a Laplace equation - * with the position of the outer - * support points as boundary - * values, in order to make the - * transformation as smooth as - * possible. + * Computes all support points of the mapping shape functions. The inner + * support points (ie. support points in quads for 2d, in hexes for 3d) are + * computed using the solution of a Laplace equation with the position of + * the outer support points as boundary values, in order to make the + * transformation as smooth as possible. */ void compute_support_points_laplace( const typename Triangulation::cell_iterator &cell, std::vector > &a) const; /** - * Needed by the - * @p laplace_on_quad function - * (for dim==2). Filled by the - * constructor. + * Needed by the @p laplace_on_quad function (for dim==2). Filled + * by the constructor. * * Sizes: - * laplace_on_quad_vector.size()= - * number of inner - * unit_support_points - * laplace_on_quad_vector[i].size()= - * number of outer - * unit_support_points, i.e. - * unit_support_points on the - * boundary of the quad + * laplace_on_quad_vector.size()= number of inner unit_support_points + * laplace_on_quad_vector[i].size()= number of outer unit_support_points, + * i.e. unit_support_points on the boundary of the quad * - * For the definition of this - * vector see equation (8) of the - * `mapping' report. + * For the definition of this vector see equation (8) of the `mapping' + * report. */ Table<2,double> laplace_on_quad_vector; /** - * Needed by the - * @p laplace_on_hex function - * (for dim==3). Filled by the - * constructor. + * Needed by the @p laplace_on_hex function (for dim==3). Filled by + * the constructor. * - * For the definition of this - * vector see equation (8) of the - * `mapping' report. + * For the definition of this vector see equation (8) of the `mapping' + * report. */ Table<2,double> laplace_on_hex_vector; @@ -504,69 +387,57 @@ private: << "laplace_vector not set for degree=" << arg1 << "."); /** - * Degree @p p of the - * polynomials used as shape - * functions for the Qp mapping + * Degree @p p of the polynomials used as shape functions for the Qp mapping * of cells at the boundary. */ const unsigned int degree; /** - * Number of inner mapping shape - * functions. + * Number of inner mapping shape functions. */ const unsigned int n_inner; /** - * Number of mapping shape - * functions on the boundary. + * Number of mapping shape functions on the boundary. */ const unsigned int n_outer; /** - * Pointer to the - * @p dim-dimensional tensor - * product polynomials used as - * shape functions for the Qp - * mapping of cells at the - * boundary. + * Pointer to the @p dim-dimensional tensor product polynomials used as + * shape functions for the Qp mapping of cells at the boundary. */ const TensorProductPolynomials *tensor_pols; /** - * Number of the Qp tensor - * product shape functions. + * Number of the Qp tensor product shape functions. */ const unsigned int n_shape_functions; /** - * Mapping from lexicographic to - * to the Qp shape function - * numbering. Its size is - * @p dofs_per_cell. + * Mapping from lexicographic to to the Qp shape function numbering. Its + * size is @p dofs_per_cell. */ const std::vector renumber; /** - * If this flag is set @p true - * then @p MappingQ is used on - * all cells, not only on - * boundary cells. + * If this flag is set @p true then @p MappingQ is used on all cells, not + * only on boundary cells. */ const bool use_mapping_q_on_all_cells; /** - * An FE_Q object which is only needed in - * 3D, since it knows how to reorder shape - * functions/DoFs on non-standard - * faces. This is used to reorder support - * points in the same way. We could make - * this a pointer to prevent construction - * in 1D and 2D, but since memory and time - * requirements are not particularly high - * this seems unnecessary at the moment. + * An FE_Q object which is only needed in 3D, since it knows how to reorder + * shape functions/DoFs on non-standard faces. This is used to reorder + * support points in the same way. We could make this a pointer to prevent + * construction in 1D and 2D, but since memory and time requirements are not + * particularly high this seems unnecessary at the moment. */ const FE_Q feq; + + /** + * Declare other MappingQ classes friends. + */ + template friend class MappingQ; }; /*@}*/ diff --git a/deal.II/include/deal.II/fe/mapping_q1.h b/deal.II/include/deal.II/fe/mapping_q1.h index 68b691875a..6cd251c64a 100644 --- a/deal.II/include/deal.II/fe/mapping_q1.h +++ b/deal.II/include/deal.II/fe/mapping_q1.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mapping_q1_h #define __deal2__mapping_q1_h diff --git a/deal.II/include/deal.II/fe/mapping_q1_eulerian.h b/deal.II/include/deal.II/fe/mapping_q1_eulerian.h index 2630565c0b..852ce715ac 100644 --- a/deal.II/include/deal.II/fe/mapping_q1_eulerian.h +++ b/deal.II/include/deal.II/fe/mapping_q1_eulerian.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mapping_q1_eulerian_h #define __deal2__mapping_q1_eulerian_h diff --git a/deal.II/include/deal.II/fe/mapping_q_eulerian.h b/deal.II/include/deal.II/fe/mapping_q_eulerian.h index 5976439541..f0a79f1066 100644 --- a/deal.II/include/deal.II/fe/mapping_q_eulerian.h +++ b/deal.II/include/deal.II/fe/mapping_q_eulerian.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mapping_q_eulerian_h #define __deal2__mapping_q_eulerian_h @@ -90,25 +95,14 @@ class MappingQEulerian : public MappingQ { public: /** - * Constructor. The first argument is - * the polynomical degree of the desired - * Qp mapping. It then takes a - * Vector & to specify the - * transformation of the domain - * from the reference to - * the current configuration. - * The organization of the - * elements in the @p Vector - * must follow the concept how - * deal.II stores solutions that - * are associated to a - * triangulation. This is - * automatically the case if the - * @p Vector represents the - * solution of the previous step - * of a nonlinear problem. - * Alternatively, the @p Vector - * can be initialized by + * Constructor. The first argument is the polynomical degree of the desired + * Qp mapping. It then takes a Vector & to specify the + * transformation of the domain from the reference to the current + * configuration. The organization of the elements in the @p Vector must + * follow the concept how deal.II stores solutions that are associated to a + * triangulation. This is automatically the case if the @p Vector + * represents the solution of the previous step of a nonlinear problem. + * Alternatively, the @p Vector can be initialized by * DoFAccessor::set_dof_values(). */ @@ -117,20 +111,16 @@ public: const DoFHandler &euler_dof_handler); /** - * Return a pointer to a copy of the - * present object. The caller of this - * copy then assumes ownership of it. + * Return a pointer to a copy of the present object. The caller of this copy + * then assumes ownership of it. */ virtual Mapping *clone () const; /** - * Always returns @p false because - * MappingQ1Eulerian does not in general - * preserve vertex locations (unless the - * translation vector happens to provide - * for zero displacements at vertex - * locations). + * Always returns @p false because MappingQ1Eulerian does not in general + * preserve vertex locations (unless the translation vector happens to + * provide for zero displacements at vertex locations). */ bool preserves_vertex_locations () const; @@ -141,10 +131,8 @@ public: protected: /** - * Implementation of the interface in - * MappingQ. Overrides the function in - * the base class, since we cannot use - * any cell similarity for this class. + * Implementation of the interface in MappingQ. Overrides the function in + * the base class, since we cannot use any cell similarity for this class. */ virtual void fill_fe_values (const typename Triangulation::cell_iterator &cell, @@ -159,36 +147,29 @@ protected: CellSimilarity::Similarity &cell_similarity) const; /** - * Reference to the vector of - * shifts. + * Reference to the vector of shifts. */ SmartPointer > euler_vector; /** - * Pointer to the DoFHandler to - * which the mapping vector is - * associated. + * Pointer to the DoFHandler to which the mapping vector is associated. */ - SmartPointer,MappingQEulerian > euler_dof_handler; private: /** - * Special quadrature rule used - * to define the support points - * in the reference configuration. + * Special quadrature rule used to define the support points in the + * reference configuration. */ class SupportQuadrature : public Quadrature { public: /** - * Constructor, with an argument - * defining the desired polynomial - * degree. + * Constructor, with an argument defining the desired polynomial degree. */ SupportQuadrature (const unsigned int map_degree); @@ -196,36 +177,26 @@ private: }; /** - * A member variable holding the - * quadrature points in the right - * order. + * A member variable holding the quadrature points in the right order. */ const SupportQuadrature support_quadrature; /** - * FEValues object used to query the - * the given finite element field - * at the support points in the - * reference configuration. + * FEValues object used to query the the given finite element field at the + * support points in the reference configuration. * - * The variable is marked as - * mutable since we have to call - * FEValues::reinit from - * compute_mapping_support_points, - * a function that is 'const'. + * The variable is marked as mutable since we have to call FEValues::reinit + * from compute_mapping_support_points, a function that is 'const'. */ mutable FEValues fe_values; /** - * A variable to guard access to - * the fe_values variable. + * A variable to guard access to the fe_values variable. */ mutable Threads::Mutex fe_values_mutex; /** - * Compute the positions of the - * support points in the current - * configuration + * Compute the positions of the support points in the current configuration */ virtual void compute_mapping_support_points( const typename Triangulation::cell_iterator &cell, diff --git a/deal.II/include/deal.II/grid/cell_id.h b/deal.II/include/deal.II/grid/cell_id.h new file mode 100644 index 0000000000..588a7f04af --- /dev/null +++ b/deal.II/include/deal.II/grid/cell_id.h @@ -0,0 +1,134 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef __deal2__cell_id_h +#define __deal2__cell_id_h + +#include +#include + +#include + + +DEAL_II_NAMESPACE_OPEN + + +/** + * A class to represent a unique ID for a cell in a Triangulation. + * This class stores the index of the coarse cell together with the + * information on how to reach the cell from that coarse cell (which + * child index to take on each level). The internal representation + * is not exposed on purpose. + * + * TODO: does it make sense to implement a more efficient representation + * (internally and/or as a string)? If yes, something like a 64bit int + * as in p4est would be a good option. + */ +class CellId +{ +public: + /** + * construct CellId with a given coarse_cell_index and list of child indices + */ + explicit CellId(unsigned int coarse_cell_id_, std::vector id_) + : coarse_cell_id(coarse_cell_id_), id(id_) + {} + + /** + * construct an empty CellId. + */ + CellId() + : coarse_cell_id(-1) + {} + + /** + * compare two CellIds + */ + bool operator== (const CellId &other) const; + + /** + * compare two CellIds + */ + bool operator!= (const CellId &other) const; + + + friend std::istream &operator>> (std::istream &is, CellId &cid); + friend std::ostream &operator<< (std::ostream &os, const CellId &cid); +private: + unsigned int coarse_cell_id; + std::vector id; +}; + +/** + * output CellId into a stream + */ +inline std::ostream &operator<< (std::ostream &os, const CellId &cid) +{ + os << cid.coarse_cell_id << '_' << cid.id.size() << ':'; + for (unsigned int i=0; i(cid.id[i]); + return os; +} + +/** + * read CellId from a stream + */ +inline std::istream &operator>> (std::istream &is, CellId &cid) +{ + unsigned int cellid; + is >> cellid; + if (is.eof()) + return is; + + cid.coarse_cell_id = cellid; + char dummy; + is >> dummy; + Assert(dummy=='_', ExcMessage("invalid CellId")); + unsigned int idsize; + is >> idsize; + is >> dummy; + Assert(dummy==':', ExcMessage("invalid CellId")); + + char value; + cid.id.clear(); + for (unsigned int i=0; i> value; + cid.id.push_back(value-'0'); + } + return is; +} + +inline bool +CellId::operator== (const CellId &other) const +{ + if (this->coarse_cell_id != other.coarse_cell_id) + return false; + return id == other.id; +} + +/** + * + */ +inline bool +CellId::operator!= (const CellId &other) const +{ + return !(*this == other); +} + +DEAL_II_NAMESPACE_CLOSE + +#endif diff --git a/deal.II/include/deal.II/grid/filtered_iterator.h b/deal.II/include/deal.II/grid/filtered_iterator.h index 2117169cb5..c6a4c56f84 100644 --- a/deal.II/include/deal.II/grid/filtered_iterator.h +++ b/deal.II/include/deal.II/grid/filtered_iterator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__filtered_iterator_h #define __deal2__filtered_iterator_h @@ -22,17 +27,16 @@ DEAL_II_NAMESPACE_OPEN /** * In this namespace a number of classes is declared that may be used - * as filters in the FilteredIterator class. The filters either - * check for binary information (for example, the IteratorFilters::Active filter - * class checks whether the object pointed to is active), or for - * valued information by comparison with prescribed values (for - * example, the LevelEqualTo filter class checks whether the - * level of the object pointed to by the iterator under consideration - * is equal to a value that was given to the filter upon construction. + * as filters in the FilteredIterator class. The filters either check + * for binary information (for example, the IteratorFilters::Active + * filter class checks whether the object pointed to is active), or + * for valued information by comparison with prescribed values (for + * example, the LevelEqualTo filter class checks whether the level of + * the object pointed to by the iterator under consideration is equal + * to a value that was given to the filter upon construction. * * For examples of use of these classes as well as requirements on - * filters see the general description of the FilteredIterator - * class. + * filters see the general description of the FilteredIterator class. * * @ingroup Iterators * @author Wolfgang Bangerth, 2002 @@ -40,10 +44,8 @@ DEAL_II_NAMESPACE_OPEN namespace IteratorFilters { /** - * Filter that evaluates to true if - * either the iterator points to an - * active object or an iterator - * past the end. + * Filter that evaluates to true if either the iterator points to an + * active object or an iterator past the end. * * @ingroup Iterators */ @@ -51,21 +53,17 @@ namespace IteratorFilters { public: /** - * Evaluate the iterator and - * return true if the object is - * active or past the end. + * Evaluate the iterator and return true if the object is active + * or past the end. */ template bool operator () (const Iterator &i) const; }; /** - * Filter that evaluates to true if - * either the iterator points to an - * object for which the user flag - * is set or an iterator past the - * end. See @ref GlossUserFlags - * for information about user flags. + * Filter that evaluates to true if either the iterator points to an + * object for which the user flag is set or an iterator past the + * end. See @ref GlossUserFlags for information about user flags. * * @ingroup Iterators */ @@ -73,10 +71,8 @@ namespace IteratorFilters { public: /** - * Evaluate the iterator and - * return true if the object - * has a set user flag or past - * the end. + * Evaluate the iterator and return true if the object has a set + * user flag or past the end. */ template bool operator () (const Iterator &i) const; @@ -84,12 +80,9 @@ namespace IteratorFilters /** - * Filter that evaluates to true if - * either the iterator points to an - * object for which the user flag - * is not set or an iterator past - * the end. Inverse filter to the - * previous class. + * Filter that evaluates to true if either the iterator points to an + * object for which the user flag is not set or an iterator past the + * end. Inverse filter to the previous class. * * @ingroup Iterators */ @@ -97,10 +90,8 @@ namespace IteratorFilters { public: /** - * Evaluate the iterator and - * return true if the object - * has an unset user flag or - * past the end. + * Evaluate the iterator and return true if the object has an + * unset user flag or past the end. */ template bool operator () (const Iterator &i) const; @@ -108,12 +99,9 @@ namespace IteratorFilters /** - * Filter for iterators that - * evaluates to true if either the - * iterator is past the end or the - * level of the object pointed to - * is equal to a value given to the - * constructor. + * Filter for iterators that evaluates to true if either the + * iterator is past the end or the level of the object pointed to is + * equal to a value given to the constructor. * * @ingroup Iterators */ @@ -121,27 +109,22 @@ namespace IteratorFilters { public: /** - * Constructor. Store the level - * which iterators shall have - * to be evaluated to true. + * Constructor. Store the level which iterators shall have to be + * evaluated to true. */ LevelEqualTo (const unsigned int level); /** - * Evaluation operator. Returns - * true if either the level of - * the object pointed to is - * equal to the stored value or - * the iterator is past the - * end. + * Evaluation operator. Returns true if either the level of the + * object pointed to is equal to the stored value or the iterator + * is past the end. */ template bool operator () (const Iterator &i) const; protected: /** - * Stored value to compare the - * level with. + * Stored value to compare the level with. */ const unsigned int level; }; @@ -149,15 +132,10 @@ namespace IteratorFilters /** - * Filter for iterators that - * evaluates to true if either the - * iterator is past the end or the - * subdomain id of the object - * pointed to is equal to a value - * given to the constructor, - * assuming that the iterator - * allows querying for a subdomain - * id). + * Filter for iterators that evaluates to true if either the + * iterator is past the end or the subdomain id of the object + * pointed to is equal to a value given to the constructor, assuming + * that the iterator allows querying for a subdomain id). * * @ingroup Iterators */ @@ -165,28 +143,22 @@ namespace IteratorFilters { public: /** - * Constructor. Store the - * subdomain which iterators - * shall have to be evaluated - * to true. + * Constructor. Store the subdomain which iterators shall have to + * be evaluated to true. */ SubdomainEqualTo (const types::subdomain_id subdomain_id); /** - * Evaluation operator. Returns - * true if either the subdomain - * of the object pointed to is - * equal to the stored value or - * the iterator is past the - * end. + * Evaluation operator. Returns true if either the subdomain of + * the object pointed to is equal to the stored value or the + * iterator is past the end. */ template bool operator () (const Iterator &i) const; protected: /** - * Stored value to compare the - * subdomain with. + * Stored value to compare the subdomain with. */ const types::subdomain_id subdomain_id; }; @@ -194,14 +166,12 @@ namespace IteratorFilters /** - * Filter for iterators that evaluates to - * true if a cell is owned by the current - * processor, i.e., if it is a - * @ref GlossLocallyOwnedCell "locally owned cell". + * Filter for iterators that evaluates to true if a cell is owned by + * the current processor, i.e., if it is a @ref + * GlossLocallyOwnedCell "locally owned cell". * - * This class is used in step-32, in - * connection with the methods of the @ref - * distributed module. + * This class is used in step-32, in connection with the methods of + * the @ref distributed module. * * @ingroup Iterators */ @@ -209,8 +179,26 @@ namespace IteratorFilters { public: /** - * Evaluation operator. Returns true if - * the cell is locally owned. + * Evaluation operator. Returns true if the cell is locally owned. + */ + template + bool operator () (const Iterator &i) const; + }; + + + + /** + * Filter for iterators that evaluates to true if th level subdomain + * id of a cell is equal to the current processor id. + * + * @ingroup Iterators + */ + class LocallyOwnedLevelCell + { + public: + /** + * Evaluation operator. Returns true if the level subdomain id of + * the cell is equal to the current processor id. */ template bool operator () (const Iterator &i) const; @@ -808,7 +796,11 @@ inline FilteredIterator:: FilteredIterator (const FilteredIterator &fi) : - BaseIterator (static_cast(fi)), +// this construction looks strange, but without going through the +// address of fi, GCC would not cast fi to the base class of type +// BaseIterator but tries to go through constructing a new +// BaseIterator with an Accessor. + BaseIterator (*(BaseIterator *)(&fi)), predicate (fi.predicate->clone ()) {} @@ -1142,6 +1134,17 @@ namespace IteratorFilters { return (i->is_locally_owned()); } + + +// ---------------- IteratorFilters::LocallyOwnedLevelCell --------- + + template + inline + bool + LocallyOwnedLevelCell::operator () (const Iterator &i) const + { + return (i->is_locally_owned_on_level()); + } } diff --git a/deal.II/include/deal.II/grid/grid_generator.h b/deal.II/include/deal.II/grid/grid_generator.h index 702bb1e01f..a3f4021278 100644 --- a/deal.II/include/deal.II/grid/grid_generator.h +++ b/deal.II/include/deal.II/grid/grid_generator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__grid_generator_h #define __deal2__grid_generator_h @@ -28,34 +33,25 @@ template class SparseMatrix; /** - * This class provides a collection of functions for generating basic - * triangulations. Below, we try to provide some pictures in order to - * illustrate at least the more complex ones. + * This namespace provides a collection of functions for generating + * triangulations for some basic geometries. * * Some of these functions receive a flag @p colorize. If this is - * set, parts of the boundary receive different boundary numbers, - * allowing them to be distinguished by application programs. See the - * documentation of the functions for details. - * - * Additionally this class provides a function - * (@p laplace_transformation) that smoothly transforms a grid - * according to given new boundary points. This can be used to - * transform (simple-shaped) grids to a more complicated ones, like a - * shell onto a grid of an airfoil, for example. - * - * No meshes for the codimension one case are provided at the moment. + * set, parts of the boundary receive different boundary indicators + * (@ref GlossBoundaryIndicator), + * allowing them to be distinguished for the purpose of attaching geometry + * objects and evaluating different boundary conditions. * + * This namespace also provides a function + * GridGenerator::laplace_transformation that smoothly transforms a domain + * into another one. This can be used to + * transform basic geometries to more complicated ones, like a + * shell to a grid of an airfoil, for example. * * @ingroup grid */ -class GridGenerator +namespace GridGenerator { -public: - /** - * Declare type for number of cell. - */ - typedef types::global_dof_index size_type; - /** * Initialize the given triangulation with a hypercube (line in 1D, square * in 2D, etc) consisting of exactly one cell. The hypercube volume is the @@ -74,9 +70,9 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void hyper_cube (Triangulation &tria, - const double left = 0., - const double right= 1.); + void hyper_cube (Triangulation &tria, + const double left = 0., + const double right= 1.); /** * Same as hyper_cube(), but with the difference that not only one cell is @@ -92,10 +88,10 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void subdivided_hyper_cube (Triangulation &tria, - const unsigned int repetitions, - const double left = 0., - const double right= 1.); + void subdivided_hyper_cube (Triangulation &tria, + const unsigned int repetitions, + const double left = 0., + const double right= 1.); /** * Create a coordinate-parallel brick from the two diagonally opposite @@ -113,10 +109,10 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void hyper_rectangle (Triangulation &tria, - const Point &p1, - const Point &p2, - const bool colorize = false); + void hyper_rectangle (Triangulation &tria, + const Point &p1, + const Point &p2, + const bool colorize = false); /** * Create a coordinate-parallel parallelepiped from the two diagonally @@ -150,13 +146,12 @@ public: * program. */ template - static void subdivided_hyper_rectangle (Triangulation &tria, const std::vector &repetitions, const Point &p1, const Point &p2, - const bool colorize=false); + const bool colorize=false); /** * Like the previous function. However, here the second argument does not @@ -174,13 +169,12 @@ public: * specified by the points @p p1 and @p p2. */ template - static void - subdivided_hyper_rectangle(Triangulation &tria, - const std::vector > &step_sizes, - const Point &p_1, - const Point &p_2, - const bool colorize); + subdivided_hyper_rectangle (Triangulation &tria, + const std::vector > &step_sizes, + const Point &p_1, + const Point &p_2, + const bool colorize); /** * Like the previous function, but with the following twist: the @p @@ -191,13 +185,12 @@ public: * i.e. the domain will have a void there. */ template - static void subdivided_hyper_rectangle (Triangulation &tria, const std::vector< std::vector > &spacing, const Point &p, - const Table &material_id, - const bool colorize=false); + const Table &material_id, + const bool colorize=false); /** * A parallelogram. The first corner point is the origin. The dim @@ -210,21 +203,19 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void - parallelogram(Triangulation &tria, - const Point (&corners)[dim], - const bool colorize=false); + parallelogram (Triangulation &tria, + const Point (&corners) [dim], + const bool colorize=false); /** * @deprecated Use the other function of same name. */ template - static void - parallelogram(Triangulation &tria, - const Tensor<2,dim> &corners, - const bool colorize=false) DEAL_II_DEPRECATED; + parallelogram (Triangulation &tria, + const Tensor<2,dim> &corners, + const bool colorize=false) DEAL_II_DEPRECATED; /** * A parallelepiped. The first corner point is the origin. The @@ -244,11 +235,10 @@ public: * function. */ template - static void - parallelepiped (Triangulation &tria, - const Point (&corners) [dim], - const bool colorize = false); + parallelepiped (Triangulation &tria, + const Point (&corners) [dim], + const bool colorize = false); /** * A subdivided parallelepiped. The first corner point is the @@ -263,10 +253,9 @@ public: * function. */ template - static void subdivided_parallelepiped (Triangulation &tria, - const size_type n_subdivisions, + const unsigned int n_subdivisions, const Point (&corners) [dim], const bool colorize = false); @@ -279,10 +268,9 @@ public: * function. */ template - static void subdivided_parallelepiped (Triangulation &tria, - const size_type ( n_subdivisions) [dim], + const unsigned int (n_subdivisions) [dim], const Point (&corners) [dim], const bool colorize = false); @@ -302,11 +290,11 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void enclosed_hyper_cube (Triangulation &tria, - const double left = 0., - const double right= 1., - const double thickness = 1., - const bool colorize = false); + void enclosed_hyper_cube (Triangulation &tria, + const double left = 0., + const double right= 1., + const double thickness = 1., + const bool colorize = false); /** * Initialize the given triangulation with a hyperball, i.e. a circle or a @@ -323,9 +311,9 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void hyper_ball (Triangulation &tria, - const Point ¢er = Point(), - const double radius = 1.); + void hyper_ball (Triangulation &tria, + const Point ¢er = Point(), + const double radius = 1.); /** * This class produces a half hyper-ball around center, which @@ -341,9 +329,9 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void half_hyper_ball (Triangulation &tria, - const Point ¢er = Point(), - const double radius = 1.); + void half_hyper_ball (Triangulation &tria, + const Point ¢er = Point(), + const double radius = 1.); /** * Create a cylinder around the x-axis. The cylinder extends from @@ -361,9 +349,9 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void cylinder (Triangulation &tria, - const double radius = 1., - const double half_length = 1.); + void cylinder (Triangulation &tria, + const double radius = 1., + const double half_length = 1.); /** * Create a cutted cone around the x-axis. The cone extends from @@ -390,11 +378,11 @@ public: * @author Markus Bürg, 2009 */ template - static void + void truncated_cone (Triangulation &tria, - const double radius_0 = 1.0, - const double radius_1 = 0.5, - const double half_length = 1.0); + const double radius_0 = 1.0, + const double radius_1 = 0.5, + const double half_length = 1.0); /** * Initialize the given triangulation with a hyper-L consisting of exactly @@ -412,9 +400,9 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void hyper_L (Triangulation &tria, - const double left = -1., - const double right= 1.); + void hyper_L (Triangulation &tria, + const double left = -1., + const double right= 1.); /** * Initialize the given Triangulation with a hypercube with a slit. In each @@ -432,10 +420,10 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void hyper_cube_slit (Triangulation &tria, - const double left = 0., - const double right= 1., - const bool colorize = false); + void hyper_cube_slit (Triangulation &tria, + const double left = 0., + const double right = 1., + const bool colorize = false); /** * Produce a hyper-shell, the region between two spheres around @@ -486,12 +474,12 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void hyper_shell (Triangulation &tria, - const Point ¢er, - const double inner_radius, - const double outer_radius, - const size_type n_cells = 0, - bool colorize = false); + void hyper_shell (Triangulation &tria, + const Point ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n_cells = 0, + bool colorize = false); /** * Produce a half hyper-shell, i.e. the space between two circles in two @@ -515,12 +503,12 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void half_hyper_shell (Triangulation &tria, - const Point ¢er, - const double inner_radius, - const double outer_radius, - const size_type n_cells = 0, - const bool colorize = false); + void half_hyper_shell (Triangulation &tria, + const Point ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n_cells = 0, + const bool colorize = false); /** @@ -544,12 +532,12 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void quarter_hyper_shell (Triangulation &tria, - const Point ¢er, - const double inner_radius, - const double outer_radius, - const size_type n_cells = 0, - const bool colorize = false); + void quarter_hyper_shell (Triangulation &tria, + const Point ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n_cells = 0, + const bool colorize = false); /** * Produce a domain that is the space between two cylinders in 3d, with @@ -564,12 +552,12 @@ public: * @note The triangulation needs to be void upon calling this function. */ template - static void cylinder_shell (Triangulation &tria, - const double length, - const double inner_radius, - const double outer_radius, - const size_type n_radial_cells = 0, - const size_type n_axial_cells = 0); + void cylinder_shell (Triangulation &tria, + const double length, + const double inner_radius, + const double outer_radius, + const unsigned int n_radial_cells = 0, + const unsigned int n_axial_cells = 0); @@ -587,9 +575,9 @@ public: * torus. */ - static void torus (Triangulation<2,3> &tria, - const double R, - const double r); + void torus (Triangulation<2,3> &tria, + const double R, + const double r); /** @@ -607,7 +595,7 @@ public: * @arg @p L: extension in @p z-direction (only used in 3d) * @arg @p repetitions: number of subdivisions * along the @p z-direction - * @arg @p colorize: wether to assign different + * @arg @p colorize: whether to assign different * boundary indicators to different faces. * The colors are given in lexicographic * ordering for the flat faces (0 to 3 in 2d, @@ -617,12 +605,13 @@ public: * get the number 0 and the hole gets number 1. */ template - static void hyper_cube_with_cylindrical_hole (Triangulation &triangulation, - const double inner_radius = .25, - const double outer_radius = .5, - const double L = .5, - const size_type repetition = 1, - const bool colorize = false); + void hyper_cube_with_cylindrical_hole ( + Triangulation &triangulation, + const double inner_radius = .25, + const double outer_radius = .5, + const double L = .5, + const unsigned int repetition = 1, + const bool colorize = false); /** * Produce a ring of cells in 3D that is cut open, twisted and glued @@ -634,11 +623,11 @@ public: * @param R The radius of the circle, which forms the middle line of the torus containing the loop of cells. Must be greater than @p r. * @param r The radius of the cylinder bend together as loop. */ - static void moebius (Triangulation<3,3> &tria, - const size_type n_cells, - const unsigned int n_rotations, - const double R, - const double r); + void moebius (Triangulation<3,3> &tria, + const unsigned int n_cells, + const unsigned int n_rotations, + const double R, + const double r); /** * Given the two triangulations specified as the first two arguments, create @@ -671,7 +660,6 @@ public: * GridTools::create_union_triangulation . */ template - static void merge_triangulations (const Triangulation &triangulation_1, const Triangulation &triangulation_2, @@ -685,12 +673,11 @@ public: * to the corresponding side walls in z direction. The bottom and top * get the next two free boundary indicators. */ - static void - extrude_triangulation(const Triangulation<2, 2> & input, - const size_type n_slices, - const double height, - Triangulation<3,3> &result); + extrude_triangulation (const Triangulation<2, 2> &input, + const unsigned int n_slices, + const double height, + Triangulation<3,3> &result); /** * This function transformes the @p Triangulation @p tria smoothly to a @@ -707,9 +694,8 @@ public: * @deprecated This function has been moved to GridTools::laplace_transform */ template - static void laplace_transformation (Triangulation &tria, - const std::map > &new_points) DEAL_II_DEPRECATED; + const std::map > &new_points) DEAL_II_DEPRECATED; /** * Exception @@ -729,67 +715,7 @@ public: int, << "The vector of repetitions must have " << arg1 <<" elements."); - -private: - /** - * Perform the action specified by the @p colorize flag of the - * hyper_rectangle() function of this class. - */ - template - static - void - colorize_hyper_rectangle (Triangulation &tria); - - /** - * Perform the action specified by the @p colorize flag of the - * subdivided_hyper_rectangle() function of this class. This function is - * singled out because it is dimension specific. - */ - template - static - void - colorize_subdivided_hyper_rectangle (Triangulation &tria, - const Point &p1, - const Point &p2, - const double epsilon); - - /** - * Assign boundary number zero to the inner shell boundary and 1 to the - * outer. - */ - template - static - void - colorize_hyper_shell (Triangulation &tria, - const Point ¢er, - const double inner_radius, - const double outer_radius); - - - /** - * Assign boundary number zero the inner shell boundary, one to the outer - * shell boundary, two to the face with x=0, three to the face with y=0, - * four to the face with z=0. - */ - template - static - void - colorize_quarter_hyper_shell(Triangulation &tria, - const Point ¢er, - const double inner_radius, - const double outer_radius); - - /** - * Solve the Laplace equation for @p laplace_transformation function for one - * of the @p dim space dimensions. Externalized into a function of its own - * in order to allow parallel execution. - */ - static - void - laplace_solve (const SparseMatrix &S, - const std::map &m, - Vector &u); -}; +} diff --git a/deal.II/include/deal.II/grid/grid_in.h b/deal.II/include/deal.II/grid/grid_in.h index 8a23c03805..5d4997ec38 100644 --- a/deal.II/include/deal.II/grid/grid_in.h +++ b/deal.II/include/deal.II/grid/grid_in.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__grid_in_h #define __deal2__grid_in_h diff --git a/deal.II/include/deal.II/grid/grid_out.h b/deal.II/include/deal.II/grid/grid_out.h index 01d778f595..22359a950a 100644 --- a/deal.II/include/deal.II/grid/grid_out.h +++ b/deal.II/include/deal.II/grid/grid_out.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__grid_out_h #define __deal2__grid_out_h @@ -623,13 +628,15 @@ namespace GridOutFlags /** * Background style. */ - enum Background{ - /// Use transparent value of SVG - transparent, - /// Use white background - white, - /// Use a gradient from white (top) to steelblue (bottom), and add date and time plus a deal.II logo. Automatically draws a margin. - dealii}; + enum Background + { + /// Use transparent value of SVG + transparent, + /// Use white background + white, + /// Use a gradient from white (top) to steelblue (bottom), and add date and time plus a deal.II logo. Automatically draws a margin. + dealii + }; Background background; @@ -646,18 +653,20 @@ namespace GridOutFlags /** * Cell coloring. */ - enum Coloring{ - /// No cell coloring - none, - /// Convert the material id into the cell color (default) - material_id, - /// Convert the level number into the cell color - level_number, - /// Convert the subdomain id into the cell color - subdomain_id, - /// Convert the level subdomain id into the cell color - level_subdomain_id}; - + enum Coloring + { + /// No cell coloring + none, + /// Convert the material id into the cell color (default) + material_id, + /// Convert the level number into the cell color + level_number, + /// Convert the subdomain id into the cell color + subdomain_id, + /// Convert the level subdomain id into the cell color + level_subdomain_id + }; + Coloring coloring; /// Interpret the level number of the cells as altitude over the x-y-plane (useful in the perpspective view). @@ -665,7 +674,7 @@ namespace GridOutFlags /** * Cell labeling (fixed order). - * + * * The following booleans determine which properties of the cell * shall be displayed as text in the middle of each cell. */ @@ -1046,15 +1055,15 @@ public: /** * Write the triangulation in the SVG format. - * - * SVG (Scalable Vector Graphics) is - * an XML-based vector image format - * developed and maintained by the - * World Wide Web Consortium (W3C). - * This function conforms to the - * latest specification SVG 1.1, + * + * SVG (Scalable Vector Graphics) is + * an XML-based vector image format + * developed and maintained by the + * World Wide Web Consortium (W3C). + * This function conforms to the + * latest specification SVG 1.1, * released on August 16, 2011. - * + * * The cells of the triangulation are written as polygons with * additional lines at the boundary of the triangulation. A coloring * of the cells is further possible in order to visualize a certain @@ -1062,10 +1071,10 @@ public: * colorbar can be drawn to encode the chosen coloring. Moreover, a * cell label can be added, showing level index, etc. * - * @note Yet only implemented for + * @note Yet only implemented for * two-dimensional grids in two * space dimensions. - * + * */ template void write_svg (const Triangulation &tria, @@ -1091,7 +1100,7 @@ public: */ template void write_mathgl (const Triangulation &tria, - std::ostream &out) const; + std::ostream &out) const; /** * Write grid to @p out according to the given data format. This @@ -1503,19 +1512,19 @@ private: /** - * This function projects a three-dimensional point (Point<3> point) - * onto a two-dimensional image plane, specified by the position of - * the camera viewing system (Point<3> camera_position), camera - * direction (Point<3> camera_position), camera horizontal (Point<3> - * camera_horizontal, necessary for the correct alignment of the + * This function projects a three-dimensional point (Point<3> point) + * onto a two-dimensional image plane, specified by the position of + * the camera viewing system (Point<3> camera_position), camera + * direction (Point<3> camera_position), camera horizontal (Point<3> + * camera_horizontal, necessary for the correct alignment of the * later images), and the focus of the camera (float camera_focus). * * For SVG output of grids. */ - static Point<2> svg_project_point(Point<3> point, - Point<3> camera_position, - Point<3> camera_direction, - Point<3> camera_horizontal, + static Point<2> svg_project_point(Point<3> point, + Point<3> camera_position, + Point<3> camera_direction, + Point<3> camera_horizontal, float camera_focus); /** diff --git a/deal.II/include/deal.II/grid/grid_refinement.h b/deal.II/include/deal.II/grid/grid_refinement.h index c5f9d6ec0b..50564a586b 100644 --- a/deal.II/include/deal.II/grid/grid_refinement.h +++ b/deal.II/include/deal.II/grid/grid_refinement.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__grid_refinement_h #define __deal2__grid_refinement_h diff --git a/deal.II/include/deal.II/grid/grid_reordering.h b/deal.II/include/deal.II/grid/grid_reordering.h index 4e03878b26..652a59ce98 100644 --- a/deal.II/include/deal.II/grid/grid_reordering.h +++ b/deal.II/include/deal.II/grid/grid_reordering.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__grid_reordering_h #define __deal2__grid_reordering_h diff --git a/deal.II/include/deal.II/grid/grid_reordering_internal.h b/deal.II/include/deal.II/grid/grid_reordering_internal.h index d9f8497c5f..004167263b 100644 --- a/deal.II/include/deal.II/grid/grid_reordering_internal.h +++ b/deal.II/include/deal.II/grid/grid_reordering_internal.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__grid_reordering_internal_h #define __deal2__grid_reordering_internal_h diff --git a/deal.II/include/deal.II/grid/grid_tools.h b/deal.II/include/deal.II/grid/grid_tools.h index 37a59770e9..29900ec738 100644 --- a/deal.II/include/deal.II/grid/grid_tools.h +++ b/deal.II/include/deal.II/grid/grid_tools.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__grid_tools_H #define __deal2__grid_tools_H @@ -19,6 +24,7 @@ #include #include #include +#include #include #include @@ -232,16 +238,32 @@ namespace GridTools Triangulation<2> &triangulation); /** - * This function transformes the @p Triangulation @p tria smoothly to a - * domain that is described by the boundary points in the map @p - * new_points. This map maps the point indices to the boundary points in the - * transformed domain. - * - * Note, that the @p Triangulation is changed in-place, therefore you don't - * need to keep two triangulations, but the given triangulation is changed - * (overwritten). - * - * In 1d, this function is not currently implemented. + * Transform the given triangulation smoothly to a different domain where + * each of the vertices at the boundary of the triangulation is mapped to + * the corresponding points in the @p new_points map. + * + * The way this function works is that it solves a Laplace equation for each + * of the dim components of a displacement field that maps the current + * domain into one described by @p new_points . The @p new_points array + * therefore represents the boundary values of this displacement field. + * The function then evaluates this displacement field at each vertex in + * the interior and uses it to place the mapped vertex where the + * displacement field locates it. Because the solution of the Laplace + * equation is smooth, this guarantees a smooth mapping from the old + * domain to the new one. + * + * @param[in] new_points The locations where a subset of the existing vertices + * are to be placed. Typically, this would be a map from the vertex indices + * of all nodes on the boundary to their new locations, thus completely + * specifying the geometry of the mapped domain. However, it may also include + * interior points if necessary and it does not need to include all boundary + * vertices (although you then lose control over the exact shape of the mapped + * domain). + * + * @param[in,out] tria The Triangulation object. This object is changed in-place, + * i.e., the previous locations of vertices are overwritten. + * + * @note This function is not currently implemented for the 1d case. */ template void laplace_transform (const std::map > &new_points, @@ -322,6 +344,11 @@ namespace GridTools * a hanging node located on a face or an * edge of it. * + * @note If the point requested does not lie in any of the cells of + * the mesh given, then this function throws an exception of type + * GridTools::ExcPointNotFound. You can catch this exception and + * decide what to do in that case. + * * @note It isn't entirely clear at this time whether the function * does the right thing with anisotropically refined meshes. It needs * to be checked for this case. @@ -333,32 +360,23 @@ namespace GridTools /** - * Find and return an iterator to - * the active cell that surrounds - * a given point @p ref. The - * type of the first parameter - * may be either - * Triangulation, - * DoFHandler, or - * MGDoFHandler, i.e. we - * can find the cell around a - * point for iterators into each - * of these classes. - * - * This is solely a wrapper function - * for the @p interpolate function - * given below, - * providing backward compatibility. - * A Q1 mapping is used for the - * boundary, and the iterator to - * the cell in which the point - * resides is returned. - * - * It is recommended to use the - * other version of this function, - * as it simultaneously delivers the - * local coordinate of the given point - * without additional computational cost. + * Find and return an iterator to the active cell that surrounds a + * given point @p ref. The type of the first parameter may be either + * Triangulation, or one of the DoF handler classes, i.e. we can find the + * cell around a point for iterators into each of these classes. + * + * This is solely a wrapper function for the function of same name + * below. A Q1 mapping is used for the boundary, and the iterator + * to the cell in which the point resides is returned. + * + * It is recommended to use the other version of this function, as + * it simultaneously delivers the local coordinate of the given + * point without additional computational cost. + * + * @note If the point requested does not lie in any of the cells of + * the mesh given, then this function throws an exception of type + * GridTools::ExcPointNotFound. You can catch this exception and + * decide what to do in that case. * * @note When applied to a triangulation or DoF handler object based * on a parallel::distributed::Triangulation object, the cell @@ -374,58 +392,39 @@ namespace GridTools const Point &p); /** - * Find and return an iterator to - * the active cell that surrounds - * a given point @p p. The - * type of the first parameter - * may be either - * Triangulation, - * DoFHandler, hp::DoFHandler, or - * MGDoFHandler, i.e., we - * can find the cell around a - * point for iterators into each - * of these classes. - * - * The algorithm used in this - * function proceeds by first - * looking for vertex located - * closest to the given point, see - * find_closest_vertex(). Secondly, - * all adjacent cells to this point - * are found in the mesh, see - * find_cells_adjacent_to_vertex(). - * Lastly, for each of these cells, - * it is tested whether the point is - * inside. This check is performed - * using arbitrary boundary mappings. - * Still, it is possible that due - * to roundoff errors, the point - * cannot be located exactly inside - * the unit cell. In this case, - * even points at a very small - * distance outside the unit cell + * Find and return an iterator to the active cell that surrounds a + * given point @p p. The type of the first parameter may be either + * Triangulation, DoFHandler, hp::DoFHandler, or MGDoFHandler, i.e., + * we can find the cell around a point for iterators into each of + * these classes. + * + * The algorithm used in this function proceeds by first looking for + * vertex located closest to the given point, see + * find_closest_vertex(). Secondly, all adjacent cells to this point + * are found in the mesh, see find_cells_adjacent_to_vertex(). + * Lastly, for each of these cells, it is tested whether the point + * is inside. This check is performed using arbitrary boundary + * mappings. Still, it is possible that due to roundoff errors, the + * point cannot be located exactly inside the unit cell. In this + * case, even points at a very small distance outside the unit cell * are allowed. * - * If a point lies on the - * boundary of two or more cells, - * then the algorithm tries to identify - * the cell that is of highest + * If a point lies on the boundary of two or more cells, then the + * algorithm tries to identify the cell that is of highest * refinement level. * - * The function returns an - * iterator to the cell, as well - * as the local position of the - * point inside the unit - * cell. This local position - * might be located slightly - * outside an actual unit cell, - * due to numerical roundoff. - * Therefore, the point returned - * by this function should - * be projected onto the unit cell, - * using GeometryInfo::project_to_unit_cell. - * This is not automatically performed - * by the algorithm. + * The function returns an iterator to the cell, as well as the + * local position of the point inside the unit cell. This local + * position might be located slightly outside an actual unit cell, + * due to numerical roundoff. Therefore, the point returned by this + * function should be projected onto the unit cell, using + * GeometryInfo::project_to_unit_cell. This is not automatically + * performed by the algorithm. + * + * @note If the point requested does not lie in any of the cells of + * the mesh given, then this function throws an exception of type + * GridTools::ExcPointNotFound. You can catch this exception and + * decide what to do in that case. * * @note When applied to a triangulation or DoF handler object based * on a parallel::distributed::Triangulation object, the cell @@ -442,14 +441,16 @@ namespace GridTools const Point &p); /** - * A version of the previous function - * where we use that mapping on a given - * cell that corresponds to the active - * finite element index of that - * cell. This is obviously only useful - * for hp problems, since the active - * finite element index for all other DoF - * handlers is always zero. + * A version of the previous function where we use that mapping on a + * given cell that corresponds to the active finite element index of + * that cell. This is obviously only useful for hp problems, since + * the active finite element index for all other DoF handlers is + * always zero. + * + * @note If the point requested does not lie in any of the cells of + * the mesh given, then this function throws an exception of type + * GridTools::ExcPointNotFound. You can catch this exception and + * decide what to do in that case. * * @note When applied to a triangulation or DoF handler object based * on a parallel::distributed::Triangulation object, the cell @@ -968,7 +969,18 @@ namespace GridTools const std::set &boundary_ids = std::set()); - + /** + * Data type that provides all the information that is needed + * to create periodicity constraints and a periodic p4est forest + * with respect to two periodic cell faces + */ + template + struct PeriodicFacePair + { + CellIterator cell[2]; + unsigned int face_idx[2]; + std::bitset<3> orientation; + }; /** * An orthogonal equality test for faces. @@ -1054,8 +1066,8 @@ namespace GridTools /** - * This function loops over all faces from @p begin to @p end and - * collects a set of periodic face pairs for @p direction: + * This function will collect periodic face pairs on the highest (i.e. + * coarsest) mesh level. * * Define a 'first' boundary as all boundary faces having boundary_id * @p b_id1 and a 'second' boundary consisting of all faces belonging @@ -1063,42 +1075,35 @@ namespace GridTools * * This function tries to match all faces belonging to the first * boundary with faces belonging to the second boundary with the help - * of orthogonal_equality. + * of orthogonal_equality(). + * + * The bitset that is returned inside of PeriodicFacePair encodes the + * _relative_ orientation of the first face with respect to the second + * face, see the documentation of orthogonal_equality for further details. + * + * The @p direction refers to the space direction in which periodicity + * is enforced. * * The @p offset is a vector tangential to the faces that is added to the * location of vertices of the 'first' boundary when attempting to match * them to the corresponding vertices of the 'second' boundary. This can * be used to implement conditions such as $u(0,y)=u(1,y+1)$. * - * @author Matthias Maier, 2012 - */ - template - std::map > > - collect_periodic_face_pairs (const FaceIterator &begin, - const typename identity::type &end, - const types::boundary_id b_id1, - const types::boundary_id b_id2, - int direction, - const dealii::Tensor<1,FaceIterator::AccessorType::space_dimension> &offset); - - - /** - * Same function as above, but accepts a Triangulation or DoFHandler - * object @p dof_handler instead of an explicit face iterator range. - * - * This function will collect periodic face pairs on the highest (i.e. - * coarsest) mesh level. + * @note The created std::vector can be used in + * DoFTools::make_periodicity_constraints and in + * parallel::distributed::Triangulation::add_periodicity to enforce + * periodicity algebraically. * - * @author Matthias Maier, 2012 + * @author Daniel Arndt, 2013 */ template - std::map > > - collect_periodic_face_pairs (const DH &dof_handler, /*TODO: Name*/ - const types::boundary_id b_id1, - const types::boundary_id b_id2, - int direction, - const dealii::Tensor<1,DH::space_dimension> &offset); - + std::vector > + collect_periodic_faces + (const DH &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const unsigned int direction, + const dealii::Tensor<1,DH::space_dimension> &offset); /** * This compatibility version of collect_periodic_face_pairs only works @@ -1118,15 +1123,101 @@ namespace GridTools * meshes with cells not in @ref GlossFaceOrientation * "standard orientation". * + * @author Daniel Arndt, 2013 + */ + template + std::vector > + collect_periodic_faces + (const DH &dof_handler, + const types::boundary_id b_id, + const unsigned int direction, + const dealii::Tensor<1,DH::space_dimension> &offset); + + /** + * This function does the same as collect_periodic_faces but returns a + * different data type. + * * @author Matthias Maier, 2012 + * + * @note The returned data type is not compatible with + * DoFTools::make_periodicity_constraints + * + * @deprecated + */ + template + std::map > > + collect_periodic_face_pairs + (const DH &container, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + int direction, + const dealii::Tensor<1,DH::space_dimension> &offset) DEAL_II_DEPRECATED; + + /** + * This compatibility version of collect_periodic_face_pairs only works + * on grids with cells in @ref GlossFaceOrientation "standard orientation". + * + * @author Matthias Maier, 2012 + * + * @note The returned data type is not compatible with + * DoFTools::make_periodicity_constraints + * + * @deprecated */ template std::map - collect_periodic_face_pairs (const DH &dof_handler, /*TODO: Name*/ - const types::boundary_id b_id, - int direction, - const dealii::Tensor<1,DH::space_dimension> &offset); + collect_periodic_face_pairs + (const DH &dof_handler, /*TODO: Name*/ + const types::boundary_id b_id, + int direction, + const dealii::Tensor<1,DH::space_dimension> &offset) DEAL_II_DEPRECATED; + /** + * This version loops over all faces from @p begin to @p end + * instead of accepting a DoFHandler or a Triangulation. + * + * @author Matthias Maier, 2012 + * + * @note This function cannot produce the return as the other + * collect_periodic_faces functions. + * + * @deprecated + */ + template + std::map > > + collect_periodic_face_pairs + (const FaceIterator &begin, + const typename identity::type &end, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const int direction, + const dealii::Tensor<1,FaceIterator::AccessorType::space_dimension> &offset) + DEAL_II_DEPRECATED; + + /** + * This function does the same as collect_periodic_faces but returns a + * different data type. + * + * @author Daniel Arndt, 2013 + * + * @note The returned data type is not compatible with + * DoFTools::make_periodicity_constraints, but with a version of + * parallel::distributed::Triangulation::add_periodicity + * + * @note Use collect_periodic_faces instead. + * + * @deprecated + */ + template + void + identify_periodic_face_pairs + (const DH &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const unsigned int direction, + std::vector > + &periodicity_vector) DEAL_II_DEPRECATED; /** diff --git a/deal.II/include/deal.II/grid/intergrid_map.h b/deal.II/include/deal.II/grid/intergrid_map.h index 04bf97c917..21c3beebae 100644 --- a/deal.II/include/deal.II/grid/intergrid_map.h +++ b/deal.II/include/deal.II/grid/intergrid_map.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__intergrid_map_h #define __deal2__intergrid_map_h diff --git a/deal.II/include/deal.II/grid/magic_numbers.h b/deal.II/include/deal.II/grid/magic_numbers.h index 23044ecce4..6ef45dca02 100644 --- a/deal.II/include/deal.II/grid/magic_numbers.h +++ b/deal.II/include/deal.II/grid/magic_numbers.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__magic_numbers_h #define __deal2__magic_numbers_h diff --git a/deal.II/include/deal.II/grid/persistent_tria.h b/deal.II/include/deal.II/grid/persistent_tria.h index 64dd0f1205..9a53ce887f 100644 --- a/deal.II/include/deal.II/grid/persistent_tria.h +++ b/deal.II/include/deal.II/grid/persistent_tria.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__persistent_tria_h #define __deal2__persistent_tria_h diff --git a/deal.II/include/deal.II/grid/tria.h b/deal.II/include/deal.II/grid/tria.h index 8e8f599992..b478da2009 100644 --- a/deal.II/include/deal.II/grid/tria.h +++ b/deal.II/include/deal.II/grid/tria.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_h #define __deal2__tria_h @@ -1455,7 +1460,7 @@ public: * RefinementListener. * * @note The use of this class has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -1470,7 +1475,7 @@ public: * class also has virtual functions. * * @note The use of this class has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -1486,7 +1491,7 @@ public: * registered with the triangulation. * * @note The use of this class has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -1504,7 +1509,7 @@ public: * registered with the triangulation. * * @note The use of this class has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -1529,7 +1534,7 @@ public: * derived classes. * * @note The use of this class has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -1552,7 +1557,7 @@ public: * implemented in derived classes. * * @note The use of this class has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -1561,7 +1566,7 @@ public: virtual void create_notification (const Triangulation &tria); - } DEAL_II_DEPRECATED; + }; /** * A structure that is used as an @@ -2073,7 +2078,7 @@ public: * section on signals in the general * documentation of this class. */ - void refine_global (const unsigned int times); + void refine_global (const unsigned int times = 1); /** * Execute both refinement and @@ -2203,7 +2208,7 @@ public: * the Triangulation is refined. * * @note The use of this function has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -2221,7 +2226,7 @@ public: * Triangulation. * * @note The use of this function has been - * superceded by the signals mechanism. + * superseded by the signals mechanism. * See the general documentation of the * Triangulation class for more information. * @@ -2607,8 +2612,16 @@ public: cell_iterator begin (const unsigned int level = 0) const; /** - * Iterator to the first active - * cell on level @p level. + * Iterator to the first active cell on level @p level. If the + * given level does not contain any active cells (i.e., all cells + * on this level are further refined, then this function returns + * end_active(level) so that loops of the kind + * @code + * for (cell=tria.begin_active(level); cell!=tria.end_active(level); ++cell) + * ... + * @endcode + * have zero iterations, as may be expected if there are no active + * cells on this level. */ active_cell_iterator begin_active(const unsigned int level = 0) const; @@ -2629,10 +2642,9 @@ public: cell_iterator end (const unsigned int level) const; /** - * Return an active iterator which is the - * first iterator not on level. If @p level - * is the last level, then this returns - * end(). + * Return an active iterator which is the first active iterator not + * on the given level. If @p level is the last level, then this + * returns end(). */ active_cell_iterator end_active (const unsigned int level) const; @@ -2643,23 +2655,11 @@ public: */ cell_iterator last () const; - /** - * Return an iterator pointing to the - * last used cell on level @p level. - */ - cell_iterator last (const unsigned int level) const; - /** * Return an iterator pointing to the * last active cell. */ active_cell_iterator last_active () const; - - /** - * Return an iterator pointing to the - * last active cell on level @p level. - */ - active_cell_iterator last_active (const unsigned int level) const; /*@}*/ /*---------------------------------------*/ @@ -3201,7 +3201,7 @@ public: */ DeclException0 (ExcTriangulationNotEmpty); /** - * Trying to re-read a grid, an error occured. + * Trying to re-read a grid, an error occurred. * * @ingroup Exceptions */ @@ -3521,7 +3521,7 @@ private: * this contains nothing, in 2D it contains data * concerning lines and in 3D quads and lines. All of * these have no level and are therefore treated - * seperately. + * separately. */ dealii::internal::Triangulation::TriaFaces *faces; diff --git a/deal.II/include/deal.II/grid/tria_accessor.h b/deal.II/include/deal.II/grid/tria_accessor.h index 349756f612..7ff6297f2c 100644 --- a/deal.II/include/deal.II/grid/tria_accessor.h +++ b/deal.II/include/deal.II/grid/tria_accessor.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_accessor_h #define __deal2__tria_accessor_h @@ -19,13 +24,10 @@ #include #include #include +#include +#include -namespace std -{ - template - struct pair; -} DEAL_II_NAMESPACE_OPEN @@ -318,7 +320,7 @@ protected: TriaAccessorBase (const Triangulation *parent = 0, const int level = -1, const int index = -1, - const AccessorData * = 0); + const AccessorData * = 0); /** * Copy constructor. Creates an @@ -345,6 +347,14 @@ protected: */ TriaAccessorBase &operator = (const TriaAccessorBase &); + /** + * Ordering of accessors. If #structure_dimension is less than + * #dimension, we simply compare the index of such an object. If + * #structure_dimension equals #dimension, we compare the level() + * first, and the index() only if levels are equal. + */ + bool operator < (const TriaAccessorBase &other) const; + protected: /** * Copy operator. This is normally @@ -2821,7 +2831,8 @@ public: /** * Return an iterator to the - * parent. + * parent. Throws an exception if this cell has no parent, i.e. has + * level 0. */ TriaIterator > parent () const; @@ -2847,6 +2858,16 @@ public: */ bool active () const; + /** + * Ordering of accessors. This function implements a total ordering + * of cells even on a parallel::distributed::Triangulation. This + * function first compares level_subdomain_id(). If these are equal, + * and both cells are active, it compares subdomain_id(). If this is + * inconclusive, TriaAccessorBase::operator < () is called. + */ + bool operator < (const CellAccessor &other) const; + + /** * Return whether this cell is owned by the current processor * or is owned by another processor. The function always returns @@ -2870,6 +2891,12 @@ public: */ bool is_locally_owned () const; + /** + * Return true if either the Triangulation is not distributed or if + * level_subdomain_id() is equal to the id of the current processor. + */ + bool is_locally_owned_on_level () const; + /** * Return whether this cell * exists in the global mesh but @@ -2990,6 +3017,15 @@ public: void set_neighbor (const unsigned int i, const TriaIterator > &pointer) const; + /** + * Return a unique ID for the current cell. This ID is constructed from the + * path in the hierarchy from the coarse father cell and works correctly + * in parallel computations. + * + * Note: This operation takes O(log(level)) time. + */ + CellId id() const; + /** * @} */ @@ -3170,6 +3206,39 @@ CellAccessor (const TriaAccessor &) "the conversion is not valid in the current context.")); } +template +CellId +CellAccessor::id() const +{ + std::vector id(this->level(), -1); + unsigned int coarse_index; + + CellAccessor ptr = *this; + while (ptr.level()>0) + { + // find the 'v'st child of our parent we are + unsigned char v=-1; + for (unsigned int c=0; cn_children(); ++c) + { + if (ptr.parent()->child_index(c)==ptr.index()) + { + v = c; + break; + } + } + + Assert(v != (unsigned char)-1, ExcInternalError()); + id[ptr.level()-1] = v; + + ptr.copy_from( *(ptr.parent())); + } + + Assert(ptr.level()==0, ExcInternalError()); + coarse_index = ptr.index(); + + return CellId(coarse_index, id); +} + #ifndef DOXYGEN diff --git a/deal.II/include/deal.II/grid/tria_accessor.templates.h b/deal.II/include/deal.II/grid/tria_accessor.templates.h index 2e4d9462ea..bdf5d52cab 100644 --- a/deal.II/include/deal.II/grid/tria_accessor.templates.h +++ b/deal.II/include/deal.II/grid/tria_accessor.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_accessor_templates_h #define __deal2__tria_accessor_templates_h @@ -136,6 +141,22 @@ TriaAccessorBase::operator != (const TriaAccessorBase +inline +bool +TriaAccessorBase::operator < (const TriaAccessorBase &other) const +{ + Assert (tria == other.tria, TriaAccessorExceptions::ExcCantCompareIterators()); + + if (present_level != other.present_level) + return (present_level < other.present_level); + + return (present_index < other.present_index); + +} + + + template inline int @@ -2909,6 +2930,25 @@ CellAccessor::is_locally_owned () const } +template +inline +bool +CellAccessor::is_locally_owned_on_level () const +{ +#ifndef DEAL_II_WITH_P4EST + return true; +#else + const parallel::distributed::Triangulation *pdt + = dynamic_cast *>(this->tria); + + if (pdt == 0) + return true; + else + return (this->level_subdomain_id() == pdt->locally_owned_subdomain()); +#endif +} + + template inline bool @@ -2963,6 +3003,26 @@ CellAccessor::neighbor_face_no (const unsigned int neighbor) const return neighbor_of_coarser_neighbor(neighbor).first; } + +template +inline +bool +CellAccessor::operator < (const CellAccessor &other) const +{ + Assert (this->tria == other.tria, TriaAccessorExceptions::ExcCantCompareIterators()); + + if (level_subdomain_id() != other.level_subdomain_id()) + return (level_subdomain_id() < other.level_subdomain_id()); + + if (active() && other.active() && + (subdomain_id() != other.subdomain_id())) + return (subdomain_id() < other.subdomain_id()); + + return TriaAccessorBase::operator < (other); +} + + + DEAL_II_NAMESPACE_CLOSE #endif diff --git a/deal.II/include/deal.II/grid/tria_boundary.h b/deal.II/include/deal.II/grid/tria_boundary.h index bf893b8214..ca948550fc 100644 --- a/deal.II/include/deal.II/grid/tria_boundary.h +++ b/deal.II/include/deal.II/grid/tria_boundary.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_boundary_h #define __deal2__tria_boundary_h @@ -17,6 +22,8 @@ #include #include +#include +#include #include #include @@ -80,120 +87,75 @@ class Boundary : public Subscriptor public: /** - * Type keeping information about - * the normals at the vertices of - * a face of a cell. Thus, there - * are - * GeometryInfo::vertices_per_face - * normal vectors, that define - * the tangent spaces of the - * boundary at the vertices. Note - * that the vectors stored in - * this object are not required - * to be normalized, nor to - * actually point outward, as one - * often will only want to check - * for orthogonality to define - * the tangent plane; if a - * function requires the normals - * to be normalized, then it must - * do so itself. + * Type keeping information about the normals at the vertices of a face of a + * cell. Thus, there are GeometryInfo::vertices_per_face + * normal vectors, that define the tangent spaces of the boundary at the + * vertices. Note that the vectors stored in this object are not required to + * be normalized, nor to actually point outward, as one often will only want + * to check for orthogonality to define the tangent plane; if a function + * requires the normals to be normalized, then it must do so itself. * - * For obvious reasons, this - * type is not useful in 1d. + * For obvious reasons, this type is not useful in 1d. */ typedef Tensor<1,spacedim> FaceVertexNormals[GeometryInfo::vertices_per_face]; /** - * Destructor. Does nothing here, but - * needs to be declared to make it + * Destructor. Does nothing here, but needs to be declared to make it * virtual. */ virtual ~Boundary (); /** - * Return the point which shall - * become the new middle vertex - * of the two children of a - * regular line. In 2D, this line - * is a line at the boundary, - * while in 3d, it is bounding a - * face at the boundary (the - * lines therefore is also on the - * boundary). + * Return the point which shall become the new middle vertex of the two + * children of a regular line. In 2D, this line is a line at the boundary, + * while in 3d, it is bounding a face at the boundary (the lines therefore + * is also on the boundary). */ virtual Point get_new_point_on_line (const typename Triangulation::line_iterator &line) const = 0; /** - * Return the point which shall - * become the common point of the - * four children of a quad at the - * boundary in three or more - * spatial dimensions. This - * function therefore is only - * useful in at least three - * dimensions and should not be - * called for lower dimensions. + * Return the point which shall become the common point of the four children + * of a quad at the boundary in three or more spatial dimensions. This + * function therefore is only useful in at least three dimensions and should + * not be called for lower dimensions. * - * This function is called after - * the four lines bounding the - * given @p quad are refined, so - * you may want to use the - * information provided by - * quad->line(i)->child(j), - * i=0...3, j=0,1. + * This function is called after the four lines bounding the given @p quad + * are refined, so you may want to use the information provided by + * quad->line(i)->child(j), i=0...3, j=0,1. * - * Because in 2D, this function - * is not needed, it is not made - * pure virtual, to avoid the - * need to overload it. The - * default implementation throws - * an error in any case, however. + * Because in 2D, this function is not needed, it is not made pure virtual, + * to avoid the need to overload it. The default implementation throws an + * error in any case, however. */ virtual Point get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; /** - * Depending on dim=2 or - * dim=3 this function - * calls the - * get_new_point_on_line or the - * get_new_point_on_quad - * function. It throws an - * exception for - * dim=1. This wrapper - * allows dimension independent + * Depending on dim=2 or dim=3 this function calls the + * get_new_point_on_line or the get_new_point_on_quad function. It throws an + * exception for dim=1. This wrapper allows dimension independent * programming. */ Point get_new_point_on_face (const typename Triangulation::face_iterator &face) const; /** - * Return equally spaced - * intermediate points on a line. + * Return intermediate points on a line spaced according to the interior + * support points of the 1D Gauss-Lobatto quadrature formula. * - * The number of points requested - * is given by the size of the - * vector @p points. It is the - * task of the derived classes to - * arrange the points in + * The number of points requested is given by the size of the vector @p + * points. It is the task of the derived classes to arrange the points in * approximately equal distances. * - * This function is called by the - * @p MappingQ class. This - * happens on each face line of a - * cells that has got at least - * one boundary line. + * This function is called by the @p MappingQ class. This happens on each + * face line of a cells that has got at least one boundary line. * - * As this function is not needed - * for @p MappingQ1, it is not - * made pure virtual, to avoid - * the need to overload it. The - * default implementation throws - * an error in any case, however. + * As this function is not needed for @p MappingQ1, it is not made pure + * virtual, to avoid the need to overload it. The default implementation + * throws an error in any case, however. */ virtual void @@ -201,34 +163,23 @@ public: std::vector > &points) const; /** - * Return equally spaced - * intermediate points on a - * boundary quad. + * Return intermediate points on a line spaced according to the tensor + * product of the interior support points of the 1D Gauss-Lobatto quadrature + * formula. * - * The number of points requested - * is given by the size of the - * vector @p points. It is - * required that this number is a - * square of another integer, - * i.e. n=points.size()=m*m. It - * is the task of the derived - * classes to arrange the points - * such they split the quad into - * (m+1)(m+1) approximately - * equal-sized subquads. + * The number of points requested is given by the size of the vector @p + * points. It is required that this number is a square of another integer, + * i.e. n=points.size()=m*m. It is the task of the derived classes + * to arrange the points such they split the quad into (m+1)(m+1) + * approximately equal-sized subquads. * - * This function is called by the - * MappingQ<3> class. This - * happens each face quad of - * cells in 3d that has got at - * least one boundary face quad. + * This function is called by the MappingQ<3> class. This happens + * each face quad of cells in 3d that has got at least one boundary face + * quad. * - * As this function is not needed - * for @p MappingQ1, it is not - * made pure virtual, to avoid - * the need to overload it. The - * default implementation throws - * an error in any case, however. + * As this function is not needed for @p MappingQ1, it is not made pure + * virtual, to avoid the need to overload it. The default implementation + * throws an error in any case, however. */ virtual void @@ -236,56 +187,36 @@ public: std::vector > &points) const; /** - * Depending on dim=2 or - * dim=3 this function - * calls the - * get_intermediate_points_on_line - * or the - * get_intermediate_points_on_quad - * function. It throws an - * exception for - * dim=1. This wrapper - * allows dimension independent - * programming. + * Depending on dim=2 or dim=3 this function calls the + * get_intermediate_points_on_line or the get_intermediate_points_on_quad + * function. It throws an exception for dim=1. This wrapper allows + * dimension independent programming. */ void get_intermediate_points_on_face (const typename Triangulation::face_iterator &face, std::vector > &points) const; /** - * Return the normal vector to the surface - * at the point p. If p is not in fact - * on the surface, but only closeby, - * try to return something reasonable, - * for example the normal vector - * at the surface point closest to p. - * (The point p will in fact not normally - * lie on the actual surface, but rather - * be a quadrature point mapped by some - * polynomial mapping; the mapped surface, - * however, will not usually coincide with - * the actual surface.) + * Return the normal vector to the surface at the point p. If p is not in + * fact on the surface, but only close-by, try to return something + * reasonable, for example the normal vector at the surface point closest to + * p. (The point p will in fact not normally lie on the actual surface, but + * rather be a quadrature point mapped by some polynomial mapping; the + * mapped surface, however, will not usually coincide with the actual + * surface.) * - * The face iterator gives an indication - * which face this function is supposed - * to compute the normal vector for. - * This is useful if the boundary of - * the domain is composed of different - * nondifferential pieces (for example - * when using the StraightBoundary class - * to approximate a geometry that is - * completely described by the coarse mesh, - * with piecewise (bi-)linear components - * between the vertices, but where the - * boundary may have a kink at the vertices - * itself). + * The face iterator gives an indication which face this function is + * supposed to compute the normal vector for. This is useful if the + * boundary of the domain is composed of different nondifferential pieces + * (for example when using the StraightBoundary class to approximate a + * geometry that is completely described by the coarse mesh, with piecewise + * (bi-)linear components between the vertices, but where the boundary may + * have a kink at the vertices itself). * - * @note Implementations of this function - * should be able to assume that the point p - * lies within or close to the face described by the - * first argument. In turn, callers of this - * function should ensure that this is - * in fact the case. + * @note Implementations of this function should be able to assume that the + * point p lies within or close to the face described by the first + * argument. In turn, callers of this function should ensure that this is in + * fact the case. */ virtual Tensor<1,spacedim> @@ -293,32 +224,17 @@ public: const Point &p) const; /** - * Compute the normal vectors to - * the boundary at each vertex of - * the given face. It is not - * required that the normal - * vectors be normed - * somehow. Neither is it - * required that the normals - * actually point outward. + * Compute the normal vectors to the boundary at each vertex of the given + * face. It is not required that the normal vectors be normed + * somehow. Neither is it required that the normals actually point outward. * - * This function is - * needed to compute data for C1 - * mappings. The default - * implementation is to throw an - * error, so you need not - * overload this function in case - * you do not intend to use C1 - * mappings. + * This function is needed to compute data for C1 mappings. The default + * implementation is to throw an error, so you need not overload this + * function in case you do not intend to use C1 mappings. * - * Note that when computing - * normal vectors at a vertex - * where the boundary is not - * differentiable, you have to - * make sure that you compute the - * one-sided limits, i.e. limit - * with respect to points inside - * the given face. + * Note that when computing normal vectors at a vertex where the boundary is + * not differentiable, you have to make sure that you compute the one-sided + * limits, i.e. limit with respect to points inside the given face. */ virtual void @@ -326,35 +242,20 @@ public: FaceVertexNormals &face_vertex_normals) const; /** - * Given a candidate point and a - * line segment characterized by - * the iterator, return a point - * that lies on the surface - * described by this object. This - * function is used in some mesh - * smoothing algorithms that try - * to move around points in order - * to improve the mesh quality - * but need to ensure that points - * that were on the boundary - * remain on the boundary. + * Given a candidate point and a line segment characterized by the iterator, + * return a point that lies on the surface described by this object. This + * function is used in some mesh smoothing algorithms that try to move + * around points in order to improve the mesh quality but need to ensure + * that points that were on the boundary remain on the boundary. * - * If spacedim==1, then the line - * represented by the line - * iterator is the entire space - * (i.e. it is a cell, not a part - * of the boundary), and the - * returned point equals the - * given input point. + * If spacedim==1, then the line represented by the line iterator is the + * entire space (i.e. it is a cell, not a part of the boundary), and the + * returned point equals the given input point. * - * Derived classes do not need to - * implement this function unless - * mesh smoothing algorithms are - * used with a particular - * boundary object. The default - * implementation of this - * function throws an exception - * of type ExcPureFunctionCalled. + * Derived classes do not need to implement this function unless mesh + * smoothing algorithms are used with a particular boundary object. The + * default implementation of this function throws an exception of type + * ExcPureFunctionCalled. */ virtual Point @@ -362,19 +263,12 @@ public: const Point &candidate) const; /** - * Same function as above but for - * a point that is to be - * projected onto the area - * characterized by the given - * quad. + * Same function as above but for a point that is to be projected onto the + * area characterized by the given quad. * - * If spacedim<=2, then the surface - * represented by the quad - * iterator is the entire space - * (i.e. it is a cell, not a part - * of the boundary), and the - * returned point equals the - * given input point. + * If spacedim<=2, then the surface represented by the quad iterator is the + * entire space (i.e. it is a cell, not a part of the boundary), and the + * returned point equals the given input point. */ virtual Point @@ -382,24 +276,40 @@ public: const Point &candidate) const; /** - * Same function as above but for - * a point that is to be - * projected onto the area - * characterized by the given - * quad. + * Same function as above but for a point that is to be projected onto the + * area characterized by the given quad. * - * If spacedim<=3, then the manifold - * represented by the hex - * iterator is the entire space - * (i.e. it is a cell, not a part - * of the boundary), and the - * returned point equals the - * given input point. + * If spacedim<=3, then the manifold represented by the hex iterator is the + * entire space (i.e. it is a cell, not a part of the boundary), and the + * returned point equals the given input point. */ virtual Point project_to_surface (const typename Triangulation::hex_iterator &hex, const Point &candidate) const; + +protected: + /** + * Returns the support points of the Gauss-Lobatto quadrature formula used + * for intermediate points. + * + * @note Since the boundary description is closely tied to the unit cell + * support points of MappingQ, new boundary descriptions need to explicitly + * use these Gauss-Lobatto points and not equidistant points. + */ + const std::vector > & + get_line_support_points (const unsigned int n_intermediate_points) const; + +private: + /** + * Point generator for the intermediate points on a boundary. + */ + mutable std::vector > > points; + + /** + * Mutex for protecting the points array. + */ + mutable Threads::Mutex mutex; }; @@ -424,56 +334,37 @@ class StraightBoundary : public Boundary { public: /** - * Default constructor. Some - * compilers require this for - * some reasons. + * Default constructor. Some compilers require this for some reasons. */ StraightBoundary (); /** - * Let the new point be the - * arithmetic mean of the two - * vertices of the line. + * Let the new point be the arithmetic mean of the two vertices of the line. * - * Refer to the general - * documentation of this class - * and the documentation of the - * base class for more - * information. + * Refer to the general documentation of this class and the documentation of + * the base class for more information. */ virtual Point get_new_point_on_line (const typename Triangulation::line_iterator &line) const; /** - * Let the new point be the - * arithmetic mean of the four - * vertices of this quad and the - * four midpoints of the lines, - * which are already created at - * the time of calling this - * function. + * Let the new point be the arithmetic mean of the four vertices of this + * quad and the four midpoints of the lines, which are already created at + * the time of calling this function. * - * Refer to the general - * documentation of this class - * and the documentation of the - * base class for more - * information. + * Refer to the general documentation of this class and the documentation of + * the base class for more information. */ virtual Point get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const; /** - * Gives n=points.size() - * points that splits the - * StraightBoundary line into - * $n+1$ partitions of equal - * lengths. + * Gives n=points.size() points that splits the StraightBoundary + * line into $n+1$ partitions of equal lengths. * - * Refer to the general - * documentation of this class - * and the documentation of the - * base class. + * Refer to the general documentation of this class and the documentation of + * the base class. */ virtual void @@ -481,16 +372,11 @@ public: std::vector > &points) const; /** - * Gives n=points.size()=m*m - * points that splits the - * StraightBoundary quad into - * $(m+1)(m+1)$ subquads of equal - * size. + * Gives n=points.size()=m*m points that splits the + * StraightBoundary quad into $(m+1)(m+1)$ subquads of equal size. * - * Refer to the general - * documentation of this class - * and the documentation of the - * base class. + * Refer to the general documentation of this class and the documentation of + * the base class. */ virtual void @@ -498,13 +384,10 @@ public: std::vector > &points) const; /** - * Implementation of the function - * declared in the base class. + * Implementation of the function declared in the base class. * - * Refer to the general - * documentation of this class - * and the documentation of the - * base class. + * Refer to the general documentation of this class and the documentation of + * the base class. */ virtual Tensor<1,spacedim> @@ -512,14 +395,10 @@ public: const Point &p) const; /** - * Compute the normals to the - * boundary at the vertices of - * the given face. + * Compute the normals to the boundary at the vertices of the given face. * - * Refer to the general - * documentation of this class - * and the documentation of the - * base class. + * Refer to the general documentation of this class and the documentation of + * the base class. */ virtual void @@ -527,32 +406,18 @@ public: typename Boundary::FaceVertexNormals &face_vertex_normals) const; /** - * Given a candidate point and a - * line segment characterized by - * the iterator, return a point - * that lies on the surface - * described by this object. This - * function is used in some mesh - * smoothing algorithms that try - * to move around points in order - * to improve the mesh quality - * but need to ensure that points - * that were on the boundary - * remain on the boundary. + * Given a candidate point and a line segment characterized by the iterator, + * return a point that lies on the surface described by this object. This + * function is used in some mesh smoothing algorithms that try to move + * around points in order to improve the mesh quality but need to ensure + * that points that were on the boundary remain on the boundary. * - * The point returned is the - * projection of the candidate - * point onto the line through - * the two vertices of the given - * line iterator. + * The point returned is the projection of the candidate point onto the line + * through the two vertices of the given line iterator. * - * If spacedim==1, then the line - * represented by the line - * iterator is the entire space - * (i.e. it is a cell, not a part - * of the boundary), and the - * returned point equals the - * given input point. + * If spacedim==1, then the line represented by the line iterator is the + * entire space (i.e. it is a cell, not a part of the boundary), and the + * returned point equals the given input point. */ virtual Point @@ -560,26 +425,15 @@ public: const Point &candidate) const; /** - * Same function as above but for - * a point that is to be - * projected onto the area - * characterized by the given - * quad. + * Same function as above but for a point that is to be projected onto the + * area characterized by the given quad. * - * The point returned is the - * projection of the candidate - * point onto the bilinear - * surface spanned by the four - * vertices of the given quad - * iterator. + * The point returned is the projection of the candidate point onto the + * bilinear surface spanned by the four vertices of the given quad iterator. * - * If spacedim<=2, then the surface - * represented by the quad - * iterator is the entire space - * (i.e. it is a cell, not a part - * of the boundary), and the - * returned point equals the - * given input point. + * If spacedim<=2, then the surface represented by the quad iterator is the + * entire space (i.e. it is a cell, not a part of the boundary), and the + * returned point equals the given input point. */ virtual Point @@ -587,26 +441,16 @@ public: const Point &candidate) const; /** - * Same function as above but for - * a point that is to be - * projected onto the area - * characterized by the given - * quad. + * Same function as above but for a point that is to be projected onto the + * area characterized by the given quad. * - * The point returned is the - * projection of the candidate - * point onto the trilinear - * manifold spanned by the eight - * vertices of the given hex + * The point returned is the projection of the candidate point onto the + * trilinear manifold spanned by the eight vertices of the given hex * iterator. * - * If spacedim<=3, then the manifold - * represented by the hex - * iterator is the entire space - * (i.e. it is a cell, not a part - * of the boundary), and the - * returned point equals the - * given input point. + * If spacedim<=3, then the manifold represented by the hex iterator is the + * entire space (i.e. it is a cell, not a part of the boundary), and the + * returned point equals the given input point. */ virtual Point diff --git a/deal.II/include/deal.II/grid/tria_boundary_lib.h b/deal.II/include/deal.II/grid/tria_boundary_lib.h index b482962bf1..2f683b964e 100644 --- a/deal.II/include/deal.II/grid/tria_boundary_lib.h +++ b/deal.II/include/deal.II/grid/tria_boundary_lib.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_boundary_lib_h #define __deal2__tria_boundary_lib_h diff --git a/deal.II/include/deal.II/grid/tria_faces.h b/deal.II/include/deal.II/grid/tria_faces.h index 0ca056b63c..4a790c4d21 100644 --- a/deal.II/include/deal.II/grid/tria_faces.h +++ b/deal.II/include/deal.II/grid/tria_faces.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_faces_h #define __deal2__tria_faces_h diff --git a/deal.II/include/deal.II/grid/tria_iterator.h b/deal.II/include/deal.II/grid/tria_iterator.h index dc75dd1242..07321efd84 100644 --- a/deal.II/include/deal.II/grid/tria_iterator.h +++ b/deal.II/include/deal.II/grid/tria_iterator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_iterator_h #define __deal2__tria_iterator_h @@ -264,7 +269,7 @@ public: * = accessor; * @endcode */ - TriaRawIterator (const Accessor &a); + explicit TriaRawIterator (const Accessor &a); /** * Constructor. Assumes that the @@ -273,7 +278,7 @@ public: * one. */ template - TriaRawIterator (const OtherAccessor &a); + explicit TriaRawIterator (const OtherAccessor &a); /** * Proper constructor, initialized @@ -436,21 +441,36 @@ public: bool operator != (const TriaRawIterator &) const; /** - * Offer a weak ordering of iterators, - * which is needed to make @p maps with - * iterators being keys. An iterator - * pointing to an element @p a is - * less than another iterator pointing - * to an element @p b if - * level(a)Accessor::structure_dimension < + * Accessor::dimension, we simply compare the index of such an + * object. This consitutes an ordering of the elements of same + * dimension on a mesh on a single process. For a distributed mesh, + * the result of the ordering relation between faces across + * processes is not defined, but most likely irrelevant. * - * Comparing iterators of which one or - * both are invalid is an error. The - * past-the-end iterator is always - * ordered last. Two past-the-end - * iterators rank the same, thus false - * is returned in that case. + * For cells, there is a total ordering even in a + * distributed::parallel::Triangulation. The ordering is lexicographic + * according to the following hierarchy (in the sense, that the next + * test is only applied if the previous was inconclusive): + * + *
      + *
    1. The past-the-end iterator is always ordered last. Two + * past-the-end iterators rank the same, thus false is returned in + * that case.
    2. + * + *
    3. The level subdomain id
    4. + *
    5. If both cells are active, the subdomain id.
    6. + *
    7. The level of the cell.
    8. + *
    9. The index of a cell inside the level.
    10. + *
    */ bool operator < (const TriaRawIterator &) const; @@ -670,6 +690,13 @@ public: const int index, const typename Accessor::AccessorData *local_data = 0); + /** + * Construct from an accessor of type OtherAccessor that is convertible + * to the type Accessor. + */ + template + explicit TriaIterator (const OtherAccessor &a); + /** * This is a conversion operator * (constructor) which takes another @@ -1155,39 +1182,21 @@ TriaRawIterator::state () const template inline bool -TriaRawIterator::operator < (const TriaRawIterator &i) const +TriaRawIterator::operator < (const TriaRawIterator &other) const { - Assert (Accessor::structure_dimension!=Accessor::dimension || - state() != IteratorState::invalid, - ExcDereferenceInvalidCell(accessor)); - Assert (Accessor::structure_dimension==Accessor::dimension || - state() != IteratorState::invalid, - ExcDereferenceInvalidObject(accessor)); + Assert (state() != IteratorState::invalid, ExcDereferenceInvalidObject(accessor)); + Assert (other.state() != IteratorState::invalid, ExcDereferenceInvalidObject(other.accessor)); - Assert (Accessor::structure_dimension!=Accessor::dimension || - i.state() != IteratorState::invalid, - ExcDereferenceInvalidCell(i.accessor)); - Assert (Accessor::structure_dimension==Accessor::dimension || - i.state() != IteratorState::invalid, - ExcDereferenceInvalidObject(i.accessor)); - - Assert (&accessor.get_triangulation() == &i.accessor.get_triangulation(), + Assert (&accessor.get_triangulation() == &other.accessor.get_triangulation(), ExcInvalidComparison()); - if (Accessor::structure_dimension==Accessor::dimension) - return ((((accessor.level() < i.accessor.level()) || - ((accessor.level() == i.accessor.level()) && - (accessor.index() < i.accessor.index())) ) && - (state()==IteratorState::valid) && - (i.state()==IteratorState::valid) ) || - ((state()==IteratorState::valid) && - (i.state()==IteratorState::past_the_end))); - else - return ((((accessor.index() < i.accessor.index()) ) && - (state()==IteratorState::valid) && - (i.state()==IteratorState::valid) ) || - ((state()==IteratorState::valid) && - (i.state()==IteratorState::past_the_end))); + // Deal with iterators past end + if (state()==IteratorState::past_the_end) + return false; + if (other.state()==IteratorState::past_the_end) + return true; + + return ((**this) < (*other)); } @@ -1281,7 +1290,24 @@ TriaIterator::TriaIterator (const TriaRawIterator &i) #endif } - +template +template +TriaIterator::TriaIterator (const OtherAccessor &a) + : + TriaRawIterator (a) +{ +#ifdef DEBUG + // do this like this, because: + // if we write + // "Assert (IteratorState::past_the_end || used)" + // used() is called anyway, even if + // state==IteratorState::past_the_end, and will then + // throw the exception! + if (this->state() != IteratorState::past_the_end) + Assert (this->accessor.used(), + ExcAssignmentOfUnusedObject()); +#endif +} template template diff --git a/deal.II/include/deal.II/grid/tria_iterator.templates.h b/deal.II/include/deal.II/grid/tria_iterator.templates.h index 2abfb1cf6d..7ac87c26df 100644 --- a/deal.II/include/deal.II/grid/tria_iterator.templates.h +++ b/deal.II/include/deal.II/grid/tria_iterator.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_iterator_templates_h #define __deal2__tria_iterator_templates_h diff --git a/deal.II/include/deal.II/grid/tria_iterator_base.h b/deal.II/include/deal.II/grid/tria_iterator_base.h index 4db7062c8b..ed95f82ec7 100644 --- a/deal.II/include/deal.II/grid/tria_iterator_base.h +++ b/deal.II/include/deal.II/grid/tria_iterator_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_iterator_base_h #define __deal2__tria_iterator_base_h diff --git a/deal.II/include/deal.II/grid/tria_iterator_selector.h b/deal.II/include/deal.II/grid/tria_iterator_selector.h index 21e45ecd11..901641004d 100644 --- a/deal.II/include/deal.II/grid/tria_iterator_selector.h +++ b/deal.II/include/deal.II/grid/tria_iterator_selector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_iterator_selector_h #define __deal2__tria_iterator_selector_h diff --git a/deal.II/include/deal.II/grid/tria_levels.h b/deal.II/include/deal.II/grid/tria_levels.h index da4669901a..1bdc99ab65 100644 --- a/deal.II/include/deal.II/grid/tria_levels.h +++ b/deal.II/include/deal.II/grid/tria_levels.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_levels_h #define __deal2__tria_levels_h diff --git a/deal.II/include/deal.II/grid/tria_object.h b/deal.II/include/deal.II/grid/tria_object.h index a7c45ad371..a3e9a8045d 100644 --- a/deal.II/include/deal.II/grid/tria_object.h +++ b/deal.II/include/deal.II/grid/tria_object.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_object_h #define __deal2__tria_object_h diff --git a/deal.II/include/deal.II/grid/tria_objects.h b/deal.II/include/deal.II/grid/tria_objects.h index c90e306a62..1f3e6d0372 100644 --- a/deal.II/include/deal.II/grid/tria_objects.h +++ b/deal.II/include/deal.II/grid/tria_objects.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tria_objects_h #define __deal2__tria_objects_h diff --git a/deal.II/include/deal.II/hp/dof_faces.h b/deal.II/include/deal.II/hp/dof_faces.h index 4896d69b1e..a5bce7eedc 100644 --- a/deal.II/include/deal.II/hp/dof_faces.h +++ b/deal.II/include/deal.II/hp/dof_faces.h @@ -1,21 +1,24 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__hp_dof_faces_h #define __deal2__hp_dof_faces_h #include -#include -#include #include #include @@ -33,17 +36,226 @@ namespace internal { namespace hp { - /** + * Store the indices of the degrees of freedom which are located on + * objects of dimension @p structdim < dim, i.e., for faces or edges + * of cells. This is opposed to the internal::hp::DoFLevels class + * that stores the DoF indices on cells. + * + * The things we store here is very similar to what is stored in the + * internal::DoFHandler::DoFObjects classes (see there for more + * information, in particular on the layout of the class hierarchy, + * and the use of file names). + * + *

    Offset computations

    + * + * For hp methods, not all cells may use the same finite element, and + * it is consequently more complicated to determine where the DoF + * indices for a given line, quad, or hex are stored. As described in + * the documentation of the internal::DoFHandler::DoFLevel class, we + * can compute the location of the first line DoF, for example, by + * calculating the offset as line_index * + * dof_handler.get_fe().dofs_per_line. This of course doesn't + * work any more if different lines may have different numbers of + * degrees of freedom associated with them. Consequently, rather than + * using this simple multiplication, the dofs array has an associated + * array dof_offsets. The data corresponding to a + * line then starts at index line_dof_offsets[line_index] + * within the line_dofs array. + * * - *

    DoFFaces

    + *

    Multiple data sets per object

    * + * If two adjacent cells use different finite elements, then + * the face that they share needs to store DoF indices for both + * involved finite elements. While faces therefore have to have at + * most two sets of DoF indices, it is easy to see that edges and + * vertices can have as many sets of DoF indices associated with them + * as there are adjacent cells. + * + * Consequently, for objects that have a lower dimensionality than + * cells, we have to store a map from the finite element index to the + * set of DoF indices associated. Since real sets are typically very + * inefficient to store, and since most of the time we expect the + * number of individual keys to be small (frequently, adjacent cells + * will have the same finite element, and only a single entry will + * exist in the map), what we do is instead to store a linked list. In + * this format, the first entry starting at position + * lines.dofs[lines.dof_offsets[line_index]] will denote + * the finite element index of the set of DoF indices following; after + * this set, we will store the finite element index of the second set + * followed by the corresponding DoF indices; and so on. Finally, when + * all finite element indices adjacent to this object have been + * covered, we write a -1 to indicate the end of the list. + * + * Access to this kind of data, as well as the distinction between + * cells and objects of lower dimensionality are encoded in the + * accessor functions, DoFObjects::set_dof_index() and + * DoFLevel::get_dof_index(). They are able to traverse this + * list and pick out or set a DoF index given the finite element index + * and its location within the set of DoFs corresponding to this + * finite element. + * + * + * @ingroup hp + * @author Tobias Leicht, 2006 + */ + template + class DoFIndicesOnFacesOrEdges + { + public: + /** + * Store the start index for + * the degrees of freedom of each + * object in the @p dofs array. + * + * The type we store is then obviously the type the @p dofs array + * uses for indexing. + */ + std::vector dof_offsets; + + /** + * Store the global indices of + * the degrees of freedom. See + * DoFLevel() for detailed + * information. + */ + std::vector dofs; + + /** + * Set the global index of + * the @p local_index-th + * degree of freedom located + * on the object with number @p + * obj_index to the value + * given by @p global_index. The @p + * dof_handler argument is + * used to access the finite + * element that is to be used + * to compute the location + * where this data is stored. + * + * The third argument, @p + * fe_index, denotes which of + * the finite elements + * associated with this + * object we shall + * access. Refer to the + * general documentation of + * the internal::hp::DoFLevel + * class template for more + * information. + */ + template + void + set_dof_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index, + const unsigned int obj_level); + + /** + * Return the global index of + * the @p local_index-th + * degree of freedom located + * on the object with number @p + * obj_index. The @p + * dof_handler argument is + * used to access the finite + * element that is to be used + * to compute the location + * where this data is stored. + * + * The third argument, @p + * fe_index, denotes which of + * the finite elements + * associated with this + * object we shall + * access. Refer to the + * general documentation of + * the internal::hp::DoFLevel + * class template for more + * information. + */ + template + types::global_dof_index + get_dof_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int obj_level) const; + + /** + * Return the number of + * finite elements that are + * active on a given + * object. If this is a cell, + * the answer is of course + * one. If it is a face, the + * answer may be one or two, + * depending on whether the + * two adjacent cells use the + * same finite element or + * not. If it is an edge in + * 3d, the possible return + * value may be one or any + * other value larger than + * that. + * + * If the object is not part + * of an active cell, then no + * degrees of freedom have + * been distributed and zero + * is returned. + */ + template + unsigned int + n_active_fe_indices (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index) const; + + /** + * Return the fe_index of the + * n-th active finite element + * on this object. + */ + template + types::global_dof_index + nth_active_fe_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n) const; + + /** + * Check whether a given + * finite element index is + * used on the present + * object or not. + */ + template + bool + fe_index_is_active (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int obj_level) const; + + /** + * Determine an estimate for the + * memory consumption (in bytes) + * of this object. + */ + std::size_t memory_consumption () const; + }; + + + + /** * These classes are similar to the internal::hp::DoFLevel classes. We here store * information that is associated with faces, rather than cells, as this information is * independent of the hierarchical structure of cells, which are organized in levels. In 2D * we store information on degrees of freedom located on lines whereas in 3D we store * information on drefrees of freedom located on quads and lines. In 1D we do nothing, as - * the faces of lines are vertices which are treated seperately. + * the faces of lines are vertices which are treated separately. * * Apart from the internal::hp::DoFObjects object containing the data to store * (degree of freedom indices) and all the access-functionality to this data, we do not @@ -61,33 +273,19 @@ namespace internal * @ingroup dofs * @author Tobias Leicht, 2006 */ - - - - - - template - class DoFFaces - { - /** - * Make the constrctor private to prevent the use - * of this template, only the specializations - * should be used - */ - private: - DoFFaces(); - }; + class DoFIndicesOnFaces; + /** * Store the indices of degrees of freedom on faces in 1D. As these would be vertices, which - * are treted seperately, don't do anything. + * are treated separately, don't do anything. * * @ingroup hp * @author Tobias Leicht, 2006 */ template<> - class DoFFaces<1> + class DoFIndicesOnFaces<1> { public: /** @@ -105,10 +303,13 @@ namespace internal * @author Tobias Leicht, 2006 */ template<> - class DoFFaces<2> + class DoFIndicesOnFaces<2> { public: - internal::hp::DoFObjects<1> lines; + /** + * Indices of DoFs on the lines that bound cells. + */ + internal::hp::DoFIndicesOnFacesOrEdges<1> lines; /** * Determine an estimate for the @@ -126,11 +327,18 @@ namespace internal * @author Tobias Leicht, 2006 */ template<> - class DoFFaces<3> + class DoFIndicesOnFaces<3> { public: - internal::hp::DoFObjects<1> lines; - internal::hp::DoFObjects<2> quads; + /** + * Indices of DoFs on the lines that form the edges of cells. + */ + internal::hp::DoFIndicesOnFacesOrEdges<1> lines; + + /** + * Indices of DoFs on the quads that bound cells. + */ + internal::hp::DoFIndicesOnFacesOrEdges<2> quads; /** * Determine an estimate for the @@ -140,6 +348,298 @@ namespace internal std::size_t memory_consumption () const; }; + + // --------------------- inline and template functions ------------------ + + template + template + inline + types::global_dof_index + DoFIndicesOnFacesOrEdges:: + get_dof_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const unsigned int obj_level) const + { + 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 != 0, + ExcMessage ("No DoFHandler is specified for this iterator")); + Assert (&dof_handler.get_fe() != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); + Assert (local_index < + dof_handler.get_fe()[fe_index].template n_dofs_per_object(), + ExcIndexRange(local_index, 0, + dof_handler.get_fe()[fe_index] + .template n_dofs_per_object())); + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, dof_offsets.size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + + Assert (structdim( + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object() + 1); + } + } + + + + template + template + inline + void + DoFIndicesOnFacesOrEdges:: + set_dof_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index, + const unsigned int obj_level) + { + 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 != 0, + ExcMessage ("No DoFHandler is specified for this iterator")); + Assert (&dof_handler.get_fe() != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); + Assert (local_index < + dof_handler.get_fe()[fe_index].template n_dofs_per_object(), + ExcIndexRange(local_index, 0, + dof_handler.get_fe()[fe_index] + .template n_dofs_per_object())); + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, dof_offsets.size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + + Assert (structdim() + 1; + } + } + + + + template + template + inline + unsigned int + DoFIndicesOnFacesOrEdges:: + n_active_fe_indices (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index) const + { + Assert (&dof_handler != 0, + ExcMessage ("No DoFHandler is specified for this iterator")); + Assert (&dof_handler.get_fe() != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, dof_offsets.size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + if (dof_offsets[obj_index] == numbers::invalid_unsigned_int) + return 0; + + Assert (structdim() + 1; + } + } + } + + + + template + template + inline + types::global_dof_index + DoFIndicesOnFacesOrEdges:: + nth_active_fe_index (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_level, + const unsigned int obj_index, + const unsigned int n) const + { + Assert (&dof_handler != 0, + ExcMessage ("No DoFHandler is specified for this iterator")); + Assert (&dof_handler.get_fe() != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, dof_offsets.size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + + Assert (structdim() + 1; + } + } + + + + template + template + inline + bool + DoFIndicesOnFacesOrEdges:: + fe_index_is_active (const dealii::hp::DoFHandler &dof_handler, + const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int obj_level) const + { + Assert (&dof_handler != 0, + ExcMessage ("No DoFHandler is specified for this iterator")); + Assert (&dof_handler.get_fe() != 0, + ExcMessage ("No finite element collection is associated with " + "this DoFHandler")); + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, static_cast(dof_offsets.size()))); + Assert ((fe_index != dealii::hp::DoFHandler::default_fe_index), + ExcMessage ("You need to specify a FE index when working " + "with hp DoFHandlers")); + Assert (fe_index < dof_handler.get_fe().size(), + ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + + Assert (structdim( + dof_handler.get_fe()[*pointer] + .template n_dofs_per_object()+1); + } + } + + } // namespace hp } // namespace internal diff --git a/deal.II/include/deal.II/hp/dof_handler.h b/deal.II/include/deal.II/hp/dof_handler.h index 16a4dde274..4ee8bab130 100644 --- a/deal.II/include/deal.II/hp/dof_handler.h +++ b/deal.II/include/deal.II/hp/dof_handler.h @@ -1,14 +1,19 @@ -//---------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__hp_dof_handler_h #define __deal2__hp_dof_handler_h @@ -33,9 +38,9 @@ namespace internal { namespace hp { - template class DoFLevel; - template class DoFFaces; - template class DoFObjects; + class DoFLevel; + template class DoFIndicesOnFaces; + template class DoFIndicesOnFacesOrEdges; namespace DoFHandler { @@ -310,9 +315,17 @@ namespace hp cell_iterator begin (const unsigned int level = 0) const; /** - * Iterator to the first active - * cell on level @p level. - */ + * Iterator to the first active cell on level @p level. If the + * given level does not contain any active cells (i.e., all cells + * on this level are further refined, then this function returns + * end_active(level) so that loops of the kind + * @code + * for (cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) + * ... + * @endcode + * have zero iterations, as may be expected if there are no active + * cells on this level. + */ active_cell_iterator begin_active(const unsigned int level = 0) const; /** @@ -334,12 +347,10 @@ namespace hp cell_iterator end (const unsigned int level) const; /** - * Return an active iterator - * which is the first iterator - * not on level. If @p level is - * the last level, then this - * returns end(). - */ + * Return an active iterator which is the first active iterator not + * on the given level. If @p level is the last level, then this + * returns end(). + */ active_cell_iterator end_active (const unsigned int level) const; /*@}*/ @@ -378,7 +389,7 @@ namespace hp * DoFs which are constrained by * hanging nodes, see @ref constraints. */ - types::global_dof_index n_dofs () const; + types::global_dof_index n_dofs () const; /** * The number of multilevel @@ -682,7 +693,7 @@ namespace hp * the active_fe_indices in * the * dealii::internal::hp::DoFLevel. They - * are initialized with the a + * are initialized with a * zero indicator, meaning * that fe[0] is going to be * used by default. This @@ -693,7 +704,6 @@ namespace hp * cell has a valid * active_fe_index. */ - void create_active_fe_table (); /** @@ -780,7 +790,8 @@ namespace hp * levels[] tree of * the Triangulation objects. */ - std::vector*> levels; + std::vector levels; + /** * Space to store the DoF * numbers for the faces. @@ -788,7 +799,7 @@ namespace hp * faces pointer of * the Triangulation objects. */ - dealii::internal::hp::DoFFaces *faces; + dealii::internal::hp::DoFIndicesOnFaces *faces; /** * A structure that contains all @@ -826,7 +837,7 @@ namespace hp * actual data format used to * the present class. */ - std::vector vertex_dofs; + std::vector vertex_dofs; /** * For each vertex in the @@ -855,10 +866,10 @@ namespace hp /** * Array to store the - * information, if a cell on + * information if a cell on * some level has children or * not. It is used by the - * refinement listeners as a + * signal slots as a * persistent buffer during the * refinement, i.e. from between * when pre_refinement_action is @@ -889,8 +900,7 @@ namespace hp * the functions that set and * retrieve vertex dof indices. */ - template friend class dealii::internal::hp::DoFLevel; - template friend class dealii::internal::hp::DoFObjects; + template friend class dealii::internal::hp::DoFIndicesOnFacesOrEdges; friend struct dealii::internal::hp::DoFHandler::Implementation; }; diff --git a/deal.II/include/deal.II/hp/dof_level.h b/deal.II/include/deal.II/hp/dof_level.h new file mode 100644 index 0000000000..0f9e43fd85 --- /dev/null +++ b/deal.II/include/deal.II/hp/dof_level.h @@ -0,0 +1,432 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2003 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef __deal2__hp_dof_level_h +#define __deal2__hp_dof_level_h + + +#include +#include + +#include + + +DEAL_II_NAMESPACE_OPEN + +namespace hp +{ + template class DoFHandler; + template class FECollection; +} + + +namespace internal +{ + namespace hp + { + namespace DoFHandler + { + struct Implementation; + } + } + namespace DoFCellAccessor + { + struct Implementation; + } +} + + +namespace internal +{ + namespace hp + { + /** + * This is the class that stores the degrees of freedom on cells in a hp + * hierarchy. Compared to faces and edges, the task here is simple since + * each cell can only have a single active finite element index. Consequently, + * all we need is one long array with DoF indices and one array of offsets + * where each cell's indices start within the array of indices. This is in + * contrast to the DoFObjects class where each face or edge may have more than + * one associated finite element with corresponding degrees of freedom. + * + * The data stored here is represented by three arrays + * - The @p active_fe_indices array stores for each cell which + * finite element is used on this cell. Since some cells are not active + * on the current level, some entries in this array may represent an + * invalid value. + * - The @p dof_indices array stores for each active cell on the current + * level the dofs that associated with the interior of the cell, + * i.e., the @p dofs_per_line dofs associated with the line in 1d, and + * @p dofs_per_quad and @p dofs_per_hex in 2d and 3d. These numbers are + * in general smaller than @p dofs_per_cell. + * - The @p dof_offsets array stores, for each cell, the starting point + * of the dof indices corresponding to this cell in the @p dof_indices + * array. This is analogous to how we store data in compressed row storage + * for sparse matrices. For cells that are not active on the current level, + * we store an invalid value for the starting index. + * + *

    Compression

    + * + * It is common for the indices stored in @p dof_indices for one cell to be + * numbered consecutively. For example, using the standard numbering (without + * renumbering DoFs), the quad dofs on the first cell of a mesh when using a + * $Q_3$ element will be numbered 12, 13, 14, 15. This allows for + * compression if we only store the first entry and have some way to mark + * the DoFs on this object as compressed. Here, compression means that we + * know that subsequent DoF indices can be obtained from the previous ones + * by just incrementing them by one -- in other words, we use a variant of doing + * run-length encoding. The way to do this is that we + * use positive FE indices for uncompressed sets of DoFs and if a set of indices + * is compressed, then we instead store the FE index in binary complement (which + * we can identify by looking at the sign bit when interpreting the number as a + * signed one). There are two functions, compress_data() and uncompress_data() + * that convert between the two possible representations. + * + * Note that compression is not always possible. For example, if one renumbered + * the example above using DoFRenumbering::downstream with $(1,0)^T$ as + * direction, then they would likely be numbered 12, 14, 13, 15, which + * can not be compressed using run-length encoding. + */ + class DoFLevel + { + private: + /** + * The type in which we store the offsets into the dof_indices array. + */ + typedef unsigned int offset_type; + + /** + * The type in which we store the active FE index. + */ + typedef unsigned short int active_fe_index_type; + + /** + * A signed type that matches the type in which we store the active FE + * index. We use this in computing binary complements. + */ + typedef signed short int signed_active_fe_index_type; + + /** + * Indices specifying the finite element of hp::FECollection to + * use for the different cells on the current level. The vector + * stores one element per cell since the active_fe_index is + * unique for cells. + * + * If a cell is not active on the level corresponding to the + * current object (i.e., it has children on higher levels) then + * it does not have an associated fe index and we store + * an invalid fe index marker instead. + */ + std::vector active_fe_indices; + + /** + * Store the start index for the degrees of freedom of each + * object in the @p dof_indices array. If the cell corresponding to + * a particular index in this array is not active on this level, + * then we do not store any DoFs for it. In that case, the offset + * we store here must be an invalid number and indeed we store + * (std::vector::size_type)(-1) + * for it. + * + * The type we store is then obviously the type the @p dof_indices array + * uses for indexing. + */ + std::vector dof_offsets; + + /** + * Store the global indices of the degrees of freedom. + * information. The dof_offsets field determines where each + * (active) cell's data is stored. + */ + std::vector dof_indices; + + /** + * The offsets for each cell of the cache that holds all DoF indices. + */ + std::vector cell_cache_offsets; + + /** + * Cache for the DoF indices + * on cells. The size of this + * array equals the sum over all cells of selected_fe[active_fe_index[cell]].dofs_per_cell. + */ + std::vector cell_dof_indices_cache; + + public: + + /** + * Set the global index of + * the @p local_index-th + * degree of freedom located + * on the object with number @p + * obj_index to the value + * given by @p global_index. The @p + * dof_handler argument is + * used to access the finite + * element that is to be used + * to compute the location + * where this data is stored. + * + * The third argument, @p + * fe_index, denotes which of + * the finite elements + * associated with this + * object we shall + * access. Refer to the + * general documentation of + * the internal::hp::DoFLevel + * class template for more + * information. + */ + void + set_dof_index (const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index); + + /** + * Return the global index of + * the @p local_index-th + * degree of freedom located + * on the object with number @p + * obj_index. The @p + * dof_handler argument is + * used to access the finite + * element that is to be used + * to compute the location + * where this data is stored. + * + * The third argument, @p + * fe_index, denotes which of + * the finite elements + * associated with this + * object we shall + * access. Refer to the + * general documentation of + * the internal::hp::DoFLevel + * class template for more + * information. + */ + types::global_dof_index + get_dof_index (const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index) const; + + /** + * Return the fe_index of the + * active finite element + * on this object. + */ + unsigned int + active_fe_index (const unsigned int obj_index) const; + + /** + * Check whether a given + * finite element index is + * used on the present + * object or not. + */ + bool + fe_index_is_active (const unsigned int obj_index, + const unsigned int fe_index) const; + + /** + * Set the fe_index of the + * active finite element + * on this object. + */ + void + set_active_fe_index (const unsigned int obj_index, + const unsigned int fe_index); + + /** + * Return a pointer to the beginning of the DoF indices cache + * for a given cell. + * + * @param obj_index The number of the cell we are looking at. + * @param dofs_per_cell The number of DoFs per cell for this cell. This + * is not used for the hp case but necessary to keep the interface + * the same as for the non-hp case. + * @return A pointer to the first DoF index for the current cell. The + * next dofs_per_cell indices are for the current cell. + */ + const types::global_dof_index * + get_cell_cache_start (const unsigned int obj_index, + const unsigned int dofs_per_cell) const; + + /** + * Determine an estimate for the + * memory consumption (in bytes) + * of this object. + */ + std::size_t memory_consumption () const; + + private: + /** + * Compress the arrays that store dof indices by using a variant + * of run-length encoding. See the general documentation of this + * class for more information. + * + * @param fe_collection The object that can tell us how many + * degrees of freedom each of the finite elements has that we + * store in this object. + */ + template + void compress_data (const dealii::hp::FECollection &fe_collection); + + /** + * Uncompress the arrays that store dof indices by using a variant + * of run-length encoding. See the general documentation of this + * class for more information. + * + * @param fe_collection The object that can tell us how many + * degrees of freedom each of the finite elements has that we + * store in this object. + */ + template + void uncompress_data (const dealii::hp::FECollection &fe_collection); + + /** + * Make hp::DoFHandler and its auxiliary class a friend since it + * is the class that needs to create these data structures. + */ + template friend class dealii::hp::DoFHandler; + friend struct dealii::internal::hp::DoFHandler::Implementation; + friend struct dealii::internal::DoFCellAccessor::Implementation; + }; + + + // -------------------- template functions -------------------------------- + + inline + types::global_dof_index + DoFLevel:: + get_dof_index (const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index) const + { + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, dof_offsets.size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (dof_offsets[obj_index] != (offset_type)(-1), + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + + Assert (fe_index == active_fe_indices[obj_index], + ExcMessage ("FE index does not match that of the present cell")); + + // see if the dof_indices array has been compressed for this + // particular cell + if ((signed_active_fe_index_type)active_fe_indices[obj_index]>=0) + return dof_indices[dof_offsets[obj_index]+local_index]; + else + return dof_indices[dof_offsets[obj_index]]+local_index; + } + + + + inline + void + DoFLevel:: + set_dof_index (const unsigned int obj_index, + const unsigned int fe_index, + const unsigned int local_index, + const types::global_dof_index global_index) + { + Assert (obj_index < dof_offsets.size(), + ExcIndexRange (obj_index, 0, dof_offsets.size())); + + // make sure we are on an + // object for which DoFs have + // been allocated at all + Assert (dof_offsets[obj_index] != (offset_type)(-1), + ExcMessage ("You are trying to access degree of freedom " + "information for an object on which no such " + "information is available")); + Assert ((signed_active_fe_index_type)active_fe_indices[obj_index]>=0, + ExcMessage ("This function can no longer be called after compressing the dof_indices array")); + Assert (fe_index == active_fe_indices[obj_index], + ExcMessage ("FE index does not match that of the present cell")); + dof_indices[dof_offsets[obj_index]+local_index] = global_index; + } + + + + inline + unsigned int + DoFLevel:: + active_fe_index (const unsigned int obj_index) const + { + Assert (obj_index < active_fe_indices.size(), + ExcIndexRange (obj_index, 0, active_fe_indices.size())); + + if (((signed_active_fe_index_type)active_fe_indices[obj_index]) >= 0) + return active_fe_indices[obj_index]; + else + return (active_fe_index_type)~(signed_active_fe_index_type)active_fe_indices[obj_index]; + } + + + + inline + bool + DoFLevel:: + fe_index_is_active (const unsigned int obj_index, + const unsigned int fe_index) const + { + return (fe_index == active_fe_index(obj_index)); + } + + + inline + void + DoFLevel:: + set_active_fe_index (const unsigned int obj_index, + const unsigned int fe_index) + { + Assert (obj_index < active_fe_indices.size(), + ExcIndexRange (obj_index, 0, active_fe_indices.size())); + + active_fe_indices[obj_index] = fe_index; + } + + + + inline + const types::global_dof_index * + DoFLevel::get_cell_cache_start (const unsigned int obj_index, + const unsigned int dofs_per_cell) const + { + Assert (obj_index < cell_cache_offsets.size(), + ExcInternalError()); + Assert (cell_cache_offsets[obj_index]+dofs_per_cell + <= + cell_dof_indices_cache.size(), + ExcInternalError()); + + return &cell_dof_indices_cache[cell_cache_offsets[obj_index]]; + } + } // namespace hp + +} // namespace internal + +DEAL_II_NAMESPACE_CLOSE + +#endif diff --git a/deal.II/include/deal.II/hp/dof_levels.h b/deal.II/include/deal.II/hp/dof_levels.h deleted file mode 100644 index f310c7dce7..0000000000 --- a/deal.II/include/deal.II/hp/dof_levels.h +++ /dev/null @@ -1,236 +0,0 @@ -//---------------------------- hp_dof_levels.h ------------------------ -// $Id$ -// -// Copyright (C) 2003, 2006, 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 -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//---------------------------- hp_dof_levels.h ------------------------ -#ifndef __deal2__hp_dof_levels_h -#define __deal2__hp_dof_levels_h - - -#include -#include - -#include - -DEAL_II_NAMESPACE_OPEN - -namespace internal -{ - namespace hp - { - - /** - * Store the indices of the degrees of freedom which are located on - * objects of dimension @p N. We declare this general template - * class, but do not actually use it. Rather, only specializations of - * this class are used. - * - * The things we store here is very similar to what is stored in the - * internal::DoFHandler::DoFLevel class hierarchy (see there for more - * information, in particular on the layout of the class hierarchy, - * and the use of file names). There are two main - * differences, discussed in the following subsections. In addition to - * the data already stored by the internal::DoFHandler::DoFLevel - * classes, we also have to store which finite element each cell - * uses. This is done in the DoFLevel<0> class, where for each cell we - * have an entry within the active_fe_indices field. - * - * - *

    Offset computations

    - * - * For hp methods, not all cells may use the same finite element, and - * it is consequently more complicated to determine where the DoF - * indices for a given line, quad, or hex are stored. As described in - * the documentation of the internal::DoFHandler::DoFLevel class, we - * can compute the location of the first line DoF, for example, by - * calculating the offset as line_index * - * dof_handler.get_fe().dofs_per_line. This of course doesn't - * work any more if different lines may have different numbers of - * degrees of freedom associated with them. Consequently, rather than - * using this simple multiplication, each of the lines.dofs, quads.dofs, - * and hexes.dofs arrays has an associated array lines.dof_offsets, - * quads.dof_offsets, and hexes.dof_offsets. The data corresponding to a - * line then starts at index line_dof_offsets[line_index] - * within the line_dofs array. - * - * - *

    Multiple data sets per object

    - * - * If an object corresponds to a cell, the global dof indices of this - * cell are stored at the location indicated above in sequential - * order. - * - * However, if two adjacent cells use different finite elements, then - * the face that they share needs to store DoF indices for both - * involved finite elements. While faces therefore have to have at - * most two sets of DoF indices, it is easy to see that vertices for - * example can have as many sets of DoF indices associated with them - * as there are adjacent cells, and the same holds for lines in 3d. - * - * Consequently, for objects that have a lower dimensionality than - * cells, we have to store a map from the finite element index to the - * set of DoF indices associated. Since real sets are typically very - * inefficient to store, and since most of the time we expect the - * number of individual keys to be small (frequently, adjacent cells - * will have the same finite element, and only a single entry will - * exist in the map), what we do is instead to store a linked list. In - * this format, the first entry starting at position - * lines.dofs[lines.dof_offsets[line_index]] will denote - * the finite element index of the set of DoF indices following; after - * this set, we will store the finite element index of the second set - * followed by the corresponding DoF indices; and so on. Finally, when - * all finite element indices adjacent to this object have been - * covered, we write a -1 to indicate the end of the list. - * - * Access to this kind of data, as well as the distinction between - * cells and objects of lower dimensionality are encoded in the - * accessor functions, DoFObjects::set_dof_index() and - * DoFLevel::get_dof_index() They are able to traverse this - * list and pick out or set a DoF index given the finite element index - * and its location within the set of DoFs corresponding to this - * finite element. - * - * - * @ingroup hp - * @author Wolfgang Bangerth, 1998, 2006, Oliver Kayser-Herold 2003. - */ - template - class DoFLevel - { - private: - /** - * Make the constructor private - * to avoid that someone uses - * this class. - */ - DoFLevel (); - }; - - - /** - * Storage for degrees of freedom on cells. See the documentation of - * the DoFLevel class template for more complete information on the - * purpose and layout of this class. - * - * @ingroup hp - * @author Wolfgang Bangerth, 1998, 2006, Oliver Kayser-Herold 2003. - */ - template <> - class DoFLevel<0> - { - public: - /** - * Indices specifying the finite - * element of hp::FECollection to use - * for the different cells. The - * meaning what a cell is, is - * dimension specific, therefore also - * the length of this vector depends - * on the dimension: in one dimension, - * the length of this vector equals - * the length of the @p lines vector, - * in two dimensions that of the @p - * quads vector, etc. - */ - - std::vector active_fe_indices; - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ - std::size_t memory_consumption () const; - }; - - - /** - * Store the indices of the degrees of freedom which are located on - * the lines. See the general template DoFLevel for more information. - * - * @ingroup hp - * @author Wolfgang Bangerth, 1998, 2006, Oliver Kayser-Herold 2003. - */ - template <> - class DoFLevel<1> : public DoFLevel<0> - { - public: - /** - * store the dof-indices and related functions of - * lines - */ - internal::hp::DoFObjects<1> dof_object; - - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ - std::size_t memory_consumption () const; - }; - - - /** - * Store the indices of the degrees of freedom which are located on - * quads. See the general template DoFLevel for more information. - * - * @ingroup hp - * @author Wolfgang Bangerth, 1998, 2006, Oliver Kayser-Herold 2003. - */ - template <> - class DoFLevel<2> : public DoFLevel<0> - { - public: - /** - * store the dof-indices and related functions of - * quads - */ - internal::hp::DoFObjects<2> dof_object; - - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ - std::size_t memory_consumption () const; - }; - - - - /** - * Store the indices of the degrees of freedom which are located on - * hexhedra. See the general template DoFLevel for more information. - * - * @ingroup hp - * @author Wolfgang Bangerth, 1998, 2006, Oliver Kayser-Herold 2003. - */ - template <> - class DoFLevel<3> : public DoFLevel<0> - { - public: - /** - * store the dof-indices and related functions of - * hexes - */ - internal::hp::DoFObjects<3> dof_object; - - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ - std::size_t memory_consumption () const; - }; - - } // namespace hp - -} // namespace internal - -DEAL_II_NAMESPACE_CLOSE - -#endif diff --git a/deal.II/include/deal.II/hp/dof_objects.h b/deal.II/include/deal.II/hp/dof_objects.h deleted file mode 100644 index 8ea18fccf3..0000000000 --- a/deal.II/include/deal.II/hp/dof_objects.h +++ /dev/null @@ -1,632 +0,0 @@ -//--------------------------------------------------------------------------- -// $Id$ -// -// Copyright (C) 2006, 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 -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//--------------------------------------------------------------------------- -#ifndef __deal2__hp_dof_objects_h -#define __deal2__hp_dof_objects_h - -#include -#include -#include - -#include - -DEAL_II_NAMESPACE_OPEN - -namespace internal -{ - namespace hp - { - - /** - * Store the indices of the degrees of freedom which are located on - * objects of dimension @p dim. - * - * The things we store here is very similar to what is stored in the - * internal::DoFHandler::DoFObjects classes (see there for more - * information, in particular on the layout of the class hierarchy, - * and the use of file names). - * - *

    Offset computations

    - * - * For hp methods, not all cells may use the same finite element, and - * it is consequently more complicated to determine where the DoF - * indices for a given line, quad, or hex are stored. As described in - * the documentation of the internal::DoFHandler::DoFLevel class, we - * can compute the location of the first line DoF, for example, by - * calculating the offset as line_index * - * dof_handler.get_fe().dofs_per_line. This of course doesn't - * work any more if different lines may have different numbers of - * degrees of freedom associated with them. Consequently, rather than - * using this simple multiplication, the dofs array has an associated - * array dof_offsets. The data corresponding to a - * line then starts at index line_dof_offsets[line_index] - * within the line_dofs array. - * - * - *

    Multiple data sets per object

    - * - * If an object corresponds to a cell, the global dof indices of this - * cell are stored at the location indicated above in sequential - * order. - * - * However, if two adjacent cells use different finite elements, then - * the face that they share needs to store DoF indices for both - * involved finite elements. While faces therefore have to have at - * most two sets of DoF indices, it is easy to see that vertices for - * example can have as many sets of DoF indices associated with them - * as there are adjacent cells, and the same holds for lines in 3d. - * - * Consequently, for objects that have a lower dimensionality than - * cells, we have to store a map from the finite element index to the - * set of DoF indices associated. Since real sets are typically very - * inefficient to store, and since most of the time we expect the - * number of individual keys to be small (frequently, adjacent cells - * will have the same finite element, and only a single entry will - * exist in the map), what we do is instead to store a linked list. In - * this format, the first entry starting at position - * lines.dofs[lines.dof_offsets[line_index]] will denote - * the finite element index of the set of DoF indices following; after - * this set, we will store the finite element index of the second set - * followed by the corresponding DoF indices; and so on. Finally, when - * all finite element indices adjacent to this object have been - * covered, we write a -1 to indicate the end of the list. - * - * Access to this kind of data, as well as the distinction between - * cells and objects of lower dimensionality are encoded in the - * accessor functions, DoFObjects::set_dof_index() and - * DoFLevel::get_dof_index() They are able to traverse this - * list and pick out or set a DoF index given the finite element index - * and its location within the set of DoFs corresponding to this - * finite element. - * - * - * @ingroup hp - * @author Tobias Leicht, 2006 - */ - - template - class DoFObjects - { - public: - /** - * Store the start index for - * the degrees of freedom of each - * hex in the @p hex_dofs array. - */ - std::vector dof_offsets; - - /** - * Store the global indices of - * the degrees of freedom. See - * DoFLevel() for detailed - * information. - */ - std::vector dofs; - - /** - * Set the global index of - * the @p local_index-th - * degree of freedom located - * on the hex with number @p - * hex_index to the value - * given by the last - * argument. The @p - * dof_handler argument is - * used to access the finite - * element that is to be used - * to compute the location - * where this data is stored. - * - * The third argument, @p - * fe_index, denotes which of - * the finite elements - * associated with this - * object we shall - * access. Refer to the - * general documentation of - * the internal::hp::DoFLevel - * class template for more - * information. - */ - template - void - set_dof_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const types::global_dof_index global_index, - const unsigned int obj_level); - - /** - * Return the global index of - * the @p local_index-th - * degree of freedom located - * on the hex with number @p - * hex_index. The @p - * dof_handler argument is - * used to access the finite - * element that is to be used - * to compute the location - * where this data is stored. - * - * The third argument, @p - * fe_index, denotes which of - * the finite elements - * associated with this - * object we shall - * access. Refer to the - * general documentation of - * the internal::hp::DoFLevel - * class template for more - * information. - */ - template - types::global_dof_index - get_dof_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int obj_level) const; - - /** - * Return the number of - * finite elements that are - * active on a given - * object. If this is a cell, - * the answer is of course - * one. If it is a face, the - * answer may be one or two, - * depending on whether the - * two adjacent cells use the - * same finite element or - * not. If it is an edge in - * 3d, the possible return - * value may be one or any - * other value larger than - * that. - * - * If the object is not part - * of an active cell, then no - * degrees of freedom have - * been distributed and zero - * is returned. - */ - template - unsigned int - n_active_fe_indices (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index) const; - - /** - * Return the fe_index of the - * n-th active finite element - * on this object. - */ - template - types::global_dof_index - nth_active_fe_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const; - - /** - * Check whether a given - * finite element index is - * used on the present - * object or not. - */ - template - bool - fe_index_is_active (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int obj_level) const; - - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ - std::size_t memory_consumption () const; - }; - - -// --------------------- inline and template functions ------------------ - - template - template - inline - types::global_dof_index - DoFObjects:: - get_dof_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const unsigned int obj_level) const - { - 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 != 0, - ExcMessage ("No DoFHandler is specified for this iterator")); - Assert (&dof_handler.get_fe() != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (fe_index < dof_handler.get_fe().size(), - ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); - Assert (local_index < - dof_handler.get_fe()[fe_index].template n_dofs_per_object(), - ExcIndexRange(local_index, 0, - dof_handler.get_fe()[fe_index] - .template n_dofs_per_object())); - Assert (obj_index < dof_offsets.size(), - ExcIndexRange (obj_index, 0, dof_offsets.size())); - - // make sure we are on an - // object for which DoFs have - // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, - ExcMessage ("You are trying to access degree of freedom " - "information for an object on which no such " - "information is available")); - - if (dim == dimm) - { - // if we are on a cell, then - // the only set of indices we - // store is the one for the - // cell, which is unique. then - // fe_index must be - // active_fe_index - Assert (fe_index == dof_handler.levels[obj_level]->active_fe_indices[obj_index], - ExcMessage ("FE index does not match that of the present cell")); - return dofs[dof_offsets[obj_index]+local_index]; - } - else - { - // we are in higher space - // dimensions, so there may - // be multiple finite - // elements associated with - // this object. 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 types::global_dof_index starting_offset = dof_offsets[obj_index]; - const types::global_dof_index *pointer = &dofs[starting_offset]; - while (true) - { - Assert (*pointer != numbers::invalid_dof_index, - ExcInternalError()); - if (*pointer == fe_index) - return *(pointer + 1 + local_index); - else - pointer += static_cast( - dof_handler.get_fe()[*pointer] - .template n_dofs_per_object() + 1); - } - } - } - - - - template - template - inline - void - DoFObjects:: - set_dof_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int local_index, - const types::global_dof_index global_index, - const unsigned int obj_level) - { - 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 != 0, - ExcMessage ("No DoFHandler is specified for this iterator")); - Assert (&dof_handler.get_fe() != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (fe_index < dof_handler.get_fe().size(), - ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); - Assert (local_index < - dof_handler.get_fe()[fe_index].template n_dofs_per_object(), - ExcIndexRange(local_index, 0, - dof_handler.get_fe()[fe_index] - .template n_dofs_per_object())); - Assert (obj_index < dof_offsets.size(), - ExcIndexRange (obj_index, 0, dof_offsets.size())); - - // make sure we are on an - // object for which DoFs have - // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, - ExcMessage ("You are trying to access degree of freedom " - "information for an object on which no such " - "information is available")); - - if (dim == dimm) - { - // if we are on a cell, then - // the only set of indices we - // store is the one for the - // cell, which is unique. then - // fe_index must be - // active_fe_index - Assert (fe_index == dof_handler.levels[obj_level]->active_fe_indices[obj_index], - ExcMessage ("FE index does not match that of the present cell")); - dofs[dof_offsets[obj_index]+local_index] = global_index; - } - else - { - // we are in higher space - // dimensions, so there may - // be multiple finite - // elements associated with - // this object. 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 types::global_dof_index starting_offset = dof_offsets[obj_index]; - types::global_dof_index *pointer = &dofs[starting_offset]; - while (true) - { - Assert (*pointer != numbers::invalid_dof_index, - ExcInternalError()); - if (*pointer == fe_index) - { - *(pointer + 1 + local_index) = global_index; - return; - } - else - pointer += dof_handler.get_fe()[*pointer] - .template n_dofs_per_object() + 1; - } - } - } - - - - template - template - inline - unsigned int - DoFObjects:: - n_active_fe_indices (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index) const - { - Assert (dim <= dimm, ExcInternalError()); - Assert (&dof_handler != 0, - ExcMessage ("No DoFHandler is specified for this iterator")); - Assert (&dof_handler.get_fe() != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (obj_index < dof_offsets.size(), - ExcIndexRange (obj_index, 0, dof_offsets.size())); - - // make sure we are on an - // object for which DoFs have - // been allocated at all - if (dof_offsets[obj_index] == numbers::invalid_dof_index) - return 0; - - // if we are on a cell, then the - // only set of indices we store - // is the one for the cell, - // which is unique - if (dim == dimm) - return 1; - else - { - // otherwise, there may be - // multiple finite elements - // associated with this - // object. 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_offsets[obj_index]; - const types::global_dof_index *pointer = &dofs[starting_offset]; - unsigned int counter = 0; - while (true) - { - if (*pointer == numbers::invalid_dof_index) - // end of list reached - return counter; - else - { - ++counter; - pointer += dof_handler.get_fe()[*pointer] - .template n_dofs_per_object() + 1; - } - } - } - } - - - - template - template - inline - types::global_dof_index - DoFObjects:: - nth_active_fe_index (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_level, - const unsigned int obj_index, - const unsigned int n) const - { - Assert (dim <= dimm, ExcInternalError()); - Assert (&dof_handler != 0, - ExcMessage ("No DoFHandler is specified for this iterator")); - Assert (&dof_handler.get_fe() != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (obj_index < dof_offsets.size(), - ExcIndexRange (obj_index, 0, dof_offsets.size())); - - // make sure we are on an - // object for which DoFs have - // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, - ExcMessage ("You are trying to access degree of freedom " - "information for an object on which no such " - "information is available")); - - if (dim == dimm) - { - // this is a cell, so there - // is only a single - // fe_index - Assert (n == 0, ExcIndexRange (n, 0, 1)); - - return dof_handler.levels[obj_level]->active_fe_indices[obj_index]; - } - else - { - Assert (n < n_active_fe_indices(dof_handler, obj_index), - ExcIndexRange (n, 0, - n_active_fe_indices(dof_handler, obj_index))); - - // we are in higher space - // dimensions, so there may - // be multiple finite - // elements associated with - // this object. 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_offsets[obj_index]; - const types::global_dof_index *pointer = &dofs[starting_offset]; - unsigned int counter = 0; - while (true) - { - Assert (*pointer != numbers::invalid_dof_index, - ExcInternalError()); - - const unsigned int fe_index = *pointer; - - Assert (fe_index < dof_handler.get_fe().size(), - ExcInternalError()); - - if (counter == n) - return fe_index; - - ++counter; - pointer += dof_handler.get_fe()[fe_index] - .template n_dofs_per_object() + 1; - } - } - } - - - - template - template - inline - bool - DoFObjects:: - fe_index_is_active (const dealii::hp::DoFHandler &dof_handler, - const unsigned int obj_index, - const unsigned int fe_index, - const unsigned int obj_level) const - { - Assert (&dof_handler != 0, - ExcMessage ("No DoFHandler is specified for this iterator")); - Assert (&dof_handler.get_fe() != 0, - ExcMessage ("No finite element collection is associated with " - "this DoFHandler")); - Assert (obj_index < dof_offsets.size(), - ExcIndexRange (obj_index, 0, static_cast(dof_offsets.size()))); - Assert ((fe_index != dealii::hp::DoFHandler::default_fe_index), - ExcMessage ("You need to specify a FE index when working " - "with hp DoFHandlers")); - Assert (fe_index < dof_handler.get_fe().size(), - ExcIndexRange (fe_index, 0, dof_handler.get_fe().size())); - - // make sure we are on an - // object for which DoFs have - // been allocated at all - Assert (dof_offsets[obj_index] != numbers::invalid_dof_index, - ExcMessage ("You are trying to access degree of freedom " - "information for an object on which no such " - "information is available")); - - if (dim == dimm) - { - // if we are on a cell, - // then the only set of - // indices we store is the - // one for the cell, which - // is unique - Assert (obj_index < dof_handler.levels[obj_level]->active_fe_indices.size(), - ExcInternalError()); - return (fe_index == dof_handler.levels[obj_level]->active_fe_indices[obj_index]); - } - else - { - // we are in higher space - // dimensions, so there may - // be multiple finite - // elements associated with - // this object. 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 types::global_dof_index starting_offset = dof_offsets[obj_index]; - const types::global_dof_index *pointer = &dofs[starting_offset]; - while (true) - { - if (*pointer == numbers::invalid_dof_index) - // end of list reached - return false; - else if (*pointer == fe_index) - return true; - else - pointer += static_cast( - dof_handler.get_fe()[*pointer] - .template n_dofs_per_object()+1); - } - } - } - - } -} - -DEAL_II_NAMESPACE_CLOSE - -#endif diff --git a/deal.II/include/deal.II/hp/fe_collection.h b/deal.II/include/deal.II/hp/fe_collection.h index ddafe78b13..def9cc371e 100644 --- a/deal.II/include/deal.II/hp/fe_collection.h +++ b/deal.II/include/deal.II/hp/fe_collection.h @@ -1,14 +1,19 @@ -//---------------------------- fe_collection.h --------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- fe_collection.h --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__fe_collection_h #define __deal2__fe_collection_h diff --git a/deal.II/include/deal.II/hp/fe_values.h b/deal.II/include/deal.II/hp/fe_values.h index 4e634cfd03..cad63fdf4f 100644 --- a/deal.II/include/deal.II/hp/fe_values.h +++ b/deal.II/include/deal.II/hp/fe_values.h @@ -1,14 +1,19 @@ -//---------------------------- hp_fe_values.h --------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- hp_fe_values.h --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__hp_fe_values_h #define __deal2__hp_fe_values_h @@ -59,63 +64,64 @@ namespace internal { public: /** - * Constructor. Set the fields - * of this class to the values - * indicated by the parameters - * to the constructor. + * Constructor. Set the fields of this class to the values indicated by + * the parameters to the constructor. */ FEValuesBase (const dealii::hp::MappingCollection &mapping_collection, const dealii::hp::FECollection &fe_collection, const dealii::hp::QCollection &q_collection, const UpdateFlags update_flags); /** - * Constructor. Set the fields - * of this class to the values - * indicated by the parameters - * to the constructor, and - * choose a @p MappingQ1 - * object for the mapping - * object. + * Constructor. Set the fields of this class to the values indicated by + * the parameters to the constructor, and choose a @p MappingQ1 object + * for the mapping object. */ FEValuesBase (const dealii::hp::FECollection &fe_collection, const dealii::hp::QCollection &q_collection, const UpdateFlags update_flags); /** - * Get a reference to the - * collection of finite - * element objects used here. + * Get a reference to the collection of finite element objects used + * here. */ const dealii::hp::FECollection & get_fe_collection () const; /** - * Return a reference to the @p - * FEValues object selected by the - * last call to - * select_fe_values(). select_fe_values() - * in turn is called when you called - * the @p reinit function of the - * hp::FE*Values class the - * last time. + * Get a reference to the collection of mapping objects used + * here. + */ + const dealii::hp::MappingCollection & + get_mapping_collection () const; + + /** + * Get a reference to the collection of quadrature objects used + * here. + */ + const dealii::hp::QCollection & + get_quadrature_collection () const; + + /** + * Get the underlying update flags. + */ + UpdateFlags get_update_flags() const; + + /** + * Return a reference to the @p FEValues object selected by the last + * call to select_fe_values(). select_fe_values() in turn is called when + * you called the @p reinit function of the hp::FE*Values class + * the last time. */ const FEValues &get_present_fe_values () const; protected: /** - * Select a FEValues object - * suitable for the given FE, - * quadrature, and mapping - * indices. If such an object - * doesn't yet exist, create - * one. + * Select a FEValues object suitable for the given FE, quadrature, and + * mapping indices. If such an object doesn't yet exist, create one. * - * The function returns a - * writable reference so that - * derived classes can also - * reinit() the selected - * FEValues object. + * The function returns a writable reference so that derived classes can + * also reinit() the selected FEValues object. */ FEValues & select_fe_values (const unsigned int fe_index, @@ -124,68 +130,44 @@ namespace internal protected: /** - * A pointer to the - * collection of finite - * elements to be used. + * A pointer to the collection of finite elements to be used. */ const SmartPointer, FEValuesBase > fe_collection; /** - * A pointer to the - * collection of mappings to - * be used. + * A pointer to the collection of mappings to be used. */ const SmartPointer, FEValuesBase > mapping_collection; /** - * Copy of the quadrature - * collection object - * provided to the - * constructor. + * Copy of the quadrature collection object provided to the constructor. */ const dealii::hp::QCollection q_collection; private: /** - * A table in which we store - * pointers to fe_values - * objects for different - * finite element, mapping, - * and quadrature objects - * from our collection. The - * first index indicates the - * index of the finite - * element within the - * fe_collection, the second - * the index of the mapping - * within the mapping - * collection, and the last - * one the index of the - * quadrature formula within - * the q_collection. + * A table in which we store pointers to fe_values objects for different + * finite element, mapping, and quadrature objects from our + * collection. The first index indicates the index of the finite element + * within the fe_collection, the second the index of the mapping within + * the mapping collection, and the last one the index of the quadrature + * formula within the q_collection. * - * Initially, all entries - * have zero pointers, and we - * will allocate them lazily - * as needed in - * select_fe_values(). + * Initially, all entries have zero pointers, and we will allocate them + * lazily as needed in select_fe_values(). */ Table<3,std_cxx1x::shared_ptr > fe_values_table; /** - * Set of indices pointing at - * the fe_values object - * selected last time the - * select_fe_value() function - * was called. + * Set of indices pointing at the fe_values object selected last time + * the select_fe_value() function was called. */ TableIndices<3> present_fe_values_index; /** - * Values of the update flags as - * given to the constructor. + * Values of the update flags as given to the constructor. */ const UpdateFlags update_flags; }; @@ -254,24 +236,13 @@ namespace hp static const unsigned int space_dimension = spacedim; /** - * Constructor. Initialize this - * object with the given - * parameters. + * Constructor. Initialize this object with the given parameters. * - * The finite element - * collection parameter is - * actually ignored, but is in - * the signature of this - * function to make it - * compatible with the - * signature of the respective - * constructor of the usual - * FEValues object, with - * the respective parameter in - * that function also being the - * return value of the - * DoFHandler::get_fe() - * function. + * The finite element collection parameter is actually ignored, but is in + * the signature of this function to make it compatible with the signature + * of the respective constructor of the usual FEValues object, with the + * respective parameter in that function also being the return value of + * the DoFHandler::get_fe() function. */ FEValues (const dealii::hp::MappingCollection &mapping_collection, const dealii::hp::FECollection &fe_collection, @@ -280,26 +251,14 @@ namespace hp /** - * Constructor. Initialize this - * object with the given - * parameters, and choose a - * @p MappingQ1 object for the - * mapping object. + * Constructor. Initialize this object with the given parameters, and + * choose a @p MappingQ1 object for the mapping object. * - * The finite element - * collection parameter is - * actually ignored, but is in - * the signature of this - * function to make it - * compatible with the - * signature of the respective - * constructor of the usual - * FEValues object, with - * the respective parameter in - * that function also being the - * return value of the - * DoFHandler::get_fe() - * function. + * The finite element collection parameter is actually ignored, but is in + * the signature of this function to make it compatible with the signature + * of the respective constructor of the usual FEValues object, with the + * respective parameter in that function also being the return value of + * the DoFHandler::get_fe() function. */ FEValues (const hp::FECollection &fe_collection, const hp::QCollection &q_collection, @@ -307,103 +266,50 @@ namespace hp /** - * Reinitialize the object for - * the given cell. + * Reinitialize the object for the given cell. * - * After the call, you can get - * an FEValues object using the - * get_present_fe_values() - * function that corresponds to - * the present cell. For this - * FEValues object, we use the - * additional arguments - * described below to determine - * which finite element, - * mapping, and quadrature - * formula to use. They are - * order in such a way that the - * arguments one may want to - * change most frequently come - * first. The rules for these - * arguments are as follows: + * After the call, you can get an FEValues object using the + * get_present_fe_values() function that corresponds to the present + * cell. For this FEValues object, we use the additional arguments + * described below to determine which finite element, mapping, and + * quadrature formula to use. They are order in such a way that the + * arguments one may want to change most frequently come first. The rules + * for these arguments are as follows: * - * If the @p fe_index argument - * to this function is left at - * its default value, then we - * use that finite element - * within the hp::FECollection - * passed to the constructor of - * this class with index given - * by - * cell-@>active_fe_index(). Consequently, - * the hp::FECollection - * argument given to this - * object should really be the - * same as that used in the - * construction of the - * hp::DofHandler associated - * with the present cell. On - * the other hand, if a value - * is given for this argument, - * it overrides the choice of + * If the @p fe_index argument to this function is left at its default + * value, then we use that finite element within the hp::FECollection + * passed to the constructor of this class with index given by + * cell-@>active_fe_index(). Consequently, the + * hp::FECollection argument given to this object should really be the + * same as that used in the construction of the hp::DofHandler associated + * with the present cell. On the other hand, if a value is given for this + * argument, it overrides the choice of * cell-@>active_fe_index(). * - * If the @p q_index argument - * is left at its default - * value, then we use that - * quadrature formula within - * the hp::QCollection passed - * to the constructor of this - * class with index given by - * cell-@>active_fe_index(), - * i.e. the same index as that - * of the finite element. In - * this case, there should be a - * corresponding quadrature - * formula for each finite - * element in the - * hp::FECollection. As a - * special case, if the - * quadrature collection - * contains only a single - * element (a frequent case if - * one wants to use the same - * quadrature object for all - * finite elements in an hp - * discretization, even if that - * may not be the most - * efficient), then this single - * quadrature is used unless a - * different value for this - * argument is specified. On - * the other hand, if a value - * is given for this argument, - * it overrides the choice of - * cell-@>active_fe_index() - * or the choice for the single + * If the @p q_index argument is left at its default value, then we use + * that quadrature formula within the hp::QCollection passed to the + * constructor of this class with index given by + * cell-@>active_fe_index(), i.e. the same index as that of + * the finite element. In this case, there should be a corresponding + * quadrature formula for each finite element in the hp::FECollection. As + * a special case, if the quadrature collection contains only a single + * element (a frequent case if one wants to use the same quadrature object + * for all finite elements in an hp discretization, even if that may not + * be the most efficient), then this single quadrature is used unless a + * different value for this argument is specified. On the other hand, if a + * value is given for this argument, it overrides the choice of + * cell-@>active_fe_index() or the choice for the single * quadrature. * - * If the @p mapping_index - * argument is left at its - * default value, then we use - * that mapping object within - * the hp::MappingCollection - * passed to the constructor of - * this class with index given - * by - * cell-@>active_fe_index(), - * i.e. the same index as that - * of the finite - * element. As above, if the - * mapping collection contains - * only a single element (a - * frequent case if one wants - * to use a MappingQ1 object - * for all finite elements in - * an hp discretization), then - * this single mapping is used - * unless a different value for - * this argument is specified. + * If the @p mapping_index argument is left at its default value, then we + * use that mapping object within the hp::MappingCollection passed to the + * constructor of this class with index given by + * cell-@>active_fe_index(), i.e. the same index as that of + * the finite element. As above, if the mapping collection contains only a + * single element (a frequent case if one wants to use a MappingQ1 object + * for all finite elements in an hp discretization), then this single + * mapping is used unless a different value for this argument is + * specified. */ template void @@ -413,33 +319,17 @@ namespace hp const unsigned int fe_index = numbers::invalid_unsigned_int); /** - * Like the previous function, - * but for non-hp - * iterators. The reason this - * (and the other non-hp - * iterator) function exists is - * so that one can use - * hp::FEValues not only for - * hp::DoFhandler objects, but - * for all sorts of DoFHandler - * objects, and triangulations - * not associated with - * DoFHandlers in general. + * Like the previous function, but for non-hp iterators. The reason this + * (and the other non-hp iterator) function exists is so that one can use + * hp::FEValues not only for hp::DoFhandler objects, but for all sorts of + * DoFHandler objects, and triangulations not associated with DoFHandlers + * in general. * - * Since - * cell-@>active_fe_index() - * doesn't make sense for - * triangulation iterators, - * this function chooses the - * zero-th finite element, - * mapping, and quadrature - * object from the relevant - * constructions passed to the - * constructor of this - * object. The only exception - * is if you specify a value - * different from the default - * value for any of these last + * Since cell-@>active_fe_index() doesn't make sense for + * triangulation iterators, this function chooses the zero-th finite + * element, mapping, and quadrature object from the relevant constructions + * passed to the constructor of this object. The only exception is if you + * specify a value different from the default value for any of these last * three arguments. */ void @@ -481,24 +371,13 @@ namespace hp { public: /** - * Constructor. Initialize this - * object with the given - * parameters. + * Constructor. Initialize this object with the given parameters. * - * The finite element - * collection parameter is - * actually ignored, but is in - * the signature of this - * function to make it - * compatible with the - * signature of the respective - * constructor of the usual - * FEValues object, with - * the respective parameter in - * that function also being the - * return value of the - * DoFHandler::get_fe() - * function. + * The finite element collection parameter is actually ignored, but is in + * the signature of this function to make it compatible with the signature + * of the respective constructor of the usual FEValues object, with the + * respective parameter in that function also being the return value of + * the DoFHandler::get_fe() function. */ FEFaceValues (const hp::MappingCollection &mapping_collection, const hp::FECollection &fe_collection, @@ -507,129 +386,64 @@ namespace hp /** - * Constructor. Initialize this - * object with the given - * parameters, and choose a - * @p MappingQ1 object for the - * mapping object. + * Constructor. Initialize this object with the given parameters, and + * choose a @p MappingQ1 object for the mapping object. * - * The finite element - * collection parameter is - * actually ignored, but is in - * the signature of this - * function to make it - * compatible with the - * signature of the respective - * constructor of the usual - * FEValues object, with - * the respective parameter in - * that function also being the - * return value of the - * DoFHandler::get_fe() - * function. + * The finite element collection parameter is actually ignored, but is in + * the signature of this function to make it compatible with the signature + * of the respective constructor of the usual FEValues object, with the + * respective parameter in that function also being the return value of + * the DoFHandler::get_fe() function. */ FEFaceValues (const hp::FECollection &fe_collection, const hp::QCollection &q_collection, const UpdateFlags update_flags); /** - * Reinitialize the object for - * the given cell and face. + * Reinitialize the object for the given cell and face. * - * After the call, you can get - * an FEFaceValues object using the - * get_present_fe_values() - * function that corresponds to - * the present cell. For this - * FEFaceValues object, we use the - * additional arguments - * described below to determine - * which finite element, - * mapping, and quadrature - * formula to use. They are - * order in such a way that the - * arguments one may want to - * change most frequently come - * first. The rules for these - * arguments are as follows: + * After the call, you can get an FEFaceValues object using the + * get_present_fe_values() function that corresponds to the present + * cell. For this FEFaceValues object, we use the additional arguments + * described below to determine which finite element, mapping, and + * quadrature formula to use. They are order in such a way that the + * arguments one may want to change most frequently come first. The rules + * for these arguments are as follows: * - * If the @p fe_index argument - * to this function is left at - * its default value, then we - * use that finite element - * within the hp::FECollection - * passed to the constructor of - * this class with index given - * by - * cell-@>active_fe_index(). Consequently, - * the hp::FECollection - * argument given to this - * object should really be the - * same as that used in the - * construction of the - * hp::DofHandler associated - * with the present cell. On - * the other hand, if a value - * is given for this argument, - * it overrides the choice of + * If the @p fe_index argument to this function is left at its default + * value, then we use that finite element within the hp::FECollection + * passed to the constructor of this class with index given by + * cell-@>active_fe_index(). Consequently, the + * hp::FECollection argument given to this object should really be the + * same as that used in the construction of the hp::DofHandler associated + * with the present cell. On the other hand, if a value is given for this + * argument, it overrides the choice of * cell-@>active_fe_index(). * - * If the @p q_index argument - * is left at its default - * value, then we use that - * quadrature formula within - * the hp::QCollection passed - * to the constructor of this - * class with index given by - * cell-@>active_fe_index(), - * i.e. the same index as that - * of the finite element. In - * this case, there should be a - * corresponding quadrature - * formula for each finite - * element in the - * hp::FECollection. As a - * special case, if the - * quadrature collection - * contains only a single - * element (a frequent case if - * one wants to use the same - * quadrature object for all - * finite elements in an hp - * discretization, even if that - * may not be the most - * efficient), then this single - * quadrature is used unless a - * different value for this - * argument is specified. On - * the other hand, if a value - * is given for this argument, - * it overrides the choice of - * cell-@>active_fe_index() - * or the choice for the single + * If the @p q_index argument is left at its default value, then we use + * that quadrature formula within the hp::QCollection passed to the + * constructor of this class with index given by + * cell-@>active_fe_index(), i.e. the same index as that of + * the finite element. In this case, there should be a corresponding + * quadrature formula for each finite element in the hp::FECollection. As + * a special case, if the quadrature collection contains only a single + * element (a frequent case if one wants to use the same quadrature object + * for all finite elements in an hp discretization, even if that may not + * be the most efficient), then this single quadrature is used unless a + * different value for this argument is specified. On the other hand, if a + * value is given for this argument, it overrides the choice of + * cell-@>active_fe_index() or the choice for the single * quadrature. * - * If the @p mapping_index - * argument is left at its - * default value, then we use - * that mapping object within - * the hp::MappingCollection - * passed to the constructor of - * this class with index given - * by - * cell-@>active_fe_index(), - * i.e. the same index as that - * of the finite - * element. As above, if the - * mapping collection contains - * only a single element (a - * frequent case if one wants - * to use a MappingQ1 object - * for all finite elements in - * an hp discretization), then - * this single mapping is used - * unless a different value for - * this argument is specified. + * If the @p mapping_index argument is left at its default value, then we + * use that mapping object within the hp::MappingCollection passed to the + * constructor of this class with index given by + * cell-@>active_fe_index(), i.e. the same index as that of + * the finite element. As above, if the mapping collection contains only a + * single element (a frequent case if one wants to use a MappingQ1 object + * for all finite elements in an hp discretization), then this single + * mapping is used unless a different value for this argument is + * specified. */ template void @@ -640,33 +454,17 @@ namespace hp const unsigned int fe_index = numbers::invalid_unsigned_int); /** - * Like the previous function, - * but for non-hp - * iterators. The reason this - * (and the other non-hp - * iterator) function exists is - * so that one can use - * hp::FEValues not only for - * hp::DoFhandler objects, but - * for all sorts of DoFHandler - * objects, and triangulations - * not associated with - * DoFHandlers in general. + * Like the previous function, but for non-hp iterators. The reason this + * (and the other non-hp iterator) function exists is so that one can use + * hp::FEValues not only for hp::DoFhandler objects, but for all sorts of + * DoFHandler objects, and triangulations not associated with DoFHandlers + * in general. * - * Since - * cell-@>active_fe_index() - * doesn't make sense for - * triangulation iterators, - * this function chooses the - * zero-th finite element, - * mapping, and quadrature - * object from the relevant - * constructions passed to the - * constructor of this - * object. The only exception - * is if you specify a value - * different from the default - * value for any of these last + * Since cell-@>active_fe_index() doesn't make sense for + * triangulation iterators, this function chooses the zero-th finite + * element, mapping, and quadrature object from the relevant constructions + * passed to the constructor of this object. The only exception is if you + * specify a value different from the default value for any of these last * three arguments. */ void @@ -691,24 +489,13 @@ namespace hp { public: /** - * Constructor. Initialize this - * object with the given - * parameters. + * Constructor. Initialize this object with the given parameters. * - * The finite element - * collection parameter is - * actually ignored, but is in - * the signature of this - * function to make it - * compatible with the - * signature of the respective - * constructor of the usual - * FEValues object, with - * the respective parameter in - * that function also being the - * return value of the - * DoFHandler::get_fe() - * function. + * The finite element collection parameter is actually ignored, but is in + * the signature of this function to make it compatible with the signature + * of the respective constructor of the usual FEValues object, with the + * respective parameter in that function also being the return value of + * the DoFHandler::get_fe() function. */ FESubfaceValues (const hp::MappingCollection &mapping_collection, const hp::FECollection &fe_collection, @@ -717,108 +504,54 @@ namespace hp /** - * Constructor. Initialize this - * object with the given - * parameters, and choose a - * @p MappingQ1 object for the - * mapping object. + * Constructor. Initialize this object with the given parameters, and + * choose a @p MappingQ1 object for the mapping object. * - * The finite element - * collection parameter is - * actually ignored, but is in - * the signature of this - * function to make it - * compatible with the - * signature of the respective - * constructor of the usual - * FEValues object, with - * the respective parameter in - * that function also being the - * return value of the - * DoFHandler::get_fe() - * function. + * The finite element collection parameter is actually ignored, but is in + * the signature of this function to make it compatible with the signature + * of the respective constructor of the usual FEValues object, with the + * respective parameter in that function also being the return value of + * the DoFHandler::get_fe() function. */ FESubfaceValues (const hp::FECollection &fe_collection, const hp::QCollection &q_collection, const UpdateFlags update_flags); /** - * Reinitialize the object for - * the given cell, face, and subface. + * Reinitialize the object for the given cell, face, and subface. * - * After the call, you can get - * an FESubfaceValues object using the - * get_present_fe_values() - * function that corresponds to - * the present cell. For this - * FESubfaceValues object, we use the - * additional arguments - * described below to determine - * which finite element, - * mapping, and quadrature - * formula to use. They are - * order in such a way that the - * arguments one may want to - * change most frequently come - * first. The rules for these - * arguments are as follows: + * After the call, you can get an FESubfaceValues object using the + * get_present_fe_values() function that corresponds to the present + * cell. For this FESubfaceValues object, we use the additional arguments + * described below to determine which finite element, mapping, and + * quadrature formula to use. They are order in such a way that the + * arguments one may want to change most frequently come first. The rules + * for these arguments are as follows: * - * If the @p q_index argument - * is left at its default - * value, then we use that - * quadrature formula within - * the hp::QCollection passed - * to the constructor of this - * class with index given by - * cell-@>active_fe_index(), - * i.e. the same index as that - * of the finite element. In - * this case, there should be a - * corresponding quadrature - * formula for each finite - * element in the - * hp::FECollection. As a - * special case, if the - * quadrature collection - * contains only a single - * element (a frequent case if - * one wants to use the same - * quadrature object for all - * finite elements in an hp - * discretization, even if that - * may not be the most - * efficient), then this single - * quadrature is used unless a - * different value for this - * argument is specified. On - * the other hand, if a value - * is given for this argument, - * it overrides the choice of - * cell-@>active_fe_index() - * or the choice for the single + * If the @p q_index argument is left at its default value, then we use + * that quadrature formula within the hp::QCollection passed to the + * constructor of this class with index given by + * cell-@>active_fe_index(), i.e. the same index as that of + * the finite element. In this case, there should be a corresponding + * quadrature formula for each finite element in the hp::FECollection. As + * a special case, if the quadrature collection contains only a single + * element (a frequent case if one wants to use the same quadrature object + * for all finite elements in an hp discretization, even if that may not + * be the most efficient), then this single quadrature is used unless a + * different value for this argument is specified. On the other hand, if a + * value is given for this argument, it overrides the choice of + * cell-@>active_fe_index() or the choice for the single * quadrature. * - * If the @p mapping_index - * argument is left at its - * default value, then we use - * that mapping object within - * the hp::MappingCollection - * passed to the constructor of - * this class with index given - * by - * cell-@>active_fe_index(), - * i.e. the same index as that - * of the finite - * element. As above, if the - * mapping collection contains - * only a single element (a - * frequent case if one wants - * to use a MappingQ1 object - * for all finite elements in - * an hp discretization), then - * this single mapping is used - * unless a different value for - * this argument is specified. + * If the @p mapping_index argument is left at its default value, then we + * use that mapping object within the hp::MappingCollection passed to the + * constructor of this class with index given by + * cell-@>active_fe_index(), i.e. the same index as that of + * the finite element. As above, if the mapping collection contains only a + * single element (a frequent case if one wants to use a MappingQ1 object + * for all finite elements in an hp discretization), then this single + * mapping is used unless a different value for this argument is + * specified. */ template void @@ -830,33 +563,17 @@ namespace hp const unsigned int fe_index = numbers::invalid_unsigned_int); /** - * Like the previous function, - * but for non-hp - * iterators. The reason this - * (and the other non-hp - * iterator) function exists is - * so that one can use - * hp::FEValues not only for - * hp::DoFhandler objects, but - * for all sorts of DoFHandler - * objects, and triangulations - * not associated with - * DoFHandlers in general. + * Like the previous function, but for non-hp iterators. The reason this + * (and the other non-hp iterator) function exists is so that one can use + * hp::FEValues not only for hp::DoFhandler objects, but for all sorts of + * DoFHandler objects, and triangulations not associated with DoFHandlers + * in general. * - * Since - * cell-@>active_fe_index() - * doesn't make sense for - * triangulation iterators, - * this function chooses the - * zero-th finite element, - * mapping, and quadrature - * object from the relevant - * constructions passed to the - * constructor of this - * object. The only exception - * is if you specify a value - * different from the default - * value for any of these last + * Since cell-@>active_fe_index() doesn't make sense for + * triangulation iterators, this function chooses the zero-th finite + * element, mapping, and quadrature object from the relevant constructions + * passed to the constructor of this object. The only exception is if you + * specify a value different from the default value for any of these last * three arguments. */ void @@ -894,6 +611,36 @@ namespace internal { return *fe_collection; } + + + + template + inline + const dealii::hp::MappingCollection & + FEValuesBase::get_mapping_collection () const + { + return *mapping_collection; + } + + + + template + inline + const dealii::hp::QCollection & + FEValuesBase::get_quadrature_collection () const + { + return q_collection; + } + + + + template + inline + dealii::UpdateFlags + FEValuesBase::get_update_flags () const + { + return update_flags; + } } } diff --git a/deal.II/include/deal.II/hp/mapping_collection.h b/deal.II/include/deal.II/hp/mapping_collection.h index 3e5b925727..512a6872b4 100644 --- a/deal.II/include/deal.II/hp/mapping_collection.h +++ b/deal.II/include/deal.II/hp/mapping_collection.h @@ -1,14 +1,19 @@ -//------------------------ mapping_collection.h -------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//------------------------ mapping_collection.h -------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mapping_collection_h #define __deal2__mapping_collection_h diff --git a/deal.II/include/deal.II/hp/q_collection.h b/deal.II/include/deal.II/hp/q_collection.h index 23f6b4df7c..2b556ddb26 100644 --- a/deal.II/include/deal.II/hp/q_collection.h +++ b/deal.II/include/deal.II/hp/q_collection.h @@ -1,14 +1,19 @@ -//---------------------------- q_collection.h ---------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- q_collection.h ---------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__q_collection_h #define __deal2__q_collection_h diff --git a/deal.II/include/deal.II/integrators/advection.h b/deal.II/include/deal.II/integrators/advection.h index 3587c7ebb8..1ab1e0c6f3 100644 --- a/deal.II/include/deal.II/integrators/advection.h +++ b/deal.II/include/deal.II/integrators/advection.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__integrators_advection_h #define __deal2__integrators_advection_h @@ -115,10 +120,10 @@ namespace LocalIntegrators } /** - * Advection residual operator in weak form + * Advection residual operator in strong form * * \f[ - * r_i = \int_Z u\,(\mathbf w \cdot \nabla) v_i \, dx. + * r_i = \int_Z (\mathbf w \cdot \nabla)u\, v_i \, dx. * \f] */ template @@ -147,18 +152,18 @@ namespace LocalIntegrators const double dx = factor * fe.JxW(k); for (unsigned i=0; i @@ -190,8 +195,8 @@ namespace LocalIntegrators for (unsigned i=0; iH1. The test functions can - * be discontinuous. + * This is the weak divergence operator and the test + * space should be at least H1. The trial functions + * may be discontinuous. + * + * @todo Verify: The function cell_matrix() is the Frechet derivative of this function with respect + * to the test functions. * * @author Guido Kanschat - * @date 2011 + * @date 2013 */ + template + void cell_residual( + Vector &result, + const FEValuesBase &fetest, + const VectorSlice > > &input, + const double factor = 1.) + { + AssertDimension(fetest.get_fe().n_components(), 1); + AssertVectorVectorDimension(input, dim, fetest.n_quadrature_points); + const unsigned int t_dofs = fetest.dofs_per_cell; + Assert (result.size() == t_dofs, ExcDimensionMismatch(result.size(), t_dofs)); + + for (unsigned int k=0; kH1. The test functions can be discontinuous. + * + * @author Guido Kanschat + * @date 2011 + */ template void gradient_matrix( FullMatrix &M, @@ -223,6 +267,42 @@ namespace LocalIntegrators } } + /** + * The residual of the gradient operator in weak form. + * \f[ + * -\int_Z \nabla\cdot \mathbf v u \,dx + * \f] + * This is the weak gradient operator and the test + * space should be at least Hdiv. The trial functions + * may be discontinuous. + * + * @todo Verify: The function gradient_matrix() is the Frechet derivative of this function with respect to the test functions. + * + * @author Guido Kanschat + * @date 2013 + */ + template + void gradient_residual( + Vector &result, + const FEValuesBase &fetest, + const std::vector &input, + const double factor = 1.) + { + AssertDimension(fetest.get_fe().n_components(), dim); + AssertDimension(input.size(), fetest.n_quadrature_points); + const unsigned int t_dofs = fetest.dofs_per_cell; + Assert (result.size() == t_dofs, ExcDimensionMismatch(result.size(), t_dofs)); + + for (unsigned int k=0; k + void + u_times_n_residual ( + Vector &result, + const FEValuesBase &fetest, + const std::vector &data, + double factor = 1.) + { + const unsigned int t_dofs = fetest.dofs_per_cell; + + AssertDimension(fetest.get_fe().n_components(), dim); + AssertDimension(result.size(), t_dofs); + AssertDimension(data.size(), fetest.n_quadrature_points); + + for (unsigned int k=0; k ndx = factor * fetest.normal_vector(k) * fetest.JxW(k); + + for (unsigned int i=0; iF the vector + * @f[ + * \int_F \Bigl(\gamma u \cdot v - n^T \epsilon(u) v - u \epsilon(v) n^T\Bigr)\;ds. + * @f] + * + * Here, u is the finite element function whose values and + * gradient are given in the arguments input and + * Dinput, respectively. $n$ is the outer + * normal vector and $\gamma$ is the usual penalty parameter. + * + * @author Guido Kanschat + * @date 2013 + */ + template + void nitsche_residual_homogeneous ( + Vector &result, + const FEValuesBase &fe, + const VectorSlice > > &input, + const VectorSlice > > > &Dinput, + double penalty, + double factor = 1.) + { + const unsigned int n_dofs = fe.dofs_per_cell; + AssertVectorVectorDimension(input, dim, fe.n_quadrature_points); + AssertVectorVectorDimension(Dinput, dim, fe.n_quadrature_points); + + for (unsigned int k=0; k &n = fe.normal_vector(k); + for (unsigned int i=0; i &n = fe1.normal_vector(k); - + for (unsigned int i=0; i + void ip_tangential_matrix ( + FullMatrix &M11, + FullMatrix &M12, + FullMatrix &M21, + FullMatrix &M22, + const FEValuesBase &fe1, + const FEValuesBase &fe2, + double penalty, + double factor1 = 1., + double factor2 = -1.) + { + const unsigned int n_dofs = fe1.dofs_per_cell; + AssertDimension(fe1.get_fe().n_components(), dim); + AssertDimension(fe2.get_fe().n_components(), dim); + AssertDimension(M11.n(), n_dofs); + AssertDimension(M11.m(), n_dofs); + AssertDimension(M12.n(), n_dofs); + AssertDimension(M12.m(), n_dofs); + AssertDimension(M21.n(), n_dofs); + AssertDimension(M21.m(), n_dofs); + AssertDimension(M22.n(), n_dofs); + AssertDimension(M22.m(), n_dofs); + + const double nui = factor1; + const double nue = (factor2 < 0) ? factor1 : factor2; + const double nu = .5*(nui+nue); + + for (unsigned int k=0; k &n = fe1.normal_vector(k); + for (unsigned int i=0; i (eigenvalues_real[i], - eigenvalues_im[i]); + eigenvalues[i] = std::complex (eigenvalues_real[i], + eigenvalues_im[i]); } } diff --git a/deal.II/include/deal.II/lac/block_indices.h b/deal.II/include/deal.II/lac/block_indices.h index d8f5d0ba84..7b37682ea0 100644 --- a/deal.II/include/deal.II/lac/block_indices.h +++ b/deal.II/include/deal.II/lac/block_indices.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_indices_h #define __deal2__block_indices_h @@ -414,7 +419,7 @@ BlockIndices::global_to_local (const size_type i) const --block; return std::pair(block, - i-start_indices[block]); + i-start_indices[block]); } diff --git a/deal.II/include/deal.II/lac/block_list.h b/deal.II/include/deal.II/lac/block_list.h index 0a5d40b905..97bfc00e20 100644 --- a/deal.II/include/deal.II/lac/block_list.h +++ b/deal.II/include/deal.II/lac/block_list.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_list_h #define __deal2__block_list_h @@ -607,7 +612,7 @@ BlockList::initialize_vertex_patches_mg( inline -BlockList::size_type +BlockList::size_type BlockList::size() const { return index_sets.size(); @@ -615,7 +620,7 @@ BlockList::size() const inline -BlockList::size_type +BlockList::size_type BlockList::block_size(size_type block) const { return index_sets[block].size(); @@ -641,7 +646,7 @@ BlockList::end(size_type block) const inline -BlockList::size_type +BlockList::size_type BlockList::local_index(size_type block, size_type index) const { AssertIndexRange(block, index_sets.size()); diff --git a/deal.II/include/deal.II/lac/block_matrix.h b/deal.II/include/deal.II/lac/block_matrix.h index 7325b5db6a..381e90c8b3 100644 --- a/deal.II/include/deal.II/lac/block_matrix.h +++ b/deal.II/include/deal.II/lac/block_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_matrix_h #define __deal2__block_matrix_h diff --git a/deal.II/include/deal.II/lac/block_matrix_array.h b/deal.II/include/deal.II/lac/block_matrix_array.h index 7cba2b2ca2..6f9a21d10b 100644 --- a/deal.II/include/deal.II/lac/block_matrix_array.h +++ b/deal.II/include/deal.II/lac/block_matrix_array.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_matrix_array_h #define __deal2__block_matrix_array_h diff --git a/deal.II/include/deal.II/lac/block_matrix_base.h b/deal.II/include/deal.II/lac/block_matrix_base.h index 4b08e1e11c..df541b1ae8 100644 --- a/deal.II/include/deal.II/lac/block_matrix_base.h +++ b/deal.II/include/deal.II/lac/block_matrix_base.h @@ -1,20 +1,26 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_matrix_base_h #define __deal2__block_matrix_base_h #include #include +#include #include #include #include @@ -407,6 +413,11 @@ public: */ BlockMatrixBase (); + /** + * Destructor. + */ + ~BlockMatrixBase (); + /** * Copy the given matrix to this * one. The operation throws an @@ -931,7 +942,7 @@ public: /** * Return a reference to the underlying - * BlockIndices data of the rows. + * BlockIndices data of the columns. */ const BlockIndices &get_column_indices () const; @@ -1236,30 +1247,74 @@ protected: private: - /** - * Temporary vector for counting the - * elements written into the - * individual blocks when doing a - * collective add or set. - */ - std::vector counter_within_block; /** - * Temporary vector for column - * indices on each block when writing - * local to global data on each - * sparse matrix. + * A structure containing some fields used by the + * set() and add() functions that is used to pre-sort + * the input fields. Since one can reasonably expect + * to call set() and add() from multiple threads at once + * as long as the matrix indices that are touched are + * disjoint, these temporary data fields need to be + * guarded by a mutex; the structure therefore contains such + * a mutex as a member variable. */ - std::vector > column_indices; + struct TemporaryData + { + /** + * Temporary vector for counting the + * elements written into the + * individual blocks when doing a + * collective add or set. + */ + std::vector counter_within_block; + + /** + * Temporary vector for column + * indices on each block when writing + * local to global data on each + * sparse matrix. + */ + std::vector > column_indices; + + /** + * Temporary vector for storing the + * local values (they need to be + * reordered when writing local to + * global). + */ + std::vector > column_values; + + /** + * A mutex variable used to guard access to the member + * variables of this structure; + */ + Threads::Mutex mutex; + + /** + * Copy operator. This is needed because the default copy + * operator of this class is deleted (since Threads::Mutex is + * not copyable) and hence the default copy operator of the + * enclosing class is also deleted. + * + * The implementation here simply does nothing -- TemporaryData + * objects are just scratch objects that are resized at the + * beginning of their use, so there is no point actually copying + * anything. + */ + TemporaryData & operator = (const TemporaryData &) + { + return *this; + } + }; /** - * Temporary vector for storing the - * local values (they need to be - * reordered when writing local to - * global). + * A set of scratch arrays that can be used by the add() + * and set() functions that take pointers to data to + * pre-sort indices before use. Access from multiple threads + * is synchronized via the mutex variable that is part of the + * structure. */ - std::vector > column_values; - + TemporaryData temporary_data; /** * Make the iterator class a @@ -1731,6 +1786,12 @@ inline BlockMatrixBase::BlockMatrixBase () {} +template +inline +BlockMatrixBase::~BlockMatrixBase () +{ + clear (); +} template @@ -1756,9 +1817,10 @@ BlockMatrixBase::memory_consumption () const MemoryConsumption::memory_consumption(row_block_indices)+ MemoryConsumption::memory_consumption(column_block_indices)+ MemoryConsumption::memory_consumption(sub_objects)+ - MemoryConsumption::memory_consumption(counter_within_block)+ - MemoryConsumption::memory_consumption(column_indices)+ - MemoryConsumption::memory_consumption(column_values); + MemoryConsumption::memory_consumption(temporary_data.counter_within_block)+ + MemoryConsumption::memory_consumption(temporary_data.column_indices)+ + MemoryConsumption::memory_consumption(temporary_data.column_values)+ + sizeof(temporary_data.mutex); for (unsigned int r=0; r::set (const size_type row, { prepare_set_operation(); + // lock access to the temporary data structure to + // allow multiple threads to call this function concurrently + Threads::Mutex::ScopedLock lock (temporary_data.mutex); + // Resize scratch arrays - if (column_indices.size() < this->n_block_cols()) + if (temporary_data.column_indices.size() < this->n_block_cols()) { - column_indices.resize (this->n_block_cols()); - column_values.resize (this->n_block_cols()); - counter_within_block.resize (this->n_block_cols()); + temporary_data.column_indices.resize (this->n_block_cols()); + temporary_data.column_values.resize (this->n_block_cols()); + temporary_data.counter_within_block.resize (this->n_block_cols()); } // Resize sub-arrays to n_cols. This @@ -1978,19 +2044,19 @@ BlockMatrixBase::set (const size_type row, // whether the size of one is large // enough before actually going // through all of them. - if (column_indices[0].size() < n_cols) + if (temporary_data.column_indices[0].size() < n_cols) { for (unsigned int i=0; in_block_cols(); ++i) { - column_indices[i].resize(n_cols); - column_values[i].resize(n_cols); + temporary_data.column_indices[i].resize(n_cols); + temporary_data.column_values[i].resize(n_cols); } } // Reset the number of added elements // in each block to zero. for (unsigned int i=0; in_block_cols(); ++i) - counter_within_block[i] = 0; + temporary_data.counter_within_block[i] = 0; // Go through the column indices to // find out which portions of the @@ -2011,10 +2077,10 @@ BlockMatrixBase::set (const size_type row, const std::pair col_index = this->column_block_indices.global_to_local(col_indices[j]); - const size_type local_index = counter_within_block[col_index.first]++; + const size_type local_index = temporary_data.counter_within_block[col_index.first]++; - column_indices[col_index.first][local_index] = col_index.second; - column_values[col_index.first][local_index] = value; + temporary_data.column_indices[col_index.first][local_index] = col_index.second; + temporary_data.column_values[col_index.first][local_index] = value; } #ifdef DEBUG @@ -2022,7 +2088,7 @@ BlockMatrixBase::set (const size_type row, // the right length has been obtained. size_type length = 0; for (unsigned int i=0; in_block_cols(); ++i) - length += counter_within_block[i]; + length += temporary_data.counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); #endif @@ -2035,14 +2101,14 @@ BlockMatrixBase::set (const size_type row, row_index = this->row_block_indices.global_to_local (row); for (unsigned int block_col=0; block_col::add (const size_type row, return; } - // Resize scratch arrays - if (column_indices.size() < this->n_block_cols()) + // Lock scratch arrays, then resize them + Threads::Mutex::ScopedLock lock (temporary_data.mutex); + + if (temporary_data.column_indices.size() < this->n_block_cols()) { - column_indices.resize (this->n_block_cols()); - column_values.resize (this->n_block_cols()); - counter_within_block.resize (this->n_block_cols()); + temporary_data.column_indices.resize (this->n_block_cols()); + temporary_data.column_values.resize (this->n_block_cols()); + temporary_data.counter_within_block.resize (this->n_block_cols()); } // Resize sub-arrays to n_cols. This @@ -2223,19 +2291,19 @@ BlockMatrixBase::add (const size_type row, // whether the size of one is large // enough before actually going // through all of them. - if (column_indices[0].size() < n_cols) + if (temporary_data.column_indices[0].size() < n_cols) { for (unsigned int i=0; in_block_cols(); ++i) { - column_indices[i].resize(n_cols); - column_values[i].resize(n_cols); + temporary_data.column_indices[i].resize(n_cols); + temporary_data.column_values[i].resize(n_cols); } } // Reset the number of added elements // in each block to zero. for (unsigned int i=0; in_block_cols(); ++i) - counter_within_block[i] = 0; + temporary_data.counter_within_block[i] = 0; // Go through the column indices to // find out which portions of the @@ -2256,10 +2324,10 @@ BlockMatrixBase::add (const size_type row, const std::pair col_index = this->column_block_indices.global_to_local(col_indices[j]); - const size_type local_index = counter_within_block[col_index.first]++; + const size_type local_index = temporary_data.counter_within_block[col_index.first]++; - column_indices[col_index.first][local_index] = col_index.second; - column_values[col_index.first][local_index] = value; + temporary_data.column_indices[col_index.first][local_index] = col_index.second; + temporary_data.column_values[col_index.first][local_index] = value; } #ifdef DEBUG @@ -2267,7 +2335,7 @@ BlockMatrixBase::add (const size_type row, // the right length has been obtained. size_type length = 0; for (unsigned int i=0; in_block_cols(); ++i) - length += counter_within_block[i]; + length += temporary_data.counter_within_block[i]; Assert (length <= n_cols, ExcInternalError()); #endif @@ -2280,14 +2348,14 @@ BlockMatrixBase::add (const size_type row, row_index = this->row_block_indices.global_to_local (row); for (unsigned int block_col=0; block_col &dst, ExcDimensionMismatch(src.n_blocks(), n_block_rows())); for (unsigned int row=0; rowrow_length (row_index.second); if (indexcolumn_number(row_index.second, index-c); + return block_columns+sub_objects[row_index.first][b]->column_number(row_index.second, index-c); c += rowlen; + block_columns += sub_objects[row_index.first][b]->n_cols(); } Assert(false, ExcInternalError()); diff --git a/deal.II/include/deal.II/lac/block_vector.h b/deal.II/include/deal.II/lac/block_vector.h index 89accbee60..77108b5525 100644 --- a/deal.II/include/deal.II/lac/block_vector.h +++ b/deal.II/include/deal.II/lac/block_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_vector_h #define __deal2__block_vector_h diff --git a/deal.II/include/deal.II/lac/block_vector.templates.h b/deal.II/include/deal.II/lac/block_vector.templates.h index 6fb4b08e37..bbfee5581b 100644 --- a/deal.II/include/deal.II/lac/block_vector.templates.h +++ b/deal.II/include/deal.II/lac/block_vector.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_vector_templates_h #define __deal2__block_vector_templates_h diff --git a/deal.II/include/deal.II/lac/block_vector_base.h b/deal.II/include/deal.II/lac/block_vector_base.h index adeb3f2142..8991123408 100644 --- a/deal.II/include/deal.II/lac/block_vector_base.h +++ b/deal.II/include/deal.II/lac/block_vector_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__block_vector_base_h #define __deal2__block_vector_base_h @@ -922,6 +927,29 @@ public: */ reference operator[] (const size_type i); + /** + * A collective get operation: instead + * of getting individual elements of a + * vector, this function allows to get + * a whole set of elements at once. The + * indices of the elements to be read + * are stated in the first argument, + * the corresponding values are returned in the + * second. + */ + template + void extract_subvector_to (const std::vector &indices, + std::vector &values) const; + + /** + * Just as the above, but with pointers. + * Useful in minimizing copying of data around. + */ + template + void extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const; + /** * Copy operator: fill all components of * the vector with the given scalar @@ -2519,6 +2547,33 @@ BlockVectorBase::operator[] (const size_type i) return operator()(i); } + + +template +template +inline +void BlockVectorBase::extract_subvector_to (const std::vector &indices, + std::vector &values) const +{ + for (size_type i = 0; i < indices.size(); ++i) + values[i] = operator()(indices[i]); +} + + + +template +template +inline +void BlockVectorBase::extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const +{ + while (indices_begin != indices_end) { + *values_begin = operator()(*indices_begin); + indices_begin++; values_begin++; + } +} + #endif // DOXYGEN DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/include/deal.II/lac/chunk_sparse_matrix.h b/deal.II/include/deal.II/lac/chunk_sparse_matrix.h index 5ecc459342..7de60a2cdc 100644 --- a/deal.II/include/deal.II/lac/chunk_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/chunk_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__chunk_sparse_matrix_h #define __deal2__chunk_sparse_matrix_h @@ -294,7 +299,7 @@ namespace ChunkSparseMatrixIterators * of the current kind. */ typedef - const Accessor & value_type; + const Accessor &value_type; /** * Constructor. Create an iterator into the matrix @p matrix for the given @@ -1346,7 +1351,7 @@ ChunkSparseMatrix::m () const template inline -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n () const { Assert (cols != 0, ExcNotInitialized()); @@ -1368,13 +1373,13 @@ ChunkSparseMatrix::get_sparsity_pattern () const template inline -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::compute_location (const size_type i, const size_type j) const { const size_type chunk_size = cols->get_chunk_size(); const size_type chunk_index - = cols->sparsity_pattern(i/chunk_size, j/chunk_size); + = cols->sparsity_pattern(i/chunk_size, j/chunk_size); if (chunk_index == ChunkSparsityPattern::invalid_entry) return ChunkSparsityPattern::invalid_entry; diff --git a/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h b/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h index e696bcd1ae..f9d396419d 100644 --- a/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h +++ b/deal.II/include/deal.II/lac/chunk_sparse_matrix.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__chunk_sparse_matrix_templates_h #define __deal2__chunk_sparse_matrix_templates_h @@ -206,9 +211,9 @@ namespace internal const size_type n_filled_last_cols = n % chunk_size; const size_type last_regular_row = n_filled_last_rows > 0 ? - std::min(m/chunk_size, - static_cast(end_row)) : - end_row; + std::min(m/chunk_size, + static_cast(end_row)) : + end_row; const size_type irregular_col = n/chunk_size; typename OutVector::iterator dst_ptr = dst.begin()+chunk_size*begin_row; @@ -450,7 +455,7 @@ ChunkSparseMatrix::reinit (const ChunkSparsityPattern &sparsity) // chunks. this entails some padding elements const size_type chunk_size = cols->get_chunk_size(); const size_type N = cols->sparsity_pattern.n_nonzero_elements() * - chunk_size * chunk_size; + chunk_size * chunk_size; if (N > max_len || max_len == 0) { if (val != 0) @@ -492,7 +497,7 @@ ChunkSparseMatrix::empty () const template -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -502,7 +507,7 @@ ChunkSparseMatrix::n_nonzero_elements () const template -typename ChunkSparseMatrix::size_type +typename ChunkSparseMatrix::size_type ChunkSparseMatrix::n_actually_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -587,7 +592,7 @@ ChunkSparseMatrix::add (const number factor, * chunk_size * chunk_size]; while (val_ptr != end_ptr) - *val_ptr++ += factor * *matrix_ptr++; + *val_ptr++ += factor **matrix_ptr++; } diff --git a/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h b/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h index 73ba343023..08f148a21d 100644 --- a/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/chunk_sparsity_pattern.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__chunk_sparsity_pattern_h #define __deal2__chunk_sparsity_pattern_h @@ -539,10 +544,10 @@ public: const ForwardIterator end, const size_type chunk_size); - /** - * @deprecated This function is deprecated. Use the function - * without the last argument - */ + /** + * @deprecated This function is deprecated. Use the function + * without the last argument + */ template void copy_from (const size_type n_rows, const size_type n_cols, @@ -918,7 +923,7 @@ namespace ChunkSparsityPatternIterators const unsigned int row) : sparsity_pattern(sparsity_pattern), - reduced_accessor(row==sparsity_pattern->n_rows() ? + reduced_accessor(row==sparsity_pattern->n_rows() ? *sparsity_pattern->sparsity_pattern.end() : *sparsity_pattern->sparsity_pattern. begin(row/sparsity_pattern->get_chunk_size())), @@ -946,12 +951,12 @@ namespace ChunkSparsityPatternIterators Accessor::is_valid_entry () const { return reduced_accessor.is_valid_entry() - && - sparsity_pattern->get_chunk_size()*reduced_accessor.row()+chunk_row < - sparsity_pattern->n_rows() - && - sparsity_pattern->get_chunk_size()*reduced_accessor.column()+chunk_col < - sparsity_pattern->n_cols(); + && + sparsity_pattern->get_chunk_size()*reduced_accessor.row()+chunk_row < + sparsity_pattern->n_rows() + && + sparsity_pattern->get_chunk_size()*reduced_accessor.column()+chunk_col < + sparsity_pattern->n_cols(); } @@ -963,7 +968,7 @@ namespace ChunkSparsityPatternIterators Assert (is_valid_entry() == true, ExcInvalidIterator()); return sparsity_pattern->get_chunk_size()*reduced_accessor.row() + - chunk_row; + chunk_row; } @@ -975,7 +980,7 @@ namespace ChunkSparsityPatternIterators Assert (is_valid_entry() == true, ExcInvalidIterator()); return sparsity_pattern->get_chunk_size()*reduced_accessor.column() + - chunk_col; + chunk_col; } @@ -1023,10 +1028,10 @@ namespace ChunkSparsityPatternIterators return true; const unsigned int - global_row = sparsity_pattern->get_chunk_size()*reduced_accessor.row() - +chunk_row, - other_global_row = sparsity_pattern->get_chunk_size()* - other.reduced_accessor.row()+other.chunk_row; + global_row = sparsity_pattern->get_chunk_size()*reduced_accessor.row() + +chunk_row, + other_global_row = sparsity_pattern->get_chunk_size()* + other.reduced_accessor.row()+other.chunk_row; if (global_row < other_global_row) return true; else if (global_row > other_global_row) @@ -1209,7 +1214,7 @@ ChunkSparsityPattern::iterator ChunkSparsityPattern::end (const unsigned int r) const { Assert (rbegin(); j!=end_of_row; ++j) { const size_type col - = internal::SparsityPatternTools::get_column_index_from_iterator(*j); + = internal::SparsityPatternTools::get_column_index_from_iterator(*j); Assert (col < n_cols, ExcInvalidIndex(col,n_cols)); add (row, col); diff --git a/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h b/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h index adb57ca87a..544ed11c13 100644 --- a/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/compressed_set_sparsity_pattern.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__compressed_set_sparsity_pattern_h #define __deal2__compressed_set_sparsity_pattern_h diff --git a/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h b/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h index 9062e6cfa9..6257f4733a 100644 --- a/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/compressed_simple_sparsity_pattern.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__compressed_simple_sparsity_pattern_h #define __deal2__compressed_simple_sparsity_pattern_h @@ -145,6 +150,12 @@ public: const size_type n, const IndexSet &rowset = IndexSet()); + /** + * Create a square SparsityPattern using + * the index set. + */ + CompressedSimpleSparsityPattern (const IndexSet &indexset); + /** * Initialize a square matrix of * dimension @p n. diff --git a/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h b/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h index 4c8b5dd802..8477716dc9 100644 --- a/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/compressed_sparsity_pattern.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__compressed_sparsity_pattern_h #define __deal2__compressed_sparsity_pattern_h diff --git a/deal.II/include/deal.II/lac/constraint_matrix.h b/deal.II/include/deal.II/lac/constraint_matrix.h index 9a59f5bba4..4bb240c83c 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__constraint_matrix_h #define __deal2__constraint_matrix_h @@ -228,6 +233,14 @@ public: */ bool can_store_line (const size_type line_index) const; + /** + * Returns the index set describing locally relevant lines if any are + * present. Note that if no local lines were given, this represents an empty + * IndexSet, whereas otherwise it contains the global problem size and the + * local range. + */ + const IndexSet & get_local_lines() const; + /** * This function copies the content of @p * constraints_in with DoFs that are @@ -543,6 +556,15 @@ public: */ bool is_identity_constrained (const size_type index) const; + /** + * Return whether the two given degrees of freedom are linked by an + * equality constraint that either constrains index1 to be so that + * index1=index2 or constrains index2 so that + * index2=index1. + */ + bool are_identity_constrained (const size_type index1, + const size_type index2) const; + /** * Return the maximum number of other * dofs that one dof is constrained @@ -1518,7 +1540,7 @@ public: * @ingroup Exceptions */ DeclException2 (ExcIncorrectConstraint, - int, int, + int, int, << "While distributing the constraint for DoF " << arg1 << ", it turns out that one of the processors " << "who own the " << arg2 @@ -1529,7 +1551,7 @@ public: << "with the appropriate locally_relevant set so " << "that every processor who owns a DoF that constrains " << "another DoF also knows about this constraint?"); - + private: /** @@ -1828,7 +1850,12 @@ ConstraintMatrix::ConstraintMatrix (const IndexSet &local_constraints) lines (), local_lines (local_constraints), sorted (false) -{} +{ + // make sure the IndexSet is compressed. Otherwise this can lead to crashes + // that are hard to find (only happen in release mode). + // see tests/mpi/constraint_matrix_crash_01 + local_lines.compress(); +} @@ -2036,6 +2063,15 @@ ConstraintMatrix::can_store_line (size_type line_index) const +inline +const IndexSet & +ConstraintMatrix::get_local_lines () const +{ + return local_lines; +} + + + template inline void ConstraintMatrix::distribute_local_to_global ( diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h index af6d907509..4a1ce1888c 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__constraint_matrix_templates_h #define __deal2__constraint_matrix_templates_h @@ -386,7 +391,7 @@ ConstraintMatrix::condense (SparseMatrix &uncondensed, // which line in the constraint matrix // handles this index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c &uncondensed, // in the constraint matrix handles this // index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c void set_zero_parallel(const std::vector &cm, VEC &vec, size_type shift = 0) { - Assert(!vec.has_ghost_elements(), ExcInternalError());//ExcGhostsPresent()); + Assert(!vec.has_ghost_elements(), ExcInternalError()); IndexSet locally_owned = vec.locally_owned_elements(); for (typename std::vector::const_iterator it = cm.begin(); it != cm.end(); ++it) - if (locally_owned.is_element(*it)) - vec(*it) = 0.; + { + // If shift>0 then we are working on a part of a BlockVector + // so vec(i) is actually the global entry i+shift. + // We first make sure the line falls into the range of vec, + // then check if is part of the local part of the vector, before + // finally setting it to 0. + if ((*it) @@ -751,8 +766,18 @@ namespace internal { for (typename std::vector::const_iterator it = cm.begin(); it != cm.end(); ++it) - if (vec.in_local_range(*it)) - vec(*it) = 0.; + { + // If shift>0 then we are working on a part of a BlockVector + // so vec(i) is actually the global entry i+shift. + // We first make sure the line falls into the range of vec, + // then check if is part of the local part of the vector, before + // finally setting it to 0. + if ((*it)::const_iterator it = cm.begin(); it != cm.end(); ++it) - vec(*it) = 0.; + vec(*it) = 0.; } template @@ -1114,10 +1139,11 @@ ConstraintMatrix::distribute (VectorType &vec) const typedef std::vector::const_iterator constraint_iterator; for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) + it != lines.end(); ++it) if (vec_owned_elements.is_element(it->line)) for (unsigned int i=0; ientries.size(); ++i) - needed_elements.add_index(it->entries[i].first); + if (!vec_owned_elements.is_element(it->entries[i].first)) + needed_elements.add_index(it->entries[i].first); VectorType ghosted_vector; internal::import_vector_with_ghost_elements (vec, @@ -1126,11 +1152,11 @@ ConstraintMatrix::distribute (VectorType &vec) const internal::bool2type::value>()); for (constraint_iterator it = lines.begin(); - it != lines.end(); ++it) + it != lines.end(); ++it) if (vec_owned_elements.is_element(it->line)) { typename VectorType::value_type - new_value = it->inhomogeneity; + new_value = it->inhomogeneity; for (unsigned int i=0; ientries.size(); ++i) new_value += (static_cast (ghosted_vector(it->entries[i].first)) * @@ -1162,7 +1188,7 @@ ConstraintMatrix::distribute (VectorType &vec) const for (unsigned int i=0; ientries.size(); ++i) new_value += (static_cast (vec(next_constraint->entries[i].first)) * - next_constraint->entries[i].second); + next_constraint->entries[i].second); Assert(numbers::is_finite(new_value), ExcNumberNotFinite()); vec(next_constraint->line) = new_value; } @@ -1337,7 +1363,7 @@ namespace internals individual_size[index]++; } - size_type + size_type get_size (const size_type index) const { return individual_size[index]; @@ -1947,7 +1973,7 @@ namespace internals const size_type loc_row = global_rows.local_row(i); typename SparseMatrix::iterator - matrix_values = sparse_matrix->begin(row); + matrix_values = sparse_matrix->begin(row); const bool optimize_diagonal = sparsity.n_rows() == sparsity.n_cols(); // distinguish three cases about what can @@ -2408,7 +2434,7 @@ make_sorted_row_list (const std::vector &local_dof_indices, Utilities::lower_bound(active_dofs.begin(), active_dofs.end()-i+1, new_index); - if (*it != new_index) + if (*it != new_index) active_dofs.insert(it, new_index); } } @@ -2698,7 +2724,7 @@ distribute_local_to_global (const FullMatrix &local_matrix, for (size_type block_col=0; block_col &local_dof_indices, for (size_type block_col=0; block_col::iterator col_ptr = cols.begin(); internals::resolve_matrix_row (global_rows, i, begin_block, end_block, dof_mask, col_ptr); diff --git a/deal.II/include/deal.II/lac/eigen.h b/deal.II/include/deal.II/lac/eigen.h index d0ccf1f91e..4de7854975 100644 --- a/deal.II/include/deal.II/lac/eigen.h +++ b/deal.II/include/deal.II/lac/eigen.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__eigen_h #define __deal2__eigen_h diff --git a/deal.II/include/deal.II/lac/exceptions.h b/deal.II/include/deal.II/lac/exceptions.h index 160138bf0d..6c8a1bacca 100644 --- a/deal.II/include/deal.II/lac/exceptions.h +++ b/deal.II/include/deal.II/lac/exceptions.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__lac_exceptions_h #define __deal2__lac_exceptions_h diff --git a/deal.II/include/deal.II/lac/filtered_matrix.h b/deal.II/include/deal.II/lac/filtered_matrix.h index f6d789f133..074613fc5f 100644 --- a/deal.II/include/deal.II/lac/filtered_matrix.h +++ b/deal.II/include/deal.II/lac/filtered_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__filtered_matrix_h #define __deal2__filtered_matrix_h diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index b1e680217d..ad8a7fc09a 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__full_matrix_h #define __deal2__full_matrix_h @@ -1538,7 +1543,7 @@ FullMatrix::copy_from (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) this->el(row, entry->column()) = entry->value(); } } @@ -1559,7 +1564,7 @@ FullMatrix::copy_transposed (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) this->el(entry->column(), row) = entry->value(); } } @@ -1864,11 +1869,11 @@ FullMatrix::print (STREAM &s, for (size_type i=0; im(); ++i) { for (size_type j=0; jn(); ++j) - { - s.width(w); - s.precision(p); - s << this->el(i,j); - } + { + s.width(w); + s.precision(p); + s << this->el(i,j); + } s << std::endl; } diff --git a/deal.II/include/deal.II/lac/full_matrix.templates.h b/deal.II/include/deal.II/lac/full_matrix.templates.h index 39a2d461fc..44c3bb8933 100644 --- a/deal.II/include/deal.II/lac/full_matrix.templates.h +++ b/deal.II/include/deal.II/lac/full_matrix.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__full_matrix_templates_h #define __deal2__full_matrix_templates_h @@ -338,9 +343,9 @@ void FullMatrix::fill (const FullMatrix &src, // Compute maximal size of copied block const size_type rows = std::min (m() - dst_offset_i, - src.m() - src_offset_i); + src.m() - src_offset_i); const size_type cols = std::min (n() - dst_offset_j, - src.n() - src_offset_j); + src.n() - src_offset_j); for (size_type i=0; i::Tadd (const FullMatrix &src, // Compute maximal size of copied block const size_type rows = std::min (m() - dst_offset_i, src.n() - src_offset_j); const size_type cols = std::min (n() - dst_offset_j, - src.m() - src_offset_i); + src.m() - src_offset_i); for (size_type i=0; i::precondition_Jacobi (Vector &dst, const somenumber *src_ptr = src.begin(); for (size_type i=0; i + + +#include +#include +#include +#include +DEAL_II_NAMESPACE_OPEN + + +namespace LinearAlgebraDealII +{ + typedef Vector Vector; + typedef BlockVector BlockVector; + + typedef SparseMatrix SparseMatrix; + + typedef PreconditionSSOR PreconditionSSOR; + +} + + +DEAL_II_NAMESPACE_CLOSE + + +#ifdef DEAL_II_USE_PETSC + +#include +#include +#include +#include +#include +#include +#include +#include + +DEAL_II_NAMESPACE_OPEN + +namespace LinearAlgebraPETSc +{ + using namespace dealii; + + typedef PETScWrappers::Vector Vector; + typedef PETScWrappers::BlockVector BlockVector; + + typedef PETScWrappers::SparseMatrix SparseMatrix; + + typedef PETScWrappers::SolverCG SolverCG; + + + namespace MPI + { + + /** + * Typedef for the vector type used. + */ + typedef PETScWrappers::MPI::Vector Vector; + + /** + * Typedef for the type used to describe vectors that + * consist of multiple blocks. + */ + typedef PETScWrappers::MPI::BlockVector BlockVector; + + /** + * Typedef for the sparse matrix type used. + */ + typedef PETScWrappers::MPI::SparseMatrix SparseMatrix; + + /** + * Typedef for the type used to describe sparse matrices that + * consist of multiple blocks. + */ + typedef PETScWrappers::MPI::BlockSparseMatrix BlockSparseMatrix; + + typedef dealii::BlockCompressedSimpleSparsityPattern CompressedBlockSparsityPattern; + + /** + * Typedef for the AMG preconditioner type. + */ + typedef PETScWrappers::PreconditionBoomerAMG PreconditionAMG; + + /** + * Typedef for the Incomplete Cholesky preconditioner. + */ + typedef PETScWrappers::PreconditionICC PreconditionIC; + + /** + * Typedef for the Incomplete LU decomposition preconditioner. + */ + typedef PETScWrappers::PreconditionILU PreconditionILU; + + /** + * Typedef for the Incomplete Jacobi decomposition preconditioner. + */ + typedef PETScWrappers::PreconditionJacobi PreconditionJacobi; + + /** + * Typedef for the SSOR preconditioner. + */ + typedef PETScWrappers::PreconditionSSOR PreconditionSSOR; + + } + +} +DEAL_II_NAMESPACE_CLOSE + + +#endif // DEAL_II_USE_PETSC + +#ifdef DEAL_II_USE_TRILINOS + +#include +#include +#include +#include +#include +#include +#include + +DEAL_II_NAMESPACE_OPEN + +namespace LinearAlgebraTrilinos +{ + using namespace dealii; + + typedef TrilinosWrappers::Vector Vector; + + typedef TrilinosWrappers::SolverCG SolverCG; + + namespace MPI + { + + /** + * Typedef for the vector type used. + */ + typedef TrilinosWrappers::MPI::Vector Vector; + + /** + * Typedef for the type used to describe vectors that + * consist of multiple blocks. + */ + typedef TrilinosWrappers::MPI::BlockVector BlockVector; + + /** + * Typedef for the sparse matrix type used. + */ + typedef TrilinosWrappers::SparseMatrix SparseMatrix; + + /** + * Typedef for the type used to describe sparse matrices that + * consist of multiple blocks. + */ + typedef TrilinosWrappers::BlockSparseMatrix BlockSparseMatrix; + + typedef TrilinosWrappers::BlockSparsityPattern CompressedBlockSparsityPattern; + + /** + * Typedef for the AMG preconditioner type. + */ + typedef TrilinosWrappers::PreconditionAMG PreconditionAMG; + + /** + * Typedef for the Incomplete Cholesky preconditioner. + */ + typedef TrilinosWrappers::PreconditionIC PreconditionIC; + + /** + * Typedef for the Incomplete LU decomposition preconditioner. + */ + typedef TrilinosWrappers::PreconditionILU PreconditionILU; + + /** + * Typedef for the Incomplete Jacobi decomposition preconditioner. + */ + typedef TrilinosWrappers::PreconditionJacobi PreconditionJacobi; + + /** + * Typedef for the SSOR preconditioner + */ + typedef TrilinosWrappers::PreconditionSSOR PreconditionSSOR; + + + } + +} + +DEAL_II_NAMESPACE_CLOSE + + +#endif // DEAL_II_USE_TRILINOS + + + +#endif diff --git a/deal.II/include/deal.II/lac/householder.h b/deal.II/include/deal.II/lac/householder.h index 900742cb1c..233a48ca88 100644 --- a/deal.II/include/deal.II/lac/householder.h +++ b/deal.II/include/deal.II/lac/householder.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__householder_h #define __deal2__householder_h diff --git a/deal.II/include/deal.II/lac/identity_matrix.h b/deal.II/include/deal.II/lac/identity_matrix.h index 718f084683..c54dbbc4fe 100644 --- a/deal.II/include/deal.II/lac/identity_matrix.h +++ b/deal.II/include/deal.II/lac/identity_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__identity_matrix_h #define __deal2__identity_matrix_h @@ -201,7 +206,7 @@ IdentityMatrix::reinit (const size_type n) inline -IdentityMatrix::size_type +IdentityMatrix::size_type IdentityMatrix::m () const { return size; @@ -210,7 +215,7 @@ IdentityMatrix::m () const inline -IdentityMatrix::size_type +IdentityMatrix::size_type IdentityMatrix::n () const { return size; diff --git a/deal.II/include/deal.II/lac/iterative_inverse.h b/deal.II/include/deal.II/lac/iterative_inverse.h index a93dd3369d..db8fdb8a13 100644 --- a/deal.II/include/deal.II/lac/iterative_inverse.h +++ b/deal.II/include/deal.II/lac/iterative_inverse.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__iterative_inverse_h #define __deal2__iterative_inverse_h diff --git a/deal.II/include/deal.II/lac/lapack_full_matrix.h b/deal.II/include/deal.II/lac/lapack_full_matrix.h index 52c978df04..b6000c48e5 100644 --- a/deal.II/include/deal.II/lac/lapack_full_matrix.h +++ b/deal.II/include/deal.II/lac/lapack_full_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__lapack_full_matrix_h #define __deal2__lapack_full_matrix_h @@ -718,7 +723,7 @@ LAPACKFullMatrix::copy_from (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) this->el(row, entry->column()) = entry->value(); } @@ -745,7 +750,7 @@ LAPACKFullMatrix::fill ( { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) { const size_type i = transpose ? entry->column() : row; const size_type j = transpose ? row : entry->column(); diff --git a/deal.II/include/deal.II/lac/lapack_support.h b/deal.II/include/deal.II/lac/lapack_support.h index 1208987f37..a675f9820c 100644 --- a/deal.II/include/deal.II/lac/lapack_support.h +++ b/deal.II/include/deal.II/lac/lapack_support.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__lapack_support_h #define __deal2__lapack_support_h diff --git a/deal.II/include/deal.II/lac/lapack_templates.h b/deal.II/include/deal.II/lac/lapack_templates.h index 5f37ef6c67..ddebfbdf03 100644 --- a/deal.II/include/deal.II/lac/lapack_templates.h +++ b/deal.II/include/deal.II/lac/lapack_templates.h @@ -1,16 +1,19 @@ -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- +// $Id$ // -// This file was automatically generated from lapack_templates.h.in -// See blastemplates in the deal.II contrib directory +// Copyright (C) 2005 - 2013 by the deal.II authors // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 by the deal authors +// This file is part of the deal.II library. // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. // -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- + #ifndef __LAPACK_TEMPLATES_H #define __LAPACK_TEMPLATES_H diff --git a/deal.II/include/deal.II/lac/matrix_block.h b/deal.II/include/deal.II/lac/matrix_block.h index 946cccca20..f6542c8bcf 100644 --- a/deal.II/include/deal.II/lac/matrix_block.h +++ b/deal.II/include/deal.II/lac/matrix_block.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_block_h #define __deal2__matrix_block_h diff --git a/deal.II/include/deal.II/lac/matrix_iterator.h b/deal.II/include/deal.II/lac/matrix_iterator.h index 6b56b79580..4e6f02d367 100644 --- a/deal.II/include/deal.II/lac/matrix_iterator.h +++ b/deal.II/include/deal.II/lac/matrix_iterator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_iterator_h #define __deal2__matrix_iterator_h diff --git a/deal.II/include/deal.II/lac/matrix_lib.h b/deal.II/include/deal.II/lac/matrix_lib.h index 89bff0430b..2a438f0271 100644 --- a/deal.II/include/deal.II/lac/matrix_lib.h +++ b/deal.II/include/deal.II/lac/matrix_lib.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012, 2013 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_lib_h #define __deal2__matrix_lib_h diff --git a/deal.II/include/deal.II/lac/matrix_lib.templates.h b/deal.II/include/deal.II/lac/matrix_lib.templates.h index 71c37a67c1..81e0a09157 100644 --- a/deal.II/include/deal.II/lac/matrix_lib.templates.h +++ b/deal.II/include/deal.II/lac/matrix_lib.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_lib_templates_h #define __deal2__matrix_lib_templates_h diff --git a/deal.II/include/deal.II/lac/matrix_out.h b/deal.II/include/deal.II/lac/matrix_out.h index 392b16c3be..55c8452217 100644 --- a/deal.II/include/deal.II/lac/matrix_out.h +++ b/deal.II/include/deal.II/lac/matrix_out.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_out_h #define __deal2__matrix_out_h @@ -386,7 +391,7 @@ MatrixOut::build_patches (const Matrix &matrix, const std::string &name, const Options options) { - size_type + size_type gridpoints_x = (matrix.n() / options.block_size + (matrix.n() % options.block_size != 0 ? 1 : 0)), diff --git a/deal.II/include/deal.II/lac/parallel_block_vector.h b/deal.II/include/deal.II/lac/parallel_block_vector.h index d42f572fcb..747d12a33e 100644 --- a/deal.II/include/deal.II/lac/parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/parallel_block_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__parallel_block_vector_h #define __deal2__parallel_block_vector_h @@ -120,6 +125,20 @@ namespace parallel */ BlockVector (const std::vector &block_sizes); + /** + * Construct a block vector with an IndexSet for the local range + * and ghost entries for each block. + */ + BlockVector (const std::vector &local_ranges, + const std::vector &ghost_indices, + const MPI_Comm communicator); + + /** + * Same as above but the ghost indicies are assumed to be empty. + */ + BlockVector (const std::vector &local_ranges, + const MPI_Comm communicator); + /** * Destructor. Clears memory. */ @@ -351,6 +370,41 @@ namespace parallel } + template + inline + BlockVector::BlockVector (const std::vector &local_ranges, + const std::vector &ghost_indices, + const MPI_Comm communicator) + { + std::vector sizes(local_ranges.size()); + for (unsigned int i=0; iblock_indices.reinit(sizes); + this->components.resize(this->n_blocks()); + + for (unsigned int i=0; in_blocks(); ++i) + this->block(i).reinit(local_ranges[i], ghost_indices[i], communicator); + } + + + template + inline + BlockVector::BlockVector (const std::vector &local_ranges, + const MPI_Comm communicator) + { + std::vector sizes(local_ranges.size()); + for (unsigned int i=0; iblock_indices.reinit(sizes); + this->components.resize(this->n_blocks()); + + for (unsigned int i=0; in_blocks(); ++i) + this->block(i).reinit(local_ranges[i], communicator); + } + + template inline @@ -449,8 +503,18 @@ namespace parallel BlockVector & BlockVector::operator = (const BlockVector &v) { - reinit (v, true); - BaseClass::operator = (v); + // we only allow assignment to vectors with the same number of blocks + // or to an empty BlockVector + Assert (this->n_blocks() == 0 || this->n_blocks() == v.n_blocks(), + ExcDimensionMismatch(this->n_blocks(), v.n_blocks())); + + if (this->n_blocks() != v.n_blocks()) + reinit(v.n_blocks(), true); + + for (size_type i=0; in_blocks(); ++i) + this->components[i] = v.block(i); + + this->collect_sizes(); return *this; } @@ -617,7 +681,7 @@ namespace parallel if (this->block(0).partitioner->n_mpi_processes() > 1) return Utilities::MPI::sum (local_result, this->block(0).partitioner->get_communicator())/ - (real_type)this->size(); + (real_type)this->size(); else return local_result/(real_type)this->size(); } diff --git a/deal.II/include/deal.II/lac/parallel_vector.h b/deal.II/include/deal.II/lac/parallel_vector.h index 1d979bced1..7e1d853e52 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.h +++ b/deal.II/include/deal.II/lac/parallel_vector.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012, 2013 by deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__parallel_vector_h #define __deal2__parallel_vector_h @@ -150,6 +154,12 @@ namespace parallel const IndexSet &ghost_indices, const MPI_Comm communicator); + /** + * Same constructor as above but without any ghost indices. + */ + Vector (const IndexSet &local_range, + const MPI_Comm communicator); + /** * Create the vector based on the parallel partitioning described in @p * partitioner. The input argument is a shared pointer, which store the @@ -200,6 +210,12 @@ namespace parallel const IndexSet &ghost_indices, const MPI_Comm communicator); + /** + * Same as above, but without ghost entries. + */ + void reinit (const IndexSet &local_range, + const MPI_Comm communicator); + /** * Initialize the vector given to the parallel partitioning described in * @p partitioner. The input argument is a shared pointer, which store @@ -484,7 +500,7 @@ namespace parallel * not owned by the current processor but can be written into or read * from locally (ghost elements). */ - const IndexSet& ghost_elements() const; + const IndexSet &ghost_elements() const; /** * Returns whether the given global index is a ghost index on the @@ -567,6 +583,29 @@ namespace parallel */ Number &operator [] (const size_type global_index); + /** + * A collective get operation: instead + * of getting individual elements of a + * vector, this function allows to get + * a whole set of elements at once. The + * indices of the elements to be read + * are stated in the first argument, + * the corresponding values are returned in the + * second. + */ + template + void extract_subvector_to (const std::vector &indices, + std::vector &values) const; + + /** + * Just as the above, but with pointers. + * Useful in minimizing copying of data around. + */ + template + void extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const; + /** * Read access to the data field specified by @p local_index. Locally * owned indices can be accessed with indices @@ -770,7 +809,7 @@ namespace parallel * vector. */ const MPI_Comm &get_mpi_communicator () const; - + /** * Checks whether the given partitioner is compatible with the * partitioner used for this vector. Two partitioners are compatible if @@ -975,6 +1014,22 @@ namespace parallel + template + inline + Vector::Vector (const IndexSet &local_range, + const MPI_Comm communicator) + : + allocated_size (0), + val (0), + import_data (0), + vector_view (0, static_cast(0)) + { + IndexSet ghost_indices(local_range.size()); + reinit (local_range, ghost_indices, communicator); + } + + + template inline Vector::Vector (const size_type size) @@ -1038,7 +1093,7 @@ namespace parallel else if (partitioner.get() != c.partitioner.get()) { size_type local_ranges_different_loc = (local_range() != - c.local_range()); + c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, partitioner->get_communicator()) != 0) @@ -1047,6 +1102,7 @@ namespace parallel reinit (c, true); } vector_view = c.vector_view; + update_ghost_values(); return *this; } @@ -1070,7 +1126,7 @@ namespace parallel else if (partitioner.get() != c.partitioner.get()) { size_type local_ranges_different_loc = (local_range() != - c.local_range()); + c.local_range()); if ((partitioner->n_mpi_processes() > 1 && Utilities::MPI::max(local_ranges_different_loc, partitioner->get_communicator()) != 0) @@ -1205,8 +1261,8 @@ namespace parallel Vector::vectors_equal_local (const Vector &v) const { return partitioner->local_size()>0 ? - vector_view.template operator == (v.vector_view) - : true; + vector_view.template operator == (v.vector_view) + : true; } @@ -1321,7 +1377,7 @@ namespace parallel return Utilities::MPI::sum (local_result * (real_type)partitioner->local_size(), partitioner->get_communicator()) - /(real_type)partitioner->size(); + /(real_type)partitioner->size(); else return local_result; } @@ -1437,8 +1493,8 @@ namespace parallel template inline std::pair::size_type, - typename Vector::size_type> - Vector::local_range () const + typename Vector::size_type> + Vector::local_range () const { return partitioner->local_range(); } @@ -1473,7 +1529,7 @@ namespace parallel template inline - typename Vector::size_type + typename Vector::size_type Vector::n_ghost_entries () const { return partitioner->n_ghost_indices(); @@ -1483,7 +1539,7 @@ namespace parallel template inline - const IndexSet& + const IndexSet & Vector::ghost_elements() const { return partitioner->ghost_indices(); @@ -1581,6 +1637,33 @@ namespace parallel + template + template + inline + void Vector::extract_subvector_to (const std::vector &indices, + std::vector &values) const + { + for (size_type i = 0; i < indices.size(); ++i) + values[i] = operator()(indices[i]); + } + + + + template + template + inline + void Vector::extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const + { + while (indices_begin != indices_end) { + *values_begin = operator()(*indices_begin); + indices_begin++; values_begin++; + } + } + + + template inline Number @@ -2004,7 +2087,7 @@ namespace parallel template inline - const MPI_Comm& + const MPI_Comm & Vector::get_mpi_communicator() const { return partitioner->get_communicator(); diff --git a/deal.II/include/deal.II/lac/parallel_vector.templates.h b/deal.II/include/deal.II/lac/parallel_vector.templates.h index c78dee5259..334966c5f0 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.templates.h +++ b/deal.II/include/deal.II/lac/parallel_vector.templates.h @@ -1,14 +1,19 @@ -//----------%----------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__parallel_vector_templates_h #define __deal2__parallel_vector_templates_h @@ -139,8 +144,22 @@ namespace parallel const IndexSet &ghost_indices, const MPI_Comm communicator) { - // set up parallel partitioner with index sets - // and communicator + // set up parallel partitioner with index sets and communicator + std_cxx1x::shared_ptr new_partitioner + (new Utilities::MPI::Partitioner (locally_owned_indices, + ghost_indices, communicator)); + reinit (new_partitioner); + } + + + + template + void + Vector::reinit (const IndexSet &locally_owned_indices, + const MPI_Comm communicator) + { + // set up parallel partitioner with index sets and communicator + IndexSet ghost_indices(locally_owned_indices.size()); std_cxx1x::shared_ptr new_partitioner (new Utilities::MPI::Partitioner (locally_owned_indices, ghost_indices, communicator)); @@ -204,7 +223,9 @@ namespace parallel // nothing to do for insert (only need to zero ghost entries in // compress_finish(). in debug mode we still want to check consistency // of the inserted data, therefore the communication is still - // initialized + // initialized. Having different code in debug and optimized mode is + // somewhat dangerous, but it really saves communication so it seems + // still worthwhile. #ifndef DEBUG if (operation == VectorOperation::insert) return; @@ -295,6 +316,16 @@ namespace parallel { #ifdef DEAL_II_WITH_MPI + // in optimized mode, no communication was started, so leave the + // function directly (and only clear ghosts) +#ifndef DEBUG + if (operation == VectorOperation::insert) + { + zero_out_ghosts(); + return; + } +#endif + const Utilities::MPI::Partitioner &part = *partitioner; // nothing to do when we neither have import @@ -338,7 +369,7 @@ namespace parallel j++, read_position++) Assert(*read_position == 0. || std::abs(local_element(j) - *read_position) < - std::abs(local_element(j)) * 100. * + std::abs(local_element(j)) * 1000. * std::numeric_limits::epsilon(), ExcMessage("Inserted elements do not match.")); AssertDimension(read_position-import_data,part.n_import_indices()); @@ -567,8 +598,8 @@ namespace parallel #endif out << "Process #" << partitioner->this_mpi_process() << std::endl - << "Local range: [" << partitioner->local_range().first << "/" - << partitioner->local_range().second << "], global size: " + << "Local range: [" << partitioner->local_range().first << ", " + << partitioner->local_range().second << "), global size: " << partitioner->size() << std::endl << "Vector data:" << std::endl; if (across) diff --git a/deal.II/include/deal.II/lac/petsc_block_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_block_sparse_matrix.h index 9bc1d63ec1..393de8adb7 100644 --- a/deal.II/include/deal.II/lac/petsc_block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_block_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_block_sparse_matrix_h #define __deal2__petsc_block_sparse_matrix_h diff --git a/deal.II/include/deal.II/lac/petsc_block_vector.h b/deal.II/include/deal.II/lac/petsc_block_vector.h index d394e5e445..bc40036c98 100644 --- a/deal.II/include/deal.II/lac/petsc_block_vector.h +++ b/deal.II/include/deal.II/lac/petsc_block_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_block_vector_h #define __deal2__petsc_block_vector_h diff --git a/deal.II/include/deal.II/lac/petsc_full_matrix.h b/deal.II/include/deal.II/lac/petsc_full_matrix.h index 42cd19e3b6..176e9d5fc3 100644 --- a/deal.II/include/deal.II/lac/petsc_full_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_full_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_full_matrix_h #define __deal2__petsc_full_matrix_h diff --git a/deal.II/include/deal.II/lac/petsc_matrix_base.h b/deal.II/include/deal.II/lac/petsc_matrix_base.h index 500b40d778..8a64919480 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_base.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_matrix_base_h #define __deal2__petsc_matrix_base_h @@ -64,11 +69,11 @@ namespace PETScWrappers class Accessor { public: - /** - * Declare type for container size. - */ - typedef types::global_dof_index size_type; - + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; + /** * Constructor. Since we use * accessors only for read @@ -79,6 +84,11 @@ namespace PETScWrappers const size_type row, const size_type index); + /** + * Copy constructor. + */ + Accessor (const Accessor &a); + /** * Row number of the element * represented by this @@ -188,7 +198,7 @@ namespace PETScWrappers * Declare type for container size. */ typedef types::global_dof_index size_type; - + /** * Constructor. Create an iterator * into the matrix @p matrix for the @@ -301,11 +311,11 @@ namespace PETScWrappers * class. */ typedef MatrixIterators::const_iterator const_iterator; - - /** - * Declare type for container size. - */ - typedef types::global_dof_index size_type; + + /** + * Declare type for container size. + */ + typedef types::global_dof_index size_type; /** * Declare a typedef in analogy to all @@ -949,8 +959,8 @@ namespace PETScWrappers * Add the matrix @p other scaled by the factor @p factor to the current * matrix. */ - MatrixBase & add (const MatrixBase &other, - const PetscScalar factor); + MatrixBase &add (const MatrixBase &other, + const PetscScalar factor); /** * Matrix-vector multiplication: @@ -1172,6 +1182,13 @@ namespace PETScWrappers */ void write_ascii (const PetscViewerFormat format = PETSC_VIEWER_DEFAULT); + /** + * print command, similar to write_ascii, but the same format as + * produced by Trilinos + */ + void print (std::ostream &out, + const bool alternative_output = false) const; + /** * Returns the number bytes consumed * by this matrix on this CPU. @@ -1292,6 +1309,16 @@ namespace PETScWrappers private: + + /** + * purposefully not implemented + */ + MatrixBase(const MatrixBase &); + /** + * purposefully not implemented + */ + MatrixBase &operator=(const MatrixBase &); + /** * An internal array of integer * values that is used to store the @@ -1343,7 +1370,19 @@ namespace PETScWrappers inline - const_iterator::Accessor::size_type + const_iterator::Accessor:: + Accessor (const Accessor &a) + : + matrix(a.matrix), + a_row(a.a_row), + a_index(a.a_index), + colnum_cache (a.colnum_cache), + value_cache (a.value_cache) + {} + + + inline + const_iterator::Accessor::size_type const_iterator::Accessor::row() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1352,7 +1391,7 @@ namespace PETScWrappers inline - const_iterator::Accessor::size_type + const_iterator::Accessor::size_type const_iterator::Accessor::column() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); @@ -1361,7 +1400,7 @@ namespace PETScWrappers inline - const_iterator::Accessor::size_type + const_iterator::Accessor::size_type const_iterator::Accessor::index() const { Assert (a_row < matrix->m(), ExcBeyondEndOfMatrix()); diff --git a/deal.II/include/deal.II/lac/petsc_matrix_free.h b/deal.II/include/deal.II/lac/petsc_matrix_free.h index c7217178d3..1c64f15c6d 100644 --- a/deal.II/include/deal.II/lac/petsc_matrix_free.h +++ b/deal.II/include/deal.II/lac/petsc_matrix_free.h @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #ifndef __deal2__petsc_matrix_free_h #define __deal2__petsc_matrix_free_h @@ -34,14 +36,14 @@ namespace PETScWrappers * Implementation of a parallel matrix class based on PETSc MatShell matrix-type. * This base class implements only the interface to the PETSc matrix object, * while all the functionality is contained in the matrix-vector - * multiplication which must be reimplmented in derived classes. + * multiplication which must be reimplemented in derived classes. * * This interface is an addition to the dealii::MatrixFree class to realize * user-defined matrix-classes together with PETSc solvers and functionalities. * See also the documentation of dealii::MatrixFree class and step-37 and step-48. * * Similar to other matrix classes in namespaces PETScWrappers and PETScWrappers::MPI, - * the MatrxiFree class provides the usual matrix-vector multiplication + * the MatrixFree class provides the usual matrix-vector multiplication * vmult(VectorBase &dst, const VectorBase &src) * which is pure virtual and must be reimplemented in derived classes. * Besides the usual interface, this class has a matrix-vector multiplication diff --git a/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h index 0bf1727fff..f52a9a5f30 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_block_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_parallel_block_sparse_matrix_h #define __deal2__petsc_parallel_block_sparse_matrix_h @@ -19,6 +24,7 @@ # include # include +# include # include # include # include @@ -172,6 +178,31 @@ namespace PETScWrappers void reinit (const size_type n_block_rows, const size_type n_block_columns); + + /** + * Efficiently reinit the block matrix for a parallel computation. + * Only the BlockSparsityPattern of the Simple type can efficiently + * store large sparsity patterns in parallel, so this is the only + * supported argument. + * The IndexSets describe the locally owned range of DoFs for each block. + * Note that each IndexSet needs to be contiguous. For a symmetric structure + * hand in the same vector for the first two arguments. + */ + void reinit(const std::vector &rows, + const std::vector &cols, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com); + + + /** + * Same as above but for a symmetric structure only. + */ + void reinit(const std::vector &sizes, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com); + + + /** * Matrix-vector multiplication: * let $dst = M*src$ with $M$ diff --git a/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h index d2fa6a98ee..f55e61d5cc 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_block_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_parallel_block_vector_h #define __deal2__petsc_parallel_block_vector_h @@ -133,6 +138,15 @@ namespace PETScWrappers explicit BlockVector (const std::vector ¶llel_partitioning, const MPI_Comm &communicator = MPI_COMM_WORLD); + /** + * Same as above, but include ghost elements + */ + BlockVector (const std::vector ¶llel_partitioning, + const std::vector &ghost_indices, + const MPI_Comm &communicator); + + + /** * Destructor. Clears memory */ @@ -279,6 +293,13 @@ namespace PETScWrappers void reinit (const std::vector ¶llel_partitioning, const MPI_Comm &communicator); + /** + * Same as above but include ghost entries. + */ + void reinit (const std::vector ¶llel_partitioning, + const std::vector &ghost_entries, + const MPI_Comm &communicator); + /** * Change the number of blocks to * num_blocks. The individual @@ -292,6 +313,11 @@ namespace PETScWrappers */ void reinit (const unsigned int num_blocks); + /** + * Returns if this vector is a ghosted vector (and thus read-only). + */ + bool has_ghost_elements() const; + /** * Return a reference to the MPI * communicator object in use with @@ -394,11 +420,18 @@ namespace PETScWrappers inline BlockVector::BlockVector (const std::vector ¶llel_partitioning, - const MPI_Comm &communicator) + const MPI_Comm &communicator) { reinit(parallel_partitioning, communicator); } + inline + BlockVector::BlockVector (const std::vector ¶llel_partitioning, + const std::vector &ghost_indices, + const MPI_Comm &communicator) + { + reinit(parallel_partitioning, ghost_indices, communicator); + } inline BlockVector & @@ -408,17 +441,25 @@ namespace PETScWrappers return *this; } - - inline BlockVector & BlockVector::operator = (const BlockVector &v) { - BaseClass::operator = (v); - return *this; - } + // we only allow assignment to vectors with the same number of blocks + // or to an empty BlockVector + Assert (n_blocks() == 0 || n_blocks() == v.n_blocks(), + ExcDimensionMismatch(n_blocks(), v.n_blocks())); + + if (this->n_blocks() != v.n_blocks()) + reinit(v.n_blocks()); + for (size_type i=0; in_blocks(); ++i) + this->components[i] = v.block(i); + collect_sizes(); + + return *this; + } inline BlockVector::~BlockVector () @@ -474,7 +515,7 @@ namespace PETScWrappers inline void BlockVector::reinit (const std::vector ¶llel_partitioning, - const MPI_Comm &communicator) + const MPI_Comm &communicator) { std::vector sizes(parallel_partitioning.size()); for (unsigned int i=0; icomponents.resize(this->n_blocks()); for (unsigned int i=0; in_blocks(); ++i) - block(i).reinit(communicator, parallel_partitioning[i]); + block(i).reinit(parallel_partitioning[i], communicator); } + inline + void + BlockVector::reinit (const std::vector ¶llel_partitioning, + const std::vector &ghost_entries, + const MPI_Comm &communicator) + { + std::vector sizes(parallel_partitioning.size()); + for (unsigned int i=0; iblock_indices.reinit(sizes); + if (this->components.size() != this->n_blocks()) + this->components.resize(this->n_blocks()); + + for (unsigned int i=0; in_blocks(); ++i) + block(i).reinit(parallel_partitioning[i], ghost_entries[i], communicator); + } + + inline const MPI_Comm & @@ -496,6 +556,17 @@ namespace PETScWrappers return block(0).get_mpi_communicator(); } + inline + bool + BlockVector::has_ghost_elements() const + { + bool ghosted=block(0).has_ghost_elements(); +#ifdef DEBUG + for (unsigned int i=0; in_blocks(); ++i) + Assert(block(i).has_ghost_elements()==ghosted, ExcInternalError()); +#endif + return ghosted; + } inline diff --git a/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h index 2b963cb2ac..115bb94bfc 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_parallel_sparse_matrix_h #define __deal2__petsc_parallel_sparse_matrix_h @@ -153,6 +158,11 @@ namespace PETScWrappers */ SparseMatrix (); + /** + * Destructor to free the PETSc object. + */ + ~SparseMatrix (); + /** * Create a sparse matrix of * dimensions @p m times @p n, with @@ -298,6 +308,13 @@ namespace PETScWrappers */ SparseMatrix &operator = (const value_type d); + + /** + * Make a copy of the PETSc matrix @p other. It is assumed that both matrices have + * the same SparsityPattern. + */ + void copy_from(const SparseMatrix &other); + /** * Throw away the present matrix and * generate one that has the same @@ -372,6 +389,18 @@ namespace PETScWrappers const unsigned int this_process, const bool preset_nonzero_locations = true); + /** + * Create a matrix where the size() of the IndexSets determine the global + * number of rows and columns and the entries of the IndexSet give + * the rows and columns for the calling processor. + * Note that only contiguous IndexSets are supported. + */ + template + void reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern, + const MPI_Comm &communicator); + /** * Return a reference to the MPI * communicator object in use with @@ -476,6 +505,14 @@ namespace PETScWrappers const unsigned int this_process, const bool preset_nonzero_locations); + /** + * Same as previous functions. + */ + template + void do_reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern); + /** * To allow calling protected * prepare_add() and diff --git a/deal.II/include/deal.II/lac/petsc_parallel_vector.h b/deal.II/include/deal.II/lac/petsc_parallel_vector.h index 1ee6f87ae4..bc3ee07627 100644 --- a/deal.II/include/deal.II/lac/petsc_parallel_vector.h +++ b/deal.II/include/deal.II/lac/petsc_parallel_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_parallel_vector_h #define __deal2__petsc_parallel_vector_h @@ -171,10 +176,10 @@ namespace PETScWrappers */ static const bool supports_distributed_data = true; - /** - * Default constructor. Initialize the - * vector as empty. - */ + /** + * Default constructor. Initialize the + * vector as empty. + */ Vector (); /** @@ -269,15 +274,47 @@ namespace PETScWrappers */ explicit Vector (const MPI_Comm &communicator, const IndexSet &local, - const IndexSet &ghost); + const IndexSet &ghost) DEAL_II_DEPRECATED; + + /** + * Constructs a new parallel ghosted PETSc + * vector from an Indexset. Note that + * @p local must be contiguous and + * the global size of the vector is + * determined by local.size(). The + * global indices in @p ghost are + * supplied as ghost indices that can + * also be read locally. + * + * Note that the @p ghost IndexSet + * may be empty and that any indices + * already contained in @p local are + * ignored during construction. That + * way, the ghost parameter can equal + * the set of locally relevant + * degrees of freedom, see step-32. + * + * @note This operation always creates a ghosted + * vector. + */ + Vector (const IndexSet &local, + const IndexSet &ghost, + const MPI_Comm &communicator); /** * Constructs a new parallel PETSc * vector from an Indexset. This creates a non * ghosted vector. */ - explicit Vector (const MPI_Comm &communicator, - const IndexSet &local); + explicit Vector (const MPI_Comm &communicator, + const IndexSet &local) DEAL_II_DEPRECATED; + /** + * Constructs a new parallel PETSc + * vector from an Indexset. This creates a non + * ghosted vector. + */ + explicit Vector (const IndexSet &local, + const MPI_Comm &communicator); /** * Copy the given vector. Resize the @@ -409,7 +446,15 @@ namespace PETScWrappers */ void reinit (const MPI_Comm &communicator, const IndexSet &local, - const IndexSet &ghost); + const IndexSet &ghost) DEAL_II_DEPRECATED; + /** + * Reinit as a vector without ghost elements. See + * constructor with same signature + * for more detais. + */ + void reinit (const IndexSet &local, + const IndexSet &ghost, + const MPI_Comm &communicator); /** * Reinit as a vector without ghost elements. See @@ -417,7 +462,14 @@ namespace PETScWrappers * for more detais. */ void reinit (const MPI_Comm &communicator, - const IndexSet &local); + const IndexSet &local) DEAL_II_DEPRECATED; + /** + * Reinit as a vector without ghost elements. See + * constructor with same signature + * for more detais. + */ + void reinit (const IndexSet &local, + const MPI_Comm &communicator); /** * Return a reference to the MPI @@ -536,10 +588,38 @@ namespace PETScWrappers Vector & Vector::operator = (const Vector &v) { + if (v.size()==0) + { + // this happens if v has not been initialized to something useful: + // Vector x,v;x=v; + // we skip the code below and create a simple serial vector of + // length 0 + + int ierr; +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + ierr = VecDestroy (vector); +#else + ierr = VecDestroy (&vector); +#endif + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + const int n = 0; + ierr = VecCreateSeq (PETSC_COMM_SELF, n, &vector); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + ghosted = false; + ghost_indices.clear(); + return *this; + } + // if the vectors have different sizes, // then first resize the present one if (size() != v.size()) - reinit (v.communicator, v.size(), v.local_size(), true); + { + if (v.has_ghost_elements()) + reinit( v.locally_owned_elements(), v.ghost_indices, v.communicator); + else + reinit (v.communicator, v.size(), v.local_size(), true); + } const int ierr = VecCopy (v.vector, vector); AssertThrow (ierr == 0, ExcPETScError(ierr)); diff --git a/deal.II/include/deal.II/lac/petsc_precondition.h b/deal.II/include/deal.II/lac/petsc_precondition.h index c43f136eca..ec03849867 100644 --- a/deal.II/include/deal.II/lac/petsc_precondition.h +++ b/deal.II/include/deal.II/lac/petsc_precondition.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_precondition_h #define __deal2__petsc_precondition_h diff --git a/deal.II/include/deal.II/lac/petsc_solver.h b/deal.II/include/deal.II/lac/petsc_solver.h index 0e3cc61d1f..b3c9ac5c84 100644 --- a/deal.II/include/deal.II/lac/petsc_solver.h +++ b/deal.II/include/deal.II/lac/petsc_solver.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_solver_h #define __deal2__petsc_solver_h @@ -219,11 +224,11 @@ namespace PETScWrappers * convergence has been reached. */ static - PetscErrorCode convergence_test (KSP ksp, - const PetscInt iteration, - const PetscReal residual_norm, - KSPConvergedReason *reason, - void *solver_control); + PetscErrorCode convergence_test (KSP ksp, + const PetscInt iteration, + const PetscReal residual_norm, + KSPConvergedReason *reason, + void *solver_control); /** * A structure that contains the PETSc @@ -1211,11 +1216,11 @@ namespace PETScWrappers * to see if convergence has been reached. */ static - PetscErrorCode convergence_test (KSP ksp, - const PetscInt iteration, - const PetscReal residual_norm, - KSPConvergedReason *reason, - void *solver_control); + PetscErrorCode convergence_test (KSP ksp, + const PetscInt iteration, + const PetscReal residual_norm, + KSPConvergedReason *reason, + void *solver_control); /** * A structure that contains the diff --git a/deal.II/include/deal.II/lac/petsc_sparse_matrix.h b/deal.II/include/deal.II/lac/petsc_sparse_matrix.h index 5644c940fd..cd12e0c2d5 100644 --- a/deal.II/include/deal.II/lac/petsc_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/petsc_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_sparse_matrix_h #define __deal2__petsc_sparse_matrix_h @@ -168,8 +173,8 @@ namespace PETScWrappers * the start. */ template - SparseMatrix (const SparsityType &sparsity_pattern, - const bool preset_nonzero_locations = true); + explicit SparseMatrix (const SparsityType &sparsity_pattern, + const bool preset_nonzero_locations = true); /** * This operator assigns a scalar to @@ -209,7 +214,7 @@ namespace PETScWrappers * the constructor of this class with * the same argument list as the * present function. - */ + */ void reinit (const size_type m, const size_type n, const std::vector &row_lengths, @@ -321,6 +326,15 @@ namespace PETScWrappers private: + /** + * Purposefully not implemented + */ + SparseMatrix(const SparseMatrix &); + /** + * Purposefully not implemented + */ + SparseMatrix &operator= (const SparseMatrix &); + /** * Do the actual work for the * respective reinit() function and the diff --git a/deal.II/include/deal.II/lac/petsc_vector.h b/deal.II/include/deal.II/lac/petsc_vector.h index 0ee5ca8162..6eed2e9472 100644 --- a/deal.II/include/deal.II/lac/petsc_vector.h +++ b/deal.II/include/deal.II/lac/petsc_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_vector_h #define __deal2__petsc_vector_h diff --git a/deal.II/include/deal.II/lac/petsc_vector_base.h b/deal.II/include/deal.II/lac/petsc_vector_base.h index 4e6416ae51..709e1e6185 100644 --- a/deal.II/include/deal.II/lac/petsc_vector_base.h +++ b/deal.II/include/deal.II/lac/petsc_vector_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__petsc_vector_base_h #define __deal2__petsc_vector_base_h @@ -83,7 +88,7 @@ namespace PETScWrappers */ typedef types::global_dof_index size_type; - private: + private: /** * Constructor. It is made private so * as to only allow the actual vector @@ -93,8 +98,8 @@ namespace PETScWrappers const size_type index); - public: - + public: + /** * This looks like a copy operator, * but does something different than @@ -468,6 +473,28 @@ namespace PETScWrappers void set (const std::vector &indices, const std::vector &values); + /** + * A collective get operation: instead + * of getting individual elements of a + * vector, this function allows to get + * a whole set of elements at once. The + * indices of the elements to be read + * are stated in the first argument, + * the corresponding values are returned in the + * second. + */ + void extract_subvector_to (const std::vector &indices, + std::vector &values) const; + + /** + * Just as the above, but with pointers. + * Useful in minimizing copying of data around. + */ + template + void extract_subvector_to (const ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const; + /** * A collective add operation: This * function adds a whole set of values @@ -1217,6 +1244,119 @@ namespace PETScWrappers return comm; } + inline + void VectorBase::extract_subvector_to (const std::vector &indices, + std::vector &values) const + { + extract_subvector_to(&(indices[0]), &(indices[0]) + indices.size(), &(values[0])); + } + + template + inline + void VectorBase::extract_subvector_to (const ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const + { + const PetscInt n_idx = static_cast(indices_end - indices_begin); + if (n_idx == 0) + return; + + // if we are dealing + // with a parallel vector + if (ghosted ) + { + + int ierr; + + // there is the possibility + // that the vector has + // ghost elements. in that + // case, we first need to + // figure out which + // elements we own locally, + // then get a pointer to + // the elements that are + // stored here (both the + // ones we own as well as + // the ghost elements). in + // this array, the locally + // owned elements come + // first followed by the + // ghost elements whose + // position we can get from + // an index set + PetscInt begin, end, i; + ierr = VecGetOwnershipRange (vector, &begin, &end); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + Vec locally_stored_elements = PETSC_NULL; + ierr = VecGhostGetLocalForm(vector, &locally_stored_elements); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + PetscInt lsize; + ierr = VecGetSize(locally_stored_elements, &lsize); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + PetscScalar *ptr; + ierr = VecGetArray(locally_stored_elements, &ptr); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + for (i = 0; i < n_idx; i++) { + const unsigned int index = *(indices_begin+i); + if ( index>=static_cast(begin) + && index(end) ) + { + //local entry + *(values_begin+i) = *(ptr+index-begin); + } + else + { + //ghost entry + const unsigned int ghostidx + = ghost_indices.index_within_set(index); + + Assert(ghostidx+end-begin<(unsigned int)lsize, ExcInternalError()); + *(values_begin+i) = *(ptr+ghostidx+end-begin); + } + } + + ierr = VecRestoreArray(locally_stored_elements, &ptr); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + ierr = VecGhostRestoreLocalForm(vector, &locally_stored_elements); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + } + // if the vector is local or the + // caller, then simply access the + // element we are interested in + else + { + int ierr; + + PetscInt begin, end; + ierr = VecGetOwnershipRange (vector, &begin, &end); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + PetscScalar *ptr; + ierr = VecGetArray(vector, &ptr); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + for (PetscInt i = 0; i < n_idx; i++) { + const unsigned int index = *(indices_begin+i); + + Assert(index>=static_cast(begin) + && index(end), ExcInternalError()); + + *(values_begin+i) = *(ptr+index-begin); + } + + ierr = VecRestoreArray(vector, &ptr); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + } + } + #endif // DOXYGEN } diff --git a/deal.II/include/deal.II/lac/pointer_matrix.h b/deal.II/include/deal.II/lac/pointer_matrix.h index 0a193b2c78..9235de13b0 100644 --- a/deal.II/include/deal.II/lac/pointer_matrix.h +++ b/deal.II/include/deal.II/lac/pointer_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__pointer_matrix_h #define __deal2__pointer_matrix_h diff --git a/deal.II/include/deal.II/lac/precondition.h b/deal.II/include/deal.II/lac/precondition.h index f1964bbe6f..d2e059fd36 100644 --- a/deal.II/include/deal.II/lac/precondition.h +++ b/deal.II/include/deal.II/lac/precondition.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__precondition_h #define __deal2__precondition_h @@ -1316,7 +1321,7 @@ PreconditionSSOR::initialize (const MATRIX &rA, // only. note: the first entry in each line denotes the diagonal // element, which we need not check. typename SparseMatrix::const_iterator - it = mat->begin(row)+1; + it = mat->begin(row)+1; for ( ; it < mat->end(row); ++it) if (it->column() > row) break; @@ -1771,7 +1776,7 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, // attach stream to SolverCG, run it with log report for eigenvalues std::ostream *old_stream = deallog.has_file() ? &deallog.get_file_stream() : - static_cast(0); + static_cast(0); if (old_stream) deallog.detach(); @@ -1791,7 +1796,7 @@ PreconditionChebyshev::initialize (const MATRIX &matrix, cg_data.compute_eigenvalues = true; SolverCG solver (control, memory, cg_data); internal::PreconditionChebyshev::DiagonalPreconditioner - preconditioner(data.matrix_diagonal_inverse); + preconditioner(data.matrix_diagonal_inverse); try { solver.solve(matrix, *dummy, *rhs, preconditioner); diff --git a/deal.II/include/deal.II/lac/precondition_block.h b/deal.II/include/deal.II/lac/precondition_block.h index 4685d476a9..a2d4e1cded 100644 --- a/deal.II/include/deal.II/lac/precondition_block.h +++ b/deal.II/include/deal.II/lac/precondition_block.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__precondition_block_h #define __deal2__precondition_block_h @@ -1122,7 +1127,7 @@ Accessor (const PreconditionBlockJacobi *matrix, template inline -typename PreconditionBlockJacobi::size_type +typename PreconditionBlockJacobi::size_type PreconditionBlockJacobi::const_iterator::Accessor::row() const { Assert (a_block < matrix->size(), diff --git a/deal.II/include/deal.II/lac/precondition_block.templates.h b/deal.II/include/deal.II/lac/precondition_block.templates.h index fd784c4628..17dfe41f86 100644 --- a/deal.II/include/deal.II/lac/precondition_block.templates.h +++ b/deal.II/include/deal.II/lac/precondition_block.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__precondition_block_templates_h #define __deal2__precondition_block_templates_h @@ -858,8 +863,8 @@ void PreconditionBlockSOR::backward ( { const size_type column = entry->column(); const size_type inverse_permuted_column = permuted - ? this->inverse_permutation[column] - : column; + ? this->inverse_permutation[column] + : column; if (inverse_permuted_column >= block_end) b_cell_row -= entry->value() * dst(column); else if (!this->inverses_ready() && column >= block_start) diff --git a/deal.II/include/deal.II/lac/precondition_block_base.h b/deal.II/include/deal.II/lac/precondition_block_base.h index ed33f34c22..ae9a142d61 100644 --- a/deal.II/include/deal.II/lac/precondition_block_base.h +++ b/deal.II/include/deal.II/lac/precondition_block_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__precondition_block_base_h #define __deal2__precondition_block_base_h diff --git a/deal.II/include/deal.II/lac/precondition_selector.h b/deal.II/include/deal.II/lac/precondition_selector.h index d4451c3fe8..21fe9100bc 100644 --- a/deal.II/include/deal.II/lac/precondition_selector.h +++ b/deal.II/include/deal.II/lac/precondition_selector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__precondition_selector_h #define __deal2__precondition_selector_h diff --git a/deal.II/include/deal.II/lac/relaxation_block.h b/deal.II/include/deal.II/lac/relaxation_block.h index 18f8002392..6e6bb9bb15 100644 --- a/deal.II/include/deal.II/lac/relaxation_block.h +++ b/deal.II/include/deal.II/lac/relaxation_block.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__relaxation_block_h #define __deal2__relaxation_block_h diff --git a/deal.II/include/deal.II/lac/relaxation_block.templates.h b/deal.II/include/deal.II/lac/relaxation_block.templates.h index 357e44af33..621ed76280 100644 --- a/deal.II/include/deal.II/lac/relaxation_block.templates.h +++ b/deal.II/include/deal.II/lac/relaxation_block.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__relaxation_block_templates_h #define __deal2__relaxation_block_templates_h @@ -216,10 +221,10 @@ RelaxationBlock::do_step ( // Apply inverse diagonal this->inverse_vmult(block, x_cell, b_cell); #ifdef DEBUG - for (unsigned int i=0;iblock_list.begin(block); diff --git a/deal.II/include/deal.II/lac/schur_matrix.h b/deal.II/include/deal.II/lac/schur_matrix.h index a973ecf198..7d1a02a3dc 100644 --- a/deal.II/include/deal.II/lac/schur_matrix.h +++ b/deal.II/include/deal.II/lac/schur_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__schur_matrix_h #define __deal2__schur_matrix_h @@ -222,7 +227,7 @@ SchurMatrix const MDt &Dt, const MC &C, VectorMemory > &mem, - const std::vector &signature) + const std::vector &signature) : Ainv(&Ainv), B(&B), Dt(&Dt), C(&C), mem(mem), signature(signature), diff --git a/deal.II/include/deal.II/lac/shifted_matrix.h b/deal.II/include/deal.II/lac/shifted_matrix.h index 185c0d1279..6e1a8655e9 100644 --- a/deal.II/include/deal.II/lac/shifted_matrix.h +++ b/deal.II/include/deal.II/lac/shifted_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__shifted_matrix_h #define __deal2__shifted_matrix_h diff --git a/deal.II/include/deal.II/lac/slepc_solver.h b/deal.II/include/deal.II/lac/slepc_solver.h index 9caa475ba6..184164369d 100644 --- a/deal.II/include/deal.II/lac/slepc_solver.h +++ b/deal.II/include/deal.II/lac/slepc_solver.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Author: Toby D. Young, Polish Academy of Sciences, 2008-2013 +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009-2013 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__slepc_solver_h #define __deal2__slepc_solver_h @@ -115,11 +119,6 @@ namespace SLEPcWrappers class SolverBase { public: - /** - * Declare type for container size. - */ - typedef types::global_dof_index size_type; - /** * Constructor. Takes the MPI communicator over which parallel * computations are to happen. @@ -157,7 +156,7 @@ namespace SLEPcWrappers solve (const PETScWrappers::MatrixBase &A, std::vector &eigenvalues, std::vector &eigenvectors, - const size_type n_eigenpairs = 1); + const unsigned int n_eigenpairs = 1); /** * Same as above, but here a composite method for solving the @@ -170,7 +169,7 @@ namespace SLEPcWrappers const PETScWrappers::MatrixBase &B, std::vector &eigenvalues, std::vector &eigenvectors, - const size_type n_eigenpairs = 1); + const unsigned int n_eigenpairs = 1); /** * Same as above, but here a composite method for solving the @@ -232,7 +231,7 @@ namespace SLEPcWrappers * deal.II's own SolverControl objects to see if convergence has * been reached. */ - void + void get_solver_state (const SolverControl::State state); /** @@ -293,14 +292,15 @@ namespace SLEPcWrappers EPS *get_eps (); /** - * Solve the linear system for n_eigenpairs + * Solve the linear system for n_eigenpairs * eigenstates. Parameter n_converged contains the - * actual number of eigenstates that have . converged; this can + * actual number of eigenstates that have converged; this can * be both fewer or more than n_eigenpairs, depending on the * SLEPc eigensolver used. */ void - solve (const unsigned int n_eigenpairs, unsigned int *n_converged); + solve (const unsigned int n_eigenpairs, + unsigned int *n_converged); /** * Access the real parts of solutions for a solved eigenvector @@ -721,8 +721,8 @@ namespace SLEPcWrappers * change that. */ SolverLAPACK (SolverControl &cn, - const MPI_Comm &mpi_communicator = PETSC_COMM_SELF, - const AdditionalData &data = AdditionalData()); + const MPI_Comm &mpi_communicator = PETSC_COMM_SELF, + const AdditionalData &data = AdditionalData()); protected: @@ -746,122 +746,122 @@ namespace SLEPcWrappers // todo: The logic of these functions can be simplified without breaking backward compatibility... template - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - std::vector &eigenvalues, - std::vector &eigenvectors, - const size_type n_eigenpairs) - { - // Panic if the number of eigenpairs wanted is out of bounds. - AssertThrow ((n_eigenpairs > 0) && (n_eigenpairs <= A.m ()), - ExcSLEPcWrappersUsageError()); - - // Set the matrices of the problem - set_matrices (A); - - // and solve - size_type n_converged = 0; - solve (n_eigenpairs, &n_converged); - - if (n_converged > n_eigenpairs) - n_converged = n_eigenpairs; - AssertThrow (n_converged == n_eigenpairs, - ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); - - AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); - eigenvectors.resize (n_converged, eigenvectors.front()); - eigenvalues.resize (n_converged); - - for (size_type index=0; index &eigenvalues, + std::vector &eigenvectors, + const unsigned int n_eigenpairs) + { + // Panic if the number of eigenpairs wanted is out of bounds. + AssertThrow ((n_eigenpairs > 0) && (n_eigenpairs <= A.m ()), + ExcSLEPcWrappersUsageError()); + + // Set the matrices of the problem + set_matrices (A); + + // and solve + unsigned int n_converged = 0; + solve (n_eigenpairs, &n_converged); + + if (n_converged > n_eigenpairs) + n_converged = n_eigenpairs; + AssertThrow (n_converged == n_eigenpairs, + ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); + + AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); + eigenvectors.resize (n_converged, eigenvectors.front()); + eigenvalues.resize (n_converged); + + for (unsigned int index=0; index - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - const PETScWrappers::MatrixBase &B, - std::vector &eigenvalues, - std::vector &eigenvectors, - const size_type n_eigenpairs) - { - // Guard against incompatible matrix sizes: - AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); - AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); - - // Panic if the number of eigenpairs wanted is out of bounds. - AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), - ExcSLEPcWrappersUsageError()); - - // Set the matrices of the problem - set_matrices (A, B); - - // and solve - size_type n_converged = 0; - solve (n_eigenpairs, &n_converged); - - if (n_converged>=n_eigenpairs) - n_converged = n_eigenpairs; - - AssertThrow (n_converged==n_eigenpairs, - ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); - AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); - - eigenvectors.resize (n_converged, eigenvectors.front()); - eigenvalues.resize (n_converged); - - for (size_type index=0; index &eigenvalues, + std::vector &eigenvectors, + const unsigned int n_eigenpairs) + { + // Guard against incompatible matrix sizes: + AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); + AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); + + // Panic if the number of eigenpairs wanted is out of bounds. + AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), + ExcSLEPcWrappersUsageError()); + + // Set the matrices of the problem + set_matrices (A, B); + + // and solve + unsigned int n_converged = 0; + solve (n_eigenpairs, &n_converged); + + if (n_converged>=n_eigenpairs) + n_converged = n_eigenpairs; + + AssertThrow (n_converged==n_eigenpairs, + ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); + AssertThrow (eigenvectors.size() != 0, ExcSLEPcWrappersUsageError()); + + eigenvectors.resize (n_converged, eigenvectors.front()); + eigenvalues.resize (n_converged); + + for (unsigned int index=0; index - void - SolverBase::solve (const PETScWrappers::MatrixBase &A, - const PETScWrappers::MatrixBase &B, - std::vector &real_eigenvalues, - std::vector &imag_eigenvalues, - std::vector &real_eigenvectors, - std::vector &imag_eigenvectors, - const size_type n_eigenpairs) - { - // Guard against incompatible matrix sizes: - AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); - AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); - - // and incompatible eigenvalue/eigenvector sizes - AssertThrow (real_eigenvalues.size() == imag_eigenvalues.size(), - ExcDimensionMismatch(real_eigenvalues.size(), imag_eigenvalues.size())); - AssertThrow (real_eigenvectors.size() == imag_eigenvectors.n (), - ExcDimensionMismatch(real_eigenvectors.size(), imag_eigenvectors.size())); - - // Panic if the number of eigenpairs wanted is out of bounds. - AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), - ExcSLEPcWrappersUsageError()); - - // Set the matrices of the problem - set_matrices (A, B); - - // and solve - size_type n_converged = 0; - solve (n_eigenpairs, &n_converged); - - if (n_converged>=n_eigenpairs) - n_converged = n_eigenpairs; - - AssertThrow (n_converged==n_eigenpairs, - ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); - AssertThrow ((real_eigenvectors.size()!=0) && (imag_eigenvectors.size()!=0), - ExcSLEPcWrappersUsageError()); - - real_eigenvectors.resize (n_converged, real_eigenvectors.front()); - imag_eigenvectors.resize (n_converged, imag_eigenvectors.front()); - real_eigenvalues.resize (n_converged); - imag_eigenvalues.resize (n_converged); - - for (size_type index=0; index &real_eigenvalues, + std::vector &imag_eigenvalues, + std::vector &real_eigenvectors, + std::vector &imag_eigenvectors, + const unsigned int n_eigenpairs) + { + // Guard against incompatible matrix sizes: + AssertThrow (A.m() == B.m (), ExcDimensionMismatch(A.m(), B.m())); + AssertThrow (A.n() == B.n (), ExcDimensionMismatch(A.n(), B.n())); + + // and incompatible eigenvalue/eigenvector sizes + AssertThrow (real_eigenvalues.size() == imag_eigenvalues.size(), + ExcDimensionMismatch(real_eigenvalues.size(), imag_eigenvalues.size())); + AssertThrow (real_eigenvectors.size() == imag_eigenvectors.n (), + ExcDimensionMismatch(real_eigenvectors.size(), imag_eigenvectors.size())); + + // Panic if the number of eigenpairs wanted is out of bounds. + AssertThrow ((n_eigenpairs>0) && (n_eigenpairs<=A.m ()), + ExcSLEPcWrappersUsageError()); + + // Set the matrices of the problem + set_matrices (A, B); + + // and solve + unsigned int n_converged = 0; + solve (n_eigenpairs, &n_converged); + + if (n_converged>=n_eigenpairs) + n_converged = n_eigenpairs; + + AssertThrow (n_converged==n_eigenpairs, + ExcSLEPcEigenvectorConvergenceMismatchError(n_converged, n_eigenpairs)); + AssertThrow ((real_eigenvectors.size()!=0) && (imag_eigenvectors.size()!=0), + ExcSLEPcWrappersUsageError()); + + real_eigenvectors.resize (n_converged, real_eigenvectors.front()); + imag_eigenvectors.resize (n_converged, imag_eigenvectors.front()); + real_eigenvalues.resize (n_converged); + imag_eigenvalues.resize (n_converged); + + for (unsigned int index=0; indexeigensolver: * @code * // Set a transformation, this one shifts the eigenspectrum by 3.142.. - * SLEPcWrappers::TransformationShift::AdditionalData additional_data (3.142); + * SLEPcWrappers::TransformationShift::AdditionalData additional_data (3.142); * SLEPcWrappers::TransformationShift shift (additional_data); * eigensolver.set_transformation (shift); * @endcode @@ -53,7 +57,7 @@ namespace SLEPcWrappers * SolverArnoldi system (solver_control, mpi_communicator); * eigensolver.solve (A, B, lambda, x, size_of_spectrum); * @endcode - * + * * @note These options can also be set at the commandline. * * @ingroup SLEPcWrappers diff --git a/deal.II/include/deal.II/lac/solver.h b/deal.II/include/deal.II/lac/solver.h index ac1c2942e5..aeee863fcf 100644 --- a/deal.II/include/deal.II/lac/solver.h +++ b/deal.II/include/deal.II/lac/solver.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_h #define __deal2__solver_h diff --git a/deal.II/include/deal.II/lac/solver_bicgstab.h b/deal.II/include/deal.II/lac/solver_bicgstab.h index f81d517d52..98d65a7646 100644 --- a/deal.II/include/deal.II/lac/solver_bicgstab.h +++ b/deal.II/include/deal.II/lac/solver_bicgstab.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_bicgstab_h #define __deal2__solver_bicgstab_h diff --git a/deal.II/include/deal.II/lac/solver_cg.h b/deal.II/include/deal.II/lac/solver_cg.h index 9881b68547..3f31cdce72 100644 --- a/deal.II/include/deal.II/lac/solver_cg.h +++ b/deal.II/include/deal.II/lac/solver_cg.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_cg_h #define __deal2__solver_cg_h diff --git a/deal.II/include/deal.II/lac/solver_control.h b/deal.II/include/deal.II/lac/solver_control.h index 7b9eb3ff2f..7116304470 100644 --- a/deal.II/include/deal.II/lac/solver_control.h +++ b/deal.II/include/deal.II/lac/solver_control.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_control_h #define __deal2__solver_control_h diff --git a/deal.II/include/deal.II/lac/solver_gmres.h b/deal.II/include/deal.II/lac/solver_gmres.h index 936b9a1a02..902b00493b 100644 --- a/deal.II/include/deal.II/lac/solver_gmres.h +++ b/deal.II/include/deal.II/lac/solver_gmres.h @@ -1,14 +1,19 @@ -//---------------------------- solver_gmres.h --------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- solver_gmres.h --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_gmres_h #define __deal2__solver_gmres_h @@ -705,7 +710,7 @@ SolverGMRES::solve (const MATRIX &A, precondition.vmult(vv,p); } else - { + { precondition.vmult(p, tmp_vectors[inner_iteration]); A.vmult(vv,p); }; diff --git a/deal.II/include/deal.II/lac/solver_minres.h b/deal.II/include/deal.II/lac/solver_minres.h index 4cb4650603..37934f4f04 100644 --- a/deal.II/include/deal.II/lac/solver_minres.h +++ b/deal.II/include/deal.II/lac/solver_minres.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_minres_h #define __deal2__solver_minres_h diff --git a/deal.II/include/deal.II/lac/solver_qmrs.h b/deal.II/include/deal.II/lac/solver_qmrs.h index 12b1266d73..1cce088b84 100644 --- a/deal.II/include/deal.II/lac/solver_qmrs.h +++ b/deal.II/include/deal.II/lac/solver_qmrs.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_qmrs_h #define __deal2__solver_qmrs_h diff --git a/deal.II/include/deal.II/lac/solver_relaxation.h b/deal.II/include/deal.II/lac/solver_relaxation.h index dd38286392..6a78113b5e 100644 --- a/deal.II/include/deal.II/lac/solver_relaxation.h +++ b/deal.II/include/deal.II/lac/solver_relaxation.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_relaxation_h #define __deal2__solver_relaxation_h diff --git a/deal.II/include/deal.II/lac/solver_richardson.h b/deal.II/include/deal.II/lac/solver_richardson.h index e7c4c27dd3..fd881aeb6d 100644 --- a/deal.II/include/deal.II/lac/solver_richardson.h +++ b/deal.II/include/deal.II/lac/solver_richardson.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_richardson_h #define __deal2__solver_richardson_h diff --git a/deal.II/include/deal.II/lac/solver_selector.h b/deal.II/include/deal.II/lac/solver_selector.h index 39bfaddec7..b027bb34c7 100644 --- a/deal.II/include/deal.II/lac/solver_selector.h +++ b/deal.II/include/deal.II/lac/solver_selector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solver_selector_h #define __deal2__solver_selector_h diff --git a/deal.II/include/deal.II/lac/sparse_decomposition.h b/deal.II/include/deal.II/lac/sparse_decomposition.h index a0bb68cf4a..b92e2712d6 100644 --- a/deal.II/include/deal.II/lac/sparse_decomposition.h +++ b/deal.II/include/deal.II/lac/sparse_decomposition.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2012 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_decomposition_h #define __deal2__sparse_decomposition_h diff --git a/deal.II/include/deal.II/lac/sparse_decomposition.templates.h b/deal.II/include/deal.II/lac/sparse_decomposition.templates.h index c5426eae00..278929f843 100644 --- a/deal.II/include/deal.II/lac/sparse_decomposition.templates.h +++ b/deal.II/include/deal.II/lac/sparse_decomposition.templates.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2011, 2012, 2013 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 2002 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_decomposition_templates_h #define __deal2__sparse_decomposition_templates_h @@ -173,19 +179,19 @@ void SparseLUDecomposition::prebuild_lower_bound() { const size_type *const - column_numbers = this->get_sparsity_pattern().colnums; + column_numbers = this->get_sparsity_pattern().colnums; const std::size_t *const - rowstart_indices = this->get_sparsity_pattern().rowstart; + rowstart_indices = this->get_sparsity_pattern().rowstart; const size_type N = this->m(); - - prebuilt_lower_bound.resize (N); - - for (size_type row=0; row::copy_from (const SparseMatrix &matrix { typename SparseMatrix::iterator index = this->begin(row); typename SparseMatrix::const_iterator - in_index = matrix.begin(row); + in_index = matrix.begin(row); index->value() = in_index->value(); ++index, ++in_index; while (index < this->end(row) && in_index < matrix.end(row)) diff --git a/deal.II/include/deal.II/lac/sparse_direct.h b/deal.II/include/deal.II/lac/sparse_direct.h index d099df543a..8ef14a7a38 100644 --- a/deal.II/include/deal.II/lac/sparse_direct.h +++ b/deal.II/include/deal.II/lac/sparse_direct.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_direct_h #define __deal2__sparse_direct_h @@ -108,7 +113,7 @@ public: /** * @{ */ - + /** * This function does nothing. It is only here to provide a interface * consistent with other sparse direct solvers. @@ -153,10 +158,10 @@ public: /** * @{ */ - + /** * Preconditioner interface function. Usually, given the source vector, - * this method returns an approximated solution of Ax = b. As this + * this method returns an approximate solution of Ax = b. As this * class provides a wrapper to a direct solver, here it is actually the * exact solution (exact within the range of numerical accuracy of * course). @@ -165,33 +170,41 @@ public: * inverse of the matrix, $A^{-1}$. */ void vmult (Vector &dst, - const Vector &src) const; + const Vector &src) const; /** * Same as before, but for block vectors. */ void vmult (BlockVector &dst, - const BlockVector &src) const; + const BlockVector &src) const; /** - * Not implemented but necessary for compiling certain other classes. + * Same as before, but uses the transpose of the matrix, i.e. this + * function multiplies with $A^{-T}$. */ void Tvmult (Vector &dst, - const Vector &src) const; + const Vector &src) const; + + /** + * Same as before, but for block vectors + */ + void Tvmult (BlockVector &dst, + const BlockVector &src) const; /** * Same as vmult(), but adding to the previous solution. Not implemented * yet but necessary for compiling certain other classes. */ void vmult_add (Vector &dst, - const Vector &src) const; + const Vector &src) const; /** - * Not implemented but necessary for compiling certain other classes. + * Same as before, but uses the transpose of the matrix, i.e. this + * function multiplies with $A^{-T}$. */ void Tvmult_add (Vector &dst, - const Vector &src) const; - + const Vector &src) const; + /** * @} */ @@ -216,14 +229,17 @@ public: * happen. Note that we can't actually call the factorize() function from * here if it has not yet been called, since we have no access to the * actual matrix. + * + * If @p transpose is set to true this function solves for the transpose + * of the matrix, i.e. $x=A^{-T}b$. */ - void solve (Vector &rhs_and_solution) const; + void solve (Vector &rhs_and_solution, bool transpose = false) const; /** * Same as before, but for block vectors. */ - void solve (BlockVector &rhs_and_solution) const; - + void solve (BlockVector &rhs_and_solution, bool transpose = false) const; + /** * Call the two functions factorize() and solve() in that order, i.e. perform * the whole solution process for the given right hand side vector. @@ -232,19 +248,21 @@ public: */ template void solve (const Matrix &matrix, - Vector &rhs_and_solution); + Vector &rhs_and_solution, + bool transpose = false); /** * Same as before, but for block vectors. */ template void solve (const Matrix &matrix, - BlockVector &rhs_and_solution); + BlockVector &rhs_and_solution, + bool transpose = false); /** * @} */ - + /** * One of the UMFPack routines threw an error. The error code is included * in the output and can be looked up in the UMFPack user manual. The @@ -253,8 +271,8 @@ public: DeclException2 (ExcUMFPACKError, char *, int, << "UMFPACK routine " << arg1 << " returned error status " << arg2 - << ". See the file " - << " for a description of error codes."); + << ". See the file " + << " for a description of 'status codes'."); private: /** diff --git a/deal.II/include/deal.II/lac/sparse_ilu.h b/deal.II/include/deal.II/lac/sparse_ilu.h index 3465cd7665..a609bbbe12 100644 --- a/deal.II/include/deal.II/lac/sparse_ilu.h +++ b/deal.II/include/deal.II/lac/sparse_ilu.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2012 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 1999 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_ilu_h #define __deal2__sparse_ilu_h diff --git a/deal.II/include/deal.II/lac/sparse_ilu.templates.h b/deal.II/include/deal.II/lac/sparse_ilu.templates.h index 10d4acb4b3..ffffd2914c 100644 --- a/deal.II/include/deal.II/lac/sparse_ilu.templates.h +++ b/deal.II/include/deal.II/lac/sparse_ilu.templates.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2011, 2012 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 1999 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_ilu_templates_h #define __deal2__sparse_ilu_templates_h diff --git a/deal.II/include/deal.II/lac/sparse_matrix.h b/deal.II/include/deal.II/lac/sparse_matrix.h index 0419e4d371..79b71911ac 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix.h +++ b/deal.II/include/deal.II/lac/sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_matrix_h #define __deal2__sparse_matrix_h @@ -708,7 +713,7 @@ public: * object. See MemoryConsumption. */ std::size_t memory_consumption () const; - + /** * Dummy function for compatibility with distributed, parallel matrices. */ @@ -944,7 +949,7 @@ public: SparseMatrix & copy_from (const TrilinosWrappers::SparseMatrix &matrix); #endif - + /** * Add matrix scaled by factor to this matrix, i.e. the * matrix factor*matrix is added to this. This function @@ -1476,13 +1481,18 @@ public: //@{ /** - * Print the matrix to the given stream, using the format (row,column) - * value, i.e. one nonzero entry of the matrix per line. If @p across - * is true, print all entries on a single line, using the format - * row,column:value + * Print the matrix to the given stream, using the format + * (row,column) value, i.e. one nonzero entry of the matrix + * per line. If across is true, print all entries on a + * single line, using the format row,column:value. + * + * If the argument diagonal_first is true, diagonal + * elements of quadratic matrices are printed first in their row, + * corresponding to the internal storage scheme. If it is false, the + * elements in a row are written in ascending column order. */ template - void print (STREAM &out, bool across=false) const; + void print (STREAM &out, bool across=false, bool diagonal_first=true) const; /** * Print the matrix in the usual format, i.e. as a matrix and not as a list @@ -2464,22 +2474,50 @@ SparseMatrix::end (const size_type r) template template inline -void SparseMatrix::print (STREAM &out, bool across) const +void SparseMatrix::print (STREAM &out, bool across, bool diagonal_first) const { Assert (cols != 0, ExcNotInitialized()); Assert (val != 0, ExcNotInitialized()); - if (across) + bool hanging_diagonal = false; + number diagonal; + + for (size_type i=0; irows; ++i) { - for (size_type i=0; irows; ++i) - for (size_type j=cols->rowstart[i]; jrowstart[i+1]; ++j) - out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; - out << std::endl; - } - else - for (size_type i=0; irows; ++i) for (size_type j=cols->rowstart[i]; jrowstart[i+1]; ++j) - out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; + { + if (!diagonal_first && i == cols->colnums[j]) + { + diagonal = val[j]; + hanging_diagonal = true; + } + else + { + if (hanging_diagonal && cols->colnums[j]>i) + { + if (across) + out << ' ' << i << ',' << i << ':' << diagonal; + else + out << '(' << i << ',' << i << ") " << diagonal << std::endl; + hanging_diagonal = false; + } + if (across) + out << ' ' << i << ',' << cols->colnums[j] << ':' << val[j]; + else + out << "(" << i << "," << cols->colnums[j] << ") " << val[j] << std::endl; + } + } + if (hanging_diagonal) + { + if (across) + out << ' ' << i << ',' << i << ':' << diagonal; + else + out << '(' << i << ',' << i << ") " << diagonal << std::endl; + hanging_diagonal = false; + } + } + if (across) + out << std::endl; } diff --git a/deal.II/include/deal.II/lac/sparse_matrix.templates.h b/deal.II/include/deal.II/lac/sparse_matrix.templates.h index dbb8b38cdc..e007579833 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix.templates.h +++ b/deal.II/include/deal.II/lac/sparse_matrix.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_matrix_templates_h #define __deal2__sparse_matrix_templates_h @@ -245,7 +250,7 @@ SparseMatrix::empty () const template -typename SparseMatrix::size_type +typename SparseMatrix::size_type SparseMatrix::get_row_length (const size_type row) const { Assert (cols != 0, ExcNotInitialized()); @@ -255,7 +260,7 @@ SparseMatrix::get_row_length (const size_type row) const template -typename SparseMatrix::size_type +typename SparseMatrix::size_type SparseMatrix::n_nonzero_elements () const { Assert (cols != 0, ExcNotInitialized()); @@ -265,7 +270,7 @@ SparseMatrix::n_nonzero_elements () const template -typename SparseMatrix::size_type +typename SparseMatrix::size_type SparseMatrix::n_actually_nonzero_elements (const double threshold) const { Assert (cols != 0, ExcNotInitialized()); @@ -361,7 +366,7 @@ SparseMatrix::copy_from (const TrilinosWrappers::SparseMatrix &matrix) { Assert (m() == matrix.m(), ExcDimensionMismatch(m(), matrix.m())); Assert (n() == matrix.n(), ExcDimensionMismatch(n(), matrix.n())); - + // first delete previous content *this = 0; @@ -377,10 +382,10 @@ SparseMatrix::copy_from (const TrilinosWrappers::SparseMatrix &matrix) // length of the row int ncols; int ierr - = matrix.trilinos_matrix().ExtractGlobalRowCopy - (row, matrix.row_length(row), ncols, - &(value_cache[0]), - reinterpret_cast(&(colnum_cache[0]))); + = matrix.trilinos_matrix().ExtractGlobalRowCopy + (row, matrix.row_length(row), ncols, + &(value_cache[0]), + reinterpret_cast(&(colnum_cache[0]))); Assert (ierr==0, ExcTrilinosError(ierr)); // resize arrays to the size actually used @@ -389,8 +394,8 @@ SparseMatrix::copy_from (const TrilinosWrappers::SparseMatrix &matrix) // then copy everything in one swoop this->set(row, - colnum_cache, - value_cache); + colnum_cache, + value_cache); } return *this; @@ -414,7 +419,7 @@ SparseMatrix::add (const number factor, const number *const end_ptr = &val[cols->n_nonzero_elements()]; while (val_ptr != end_ptr) - *val_ptr++ += factor * *matrix_ptr++; + *val_ptr++ += factor **matrix_ptr++; } @@ -982,9 +987,9 @@ SparseMatrix::mmult (SparseMatrix &C, { const size_type col = *rows; size_type *new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[col]]); + (&sp_B.colnums[sp_B.rowstart[col]]); size_type *end_new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[col+1]]); + (&sp_B.colnums[sp_B.rowstart[col+1]]); // if B has a diagonal, need to add that manually. this way, // we maintain sortedness. @@ -1047,7 +1052,7 @@ SparseMatrix::mmult (SparseMatrix &C, &B.val[new_cols-&sp_B.colnums[sp_B.rowstart[0]]]; const numberB *const end_cols = &B.val[sp_B.rowstart[col+1]]; for (; B_val_ptr != end_cols; ++B_val_ptr) - *new_ptr++ = A_val * *B_val_ptr * (use_vector ? V(col) : 1); + *new_ptr++ = A_val **B_val_ptr * (use_vector ? V(col) : 1); C.add (i, new_ptr-&new_entries[0], new_cols, &new_entries[0], false, true); @@ -1107,10 +1112,10 @@ SparseMatrix::Tmmult (SparseMatrix &C, const size_type *const end_rows = &sp_A.colnums[sp_A.rowstart[i+1]]; // cast away constness to conform with csp.add_entries interface - size_type *new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[i]]); - size_type *end_new_cols = const_cast - (&sp_B.colnums[sp_B.rowstart[i+1]]); + size_type *new_cols = const_cast + (&sp_B.colnums[sp_B.rowstart[i]]); + size_type *end_new_cols = const_cast + (&sp_B.colnums[sp_B.rowstart[i+1]]); if (sp_B.n_rows() == sp_B.n_cols()) ++new_cols; @@ -1177,7 +1182,7 @@ SparseMatrix::Tmmult (SparseMatrix &C, const numberB *B_val_ptr = &B.val[new_cols-&sp_B.colnums[sp_B.rowstart[0]]]; for (; B_val_ptr != end_cols; ++B_val_ptr) - *new_ptr++ = A_val * *B_val_ptr * (use_vector ? V(i) : 1); + *new_ptr++ = A_val **B_val_ptr * (use_vector ? V(i) : 1); C.add (row, new_ptr-&new_entries[0], new_cols, &new_entries[0], false, true); @@ -1352,7 +1357,7 @@ SparseMatrix::precondition_Jacobi (Vector &dst, // square matrix by above assertion if (om != 1.) for (size_type i=0; i *matrix, template inline -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::const_iterator::Accessor::row() const { return a_row; @@ -1142,7 +1147,7 @@ SparseMatrixEZ::const_iterator::Accessor::row() const template inline -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::const_iterator::Accessor::column() const { return matrix->data[matrix->row_info[a_row].start+a_index].column; @@ -1623,7 +1628,7 @@ SparseMatrixEZ::copy_from (const MATRIX &M) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) if (entry->value() != 0) set(row, entry->column(), entry->value()); } @@ -1651,7 +1656,7 @@ SparseMatrixEZ::add (const number factor, { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); - entry != end_row; ++entry) + entry != end_row; ++entry) if (entry->value() != 0) add(row, entry->column(), factor * entry->value()); } diff --git a/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h b/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h index 4c1f6b7386..eac1a95b32 100644 --- a/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h +++ b/deal.II/include/deal.II/lac/sparse_matrix_ez.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_matrix_ez_templates_h #define __deal2__sparse_matrix_ez_templates_h @@ -254,7 +259,7 @@ SparseMatrixEZ::precondition_Jacobi (Vector &dst, for (; ri != end; ++dst_ptr, ++src_ptr, ++ri) { Assert (ri->diagonal != RowInfo::invalid_diagonal, ExcNoDiagonal()); - *dst_ptr = om * *src_ptr / data[ri->start + ri->diagonal].value; + *dst_ptr = om **src_ptr / data[ri->start + ri->diagonal].value; } } @@ -388,7 +393,7 @@ SparseMatrixEZ::memory_consumption() const template -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::get_row_length (const size_type row) const { return row_info[row].length; @@ -397,7 +402,7 @@ SparseMatrixEZ::get_row_length (const size_type row) const template -typename SparseMatrixEZ::size_type +typename SparseMatrixEZ::size_type SparseMatrixEZ::n_nonzero_elements() const { typename std::vector::const_iterator row = row_info.begin(); diff --git a/deal.II/include/deal.II/lac/sparse_mic.h b/deal.II/include/deal.II/lac/sparse_mic.h index fe82ff2bea..a7ceb20fef 100644 --- a/deal.II/include/deal.II/lac/sparse_mic.h +++ b/deal.II/include/deal.II/lac/sparse_mic.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 2002 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_mic_h #define __deal2__sparse_mic_h diff --git a/deal.II/include/deal.II/lac/sparse_mic.templates.h b/deal.II/include/deal.II/lac/sparse_mic.templates.h index c35d9cafa7..dd9cd57c64 100644 --- a/deal.II/include/deal.II/lac/sparse_mic.templates.h +++ b/deal.II/include/deal.II/lac/sparse_mic.templates.h @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2011, 2012, 2013 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 2002 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_mic_templates_h #define __deal2__sparse_mic_templates_h diff --git a/deal.II/include/deal.II/lac/sparse_vanka.h b/deal.II/include/deal.II/lac/sparse_vanka.h index 0ae7bcb75c..fba90664de 100644 --- a/deal.II/include/deal.II/lac/sparse_vanka.h +++ b/deal.II/include/deal.II/lac/sparse_vanka.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_vanka_h #define __deal2__sparse_vanka_h diff --git a/deal.II/include/deal.II/lac/sparse_vanka.templates.h b/deal.II/include/deal.II/lac/sparse_vanka.templates.h index d8586758bd..de72b05d8a 100644 --- a/deal.II/include/deal.II/lac/sparse_vanka.templates.h +++ b/deal.II/include/deal.II/lac/sparse_vanka.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparse_vanka_templates_h #define __deal2__sparse_vanka_templates_h @@ -67,10 +72,10 @@ SparseVanka::compute_inverses () #else const size_type n_inverses = std::count (selected.begin(), selected.end(), - true); + true); - const size_type n_inverses_per_thread = std::max(n_inverses / n_threads, - static_cast (1U)); + const size_type n_inverses_per_thread = std::max(n_inverses / n_threads, + static_cast (1U)); // set up start and end index // for each of the @@ -288,7 +293,7 @@ SparseVanka::apply_preconditioner (Vector &dst, // number of DoFs coupling to // irow (including irow itself) for (typename SparseMatrix::const_iterator p=matrix->begin(row); - p != matrix->end(row); ++p) + p != matrix->end(row); ++p) { // find out whether this DoF // (that couples with @p irow, @@ -391,8 +396,8 @@ SparseBlockVanka::compute_dof_masks (const SparseMatrix &M, selected.end(), true); - const size_type n_inverses_per_block = std::max(n_inverses / n_blocks, - static_cast (1U)); + const size_type n_inverses_per_block = std::max(n_inverses / n_blocks, + static_cast (1U)); // precompute the splitting points std::vector > intervals (n_blocks); diff --git a/deal.II/include/deal.II/lac/sparsity_pattern.h b/deal.II/include/deal.II/lac/sparsity_pattern.h index 48c1a4e67a..ada6bbf528 100644 --- a/deal.II/include/deal.II/lac/sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/sparsity_pattern.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparsity_pattern_h #define __deal2__sparsity_pattern_h @@ -61,7 +66,7 @@ namespace internals * the copy_from() function, if the inner iterator type points to plain * unsigned integers. */ - size_type + size_type get_column_index_from_iterator (const size_type i); /** @@ -70,7 +75,7 @@ namespace internals * unsigned integers and some other value. */ template - size_type + size_type get_column_index_from_iterator (const std::pair &i); /** @@ -79,7 +84,7 @@ namespace internals * std::map). */ template - size_type + size_type get_column_index_from_iterator (const std::pair &i); } @@ -1142,7 +1147,7 @@ public: /** * Write the data of this object en bloc to a file. This is done in a binary * mode, so the output is neither readable by humans nor (probably) by other - * computers using a different operating system of number format. + * computers using a different operating system or number format. * * The purpose of this function is that you can swap out matrices and * sparsity pattern if you are short of memory, want to communicate between @@ -1390,7 +1395,7 @@ private: * r are stored within the index range * #rowstart[r]...#rowstart[r+1]. Therefore to find out * whether a given element (r,c) exists, we have to check whether the - * column number c exists in the abovementioned range within this + * column number c exists in the above-mentioned range within this * array. If it exists, say at position p within this array, the * value of the respective element in the sparse matrix will also be at * position p of the values array of that class. @@ -1488,12 +1493,12 @@ namespace SparsityPatternIterators inline - size_type + size_type Accessor::row() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); - const std::size_t * insert_point = + const std::size_t *insert_point = std::upper_bound(sparsity_pattern->rowstart, sparsity_pattern->rowstart + sparsity_pattern->rows + 1, index_within_sparsity); @@ -1502,7 +1507,7 @@ namespace SparsityPatternIterators inline - size_type + size_type Accessor::column() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); @@ -1512,7 +1517,7 @@ namespace SparsityPatternIterators inline - size_type + size_type Accessor::index() const { Assert (is_valid_entry() == true, ExcInvalidIterator()); @@ -1710,7 +1715,7 @@ SparsityPattern::row_end (const size_type r) const inline -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::n_rows () const { return rows; @@ -1718,7 +1723,7 @@ SparsityPattern::n_rows () const inline -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::n_cols () const { return cols; @@ -1777,7 +1782,7 @@ SparsityPattern::row_length (const size_type row) const inline -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::column_number (const size_type row, const unsigned int index) const { @@ -1864,14 +1869,14 @@ SparsityPattern::operator == (const SparsityPattern &sp2) const namespace internal { namespace SparsityPatternTools - { + { /** * Declare type for container size. */ - typedef types::global_dof_index size_type; - + typedef types::global_dof_index size_type; + inline - size_type + size_type get_column_index_from_iterator (const size_type i) { return i; @@ -1881,7 +1886,7 @@ namespace internal template inline - size_type + size_type get_column_index_from_iterator (const std::pair &i) { return i.first; @@ -1891,7 +1896,7 @@ namespace internal template inline - size_type + size_type get_column_index_from_iterator (const std::pair &i) { return i.first; diff --git a/deal.II/include/deal.II/lac/sparsity_tools.h b/deal.II/include/deal.II/lac/sparsity_tools.h index 9f0777ddd5..860eedfae7 100644 --- a/deal.II/include/deal.II/lac/sparsity_tools.h +++ b/deal.II/include/deal.II/lac/sparsity_tools.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__sparsity_tools_h #define __deal2__sparsity_tools_h @@ -231,7 +236,9 @@ namespace SparsityTools * range of elements stored locally * and should be the one used in * the constructor of the - * CompressedSimpleSparsityPattern. Only + * CompressedSimpleSparsityPattern. + * This should be the locally relevant set. + * Only * rows contained in myrange are * checked in csp for transfer. * This function needs to be used @@ -245,6 +252,19 @@ namespace SparsityTools const std::vector &rows_per_cpu, const MPI_Comm &mpi_comm, const IndexSet &myrange); + + /** + * similar to the function above, but includes support for + * BlockCompressedSimpleSparsityPattern. + * @p owned_set_per_cpu is typically DoFHandler::locally_owned_dofs_per_processor + * and @p myrange are locally_relevant_dofs. + */ + template + void distribute_sparsity_pattern(CSP_t &csp, + const std::vector &owned_set_per_cpu, + const MPI_Comm &mpi_comm, + const IndexSet &myrange); + #endif diff --git a/deal.II/include/deal.II/lac/swappable_vector.h b/deal.II/include/deal.II/lac/swappable_vector.h index 02db61b625..0100ba8b7b 100644 --- a/deal.II/include/deal.II/lac/swappable_vector.h +++ b/deal.II/include/deal.II/lac/swappable_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__swappable_vector_h #define __deal2__swappable_vector_h diff --git a/deal.II/include/deal.II/lac/swappable_vector.templates.h b/deal.II/include/deal.II/lac/swappable_vector.templates.h index 8be2192a61..b73414b239 100644 --- a/deal.II/include/deal.II/lac/swappable_vector.templates.h +++ b/deal.II/include/deal.II/lac/swappable_vector.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__swappable_vector_templates_h #define __deal2__swappable_vector_templates_h diff --git a/deal.II/include/deal.II/lac/transpose_matrix.h b/deal.II/include/deal.II/lac/transpose_matrix.h index eb9e2b78c8..6558e6a3b8 100644 --- a/deal.II/include/deal.II/lac/transpose_matrix.h +++ b/deal.II/include/deal.II/lac/transpose_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__transpose_matrix_h #define __deal2__transpose_matrix_h diff --git a/deal.II/include/deal.II/lac/tridiagonal_matrix.h b/deal.II/include/deal.II/lac/tridiagonal_matrix.h index 0f3d054588..8b31214933 100644 --- a/deal.II/include/deal.II/lac/tridiagonal_matrix.h +++ b/deal.II/include/deal.II/lac/tridiagonal_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__tridiagonal_matrix_h #define __deal2__tridiagonal_matrix_h diff --git a/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h index f9e8eb4f04..99d19b118a 100644 --- a/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_block_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_block_sparse_matrix_h #define __deal2__trilinos_block_sparse_matrix_h diff --git a/deal.II/include/deal.II/lac/trilinos_block_vector.h b/deal.II/include/deal.II/lac/trilinos_block_vector.h index 56e206bf5e..9006b134c2 100644 --- a/deal.II/include/deal.II/lac/trilinos_block_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_block_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_block_vector_h #define __deal2__trilinos_block_vector_h diff --git a/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h b/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h index 8c5408572d..d684216bdc 100644 --- a/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_parallel_block_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_parallel_block_vector_h #define __deal2__trilinos_parallel_block_vector_h @@ -120,7 +125,17 @@ namespace TrilinosWrappers * processes. */ explicit BlockVector (const std::vector ¶llel_partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD); + const MPI_Comm &communicator = MPI_COMM_WORLD); + + /** + * Creates a BlockVector with ghost elements. @p ghost_values + * may contain any elements in @p parallel_partitioning, they will + * be ignored. + */ + BlockVector (const std::vector ¶llel_partitioning, + const std::vector &ghost_values, + const MPI_Comm &communicator); + /** * Copy-Constructor. Set all the @@ -225,6 +240,14 @@ namespace TrilinosWrappers void reinit (const std::vector ¶llel_partitioning, const MPI_Comm &communicator = MPI_COMM_WORLD, const bool fast = false); + /** + * like above, but with a second set of indices for + * ghost entries. + */ + void reinit (const std::vector &partitioning, + const std::vector &ghost_values, + const MPI_Comm &communicator = MPI_COMM_WORLD); + /** * Change the dimension to that @@ -340,6 +363,11 @@ namespace TrilinosWrappers */ bool is_compressed () const; + /** + * Returns if this Vector contains ghost elements. + */ + bool has_ghost_elements() const; + /** * Swap the contents of this * vector and the other vector @@ -418,6 +446,14 @@ namespace TrilinosWrappers } + inline + BlockVector::BlockVector (const std::vector ¶llel_partitioning, + const std::vector &ghost_values, + const MPI_Comm &communicator) + { + reinit(parallel_partitioning, ghost_values, communicator); + } + inline BlockVector::BlockVector (const size_type num_blocks) @@ -497,6 +533,18 @@ namespace TrilinosWrappers } + inline + bool + BlockVector::has_ghost_elements() const + { + bool ghosted=block(0).has_ghost_elements(); +#ifdef DEBUG + for (unsigned int i=0; in_blocks(); ++i) + Assert(block(i).has_ghost_elements()==ghosted, ExcInternalError()); +#endif + return ghosted; + } + inline void BlockVector::swap (BlockVector &v) diff --git a/deal.II/include/deal.II/lac/trilinos_precondition.h b/deal.II/include/deal.II/lac/trilinos_precondition.h index c9a7986d36..3936118d50 100644 --- a/deal.II/include/deal.II/lac/trilinos_precondition.h +++ b/deal.II/include/deal.II/lac/trilinos_precondition.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_precondition_h #define __deal2__trilinos_precondition_h @@ -116,13 +121,13 @@ namespace TrilinosWrappers /** * Apply the preconditioner. */ - void vmult (VectorBase &dst, - const VectorBase &src) const; + virtual void vmult (VectorBase &dst, + const VectorBase &src) const; /** * Apply the transpose preconditioner. */ - void Tvmult (VectorBase &dst, + virtual void Tvmult (VectorBase &dst, const VectorBase &src) const; /** @@ -132,8 +137,8 @@ namespace TrilinosWrappers * in the Trilinos wrapper * class. */ - void vmult (dealii::Vector &dst, - const dealii::Vector &src) const; + virtual void vmult (dealii::Vector &dst, + const dealii::Vector &src) const; /** * Apply the transpose preconditioner on @@ -142,8 +147,8 @@ namespace TrilinosWrappers * in the Trilinos wrapper * class. */ - void Tvmult (dealii::Vector &dst, - const dealii::Vector &src) const; + virtual void Tvmult (dealii::Vector &dst, + const dealii::Vector &src) const; /** * Apply the preconditioner on deal.II @@ -151,8 +156,8 @@ namespace TrilinosWrappers * the ones provided in the Trilinos * wrapper class. */ - void vmult (dealii::parallel::distributed::Vector &dst, - const dealii::parallel::distributed::Vector &src) const; + virtual void vmult (dealii::parallel::distributed::Vector &dst, + const dealii::parallel::distributed::Vector &src) const; /** * Apply the transpose preconditioner on deal.II @@ -160,8 +165,8 @@ namespace TrilinosWrappers * the ones provided in the Trilinos * wrapper class. */ - void Tvmult (dealii::parallel::distributed::Vector &dst, - const dealii::parallel::distributed::Vector &src) const; + virtual void Tvmult (dealii::parallel::distributed::Vector &dst, + const dealii::parallel::distributed::Vector &src) const; /** * Exception. @@ -1503,6 +1508,64 @@ namespace TrilinosWrappers + /** + * A wrapper class for an identity preconditioner for Trilinos matrices. + * + * @ingroup TrilinosWrappers + * @ingroup Preconditioners + * @author Bruno Turcksin, 2013 + */ + class PreconditionIdentity : public PreconditionBase + { + public: + + /** + * Apply the preconditioner, i.e., dst = src. + */ + void vmult (VectorBase &dst, + const VectorBase &src) const; + + /** + * Apply the transport conditioner, i.e., dst = src. + */ + void Tvmult (VectorBase &dst, + const VectorBase &src) const; + + /** + * Apply the preconditioner on deal.II data structures + * instead of the ones provided in the Trilinos wrapper class, + * i.e., dst = src. + */ + void vmult (dealii::Vector &dst, + const dealii::Vector &src) const; + + /** + * Apply the transpose preconditioner on deal.II data structures + * instead of the ones provided in the Trilinos wrapper class, + * i.e. dst = src. + */ + void Tvmult (dealii::Vector &dst, + const dealii::Vector &src) const; + + /** + * Apply the preconditioner on deal.II parallel data structures + * instead of the ones provided in the Trilinos wrapper class, + * i.e., dst = src. + */ + void vmult (parallel::distributed::Vector &dst, + const dealii::parallel::distributed::Vector &src) const; + + /** + * Apply the transpose preconditioner on deal.II parallel data structures + * instead of the ones provided in the Trilinos wrapper class, + * i.e., dst = src. + */ + void Tvmult (parallel::distributed::Vector &dst, + const dealii::parallel::distributed::Vector &src) const; + }; + + + // -------------------------- inline and template functions ---------------------- diff --git a/deal.II/include/deal.II/lac/trilinos_solver.h b/deal.II/include/deal.II/lac/trilinos_solver.h index a0ed043623..1c4ead78a8 100644 --- a/deal.II/include/deal.II/lac/trilinos_solver.h +++ b/deal.II/include/deal.II/lac/trilinos_solver.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_solver_h #define __deal2__trilinos_solver_h @@ -155,6 +160,26 @@ namespace TrilinosWrappers const VectorBase &b, const PreconditionBase &preconditioner); + /** + * Solve the linear system + * Ax=b where A + * is an operator. This function + * can be used for matrix free + * computation. Depending on + * the information provided by + * derived classes and the + * object passed as a + * preconditioner, one of the + * linear solvers and + * preconditioners of Trilinos + * is chosen. + */ + void + solve (Epetra_Operator &A, + VectorBase &x, + const VectorBase &b, + const PreconditionBase &preconditioner); + /** * Solve the linear system * Ax=b. Depending on the @@ -179,6 +204,32 @@ namespace TrilinosWrappers const dealii::Vector &b, const PreconditionBase &preconditioner); + /** + * Solve the linear system + * Ax=b where A + * is an operator. This function can + * be used for matric free. Depending on the + * information provided by derived + * classes and the object passed as a + * preconditioner, one of the linear + * solvers and preconditioners of + * Trilinos is chosen. This class + * works with matrices according to + * the TrilinosWrappers format, but + * can take deal.II vectors as + * argument. Since deal.II are serial + * vectors (not distributed), this + * function does only what you expect + * in case the matrix is locally + * owned. Otherwise, an exception + * will be thrown. + */ + void + solve (Epetra_Operator &A, + dealii::Vector &x, + const dealii::Vector &b, + const PreconditionBase &preconditioner); + /** * Access to object that controls * convergence. @@ -211,6 +262,12 @@ namespace TrilinosWrappers private: + /** + * The solve function is used to set properly the Epetra_LinearProblem, + * once it is done this function solves the linear problem. + */ + void execute_solve(const PreconditionBase &preconditioner); + /** * A structure that collects * the Trilinos sparse matrix, diff --git a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h index 0d775dd943..6f3327f85b 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/deal.II/include/deal.II/lac/trilinos_sparse_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_sparse_matrix_h #define __deal2__trilinos_sparse_matrix_h @@ -2967,26 +2972,26 @@ namespace TrilinosWrappers Epetra_CombineMode mode = last_action; if (last_action == Zero) - { - if ((operation==::dealii::VectorOperation::add) || - (operation==::dealii::VectorOperation::unknown)) - mode = Add; - else if (operation==::dealii::VectorOperation::insert) - mode = Insert; - } + { + if ((operation==::dealii::VectorOperation::add) || + (operation==::dealii::VectorOperation::unknown)) + mode = Add; + else if (operation==::dealii::VectorOperation::insert) + mode = Insert; + } else - { - Assert( + { + Assert( ((last_action == Add) && (operation!=::dealii::VectorOperation::insert)) || ((last_action == Insert) && (operation!=::dealii::VectorOperation::add)), ExcMessage("operation and argument to compress() do not match")); - } + } // flush buffers int ierr; ierr = matrix->GlobalAssemble (*column_space_map, matrix->RowMap(), - true, mode); + true, mode); AssertThrow (ierr == 0, ExcTrilinosError(ierr)); @@ -3132,7 +3137,7 @@ namespace TrilinosWrappers if (elide_zero_values == false) { col_index_ptr = (TrilinosWrappers::types::int_type *)col_indices; - col_value_ptr = const_cast(values); + col_value_ptr = const_cast(values); n_columns = n_cols; } else @@ -3182,9 +3187,9 @@ namespace TrilinosWrappers if (matrix->Filled() == false) { ierr = matrix->Epetra_CrsMatrix::InsertGlobalValues( - static_cast(row), - static_cast(n_columns),const_cast(col_value_ptr), - col_index_ptr); + static_cast(row), + static_cast(n_columns),const_cast(col_value_ptr), + col_index_ptr); // When inserting elements, we do not want to create exceptions in // the case when inserting non-local data (since that's what we @@ -3357,7 +3362,7 @@ namespace TrilinosWrappers if (elide_zero_values == false) { col_index_ptr = (TrilinosWrappers::types::int_type *)col_indices; - col_value_ptr = const_cast(values); + col_value_ptr = const_cast(values); n_columns = n_cols; #ifdef DEBUG for (size_type j=0; jFilled(), ExcMatrixNotCompressed()); + (void)src; + (void)dst; internal::SparseMatrix::check_vector_map_equality(*matrix, src, dst); const size_type dst_local_size = dst.end() - dst.begin(); AssertDimension (dst_local_size, static_cast(matrix->RangeMap().NumMyElements())); + (void)dst_local_size; const size_type src_local_size = src.end() - src.begin(); AssertDimension (src_local_size, static_cast(matrix->DomainMap().NumMyElements())); + (void)src_local_size; Epetra_MultiVector tril_dst (View, matrix->RangeMap(), dst.begin(), matrix->DomainMap().NumMyPoints(), 1); @@ -3701,7 +3713,7 @@ namespace TrilinosWrappers } - + template inline void diff --git a/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h b/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h index 25d9482c09..22f1ade8d0 100644 --- a/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h +++ b/deal.II/include/deal.II/lac/trilinos_sparsity_pattern.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_sparsity_pattern_h #define __deal2__trilinos_sparsity_pattern_h @@ -82,6 +87,11 @@ namespace TrilinosWrappers const size_type row, const size_type index); + /** + * Copy constructor. + */ + Accessor (const Accessor &a); + /** * Row number of the element * represented by this object. @@ -198,6 +208,11 @@ namespace TrilinosWrappers const size_type row, const size_type index); + /** + * Copy constructor. + */ + Iterator (const Iterator &i); + /** * Prefix increment. */ @@ -1407,6 +1422,16 @@ namespace TrilinosWrappers } + inline + Accessor::Accessor (const Accessor &a) + : + sparsity_pattern(a.sparsity_pattern), + a_row(a.a_row), + a_index(a.a_index), + colnum_cache (a.colnum_cache) + {} + + inline Accessor::size_type Accessor::row() const @@ -1446,6 +1471,13 @@ namespace TrilinosWrappers {} + inline + Iterator::Iterator(const Iterator &i) + : + accessor(i.accessor) + {} + + inline Iterator & @@ -1656,8 +1688,8 @@ namespace TrilinosWrappers // from it which we can by evaluating an expression such as when // multiplying the value produced by 2 Assert (sizeof(TrilinosWrappers::types::int_type) == - sizeof((*begin)*2), - ExcNotImplemented()); + sizeof((*begin)*2), + ExcNotImplemented()); TrilinosWrappers::types::int_type *col_index_ptr = (TrilinosWrappers::types::int_type *)(&*begin); diff --git a/deal.II/include/deal.II/lac/trilinos_vector.h b/deal.II/include/deal.II/lac/trilinos_vector.h index e1302dff34..d8b651925b 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector.h +++ b/deal.II/include/deal.II/lac/trilinos_vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_vector_h #define __deal2__trilinos_vector_h @@ -45,16 +50,16 @@ namespace TrilinosWrappers namespace { #ifndef DEAL_II_USE_LARGE_INDEX_TYPE - // define a helper function that queries the global ID of local ID of - // an Epetra_BlockMap object by calling either the 32- or 64-bit + // define a helper function that queries the global ID of local ID of + // an Epetra_BlockMap object by calling either the 32- or 64-bit // function necessary. int gid(const Epetra_BlockMap &map, int i) { return map.GID(i); } #else - // define a helper function that queries the global ID of local ID of - // an Epetra_BlockMap object by calling either the 32- or 64-bit + // define a helper function that queries the global ID of local ID of + // an Epetra_BlockMap object by calling either the 32- or 64-bit // function necessary. long long int gid(const Epetra_BlockMap &map, int i) { @@ -275,6 +280,16 @@ namespace TrilinosWrappers void reinit (const BlockVector &v, const bool import_data = false); + /** + * Reinit function. Creates a vector + * using the IndexSet local as our + * own unknowns, add optional ghost + * values ghost. + */ + void reinit (const IndexSet &local, + const IndexSet &ghost, + const MPI_Comm &communicator = MPI_COMM_WORLD); + /** * Set all components of the * vector to the given number @p @@ -394,7 +409,7 @@ namespace TrilinosWrappers * this is all we need to * generate a parallel vector. */ - Vector (const Epetra_Map ¶llel_partitioning); + explicit Vector (const Epetra_Map ¶llel_partitioning); /** * Copy constructor from the @@ -407,8 +422,8 @@ namespace TrilinosWrappers * that sets the partitioning * details. */ - explicit Vector (const Epetra_Map ¶llel_partitioning, - const VectorBase &v); + Vector (const Epetra_Map ¶llel_partitioning, + const VectorBase &v); /** * Reinitialize from a deal.II @@ -436,8 +451,8 @@ namespace TrilinosWrappers * elements. */ template - explicit Vector (const Epetra_Map ¶llel_partitioning, - const dealii::Vector &v); + Vector (const Epetra_Map ¶llel_partitioning, + const dealii::Vector &v); //@} /** * @name Initialization with an IndexSet @@ -453,7 +468,14 @@ namespace TrilinosWrappers * need to generate a %parallel * vector. */ - Vector (const IndexSet ¶llel_partitioning, + explicit Vector (const IndexSet ¶llel_partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD); + + /** + * Creates a ghosted parallel vector. + */ + Vector (const IndexSet &local, + const IndexSet &ghost, const MPI_Comm &communicator = MPI_COMM_WORLD); /** @@ -467,9 +489,9 @@ namespace TrilinosWrappers * communicator that set the * partitioning details. */ - explicit Vector (const IndexSet ¶llel_partitioning, - const VectorBase &v, - const MPI_Comm &communicator = MPI_COMM_WORLD); + Vector (const IndexSet ¶llel_partitioning, + const VectorBase &v, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Copy-constructor from deal.II @@ -478,9 +500,9 @@ namespace TrilinosWrappers * copies all the elements. */ template - explicit Vector (const IndexSet ¶llel_partitioning, - const dealii::Vector &v, - const MPI_Comm &communicator = MPI_COMM_WORLD); + Vector (const IndexSet ¶llel_partitioning, + const dealii::Vector &v, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * Reinit functionality. This function @@ -646,7 +668,7 @@ namespace TrilinosWrappers * input the number of elements * in the vector. */ - Vector (const size_type n); + explicit Vector (const size_type n); /** * This constructor takes as @@ -660,7 +682,7 @@ namespace TrilinosWrappers * map will be generated * internally. */ - Vector (const Epetra_Map &partitioning); + explicit Vector (const Epetra_Map &partitioning); /** * This constructor takes as input @@ -673,8 +695,8 @@ namespace TrilinosWrappers * taken and a localized version will * be generated internally. */ - Vector (const IndexSet &partitioning, - const MPI_Comm &communicator = MPI_COMM_WORLD); + explicit Vector (const IndexSet &partitioning, + const MPI_Comm &communicator = MPI_COMM_WORLD); /** * This constructor takes a diff --git a/deal.II/include/deal.II/lac/trilinos_vector_base.h b/deal.II/include/deal.II/lac/trilinos_vector_base.h index 69a0457bc8..a721cdce8c 100644 --- a/deal.II/include/deal.II/lac/trilinos_vector_base.h +++ b/deal.II/include/deal.II/lac/trilinos_vector_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__trilinos_vector_base_h #define __deal2__trilinos_vector_base_h @@ -669,6 +674,28 @@ namespace TrilinosWrappers TrilinosScalar operator [] (const size_type index) const; + /** + * A collective get operation: instead + * of getting individual elements of a + * vector, this function allows to get + * a whole set of elements at once. The + * indices of the elements to be read + * are stated in the first argument, + * the corresponding values are returned in the + * second. + */ + void extract_subvector_to (const std::vector &indices, + std::vector &values) const; + + /** + * Just as the above, but with pointers. + * Useful in minimizing copying of data around. + */ + template + void extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const; + /** * Return the value of the vector * entry i. Note that this @@ -685,7 +712,7 @@ namespace TrilinosWrappers /** * Make the Vector class a bit like the vector<> class of * the C++ standard library by returning iterators to the start and end - * of the locally owned elements of this vector. The ordering of local elements corresponds to the one given + * of the locally owned elements of this vector. The ordering of local elements corresponds to the one given * * It holds that end() - begin() == local_size(). */ @@ -1263,9 +1290,9 @@ namespace TrilinosWrappers { const size_type n_indices = vector->Map().NumMyElements(); #ifndef DEAL_II_USE_LARGE_INDEX_TYPE - unsigned int * vector_indices = (unsigned int*)vector->Map().MyGlobalElements(); + unsigned int *vector_indices = (unsigned int *)vector->Map().MyGlobalElements(); #else - size_type * vector_indices = (size_type*)vector->Map().MyGlobalElements64(); + size_type *vector_indices = (size_type *)vector->Map().MyGlobalElements64(); #endif is.add_indices(vector_indices, vector_indices+n_indices); is.compress(); @@ -1311,6 +1338,30 @@ namespace TrilinosWrappers + inline + void VectorBase::extract_subvector_to (const std::vector &indices, + std::vector &values) const + { + for (size_type i = 0; i < indices.size(); ++i) + values[i] = operator()(indices[i]); + } + + + + template + inline + void VectorBase::extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const + { + while (indices_begin != indices_end) { + *values_begin = operator()(*indices_begin); + indices_begin++; values_begin++; + } + } + + + inline VectorBase::iterator VectorBase::begin() diff --git a/deal.II/include/deal.II/lac/vector.h b/deal.II/include/deal.II/lac/vector.h index bfd739458f..fb67e97c1c 100644 --- a/deal.II/include/deal.II/lac/vector.h +++ b/deal.II/include/deal.II/lac/vector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__vector_h #define __deal2__vector_h @@ -712,6 +717,29 @@ public: * Exactly the same as operator(). */ Number &operator[] (const size_type i); + + /** + * A collective get operation: instead + * of getting individual elements of a + * vector, this function allows to get + * a whole set of elements at once. The + * indices of the elements to be read + * are stated in the first argument, + * the corresponding values are returned in the + * second. + */ + template + void extract_subvector_to (const std::vector &indices, + std::vector &values) const; + + /** + * Just as the above, but with pointers. + * Useful in minimizing copying of data around. + */ + template + void extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const; //@} @@ -1319,6 +1347,33 @@ Number &Vector::operator[] (const size_type i) +template +template +inline +void Vector::extract_subvector_to (const std::vector &indices, + std::vector &values) const +{ + for (size_type i = 0; i < indices.size(); ++i) + values[i] = operator()(indices[i]); +} + + + +template +template +inline +void Vector::extract_subvector_to (ForwardIterator indices_begin, + const ForwardIterator indices_end, + OutputIterator values_begin) const +{ + while (indices_begin != indices_end) { + *values_begin = operator()(*indices_begin); + indices_begin++; values_begin++; + } +} + + + template inline Vector & diff --git a/deal.II/include/deal.II/lac/vector.templates.h b/deal.II/include/deal.II/lac/vector.templates.h index 5502623c73..b6181ffdf3 100644 --- a/deal.II/include/deal.II/lac/vector.templates.h +++ b/deal.II/include/deal.II/lac/vector.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__vector_templates_h #define __deal2__vector_templates_h @@ -322,12 +327,10 @@ namespace internal { namespace Vector { - typedef types::global_dof_index size_type; - - template + template void set_subrange (const T s, - const size_type begin, - const size_type end, + const typename dealii::Vector::size_type begin, + const typename dealii::Vector::size_type end, dealii::Vector &dst) { if (s == T()) @@ -336,9 +339,10 @@ namespace internal std::fill (&*(dst.begin()+begin), &*(dst.begin()+end), s); } - template - void copy_subrange (const size_type begin, - const size_type end, + + template + void copy_subrange (const typename dealii::Vector::size_type begin, + const typename dealii::Vector::size_type end, const dealii::Vector &src, dealii::Vector &dst) { @@ -346,9 +350,10 @@ namespace internal (end-begin)*sizeof(T)); } - template - void copy_subrange (const size_type begin, - const size_type end, + + template + void copy_subrange (const typename dealii::Vector::size_type begin, + const typename dealii::Vector::size_type end, const dealii::Vector &src, dealii::Vector &dst) { @@ -359,15 +364,17 @@ namespace internal *p = *q; } + template - void copy_subrange_wrap (const size_type begin, - const size_type end, + void copy_subrange_wrap (const typename dealii::Vector::size_type begin, + const typename dealii::Vector::size_type end, const dealii::Vector &src, dealii::Vector &dst) { copy_subrange (begin, end, src, dst); } + template void copy_vector (const dealii::Vector &src, dealii::Vector &dst) @@ -375,8 +382,8 @@ namespace internal if (PointerComparison::equal(&src, &dst)) return; - const size_type vec_size = src.size(); - const size_type dst_size = dst.size(); + const typename dealii::Vector::size_type vec_size = src.size(); + const typename dealii::Vector::size_type dst_size = dst.size(); if (dst_size != vec_size) dst.reinit (vec_size, true); if (vec_size>internal::Vector::minimum_parallel_grain_size) @@ -573,7 +580,7 @@ namespace internal // The code returns the result as the last argument in order to make // spawning tasks simpler and use automatic template deduction. template + typename ResultType, typename size_type> void accumulate (const Operation &op, const Number *X, const Number2 *Y, @@ -674,18 +681,18 @@ namespace internal ResultType r0, r1, r2, r3; Threads::TaskGroup<> task_group; task_group += Threads::new_task(&accumulate, + ResultType,size_type>, op, X, Y, power, new_size, r0); task_group += Threads::new_task(&accumulate, + ResultType,size_type>, op, X+new_size, Y+new_size, power, new_size, r1); task_group += Threads::new_task(&accumulate, + ResultType,size_type>, op, X+2*new_size, Y+2*new_size, power, new_size, r2); task_group += Threads::new_task(&accumulate, + ResultType,size_type>, op, X+3*new_size, Y+3*new_size, power, vec_size-3*new_size, r3); task_group.join_all(); diff --git a/deal.II/include/deal.II/lac/vector_memory.h b/deal.II/include/deal.II/lac/vector_memory.h index aadd6eaa59..069ce99e85 100644 --- a/deal.II/include/deal.II/lac/vector_memory.h +++ b/deal.II/include/deal.II/lac/vector_memory.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__vector_memory_h #define __deal2__vector_memory_h diff --git a/deal.II/include/deal.II/lac/vector_view.h b/deal.II/include/deal.II/lac/vector_view.h index 72fae49f8e..de704a2e44 100644 --- a/deal.II/include/deal.II/lac/vector_view.h +++ b/deal.II/include/deal.II/lac/vector_view.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __dealii__vector_view_h #define __dealii__vector_view_h @@ -217,7 +222,7 @@ public: * view_of_long_vector(i), with i>0 might * cause an attempt to access invalid * areas of memory, or might function - * properly, depending on wether or not + * properly, depending on whether or not * the system was able to allocate some * memory consecutively after the * original allocation. diff --git a/deal.II/include/deal.II/matrix_free/dof_info.h b/deal.II/include/deal.II/matrix_free/dof_info.h index acb37139a5..d6a4e26612 100644 --- a/deal.II/include/deal.II/matrix_free/dof_info.h +++ b/deal.II/include/deal.II/matrix_free/dof_info.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011-2013 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_free_dof_info_h #define __deal2__matrix_free_dof_info_h @@ -22,6 +26,8 @@ #include #include +#include + #include @@ -51,19 +57,6 @@ namespace internal */ struct DoFInfo { - - /** - * size_type of the dof_indicies object. - */ - - typedef std::vector::size_type size_dof; - - /** - * size_type of the constraint_indicators object. - */ - - typedef std::vector >::size_type size_constraint; - /** * Default empty constructor. */ @@ -78,18 +71,18 @@ namespace internal * Clears all data fields in this class. */ void clear (); - + /** * Returns a pointer to the first index in the DoF row @p row. */ - const types::global_dof_index *begin_indices (const unsigned int row) const; + const unsigned int *begin_indices (const unsigned int row) const; /** * Returns a pointer to the one past the last DoF index in the row @p * row. */ - const types::global_dof_index *end_indices (const unsigned int row) const; + const unsigned int *end_indices (const unsigned int row) const; /** * Returns the number of entries in the indices field for the given row. @@ -120,13 +113,13 @@ namespace internal * Returns a pointer to the first index in the DoF row @p row for plain * indices (i.e., the entries where constraints are not embedded). */ - const types::global_dof_index *begin_indices_plain (const unsigned int row) const; + const unsigned int *begin_indices_plain (const unsigned int row) const; /** * Returns a pointer to the one past the last DoF index in the row @p * row (i.e., the entries where constraints are not embedded). */ - const types::global_dof_index *end_indices_plain (const unsigned int row) const; + const unsigned int *end_indices_plain (const unsigned int row) const; /** * Returns the FE index for a given finite element degree. If not in hp @@ -178,7 +171,7 @@ namespace internal */ void compute_renumber_serial (const std::vector &boundary_cells, const SizeInfo &size_info, - std::vector &renumbering); + std::vector &renumbering); /** * Reorganizes cells in the hp case without parallelism such that all @@ -187,7 +180,7 @@ namespace internal * DoFHandlers. */ void compute_renumber_hp_serial (SizeInfo &size_info, - std::vector &renumbering, + std::vector &renumbering, std::vector &irregular_cells); /** @@ -197,7 +190,7 @@ namespace internal */ void compute_renumber_parallel (const std::vector &boundary_cells, SizeInfo &size_info, - std::vector &renumbering); + std::vector &renumbering); /** * This method reorders the way cells are gone through based on a given @@ -206,7 +199,7 @@ namespace internal * vectorization. */ void reorder_cells (const SizeInfo &size_info, - const std::vector &renumbering, + const std::vector &renumbering, const std::vector &constraint_pool_row_index, const std::vector &irregular_cells, const unsigned int vectorization_length); @@ -237,7 +230,7 @@ namespace internal void make_thread_graph_partition_color (SizeInfo &size_info, TaskInfo &task_info, - std::vector &renumbering, + std::vector &renumbering, std::vector &irregular_cells, const bool hp_bool); @@ -258,7 +251,7 @@ namespace internal void make_thread_graph_partition_partition (SizeInfo &size_info, TaskInfo &task_info, - std::vector &renumbering, + std::vector &renumbering, std::vector &irregular_cells, const bool hp_bool); @@ -271,7 +264,7 @@ namespace internal void make_connectivity_graph (const SizeInfo &size_info, const TaskInfo &task_info, - const std::vector &renumbering, + const std::vector &renumbering, const std::vector &irregular_cells, const bool do_blocking, CompressedSimpleSparsityPattern &connectivity) const; @@ -313,19 +306,25 @@ namespace internal * certain structure in the indices, like indices for vector-valued * problems or for cells where not all vector components are filled. */ - std::vector > row_starts; + std::vector > row_starts; /** - * Stores the (global) indices of the degrees of freedom for each cell. This - * array also includes the indirect contributions from constraints, + * Stores the indices of the degrees of freedom for each cell. These + * indices are computed in MPI-local index space, i.e., each processor + * stores the locally owned indices as numbers between 0 and + * n_locally_owned_dofs-1 and ghost indices in the range + * n_locally_owned_dofs to + * n_locally_owned_dofs+n_ghost_dofs. The translation between + * this MPI-local index space and the global numbering of degrees of + * freedom is stored in the @p vector_partitioner data structure. + + * This array also includes the indirect contributions from constraints, * which are described by the @p constraint_indicator field. Because of * variable lengths of rows, this would be a vector of a * vector. However, we use one contiguous memory region and store the * rowstart in the variable @p row_starts. */ - std::vector dof_indices; + std::vector dof_indices; /** * This variable describes the position of constraints in terms of the @@ -350,13 +349,13 @@ namespace internal * This stores a (sorted) list of all locally owned degrees of freedom * that are constrained. */ - std::vector constrained_dofs; + std::vector constrained_dofs; /** * Stores the rowstart indices of the compressed row storage in the @p * plain_dof_indices fields. */ - std::vector row_starts_plain_indices; + std::vector row_starts_plain_indices; /** * Stores the indices of the degrees of freedom for each cell. This @@ -366,7 +365,7 @@ namespace internal * contiguous memory region and store the rowstart in the variable @p * row_starts_plain_indices. */ - std::vector plain_dof_indices; + std::vector plain_dof_indices; /** * Stores the dimension of the underlying DoFHandler. Since the indices @@ -428,11 +427,11 @@ namespace internal #ifndef DOXYGEN inline - const types::global_dof_index * + const unsigned int * DoFInfo::begin_indices (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); - const unsigned int index = std_cxx1x::get<0>(row_starts[row]); + const unsigned int index = row_starts[row][0]; AssertIndexRange(index, dof_indices.size()+1); return dof_indices.empty() ? 0 : &dof_indices[0] + index; } @@ -440,11 +439,11 @@ namespace internal inline - const types::global_dof_index * + const unsigned int * DoFInfo::end_indices (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); - const unsigned int index = std_cxx1x::get<0>(row_starts[row+1]); + const unsigned int index = row_starts[row+1][0]; AssertIndexRange(index, dof_indices.size()+1); return dof_indices.empty() ? 0 : &dof_indices[0] + index; } @@ -456,8 +455,7 @@ namespace internal DoFInfo::row_length_indices (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); - return (std_cxx1x::get<0>(row_starts[row+1]) - - std_cxx1x::get<0>(row_starts[row])); + return (row_starts[row+1][0] - row_starts[row][0]); } @@ -467,7 +465,7 @@ namespace internal DoFInfo::begin_indicators (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); - const unsigned int index = std_cxx1x::get<1>(row_starts[row]); + const unsigned int index = row_starts[row][1]; AssertIndexRange (index, constraint_indicator.size()+1); return constraint_indicator.empty() ? 0 : &constraint_indicator[0] + index; } @@ -479,7 +477,7 @@ namespace internal DoFInfo::end_indicators (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); - const unsigned int index = std_cxx1x::get<1>(row_starts[row+1]); + const unsigned int index = row_starts[row+1][1]; AssertIndexRange (index, constraint_indicator.size()+1); return constraint_indicator.empty() ? 0 : &constraint_indicator[0] + index; } @@ -491,20 +489,19 @@ namespace internal DoFInfo::row_length_indicators (const unsigned int row) const { AssertIndexRange (row, row_starts.size()-1); - return (std_cxx1x::get<1>(row_starts[row+1]) - - std_cxx1x::get<1>(row_starts[row])); + return (row_starts[row+1][1] - row_starts[row][1]); } inline - const types::global_dof_index * + const unsigned int * DoFInfo::begin_indices_plain (const unsigned int row) const { // if we have no constraints, should take the data from dof_indices if (row_length_indicators(row) == 0) { - Assert (row_starts_plain_indices[row] == numbers::invalid_dof_index, + Assert (row_starts_plain_indices[row]==numbers::invalid_unsigned_int, ExcInternalError()); return begin_indices(row); } @@ -520,7 +517,7 @@ namespace internal inline - const types::global_dof_index * + const unsigned int * DoFInfo::end_indices_plain (const unsigned int row) const { return begin_indices_plain(row) + diff --git a/deal.II/include/deal.II/matrix_free/dof_info.templates.h b/deal.II/include/deal.II/matrix_free/dof_info.templates.h index aa639f3ad4..8ab56dcc92 100644 --- a/deal.II/include/deal.II/matrix_free/dof_info.templates.h +++ b/deal.II/include/deal.II/matrix_free/dof_info.templates.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -70,7 +74,7 @@ namespace internal template unsigned short ConstraintValues:: - insert_entries (const std::vector > &entries) + insert_entries (const std::vector > &entries) { next_constraint.first.resize(entries.size()); if (entries.size() > 0) @@ -169,7 +173,7 @@ namespace internal void - DoFInfo::read_dof_indices (const std::vector &local_indices, + DoFInfo::read_dof_indices (const std::vector &local_indices, const std::vector &lexicographic_inv, const ConstraintMatrix &constraints, const unsigned int cell_number, @@ -180,14 +184,17 @@ namespace internal const unsigned int n_mpi_procs = vector_partitioner->n_mpi_processes(); const types::global_dof_index first_owned = vector_partitioner->local_range().first; const types::global_dof_index last_owned = vector_partitioner->local_range().second; - const types::global_dof_index n_owned = last_owned - first_owned; + Assert (last_owned-first_owned < std::numeric_limits::max(), + ExcMessage("The size local range of owned indices must not " + "exceed the size of unsigned int")); + const unsigned int n_owned = last_owned - first_owned; std::pair constraint_iterator (0,0); unsigned int dofs_this_cell = (cell_active_fe_index.empty()) ? dofs_per_cell[0] : dofs_per_cell[cell_active_fe_index[cell_number]]; for (unsigned int i=0; i > *entries_ptr = @@ -238,8 +245,7 @@ namespace internal (constraint_indices[j] < first_owned || constraint_indices[j] >= last_owned)) { - dof_indices.push_back - (n_owned + ghost_dofs.size()); + dof_indices.push_back (n_owned + ghost_dofs.size()); // collect ghosts so that we can later construct an // IndexSet for them. also store whether the current @@ -251,7 +257,8 @@ namespace internal // not ghost, so transform to the local index space // directly dof_indices.push_back - (constraint_indices[j] - first_owned); + (static_cast(constraint_indices[j] - + first_owned)); } } } @@ -272,7 +279,7 @@ no_constraint: else current_dof -= first_owned; - dof_indices.push_back (current_dof); + dof_indices.push_back (static_cast(current_dof)); // make sure constraint_iterator.first is always within the // bounds of unsigned short @@ -282,10 +289,9 @@ no_constraint: constraint_iterator.first++; } } - row_starts[cell_number+1] = std_cxx1x::tuple - (dof_indices.size(), constraint_indicator.size(), 0); + row_starts[cell_number+1][0] = dof_indices.size(); + row_starts[cell_number+1][1] = constraint_indicator.size(); + row_starts[cell_number+1][2] = 0; // now to the plain indices: in case we have constraints on this cell, // store the indices without the constraints resolve once again @@ -294,14 +300,13 @@ no_constraint: if (cell_number == 0) row_starts_plain_indices.resize (row_starts.size()); row_starts_plain_indices[cell_number] = plain_dof_indices.size(); - bool cell_has_constraints = - std_cxx1x::get<1>(row_starts[cell_number+1]) > - std_cxx1x::get<1>(row_starts[cell_number]); + bool cell_has_constraints = (row_starts[cell_number+1][1] > + row_starts[cell_number][1]); if (cell_has_constraints == true) { for (unsigned int i=0; i 1 && (current_dof < first_owned || @@ -313,7 +318,8 @@ no_constraint: } else current_dof -= first_owned; - plain_dof_indices.push_back (current_dof); + plain_dof_indices.push_back (static_cast + (current_dof)); } } } @@ -327,12 +333,12 @@ no_constraint: Assert (boundary_cells.size() < row_starts.size(), ExcInternalError()); // sort ghost dofs and compress out duplicates - const types::global_dof_index n_owned = (vector_partitioner->local_range().second- + const unsigned int n_owned = (vector_partitioner->local_range().second- vector_partitioner->local_range().first); - const size_dof n_ghosts = ghost_dofs.size(); - unsigned int n_unique_ghosts= 0; + const std::size_t n_ghosts = ghost_dofs.size(); + unsigned int n_unique_ghosts= 0; #ifdef DEBUG - for (std::vector::iterator dof = dof_indices.begin(); + for (std::vector::iterator dof = dof_indices.begin(); dof!=dof_indices.end(); ++dof) AssertIndexRange (*dof, n_owned+n_ghosts); #endif @@ -345,18 +351,18 @@ no_constraint: // replace the temporary numbering of ghosts by the real number in // the index set, we need to store these values std::vector > ghost_origin(n_ghosts); - for (size_dof i=0; ighost_origin[i-1].first+1) + if (ghost_origin[i].first > ghost_origin[i-1].first+1) { ghost_indices.add_range (last_contiguous_start, ghost_origin[i-1].first+1); @@ -375,7 +381,7 @@ no_constraint: // dofs. the ghost index set should store the same number { AssertDimension (n_unique_ghosts, ghost_indices.n_elements()); - for (size_dof i=0; i - (begin_indices(boundary_cells[i])); + unsigned int *data_ptr = const_cast (begin_indices(boundary_cells[i])); - const types::global_dof_index *row_end = end_indices(boundary_cells[i]); + const unsigned int *row_end = end_indices(boundary_cells[i]); for ( ; data_ptr != row_end; ++data_ptr) *data_ptr = ((*data_ptr < n_owned) ? @@ -405,10 +410,8 @@ no_constraint: { if (row_length_indicators(boundary_cells[i]) > 0) { - types::global_dof_index *data_ptr = const_cast - (begin_indices_plain(boundary_cells[i])); - const types::global_dof_index *row_end = - (end_indices_plain(boundary_cells[i])); + unsigned int *data_ptr = const_cast (begin_indices_plain(boundary_cells[i])); + const unsigned int *row_end = end_indices_plain(boundary_cells[i]); for ( ; data_ptr != row_end; ++data_ptr) *data_ptr = ((*data_ptr < n_owned) ? @@ -421,8 +424,8 @@ no_constraint: } } - std::vector new_ghosts; - ghost_dofs.swap(new_ghosts); + std::vector empty; + ghost_dofs.swap(empty); // set the ghost indices now. need to cast away constness here, but that // is uncritical since we reset the Partitioner in the same initialize @@ -437,9 +440,9 @@ no_constraint: void DoFInfo::compute_renumber_serial (const std::vector &boundary_cells, const SizeInfo &size_info, - std::vector &renumbering) + std::vector &renumbering) { - std::vector reverse_numbering (size_info.n_active_cells, + std::vector reverse_numbering (size_info.n_active_cells, numbers::invalid_unsigned_int); const unsigned int n_boundary_cells = boundary_cells.size(); for (unsigned int j=0; j &renumbering, + std::vector &renumbering, std::vector &irregular_cells) { if (max_fe_index < 2) @@ -553,9 +556,9 @@ no_constraint: void DoFInfo::compute_renumber_parallel (const std::vector &boundary_cells, SizeInfo &size_info, - std::vector &renumbering) + std::vector &renumbering) { - std::vector reverse_numbering (size_info.n_active_cells, + std::vector reverse_numbering (size_info.n_active_cells, numbers::invalid_unsigned_int); const unsigned int n_boundary_cells = boundary_cells.size(); for (unsigned int j=0; j &renumbering, + const std::vector &renumbering, const std::vector &constraint_pool_row_index, const std::vector &irregular_cells, const unsigned int vectorization_length) @@ -606,12 +609,11 @@ no_constraint: std::swap (new_active_fe_index, cell_active_fe_index); } - std::vector > new_row_starts; - std::vector new_dof_indices; + std::vector > new_row_starts; + std::vector new_dof_indices; std::vector > new_constraint_indicator; - std::vector new_plain_indices, new_rowstart_plain; + std::vector new_plain_indices, new_rowstart_plain; unsigned int position_cell = 0; new_row_starts.resize (size_info.n_macro_cells + 1); new_dof_indices.reserve (dof_indices.size()); @@ -619,7 +621,7 @@ no_constraint: if (store_plain_indices == true) { new_rowstart_plain.resize (size_info.n_macro_cells + 1, - numbers::invalid_dof_index); + numbers::invalid_unsigned_int); new_plain_indices.reserve (plain_dof_indices.size()); } @@ -628,8 +630,8 @@ no_constraint: // vectors are adjacent, i.e., first dof index 0 for all vectors, then // dof index 1 for all vectors, and so on. This involves some extra // resorting. - std::vector glob_indices (vectorization_length); - std::vector plain_glob_indices (vectorization_length); + std::vector glob_indices (vectorization_length); + std::vector plain_glob_indices (vectorization_length); std::vector*> constr_ind(vectorization_length), constr_end(vectorization_length); std::vector index(vectorization_length); @@ -638,10 +640,9 @@ no_constraint: const unsigned int dofs_mcell = dofs_per_cell[cell_active_fe_index.size() == 0 ? 0 : cell_active_fe_index[i]] * vectorization_length; - new_row_starts[i] = - std_cxx1x::tuple - (new_dof_indices.size(), new_constraint_indicator.size(), - irregular_cells[i]); + new_row_starts[i][0] = new_dof_indices.size(); + new_row_starts[i][1] = new_constraint_indicator.size(); + new_row_starts[i][2] = irregular_cells[i]; const unsigned int n_comp = (irregular_cells[i]>0 ? irregular_cells[i] : vectorization_length); @@ -722,9 +723,9 @@ no_constraint: } AssertDimension (position_cell+1, row_starts.size()); - new_row_starts[size_info.n_macro_cells] = - std_cxx1x::tuple - (new_dof_indices.size(), new_constraint_indicator.size(), 0); + new_row_starts[size_info.n_macro_cells][0] = new_dof_indices.size(); + new_row_starts[size_info.n_macro_cells][1] = new_constraint_indicator.size(); + new_row_starts[size_info.n_macro_cells][2] = 0; AssertDimension(dof_indices.size(), new_dof_indices.size()); AssertDimension(constraint_indicator.size(), @@ -739,10 +740,10 @@ no_constraint: #ifdef DEBUG // sanity check 1: all indices should be smaller than the number of dofs // locally owned plus the number of ghosts - const types::global_dof_index index_range = (vector_partitioner->local_range().second- + const unsigned int index_range = (vector_partitioner->local_range().second- vector_partitioner->local_range().first) - + vector_partitioner->ghost_indices().n_elements(); - for (size_dof i=0; ighost_indices().n_elements(); + for (std::size_t i=0; ilocal_range().second- + const unsigned int local_size = (vector_partitioner->local_range().second- vector_partitioner->local_range().first); for (unsigned int row=0; row &renumbering, - std::vector &irregular_cells, - const bool hp_bool) + (SizeInfo &size_info, + TaskInfo &task_info, + std::vector &renumbering, + std::vector &irregular_cells, + const bool hp_bool) { if (size_info.n_macro_cells == 0) return; @@ -925,12 +926,12 @@ no_constraint: // yet assigned a partition. std::vector cell_partition(task_info.n_blocks, size_info.n_macro_cells); - std::vector neighbor_list; - std::vector neighbor_neighbor_list; + std::vector neighbor_list; + std::vector neighbor_neighbor_list; // In element j of this variable, one puts the old number of the block // that should be the jth block in the new numeration. - std::vector partition_list (task_info.n_blocks,0); + std::vector partition_list (task_info.n_blocks,0); std::vector partition_color_list(task_info.n_blocks,0); // This vector points to the start of each partition. @@ -1019,12 +1020,12 @@ no_constraint: k++) { unsigned int cell = partition_list[k]; - unsigned int no_neighbors = connectivity.row_length(cell); + unsigned int n_neighbors = connectivity.row_length(cell); // In the worst case, each neighbor has a different color. So we - // find at least one available color between 0 and no_neighbors. - color_finder.resize(no_neighbors+1); - for (unsigned int j=0; j<=no_neighbors; ++j) + // find at least one available color between 0 and n_neighbors. + color_finder.resize(n_neighbors+1); + for (unsigned int j=0; j<=n_neighbors; ++j) color_finder[j]=true; CompressedSimpleSparsityPattern::row_iterator neighbor = connectivity.row_begin(cell), @@ -1034,7 +1035,7 @@ no_constraint: // Mark the color that a neighbor within the partition has // as taken if (cell_partition[*neighbor] == part && - cell_color[*neighbor] <= no_neighbors) + cell_color[*neighbor] <= n_neighbors) color_finder[cell_color[*neighbor]] = false; } // Choose the smallest color that is not taken for the block @@ -1123,7 +1124,7 @@ no_constraint: // check that the renumbering is one-to-one #ifdef DEBUG { - std::vector sorted_renumbering (renumbering); + std::vector sorted_renumbering (renumbering); std::sort(sorted_renumbering.begin(), sorted_renumbering.end()); for (unsigned int i=0; i &renumbering, - std::vector &irregular_cells, - const bool hp_bool) + (SizeInfo &size_info, + TaskInfo &task_info, + std::vector &renumbering, + std::vector &irregular_cells, + const bool hp_bool) { if (size_info.n_macro_cells == 0) return; @@ -1183,7 +1184,7 @@ no_constraint: // In element j of this variable, one puts the old number of the block // that should be the jth block in the new numeration. std::vector partition_list(size_info.n_active_cells,0); - std::vector partition_partition_list(size_info.n_active_cells,0); + std::vector partition_partition_list(size_info.n_active_cells,0); // This vector points to the start of each partition. std::vector partition_size(2,0); @@ -1438,7 +1439,7 @@ not_connect: missing_macros = 0; std::vector remaining_per_macro_cell (max_fe_index); - std::vector > + std::vector > renumbering_fe_index; unsigned int cell; bool filled = true; @@ -1651,7 +1652,7 @@ not_connect: reserve (2000); } - void reserve (const types::global_dof_index size) + void reserve (const std::size_t size) { if (size > 0) this->std::vector::reserve (size); @@ -1660,11 +1661,11 @@ not_connect: // insert a given entry. dat is a pointer within this vector (the user // needs to make sure that it really stays there) - void insert (const types::global_dof_index entry, + void insert (const unsigned int entry, std::vector::iterator &dat) { - AssertIndexRange (static_cast(dat - begin()), size()+1); - AssertIndexRange (static_cast(end() - dat), size()+1); + AssertIndexRange (static_cast(dat - begin()), size()+1); + AssertIndexRange (static_cast(end() - dat), size()+1); AssertIndexRange (size(), capacity()); while (dat != end() && *dat < entry) ++dat; @@ -1690,23 +1691,23 @@ not_connect: DoFInfo::make_connectivity_graph (const SizeInfo &size_info, const TaskInfo &task_info, - const std::vector &renumbering, + const std::vector &renumbering, const std::vector &irregular_cells, const bool do_blocking, CompressedSimpleSparsityPattern &connectivity) const { AssertDimension (row_starts.size()-1, size_info.n_active_cells); - const types::global_dof_index n_rows = - (vector_partitioner->local_range().second- - vector_partitioner->local_range().first) - + vector_partitioner->ghost_indices().n_elements(); - const types::global_dof_index n_blocks = (do_blocking == true) ? + const unsigned int n_rows = + (vector_partitioner->local_range().second- + vector_partitioner->local_range().first) + + vector_partitioner->ghost_indices().n_elements(); + const unsigned int n_blocks = (do_blocking == true) ? task_info.n_blocks : size_info.n_active_cells; // first determine row lengths std::vector row_lengths(n_rows); unsigned int cell_start = 0, mcell_start = 0; - std::vector scratch; + std::vector scratch; for (unsigned int block = 0; block < n_blocks; ++block) { // if we have the blocking variant (used in the coloring scheme), we @@ -1743,15 +1744,15 @@ not_connect: scratch.insert(scratch.end(), begin_indices(block), end_indices(block)); std::sort(scratch.begin(), scratch.end()); - const types::global_dof_index n_unique = + const unsigned int n_unique = std::unique(scratch.begin(), scratch.end())-scratch.begin(); - for (types::global_dof_index i=0; i 0) { @@ -1879,7 +1880,7 @@ not_connect: renumbering.resize (local_size, numbers::invalid_dof_index); types::global_dof_index counter = 0; - std::vector::iterator dof_ind = dof_indices.begin(), + std::vector::iterator dof_ind = dof_indices.begin(), end_ind = dof_indices.end(); for ( ; dof_ind != end_ind; ++dof_ind) { @@ -1892,23 +1893,27 @@ not_connect: } AssertIndexRange (counter, local_size+1); - for (size_dof i=0; i new_constrained_dofs (constrained_dofs.size()); - for (size_dof i=0; i new_constrained_dofs (constrained_dofs.size()); + for (std::size_t i=0; i new_constrained_dofs[i-1], ExcInternalError()); #endif std::swap (constrained_dofs, new_constrained_dofs); + // transform indices to global index space + for (std::size_t i=0; ilocal_to_global(renumbering[i]); + AssertDimension (counter, renumbering.size()); } @@ -1918,8 +1923,7 @@ not_connect: DoFInfo::memory_consumption () const { std::size_t memory = sizeof(*this); - memory += (row_starts.capacity()*sizeof(std_cxx1x::tuple)); + memory += (row_starts.capacity()*sizeof(std_cxx1x::array)); memory += MemoryConsumption::memory_consumption (dof_indices); memory += MemoryConsumption::memory_consumption (row_starts_plain_indices); memory += MemoryConsumption::memory_consumption (plain_dof_indices); @@ -1937,7 +1941,7 @@ not_connect: { out << " Memory row starts indices: "; size_info.print_memory_statistics - (out, (row_starts.capacity()*sizeof(std_cxx1x::tuple))); + (out, (row_starts.capacity()*sizeof(std_cxx1x::array))); out << " Memory dof indices: "; size_info.print_memory_statistics (out, MemoryConsumption::memory_consumption (dof_indices)); @@ -1965,9 +1969,8 @@ not_connect: for (unsigned int row=0 ; row *con_it = begin_indicators(row), diff --git a/deal.II/include/deal.II/matrix_free/fe_evaluation.h b/deal.II/include/deal.II/matrix_free/fe_evaluation.h index 6365734a49..0e46cdb59c 100644 --- a/deal.II/include/deal.II/matrix_free/fe_evaluation.h +++ b/deal.II/include/deal.II/matrix_free/fe_evaluation.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_free_fe_evaluation_h #define __deal2__matrix_free_fe_evaluation_h @@ -1770,7 +1774,7 @@ namespace internal { typedef typename VectorType::BlockType BaseVectorType; - static BaseVectorType* get_vector_component (VectorType &vec, + static BaseVectorType *get_vector_component (VectorType &vec, const unsigned int component) { AssertIndexRange (component, vec.n_blocks()); @@ -1783,7 +1787,7 @@ namespace internal { typedef VectorType BaseVectorType; - static BaseVectorType* get_vector_component (VectorType &vec, + static BaseVectorType *get_vector_component (VectorType &vec, const unsigned int) { return &vec; @@ -1817,15 +1821,14 @@ FEEvaluationBase // loop over all local dofs. ind_local holds local number on cell, index // iterates over the elements of index_local_to_global and dof_indices // points to the global indices stored in index_local_to_global - const types::global_dof_index *dof_indices = dof_info.begin_indices(cell); + const unsigned int *dof_indices = dof_info.begin_indices(cell); const std::pair *indicators = dof_info.begin_indicators(cell); const std::pair *indicators_end = dof_info.end_indicators(cell); unsigned int ind_local = 0; - const unsigned int n_irreg_components_filled = - std_cxx1x::get<2>(dof_info.row_starts[cell]); + const unsigned int n_irreg_components_filled = dof_info.row_starts[cell][2]; const bool at_irregular_cell = n_irreg_components_filled > 0; // scalar case (or case when all components have the same degrees of freedom @@ -2127,7 +2130,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector::value>::BaseVectorType *src_data[n_components]; + IsBlockVector::value>::BaseVectorType *src_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(const_cast(src), d); @@ -2210,7 +2213,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data const typename internal::BlockVectorSelector::value>::BaseVectorType *src_data[n_components]; + IsBlockVector::value>::BaseVectorType *src_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(const_cast(src), d); @@ -2277,7 +2280,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector::value>::BaseVectorType *dst_data[n_components]; + IsBlockVector::value>::BaseVectorType *dst_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(dst, d); @@ -2355,7 +2358,7 @@ FEEvaluationBase // select between block vectors and non-block vectors. Note that the number // of components is checked in the internal data typename internal::BlockVectorSelector::value>::BaseVectorType *dst_data[n_components]; + IsBlockVector::value>::BaseVectorType *dst_data[n_components]; for (unsigned int d=0; d::value>::get_vector_component(dst, d); @@ -2439,10 +2442,9 @@ FEEvaluationBase // loop over all local dofs. ind_local holds local number on cell, index // iterates over the elements of index_local_to_global and dof_indices // points to the global indices stored in index_local_to_global - const types::global_dof_index *dof_indices = dof_info.begin_indices_plain(cell); + const unsigned int *dof_indices = dof_info.begin_indices_plain(cell); - const unsigned int n_irreg_components_filled = - std_cxx1x::get<2>(dof_info.row_starts[cell]); + const unsigned int n_irreg_components_filled = dof_info.row_starts[cell][2]; const bool at_irregular_cell = n_irreg_components_filled > 0; // scalar case (or case when all components have the same degrees of freedom @@ -3878,12 +3880,12 @@ namespace internal inline void apply_tensor_product_values (const VectorizedArray *shape_values, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = dof_to_quad ? (fe_degree+1) : n_q_points_1d, - nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); + nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); const int n_cols = nn / 2; const int mid = mm / 2; @@ -3897,132 +3899,132 @@ namespace internal { for (int col=0; col val0, val1, in0, in1, res0, res1; - if (dof_to_quad == true) - { - val0 = shape_values[col]; - val1 = shape_values[nn-1-col]; - } - else - { - val0 = shape_values[col*n_q_points_1d]; - val1 = shape_values[(col+1)*n_q_points_1d-1]; - } - if (mid > 0) - { - in0 = in[0]; - in1 = in[stride*(mm-1)]; - res0 = val0 * in0; - res1 = val1 * in0; - res0 += val1 * in1; - res1 += val0 * in1; - for (int ind=1; ind(); - if (dof_to_quad == true) - { - if (mm % 2 == 1) - { - val0 = shape_values[mid*n_q_points_1d+col]; - val1 = val0 * in[stride*mid]; - res0 += val1; - res1 += val1; - } - } - else - { - if (mm % 2 == 1 && nn % 2 == 0) - { - val0 = shape_values[col*n_q_points_1d+mid]; - val1 = val0 * in[stride*mid]; - res0 += val1; - res1 += val1; - } - } - if (add == false) - { - out[stride*col] = res0; - out[stride*(nn-1-col)] = res1; - } - else - { - out[stride*col] += res0; - out[stride*(nn-1-col)] += res1; - } + VectorizedArray val0, val1, in0, in1, res0, res1; + if (dof_to_quad == true) + { + val0 = shape_values[col]; + val1 = shape_values[nn-1-col]; + } + else + { + val0 = shape_values[col*n_q_points_1d]; + val1 = shape_values[(col+1)*n_q_points_1d-1]; + } + if (mid > 0) + { + in0 = in[0]; + in1 = in[stride*(mm-1)]; + res0 = val0 * in0; + res1 = val1 * in0; + res0 += val1 * in1; + res1 += val0 * in1; + for (int ind=1; ind(); + if (dof_to_quad == true) + { + if (mm % 2 == 1) + { + val0 = shape_values[mid*n_q_points_1d+col]; + val1 = val0 * in[stride*mid]; + res0 += val1; + res1 += val1; + } + } + else + { + if (mm % 2 == 1 && nn % 2 == 0) + { + val0 = shape_values[col*n_q_points_1d+mid]; + val1 = val0 * in[stride*mid]; + res0 += val1; + res1 += val1; + } + } + if (add == false) + { + out[stride*col] = res0; + out[stride*(nn-1-col)] = res1; + } + else + { + out[stride*col] += res0; + out[stride*(nn-1-col)] += res1; + } } if ( dof_to_quad == true && nn%2==1 && mm%2==1 ) { - if (add==false) - out[stride*n_cols] = in[stride*mid]; - else - out[stride*n_cols] += in[stride*mid]; + if (add==false) + out[stride*n_cols] = in[stride*mid]; + else + out[stride*n_cols] += in[stride*mid]; } else if (dof_to_quad == true && nn%2==1) { - VectorizedArray res0; - VectorizedArray val0 = shape_values[n_cols]; - if (mid > 0) - { - res0 = in[0] + in[stride*(mm-1)]; - res0 *= val0; - for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; - val1 *= val0; - res0 += val1; - } - } - else - res0 = VectorizedArray(); - if (add == false) - out[stride*n_cols] = res0; - else - out[stride*n_cols] += res0; + VectorizedArray res0; + VectorizedArray val0 = shape_values[n_cols]; + if (mid > 0) + { + res0 = in[0] + in[stride*(mm-1)]; + res0 *= val0; + for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; + val1 *= val0; + res0 += val1; + } + } + else + res0 = VectorizedArray(); + if (add == false) + out[stride*n_cols] = res0; + else + out[stride*n_cols] += res0; } else if (dof_to_quad == false && nn%2 == 1) { - VectorizedArray res0; - if (mid > 0) - { - VectorizedArray val0 = shape_values[n_cols*n_q_points_1d]; - res0 = in[0] + in[stride*(mm-1)]; - res0 *= val0; - for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; - val1 *= val0; - res0 += val1; - } - if (mm % 2) - res0 += in[stride*mid]; - } - else - res0 = in[0]; - if (add == false) - out[stride*n_cols] = res0; - else - out[stride*n_cols] += res0; + VectorizedArray res0; + if (mid > 0) + { + VectorizedArray val0 = shape_values[n_cols*n_q_points_1d]; + res0 = in[0] + in[stride*(mm-1)]; + res0 *= val0; + for (int ind=1; ind val1 = in[stride*ind] + in[stride*(mm-1-ind)]; + val1 *= val0; + res0 += val1; + } + if (mm % 2) + res0 += in[stride*mid]; + } + else + res0 = in[0]; + if (add == false) + out[stride*n_cols] = res0; + else + out[stride*n_cols] += res0; } // increment: in regular case, just go to the next point in @@ -4031,16 +4033,16 @@ namespace internal switch (direction) { case 0: - in += mm; - out += nn; - break; + in += mm; + out += nn; + break; case 1: case 2: - ++in; - ++out; - break; + ++in; + ++out; + break; default: - Assert (false, ExcNotImplemented()); + Assert (false, ExcNotImplemented()); } } if (direction == 1) @@ -4081,12 +4083,12 @@ namespace internal inline void apply_tensor_product_gradients (const VectorizedArray *shape_gradients, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = dof_to_quad ? (fe_degree+1) : n_q_points_1d, - nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); + nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); const int n_cols = nn / 2; const int mid = mm / 2; @@ -4225,12 +4227,12 @@ namespace internal inline void apply_tensor_product_hessians (const VectorizedArray *shape_hessians, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = dof_to_quad ? (fe_degree+1) : n_q_points_1d, - nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); + nn = dof_to_quad ? n_q_points_1d : (fe_degree+1); const int n_cols = nn / 2; const int mid = mm / 2; @@ -4399,8 +4401,8 @@ namespace internal inline void apply_tensor_product_gradients_gl (const VectorizedArray *shape_gradients, - const VectorizedArray in [], - VectorizedArray out []) + const VectorizedArray in [], + VectorizedArray out []) { AssertIndexRange (direction, dim); const int mm = fe_degree+1; diff --git a/deal.II/include/deal.II/matrix_free/helper_functions.h b/deal.II/include/deal.II/matrix_free/helper_functions.h index 630178b7b1..e5e0d6d75a 100644 --- a/deal.II/include/deal.II/matrix_free/helper_functions.h +++ b/deal.II/include/deal.II/matrix_free/helper_functions.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_free_helper_functions_h #define __deal2__matrix_free_helper_functions_h diff --git a/deal.II/include/deal.II/matrix_free/mapping_info.h b/deal.II/include/deal.II/matrix_free/mapping_info.h index 4eb7cab711..692cf4de57 100644 --- a/deal.II/include/deal.II/matrix_free/mapping_info.h +++ b/deal.II/include/deal.II/matrix_free/mapping_info.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011-2012 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_free_mapping_info_h #define __deal2__matrix_free_mapping_info_h diff --git a/deal.II/include/deal.II/matrix_free/mapping_info.templates.h b/deal.II/include/deal.II/matrix_free/mapping_info.templates.h index 7c7a57292b..f19e7be6c5 100644 --- a/deal.II/include/deal.II/matrix_free/mapping_info.templates.h +++ b/deal.II/include/deal.II/matrix_free/mapping_info.templates.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011-2012 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/include/deal.II/matrix_free/matrix_free.h b/deal.II/include/deal.II/matrix_free/matrix_free.h index b54415d4d8..c3fe2de0f1 100644 --- a/deal.II/include/deal.II/matrix_free/matrix_free.h +++ b/deal.II/include/deal.II/matrix_free/matrix_free.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_free_h #define __deal2__matrix_free_h @@ -554,15 +558,18 @@ public: /** * Returns a list of all degrees of freedom that are constrained. The list - * is returned in local index space for the locally owned range of the - * vector, not in global numbers. In addition, it only returns the indices - * for degrees of freedom that are owned locally, not for ghosts. - */ - const std::vector & + * is returned in MPI-local index space for the locally owned range of the + * vector, not in global MPI index space that spans all MPI processors. To + * get numbers in global index space, call + * get_vector_partitioner()->local_to_global on an entry of the + * vector. In addition, it only returns the indices for degrees of freedom + * that are owned locally, not for ghosts. + */ + const std::vector & get_constrained_dofs (const unsigned int fe_component = 0) const; /** - * Calls renumber_dofs function in dof info which renumbers the degrees + * Calls renumber_dofs function in dof_info which renumbers the degrees * of freedom according to the ordering for parallelization. */ void renumber_dofs (std::vector &renumbering, @@ -972,7 +979,7 @@ MatrixFree::get_vector_partitioner (const unsigned int comp) const template inline -const std::vector & +const std::vector & MatrixFree::get_constrained_dofs (const unsigned int comp) const { AssertIndexRange (comp, n_components()); @@ -1203,8 +1210,7 @@ MatrixFree::get_cell_iterator(const unsigned int macro_cell_number, AssertIndexRange (dof_index, dof_handlers.n_dof_handlers); AssertIndexRange (macro_cell_number, size_info.n_macro_cells); AssertIndexRange (vector_number, vectorization_length); - const unsigned int irreg_filled = - std_cxx1x::get<2>(dof_info[dof_index].row_starts[macro_cell_number]); + const unsigned int irreg_filled = dof_info[dof_index].row_starts[macro_cell_number][2]; if (irreg_filled > 0) AssertIndexRange (vector_number, irreg_filled); #endif @@ -1242,8 +1248,7 @@ MatrixFree::get_hp_cell_iterator(const unsigned int macro_cell_numbe AssertIndexRange (dof_index, dof_handlers.n_dof_handlers); AssertIndexRange (macro_cell_number, size_info.n_macro_cells); AssertIndexRange (vector_number, vectorization_length); - const unsigned int irreg_filled = - std_cxx1x::get<2>(dof_info[dof_index].row_starts[macro_cell_number]); + const unsigned int irreg_filled = dof_info[dof_index].row_starts[macro_cell_number][2]; if (irreg_filled > 0) AssertIndexRange (vector_number, irreg_filled); #endif @@ -1265,7 +1270,7 @@ bool MatrixFree::at_irregular_cell (const unsigned int macro_cell) const { AssertIndexRange (macro_cell, size_info.n_macro_cells); - return std_cxx1x::get<2>(dof_info[0].row_starts[macro_cell]) > 0; + return dof_info[0].row_starts[macro_cell][2] > 0; } @@ -1276,8 +1281,7 @@ unsigned int MatrixFree::n_components_filled (const unsigned int macro_cell) const { AssertIndexRange (macro_cell, size_info.n_macro_cells); - const unsigned int n_filled = - std_cxx1x::get<2>(dof_info[0].row_starts[macro_cell]); + const unsigned int n_filled = dof_info[0].row_starts[macro_cell][2]; if (n_filled == 0) return VectorizedArray::n_array_elements; else diff --git a/deal.II/include/deal.II/matrix_free/matrix_free.templates.h b/deal.II/include/deal.II/matrix_free/matrix_free.templates.h index d19c2a019c..4e3d3c463a 100644 --- a/deal.II/include/deal.II/matrix_free/matrix_free.templates.h +++ b/deal.II/include/deal.II/matrix_free/matrix_free.templates.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011, 2012 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -174,7 +178,7 @@ internal_reinit(const Mapping &mapping, dof_info[i].n_components = dof_handler[i]->get_fe().element_multiplicity(0); dof_info[i].dofs_per_cell.push_back(dof_handler[i]->get_fe().dofs_per_cell); dof_info[i].row_starts.resize(size_info.n_macro_cells+1); - std_cxx1x::get<2>(dof_info[i].row_starts.back()) = + dof_info[i].row_starts.back()[2] = cell_level_index.size() % VectorizedArray::n_array_elements; // if indices are not initialized, the cell_level_index might not be @@ -296,7 +300,7 @@ internal_reinit(const Mapping &mapping, dof_info[i].n_components = dof_handler[i]->get_fe()[0].element_multiplicity(0); dof_info[i].dofs_per_cell.push_back(dof_handler[i]->get_fe()[0].dofs_per_cell); dof_info[i].row_starts.resize(size_info.n_macro_cells+1); - std_cxx1x::get<2>(dof_info[i].row_starts.back()) = + dof_info[i].row_starts.back()[2] = cell_level_index.size() % VectorizedArray::n_array_elements; // if indices are not initialized, the cell_level_index might not be @@ -459,14 +463,12 @@ void MatrixFree::initialize_indices { const unsigned int n_fe = dof_handlers.n_dof_handlers; const unsigned int n_active_cells = cell_level_index.size(); - const unsigned int n_mpi_procs = size_info.n_procs; AssertDimension (n_active_cells, cell_level_index.size()); AssertDimension (n_fe, locally_owned_set.size()); AssertDimension (n_fe, constraint.size()); std::vector local_dof_indices; - std::vector > ghost_dofs(n_fe); std::vector > > lexicographic_inv(n_fe); internal::MatrixFreeFunctions::ConstraintValues constraint_values; @@ -526,7 +528,7 @@ void MatrixFree::initialize_indices dynamic_cast,dim,dim>*> (&fe.base_element(0)); const FE_Poly >,dim,dim> *fe_poly_piece = + PiecewisePolynomial >,dim,dim> *fe_poly_piece = dynamic_cast >,dim,dim>*> (&fe.base_element(0)); @@ -577,8 +579,9 @@ void MatrixFree::initialize_indices // initialize the arrays for indices dof_info[no].row_starts.resize (n_active_cells+1); - dof_info[no].row_starts[0] = std_cxx1x::tuple (0,0,0); + dof_info[no].row_starts[0][0] = 0; + dof_info[no].row_starts[0][1] = 0; + dof_info[no].row_starts[0][2] = 0; dof_info[no].dof_indices.reserve ((n_active_cells*dof_info[no].dofs_per_cell[0]*3)/2); @@ -589,11 +592,9 @@ void MatrixFree::initialize_indices end_index = dof_info[no].vector_partitioner->local_range().second; for (types::global_dof_index i=start_index; iis_constrained(i)==true) - dof_info[no].constrained_dofs.push_back(i-start_index); + dof_info[no].constrained_dofs. + push_back(static_cast(i-start_index)); } - - if (n_mpi_procs > 1) - ghost_dofs[no].reserve (locally_owned_set[no].n_elements()/10+1); } // extract all the global indices associated with the computation, and form @@ -685,7 +686,7 @@ void MatrixFree::initialize_indices // reorganize the indices in order to overlap communication in MPI with // computations: Place all cells with ghost indices into one chunk. Also // reorder cells so that we can parallelize by threads - std::vector renumbering; + std::vector renumbering; if (task_info.use_multithreading == true) { dof_info[0].compute_renumber_parallel (boundary_cells, size_info, @@ -715,7 +716,7 @@ void MatrixFree::initialize_indices // operations will then be done simultaneously). #ifdef DEBUG { - std::vector sorted_renumbering (renumbering); + std::vector sorted_renumbering (renumbering); std::sort (sorted_renumbering.begin(), sorted_renumbering.end()); for (unsigned int i=0; i #include @@ -61,13 +65,13 @@ namespace internal const FE_Poly,dim,dim> *fe_poly = dynamic_cast,dim,dim>*>(&fe); const FE_Poly >,dim,dim> *fe_poly_piece = + PiecewisePolynomial >,dim,dim> *fe_poly_piece = dynamic_cast >,dim,dim>*> (&fe); Assert (fe_poly != 0 || fe_poly_piece, ExcNotImplemented()); lexicographic = fe_poly != 0 ? - fe_poly->get_poly_space_numbering_inverse() : - fe_poly_piece->get_poly_space_numbering_inverse(); + fe_poly->get_poly_space_numbering_inverse() : + fe_poly_piece->get_poly_space_numbering_inverse(); // to evaluate 1D polynomials, evaluate along the line where y=z=0, // assuming that shape_value(0,Point()) == 1. otherwise, need diff --git a/deal.II/include/deal.II/meshworker/assembler.h b/deal.II/include/deal.II/meshworker/assembler.h index 0f6f3242fb..6135a031f4 100644 --- a/deal.II/include/deal.II/meshworker/assembler.h +++ b/deal.II/include/deal.II/meshworker/assembler.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_assembler_h #define __deal2__mesh_worker_assembler_h diff --git a/deal.II/include/deal.II/meshworker/dof_info.h b/deal.II/include/deal.II/meshworker/dof_info.h index 76f1679ce9..402f7822ea 100644 --- a/deal.II/include/deal.II/meshworker/dof_info.h +++ b/deal.II/include/deal.II/meshworker/dof_info.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_dof_info_h #define __deal2__mesh_worker_dof_info_h @@ -117,7 +122,7 @@ namespace MeshWorker * pointer empty, but setting * the #aux_local_indices. */ - DoFInfo (const DoFHandler& dof_handler); + DoFInfo (const DoFHandler &dof_handler); /** * Set the current cell and @@ -151,7 +156,7 @@ namespace MeshWorker template void set_face (const DHFaceIterator &f, const unsigned int face_no); - + /** * Switch to a new subface of the same cell. Does not change @p * indices and does not reset data in LocalResults. @@ -313,7 +318,7 @@ namespace MeshWorker get_indices(c); level_cell = c->is_level_cell(); - cell = static_cast::cell_iterator> (c); + cell = typename Triangulation::cell_iterator(*c); face_number = deal_II_numbers::invalid_unsigned_int; sub_number = deal_II_numbers::invalid_unsigned_int; if (block_info) @@ -345,11 +350,11 @@ namespace MeshWorker const unsigned int face_no) { if ((cell.state() != IteratorState::valid) - || cell != static_cast::cell_iterator> (c)) + || cell != typename Triangulation::cell_iterator(*c)) get_indices(c); level_cell = c->is_level_cell(); - cell = static_cast::cell_iterator> (c); + cell = typename Triangulation::cell_iterator(*c); set_face(f,face_no); if (block_info) diff --git a/deal.II/include/deal.II/meshworker/dof_info.templates.h b/deal.II/include/deal.II/meshworker/dof_info.templates.h index b3eefcfcdd..91c25acbc5 100644 --- a/deal.II/include/deal.II/meshworker/dof_info.templates.h +++ b/deal.II/include/deal.II/meshworker/dof_info.templates.h @@ -1,15 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/include/deal.II/meshworker/functional.h b/deal.II/include/deal.II/meshworker/functional.h index 08546b1ba9..a651ba1acc 100644 --- a/deal.II/include/deal.II/meshworker/functional.h +++ b/deal.II/include/deal.II/meshworker/functional.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_functional_h #define __deal2__mesh_worker_functional_h diff --git a/deal.II/include/deal.II/meshworker/integration_info.h b/deal.II/include/deal.II/meshworker/integration_info.h index aa220d1f6b..1bd8c63b5c 100644 --- a/deal.II/include/deal.II/meshworker/integration_info.h +++ b/deal.II/include/deal.II/meshworker/integration_info.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_integration_info_h #define __deal2__mesh_worker_integration_info_h @@ -85,44 +90,30 @@ namespace MeshWorker IntegrationInfo(); /** - * Copy constructor, creating a - * clone to be used by + * Copy constructor, creating a clone to be used by * WorksTream::run(). */ IntegrationInfo(const IntegrationInfo &other); /** - * Build all internal - * structures, in particular - * the FEValuesBase objects - * and allocate space for - * data vectors. + * Build all internal structures, in particular the FEValuesBase + * objects and allocate space for data vectors. * - * @param el is the finite - * element of the DoFHandler. + * @param el is the finite element of the DoFHandler. * - * @param mapping is the Mapping - * object used to map the - * mesh cells. + * @param mapping is the Mapping object used to map the mesh + * cells. * - * @param quadrature is a - * Quadrature formula used in - * the constructor of the - * FEVALUES objects. + * @param quadrature is a Quadrature formula used in the + * constructor of the FEVALUES objects. * - * @param flags are the - * UpdateFlags used in - * the constructor of the + * @param flags are the UpdateFlags used in the constructor of the * FEVALUES objects. * - * @param local_block_info is - * an optional parameter for - * systems of PDE. If it is - * provided with reasonable - * data, then the degrees of - * freedom on the cells will be - * re-ordered to reflect the - * block structure of the system. + * @param local_block_info is an optional parameter for systems of + * PDE. If it is provided with reasonable data, then the degrees + * of freedom on the cells will be re-ordered to reflect the block + * structure of the system. */ template void initialize(const FiniteElement &el, @@ -132,9 +123,7 @@ namespace MeshWorker const BlockInfo *local_block_info = 0); /** - * Initialize the data - * vector and cache the - * selector. + * Initialize the data vector and cache the selector. */ void initialize_data(const std_cxx1x::shared_ptr > &data); @@ -147,97 +136,67 @@ namespace MeshWorker bool multigrid; /// Access to finite element /** - * This is the access - * function being used, if - * the constructor for a - * single element was - * used. It throws an - * exception, if applied to a - * vector of elements. + * This is the access function being used, if the constructor for + * a single element was used. It throws an exception, if applied + * to a vector of elements. */ const FEValuesBase &fe_values () const; /// Access to finite elements /** - * This access function must - * be used if the constructor - * for a group of elements - * was used. + * This access function must be used if the constructor for a + * group of elements was used. * * @see DGBlockSplitApplication */ const FEValuesBase &fe_values (const unsigned int i) const; /** - * The vector containing the - * values of finite element - * functions in the quadrature - * points. + * The vector containing the values of finite element functions in + * the quadrature points. * - * There is one vector per - * selected finite element - * function, containing one - * vector for each component, - * containing vectors with - * values for each quadrature - * point. + * There is one vector per selected finite element function, + * containing one vector for each component, containing vectors + * with values for each quadrature point. */ std::vector > > values; /** - * The vector containing the - * derivatives of finite - * element functions in the - * quadrature points. + * The vector containing the derivatives of finite element + * functions in the quadrature points. * - * There is one vector per - * selected finite element - * function, containing one - * vector for each component, - * containing vectors with - * values for each quadrature - * point. + * There is one vector per selected finite element function, + * containing one vector for each component, containing vectors + * with values for each quadrature point. */ std::vector > > > gradients; /** - * The vector containing the - * second derivatives of finite - * element functions in the - * quadrature points. + * The vector containing the second derivatives of finite element + * functions in the quadrature points. * - * There is one vector per - * selected finite element - * function, containing one - * vector for each component, - * containing vectors with - * values for each quadrature - * point. + * There is one vector per selected finite element function, + * containing one vector for each component, containing vectors + * with values for each quadrature point. */ std::vector > > > hessians; /** - * Reinitialize internal data - * structures for use on a cell. + * Reinitialize internal data structures for use on a cell. */ template void reinit(const DoFInfo &i); /** - * Use the finite element - * functions in #global_data - * and fill the vectors - * #values, #gradients and - * #hessians. + * Use the finite element functions in #global_data and fill the + * vectors #values, #gradients and #hessians. */ template void fill_local_data(const DoFInfo &info, bool split_fevalues); /** - * The global data vector - * used to compute function - * values in quadrature - * points. + * The global data vector used to compute function values in + * quadrature points. */ std_cxx1x::shared_ptr > global_data; @@ -248,13 +207,9 @@ namespace MeshWorker private: /** - * Use the finite element - * functions in #global_data - * and fill the vectors - * #values, #gradients and - * #hessians with values - * according to the - * selector. + * Use the finite element functions in #global_data and fill the + * vectors #values, #gradients and #hessians with values according + * to the selector. */ template void fill_local_data( @@ -262,8 +217,7 @@ namespace MeshWorker VectorSelector &selector, bool split_fevalues) const; /** - * Cache the number of - * components of the system element. + * Cache the number of components of the system element. */ unsigned int n_components; }; @@ -341,34 +295,22 @@ namespace MeshWorker IntegrationInfoBox (); /** - * Initialize the - * IntegrationInfo objects - * contained. + * Initialize the IntegrationInfo objects contained. * - * Before doing so, add update - * flags necessary to produce - * the data needed and also - * set uninitialized quadrature - * rules to Gauss formulas, - * which integrate polynomial - * bilinear forms exactly. + * Before doing so, add update flags necessary to produce the data + * needed and also set uninitialized quadrature rules to Gauss + * formulas, which integrate polynomial bilinear forms exactly. */ void initialize(const FiniteElement &el, const Mapping &mapping, const BlockInfo *block_info = 0); /** - * Initialize the - * IntegrationInfo objects - * contained. + * Initialize the IntegrationInfo objects contained. * - * Before doing so, add update - * flags necessary to produce - * the data needed and also - * set uninitialized quadrature - * rules to Gauss formulas, - * which integrate polynomial - * bilinear forms exactly. + * Before doing so, add update flags necessary to produce the data + * needed and also set uninitialized quadrature rules to Gauss + * formulas, which integrate polynomial bilinear forms exactly. */ template void initialize(const FiniteElement &el, @@ -377,17 +319,11 @@ namespace MeshWorker const BlockInfo *block_info = 0); /** - * Initialize the - * IntegrationInfo objects - * contained. + * Initialize the IntegrationInfo objects contained. * - * Before doing so, add update - * flags necessary to produce - * the data needed and also - * set uninitialized quadrature - * rules to Gauss formulas, - * which integrate polynomial - * bilinear forms exactly. + * Before doing so, add update flags necessary to produce the data + * needed and also set uninitialized quadrature rules to Gauss + * formulas, which integrate polynomial bilinear forms exactly. */ template void initialize(const FiniteElement &el, @@ -400,64 +336,43 @@ namespace MeshWorker /* @{ */ /** - * Call this function before - * initialize() in order to - * guess the update flags - * needed, based on the data - * selected. + * Call this function before initialize() in order to guess the + * update flags needed, based on the data selected. * - * When computing face fluxes, - * we normally can use the - * geometry (integration - * weights and normal vectors) - * from the original cell and - * thus can avoid updating - * these values on the - * neighboring cell. Set - * neighbor_geometry - * to true in order to - * initialize these values as - * well. + * When computing face fluxes, we normally can use the geometry + * (integration weights and normal vectors) from the original cell + * and thus can avoid updating these values on the neighboring + * cell. Set neighbor_geometry to true in order to + * initialize these values as well. */ void initialize_update_flags(bool neighbor_geometry = false); /** - * Add FEValues UpdateFlags for - * integration on all objects - * (cells, boundary faces and - * all interior faces). + * Add FEValues UpdateFlags for integration on all objects (cells, + * boundary faces and all interior faces). */ void add_update_flags_all (const UpdateFlags flags); /** - * Add FEValues UpdateFlags for - * integration on cells. + * Add FEValues UpdateFlags for integration on cells. */ void add_update_flags_cell(const UpdateFlags flags); /** - * Add FEValues UpdateFlags for - * integration on boundary faces. + * Add FEValues UpdateFlags for integration on boundary faces. */ void add_update_flags_boundary(const UpdateFlags flags); /** - * Add FEValues UpdateFlags for - * integration on interior faces. + * Add FEValues UpdateFlags for integration on interior faces. */ void add_update_flags_face(const UpdateFlags flags); /** - * Add additional update flags - * to the ones already set in - * this program. The four - * boolean flags indicate - * whether the additional flags - * should be set for cell, - * boundary, interelement face - * for the cell itself - * or neighbor cell, or - * any combination thereof. + * Add additional update flags to the ones already set in this + * program. The four boolean flags indicate whether the additional + * flags should be set for cell, boundary, interelement face for + * the cell itself or neighbor cell, or any combination thereof. */ void add_update_flags(const UpdateFlags flags, const bool cell = true, @@ -466,19 +381,12 @@ namespace MeshWorker const bool neighbor = true); /** - * Assign n-point Gauss - * quadratures to each of the - * quadrature rules. Here, a - * size of zero points means - * that no loop over these grid - * entities should be - * performed. + * Assign n-point Gauss quadratures to each of the quadrature + * rules. Here, a size of zero points means that no loop over + * these grid entities should be performed. * - * If the parameter - * force is true, then - * all quadrature sets are - * filled with new quadrature - * ruels. If it is false, then + * If the parameter force is true, then all quadrature + * sets are filled with new quadrature ruels. If it is false, then * only empty rules are changed. */ void initialize_gauss_quadrature(unsigned int n_cell_points, @@ -492,59 +400,45 @@ namespace MeshWorker std::size_t memory_consumption () const; /** - * The set of update flags - * for boundary cell integration. + * The set of update flags for boundary cell integration. * - * Defaults to - * #update_JxW_values. + * Defaults to #update_JxW_values. */ UpdateFlags cell_flags; /** - * The set of update flags - * for boundary face integration. + * The set of update flags for boundary face integration. * - * Defaults to - * #update_JxW_values and - * #update_normal_vectors. + * Defaults to #update_JxW_values and #update_normal_vectors. */ UpdateFlags boundary_flags; /** - * The set of update flags - * for interior face integration. + * The set of update flags for interior face integration. * - * Defaults to - * #update_JxW_values and - * #update_normal_vectors. + * Defaults to #update_JxW_values and #update_normal_vectors. */ UpdateFlags face_flags; /** - * The set of update flags - * for interior face integration. + * The set of update flags for interior face integration. * - * Defaults to - * #update_default, since - * quadrature weights are - * taken from the other cell. + * Defaults to #update_default, since quadrature weights are taken + * from the other cell. */ UpdateFlags neighbor_flags; /** - * The quadrature rule used - * on cells. + * The quadrature rule used on cells. */ Quadrature cell_quadrature; /** - * The quadrature rule used - * on boundary faces. + * The quadrature rule used on boundary faces. */ Quadrature boundary_quadrature; /** - * The quadrature rule used - * on interior faces. + * The quadrature rule used on interior faces. */ Quadrature face_quadrature; /* @} */ @@ -555,46 +449,30 @@ namespace MeshWorker /* @{ */ /** - * Initialize the - * VectorSelector objects - * #cell_selector, - * #boundary_selector and - * #face_selector in order to - * save computational - * effort. If no selectors - * are used, then values for - * all named vectors in - * DoFInfo::global_data will be - * computed in all quadrature - * points. + * Initialize the VectorSelector objects #cell_selector, + * #boundary_selector and #face_selector in order to save + * computational effort. If no selectors are used, then values for + * all named vectors in DoFInfo::global_data will be computed in + * all quadrature points. * - * This function will also - * add UpdateFlags to the - * flags stored in this class. + * This function will also add UpdateFlags to the flags stored in + * this class. */ /** - * Select the vectors from - * DoFInfo::global_data - * that should be computed in - * the quadrature points on cells. + * Select the vectors from DoFInfo::global_data that should be + * computed in the quadrature points on cells. */ MeshWorker::VectorSelector cell_selector; /** - * Select the vectors from - * DoFInfo::global_data - * that should be computed in - * the quadrature points on - * boundary faces. + * Select the vectors from DoFInfo::global_data that should be + * computed in the quadrature points on boundary faces. */ MeshWorker::VectorSelector boundary_selector; /** - * Select the vectors from - * DoFInfo::global_data - * that should be computed in - * the quadrature points on - * interior faces. + * Select the vectors from DoFInfo::global_data that should be + * computed in the quadrature points on interior faces. */ MeshWorker::VectorSelector face_selector; @@ -608,68 +486,41 @@ namespace MeshWorker */ /* @{ */ /** - * A callback function which is - * called in the loop over all - * cells, after the action on a - * cell has been performed and - * before the faces are dealt - * with. + * A callback function which is called in the loop over all cells, + * after the action on a cell has been performed and before the + * faces are dealt with. * - * In order for this function - * to have this effect, - * at least either of the - * arguments - * boundary_worker or - * face_worker - * arguments of loop() should - * be nonzero. Additionally, - * cells_first should - * be true. If - * cells_first is - * false, this function is - * called before any action on - * a cell is taken. + * In order for this function to have this effect, at least either + * of the arguments boundary_worker or + * face_worker arguments of loop() should be + * nonzero. Additionally, cells_first should be true. If + * cells_first is false, this function is called before + * any action on a cell is taken. * - * And empty function in this - * class, but can be replaced - * in other classes given to - * loop() instead. + * And empty function in this class, but can be replaced in other + * classes given to loop() instead. * - * See loop() and cell_action() - * for more details of how this + * See loop() and cell_action() for more details of how this * function can be used. */ template void post_cell(const DoFInfoBox &); /** - * A callback function which is - * called in the loop over all - * cells, after the action on - * the faces of a cell has been - * performed and before the - * cell itself is dealt with - * (assumes + * A callback function which is called in the loop over all cells, + * after the action on the faces of a cell has been performed and + * before the cell itself is dealt with (assumes * cells_first is false). * - * In order for this function - * to have a reasonable effect, - * at least either of the - * arguments - * boundary_worker or - * face_worker - * arguments of loop() should - * be nonzero. Additionally, - * cells_first should - * be false. + * In order for this function to have a reasonable effect, at + * least either of the arguments boundary_worker or + * face_worker arguments of loop() should be + * nonzero. Additionally, cells_first should be false. * - * And empty function in this - * class, but can be replaced - * in other classes given to - * loop() instead. + * And empty function in this class, but can be replaced in other + * classes given to loop() instead. * - * See loop() and cell_action() - * for more details of how this + * See loop() and cell_action() for more details of how this * function can be used. */ template @@ -680,27 +531,21 @@ namespace MeshWorker */ CellInfo cell; /** - * The info object for a - * boundary face. + * The info object for a boundary face. */ CellInfo boundary; /** - * The info object for a - * regular interior face, seen - * from the first cell. + * The info object for a regular interior face, seen from the + * first cell. */ CellInfo face; /** - * The info object for the - * refined side of an interior - * face seen from the first - * cell. + * The info object for the refined side of an interior face seen + * from the first cell. */ CellInfo subface; /** - * The info object for an - * interior face, seen from the - * other cell. + * The info object for an interior face, seen from the other cell. */ CellInfo neighbor; diff --git a/deal.II/include/deal.II/meshworker/integration_info.templates.h b/deal.II/include/deal.II/meshworker/integration_info.templates.h index 93b5d01f07..b1e1c21932 100644 --- a/deal.II/include/deal.II/meshworker/integration_info.templates.h +++ b/deal.II/include/deal.II/meshworker/integration_info.templates.h @@ -1,15 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/include/deal.II/meshworker/local_integrator.h b/deal.II/include/deal.II/meshworker/local_integrator.h index c46173eb21..2516135024 100644 --- a/deal.II/include/deal.II/meshworker/local_integrator.h +++ b/deal.II/include/deal.II/meshworker/local_integrator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_local_integrator_h #define __deal2__mesh_worker_local_integrator_h @@ -35,6 +40,10 @@ namespace MeshWorker * integrate on boundary and interior faces. Thes flags are true by * default, but can be modified by applications to speed up the loop. * + * If a function is not overloaded in a derived class, but its usage + * flag is true, the function will cause an exception + * ExcPureFunction. + * * @ingroup MeshWorker * @author Guido Kanschat * @date 2012 @@ -44,64 +53,68 @@ namespace MeshWorker { public: /** - * The constructor setting - * default values. + * The constructor setting default values, namely all integration flags to true. */ LocalIntegrator(); + /** + * The constructor setting integration flags to specified values. + */ + LocalIntegrator(bool use_cell, bool use_boundary, bool use_face); + /** * The empty virtual destructor. */ ~LocalIntegrator(); /** - * Virtual function for - * integrating on cells. + * Virtual function for integrating on cells. Throws exception + * PureFunctionCalled if not overloaded by a derived class. */ virtual void cell(DoFInfo &dinfo, - IntegrationInfo &info) const = 0; + IntegrationInfo &info) const; /** - * Virtual function for - * integrating on boundary faces. + * Virtual function for integrating on boundary faces. Throws exception + * PureFunctionCalled if not overloaded by a derived class. */ virtual void boundary(DoFInfo &dinfo, - IntegrationInfo &info) const = 0; + IntegrationInfo &info) const; /** - * Virtual function for - * integrating on interior faces. + * Virtual function for integrating on interior faces. Throws exception + * PureFunctionCalled if not overloaded by a derived class. */ virtual void face(DoFInfo &dinfo1, DoFInfo &dinfo2, IntegrationInfo &info1, - IntegrationInfo &info2) const = 0; + IntegrationInfo &info2) const; /** - * The flag indicating whether - * the cell integrator cell() - * is to be used in the - * loop. Defaults to - * true. + * The flag indicating whether the cell integrator cell() is to be + * used in the loop. Defaults to true. */ bool use_cell; /** - * The flag indicating whether - * the boundary integrator - * boundary() is to be - * used in the loop. Defaults - * to true. + * The flag indicating whether the boundary integrator boundary() + * is to be used in the loop. Defaults to true. */ bool use_boundary; /** - * The flag indicating whether - * the interior face integrator - * face() is to be used in the - * loop. Defaults to - * true. + * The flag indicating whether the interior face integrator face() + * is to be used in the loop. Defaults to true. */ bool use_face; + /** + * This error is thrown if one of the virtual functions cell(), + * boundary(), or face() is called without being overloaded in a + * derived class. Consider setting #use_cell, #use_boundary, and + * #use_face to false, respectively. + * + * @ingroup Exceptions + */ + DeclException0(ExcPureFunction); }; } diff --git a/deal.II/include/deal.II/meshworker/local_results.h b/deal.II/include/deal.II/meshworker/local_results.h index 718d683b36..828632548a 100644 --- a/deal.II/include/deal.II/meshworker/local_results.h +++ b/deal.II/include/deal.II/meshworker/local_results.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_local_results_h #define __deal2__mesh_worker_local_results_h @@ -320,14 +325,14 @@ namespace MeshWorker * @note This function is usually only called by the assembler. */ void initialize_numbers(const unsigned int n); - + /** * Initialize the vector with vector values. * * @note This function is usually only called by the assembler. */ void initialize_vectors(const unsigned int n); - + /** * Allocate @p n local matrices. Additionally, set their block row * and column coordinates to zero. The matrices themselves are diff --git a/deal.II/include/deal.II/meshworker/loop.h b/deal.II/include/deal.II/meshworker/loop.h index d57f2a4a46..73ed8f5bd7 100644 --- a/deal.II/include/deal.II/meshworker/loop.h +++ b/deal.II/include/deal.II/meshworker/loop.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_loop_h #define __deal2__mesh_worker_loop_h @@ -28,6 +33,7 @@ DEAL_II_NAMESPACE_OPEN template class TriaActiveIterator; +template class FilteredIterator; namespace internal { @@ -46,6 +52,12 @@ namespace internal return true; } + template + inline bool is_active_iterator(const FilteredIterator > &) + { + return true; + } + template void assemble(const MeshWorker::DoFInfoBox &dinfo, A *assembler) { diff --git a/deal.II/include/deal.II/meshworker/output.h b/deal.II/include/deal.II/meshworker/output.h index 063d8784e0..e51d8c0116 100644 --- a/deal.II/include/deal.II/meshworker/output.h +++ b/deal.II/include/deal.II/meshworker/output.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_output_h #define __deal2__mesh_worker_output_h diff --git a/deal.II/include/deal.II/meshworker/simple.h b/deal.II/include/deal.II/meshworker/simple.h index a200c46abc..e43257df15 100644 --- a/deal.II/include/deal.II/meshworker/simple.h +++ b/deal.II/include/deal.II/meshworker/simple.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_simple_h #define __deal2__mesh_worker_simple_h @@ -115,8 +120,8 @@ namespace MeshWorker */ SmartPointer > constraints; }; - - + + /** * Assemble local matrices into a single global matrix. If this global * matrix has a block structure, this structure is not used, but @@ -251,29 +256,24 @@ namespace MeshWorker { public: /** - * Constructor, initializing - * the #threshold, which - * limits how small numbers - * may be to be entered into - * the matrix. + * Constructor, initializing the #threshold, which limits how + * small numbers may be to be entered into the matrix. */ MGMatrixSimple(double threshold = 1.e-12); /** - * Store the result matrix - * for later assembling. + * Store the result matrix for later assembling. */ void initialize(MGLevelObject &m); /** - * Initialize the multilevel - * constraints. + * Initialize the multilevel constraints. */ void initialize(const MGConstrainedDoFs &mg_constrained_dofs); /** - * @deprecated This function is of no effect. Only the block info - * structure in DoFInfo is being used. + * @deprecated This function is of no effect. Only the block + * info structure in DoFInfo is being used. * * Store information on the local block structure. If the * assembler is inititialized with this function, @@ -453,6 +453,15 @@ namespace MeshWorker */ void initialize(MATRIX &m, VECTOR &rhs); + /** + * Initialize the constraints. After this function has been + * called with a valid ConstraintMatrix, the function + * ConstraintMatrix::distribute_local_to_global() will be used + * by assemble() to distribute the cell and face matrices into a + * global sparse matrix. + */ + void initialize(const ConstraintMatrix &constraints); + /** * Initialize the local data * in the @@ -510,8 +519,8 @@ namespace MeshWorker inline void ResidualSimple::initialize_local_blocks(const BlockIndices &) {} - - + + template template inline void @@ -535,13 +544,13 @@ namespace MeshWorker } else { - if (info.indices_by_block.size() == 0) - constraints->distribute_local_to_global(info.vector(k).block(0), info.indices, (*residuals(k))); - else - for (unsigned int i=0;i != info.vector(k).n_blocks();++i) - constraints->distribute_local_to_global(info.vector(k).block(i), info.indices_by_block[i], (*residuals(k))); - } - } + if (info.indices_by_block.size() == 0) + constraints->distribute_local_to_global(info.vector(k).block(0), info.indices, (*residuals(k))); + else + for (unsigned int i=0; i != info.vector(k).n_blocks(); ++i) + constraints->distribute_local_to_global(info.vector(k).block(i), info.indices_by_block[i], (*residuals(k))); + } + } } template @@ -561,27 +570,27 @@ namespace MeshWorker } else { - if (info1.indices_by_block.size() == 0 && info2.indices_by_block.size() == 0) - { - constraints->distribute_local_to_global - (info1.vector(k).block(0), info1.indices, (*residuals(k))); - constraints->distribute_local_to_global - (info2.vector(k).block(0), info2.indices, (*residuals(k))); - } - else if (info1.indices_by_block.size() != 0 && info2.indices_by_block.size() != 0) - { - for (unsigned int i=0;idistribute_local_to_global - (info1.vector(k).block(i), info1.indices_by_block[i], (*residuals(k))); - constraints->distribute_local_to_global - (info2.vector(k).block(i), info2.indices_by_block[i], (*residuals(k))); - } - } - else - { - Assert(false, ExcNotImplemented()); - } + if (info1.indices_by_block.size() == 0 && info2.indices_by_block.size() == 0) + { + constraints->distribute_local_to_global + (info1.vector(k).block(0), info1.indices, (*residuals(k))); + constraints->distribute_local_to_global + (info2.vector(k).block(0), info2.indices, (*residuals(k))); + } + else if (info1.indices_by_block.size() != 0 && info2.indices_by_block.size() != 0) + { + for (unsigned int i=0; idistribute_local_to_global + (info1.vector(k).block(i), info1.indices_by_block[i], (*residuals(k))); + constraints->distribute_local_to_global + (info2.vector(k).block(i), info2.indices_by_block[i], (*residuals(k))); + } + } + else + { + Assert(false, ExcNotImplemented()); + } } } } @@ -721,9 +730,9 @@ namespace MeshWorker info2.indices_by_block[row], info1.indices_by_block[column]); } else - { - Assert(false, ExcNotImplemented()); - } + { + Assert(false, ExcNotImplemented()); + } } @@ -865,15 +874,8 @@ namespace MeshWorker { if (mg_constrained_dofs->set_boundary_values()) { - // At the - // boundary, - // only enter - // the term - // on the - // diagonal, - // but not - // the - // coupling terms + // At the boundary, only enter the term on the + // diagonal, but not the coupling terms if ((!mg_constrained_dofs->is_boundary_index(level, i1[j]) && !mg_constrained_dofs->is_boundary_index(level, i2[k])) || @@ -913,8 +915,7 @@ namespace MeshWorker for (unsigned int j=0; j= threshold) - if (mg_constrained_dofs->at_refinement_edge(level, i1[j]) && - !mg_constrained_dofs->at_refinement_edge(level, i2[k])) + if (!mg_constrained_dofs->at_refinement_edge(level, i2[k])) G.add(i1[j], i2[k], M(k,j)); } } @@ -943,8 +944,7 @@ namespace MeshWorker for (unsigned int j=0; j= threshold) - if (mg_constrained_dofs->at_refinement_edge(level, i1[j]) && - !mg_constrained_dofs->at_refinement_edge(level, i2[k])) + if (!mg_constrained_dofs->at_refinement_edge(level, i2[k])) G.add(i1[j], i2[k], M(j,k)); } } @@ -960,38 +960,41 @@ namespace MeshWorker { AssertDimension(M.m(), i1.size()); AssertDimension(M.n(), i2.size()); - - if (mg_constrained_dofs == 0) - { - for (unsigned int j=0; j= threshold) - G.add(i1[j], i2[k], M(j,k)); - } - else - { - for (unsigned int j=0; j= threshold) - if (mg_constrained_dofs->at_refinement_edge(level, i1[j]) && - !mg_constrained_dofs->at_refinement_edge(level, i2[k])) - { - if (mg_constrained_dofs->set_boundary_values()) - { - if ((!mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && - !mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k])) - || - (mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && - mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k]) && - i1[j] == i2[k])) - G.add(i1[j], i2[k], M(j,k)); - } - else - G.add(i1[j], i2[k], M(j,k)); - } - } + Assert(mg_constrained_dofs != 0, ExcInternalError()); + + for (unsigned int j=0; j= threshold) + // Enter values into matrix only if j corresponds to a + // degree of freedom on the refinemenent edge, k does + // not, and both are not on the boundary. This is part + // the difference between the complete matrix with no + // boundary condition at the refinement edge and and + // the matrix assembled above by assemble(). + + // Thus the logic is: enter the row if it is + // constrained by hanging node constraints (actually, + // the whole refinement edge), but not if it is + // constrained by a boundary constraint. + if (mg_constrained_dofs->at_refinement_edge(level, i1[j]) && + !mg_constrained_dofs->at_refinement_edge(level, i2[k])) + { + if (mg_constrained_dofs->set_boundary_values()) + { + if ((!mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && + !mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k])) + || + (mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && + mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k]) && + i1[j] == i2[k])) + G.add(i1[j], i2[k], M(j,k)); + } + else + G.add(i1[j], i2[k], M(j,k)); + } } - + + template inline void MGMatrixSimple::assemble_out( @@ -1003,38 +1006,29 @@ namespace MeshWorker { AssertDimension(M.n(), i1.size()); AssertDimension(M.m(), i2.size()); - - if (mg_constrained_dofs == 0) - { - for (unsigned int j=0; j= threshold) - G.add(i1[j], i2[k], M(k,j)); - } - else - { - for (unsigned int j=0; j= threshold) - if (mg_constrained_dofs->at_refinement_edge(level, i1[j]) && - !mg_constrained_dofs->at_refinement_edge(level, i2[k])) - { - if (mg_constrained_dofs->set_boundary_values()) - { - if ((!mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && - !mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k])) - || - (mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && - mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k]) && - i1[j] == i2[k])) - G.add(i1[j], i2[k], M(k,j)); - } - else - G.add(i1[j], i2[k], M(k,j)); - } - } + Assert(mg_constrained_dofs != 0, ExcInternalError()); + + for (unsigned int j=0; j= threshold) + if (mg_constrained_dofs->at_refinement_edge(level, i1[j]) && + !mg_constrained_dofs->at_refinement_edge(level, i2[k])) + { + if (mg_constrained_dofs->set_boundary_values()) + { + if ((!mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && + !mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k])) + || + (mg_constrained_dofs->at_refinement_edge_boundary(level, i1[j]) && + mg_constrained_dofs->at_refinement_edge_boundary(level, i2[k]) && + i1[j] == i2[k])) + G.add(i1[j], i2[k], M(k,j)); + } + else + G.add(i1[j], i2[k], M(k,j)); + } } - + template template @@ -1180,7 +1174,15 @@ namespace MeshWorker ResidualSimple::initialize(data); } + template + inline void + SystemSimple::initialize(const ConstraintMatrix &c) + { + MatrixSimple::initialize(c); + ResidualSimple::initialize(c); + } + template template inline void diff --git a/deal.II/include/deal.II/meshworker/vector_selector.h b/deal.II/include/deal.II/meshworker/vector_selector.h index 80f32264c9..5976df4dbd 100644 --- a/deal.II/include/deal.II/meshworker/vector_selector.h +++ b/deal.II/include/deal.II/meshworker/vector_selector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mesh_worker_vector_selector_h #define __deal2__mesh_worker_vector_selector_h diff --git a/deal.II/include/deal.II/meshworker/vector_selector.templates.h b/deal.II/include/deal.II/meshworker/vector_selector.templates.h index 1490db53bc..dc0e6fbbff 100644 --- a/deal.II/include/deal.II/meshworker/vector_selector.templates.h +++ b/deal.II/include/deal.II/meshworker/vector_selector.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/include/deal.II/multigrid/mg_base.h b/deal.II/include/deal.II/multigrid/mg_base.h index 0f953c034b..1f39395a7a 100644 --- a/deal.II/include/deal.II/multigrid/mg_base.h +++ b/deal.II/include/deal.II/multigrid/mg_base.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_base_h #define __deal2__mg_base_h diff --git a/deal.II/include/deal.II/multigrid/mg_block_smoother.h b/deal.II/include/deal.II/multigrid/mg_block_smoother.h index 688bfdf78b..cc22195abf 100644 --- a/deal.II/include/deal.II/multigrid/mg_block_smoother.h +++ b/deal.II/include/deal.II/multigrid/mg_block_smoother.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_block_smoother_h #define __deal2__mg_block_smoother_h diff --git a/deal.II/include/deal.II/multigrid/mg_coarse.h b/deal.II/include/deal.II/multigrid/mg_coarse.h index 1e7c410395..d586cf353a 100644 --- a/deal.II/include/deal.II/multigrid/mg_coarse.h +++ b/deal.II/include/deal.II/multigrid/mg_coarse.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_coarse_h #define __deal2__mg_coarse_h @@ -308,9 +313,9 @@ MGCoarseGridHouseholder::initialize( template void MGCoarseGridHouseholder::operator() ( - const unsigned int /*level*/, - VECTOR &dst, - const VECTOR &src) const + const unsigned int /*level*/, + VECTOR &dst, + const VECTOR &src) const { householder.least_squares(dst, src); } @@ -339,9 +344,9 @@ MGCoarseGridSVD::initialize( template void MGCoarseGridSVD::operator() ( - const unsigned int /*level*/, - VECTOR &dst, - const VECTOR &src) const + const unsigned int /*level*/, + VECTOR &dst, + const VECTOR &src) const { matrix.vmult(dst, src); } diff --git a/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h b/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h index 5587527497..85389cdffa 100644 --- a/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h +++ b/deal.II/include/deal.II/multigrid/mg_constrained_dofs.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_constraints_h #define __deal2__mg_constraints_h @@ -35,7 +40,7 @@ template struct FunctionMap; class MGConstrainedDoFs : public Subscriptor { public: - + typedef std::vector >::size_type size_dof; /** * Fill the internal data @@ -69,116 +74,97 @@ public: void clear(); /** - * Determine whether a dof index - * is subject to a boundary + * Determine whether a dof index is subject to a boundary * constraint. */ bool is_boundary_index (const unsigned int level, const types::global_dof_index index) const; /** - * Determine whether a dof index - * is at an edge that is not - * a refinement edge. + * Determine whether a dof index is at an edge that is not a + * refinement edge. */ bool non_refinement_edge_index (const unsigned int level, const types::global_dof_index index) const; /** - * Determine whether a dof index - * is at the refinement edge. + * Determine whether a dof index is at the refinement edge. */ bool at_refinement_edge (const unsigned int level, const types::global_dof_index index) const; /** - * Determine whether a dof index - * is at the refinement edge and - * subject to a boundary - * constraint . + * Determine whether a dof index is at the refinement edge and + * subject to a boundary constraint . */ bool at_refinement_edge_boundary (const unsigned int level, const types::global_dof_index index) const; /** - * Return the indices of dofs for each - * level that lie on the boundary of the - * domain. + * Return the indices of dofs for each level that lie on the + * boundary of the domain. */ const std::vector > & get_boundary_indices () const; /** - * Return the indices of dofs for each - * level that lie on the boundary of the - * domain. + * Return the indices of dofs for each level that lie on the + * boundary of the domain. */ const std::vector > & get_non_refinement_edge_indices () const; /** - * Return the indices of dofs for each - * level that lie on the refinement edge - * (i.e. are on faces between cells of - * this level and cells on the level - * below). + * Return the indices of dofs for each level that lie on the + * refinement edge (i.e. are on faces between cells of this level + * and cells on the level below). */ const std::vector > & get_refinement_edge_indices () const; /** - * Return the indices of dofs for each - * level that are in the intersection of - * the sets returned by - * get_boundary_indices() and + * Return the indices of dofs for each level that are in the + * intersection of the sets returned by get_boundary_indices() and * get_refinement_edge_indices(). */ const std::vector > & get_refinement_edge_boundary_indices () const; /** - * Return if boundary_indices need to - * be set or not. + * Return if boundary_indices need to be set or not. */ bool set_boundary_values () const; /** - * Return if the finite element requires - * continuity across refinement edges. + * Return if the finite element requires continuity across + * refinement edges. */ bool continuity_across_refinement_edges () const; private: /** - * The indices of boundary dofs - * for each level. + * The indices of boundary dofs for each level. */ std::vector > boundary_indices; /** - * The degrees of freedom on egdges - * that are not a - * refinement edge between a - * level and coarser cells. + * The degrees of freedom on egdges that are not a refinement edge + * between a level and coarser cells. */ std::vector > non_refinement_edge_indices; /** - * The degrees of freedom on the - * refinement edge between a - * level and coarser cells. + * The degrees of freedom on the refinement edge between a level and + * coarser cells. */ std::vector > refinement_edge_indices; /** - * The degrees of freedom on the - * refinement edge between a - * level and coarser cells, which - * are also on the boundary. + * The degrees of freedom on the refinement edge between a level and + * coarser cells, which are also on the boundary. * - * This is a subset of - * #refinement_edge_indices. + * This is a subset of #refinement_edge_indices. */ std::vector > refinement_edge_boundary_indices; }; @@ -189,7 +175,7 @@ inline void MGConstrainedDoFs::initialize(const DoFHandler &dof) { - const unsigned int nlevels = dof.get_tria().n_levels(); + const unsigned int nlevels = dof.get_tria().n_global_levels(); refinement_edge_indices.resize(nlevels); refinement_edge_boundary_indices.resize(nlevels); non_refinement_edge_indices.resize(nlevels); @@ -213,7 +199,7 @@ MGConstrainedDoFs::initialize( const typename FunctionMap::type &function_map, const ComponentMask &component_mask) { - const unsigned int nlevels = dof.get_tria().n_levels(); + const unsigned int nlevels = dof.get_tria().n_global_levels(); boundary_indices.resize(nlevels); refinement_edge_indices.resize(nlevels); refinement_edge_boundary_indices.resize(nlevels); diff --git a/deal.II/include/deal.II/multigrid/mg_dof_accessor.h b/deal.II/include/deal.II/multigrid/mg_dof_accessor.h index 464119719b..4067867a96 100644 --- a/deal.II/include/deal.II/multigrid/mg_dof_accessor.h +++ b/deal.II/include/deal.II/multigrid/mg_dof_accessor.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_dof_accessor_h #define __deal2__mg_dof_accessor_h diff --git a/deal.II/include/deal.II/multigrid/mg_dof_handler.h b/deal.II/include/deal.II/multigrid/mg_dof_handler.h index 736b9778ad..7bf6eca7e6 100644 --- a/deal.II/include/deal.II/multigrid/mg_dof_handler.h +++ b/deal.II/include/deal.II/multigrid/mg_dof_handler.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_dof_handler_h #define __deal2__mg_dof_handler_h diff --git a/deal.II/include/deal.II/multigrid/mg_dof_iterator_selector.h b/deal.II/include/deal.II/multigrid/mg_dof_iterator_selector.h index 5447e5c859..d1c699112d 100644 --- a/deal.II/include/deal.II/multigrid/mg_dof_iterator_selector.h +++ b/deal.II/include/deal.II/multigrid/mg_dof_iterator_selector.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_dof_iterator_selector_h #define __deal2__mg_dof_iterator_selector_h diff --git a/deal.II/include/deal.II/multigrid/mg_matrix.h b/deal.II/include/deal.II/multigrid/mg_matrix.h index dcba1d20b7..ca7d17925c 100644 --- a/deal.II/include/deal.II/multigrid/mg_matrix.h +++ b/deal.II/include/deal.II/multigrid/mg_matrix.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_matrix_h #define __deal2__mg_matrix_h diff --git a/deal.II/include/deal.II/multigrid/mg_smoother.h b/deal.II/include/deal.II/multigrid/mg_smoother.h index bbfbfcedff..abeb0045e2 100644 --- a/deal.II/include/deal.II/multigrid/mg_smoother.h +++ b/deal.II/include/deal.II/multigrid/mg_smoother.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_smoother_h #define __deal2__mg_smoother_h @@ -1230,8 +1235,13 @@ MGSmootherPrecondition::smooth( { if (this->debug > 0) deallog << 'T'; - matrices[level].Tvmult(*r,u); - r->sadd(-1.,1.,rhs); + if (i == 0 && u.all_zero()) + *r = rhs; + else + { + matrices[level].Tvmult(*r,u); + r->sadd(-1.,1.,rhs); + } if (this->debug > 2) deallog << ' ' << r->l2_norm() << ' '; smoothers[level].Tvmult(*d, *r); @@ -1242,8 +1252,13 @@ MGSmootherPrecondition::smooth( { if (this->debug > 0) deallog << 'N'; - matrices[level].vmult(*r,u); - r->sadd(-1.,rhs); + if (i == 0 && u.all_zero()) + *r = rhs; + else + { + matrices[level].vmult(*r,u); + r->sadd(-1.,rhs); + } if (this->debug > 2) deallog << ' ' << r->l2_norm() << ' '; smoothers[level].vmult(*d, *r); diff --git a/deal.II/include/deal.II/multigrid/mg_tools.h b/deal.II/include/deal.II/multigrid/mg_tools.h index 97641159a4..e06cbc96d9 100644 --- a/deal.II/include/deal.II/multigrid/mg_tools.h +++ b/deal.II/include/deal.II/multigrid/mg_tools.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_tools_h #define __deal2__mg_tools_h diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.h b/deal.II/include/deal.II/multigrid/mg_transfer.h index b87a922d98..6d869a3720 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_transfer_h #define __deal2__mg_transfer_h @@ -43,9 +48,9 @@ namespace internal { typedef ::dealii::SparsityPattern Sparsity; typedef ::dealii::SparseMatrix Matrix; - + template - static void reinit(Matrix& matrix, Sparsity& sparsity, int level, const CSP& csp, const DH&) + static void reinit(Matrix &matrix, Sparsity &sparsity, int level, const CSP &csp, const DH &) { sparsity.copy_from (csp); matrix.reinit (sparsity); @@ -58,15 +63,15 @@ namespace internal { typedef ::dealii::TrilinosWrappers::SparsityPattern Sparsity; typedef ::dealii::TrilinosWrappers::SparseMatrix Matrix; - + template - static void reinit(Matrix& matrix, Sparsity& sparsity, int level, const CSP& csp, DH& dh) + static void reinit(Matrix &matrix, Sparsity &sparsity, int level, const CSP &csp, DH &dh) { matrix.reinit(dh.locally_owned_mg_dofs(level+1), - dh.locally_owned_mg_dofs(level), - csp, MPI_COMM_WORLD, true); + dh.locally_owned_mg_dofs(level), + csp, MPI_COMM_WORLD, true); } - + }; template <> @@ -74,9 +79,9 @@ namespace internal { typedef ::dealii::TrilinosWrappers::SparsityPattern Sparsity; typedef ::dealii::TrilinosWrappers::SparseMatrix Matrix; - + template - static void reinit(Matrix& matrix, Sparsity& sparsity, int level, const CSP& csp, DH& dh) + static void reinit(Matrix &matrix, Sparsity &sparsity, int level, const CSP &csp, DH &dh) { } }; @@ -230,17 +235,17 @@ public: * Memory used by this object. */ std::size_t memory_consumption () const; - + /** * Print all the matrices for debugging purposes. */ - void print_matrices(std::ostream& os) const; + void print_matrices(std::ostream &os) const; /** * Print the copy index fields for debugging purposes. */ - void print_indices(std::ostream& os) const; - + void print_indices(std::ostream &os) const; + private: /** @@ -263,7 +268,7 @@ private: /** * Mapping for the copy_to_mg() and copy_from_mg() functions. Here only * index pairs locally owned - * + * * The data is organized as follows: one vector per level. Each * element of these vectors contains first the global index, then * the level index. @@ -290,7 +295,7 @@ private: */ std::vector > > copy_indices_from_me; - + /** * The vector that stores what diff --git a/deal.II/include/deal.II/multigrid/mg_transfer.templates.h b/deal.II/include/deal.II/multigrid/mg_transfer.templates.h index fc69e3a4e0..59e3cde2c1 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer.templates.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_transfer_templates_h #define __deal2__mg_transfer_templates_h @@ -198,24 +203,24 @@ MGTransferPrebuilt::copy_from_mg( // First copy all indices local to this process if (constraints==0) - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) = src[level](i->second); + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + dst(i->first) = src[level](i->second); else - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); - + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + // Do the same for the indices where the level index is local, // but the global index is not if (constraints==0) - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - dst(i->first) = src[level](i->second); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) = src[level](i->second); else - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); } } @@ -240,24 +245,24 @@ MGTransferPrebuilt::copy_from_mg_add ( { typedef std::vector >::const_iterator IT; if (constraints==0) - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - dst(i->first) += src[level](i->second); + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + dst(i->first) += src[level](i->second); else - for (IT i= copy_indices[level].begin(); - i != copy_indices[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); - + for (IT i= copy_indices[level].begin(); + i != copy_indices[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + // Do the same for the indices where the level index is local, // but the global index is not if (constraints==0) - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - dst(i->first) += src[level](i->second); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + dst(i->first) += src[level](i->second); else - for (IT i= copy_indices_from_me[level].begin(); - i != copy_indices_from_me[level].end(); ++i) - constraints->distribute_local_to_global(i->first, src[level](i->second), dst); + for (IT i= copy_indices_from_me[level].begin(); + i != copy_indices_from_me[level].end(); ++i) + constraints->distribute_local_to_global(i->first, src[level](i->second), dst); } } diff --git a/deal.II/include/deal.II/multigrid/mg_transfer_block.h b/deal.II/include/deal.II/multigrid/mg_transfer_block.h index 284081e121..b06e47f404 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer_block.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer_block.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_transfer_block_h #define __deal2__mg_transfer_block_h diff --git a/deal.II/include/deal.II/multigrid/mg_transfer_block.templates.h b/deal.II/include/deal.II/multigrid/mg_transfer_block.templates.h index 7b7886bd41..ef1fe22b91 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer_block.templates.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer_block.templates.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// mg_transfer.templates.h,v 1.22 2006/01/29 15:03:55 guido Exp -// Version: +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_transfer_block_templates_h #define __deal2__mg_transfer_block_templates_h diff --git a/deal.II/include/deal.II/multigrid/mg_transfer_component.h b/deal.II/include/deal.II/multigrid/mg_transfer_component.h index eb2a520bb1..305c828532 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer_component.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer_component.h @@ -1,34 +1,36 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_transfer_component_h #define __deal2__mg_transfer_component_h #include +#include #include #include #include #include #include -#include -#include #include - - - #include +#include +#include -#include DEAL_II_NAMESPACE_OPEN diff --git a/deal.II/include/deal.II/multigrid/mg_transfer_component.templates.h b/deal.II/include/deal.II/multigrid/mg_transfer_component.templates.h index fd260b6e99..856db2405a 100644 --- a/deal.II/include/deal.II/multigrid/mg_transfer_component.templates.h +++ b/deal.II/include/deal.II/multigrid/mg_transfer_component.templates.h @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// mg_transfer.templates.h,v 1.22 2006/01/29 15:03:55 guido Exp -// Version: +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__mg_transfer_component_templates_h #define __deal2__mg_transfer_component_templates_h diff --git a/deal.II/include/deal.II/multigrid/multigrid.h b/deal.II/include/deal.II/multigrid/multigrid.h index 24ae9fb2d0..0ef5bfdf4d 100644 --- a/deal.II/include/deal.II/multigrid/multigrid.h +++ b/deal.II/include/deal.II/multigrid/multigrid.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__multigrid_h #define __deal2__multigrid_h @@ -17,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/deal.II/include/deal.II/multigrid/multigrid.templates.h b/deal.II/include/deal.II/multigrid/multigrid.templates.h index 4422edac91..13b36bc9fc 100644 --- a/deal.II/include/deal.II/multigrid/multigrid.templates.h +++ b/deal.II/include/deal.II/multigrid/multigrid.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__multigrid_templates_h #define __deal2__multigrid_templates_h #include diff --git a/deal.II/include/deal.II/multigrid/sparse_matrix_collection.h b/deal.II/include/deal.II/multigrid/sparse_matrix_collection.h new file mode 100644 index 0000000000..a7dd03816e --- /dev/null +++ b/deal.II/include/deal.II/multigrid/sparse_matrix_collection.h @@ -0,0 +1,124 @@ +// --------------------------------------------------------------------- +// $Id: mg_matrix.h 30036 2013-07-18 16:55:32Z maier $ +// +// Copyright (C) 2003 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef __deal2__mg_sparse_matrix_collection_h +#define __deal2__mg_sparse_matrix_collection_h + +#include +#include +#include +#include +#include +#include +#include +#include + +DEAL_II_NAMESPACE_OPEN + +namespace mg +{ +/** + * Handler and storage for all five SparseMatrix object involved in + * using multigrid with local refinement. + * + * @author Baerbel Janssen, Guido Kanschat + * @date 2013 + */ + template + class SparseMatrixCollection : public Subscriptor + { + public: + void resize(const unsigned int minlevel, const unsigned int maxlevel); + + template + void reinit(const DH& dof_handler); + + void set_zero(); + + MGLevelObject sparsity; + MGLevelObject sparsity_edge; + + MGLevelObject > matrix; + MGLevelObject > matrix_down; + MGLevelObject > matrix_up; + MGLevelObject > matrix_in; + MGLevelObject > matrix_out; + }; + + + template + void + SparseMatrixCollection::resize(const unsigned int minlevel, const unsigned int maxlevel) + { + matrix.resize(minlevel, maxlevel); + matrix.clear(); + matrix_up.resize(minlevel+1, maxlevel); + matrix_up.clear(); + matrix_down.resize(minlevel+1, maxlevel); + matrix_down.clear(); + matrix_in.resize(minlevel, maxlevel); + matrix_in.clear(); + matrix_out.resize(minlevel, maxlevel); + matrix_out.clear(); + sparsity.resize(minlevel, maxlevel); + sparsity_edge.resize(minlevel, maxlevel); + } + + + template + template + void + SparseMatrixCollection::reinit(const DH& dof_handler) + { + AssertIndexRange(sparsity.max_level(), dof_handler.get_tria().n_levels()); + + for (unsigned int level=sparsity.min_level(); + level<=sparsity.max_level();++level) + { + CompressedSparsityPattern c_sparsity(dof_handler.n_dofs(level)); + MGTools::make_flux_sparsity_pattern(dof_handler, c_sparsity, level); + sparsity[level].copy_from(c_sparsity); + matrix[level].reinit(sparsity[level]); + matrix_in[level].reinit(sparsity[level]); + matrix_out[level].reinit(sparsity[level]); + if (level>0) + { + CompressedSparsityPattern ci_sparsity; + ci_sparsity.reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level)); + MGTools::make_flux_sparsity_pattern_edge(dof_handler, ci_sparsity, level); + sparsity_edge[level].copy_from(ci_sparsity); + matrix_up[level].reinit(sparsity_edge[level]); + matrix_down[level].reinit(sparsity_edge[level]); + } + } + } + + template + void + SparseMatrixCollection::set_zero() + { + matrix = 0.; + matrix_in = 0.; + matrix_out = 0.; + matrix_up = 0.; + matrix_down = 0.; + } + +} + +DEAL_II_NAMESPACE_CLOSE + +#endif diff --git a/deal.II/include/deal.II/numerics/data_component_interpretation.h b/deal.II/include/deal.II/numerics/data_component_interpretation.h index 0cb60e68de..06e3a4ad3f 100644 --- a/deal.II/include/deal.II/numerics/data_component_interpretation.h +++ b/deal.II/include/deal.II/numerics/data_component_interpretation.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__data_component_interpretation_h #define __deal2__data_component_interpretation_h diff --git a/deal.II/include/deal.II/numerics/data_out.h b/deal.II/include/deal.II/numerics/data_out.h index 0acdca6641..7dfe9c9bd4 100644 --- a/deal.II/include/deal.II/numerics/data_out.h +++ b/deal.II/include/deal.II/numerics/data_out.h @@ -1,30 +1,26 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__data_out_h #define __deal2__data_out_h #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include @@ -37,274 +33,20 @@ namespace internal namespace DataOut { /** - * For each vector that has been added - * through the add_data_vector() - * functions, we need to keep track of a - * pointer to it, and allow data - * extraction from it when we generate - * patches. Unfortunately, we need to do - * this for a number of different vector - * types. Fortunately, they all have the - * same interface. So the way we go is to - * have a base class that provides the - * functions to access the vector's - * information, and to have a derived - * template class that can be - * instantiated for each vector - * type. Since the vectors all have the - * same interface, this is no big - * problem, as they can all use the same - * general templatized code. - * - * @author Wolfgang Bangerth, 2004 - */ - template - class DataEntryBase - { - public: - /** - * Constructor. Give a list of names - * for the individual components of - * the vector and their - * interpretation as scalar or vector - * data. This constructor assumes - * that no postprocessor is going to - * be used. - */ - DataEntryBase (const std::vector &names, - const std::vector &data_component_interpretation); - - /** - * Constructor when a data - * postprocessor is going to be - * used. In that case, the names and - * vector declarations are going to - * be acquired from the postprocessor. - */ - DataEntryBase (const DataPostprocessor *data_postprocessor); - - /** - * Destructor made virtual. - */ - virtual ~DataEntryBase (); - - /** - * Assuming that the stored vector is - * a cell vector, extract the given - * element from it. - */ - virtual - double - get_cell_data_value (const unsigned int cell_number) const = 0; - - /** - * Given a FEValuesBase object, - * extract the values on the present - * cell from the vector we actually - * store. - */ - virtual - void - get_function_values (const FEValuesBase &fe_patch_values, - std::vector &patch_values) const = 0; - - /** - * Given a FEValuesBase object, - * extract the values on the present - * cell from the vector we actually - * store. This function does the same - * as the one above but for - * vector-valued finite elements. - */ - virtual - void - get_function_values (const FEValuesBase &fe_patch_values, - std::vector > &patch_values_system) const = 0; - - /** - * Given a FEValuesBase object, - * extract the gradients on the present - * cell from the vector we actually - * store. - */ - virtual - void - get_function_gradients (const FEValuesBase &fe_patch_values, - std::vector > &patch_gradients) const = 0; - - /** - * Given a FEValuesBase object, - * extract the gradients on the present - * cell from the vector we actually - * store. This function does the same - * as the one above but for - * vector-valued finite elements. - */ - virtual - void - get_function_gradients (const FEValuesBase &fe_patch_values, - std::vector > > &patch_gradients_system) const = 0; - - /** - * Given a FEValuesBase object, extract - * the second derivatives on the - * present cell from the vector we - * actually store. - */ - virtual - void - get_function_hessians (const FEValuesBase &fe_patch_values, - std::vector > &patch_hessians) const = 0; - - /** - * Given a FEValuesBase object, extract - * the second derivatives on the - * present cell from the vector we - * actually store. This function does - * the same as the one above but for - * vector-valued finite elements. - */ - virtual - void - get_function_hessians (const FEValuesBase &fe_patch_values, - std::vector > > &patch_hessians_system) const = 0; - - /** - * Clear all references to the - * vectors. - */ - virtual void clear () = 0; - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. - */ - virtual std::size_t memory_consumption () const = 0; - - /** - * Names of the components of this - * data vector. - */ - const std::vector names; - - /** - * A vector that for each of the - * n_output_variables variables of - * the current data set indicates - * whether they are scalar fields, - * parts of a vector-field, or any of - * the other supported kinds of data. - */ - const std::vector - data_component_interpretation; - - /** - * Pointer to a DataPostprocessing - * object which shall be applied to - * this data vector. - */ - SmartPointer > postprocessor; - - /** - * Number of output variables this - * dataset provides (either number of - * components in vector valued function - * / data vector or number of computed - * quantities, if DataPostprocessor is - * applied). This variable is - * determined via and thus equivalent - * to names.size(). - */ - unsigned int n_output_variables; - }; - - - /** - * A data structure that holds - * all data needed in one thread - * when building patches in - * parallel. These data - * structures are created - * globally rather than on each - * cell to avoid allocation of - * memory in the threads. This is - * a base class for the - * AdditionalData kind of data - * structure discussed in the - * documentation of the - * WorkStream class. - * - * The - * cell_to_patch_index_map - * is an array that stores for index - * [i][j] the number of the - * patch that associated with the cell - * with index @p j on level @p i. This - * information is set up prior to - * generation of the patches, and is - * needed to generate neighborship - * information. - * - * This structure is used by - * several of the DataOut* - * classes, which derived their - * own ParallelData classes from - * it for additional fields. - */ - template - struct ParallelDataBase - { - template - ParallelDataBase (const unsigned int n_components, - const unsigned int n_datasets, - const unsigned int n_subdivisions, - const unsigned int n_q_points, - const std::vector &n_postprocessor_outputs, - const FE &finite_elements); - - const unsigned int n_components; - const unsigned int n_datasets; - const unsigned int n_subdivisions; - - std::vector patch_values; - std::vector > patch_values_system; - std::vector > patch_gradients; - std::vector > > patch_gradients_system; - std::vector > patch_hessians; - std::vector > > patch_hessians_system; - std::vector > > postprocessed_values; - - const dealii::hp::FECollection fe_collection; - }; - - - /** - * A derived class for use in the - * DataOut class. This is - * a class for the - * AdditionalData kind of data - * structure discussed in the - * documentation of the - * WorkStream context. + * A derived class for use in the DataOut class. This is a class for the + * AdditionalData kind of data structure discussed in the documentation of + * the WorkStream context. */ template struct ParallelData : public ParallelDataBase { - template - ParallelData (const Quadrature &quadrature, - const unsigned int n_components, - const unsigned int n_datasets, + ParallelData (const unsigned int n_datasets, const unsigned int n_subdivisions, const std::vector &n_postprocessor_outputs, const Mapping &mapping, - const std::vector > &cell_to_patch_index_map, - const FE &finite_elements, - const UpdateFlags update_flags); - - const dealii::hp::QCollection q_collection; - const dealii::hp::MappingCollection mapping_collection; - dealii::hp::FEValues x_fe_values; + const std::vector > > &finite_elements, + const UpdateFlags update_flags, + const std::vector > &cell_to_patch_index_map); std::vector > patch_evaluation_points; @@ -314,675 +56,11 @@ namespace internal } -//TODO: Most of the documentation of DataOut_DoFData applies to DataOut. /** - * This is an abstract class which provides the functionality to - * generate patches for output by base classes from data vectors on a - * grid. It allows to store a pointer to a DoFHandler object and one - * or more pointers to node and cell data denoting functions on the - * grid which shall later be written in any of the implemented data - * formats. - * - * - *

    User visible interface

    - * - * The user visible interface of this class consists of functions which allow - * a user to make a DoFHandler object known to this class and to add data - * vectors which will later be written to a file in some format. Instead of - * pondering about the different functions, an example is probably the best - * way: - * @code - * ... - * ... // compute solution, which contains nodal values - * ... - * ... // compute error_estimator, which contains one value per cell - * - * std::vector solution_names; - * solution_names.push_back ("x-displacement"); - * solution_names.push_back ("y-displacement"); - * - * DataOut data_out; - * data_out.attach_dof_handler (dof_handler); - * data_out.add_data_vector (solution, solution_names); - * data_out.add_data_vector (error_estimator, "estimated_error"); - * - * data_out.build_patches (); - * - * ofstream output_file ("output"); - * data_out.write_xxx (output_file); - * - * data_out.clear(); - * @endcode - * - * attach_dof_handler() tells this class that all future operations - * are to take place with the DoFHandler object and the triangulation - * it lives on. We then add the solution vector and the error - * estimator; note that they have different dimensions, because the - * solution is a nodal vector, here consisting of two components - * ("x-displacement" and "y-displacement") while the error estimator - * probably is a vector holding cell data. When attaching a data - * vector, you have to give a name to each component of the vector, - * which is done through an object of type vector as - * second argument; if only one component is in the vector, for - * example if we are adding cell data as in the second case, or if the - * finite element used by the DoFHandler has only one component, then - * you can use the second add_data_vector() function which takes a @p - * string instead of the vector. - * - * The add_data_vector() functions have additional arguments (with default - * values) that can be used to specify certain transformations. In particular, - * it allows to attach DataPostprocessor arguments to compute derived - * information from a data vector at each point at which the field will - * be evaluated so that it can be written to a file (for example, the - * Mach number in hypersonic flow can be computed from density and velocities; - * step-29 also shows an example); another piece of information - * specified through arguments with default values is how certain output - * components should be interpreted, i.e. whether each component of the data - * is logically an independent scalar field, or whether some of them together - * form logically a vector-field (see the - * DataComponentInterpretation::DataComponentInterpretation enum, and the @ref - * step_22 "step-22" tutorial program). - * - * It should be noted that this class does not copy the vector given to it through - * the add_data_vector() functions, for memory consumption reasons. It only - * stores a reference to it, so it is in your responsibility to make sure that - * the data vectors exist long enough. - * - * After adding all data vectors, you need to call a function which generates - * the patches for output from the stored data. Derived classes name this - * function build_patches(). Finally, you write() the data in one format or other, - * to a file. - * - * Please note, that in the example above, an object of type DataOut was - * used, i.e. an object of a derived class. This is necessary since this - * class does not provide means to actually generate the patches, only aids to - * store and access data. - * - * Note that the base class of this class, DataOutInterface offers - * several functions to ease programming with run-time determinable - * output formats (i.e. you need not use a fixed format by calling - * DataOutInterface::write_xxx in the above example, but you can - * select it by a run-time parameter without having to write the - * if () ... else ... clauses yourself), and also functions - * and classes offering ways to control the appearance of the output - * by setting flags for each output format. - * - * - *

    Information for derived classes

    - * - * What is actually missing this class is a way to produce the patches - * for output itself, from the stored data and degree of freedom - * information. Since this task is often application dependent it is - * left to derived classes. For example, in many applications, it - * might be wanted to limit the depth of output to a certain number of - * refinement levels and write data from finer cells only in a way - * interpolated to coarser cells, to reduce the amount of - * output. Also, it might be wanted to use different numbers of - * subdivisions on different cells when forming a patch, for example - * to accomplish for different polynomial degrees of the trial space - * on different cells. Also, the output need not necessarily consist - * of a patch for each cell, but might be made up of patches for - * faces, of other things. Take a look at derived classes to what is - * possible in this respect. - * - * For this reason, it is left to a derived class to provide a - * function, named usually build_patches() or the like, which fills - * the #patches array of this class. - * - * Regarding the templates of this class, it needs three values: first - * the space dimension in which the triangulation and the DoF handler - * operate, second the dimension of the objects which the patches - * represent. Although in most cases they are equal, there are also - * classes for which this does not hold, for example if one outputs - * the result of a computation exploiting rotational symmetry in the - * original domain (in which the space dimension of the output would - * be one higher than that of the DoF handler, see the - * DataOut_Rotation() class), or one might conceive that one could - * write a class that only outputs the solution on a cut through the - * domain, in which case the space dimension of the output is less - * than that of the DoF handler. The last template argument denotes - * the dimension of the space into which the patches are embedded; - * usually, this dimension is the same as the dimensio of the patches - * themselves (which is also the default value of the template - * parameter), but there might be cases where this is not so. For - * example, in the DataOut_Faces() class, patches are generated - * from faces of the triangulation. Thus, the dimension of the patch - * is one less than the dimension of the embedding space, which is, in - * this case, equal to the dimension of the triangulation and DoF - * handler. However, for the cut through the domain mentioned above, - * if the cut is a straight one, then the cut can be embedded into a - * space of one dimension lower than the dimension of the - * triangulation, so that the last template parameter has the same - * value as the second one. + * This class is the main class to provide output of data described by finite + * element fields defined on a collection of cells. * - * @ingroup output - * @author Wolfgang Bangerth, 1999 - */ -template -class DataOut_DoFData : public DataOutInterface -{ -public: - - /** - * Typedef to the iterator type - * of the dof handler class under - * consideration. - */ - typedef typename DH::cell_iterator cell_iterator; - typedef typename DH::active_cell_iterator active_cell_iterator; - -public: - - /** - * Type describing what the - * vector given to - * add_data_vector() is: a - * vector that has one entry per - * degree of freedom in a - * DoFHandler object (such - * as solution vectors), or one - * entry per cell in the - * triangulation underlying the - * DoFHandler object (such - * as error per cell data). The - * value #type_automatic tells - * add_data_vector() to find - * out itself (see the - * documentation of - * add_data_vector() for the - * method used). - */ - enum DataVectorType - { - /** - * Data vector entries are - * associated to degrees of freedom - */ - type_dof_data, - - /** - * Data vector entries are one per - * grid cell - */ - type_cell_data, - - /** - * Find out automatically - */ - type_automatic - }; - - /** - * Constructor - */ - DataOut_DoFData (); - - /** - * Destructor. - */ - virtual ~DataOut_DoFData (); - - /** - * Designate a dof handler to be - * used to extract geometry data - * and the mapping between nodes - * and node values. - */ - void attach_dof_handler (const DH &); - - /** - * Add a data vector together - * with its name. - * - * A pointer to the vector is - * stored, so you have to make - * sure the vector exists at that - * address at least as long as - * you call the write_* - * functions. - * - * It is assumed that the vector - * has the same number of - * components as there are - * degrees of freedom in the dof - * handler, in which case it is - * assumed to be a vector storing - * nodal data; or the size may be - * the number of active cells on - * the present grid, in which - * case it is assumed to be a - * cell data vector. As the - * number of degrees of freedom - * and of cells is usually not - * equal, the function can - * determine itself which type of - * vector it is given. However, - * there are corner cases where - * this automatic determination - * does not work. One example is - * if you compute with piecewise - * constant elements and have a - * scalar solution, then there - * are as many cells as there are - * degrees of freedom (though - * they may be numbered - * differently). Another - * possibility is if you have a - * 1d mesh embedded in 2d space - * and the mesh consists of a - * closed curve of cells; in this - * case, there are as many nodes - * as there are cells, and when - * using a Q1 element you will - * have as many degrees of - * freedom as there are cells. - * In these cases, you can change - * the last argument of the - * function from its default - * value #type_automatic to - * either #type_dof_data or - * #type_cell_data, depending on - * what the vector - * represents. Apart from such - * corner cases, you can leave - * the argument at its default - * value and let the function - * determine the type of the - * vector itself. - * - * If it is a vector holding DoF - * data, the names given shall be - * one for each component of the - * underlying finite element. If - * it is a finite element - * composed of only one - * subelement, then there is - * another function following - * which takes a single name - * instead of a vector of names. - * - * The data_component_interpretation - * argument contains information about - * how the individual components of - * output files that consist of more than - * one data set are to be interpreted. - * - * For example, if one has a finite - * element for the Stokes equations in - * 2d, representing components (u,v,p), - * one would like to indicate that the - * first two, u and v, represent a - * logical vector so that later on when - * we generate graphical output we can - * hand them off to a visualization - * program that will automatically know - * to render them as a vector field, - * rather than as two separate and - * independent scalar fields. - * - * The default value of this argument - * (i.e. an empty vector) corresponds is - * equivalent to a vector of values - * DataComponentInterpretation::component_is_scalar, - * indicating that all output components - * are independent scalar - * fields. However, if the given data - * vector represents logical vectors, you - * may pass a vector that contains values - * DataComponentInterpretation::component_is_part_of_vector. In - * the example above, one would pass in a - * vector with components - * (DataComponentInterpretation::component_is_part_of_vector, - * DataComponentInterpretation::component_is_part_of_vector, - * DataComponentInterpretation::component_is_scalar) - * for (u,v,p). - * - * The names of a data vector - * shall only contain characters - * which are letters, underscore - * and a few other ones. Refer to - * the ExcInvalidCharacter - * exception declared in this - * class to see which characters - * are valid and which are not. - * - * @note The actual type for the - * vector argument may be any - * vector type from which - * FEValues can extract values on - * a cell using the - * FEValuesBase::get_function_values() - * function. In particular, this - * includes all of the usual - * vector types, but also - * IndexSet (see step-41 for a - * use of this). - */ - template - void add_data_vector (const VECTOR &data, - const std::vector &names, - const DataVectorType type = type_automatic, - const std::vector &data_component_interpretation - = std::vector()); - - /** - * This function is an abbreviation to - * the above one (see there for a - * discussion of the various arguments), - * intended for use with finite elements - * that are not composed of - * subelements. In this case, only one - * name per data vector needs to be - * given, which is what this function - * takes. It simply relays its arguments - * after a conversion of the @p name to a - * vector of strings, to the other - * add_data_vector() function above. - * - * If @p data is a vector with - * multiple components this - * function will generate - * distinct names for all - * components by appending an - * underscore and the number of - * each component to @p name - * - * The actual type for the template - * argument may be any vector type from - * which FEValues can extract values - * on a cell using the - * FEValuesBase::get_function_values() function. - */ - template - void add_data_vector (const VECTOR &data, - const std::string &name, - const DataVectorType type = type_automatic, - const std::vector &data_component_interpretation - = std::vector()); - - /** - * This function is an alternative to the - * above ones, allowing the output of - * derived quantities instead of the given - * data. This converison has to be done in - * a class derived from DataPostprocessor. - * - * The names for these derived quantities - * are provided by the @p - * data_postprocessor argument. Likewise, - * the data_component_interpretation - * argument of the other - * add_data_vector() functions is - * provided by the data_postprocessor - * argument. As only data of type @p - * type_dof_data can be transformed, this - * type is also known implicitly and does - * not have to be given. - * - * @note The actual type for the - * vector argument may be any - * vector type from which - * FEValues can extract values on - * a cell using the - * FEValuesBase::get_function_values() - * function. In particular, this - * includes all of the usual - * vector types, but also - * IndexSet (see step-41 for a - * use of this). - */ - template - void add_data_vector (const VECTOR &data, - const DataPostprocessor &data_postprocessor); - - /** - * Release the pointers to the - * data vectors. This allows - * output of a new set of vectors - * without supplying the DoF - * handler again. Therefore, the - * DataOut object can be used - * in an algebraic context. Note - * that besides the data vectors - * also the patches already - * computed are deleted. - */ - void clear_data_vectors (); - - /** - * Release pointers to all input - * data elements, i.e. pointers - * to data vectors and to the DoF - * handler object. This function - * may be useful when you have - * called the @p build_patches - * function of derived class, - * since then the patches are - * built and the input data is no - * more needed, nor is there a - * need to reference it. You can - * then output the patches - * detached from the main thread - * and need not make sure anymore - * that the DoF handler object - * and vectors must not be - * deleted before the output - * thread is finished. - */ - void clear_input_data_references (); - - /** - * This function can be used to - * merge the patches that were - * created using the - * @p build_patches function of - * the object given as argument - * into the list of patches - * created by this object. This - * is sometimes handy if one has, - * for example, a domain - * decomposition algorithm where - * each block is represented by a - * DoFHandler of its own, - * but one wants to output the - * solution on all the blocks at - * the same time. - * - * For this to work, the given - * argument and this object need - * to have the same number of - * output vectors, and they need - * to use the same number of - * subdivisions per patch. The - * output will probably look - * rather funny if patches in - * both objects overlap in space. - * - * If you call - * build_patches() for this - * object after merging in - * patches, the previous state is - * overwritten, and the merged-in - * patches are lost. - * - * The second parameter allows to - * shift each node of the patches - * in the object passed in in the - * first parameter by a certain - * amount. This is sometimes - * useful to generate "exploded" - * views of a collection of - * blocks. - * - * This function will fail if - * either this or the other - * object did not yet set up any - * patches. - */ - template - void merge_patches (const DataOut_DoFData &source, - const Point &shift = Point()); - - /** - * Release the pointers to the - * data vectors and the DoF - * handler. You have to set all - * data entries again using the - * add_data_vector() - * function. The pointer to the - * dof handler is cleared as - * well, along with all other - * data. In effect, this function - * resets everything to a virgin - * state. - */ - virtual void clear (); - - /** - * Determine an estimate for the - * memory consumption (in bytes) - * of this object. - */ - std::size_t memory_consumption () const; - - /** - * Exception - */ - DeclException0 (ExcNoDoFHandlerSelected); - /** - * Exception - */ - DeclException0 (ExcDataPostprocessingIsNotPossibleForCellData); - /** - * Exception - */ - DeclException3 (ExcInvalidVectorSize, - int, int, int, - << "The vector has size " << arg1 - << " but the DoFHandler objects says there are " << arg2 - << " degrees of freedom and there are " << arg3 - << " active cells."); - /** - * Exception - */ - DeclException2 (ExcInvalidCharacter, - std::string, size_t, - << "Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl - << "description strings since some graphics formats will only accept these." - << std::endl - << "The string you gave was <" << arg1 - << ">, the invalid character is <" << arg1[arg2] - << ">." << std::endl); - /** - * Exception - */ - DeclException0 (ExcOldDataStillPresent); - /** - * Exception - */ - DeclException2 (ExcInvalidNumberOfNames, - int, int, - << "You have to give one name per component in your " - << "data vector. The number you gave was " << arg1 - << ", but the number of components is " << arg2); - /** - * Exception - */ - DeclException0 (ExcNoPatches); - /** - * Exception - */ - DeclException0 (ExcIncompatibleDatasetNames); - /** - * Exception - */ - DeclException0 (ExcIncompatiblePatchLists); - - DeclException2 (ExcInvalidVectorDeclaration, - int, std::string, - << "When declaring that a number of components in a data\n" - << "set to be output logically form a vector instead of\n" - << "simply a set of scalar fields, you need to specify\n" - << "this for all relevant components. Furthermore,\n" - << "vectors must always consist of exactly \n" - << "components. However, the vector component at\n" - << "position " << arg1 << " with name <" << arg2 - << "> does not satisfy these conditions."); - -protected: - /** - * Abbreviate the somewhat lengthy - * name for the Patch class. - */ - typedef dealii::DataOutBase::Patch Patch; - - /** - * Pointer to the dof handler object. - */ - SmartPointer > dofs; - - /** - * List of data elements with vectors of - * values for each degree of freedom. - */ - std::vector > > dof_data; - - /** - * List of data elements with vectors of - * values for each cell. - */ - std::vector > > cell_data; - - /** - * This is a list of patches that is - * created each time build_patches() - * is called. These patches are used - * in the output routines of the base - * classes. - */ - std::vector patches; - - /** - * Function by which the base - * class's functions get to know - * what patches they shall write - * to a file. - */ - virtual - const std::vector &get_patches () const; - - /** - * 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; - - /** - * Overload of the respective - * DataOutInterface::get_vector_data_ranges() - * function. See there for a more - * extensive documentation. - */ - virtual - std::vector > - get_vector_data_ranges () const; - - /** - * Make all template siblings - * friends. Needed for the - * merge_patches() function. - */ - template - friend class DataOut_DoFData; -}; - - - -/** * This class is an actual implementation of the functionality proposed by * the DataOut_DoFData class. It offers a function build_patches() that * generates the patches to be written in some graphics format from the data @@ -1067,17 +145,15 @@ class DataOut : public DataOut_DoFData { public: /** - * Typedef to the iterator type - * of the dof handler class under + * Typedef to the iterator type of the dof handler class under * consideration. */ typedef typename DataOut_DoFData::cell_iterator cell_iterator; typedef typename DataOut_DoFData::active_cell_iterator active_cell_iterator; /** - * Enumeration describing the region of the - * domain in which curved cells shall be - * created. + * Enumeration describing the region of the domain in which curved cells + * shall be created. */ enum CurvedCellRegion { @@ -1087,108 +163,61 @@ public: }; /** - * This is the central function - * of this class since it builds - * the list of patches to be - * written by the low-level - * functions of the base - * class. See the general - * documentation of this class - * for further information. + * This is the central function of this class since it builds the list of + * patches to be written by the low-level functions of the base class. See + * the general documentation of this class for further information. * - * The default value 0 - * of n_subdivisions - * indicates that the value - * stored in - * DataOutInterface::default_subdivisions - * is to be used. + * The default value 0 of n_subdivisions indicates that + * the value stored in DataOutInterface::default_subdivisions is to be used. */ virtual void build_patches (const unsigned int n_subdivisions = 0); /** - * Same as above, except that the - * additional first parameter - * defines a mapping that is to - * be used in the generation of - * output. If - * n_subdivisions>1, the - * points interior of subdivided - * patches which originate from - * cells at the boundary of the - * domain can be computed using the - * mapping, i.e. a higher order - * mapping leads to a - * representation of a curved - * boundary by using more - * subdivisions. Some mappings like - * MappingQEulerian result in curved cells - * in the interior of the domain. However, - * there is nor easy way to get this - * information from the Mapping. Thus the - * last argument @p curved_region take one - * of three values resulting in no curved - * cells at all, curved cells at the - * boundary (default) or curved cells in - * the whole domain. + * Same as above, except that the additional first parameter defines a + * mapping that is to be used in the generation of output. If + * n_subdivisions>1, the points interior of subdivided patches + * which originate from cells at the boundary of the domain can be computed + * using the mapping, i.e. a higher order mapping leads to a representation + * of a curved boundary by using more subdivisions. Some mappings like + * MappingQEulerian result in curved cells in the interior of the + * domain. However, there is nor easy way to get this information from the + * Mapping. Thus the last argument @p curved_region take one of three values + * resulting in no curved cells at all, curved cells at the boundary + * (default) or curved cells in the whole domain. * - * Even for non-curved cells the - * mapping argument can be used - * for the Eulerian mappings (see - * class MappingQ1Eulerian) where - * a mapping is used not only to - * determine the position of - * points interior to a cell, but - * also of the vertices. It - * offers an opportunity to watch - * the solution on a deformed - * triangulation on which the - * computation was actually - * carried out, even if the mesh - * is internally stored in its - * undeformed configuration and - * the deformation is only - * tracked by an additional - * vector that holds the + * Even for non-curved cells the mapping argument can be used for the + * Eulerian mappings (see class MappingQ1Eulerian) where a mapping is used + * not only to determine the position of points interior to a cell, but also + * of the vertices. It offers an opportunity to watch the solution on a + * deformed triangulation on which the computation was actually carried out, + * even if the mesh is internally stored in its undeformed configuration and + * the deformation is only tracked by an additional vector that holds the * deformation of each vertex. * - * @todo The @p mapping argument should be - * replaced by a hp::MappingCollection in - * case of a hp::DoFHandler. + * @todo The @p mapping argument should be replaced by a + * hp::MappingCollection in case of a hp::DoFHandler. */ virtual void build_patches (const Mapping &mapping, const unsigned int n_subdivisions = 0, const CurvedCellRegion curved_region = curved_boundary); /** - * Return the first cell which we - * want output for. The default - * implementation returns the - * first active cell, but you - * might want to return other - * cells in a derived class. + * Return the first cell which we want output for. The default + * implementation returns the first active cell, but you might want to + * return other cells in a derived class. */ virtual cell_iterator first_cell (); /** - * Return the next cell after - * @p cell which we want output - * for. If there are no more - * cells, #dofs->end() shall - * be returned. + * Return the next cell after @p cell which we want output for. If there + * are no more cells, #dofs->end() shall be returned. * - * The default implementation - * returns the next active cell, - * but you might want to return - * other cells in a derived - * class. Note that the default - * implementation assumes that - * the given @p cell is active, - * which is guaranteed as long as - * first_cell() is also used - * from the default - * implementation. Overloading - * only one of the two functions - * might not be a good idea. + * The default implementation returns the next active cell, but you might + * want to return other cells in a derived class. Note that the default + * implementation assumes that the given @p cell is active, which is + * guaranteed as long as first_cell() is also used from the default + * implementation. Overloading only one of the two functions might not be a + * good idea. */ virtual cell_iterator next_cell (const cell_iterator &cell); @@ -1203,36 +232,23 @@ public: private: /** - * Return the first cell produced - * by the - * first_cell()/next_cell() - * function pair that is locally - * owned. If this object operates - * on a non-distributed - * triangulation, the result - * equals what first_cell() - * returns. + * Return the first cell produced by the first_cell()/next_cell() function + * pair that is locally owned. If this object operates on a non-distributed + * triangulation, the result equals what first_cell() returns. */ cell_iterator first_locally_owned_cell (); /** - * Return the next cell produced - * by the next_cell() function - * that is locally owned. If this - * object operates on a - * non-distributed triangulation, - * the result equals what - * first_cell() returns. + * Return the next cell produced by the next_cell() function that is locally + * owned. If this object operates on a non-distributed triangulation, the + * result equals what first_cell() returns. */ cell_iterator next_locally_owned_cell (const cell_iterator &cell); /** - * Build one patch. This function - * is called in a WorkStream - * context. + * Build one patch. This function is called in a WorkStream context. * - * The result is written into the patch - * variable. + * The result is written into the patch variable. */ void build_one_patch (const std::pair *cell_and_index, internal::DataOut::ParallelData &data, @@ -1242,126 +258,6 @@ private: -// -------------------- template and inline functions ------------------------ - - -namespace internal -{ - namespace DataOut - { - template - template - ParallelDataBase:: - ParallelDataBase (const unsigned int n_components, - const unsigned int n_datasets, - const unsigned int n_subdivisions, - const unsigned int n_q_points, - const std::vector &n_postprocessor_outputs, - const FE &finite_elements) - : - n_components (n_components), - n_datasets (n_datasets), - n_subdivisions (n_subdivisions), - patch_values (n_q_points), - patch_values_system (n_q_points), - patch_gradients (n_q_points), - patch_gradients_system (n_q_points), - patch_hessians (n_q_points), - patch_hessians_system (n_q_points), - postprocessed_values (n_postprocessor_outputs.size()), - fe_collection (finite_elements) - { - for (unsigned int k=0; k(n_postprocessor_outputs[dataset])); - } - } -} - - -template -template -void -DataOut_DoFData:: -merge_patches (const DataOut_DoFData &source, - const Point &shift) -{ - const std::vector source_patches = source.get_patches (); - Assert (patches.size () != 0, ExcNoPatches ()); - Assert (source_patches.size () != 0, ExcNoPatches ()); - // check equality of component - // names - Assert (get_dataset_names() == source.get_dataset_names(), - ExcIncompatibleDatasetNames()); - // make sure patches are compatible. we'll - // assume that if the first respective - // patches are ok that all the other ones - // are ok as well - Assert (patches[0].n_subdivisions == source_patches[0].n_subdivisions, - ExcIncompatiblePatchLists()); - Assert (patches[0].data.n_rows() == source_patches[0].data.n_rows(), - ExcIncompatiblePatchLists()); - Assert (patches[0].data.n_cols() == source_patches[0].data.n_cols(), - ExcIncompatiblePatchLists()); - - // check equality of the vector data - // specifications - Assert (get_vector_data_ranges().size() == - source.get_vector_data_ranges().size(), - ExcMessage ("Both sources need to declare the same components " - "as vectors.")); - for (unsigned int i=0; i(get_vector_data_ranges()[i]) == - std_cxx1x::get<0>(source.get_vector_data_ranges()[i]), - ExcMessage ("Both sources need to declare the same components " - "as vectors.")); - Assert (std_cxx1x::get<1>(get_vector_data_ranges()[i]) == - std_cxx1x::get<1>(source.get_vector_data_ranges()[i]), - ExcMessage ("Both sources need to declare the same components " - "as vectors.")); - Assert (std_cxx1x::get<2>(get_vector_data_ranges()[i]) == - std_cxx1x::get<2>(source.get_vector_data_ranges()[i]), - ExcMessage ("Both sources need to declare the same components " - "as vectors.")); - } - - // merge patches. store old number - // of elements, since we need to - // adjust patch numbers, etc - // afterwards - const unsigned int old_n_patches = patches.size(); - patches.insert (patches.end(), - source_patches.begin(), - source_patches.end()); - - // perform shift, if so desired - if (shift != Point()) - for (unsigned int i=old_n_patches; i::vertices_per_cell; ++v) - patches[i].vertices[v] += shift; - - // adjust patch numbers - for (unsigned int i=old_n_patches; i::faces_per_cell; ++n) - if (patches[i].neighbors[n] != Patch::no_neighbor) - patches[i].neighbors[n] += old_n_patches; -} - - DEAL_II_NAMESPACE_CLOSE #endif diff --git a/deal.II/include/deal.II/numerics/data_out_dof_data.h b/deal.II/include/deal.II/numerics/data_out_dof_data.h new file mode 100644 index 0000000000..fdc24dbd2f --- /dev/null +++ b/deal.II/include/deal.II/numerics/data_out_dof_data.h @@ -0,0 +1,920 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1999 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef __deal2__data_out_dof_data_h +#define __deal2__data_out_dof_data_h + + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +DEAL_II_NAMESPACE_OPEN + +template class FEValuesBase; + +namespace internal +{ + namespace DataOut + { + /** + * For each vector that has been added through the add_data_vector() + * functions, we need to keep track of a pointer to it, and allow data + * extraction from it when we generate patches. Unfortunately, we need to + * do this for a number of different vector types. Fortunately, they all + * have the same interface. So the way we go is to have a base class that + * provides the functions to access the vector's information, and to have + * a derived template class that can be instantiated for each vector + * type. Since the vectors all have the same interface, this is no big + * problem, as they can all use the same general templatized code. + * + * @author Wolfgang Bangerth, 2004 + */ + template + class DataEntryBase + { + public: + /** + * Constructor. Give a list of names for the individual components of + * the vector and their interpretation as scalar or vector data. This + * constructor assumes that no postprocessor is going to be used. + */ + DataEntryBase (const DH *dofs, + const std::vector &names, + const std::vector &data_component_interpretation); + + /** + * Constructor when a data postprocessor is going to be used. In that + * case, the names and vector declarations are going to be acquired from + * the postprocessor. + */ + DataEntryBase (const DH *dofs, + const DataPostprocessor *data_postprocessor); + + /** + * Destructor made virtual. + */ + virtual ~DataEntryBase (); + + /** + * Assuming that the stored vector is a cell vector, extract the given + * element from it. + */ + virtual + double + get_cell_data_value (const unsigned int cell_number) const = 0; + + /** + * Given a FEValuesBase object, extract the values on the present cell + * from the vector we actually store. + */ + virtual + void + get_function_values (const FEValuesBase &fe_patch_values, + std::vector &patch_values) const = 0; + + /** + * Given a FEValuesBase object, extract the values on the present cell + * from the vector we actually store. This function does the same as the + * one above but for vector-valued finite elements. + */ + virtual + void + get_function_values (const FEValuesBase &fe_patch_values, + std::vector > &patch_values_system) const = 0; + + /** + * Given a FEValuesBase object, extract the gradients on the present + * cell from the vector we actually store. + */ + virtual + void + get_function_gradients (const FEValuesBase &fe_patch_values, + std::vector > &patch_gradients) const = 0; + + /** + * Given a FEValuesBase object, extract the gradients on the present + * cell from the vector we actually store. This function does the same + * as the one above but for vector-valued finite elements. + */ + virtual + void + get_function_gradients (const FEValuesBase &fe_patch_values, + std::vector > > &patch_gradients_system) const = 0; + + /** + * Given a FEValuesBase object, extract the second derivatives on the + * present cell from the vector we actually store. + */ + virtual + void + get_function_hessians (const FEValuesBase &fe_patch_values, + std::vector > &patch_hessians) const = 0; + + /** + * Given a FEValuesBase object, extract the second derivatives on the + * present cell from the vector we actually store. This function does + * the same as the one above but for vector-valued finite elements. + */ + virtual + void + get_function_hessians (const FEValuesBase &fe_patch_values, + std::vector > > &patch_hessians_system) const = 0; + + /** + * Clear all references to the vectors. + */ + virtual void clear () = 0; + + /** + * Determine an estimate for the memory consumption (in bytes) of this + * object. + */ + virtual std::size_t memory_consumption () const = 0; + + /** + * Pointer to the DoFHandler object that the vector is based on. + */ + SmartPointer dof_handler; + + /** + * Names of the components of this data vector. + */ + const std::vector names; + + /** + * A vector that for each of the n_output_variables variables of the + * current data set indicates whether they are scalar fields, parts of a + * vector-field, or any of the other supported kinds of data. + */ + const std::vector + data_component_interpretation; + + /** + * Pointer to a DataPostprocessing object which shall be applied to this + * data vector. + */ + SmartPointer > postprocessor; + + /** + * Number of output variables this dataset provides (either number of + * components in vector valued function / data vector or number of + * computed quantities, if DataPostprocessor is applied). This variable + * is determined via and thus equivalent to names.size(). + */ + unsigned int n_output_variables; + }; + + + /** + * A data structure that holds all data needed in one thread when building + * patches in parallel. These data structures are created globally rather + * than on each cell to avoid allocation of memory in the threads. This is + * a base class for the AdditionalData kind of data structure discussed in + * the documentation of the WorkStream class. + * + * The cell_to_patch_index_map is an array that stores for + * index [i][j] the number of the patch that associated with the + * cell with index @p j on level @p i. This information is set up prior to + * generation of the patches, and is needed to generate neighborship + * information. + * + * This structure is used by several of the DataOut* classes, which + * derived their own ParallelData classes from it for additional fields. + */ + template + struct ParallelDataBase + { + ParallelDataBase (const unsigned int n_datasets, + const unsigned int n_subdivisions, + const std::vector &n_postprocessor_outputs, + const Mapping &mapping, + const std::vector > > &finite_elements, + const UpdateFlags update_flags, + const bool use_face_values); + + ParallelDataBase (const ParallelDataBase &data); + + template + void reinit_all_fe_values(std::vector > > &dof_data, + const typename dealii::Triangulation::cell_iterator &cell, + const unsigned int face = numbers::invalid_unsigned_int); + + const FEValuesBase & + get_present_fe_values(const unsigned int dataset) const; + + void resize_system_vectors(const unsigned int n_components); + + const unsigned int n_datasets; + const unsigned int n_subdivisions; + + std::vector patch_values; + std::vector > patch_values_system; + std::vector > patch_gradients; + std::vector > > patch_gradients_system; + std::vector > patch_hessians; + std::vector > > patch_hessians_system; + std::vector > > postprocessed_values; + + const dealii::hp::MappingCollection mapping_collection; + const std::vector > > finite_elements; + const UpdateFlags update_flags; + + std::vector > > x_fe_values; + std::vector > > x_fe_face_values; + }; + } +} + + +//TODO: Most of the documentation of DataOut_DoFData applies to DataOut. + +/** + * This is an abstract class which provides the functionality to generate + * patches for output by base classes from data vectors on a grid. It allows + * to store one or more pointers to a DoFHandler and attached node and cell + * data denoting functions on the grid which shall later be written in any of + * the implemented data formats. + * + * + *

    User visible interface

    + * + * The user visible interface of this class allows the user to specify data in + * two different ways. One is to make a DoFHandler object known to this class + * and to add data vectors that all correspond to this DoFHandler or the grid + * cells which will later be written to a file in some format. The second + * approach is to pass a DoFHandler object along with the vector. This allows + * setting data from different DoFHandlers in a neat way (of course, they both + * need to be based on the same triangulation). Instead of pondering about the + * different functions, an example for the first kind is probably the best + * explanation: + * @code + * ... + * ... // compute solution, which contains nodal values + * ... + * ... // compute error_estimator, which contains one value per cell + * + * std::vector solution_names; + * solution_names.push_back ("x-displacement"); + * solution_names.push_back ("y-displacement"); + * + * DataOut data_out; + * data_out.attach_dof_handler (dof_handler); + * data_out.add_data_vector (solution, solution_names); + * data_out.add_data_vector (error_estimator, "estimated_error"); + * + * data_out.build_patches (); + * + * ofstream output_file ("output"); + * data_out.write_xxx (output_file); + * + * data_out.clear(); + * @endcode + * + * attach_dof_handler() tells this class that all future operations + * are to take place with the DoFHandler object and the triangulation + * it lives on. We then add the solution vector and the error + * estimator; note that they have different dimensions, because the + * solution is a nodal vector, here consisting of two components + * ("x-displacement" and "y-displacement") while the error estimator + * probably is a vector holding cell data. When attaching a data + * vector, you have to give a name to each component of the vector, + * which is done through an object of type vector as + * second argument; if only one component is in the vector, for + * example if we are adding cell data as in the second case, or if the + * finite element used by the DoFHandler has only one component, then + * you can use the second add_data_vector() function which takes a @p + * string instead of the vector. + * + * The add_data_vector() functions have additional arguments (with default + * values) that can be used to specify certain transformations. In particular, + * it allows to attach DataPostprocessor arguments to compute derived + * information from a data vector at each point at which the field will + * be evaluated so that it can be written to a file (for example, the + * Mach number in hypersonic flow can be computed from density and velocities; + * step-29 also shows an example); another piece of information + * specified through arguments with default values is how certain output + * components should be interpreted, i.e. whether each component of the data + * is logically an independent scalar field, or whether some of them together + * form logically a vector-field (see the + * DataComponentInterpretation::DataComponentInterpretation enum, and the @ref + * step_22 "step-22" tutorial program). + * + * It should be noted that this class does not copy the vector given to it through + * the add_data_vector() functions, for memory consumption reasons. It only + * stores a reference to it, so it is in your responsibility to make sure that + * the data vectors exist long enough. + * + * After adding all data vectors, you need to call a function which generates + * the patches for output from the stored data. Derived classes name this + * function build_patches(). Finally, you write() the data in one format or other, + * to a file. + * + * Please note that in the example above, an object of type DataOut was + * used, i.e. an object of a derived class. This is necessary since this + * class does not provide means to actually generate the patches, only aids to + * store and access data. + * + * Note that the base class of this class, DataOutInterface offers + * several functions to ease programming with run-time determinable + * output formats (i.e. you need not use a fixed format by calling + * DataOutInterface::write_xxx in the above example, but you can + * select it by a run-time parameter without having to write the + * if () ... else ... clauses yourself), and also functions + * and classes offering ways to control the appearance of the output + * by setting flags for each output format. + * + * + *

    Information for derived classes

    + * + * What is actually missing this class is a way to produce the patches + * for output itself, from the stored data and degree of freedom + * information. Since this task is often application dependent it is + * left to derived classes. For example, in many applications, it + * might be wanted to limit the depth of output to a certain number of + * refinement levels and write data from finer cells only in a way + * interpolated to coarser cells, to reduce the amount of + * output. Also, it might be wanted to use different numbers of + * subdivisions on different cells when forming a patch, for example + * to accomplish for different polynomial degrees of the trial space + * on different cells. Also, the output need not necessarily consist + * of a patch for each cell, but might be made up of patches for + * faces, of other things. Take a look at derived classes to what is + * possible in this respect. + * + * For this reason, it is left to a derived class to provide a + * function, named usually build_patches() or the like, which fills + * the #patches array of this class. + * + * Regarding the templates of this class, it needs three values: first + * the space dimension in which the triangulation and the DoF handler + * operate, second the dimension of the objects which the patches + * represent. Although in most cases they are equal, there are also + * classes for which this does not hold, for example if one outputs + * the result of a computation exploiting rotational symmetry in the + * original domain (in which the space dimension of the output would + * be one higher than that of the DoF handler, see the + * DataOut_Rotation() class), or one might conceive that one could + * write a class that only outputs the solution on a cut through the + * domain, in which case the space dimension of the output is less + * than that of the DoF handler. The last template argument denotes + * the dimension of the space into which the patches are embedded; + * usually, this dimension is the same as the dimensio of the patches + * themselves (which is also the default value of the template + * parameter), but there might be cases where this is not so. For + * example, in the DataOut_Faces() class, patches are generated + * from faces of the triangulation. Thus, the dimension of the patch + * is one less than the dimension of the embedding space, which is, in + * this case, equal to the dimension of the triangulation and DoF + * handler. However, for the cut through the domain mentioned above, + * if the cut is a straight one, then the cut can be embedded into a + * space of one dimension lower than the dimension of the + * triangulation, so that the last template parameter has the same + * value as the second one. + * + * @ingroup output + * @author Wolfgang Bangerth, 1999 + */ +template +class DataOut_DoFData : public DataOutInterface +{ +public: + + /** + * Typedef to the iterator type of the dof handler class under + * consideration. + */ + typedef typename Triangulation::cell_iterator cell_iterator; + typedef typename Triangulation::active_cell_iterator active_cell_iterator; + +public: + + /** + * Type describing what the vector given to add_data_vector() is: a vector + * that has one entry per degree of freedom in a DoFHandler object (such as + * solution vectors), or one entry per cell in the triangulation underlying + * the DoFHandler object (such as error per cell data). The value + * #type_automatic tells add_data_vector() to find out itself (see the + * documentation of add_data_vector() for the method used). + */ + enum DataVectorType + { + /** + * Data vector entries are associated to degrees of freedom + */ + type_dof_data, + + /** + * Data vector entries are one per grid cell + */ + type_cell_data, + + /** + * Find out automatically + */ + type_automatic + }; + + /** + * Constructor + */ + DataOut_DoFData (); + + /** + * Destructor. + */ + virtual ~DataOut_DoFData (); + + /** + * Designate a dof handler to be used to extract geometry data and the + * mapping between nodes and node values. This call is not necessary if all + * added data vectors are supplemented with a DoFHandler argument. + * + * This call is optional: If you add data vectors with specified DoFHandler + * object, then that contains all information needed to generate the output. + */ + void attach_dof_handler (const DH &); + + /** + * Designate a triangulation to be used to extract geometry data and the + * mapping between nodes and node values. + * + * This call is optional: If you add data vectors with specified DoFHandler + * object, then that contains all information needed to generate the + * output. This call is useful when you only output cell vectors and no + * DoFHandler at all, in which case it provides the geometry. + */ + void attach_triangulation (const Triangulation &); + + /** + * Add a data vector together with its name. + * + * A pointer to the vector is stored, so you have to make sure the vector + * exists at that address at least as long as you call the write_* + * functions. + * + * It is assumed that the vector has the same number of components as there + * are degrees of freedom in the dof handler, in which case it is assumed to + * be a vector storing nodal data; or the size may be the number of active + * cells on the present grid, in which case it is assumed to be a cell data + * vector. As the number of degrees of freedom and of cells is usually not + * equal, the function can determine itself which type of vector it is + * given. However, there are corner cases where this automatic determination + * does not work. One example is if you compute with piecewise constant + * elements and have a scalar solution, then there are as many cells as + * there are degrees of freedom (though they may be numbered + * differently). Another possibility is if you have a 1d mesh embedded in 2d + * space and the mesh consists of a closed curve of cells; in this case, + * there are as many nodes as there are cells, and when using a Q1 element + * you will have as many degrees of freedom as there are cells. In these + * cases, you can change the last argument of the function from its default + * value #type_automatic to either #type_dof_data or #type_cell_data, + * depending on what the vector represents. Apart from such corner cases, + * you can leave the argument at its default value and let the function + * determine the type of the vector itself. + * + * If it is a vector holding DoF data, the names given shall be one for each + * component of the underlying finite element. If it is a finite element + * composed of only one subelement, then there is another function following + * which takes a single name instead of a vector of names. + * + * The data_component_interpretation argument contains information about how + * the individual components of output files that consist of more than one + * data set are to be interpreted. + * + * For example, if one has a finite element for the Stokes equations in 2d, + * representing components (u,v,p), one would like to indicate that the + * first two, u and v, represent a logical vector so that later on when we + * generate graphical output we can hand them off to a visualization program + * that will automatically know to render them as a vector field, rather + * than as two separate and independent scalar fields. + * + * The default value of this argument (i.e. an empty vector) corresponds is + * equivalent to a vector of values + * DataComponentInterpretation::component_is_scalar, indicating that all + * output components are independent scalar fields. However, if the given + * data vector represents logical vectors, you may pass a vector that + * contains values + * DataComponentInterpretation::component_is_part_of_vector. In the example + * above, one would pass in a vector with components + * (DataComponentInterpretation::component_is_part_of_vector, + * DataComponentInterpretation::component_is_part_of_vector, + * DataComponentInterpretation::component_is_scalar) for (u,v,p). + * + * The names of a data vector shall only contain characters which are + * letters, underscore and a few other ones. Refer to the + * ExcInvalidCharacter exception declared in this class to see which + * characters are valid and which are not. + * + * @note The actual type for the vector argument may be any vector type from + * which FEValues can extract values on a cell using the + * FEValuesBase::get_function_values() function. In particular, this + * includes all of the usual vector types, but also IndexSet (see step-41 + * for a use of this). + */ + template + void add_data_vector (const VECTOR &data, + const std::vector &names, + const DataVectorType type = type_automatic, + const std::vector &data_component_interpretation + = std::vector()); + + /** + * This function is an abbreviation to the above one (see there for a + * discussion of the various arguments), intended for use with finite + * elements that are not composed of subelements. In this case, only one + * name per data vector needs to be given, which is what this function + * takes. It simply relays its arguments after a conversion of the @p name + * to a vector of strings, to the other add_data_vector() function above. + * + * If @p data is a vector with multiple components this function will + * generate distinct names for all components by appending an underscore and + * the number of each component to @p name + * + * The actual type for the template argument may be any vector type from + * which FEValues can extract values on a cell using the + * FEValuesBase::get_function_values() function. + */ + template + void add_data_vector (const VECTOR &data, + const std::string &name, + const DataVectorType type = type_automatic, + const std::vector &data_component_interpretation + = std::vector()); + + /** + * This function is an extension of the above one (see there for a + * discussion of the arguments except the first one) and allows to set a + * vector with its own DoFHandler object. This DoFHandler needs to be + * compatible with the other DoFHandler objects assigned with calls to @p + * add_data_vector or @p attach_dof_handler, in the sense that the + * DoFHandler objects need to be based on the same triangulation. This + * function allows you to export data from multiple DoFHandlers that + * describe different solution components. + * + * Since this function takes a DoFHandler object and hence naturally + * represents dof data, the data vector type argument present in the other + * methods above is skipped. + */ + template + void add_data_vector (const DH &dof_handler, + const VECTOR &data, + const std::vector &names, + const std::vector &data_component_interpretation + = std::vector()); + + + /** + * This function is an abbreviation of the function above with only a scalar + * @p dof_handler given and a single data name. + */ + template + void add_data_vector (const DH &dof_handler, + const VECTOR &data, + const std::string &name, + const std::vector &data_component_interpretation + = std::vector()); + + /** + * This function is an alternative to the above ones, allowing the output of + * derived quantities instead of the given data. This converison has to be + * done in a class derived from DataPostprocessor. + * + * The names for these derived quantities are provided by the @p + * data_postprocessor argument. Likewise, the data_component_interpretation + * argument of the other add_data_vector() functions is provided by the + * data_postprocessor argument. As only data of type @p type_dof_data can be + * transformed, this type is also known implicitly and does not have to be + * given. + * + * @note The actual type for the vector argument may be any vector type from + * which FEValues can extract values on a cell using the + * FEValuesBase::get_function_values() function. In particular, this + * includes all of the usual vector types, but also IndexSet (see step-41 + * for a use of this). + */ + template + void add_data_vector (const VECTOR &data, + const DataPostprocessor &data_postprocessor); + + /** + * Same function as above, but with a DoFHandler object that does not need + * to coincide with the DoFHandler initially set. Note that the + * postprocessor can only read data from the given DoFHandler and solution + * vector, not other solution vectors or DoFHandlers. + */ + template + void add_data_vector (const DH &dof_handler, + const VECTOR &data, + const DataPostprocessor &data_postprocessor); + + /** + * Release the pointers to the data vectors. This allows output of a new set + * of vectors without supplying the DoF handler again. Therefore, the + * DataOut object can be used in an algebraic context. Note that besides the + * data vectors also the patches already computed are deleted. + */ + void clear_data_vectors (); + + /** + * Release pointers to all input data elements, i.e. pointers to data + * vectors and to the DoF handler object. This function may be useful when + * you have called the @p build_patches function of derived class, since + * then the patches are built and the input data is no more needed, nor is + * there a need to reference it. You can then output the patches detached + * from the main thread and need not make sure anymore that the DoF handler + * object and vectors must not be deleted before the output thread is + * finished. + */ + void clear_input_data_references (); + + /** + * This function can be used to merge the patches that were created using + * the @p build_patches function of the object given as argument into the + * list of patches created by this object. This is sometimes handy if one + * has, for example, a domain decomposition algorithm where each block is + * represented by a DoFHandler of its own, but one wants to output the + * solution on all the blocks at the same time. + * + * For this to work, the given argument and this object need to have the + * same number of output vectors, and they need to use the same number of + * subdivisions per patch. The output will probably look rather funny if + * patches in both objects overlap in space. + * + * If you call build_patches() for this object after merging in patches, the + * previous state is overwritten, and the merged-in patches are lost. + * + * The second parameter allows to shift each node of the patches in the + * object passed in in the first parameter by a certain amount. This is + * sometimes useful to generate "exploded" views of a collection of blocks. + * + * This function will fail if either this or the other object did not yet + * set up any patches. + */ + template + void merge_patches (const DataOut_DoFData &source, + const Point &shift = Point()); + + /** + * Release the pointers to the data vectors and the DoF handler. You have to + * set all data entries again using the add_data_vector() function. The + * pointer to the dof handler is cleared as well, along with all other + * data. In effect, this function resets everything to a virgin state. + */ + virtual void clear (); + + /** + * Determine an estimate for the memory consumption (in bytes) of this + * object. + */ + std::size_t memory_consumption () const; + + /** + * Exception + */ + DeclException0 (ExcNoTriangulationSelected); + + /** + * Exception + */ + DeclException0 (ExcNoDoFHandlerSelected); + + /** + * Exception + */ + DeclException0 (ExcDataPostprocessingIsNotPossibleForCellData); + + /** + * Exception + */ + DeclException3 (ExcInvalidVectorSize, + int, int, int, + << "The vector has size " << arg1 + << " but the DoFHandler objects says there are " << arg2 + << " degrees of freedom and there are " << arg3 + << " active cells."); + /** + * Exception + */ + DeclException2 (ExcInvalidCharacter, + std::string, size_t, + << "Please use only the characters [a-zA-Z0-9_<>()] for" << std::endl + << "description strings since some graphics formats will only accept these." + << std::endl + << "The string you gave was <" << arg1 + << ">, the invalid character is <" << arg1[arg2] + << ">." << std::endl); + /** + * Exception + */ + DeclException0 (ExcOldDataStillPresent); + /** + * Exception + */ + DeclException2 (ExcInvalidNumberOfNames, + int, int, + << "You have to give one name per component in your " + << "data vector. The number you gave was " << arg1 + << ", but the number of components is " << arg2); + /** + * Exception + */ + DeclException0 (ExcNoPatches); + /** + * Exception + */ + DeclException0 (ExcIncompatibleDatasetNames); + /** + * Exception + */ + DeclException0 (ExcIncompatiblePatchLists); + + DeclException2 (ExcInvalidVectorDeclaration, + int, std::string, + << "When declaring that a number of components in a data\n" + << "set to be output logically form a vector instead of\n" + << "simply a set of scalar fields, you need to specify\n" + << "this for all relevant components. Furthermore,\n" + << "vectors must always consist of exactly \n" + << "components. However, the vector component at\n" + << "position " << arg1 << " with name <" << arg2 + << "> does not satisfy these conditions."); + +protected: + /** + * Abbreviate the somewhat lengthy name for the Patch class. + */ + typedef dealii::DataOutBase::Patch Patch; + + /** + * Pointer to the triangulation object. + */ + SmartPointer > triangulation; + + /** + * Pointer to the optional handler object. + */ + SmartPointer dofs; + + /** + * List of data elements with vectors of values for each degree of freedom. + */ + std::vector > > dof_data; + + /** + * List of data elements with vectors of values for each cell. + */ + std::vector > > cell_data; + + /** + * This is a list of patches that is created each time build_patches() is + * called. These patches are used in the output routines of the base + * classes. + */ + std::vector patches; + + /** + * Function by which the base class's functions get to know what patches + * they shall write to a file. + */ + virtual + const std::vector &get_patches () const; + + /** + * 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; + + /** + * Extracts the finite elements stored in the dof_data object, including a + * dummy object of FE_DGQ(0) in case only the triangulation is used. + */ + std::vector > > + get_finite_elements() const; + + /** + * Overload of the respective DataOutInterface::get_vector_data_ranges() + * function. See there for a more extensive documentation. + */ + virtual + std::vector > + get_vector_data_ranges () const; + + /** + * Make all template siblings friends. Needed for the merge_patches() + * function. + */ + template + friend class DataOut_DoFData; +}; + + + +// -------------------- template and inline functions ------------------------ + + +template +template +void +DataOut_DoFData:: +merge_patches (const DataOut_DoFData &source, + const Point &shift) +{ + const std::vector source_patches = source.get_patches (); + Assert (patches.size () != 0, ExcNoPatches ()); + Assert (source_patches.size () != 0, ExcNoPatches ()); + // check equality of component + // names + Assert (get_dataset_names() == source.get_dataset_names(), + ExcIncompatibleDatasetNames()); + // make sure patches are compatible. we'll + // assume that if the first respective + // patches are ok that all the other ones + // are ok as well + Assert (patches[0].n_subdivisions == source_patches[0].n_subdivisions, + ExcIncompatiblePatchLists()); + Assert (patches[0].data.n_rows() == source_patches[0].data.n_rows(), + ExcIncompatiblePatchLists()); + Assert (patches[0].data.n_cols() == source_patches[0].data.n_cols(), + ExcIncompatiblePatchLists()); + + // check equality of the vector data + // specifications + Assert (get_vector_data_ranges().size() == + source.get_vector_data_ranges().size(), + ExcMessage ("Both sources need to declare the same components " + "as vectors.")); + for (unsigned int i=0; i(get_vector_data_ranges()[i]) == + std_cxx1x::get<0>(source.get_vector_data_ranges()[i]), + ExcMessage ("Both sources need to declare the same components " + "as vectors.")); + Assert (std_cxx1x::get<1>(get_vector_data_ranges()[i]) == + std_cxx1x::get<1>(source.get_vector_data_ranges()[i]), + ExcMessage ("Both sources need to declare the same components " + "as vectors.")); + Assert (std_cxx1x::get<2>(get_vector_data_ranges()[i]) == + std_cxx1x::get<2>(source.get_vector_data_ranges()[i]), + ExcMessage ("Both sources need to declare the same components " + "as vectors.")); + } + + // merge patches. store old number + // of elements, since we need to + // adjust patch numbers, etc + // afterwards + const unsigned int old_n_patches = patches.size(); + patches.insert (patches.end(), + source_patches.begin(), + source_patches.end()); + + // perform shift, if so desired + if (shift != Point()) + for (unsigned int i=old_n_patches; i::vertices_per_cell; ++v) + patches[i].vertices[v] += shift; + + // adjust patch numbers + for (unsigned int i=old_n_patches; i::faces_per_cell; ++n) + if (patches[i].neighbors[n] != Patch::no_neighbor) + patches[i].neighbors[n] += old_n_patches; +} + + +DEAL_II_NAMESPACE_CLOSE + +#endif diff --git a/deal.II/include/deal.II/numerics/data_out_faces.h b/deal.II/include/deal.II/numerics/data_out_faces.h index 69055bf91c..defebb091e 100644 --- a/deal.II/include/deal.II/numerics/data_out_faces.h +++ b/deal.II/include/deal.II/numerics/data_out_faces.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__data_out_faces_h #define __deal2__data_out_faces_h @@ -38,20 +43,13 @@ namespace internal template struct ParallelData : public internal::DataOut::ParallelDataBase { - template - ParallelData (const Quadrature &quadrature, - const unsigned int n_components, - const unsigned int n_datasets, + ParallelData (const unsigned int n_datasets, const unsigned int n_subdivisions, const std::vector &n_postprocessor_outputs, const Mapping &mapping, - const FE &finite_elements, + const std::vector > > &finite_elements, const UpdateFlags update_flags); - const dealii::hp::QCollection q_collection; - const dealii::hp::MappingCollection mapping_collection; - dealii::hp::FEFaceValues x_fe_values; - std::vector > patch_normals; std::vector > patch_evaluation_points; }; diff --git a/deal.II/include/deal.II/numerics/data_out_rotation.h b/deal.II/include/deal.II/numerics/data_out_rotation.h index c720fb3933..bdf5a84778 100644 --- a/deal.II/include/deal.II/numerics/data_out_rotation.h +++ b/deal.II/include/deal.II/numerics/data_out_rotation.h @@ -1,20 +1,25 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__data_out_rotation_h #define __deal2__data_out_rotation_h #include -#include +#include #include #include @@ -38,21 +43,16 @@ namespace internal template struct ParallelData : public internal::DataOut::ParallelDataBase { - template - ParallelData (const Quadrature &quadrature, - const unsigned int n_components, - const unsigned int n_datasets, + ParallelData (const unsigned int n_datasets, const unsigned int n_subdivisions, const unsigned int n_patches_per_circle, const std::vector &n_postprocessor_outputs, - const FE &finite_elements, + const Mapping &mapping, + const std::vector > > &finite_elements, const UpdateFlags update_flags); const unsigned int n_patches_per_circle; - const dealii::hp::QCollection q_collection; - dealii::hp::FEValues x_fe_values; - std::vector > patch_evaluation_points; }; } diff --git a/deal.II/include/deal.II/numerics/data_out_stack.h b/deal.II/include/deal.II/numerics/data_out_stack.h index bfbe7ac39e..d7f65b44be 100644 --- a/deal.II/include/deal.II/numerics/data_out_stack.h +++ b/deal.II/include/deal.II/numerics/data_out_stack.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__data_out_stack_h #define __deal2__data_out_stack_h diff --git a/deal.II/include/deal.II/numerics/data_postprocessor.h b/deal.II/include/deal.II/numerics/data_postprocessor.h index f8101e1634..0260969acc 100644 --- a/deal.II/include/deal.II/numerics/data_postprocessor.h +++ b/deal.II/include/deal.II/numerics/data_postprocessor.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__data_postprocessor_h #define __deal2__data_postprocessor_h @@ -77,7 +82,7 @@ DEAL_II_NAMESPACE_OPEN * takes a solution that consists of velocity, pressure and temperature (dim+2 * components) and computes a variety of output quantities, some of which * are vector valued and some of which are scalar. On the other hand, - * in step-28 we implement a postprocessor that only computes the magnitude + * in step-29 we implement a postprocessor that only computes the magnitude * of a complex number given by a two-component finite element. It seems silly * to have to implement four virtual functions for this * (compute_derived_quantities_scalar() or compute_derived_quantities_vector(), diff --git a/deal.II/include/deal.II/numerics/derivative_approximation.h b/deal.II/include/deal.II/numerics/derivative_approximation.h index 0aaa4cc2c5..34ebddb381 100644 --- a/deal.II/include/deal.II/numerics/derivative_approximation.h +++ b/deal.II/include/deal.II/numerics/derivative_approximation.h @@ -1,15 +1,19 @@ - -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2000 - 2013 by the deal.II authors // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2012 by the deal.II authors +// This file is part of the deal.II library. // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. // -//--------------------------------------------------------------------------- +// --------------------------------------------------------------------- + #ifndef __deal2__gradient_estimator_h #define __deal2__gradient_estimator_h diff --git a/deal.II/include/deal.II/numerics/dof_output_operator.h b/deal.II/include/deal.II/numerics/dof_output_operator.h index a79a4e1def..70f89b5467 100644 --- a/deal.II/include/deal.II/numerics/dof_output_operator.h +++ b/deal.II/include/deal.II/numerics/dof_output_operator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__dof_output_operator_h #define __deal2__dof_output_operator_h diff --git a/deal.II/include/deal.II/numerics/dof_output_operator.templates.h b/deal.II/include/deal.II/numerics/dof_output_operator.templates.h index 3515f0c7ad..b9529a01c4 100644 --- a/deal.II/include/deal.II/numerics/dof_output_operator.templates.h +++ b/deal.II/include/deal.II/numerics/dof_output_operator.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2012 by Guido Kanschat +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/include/deal.II/numerics/dof_print_solver_step.h b/deal.II/include/deal.II/numerics/dof_print_solver_step.h index 9e9362bea2..2965718e1b 100644 --- a/deal.II/include/deal.II/numerics/dof_print_solver_step.h +++ b/deal.II/include/deal.II/numerics/dof_print_solver_step.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__dof_print_solver_step_h #define __deal2__dof_print_solver_step_h diff --git a/deal.II/include/deal.II/numerics/error_estimator.h b/deal.II/include/deal.II/numerics/error_estimator.h index 4e8a40b1ad..6f15d97c2e 100644 --- a/deal.II/include/deal.II/numerics/error_estimator.h +++ b/deal.II/include/deal.II/numerics/error_estimator.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__error_estimator_h #define __deal2__error_estimator_h @@ -229,114 +234,59 @@ class KellyErrorEstimator { public: /** - * Implementation of the error - * estimator described above. You - * may give a coefficient, but - * there is a default value which - * denotes the constant - * coefficient with value - * one. The coefficient function - * may either be a scalar one, in - * which case it is used for all - * components of the finite - * element, or a vector-valued - * one with as many components as - * there are in the finite - * element; in the latter case, - * each component is weighted by - * the respective component in - * the coefficient. + * Implementation of the error estimator described above. You may give a + * coefficient, but there is a default value which denotes the constant + * coefficient with value one. The coefficient function may either be a + * scalar one, in which case it is used for all components of the finite + * element, or a vector-valued one with as many components as there are in + * the finite element; in the latter case, each component is weighted by the + * respective component in the coefficient. * - * You might give a list of - * components you want to - * evaluate, in case the finite - * element used by the - * DoFHandler object is - * vector-valued. You then have - * to set those entries to true - * in the bit-vector - * @p component_mask - * (see @ref GlossComponentMask) - * for which the - * respective component is to be - * used in the error - * estimator. The default is to - * use all components, which is - * done by either providing a - * bit-vector with all-set - * entries, or an empty - * bit-vector. + * You might give a list of components you want to evaluate, in case the + * finite element used by the DoFHandler object is vector-valued. You then + * have to set those entries to true in the bit-vector @p component_mask + * (see @ref GlossComponentMask) for which the respective component is to be + * used in the error estimator. The default is to use all components, which + * is done by either providing a bit-vector with all-set entries, or an + * empty bit-vector. * - * The @p subdomain_id parameter - * indicates whether we shall compute - * indicators for all cells (in case its - * value is the default, - * numbers::invalid_unsigned_int), - * or only for the cells belonging to a - * certain subdomain with the given - * indicator. The latter case is used for - * parallel computations where all - * processor nodes have the global grid - * stored, and could well compute all the - * indicators for all cells themselves, - * but where it is more efficient to have - * each process compute only indicators - * for the cells it owns, and have them - * exchange the resulting information - * afterwards. This is in particular true - * for the case where meshes are very - * large and computing indicators for @em - * every cell is too expensive, while - * computing indicators for only local - * cells is acceptable. Note that if you - * only ask for the indicators of a - * certain subdomain to be computed, you - * must nevertheless make sure that this - * function has access to the correct - * node values of @em all degrees of - * freedom. This is since the function - * needs to access DoF values on - * neighboring cells as well, even if - * they belong to a different subdomain. + * The @p subdomain_id parameter indicates whether we shall compute + * indicators for all cells (in case its value is the default, + * numbers::invalid_unsigned_int), or only for the cells belonging + * to a certain subdomain with the given indicator. The latter case is used + * for parallel computations where all processor nodes have the global grid + * stored, and could well compute all the indicators for all cells + * themselves, but where it is more efficient to have each process compute + * only indicators for the cells it owns, and have them exchange the + * resulting information afterwards. This is in particular true for the case + * where meshes are very large and computing indicators for @em every cell + * is too expensive, while computing indicators for only local cells is + * acceptable. Note that if you only ask for the indicators of a certain + * subdomain to be computed, you must nevertheless make sure that this + * function has access to the correct node values of @em all degrees of + * freedom. This is since the function needs to access DoF values on + * neighboring cells as well, even if they belong to a different subdomain. * - * The @p material_id parameter has a similar - * meaning: if not set to its default value - * (which is numbers::invalid_material_id), - * it means that indicators will only be - * computed for cells with this particular - * material id. + * The @p material_id parameter has a similar meaning: if not set to its + * default value (which is numbers::invalid_material_id), it means that + * indicators will only be computed for cells with this particular material + * id. * - * The @p n_threads parameter used to - * indicate the number of threads to be - * used to compute the error - * estimator. This parameter is now - * ignored, with the number of threads - * determined automatically. The - * parameter is retained for - * compatibility with old versions of the - * library. + * The @p n_threads parameter used to indicate the number of threads to be + * used to compute the error estimator. This parameter is now ignored, with + * the number of threads determined automatically. The parameter is retained + * for compatibility with old versions of the library. * - * @note If the DoFHandler object - * given as an argument to this - * function builds on a - * parallel::distributed::Triangulation, - * this function skips - * computations on all cells that - * are not locally owned. In that - * case, the only valid value for - * the subdomain_id argument - * (besides the invalid value) is - * the subdomain id that is - * associated with the currently + * @note If the DoFHandler object given as an argument to this function + * builds on a parallel::distributed::Triangulation, this function skips + * computations on all cells that are not locally owned. In that case, the + * only valid value for the subdomain_id argument (besides the invalid + * value) is the subdomain id that is associated with the currently * processor, as reported by * parallel::distributed::Triangulation::locally_owned_subdomain(). Even - * though nothing is computed on - * cells that we don't locally - * own, the error indicator - * vector must still have a - * length equal to the number of - * active cell in the mesh as - * reported by + * though nothing is computed on cells that we don't locally own, the error + * indicator vector must still have a length equal to the number of active + * cell in the mesh as reported by * parallel::distributed::Triangulation::n_locally_owned_active_cells(). */ template @@ -353,8 +303,7 @@ public: const types::material_id material_id = numbers::invalid_material_id); /** - * Calls the @p estimate - * function, see above, with + * Calls the @p estimate function, see above, with * mapping=MappingQ1@(). */ template @@ -370,31 +319,17 @@ public: const types::material_id material_id = numbers::invalid_material_id); /** - * Same function as above, but - * accepts more than one solution - * vector and returns one error - * vector for each solution - * vector. For the reason of - * existence of this function, - * see the general documentation - * of this class. + * Same function as above, but accepts more than one solution vector and + * returns one error vector for each solution vector. For the reason of + * existence of this function, see the general documentation of this class. * - * Since we do not want to force - * the user of this function to - * copy around their solution - * vectors, the vector of - * solution vectors takes - * pointers to the solutions, - * rather than being a vector of - * vectors. This makes it simpler - * to have the solution vectors - * somewhere in memory, rather - * than to have them collected - * somewhere special. (Note that - * it is not possible to - * construct of vector of - * references, so we had to use a - * vector of pointers.) + * Since we do not want to force the user of this function to copy around + * their solution vectors, the vector of solution vectors takes pointers to + * the solutions, rather than being a vector of vectors. This makes it + * simpler to have the solution vectors somewhere in memory, rather than to + * have them collected somewhere special. (Note that it is not possible to + * construct of vector of references, so we had to use a vector of + * pointers.) */ template static void estimate (const Mapping &mapping, @@ -410,8 +345,7 @@ public: const types::material_id material_id = numbers::invalid_material_id); /** - * Calls the @p estimate - * function, see above, with + * Calls the @p estimate function, see above, with * mapping=MappingQ1@(). */ template @@ -428,10 +362,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const Mapping &mapping, @@ -448,10 +380,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const DH &dof, @@ -467,10 +397,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const Mapping &mapping, @@ -487,10 +415,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const DH &dof, @@ -556,51 +482,28 @@ class KellyErrorEstimator<1,spacedim> { public: /** - * Implementation of the error - * estimator described above. You - * may give a coefficient, but - * there is a default value which - * denotes the constant - * coefficient with value - * one. The coefficient function - * may either be a scalar one, in - * which case it is used for all - * components of the finite - * element, or a vector-valued - * one with as many components as - * there are in the finite - * element; in the latter case, - * each component is weighted by - * the respective component in - * the coefficient. + * Implementation of the error estimator described above. You may give a + * coefficient, but there is a default value which denotes the constant + * coefficient with value one. The coefficient function may either be a + * scalar one, in which case it is used for all components of the finite + * element, or a vector-valued one with as many components as there are in + * the finite element; in the latter case, each component is weighted by the + * respective component in the coefficient. * - * You might give a list of components - * you want to evaluate, in case the - * finite element used by the DoFHandler - * object is vector-valued. You then have - * to set those entries to true in the - * bit-vector @p component_mask for which - * the respective component is to be used - * in the error estimator. The default is - * to use all components, which is done - * by either providing a bit-vector with - * all-set entries, or an empty - * bit-vector. All the other parameters - * are as in the general case used for 2d - * and higher. + * You might give a list of components you want to evaluate, in case the + * finite element used by the DoFHandler object is vector-valued. You then + * have to set those entries to true in the bit-vector @p component_mask for + * which the respective component is to be used in the error estimator. The + * default is to use all components, which is done by either providing a + * bit-vector with all-set entries, or an empty bit-vector. All the other + * parameters are as in the general case used for 2d and higher. * - * The estimator supports multithreading - * and splits the cells to - * multithread_info.n_default_threads - * (default) threads. The number of - * threads to be used in multithreaded - * mode can be set with the last - * parameter of the error estimator. - * Multithreading is not presently - * implemented for 1d, but we retain the - * respective parameter for compatibility - * with the function signature in the - * general case. + * The estimator supports multithreading and splits the cells to + * multithread_info.n_default_threads (default) threads. The number + * of threads to be used in multithreaded mode can be set with the last + * parameter of the error estimator. Multithreading is not presently + * implemented for 1d, but we retain the respective parameter for + * compatibility with the function signature in the general case. */ template static void estimate (const Mapping<1,spacedim> &mapping, @@ -616,8 +519,7 @@ public: const types::material_id material_id = numbers::invalid_material_id); /** - * Calls the @p estimate - * function, see above, with + * Calls the @p estimate function, see above, with * mapping=MappingQ1<1>(). */ template @@ -633,31 +535,17 @@ public: const types::material_id material_id = numbers::invalid_material_id); /** - * Same function as above, but - * accepts more than one solution - * vectors and returns one error - * vector for each solution - * vector. For the reason of - * existence of this function, - * see the general documentation - * of this class. + * Same function as above, but accepts more than one solution vectors and + * returns one error vector for each solution vector. For the reason of + * existence of this function, see the general documentation of this class. * - * Since we do not want to force - * the user of this function to - * copy around their solution - * vectors, the vector of - * solution vectors takes - * pointers to the solutions, - * rather than being a vector of - * vectors. This makes it simpler - * to have the solution vectors - * somewhere in memory, rather - * than to have them collected - * somewhere special. (Note that - * it is not possible to - * construct of vector of - * references, so we had to use a - * vector of pointers.) + * Since we do not want to force the user of this function to copy around + * their solution vectors, the vector of solution vectors takes pointers to + * the solutions, rather than being a vector of vectors. This makes it + * simpler to have the solution vectors somewhere in memory, rather than to + * have them collected somewhere special. (Note that it is not possible to + * construct of vector of references, so we had to use a vector of + * pointers.) */ template static void estimate (const Mapping<1,spacedim> &mapping, @@ -673,8 +561,7 @@ public: const types::material_id material_id = numbers::invalid_material_id); /** - * Calls the @p estimate - * function, see above, with + * Calls the @p estimate function, see above, with * mapping=MappingQ1<1>(). */ template @@ -691,10 +578,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const Mapping<1,spacedim> &mapping, @@ -711,10 +596,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const DH &dof, @@ -730,10 +613,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const Mapping<1,spacedim> &mapping, @@ -750,10 +631,8 @@ public: /** - * Equivalent to the set of functions - * above, except that this one takes a - * quadrature collection for hp finite - * element dof handlers. + * Equivalent to the set of functions above, except that this one takes a + * quadrature collection for hp finite element dof handlers. */ template static void estimate (const DH &dof, diff --git a/deal.II/include/deal.II/numerics/fe_field_function.h b/deal.II/include/deal.II/numerics/fe_field_function.h index 98b7b663c7..b4df6928f1 100644 --- a/deal.II/include/deal.II/numerics/fe_field_function.h +++ b/deal.II/include/deal.II/numerics/fe_field_function.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2009, 2012, 2013 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__fe_function_h #define __deal2__fe_function_h diff --git a/deal.II/include/deal.II/numerics/fe_field_function.templates.h b/deal.II/include/deal.II/numerics/fe_field_function.templates.h index a5b657c227..93824a0f03 100644 --- a/deal.II/include/deal.II/numerics/fe_field_function.templates.h +++ b/deal.II/include/deal.II/numerics/fe_field_function.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -61,16 +66,16 @@ namespace Functions typename DH::active_cell_iterator cell = cell_hint.get(); if (cell == dh->end()) cell = dh->begin_active(); - + boost::optional > qp = get_reference_coordinates (cell, p); if (!qp) { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; } @@ -119,9 +124,9 @@ namespace Functions { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; } @@ -172,9 +177,9 @@ namespace Functions { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, p); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; } @@ -440,9 +445,9 @@ namespace Functions const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[0]); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cell = my_pair.first; qp = my_pair.second; point_flags[0] = true; @@ -504,9 +509,9 @@ namespace Functions { const std::pair > my_pair = GridTools::find_active_cell_around_point (mapping, *dh, points[first_outside]); - AssertThrow (my_pair.first->is_locally_owned(), - ExcPointNotAvailableHere()); - + AssertThrow (my_pair.first->is_locally_owned(), + ExcPointNotAvailableHere()); + cells.push_back(my_pair.first); qpoints.push_back(std::vector >(1, my_pair.second)); maps.push_back(std::vector(1, first_outside)); diff --git a/deal.II/include/deal.II/numerics/histogram.h b/deal.II/include/deal.II/numerics/histogram.h index cbc4058387..7a109e98ee 100644 --- a/deal.II/include/deal.II/numerics/histogram.h +++ b/deal.II/include/deal.II/numerics/histogram.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__histogram_h #define __deal2__histogram_h diff --git a/deal.II/include/deal.II/numerics/matrix_tools.h b/deal.II/include/deal.II/numerics/matrix_tools.h index 7291688aa8..ffacbafac3 100644 --- a/deal.II/include/deal.II/numerics/matrix_tools.h +++ b/deal.II/include/deal.II/numerics/matrix_tools.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__matrix_tools_h #define __deal2__matrix_tools_h diff --git a/deal.II/include/deal.II/numerics/point_value_history.h b/deal.II/include/deal.II/numerics/point_value_history.h index 460d403c4b..f13ad55175 100644 --- a/deal.II/include/deal.II/numerics/point_value_history.h +++ b/deal.II/include/deal.II/numerics/point_value_history.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2012 by Michael Rapson and the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __dealii__point_value_history_h #define __dealii__point_value_history_h diff --git a/deal.II/include/deal.II/numerics/solution_transfer.h b/deal.II/include/deal.II/numerics/solution_transfer.h index d1983fda76..b37133426a 100644 --- a/deal.II/include/deal.II/numerics/solution_transfer.h +++ b/deal.II/include/deal.II/numerics/solution_transfer.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__solution_transfer_h #define __deal2__solution_transfer_h diff --git a/deal.II/include/deal.II/numerics/time_dependent.h b/deal.II/include/deal.II/numerics/time_dependent.h index 5b34cc9ac1..190d0d4ca9 100644 --- a/deal.II/include/deal.II/numerics/time_dependent.h +++ b/deal.II/include/deal.II/numerics/time_dependent.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__time_dependent_h #define __deal2__time_dependent_h diff --git a/deal.II/include/deal.II/numerics/vector_tools.h b/deal.II/include/deal.II/numerics/vector_tools.h index c0b5c8c057..801e080db9 100644 --- a/deal.II/include/deal.II/numerics/vector_tools.h +++ b/deal.II/include/deal.II/numerics/vector_tools.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef __deal2__vector_tools_h #define __deal2__vector_tools_h @@ -177,7 +182,7 @@ class ConstraintMatrix; * *
  • Creation of right hand side vectors for point sources: * The create_point_source_vector() function computes the vector - * $f_i = \int_\Omega \delta_0(x-x_0) \phi_i(x) dx$. + * $f_i = \int_\Omega \delta(x-x_0) \phi_i(x) dx$. * *
  • Creation of boundary right hand side vectors: The * create_boundary_right_hand_side() function computes the vector @@ -653,7 +658,7 @@ namespace VectorTools /** * Calls the project() - * function, see above, with + * function above, with * mapping=MappingQ1@(). */ template @@ -668,6 +673,40 @@ namespace VectorTools Quadrature(0)), const bool project_to_boundary_first = false); + /** + * Same as above, but for arguments of type hp::DoFHandler, + * hp::QuadratureCollection, hp::MappingCollection + */ + template + void project (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, + const ConstraintMatrix &constraints, + const hp::QCollection &quadrature, + const Function &function, + VECTOR &vec, + const bool enforce_zero_boundary = false, + const hp::QCollection &q_boundary = hp::QCollection(dim > 1 ? + QGauss(2) : + Quadrature(0)), + const bool project_to_boundary_first = false); + + /** + * Calls the project() + * function above, with a collection of + * MappingQ1@() objects. + */ + template + void project (const hp::DoFHandler &dof, + const ConstraintMatrix &constraints, + const hp::QCollection &quadrature, + const Function &function, + VECTOR &vec, + const bool enforce_zero_boundary = false, + const hp::QCollection &q_boundary = hp::QCollection(dim > 1 ? + QGauss(2) : + Quadrature(0)), + const bool project_to_boundary_first = false); + /** * Compute Dirichlet boundary * conditions. This function makes up a map @@ -761,6 +800,18 @@ namespace VectorTools std::map &boundary_values, const ComponentMask &component_mask = ComponentMask()); + /** + * Like the previous function, but take a mapping collection to go with + * the hp::DoFHandler object. + */ + template + void + interpolate_boundary_values (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, + const typename FunctionMap::type &function_map, + std::map &boundary_values, + const ComponentMask &component_mask = ComponentMask()); + /** * Same function as above, but * taking only one pair of @@ -1048,6 +1099,29 @@ namespace VectorTools std::map &boundary_values, std::vector component_mapping = std::vector()); + /** + * Same as above, but for objects of type hp::DoFHandler + */ + template + void project_boundary_values (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, + const typename FunctionMap::type &boundary_functions, + const hp::QCollection &q, + std::map &boundary_values, + std::vector component_mapping = std::vector()); + + /** + * Calls the project_boundary_values() + * function, see above, with + * mapping=MappingQ1@(). + */ + template + void project_boundary_values (const hp::DoFHandler &dof, + const typename FunctionMap::type &boundary_function, + const hp::QCollection &q, + std::map &boundary_values, + std::vector component_mapping = std::vector()); + /** * Project a function to the boundary of * the domain, using the given quadrature @@ -1330,300 +1404,173 @@ namespace VectorTools /** - * Compute the constraints that - * correspond to boundary conditions of - * the form $\vec n \cdot \vec u=0$, - * i.e. no normal flux if $\vec u$ is a - * vector-valued quantity. These - * conditions have exactly the form - * handled by the ConstraintMatrix class, - * so instead of creating a map between - * boundary degrees of freedom and - * corresponding value, we here create a - * list of constraints that are written - * into a ConstraintMatrix. This object - * may already have some content, for - * example from hanging node constraints, - * that remains untouched. These - * constraints have to be applied to the - * linear system like any other such - * constraints, i.e. you have to condense - * the linear system with the constraints - * before solving, and you have to - * distribute the solution vector - * afterwards. - * - * The use of this function is - * explained in more detail in - * step-31. It - * doesn't make much sense in 1d, - * so the function throws an - * exception in that case. - * - * The second argument of this - * function denotes the first - * vector component in the finite - * element that corresponds to - * the vector function that you - * want to constrain. For - * example, if we were solving a - * Stokes equation in 2d and the - * finite element had components - * $(u,v,p)$, then @p - * first_vector_component would - * be zero. On the other hand, if - * we solved the Maxwell - * equations in 3d and the finite - * element has components - * $(E_x,E_y,E_z,B_x,B_y,B_z)$ - * and we want the boundary - * condition $\vec n\cdot \vec - * B=0$, then @p - * first_vector_component would - * be 3. Vectors are implicitly - * assumed to have exactly - * dim components - * that are ordered in the same - * way as we usually order the - * coordinate directions, - * i.e. $x$-, $y$-, and finally - * $z$-component. The function - * assumes, but can't check, that - * the vector components in the - * range - * [first_vector_component,first_vector_component+dim) - * come from the same base finite - * element. For example, in the - * Stokes example above, it would - * not make sense to use a - * FESystem@(FE_Q@(2), - * 1, FE_Q@(1), dim) - * (note that the first velocity - * vector component is a $Q_2$ - * element, whereas all the other - * ones are $Q_1$ elements) as - * there would be points on the - * boundary where the - * $x$-velocity is defined but no - * corresponding $y$- or - * $z$-velocities. - * - * The third argument denotes the set of - * boundary indicators on which the - * boundary condition is to be - * enforced. Note that, as explained - * below, this is one of the few - * functions where it makes a difference - * where we call the function multiple - * times with only one boundary - * indicator, or whether we call the - * function onces with the whole set of - * boundary indicators at once. - * - * The mapping argument is used to - * compute the boundary points where the function - * needs to request the normal vector $\vec n$ - * from the boundary description. - * - * @note When combining adaptively - * refined meshes with hanging node - * constraints and boundary conditions - * like from the current function within - * one ConstraintMatrix object, the - * hanging node constraints should always - * be set first, and then the boundary - * conditions since boundary conditions - * are not set in the second operation on - * degrees of freedom that are already - * constrained. This makes sure that the - * discretization remains conforming as - * is needed. See the discussion on - * conflicting constraints in the module - * on @ref constraints . + * Compute the constraints that correspond to boundary conditions of the + * form $\vec n \cdot \vec u=0$, i.e. no normal flux if $\vec u$ is a + * vector-valued quantity. These conditions have exactly the form handled by + * the ConstraintMatrix class, so instead of creating a map between boundary + * degrees of freedom and corresponding value, we here create a list of + * constraints that are written into a ConstraintMatrix. This object may + * already have some content, for example from hanging node constraints, + * that remains untouched. These constraints have to be applied to the + * linear system like any other such constraints, i.e. you have to condense + * the linear system with the constraints before solving, and you have to + * distribute the solution vector afterwards. + * + * The use of this function is explained in more detail in step-31. It + * doesn't make much sense in 1d, so the function throws an exception in + * that case. + * + * The second argument of this function denotes the first vector component + * in the finite element that corresponds to the vector function that you + * want to constrain. For example, if we were solving a Stokes equation in + * 2d and the finite element had components $(u,v,p)$, then @p + * first_vector_component would be zero. On the other hand, if we solved the + * Maxwell equations in 3d and the finite element has components + * $(E_x,E_y,E_z,B_x,B_y,B_z)$ and we want the boundary condition $\vec + * n\cdot \vec B=0$, then @p first_vector_component would be 3. Vectors are + * implicitly assumed to have exactly dim components that are + * ordered in the same way as we usually order the coordinate directions, + * i.e. $x$-, $y$-, and finally $z$-component. The function assumes, but + * can't check, that the vector components in the range + * [first_vector_component,first_vector_component+dim) come + * from the same base finite element. For example, in the Stokes example + * above, it would not make sense to use a + * FESystem@(FE_Q@(2), 1, FE_Q@(1), dim) + * (note that the first velocity vector component is a $Q_2$ element, + * whereas all the other ones are $Q_1$ elements) as there would be points + * on the boundary where the $x$-velocity is defined but no corresponding + * $y$- or $z$-velocities. + * + * The third argument denotes the set of boundary indicators on which the + * boundary condition is to be enforced. Note that, as explained below, this + * is one of the few functions where it makes a difference where we call the + * function multiple times with only one boundary indicator, or whether we + * call the function onces with the whole set of boundary indicators at + * once. + * + * The mapping argument is used to compute the boundary points where the + * function needs to request the normal vector $\vec n$ from the boundary + * description. + * + * @note When combining adaptively refined meshes with hanging node + * constraints and boundary conditions like from the current function within + * one ConstraintMatrix object, the hanging node constraints should always + * be set first, and then the boundary conditions since boundary conditions + * are not set in the second operation on degrees of freedom that are + * already constrained. This makes sure that the discretization remains + * conforming as is needed. See the discussion on conflicting constraints in + * the module on @ref constraints . * * *

    Computing constraints in 2d

    * - * Computing these constraints requires - * some smarts. The main question - * revolves around the question what the - * normal vector is. Consider the - * following situation: - *

    - * @image html no_normal_flux_1.png + * Computing these constraints requires some smarts. The main question + * revolves around the question what the normal vector is. Consider the + * following situation:

    @image html no_normal_flux_1.png *

    * - * Here, we have two cells that use a - * bilinear mapping - * (i.e. MappingQ1). Consequently, for - * each of the cells, the normal vector - * is perpendicular to the straight - * edge. If the two edges at the top and - * right are meant to approximate a - * curved boundary (as indicated by the - * dashed line), then neither of the two - * computed normal vectors are equal to - * the exact normal vector (though they - * approximate it as the mesh is refined - * further). What is worse, if we - * constrain $\vec n \cdot \vec u=0$ at - * the common vertex with the normal - * vector from both cells, then we - * constrain the vector $\vec u$ with - * respect to two linearly independent - * vectors; consequently, the constraint - * would be $\vec u=0$ at this point - * (i.e. all components of the - * vector), which is not what we wanted. - * - * To deal with this situation, the - * algorithm works in the following way: - * at each point where we want to - * constrain $\vec u$, we first collect - * all normal vectors that adjacent cells - * might compute at this point. We then - * do not constrain $\vec n \cdot \vec - * u=0$ for each of these normal - * vectors but only for the - * average of the normal - * vectors. In the example above, we - * therefore record only a single - * constraint $\vec n \cdot \vec {\bar - * u}=0$, where $\vec {\bar u}$ is the - * average of the two indicated normal - * vectors. - * - * Unfortunately, this is not quite - * enough. Consider the situation here: + * Here, we have two cells that use a bilinear mapping + * (i.e. MappingQ1). Consequently, for each of the cells, the normal vector + * is perpendicular to the straight edge. If the two edges at the top and + * right are meant to approximate a curved boundary (as indicated by the + * dashed line), then neither of the two computed normal vectors are equal + * to the exact normal vector (though they approximate it as the mesh is + * refined further). What is worse, if we constrain $\vec n \cdot \vec u=0$ + * at the common vertex with the normal vector from both cells, then we + * constrain the vector $\vec u$ with respect to two linearly independent + * vectors; consequently, the constraint would be $\vec u=0$ at this point + * (i.e. all components of the vector), which is not what we wanted. + * + * To deal with this situation, the algorithm works in the following way: at + * each point where we want to constrain $\vec u$, we first collect all + * normal vectors that adjacent cells might compute at this point. We then + * do not constrain $\vec n \cdot \vec u=0$ for each of these normal + * vectors but only for the average of the normal vectors. In the + * example above, we therefore record only a single constraint $\vec n \cdot + * \vec {\bar u}=0$, where $\vec {\bar u}$ is the average of the two + * indicated normal vectors. + * + * Unfortunately, this is not quite enough. Consider the situation here: * *

    * @image html no_normal_flux_2.png *

    * - * If again the top and right edges - * approximate a curved boundary, and the - * left boundary a separate boundary (for - * example straight) so that the exact - * boundary has indeed a corner at the - * top left vertex, then the above - * construction would not work: here, we - * indeed want the constraint that $\vec - * u$ at this point (because the normal - * velocities with respect to both the - * left normal as well as the top normal - * vector should be zero), not that the - * velocity in the direction of the - * average normal vector is zero. - * - * Consequently, we use the following - * heuristic to determine whether all - * normal vectors computed at one point - * are to be averaged: if two normal - * vectors for the same point are - * computed on different cells, - * then they are to be averaged. This - * covers the first example above. If - * they are computed from the same cell, - * then the fact that they are different - * is considered indication that they - * come from different parts of the - * boundary that might be joined by a - * real corner, and must not be averaged. - * - * There is one problem with this - * scheme. If, for example, the same - * domain we have considered above, is - * discretized with the following mesh, - * then we get into trouble: + * If again the top and right edges approximate a curved boundary, and the + * left boundary a separate boundary (for example straight) so that the + * exact boundary has indeed a corner at the top left vertex, then the above + * construction would not work: here, we indeed want the constraint that + * $\vec u$ at this point (because the normal velocities with respect to + * both the left normal as well as the top normal vector should be zero), + * not that the velocity in the direction of the average normal vector is + * zero. + * + * Consequently, we use the following heuristic to determine whether all + * normal vectors computed at one point are to be averaged: if two normal + * vectors for the same point are computed on different cells, then + * they are to be averaged. This covers the first example above. If they are + * computed from the same cell, then the fact that they are different is + * considered indication that they come from different parts of the boundary + * that might be joined by a real corner, and must not be averaged. + * + * There is one problem with this scheme. If, for example, the same domain + * we have considered above, is discretized with the following mesh, then we + * get into trouble: * *

    * @image html no_normal_flux_3.png *

    * - * Here, the algorithm assumes that the - * boundary does not have a corner at the - * point where faces $F1$ and $F2$ join - * because at that point there are two - * different normal vectors computed from - * different cells. If you intend for - * there to be a corner of the exact - * boundary at this point, the only way - * to deal with this is to assign the two - * parts of the boundary different - * boundary indicators and call this - * function twice, once for each boundary - * indicators; doing so will yield only - * one normal vector at this point per - * invocation (because we consider only - * one boundary part at a time), with the - * result that the normal vectors will - * not be averaged. + * Here, the algorithm assumes that the boundary does not have a corner at + * the point where faces $F1$ and $F2$ join because at that point there are + * two different normal vectors computed from different cells. If you intend + * for there to be a corner of the exact boundary at this point, the only + * way to deal with this is to assign the two parts of the boundary + * different boundary indicators and call this function twice, once for each + * boundary indicators; doing so will yield only one normal vector at this + * point per invocation (because we consider only one boundary part at a + * time), with the result that the normal vectors will not be averaged. This + * situation also needs to be taken into account when using this function + * around reentrant corners on Cartesian meshes. If no-normal-flux boundary + * conditions are to be enforced on non-Cartesian meshes around reentrant + * corners, one may even get cycles in the constraints as one will in + * general constrain different components from the two sides. In that case, + * set a no-slip constraint on the reentrant vertex first. * * *

    Computing constraints in 3d

    * - * The situation is more - * complicated in 3d. Consider - * the following case where we - * want to compute the - * constraints at the marked - * vertex: + * The situation is more complicated in 3d. Consider the following case + * where we want to compute the constraints at the marked vertex: * *

    * @image html no_normal_flux_4.png *

    * - * Here, we get four different - * normal vectors, one from each - * of the four faces that meet at - * the vertex. Even though they - * may form a complete set of - * vectors, it is not our intent - * to constrain all components of - * the vector field at this - * point. Rather, we would like - * to still allow tangential - * flow, where the term - * "tangential" has to be - * suitably defined. - * - * In a case like this, the - * algorithm proceeds as follows: - * for each cell that has - * computed two tangential - * vectors at this point, we - * compute the unconstrained - * direction as the outer product - * of the two tangential vectors - * (if necessary multiplied by - * minus one). We then average - * these tangential - * vectors. Finally, we compute - * constraints for the two - * directions perpendicular to - * this averaged tangential - * direction. - * - * There are cases where one cell - * contributes two tangential - * directions and another one - * only one; for example, this - * would happen if both top and - * front faces of the left cell - * belong to the boundary - * selected whereas only the top - * face of the right cell belongs - * to it. This case is not - * currently implemented. + * Here, we get four different normal vectors, one from each of the four + * faces that meet at the vertex. Even though they may form a complete set + * of vectors, it is not our intent to constrain all components of the + * vector field at this point. Rather, we would like to still allow + * tangential flow, where the term "tangential" has to be suitably defined. + * + * In a case like this, the algorithm proceeds as follows: for each cell + * that has computed two tangential vectors at this point, we compute the + * unconstrained direction as the outer product of the two tangential + * vectors (if necessary multiplied by minus one). We then average these + * tangential vectors. Finally, we compute constraints for the two + * directions perpendicular to this averaged tangential direction. + * + * There are cases where one cell contributes two tangential directions and + * another one only one; for example, this would happen if both top and + * front faces of the left cell belong to the boundary selected whereas only + * the top face of the right cell belongs to it. This case is not currently + * implemented. * * *

    Results

    * - * Because it makes for good - * pictures, here are two images - * of vector fields on a circle - * and on a sphere to which the - * constraints computed by this + * Because it makes for good pictures, here are two images of vector fields + * on a circle and on a sphere to which the constraints computed by this * function have been applied: * *

    @@ -1631,16 +1578,10 @@ namespace VectorTools * @image html no_normal_flux_6.png *

    * - * The vectors fields are not - * physically reasonable but the - * tangentiality constraint is - * clearly enforced. The fact - * that the vector fields are - * zero at some points on the - * boundary is an artifact of the - * way it is created, it is not - * constrained to be zero at - * these points. + * The vectors fields are not physically reasonable but the tangentiality + * constraint is clearly enforced. The fact that the vector fields are zero + * at some points on the boundary is an artifact of the way it is created, + * it is not constrained to be zero at these points. * * @ingroup constraints * @@ -1654,6 +1595,22 @@ namespace VectorTools ConstraintMatrix &constraints, const Mapping &mapping = StaticMappingQ1::mapping); + /** + * Compute the constraints that correspond to boundary conditions of the + * form $\vec n \times \vec u=0$, i.e. flow normal to the boundary if $\vec + * u$ is a vector-valued quantity. This function constrains exactly those + * vector-valued components that are left unconstrained by + * compute_no_normal_flux_constraints, and leaves the one component + * unconstrained that is constrained by compute_no_normal_flux_constraints. + */ + template class DH, int spacedim> + void + compute_normal_flux_constraints (const DH &dof_handler, + const unsigned int first_vector_component, + const std::set &boundary_ids, + ConstraintMatrix &constraints, + const Mapping &mapping = StaticMappingQ1::mapping); + //@} /** @@ -1711,7 +1668,9 @@ namespace VectorTools /** * Create a right hand side - * vector for a point source at point @p p. + * vector for a point source at point @p p. In other words, it creates + * a vector $F$ so that + * $F_i = \int_\Omega \delta(x-p) \phi_i(x) dx$. * Prior content of the * given @p rhs_vector vector is * deleted. @@ -2071,6 +2030,11 @@ namespace VectorTools * using a Q1-mapping for cell * boundaries to call the other * point_difference() function. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template void point_difference (const DoFHandler &dof, @@ -2095,6 +2059,11 @@ namespace VectorTools * this function uses an * arbitrary mapping to evaluate * the difference. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template void point_difference (const Mapping &mapping, @@ -2118,6 +2087,11 @@ namespace VectorTools * using a Q1-mapping for cell * boundaries to call the other * point_difference() function. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template void @@ -2128,6 +2102,11 @@ namespace VectorTools /** * Same as above for hp. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template void @@ -2153,6 +2132,11 @@ namespace VectorTools * "Possibilities for extensions" part of * the results section of @ref step_3 * "step-3". + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template double @@ -2162,6 +2146,11 @@ namespace VectorTools /** * Same as above for hp. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template double @@ -2183,6 +2172,11 @@ namespace VectorTools * function of the same name, * this function uses an arbitrary * mapping to evaluate the difference. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template void @@ -2194,6 +2188,11 @@ namespace VectorTools /** * Same as above for hp. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template void @@ -2215,6 +2214,11 @@ namespace VectorTools * function of the same name, * this function uses an arbitrary * mapping to evaluate the difference. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template double @@ -2225,6 +2229,11 @@ namespace VectorTools /** * Same as above for hp. + * + * @note If the cell in which the point is found + * is not locally owned, an exception of type + * VectorTools::ExcPointNotAvailableHere + * is thrown. */ template double @@ -2344,9 +2353,9 @@ namespace VectorTools DeclException0 (ExcNonInterpolatingFE); /** - * Exception - */ - DeclException0 (ExcNoComponentSelected); + * Exception + */ + DeclException0 (ExcPointNotAvailableHere); } diff --git a/deal.II/include/deal.II/numerics/vector_tools.templates.h b/deal.II/include/deal.II/numerics/vector_tools.templates.h index 6e90a698fa..92670d6ac5 100644 --- a/deal.II/include/deal.II/numerics/vector_tools.templates.h +++ b/deal.II/include/deal.II/numerics/vector_tools.templates.h @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #ifndef _deal2__vector_tools_templates_h #define _deal2__vector_tools_templates_h @@ -55,6 +60,7 @@ #include #include +#include #include #include #include @@ -329,57 +335,17 @@ namespace VectorTools namespace internal { + /** + * Interpolate zero boundary values. We don't need to worry about a mapping + * here because the function we evaluate for the DoFs is zero in the mapped + * locations as well as in the original, unmapped locations + */ + template void - interpolate_zero_boundary_values (const dealii::DoFHandler<1> &dof_handler, - std::map &boundary_values) - { - // we only need to find the - // left-most and right-most - // vertex and query its vertex - // dof indices. that's easy :-) - for (unsigned int direction=0; direction<2; ++direction) - { - dealii::DoFHandler<1>::cell_iterator - cell = dof_handler.begin(0); - while (!cell->at_boundary(direction)) - cell = cell->neighbor(direction); - - for (unsigned int i=0; ivertex_dof_index (direction, i)] = 0.; - } - } - - - - // codimension 1 - void - interpolate_zero_boundary_values (const dealii::DoFHandler<1,2> &dof_handler, - std::map &boundary_values) - { - // we only need to find the - // left-most and right-most - // vertex and query its vertex - // dof indices. that's easy :-) - for (unsigned int direction=0; direction<2; ++direction) - { - dealii::DoFHandler<1,2>::cell_iterator - cell = dof_handler.begin(0); - while (!cell->at_boundary(direction)) - cell = cell->neighbor(direction); - - for (unsigned int i=0; ivertex_dof_index (direction, i)] = 0.; - } - } - - - - template - void - interpolate_zero_boundary_values (const dealii::DoFHandler &dof_handler, + interpolate_zero_boundary_values (const DH &dof_handler, std::map &boundary_values) { - const FiniteElement &fe = dof_handler.get_fe(); + const unsigned int dim = DH::dimension; // loop over all boundary faces // to get all dof indices of @@ -402,16 +368,18 @@ namespace VectorTools // that is actually wholly on // the boundary, not only by // one line or one vertex - typename dealii::DoFHandler::active_cell_iterator + typename DH::active_cell_iterator cell = dof_handler.begin_active(), endc = dof_handler.end(); - std::vector face_dof_indices (fe.dofs_per_face); + std::vector face_dof_indices; for (; cell!=endc; ++cell) for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->at_boundary(f)) { - cell->face(f)->get_dof_indices (face_dof_indices); - for (unsigned int i=0; iget_fe().dofs_per_face); + cell->face(f)->get_dof_indices (face_dof_indices, + cell->active_fe_index()); + for (unsigned int i=0; iget_fe().dofs_per_face; ++i) // enter zero boundary values // for all boundary nodes // @@ -531,132 +499,185 @@ namespace VectorTools } - - template - void project (const Mapping &mapping, - const DoFHandler &dof, - const ConstraintMatrix &constraints, - const Quadrature &quadrature, - const Function &function, - VECTOR &vec_result, - const bool enforce_zero_boundary, - const Quadrature &q_boundary, - const bool project_to_boundary_first) + namespace { - Assert (dof.get_fe().n_components() == function.n_components, - ExcDimensionMismatch(dof.get_fe().n_components(), - function.n_components)); - - Assert (vec_result.size() == dof.n_dofs(), - ExcDimensionMismatch (vec_result.size(), dof.n_dofs())); - - // make up boundary values - std::map boundary_values; - - if (enforce_zero_boundary == true) - // no need to project boundary - // values, but enforce - // homogeneous boundary values - // anyway - internal:: - interpolate_zero_boundary_values (dof, boundary_values); - - else - // no homogeneous boundary values - if (project_to_boundary_first == true) - // boundary projection required - { - // set up a list of boundary - // functions for the - // different boundary - // parts. We want the - // function to hold on - // all parts of the boundary - typename FunctionMap::type boundary_functions; - for (types::boundary_id c=0; c class DH, + template class M_or_MC, + template class Q_or_QC> + void project_compute_b_v (const M_or_MC &mapping, + const DH &dof, + const Function &function, + const bool enforce_zero_boundary, + const Q_or_QC &q_boundary, + const bool project_to_boundary_first, + std::map &boundary_values) + { + if (enforce_zero_boundary == true) + // no need to project boundary + // values, but enforce + // homogeneous boundary values + // anyway + internal:: + interpolate_zero_boundary_values (dof, boundary_values); + + else + // no homogeneous boundary values + if (project_to_boundary_first == true) + // boundary projection required + { + // set up a list of boundary + // functions for the + // different boundary + // parts. We want the + // function to hold on + // all parts of the boundary + const std::vector + used_boundary_indicators = dof.get_tria().get_boundary_indicators(); + + typename FunctionMap::type boundary_functions; + for (unsigned int i=0; i vec (dof.n_dofs()); - SparsityPattern sparsity; - // check if constraints are compatible (see below) - bool constraints_are_compatible = true; + /** + * Return whether the boundary values try to constrain a degree of + * freedom that is already constrained to something else + */ + bool constraints_and_b_v_are_compatible (const ConstraintMatrix &constraints, + std::map &boundary_values) { for (std::map::iterator it=boundary_values.begin(); it != boundary_values.end(); ++it) if (constraints.is_constrained(it->first)) +//TODO: This looks wrong -- shouldn't it be ==0 in the first condition and && ? if (!(constraints.get_constraint_entries(it->first)->size() > 0 || (constraints.get_inhomogeneity(it->first) == it->second))) - { - constraints_are_compatible = false; - break; - } - } - - // use csp to consume less memory and to - // still be fast - { - CompressedSimpleSparsityPattern csp (dof.n_dofs(), dof.n_dofs()); - DoFTools::make_sparsity_pattern (dof, csp, constraints, - !constraints_are_compatible); + return false; - sparsity.copy_from (csp); + return true; } - SparseMatrix mass_matrix (sparsity); - Vector tmp (mass_matrix.n()); - // If the constraint matrix does not conflict with the given boundary - // values (i.e., it either does not contain boundary values or it contains - // the same as boundary_values), we can let it call - // distribute_local_to_global straight away, otherwise we need to first - // interpolate the boundary values and then condense the matrix and vector - if (constraints_are_compatible) + /** + * Generic implementation of the project() function + */ + template class DH, + template class M_or_MC, + template class Q_or_QC> + void do_project (const M_or_MC &mapping, + const DH &dof, + const ConstraintMatrix &constraints, + const Q_or_QC &quadrature, + const Function &function, + Vector &vec_result, + const bool enforce_zero_boundary, + const Q_or_QC &q_boundary, + const bool project_to_boundary_first) + { + Assert (dof.get_fe().n_components() == function.n_components, + ExcDimensionMismatch(dof.get_fe().n_components(), + function.n_components)); + Assert (vec_result.size() == dof.n_dofs(), + ExcDimensionMismatch (vec_result.size(), dof.n_dofs())); + + // make up boundary values + std::map boundary_values; + project_compute_b_v(mapping, dof, function, enforce_zero_boundary, + q_boundary, project_to_boundary_first, boundary_values); + + // check if constraints are compatible (see below) + const bool constraints_are_compatible = + constraints_and_b_v_are_compatible(constraints, boundary_values); + + // set up mass matrix and right hand side + dealii::Vector vec (dof.n_dofs()); + SparsityPattern sparsity; { - const Function* dummy = 0; - MatrixCreator::create_mass_matrix (mapping, dof, quadrature, - mass_matrix, function, tmp, - dummy, constraints); - if (boundary_values.size() > 0) + CompressedSimpleSparsityPattern csp (dof.n_dofs(), dof.n_dofs()); + DoFTools::make_sparsity_pattern (dof, csp, constraints, + !constraints_are_compatible); + + sparsity.copy_from (csp); + } + SparseMatrix mass_matrix (sparsity); + dealii::Vector tmp (mass_matrix.n()); + + // If the constraint matrix does not conflict with the given boundary + // values (i.e., it either does not contain boundary values or it contains + // the same as boundary_values), we can let it call + // distribute_local_to_global straight away, otherwise we need to first + // interpolate the boundary values and then condense the matrix and vector + if (constraints_are_compatible) + { + const Function *dummy = 0; + MatrixCreator::create_mass_matrix (mapping, dof, quadrature, + mass_matrix, function, tmp, + dummy, constraints); + if (boundary_values.size() > 0) + MatrixTools::apply_boundary_values (boundary_values, + mass_matrix, vec, tmp, + true); + } + else + { + // create mass matrix and rhs at once, which is faster. + MatrixCreator::create_mass_matrix (mapping, dof, quadrature, + mass_matrix, function, tmp); MatrixTools::apply_boundary_values (boundary_values, mass_matrix, vec, tmp, true); - } - else - { - // create mass matrix and rhs at once, which is faster. - MatrixCreator::create_mass_matrix (mapping, dof, quadrature, - mass_matrix, function, tmp); - MatrixTools::apply_boundary_values (boundary_values, - mass_matrix, vec, tmp, - true); - constraints.condense(mass_matrix, tmp); - } + constraints.condense(mass_matrix, tmp); + } - // Allow for a maximum of 5*n steps to reduce the residual by 10^-12. n - // steps may not be sufficient, since roundoff errors may accumulate for - // badly conditioned matrices - ReductionControl control(5*tmp.size(), 0., 1e-12, false, false); - GrowingVectorMemory<> memory; - SolverCG<> cg(control,memory); + // Allow for a maximum of 5*n steps to reduce the residual by 10^-12. n + // steps may not be sufficient, since roundoff errors may accumulate for + // badly conditioned matrices + ReductionControl control(5*tmp.size(), 0., 1e-12, false, false); + GrowingVectorMemory<> memory; + SolverCG<> cg(control,memory); - PreconditionSSOR<> prec; - prec.initialize(mass_matrix, 1.2); + PreconditionSSOR<> prec; + prec.initialize(mass_matrix, 1.2); - cg.solve (mass_matrix, vec, tmp, prec); + cg.solve (mass_matrix, vec, tmp, prec); - constraints.distribute (vec); + constraints.distribute (vec); - // copy vec into vec_result. we can't use vec_result itself above, since - // it may be of another type than Vector and that wouldn't - // necessarily go together with the matrix and other functions - for (unsigned int i=0; i and that wouldn't + // necessarily go together with the matrix and other functions + for (unsigned int i=0; i + void project (const Mapping &mapping, + const DoFHandler &dof, + const ConstraintMatrix &constraints, + const Quadrature &quadrature, + const Function &function, + VECTOR &vec_result, + const bool enforce_zero_boundary, + const Quadrature &q_boundary, + const bool project_to_boundary_first) + { + do_project (mapping, dof, constraints, quadrature, + function, vec_result, + enforce_zero_boundary, q_boundary, + project_to_boundary_first); } @@ -676,6 +697,39 @@ namespace VectorTools + template + void project (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, + const ConstraintMatrix &constraints, + const hp::QCollection &quadrature, + const Function &function, + VECTOR &vec_result, + const bool enforce_zero_boundary, + const hp::QCollection &q_boundary, + const bool project_to_boundary_first) + { + do_project (mapping, dof, constraints, quadrature, + function, vec_result, + enforce_zero_boundary, q_boundary, + project_to_boundary_first); + } + + + template + void project (const hp::DoFHandler &dof, + const ConstraintMatrix &constraints, + const hp::QCollection &quadrature, + const Function &function, + VECTOR &vec, + const bool enforce_zero_boundary, + const hp::QCollection &q_boundary, + const bool project_to_boundary_first) + { + project(hp::StaticMappingQ1::mapping_collection, + dof, constraints, quadrature, function, vec, + enforce_zero_boundary, q_boundary, project_to_boundary_first); + } + template void create_right_hand_side (const Mapping &mapping, @@ -1127,36 +1181,6 @@ namespace VectorTools -// separate implementation for 1D because otherwise we get linker errors since -// FEFaceValues<1> is not compiled - template <> - void - create_boundary_right_hand_side (const Mapping<1,1> &, - const DoFHandler<1,1> &, - const Quadrature<0> &, - const Function<1> &, - Vector &, - const std::set &) - { - Assert (false, ExcImpossibleInDim(1)); - } - - - - template <> - void - create_boundary_right_hand_side (const Mapping<1,2> &, - const DoFHandler<1,2> &, - const Quadrature<0> &, - const Function<2> &, - Vector &, - const std::set &) - { - Assert (false, ExcImpossibleInDim(1)); - } - - - template void create_boundary_right_hand_side (const Mapping &mapping, @@ -1296,36 +1320,6 @@ namespace VectorTools -// separate implementation for 1D because otherwise we get linker errors since -// hp::FEFaceValues<1> is not compiled - template <> - void - create_boundary_right_hand_side (const hp::MappingCollection<1,1> &, - const hp::DoFHandler<1,1> &, - const hp::QCollection<0> &, - const Function<1> &, - Vector &, - const std::set &) - { - Assert (false, ExcImpossibleInDim(1)); - } - - - - template <> - void - create_boundary_right_hand_side (const hp::MappingCollection<1,2> &, - const hp::DoFHandler<1,2> &, - const hp::QCollection<0> &, - const Function<2> &, - Vector &, - const std::set &) - { - Assert (false, ExcImpossibleInDim(1)); - } - - - template void create_boundary_right_hand_side (const hp::MappingCollection &mapping, @@ -1479,7 +1473,7 @@ namespace VectorTools // ----------- interpolate_boundary_values for std::map -------------------- - namespace internal + namespace { // interpolate boundary values in // 1d. in higher dimensions, we @@ -1488,9 +1482,10 @@ namespace VectorTools // faces are points and it is far // easier to simply work on // individual vertices - template + template class M_or_MC> static inline - void interpolate_boundary_values (const Mapping &, + void do_interpolate_boundary_values (const M_or_MC &, const DH &dof, const typename FunctionMap::type &function_map, std::map &boundary_values, @@ -1530,7 +1525,7 @@ namespace VectorTools boundary_function.n_components)); Assert (component_mask.n_selected_components(fe.n_components()) > 0, - ExcNoComponentSelected()); + ComponentMask::ExcNoComponentSelected()); // now set the value of // the vertex degree of @@ -1566,10 +1561,11 @@ namespace VectorTools - template + template class M_or_MC> static inline void - interpolate_boundary_values (const Mapping &mapping, + do_interpolate_boundary_values (const M_or_MC &mapping, const DH &dof, const typename FunctionMap::type &function_map, std::map &boundary_values, @@ -1920,8 +1916,7 @@ namespace VectorTools std::map &boundary_values, const ComponentMask &component_mask_) { - internal:: - interpolate_boundary_values (mapping, dof, function_map, boundary_values, + do_interpolate_boundary_values (mapping, dof, function_map, boundary_values, component_mask_, dealii::internal::int2type()); } @@ -1944,6 +1939,20 @@ namespace VectorTools } + template + void + interpolate_boundary_values (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, + const typename FunctionMap::type &function_map, + std::map &boundary_values, + const ComponentMask &component_mask_) + { + do_interpolate_boundary_values (mapping, dof, function_map, boundary_values, + component_mask_, + dealii::internal::int2type()); + } + + template void @@ -2060,211 +2069,201 @@ namespace VectorTools // -------- implementation for project_boundary_values with std::map -------- -// separate implementations for 1D because otherwise we get linking errors -// because create_boundary_mass_matrix is not compiled for 1D - template <> - void - project_boundary_values (const Mapping<1,1> &mapping, - const DoFHandler<1,1> &dof, - const FunctionMap<1>::type &boundary_functions, - const Quadrature<0> &, - std::map &boundary_values, - std::vector component_mapping) - { - Assert (component_mapping.size() == 0, ExcNotImplemented()); - // projection in 1d is equivalent - // to interpolation - interpolate_boundary_values (mapping, dof, boundary_functions, - boundary_values, ComponentMask()); - } - - - template <> - void - project_boundary_values (const Mapping<1,2> &mapping, - const DoFHandler<1,2> &dof, - const FunctionMap<2>::type &boundary_functions, - const Quadrature<0> &, - std::map &boundary_values, - std::vector component_mapping) + namespace { - Assert (component_mapping.size() == 0, ExcNotImplemented()); - // projection in 1d is equivalent - // to interpolation - interpolate_boundary_values (mapping, dof, boundary_functions, - boundary_values, ComponentMask()); - } + template class DH, + template class M_or_MC, + template class Q_or_QC> + void + do_project_boundary_values (const M_or_MC &mapping, + const DH &dof, + const typename FunctionMap::type &boundary_functions, + const Q_or_QC &q, + std::map &boundary_values, + std::vector component_mapping) + { + // in 1d, projection onto the 0d end points == interpolation + if (dim == 1) + { + Assert (component_mapping.size() == 0, ExcNotImplemented()); + interpolate_boundary_values (mapping, dof, boundary_functions, + boundary_values, ComponentMask()); + return; + } + //TODO:[?] In project_boundary_values, no condensation of sparsity + // structures, matrices and right hand sides or distribution of + // solution vectors is performed. This is ok for dim<3 because then + // there are no constrained nodes on the boundary, but is not + // acceptable for higher dimensions. Fix this. + if (component_mapping.size() == 0) + { + AssertDimension (dof.get_fe().n_components(), boundary_functions.begin()->second->n_components); + // I still do not see why i + // should create another copy + // here + component_mapping.resize(dof.get_fe().n_components()); + for (unsigned int i= 0 ; i < component_mapping.size() ; ++i) + component_mapping[i] = i; + } + else + AssertDimension (dof.get_fe().n_components(), component_mapping.size()); + std::vector dof_to_boundary_mapping; + std::set selected_boundary_components; + for (typename FunctionMap::type::const_iterator i=boundary_functions.begin(); + i!=boundary_functions.end(); ++i) + selected_boundary_components.insert (i->first); - template - void - project_boundary_values (const Mapping &mapping, - const DoFHandler &dof, - const typename FunctionMap::type &boundary_functions, - const Quadrature &q, - std::map &boundary_values, - std::vector component_mapping) - { -//TODO:[?] In project_boundary_values, no condensation of sparsity -// structures, matrices and right hand sides or distribution of -// solution vectors is performed. This is ok for dim<3 because then -// there are no constrained nodes on the boundary, but is not -// acceptable for higher dimensions. Fix this. + DoFTools::map_dof_to_boundary_indices (dof, selected_boundary_components, + dof_to_boundary_mapping); - if (component_mapping.size() == 0) - { - AssertDimension (dof.get_fe().n_components(), boundary_functions.begin()->second->n_components); - // I still do not see why i - // should create another copy - // here - component_mapping.resize(dof.get_fe().n_components()); - for (unsigned int i= 0 ; i < component_mapping.size() ; ++i) - component_mapping[i] = i; - } - else - AssertDimension (dof.get_fe().n_components(), component_mapping.size()); - - std::vector dof_to_boundary_mapping; - std::set selected_boundary_components; - for (typename FunctionMap::type::const_iterator i=boundary_functions.begin(); - i!=boundary_functions.end(); ++i) - selected_boundary_components.insert (i->first); - - DoFTools::map_dof_to_boundary_indices (dof, selected_boundary_components, - dof_to_boundary_mapping); - - // Done if no degrees of freedom on the boundary - if (dof.n_boundary_dofs (boundary_functions) == 0) - return; - - // set up sparsity structure - CompressedSparsityPattern c_sparsity(dof.n_boundary_dofs (boundary_functions), - dof.n_boundary_dofs (boundary_functions)); - DoFTools::make_boundary_sparsity_pattern (dof, - boundary_functions, - dof_to_boundary_mapping, - c_sparsity); - SparsityPattern sparsity; - sparsity.copy_from(c_sparsity); - - - - // note: for three or more dimensions, there - // may be constrained nodes on the boundary - // in this case the boundary mass matrix has - // to be condensed and the solution is to - // be distributed afterwards, which is not - // yet implemented. The reason for this is - // that we cannot simply use the condense - // family of functions, since the matrices - // and vectors do not use the global - // numbering but rather the boundary - // numbering, i.e. the condense function - // needs to use another indirection. There - // should be not many technical problems, - // but it needs to be implemented - if (dim>=3) - { -#ifdef DEBUG -// Assert that there are no hanging nodes at the boundary - int level = -1; - for (typename DoFHandler::active_cell_iterator cell = dof.begin_active(); - cell != dof.end(); ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) - { - if (cell->at_boundary(f)) - { - if (level == -1) - level = cell->level(); - else - { - Assert (level == cell->level(), ExcNotImplemented()); - } - } - } -#endif - } - sparsity.compress(); + // Done if no degrees of freedom on the boundary + if (dof.n_boundary_dofs (boundary_functions) == 0) + return; + + // set up sparsity structure + CompressedSparsityPattern c_sparsity(dof.n_boundary_dofs (boundary_functions), + dof.n_boundary_dofs (boundary_functions)); + DoFTools::make_boundary_sparsity_pattern (dof, + boundary_functions, + dof_to_boundary_mapping, + c_sparsity); + SparsityPattern sparsity; + sparsity.copy_from(c_sparsity); + + + + // note: for three or more dimensions, there + // may be constrained nodes on the boundary + // in this case the boundary mass matrix has + // to be condensed and the solution is to + // be distributed afterwards, which is not + // yet implemented. The reason for this is + // that we cannot simply use the condense + // family of functions, since the matrices + // and vectors do not use the global + // numbering but rather the boundary + // numbering, i.e. the condense function + // needs to use another indirection. There + // should be not many technical problems, + // but it needs to be implemented + if (dim>=3) + { + #ifdef DEBUG + // Assert that there are no hanging nodes at the boundary + int level = -1; + for (typename DH::active_cell_iterator cell = dof.begin_active(); + cell != dof.end(); ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + { + if (cell->at_boundary(f)) + { + if (level == -1) + level = cell->level(); + else + { + Assert (level == cell->level(), ExcNotImplemented()); + } + } + } + #endif + } + sparsity.compress(); - // make mass matrix and right hand side - SparseMatrix mass_matrix(sparsity); - Vector rhs(sparsity.n_rows()); + // make mass matrix and right hand side + SparseMatrix mass_matrix(sparsity); + Vector rhs(sparsity.n_rows()); - MatrixCreator::create_boundary_mass_matrix (mapping, dof, q, - mass_matrix, boundary_functions, - rhs, dof_to_boundary_mapping, (const Function *) 0, - component_mapping); + MatrixCreator::create_boundary_mass_matrix (mapping, dof, q, + mass_matrix, boundary_functions, + rhs, dof_to_boundary_mapping, (const Function *) 0, + component_mapping); - // For certain weird elements, - // there might be degrees of - // freedom on the boundary, but - // their shape functions do not - // have support there. Let's - // eliminate them here. + // For certain weird elements, + // there might be degrees of + // freedom on the boundary, but + // their shape functions do not + // have support there. Let's + // eliminate them here. - // The Bogner-Fox-Schmidt element - // is an example for those. + // The Bogner-Fox-Schmidt element + // is an example for those. //TODO: Maybe we should figure out if the element really needs this - FilteredMatrix > filtered_mass_matrix(mass_matrix, true); - FilteredMatrix > filtered_precondition; - std::vector excluded_dofs(mass_matrix.m(), false); + FilteredMatrix > filtered_mass_matrix(mass_matrix, true); + FilteredMatrix > filtered_precondition; + std::vector excluded_dofs(mass_matrix.m(), false); - double max_element = 0.; - for (unsigned int i=0; i max_element) - max_element = mass_matrix.diag_element(i); + double max_element = 0.; + for (unsigned int i=0; i max_element) + max_element = mass_matrix.diag_element(i); - for (unsigned int i=0; i boundary_projection (rhs.size()); - - // Allow for a maximum of 5*n - // steps to reduce the residual by - // 10^-12. n steps may not be - // sufficient, since roundoff - // errors may accumulate for badly - // conditioned matrices - ReductionControl control(5*rhs.size(), 0., 1.e-12, false, false); - GrowingVectorMemory<> memory; - SolverCG<> cg(control,memory); - - PreconditionSSOR<> prec; - prec.initialize(mass_matrix, 1.2); - filtered_precondition.initialize(prec, true); - // solve - cg.solve (filtered_mass_matrix, boundary_projection, rhs, filtered_precondition); - filtered_precondition.apply_constraints(boundary_projection, true); - filtered_precondition.clear(); - // fill in boundary values - for (unsigned int i=0; i::invalid_dof_index - && ! excluded_dofs[dof_to_boundary_mapping[i]]) - { - Assert(numbers::is_finite(boundary_projection(dof_to_boundary_mapping[i])), ExcNumberNotFinite()); + Vector boundary_projection (rhs.size()); + + // Allow for a maximum of 5*n + // steps to reduce the residual by + // 10^-12. n steps may not be + // sufficient, since roundoff + // errors may accumulate for badly + // conditioned matrices + ReductionControl control(5*rhs.size(), 0., 1.e-12, false, false); + GrowingVectorMemory<> memory; + SolverCG<> cg(control,memory); + + PreconditionSSOR<> prec; + prec.initialize(mass_matrix, 1.2); + filtered_precondition.initialize(prec, true); + // solve + cg.solve (filtered_mass_matrix, boundary_projection, rhs, filtered_precondition); + filtered_precondition.apply_constraints(boundary_projection, true); + filtered_precondition.clear(); + // fill in boundary values + for (unsigned int i=0; i::invalid_dof_index + && ! excluded_dofs[dof_to_boundary_mapping[i]]) + { + Assert(numbers::is_finite(boundary_projection(dof_to_boundary_mapping[i])), ExcNumberNotFinite()); - // this dof is on one of the - // interesting boundary parts - // - // remember: i is the global dof - // number, dof_to_boundary_mapping[i] - // is the number on the boundary and - // thus in the solution vector - boundary_values[i] = boundary_projection(dof_to_boundary_mapping[i]); - } + // this dof is on one of the + // interesting boundary parts + // + // remember: i is the global dof + // number, dof_to_boundary_mapping[i] + // is the number on the boundary and + // thus in the solution vector + boundary_values[i] = boundary_projection(dof_to_boundary_mapping[i]); + } + } + } + + template + void + project_boundary_values (const Mapping &mapping, + const DoFHandler &dof, + const typename FunctionMap::type &boundary_functions, + const Quadrature &q, + std::map &boundary_values, + std::vector component_mapping) + { + do_project_boundary_values(mapping, dof, boundary_functions, q, + boundary_values, component_mapping); } @@ -2283,7 +2282,37 @@ namespace VectorTools -// ----- implementation for project_boundary_values with ConstraintMatrix ----- + template + void project_boundary_values (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, + const typename FunctionMap::type &boundary_functions, + const hp::QCollection &q, + std::map &boundary_values, + std::vector component_mapping) + { + do_project_boundary_values (mapping, dof, + boundary_functions, + q, boundary_values, + component_mapping); + } + + + + template + void project_boundary_values (const hp::DoFHandler &dof, + const typename FunctionMap::type &boundary_function, + const hp::QCollection &q, + std::map &boundary_values, + std::vector component_mapping) + { + project_boundary_values (hp::StaticMappingQ1::mapping_collection, dof, + boundary_function, + q, boundary_values, + component_mapping); + } + + + // ----- implementation for project_boundary_values with ConstraintMatrix ----- @@ -2758,7 +2787,7 @@ namespace VectorTools std::vector &dof_values, std::vector &dofs_processed) { - const double tol = 0.5 * cell->get_fe ().degree * 1e-13 / cell->face (face)->line (line)->diameter (); + const double tol = 0.5 * cell->face (face)->line (line)->diameter () / cell->get_fe ().degree; const unsigned int dim = 3; const unsigned int spacedim = 3; @@ -2962,6 +2991,7 @@ namespace VectorTools { case 2: { + const double tol = 0.5 * cell->face (face)->diameter () / cell->get_fe ().degree; std::vector > tangentials (fe_values.n_quadrature_points); @@ -2995,18 +3025,18 @@ namespace VectorTools = reference_quadrature_points[q_point]; shifted_reference_point_1 (face_coordinate_direction[face]) - += 1e-13; + += tol; shifted_reference_point_2 (face_coordinate_direction[face]) - -= 1e-13; + -= tol; tangentials[q_point] - = 2e13 - * (fe_values.get_mapping () + = (fe_values.get_mapping () .transform_unit_to_real_cell (cell, shifted_reference_point_1) - fe_values.get_mapping () .transform_unit_to_real_cell (cell, - shifted_reference_point_2)); + shifted_reference_point_2)) + / tol; tangentials[q_point] /= std::sqrt (tangentials[q_point].square ()); // Compute the degrees @@ -3155,19 +3185,10 @@ namespace VectorTools } } - // Create the system - // matrix by - // multiplying the - // assembling matrix - // with its transposed - // and the right - // hand side vector - // by mutliplying - // the assembling - // matrix with the - // assembling vector. - // Invert the system - // matrix. + // Create the system matrix by multiplying the assembling matrix + // with its transposed and the right hand side vector by mutliplying + // the assembling matrix with the assembling vector. Invert the + // system matrix. assembling_matrix.mTmult (cell_matrix, assembling_matrix); cell_matrix_inv.invert (cell_matrix); assembling_matrix.vmult (cell_rhs, assembling_vector); @@ -3197,12 +3218,8 @@ namespace VectorTools } } - // Now we do the - // same as above - // with the vertical - // shape functions - // instead of the - // horizontal ones. + // Now we do the same as above with the vertical shape functions + // instead of the horizontal ones. for (unsigned int q_point = 0; q_point < fe_values.n_quadrature_points; ++q_point) { @@ -3307,32 +3324,18 @@ namespace VectorTools ConstraintMatrix &constraints, const Mapping &mapping) { - // Projection-based interpolation - // is performed in two (in 2D) - // respectively three (in 3D) - // steps. First the tangential - // component of the function is - // interpolated on each edge. This - // gives the values for the degrees - // of freedom corresponding to the - // edge shape functions. Now we are - // done for 2D, but in 3D we possibly - // have also degrees of freedom, which - // are located in the interior of - // the faces. Therefore we compute - // the residual of the function - // describing the boundary values - // and the interpolated part, which - // we have computed in the last - // step. On the faces there are - // two kinds of shape functions, - // the horizontal and the vertical - // ones. Thus we have to solve two - // linear systems of equations of - // size degree * (degree + - // 1) to obtain the values for - // the corresponding degrees of - // freedom. + // Projection-based interpolation is performed in two (in 2D) respectively + // three (in 3D) steps. First the tangential component of the function is + // interpolated on each edge. This gives the values for the degrees of + // freedom corresponding to the edge shape functions. Now we are done for + // 2D, but in 3D we possibly have also degrees of freedom, which are + // located in the interior of the faces. Therefore we compute the residual + // of the function describing the boundary values and the interpolated + // part, which we have computed in the last step. On the faces there are + // two kinds of shape functions, the horizontal and the vertical + // ones. Thus we have to solve two linear systems of equations of size + // degree * (degree + 1) to obtain the values for the + // corresponding degrees of freedom. const unsigned int superdegree = dof_handler.get_fe ().degree; const QGauss reference_face_quadrature (2 * superdegree); const unsigned int dofs_per_face = dof_handler.get_fe ().dofs_per_face; @@ -3410,15 +3413,13 @@ namespace VectorTools // if the degree of // freedom is not // already constrained. - const double tol = 0.5 * cell->get_fe ().degree * 1e-13 / cell->face (face)->diameter (); - for (unsigned int dof = 0; dof < dofs_per_face; ++dof) if (dofs_processed[dof] && constraints.can_store_line (face_dof_indices[dof]) && !(constraints.is_constrained (face_dof_indices[dof]))) { constraints.add_line (face_dof_indices[dof]); - if (std::abs (dof_values[dof]) > tol) + if (std::abs (dof_values[dof]) > 1e-13) constraints.set_inhomogeneity (face_dof_indices[dof], dof_values[dof]); } } @@ -3505,19 +3506,16 @@ namespace VectorTools // Store the computed // values in the global // vector. - cell->face (face)->get_dof_indices (face_dof_indices, cell->active_fe_index ()); - const double tol = 0.5 * superdegree * 1e-13 / cell->face (face)->diameter (); - for (unsigned int dof = 0; dof < dofs_per_face; ++dof) if (dofs_processed[dof] && constraints.can_store_line (face_dof_indices[dof]) && !(constraints.is_constrained (face_dof_indices[dof]))) { constraints.add_line (face_dof_indices[dof]); - if (std::abs (dof_values[dof]) > tol) + if (std::abs (dof_values[dof]) > 1e-13) constraints.set_inhomogeneity (face_dof_indices[dof], dof_values[dof]); } } @@ -3575,19 +3573,12 @@ namespace VectorTools for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; ++face) if (cell->face (face)->boundary_indicator () == boundary_component) { - // if the FE is a - // FE_Nothing object - // there is no work to - // do + // if the FE is a FE_Nothing object there is no work to do if (dynamic_cast*> (&cell->get_fe ()) != 0) return; - // This is only - // implemented, if the - // FE is a Nedelec - // element. If the FE is - // a FESystem we cannot - // check this. + // This is only implemented, if the FE is a Nedelec + // element. If the FE is a FESystem we cannot check this. if (dynamic_cast*> (&cell->get_fe ()) == 0) { typedef FiniteElement FEL; @@ -3616,15 +3607,13 @@ namespace VectorTools cell->face (face)->get_dof_indices (face_dof_indices, cell->active_fe_index ()); - const double tol = 0.5 * cell->get_fe ().degree * 1e-13 / cell->face (face)->diameter (); - for (unsigned int dof = 0; dof < dofs_per_face; ++dof) if (dofs_processed[dof] && constraints.can_store_line (face_dof_indices[dof]) && !(constraints.is_constrained (face_dof_indices[dof]))) { constraints.add_line (face_dof_indices[dof]); - if (std::abs (dof_values[dof]) > tol) + if (std::abs (dof_values[dof]) > 1e-13) constraints.set_inhomogeneity (face_dof_indices[dof], dof_values[dof]); } } @@ -3661,19 +3650,12 @@ namespace VectorTools for (unsigned int face = 0; face < GeometryInfo::faces_per_cell; ++face) if (cell->face (face)->boundary_indicator () == boundary_component) { - // if the FE is a - // FE_Nothing object - // there is no work to - // do + // if the FE is a FE_Nothing object there is no work to do if (dynamic_cast*> (&cell->get_fe ()) != 0) return; - // This is only - // implemented, if the - // FE is a Nedelec - // element. If the FE is - // a FESystem we cannot - // check this. + // This is only implemented, if the FE is a Nedelec + // element. If the FE is a FESystem we cannot check this. if (dynamic_cast*> (&cell->get_fe ()) == 0) { typedef FiniteElement FEL; @@ -3703,11 +3685,8 @@ namespace VectorTools first_vector_component, dof_values, dofs_processed); - // If there are higher - // order shape - // functions, there is - // still some work - // left. + // If there are higher order shape functions, there is still + // some work left. if (degree > 0) internals ::compute_face_projection_curl_conforming (cell, face, fe_face_values, @@ -3720,15 +3699,13 @@ namespace VectorTools cell->face (face)->get_dof_indices (face_dof_indices, cell->active_fe_index ()); - const double tol = 0.5 * superdegree * 1e-13 / cell->face (face)->diameter (); - for (unsigned int dof = 0; dof < dofs_per_face; ++dof) if (dofs_processed[dof] && constraints.can_store_line (face_dof_indices[dof]) && !(constraints.is_constrained (face_dof_indices[dof]))) { constraints.add_line (face_dof_indices[dof]); - if (std::abs (dof_values[dof]) > tol) + if (std::abs (dof_values[dof]) > 1e-13) constraints.set_inhomogeneity (face_dof_indices[dof], dof_values[dof]); } } @@ -3744,10 +3721,8 @@ namespace VectorTools namespace internals { - // This function computes the - // projection of the boundary - // function on the boundary - // in 2d. + // This function computes the projection of the boundary function on the + // boundary in 2d. template void compute_face_projection_div_conforming (const cell_iterator &cell, @@ -3758,13 +3733,9 @@ namespace VectorTools const std::vector > &jacobians, ConstraintMatrix &constraints) { - // Compute the intergral over - // the product of the normal - // components of the boundary - // function times the normal - // components of the shape - // functions supported on the - // boundary. + // Compute the intergral over the product of the normal components of + // the boundary function times the normal components of the shape + // functions supported on the boundary. const FEValuesExtractors::Vector vec (first_vector_component); const FiniteElement<2> &fe = cell->get_fe (); const std::vector > &normals = fe_values.get_normal_vectors (); @@ -3774,9 +3745,7 @@ namespace VectorTools values (fe_values.n_quadrature_points, Vector (2)); Vector dof_values (fe.dofs_per_face); - // Get the values of the - // boundary function at the - // quadrature points. + // Get the values of the boundary function at the quadrature points. { const std::vector > & quadrature_points = fe_values.get_quadrature_points (); @@ -3806,10 +3775,8 @@ namespace VectorTools cell->face (face)->get_dof_indices (face_dof_indices, cell->active_fe_index ()); - // Copy the computed values - // in the ConstraintMatrix only, - // if the degree of freedom is - // not already constrained. + // Copy the computed values in the ConstraintMatrix only, if the degree + // of freedom is not already constrained. for (unsigned int i = 0; i < fe.dofs_per_face; ++i) if (!(constraints.is_constrained (face_dof_indices[i]))) { @@ -3820,9 +3787,7 @@ namespace VectorTools } } - // dummy implementation of above - // function for all other - // dimensions + // dummy implementation of above function for all other dimensions template void compute_face_projection_div_conforming (const cell_iterator &, @@ -3836,10 +3801,8 @@ namespace VectorTools Assert (false, ExcNotImplemented ()); } - // This function computes the - // projection of the boundary - // function on the boundary - // in 3d. + // This function computes the projection of the boundary function on the + // boundary in 3d. template void compute_face_projection_div_conforming (const cell_iterator &cell, @@ -3851,13 +3814,9 @@ namespace VectorTools std::vector &dof_values, std::vector &projected_dofs) { - // Compute the intergral over - // the product of the normal - // components of the boundary - // function times the normal - // components of the shape - // functions supported on the - // boundary. + // Compute the intergral over the product of the normal components of + // the boundary function times the normal components of the shape + // functions supported on the boundary. const FEValuesExtractors::Vector vec (first_vector_component); const FiniteElement<3> &fe = cell->get_fe (); const std::vector > &normals = fe_values.get_normal_vectors (); @@ -4283,7 +4242,8 @@ namespace VectorTools hp::FEFaceValues x_fe_face_values (mapping_collection, fe_collection, face_quadrature_collection, - update_q_points); + update_q_points | + update_normal_vectors); // have a map that stores normal vectors for each vector-dof tuple we want // to constrain. since we can get at the same vector dof tuple more than @@ -4380,17 +4340,38 @@ namespace VectorTools // to check that they are small *relative to something // else*). we do this and then normalize the length of the // vector back to one, just to be on the safe side + // + // one more point: we would like to use the "real" normal + // vector here, as provided by the boundary description + // and as opposed to what we get from the FEValues object. + // we do this in the immediately next line, but as is + // obvious, the boundary only has a vague idea which side + // of a cell it is on -- indicated by the face number. in + // other words, it may provide the inner or outer normal. + // by and large, there is no harm from this, since the + // tangential vector we compute is still the same. however, + // we do average over normal vectors from adjacent cells + // and if they have recorded normal vectors from the inside + // once and from the outside the other time, then this + // averaging is going to run into trouble. as a consequence + // we ask the mapping after all for its normal vector, + // but we only ask it so that we can possibly correct the + // sign of the normal vector provided by the boundary + // if they should point in different directions. this is the + // case in tests/deal.II/no_flux_11. Point normal_vector = (cell->face(face_no)->get_boundary() .normal_vector (cell->face(face_no), fe_values.quadrature_point(i))); + if (normal_vector * fe_values.normal_vector(i) < 0) + normal_vector *= -1; Assert (std::fabs(normal_vector.norm() - 1) < 1e-14, ExcInternalError()); for (unsigned int d=0; d + struct PointComparator + { + bool operator ()(const std_cxx1x::array &p1, + const std_cxx1x::array &p2) + { + for (unsigned int d=0; d class DH, int spacedim> + void + compute_normal_flux_constraints (const DH&dof_handler, + const unsigned int first_vector_component, + const std::set &boundary_ids, + ConstraintMatrix &constraints, + const Mapping &mapping) + { + ConstraintMatrix no_normal_flux_constraints(constraints.get_local_lines()); + compute_no_normal_flux_constraints (dof_handler, + first_vector_component, + boundary_ids, + no_normal_flux_constraints, + mapping); + + // Extract a list that collects all vector components that belong to the + // same node (scalar basis function). When creating that list, we use an + // array of dim components that stores the global degree of freedom. + std::set, PointComparator > vector_dofs; + std::vector face_dofs; + + std::vector > cell_vector_dofs; + for (typename DH::active_cell_iterator cell = + dof_handler.begin_active(); cell != dof_handler.end(); ++cell) + if (!cell->is_artificial()) + for (unsigned int face_no=0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + if (boundary_ids.find(cell->face(face_no)->boundary_indicator()) + != boundary_ids.end()) + { + const FiniteElement &fe = cell->get_fe(); + typename DH::face_iterator face=cell->face(face_no); + + // get the indices of the dofs on this cell... + face_dofs.resize (fe.dofs_per_face); + face->get_dof_indices (face_dofs, cell->active_fe_index()); + + unsigned int n_scalar_indices = 0; + cell_vector_dofs.resize(fe.dofs_per_face); + for (unsigned int i=0; i= first_vector_component && + fe.face_system_to_component_index(i).first < first_vector_component + dim) + { + n_scalar_indices = + std::max(n_scalar_indices, + fe.face_system_to_component_index(i).second+1); + cell_vector_dofs[fe.face_system_to_component_index(i).second] + [fe.face_system_to_component_index(i).first-first_vector_component] + = face_dofs[i]; + } + + // now we identified the vector indices on the cell, so next + // insert them into the set (it would be expensive to directly + // insert incomplete points into the set) + for (unsigned int i=0; i, + PointComparator >::const_iterator it=vector_dofs.begin(); + it!=vector_dofs.end(); ++it) + { + unsigned int n_constraints = 0; + bool is_constrained[dim]; + for (unsigned int d=0; d 0) + { + // if more than one no-flux constraint is present, we need to + // constrain all vector degrees of freedom (we are in a corner + // where several faces meet and to get a continuous FE solution we + // need to set all conditions to zero). + if (n_constraints > 1) + { + for (unsigned int d=0; d normal; + unsigned constrained_index = -1; + for (unsigned int d=0; d >* constrained + = no_normal_flux_constraints.get_constraint_entries((*it)[constrained_index]); + // find components to which this index is constrained to + Assert(constrained != 0, ExcInternalError()); + Assert(constrained->size() < dim, ExcInternalError()); + for (unsigned int c=0; csize(); ++c) + { + int index = -1; + for (unsigned int d=0; d 1e-13) + constraints.add_entry(new_index, (*it)[constrained_index], + -normal[d]); + } + } + } + } + AssertDimension(n_total_constraints_found, + no_normal_flux_constraints.n_constraints()); + } + + + namespace internal { + template + struct IDScratchData + { + IDScratchData (const dealii::hp::MappingCollection &mapping, + const dealii::hp::FECollection &fe, + const dealii::hp::QCollection &q, + const UpdateFlags update_flags); + + IDScratchData (const IDScratchData &data); + + void resize_vectors (const unsigned int n_q_points, + const unsigned int n_components); + + std::vector > function_values; + std::vector > > function_grads; + std::vector weight_values; + std::vector > weight_vectors; + + std::vector > psi_values; + std::vector > > psi_grads; + std::vector psi_scalar; + + std::vector tmp_values; + std::vector > tmp_gradients; + + dealii::hp::FEValues x_fe_values; + }; + + + template + IDScratchData + ::IDScratchData(const dealii::hp::MappingCollection &mapping, + const dealii::hp::FECollection &fe, + const dealii::hp::QCollection &q, + const UpdateFlags update_flags) + : + x_fe_values(mapping, fe, q, update_flags) + {} + + template + IDScratchData::IDScratchData (const IDScratchData &data) + : + x_fe_values(data.x_fe_values.get_mapping_collection(), + data.x_fe_values.get_fe_collection(), + data.x_fe_values.get_quadrature_collection(), + data.x_fe_values.get_update_flags()) + {} + + template + void + IDScratchData::resize_vectors (const unsigned int n_q_points, + const unsigned int n_components) + { + function_values.resize (n_q_points, + dealii::Vector(n_components)); + function_grads.resize (n_q_points, + std::vector >(n_components)); + + weight_values.resize (n_q_points); + weight_vectors.resize (n_q_points, + dealii::Vector(n_components)); + + psi_values.resize (n_q_points, + dealii::Vector(n_components)); + psi_grads.resize (n_q_points, + std::vector >(n_components)); + psi_scalar.resize (n_q_points); + + tmp_values.resize (n_q_points); + tmp_gradients.resize (n_q_points); + } + + + // avoid compiling inner function for many vector types when we always + // really do the same thing by putting the main work into this helper + // function + template + double + integrate_difference_inner (const Function &exact_solution, + const NormType &norm, + const Function *weight, + const UpdateFlags update_flags, + const double exponent, + const unsigned int n_components, + IDScratchData &data) + { + const bool fe_is_system = (n_components != 1); + const dealii::FEValues &fe_values = data.x_fe_values.get_present_fe_values (); + const unsigned int n_q_points = fe_values.n_quadrature_points; + + if (weight!=0) + { + if (weight->n_components>1) + weight->vector_value_list (fe_values.get_quadrature_points(), + data.weight_vectors); + else + { + weight->value_list (fe_values.get_quadrature_points(), + data.weight_values); + for (unsigned int k=0; k static void - do_integrate_difference (const dealii::hp::MappingCollection &mapping, + do_integrate_difference (const dealii::hp::MappingCollection &mapping, const DH &dof, const InVector &fe_function, const Function &exact_solution, @@ -4698,17 +5120,12 @@ namespace VectorTools const Function *weight, const double exponent_1) { - // we mark the "exponent" parameter - // to this function "const" since - // it is strictly incoming, but we - // need to set it to something - // different later on, if - // necessary, so have a read-write - // version of it: + // we mark the "exponent" parameter to this function "const" since it is + // strictly incoming, but we need to set it to something different later + // on, if necessary, so have a read-write version of it: double exponent = exponent_1; const unsigned int n_components = dof.get_fe().n_components(); - const bool fe_is_system = (n_components != 1); if (weight!=0) { @@ -4755,32 +5172,7 @@ namespace VectorTools } dealii::hp::FECollection fe_collection (dof.get_fe()); - dealii::hp::FEValues x_fe_values(mapping, fe_collection, q, update_flags); - - const unsigned int max_n_q_points = q.max_n_quadrature_points (); - - std::vector< dealii::Vector > - function_values (max_n_q_points, dealii::Vector(n_components)); - std::vector > > - function_grads (max_n_q_points, std::vector >(n_components)); - - std::vector - weight_values (max_n_q_points); - std::vector > - weight_vectors (max_n_q_points, dealii::Vector(n_components)); - - std::vector > - psi_values (max_n_q_points, dealii::Vector(n_components)); - std::vector > > - psi_grads (max_n_q_points, std::vector >(n_components)); - std::vector - psi_scalar (max_n_q_points); - - // tmp vector when we use the - // Function functions for - // scalar functions - std::vector tmp_values (max_n_q_points); - std::vector > tmp_gradients (max_n_q_points); + IDScratchData data(mapping, fe_collection, q, update_flags); // loop over all cells typename DH::active_cell_iterator cell = dof.begin_active(), @@ -4788,285 +5180,26 @@ namespace VectorTools for (unsigned int index=0; cell != endc; ++cell, ++index) if (cell->is_locally_owned()) { - double diff=0; // initialize for this cell - x_fe_values.reinit (cell); + data.x_fe_values.reinit (cell); - const dealii::FEValues &fe_values = x_fe_values.get_present_fe_values (); + const dealii::FEValues &fe_values = data.x_fe_values.get_present_fe_values (); const unsigned int n_q_points = fe_values.n_quadrature_points; - - // resize all out scratch - // arrays to the number of - // quadrature points we use - // for the present cell - function_values.resize (n_q_points, - dealii::Vector(n_components)); - function_grads.resize (n_q_points, - std::vector >(n_components)); - - weight_values.resize (n_q_points); - weight_vectors.resize (n_q_points, - dealii::Vector(n_components)); - - psi_values.resize (n_q_points, - dealii::Vector(n_components)); - psi_grads.resize (n_q_points, - std::vector >(n_components)); - psi_scalar.resize (n_q_points); - - tmp_values.resize (n_q_points); - tmp_gradients.resize (n_q_points); - - if (weight!=0) - { - if (weight->n_components>1) - weight->vector_value_list (fe_values.get_quadrature_points(), - weight_vectors); - else - { - weight->value_list (fe_values.get_quadrature_points(), - weight_values); - for (unsigned int k=0; k::mapping_collection, + ::do_integrate_difference(hp::StaticMappingQ1::mapping_collection, dof, fe_function, exact_solution, difference, q, norm, weight, exponent); @@ -5192,6 +5325,8 @@ namespace VectorTools const std::pair::active_cell_iterator, Point > cell_point = GridTools::find_active_cell_around_point (mapping, dof, point); + AssertThrow(cell_point.first->is_locally_owned(), + ExcPointNotAvailableHere()); Assert(GeometryInfo::distance_to_unit_cell(cell_point.second) < 1e-10, ExcInternalError()); @@ -5292,6 +5427,8 @@ namespace VectorTools cell_point = GridTools::find_active_cell_around_point (mapping, dof, point); + AssertThrow(cell_point.first->is_locally_owned(), + ExcPointNotAvailableHere()); Assert(GeometryInfo::distance_to_unit_cell(cell_point.second) < 1e-10, ExcInternalError()); @@ -5329,6 +5466,8 @@ namespace VectorTools const std::pair::active_cell_iterator, Point > cell_point = GridTools::find_active_cell_around_point (mapping, dof, point); + AssertThrow(cell_point.first->is_locally_owned(), + ExcPointNotAvailableHere()); Assert(GeometryInfo::distance_to_unit_cell(cell_point.second) < 1e-10, ExcInternalError()); @@ -5365,6 +5504,8 @@ namespace VectorTools const std::pair::active_cell_iterator, Point > cell_point = GridTools::find_active_cell_around_point (mapping, dof, point); + AssertThrow(cell_point.first->is_locally_owned(), + ExcPointNotAvailableHere()); Assert(GeometryInfo::distance_to_unit_cell(cell_point.second) < 1e-10, ExcInternalError()); @@ -5400,6 +5541,8 @@ namespace VectorTools const std::pair::active_cell_iterator, Point > cell_point = GridTools::find_active_cell_around_point (mapping, dof, point); + AssertThrow(cell_point.first->is_locally_owned(), + ExcPointNotAvailableHere()); Assert(GeometryInfo::distance_to_unit_cell(cell_point.second) < 1e-10, ExcInternalError()); @@ -5424,7 +5567,7 @@ namespace VectorTools subtract_mean_value(VECTOR &v, const std::vector &p_select) { - if(p_select.size() == 0) + if (p_select.size() == 0) { // In case of an empty boolean mask operate on the whole vector: v.add( - v.mean_value() ); @@ -5434,12 +5577,12 @@ namespace VectorTools // This function is not implemented for distributed vectors, so // if v is not a boring Vector or BlockVector: Assert( dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v) - || dynamic_cast *>(& v), - ExcNotImplemented()); + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v) + || dynamic_cast *>(& v), + ExcNotImplemented()); const unsigned int n = v.size(); @@ -5456,7 +5599,7 @@ namespace VectorTools } // Error out if we have not constrained anything. Note that in this // case the vector v is always nonempty. - Assert (n == 0 || counter > 0, ExcNoComponentSelected()); + Assert (n == 0 || counter > 0, ComponentMask::ExcNoComponentSelected()); s /= counter; diff --git a/deal.II/source/CMakeLists.txt b/deal.II/source/CMakeLists.txt index 3118888674..5b21083aac 100644 --- a/deal.II/source/CMakeLists.txt +++ b/deal.II/source/CMakeLists.txt @@ -1,16 +1,18 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- # # Compile the deal.II library @@ -48,6 +50,8 @@ ADD_SUBDIRECTORY(matrix_free) ADD_SUBDIRECTORY(meshworker) +ADD_CUSTOM_TARGET(library) + FOREACH(build ${DEAL_II_BUILD_TYPES}) STRING(TOLOWER ${build} build_lowercase) @@ -59,10 +63,12 @@ FOREACH(build ${DEAL_II_BUILD_TYPES}) deal_ii_objects_${build_lowercase} ) ADD_LIBRARY(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} - base/dummy.cc # Workaround for a bug in the Xcode generator + dummy.cc # Workaround for a bug in the Xcode generator ${deal_ii_objects_${build_lowercase}} ) + ADD_DEPENDENCIES(library ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}) + SET_TARGET_PROPERTIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} PROPERTIES VERSION "${DEAL_II_PACKAGE_VERSION}" @@ -72,15 +78,26 @@ FOREACH(build ${DEAL_II_BUILD_TYPES}) # a C++ library is still ABI backwards compatible :-] # SOVERSION "${DEAL_II_PACKAGE_VERSION}" - LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${build}}" + LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}" COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${build}}" COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${build}}" INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${DEAL_II_LIBRARY_RELDIR}" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ) TARGET_LINK_LIBRARIES(${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} - ${DEAL_II_EXTERNAL_LIBRARIES} ${DEAL_II_EXTERNAL_LIBRARIES_${build}} + ${DEAL_II_EXTERNAL_LIBRARIES} + ) + + FILE(MAKE_DIRECTORY + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR} + ) + EXPORT(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} + FILE ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}BuildTargets.cmake + APPEND ) INSTALL(TARGETS ${DEAL_II_BASE_NAME}${DEAL_II_${build}_SUFFIX} diff --git a/deal.II/source/algorithms/CMakeLists.txt b/deal.II/source/algorithms/CMakeLists.txt index 3a382d7c8f..b9a7e70f1b 100644 --- a/deal.II/source/algorithms/CMakeLists.txt +++ b/deal.II/source/algorithms/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/algorithms/*.h - ) - SET(_src operator.cc timestep_control.cc @@ -27,5 +25,9 @@ SET(_inst operator.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/algorithms/*.h + ) + DEAL_II_ADD_LIBRARY(obj_algorithms OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_algorithms "${_inst}") diff --git a/deal.II/source/algorithms/operator.cc b/deal.II/source/algorithms/operator.cc index 98e702f374..8f0bcc0516 100644 --- a/deal.II/source/algorithms/operator.cc +++ b/deal.II/source/algorithms/operator.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/algorithms/operator.inst.in b/deal.II/source/algorithms/operator.inst.in index ba4fbd847f..f3aa5de504 100644 --- a/deal.II/source/algorithms/operator.inst.in +++ b/deal.II/source/algorithms/operator.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (VEC : SERIAL_VECTORS) { diff --git a/deal.II/source/algorithms/timestep_control.cc b/deal.II/source/algorithms/timestep_control.cc index fd608c5be2..1ae7739d30 100644 --- a/deal.II/source/algorithms/timestep_control.cc +++ b/deal.II/source/algorithms/timestep_control.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2010, 2012 by Guido Kanschat +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/CMakeLists.txt b/deal.II/source/base/CMakeLists.txt index 5269d6c64e..892456ad89 100644 --- a/deal.II/source/base/CMakeLists.txt +++ b/deal.II/source/base/CMakeLists.txt @@ -1,30 +1,27 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/base/*.h - ) - SET(_src auto_derivative_function.cc conditional_ostream.cc config.cc convergence_table.cc data_out_base.cc - # do NOT include dummy.cc event.cc exceptions.cc flow_function.cc @@ -51,9 +48,9 @@ SET(_src polynomials_adini.cc polynomials_bdm.cc polynomials_nedelec.cc - polynomials_piecewise.cc polynomial_space.cc polynomials_p.cc + polynomials_piecewise.cc polynomials_raviart_thomas.cc quadrature.cc quadrature_lib.cc @@ -69,7 +66,10 @@ SET(_src utilities.cc ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/base/*.h + ) + DEAL_II_ADD_LIBRARY(obj_base OBJECT ${_src} ${_header} ${CMAKE_BINARY_DIR}/include/deal.II/base/config.h ) - diff --git a/deal.II/source/base/auto_derivative_function.cc b/deal.II/source/base/auto_derivative_function.cc index 98717ccb0a..9c404d76e9 100644 --- a/deal.II/source/base/auto_derivative_function.cc +++ b/deal.II/source/base/auto_derivative_function.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/conditional_ostream.cc b/deal.II/source/base/conditional_ostream.cc index da238cdf2c..29e3122f06 100644 --- a/deal.II/source/base/conditional_ostream.cc +++ b/deal.II/source/base/conditional_ostream.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/base/config.cc b/deal.II/source/base/config.cc index 89aa9ab290..c5c00671d5 100644 --- a/deal.II/source/base/config.cc +++ b/deal.II/source/base/config.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/convergence_table.cc b/deal.II/source/base/convergence_table.cc index df3555ff05..1a33363822 100644 --- a/deal.II/source/base/convergence_table.cc +++ b/deal.II/source/base/convergence_table.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -67,7 +69,7 @@ void ConvergenceTable::evaluate_convergence_rates(const std::string &data_column // Calculate all missing rate values: for (unsigned int i = no_rate_entries; i +void DataOutBase::DataOutFilter::write_point(const unsigned int &index, const Point &p) +{ + Map3DPoint::const_iterator it; + unsigned int internal_ind; + Point<3> int_pt; + + for (int d=0; d<3; ++d) int_pt(d) = (d < dim ? p(d) : 0); + node_dim = dim; + it = existing_points.find(int_pt); + + // If the point isn't in the set, or we're not filtering duplicate points, add it + if (it == existing_points.end() || !flags.filter_duplicate_vertices) + { + internal_ind = existing_points.size(); + existing_points.insert(std::make_pair(int_pt, internal_ind)); + } + else + { + internal_ind = it->second; + } + // Now add the index to the list of filtered points + filtered_points[index] = internal_ind; +} + +void DataOutBase::DataOutFilter::internal_add_cell(const unsigned int &cell_index, const unsigned int &pt_index) +{ + filtered_cells[cell_index] = filtered_points[pt_index]; +} + +void DataOutBase::DataOutFilter::fill_node_data(std::vector &node_data) const +{ + Map3DPoint::const_iterator it; + + node_data.resize(existing_points.size()*node_dim); + + for (it=existing_points.begin(); it!=existing_points.end(); ++it) + { + for (int d=0; dsecond+d] = it->first(d); + } +} + +void DataOutBase::DataOutFilter::fill_cell_data(const unsigned int &local_node_offset, std::vector &cell_data) const +{ + std::map::const_iterator it; + + cell_data.resize(filtered_cells.size()); + + for (it=filtered_cells.begin(); it!=filtered_cells.end(); ++it) + { + cell_data[it->first] = it->second+local_node_offset; + } +} + +template +void +DataOutBase::DataOutFilter::write_cell( + unsigned int index, + unsigned int start, + unsigned int d1, + unsigned int d2, + unsigned int d3) +{ + unsigned int base_entry = index * GeometryInfo::vertices_per_cell; + n_cell_verts = GeometryInfo::vertices_per_cell; + internal_add_cell(base_entry+0, start); + internal_add_cell(base_entry+1, start+d1); + if (dim>=2) + { + internal_add_cell(base_entry+2, start+d2+d1); + internal_add_cell(base_entry+3, start+d2); + if (dim>=3) + { + internal_add_cell(base_entry+4, start+d3); + internal_add_cell(base_entry+5, start+d3+d1); + internal_add_cell(base_entry+6, start+d3+d2+d1); + internal_add_cell(base_entry+7, start+d3+d2); + } + } +} + +void DataOutBase::DataOutFilter::write_data_set(const std::string &name, const unsigned int &dimension, const unsigned int &set_num, const Table<2,double> &data_vectors) +{ + unsigned int num_verts = existing_points.size(); + unsigned int i, r, d, new_dim; + + // HDF5/XDMF output only supports 1D or 3D output, so force rearrangement if needed + if (flags.xdmf_hdf5_output && dimension != 1) new_dim = 3; + else new_dim = dimension; + + // Record the data set name, dimension, and allocate space for it + data_set_names.push_back(name); + data_set_dims.push_back(new_dim); + data_sets.push_back(std::vector(new_dim*num_verts)); + + // TODO: averaging, min/max, etc for merged vertices + for (i=0; i in general + // Wolfgang supposed that we don't need it in general, but however this + // choice avoids a -Warray-bounds check warning + static unsigned int vtk_cell_type[5] = { - 0, 3, 9, 12 + 0, 3, 9, 12, static_cast(-1) }; //----------------------------------------------------------------------// @@ -392,10 +510,6 @@ namespace } } - - - - /** * Class for writing basic * entities in @ref @@ -971,81 +1085,6 @@ namespace }; - class HDF5MemStream - { - public: - /** - * Constructor, storing - * persistent values for - * later use. - */ - HDF5MemStream (const unsigned int local_points_cell_count[2], const unsigned int global_points_cell_offsets[2], const unsigned int dim); - - /** - * Output operator for points. - */ - template - void write_point (const unsigned int index, - const Point &); - - /** - * Do whatever is necessary to - * terminate the list of points. - * In this case, nothing. - */ - void flush_points () {}; - - /** - * Write dim-dimensional cell - * with first vertex at - * number start and further - * vertices offset by the - * specified values. Values - * not needed are ignored. - * - * The order of vertices for - * these cells in different - * dimensions is - *
      - *
    1. [0,1] - *
    2. [] - *
    3. [] - *
    - */ - template - void write_cell(const unsigned int index, - const unsigned int start, - const unsigned int x_offset, - const unsigned int y_offset, - const unsigned int z_offset); - - /** - * Do whatever is necessary to - * terminate the list of cells. - * In this case, nothing. - */ - void flush_cells () {}; - - const double *node_data(void) const - { - return &vertices[0]; - }; - const unsigned int *cell_data(void) const - { - return &cells[0]; - }; - - private: - /** - * A list of vertices and - * cells, used to write HDF5 data. - */ - std::vector vertices; - std::vector cells; - unsigned int cell_offset; - }; - - //----------------------------------------------------------------------// DXStream::DXStream(std::ostream &out, @@ -1542,49 +1581,6 @@ namespace return stream; } - HDF5MemStream::HDF5MemStream(const unsigned int local_points_cell_count[2], const unsigned int global_points_cell_offsets[2], const unsigned int dim) - { - unsigned int entries_per_cell = (2 << (dim-1)); - - vertices.resize(local_points_cell_count[0]*dim); - cells.resize(local_points_cell_count[1]*entries_per_cell); - cell_offset = global_points_cell_offsets[1]*entries_per_cell; - } - - template - void - HDF5MemStream::write_point (const unsigned int index, - const Point &p) - { - for (int i=0; i - void - HDF5MemStream::write_cell( - unsigned int index, - unsigned int start, - unsigned int d1, - unsigned int d2, - unsigned int d3) - { - unsigned int base_entry = index * GeometryInfo::vertices_per_cell; - cells[base_entry+0] = cell_offset+start; - cells[base_entry+1] = cell_offset+start+d1; - if (dim>=2) - { - cells[base_entry+2] = cell_offset+start+d2+d1; - cells[base_entry+3] = cell_offset+start+d2; - if (dim>=3) - { - cells[base_entry+4] = cell_offset+start+d3; - cells[base_entry+5] = cell_offset+start+d3+d1; - cells[base_entry+6] = cell_offset+start+d3+d2+d1; - cells[base_entry+7] = cell_offset+start+d3+d2; - } - } - } - template std::ostream & DXStream::operator<< (const T &t) @@ -1726,6 +1722,41 @@ DataOutBase::PovrayFlags::PovrayFlags (const bool smooth, {} +DataOutBase::DataOutFilterFlags::DataOutFilterFlags (const bool filter_duplicate_vertices, + const bool xdmf_hdf5_output) : + filter_duplicate_vertices(filter_duplicate_vertices), + xdmf_hdf5_output(xdmf_hdf5_output) {} + +void DataOutBase::DataOutFilterFlags::declare_parameters (ParameterHandler &prm) +{ + prm.declare_entry ("Filter duplicate vertices", "false", + Patterns::Bool(), + "Whether to remove duplicate vertex values."); + prm.declare_entry ("XDMF HDF5 output", "false", + Patterns::Bool(), + "Whether the data will be used in an XDMF/HDF5 combination."); +} + + + +void DataOutBase::DataOutFilterFlags::parse_parameters (const ParameterHandler &prm) +{ + filter_duplicate_vertices = prm.get_bool ("Filter duplicate vertices"); + xdmf_hdf5_output = prm.get_bool ("XDMF HDF5 output"); +} + + + +std::size_t +DataOutBase::DataOutFilterFlags::memory_consumption () const +{ + // only simple data elements, so + // use sizeof operator + return sizeof (*this); +} + + + DataOutBase::DXFlags::DXFlags (const bool write_neighbors, const bool int_binary, const bool coordinates_binary, @@ -2186,10 +2217,12 @@ DataOutBase::TecplotFlags::memory_consumption () const DataOutBase::VtkFlags::VtkFlags (const double time, - const unsigned int cycle) + const unsigned int cycle, + const bool print_date_and_time) : time (time), - cycle (cycle) + cycle (cycle), + print_date_and_time (print_date_and_time) {} @@ -2214,17 +2247,20 @@ DataOutBase::VtkFlags::memory_consumption () const DataOutBase::SvgFlags::SvgFlags (const unsigned int height_vector, - const int azimuth_angle, + const int azimuth_angle, const int polar_angle, const unsigned int line_thickness, const bool margin, - const bool draw_colorbar) : -height_vector(height_vector), -azimuth_angle(azimuth_angle), -polar_angle(polar_angle), -line_thickness(line_thickness), -margin(margin), -draw_colorbar(draw_colorbar) + const bool draw_colorbar) + : + height(4000), + width(0), + height_vector(height_vector), + azimuth_angle(azimuth_angle), + polar_angle(polar_angle), + line_thickness(line_thickness), + margin(margin), + draw_colorbar(draw_colorbar) {} @@ -2537,17 +2573,17 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) int i, j; for (i = 0; i < 2; ++i) - { - for (j = 0; j < 2-i; ++j) { - if (points[j][2] > points[j + 1][2]) - { - Point<3> temp = points[j]; - points[j] = points[j+1]; - points[j+1] = temp; - } + for (j = 0; j < 2-i; ++j) + { + if (points[j][2] > points[j + 1][2]) + { + Point<3> temp = points[j]; + points[j] = points[j+1]; + points[j+1] = temp; + } + } } - } // save the related three-dimensional vectors v_min, v_inter, and v_max v_min = points[0]; @@ -2570,47 +2606,47 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) bool col_change = false; if (A[0][0] == 0) - { - col_change = true; + { + col_change = true; - A[0][0] = A[0][1]; - A[0][1] = 0; + A[0][0] = A[0][1]; + A[0][1] = 0; - double temp = A[1][0]; - A[1][0] = A[1][1]; - A[1][1] = temp; - } + double temp = A[1][0]; + A[1][0] = A[1][1]; + A[1][1] = temp; + } - for (unsigned int k = 0; k < 1; k++) - { - for (unsigned int i = k+1; i < 2; i++) + for (unsigned int k = 0; k < 1; k++) { - x = A[i][k] / A[k][k]; + for (unsigned int i = k+1; i < 2; i++) + { + x = A[i][k] / A[k][k]; - for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; + for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; - b[i] = b[i] - b[k]*x; + b[i] = b[i] - b[k]*x; + } } - } b[1] = b[1] / A[1][1]; - for (int i = 0; i >= 0; i--) - { - sum = b[i]; + for (int i = 0; i >= 0; i--) + { + sum = b[i]; - for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; + for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; - b[i] = sum / A[i][i]; - } + b[i] = sum / A[i][i]; + } if (col_change) - { - double temp = b[0]; - b[0] = b[1]; - b[1] = temp; - } + { + double temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } double c = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) + v_min[2]; @@ -2626,47 +2662,47 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) col_change = false; if (A[0][0] == 0) - { - col_change = true; + { + col_change = true; - A[0][0] = A[0][1]; - A[0][1] = 0; + A[0][0] = A[0][1]; + A[0][1] = 0; - double temp = A[1][0]; - A[1][0] = A[1][1]; - A[1][1] = temp; - } + double temp = A[1][0]; + A[1][0] = A[1][1]; + A[1][1] = temp; + } - for (unsigned int k = 0; k < 1; k++) - { - for (unsigned int i = k+1; i < 2; i++) + for (unsigned int k = 0; k < 1; k++) { - x = A[i][k] / A[k][k]; + for (unsigned int i = k+1; i < 2; i++) + { + x = A[i][k] / A[k][k]; - for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; + for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; - b[i] = b[i] - b[k] * x; + b[i] = b[i] - b[k] * x; + } } - } b[1]=b[1] / A[1][1]; - for (int i = 0; i >= 0; i--) - { - sum = b[i]; + for (int i = 0; i >= 0; i--) + { + sum = b[i]; - for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j]*b[j]; + for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j]*b[j]; - b[i] = sum / A[i][i]; - } + b[i] = sum / A[i][i]; + } if (col_change) - { - double temp = b[0]; - b[0] = b[1]; - b[1] = temp; - } + { + double temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } gradient[0] = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) - c + v_min[2]; @@ -2682,46 +2718,46 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) col_change = false; if (A[0][0] == 0) - { - col_change = true; + { + col_change = true; - A[0][0] = A[0][1]; - A[0][1] = 0; + A[0][0] = A[0][1]; + A[0][1] = 0; - double temp = A[1][0]; - A[1][0] = A[1][1]; - A[1][1] = temp; - } + double temp = A[1][0]; + A[1][0] = A[1][1]; + A[1][1] = temp; + } - for (unsigned int k = 0; k < 1; k++) - { - for (unsigned int i = k+1; i < 2; i++) + for (unsigned int k = 0; k < 1; k++) { - x = A[i][k] / A[k][k]; + for (unsigned int i = k+1; i < 2; i++) + { + x = A[i][k] / A[k][k]; - for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; + for (unsigned int j = k+1; j < 2; j++) A[i][j] = A[i][j] - A[k][j] * x; - b[i] = b[i] - b[k] * x; + b[i] = b[i] - b[k] * x; + } } - } b[1] = b[1] / A[1][1]; - for (int i = 0; i >= 0; i--) - { - sum = b[i]; + for (int i = 0; i >= 0; i--) + { + sum = b[i]; - for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; + for (unsigned int j = i+1; j < 2; j++) sum = sum - A[i][j] * b[j]; - b[i] = sum / A[i][i]; - } + b[i] = sum / A[i][i]; + } if (col_change) - { - double temp = b[0]; - b[0] = b[1]; - b[1] = temp; - } + { + double temp = b[0]; + b[0] = b[1]; + b[1] = temp; + } gradient[1] = b[0] * (v_max[2] - v_min[2]) + b[1] * (v_inter[2] - v_min[2]) - c + v_min[2]; @@ -2736,7 +2772,7 @@ Point<6> DataOutBase::svg_get_gradient_parameters(Point<3> points[]) gradient_parameters[0] = v_min[0]; gradient_parameters[1] = v_min[1]; - + gradient_parameters[2] = v_min[0] + lambda * gradient[0]; gradient_parameters[3] = v_min[1] + lambda * gradient[1]; @@ -4937,14 +4973,18 @@ DataOutBase::write_vtk (const std::vector > &patches, std::tm *time = std::localtime(&time1); out << "# vtk DataFile Version 3.0" << '\n' - << "#This file was generated by the deal.II library on " - << time->tm_year+1900 << "/" - << time->tm_mon+1 << "/" - << time->tm_mday << " at " - << time->tm_hour << ":" - << std::setw(2) << time->tm_min << ":" - << std::setw(2) << time->tm_sec - << '\n' + << "#This file was generated by the deal.II library"; + if (flags.print_date_and_time) + out << " on " + << time->tm_year+1900 << "/" + << time->tm_mon+1 << "/" + << time->tm_mday << " at " + << time->tm_hour << ":" + << std::setw(2) << time->tm_min << ":" + << std::setw(2) << time->tm_sec; + else + out << "."; + out << '\n' << "ASCII" << '\n'; // now output the data header @@ -5154,7 +5194,8 @@ DataOutBase::write_vtk (const std::vector > &patches, } -void DataOutBase::write_vtu_header (std::ostream &out) +void DataOutBase::write_vtu_header (std::ostream &out, + const VtkFlags &flags) { AssertThrow (out, ExcIO()); std::time_t time1= std::time (0); @@ -5163,15 +5204,18 @@ void DataOutBase::write_vtu_header (std::ostream &out) out << "\n"; - + << "#This file was generated by the deal.II library"; + if (flags.print_date_and_time) + out << " on " + << time->tm_year+1900 << "/" + << time->tm_mon+1 << "/" + << time->tm_mday << " at " + << time->tm_hour << ":" + << std::setw(2) << time->tm_min << ":" + << std::setw(2) << time->tm_sec; + else + out << "."; + out << "\n-->\n"; out << " > &patches, const VtkFlags &flags, std::ostream &out) { - write_vtu_header(out); + write_vtu_header(out, flags); write_vtu_main (patches, data_names, vector_data_ranges, flags, out); write_vtu_footer(out); @@ -5325,7 +5369,7 @@ void DataOutBase::write_vtu_main (const std::vector > &patch if (n_metadata > 0) out << "\n"; -} + } VtuStream vtu_out(out, flags); @@ -5593,12 +5637,12 @@ void DataOutBase::write_svg (const std::vector > &patches, // do not allow volume rendering AssertThrow (dim==2, ExcNotImplemented()); - const unsigned int height = 4000; - unsigned int width; + const unsigned int height = flags.height; + unsigned int width = flags.width; // margin around the plotted area unsigned int margin_in_percent = 0; - if(flags.margin) margin_in_percent = 5; + if (flags.margin) margin_in_percent = 5; // determine the bounding box in the model space @@ -5619,8 +5663,8 @@ void DataOutBase::write_svg (const std::vector > &patches, Point<2> projection_decomposition; Point<2> projection_decompositions[4]; - compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); - + compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); + Assert ((flags.height_vector < patch->data.n_rows()) || patch->data.n_rows() == 0, ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); @@ -5634,55 +5678,55 @@ void DataOutBase::write_svg (const std::vector > &patches, // iterate over the patches for (; patch != patches.end(); ++patch) - { - n_subdivisions = patch->n_subdivisions; - n = n_subdivisions + 1; - - for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) - { - for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) - { - compute_node(projected_points[0], &*patch, i1, i2, 0, n_subdivisions); - compute_node(projected_points[1], &*patch, i1+1, i2, 0, n_subdivisions); - compute_node(projected_points[2], &*patch, i1, i2+1, 0, n_subdivisions); - compute_node(projected_points[3], &*patch, i1+1, i2+1, 0, n_subdivisions); - - x_min = std::min(x_min, (double)projected_points[0][0]); - x_min = std::min(x_min, (double)projected_points[1][0]); - x_min = std::min(x_min, (double)projected_points[2][0]); - x_min = std::min(x_min, (double)projected_points[3][0]); - - x_max = std::max(x_max, (double)projected_points[0][0]); - x_max = std::max(x_max, (double)projected_points[1][0]); - x_max = std::max(x_max, (double)projected_points[2][0]); - x_max = std::max(x_max, (double)projected_points[3][0]); - - y_min = std::min(y_min, (double)projected_points[0][1]); - y_min = std::min(y_min, (double)projected_points[1][1]); - y_min = std::min(y_min, (double)projected_points[2][1]); - y_min = std::min(y_min, (double)projected_points[3][1]); - - y_max = std::max(y_max, (double)projected_points[0][1]); - y_max = std::max(y_max, (double)projected_points[1][1]); - y_max = std::max(y_max, (double)projected_points[2][1]); - y_max = std::max(y_max, (double)projected_points[3][1]); - - Assert ((flags.height_vector < patch->data.n_rows()) || - patch->data.n_rows() == 0, - ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); - - z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); - z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); - z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); - z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); - - z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); - z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); - z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); - z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); - } - } - } + { + n_subdivisions = patch->n_subdivisions; + n = n_subdivisions + 1; + + for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) + { + for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) + { + compute_node(projected_points[0], &*patch, i1, i2, 0, n_subdivisions); + compute_node(projected_points[1], &*patch, i1+1, i2, 0, n_subdivisions); + compute_node(projected_points[2], &*patch, i1, i2+1, 0, n_subdivisions); + compute_node(projected_points[3], &*patch, i1+1, i2+1, 0, n_subdivisions); + + x_min = std::min(x_min, (double)projected_points[0][0]); + x_min = std::min(x_min, (double)projected_points[1][0]); + x_min = std::min(x_min, (double)projected_points[2][0]); + x_min = std::min(x_min, (double)projected_points[3][0]); + + x_max = std::max(x_max, (double)projected_points[0][0]); + x_max = std::max(x_max, (double)projected_points[1][0]); + x_max = std::max(x_max, (double)projected_points[2][0]); + x_max = std::max(x_max, (double)projected_points[3][0]); + + y_min = std::min(y_min, (double)projected_points[0][1]); + y_min = std::min(y_min, (double)projected_points[1][1]); + y_min = std::min(y_min, (double)projected_points[2][1]); + y_min = std::min(y_min, (double)projected_points[3][1]); + + y_max = std::max(y_max, (double)projected_points[0][1]); + y_max = std::max(y_max, (double)projected_points[1][1]); + y_max = std::max(y_max, (double)projected_points[2][1]); + y_max = std::max(y_max, (double)projected_points[3][1]); + + Assert ((flags.height_vector < patch->data.n_rows()) || + patch->data.n_rows() == 0, + ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); + + z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); + z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); + z_min = std::min(z_min, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); + z_min = std::min(z_min, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); + + z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + i2*d2)); + z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + i2*d2)); + z_max = std::max(z_max, (double)patch->data(flags.height_vector, i1*d1 + (i2+1)*d2)); + z_max = std::max(z_max, (double)patch->data(flags.height_vector, (i1+1)*d1 + (i2+1)*d2)); + } + } + } x_dimension = x_max - x_min; y_dimension = y_max - y_min; @@ -5762,7 +5806,7 @@ void DataOutBase::write_svg (const std::vector > &patches, camera_position[1] -= (z_min + 2. * z_dimension) * sin(angle_factor * flags.polar_angle) * cos(angle_factor * flags.azimuth_angle); -// determine the bounding box on the projection plane +// determine the bounding box on the projection plane double x_min_perspective, y_min_perspective; double x_max_perspective, y_max_perspective; double x_dimension_perspective, y_dimension_perspective; @@ -5774,8 +5818,8 @@ void DataOutBase::write_svg (const std::vector > &patches, Point<3> point(true); - compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); - + compute_node(projected_point, &*patch, 0, 0, 0, n_subdivisions); + Assert ((flags.height_vector < patch->data.n_rows()) || patch->data.n_rows() == 0, ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); @@ -5793,69 +5837,69 @@ void DataOutBase::write_svg (const std::vector > &patches, // iterate over the patches for (; patch != patches.end(); ++patch) - { - n_subdivisions = patch->n_subdivisions; - n = n_subdivisions + 1; + { + n_subdivisions = patch->n_subdivisions; + n = n_subdivisions + 1; - for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) - { - for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) - { - Point projected_vertices[4]; - Point<3> vertices[4]; - - compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); - compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); - compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); - compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); - - Assert ((flags.height_vector < patch->data.n_rows()) || - patch->data.n_rows() == 0, - ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); - - vertices[0][0] = projected_vertices[0][0]; - vertices[0][1] = projected_vertices[0][1]; - vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; - - vertices[1][0] = projected_vertices[1][0]; - vertices[1][1] = projected_vertices[1][1]; - vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; - - vertices[2][0] = projected_vertices[2][0]; - vertices[2][1] = projected_vertices[2][1]; - vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; - - vertices[3][0] = projected_vertices[3][0]; - vertices[3][1] = projected_vertices[3][1]; - vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; - - projection_decompositions[0] = svg_project_point(vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); - projection_decompositions[1] = svg_project_point(vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); - projection_decompositions[2] = svg_project_point(vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); - projection_decompositions[3] = svg_project_point(vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); - - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[0][0]); - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[1][0]); - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[2][0]); - x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[3][0]); - - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[0][0]); - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[1][0]); - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[2][0]); - x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[3][0]); - - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[0][1]); - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[1][1]); - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[2][1]); - y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[3][1]); - - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[0][1]); - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[1][1]); - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[2][1]); - y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[3][1]); - } + for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) + { + for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) + { + Point projected_vertices[4]; + Point<3> vertices[4]; + + compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); + compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); + compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); + compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); + + Assert ((flags.height_vector < patch->data.n_rows()) || + patch->data.n_rows() == 0, + ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); + + vertices[0][0] = projected_vertices[0][0]; + vertices[0][1] = projected_vertices[0][1]; + vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; + + vertices[1][0] = projected_vertices[1][0]; + vertices[1][1] = projected_vertices[1][1]; + vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; + + vertices[2][0] = projected_vertices[2][0]; + vertices[2][1] = projected_vertices[2][1]; + vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; + + vertices[3][0] = projected_vertices[3][0]; + vertices[3][1] = projected_vertices[3][1]; + vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; + + projection_decompositions[0] = svg_project_point(vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); + projection_decompositions[1] = svg_project_point(vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); + projection_decompositions[2] = svg_project_point(vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); + projection_decompositions[3] = svg_project_point(vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); + + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[0][0]); + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[1][0]); + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[2][0]); + x_min_perspective = std::min(x_min_perspective, (double)projection_decompositions[3][0]); + + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[0][0]); + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[1][0]); + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[2][0]); + x_max_perspective = std::max(x_max_perspective, (double)projection_decompositions[3][0]); + + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[0][1]); + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[1][1]); + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[2][1]); + y_min_perspective = std::min(y_min_perspective, (double)projection_decompositions[3][1]); + + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[0][1]); + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[1][1]); + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[2][1]); + y_max_perspective = std::max(y_max_perspective, (double)projection_decompositions[3][1]); + } + } } - } x_dimension_perspective = x_max_perspective - x_min_perspective; y_dimension_perspective = y_max_perspective - y_min_perspective; @@ -5864,290 +5908,361 @@ void DataOutBase::write_svg (const std::vector > &patches, // iterate over the patches for (patch = patches.begin(); patch != patches.end(); ++patch) - { - n_subdivisions = patch->n_subdivisions; - n = n_subdivisions + 1; + { + n_subdivisions = patch->n_subdivisions; + n = n_subdivisions + 1; - for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) - { - for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) - { - Point projected_vertices[4]; - SvgCell cell; - - compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); - compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); - compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); - compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); - - Assert ((flags.height_vector < patch->data.n_rows()) || - patch->data.n_rows() == 0, - ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); - - cell.vertices[0][0] = projected_vertices[0][0]; - cell.vertices[0][1] = projected_vertices[0][1]; - cell.vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; - - cell.vertices[1][0] = projected_vertices[1][0]; - cell.vertices[1][1] = projected_vertices[1][1]; - cell.vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; - - cell.vertices[2][0] = projected_vertices[2][0]; - cell.vertices[2][1] = projected_vertices[2][1]; - cell.vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; - - cell.vertices[3][0] = projected_vertices[3][0]; - cell.vertices[3][1] = projected_vertices[3][1]; - cell.vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; - - cell.projected_vertices[0] = svg_project_point(cell.vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); - cell.projected_vertices[1] = svg_project_point(cell.vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); - cell.projected_vertices[2] = svg_project_point(cell.vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); - cell.projected_vertices[3] = svg_project_point(cell.vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); - - cell.center = .25 * (cell.vertices[0] + cell.vertices[1] + cell.vertices[2] + cell.vertices[3]); - cell.projected_center = svg_project_point(cell.center, camera_position, camera_direction, camera_horizontal, camera_focus); - - cell.depth = cell.center.distance(camera_position); - - cells.insert(cell); - } + for (unsigned int i2 = 0; i2 < n_subdivisions; ++i2) + { + for (unsigned int i1 = 0; i1 < n_subdivisions; ++i1) + { + Point projected_vertices[4]; + SvgCell cell; + + compute_node(projected_vertices[0], &*patch, i1, i2, 0, n_subdivisions); + compute_node(projected_vertices[1], &*patch, i1+1, i2, 0, n_subdivisions); + compute_node(projected_vertices[2], &*patch, i1, i2+1, 0, n_subdivisions); + compute_node(projected_vertices[3], &*patch, i1+1, i2+1, 0, n_subdivisions); + + Assert ((flags.height_vector < patch->data.n_rows()) || + patch->data.n_rows() == 0, + ExcIndexRange (flags.height_vector, 0, patch->data.n_rows())); + + cell.vertices[0][0] = projected_vertices[0][0]; + cell.vertices[0][1] = projected_vertices[0][1]; + cell.vertices[0][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + i2*d2) : 0; + + cell.vertices[1][0] = projected_vertices[1][0]; + cell.vertices[1][1] = projected_vertices[1][1]; + cell.vertices[1][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + i2*d2) : 0; + + cell.vertices[2][0] = projected_vertices[2][0]; + cell.vertices[2][1] = projected_vertices[2][1]; + cell.vertices[2][2] = patch->data.n_rows() != 0 ? patch->data(0,i1*d1 + (i2+1)*d2) : 0; + + cell.vertices[3][0] = projected_vertices[3][0]; + cell.vertices[3][1] = projected_vertices[3][1]; + cell.vertices[3][2] = patch->data.n_rows() != 0 ? patch->data(0,(i1+1)*d1 + (i2+1)*d2) : 0; + + cell.projected_vertices[0] = svg_project_point(cell.vertices[0], camera_position, camera_direction, camera_horizontal, camera_focus); + cell.projected_vertices[1] = svg_project_point(cell.vertices[1], camera_position, camera_direction, camera_horizontal, camera_focus); + cell.projected_vertices[2] = svg_project_point(cell.vertices[2], camera_position, camera_direction, camera_horizontal, camera_focus); + cell.projected_vertices[3] = svg_project_point(cell.vertices[3], camera_position, camera_direction, camera_horizontal, camera_focus); + + cell.center = .25 * (cell.vertices[0] + cell.vertices[1] + cell.vertices[2] + cell.vertices[3]); + cell.projected_center = svg_project_point(cell.center, camera_position, camera_direction, camera_horizontal, camera_focus); + + cell.depth = cell.center.distance(camera_position); + + cells.insert(cell); + } + } } - } // write the svg file - width = static_cast(.5 + height * (x_dimension_perspective / y_dimension_perspective)); + if (width==0) + width = static_cast(.5 + height * (x_dimension_perspective / y_dimension_perspective)); unsigned int additional_width = 0; - if(flags.draw_colorbar) additional_width = static_cast(.5 + height * .3); // additional width for colorbar - + if (flags.draw_colorbar) additional_width = static_cast(.5 + height * .3); // additional width for colorbar + // basic svg header and background rectangle - out << "" << '\n' + out << "" << '\n' << " " << '\n' << '\n'; unsigned int triangle_counter = 0; - + // write the cells in the correct order for (typename std::multiset::const_iterator cell = cells.begin(); cell != cells.end(); ++cell) - { - Point<3> points3d_triangle[3]; - - for (unsigned int triangle_index = 0; triangle_index < 4; triangle_index++) { - switch (triangle_index) - { - case 0: points3d_triangle[0] = cell->vertices[0], points3d_triangle[1] = cell->vertices[1], points3d_triangle[2] = cell->center; break; - case 1: points3d_triangle[0] = cell->vertices[1], points3d_triangle[1] = cell->vertices[3], points3d_triangle[2] = cell->center; break; - case 2: points3d_triangle[0] = cell->vertices[3], points3d_triangle[1] = cell->vertices[2], points3d_triangle[2] = cell->center; break; - case 3: points3d_triangle[0] = cell->vertices[2], points3d_triangle[1] = cell->vertices[0], points3d_triangle[2] = cell->center; break; - default: break; - } + Point<3> points3d_triangle[3]; + + for (unsigned int triangle_index = 0; triangle_index < 4; triangle_index++) + { + switch (triangle_index) + { + case 0: + points3d_triangle[0] = cell->vertices[0], points3d_triangle[1] = cell->vertices[1], points3d_triangle[2] = cell->center; + break; + case 1: + points3d_triangle[0] = cell->vertices[1], points3d_triangle[1] = cell->vertices[3], points3d_triangle[2] = cell->center; + break; + case 2: + points3d_triangle[0] = cell->vertices[3], points3d_triangle[1] = cell->vertices[2], points3d_triangle[2] = cell->center; + break; + case 3: + points3d_triangle[0] = cell->vertices[2], points3d_triangle[1] = cell->vertices[0], points3d_triangle[2] = cell->center; + break; + default: + break; + } - Point<6> gradient_param = svg_get_gradient_parameters(points3d_triangle); + Point<6> gradient_param = svg_get_gradient_parameters(points3d_triangle); - double start_h = .667 - ((gradient_param[4] - z_min) / z_dimension) * .667; - double stop_h = .667 - ((gradient_param[5] - z_min) / z_dimension) * .667; + double start_h = .667 - ((gradient_param[4] - z_min) / z_dimension) * .667; + double stop_h = .667 - ((gradient_param[5] - z_min) / z_dimension) * .667; - unsigned int start_r = 0; - unsigned int start_g = 0; - unsigned int start_b = 0; + unsigned int start_r = 0; + unsigned int start_g = 0; + unsigned int start_b = 0; - unsigned int stop_r = 0; - unsigned int stop_g = 0; - unsigned int stop_b = 0; + unsigned int stop_r = 0; + unsigned int stop_g = 0; + unsigned int stop_b = 0; - unsigned int start_i = static_cast(start_h * 6.); - unsigned int stop_i = static_cast(stop_h * 6.); + unsigned int start_i = static_cast(start_h * 6.); + unsigned int stop_i = static_cast(stop_h * 6.); - double start_f = start_h * 6. - start_i; - double start_q = 1. - start_f; + double start_f = start_h * 6. - start_i; + double start_q = 1. - start_f; - double stop_f = stop_h * 6. - stop_i; - double stop_q = 1. - stop_f; + double stop_f = stop_h * 6. - stop_i; + double stop_q = 1. - stop_f; - switch (start_i % 6) - { - case 0: start_r = 255, start_g = static_cast(.5 + 255. * start_f); break; - case 1: start_r = static_cast(.5 + 255. * start_q), start_g = 255; break; - case 2: start_g = 255, start_b = static_cast(.5 + 255. * start_f); break; - case 3: start_g = static_cast(.5 + 255. * start_q), start_b = 255; break; - case 4: start_r = static_cast(.5 + 255. * start_f), start_b = 255; break; - case 5: start_r = 255, start_b = static_cast(.5 + 255. * start_q); break; - default: break; - } + switch (start_i % 6) + { + case 0: + start_r = 255, start_g = static_cast(.5 + 255. * start_f); + break; + case 1: + start_r = static_cast(.5 + 255. * start_q), start_g = 255; + break; + case 2: + start_g = 255, start_b = static_cast(.5 + 255. * start_f); + break; + case 3: + start_g = static_cast(.5 + 255. * start_q), start_b = 255; + break; + case 4: + start_r = static_cast(.5 + 255. * start_f), start_b = 255; + break; + case 5: + start_r = 255, start_b = static_cast(.5 + 255. * start_q); + break; + default: + break; + } - switch (stop_i % 6) - { - case 0: stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); break; - case 1: stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; break; - case 2: stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); break; - case 3: stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; break; - case 4: stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; break; - case 5: stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); break; - default: break; - } + switch (stop_i % 6) + { + case 0: + stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); + break; + case 1: + stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; + break; + case 2: + stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); + break; + case 3: + stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; + break; + case 4: + stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; + break; + case 5: + stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); + break; + default: + break; + } - Point<3> gradient_start_point_3d, gradient_stop_point_3d; - - gradient_start_point_3d[0] = gradient_param[0]; - gradient_start_point_3d[1] = gradient_param[1]; - gradient_start_point_3d[2] = gradient_param[4]; - - gradient_stop_point_3d[0] = gradient_param[2]; - gradient_stop_point_3d[1] = gradient_param[3]; - gradient_stop_point_3d[2] = gradient_param[5]; - - Point<2> gradient_start_point = svg_project_point(gradient_start_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); - Point<2> gradient_stop_point = svg_project_point(gradient_stop_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); - - // define linear gradient - out << " (.5 + ((gradient_start_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << "\" " - << "y1=\"" - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_start_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << "\" " - << "x2=\"" - << static_cast(.5 + ((gradient_stop_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << "\" " - << "y2=\"" - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_stop_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << "\"" - << ">" << '\n' - << " " << '\n' - << " " << '\n' - << " " << '\n'; - - // draw current triangle - double x1 = 0, y1 = 0, x2 = 0, y2 = 0; - double x3 = cell->projected_center[0]; - double y3 = cell->projected_center[1]; - - switch (triangle_index) - { - case 0: x1 = cell->projected_vertices[0][0], y1 = cell->projected_vertices[0][1], x2 = cell->projected_vertices[1][0], y2 = cell->projected_vertices[1][1]; break; - case 1: x1 = cell->projected_vertices[1][0], y1 = cell->projected_vertices[1][1], x2 = cell->projected_vertices[3][0], y2 = cell->projected_vertices[3][1]; break; - case 2: x1 = cell->projected_vertices[3][0], y1 = cell->projected_vertices[3][1], x2 = cell->projected_vertices[2][0], y2 = cell->projected_vertices[2][1]; break; - case 3: x1 = cell->projected_vertices[2][0], y1 = cell->projected_vertices[2][1], x2 = cell->projected_vertices[0][0], y2 = cell->projected_vertices[0][1]; break; - default: break; - } + Point<3> gradient_start_point_3d, gradient_stop_point_3d; + + gradient_start_point_3d[0] = gradient_param[0]; + gradient_start_point_3d[1] = gradient_param[1]; + gradient_start_point_3d[2] = gradient_param[4]; + + gradient_stop_point_3d[0] = gradient_param[2]; + gradient_stop_point_3d[1] = gradient_param[3]; + gradient_stop_point_3d[2] = gradient_param[5]; + + Point<2> gradient_start_point = svg_project_point(gradient_start_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); + Point<2> gradient_stop_point = svg_project_point(gradient_stop_point_3d, camera_position, camera_direction, camera_horizontal, camera_focus); + + // define linear gradient + out << " (.5 + ((gradient_start_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << "\" " + << "y1=\"" + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_start_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << "\" " + << "x2=\"" + << static_cast(.5 + ((gradient_stop_point[0] - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << "\" " + << "y2=\"" + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((gradient_stop_point[1] - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << "\"" + << ">" << '\n' + << " " << '\n' + << " " << '\n' + << " " << '\n'; + + // draw current triangle + double x1 = 0, y1 = 0, x2 = 0, y2 = 0; + double x3 = cell->projected_center[0]; + double y3 = cell->projected_center[1]; + + switch (triangle_index) + { + case 0: + x1 = cell->projected_vertices[0][0], y1 = cell->projected_vertices[0][1], x2 = cell->projected_vertices[1][0], y2 = cell->projected_vertices[1][1]; + break; + case 1: + x1 = cell->projected_vertices[1][0], y1 = cell->projected_vertices[1][1], x2 = cell->projected_vertices[3][0], y2 = cell->projected_vertices[3][1]; + break; + case 2: + x1 = cell->projected_vertices[3][0], y1 = cell->projected_vertices[3][1], x2 = cell->projected_vertices[2][0], y2 = cell->projected_vertices[2][1]; + break; + case 3: + x1 = cell->projected_vertices[2][0], y1 = cell->projected_vertices[2][1], x2 = cell->projected_vertices[0][0], y2 = cell->projected_vertices[0][1]; + break; + default: + break; + } - out << " (.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast(.5 + ((x2 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y2 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast(.5 + ((x3 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y3 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << " L " - << static_cast(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) - << ' ' - << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) - << "\" style=\"stroke:black; fill:url(#" << triangle_counter << "); stroke-width:" << flags.line_thickness << "\"/>" << '\n'; - - triangle_counter++; + out << " (.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast(.5 + ((x2 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y2 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast(.5 + ((x3 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y3 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << " L " + << static_cast(.5 + ((x1 - x_min_perspective) / x_dimension_perspective) * (width - (width/100.) * 2. * margin_in_percent) + ((width/100.) * margin_in_percent)) + << ' ' + << static_cast(.5 + height - (height/100.) * margin_in_percent - ((y1 - y_min_perspective) / y_dimension_perspective) * (height - (height/100.) * 2. * margin_in_percent)) + << "\" style=\"stroke:black; fill:url(#" << triangle_counter << "); stroke-width:" << flags.line_thickness << "\"/>" << '\n'; + + triangle_counter++; + } } - } // draw the colorbar if (flags.draw_colorbar) - { - out << '\n' << " " << '\n'; + { + out << '\n' << " " << '\n'; - unsigned int element_height = static_cast(((height/100.) * (71. - 2.*margin_in_percent)) / 4); - unsigned int element_width = static_cast(.5 + (height/100.) * 2.5); + unsigned int element_height = static_cast(((height/100.) * (71. - 2.*margin_in_percent)) / 4); + unsigned int element_width = static_cast(.5 + (height/100.) * 2.5); - additional_width = 0; - if (!flags.margin) additional_width = static_cast(.5 + (height/100.) * 2.5); + additional_width = 0; + if (!flags.margin) additional_width = static_cast(.5 + (height/100.) * 2.5); - for (unsigned int index = 0; index < 4; index++) - { - double start_h = .667 - ((index+1) / 4.) * .667; - double stop_h = .667 - (index / 4.) * .667; + for (unsigned int index = 0; index < 4; index++) + { + double start_h = .667 - ((index+1) / 4.) * .667; + double stop_h = .667 - (index / 4.) * .667; - unsigned int start_r = 0; - unsigned int start_g = 0; - unsigned int start_b = 0; + unsigned int start_r = 0; + unsigned int start_g = 0; + unsigned int start_b = 0; - unsigned int stop_r = 0; - unsigned int stop_g = 0; - unsigned int stop_b = 0; + unsigned int stop_r = 0; + unsigned int stop_g = 0; + unsigned int stop_b = 0; - unsigned int start_i = static_cast(start_h * 6.); - unsigned int stop_i = static_cast(stop_h * 6.); + unsigned int start_i = static_cast(start_h * 6.); + unsigned int stop_i = static_cast(stop_h * 6.); - double start_f = start_h * 6. - start_i; - double start_q = 1. - start_f; + double start_f = start_h * 6. - start_i; + double start_q = 1. - start_f; - double stop_f = stop_h * 6. - stop_i; - double stop_q = 1. - stop_f; + double stop_f = stop_h * 6. - stop_i; + double stop_q = 1. - stop_f; - switch (start_i % 6) - { - case 0: start_r = 255, start_g = static_cast(.5 + 255. * start_f); break; - case 1: start_r = static_cast(.5 + 255. * start_q), start_g = 255; break; - case 2: start_g = 255, start_b = static_cast(.5 + 255. * start_f); break; - case 3: start_g = static_cast(.5 + 255. * start_q), start_b = 255; break; - case 4: start_r = static_cast(.5 + 255. * start_f), start_b = 255; break; - case 5: start_r = 255, start_b = static_cast(.5 + 255. * start_q); break; - default: break; - } + switch (start_i % 6) + { + case 0: + start_r = 255, start_g = static_cast(.5 + 255. * start_f); + break; + case 1: + start_r = static_cast(.5 + 255. * start_q), start_g = 255; + break; + case 2: + start_g = 255, start_b = static_cast(.5 + 255. * start_f); + break; + case 3: + start_g = static_cast(.5 + 255. * start_q), start_b = 255; + break; + case 4: + start_r = static_cast(.5 + 255. * start_f), start_b = 255; + break; + case 5: + start_r = 255, start_b = static_cast(.5 + 255. * start_q); + break; + default: + break; + } - switch (stop_i % 6) - { - case 0: stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); break; - case 1: stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; break; - case 2: stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); break; - case 3: stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; break; - case 4: stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; break; - case 5: stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); break; - default: break; - } + switch (stop_i % 6) + { + case 0: + stop_r = 255, stop_g = static_cast(.5 + 255. * stop_f); + break; + case 1: + stop_r = static_cast(.5 + 255. * stop_q), stop_g = 255; + break; + case 2: + stop_g = 255, stop_b = static_cast(.5 + 255. * stop_f); + break; + case 3: + stop_g = static_cast(.5 + 255. * stop_q), stop_b = 255; + break; + case 4: + stop_r = static_cast(.5 + 255. * stop_f), stop_b = 255; + break; + case 5: + stop_r = 255, stop_b = static_cast(.5 + 255. * stop_q); + break; + default: + break; + } - // define gradient - out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height << "\" " - << "x2=\"" << width + additional_width << "\" " - << "y2=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29)) + (4-index) * element_height << "\"" - << ">" << '\n' - << " " << '\n' - << " " << '\n' - << " " << '\n'; - - // draw box corresponding to the gradient above - out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height - << "\" width=\"" << element_width - << "\" height=\"" << element_height - << "\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_" << index << ")\"/>" << '\n'; - } - - for (unsigned int index = 0; index < 5; index++) - { - out << " (1.5 * element_width) - << "\" y=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29) + (4.-index) * element_height + 30.) << "\"" - << " style=\"text-anchor:start; font-size:80; font-family:Helvetica"; + // define gradient + out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height << "\" " + << "x2=\"" << width + additional_width << "\" " + << "y2=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29)) + (4-index) * element_height << "\"" + << ">" << '\n' + << " " << '\n' + << " " << '\n' + << " " << '\n'; + + // draw box corresponding to the gradient above + out << " (.5 + (height/100.) * (margin_in_percent + 29)) + (3-index) * element_height + << "\" width=\"" << element_width + << "\" height=\"" << element_height + << "\" style=\"stroke:black; stroke-width:2; fill:url(#colorbar_" << index << ")\"/>" << '\n'; + } + + for (unsigned int index = 0; index < 5; index++) + { + out << " (1.5 * element_width) + << "\" y=\"" << static_cast(.5 + (height/100.) * (margin_in_percent + 29) + (4.-index) * element_height + 30.) << "\"" + << " style=\"text-anchor:start; font-size:80; font-family:Helvetica"; - if (index == 0 || index == 4) out << "; font-weight:bold"; + if (index == 0 || index == 4) out << "; font-weight:bold"; - out << "\">" << (float)(((int)((z_min + index * (z_dimension / 4.))*10000))/10000.); + out << "\">" << (float)(((int)((z_min + index * (z_dimension / 4.))*10000))/10000.); - if (index == 4) out << " max"; - if (index == 0) out << " min"; + if (index == 4) out << " max"; + if (index == 0) out << " min"; - out << "" << '\n'; + out << "" << '\n'; + } } - } // finalize the svg file out << '\n' << ""; @@ -6406,7 +6521,7 @@ void DataOutInterface::write_vtu_in_parallel (const char *filename MPI_Info info; MPI_Info_create(&info); MPI_File fh; - MPI_File_open(MPI_COMM_WORLD, const_cast(filename), + MPI_File_open(comm, const_cast(filename), MPI_MODE_CREATE | MPI_MODE_WRONLY, info, &fh); MPI_File_set_size(fh, 0); // delete the file contents // this barrier is necessary, because otherwise others might already @@ -6420,7 +6535,7 @@ void DataOutInterface::write_vtu_in_parallel (const char *filename if (myrank==0) { std::stringstream ss; - DataOutBase::write_vtu_header(ss); + DataOutBase::write_vtu_header(ss, vtk_flags); header_size = ss.str().size(); MPI_File_write(fh, const_cast(ss.str().c_str()), header_size, MPI_CHAR, NULL); } @@ -6606,6 +6721,32 @@ DataOutInterface::write_visit_record (std::ostream &out, +template +void +DataOutInterface::write_visit_record (std::ostream &out, + const std::vector > &piece_names) const +{ + AssertThrow (out, ExcIO()); + + if (piece_names.size() == 0) + return; + + const double nblocks = piece_names[0].size(); + Assert(nblocks > 0, ExcMessage("piece_names should be a vector of nonempty vectors.") ) + + out << "!NBLOCKS " << nblocks << '\n'; + for (std::vector >::const_iterator domain = piece_names.begin(); domain != piece_names.end(); ++domain) + { + Assert(domain->size() == nblocks, ExcMessage("piece_names should be a vector of equal sized vectors.") ) + for (std::vector::const_iterator subdomain = domain->begin(); subdomain != domain->end(); ++subdomain) + out << *subdomain << '\n'; + } + + out << std::flush; +} + + + template void DataOutInterface:: write_deal_II_intermediate (std::ostream &out) const @@ -6618,39 +6759,42 @@ write_deal_II_intermediate (std::ostream &out) const template XDMFEntry DataOutInterface:: -create_xdmf_entry (const char *h5_filename, const double cur_time, MPI_Comm comm) const +create_xdmf_entry (const std::string &h5_filename, const double cur_time, MPI_Comm comm) const +{ + DataOutBase::DataOutFilter data_filter(DataOutBase::DataOutFilterFlags(false, true)); + write_filtered_data(data_filter); + return create_xdmf_entry(data_filter, h5_filename, cur_time, comm); +} + +template +XDMFEntry DataOutInterface:: +create_xdmf_entry (const DataOutFilter &data_filter, const std::string &h5_filename, const double cur_time, MPI_Comm comm) const { - return DataOutBase::create_xdmf_entry(get_patches(), get_dataset_names(), get_vector_data_ranges(), - h5_filename, cur_time, comm); + return create_xdmf_entry(data_filter, h5_filename, h5_filename, cur_time, comm); } template -XDMFEntry DataOutBase::create_xdmf_entry (const std::vector > &patches, - const std::vector &data_names, - const std::vector > &vector_data_ranges, - const char *h5_filename, - const double cur_time, - MPI_Comm comm) +XDMFEntry DataOutInterface:: +create_xdmf_entry (const DataOutFilter &data_filter, const std::string &h5_mesh_filename, const std::string &h5_solution_filename, const double cur_time, MPI_Comm comm) const { unsigned int local_node_cell_count[2], global_node_cell_count[2]; - const unsigned int n_data_sets = data_names.size(); int myrank; #ifndef DEAL_II_WITH_HDF5 // throw an exception, but first make // sure the compiler does not warn about // the now unused function arguments - (void)patches; - (void)data_names; - (void)vector_data_ranges; - (void)h5_filename; + (void)data_filter; + (void)h5_mesh_filename; + (void)h5_solution_filename; (void)cur_time; (void)comm; AssertThrow(false, ExcMessage ("XDMF support requires HDF5 to be turned on.")); #endif AssertThrow(dim == 2 || dim == 3, ExcMessage ("XDMF only supports 2 or 3 dimensions.")); - compute_sizes(patches, local_node_cell_count[0], local_node_cell_count[1]); + local_node_cell_count[0] = data_filter.n_nodes(); + local_node_cell_count[1] = data_filter.n_cells(); // And compute the global total #ifdef DEAL_II_WITH_MPI @@ -6665,56 +6809,14 @@ XDMFEntry DataOutBase::create_xdmf_entry (const std::vector // Output the XDMF file only on the root process if (myrank == 0) { - XDMFEntry entry(h5_filename, cur_time, global_node_cell_count[0], global_node_cell_count[1], dim); + XDMFEntry entry(h5_mesh_filename, h5_solution_filename, cur_time, global_node_cell_count[0], global_node_cell_count[1], dim); + unsigned int n_data_sets = data_filter.n_data_sets(); // The vector names generated here must match those generated in the HDF5 file - unsigned int i, n_th_vector, data_set, pt_data_vector_dim; - std::string vector_name; - for (n_th_vector=0,data_set=0; data_set(vector_data_ranges[n_th_vector]) < data_set) n_th_vector++; - - // Determine whether the data is multiple dimensions or one - if (std_cxx1x::get<0>(vector_data_ranges[n_th_vector]) == data_set) - { - // Multiple dimensions - pt_data_vector_dim = std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) - std_cxx1x::get<0>(vector_data_ranges[n_th_vector])+1; - - // Ensure the dimensionality of the data is correct - AssertThrow (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) >= std_cxx1x::get<0>(vector_data_ranges[n_th_vector]), - ExcLowerRange (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]), std_cxx1x::get<0>(vector_data_ranges[n_th_vector]))); - AssertThrow (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) < n_data_sets, - ExcIndexRange (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]), 0, n_data_sets)); - - // Determine the vector name - // Concatenate all the - // component names with double - // underscores unless a vector - // name has been specified - if (std_cxx1x::get<2>(vector_data_ranges[n_th_vector]) != "") - { - vector_name = std_cxx1x::get<2>(vector_data_ranges[n_th_vector]); - } - else - { - vector_name = ""; - for (i=std_cxx1x::get<0>(vector_data_ranges[n_th_vector]); i(vector_data_ranges[n_th_vector]); ++i) - vector_name += data_names[i] + "__"; - vector_name += data_names[std_cxx1x::get<1>(vector_data_ranges[n_th_vector])]; - } - } - else - { - // One dimension - pt_data_vector_dim = 1; - vector_name = data_names[data_set]; - } - - entry.add_attribute(vector_name, pt_data_vector_dim); - - // Advance the current data set - data_set += pt_data_vector_dim; + entry.add_attribute(data_filter.get_data_set_name(i), data_filter.get_data_set_dim(i)); } return entry; @@ -6728,19 +6830,8 @@ XDMFEntry DataOutBase::create_xdmf_entry (const std::vector template void DataOutInterface:: write_xdmf_file (const std::vector &entries, - const char *filename, + const std::string &filename, MPI_Comm comm) const -{ - DataOutBase::write_xdmf_file(get_patches(), entries, filename, comm); -} - - - -template -void DataOutBase::write_xdmf_file (const std::vector > &, - const std::vector &entries, - const char *filename, - MPI_Comm comm) { int myrank; @@ -6754,7 +6845,7 @@ void DataOutBase::write_xdmf_file (const std::vector > &, // Only rank 0 process writes the XDMF file if (myrank == 0) { - std::ofstream xdmf_file(filename); + std::ofstream xdmf_file(filename.c_str()); std::vector::const_iterator it; xdmf_file << "\n"; @@ -6776,8 +6867,10 @@ void DataOutBase::write_xdmf_file (const std::vector > &, } -// Get the XDMF content associated with this entry -// If the entry is not valid, this returns false +/* + * Get the XDMF content associated with this entry. + * If the entry is not valid, this returns an empty string. + */ std::string XDMFEntry::get_xdmf_content(const unsigned int indent_level) const { std::stringstream ss; @@ -6789,7 +6882,7 @@ std::string XDMFEntry::get_xdmf_content(const unsigned int indent_level) const ss << indent(indent_level+1) << "\n"; ss << indent(indent_level+1) << "\n"; ss << indent(indent_level+2) << "\n"; - ss << indent(indent_level+3) << h5_filename << ":/nodes\n"; + ss << indent(indent_level+3) << h5_mesh_filename << ":/nodes\n"; ss << indent(indent_level+2) << "\n"; ss << indent(indent_level+1) << "\n"; // If we have cells defined, use a quadrilateral (2D) or hexahedron (3D) topology @@ -6797,7 +6890,7 @@ std::string XDMFEntry::get_xdmf_content(const unsigned int indent_level) const { ss << indent(indent_level+1) << "\n"; ss << indent(indent_level+2) << "\n"; - ss << indent(indent_level+3) << h5_filename << ":/cells\n"; + ss << indent(indent_level+3) << h5_mesh_filename << ":/cells\n"; ss << indent(indent_level+2) << "\n"; ss << indent(indent_level+1) << "\n"; } @@ -6813,7 +6906,7 @@ std::string XDMFEntry::get_xdmf_content(const unsigned int indent_level) const ss << indent(indent_level+1) << "first << "\" AttributeType=\"" << (it->second > 1 ? "Vector" : "Scalar") << "\" Center=\"Node\">\n"; // Vectors must have 3 elements even for 2D models ss << indent(indent_level+2) << "second > 1 ? 3 : 1) << "\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n"; - ss << indent(indent_level+3) << h5_filename << ":/" << it->first << "\n"; + ss << indent(indent_level+3) << h5_sol_filename << ":/" << it->first << "\n"; ss << indent(indent_level+2) << "\n"; ss << indent(indent_level+1) << "\n"; } @@ -6823,23 +6916,153 @@ std::string XDMFEntry::get_xdmf_content(const unsigned int indent_level) const return ss.str(); } +/* + * Write the data in this DataOutInterface to a DataOutFilter object. + * Filtering is performed based on the DataOutFilter flags. + */ template void DataOutInterface:: -write_hdf5_parallel (const char *filename, MPI_Comm comm) const +write_filtered_data (DataOutFilter &filtered_data) const { -#ifndef DEAL_II_WITH_HDF5 - AssertThrow(false, ExcMessage ("HDF5 support is disabled.")); -#endif - DataOutBase::write_hdf5_parallel(get_patches(), get_dataset_names(), + DataOutBase::write_filtered_data(get_patches(), get_dataset_names(), get_vector_data_ranges(), - filename, comm); + filtered_data); } template -void DataOutBase::write_hdf5_parallel (const std::vector > &patches, +void DataOutBase::write_filtered_data (const std::vector > &patches, const std::vector &data_names, const std::vector > &vector_data_ranges, - const char *filename, + DataOutFilter &filtered_data) +{ + const unsigned int n_data_sets = data_names.size(); + unsigned int n_node, n_cell; + Table<2,double> data_vectors; + Threads::Task<> reorder_task; + +#ifndef DEAL_II_WITH_MPI + // verify that there are indeed + // patches to be written out. most + // of the times, people just forget + // to call build_patches when there + // are no patches, so a warning is + // in order. that said, the + // assertion is disabled if we + // support MPI since then it can + // happen that on the coarsest + // mesh, a processor simply has no + // cells it actually owns, and in + // that case it is legit if there + // are no patches + Assert (patches.size() > 0, ExcNoPatches()); +#endif + + compute_sizes(patches, n_node, n_cell); + + data_vectors = Table<2,double> (n_data_sets, n_node); + void (*fun_ptr) (const std::vector > &, Table<2,double> &) = &DataOutBase::template write_gmv_reorder_data_vectors; + reorder_task = Threads::new_task (fun_ptr, patches, data_vectors); + + // Write the nodes/cells to the DataOutFilter object. + write_nodes(patches, filtered_data); + write_cells(patches, filtered_data); + + // Ensure reordering is done before we output data set values + reorder_task.join (); + + // when writing, first write out + // all vector data, then handle the + // scalar data sets that have been + // left over + unsigned int i, n, q, r, n_th_vector, data_set, pt_data_vector_dim, mem_vector_dim; + std::string vector_name; + for (n_th_vector=0,data_set=0; data_set(vector_data_ranges[n_th_vector]) < data_set) n_th_vector++; + + // Determine the dimension of this data + if (std_cxx1x::get<0>(vector_data_ranges[n_th_vector]) == data_set) + { + // Multiple dimensions + pt_data_vector_dim = std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) - std_cxx1x::get<0>(vector_data_ranges[n_th_vector])+1; + + // Ensure the dimensionality of the data is correct + AssertThrow (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) >= std_cxx1x::get<0>(vector_data_ranges[n_th_vector]), + ExcLowerRange (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]), std_cxx1x::get<0>(vector_data_ranges[n_th_vector]))); + AssertThrow (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) < n_data_sets, + ExcIndexRange (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]), 0, n_data_sets)); + + // Determine the vector name + // Concatenate all the + // component names with double + // underscores unless a vector + // name has been specified + if (std_cxx1x::get<2>(vector_data_ranges[n_th_vector]) != "") + { + vector_name = std_cxx1x::get<2>(vector_data_ranges[n_th_vector]); + } + else + { + vector_name = ""; + for (i=std_cxx1x::get<0>(vector_data_ranges[n_th_vector]); i(vector_data_ranges[n_th_vector]); ++i) + vector_name += data_names[i] + "__"; + vector_name += data_names[std_cxx1x::get<1>(vector_data_ranges[n_th_vector])]; + } + } + else + { + // One dimension + pt_data_vector_dim = 1; + vector_name = data_names[data_set]; + } + + // Write data to the filter object + filtered_data.write_data_set(vector_name, pt_data_vector_dim, data_set, data_vectors); + + // Advance the current data set + data_set += pt_data_vector_dim; + } +} + +template +void DataOutInterface:: +write_hdf5_parallel (const std::string &filename, MPI_Comm comm) const +{ + DataOutBase::DataOutFilter data_filter(DataOutBase::DataOutFilterFlags(false, true)); + write_filtered_data(data_filter); + write_hdf5_parallel(data_filter, filename, comm); +} + +template +void DataOutInterface:: +write_hdf5_parallel (const DataOutFilter &data_filter, const std::string &filename, MPI_Comm comm) const +{ + DataOutBase::write_hdf5_parallel(get_patches(), data_filter, filename, comm); +} + +template +void DataOutInterface:: +write_hdf5_parallel (const DataOutFilter &data_filter, const bool write_mesh_file, const std::string &mesh_filename, const std::string &solution_filename, MPI_Comm comm) const +{ + DataOutBase::write_hdf5_parallel(get_patches(), data_filter, write_mesh_file, mesh_filename, solution_filename, comm); +} + +template +void DataOutBase::write_hdf5_parallel (const std::vector > &patches, + const DataOutFilter &data_filter, + const std::string &filename, + MPI_Comm comm) +{ + write_hdf5_parallel(patches, data_filter, true, filename, filename, comm); +} + +template +void DataOutBase::write_hdf5_parallel (const std::vector > &patches, + const DataOutFilter &data_filter, + const bool write_mesh_file, + const std::string &mesh_filename, + const std::string &solution_filename, MPI_Comm comm) { #ifndef DEAL_II_WITH_HDF5 @@ -6847,9 +7070,10 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & // sure the compiler does not warn about // the now unused function arguments (void)patches; - (void)data_names; - (void)vector_data_ranges; - (void)filename; + (void)data_filter; + (void)write_mesh_file; + (void)mesh_filename; + (void)solution_filename; (void)comm; AssertThrow(false, ExcMessage ("HDF5 support is disabled.")); #else @@ -6867,21 +7091,20 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & // cells it actually owns, and in // that case it is legit if there // are no patches - Assert (patches.size() > 0, ExcNoPatches()); + Assert (data_filter.n_nodes() > 0, ExcNoPatches()); #else - hid_t h5_file_id, plist_id; + hid_t h5_mesh_file_id=-1, h5_solution_file_id, file_plist_id, plist_id; hid_t node_dataspace, node_dataset, node_file_dataspace, node_memory_dataspace; hid_t cell_dataspace, cell_dataset, cell_file_dataspace, cell_memory_dataspace; hid_t pt_data_dataspace, pt_data_dataset, pt_data_file_dataspace, pt_data_memory_dataspace; herr_t status; unsigned int local_node_cell_count[2], global_node_cell_count[2], global_node_cell_offsets[2]; hsize_t count[2], offset[2], node_ds_dim[2], cell_ds_dim[2]; - const unsigned int n_data_sets = data_names.size(); bool empty_proc = false; - Table<2,double> data_vectors; - Threads::Task<> reorder_task; + std::vector node_data_vec; + std::vector cell_data_vec; - if (patches.size() == 0) empty_proc = true; + if (data_filter.n_nodes() == 0) empty_proc = true; // If HDF5 is not parallel and we're using multiple processes, abort #ifndef H5_HAVE_PARALLEL @@ -6893,37 +7116,21 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & #endif #endif - if (empty_proc) - { - local_node_cell_count[0] = local_node_cell_count[1] = 0; - } - else - { - compute_sizes(patches, local_node_cell_count[0], local_node_cell_count[1]); - - data_vectors = Table<2,double> (n_data_sets, local_node_cell_count[0]); - void (*fun_ptr) (const std::vector > &, Table<2,double> &) = &DataOutBase::template write_gmv_reorder_data_vectors; - reorder_task = Threads::new_task (fun_ptr, patches, data_vectors); - } + local_node_cell_count[0] = data_filter.n_nodes(); + local_node_cell_count[1] = data_filter.n_cells(); // Create file access properties - plist_id = H5Pcreate(H5P_FILE_ACCESS); - AssertThrow(plist_id != -1, ExcIO()); + file_plist_id = H5Pcreate(H5P_FILE_ACCESS); + AssertThrow(file_plist_id != -1, ExcIO()); // If MPI is enabled *and* HDF5 is parallel, we can do parallel output #ifdef DEAL_II_WITH_MPI #ifdef H5_HAVE_PARALLEL // Set the access to use the specified MPI_Comm object - status = H5Pset_fapl_mpio(plist_id, comm, MPI_INFO_NULL); + status = H5Pset_fapl_mpio(file_plist_id, comm, MPI_INFO_NULL); AssertThrow(status >= 0, ExcIO()); #endif #endif - // Overwrite any existing files (change this to an option?) and close the property list - h5_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id); - AssertThrow(h5_file_id >= 0, ExcIO()); - status = H5Pclose(plist_id); - AssertThrow(status >= 0, ExcIO()); - // Compute the global total number of nodes/cells // And determine the offset of the data for this process #ifdef DEAL_II_WITH_MPI @@ -6935,159 +7142,159 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & global_node_cell_offsets[0] = global_node_cell_offsets[1] = 0; #endif - // Write the nodes/cells to the HDF5 "stream" object. Record the process offset - // so that node reference indices are correctly calculated - HDF5MemStream hdf5_data(local_node_cell_count, global_node_cell_offsets, dim); - write_nodes(patches, hdf5_data); - write_cells(patches, hdf5_data); + // Create the property list for a collective write + plist_id = H5Pcreate(H5P_DATASET_XFER); + AssertThrow(plist_id >= 0, ExcIO()); +#ifdef DEAL_II_WITH_MPI +#ifdef H5_HAVE_PARALLEL + status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); + AssertThrow(status >= 0, ExcIO()); +#endif +#endif + + if (write_mesh_file) + { + // Overwrite any existing files (change this to an option?) + h5_mesh_file_id = H5Fcreate(mesh_filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, file_plist_id); + AssertThrow(h5_mesh_file_id >= 0, ExcIO()); - // Create the dataspace for the nodes and cells - node_ds_dim[0] = global_node_cell_count[0]; - node_ds_dim[1] = dim; - node_dataspace = H5Screate_simple(2, node_ds_dim, NULL); - AssertThrow(node_dataspace >= 0, ExcIO()); + // Create the dataspace for the nodes and cells + node_ds_dim[0] = global_node_cell_count[0]; + node_ds_dim[1] = dim; + node_dataspace = H5Screate_simple(2, node_ds_dim, NULL); + AssertThrow(node_dataspace >= 0, ExcIO()); - cell_ds_dim[0] = global_node_cell_count[1]; - cell_ds_dim[1] = GeometryInfo::vertices_per_cell; - cell_dataspace = H5Screate_simple(2, cell_ds_dim, NULL); - AssertThrow(cell_dataspace >= 0, ExcIO()); + cell_ds_dim[0] = global_node_cell_count[1]; + cell_ds_dim[1] = GeometryInfo::vertices_per_cell; + cell_dataspace = H5Screate_simple(2, cell_ds_dim, NULL); + AssertThrow(cell_dataspace >= 0, ExcIO()); - // Create the dataset for the nodes and cells + // Create the dataset for the nodes and cells #if H5Gcreate_vers == 1 - node_dataset = H5Dcreate(h5_file_id, "nodes", H5T_NATIVE_DOUBLE, node_dataspace, H5P_DEFAULT); + node_dataset = H5Dcreate(h5_mesh_file_id, "nodes", H5T_NATIVE_DOUBLE, node_dataspace, H5P_DEFAULT); #else - node_dataset = H5Dcreate(h5_file_id, "nodes", H5T_NATIVE_DOUBLE, node_dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + node_dataset = H5Dcreate(h5_mesh_file_id, "nodes", H5T_NATIVE_DOUBLE, node_dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #endif - AssertThrow(node_dataset >= 0, ExcIO()); + AssertThrow(node_dataset >= 0, ExcIO()); #if H5Gcreate_vers == 1 - cell_dataset = H5Dcreate(h5_file_id, "cells", H5T_NATIVE_UINT, cell_dataspace, H5P_DEFAULT); + cell_dataset = H5Dcreate(h5_mesh_file_id, "cells", H5T_NATIVE_UINT, cell_dataspace, H5P_DEFAULT); #else - cell_dataset = H5Dcreate(h5_file_id, "cells", H5T_NATIVE_UINT, cell_dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + cell_dataset = H5Dcreate(h5_mesh_file_id, "cells", H5T_NATIVE_UINT, cell_dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #endif - AssertThrow(cell_dataset >= 0, ExcIO()); + AssertThrow(cell_dataset >= 0, ExcIO()); - // Close the node and cell dataspaces since we're done with them - status = H5Sclose(node_dataspace); - AssertThrow(status >= 0, ExcIO()); - status = H5Sclose(cell_dataspace); - AssertThrow(status >= 0, ExcIO()); + // Close the node and cell dataspaces since we're done with them + status = H5Sclose(node_dataspace); + AssertThrow(status >= 0, ExcIO()); + status = H5Sclose(cell_dataspace); + AssertThrow(status >= 0, ExcIO()); - // Create the data subset we'll use to read from memory - count[0] = local_node_cell_count[0]; - count[1] = dim; - offset[0] = global_node_cell_offsets[0]; - offset[1] = 0; - node_memory_dataspace = H5Screate_simple(2, count, NULL); - AssertThrow(node_memory_dataspace >= 0, ExcIO()); - - // Select the hyperslab in the file - node_file_dataspace = H5Dget_space(node_dataset); - AssertThrow(node_file_dataspace >= 0, ExcIO()); - status = H5Sselect_hyperslab(node_file_dataspace, H5S_SELECT_SET, offset, NULL, count, NULL); - AssertThrow(status >= 0, ExcIO()); + // Create the data subset we'll use to read from memory + count[0] = local_node_cell_count[0]; + count[1] = dim; + offset[0] = global_node_cell_offsets[0]; + offset[1] = 0; + node_memory_dataspace = H5Screate_simple(2, count, NULL); + AssertThrow(node_memory_dataspace >= 0, ExcIO()); - // And repeat for cells - count[0] = local_node_cell_count[1]; - count[1] = GeometryInfo::vertices_per_cell; - offset[0] = global_node_cell_offsets[1]; - offset[1] = 0; - cell_memory_dataspace = H5Screate_simple(2, count, NULL); - AssertThrow(cell_memory_dataspace >= 0, ExcIO()); - - cell_file_dataspace = H5Dget_space(cell_dataset); - AssertThrow(cell_file_dataspace >= 0, ExcIO()); - status = H5Sselect_hyperslab(cell_file_dataspace, H5S_SELECT_SET, offset, NULL, count, NULL); - AssertThrow(status >= 0, ExcIO()); + // Select the hyperslab in the file + node_file_dataspace = H5Dget_space(node_dataset); + AssertThrow(node_file_dataspace >= 0, ExcIO()); + status = H5Sselect_hyperslab(node_file_dataspace, H5S_SELECT_SET, offset, NULL, count, NULL); + AssertThrow(status >= 0, ExcIO()); - // Create the property list for a collective write - plist_id = H5Pcreate(H5P_DATASET_XFER); - AssertThrow(plist_id >= 0, ExcIO()); -#ifdef DEAL_II_WITH_MPI -#ifdef H5_HAVE_PARALLEL - status = H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); - AssertThrow(status >= 0, ExcIO()); -#endif -#endif + // And repeat for cells + count[0] = local_node_cell_count[1]; + count[1] = GeometryInfo::vertices_per_cell; + offset[0] = global_node_cell_offsets[1]; + offset[1] = 0; + cell_memory_dataspace = H5Screate_simple(2, count, NULL); + AssertThrow(cell_memory_dataspace >= 0, ExcIO()); - // And finally, write the node data - status = H5Dwrite(node_dataset, H5T_NATIVE_DOUBLE, node_memory_dataspace, node_file_dataspace, plist_id, hdf5_data.node_data()); - AssertThrow(status >= 0, ExcIO()); + cell_file_dataspace = H5Dget_space(cell_dataset); + AssertThrow(cell_file_dataspace >= 0, ExcIO()); + status = H5Sselect_hyperslab(cell_file_dataspace, H5S_SELECT_SET, offset, NULL, count, NULL); + AssertThrow(status >= 0, ExcIO()); - // And the cell data - status = H5Dwrite(cell_dataset, H5T_NATIVE_UINT, cell_memory_dataspace, cell_file_dataspace, plist_id, hdf5_data.cell_data()); - AssertThrow(status >= 0, ExcIO()); + // And finally, write the node data + data_filter.fill_node_data(node_data_vec); + status = H5Dwrite(node_dataset, H5T_NATIVE_DOUBLE, node_memory_dataspace, node_file_dataspace, plist_id, &node_data_vec[0]); + AssertThrow(status >= 0, ExcIO()); + node_data_vec.clear(); - if (!empty_proc) reorder_task.join (); + // And the cell data + data_filter.fill_cell_data(global_node_cell_offsets[0], cell_data_vec); + status = H5Dwrite(cell_dataset, H5T_NATIVE_UINT, cell_memory_dataspace, cell_file_dataspace, plist_id, &cell_data_vec[0]); + AssertThrow(status >= 0, ExcIO()); + cell_data_vec.clear(); - // when writing, first write out - // all vector data, then handle the - // scalar data sets that have been - // left over - unsigned int i, n, q, r, n_th_vector, data_set, pt_data_vector_dim, mem_vector_dim; - double *pt_data; - std::string vector_name; - for (n_th_vector=0,data_set=0; data_set(vector_data_ranges[n_th_vector]) < data_set) n_th_vector++; + // Close the file dataspaces + status = H5Sclose(node_file_dataspace); + AssertThrow(status >= 0, ExcIO()); + status = H5Sclose(cell_file_dataspace); + AssertThrow(status >= 0, ExcIO()); - // Determine the dimension of this data - if (std_cxx1x::get<0>(vector_data_ranges[n_th_vector]) == data_set) - { - // Multiple dimensions - pt_data_vector_dim = std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) - std_cxx1x::get<0>(vector_data_ranges[n_th_vector])+1; + // Close the memory dataspaces + status = H5Sclose(node_memory_dataspace); + AssertThrow(status >= 0, ExcIO()); + status = H5Sclose(cell_memory_dataspace); + AssertThrow(status >= 0, ExcIO()); - // Ensure the dimensionality of the data is correct - AssertThrow (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) >= std_cxx1x::get<0>(vector_data_ranges[n_th_vector]), - ExcLowerRange (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]), std_cxx1x::get<0>(vector_data_ranges[n_th_vector]))); - AssertThrow (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]) < n_data_sets, - ExcIndexRange (std_cxx1x::get<1>(vector_data_ranges[n_th_vector]), 0, n_data_sets)); + // Close the datasets + status = H5Dclose(node_dataset); + AssertThrow(status >= 0, ExcIO()); + status = H5Dclose(cell_dataset); + AssertThrow(status >= 0, ExcIO()); - // Determine the vector name - // Concatenate all the - // component names with double - // underscores unless a vector - // name has been specified - if (std_cxx1x::get<2>(vector_data_ranges[n_th_vector]) != "") - { - vector_name = std_cxx1x::get<2>(vector_data_ranges[n_th_vector]); - } - else - { - vector_name = ""; - for (i=std_cxx1x::get<0>(vector_data_ranges[n_th_vector]); i(vector_data_ranges[n_th_vector]); ++i) - vector_name += data_names[i] + "__"; - vector_name += data_names[std_cxx1x::get<1>(vector_data_ranges[n_th_vector])]; - } - } - else + // If the filenames are different, we need to close the mesh file + if (mesh_filename != solution_filename) { - // One dimension - pt_data_vector_dim = 1; - vector_name = data_names[data_set]; + status = H5Fclose(h5_mesh_file_id); + AssertThrow(status >= 0, ExcIO()); } + } + // If the filenames are identical, continue with the same file + if (mesh_filename == solution_filename && write_mesh_file) + { + h5_solution_file_id = h5_mesh_file_id; + } + else + { + // Otherwise we need to open a new file + h5_solution_file_id = H5Fcreate(solution_filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, file_plist_id); + AssertThrow(h5_solution_file_id >= 0, ExcIO()); + } + + // when writing, first write out + // all vector data, then handle the + // scalar data sets that have been + // left over + unsigned int i, n, q, r, pt_data_vector_dim; + std::string vector_name; + for (i=0; i1?3:1); - pt_data = new double[local_node_cell_count[0]*mem_vector_dim]; + pt_data_vector_dim = data_filter.get_data_set_dim(i); + vector_name = data_filter.get_data_set_name(i); // Create the dataspace for the point data node_ds_dim[0] = global_node_cell_count[0]; - node_ds_dim[1] = mem_vector_dim; + node_ds_dim[1] = pt_data_vector_dim; pt_data_dataspace = H5Screate_simple(2, node_ds_dim, NULL); AssertThrow(pt_data_dataspace >= 0, ExcIO()); #if H5Gcreate_vers == 1 - pt_data_dataset = H5Dcreate(h5_file_id, vector_name.c_str(), H5T_NATIVE_DOUBLE, pt_data_dataspace, H5P_DEFAULT); + pt_data_dataset = H5Dcreate(h5_solution_file_id, vector_name.c_str(), H5T_NATIVE_DOUBLE, pt_data_dataspace, H5P_DEFAULT); #else - pt_data_dataset = H5Dcreate(h5_file_id, vector_name.c_str(), H5T_NATIVE_DOUBLE, pt_data_dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + pt_data_dataset = H5Dcreate(h5_solution_file_id, vector_name.c_str(), H5T_NATIVE_DOUBLE, pt_data_dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); #endif AssertThrow(pt_data_dataset >= 0, ExcIO()); // Create the data subset we'll use to read from memory count[0] = local_node_cell_count[0]; - count[1] = mem_vector_dim; + count[1] = pt_data_vector_dim; offset[0] = global_node_cell_offsets[0]; offset[1] = 0; pt_data_memory_dataspace = H5Screate_simple(2, count, NULL); @@ -7099,24 +7306,10 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & status = H5Sselect_hyperslab(pt_data_file_dataspace, H5S_SELECT_SET, offset, NULL, count, NULL); AssertThrow(status >= 0, ExcIO()); - // Write point data to the memory array - r = 0; - for (i=0; !empty_proc && i= 0, ExcIO()); - delete pt_data; - // Close the dataspaces status = H5Sclose(pt_data_dataspace); AssertThrow(status >= 0, ExcIO()); @@ -7127,27 +7320,10 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & // Close the dataset status = H5Dclose(pt_data_dataset); AssertThrow(status >= 0, ExcIO()); - - // Advance the current data set - data_set += pt_data_vector_dim; } - // Close the file dataspaces - status = H5Sclose(node_file_dataspace); - AssertThrow(status >= 0, ExcIO()); - status = H5Sclose(cell_file_dataspace); - AssertThrow(status >= 0, ExcIO()); - - // Close the memory dataspaces - status = H5Sclose(node_memory_dataspace); - AssertThrow(status >= 0, ExcIO()); - status = H5Sclose(cell_memory_dataspace); - AssertThrow(status >= 0, ExcIO()); - - // Close the datasets - status = H5Dclose(node_dataset); - AssertThrow(status >= 0, ExcIO()); - status = H5Dclose(cell_dataset); + // Close the file property list + status = H5Pclose(file_plist_id); AssertThrow(status >= 0, ExcIO()); // Close the parallel access @@ -7155,7 +7331,7 @@ void DataOutBase::write_hdf5_parallel (const std::vector > & AssertThrow(status >= 0, ExcIO()); // Close the file - status = H5Fclose(h5_file_id); + status = H5Fclose(h5_solution_file_id); AssertThrow(status >= 0, ExcIO()); #endif #endif diff --git a/deal.II/source/base/dummy.cc b/deal.II/source/base/dummy.cc deleted file mode 100644 index aa82ba52fe..0000000000 --- a/deal.II/source/base/dummy.cc +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Workaround for a bug in the Xcode generator. - * - * This file contains a dummy global symbol to trigger the link phase in - * the generated Xcode project. - */ - -const int _global_symbol_42 = 42; - diff --git a/deal.II/source/base/event.cc b/deal.II/source/base/event.cc index 4c890e4a49..fa701dff14 100644 --- a/deal.II/source/base/event.cc +++ b/deal.II/source/base/event.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/base/exceptions.cc b/deal.II/source/base/exceptions.cc index 10526f1b3d..89350862fc 100644 --- a/deal.II/source/base/exceptions.cc +++ b/deal.II/source/base/exceptions.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/flow_function.cc b/deal.II/source/base/flow_function.cc index 707417138a..92c3b9d727 100644 --- a/deal.II/source/base/flow_function.cc +++ b/deal.II/source/base/flow_function.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/function.cc b/deal.II/source/base/function.cc index 17187a03e4..40c7f30af2 100644 --- a/deal.II/source/base/function.cc +++ b/deal.II/source/base/function.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -591,7 +593,7 @@ vector_value (const Point &p, * to be size n_components. */ template -VectorFunctionFromTensorFunction::VectorFunctionFromTensorFunction (const TensorFunction<1,dim>& tensor_function, +VectorFunctionFromTensorFunction::VectorFunctionFromTensorFunction (const TensorFunction<1,dim> &tensor_function, const unsigned int selected_component, const unsigned int n_components) : diff --git a/deal.II/source/base/function_derivative.cc b/deal.II/source/base/function_derivative.cc index cfa5c9f20a..9fc7182c26 100644 --- a/deal.II/source/base/function_derivative.cc +++ b/deal.II/source/base/function_derivative.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/function_lib.cc b/deal.II/source/base/function_lib.cc index d7df931caa..a1b5efd521 100644 --- a/deal.II/source/base/function_lib.cc +++ b/deal.II/source/base/function_lib.cc @@ -1,15 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/function_lib_cutoff.cc b/deal.II/source/base/function_lib_cutoff.cc index 51c933bfd0..f832590c98 100644 --- a/deal.II/source/base/function_lib_cutoff.cc +++ b/deal.II/source/base/function_lib_cutoff.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/function_parser.cc b/deal.II/source/base/function_parser.cc index 8c6095384e..c26b0594e5 100644 --- a/deal.II/source/base/function_parser.cc +++ b/deal.II/source/base/function_parser.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2009, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/function_time.cc b/deal.II/source/base/function_time.cc index 3c26216f95..b726a6551e 100644 --- a/deal.II/source/base/function_time.cc +++ b/deal.II/source/base/function_time.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/base/geometry_info.cc b/deal.II/source/base/geometry_info.cc index 60c190ee1e..6569451117 100644 --- a/deal.II/source/base/geometry_info.cc +++ b/deal.II/source/base/geometry_info.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -1099,7 +1101,9 @@ unsigned int GeometryInfo<2>::child_cell_on_face (const RefinementCase<2> &ref_case, const unsigned int face, const unsigned int subface, - const bool, const bool face_flip, const bool, + const bool /*face_orientation*/, + const bool face_flip, + const bool /*face_rotation*/, const RefinementCase<1> &) { Assert (face #include @@ -269,6 +271,8 @@ IndexSet::block_read(std::istream &in) if (n_ranges) in.read(reinterpret_cast(&*ranges.begin()), ranges.size() * sizeof(Range)); + + do_compress(); // needed so that largest_range can be recomputed } diff --git a/deal.II/source/base/job_identifier.cc b/deal.II/source/base/job_identifier.cc index 9905187512..c347ce317d 100644 --- a/deal.II/source/base/job_identifier.cc +++ b/deal.II/source/base/job_identifier.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/logstream.cc b/deal.II/source/base/logstream.cc index e0fc350cf5..447ff34110 100644 --- a/deal.II/source/base/logstream.cc +++ b/deal.II/source/base/logstream.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -135,23 +137,65 @@ LogStream::operator<< (std::ostream& (*p) (std::ostream &)) // Print to the internal stringstream: stream << p; - // Next check whether this is the flush or endl - // manipulator, and if so print out the message. - std::ostream & (* const p_flush) (std::ostream &) = &std::flush; - std::ostream & (* const p_endl) (std::ostream &) = &std::endl; - if (p == p_flush || p == p_endl) + + // This is a bloody hack until LogStream got reimplemented as a proper + // child of std::streambuf (or similar). + // + // The problem is that at this point we would like to know whether an + // std::flush or std::endl has called us, however, there is no way to + // detect this in a sane manner. + // + // The obvious idea to compare function pointers, + // std::ostream & (* const p_flush) (std::ostream &) = &std::flush; + // p == p_flush ? ..., + // is wrong as there doesn't has to be a _single_ std::flush instance... + // there could be multiple of it. And in fact, LLVM's libc++ implements + // std::flush and std::endl in a way that every shared library and + // executable has its local copy... fun... + // + // - Maier, 2013 + + class QueryStreambuf : public std::streambuf + { + // Implement a minimalistic stream buffer that only stores the fact + // whether overflow or sync was called + public: + QueryStreambuf() + : flushed_(false), newline_written_(false) + { + } + bool flushed() { return flushed_; } + bool newline_written() { return newline_written_; } + private: + int_type overflow(int_type ch) + { + newline_written_ = true; + return ch; + } + int sync() + { + flushed_ = true; + return 0; + } + bool flushed_; + bool newline_written_; + } query_streambuf; + + { + // and initialize an ostream with this streambuf: + std::ostream inject (&query_streambuf); + inject << p; + } + + if (query_streambuf.flushed()) { Threads::Mutex::ScopedLock lock(write_lock); - // Print the line head in case of a newline: + // Print the line head in case of a previous newline: if (at_newline) print_line_head(); - if(p == p_flush) - at_newline = false; - - if(p == p_endl) - at_newline = true; + at_newline = query_streambuf.newline_written(); if (get_prefixes().size() <= std_depth) *std_out << stream.str(); @@ -159,7 +203,7 @@ LogStream::operator<< (std::ostream& (*p) (std::ostream &)) if (file && (get_prefixes().size() <= file_depth)) *file << stream.str() << std::flush; - // Start a new string + // Start a new string: stream.str(""); } @@ -226,14 +270,22 @@ LogStream::has_file() const const std::string & LogStream::get_prefix() const { - return get_prefixes().top(); + static std::string empty_string; + + if (get_prefixes().size() > 0) + return get_prefixes().top(); + else + return empty_string; } void LogStream::push (const std::string &text) { - std::string pre=get_prefixes().top(); + std::string pre; + if (get_prefixes().size() > 0) + pre = get_prefixes().top(); + pre += text; pre += std::string(":"); get_prefixes().push(pre); @@ -242,7 +294,7 @@ LogStream::push (const std::string &text) void LogStream::pop () { - if (get_prefixes().size() > 1) + if (get_prefixes().size() > 0) get_prefixes().pop(); } @@ -342,7 +394,7 @@ LogStream::get_prefixes() const // If this is a new locally stored stack, copy the "blessed" prefixes // from the initial thread that created logstream. - if(! exists) + if (! exists) { const tbb::enumerable_thread_specific > &impl = prefixes.get_implementation(); @@ -436,7 +488,8 @@ LogStream::print_line_head() if (print_thread_id) *std_out << '[' << thread << ']'; - *std_out << head << ':'; + if (head.size() > 0) + *std_out << head << ':'; } if (file && (get_prefixes().size() <= file_depth)) @@ -453,7 +506,8 @@ LogStream::print_line_head() if (print_thread_id) *file << '[' << thread << ']'; - *file << head << ':'; + if (head.size() > 0) + *file << head << ':'; } } diff --git a/deal.II/source/base/memory_consumption.cc b/deal.II/source/base/memory_consumption.cc index 8ecaa085f6..ab523c4143 100644 --- a/deal.II/source/base/memory_consumption.cc +++ b/deal.II/source/base/memory_consumption.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/base/mpi.cc b/deal.II/source/base/mpi.cc index 4a1c99c7bb..4b93f9be56 100644 --- a/deal.II/source/base/mpi.cc +++ b/deal.II/source/base/mpi.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -308,10 +312,10 @@ namespace Utilities MPI_InitFinalize::MPI_InitFinalize (int &argc, - char ** &argv, - unsigned int max_num_threads) - : - owns_mpi (true) + char ** &argv, + unsigned int max_num_threads) + : + owns_mpi (true) { do_init(argc, argv, max_num_threads); } @@ -330,24 +334,17 @@ namespace Utilities void MPI_InitFinalize::do_init(int &argc, - char ** &argv, - unsigned int max_num_threads) + char ** &argv, + unsigned int max_num_threads) { static bool constructor_has_already_run = false; Assert (constructor_has_already_run == false, ExcMessage ("You can only create a single object of this class " "in a program since it initializes the MPI system.")); -#ifdef DEAL_II_WITH_PETSC -# ifdef DEAL_II_WITH_SLEPC - // Initialise SLEPc (with PETSc): - SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); -# else - // or just initialise PETSc alone: - PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); -# endif -#else -# ifdef DEAL_II_WITH_MPI + + +#ifdef DEAL_II_WITH_MPI // if we have PETSc, we will initialize it and let it handle MPI. // Otherwise, we will do it. int MPI_has_been_started = 0; @@ -355,16 +352,36 @@ namespace Utilities AssertThrow (MPI_has_been_started == 0, ExcMessage ("MPI error. You can only start MPI once!")); - int mpi_err; - mpi_err = MPI_Init (&argc, &argv); + int mpi_err, provided; + // this works likempi_err = MPI_Init (&argc, &argv); but tells MPI that + // we might use several threads but never call two MPI functions at the + // same time. For an explanation see on why we do this see + // http://www.open-mpi.org/community/lists/users/2010/03/12244.php + int wanted = MPI_THREAD_SERIALIZED; + mpi_err = MPI_Init_thread(&argc, &argv, wanted, &provided); AssertThrow (mpi_err == 0, ExcMessage ("MPI could not be initialized.")); -# else + + // disable for now because at least some implementations always return MPI_THREAD_SINGLE. + //Assert(max_num_threads==1 || provided != MPI_THREAD_SINGLE, + // ExcMessage("MPI reports that we are not allowed to use multiple threads.")); +#else // make sure the compiler doesn't warn // about these variables (void)argc; (void)argv; (void)owns_mpi; +#endif + + // we are allowed to call MPI_Init ourselves and PETScInitialize will + // detect this. This allows us to use MPI_Init_thread instead. +#ifdef DEAL_II_WITH_PETSC +# ifdef DEAL_II_WITH_SLEPC + // Initialize SLEPc (with PETSc): + SlepcInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); +# else + // or just initialize PETSc alone: + PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); # endif #endif @@ -418,15 +435,15 @@ namespace Utilities // or just end PETSc. PetscFinalize(); # endif - } -#endif + } +#endif - // only MPI_Finalize if we are running with MPI and we are not using PETSc - // (otherwise we called it above already): + // only MPI_Finalize if we are running with MPI. We also need to do this + // when running PETSc, because we initialize MPI ourselves before calling + // PetscInitialize #ifdef DEAL_II_WITH_MPI -#ifndef DEAL_II_WITH_PETSC - int mpi_err = 0; + int mpi_err = 0; int MPI_has_been_started = 0; MPI_Initialized(&MPI_has_been_started); @@ -447,7 +464,6 @@ namespace Utilities AssertThrow (mpi_err == 0, ExcMessage ("An error occurred while calling MPI_Finalize()")); -#endif #endif } diff --git a/deal.II/source/base/multithread_info.cc b/deal.II/source/base/multithread_info.cc index f871f7bf47..e79373d0aa 100644 --- a/deal.II/source/base/multithread_info.cc +++ b/deal.II/source/base/multithread_info.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -100,7 +102,7 @@ unsigned int MultithreadInfo::get_n_cpus() void MultithreadInfo::set_thread_limit(const unsigned int max_threads) { unsigned int max_threads_env = numbers::invalid_unsigned_int; - char* penv; + char *penv; penv = getenv ("DEAL_II_NUM_THREADS"); if (penv!=NULL) @@ -110,9 +112,9 @@ void MultithreadInfo::set_thread_limit(const unsigned int max_threads) if (n_max_threads == numbers::invalid_unsigned_int) n_max_threads = tbb::task_scheduler_init::default_num_threads(); else - { + { static tbb::task_scheduler_init dummy (n_max_threads); - } + } } bool MultithreadInfo::is_running_single_threaded() diff --git a/deal.II/source/base/parallel.cc b/deal.II/source/base/parallel.cc index 3213ecb19b..8878471bb4 100644 --- a/deal.II/source/base/parallel.cc +++ b/deal.II/source/base/parallel.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/base/parameter_handler.cc b/deal.II/source/base/parameter_handler.cc index 6268cca617..267fef855e 100644 --- a/deal.II/source/base/parameter_handler.cc +++ b/deal.II/source/base/parameter_handler.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -429,14 +433,18 @@ namespace Patterns List::List (const PatternBase &p, const unsigned int min_elements, - const unsigned int max_elements) + const unsigned int max_elements, + const std::string &separator) : pattern (p.clone()), min_elements (min_elements), - max_elements (max_elements) + max_elements (max_elements), + separator (separator) { Assert (min_elements <= max_elements, ExcInvalidRange (min_elements, max_elements)); + Assert (separator.size() > 0, + ExcMessage ("The separator must have a non-zero length.")); } @@ -453,7 +461,6 @@ namespace Patterns { std::string tmp = test_string_list; std::vector split_list; - split_list.reserve (std::count (tmp.begin(), tmp.end(), ',')+1); // first split the input list while (tmp.length() != 0) @@ -461,10 +468,10 @@ namespace Patterns std::string name; name = tmp; - if (name.find(",") != std::string::npos) + if (name.find(separator) != std::string::npos) { - name.erase (name.find(","), std::string::npos); - tmp.erase (0, tmp.find(",")+1); + name.erase (name.find(separator), std::string::npos); + tmp.erase (0, tmp.find(separator)+separator.size()); } else tmp = ""; @@ -477,7 +484,7 @@ namespace Patterns name.erase (name.length()-1, 1); split_list.push_back (name); - }; + } if ((split_list.size() < min_elements) || (split_list.size() > max_elements)) @@ -502,8 +509,10 @@ namespace Patterns description << description_init << " list of <" << pattern->description() << ">" << " of length " << min_elements << "..." << max_elements - << " (inclusive)" - << "]"; + << " (inclusive)"; + if (separator != ",") + description << " separated by <" << separator << ">"; + description << "]"; return description.str(); } @@ -513,7 +522,7 @@ namespace Patterns PatternBase * List::clone () const { - return new List(*pattern, min_elements, max_elements); + return new List(*pattern, min_elements, max_elements, separator); } @@ -521,7 +530,8 @@ namespace Patterns List::memory_consumption () const { return (sizeof(*this) + - MemoryConsumption::memory_consumption(*pattern)); + MemoryConsumption::memory_consumption(*pattern) + + MemoryConsumption::memory_consumption(separator)); } @@ -548,7 +558,14 @@ namespace Patterns if (!(is >> max_elements)) return new List(*base_pattern, min_elements); - return new List(*base_pattern, min_elements, max_elements); + is.ignore(strlen(" separated by <")); + std::string separator; + if (!is) + std::getline(is, separator, '>'); + else + separator = ","; + + return new List(*base_pattern, min_elements, max_elements, separator); } else return 0; @@ -565,15 +582,22 @@ namespace Patterns Map::Map (const PatternBase &p_key, const PatternBase &p_value, const unsigned int min_elements, - const unsigned int max_elements) + const unsigned int max_elements, + const std::string &separator) : key_pattern (p_key.clone()), value_pattern (p_value.clone()), min_elements (min_elements), - max_elements (max_elements) + max_elements (max_elements), + separator (separator) { Assert (min_elements <= max_elements, ExcInvalidRange (min_elements, max_elements)); + Assert (separator.size() > 0, + ExcMessage ("The separator must have a non-zero length.")); + Assert (separator != ":", + ExcMessage ("The separator can not be a colon ':' sicne that " + "is the separator between the two elements of pairs")); } @@ -593,7 +617,6 @@ namespace Patterns { std::string tmp = test_string_list; std::vector split_list; - split_list.reserve (std::count (tmp.begin(), tmp.end(), ',')+1); // first split the input list at comma sites while (tmp.length() != 0) @@ -601,10 +624,10 @@ namespace Patterns std::string map_entry; map_entry = tmp; - if (map_entry.find(",") != std::string::npos) + if (map_entry.find(separator) != std::string::npos) { - map_entry.erase (map_entry.find(","), std::string::npos); - tmp.erase (0, tmp.find(",")+1); + map_entry.erase (map_entry.find(separator), std::string::npos); + tmp.erase (0, tmp.find(separator)+separator.size()); } else tmp = ""; @@ -617,7 +640,7 @@ namespace Patterns map_entry.erase (map_entry.length()-1, 1); split_list.push_back (map_entry); - }; + } if ((split_list.size() < min_elements) || (split_list.size() > max_elements)) @@ -665,8 +688,10 @@ namespace Patterns << key_pattern->description() << ":" << value_pattern->description() << ">" << " of length " << min_elements << "..." << max_elements - << " (inclusive)" - << "]"; + << " (inclusive)"; + if (separator != ",") + description << " separated by <" << separator << ">"; + description << "]"; return description.str(); } @@ -676,7 +701,9 @@ namespace Patterns PatternBase * Map::clone () const { - return new Map(*key_pattern, *value_pattern, min_elements, max_elements); + return new Map(*key_pattern, *value_pattern, + min_elements, max_elements, + separator); } @@ -685,7 +712,8 @@ namespace Patterns { return (sizeof(*this) + MemoryConsumption::memory_consumption (*key_pattern) + - MemoryConsumption::memory_consumption (*value_pattern)); + MemoryConsumption::memory_consumption (*value_pattern) + + MemoryConsumption::memory_consumption (separator)); } @@ -720,7 +748,16 @@ namespace Patterns if (!(is >> max_elements)) return new Map(*key_pattern, *value_pattern, min_elements); - return new Map(*key_pattern, *value_pattern, min_elements, max_elements); + is.ignore(strlen(" separated by <")); + std::string separator; + if (!is) + std::getline(is, separator, '>'); + else + separator = ","; + + return new Map(*key_pattern, *value_pattern, + min_elements, max_elements, + separator); } else return 0; @@ -1081,20 +1118,20 @@ ParameterHandler::mangle (const std::string &s) for (unsigned int i=0; i(s[i])/16]); - u.push_back (hex[static_cast(s[i])%16]); - } + { + u.push_back ('_'); + static const char hex[16] + = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; + u.push_back (hex[static_cast(s[i])/16]); + u.push_back (hex[static_cast(s[i])%16]); + } } return u; @@ -1276,7 +1313,8 @@ ParameterHandler::get_current_full_path (const std::string &name) const -bool ParameterHandler::read_input (std::istream &input) +bool ParameterHandler::read_input (std::istream &input, + const std::string &filename) { AssertThrow (input, ExcIO()); @@ -1288,8 +1326,7 @@ bool ParameterHandler::read_input (std::istream &input) { ++lineno; getline (input, line); - if (!scan_line (line, lineno)) - status = false; + status &= scan_line (line, filename, lineno); } return status; @@ -1309,7 +1346,7 @@ bool ParameterHandler::read_input (const std::string &filename, std::ifstream input (openname.c_str()); AssertThrow(input, ExcIO()); - return read_input (input); + return read_input (input, filename); } catch (const PathSearch::ExcFileNotFound &) { @@ -1331,34 +1368,10 @@ bool ParameterHandler::read_input (const std::string &filename, bool ParameterHandler::read_input_from_string (const char *s) { - // if empty std::string then exit - // with success - if ((s == 0) || ((*s) == 0)) return true; - - std::string line; - std::string input (s); - int lineno=0; - - // if necessary append a newline char - // to make all lines equal - if (input[input.length()-1] != '\n') - input += '\n'; - - bool status = true; - while (input.size() != 0) - { - // get one line from Input (=s) - line.assign (input, 0, input.find('\n')); - // delete this part including - // the backspace - input.erase (0, input.find('\n')+1); - ++lineno; - - if (!scan_line (line, lineno)) - status = false; - } - - return status; + // create an istringstream representation and pass it off + // to the other functions doing this work + std::istringstream in (s); + return read_input (in, "input string"); } @@ -1567,6 +1580,10 @@ ParameterHandler::declare_entry (const std::string &entry, entries->put (get_current_full_path(entry) + path_separator + "pattern_description", patterns.back()->description()); + + // as documented, do the default value checking at the very end + AssertThrow (pattern.match (default_value), + ExcValueDoesNotMatchPattern (default_value, pattern.description())); } @@ -2238,8 +2255,9 @@ ParameterHandler::log_parameters_section (LogStream &out) bool -ParameterHandler::scan_line (std::string line, - const unsigned int lineno) +ParameterHandler::scan_line (std::string line, + const std::string &input_filename, + const unsigned int lineno) { // if there is a comment, delete it if (line.find('#') != std::string::npos) @@ -2252,11 +2270,14 @@ ParameterHandler::scan_line (std::string line, line.erase (line.find(" "), 1); // now every existing whitespace // should be exactly one ' '; - // if at end or beginning: delete - if ((line.length() != 0) && (std::isspace (line[0]))) line.erase (0, 1); + // if at beginning: delete + if ((line.length() != 0) && (std::isspace (line[0]))) + line.erase (0, 1); // if line is now empty: leave - if (line.length() == 0) return true; + if (line.length() == 0) + return true; + // also delete spaces at the end if (std::isspace (line[line.length()-1])) line.erase (line.size()-1, 1); @@ -2272,8 +2293,9 @@ ParameterHandler::scan_line (std::string line, // check whether subsection exists if (!entries->get_child_optional (get_current_full_path(subsection))) { - std::cerr << "Line " << lineno - << ": There is no such subsection to be entered: " + std::cerr << "Line <" << lineno + << "> of file <" << input_filename + << ">: There is no such subsection to be entered: " << demangle(get_current_full_path(subsection)) << std::endl; for (unsigned int i=0; i of file <" << input_filename + << ">: There is no subsection to leave here!" << std::endl; return false; } else @@ -2336,7 +2359,9 @@ ParameterHandler::scan_line (std::string line, = entries->get (get_current_full_path(entry_name) + path_separator + "pattern"); if (!patterns[pattern_index]->match(entry_value)) { - std::cerr << "Line " << lineno << ":" << std::endl + std::cerr << "Line <" << lineno + << "> of file <" << input_filename + << ">:" << std::endl << " The entry value" << std::endl << " " << entry_value << std::endl << " for the entry named" << std::endl @@ -2354,8 +2379,9 @@ ParameterHandler::scan_line (std::string line, } else { - std::cerr << "Line " << lineno - << ": No such entry was declared:" << std::endl + std::cerr << "Line <" << lineno + << "> of file <" << input_filename + << ">: No such entry was declared:" << std::endl << " " << entry_name << std::endl << " of file <" << input_filename + << "> is an include statement but does not name a file!" + << std::endl; + + return false; + } + + std::ifstream input (line.c_str()); + if (!input) + { + std::cerr << "Line <" << lineno + << "> of file <" << input_filename + << "> is an include statement but the file <" + << line << "> could not be opened!" + << std::endl; + + return false; + } + else + return read_input (input); + } + // this line matched nothing known - std::cerr << "Line " << lineno - << ": This line matched nothing known ('set' or 'subsection' missing!?):" << std::endl + std::cerr << "Line <" << lineno + << "> of file <" << input_filename + << ">: This line matched nothing known ('set' or 'subsection' missing!?):" << std::endl << " " << line << std::endl; return false; } @@ -2428,11 +2491,12 @@ MultipleParameterLoop::~MultipleParameterLoop () -bool MultipleParameterLoop::read_input (std::istream &input) +bool MultipleParameterLoop::read_input (std::istream &input, + const std::string &filename) { AssertThrow (input, ExcIO()); - bool x = ParameterHandler::read_input (input); + bool x = ParameterHandler::read_input (input, filename); if (x) init_branches (); return x; diff --git a/deal.II/source/base/parsed_function.cc b/deal.II/source/base/parsed_function.cc index 42540badf2..14b975a039 100644 --- a/deal.II/source/base/parsed_function.cc +++ b/deal.II/source/base/parsed_function.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/partitioner.cc b/deal.II/source/base/partitioner.cc index 01fa8a5736..b800411896 100644 --- a/deal.II/source/base/partitioner.cc +++ b/deal.II/source/base/partitioner.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -120,10 +122,9 @@ namespace Utilities void Partitioner::set_ghost_indices (const IndexSet &ghost_indices_in) { - // Set ghost indices from input. To be sure - // that no entries from the locally owned - // range are present, subtract the locally - // owned indices in any case. + // Set ghost indices from input. To be sure that no entries from the + // locally owned range are present, subtract the locally owned indices + // in any case. Assert (ghost_indices_in.n_elements() == 0 || ghost_indices_in.size() == locally_owned_range_data.size(), ExcDimensionMismatch (ghost_indices_in.size(), @@ -135,18 +136,14 @@ namespace Utilities ghost_indices_data.compress(); n_ghost_indices_data = ghost_indices_data.n_elements(); - // In the rest of this function, we determine - // the point-to-point communication pattern of - // the partitioner. We make up a list with - // both the processors the ghost indices - // actually belong to, and the indices that - // are locally held but ghost indices of other - // processors. This allows then to import and - // export data very easily. - - // find out the end index for each processor - // and communicate it (this implies the start - // index for the next processor) + // In the rest of this function, we determine the point-to-point + // communication pattern of the partitioner. We make up a list with both + // the processors the ghost indices actually belong to, and the indices + // that are locally held but ghost indices of other processors. This + // allows then to import and export data very easily. + + // find out the end index for each processor and communicate it (this + // implies the start index for the next processor) #ifdef DEAL_II_WITH_MPI if (n_procs < 2) { @@ -163,9 +160,8 @@ namespace Utilities MPI_BYTE, communicator); first_index[n_procs] = global_size; - // fix case when there are some processors - // without any locally owned indices: then - // there might be a zero in some entries + // fix case when there are some processors without any locally owned + // indices: then there might be a zero in some entries if (global_size > 0) { unsigned int first_proc_with_nonzero_dofs = 0; @@ -179,8 +175,7 @@ namespace Utilities if (first_index[i] == 0) first_index[i] = first_index[i-1]; - // correct if our processor has a wrong local - // range + // correct if our processor has a wrong local range if (first_index[my_pid] != local_range_data.first) { Assert(local_range_data.first == local_range_data.second, @@ -189,20 +184,16 @@ namespace Utilities } } - // Allocate memory for data that will be - // exported + // Allocate memory for data that will be exported std::vector expanded_ghost_indices (n_ghost_indices_data); unsigned int n_ghost_targets = 0; if (n_ghost_indices_data > 0) { - // Create first a vector of ghost_targets from - // the list of ghost indices and then push - // back new values. When we are done, copy the - // data to that field of the partitioner. This - // way, the variable ghost_targets will have - // exactly the size we need, whereas the - // vector filled with push_back might actually - // be too long. + // Create first a vector of ghost_targets from the list of ghost + // indices and then push back new values. When we are done, copy the + // data to that field of the partitioner. This way, the variable + // ghost_targets will have exactly the size we need, whereas the + // vector filled with push_back might actually be too long. unsigned int current_proc = 0; ghost_indices_data.fill_index_vector (expanded_ghost_indices); unsigned int current_index = expanded_ghost_indices[0]; @@ -231,8 +222,7 @@ namespace Utilities n_ghost_indices_data - ghost_targets_temp[n_ghost_targets-1].second; ghost_targets_data = ghost_targets_temp; } - // find the processes that want to import to - // me + // find the processes that want to import to me { std::vector send_buffer (n_procs, 0); std::vector receive_buffer (n_procs, 0); @@ -255,9 +245,8 @@ namespace Utilities import_targets_data = import_targets_temp; } - // send and receive indices for import - // data. non-blocking receives and blocking - // sends + // send and receive indices for import data. non-blocking receives and + // blocking sends std::vector expanded_import_indices (n_import_indices_data); { unsigned int current_index_start = 0; @@ -288,9 +277,8 @@ namespace Utilities MPI_Waitall (import_requests.size(), &import_requests[0], MPI_STATUSES_IGNORE); - // transform import indices to local index - // space and compress contiguous indices in - // form of ranges + // transform import indices to local index space and compress + // contiguous indices in form of ranges { types::global_dof_index last_index = numbers::invalid_dof_index-1; std::vector > compressed_import_indices; @@ -301,7 +289,7 @@ namespace Utilities ExcIndexRange(expanded_import_indices[i], local_range_data.first, local_range_data.second)); types::global_dof_index new_index = (expanded_import_indices[i] - - local_range_data.first); + local_range_data.first); if (new_index == last_index+1) compressed_import_indices.back().second++; else diff --git a/deal.II/source/base/path_search.cc b/deal.II/source/base/path_search.cc index ea90d33df5..6d3e0a5eef 100644 --- a/deal.II/source/base/path_search.cc +++ b/deal.II/source/base/path_search.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/polynomial.cc b/deal.II/source/base/polynomial.cc index 7d399b31c0..cd0b61f7e9 100644 --- a/deal.II/source/base/polynomial.cc +++ b/deal.II/source/base/polynomial.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/polynomial_space.cc b/deal.II/source/base/polynomial_space.cc index 2852f213af..50d465f92b 100644 --- a/deal.II/source/base/polynomial_space.cc +++ b/deal.II/source/base/polynomial_space.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/polynomials_abf.cc b/deal.II/source/base/polynomials_abf.cc index 4d40d68db7..1486a67e7e 100644 --- a/deal.II/source/base/polynomials_abf.cc +++ b/deal.II/source/base/polynomials_abf.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/polynomials_adini.cc b/deal.II/source/base/polynomials_adini.cc index fe385f82ce..bd9519847a 100644 --- a/deal.II/source/base/polynomials_adini.cc +++ b/deal.II/source/base/polynomials_adini.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/base/polynomials_bdm.cc b/deal.II/source/base/polynomials_bdm.cc index f1b1f2adda..09eefae3e6 100644 --- a/deal.II/source/base/polynomials_bdm.cc +++ b/deal.II/source/base/polynomials_bdm.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/polynomials_nedelec.cc b/deal.II/source/base/polynomials_nedelec.cc index c49950f954..2bd51e6643 100644 --- a/deal.II/source/base/polynomials_nedelec.cc +++ b/deal.II/source/base/polynomials_nedelec.cc @@ -1,3 +1,19 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include #include diff --git a/deal.II/source/base/polynomials_p.cc b/deal.II/source/base/polynomials_p.cc index 93ddc1d51d..51112449d0 100644 --- a/deal.II/source/base/polynomials_p.cc +++ b/deal.II/source/base/polynomials_p.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/base/polynomials_piecewise.cc b/deal.II/source/base/polynomials_piecewise.cc index 70a259ffa4..facd247735 100644 --- a/deal.II/source/base/polynomials_piecewise.cc +++ b/deal.II/source/base/polynomials_piecewise.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -72,7 +74,7 @@ namespace Polynomials } } else - { + { const double offset = step * interval; if (xoffset+step) { diff --git a/deal.II/source/base/polynomials_raviart_thomas.cc b/deal.II/source/base/polynomials_raviart_thomas.cc index 367b2443e1..e880e1c38f 100644 --- a/deal.II/source/base/polynomials_raviart_thomas.cc +++ b/deal.II/source/base/polynomials_raviart_thomas.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/quadrature.cc b/deal.II/source/base/quadrature.cc index df037e405f..ef9aa1bf2b 100644 --- a/deal.II/source/base/quadrature.cc +++ b/deal.II/source/base/quadrature.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/quadrature_lib.cc b/deal.II/source/base/quadrature_lib.cc index bee1e324b0..bd328b4e00 100644 --- a/deal.II/source/base/quadrature_lib.cc +++ b/deal.II/source/base/quadrature_lib.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/quadrature_selector.cc b/deal.II/source/base/quadrature_selector.cc index 0d5b8054f4..e417c10f30 100644 --- a/deal.II/source/base/quadrature_selector.cc +++ b/deal.II/source/base/quadrature_selector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/base/subscriptor.cc b/deal.II/source/base/subscriptor.cc index 17278853fa..fa2af252e4 100644 --- a/deal.II/source/base/subscriptor.cc +++ b/deal.II/source/base/subscriptor.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -69,13 +71,6 @@ Subscriptor::~Subscriptor () // running the c++filt program over // the output. #ifdef DEBUG - std::string infostring; - for (map_iterator it = counter_map.begin(); it != counter_map.end(); ++it) - { - if (it->second > 0) - infostring += std::string("\n from Subscriber ") - + std::string(it->first); - } // if there are still active pointers, show // a message and kill the program. However, @@ -99,6 +94,17 @@ Subscriptor::~Subscriptor () { if (std::uncaught_exception() == false) { + std::string infostring; + for (map_iterator it = counter_map.begin(); it != counter_map.end(); ++it) + { + if (it->second > 0) + infostring += std::string("\n from Subscriber ") + + std::string(it->first); + } + + if (infostring == "") + infostring = ""; + Assert (counter == 0, ExcInUse (counter, object_info->name(), infostring)); } diff --git a/deal.II/source/base/symmetric_tensor.cc b/deal.II/source/base/symmetric_tensor.cc index e286323981..6df63ebf92 100644 --- a/deal.II/source/base/symmetric_tensor.cc +++ b/deal.II/source/base/symmetric_tensor.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/base/table_handler.cc b/deal.II/source/base/table_handler.cc index d9b500718c..831434c98d 100644 --- a/deal.II/source/base/table_handler.cc +++ b/deal.II/source/base/table_handler.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -341,25 +343,62 @@ void TableHandler::write_text(std::ostream &out, const unsigned int nrows = n_rows(); const unsigned int n_cols = sel_columns.size(); - // handle the simple format separately first - if (format==simple_table_with_separate_column_description) + // cache the columns and compute the widths of each column for alignment + std::vector cols; + std::vector column_widths (n_cols, 0); + for (unsigned int j=0; j::const_iterator + col_iter=columns.find(key); + Assert(col_iter!=columns.end(), ExcInternalError()); + cols.push_back(&(col_iter->second)); + + column_widths[j] = col_iter->second.max_length; + } + + switch (format) + { + case org_mode_table: { // write the captions + out << "| " << std::left; for (unsigned int j=0; j cols; + out << std::flush; + return; + } + + case simple_table_with_separate_column_description: + { + // write the captions for (unsigned int j=0; j::const_iterator - col_iter=columns.find(key); - Assert(col_iter!=columns.end(), ExcInternalError()); - cols.push_back(&(col_iter->second)); + const std::string &key = sel_columns[j]; + out << "# " << j+1 << ": " << key << '\n'; } // write the body @@ -378,33 +417,21 @@ void TableHandler::write_text(std::ostream &out, out << std::flush; return; } - - // cache the columns and compute the widths of each column for alignment - std::vector cols; - std::vector column_widths (n_cols, 0); - for (unsigned int j=0; j::const_iterator - col_iter=columns.find(key); - Assert(col_iter!=columns.end(), ExcInternalError()); - cols.push_back(&(col_iter->second)); - - column_widths[j] = col_iter->second.max_length; - } - - // writing the captions for table_with_separate_column_description - // means that we ignore supercolumns and output the column - // header for each column. enumerate columns starting with 1 - if (format == table_with_separate_column_description) + + case table_with_separate_column_description: { + // writing the captions for table_with_separate_column_description + // means that we ignore supercolumns and output the column + // header for each column. enumerate columns starting with 1 for (unsigned int j=0; j #include @@ -21,6 +23,7 @@ DEAL_II_NAMESPACE_OPEN + ////////////////////////////////////////////////////////////////////// // TensorFunction ////////////////////////////////////////////////////////////////////// @@ -82,6 +85,90 @@ TensorFunction::gradient_list (const std::vector > &poin } + +////////////////////////////////////////////////////////////////////// +// ConstantTensorFunction +////////////////////////////////////////////////////////////////////// + + +template +ConstantTensorFunction::ConstantTensorFunction (const Tensor &value, + const double initial_time) + : + TensorFunction (initial_time), + _value(value) +{} + + +template +ConstantTensorFunction::~ConstantTensorFunction () +{} + + +template +typename TensorFunction::value_type +ConstantTensorFunction::value (const Point &/*point*/) const +{ + return _value; +} + + +template +void +ConstantTensorFunction::value_list (const std::vector > &points, + std::vector::value_type> &values) const +{ + Assert (values.size() == points.size(), + ExcDimensionMismatch(values.size(), points.size())); + + for (unsigned int i=0; i +typename TensorFunction::gradient_type +ConstantTensorFunction::gradient (const Point &) const +{ + static const Tensor zero; + + return zero; +} + + +template +void +ConstantTensorFunction::gradient_list (const std::vector > &points, + std::vector::gradient_type> &gradients) const +{ + Assert (gradients.size() == points.size(), + ExcDimensionMismatch(gradients.size(), points.size())); + + static const Tensor zero; + + for (unsigned int i=0; i +ZeroTensorFunction::ZeroTensorFunction (const double initial_time) + : + ConstantTensorFunction (dealii::Tensor(), initial_time) +{} + + + +////////////////////////////////////////////////////////////////////// +// Explicit instantiations: +////////////////////////////////////////////////////////////////////// + template class TensorFunction<1,1>; template class TensorFunction<2,1>; template class TensorFunction<3,1>; @@ -95,4 +182,31 @@ template class TensorFunction<2,3>; template class TensorFunction<3,3>; template class TensorFunction<4,3>; +template class ConstantTensorFunction<1,1>; +template class ConstantTensorFunction<2,1>; +template class ConstantTensorFunction<3,1>; +template class ConstantTensorFunction<4,1>; +template class ConstantTensorFunction<1,2>; +template class ConstantTensorFunction<2,2>; +template class ConstantTensorFunction<3,2>; +template class ConstantTensorFunction<4,2>; +template class ConstantTensorFunction<1,3>; +template class ConstantTensorFunction<2,3>; +template class ConstantTensorFunction<3,3>; +template class ConstantTensorFunction<4,3>; + +template class ZeroTensorFunction<1,1>; +template class ZeroTensorFunction<2,1>; +template class ZeroTensorFunction<3,1>; +template class ZeroTensorFunction<4,1>; +template class ZeroTensorFunction<1,2>; +template class ZeroTensorFunction<2,2>; +template class ZeroTensorFunction<3,2>; +template class ZeroTensorFunction<4,2>; +template class ZeroTensorFunction<1,3>; +template class ZeroTensorFunction<2,3>; +template class ZeroTensorFunction<3,3>; +template class ZeroTensorFunction<4,3>; + + DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/base/tensor_product_polynomials.cc b/deal.II/source/base/tensor_product_polynomials.cc index 7a9329fa1a..318f022658 100644 --- a/deal.II/source/base/tensor_product_polynomials.cc +++ b/deal.II/source/base/tensor_product_polynomials.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -33,7 +35,7 @@ namespace internal void compute_tensor_index(const unsigned int, const unsigned int, const unsigned int, - unsigned int (&)[dim]) + unsigned int ( &)[dim]) { Assert(false, ExcNotImplemented()); } diff --git a/deal.II/source/base/tensor_product_polynomials_const.cc b/deal.II/source/base/tensor_product_polynomials_const.cc index 6d6e6876b2..724114c4ad 100644 --- a/deal.II/source/base/tensor_product_polynomials_const.cc +++ b/deal.II/source/base/tensor_product_polynomials_const.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id: trilinos_sparse_matrix.cc 27985 2013-01-08 21:36:23Z bangerth $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012, 2013 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/base/thread_management.cc b/deal.II/source/base/thread_management.cc index 47a3859120..5f9d75edc8 100644 --- a/deal.II/source/base/thread_management.cc +++ b/deal.II/source/base/thread_management.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/base/timer.cc b/deal.II/source/base/timer.cc index 2c0b9cf2f9..d931000e82 100644 --- a/deal.II/source/base/timer.cc +++ b/deal.II/source/base/timer.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -329,7 +331,7 @@ TimerOutput::~TimerOutput() leave_subsection(); if ( (output_frequency == summary || output_frequency == every_call_and_summary) - && output_is_enabled == true) + && output_is_enabled == true) print_summary(); } diff --git a/deal.II/source/base/utilities.cc b/deal.II/source/base/utilities.cc index 6132d45762..16c8d1ab31 100644 --- a/deal.II/source/base/utilities.cc +++ b/deal.II/source/base/utilities.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/distributed/CMakeLists.txt b/deal.II/source/distributed/CMakeLists.txt index 3334e88d9a..4bb6e252cd 100644 --- a/deal.II/source/distributed/CMakeLists.txt +++ b/deal.II/source/distributed/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/distributed/*.h - ) - SET(_src grid_refinement.cc solution_transfer.cc @@ -30,6 +28,9 @@ SET(_inst tria.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/distributed/*.h + ) + DEAL_II_ADD_LIBRARY(obj_distributed OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_distributed "${_inst}") - diff --git a/deal.II/source/distributed/grid_refinement.cc b/deal.II/source/distributed/grid_refinement.cc index 28acfffcd6..9b89144f91 100644 --- a/deal.II/source/distributed/grid_refinement.cc +++ b/deal.II/source/distributed/grid_refinement.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/distributed/grid_refinement.inst.in b/deal.II/source/distributed/grid_refinement.inst.in index ab54188964..556d53ea75 100644 --- a/deal.II/source/distributed/grid_refinement.inst.in +++ b/deal.II/source/distributed/grid_refinement.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + diff --git a/deal.II/source/distributed/solution_transfer.cc b/deal.II/source/distributed/solution_transfer.cc index c328a6e230..f5aced6a3e 100644 --- a/deal.II/source/distributed/solution_transfer.cc +++ b/deal.II/source/distributed/solution_transfer.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/distributed/solution_transfer.inst.in b/deal.II/source/distributed/solution_transfer.inst.in index 70d0ef4fab..d4b2ace584 100644 --- a/deal.II/source/distributed/solution_transfer.inst.in +++ b/deal.II/source/distributed/solution_transfer.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/distributed/tria.cc b/deal.II/source/distributed/tria.cc index f18e075130..5b0caa979f 100644 --- a/deal.II/source/distributed/tria.cc +++ b/deal.II/source/distributed/tria.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -19,8 +23,8 @@ #include #include #include -#include #include +#include #ifdef DEAL_II_WITH_P4EST # include @@ -28,12 +32,14 @@ # include # include # include +# include # include # include # include # include # include +# include #endif #include @@ -52,21 +58,11 @@ namespace internal namespace p4est { /** - * A structure whose explicit - * specializations contain - * pointers to the relevant - * p4est_* and p8est_* - * functions. Using this - * structure, for example by - * saying - * functions::quadrant_compare, - * we can write code in a - * dimension independent way, - * either calling - * p4est_quadrant_compare or - * p8est_quadrant_compare, - * depending on template - * argument. + * A structure whose explicit specializations contain pointers to the + * relevant p4est_* and p8est_* functions. Using this structure, for + * example by saying functions::quadrant_compare, we can write code + * in a dimension independent way, either calling p4est_quadrant_compare + * or p8est_quadrant_compare, depending on template argument. */ template struct functions; @@ -100,6 +96,10 @@ namespace internal int (&quadrant_is_ancestor) (const types<2>::quadrant *q1, const types<2>::quadrant *q2); + static + int (&quadrant_ancestor_id) (const types<2>::quadrant *q, + int level); + static int (&comm_find_owner) (types<2>::forest *p4est, const types<2>::locidx which_tree, @@ -112,6 +112,16 @@ namespace internal types<2>::topidx num_corners, types<2>::topidx num_vtt); + static + void (&connectivity_join_faces) (types<2>::connectivity *conn, + types<2>::topidx tree_left, + types<2>::topidx tree_right, + int face_left, + int face_right, + int orientation); + + + static void (&connectivity_destroy) (p4est_connectivity_t *connectivity); @@ -167,6 +177,9 @@ namespace internal void (&connectivity_save) (const char *filename, types<2>::connectivity *connectivity); + static + int (&connectivity_is_valid) (types<2>::connectivity *connectivity); + static types<2>::connectivity *(&connectivity_load) (const char *filename, long *length); @@ -229,6 +242,10 @@ namespace internal const types<2>::quadrant *q2) = p4est_quadrant_is_ancestor; + int (&functions<2>::quadrant_ancestor_id) (const types<2>::quadrant *q, + int level) + = p4est_quadrant_ancestor_id; + int (&functions<2>::comm_find_owner) (types<2>::forest *p4est, const types<2>::locidx which_tree, const types<2>::quadrant *q, @@ -241,6 +258,16 @@ namespace internal types<2>::topidx num_vtt) = p4est_connectivity_new; +#if DEAL_II_P4EST_VERSION_GTE(0,3,4,1) + void (&functions<2>::connectivity_join_faces) (types<2>::connectivity *conn, + types<2>::topidx tree_left, + types<2>::topidx tree_right, + int face_left, + int face_right, + int orientation) + = p4est_connectivity_join_faces; +#endif + void (&functions<2>::connectivity_destroy) (p4est_connectivity_t *connectivity) = p4est_connectivity_destroy; @@ -297,6 +324,10 @@ namespace internal types<2>::connectivity *connectivity) = p4est_connectivity_save; + int (&functions<2>::connectivity_is_valid) (types<2>::connectivity + *connectivity) + = p4est_connectivity_is_valid; + types<2>::connectivity * (&functions<2>::connectivity_load) (const char *filename, long *length) @@ -361,6 +392,10 @@ namespace internal int (&quadrant_is_ancestor) (const types<3>::quadrant *q1, const types<3>::quadrant *q2); + static + int (&quadrant_ancestor_id) (const types<3>::quadrant *q, + int level); + static int (&comm_find_owner) (types<3>::forest *p4est, const types<3>::locidx which_tree, @@ -375,6 +410,14 @@ namespace internal types<3>::topidx num_corners, types<3>::topidx num_ctt); + static + void (&connectivity_join_faces) (types<3>::connectivity *conn, + types<3>::topidx tree_left, + types<3>::topidx tree_right, + int face_left, + int face_right, + int orientation); + static void (&connectivity_destroy) (p8est_connectivity_t *connectivity); @@ -430,6 +473,9 @@ namespace internal void (&connectivity_save) (const char *filename, types<3>::connectivity *connectivity); + static + int (&connectivity_is_valid) (types<3>::connectivity *connectivity); + static types<3>::connectivity *(&connectivity_load) (const char *filename, long *length); @@ -493,6 +539,10 @@ namespace internal const types<3>::quadrant *q2) = p8est_quadrant_is_ancestor; + int (&functions<3>::quadrant_ancestor_id) (const types<3>::quadrant *q, + int level) + = p8est_quadrant_ancestor_id; + int (&functions<3>::comm_find_owner) (types<3>::forest *p4est, const types<3>::locidx which_tree, const types<3>::quadrant *q, @@ -510,6 +560,16 @@ namespace internal void (&functions<3>::connectivity_destroy) (p8est_connectivity_t *connectivity) = p8est_connectivity_destroy; +#if DEAL_II_P4EST_VERSION_GTE(0,3,4,1) + void (&functions<3>::connectivity_join_faces) (types<3>::connectivity *conn, + types<3>::topidx tree_left, + types<3>::topidx tree_right, + int face_left, + int face_right, + int orientation) + = p8est_connectivity_join_faces; +#endif + types<3>::forest *(&functions<3>::new_forest) (MPI_Comm mpicomm, types<3>::connectivity *connectivity, types<3>::locidx min_quadrants, @@ -563,6 +623,10 @@ namespace internal types<3>::connectivity *connectivity) = p8est_connectivity_save; + int (&functions<3>::connectivity_is_valid) (types<3>::connectivity + *connectivity) + = p8est_connectivity_is_valid; + types<3>::connectivity * (&functions<3>::connectivity_load) (const char *filename, long *length) @@ -664,6 +728,37 @@ namespace internal { return functions::quadrant_is_ancestor(&q1, &q2); } + + /** + * This struct templatizes the p4est iterate structs and function + * prototypes, which are used to execute callback functions for faces, + * edges, and corners that require local neighborhood information, i.e. + * the neighboring cells */ + template struct iter; + + template <> struct iter<2> + { + typedef p4est_iter_corner_info_t corner_info; + typedef p4est_iter_corner_side_t corner_side; + typedef p4est_iter_corner_t corner_iter; + typedef p4est_iter_face_info_t face_info; + typedef p4est_iter_face_side_t face_side; + typedef p4est_iter_face_t face_iter; + }; + + template <> struct iter<3> + { + typedef p8est_iter_corner_info_t corner_info; + typedef p8est_iter_corner_side_t corner_side; + typedef p8est_iter_corner_t corner_iter; + typedef p8est_iter_edge_info_t edge_info; + typedef p8est_iter_edge_side_t edge_side; + typedef p8est_iter_edge_t edge_iter; + typedef p8est_iter_face_info_t face_info; + typedef p8est_iter_face_side_t face_side; + typedef p8est_iter_face_t face_iter; + }; + } } @@ -721,9 +816,8 @@ namespace /** - * Set all vertex and cell - * related information in the - * p4est connectivity structure. + * Set all vertex and cell related information in the p4est connectivity + * structure. */ template void @@ -736,16 +830,12 @@ namespace const bool set_vertex_info, typename internal::p4est::types::connectivity *connectivity) { - // copy the vertices into the - // connectivity structure. the - // triangulation exports the array of - // vertices, but some of the entries are - // sometimes unused; this shouldn't be - // the case for a newly created - // triangulation, but make sure + // copy the vertices into the connectivity structure. the triangulation + // exports the array of vertices, but some of the entries are sometimes + // unused; this shouldn't be the case for a newly created triangulation, + // but make sure // - // note that p4est stores coordinates as - // a triplet of values even in 2d + // note that p4est stores coordinates as a triplet of values even in 2d Assert (triangulation.get_used_vertices().size() == triangulation.get_vertices().size(), ExcInternalError()); @@ -765,14 +855,11 @@ namespace triangulation.get_vertices()[v][2]); } - // next store the tree_to_vertex indices - // (each tree is here only a single cell - // in the coarse mesh). p4est requires - // vertex numbering in clockwise + // next store the tree_to_vertex indices (each tree is here only a single + // cell in the coarse mesh). p4est requires vertex numbering in clockwise // orientation // - // while we're at it, also copy the - // neighborship information between cells + // while we're at it, also copy the neighborship information between cells typename Triangulation::active_cell_iterator cell = triangulation.begin_active(), endc = triangulation.end(); @@ -788,8 +875,7 @@ namespace connectivity->tree_to_corner[index*GeometryInfo::vertices_per_cell+v] = cell->vertex_index(v); } - // neighborship information. if a - // cell is at a boundary, then enter + // neighborship information. if a cell is at a boundary, then enter // the index of the cell itself here for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->face(f)->at_boundary() == false) @@ -799,10 +885,8 @@ namespace connectivity->tree_to_tree[index*GeometryInfo::faces_per_cell + f] = coarse_cell_to_p4est_tree_permutation[cell->index()]; - // fill tree_to_face, which is - // essentially neighbor_to_neighbor; - // however, we have to remap the - // resulting face number as well + // fill tree_to_face, which is essentially neighbor_to_neighbor; + // however, we have to remap the resulting face number as well for (unsigned int f=0; f::faces_per_cell; ++f) if (cell->face(f)->at_boundary() == false) { @@ -818,37 +902,16 @@ namespace case 3: { /* - * The values for - * tree_to_face are in - * 0..23 where ttf % 6 - * gives the face - * number and ttf / 6 - * the face orientation - * code. The - * orientation is - * determined as - * follows. Let - * my_face and - * other_face be the - * two face numbers of - * the connecting trees - * in 0..5. Then the - * first face vertex of - * the lower of my_face - * and other_face - * connects to a face - * vertex numbered 0..3 - * in the higher of - * my_face and - * other_face. The - * face orientation is - * defined as this - * number. If my_face - * == other_face, - * treating either of - * both faces as the - * lower one leads to - * the same result. + * The values for tree_to_face are in 0..23 where ttf % 6 + * gives the face number and ttf / 6 the face orientation + * code. The orientation is determined as follows. Let + * my_face and other_face be the two face numbers of the + * connecting trees in 0..5. Then the first face vertex of + * the lower of my_face and other_face connects to a face + * vertex numbered 0..3 in the higher of my_face and + * other_face. The face orientation is defined as this + * number. If my_face == other_face, treating either of + * both faces as the lower one leads to the same result. */ connectivity->tree_to_face[index*6 + f] @@ -869,10 +932,8 @@ namespace unsigned int v = 0; - // global vertex index of - // vertex 0 on face of - // cell with smaller - // local face index + // global vertex index of vertex 0 on face of cell with + // smaller local face index unsigned int g_idx = cell_list[smaller_idx]->vertex_index( GeometryInfo::face_to_cell_vertices( @@ -883,10 +944,8 @@ namespace cell_list[smaller_idx]->face_rotation(face_idx_list[smaller_idx])) ); - // loop over vertices on - // face from other cell - // and compare global - // vertex numbers + // loop over vertices on face from other cell and compare + // global vertex numbers for (unsigned int i=0; i::vertices_per_face; ++i) { unsigned int idx @@ -1068,8 +1127,7 @@ namespace const typename internal::p4est::types::forest &forest, const types::subdomain_id my_subdomain) { - // check if this cell exists in - // the local p4est cell + // check if this cell exists in the local p4est cell if (sc_array_bsearch(const_cast(&tree.quadrants), &p4est_cell, internal::p4est::functions::quadrant_compare) @@ -1082,19 +1140,11 @@ namespace } else { - // no, cell not found in - // local part of - // p4est. this means that - // the local part is more - // refined than the current - // cell. if this cell has - // no children of its own, - // we need to refine it, - // and if it does already - // have children then loop - // over all children and - // see if they are locally - // available as well + // no, cell not found in local part of p4est. this means that the + // local part is more refined than the current cell. if this cell has + // no children of its own, we need to refine it, and if it does + // already have children then loop over all children and see if they + // are locally available as well if (dealii_cell->has_children () == false) dealii_cell->set_refine_flag (); else @@ -1127,29 +1177,18 @@ namespace &p4est_child[c]) == false) { - // no, this child - // is locally not - // available in - // the p4est. - // delete all - // its children - // but, because this - // may not be successfull, - // make sure to mark all - // children recursively as - // not local. + // no, this child is locally not available in the p4est. + // delete all its children but, because this may not be + // successfull, make sure to mark all children recursively + // as not local. delete_all_children (dealii_cell->child(c)); dealii_cell->child(c) ->recursively_set_subdomain_id(numbers::artificial_subdomain_id); } else { - // at least some - // part of the - // tree rooted in - // this child is - // locally - // available + // at least some part of the tree rooted in this child is + // locally available match_tree_recursively (tree, dealii_cell->child(c), p4est_child[c], @@ -1163,66 +1202,36 @@ namespace template void - match_quadrant_recursively (const typename internal::p4est::types::quadrant &this_quadrant, - const typename Triangulation::cell_iterator &dealii_cell, - const typename internal::p4est::types::quadrant &ghost_quadrant, - const typename internal::p4est::types::forest &forest, - unsigned int ghost_owner) + match_quadrant (const dealii::Triangulation *tria, + unsigned int dealii_index, + typename internal::p4est::types::quadrant &ghost_quadrant, + unsigned int ghost_owner) { - if (internal::p4est::functions::quadrant_is_equal(&this_quadrant, &ghost_quadrant)) - { - // this is the ghostcell + int i, child_id; + int l = ghost_quadrant.level; - if (dealii_cell->has_children()) - delete_all_children (dealii_cell); - else + for (i = 0; i < l; i++) + { + typename Triangulation::cell_iterator cell (tria, i, dealii_index); + if (cell->has_children () == false) { - dealii_cell->clear_coarsen_flag(); - dealii_cell->set_subdomain_id(ghost_owner); + cell->clear_coarsen_flag(); + cell->set_refine_flag (); + return; } - return; - } - if (! internal::p4est::functions::quadrant_is_ancestor ( &this_quadrant, &ghost_quadrant)) - { - return; - } - - if (dealii_cell->has_children () == false) - { - dealii_cell->clear_coarsen_flag(); - dealii_cell->set_refine_flag (); - return; + child_id = internal::p4est::functions::quadrant_ancestor_id (&ghost_quadrant, i + 1); + dealii_index = cell->child_index(child_id); } - typename internal::p4est::types::quadrant - p4est_child[GeometryInfo::max_children_per_cell]; - for (unsigned int c=0; - c::max_children_per_cell; ++c) - switch (dim) - { - case 2: - P4EST_QUADRANT_INIT(&p4est_child[c]); - break; - case 3: - P8EST_QUADRANT_INIT(&p4est_child[c]); - break; - default: - Assert (false, ExcNotImplemented()); - } - - - internal::p4est::functions:: - quadrant_childrenv (&this_quadrant, p4est_child); - - for (unsigned int c=0; - c::max_children_per_cell; ++c) - + typename Triangulation::cell_iterator cell (tria, l, dealii_index); + if (cell->has_children()) + delete_all_children (cell); + else { - match_quadrant_recursively (p4est_child[c], dealii_cell->child(c), ghost_quadrant, forest, ghost_owner); + cell->clear_coarsen_flag(); + cell->set_subdomain_id(ghost_owner); } - - } @@ -1309,8 +1318,7 @@ namespace { //this cell got refined - //attach to the first child, because - // we can only attach to active + //attach to the first child, because we can only attach to active // quadrants typename internal::p4est::types::quadrant p4est_child[GeometryInfo::max_children_per_cell]; @@ -1367,8 +1375,7 @@ namespace } else { - //it's children got coarsened into - //this cell + //it's children got coarsened into this cell typename internal::p4est::types::quadrant *q; q = static_cast::quadrant *> ( sc_array_index (const_cast(&tree.quadrants), idx) @@ -1406,8 +1413,7 @@ namespace quadrant_overlaps_tree (const_cast::tree *>(&tree), &p4est_cell) == false)) - // this quadrant and none of - // it's children belong to us. + // this quadrant and none of it's children belong to us. return; @@ -1458,7 +1464,7 @@ namespace void *ptr = static_cast(q->p.user_data) + offset; typename parallel::distributed::Triangulation::CellStatus status = * static_cast< - typename parallel::distributed::Triangulation::CellStatus* + typename parallel::distributed::Triangulation::CellStatus * >(q->p.user_data); switch (status) { @@ -1490,10 +1496,9 @@ namespace /** - * A data structure that we use to store - * which cells (indicated by - * internal::p4est::types::quadrant objects) shall be - * refined and which shall be coarsened. + * A data structure that we use to store which cells (indicated by + * internal::p4est::types::quadrant objects) shall be refined and which + * shall be coarsened. */ template class RefineAndCoarsenList @@ -1505,21 +1510,12 @@ namespace typename internal::p4est::types::forest &forest); /** - * A callback function that we - * pass to the p4est data - * structures when a forest is - * to be refined. The p4est - * functions call it back with - * a tree (the index of the - * tree that grows out of a - * given coarse cell) and a - * refinement path from that - * coarse cell to a - * terminal/leaf cell. The - * function returns whether the - * corresponding cell in the - * deal.II triangulation has - * the refined flag set. + * A callback function that we pass to the p4est data structures when a + * forest is to be refined. The p4est functions call it back with a tree + * (the index of the tree that grows out of a given coarse cell) and a + * refinement path from that coarse cell to a terminal/leaf cell. The + * function returns whether the corresponding cell in the deal.II + * triangulation has the refined flag set. */ static int @@ -1528,12 +1524,8 @@ namespace typename internal::p4est::types::quadrant *quadrant); /** - * Same as the refine_callback - * function, but return whether - * all four of the given - * children of a non-terminal - * cell are to be coarsened - * away. + * Same as the refine_callback function, but return whether all four of + * the given children of a non-terminal cell are to be coarsened away. */ static int @@ -1574,14 +1566,13 @@ namespace template RefineAndCoarsenList:: RefineAndCoarsenList (const Triangulation &triangulation, - const std::vector &p4est_tree_to_coarse_cell_permutation, - const types::subdomain_id my_subdomain, + const std::vector &p4est_tree_to_coarse_cell_permutation, + const types::subdomain_id my_subdomain, typename internal::p4est::types::forest &forest) : forest(forest) { - // count how many flags are set and - // allocate that much memory + // count how many flags are set and allocate that much memory unsigned int n_refine_flags = 0, n_coarsen_flags = 0; for (typename Triangulation::active_cell_iterator @@ -1602,20 +1593,13 @@ namespace coarsen_list.reserve (n_coarsen_flags); - // now build the lists of cells that - // are flagged. note that p4est will - // traverse its cells in the order in - // which trees appear in the - // forest. this order is not the same - // as the order of coarse cells in the - // deal.II Triangulation because we - // have translated everything by the - // coarse_cell_to_p4est_tree_permutation - // permutation. in order to make sure - // that the output array is already in - // the correct order, traverse our - // coarse cells in the same order in - // which p4est will: + // now build the lists of cells that are flagged. note that p4est will + // traverse its cells in the order in which trees appear in the + // forest. this order is not the same as the order of coarse cells in the + // deal.II Triangulation because we have translated everything by the + // coarse_cell_to_p4est_tree_permutation permutation. in order to make + // sure that the output array is already in the correct order, traverse + // our coarse cells in the same order in which p4est will: for (unsigned int c=0; c= refine_list[i-1].p.which_tree, @@ -1714,8 +1697,7 @@ namespace RefineAndCoarsenList *this_object = reinterpret_cast*>(forest->user_pointer); - // if there are no more cells in our - // list the current cell can't be + // if there are no more cells in our list the current cell can't be // flagged for refinement if (this_object->current_refine_pointer == this_object->refine_list.end()) return false; @@ -1724,29 +1706,25 @@ namespace this_object->current_refine_pointer->p.which_tree, ExcInternalError()); - // if p4est hasn't yet reached the tree - // of the next flagged cell the current - // cell can't be flagged for refinement + // if p4est hasn't yet reached the tree of the next flagged cell the + // current cell can't be flagged for refinement if (coarse_cell_index < this_object->current_refine_pointer->p.which_tree) return false; - // now we're in the right tree in the - // forest + // now we're in the right tree in the forest Assert (coarse_cell_index <= this_object->current_refine_pointer->p.which_tree, ExcInternalError()); - // make sure that the p4est loop over - // cells hasn't gotten ahead of our own + // make sure that the p4est loop over cells hasn't gotten ahead of our own // pointer Assert (internal::p4est::functions:: quadrant_compare (quadrant, &*this_object->current_refine_pointer) <= 0, ExcInternalError()); - // now, if the p4est cell is one in the - // list, it is supposed to be refined + // now, if the p4est cell is one in the list, it is supposed to be refined if (internal::p4est::functions:: quadrant_is_equal (quadrant, &*this_object->current_refine_pointer)) { @@ -1770,8 +1748,7 @@ namespace RefineAndCoarsenList *this_object = reinterpret_cast*>(forest->user_pointer); - // if there are no more cells in our - // list the current cell can't be + // if there are no more cells in our list the current cell can't be // flagged for coarsening if (this_object->current_coarsen_pointer == this_object->coarsen_list.end()) @@ -1781,29 +1758,26 @@ namespace this_object->current_coarsen_pointer->p.which_tree, ExcInternalError()); - // if p4est hasn't yet reached the tree - // of the next flagged cell the current - // cell can't be flagged for coarsening + // if p4est hasn't yet reached the tree of the next flagged cell the + // current cell can't be flagged for coarsening if (coarse_cell_index < this_object->current_coarsen_pointer->p.which_tree) return false; - // now we're in the right tree in the - // forest + // now we're in the right tree in the forest Assert (coarse_cell_index <= this_object->current_coarsen_pointer->p.which_tree, ExcInternalError()); - // make sure that the p4est loop over - // cells hasn't gotten ahead of our own + // make sure that the p4est loop over cells hasn't gotten ahead of our own // pointer Assert (internal::p4est::functions:: quadrant_compare (children[0], &*this_object->current_coarsen_pointer) <= 0, ExcInternalError()); - // now, if the p4est cell is one in the - // list, it is supposed to be coarsened + // now, if the p4est cell is one in the list, it is supposed to be + // coarsened if (internal::p4est::functions:: quadrant_is_equal (children[0], &*this_object->current_coarsen_pointer)) @@ -1811,10 +1785,8 @@ namespace // move current pointer one up ++this_object->current_coarsen_pointer; - // note that the next 3 cells in - // our list need to correspond to - // the other siblings of the cell - // we have just found + // note that the next 3 cells in our list need to correspond to the + // other siblings of the cell we have just found for (unsigned int c=1; c::max_children_per_cell; ++c) { Assert (internal::p4est::functions:: @@ -1845,12 +1817,8 @@ namespace internal { Singleton () { - // ensure that the - // initialization - // code is run only - // once, even if we - // link with 1d, 2d, - // and 3d libraries + // ensure that the initialization code is run only once, even if we + // link with 1d, 2d, and 3d libraries static bool initialized = false; if (initialized == false) @@ -1870,9 +1838,7 @@ namespace internal if (deinitialized == false) { - // p4est has no - // p4est_finalize - // function + // p4est has no p4est_finalize function sc_finalize (); deinitialized = true; @@ -1881,8 +1847,8 @@ namespace internal }; public: - // do run the initialization code, at least the first time around we - // get to this function + // do run the initialization code, at least the first time around we get + // to this function static void do_initialize () { static Singleton singleton; @@ -1916,9 +1882,7 @@ namespace parallel const typename dealii::Triangulation::MeshSmoothing smooth_grid, const Settings settings_) : - // do not check - // for distorted - // cells + // do not check for distorted cells dealii::Triangulation (smooth_grid, false), @@ -1934,11 +1898,13 @@ namespace parallel n_attached_datas(0), n_attached_deserialize(0) { - // initialize p4est. do this in a separate function since it has - // to happen only once, even if we have triangulation objects - // for several different space dimensions + // initialize p4est. do this in a separate function since it has to + // happen only once, even if we have triangulation objects for several + // different space dimensions dealii::internal::p4est::InitFinalize::do_initialize (); + parallel_ghost = 0; + number_cache.n_locally_owned_active_cells .resize (Utilities::MPI::n_mpi_processes (mpi_communicator)); } @@ -1956,8 +1922,7 @@ namespace parallel Assert (parallel_forest == 0, ExcInternalError()); Assert (refinement_in_progress == false, ExcInternalError()); - // get rid of the unique - // communicator used here again + // get rid of the unique communicator used here again MPI_Comm_free (&mpi_communicator); } @@ -1978,17 +1943,13 @@ namespace parallel } catch (const typename dealii::Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } - // note that now we have some content in - // the p4est objects and call the - // functions that do the actual work - // (which are dimension dependent, so + // note that now we have some content in the p4est objects and call the + // functions that do the actual work (which are dimension dependent, so // separate) triangulation_has_content = true; @@ -2002,10 +1963,8 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } @@ -2020,6 +1979,12 @@ namespace parallel { triangulation_has_content = false; + if (parallel_ghost != 0) + { + dealii::internal::p4est::functions::ghost_destroy (parallel_ghost); + parallel_ghost = 0; + } + if (parallel_forest != 0) { dealii::internal::p4est::functions::destroy (parallel_forest); @@ -2117,6 +2082,10 @@ namespace parallel Triangulation:: load(const char *filename) { + if (parallel_ghost != 0) { + dealii::internal::p4est::functions::ghost_destroy (parallel_ghost); + parallel_ghost = 0; + } dealii::internal::p4est::functions::destroy (parallel_forest); parallel_forest = 0; dealii::internal::p4est::functions::connectivity_destroy (connectivity); @@ -2194,12 +2163,10 @@ namespace parallel Assert (this->n_cells(0) > 0, ExcInternalError()); Assert (this->n_levels() == 1, ExcInternalError()); - // data structures that counts how many - // cells touch each vertex - // (vertex_touch_count), and which cells - // touch a given vertex (together with - // the local numbering of that vertex - // within the cells that touch it) + // data structures that counts how many cells touch each vertex + // (vertex_touch_count), and which cells touch a given vertex (together + // with the local numbering of that vertex within the cells that touch + // it) std::vector vertex_touch_count; std::vector< std::list< @@ -2214,12 +2181,9 @@ namespace parallel vertex_touch_count.end(), 0); - // now create a connectivity - // object with the right sizes - // for all arrays. set vertex - // information only in debug - // mode (saves a few bytes in - // optimized mode) + // now create a connectivity object with the right sizes for all + // arrays. set vertex information only in debug mode (saves a few bytes + // in optimized mode) const bool set_vertex_info #ifdef DEBUG = true @@ -2245,8 +2209,7 @@ namespace parallel Assert (p4est_connectivity_is_valid (connectivity) == 1, ExcInternalError()); - // now create a forest out of the - // connectivity data structure + // now create a forest out of the connectivity data structure parallel_forest = dealii::internal::p4est::functions<2>:: new_forest (mpi_communicator, @@ -2261,9 +2224,8 @@ namespace parallel - // TODO: This is a verbatim copy of the 2,2 - // case. However, we can't just specialize the - // dim template argument, but let spacedim open + // TODO: This is a verbatim copy of the 2,2 case. However, we can't just + // specialize the dim template argument, but let spacedim open template <> void Triangulation<2,3>::copy_new_triangulation_to_p4est (dealii::internal::int2type<2>) @@ -2272,12 +2234,10 @@ namespace parallel Assert (this->n_cells(0) > 0, ExcInternalError()); Assert (this->n_levels() == 1, ExcInternalError()); - // data structures that counts how many - // cells touch each vertex - // (vertex_touch_count), and which cells - // touch a given vertex (together with - // the local numbering of that vertex - // within the cells that touch it) + // data structures that counts how many cells touch each vertex + // (vertex_touch_count), and which cells touch a given vertex (together + // with the local numbering of that vertex within the cells that touch + // it) std::vector vertex_touch_count; std::vector< std::list< @@ -2292,12 +2252,9 @@ namespace parallel vertex_touch_count.end(), 0); - // now create a connectivity - // object with the right sizes - // for all arrays. set vertex - // information only in debug - // mode (saves a few bytes in - // optimized mode) + // now create a connectivity object with the right sizes for all + // arrays. set vertex information only in debug mode (saves a few bytes + // in optimized mode) const bool set_vertex_info #ifdef DEBUG = true @@ -2323,8 +2280,7 @@ namespace parallel Assert (p4est_connectivity_is_valid (connectivity) == 1, ExcInternalError()); - // now create a forest out of the - // connectivity data structure + // now create a forest out of the connectivity data structure parallel_forest = dealii::internal::p4est::functions<2>:: new_forest (mpi_communicator, @@ -2347,12 +2303,10 @@ namespace parallel Assert (this->n_cells(0) > 0, ExcInternalError()); Assert (this->n_levels() == 1, ExcInternalError()); - // data structures that counts how many - // cells touch each vertex - // (vertex_touch_count), and which cells - // touch a given vertex (together with - // the local numbering of that vertex - // within the cells that touch it) + // data structures that counts how many cells touch each vertex + // (vertex_touch_count), and which cells touch a given vertex (together + // with the local numbering of that vertex within the cells that touch + // it) std::vector vertex_touch_count; std::vector< std::list< @@ -2380,9 +2334,8 @@ namespace parallel num_ett = std::accumulate (edge_touch_count.begin(), edge_touch_count.end(), 0); - // now create a connectivity object with - // the right sizes for all arrays - + + // now create a connectivity object with the right sizes for all arrays const bool set_vertex_info #ifdef DEBUG = true @@ -2479,8 +2432,7 @@ namespace parallel Assert (p8est_connectivity_is_valid (connectivity) == 1, ExcInternalError()); - // now create a forest out of the - // connectivity data structure + // now create a forest out of the connectivity data structure parallel_forest = dealii::internal::p4est::functions<3>:: new_forest (mpi_communicator, @@ -2499,20 +2451,26 @@ namespace parallel void Triangulation::copy_local_forest_to_triangulation () { - // disable mesh smoothing for - // recreating the deal.II - // triangulation, otherwise we might - // not be able to reproduce the p4est - // mesh exactly. We restore the - // original smoothing at the end of - // this function. Note that the - // smoothing flag is used in the normal + // disable mesh smoothing for recreating the deal.II triangulation, + // otherwise we might not be able to reproduce the p4est mesh + // exactly. We restore the original smoothing at the end of this + // function. Note that the smoothing flag is used in the normal // refinement process. typename Triangulation::MeshSmoothing - save_smooth = this->smooth_grid; - this->smooth_grid = dealii::Triangulation::none; - bool mesh_changed = false; + save_smooth = this->smooth_grid; + + // We will refine manually to match the p4est further down, which + // obeys a level difference of 2 at each vertex (see the balance call + // to p4est). We can disable this here so we store fewer artificial + // cells (in some cases). For geometric multigrid it turns out that + // we will miss level cells at shared vertices if we ignore this. + // See tests/mpi/mg_06. + if (settings & construct_multigrid_hierarchy) + this->smooth_grid = dealii::Triangulation::limit_level_difference_at_vertices; + else + this->smooth_grid = dealii::Triangulation::none; + bool mesh_changed = false; // remove all deal.II refinements. Note that we could skip this and // start from our current state, because the algorithm later coarsens as @@ -2541,9 +2499,7 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for + // the underlying triangulation should not be checking for // distorted cells AssertThrow (false, ExcInternalError()); } @@ -2553,17 +2509,21 @@ namespace parallel // query p4est for the ghost cells - typename dealii::internal::p4est::types::ghost *ghostlayer; - ghostlayer = dealii::internal::p4est::functions::ghost_new (parallel_forest, + if (parallel_ghost != 0) + { + dealii::internal::p4est::functions::ghost_destroy (parallel_ghost); + parallel_ghost = 0; + } + parallel_ghost = dealii::internal::p4est::functions::ghost_new (parallel_forest, (dim == 2 ? typename dealii::internal::p4est::types:: - balance_type(P4EST_BALANCE_CORNER) + balance_type(P4EST_CONNECT_CORNER) : typename dealii::internal::p4est::types:: - balance_type(P8EST_BALANCE_CORNER))); + balance_type(P8EST_CONNECT_CORNER))); - Assert (ghostlayer, ExcInternalError()); + Assert (parallel_ghost, ExcInternalError()); // set all cells to artificial. we will later set it to the correct @@ -2581,14 +2541,9 @@ namespace parallel cell != this->end(0); ++cell) { - // if this processor - // stores no part of the - // forest that comes out - // of this coarse grid - // cell, then we need to - // delete all children of - // this cell (the coarse - // grid cell remains) + // if this processor stores no part of the forest that comes out + // of this coarse grid cell, then we need to delete all children + // of this cell (the coarse grid cell remains) if (tree_exists_locally(parallel_forest, coarse_cell_to_p4est_tree_permutation[cell->index()]) == false) @@ -2600,13 +2555,8 @@ namespace parallel else { - - // this processor - // stores at least a - // part of the tree - // that comes out of - // this cell. - + // this processor stores at least a part of the tree that + // comes out of this cell. typename dealii::internal::p4est::types::quadrant p4est_coarse_cell; typename dealii::internal::p4est::types::tree *tree = @@ -2621,38 +2571,30 @@ namespace parallel } } - // check mesh for ghostcells, - // refine as necessary. - // iterate over every ghostquadrant, - // find corresponding deal coarsecell - // and recurse. + // check mesh for ghostcells, refine as necessary. iterate over + // every ghostquadrant, find corresponding deal coarsecell and + // recurse. typename dealii::internal::p4est::types::quadrant *quadr; unsigned int ghost_owner=0; + typename dealii::internal::p4est::types::topidx ghost_tree=0; - for (unsigned int g_idx=0; g_idxghosts.elem_count; ++g_idx) + for (unsigned int g_idx=0; g_idxghosts.elem_count; ++g_idx) { - while (g_idx >= (unsigned int)ghostlayer->proc_offsets[ghost_owner+1]) + while (g_idx >= (unsigned int)parallel_ghost->proc_offsets[ghost_owner+1]) ++ghost_owner; + while (g_idx >= (unsigned int)parallel_ghost->tree_offsets[ghost_tree+1]) + ++ghost_tree; quadr = static_cast::quadrant *> - ( sc_array_index(&ghostlayer->ghosts, g_idx) ); + ( sc_array_index(¶llel_ghost->ghosts, g_idx) ); unsigned int coarse_cell_index = - p4est_tree_to_coarse_cell_permutation[quadr->p.piggy3.which_tree]; - - const typename Triangulation::cell_iterator - cell (this, 0U, coarse_cell_index); + p4est_tree_to_coarse_cell_permutation[ghost_tree]; - typename dealii::internal::p4est::types::quadrant p4est_coarse_cell; - dealii::internal::p4est::init_coarse_quadrant (p4est_coarse_cell); - - match_quadrant_recursively (p4est_coarse_cell, cell, *quadr, - *parallel_forest, ghost_owner); + match_quadrant (this, coarse_cell_index, *quadr, ghost_owner); } - // fix all the flags to make - // sure we have a consistent - // mesh + // fix all the flags to make sure we have a consistent mesh this->prepare_coarsening_and_refinement (); // see if any flags are still set @@ -2667,10 +2609,8 @@ namespace parallel break; } - // actually do the refinement - // but prevent the refinement - // hook below from taking - // over + // actually do the refinement but prevent the refinement hook below + // from taking over const bool saved_refinement_in_progress = refinement_in_progress; refinement_in_progress = true; @@ -2680,9 +2620,7 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for + // the underlying triangulation should not be checking for // distorted cells AssertThrow (false, ExcInternalError()); } @@ -2706,7 +2644,7 @@ namespace parallel ++num_ghosts; } - Assert( num_ghosts == ghostlayer->ghosts.elem_count, ExcInternalError()); + Assert( num_ghosts == parallel_ghost->ghosts.elem_count, ExcInternalError()); #endif @@ -2716,9 +2654,10 @@ namespace parallel // we need this information for all our ancestors and the same-level neighbors of our own cells (=level ghosts) if (settings & construct_multigrid_hierarchy) { - // step 1: We set our own ids all the way down and all the others to -1. Note that we do not fill - // other cells we could figure out the same way, because we might accidentally set an id for a - // cell that is not a ghost cell. + // step 1: We set our own ids all the way down and all the others to + // -1. Note that we do not fill other cells we could figure out the + // same way, because we might accidentally set an id for a cell that + // is not a ghost cell. for (unsigned int lvl=this->n_levels(); lvl>0;) { --lvl; @@ -2735,7 +2674,8 @@ namespace parallel } } - //step 2: make sure all the neighbors to our level_cells exist. Need to look up in p4est... + //step 2: make sure all the neighbors to our level_cells exist. Need + //to look up in p4est... std::vector > marked_vertices(this->n_levels()); for (unsigned int lvl=0; lvln_levels(); ++lvl) @@ -2780,7 +2720,8 @@ namespace parallel { if (cell->child(c)->level_subdomain_id()==this->locally_owned_subdomain()) { - //at least one of the children belongs to us, so make sure we set the level subdomain id + //at least one of the children belongs to us, so + //make sure we set the level subdomain id types::subdomain_id mark = numbers::artificial_subdomain_id; mark = cell->child(0)->level_subdomain_id(); Assert(mark != numbers::artificial_subdomain_id, ExcInternalError()); //we should know the child(0) @@ -2791,24 +2732,44 @@ namespace parallel } } + //step 4: Special case: on each level we need all the face neighbors + // of our own level cells these are normally on the same level, + // unless the neighbor is active and coarser. It can end up on a + // different processor. Luckily, the level_subdomain_id can be + // figured out without communication, because the cell is active + // (and so level_subdomain_id=subdomain_id): + for (typename Triangulation::cell_iterator cell = this->begin(); cell!=this->end(); ++cell) + { + if (cell->level_subdomain_id()!=this->locally_owned_subdomain()) + continue; + for (unsigned int f=0; f::faces_per_cell; ++f) + { + if (cell->face(f)->at_boundary()) + continue; + if (cell->neighbor(f)->level() < cell->level() + && + cell->neighbor(f)->level_subdomain_id()!=this->locally_owned_subdomain()) + { + Assert(cell->neighbor(f)->active(), ExcInternalError()); + Assert(cell->neighbor(f)->subdomain_id() != numbers::artificial_subdomain_id, ExcInternalError()); + Assert(cell->neighbor(f)->level_subdomain_id() == numbers::artificial_subdomain_id + || cell->neighbor(f)->level_subdomain_id() == cell->neighbor(f)->subdomain_id(), ExcInternalError()); + cell->neighbor(f)->set_level_subdomain_id(cell->neighbor(f)->subdomain_id()); + } + } + + } } - // check that our local copy has - // exactly as many cells as the - // p4est original (at least if we - // are on only one processor); - // for parallel computations, we - // want to check that we have at - // least as many as p4est stores - // locally (in the future we - // should check that we have - // exactly as many non-artificial - // cells as - // parallel_forest->local_num_quadrants) + // check that our local copy has exactly as many cells as the p4est + // original (at least if we are on only one processor); for parallel + // computations, we want to check that we have at least as many as p4est + // stores locally (in the future we should check that we have exactly as + // many non-artificial cells as parallel_forest->local_num_quadrants) { const unsigned int total_local_cells = this->n_active_cells(); @@ -2821,8 +2782,7 @@ namespace parallel total_local_cells, ExcInternalError()); - // count the number of owned, active - // cells and compare with p4est. + // count the number of owned, active cells and compare with p4est. unsigned int n_owned = 0; for (typename Triangulation::active_cell_iterator cell = this->begin_active(); @@ -2837,8 +2797,6 @@ namespace parallel } - dealii::internal::p4est::functions::ghost_destroy (ghostlayer); - this->smooth_grid = save_smooth; } @@ -2848,8 +2806,7 @@ namespace parallel void Triangulation::execute_coarsening_and_refinement () { - // first make sure that recursive - // calls are handled correctly + // first make sure that recursive calls are handled correctly if (refinement_in_progress == true) { dealii::Triangulation::execute_coarsening_and_refinement (); @@ -2859,12 +2816,12 @@ namespace parallel // do not allow anisotropic refinement #ifdef DEBUG for (typename Triangulation::active_cell_iterator - cell = this->begin_active(); - cell != this->end(); ++cell) - if (cell->is_locally_owned() && cell->refine_flag_set()) - Assert (cell->refine_flag_set() == - RefinementPossibilities::isotropic_refinement, - ExcMessage ("This class does not support anisotropic refinement")); + cell = this->begin_active(); + cell != this->end(); ++cell) + if (cell->is_locally_owned() && cell->refine_flag_set()) + Assert (cell->refine_flag_set() == + RefinementPossibilities::isotropic_refinement, + ExcMessage ("This class does not support anisotropic refinement")); #endif @@ -2872,25 +2829,20 @@ namespace parallel if (this->n_levels()==dealii::internal::p4est::functions::max_level) { for (typename Triangulation::active_cell_iterator - cell = this->begin_active(dealii::internal::p4est::functions::max_level-1); - cell != this->end(dealii::internal::p4est::functions::max_level-1); ++cell) + cell = this->begin_active(dealii::internal::p4est::functions::max_level-1); + cell != this->end(dealii::internal::p4est::functions::max_level-1); ++cell) { AssertThrow(!(cell->refine_flag_set()), - ExcMessage("Fatal Error: maximum refinement level of p4est reached.")); + ExcMessage("Fatal Error: maximum refinement level of p4est reached.")); } } - // now do the work we're - // supposed to do when we are - // in charge + // now do the work we're supposed to do when we are in charge refinement_in_progress = true; this->prepare_coarsening_and_refinement (); - // make sure all flags are - // cleared on cells we don't - // own, since nothing good can - // come of that if they are - // still around + // make sure all flags are cleared on cells we don't own, since nothing + // good can come of that if they are still around for (typename Triangulation::active_cell_iterator cell = this->begin_active(); cell != this->end(); ++cell) @@ -2901,26 +2853,27 @@ namespace parallel } - // count how many cells will be refined - // and coarsened, and allocate that much - // memory + // count how many cells will be refined and coarsened, and allocate that + // much memory RefineAndCoarsenList refine_and_coarsen_list (*this, p4est_tree_to_coarse_cell_permutation, my_subdomain, *parallel_forest); - // copy refine and coarsen flags into - // p4est and execute the refinement and - // coarsening. this uses the - // refine_and_coarsen_list just built, - // which is communicated to the callback - // functions through the + // copy refine and coarsen flags into p4est and execute the refinement + // and coarsening. this uses the refine_and_coarsen_list just built, + // which is communicated to the callback functions through the // user_pointer Assert (parallel_forest->user_pointer == this, ExcInternalError()); parallel_forest->user_pointer = &refine_and_coarsen_list; + if (parallel_ghost != 0) + { + dealii::internal::p4est::functions::ghost_destroy (parallel_ghost); + parallel_ghost = 0; + } dealii::internal::p4est::functions:: refine (parallel_forest, /* refine_recursive */ false, &RefineAndCoarsenList::refine_callback, @@ -2930,8 +2883,7 @@ namespace parallel &RefineAndCoarsenList::coarsen_callback, /*init_callback=*/NULL); - // make sure all cells in the lists have - // been consumed + // make sure all cells in the lists have been consumed Assert (refine_and_coarsen_list.pointers_are_at_end(), ExcInternalError()); @@ -2945,32 +2897,26 @@ namespace parallel (dim == 2 ? typename dealii::internal::p4est::types:: - balance_type(P4EST_BALANCE_FULL) + balance_type(P4EST_CONNECT_FULL) : typename dealii::internal::p4est::types:: - balance_type(P8EST_BALANCE_FULL)), + balance_type(P8EST_CONNECT_FULL)), /*init_callback=*/NULL); - // before repartitioning the mesh let - // others attach mesh related info - // (such as SolutionTransfer data) to - // the p4est + // before repartitioning the mesh let others attach mesh related info + // (such as SolutionTransfer data) to the p4est attach_mesh_data(); - // partition the new mesh between - // all processors + // partition the new mesh between all processors dealii::internal::p4est::functions:: partition (parallel_forest, /* prepare coarsening */ 1, /* weight_callback */ NULL); - // finally copy back from local - // part of tree to deal.II - // triangulation. before doing - // so, make sure there are no - // refine or coarsen flags - // pending + // finally copy back from local part of tree to deal.II + // triangulation. before doing so, make sure there are no refine or + // coarsen flags pending for (typename Triangulation::active_cell_iterator cell = this->begin_active(); cell != this->end(); ++cell) @@ -2985,10 +2931,8 @@ namespace parallel } catch (const typename Triangulation::DistortedCellList &) { - // the underlying - // triangulation should not - // be checking for - // distorted cells + // the underlying triangulation should not be checking for distorted + // cells AssertThrow (false, ExcInternalError()); } @@ -3033,10 +2977,7 @@ namespace parallel number_cache.n_global_active_cells = std::accumulate (number_cache.n_locally_owned_active_cells.begin(), number_cache.n_locally_owned_active_cells.end(), - /* ensure sum is - computed with - correct data - type:*/ + /* ensure sum is computed with correct data type:*/ static_cast(0)); number_cache.n_global_levels = Utilities::MPI::max(this->n_levels(), mpi_communicator); } @@ -3141,8 +3082,7 @@ namespace parallel dealii::internal::p4est::init_coarse_quadrant (p4est_coarse_cell); - // parent_cell is not correct here, - // but is only used in a refined + // parent_cell is not correct here, but is only used in a refined // cell post_mesh_data_recursively (*tree, cell, @@ -3160,10 +3100,10 @@ namespace parallel } // important: only remove data if we are not in the deserialization - // process. There, each SolutionTransfer registers and unpacks - // before the next one does this, so n_attached_datas is only 1 here. - // This would destroy the saved data before the second SolutionTransfer - // can get it. This created a bug that is documented in + // process. There, each SolutionTransfer registers and unpacks before + // the next one does this, so n_attached_datas is only 1 here. This + // would destroy the saved data before the second SolutionTransfer can + // get it. This created a bug that is documented in // tests/mpi/p4est_save_03 with more than one SolutionTransfer. if (!n_attached_datas && n_attached_deserialize == 0) { @@ -3187,7 +3127,307 @@ namespace parallel return p4est_tree_to_coarse_cell_permutation; } + namespace + { + /** + * This is the callback data structure used to fill + * vertices_with_ghost_neighbors via the p4est_iterate tool + */ + template + struct find_ghosts + { + typename dealii::parallel::distributed::Triangulation *triangulation; + sc_array_t * subids; + std::map > + *vertices_with_ghost_neighbors; + }; + + /** At a corner (vertex), determine if any of the neighboring cells are + * ghosts. If there are, find out their subdomain ids, and if this is a + * local vertex, then add these subdomain ids to the map + * vertices_with_ghost_neighbors of that index + */ + template + void + find_ghosts_corner + (typename dealii::internal::p4est::iter::corner_info * info, + void *user_data) + { + int i, j; + int nsides = info->sides.elem_count; + typename dealii::internal::p4est::iter::corner_side * sides = + (typename dealii::internal::p4est::iter::corner_side *) + (info->sides.array); + struct find_ghosts *fg = static_cast *>(user_data); + sc_array_t *subids = fg->subids; + typename dealii::parallel::distributed::Triangulation *triangulation = fg->triangulation; + int nsubs; + dealii::types::subdomain_id *subdomain_ids; + std::map > + *vertices_with_ghost_neighbors = fg->vertices_with_ghost_neighbors; + + subids->elem_count = 0; + for (i = 0; i < nsides; i++) { + if (sides[i].is_ghost) { + typename dealii::parallel::distributed::Triangulation::cell_iterator cell = cell_from_quad (triangulation, sides[i].treeid, *(sides[i].quad)); + Assert (cell->is_ghost(), ExcMessage ("ghost quad did not find ghost cell")); + dealii::types::subdomain_id *subid = + static_cast(sc_array_push (subids)); + *subid = cell->subdomain_id(); + } + } + + if (!subids->elem_count) { + return; + } + + nsubs = (int) subids->elem_count; + subdomain_ids = (dealii::types::subdomain_id *) (subids->array); + + for (i = 0; i < nsides; i++) { + if (!sides[i].is_ghost) { + typename dealii::parallel::distributed::Triangulation::cell_iterator cell = cell_from_quad (triangulation, sides[i].treeid, *(sides[i].quad)); + + Assert (!cell->is_ghost(), ExcMessage ("local quad found ghost cell")); + + for (j = 0; j < nsubs; j++) { + (*vertices_with_ghost_neighbors)[cell->vertex_index(sides[i].corner)] + .insert (subdomain_ids[j]); + } + } + } + + subids->elem_count = 0; + } + + /** Similar to find_ghosts_corner, but for the hanging vertex in the + * middle of an edge + */ + template + void + find_ghosts_edge + (typename dealii::internal::p4est::iter::edge_info * info, + void *user_data) + { + int i, j, k; + int nsides = info->sides.elem_count; + typename dealii::internal::p4est::iter::edge_side * sides = + (typename dealii::internal::p4est::iter::edge_side *) + (info->sides.array); + struct find_ghosts *fg = static_cast *>(user_data); + sc_array_t *subids = fg->subids; + typename dealii::parallel::distributed::Triangulation *triangulation = fg->triangulation; + int nsubs; + dealii::types::subdomain_id *subdomain_ids; + std::map > + *vertices_with_ghost_neighbors = fg->vertices_with_ghost_neighbors; + + subids->elem_count = 0; + for (i = 0; i < nsides; i++) { + if (sides[i].is_hanging) { + for (j = 0; j < 2; j++) { + if (sides[i].is.hanging.is_ghost[j]) { + typename dealii::parallel::distributed::Triangulation::cell_iterator cell = cell_from_quad (triangulation, sides[i].treeid, *(sides[i].is.hanging.quad[j])); + dealii::types::subdomain_id *subid = + static_cast(sc_array_push (subids)); + *subid = cell->subdomain_id(); + } + } + } + } + + if (!subids->elem_count) { + return; + } + + nsubs = (int) subids->elem_count; + subdomain_ids = (dealii::types::subdomain_id *) (subids->array); + + for (i = 0; i < nsides; i++) { + if (sides[i].is_hanging) { + for (j = 0; j < 2; j++) { + if (!sides[i].is.hanging.is_ghost[j]) { + typename dealii::parallel::distributed::Triangulation::cell_iterator cell = cell_from_quad (triangulation, sides[i].treeid, *(sides[i].is.hanging.quad[j])); + + for (k = 0; k < nsubs; k++) { + (*vertices_with_ghost_neighbors)[cell->vertex_index(p8est_edge_corners[sides[i].edge][1^j])] + .insert (subdomain_ids[k]); + } + } + } + } + } + + subids->elem_count = 0; + } + + /** Similar to find_ghosts_corner, but for the hanging vertex in the + * middle of a face + */ + template + void + find_ghosts_face + (typename dealii::internal::p4est::iter::face_info * info, + void *user_data) + { + int i, j, k; + int nsides = info->sides.elem_count; + typename dealii::internal::p4est::iter::face_side * sides = + (typename dealii::internal::p4est::iter::face_side *) + (info->sides.array); + struct find_ghosts *fg = static_cast *>(user_data); + sc_array_t *subids = fg->subids; + typename dealii::parallel::distributed::Triangulation *triangulation = fg->triangulation; + int nsubs; + dealii::types::subdomain_id *subdomain_ids; + std::map > + *vertices_with_ghost_neighbors = fg->vertices_with_ghost_neighbors; + int limit = (dim == 2) ? 2 : 4; + + subids->elem_count = 0; + for (i = 0; i < nsides; i++) { + if (sides[i].is_hanging) { + for (j = 0; j < limit; j++) { + if (sides[i].is.hanging.is_ghost[j]) { + typename dealii::parallel::distributed::Triangulation::cell_iterator cell = cell_from_quad (triangulation, sides[i].treeid, *(sides[i].is.hanging.quad[j])); + dealii::types::subdomain_id *subid = + static_cast(sc_array_push (subids)); + *subid = cell->subdomain_id(); + } + } + } + } + + if (!subids->elem_count) { + return; + } + + nsubs = (int) subids->elem_count; + subdomain_ids = (dealii::types::subdomain_id *) (subids->array); + + for (i = 0; i < nsides; i++) { + if (sides[i].is_hanging) { + for (j = 0; j < limit; j++) { + if (!sides[i].is.hanging.is_ghost[j]) { + typename dealii::parallel::distributed::Triangulation::cell_iterator cell = cell_from_quad (triangulation, sides[i].treeid, *(sides[i].is.hanging.quad[j])); + + for (k = 0; k < nsubs; k++) { + if (dim == 2) { + (*vertices_with_ghost_neighbors)[cell->vertex_index(p4est_face_corners[sides[i].face][(limit - 1)^j])] + .insert (subdomain_ids[k]); + } + else { + (*vertices_with_ghost_neighbors)[cell->vertex_index(p8est_face_corners[sides[i].face][(limit - 1)^j])] + .insert (subdomain_ids[k]); + } + } + } + } + } + } + + subids->elem_count = 0; + } + } + + template <> + void + Triangulation<1,1>:: + fill_vertices_with_ghost_neighbors + (std::map > + &vertices_with_ghost_neighbors) + { + Assert (false, ExcNotImplemented()); + } + template <> + void + Triangulation<1,2>:: + fill_vertices_with_ghost_neighbors + (std::map > + &vertices_with_ghost_neighbors) + { + Assert (false, ExcNotImplemented()); + } + + template <> + void + Triangulation<1,3>:: + fill_vertices_with_ghost_neighbors + (std::map > + &vertices_with_ghost_neighbors) + { + Assert (false, ExcNotImplemented()); + } + + /** + * Determine the neighboring subdomains that are adjacent to each vertex. + * This is achieved via the p4est_iterate tool + */ + template <> + void + Triangulation<2,2>:: + fill_vertices_with_ghost_neighbors + (std::map > + &vertices_with_ghost_neighbors) + { + struct find_ghosts<2,2> fg; + + fg.subids = sc_array_new (sizeof (dealii::types::subdomain_id)); + fg.triangulation = this; + fg.vertices_with_ghost_neighbors = &(vertices_with_ghost_neighbors); + + p4est_iterate (this->parallel_forest, this->parallel_ghost, static_cast(&fg), + NULL, find_ghosts_face<2,2>, find_ghosts_corner<2,2>); + + sc_array_destroy (fg.subids); + } + + /** + * Determine the neighboring subdomains that are adjacent to each vertex. + * This is achieved via the p4est_iterate tool + */ + template <> + void + Triangulation<2,3>:: + fill_vertices_with_ghost_neighbors + (std::map > + &vertices_with_ghost_neighbors) + { + struct find_ghosts<2,3> fg; + + fg.subids = sc_array_new (sizeof (dealii::types::subdomain_id)); + fg.triangulation = this; + fg.vertices_with_ghost_neighbors = &(vertices_with_ghost_neighbors); + + p4est_iterate (this->parallel_forest, this->parallel_ghost, static_cast(&fg), + NULL, find_ghosts_face<2,3>, find_ghosts_corner<2,3>); + + sc_array_destroy (fg.subids); + } + + /** + * Determine the neighboring subdomains that are adjacent to each vertex. + * This is achieved via the p8est_iterate tool + */ + template <> + void + Triangulation<3,3>:: + fill_vertices_with_ghost_neighbors + (std::map > + &vertices_with_ghost_neighbors) + { + struct find_ghosts<3,3> fg; + + fg.subids = sc_array_new (sizeof (dealii::types::subdomain_id)); + fg.triangulation = this; + fg.vertices_with_ghost_neighbors = &(vertices_with_ghost_neighbors); + + p8est_iterate (this->parallel_forest, this->parallel_ghost, static_cast(&fg), + NULL, find_ghosts_face<3,3>, find_ghosts_edge<3,3>, find_ghosts_corner<3,3>); + + sc_array_destroy (fg.subids); + } template MPI_Comm @@ -3196,6 +3436,134 @@ namespace parallel return mpi_communicator; } + template + void + Triangulation::add_periodicity + (const std::vector >& + periodicity_vector) + { + #if DEAL_II_P4EST_VERSION_GTE(0,3,4,1) + Assert (triangulation_has_content == true, + ExcMessage ("The triangulation is empty!")); + Assert (this->n_levels() == 1, + ExcMessage ("The triangulation is refined!")); + + typedef std::vector > + FaceVector; + typename FaceVector::const_iterator it, periodic_end; + it = periodicity_vector.begin(); + periodic_end = periodicity_vector.end(); + + for (; itcell[0]; + const cell_iterator second_cell = it->cell[1]; + const unsigned int face_left = it->face_idx[0]; + const unsigned int face_right = it->face_idx[1]; + + //respective cells of the matching faces in p4est + const unsigned int tree_left + = coarse_cell_to_p4est_tree_permutation[std::distance(this->begin(), + first_cell)]; + const unsigned int tree_right + = coarse_cell_to_p4est_tree_permutation[std::distance(this->begin(), + second_cell)]; + + //TODO Add support for non default orientation. + Assert(it->orientation == 1, + ExcMessage("Found a face match with non standard orientation. " + "This function is only suitable for meshes with " + "cells in default orientation")); + + dealii::internal::p4est::functions:: + connectivity_join_faces (connectivity, + tree_left, + tree_right, + face_left, + face_right, + /* orientation */ 0); + + /* The orientation parameter above describes the difference between + * the cell on the left and the cell on the right would number of the + * corners of the face. In the periodic domains most users will want, + * this orientation will be 0, i.e. the two cells would number the + * corners the same way. More exotic periodicity, like moebius strips + * or converting an unstructured quad/hex mesh into a periodic domain, + * are not supported right now, and undefined behavior will occur if + * users try to make them periodic. This may be addressed at a later + * date. + */ + } + + + Assert(dealii::internal::p4est::functions::connectivity_is_valid + (connectivity) == 1, ExcInternalError()); + + // now create a forest out of the connectivity data structure + dealii::internal::p4est::functions::destroy (parallel_forest); + parallel_forest + = dealii::internal::p4est::functions:: + new_forest (mpi_communicator, + connectivity, + /* minimum initial number of quadrants per tree */ 0, + /* minimum level of upfront refinement */ 0, + /* use uniform upfront refinement */ 1, + /* user_data_size = */ 0, + /* user_data_constructor = */ NULL, + /* user_pointer */ this); + + + try + { + copy_local_forest_to_triangulation (); + } + catch (const typename Triangulation::DistortedCellList &) + { + // the underlying triangulation should not be checking for distorted + // cells + AssertThrow (false, ExcInternalError()); + } + + #else + Assert(false, ExcMessage ("Need p4est version >= 0.3.4.1!")); + #endif + } + + + template + void + Triangulation::add_periodicity + (const std::vector >& + periodicity_vector) + { +#if DEAL_II_P4EST_VERSION_GTE(0,3,4,1) + typedef std::vector > + FaceVector; + + typename FaceVector::const_iterator it, end_periodic; + it = periodicity_vector.begin(); + end_periodic = periodicity_vector.end(); + + std::vector > periodic_faces; + + for(; it!=end_periodic; ++it) + { + const cell_iterator cell1 = std_cxx1x::get<0> (*it); + const cell_iterator cell2 = std_cxx1x::get<2> (*it); + const unsigned int face_idx1 = std_cxx1x::get<1> (*it); + const unsigned int face_idx2 = std_cxx1x::get<3> (*it); + const GridTools::PeriodicFacePair matched_face + = {{cell1, cell2},{face_idx1, face_idx2}, 1}; + periodic_faces.push_back(matched_face); + } + + add_periodicity(periodic_faces); +#else + Assert(false, ExcMessage ("Need p4est version >= 0.3.4.1!")); +#endif + } template @@ -3238,9 +3606,64 @@ namespace parallel template void Triangulation:: - copy_triangulation (const dealii::Triangulation &) + copy_triangulation (const dealii::Triangulation &old_tria) { - Assert (false, ExcNotImplemented()); + try + { + dealii::Triangulation:: + copy_triangulation (old_tria); + } + catch (const typename dealii::Triangulation::DistortedCellList &) + { + // the underlying triangulation should not be checking for distorted + // cells + AssertThrow (false, ExcInternalError()); + } + + // note that now we have some content in the p4est objects and call the + // functions that do the actual work (which are dimension dependent, so + // separate) + triangulation_has_content = true; + + Assert (old_tria.n_levels() == 1, + ExcMessage ("Parallel distributed triangulations can only be copied, " + "if they are not refined!")); + + if (const dealii::parallel::distributed::Triangulation * + old_tria_x = dynamic_cast *>(&old_tria)) + { + Assert (!old_tria_x->refinement_in_progress, + ExcMessage ("Parallel distributed triangulations can only " + "be copied, if no refinement is in progress!")); + + mpi_communicator = Utilities::MPI::duplicate_communicator (old_tria_x->get_communicator ()); + + coarse_cell_to_p4est_tree_permutation = old_tria_x->coarse_cell_to_p4est_tree_permutation; + p4est_tree_to_coarse_cell_permutation = old_tria_x->p4est_tree_to_coarse_cell_permutation; + attached_data_size = old_tria_x->attached_data_size; + n_attached_datas = old_tria_x->n_attached_datas; + + settings = old_tria_x->settings; + } + else + { + setup_coarse_cell_to_p4est_tree_permutation (); + } + + copy_new_triangulation_to_p4est (dealii::internal::int2type()); + + try + { + copy_local_forest_to_triangulation (); + } + catch (const typename Triangulation::DistortedCellList &) + { + // the underlying triangulation should not be checking for distorted + // cells + AssertThrow (false, ExcInternalError()); + } + + update_number_cache (); } @@ -3249,9 +3672,8 @@ namespace parallel Triangulation:: attach_mesh_data() { - // determine size of memory in bytes to - // attach to each cell. This needs to - // be constant because of p4est. + // determine size of memory in bytes to attach to each cell. This needs + // to be constant because of p4est. if (attached_data_size==0) { Assert(n_attached_datas==0, ExcInternalError()); @@ -3295,10 +3717,33 @@ namespace parallel } } + template + typename dealii::Triangulation::cell_iterator + cell_from_quad + (typename dealii::parallel::distributed::Triangulation *triangulation, + typename dealii::internal::p4est::types::topidx treeidx, + typename dealii::internal::p4est::types::quadrant &quad) + { + int i, l = quad.level; + int child_id; + const std::vector perm = triangulation->get_p4est_tree_to_coarse_cell_permutation (); + types::global_dof_index dealii_index = perm[treeidx]; + + for (i = 0; i < l; i++) { + typename dealii::Triangulation::cell_iterator cell (triangulation, i, dealii_index); + child_id = internal::p4est::functions::quadrant_ancestor_id (&quad, i + 1); + Assert (cell->has_children (), ExcMessage ("p4est quadrant does not correspond to a cell!")); + dealii_index = cell->child_index(child_id); + } + + typename dealii::Triangulation::cell_iterator out_cell (triangulation, l, dealii_index); + + return out_cell; + } + - // TODO: again problems with specialization in - // only one template argument + // TODO: again problems with specialization in only one template argument template <> Triangulation<1,1>::Triangulation (MPI_Comm) { @@ -3349,10 +3794,10 @@ namespace parallel } template <> - const std::vector & + const std::vector & Triangulation<1,1>::get_p4est_tree_to_coarse_cell_permutation() const { - static std::vector a; + static std::vector a; return a; } diff --git a/deal.II/source/distributed/tria.inst.in b/deal.II/source/distributed/tria.inst.in index 9f1eae89b8..b5199699f3 100644 --- a/deal.II/source/distributed/tria.inst.in +++ b/deal.II/source/distributed/tria.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/dofs/CMakeLists.txt b/deal.II/source/dofs/CMakeLists.txt index c85db4f35c..5f2c031c9d 100644 --- a/deal.II/source/dofs/CMakeLists.txt +++ b/deal.II/source/dofs/CMakeLists.txt @@ -1,45 +1,54 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/dofs/*.h - ) - SET(_src block_info.cc dof_accessor.cc + dof_accessor_get.cc + dof_accessor_set.cc dof_faces.cc dof_handler.cc dof_handler_policy.cc dof_objects.cc dof_renumbering.cc dof_tools.cc + dof_tools_constraints.cc + dof_tools_sparsity.cc number_cache.cc ) SET(_inst block_info.inst.in + dof_accessor_get.inst.in dof_accessor.inst.in + dof_accessor_set.inst.in dof_handler.inst.in dof_handler_policy.inst.in dof_objects.inst.in dof_renumbering.inst.in + dof_tools_constraints.inst.in dof_tools.inst.in + dof_tools_sparsity.inst.in + ) + +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/dofs/*.h ) DEAL_II_ADD_LIBRARY(obj_dofs OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_dofs "${_inst}") - diff --git a/deal.II/source/dofs/block_info.cc b/deal.II/source/dofs/block_info.cc index 9e7dd902f8..5a23113419 100644 --- a/deal.II/source/dofs/block_info.cc +++ b/deal.II/source/dofs/block_info.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/dofs/block_info.inst.in b/deal.II/source/dofs/block_info.inst.in index 5e5b2ed571..a416b87ba8 100644 --- a/deal.II/source/dofs/block_info.inst.in +++ b/deal.II/source/dofs/block_info.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/dofs/dof_accessor.cc b/deal.II/source/dofs/dof_accessor.cc index 255cb70d18..34dbb34906 100644 --- a/deal.II/source/dofs/dof_accessor.cc +++ b/deal.II/source/dofs/dof_accessor.cc @@ -1,26 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - - -#include -#include -#include -#include -#include -#include -#include -#include -#include +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -95,174 +87,6 @@ DoFCellAccessor::neighbor_child_on_subface (const unsigned int face, -template -template -void -DoFCellAccessor:: -get_interpolated_dof_values (const InputVector &values, - Vector &interpolated_values) const -{ - const FiniteElement &fe = this->get_fe(); - const unsigned int dofs_per_cell = fe.dofs_per_cell; - - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&fe != 0, - typename BaseClass::ExcInvalidObject()); - Assert (interpolated_values.size() == dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - - if (!this->has_children()) - // if this cell has no children: simply - // return the exact values on this cell - this->get_dof_values (values, interpolated_values); - else - // otherwise clobber them from the children - { - Vector tmp1(dofs_per_cell); - Vector tmp2(dofs_per_cell); - - interpolated_values = 0; - - // later on we will have to - // push the values interpolated - // from the child to the mother - // cell into the output - // vector. unfortunately, there - // are two types of elements: - // ones where you add up the - // contributions from the - // different child cells, and - // ones where you overwrite. - // - // an example for the first is - // piecewise constant (and - // discontinuous) elements, - // where we build the value on - // the coarse cell by averaging - // the values from the cell - // (i.e. by adding up a - // fraction of the values of - // their values) - // - // an example for the latter - // are the usual continuous - // elements. the value on a - // vertex of a coarse cell must - // there be the same, - // irrespective of the adjacent - // cell we are presently on. so - // we always overwrite. in - // fact, we must, since we - // cannot know in advance how - // many neighbors there will - // be, so there is no way to - // compute the average with - // fixed factors - // - // so we have to find out to - // which type this element - // belongs. the difficulty is: - // the finite element may be a - // composed one, so we can only - // hope to do this for each - // shape function - // individually. in fact, there - // are even weird finite - // elements (for example the - // Raviart-Thomas element) - // which have shape functions - // that are additive (interior - // ones) and others that are - // overwriting (face degrees of - // freedom that need to be - // continuous across the - // face). to avoid checking - // this over and over again, we - // do this once now and cache - // the results - std::vector restriction_is_additive (dofs_per_cell); - for (unsigned int i=0; in_children(); ++child) - { - // get the values from the present - // child, if necessary by - // interpolation itself - this->child(child)->get_interpolated_dof_values (values, - tmp1); - // interpolate these to the mother - // cell - fe.get_restriction_matrix(child, this->refinement_case()).vmult (tmp2, tmp1); - - // and add up or set them - // in the output vector - for (unsigned int i=0; i -template -void -DoFCellAccessor:: -set_dof_values_by_interpolation (const Vector &local_values, - OutputVector &values) const -{ - const unsigned int dofs_per_cell = this->get_fe().dofs_per_cell; - - Assert (this->dof_handler != 0, - typename BaseClass::ExcInvalidObject()); - Assert (&this->get_fe() != 0, - typename BaseClass::ExcInvalidObject()); - Assert (local_values.size() == dofs_per_cell, - typename BaseClass::ExcVectorDoesNotMatch()); - Assert (values.size() == this->dof_handler->n_dofs(), - typename BaseClass::ExcVectorDoesNotMatch()); - - if (!this->has_children()) - // if this cell has no children: simply - // set the values on this cell - this->set_dof_values (local_values, values); - else - // otherwise distribute them to the children - { - Vector tmp(dofs_per_cell); - - for (unsigned int child=0; childn_children(); ++child) - { - Assert (this->child(child)->get_fe().dofs_per_cell == dofs_per_cell, - ExcNotImplemented()); - - // prolong the given data - // to the present - // cell. FullMatrix only - // wants us to call vmult - // if the matrix size is - // actually non-zero, so - // check that case - if (tmp.size() > 0) - { - this->get_fe().get_prolongation_matrix(child, this->refinement_case()) - .vmult (tmp, local_values); - - this->child(child)->set_dof_values_by_interpolation (tmp, values); - } - } - } -} - - - // -------------------------------------------------------------------------- // explicit instantiations #include "dof_accessor.inst" diff --git a/deal.II/source/dofs/dof_accessor.inst.in b/deal.II/source/dofs/dof_accessor.inst.in index e433bbb599..297e98c829 100644 --- a/deal.II/source/dofs/dof_accessor.inst.in +++ b/deal.II/source/dofs/dof_accessor.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // TODO: This could surely be made more systematic! @@ -161,82 +165,3 @@ for (deal_II_dimension : DIMENSIONS; lda : BOOL) #endif } - -for (VEC : SERIAL_VECTORS; SCALAR : REAL_SCALARS; deal_II_dimension : DIMENSIONS; lda : BOOL) - { - template - void - DoFCellAccessor, lda>::get_interpolated_dof_values - (const VEC&, Vector&) const; - template - void - DoFCellAccessor, lda>::set_dof_values_by_interpolation - (const Vector&, VEC&) const; - -#if deal_II_dimension != 3 - - template - void - DoFCellAccessor, lda>::get_interpolated_dof_values - (const VEC&, Vector&) const; - template - void - DoFCellAccessor, lda>::set_dof_values_by_interpolation - (const Vector&, VEC&) const; - -#endif - -#if deal_II_dimension == 3 - - template - void - DoFCellAccessor, lda>::get_interpolated_dof_values - (const VEC&, Vector&) const; - template - void - DoFCellAccessor, lda>::set_dof_values_by_interpolation - (const Vector&, VEC&) const; - -#endif - - } - - -for (VEC : SERIAL_VECTORS; SCALAR : REAL_SCALARS; deal_II_dimension : DIMENSIONS; lda : BOOL) - { - template - void - DoFCellAccessor, lda>::get_interpolated_dof_values - (const VEC&, Vector&) const; - template - void - DoFCellAccessor, lda>::set_dof_values_by_interpolation - (const Vector&, VEC&) const; - -#if deal_II_dimension != 3 - - template - void - DoFCellAccessor, lda>::get_interpolated_dof_values - (const VEC&, Vector&) const; - template - void - DoFCellAccessor, lda>::set_dof_values_by_interpolation - (const Vector&, VEC&) const; - -#endif - -#if deal_II_dimension == 3 - - template - void - DoFCellAccessor, lda>::get_interpolated_dof_values - (const VEC&, Vector&) const; - template - void - DoFCellAccessor, lda>::set_dof_values_by_interpolation - (const Vector&, VEC&) const; - -#endif - } - diff --git a/deal.II/source/dofs/dof_accessor_get.cc b/deal.II/source/dofs/dof_accessor_get.cc new file mode 100644 index 0000000000..9b9ca8b7b8 --- /dev/null +++ b/deal.II/source/dofs/dof_accessor_get.cc @@ -0,0 +1,125 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +DEAL_II_NAMESPACE_OPEN + + +template +template +void +DoFCellAccessor:: +get_interpolated_dof_values (const InputVector &values, + Vector &interpolated_values) const +{ + const FiniteElement &fe = this->get_fe(); + const unsigned int dofs_per_cell = fe.dofs_per_cell; + + Assert (this->dof_handler != 0, + typename BaseClass::ExcInvalidObject()); + Assert (&fe != 0, + typename BaseClass::ExcInvalidObject()); + Assert (interpolated_values.size() == dofs_per_cell, + typename BaseClass::ExcVectorDoesNotMatch()); + Assert (values.size() == this->dof_handler->n_dofs(), + typename BaseClass::ExcVectorDoesNotMatch()); + + if (!this->has_children()) + // if this cell has no children: simply return the exact values on this + // cell + this->get_dof_values (values, interpolated_values); + else + // otherwise clobber them from the children + { + Vector tmp1(dofs_per_cell); + Vector tmp2(dofs_per_cell); + + interpolated_values = 0; + + // later on we will have to push the values interpolated from the child + // to the mother cell into the output vector. unfortunately, there are + // two types of elements: ones where you add up the contributions from + // the different child cells, and ones where you overwrite. + // + // an example for the first is piecewise constant (and discontinuous) + // elements, where we build the value on the coarse cell by averaging + // the values from the cell (i.e. by adding up a fraction of the values + // of their values) + // + // an example for the latter are the usual continuous elements. the + // value on a vertex of a coarse cell must there be the same, + // irrespective of the adjacent cell we are presently on. so we always + // overwrite. in fact, we must, since we cannot know in advance how many + // neighbors there will be, so there is no way to compute the average + // with fixed factors + // + // so we have to find out to which type this element belongs. the + // difficulty is: the finite element may be a composed one, so we can + // only hope to do this for each shape function individually. in fact, + // there are even weird finite elements (for example the Raviart-Thomas + // element) which have shape functions that are additive (interior ones) + // and others that are overwriting (face degrees of freedom that need to + // be continuous across the face). to avoid checking this over and over + // again, we do this once now and cache the results + std::vector restriction_is_additive (dofs_per_cell); + for (unsigned int i=0; in_children(); ++child) + { + // get the values from the present child, if necessary by + // interpolation itself + this->child(child)->get_interpolated_dof_values (values, + tmp1); + // interpolate these to the mother cell + fe.get_restriction_matrix(child, this->refinement_case()).vmult (tmp2, tmp1); + + // and add up or set them in the output vector + for (unsigned int i=0; i, lda>::get_interpolated_dof_values + (const VEC&, Vector&) const; + +#if deal_II_dimension != 3 + + template + void + DoFCellAccessor, lda>::get_interpolated_dof_values + (const VEC&, Vector&) const; + +#endif + +#if deal_II_dimension == 3 + + template + void + DoFCellAccessor, lda>::get_interpolated_dof_values + (const VEC&, Vector&) const; + +#endif + + } + + +for (VEC : SERIAL_VECTORS; SCALAR : REAL_SCALARS; deal_II_dimension : DIMENSIONS; lda : BOOL) + { + template + void + DoFCellAccessor, lda>::get_interpolated_dof_values + (const VEC&, Vector&) const; + +#if deal_II_dimension != 3 + + template + void + DoFCellAccessor, lda>::get_interpolated_dof_values + (const VEC&, Vector&) const; + +#endif + +#if deal_II_dimension == 3 + + template + void + DoFCellAccessor, lda>::get_interpolated_dof_values + (const VEC&, Vector&) const; + +#endif + } + diff --git a/deal.II/source/dofs/dof_accessor_set.cc b/deal.II/source/dofs/dof_accessor_set.cc new file mode 100644 index 0000000000..f11fc845a0 --- /dev/null +++ b/deal.II/source/dofs/dof_accessor_set.cc @@ -0,0 +1,93 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +DEAL_II_NAMESPACE_OPEN + + + +template +template +void +DoFCellAccessor:: +set_dof_values_by_interpolation (const Vector &local_values, + OutputVector &values) const +{ + const unsigned int dofs_per_cell = this->get_fe().dofs_per_cell; + + Assert (this->dof_handler != 0, + typename BaseClass::ExcInvalidObject()); + Assert (&this->get_fe() != 0, + typename BaseClass::ExcInvalidObject()); + Assert (local_values.size() == dofs_per_cell, + typename BaseClass::ExcVectorDoesNotMatch()); + Assert (values.size() == this->dof_handler->n_dofs(), + typename BaseClass::ExcVectorDoesNotMatch()); + + if (!this->has_children()) + // if this cell has no children: simply set the values on this cell + this->set_dof_values (local_values, values); + else + // otherwise distribute them to the children + { + Vector tmp(dofs_per_cell); + + for (unsigned int child=0; childn_children(); ++child) + { + Assert (this->child(child)->get_fe().dofs_per_cell == dofs_per_cell, + ExcNotImplemented()); + + // prolong the given data to the present cell. FullMatrix only wants + // us to call vmult if the matrix size is actually non-zero, so + // check that case + if (tmp.size() > 0) + { + this->get_fe().get_prolongation_matrix(child, this->refinement_case()) + .vmult (tmp, local_values); + + this->child(child)->set_dof_values_by_interpolation (tmp, values); + } + } + } +} + + + +// -------------------------------------------------------------------------- +// explicit instantiations +#include "dof_accessor_set.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/dofs/dof_accessor_set.inst.in b/deal.II/source/dofs/dof_accessor_set.inst.in new file mode 100644 index 0000000000..74948318e8 --- /dev/null +++ b/deal.II/source/dofs/dof_accessor_set.inst.in @@ -0,0 +1,72 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +for (VEC : SERIAL_VECTORS; SCALAR : REAL_SCALARS; deal_II_dimension : DIMENSIONS; lda : BOOL) + { + template + void + DoFCellAccessor, lda>::set_dof_values_by_interpolation + (const Vector&, VEC&) const; + +#if deal_II_dimension != 3 + + template + void + DoFCellAccessor, lda>::set_dof_values_by_interpolation + (const Vector&, VEC&) const; + +#endif + +#if deal_II_dimension == 3 + + template + void + DoFCellAccessor, lda>::set_dof_values_by_interpolation + (const Vector&, VEC&) const; + +#endif + + } + + +for (VEC : SERIAL_VECTORS; SCALAR : REAL_SCALARS; deal_II_dimension : DIMENSIONS; lda : BOOL) + { + template + void + DoFCellAccessor, lda>::set_dof_values_by_interpolation + (const Vector&, VEC&) const; + +#if deal_II_dimension != 3 + + template + void + DoFCellAccessor, lda>::set_dof_values_by_interpolation + (const Vector&, VEC&) const; + +#endif + +#if deal_II_dimension == 3 + + template + void + DoFCellAccessor, lda>::set_dof_values_by_interpolation + (const Vector&, VEC&) const; + +#endif + } + diff --git a/deal.II/source/dofs/dof_faces.cc b/deal.II/source/dofs/dof_faces.cc index 66f146b63d..e5944bf73c 100644 --- a/deal.II/source/dofs/dof_faces.cc +++ b/deal.II/source/dofs/dof_faces.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/dofs/dof_handler.cc b/deal.II/source/dofs/dof_handler.cc index 093d7f0a4a..6aaaef2dd8 100644 --- a/deal.II/source/dofs/dof_handler.cc +++ b/deal.II/source/dofs/dof_handler.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -87,7 +89,7 @@ namespace internal max_couplings_between_dofs (const DoFHandler<1,spacedim> &dof_handler) { return std::min(static_cast(3*dof_handler.selected_fe->dofs_per_vertex + - 2*dof_handler.selected_fe->dofs_per_line), + 2*dof_handler.selected_fe->dofs_per_line), dof_handler.n_dofs()); } diff --git a/deal.II/source/dofs/dof_handler.inst.in b/deal.II/source/dofs/dof_handler.inst.in index 9f9ccbf7ba..594bbd4c4a 100644 --- a/deal.II/source/dofs/dof_handler.inst.in +++ b/deal.II/source/dofs/dof_handler.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/dofs/dof_handler_policy.cc b/deal.II/source/dofs/dof_handler_policy.cc index b28d6f65e1..3db4b2104a 100644 --- a/deal.II/source/dofs/dof_handler_policy.cc +++ b/deal.II/source/dofs/dof_handler_policy.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + //TODO [TH]: renumber DoFs for multigrid is not done yet @@ -585,16 +589,16 @@ namespace internal const bool check_validity) { for (typename std::vector::MGVertexDoFs>::iterator - i=dof_handler.mg_vertex_dofs.begin(); + i=dof_handler.mg_vertex_dofs.begin(); i!=dof_handler.mg_vertex_dofs.end(); - ++i) + ++i) // if the present vertex lives on // the current level if ((i->get_coarsest_level() <= level) && (i->get_finest_level() >= level)) for (unsigned int d=0; dget_index (level, d); + dealii::types::global_dof_index idx = i->get_index (level, d); if (idx != DoFHandler<1>::invalid_dof_index) i->set_index (level, d, (indices.n_elements() == 0)? @@ -607,9 +611,9 @@ namespace internal for (std::vector::iterator - i=dof_handler.mg_levels[level]->dof_object.dofs.begin(); + i=dof_handler.mg_levels[level]->dof_object.dofs.begin(); i!=dof_handler.mg_levels[level]->dof_object.dofs.end(); - ++i) + ++i) { if (*i != DoFHandler<1>::invalid_dof_index) { @@ -739,7 +743,7 @@ namespace internal { for (unsigned int d=0; dline(l)->mg_dof_index(level, d); + dealii::types::global_dof_index idx = cell->line(l)->mg_dof_index(level, d); if (idx != DoFHandler<1>::invalid_dof_index) cell->line(l)->set_mg_dof_index (level, d, ((indices.n_elements() == 0) ? new_numbers[idx] : @@ -842,8 +846,8 @@ namespace internal static void renumber_mg_dofs (const std::vector &, - const IndexSet &, - DoFHandler<3,spacedim> &, + const IndexSet &, + DoFHandler<3,spacedim> &, const unsigned int , const bool ) { @@ -1208,6 +1212,33 @@ namespace internal } } + //additionally (multigrid only), we can have the case that children of our neighbor + //have us as a neighbor. In this case we and the children are active. + if (dealii_cell->active()) + { + for (unsigned int f=0;f::faces_per_cell;++f) + { + if (dealii_cell->at_boundary(f)) + continue; + typename DoFHandler::level_cell_iterator neighbor = dealii_cell->neighbor(f); + if (!neighbor->has_children()) + continue; + + for (unsigned int subface=0; subface::max_children_per_face; ++subface) + { + typename DoFHandler::level_cell_iterator child = dealii_cell->neighbor_child_on_subface(f,subface); + dealii::types::subdomain_id dest = child->subdomain_id(); + Assert(dest != dealii::numbers::artificial_subdomain_id, ExcInternalError()); + if (dest != tria.locally_owned_subdomain()) + send_to.insert(dest); + } + + } + + } + + + // send if we have something to send if (send_to.size() > 0) { // this cell's dof_indices @@ -1323,7 +1354,7 @@ namespace internal const typename dealii::internal::p4est::types::quadrant &p4est_cell, const typename DoFHandler::level_cell_iterator &dealii_cell, const typename dealii::internal::p4est::types::quadrant &quadrant, - dealii::types::global_dof_index* dofs, + dealii::types::global_dof_index *dofs, unsigned int level) { if (internal::p4est::quadrant_is_equal(p4est_cell, quadrant)) @@ -1578,10 +1609,10 @@ namespace internal =reinterpret_cast::quadrant *>(ptr); ptr+=cells*sizeof(typename dealii::internal::p4est::types::quadrant); dealii::types::global_dof_index *dofs - = reinterpret_cast(ptr); + = reinterpret_cast(ptr); - // the dofs pointer contains for each cell the number of dofs - // on that cell (dofs[0]) followed by the dof indices itself. + // the dofs pointer contains for each cell the number of dofs + // on that cell (dofs[0]) followed by the dof indices itself. for (unsigned int c=0; c::level_cell_iterator @@ -1802,6 +1833,10 @@ namespace internal MPI_Get_count(&status, MPI_BYTE, &len); receive.resize(len); +#ifdef DEBUG + Assert(senders.find(status.MPI_SOURCE)!=senders.end(), ExcInternalError()); +#endif + char *ptr = &receive[0]; MPI_Recv(ptr, len, MPI_BYTE, status.MPI_SOURCE, status.MPI_TAG, tr->get_communicator(), &status); @@ -1817,10 +1852,10 @@ namespace internal =reinterpret_cast::quadrant *>(ptr); ptr+=cells*sizeof(typename dealii::internal::p4est::types::quadrant); dealii::types::global_dof_index *dofs - = reinterpret_cast(ptr); + = reinterpret_cast(ptr); - // the dofs pointer contains for each cell the number of dofs - // on that cell (dofs[0]) followed by the dof indices itself. + // the dofs pointer contains for each cell the number of dofs + // on that cell (dofs[0]) followed by the dof indices itself. for (unsigned int c=0; c::level_cell_iterator @@ -1857,8 +1892,8 @@ namespace internal unsigned int sent=needs_to_get_cells.size(); unsigned int recv=senders.size(); - MPI_Reduce(&sent, &sum_send, 1, MPI_UNSIGNED, MPI_SUM, 0, tr->get_communicator()); - MPI_Reduce(&recv, &sum_recv, 1, MPI_UNSIGNED, MPI_SUM, 0, tr->get_communicator()); + MPI_Reduce(&sent, &sum_send, 1, MPI_UNSIGNED, MPI_SUM, 56345, tr->get_communicator()); + MPI_Reduce(&recv, &sum_recv, 1, MPI_UNSIGNED, MPI_SUM, 56346, tr->get_communicator()); Assert(sum_send==sum_recv, ExcInternalError()); } #endif @@ -2054,25 +2089,14 @@ namespace internal if (!cell->is_artificial()) cell->set_user_flag(); - //mark the vertices we are interested - //in, i.e. belonging to own and marked cells - const std::vector locally_active_vertices - = mark_locally_active_vertices (*tr); - // add each ghostcells' // subdomain to the vertex and // keep track of interesting // neighbors std::map > vertices_with_ghost_neighbors; - for (typename DoFHandler::active_cell_iterator - cell = dof_handler.begin_active(); - cell != dof_handler.end(); ++cell) - if (cell->is_ghost ()) - for (unsigned int v=0; v::vertices_per_cell; ++v) - if (locally_active_vertices[cell->vertex_index(v)]) - vertices_with_ghost_neighbors[cell->vertex_index(v)] - .insert (cell->subdomain_id()); + + tr->fill_vertices_with_ghost_neighbors (vertices_with_ghost_neighbors); /* Send and receive cells. After this, @@ -2316,7 +2340,8 @@ namespace internal for (typename DoFHandler::level_cell_iterator cell = dof_handler.begin(level); cell != dof_handler.end(level); ++cell) - if (cell->level_subdomain_id() != dealii::numbers::artificial_subdomain_id && cell->level_subdomain_id() != tr->locally_owned_subdomain()) + if (cell->level_subdomain_id() != dealii::numbers::artificial_subdomain_id + && cell->level_subdomain_id() != tr->locally_owned_subdomain()) for (unsigned int v=0; v::vertices_per_cell; ++v) if (locally_active_vertices[cell->vertex_index(v)]) vertices_with_ghost_neighbors[cell->vertex_index(v)] @@ -2360,7 +2385,7 @@ namespace internal local_dof_indices.end(), DoFHandler::invalid_dof_index)) { - Assert(false, ExcMessage ("not all dofs got distributed!")); + Assert(false, ExcMessage ("not all DoFs got distributed!")); } } } @@ -2451,7 +2476,7 @@ namespace internal // to blocks. If yes, we can add the block // ranges to the IndexSet, otherwise we need // to go through the indices once again and - // add each element individually (slow!) + // add each element individually unsigned int sum = 0; for (unsigned int i=0; iis_artificial()) cell->set_user_flag(); - //mark the vertices we are interested - //in, i.e. belonging to own and marked cells - const std::vector locally_active_vertices - = mark_locally_active_vertices (*tr); // add each ghostcells' // subdomain to the vertex and @@ -2554,14 +2574,8 @@ namespace internal // neighbors std::map > vertices_with_ghost_neighbors; - for (typename DoFHandler::active_cell_iterator - cell = dof_handler.begin_active(); - cell != dof_handler.end(); ++cell) - if (cell->is_ghost ()) - for (unsigned int v=0; v::vertices_per_cell; ++v) - if (locally_active_vertices[cell->vertex_index(v)]) - vertices_with_ghost_neighbors[cell->vertex_index(v)] - .insert (cell->subdomain_id()); + + tr->fill_vertices_with_ghost_neighbors (vertices_with_ghost_neighbors); // Send and receive cells. After this, only // the local cells are marked, that received diff --git a/deal.II/source/dofs/dof_handler_policy.inst.in b/deal.II/source/dofs/dof_handler_policy.inst.in index dbe008f664..9b86beb03f 100644 --- a/deal.II/source/dofs/dof_handler_policy.inst.in +++ b/deal.II/source/dofs/dof_handler_policy.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/dofs/dof_objects.cc b/deal.II/source/dofs/dof_objects.cc index 6fbb7f37aa..113bf75afb 100644 --- a/deal.II/source/dofs/dof_objects.cc +++ b/deal.II/source/dofs/dof_objects.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/dofs/dof_objects.inst.in b/deal.II/source/dofs/dof_objects.inst.in index 08e28bcc33..5f234b43b6 100644 --- a/deal.II/source/dofs/dof_objects.inst.in +++ b/deal.II/source/dofs/dof_objects.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2010, 2011 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/dofs/dof_renumbering.cc b/deal.II/source/dofs/dof_renumbering.cc index 979cd02e91..2bc1ed384c 100644 --- a/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/source/dofs/dof_renumbering.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -437,12 +439,24 @@ namespace DoFRenumbering { Assert(dof_handler.n_dofs(level) != numbers::invalid_dof_index, ExcNotInitialized()); -//TODO: we should be doing the same here as in the other compute_CMK function to preserve some memory // make the connection graph - SparsityPattern sparsity (dof_handler.n_dofs(level), - dof_handler.max_couplings_between_dofs()); - MGTools::make_sparsity_pattern (dof_handler, sparsity, level); + SparsityPattern sparsity; + if (DH::dimension < 2) + { + sparsity.reinit (dof_handler.n_dofs(level), + dof_handler.n_dofs(level), + dof_handler.max_couplings_between_dofs()); + MGTools::make_sparsity_pattern (dof_handler, sparsity, level); + sparsity.compress(); + } + else + { + CompressedSimpleSparsityPattern csp (dof_handler.n_dofs(level), + dof_handler.n_dofs(level)); + MGTools::make_sparsity_pattern (dof_handler, csp, level); + sparsity.copy_from (csp); + } std::vector new_indices(sparsity.n_rows()); SparsityTools::reorder_Cuthill_McKee (sparsity, new_indices, @@ -521,7 +535,7 @@ namespace DoFRenumbering { //TODO: Merge with previous function std::vector renumbering (dof_handler.n_dofs(), - hp::DoFHandler::invalid_dof_index); + hp::DoFHandler::invalid_dof_index); typename hp::DoFHandler::active_cell_iterator start = dof_handler.begin_active(); @@ -554,7 +568,7 @@ namespace DoFRenumbering ExcNotInitialized()); std::vector renumbering (dof_handler.n_dofs(level), - DH::invalid_dof_index); + DH::invalid_dof_index); typename DH::level_cell_iterator start =dof_handler.begin(level); typename DH::level_cell_iterator end = dof_handler.end(level); @@ -747,10 +761,10 @@ namespace DoFRenumbering Utilities::MPI::n_mpi_processes (tria->get_communicator())); MPI_Allgather ( &local_dof_count[0], - n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - &all_dof_counts[0], n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - tria->get_communicator()); + &all_dof_counts[0], + n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, + tria->get_communicator()); for (unsigned int i=0; ilocally_owned_subdomain()+i] @@ -820,7 +834,7 @@ namespace DoFRenumbering block_wise (DoFHandler &dof_handler) { std::vector renumbering (dof_handler.n_locally_owned_dofs(), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); typename DoFHandler::active_cell_iterator start = dof_handler.begin_active(); @@ -889,7 +903,7 @@ namespace DoFRenumbering ExcNotInitialized()); std::vector renumbering (dof_handler.n_dofs(level), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); typename DoFHandler::level_cell_iterator start =dof_handler.begin(level); @@ -1044,13 +1058,13 @@ namespace DoFRenumbering all_dof_counts(fe_collection.n_components() * Utilities::MPI::n_mpi_processes (tria->get_communicator())); - Assert (sizeof(types::global_dof_index) == sizeof(unsigned int), - ExcNotImplemented()); + Assert (sizeof(types::global_dof_index) == sizeof(unsigned int), + ExcNotImplemented()); MPI_Allgather ( &local_dof_count[0], - n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - &all_dof_counts[0], n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, - tria->get_communicator()); + &all_dof_counts[0], + n_buckets, DEAL_II_DOF_INDEX_MPI_TYPE, + tria->get_communicator()); for (unsigned int i=0; ilocally_owned_subdomain()+i] @@ -1172,7 +1186,7 @@ namespace DoFRenumbering hierarchical (DoFHandler &dof_handler) { std::vector renumbering (dof_handler.n_locally_owned_dofs(), - DoFHandler::invalid_dof_index); + DoFHandler::invalid_dof_index); typename DoFHandler::level_cell_iterator cell; @@ -1186,11 +1200,11 @@ namespace DoFRenumbering if (tria) { #ifdef DEAL_II_WITH_P4EST - //this is a distributed Triangulation. We need to traverse the coarse - //cells in the order p4est does + // this is a distributed Triangulation. We need to traverse the coarse + // cells in the order p4est does for (unsigned int c = 0; c < tria->n_cells (0); ++c) { - unsigned int coarse_cell_index = + const unsigned int coarse_cell_index = tria->get_p4est_tree_to_coarse_cell_permutation() [c]; const typename DoFHandler::level_cell_iterator @@ -1265,7 +1279,7 @@ namespace DoFRenumbering ExcNotInitialized()); std::vector renumbering(dof_handler.n_dofs(level), - DH::invalid_dof_index); + DH::invalid_dof_index); compute_sort_selected_dofs_back(renumbering, dof_handler, selected_dofs, level); dof_handler.renumber_dofs(level, renumbering); @@ -1540,14 +1554,18 @@ namespace DoFRenumbering { if (dof_wise_renumbering == false) { - std::vector - ordered_cells(dof.get_tria().n_active_cells()); + std::vector ordered_cells; + ordered_cells.reserve(dof.get_tria().n_active_cells()); const CompareDownstream comparator(direction); - typename DH::active_cell_iterator begin = dof.begin_active(); + typename DH::active_cell_iterator p = dof.begin_active(); typename DH::active_cell_iterator end = dof.end(); - copy (begin, end, ordered_cells.begin()); + while (p!=end) + { + ordered_cells.push_back(p); + ++p; + } std::sort (ordered_cells.begin(), ordered_cells.end(), comparator); compute_cell_wise(new_indices, reverse, dof, ordered_cells); @@ -1643,14 +1661,18 @@ namespace DoFRenumbering { if (dof_wise_renumbering == false) { - std::vector - ordered_cells(dof.get_tria().n_cells(level)); + std::vector ordered_cells; + ordered_cells.reserve (dof.get_tria().n_cells(level)); const CompareDownstream comparator(direction); - typename DH::level_cell_iterator begin = dof.begin(level); + typename DH::level_cell_iterator p = dof.begin(level); typename DH::level_cell_iterator end = dof.end(level); - std::copy (begin, end, ordered_cells.begin()); + while (p!=end) + { + ordered_cells.push_back(p); + ++p; + } std::sort (ordered_cells.begin(), ordered_cells.end(), comparator); compute_cell_wise(new_indices, reverse, dof, level, ordered_cells); @@ -1796,14 +1818,18 @@ namespace DoFRenumbering const Point ¢er, const bool counter) { - std::vector - ordered_cells(dof.get_tria().n_active_cells()); + std::vector ordered_cells; + ordered_cells.reserve (dof.get_tria().n_active_cells()); internal::ClockCells comparator(center, counter); - typename DH::active_cell_iterator begin = dof.begin_active(); + typename DH::active_cell_iterator p = dof.begin_active(); typename DH::active_cell_iterator end = dof.end(); - std::copy (begin, end, ordered_cells.begin()); + while (p!=end) + { + ordered_cells.push_back(p); + ++p; + } std::sort (ordered_cells.begin(), ordered_cells.end(), comparator); std::vector reverse(new_indices.size()); @@ -1818,14 +1844,18 @@ namespace DoFRenumbering const Point ¢er, const bool counter) { - std::vector - ordered_cells(dof.get_tria().n_cells(level)); + std::vector ordered_cells; + ordered_cells.reserve(dof.get_tria().n_active_cells()); internal::ClockCells comparator(center, counter); - typename DH::level_cell_iterator begin = dof.begin(level); + typename DH::level_cell_iterator p = dof.begin(level); typename DH::level_cell_iterator end = dof.end(level); - std::copy (begin, end, ordered_cells.begin()); + while (p!=end) + { + ordered_cells.push_back(p); + ++p; + } std::sort (ordered_cells.begin(), ordered_cells.end(), comparator); cell_wise(dof, level, ordered_cells); diff --git a/deal.II/source/dofs/dof_renumbering.inst.in b/deal.II/source/dofs/dof_renumbering.inst.in index cfde20f725..c8c1115558 100644 --- a/deal.II/source/dofs/dof_renumbering.inst.in +++ b/deal.II/source/dofs/dof_renumbering.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { diff --git a/deal.II/source/dofs/dof_tools.cc b/deal.II/source/dofs/dof_tools.cc index 9e8c83936c..51b5f2ec55 100644 --- a/deal.II/source/dofs/dof_tools.cc +++ b/deal.II/source/dofs/dof_tools.cc @@ -1,3219 +1,58 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -DEAL_II_NAMESPACE_OPEN - - - -namespace DoFTools -{ - - template - void - make_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, - const ConstraintMatrix &constraints, - const bool keep_constrained_dofs, - const types::subdomain_id subdomain_id) - { - const types::global_dof_index n_dofs = dof.n_dofs(); - - Assert (sparsity.n_rows() == n_dofs, - ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); - Assert (sparsity.n_cols() == n_dofs, - ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); - - // If we have a distributed::Triangulation only allow locally_owned - // subdomain. Not setting a subdomain is also okay, because we skip - // ghost cells in the loop below. - Assert ( - (dof.get_tria().locally_owned_subdomain() == numbers::invalid_subdomain_id) - || - (subdomain_id == numbers::invalid_subdomain_id) - || - (subdomain_id == dof.get_tria().locally_owned_subdomain()), - ExcMessage ("For parallel::distributed::Triangulation objects and " - "associated DoF handler objects, asking for any subdomain other " - "than the locally owned one does not make sense.")); - - std::vector dofs_on_this_cell; - dofs_on_this_cell.reserve (max_dofs_per_cell(dof)); - typename DH::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); - - // In case we work with a distributed sparsity pattern of Trilinos - // type, we only have to do the work if the current cell is owned by - // the calling processor. Otherwise, just continue. - for (; cell!=endc; ++cell) - if (((subdomain_id == numbers::invalid_subdomain_id) - || - (subdomain_id == cell->subdomain_id())) - && - cell->is_locally_owned()) - { - const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; - dofs_on_this_cell.resize (dofs_per_cell); - cell->get_dof_indices (dofs_on_this_cell); - - // make sparsity pattern for this cell. if no constraints pattern - // was given, then the following call acts as if simply no - // constraints existed - constraints.add_entries_local_to_global (dofs_on_this_cell, - sparsity, - keep_constrained_dofs); - } - } - - - - template - void - make_sparsity_pattern (const DH &dof, - const Table<2,Coupling> &couplings, - SparsityPattern &sparsity, - const ConstraintMatrix &constraints, - const bool keep_constrained_dofs, - const types::subdomain_id subdomain_id) - { - const types::global_dof_index n_dofs = dof.n_dofs(); - - Assert (sparsity.n_rows() == n_dofs, - ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); - Assert (sparsity.n_cols() == n_dofs, - ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); - Assert (couplings.n_rows() == dof.get_fe().n_components(), - ExcDimensionMismatch(couplings.n_rows(), dof.get_fe().n_components())); - Assert (couplings.n_cols() == dof.get_fe().n_components(), - ExcDimensionMismatch(couplings.n_cols(), dof.get_fe().n_components())); - - // If we have a distributed::Triangulation only allow locally_owned - // subdomain. Not setting a subdomain is also okay, because we skip - // ghost cells in the loop below. - Assert ( - (dof.get_tria().locally_owned_subdomain() == numbers::invalid_subdomain_id) - || - (subdomain_id == numbers::invalid_subdomain_id) - || - (subdomain_id == dof.get_tria().locally_owned_subdomain()), - ExcMessage ("For parallel::distributed::Triangulation objects and " - "associated DoF handler objects, asking for any subdomain other " - "than the locally owned one does not make sense.")); - - const hp::FECollection fe_collection (dof.get_fe()); - - // first, for each finite element, build a mask for each dof, not like - // the one given which represents components. make sure we do the right - // thing also with respect to non-primitive shape functions, which - // takes some additional thought - std::vector > dof_mask(fe_collection.size()); - - // check whether the table of couplings contains only true arguments, - // i.e., we do not exclude any index. that is the easy case, since we - // don't have to set up the tables - bool need_dof_mask = false; - for (unsigned int i=0; i dofs_on_this_cell(fe_collection.max_dofs_per_cell()); - typename DH::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); - - // In case we work with a distributed sparsity pattern of Trilinos - // type, we only have to do the work if the current cell is owned by - // the calling processor. Otherwise, just continue. - for (; cell!=endc; ++cell) - if (((subdomain_id == numbers::invalid_subdomain_id) - || - (subdomain_id == cell->subdomain_id())) - && - cell->is_locally_owned()) - { - const unsigned int fe_index = cell->active_fe_index(); - const unsigned int dofs_per_cell =fe_collection[fe_index].dofs_per_cell; - - dofs_on_this_cell.resize (dofs_per_cell); - cell->get_dof_indices (dofs_on_this_cell); - - - // make sparsity pattern for this cell. if no constraints pattern - // was given, then the following call acts as if simply no - // constraints existed - constraints.add_entries_local_to_global (dofs_on_this_cell, - sparsity, - keep_constrained_dofs, - dof_mask[fe_index]); - } - } - - - - template - void - make_sparsity_pattern ( - const DH &dof_row, - const DH &dof_col, - SparsityPattern &sparsity) - { - const types::global_dof_index n_dofs_row = dof_row.n_dofs(); - const types::global_dof_index n_dofs_col = dof_col.n_dofs(); - - Assert (sparsity.n_rows() == n_dofs_row, - ExcDimensionMismatch (sparsity.n_rows(), n_dofs_row)); - Assert (sparsity.n_cols() == n_dofs_col, - ExcDimensionMismatch (sparsity.n_cols(), n_dofs_col)); - -//TODO: Looks like wasteful memory management here - - const std::list > - cell_list - = GridTools::get_finest_common_cells (dof_row, dof_col); - - - typename std::list >::const_iterator - cell_iter = cell_list.begin(); - - for (; cell_iter!=cell_list.end(); ++cell_iter) - { - const typename DH::cell_iterator cell_row = cell_iter->first; - const typename DH::cell_iterator cell_col = cell_iter->second; - - if (!cell_row->has_children() && !cell_col->has_children()) - { - const unsigned int dofs_per_cell_row = - cell_row->get_fe().dofs_per_cell; - const unsigned int dofs_per_cell_col = - cell_col->get_fe().dofs_per_cell; - std::vector - local_dof_indices_row(dofs_per_cell_row); - std::vector - local_dof_indices_col(dofs_per_cell_col); - cell_row->get_dof_indices (local_dof_indices_row); - cell_col->get_dof_indices (local_dof_indices_col); - for (unsigned int i=0; ihas_children()) - { - const std::vector - child_cells = GridTools::get_active_child_cells (cell_row); - for (unsigned int i=0; iget_fe().dofs_per_cell; - const unsigned int dofs_per_cell_col = - cell_col->get_fe().dofs_per_cell; - std::vector - local_dof_indices_row(dofs_per_cell_row); - std::vector - local_dof_indices_col(dofs_per_cell_col); - cell_row_child->get_dof_indices (local_dof_indices_row); - cell_col->get_dof_indices (local_dof_indices_col); - for (unsigned int i=0; i - child_cells = GridTools::get_active_child_cells (cell_col); - for (unsigned int i=0; iget_fe().dofs_per_cell; - const unsigned int dofs_per_cell_col = - cell_col_child->get_fe().dofs_per_cell; - std::vector - local_dof_indices_row(dofs_per_cell_row); - std::vector - local_dof_indices_col(dofs_per_cell_col); - cell_row->get_dof_indices (local_dof_indices_row); - cell_col_child->get_dof_indices (local_dof_indices_col); - for (unsigned int i=0; i - void - make_boundary_sparsity_pattern ( - const DH &dof, - const std::vector &dof_to_boundary_mapping, - SparsityPattern &sparsity) - { - if (DH::dimension == 1) - { - // there are only 2 boundary indicators in 1d, so it is no - // performance problem to call the other function - typename DH::FunctionMap boundary_indicators; - boundary_indicators[0] = 0; - boundary_indicators[1] = 0; - make_boundary_sparsity_pattern (dof, - boundary_indicators, - dof_to_boundary_mapping, - sparsity); - return; - } - - const types::global_dof_index n_dofs = dof.n_dofs(); - - AssertDimension (dof_to_boundary_mapping.size(), n_dofs); - AssertDimension (sparsity.n_rows(), dof.n_boundary_dofs()); - AssertDimension (sparsity.n_cols(), dof.n_boundary_dofs()); -#ifdef DEBUG - if (sparsity.n_rows() != 0) - { - types::global_dof_index max_element = 0; - for (std::vector::const_iterator i=dof_to_boundary_mapping.begin(); - i!=dof_to_boundary_mapping.end(); ++i) - if ((*i != DH::invalid_dof_index) && - (*i > max_element)) - max_element = *i; - AssertDimension (max_element, sparsity.n_rows()-1); - }; -#endif - - std::vector dofs_on_this_face; - dofs_on_this_face.reserve (max_dofs_per_face(dof)); - - // loop over all faces to check whether they are at a boundary. note - // that we need not take special care of single lines (using - // @p{cell->has_boundary_lines}), since we do not support boundaries of - // dimension dim-2, and so every boundary line is also part of a - // boundary face. - typename DH::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); - for (; cell!=endc; ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->at_boundary(f)) - { - const unsigned int dofs_per_face = cell->get_fe().dofs_per_face; - dofs_on_this_face.resize (dofs_per_face); - cell->face(f)->get_dof_indices (dofs_on_this_face, - cell->active_fe_index()); - - // make sparsity pattern for this cell - for (unsigned int i=0; i - void make_boundary_sparsity_pattern ( - const DH &dof, - const typename FunctionMap::type &boundary_indicators, - const std::vector &dof_to_boundary_mapping, - SparsityPattern &sparsity) - { - if (DH::dimension == 1) - { - // first check left, then right boundary point - for (unsigned int direction=0; direction<2; ++direction) - { - // if this boundary is not requested, then go on with next one - if (boundary_indicators.find(direction) == - boundary_indicators.end()) - continue; - - // find active cell at that boundary: first go to left/right, - // then to children - typename DH::level_cell_iterator cell = dof.begin(0); - while (!cell->at_boundary(direction)) - cell = cell->neighbor(direction); - while (!cell->active()) - cell = cell->child(direction); - - const unsigned int dofs_per_vertex = cell->get_fe().dofs_per_vertex; - std::vector boundary_dof_boundary_indices (dofs_per_vertex); - - // next get boundary mapped dof indices of boundary dofs - for (unsigned int i=0; ivertex_dof_index(direction,i)]; - - for (unsigned int i=0; i::const_iterator i=dof_to_boundary_mapping.begin(); - i!=dof_to_boundary_mapping.end(); ++i) - if ((*i != DH::invalid_dof_index) && - (*i > max_element)) - max_element = *i; - AssertDimension (max_element, sparsity.n_rows()-1); - }; -#endif - - std::vector dofs_on_this_face; - dofs_on_this_face.reserve (max_dofs_per_face(dof)); - typename DH::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); - for (; cell!=endc; ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) - if (boundary_indicators.find(cell->face(f)->boundary_indicator()) != - boundary_indicators.end()) - { - const unsigned int dofs_per_face = cell->get_fe().dofs_per_face; - dofs_on_this_face.resize (dofs_per_face); - cell->face(f)->get_dof_indices (dofs_on_this_face, - cell->active_fe_index()); - - // make sparsity pattern for this cell - for (unsigned int i=0; i - void - make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, - const ConstraintMatrix &constraints, - const bool keep_constrained_dofs, - const types::subdomain_id subdomain_id) - - // TODO: QA: reduce the indentation level of this method..., Maier 2012 - - { - const types::global_dof_index n_dofs = dof.n_dofs(); - - AssertDimension (sparsity.n_rows(), n_dofs); - AssertDimension (sparsity.n_cols(), n_dofs); - - // If we have a distributed::Triangulation only allow locally_owned - // subdomain. Not setting a subdomain is also okay, because we skip - // ghost cells in the loop below. - Assert ( - (dof.get_tria().locally_owned_subdomain() == numbers::invalid_subdomain_id) - || - (subdomain_id == numbers::invalid_subdomain_id) - || - (subdomain_id == dof.get_tria().locally_owned_subdomain()), - ExcMessage ("For parallel::distributed::Triangulation objects and " - "associated DoF handler objects, asking for any subdomain other " - "than the locally owned one does not make sense.")); - - std::vector dofs_on_this_cell; - std::vector dofs_on_other_cell; - dofs_on_this_cell.reserve (max_dofs_per_cell(dof)); - dofs_on_other_cell.reserve (max_dofs_per_cell(dof)); - typename DH::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); - - // TODO: in an old implementation, we used user flags before to tag - // faces that were already touched. this way, we could reduce the work - // a little bit. now, we instead add only data from one side. this - // should be OK, but we need to actually verify it. - - // In case we work with a distributed sparsity pattern of Trilinos - // type, we only have to do the work if the current cell is owned by - // the calling processor. Otherwise, just continue. - for (; cell!=endc; ++cell) - if (((subdomain_id == numbers::invalid_subdomain_id) - || - (subdomain_id == cell->subdomain_id())) - && - cell->is_locally_owned()) - { - const unsigned int n_dofs_on_this_cell = cell->get_fe().dofs_per_cell; - dofs_on_this_cell.resize (n_dofs_on_this_cell); - cell->get_dof_indices (dofs_on_this_cell); - - // make sparsity pattern for this cell. if no constraints pattern - // was given, then the following call acts as if simply no - // constraints existed - constraints.add_entries_local_to_global (dofs_on_this_cell, - sparsity, - keep_constrained_dofs); - - for (unsigned int face = 0; - face < GeometryInfo::faces_per_cell; - ++face) - { - typename DH::face_iterator cell_face = cell->face(face); - if (! cell->at_boundary(face) ) - { - typename DH::level_cell_iterator neighbor = cell->neighbor(face); - - // in 1d, we do not need to worry whether the neighbor - // might have children and then loop over those children. - // rather, we may as well go straight to to cell behind - // this particular cell's most terminal child - if (DH::dimension==1) - while (neighbor->has_children()) - neighbor = neighbor->child(face==0 ? 1 : 0); - - if (neighbor->has_children()) - { - for (unsigned int sub_nr = 0; - sub_nr != cell_face->number_of_children(); - ++sub_nr) - { - const typename DH::level_cell_iterator - sub_neighbor - = cell->neighbor_child_on_subface (face, sub_nr); - - const unsigned int n_dofs_on_neighbor - = sub_neighbor->get_fe().dofs_per_cell; - dofs_on_other_cell.resize (n_dofs_on_neighbor); - sub_neighbor->get_dof_indices (dofs_on_other_cell); - - constraints.add_entries_local_to_global - (dofs_on_this_cell, dofs_on_other_cell, - sparsity, keep_constrained_dofs); - constraints.add_entries_local_to_global - (dofs_on_other_cell, dofs_on_this_cell, - sparsity, keep_constrained_dofs); - } - } - else - { - // Refinement edges are taken care of by coarser - // cells - - // TODO: in the distributed case, we miss out the - // constraints when the neighbor cell is coarser, but - // only the current cell is owned locally! - if (cell->neighbor_is_coarser(face)) - continue; - - const unsigned int n_dofs_on_neighbor - = neighbor->get_fe().dofs_per_cell; - dofs_on_other_cell.resize (n_dofs_on_neighbor); - - neighbor->get_dof_indices (dofs_on_other_cell); - - constraints.add_entries_local_to_global - (dofs_on_this_cell, dofs_on_other_cell, - sparsity, keep_constrained_dofs); - - // only need to add these in case the neighbor cell - // is not locally owned - otherwise, we touch each - // face twice and hence put the indices the other way - // around - if (!cell->neighbor(face)->active() - || - (cell->neighbor(face)->subdomain_id() != - cell->subdomain_id())) - constraints.add_entries_local_to_global - (dofs_on_other_cell, dofs_on_this_cell, - sparsity, keep_constrained_dofs); - } - } - } - } - } - - - - template - void - make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity) - { - ConstraintMatrix constraints; - make_flux_sparsity_pattern (dof, sparsity, constraints); - } - - - - template - Table<2,Coupling> - dof_couplings_from_component_couplings (const FiniteElement &fe, - const Table<2,Coupling> &component_couplings) - { - Assert(component_couplings.n_rows() == fe.n_components(), - ExcDimensionMismatch(component_couplings.n_rows(), - fe.n_components())); - Assert(component_couplings.n_cols() == fe.n_components(), - ExcDimensionMismatch(component_couplings.n_cols(), - fe.n_components())); - - const unsigned int n_dofs = fe.dofs_per_cell; - - Table<2,Coupling> dof_couplings (n_dofs, n_dofs); - - for (unsigned int i=0; i - std::vector > - dof_couplings_from_component_couplings - (const hp::FECollection &fe, - const Table<2,Coupling> &component_couplings) - { - std::vector > return_value (fe.size()); - for (unsigned int i=0; i - void - make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, - const Table<2,Coupling> &int_mask, - const Table<2,Coupling> &flux_mask) - { - const FiniteElement &fe = dof.get_fe(); - - std::vector dofs_on_this_cell(fe.dofs_per_cell); - std::vector dofs_on_other_cell(fe.dofs_per_cell); - - const Table<2,Coupling> - int_dof_mask = dof_couplings_from_component_couplings(fe, int_mask), - flux_dof_mask = dof_couplings_from_component_couplings(fe, flux_mask); - - Table<2,bool> support_on_face(fe.dofs_per_cell, - GeometryInfo::faces_per_cell); - for (unsigned int i=0; i::faces_per_cell; ++f) - support_on_face(i,f) = fe.has_support_on_face(i,f); - - typename DH::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); - for (; cell!=endc; ++cell) - if (cell->is_locally_owned()) - { - cell->get_dof_indices (dofs_on_this_cell); - // make sparsity pattern for this cell - for (unsigned int i=0; i::faces_per_cell; - ++face) - { - const typename DH::face_iterator - cell_face = cell->face(face); - if (cell_face->user_flag_set ()) - continue; - - if (cell->at_boundary (face) ) - { - for (unsigned int i=0; ineighbor(face); - // Refinement edges are taken care of by coarser - // cells - if (cell->neighbor_is_coarser(face)) - continue; - - typename DH::face_iterator cell_face = cell->face(face); - const unsigned int - neighbor_face = cell->neighbor_of_neighbor(face); - - if (cell_face->has_children()) - { - for (unsigned int sub_nr = 0; - sub_nr != cell_face->n_children(); - ++sub_nr) - { - const typename DH::level_cell_iterator - sub_neighbor - = cell->neighbor_child_on_subface (face, sub_nr); - - sub_neighbor->get_dof_indices (dofs_on_other_cell); - for (unsigned int i=0; iface(neighbor_face)->set_user_flag (); - } - } - else - { - neighbor->get_dof_indices (dofs_on_other_cell); - for (unsigned int i=0; iface(neighbor_face)->set_user_flag (); - } - } - } - } - } - - - // implementation of the same function in namespace DoFTools for - // non-hp DoFHandlers - template - void - make_flux_sparsity_pattern (const dealii::hp::DoFHandler &dof, - SparsityPattern &sparsity, - const Table<2,Coupling> &int_mask, - const Table<2,Coupling> &flux_mask) - { - // while the implementation above is quite optimized and caches a - // lot of data (see e.g. the int/flux_dof_mask tables), this is no - // longer practical for the hp version since we would have to have - // it for all combinations of elements in the hp::FECollection. - // consequently, the implementation here is simpler and probably - // less efficient but at least readable... - - const dealii::hp::FECollection &fe = dof.get_fe(); - - std::vector dofs_on_this_cell(DoFTools::max_dofs_per_cell(dof)); - std::vector dofs_on_other_cell(DoFTools::max_dofs_per_cell(dof)); - - const std::vector > - int_dof_mask - = dof_couplings_from_component_couplings(fe, int_mask); - - typename dealii::hp::DoFHandler::active_cell_iterator - cell = dof.begin_active(), - endc = dof.end(); - for (; cell!=endc; ++cell) - { - dofs_on_this_cell.resize (cell->get_fe().dofs_per_cell); - cell->get_dof_indices (dofs_on_this_cell); - - // make sparsity pattern for this cell - for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) - for (unsigned int j=0; jget_fe().dofs_per_cell; ++j) - if (int_dof_mask[cell->active_fe_index()](i,j) != none) - sparsity.add (dofs_on_this_cell[i], - dofs_on_this_cell[j]); - - // Loop over all interior neighbors - for (unsigned int face = 0; - face < GeometryInfo::faces_per_cell; - ++face) - { - const typename dealii::hp::DoFHandler::face_iterator - cell_face = cell->face(face); - if (cell_face->user_flag_set ()) - continue; - - if (cell->at_boundary (face) ) - { - for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) - for (unsigned int j=0; jget_fe().dofs_per_cell; ++j) - if ((flux_mask(cell->get_fe().system_to_component_index(i).first, - cell->get_fe().system_to_component_index(j).first) - == always) - || - (flux_mask(cell->get_fe().system_to_component_index(i).first, - cell->get_fe().system_to_component_index(j).first) - == nonzero)) - sparsity.add (dofs_on_this_cell[i], - dofs_on_this_cell[j]); - } - else - { - typename dealii::hp::DoFHandler::level_cell_iterator - neighbor = cell->neighbor(face); - - // Refinement edges are taken care of by coarser cells - if (cell->neighbor_is_coarser(face)) - continue; - - typename dealii::hp::DoFHandler::face_iterator - cell_face = cell->face(face); - const unsigned int - neighbor_face = cell->neighbor_of_neighbor(face); - - if (cell_face->has_children()) - { - for (unsigned int sub_nr = 0; - sub_nr != cell_face->n_children(); - ++sub_nr) - { - const typename dealii::hp::DoFHandler::level_cell_iterator - sub_neighbor - = cell->neighbor_child_on_subface (face, sub_nr); - - dofs_on_other_cell.resize (sub_neighbor->get_fe().dofs_per_cell); - sub_neighbor->get_dof_indices (dofs_on_other_cell); - for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) - { - for (unsigned int j=0; jget_fe().dofs_per_cell; - ++j) - { - if ((flux_mask(cell->get_fe().system_to_component_index(i).first, - sub_neighbor->get_fe().system_to_component_index(j).first) - == always) - || - (flux_mask(cell->get_fe().system_to_component_index(i).first, - sub_neighbor->get_fe().system_to_component_index(j).first) - == nonzero)) - { - sparsity.add (dofs_on_this_cell[i], - dofs_on_other_cell[j]); - sparsity.add (dofs_on_other_cell[i], - dofs_on_this_cell[j]); - sparsity.add (dofs_on_this_cell[i], - dofs_on_this_cell[j]); - sparsity.add (dofs_on_other_cell[i], - dofs_on_other_cell[j]); - } - - if ((flux_mask(sub_neighbor->get_fe().system_to_component_index(j).first, - cell->get_fe().system_to_component_index(i).first) - == always) - || - (flux_mask(sub_neighbor->get_fe().system_to_component_index(j).first, - cell->get_fe().system_to_component_index(i).first) - == nonzero)) - { - sparsity.add (dofs_on_this_cell[j], - dofs_on_other_cell[i]); - sparsity.add (dofs_on_other_cell[j], - dofs_on_this_cell[i]); - sparsity.add (dofs_on_this_cell[j], - dofs_on_this_cell[i]); - sparsity.add (dofs_on_other_cell[j], - dofs_on_other_cell[i]); - } - } - } - sub_neighbor->face(neighbor_face)->set_user_flag (); - } - } - else - { - dofs_on_other_cell.resize (neighbor->get_fe().dofs_per_cell); - neighbor->get_dof_indices (dofs_on_other_cell); - for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) - { - for (unsigned int j=0; jget_fe().dofs_per_cell; ++j) - { - if ((flux_mask(cell->get_fe().system_to_component_index(i).first, - neighbor->get_fe().system_to_component_index(j).first) - == always) - || - (flux_mask(cell->get_fe().system_to_component_index(i).first, - neighbor->get_fe().system_to_component_index(j).first) - == nonzero)) - { - sparsity.add (dofs_on_this_cell[i], - dofs_on_other_cell[j]); - sparsity.add (dofs_on_other_cell[i], - dofs_on_this_cell[j]); - sparsity.add (dofs_on_this_cell[i], - dofs_on_this_cell[j]); - sparsity.add (dofs_on_other_cell[i], - dofs_on_other_cell[j]); - } - - if ((flux_mask(neighbor->get_fe().system_to_component_index(j).first, - cell->get_fe().system_to_component_index(i).first) - == always) - || - (flux_mask(neighbor->get_fe().system_to_component_index(j).first, - cell->get_fe().system_to_component_index(i).first) - == nonzero)) - { - sparsity.add (dofs_on_this_cell[j], - dofs_on_other_cell[i]); - sparsity.add (dofs_on_other_cell[j], - dofs_on_this_cell[i]); - sparsity.add (dofs_on_this_cell[j], - dofs_on_this_cell[i]); - sparsity.add (dofs_on_other_cell[j], - dofs_on_other_cell[i]); - } - } - } - neighbor->face(neighbor_face)->set_user_flag (); - } - } - } - } - } - } - - } - - - - - template - void - make_flux_sparsity_pattern (const DH &dof, - SparsityPattern &sparsity, - const Table<2,Coupling> &int_mask, - const Table<2,Coupling> &flux_mask) - { - // do the error checking and frame code here, and then pass on to more - // specialized functions in the internal namespace - const types::global_dof_index n_dofs = dof.n_dofs(); - const unsigned int n_comp = dof.get_fe().n_components(); - - Assert (sparsity.n_rows() == n_dofs, - ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); - Assert (sparsity.n_cols() == n_dofs, - ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); - Assert (int_mask.n_rows() == n_comp, - ExcDimensionMismatch (int_mask.n_rows(), n_comp)); - Assert (int_mask.n_cols() == n_comp, - ExcDimensionMismatch (int_mask.n_cols(), n_comp)); - Assert (flux_mask.n_rows() == n_comp, - ExcDimensionMismatch (flux_mask.n_rows(), n_comp)); - Assert (flux_mask.n_cols() == n_comp, - ExcDimensionMismatch (flux_mask.n_cols(), n_comp)); - - // Clear user flags because we will need them. But first we save them - // and make sure that we restore them later such that at the end of - // this function the Triangulation will be in the same state as it was - // at the beginning of this function. - std::vector user_flags; - dof.get_tria().save_user_flags(user_flags); - const_cast &>(dof.get_tria()).clear_user_flags (); - - internal::make_flux_sparsity_pattern (dof, sparsity, - int_mask, flux_mask); - - // finally restore the user flags - const_cast &>(dof.get_tria()).load_user_flags(user_flags); - } - - - - - namespace internal - { - namespace - { - inline bool - check_master_dof_list (const FullMatrix &face_interpolation_matrix, - const std::vector &master_dof_list) - { - const unsigned int N = master_dof_list.size(); - - FullMatrix tmp (N,N); - for (unsigned int i=0; i p(N); - for (unsigned int i=0; i max) - { - max = std::fabs(tmp(i,j)); - r = i; - } - } - // check whether the pivot is too small. if that is the case, - // then the matrix is singular and we shouldn't use this set of - // master dofs - if (max < 1.e-12*typical_diagonal_element) - return false; - - // row interchange - if (r>j) - { - for (unsigned int k=0; k - void - select_master_dofs_for_face_restriction (const FiniteElement &fe1, - const FiniteElement &fe2, - const FullMatrix &face_interpolation_matrix, - std::vector &master_dof_mask) - { - Assert (fe1.dofs_per_face >= fe2.dofs_per_face, - ExcInternalError()); - AssertDimension (master_dof_mask.size(), fe1.dofs_per_face); - - Assert (fe2.dofs_per_vertex <= fe1.dofs_per_vertex, - ExcInternalError()); - Assert (fe2.dofs_per_line <= fe1.dofs_per_line, - ExcInternalError()); - Assert ((dim < 3) - || - (fe2.dofs_per_quad <= fe1.dofs_per_quad), - ExcInternalError()); - - // the idea here is to designate as many DoFs in fe1 per object - // (vertex, line, quad) as master as there are such dofs in fe2 - // (indices are int, because we want to avoid the 'unsigned int < 0 - // is always false warning for the cases at the bottom in 1d and - // 2d) - // - // as mentioned in the paper, it is not always easy to find a set - // of master dofs that produces an invertible matrix. to this end, - // we check in each step whether the matrix is still invertible and - // simply discard this dof if the matrix is not invertible anymore. - // - // the cases where we did have trouble in the past were with adding - // more quad dofs when Q3 and Q4 elements meet at a refined face in - // 3d (see the hp/crash_12 test that tests that we can do exactly - // this, and failed before we had code to compensate for this - // case). the other case are system elements: if we have say a Q1Q2 - // vs a Q2Q3 element, then we can't just take all master dofs on a - // line from a single base element, since the shape functions of - // that base element are independent of that of the other one. this - // latter case shows up when running hp/hp_constraints_q_system_06 - - std::vector master_dof_list; - unsigned int index = 0; - for (int v=0; - v(GeometryInfo::vertices_per_face); - ++v) - { - unsigned int dofs_added = 0; - unsigned int i = 0; - while (dofs_added < fe2.dofs_per_vertex) - { - // make sure that we were able to find a set of master dofs - // and that the code down below didn't just reject all our - // efforts - Assert (i < fe1.dofs_per_vertex, - ExcInternalError()); - - // tentatively push this vertex dof - master_dof_list.push_back (index+i); - - // then see what happens. if it succeeds, fine - if (check_master_dof_list (face_interpolation_matrix, - master_dof_list) - == true) - ++dofs_added; - else - // well, it didn't. simply pop that dof from the list - // again and try with the next dof - master_dof_list.pop_back (); - - // forward counter by one - ++i; - } - index += fe1.dofs_per_vertex; - } - - for (int l=0; - l(GeometryInfo::lines_per_face); - ++l) - { - // same algorithm as above - unsigned int dofs_added = 0; - unsigned int i = 0; - while (dofs_added < fe2.dofs_per_line) - { - Assert (i < fe1.dofs_per_line, - ExcInternalError()); - - master_dof_list.push_back (index+i); - if (check_master_dof_list (face_interpolation_matrix, - master_dof_list) - == true) - ++dofs_added; - else - master_dof_list.pop_back (); - - ++i; - } - index += fe1.dofs_per_line; - } - - for (int q=0; - q(GeometryInfo::quads_per_face); - ++q) - { - // same algorithm as above - unsigned int dofs_added = 0; - unsigned int i = 0; - while (dofs_added < fe2.dofs_per_quad) - { - Assert (i < fe1.dofs_per_quad, - ExcInternalError()); - - master_dof_list.push_back (index+i); - if (check_master_dof_list (face_interpolation_matrix, - master_dof_list) - == true) - ++dofs_added; - else - master_dof_list.pop_back (); - - ++i; - } - index += fe1.dofs_per_quad; - } - - AssertDimension (index, fe1.dofs_per_face); - AssertDimension (master_dof_list.size(), fe2.dofs_per_face); - - // finally copy the list into the mask - std::fill (master_dof_mask.begin(), master_dof_mask.end(), false); - for (std::vector::const_iterator i=master_dof_list.begin(); - i!=master_dof_list.end(); ++i) - master_dof_mask[*i] = true; - } - - - - /** - * Make sure that the mask exists that determines which dofs will be - * the masters on refined faces where an fe1 and a fe2 meet. - */ - template - void - ensure_existence_of_master_dof_mask (const FiniteElement &fe1, - const FiniteElement &fe2, - const FullMatrix &face_interpolation_matrix, - std_cxx1x::shared_ptr > &master_dof_mask) - { - if (master_dof_mask == std_cxx1x::shared_ptr >()) - { - master_dof_mask = std_cxx1x::shared_ptr > - (new std::vector (fe1.dofs_per_face)); - select_master_dofs_for_face_restriction (fe1, - fe2, - face_interpolation_matrix, - *master_dof_mask); - } - } - - - - /** - * Make sure that the given @p face_interpolation_matrix pointer - * points to a valid matrix. If the pointer is zero beforehand, - * create an entry with the correct data. If it is nonzero, don't - * touch it. - */ - template - void - ensure_existence_of_face_matrix (const FiniteElement &fe1, - const FiniteElement &fe2, - std_cxx1x::shared_ptr > &matrix) - { - if (matrix == std_cxx1x::shared_ptr >()) - { - matrix = std_cxx1x::shared_ptr > - (new FullMatrix (fe2.dofs_per_face, - fe1.dofs_per_face)); - fe1.get_face_interpolation_matrix (fe2, - *matrix); - } - } - - - - /** - * Same, but for subface interpolation matrices. - */ - template - void - ensure_existence_of_subface_matrix (const FiniteElement &fe1, - const FiniteElement &fe2, - const unsigned int subface, - std_cxx1x::shared_ptr > &matrix) - { - if (matrix == std_cxx1x::shared_ptr >()) - { - matrix = std_cxx1x::shared_ptr > - (new FullMatrix (fe2.dofs_per_face, - fe1.dofs_per_face)); - fe1.get_subface_interpolation_matrix (fe2, - subface, - *matrix); - } - } - - - - /** - * Given the face interpolation matrix between two elements, split it - * into its master and slave parts and invert the master part as - * explained in the @ref hp_paper "hp paper". - */ - void - ensure_existence_of_split_face_matrix (const FullMatrix &face_interpolation_matrix, - const std::vector &master_dof_mask, - std_cxx1x::shared_ptr,FullMatrix > > &split_matrix) - { - AssertDimension (master_dof_mask.size(), face_interpolation_matrix.m()); - Assert (std::count (master_dof_mask.begin(), master_dof_mask.end(), true) == - static_cast(face_interpolation_matrix.n()), - ExcInternalError()); - - if (split_matrix == - std_cxx1x::shared_ptr,FullMatrix > >()) - { - split_matrix - = std_cxx1x::shared_ptr,FullMatrix > > - (new std::pair,FullMatrix >()); - - const unsigned int n_master_dofs = face_interpolation_matrix.n(); - const unsigned int n_dofs = face_interpolation_matrix.m(); - - Assert (n_master_dofs <= n_dofs, ExcInternalError()); - - // copy and invert the master - // component, copy the slave - // component - split_matrix->first.reinit (n_master_dofs, n_master_dofs); - split_matrix->second.reinit (n_dofs-n_master_dofs, n_master_dofs); - - unsigned int nth_master_dof = 0, - nth_slave_dof = 0; - - for (unsigned int i=0; ifirst(nth_master_dof,j) - = face_interpolation_matrix(i,j); - ++nth_master_dof; - } - else - { - for (unsigned int j=0; jsecond(nth_slave_dof,j) - = face_interpolation_matrix(i,j); - ++nth_slave_dof; - } - - AssertDimension (nth_master_dof, n_master_dofs); - AssertDimension (nth_slave_dof, n_dofs-n_master_dofs); - - //TODO[WB]: We should make sure very small entries are removed after inversion - split_matrix->first.gauss_jordan (); - } - } - - - // a template that can determine statically whether a given - // DoFHandler class supports different finite element elements - template - struct DoFHandlerSupportsDifferentFEs - { - static const bool value = true; - }; - - - template - struct DoFHandlerSupportsDifferentFEs< dealii::DoFHandler > - { - static const bool value = false; - }; - - - template - struct DoFHandlerSupportsDifferentFEs< dealii::MGDoFHandler > - { - static const bool value = false; - }; - - - /** - * A function that returns how many different finite elements a dof - * handler uses. This is one for non-hp DoFHandlers and - * dof_handler.get_fe().size() for the hp-versions. - */ - template - unsigned int - n_finite_elements (const dealii::hp::DoFHandler &dof_handler) - { - return dof_handler.get_fe().size(); - } - - - template - unsigned int - n_finite_elements (const DH &) - { - return 1; - } - - - /** - * For a given face belonging to an active cell that borders to a - * more refined cell, return the fe_index of the most dominating - * finite element used on any of the face's subfaces. - */ - template - unsigned int - get_most_dominating_subface_fe_index (const face_iterator &face) - { - const unsigned int dim - = face_iterator::AccessorType::dimension; - const unsigned int spacedim - = face_iterator::AccessorType::space_dimension; - - unsigned int dominating_subface_no = 0; - for (; dominating_subface_non_children(); - ++dominating_subface_no) - { - // each of the subfaces can have only a single fe_index - // associated with them, since there is no cell on the other - // side - Assert (face->child(dominating_subface_no) - ->n_active_fe_indices() - == 1, - ExcInternalError()); - - const FiniteElement & - this_subface_fe = (face->child(dominating_subface_no) - ->get_fe (face->child(dominating_subface_no) - ->nth_active_fe_index(0))); - - FiniteElementDomination::Domination - domination = FiniteElementDomination::either_element_can_dominate; - for (unsigned int sf=0; sfn_children(); ++sf) - if (sf != dominating_subface_no) - { - const FiniteElement & - that_subface_fe = (face->child(sf) - ->get_fe (face->child(sf) - ->nth_active_fe_index(0))); - - domination = domination & - this_subface_fe.compare_for_face_domination(that_subface_fe); - } - - // see if the element on this subface is able to dominate the - // ones on all other subfaces, and if so take it - if ((domination == FiniteElementDomination::this_element_dominates) - || - (domination == FiniteElementDomination::either_element_can_dominate)) - break; - } - - // check that we have found one such subface - Assert (dominating_subface_no < face->n_children(), - ExcNotImplemented()); - - // return the finite element index used on it. note that only a - // single fe can be active on such subfaces - return face->child (dominating_subface_no)->nth_active_fe_index(0); - } - - - - /** - * Copy constraints into a constraint matrix object. - * - * This function removes zero constraints and those, which constrain - * a DoF which was already eliminated in one of the previous steps of - * the hp hanging node procedure. - * - * It also suppresses very small entries in the constraint matrix to - * avoid making the sparsity pattern fuller than necessary. - */ - void - filter_constraints (const std::vector &master_dofs, - const std::vector &slave_dofs, - const FullMatrix &face_constraints, - ConstraintMatrix &constraints) - { - Assert (face_constraints.n () == master_dofs.size (), - ExcDimensionMismatch(master_dofs.size (), - face_constraints.n())); - Assert (face_constraints.m () == slave_dofs.size (), - ExcDimensionMismatch(slave_dofs.size (), - face_constraints.m())); - - const unsigned int n_master_dofs = master_dofs.size (); - const unsigned int n_slave_dofs = slave_dofs.size (); - - // check for a couple conditions that happened in parallel - // distributed mode - for (unsigned int row=0; row!=n_slave_dofs; ++row) - Assert (slave_dofs[row] != numbers::invalid_dof_index, - ExcInternalError()); - for (unsigned int col=0; col!=n_master_dofs; ++col) - Assert (master_dofs[col] != numbers::invalid_dof_index, - ExcInternalError()); - - - for (unsigned int row=0; row!=n_slave_dofs; ++row) - if (constraints.is_constrained (slave_dofs[row]) == false) - { - bool constraint_already_satisfied = false; - - // Check if we have an identity constraint, which is already - // satisfied by unification of the corresponding global dof - // indices - for (unsigned int i=0; i= 1e-14*abs_sum)) - constraints.add_entry (slave_dofs[row], - master_dofs[i], - face_constraints (row,i)); - constraints.set_inhomogeneity (slave_dofs[row], 0.); - } - } - } - - } - - - - void - make_hp_hanging_node_constraints (const dealii::DoFHandler<1> &, - ConstraintMatrix &) - { - // nothing to do for regular dof handlers in 1d - } - - - - void - make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1> &, - ConstraintMatrix &, - dealii::internal::int2type<1>) - { - // nothing to do for regular dof handlers in 1d - } - - - void - make_hp_hanging_node_constraints (const dealii::MGDoFHandler<1> &, - ConstraintMatrix &) - { - // nothing to do for regular dof handlers in 1d - } - - - - void - make_oldstyle_hanging_node_constraints (const dealii::MGDoFHandler<1> &, - ConstraintMatrix &, - dealii::internal::int2type<1>) - { - // nothing to do for regular dof handlers in 1d - } - - - void - make_hp_hanging_node_constraints (const dealii::hp::DoFHandler<1> &/*dof_handler*/, - ConstraintMatrix &/*constraints*/) - { - // we may have to compute constraints for vertices. gotta think about - // that a bit more - - //TODO[WB]: think about what to do here... - } - - - - void - make_oldstyle_hanging_node_constraints (const dealii::hp::DoFHandler<1> &/*dof_handler*/, - ConstraintMatrix &/*constraints*/, - dealii::internal::int2type<1>) - { - // we may have to compute constraints for vertices. gotta think about - // that a bit more - - //TODO[WB]: think about what to do here... - } - - - void - make_hp_hanging_node_constraints (const dealii::DoFHandler<1,2> &, - ConstraintMatrix &) - { - // nothing to do for regular dof handlers in 1d - } - - - - void - make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1,2> &, - ConstraintMatrix &, - dealii::internal::int2type<1>) - { - // nothing to do for regular dof handlers in 1d - } - - - void - make_hp_hanging_node_constraints (const dealii::DoFHandler<1,3> &, - ConstraintMatrix &) - { - // nothing to do for regular dof handlers in 1d - } - - void - make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1,3> &, - ConstraintMatrix &, - dealii::internal::int2type<1>) - { - // nothing to do for regular dof handlers in 1d - } - - -// currently not used but may be in the future: - -// void -// make_hp_hanging_node_constraints (const dealii::MDoFHandler<1,2> &, -// ConstraintMatrix &) -// { -// // nothing to do for regular -// // dof handlers in 1d -// } - - - -// void -// make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1,2> &, -// ConstraintMatrix &, -// dealii::internal::int2type<1>) -// { -// // nothing to do for regular -// // dof handlers in 1d -// } - - -// void -// make_oldstyle_hanging_node_constraints (const dealii::hp::DoFHandler<1,2> &/*dof_handler*/, -// ConstraintMatrix &/*constraints*/, -// dealii::internal::int2type<1>) -// { -// // we may have to compute -// // constraints for -// // vertices. gotta think about -// // that a bit more -// -// //TODO[WB]: think about what to do here... -// } -//#endif - - - - template - void - make_oldstyle_hanging_node_constraints (const DH &dof_handler, - ConstraintMatrix &constraints, - dealii::internal::int2type<2>) - { - const unsigned int dim = 2; - - const unsigned int spacedim = DH::space_dimension; - - std::vector dofs_on_mother; - std::vector dofs_on_children; - - // loop over all lines; only on lines there can be constraints. We do - // so by looping over all active cells and checking whether any of - // the faces are refined which can only be from the neighboring cell - // because this one is active. In that case, the face is subject to - // constraints - // - // note that even though we may visit a face twice if the neighboring - // cells are equally refined, we can only visit each face with - // hanging nodes once - typename DH::active_cell_iterator cell = dof_handler.begin_active(), - endc = dof_handler.end(); - for (; cell!=endc; ++cell) - // artificial cells can at best neighbor ghost cells, but we're not - // interested in these interfaces - if (!cell->is_artificial ()) - for (unsigned int face=0; face::faces_per_cell; ++face) - if (cell->face(face)->has_children()) - { - // in any case, faces can have at most two active fe - // indices, but here the face can have only one (namely the - // same as that from the cell we're sitting on), and each - // of the children can have only one as well. check this - Assert (cell->face(face)->n_active_fe_indices() == 1, - ExcInternalError()); - Assert (cell->face(face)->fe_index_is_active(cell->active_fe_index()) - == true, - ExcInternalError()); - for (unsigned int c=0; cface(face)->n_children(); ++c) - if (!cell->neighbor_child_on_subface(face,c)->is_artificial()) - Assert (cell->face(face)->child(c)->n_active_fe_indices() == 1, - ExcInternalError()); - - // right now, all that is implemented is the case that both - // sides use the same fe - for (unsigned int c=0; cface(face)->n_children(); ++c) - if (!cell->neighbor_child_on_subface(face,c)->is_artificial()) - Assert (cell->face(face)->child(c) - ->fe_index_is_active(cell->active_fe_index()) == true, - ExcNotImplemented()); - - // ok, start up the work - const FiniteElement &fe = cell->get_fe(); - const unsigned int fe_index = cell->active_fe_index(); - - const unsigned int - n_dofs_on_mother = 2*fe.dofs_per_vertex + fe.dofs_per_line, - n_dofs_on_children = fe.dofs_per_vertex + 2*fe.dofs_per_line; - - dofs_on_mother.resize (n_dofs_on_mother); - dofs_on_children.resize (n_dofs_on_children); - - Assert(n_dofs_on_mother == fe.constraints().n(), - ExcDimensionMismatch(n_dofs_on_mother, - fe.constraints().n())); - Assert(n_dofs_on_children == fe.constraints().m(), - ExcDimensionMismatch(n_dofs_on_children, - fe.constraints().m())); - - const typename DH::line_iterator this_face = cell->face(face); - - // fill the dofs indices. Use same enumeration scheme as in - // @p{FiniteElement::constraints()} - unsigned int next_index = 0; - for (unsigned int vertex=0; vertex<2; ++vertex) - for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) - dofs_on_mother[next_index++] = this_face->vertex_dof_index(vertex,dof, - fe_index); - for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) - dofs_on_mother[next_index++] = this_face->dof_index(dof, fe_index); - AssertDimension (next_index, dofs_on_mother.size()); - - next_index = 0; - for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) - dofs_on_children[next_index++] - = this_face->child(0)->vertex_dof_index(1,dof,fe_index); - for (unsigned int child=0; child<2; ++child) - for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) - dofs_on_children[next_index++] - = this_face->child(child)->dof_index(dof, fe_index); - AssertDimension (next_index, dofs_on_children.size()); - - // for each row in the constraint matrix for this line: - for (unsigned int row=0; row!=dofs_on_children.size(); ++row) - { - constraints.add_line (dofs_on_children[row]); - for (unsigned int i=0; i!=dofs_on_mother.size(); ++i) - constraints.add_entry (dofs_on_children[row], - dofs_on_mother[i], - fe.constraints()(row,i)); - - constraints.set_inhomogeneity (dofs_on_children[row], 0.); - } - } - else - { - // this face has no children, but it could still be that it - // is shared by two cells that use a different fe index. - // check a couple of things, but ignore the case that the - // neighbor is an artificial cell - if (!cell->at_boundary(face) && - !cell->neighbor(face)->is_artificial()) - { - Assert (cell->face(face)->n_active_fe_indices() == 1, - ExcNotImplemented()); - Assert (cell->face(face) - ->fe_index_is_active(cell->active_fe_index()) == true, - ExcInternalError()); - } - } - } - - - - template - void - make_oldstyle_hanging_node_constraints (const DH &dof_handler, - ConstraintMatrix &constraints, - dealii::internal::int2type<3>) - { - const unsigned int dim = 3; - - std::vector dofs_on_mother; - std::vector dofs_on_children; - - // loop over all quads; only on quads there can be constraints. We do - // so by looping over all active cells and checking whether any of - // the faces are refined which can only be from the neighboring cell - // because this one is active. In that case, the face is subject to - // constraints - // - // note that even though we may visit a face twice if the neighboring - // cells are equally refined, we can only visit each face with - // hanging nodes once - typename DH::active_cell_iterator cell = dof_handler.begin_active(), - endc = dof_handler.end(); - for (; cell!=endc; ++cell) - // artificial cells can at best neighbor ghost cells, but we're not - // interested in these interfaces - if (!cell->is_artificial ()) - for (unsigned int face=0; face::faces_per_cell; ++face) - if (cell->face(face)->has_children()) - { - // first of all, make sure that we treat a case which is - // possible, i.e. either no dofs on the face at all or no - // anisotropic refinement - if (cell->get_fe().dofs_per_face == 0) - continue; - - Assert(cell->face(face)->refinement_case()==RefinementCase::isotropic_refinement, - ExcNotImplemented()); - - // in any case, faces can have at most two active fe - // indices, but here the face can have only one (namely the - // same as that from the cell we're sitting on), and each - // of the children can have only one as well. check this - AssertDimension (cell->face(face)->n_active_fe_indices(), 1); - Assert (cell->face(face)->fe_index_is_active(cell->active_fe_index()) - == true, - ExcInternalError()); - for (unsigned int c=0; cface(face)->n_children(); ++c) - AssertDimension (cell->face(face)->child(c)->n_active_fe_indices(), 1); - - // right now, all that is implemented is the case that both - // sides use the same fe, and not only that but also that - // all lines bounding this face and the children have the - // same fe - for (unsigned int c=0; cface(face)->n_children(); ++c) - if (!cell->neighbor_child_on_subface(face,c)->is_artificial()) - { - Assert (cell->face(face)->child(c) - ->fe_index_is_active(cell->active_fe_index()) == true, - ExcNotImplemented()); - for (unsigned int e=0; e<4; ++e) - { - Assert (cell->face(face)->child(c)->line(e) - ->n_active_fe_indices() == 1, - ExcNotImplemented()); - Assert (cell->face(face)->child(c)->line(e) - ->fe_index_is_active(cell->active_fe_index()) == true, - ExcNotImplemented()); - } - } - for (unsigned int e=0; e<4; ++e) - { - Assert (cell->face(face)->line(e) - ->n_active_fe_indices() == 1, - ExcNotImplemented()); - Assert (cell->face(face)->line(e) - ->fe_index_is_active(cell->active_fe_index()) == true, - ExcNotImplemented()); - } - - // ok, start up the work - const FiniteElement &fe = cell->get_fe(); - const unsigned int fe_index = cell->active_fe_index(); - - const unsigned int n_dofs_on_mother = fe.dofs_per_face; - const unsigned int n_dofs_on_children = (5*fe.dofs_per_vertex+ - 12*fe.dofs_per_line+ - 4*fe.dofs_per_quad); - - //TODO[TL]: think about this and the following in case of anisotropic refinement - - dofs_on_mother.resize (n_dofs_on_mother); - dofs_on_children.resize (n_dofs_on_children); - - Assert(n_dofs_on_mother == fe.constraints().n(), - ExcDimensionMismatch(n_dofs_on_mother, - fe.constraints().n())); - Assert(n_dofs_on_children == fe.constraints().m(), - ExcDimensionMismatch(n_dofs_on_children, - fe.constraints().m())); - - const typename DH::face_iterator this_face = cell->face(face); - - // fill the dofs indices. Use same enumeration scheme as in - // @p{FiniteElement::constraints()} - unsigned int next_index = 0; - for (unsigned int vertex=0; vertex<4; ++vertex) - for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) - dofs_on_mother[next_index++] = this_face->vertex_dof_index(vertex,dof, - fe_index); - for (unsigned int line=0; line<4; ++line) - for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) - dofs_on_mother[next_index++] - = this_face->line(line)->dof_index(dof, fe_index); - for (unsigned int dof=0; dof!=fe.dofs_per_quad; ++dof) - dofs_on_mother[next_index++] = this_face->dof_index(dof, fe_index); - AssertDimension (next_index, dofs_on_mother.size()); - - next_index = 0; - - // assert some consistency assumptions - - //TODO[TL]: think about this in case of anisotropic - //refinement - - Assert (dof_handler.get_tria().get_anisotropic_refinement_flag() || - ((this_face->child(0)->vertex_index(3) == - this_face->child(1)->vertex_index(2)) && - (this_face->child(0)->vertex_index(3) == - this_face->child(2)->vertex_index(1)) && - (this_face->child(0)->vertex_index(3) == - this_face->child(3)->vertex_index(0))), - ExcInternalError()); - for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) - dofs_on_children[next_index++] - = this_face->child(0)->vertex_dof_index(3,dof); - - // dof numbers on the centers of the lines bounding this - // face - for (unsigned int line=0; line<4; ++line) - for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) - dofs_on_children[next_index++] - = this_face->line(line)->child(0)->vertex_dof_index(1,dof, fe_index); - - // next the dofs on the lines interior to the face; the - // order of these lines is laid down in the FiniteElement - // class documentation - for (unsigned int dof=0; dofchild(0)->line(1)->dof_index(dof, fe_index); - for (unsigned int dof=0; dofchild(2)->line(1)->dof_index(dof, fe_index); - for (unsigned int dof=0; dofchild(0)->line(3)->dof_index(dof, fe_index); - for (unsigned int dof=0; dofchild(1)->line(3)->dof_index(dof, fe_index); - - // dofs on the bordering lines - for (unsigned int line=0; line<4; ++line) - for (unsigned int child=0; child<2; ++child) - for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) - dofs_on_children[next_index++] - = this_face->line(line)->child(child)->dof_index(dof, fe_index); - - // finally, for the dofs interior to the four child faces - for (unsigned int child=0; child<4; ++child) - for (unsigned int dof=0; dof!=fe.dofs_per_quad; ++dof) - dofs_on_children[next_index++] - = this_face->child(child)->dof_index(dof, fe_index); - AssertDimension (next_index, dofs_on_children.size()); - - // for each row in the constraint matrix for this line: - for (unsigned int row=0; row!=dofs_on_children.size(); ++row) - { - constraints.add_line (dofs_on_children[row]); - for (unsigned int i=0; i!=dofs_on_mother.size(); ++i) - constraints.add_entry (dofs_on_children[row], - dofs_on_mother[i], - fe.constraints()(row,i)); - - constraints.set_inhomogeneity(dofs_on_children[row], 0.); - } - } - else - { - // this face has no children, but it could still be that it - // is shared by two cells that use a different fe index. - // check a couple of things, but ignore the case that the - // neighbor is an artificial cell - if (!cell->at_boundary(face) && - !cell->neighbor(face)->is_artificial()) - { - Assert (cell->face(face)->n_active_fe_indices() == 1, - ExcNotImplemented()); - Assert (cell->face(face) - ->fe_index_is_active(cell->active_fe_index()) == true, - ExcInternalError()); - } - } - } - - - template - void - make_hp_hanging_node_constraints (const DH &dof_handler, - ConstraintMatrix &constraints) - { - // note: this function is going to be hard to understand if you - // haven't read the hp paper. however, we try to follow the notation - // laid out there, so go read the paper before you try to understand - // what is going on here - - const unsigned int dim = DH::dimension; - - const unsigned int spacedim = DH::space_dimension; - - - // a matrix to be used for constraints below. declared here and - // simply resized down below to avoid permanent re-allocation of - // memory - FullMatrix constraint_matrix; - - // similarly have arrays that will hold master and slave dof numbers, - // as well as a scratch array needed for the complicated case below - std::vector master_dofs; - std::vector slave_dofs; - std::vector scratch_dofs; - - // caches for the face and subface interpolation matrices between - // different (or the same) finite elements. we compute them only - // once, namely the first time they are needed, and then just reuse - // them - Table<2,std_cxx1x::shared_ptr > > - face_interpolation_matrices (n_finite_elements (dof_handler), - n_finite_elements (dof_handler)); - Table<3,std_cxx1x::shared_ptr > > - subface_interpolation_matrices (n_finite_elements (dof_handler), - n_finite_elements (dof_handler), - GeometryInfo::max_children_per_face); - - // similarly have a cache for the matrices that are split into their - // master and slave parts, and for which the master part is inverted. - // these two matrices are derived from the face interpolation matrix - // as described in the @ref hp_paper "hp paper" - Table<2,std_cxx1x::shared_ptr,FullMatrix > > > - split_face_interpolation_matrices (n_finite_elements (dof_handler), - n_finite_elements (dof_handler)); - - // finally, for each pair of finite elements, have a mask that states - // which of the degrees of freedom on the coarse side of a refined - // face will act as master dofs. - Table<2,std_cxx1x::shared_ptr > > - master_dof_masks (n_finite_elements (dof_handler), - n_finite_elements (dof_handler)); - - // loop over all faces - // - // note that even though we may visit a face twice if the neighboring - // cells are equally refined, we can only visit each face with - // hanging nodes once - typename DH::active_cell_iterator cell = dof_handler.begin_active(), - endc = dof_handler.end(); - for (; cell!=endc; ++cell) - // artificial cells can at best neighbor ghost cells, but we're not - // interested in these interfaces - if (!cell->is_artificial ()) - for (unsigned int face=0; face::faces_per_cell; ++face) - if (cell->face(face)->has_children()) - { - // first of all, make sure that we treat a case which is - // possible, i.e. either no dofs on the face at all or no - // anisotropic refinement - if (cell->get_fe().dofs_per_face == 0) - continue; - - Assert(cell->face(face)->refinement_case()==RefinementCase::isotropic_refinement, - ExcNotImplemented()); - - // so now we've found a face of an active cell that has - // children. that means that there are hanging nodes here. - - // in any case, faces can have at most two sets of active - // fe indices, but here the face can have only one (namely - // the same as that from the cell we're sitting on), and - // each of the children can have only one as well. check - // this - Assert (cell->face(face)->n_active_fe_indices() == 1, - ExcInternalError()); - Assert (cell->face(face)->fe_index_is_active(cell->active_fe_index()) - == true, - ExcInternalError()); - for (unsigned int c=0; cface(face)->n_children(); ++c) - Assert (cell->face(face)->child(c)->n_active_fe_indices() == 1, - ExcInternalError()); - - // first find out whether we can constrain each of the - // subfaces to the mother face. in the lingo of the hp - // paper, this would be the simple case. note that we can - // short-circuit this decision if the dof_handler doesn't - // support hp at all - // - // ignore all interfaces with artificial cells - FiniteElementDomination::Domination - mother_face_dominates = FiniteElementDomination::either_element_can_dominate; - - if (DoFHandlerSupportsDifferentFEs::value == true) - for (unsigned int c=0; cface(face)->number_of_children(); ++c) - if (!cell->neighbor_child_on_subface (face, c)->is_artificial()) - mother_face_dominates = mother_face_dominates & - (cell->get_fe().compare_for_face_domination - (cell->neighbor_child_on_subface (face, c)->get_fe())); - - switch (mother_face_dominates) - { - case FiniteElementDomination::this_element_dominates: - case FiniteElementDomination::either_element_can_dominate: - { - // Case 1 (the simple case and the only case that can - // happen for non-hp DoFHandlers): The coarse element - // dominates the elements on the subfaces (or they are - // all the same) - // - // so we are going to constrain the DoFs on the face - // children against the DoFs on the face itself - master_dofs.resize (cell->get_fe().dofs_per_face); - - cell->face(face)->get_dof_indices (master_dofs, - cell->active_fe_index ()); - - // Now create constraint matrix for the subfaces and - // assemble it. ignore all interfaces with artificial - // cells because we can only get to such interfaces if - // the current cell is a ghost cell - for (unsigned int c=0; cface(face)->n_children(); ++c) - { - if (cell->neighbor_child_on_subface (face, c)->is_artificial()) - continue; - - const typename DH::active_face_iterator - subface = cell->face(face)->child(c); - - Assert (subface->n_active_fe_indices() == 1, - ExcInternalError()); - - const unsigned int - subface_fe_index = subface->nth_active_fe_index(0); - - // we sometime run into the situation where for - // example on one big cell we have a FE_Q(1) and on - // the subfaces we have a mixture of FE_Q(1) and - // FE_Nothing. In that case, the face domination is - // either_element_can_dominate for the whole - // collection of subfaces, but on the particular - // subface between FE_Q(1) and FE_Nothing, there - // are no constraints that we need to take care of. - // in that case, just continue - if (cell->get_fe().compare_for_face_domination - (subface->get_fe(subface_fe_index)) - == - FiniteElementDomination::no_requirements) - continue; - - // Same procedure as for the mother cell. Extract - // the face DoFs from the cell DoFs. - slave_dofs.resize (subface->get_fe(subface_fe_index) - .dofs_per_face); - subface->get_dof_indices (slave_dofs, subface_fe_index); - - for (unsigned int i=0; iget_fe(), - subface->get_fe(subface_fe_index), - c, - subface_interpolation_matrices - [cell->active_fe_index()][subface_fe_index][c]); - - // Add constraints to global constraint matrix. - filter_constraints (master_dofs, - slave_dofs, - *(subface_interpolation_matrices - [cell->active_fe_index()][subface_fe_index][c]), - constraints); - } - - break; - } - - case FiniteElementDomination::other_element_dominates: - case FiniteElementDomination::neither_element_dominates: - { - // Case 2 (the "complex" case): at least one (the - // neither_... case) of the finer elements or all of - // them (the other_... case) is dominating. See the hp - // paper for a way how to deal with this situation - // - // since this is something that can only happen for hp - // dof handlers, add a check here... - Assert (DoFHandlerSupportsDifferentFEs::value == true, - ExcInternalError()); - - // we first have to find the finite element that is - // able to generate a space that all the other ones can - // be constrained to - const unsigned int dominating_fe_index - = get_most_dominating_subface_fe_index (cell->face(face)); - - const FiniteElement &dominating_fe - = dof_handler.get_fe()[dominating_fe_index]; - - // check also that it is able to constrain the mother - // face. it should be, or we wouldn't have gotten into - // the branch for the 'complex' case - Assert ((dominating_fe.compare_for_face_domination - (cell->face(face)->get_fe(cell->face(face)->nth_active_fe_index(0))) - == FiniteElementDomination::this_element_dominates) - || - (dominating_fe.compare_for_face_domination - (cell->face(face)->get_fe(cell->face(face)->nth_active_fe_index(0))) - == FiniteElementDomination::either_element_can_dominate), - ExcInternalError()); - - - // first get the interpolation matrix from the mother - // to the virtual dofs - Assert (dominating_fe.dofs_per_face <= - cell->get_fe().dofs_per_face, - ExcInternalError()); - - ensure_existence_of_face_matrix - (dominating_fe, - cell->get_fe(), - face_interpolation_matrices - [dominating_fe_index][cell->active_fe_index()]); - - // split this matrix into master and slave components. - // invert the master component - ensure_existence_of_master_dof_mask - (cell->get_fe(), - dominating_fe, - (*face_interpolation_matrices - [dominating_fe_index] - [cell->active_fe_index()]), - master_dof_masks - [dominating_fe_index] - [cell->active_fe_index()]); - - ensure_existence_of_split_face_matrix - (*face_interpolation_matrices - [dominating_fe_index][cell->active_fe_index()], - (*master_dof_masks - [dominating_fe_index][cell->active_fe_index()]), - split_face_interpolation_matrices - [dominating_fe_index][cell->active_fe_index()]); - - const FullMatrix &restrict_mother_to_virtual_master_inv - = (split_face_interpolation_matrices - [dominating_fe_index][cell->active_fe_index()]->first); - - const FullMatrix &restrict_mother_to_virtual_slave - = (split_face_interpolation_matrices - [dominating_fe_index][cell->active_fe_index()]->second); - - // now compute the constraint matrix as the product - // between the inverse matrix and the slave part - constraint_matrix.reinit (cell->get_fe().dofs_per_face - - dominating_fe.dofs_per_face, - dominating_fe.dofs_per_face); - restrict_mother_to_virtual_slave - .mmult (constraint_matrix, - restrict_mother_to_virtual_master_inv); - - // then figure out the global numbers of master and - // slave dofs and apply constraints - scratch_dofs.resize (cell->get_fe().dofs_per_face); - cell->face(face)->get_dof_indices (scratch_dofs, - cell->active_fe_index ()); - - // split dofs into master and slave components - master_dofs.clear (); - slave_dofs.clear (); - for (unsigned int i=0; iget_fe().dofs_per_face; ++i) - if ((*master_dof_masks - [dominating_fe_index][cell->active_fe_index()])[i] == true) - master_dofs.push_back (scratch_dofs[i]); - else - slave_dofs.push_back (scratch_dofs[i]); - - AssertDimension (master_dofs.size(), dominating_fe.dofs_per_face); - AssertDimension (slave_dofs.size(), - cell->get_fe().dofs_per_face - dominating_fe.dofs_per_face); - - filter_constraints (master_dofs, - slave_dofs, - constraint_matrix, - constraints); - - - - // next we have to deal with the subfaces. do as - // discussed in the hp paper - for (unsigned int sf=0; - sfface(face)->n_children(); ++sf) - { - // ignore interfaces with artificial cells as well - // as interfaces between ghost cells in 2d - if (cell->neighbor_child_on_subface (face, sf)->is_artificial() - || - (dim==2 && cell->is_ghost() - && - cell->neighbor_child_on_subface (face, sf)->is_ghost())) - continue; - - Assert (cell->face(face)->child(sf) - ->n_active_fe_indices() == 1, - ExcInternalError()); - - const unsigned int subface_fe_index - = cell->face(face)->child(sf)->nth_active_fe_index(0); - const FiniteElement &subface_fe - = dof_handler.get_fe()[subface_fe_index]; - - // first get the interpolation matrix from the - // subface to the virtual dofs - Assert (dominating_fe.dofs_per_face <= - subface_fe.dofs_per_face, - ExcInternalError()); - ensure_existence_of_subface_matrix - (dominating_fe, - subface_fe, - sf, - subface_interpolation_matrices - [dominating_fe_index][subface_fe_index][sf]); - - const FullMatrix &restrict_subface_to_virtual - = *(subface_interpolation_matrices - [dominating_fe_index][subface_fe_index][sf]); - - constraint_matrix.reinit (subface_fe.dofs_per_face, - dominating_fe.dofs_per_face); - - restrict_subface_to_virtual - .mmult (constraint_matrix, - restrict_mother_to_virtual_master_inv); - - slave_dofs.resize (subface_fe.dofs_per_face); - cell->face(face)->child(sf)->get_dof_indices (slave_dofs, - subface_fe_index); - - filter_constraints (master_dofs, - slave_dofs, - constraint_matrix, - constraints); - } - - break; - } - - case FiniteElementDomination::no_requirements: - // there are no continuity requirements between the two - // elements. record no constraints - break; - - default: - // we shouldn't get here - Assert (false, ExcInternalError()); - } - } - else - { - // this face has no children, but it could still be that it - // is shared by two cells that use a different fe index - Assert (cell->face(face) - ->fe_index_is_active(cell->active_fe_index()) == true, - ExcInternalError()); - - // see if there is a neighbor that is an artificial cell. - // in that case, we're not interested in this interface. we - // test this case first since artificial cells may not have - // an active_fe_index set, etc - if (!cell->at_boundary(face) - && - cell->neighbor(face)->is_artificial()) - continue; - - // Only if there is a neighbor with a different - // active_fe_index and the same h-level, some action has to - // be taken. - if ((DoFHandlerSupportsDifferentFEs::value == true) - && - !cell->face(face)->at_boundary () - && - (cell->neighbor(face)->active_fe_index () != - cell->active_fe_index ()) - && - (!cell->face(face)->has_children() && - !cell->neighbor_is_coarser(face) )) - { - const typename DH::level_cell_iterator neighbor = cell->neighbor (face); - - // see which side of the face we have to constrain - switch (cell->get_fe().compare_for_face_domination (neighbor->get_fe ())) - { - case FiniteElementDomination::this_element_dominates: - { - // Get DoFs on dominating and dominated side of the - // face - master_dofs.resize (cell->get_fe().dofs_per_face); - cell->face(face)->get_dof_indices (master_dofs, - cell->active_fe_index ()); - - slave_dofs.resize (neighbor->get_fe().dofs_per_face); - cell->face(face)->get_dof_indices (slave_dofs, - neighbor->active_fe_index ()); - - // break if the n_master_dofs == 0, because we are - // attempting to constrain to an element that has - // has no face dofs - if (master_dofs.size() == 0) break; - - // make sure the element constraints for this face - // are available - ensure_existence_of_face_matrix - (cell->get_fe(), - neighbor->get_fe(), - face_interpolation_matrices - [cell->active_fe_index()][neighbor->active_fe_index()]); - - // Add constraints to global constraint matrix. - filter_constraints (master_dofs, - slave_dofs, - *(face_interpolation_matrices - [cell->active_fe_index()] - [neighbor->active_fe_index()]), - constraints); - - break; - } - - case FiniteElementDomination::other_element_dominates: - { - // we don't do anything here since we will come - // back to this face from the other cell, at which - // time we will fall into the first case clause - // above - break; - } - - case FiniteElementDomination::either_element_can_dominate: - { - // it appears as if neither element has any - // constraints on its neighbor. this may be because - // neither element has any DoFs on faces at all. or - // that the two elements are actually the same, - // although they happen to run under different - // fe_indices (this is what happens in - // hp/hp_hanging_nodes_01 for example). - // - // another possibility is what happens in crash_13. - // there, we have FESystem(FE_Q(1),FE_DGQ(0)) vs. - // FESystem(FE_Q(1),FE_DGQ(1)). neither of them - // dominates the other. the point is that it - // doesn't matter, since hopefully for this case, - // both sides' dofs should have been unified. - // - // make sure this is actually true. this actually - // only matters, of course, if either of the two - // finite elements actually do have dofs on the - // face - if ((cell->get_fe().dofs_per_face != 0) - || - (cell->neighbor(face)->get_fe().dofs_per_face != 0)) - { - Assert (cell->get_fe().dofs_per_face - == - cell->neighbor(face)->get_fe().dofs_per_face, - ExcNotImplemented()); - - // (ab)use the master and slave dofs arrays for - // a moment here - master_dofs.resize (cell->get_fe().dofs_per_face); - cell->face(face) - ->get_dof_indices (master_dofs, - cell->active_fe_index ()); - - slave_dofs.resize (cell->neighbor(face)->get_fe().dofs_per_face); - cell->face(face) - ->get_dof_indices (slave_dofs, - cell->neighbor(face)->active_fe_index ()); - - for (unsigned int i=0; iget_fe().dofs_per_face; ++i) - AssertDimension (master_dofs[i], slave_dofs[i]); - } - - break; - } - - case FiniteElementDomination::neither_element_dominates: - { - // we don't presently know what exactly to do here. - // it isn't quite clear what exactly we would have - // to do here. sit tight until someone trips over - // the following statement and see what exactly is - // going on - Assert (false, ExcNotImplemented()); - break; - } - - case FiniteElementDomination::no_requirements: - { - // nothing to do here - break; - } - - default: - // we shouldn't get here - Assert (false, ExcInternalError()); - } - } - } - } - } - - - - - template - void - make_hanging_node_constraints (const DH &dof_handler, - ConstraintMatrix &constraints) - { - // Decide whether to use the new or old make_hanging_node_constraints - // function. If all the FiniteElement or all elements in a FECollection - // support the new face constraint matrix, the new code will be used. - // Otherwise, the old implementation is used for the moment. - if (dof_handler.get_fe().hp_constraints_are_implemented ()) - internal:: - make_hp_hanging_node_constraints (dof_handler, - constraints); - else - internal:: - make_oldstyle_hanging_node_constraints (dof_handler, - constraints, - dealii::internal::int2type()); - } - - - - namespace - { - // enter constraints for periodicity into the given ConstraintMatrix object. - // this function is called when at least one of the two face iterators corresponds - // to an active object without further children - // - // @param transformation A matrix that maps degrees of freedom from one face - // to another. If the DoFs on the two faces are supposed to match exactly, then - // the matrix so provided will be the identity matrix. if face 2 is once refined - // from face 1, then the matrix needs to be the interpolation matrix from a face - // to this particular child - // - // @precondition: face_1 is supposed to be active - template - void - set_periodicity_constraints (const FaceIterator &face_1, - const typename identity::type &face_2, - const FullMatrix &transformation, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask, - const bool face_orientation, - const bool face_flip, - const bool face_rotation) - { - static const int dim = FaceIterator::AccessorType::dimension; - static const int spacedim = FaceIterator::AccessorType::space_dimension; - - // we should be in the case where face_1 is active, i.e. has no children: - Assert (!face_1->has_children(), - ExcInternalError()); - - Assert (face_1->n_active_fe_indices() == 1, - ExcInternalError()); - - // if face_2 does have children, then we need to iterate over them - if (face_2->has_children()) - { - Assert (face_2->n_children() == GeometryInfo::max_children_per_face, - ExcNotImplemented()); - const unsigned int dofs_per_face - = face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face; - FullMatrix child_transformation (dofs_per_face, dofs_per_face); - FullMatrix subface_interpolation (dofs_per_face, dofs_per_face); - for (unsigned int c=0; cn_children(); ++c) - { - // get the interpolation matrix recursively from the one that - // interpolated from face_1 to face_2 by multiplying from the - // left with the one that interpolates from face_2 to - // its child - face_1->get_fe(face_1->nth_active_fe_index(0)) - .get_subface_interpolation_matrix (face_1->get_fe(face_1->nth_active_fe_index(0)), - c, - subface_interpolation); - subface_interpolation.mmult (child_transformation, transformation); - set_periodicity_constraints(face_1, face_2->child(c), - child_transformation, - constraint_matrix, component_mask, - face_orientation, face_flip, face_rotation); - } - } - else - // both faces are active. we need to match the corresponding DoFs of both faces - { - const unsigned int face_1_index = face_1->nth_active_fe_index(0); - const unsigned int face_2_index = face_2->nth_active_fe_index(0); - Assert(face_1->get_fe(face_1_index) == face_2->get_fe(face_1_index), - ExcMessage ("Matching periodic cells need to use the same finite element")); - - const FiniteElement &fe = face_1->get_fe(face_1_index); - - Assert(component_mask.represents_n_components(fe.n_components()), - ExcMessage ("The number of components in the mask has to be either " - "zero or equal to the number of components in the finite " "element.")); - - const unsigned int dofs_per_face = fe.dofs_per_face; - - std::vector dofs_1(dofs_per_face); - std::vector dofs_2(dofs_per_face); - - face_1->get_dof_indices(dofs_1, face_1_index); - face_2->get_dof_indices(dofs_2, face_2_index); - - // Well, this is a hack: - // - // There is no - // face_to_face_index(face_index, - // face_orientation, - // face_flip, - // face_rotation) - // function in FiniteElementData, so we have to use - // face_to_cell_index(face_index, face - // face_orientation, - // face_flip, - // face_rotation) - // But this will give us an index on a cell - something we cannot work - // with directly. But luckily we can match them back :-] - - std::map cell_to_rotated_face_index; - - // Build up a cell to face index for face_2: - for (unsigned int i = 0; i < dofs_per_face; ++i) - { - const unsigned int cell_index = fe.face_to_cell_index(i, 0, /* It doesn't really matter, just assume - * we're on the first face... - */ - true, false, false // default orientation - ); - cell_to_rotated_face_index[cell_index] = i; - } - - // loop over all dofs on face 2 and constrain them again the ones on face 1 - for (unsigned int i=0; i - void - make_periodicity_constraints (const FaceIterator &face_1, - const typename identity::type &face_2, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask, - const bool face_orientation, - const bool face_flip, - const bool face_rotation) - { - static const int dim = FaceIterator::AccessorType::dimension; - - Assert( (dim != 1) || - (face_orientation == true && - face_flip == false && - face_rotation == false), - ExcMessage ("The supplied orientation " - "(face_orientation, face_flip, face_rotation) " - "is invalid for 1D")); - - Assert( (dim != 2) || - (face_orientation == true && - face_rotation == false), - ExcMessage ("The supplied orientation " - "(face_orientation, face_flip, face_rotation) " - "is invalid for 2D")); - - Assert(face_1 != face_2, - ExcMessage ("face_1 and face_2 are equal! Cannot constrain DoFs " - "on the very same face")); - - Assert(face_1->at_boundary() && face_2->at_boundary(), - ExcMessage ("Faces for periodicity constraints must be on the boundary")); - - - // A lookup table on how to go through the child faces depending on the - // orientation: - - static const int lookup_table_2d[2][2] = - { - // flip: - {0, 1}, // false - {1, 0}, // true - }; - - static const int lookup_table_3d[2][2][2][4] = - { - // orientation flip rotation - { { {0, 2, 1, 3}, // false false false - {2, 3, 0, 1}, // false false true - }, - { {3, 1, 2, 0}, // false true false - {1, 0, 3, 2}, // false true true - }, - }, - { { {0, 1, 2, 3}, // true false false - {1, 3, 0, 2}, // true false true - }, - { {3, 2, 1, 0}, // true true false - {2, 0, 3, 1}, // true true true - }, - }, - }; - - // In the case that both faces have children, we loop over all - // children and apply make_periodicty_constrains recursively: - if (face_1->has_children() && face_2->has_children()) - { - Assert(face_1->n_children() == GeometryInfo::max_children_per_face && - face_2->n_children() == GeometryInfo::max_children_per_face, - ExcNotImplemented()); - - for (unsigned int i = 0; i < GeometryInfo::max_children_per_face; ++i) - { - // Lookup the index for the second face - unsigned int j; - switch (dim) - { - case 2: - j = lookup_table_2d[face_flip][i]; - break; - case 3: - j = lookup_table_3d[face_orientation][face_flip][face_rotation][i]; - break; - default: - AssertThrow(false, ExcNotImplemented()); - } - - make_periodicity_constraints (face_1->child(i), - face_2->child(j), - constraint_matrix, - component_mask, - face_orientation, - face_flip, - face_rotation); - } - } - else - // otherwise at least one of the two faces is active and - // we need to enter the constraints - { - if (face_2->has_children() == false) - set_periodicity_constraints(face_2, face_1, - FullMatrix(IdentityMatrix(face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face)), - constraint_matrix, - component_mask, - face_orientation, face_flip, face_rotation); - else - set_periodicity_constraints(face_1, face_2, - FullMatrix(IdentityMatrix(face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face)), - constraint_matrix, - component_mask, - face_orientation, face_flip, face_rotation); - } - } - - - - template - void - make_periodicity_constraints (const DH &dof_handler, - const types::boundary_id b_id1, - const types::boundary_id b_id2, - const int direction, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask) - { - Tensor<1,DH::space_dimension> dummy; - make_periodicity_constraints (dof_handler, - b_id1, - b_id2, - direction, - dummy, - constraint_matrix, - component_mask); - } - - - - template - void - make_periodicity_constraints (const DH &dof_handler, - const types::boundary_id b_id1, - const types::boundary_id b_id2, - const int direction, - dealii::Tensor<1,DH::space_dimension> &offset, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask) - { - static const int space_dim = DH::space_dimension; - Assert (0<=direction && direction PTRIA; - const PTRIA *ptria_p = dynamic_cast (&dof_handler.get_tria()); - Assert ((ptria_p == 0 || Utilities::MPI::n_mpi_processes(ptria_p->get_communicator()) == 1), - ExcMessage ("This function can not be used with distributed triangulations." - "See the documentation for more information.")); - } -#endif - - Assert (b_id1 != b_id2, - ExcMessage ("The boundary indicators b_id1 and b_id2 must be" - "different to denote different boundaries.")); - - typedef typename DH::face_iterator FaceIterator; - typedef std::map > > FaceMap; - - // Collect matching periodic cells on the coarsest level: - FaceMap matched_cells = - GridTools::collect_periodic_face_pairs(dof_handler, - b_id1, b_id2, - direction, offset); - - // And apply the low level make_periodicity_constraints function to - // every matching pair: - for (typename FaceMap::iterator it = matched_cells.begin(); - it != matched_cells.end(); ++it) - { - typedef typename DH::face_iterator FaceIterator; - const FaceIterator &face_1 = it->first; - const FaceIterator &face_2 = it->second.first; - const std::bitset<3> &orientation = it->second.second; - - Assert(face_1->at_boundary() && face_2->at_boundary(), - ExcInternalError()); - - Assert (face_1->boundary_indicator() == b_id1 && - face_2->boundary_indicator() == b_id2, - ExcInternalError()); - - Assert (face_1 != face_2, - ExcInternalError()); - - make_periodicity_constraints(face_1, - face_2, - constraint_matrix, - component_mask, - orientation[0], - orientation[1], - orientation[2]); - } - } - - - - template - void - make_periodicity_constraints (const DH &dof_handler, - const types::boundary_id b_id, - const int direction, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask) - { - Tensor<1,DH::space_dimension> dummy; - make_periodicity_constraints (dof_handler, - b_id, - direction, - dummy, - constraint_matrix, - component_mask); - } - - - - template - void - make_periodicity_constraints (const DH &dof_handler, - const types::boundary_id b_id, - const int direction, - dealii::Tensor<1,DH::space_dimension> &offset, - dealii::ConstraintMatrix &constraint_matrix, - const ComponentMask &component_mask) - { - static const int dim = DH::dimension; - static const int space_dim = DH::space_dimension; - - Assert (0<=direction && direction PTRIA; - const PTRIA *ptria_p = dynamic_cast (&dof_handler.get_tria()); - Assert ((ptria_p == 0 || Utilities::MPI::n_mpi_processes(ptria_p->get_communicator()) == 1), - ExcMessage ("This function can not be used with distributed triangulations." - "See the documentation for more information.")); - } -#endif - - typedef typename DH::face_iterator FaceIterator; - typedef std::map FaceMap; - - // Collect matching periodic cells on the coarsest level: - FaceMap matched_cells = - GridTools::collect_periodic_face_pairs(dof_handler, - b_id, - direction, offset); - - // And apply the low level make_periodicity_constraints function to - // every matching pair: - for (typename FaceMap::iterator it = matched_cells.begin(); - it != matched_cells.end(); ++it) - { - typedef typename DH::face_iterator FaceIterator; - const FaceIterator &face_1 = it->first; - const FaceIterator &face_2 = it->second; +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- - Assert(face_1->at_boundary() && face_2->at_boundary(), - ExcInternalError()); +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include - Assert (face_1->boundary_indicator() == b_id && - face_2->boundary_indicator() == b_id, - ExcInternalError()); +#include - Assert (face_1 != face_2, - ExcInternalError()); +#include +#include - make_periodicity_constraints(face_1, - face_2, - constraint_matrix, - component_mask - /* standard orientation */); - } - } +DEAL_II_NAMESPACE_OPEN +namespace DoFTools +{ namespace internal { // return an array that for each dof on the reference cell @@ -4507,7 +1346,7 @@ namespace DoFTools const unsigned int n_components = dof_handler.get_fe().n_components(); std::fill (dofs_per_component.begin(), dofs_per_component.end(), - types::global_dof_index(0)); + types::global_dof_index(0)); // If the empty vector was given as default argument, set up this // vector as identity. @@ -4558,7 +1397,7 @@ namespace DoFTools || (std::accumulate (dofs_per_component.begin(), dofs_per_component.end(), - types::global_dof_index(0)) + types::global_dof_index(0)) == dof_handler.n_locally_owned_dofs()), ExcInternalError()); @@ -4575,7 +1414,7 @@ namespace DoFTools MPI_Allreduce ( &local_dof_count[0], &dofs_per_component[0], n_target_components, DEAL_II_DOF_INDEX_MPI_TYPE, - MPI_SUM, tria->get_communicator()); + MPI_SUM, tria->get_communicator()); } #endif } @@ -4598,7 +1437,7 @@ namespace DoFTools { const FiniteElement &fe = fe_collection[this_fe]; std::fill (dofs_per_block.begin(), dofs_per_block.end(), - types::global_dof_index(0)); + types::global_dof_index(0)); // If the empty vector was given as default argument, set up this // vector as identity. @@ -4650,9 +1489,9 @@ namespace DoFTools { std::vector local_dof_count = dofs_per_block; MPI_Allreduce ( &local_dof_count[0], &dofs_per_block[0], - n_target_blocks, + n_target_blocks, DEAL_II_DOF_INDEX_MPI_TYPE, - MPI_SUM, tria->get_communicator()); + MPI_SUM, tria->get_communicator()); } #endif #endif @@ -4673,677 +1512,6 @@ namespace DoFTools - - namespace internal - { - namespace - { - /** - * This is a function that is called by the _2 function and that - * operates on a range of cells only. It is used to split up the - * whole range of cells into chunks which are then worked on in - * parallel, if multithreading is available. - */ - template - void - compute_intergrid_weights_3 ( - const dealii::DoFHandler &coarse_grid, - const unsigned int coarse_component, - const InterGridMap > &coarse_to_fine_grid_map, - const std::vector > ¶meter_dofs, - const std::vector &weight_mapping, - std::vector > &weights, - const typename dealii::DoFHandler::active_cell_iterator &begin, - const typename dealii::DoFHandler::active_cell_iterator &end) - { - // aliases to the finite elements used by the dof handlers: - const FiniteElement &coarse_fe = coarse_grid.get_fe(); - - // for each cell on the parameter grid: find out which degrees of - // freedom on the fine grid correspond in which way to the degrees - // of freedom on the parameter grid - // - // since for continuous FEs some dofs exist on more than one cell, - // we have to track which ones were already visited. the problem is - // that if we visit a dof first on one cell and compute its weight - // with respect to some global dofs to be non-zero, and later visit - // the dof again on another cell and (since we are on another cell) - // recompute the weights with respect to the same dofs as above to - // be zero now, we have to preserve them. we therefore overwrite - // all weights if they are nonzero and do not enforce zero weights - // since that might be only due to the fact that we are on another - // cell. - // - // example: - // coarse grid - // | | | - // *-----*-----* - // | cell|cell | - // | 1 | 2 | - // | | | - // 0-----1-----* - // - // fine grid - // | | | | | - // *--*--*--*--* - // | | | | | - // *--*--*--*--* - // | | | | | - // *--x--y--*--* - // - // when on cell 1, we compute the weights of dof 'x' to be 1/2 from - // parameter dofs 0 and 1, respectively. however, when later we are - // on cell 2, we again compute the prolongation of shape function 1 - // restricted to cell 2 to the globla grid and find that the weight - // of global dof 'x' now is zero. however, we should not overwrite - // the old value. - // - // we therefore always only set nonzero values. why adding up is - // not useful: dof 'y' would get weight 1 from parameter dof 1 on - // both cells 1 and 2, but the correct weight is nevertheless only - // 1. - - // vector to hold the representation of a single degree of freedom - // on the coarse grid (for the selected fe) on the fine grid - const types::global_dof_index n_fine_dofs = weight_mapping.size(); - dealii::Vector global_parameter_representation (n_fine_dofs); - - typename dealii::DoFHandler::active_cell_iterator cell; - std::vector parameter_dof_indices (coarse_fe.dofs_per_cell); - - for (cell=begin; cell!=end; ++cell) - { - // get the global indices of the parameter dofs on this - // parameter grid cell - cell->get_dof_indices (parameter_dof_indices); - - // loop over all dofs on this cell and check whether they are - // interesting for us - for (unsigned int local_dof=0; - local_dof - set_dof_values_by_interpolation (parameter_dofs[local_parameter_dof], - global_parameter_representation); - // now that we've got the global representation of each - // parameter dof, we've only got to clobber the non-zero - // entries in that vector and store the result - // - // what we have learned: if entry @p{i} of the global - // vector holds the value @p{v[i]}, then this is the - // weight with which the present dof contributes to - // @p{i}. there may be several such @p{i}s and their - // weights' sum should be one. Then, @p{v[i]} should be - // equal to @p{\sum_j w_{ij} p[j]} with @p{p[j]} be the - // values of the degrees of freedom on the coarse grid. - // we can thus compute constraints which link the degrees - // of freedom @p{v[i]} on the fine grid to those on the - // coarse grid, @p{p[j]}. Now to use these as real - // constraints, rather than as additional equations, we - // have to identify representants among the @p{i} for - // each @p{j}. this will be done by simply taking the - // first @p{i} for which @p{w_{ij}==1}. - // - // guard modification of the weights array by a Mutex. - // since it should happen rather rarely that there are - // several threads operating on different intergrid - // weights, have only one mutex for all of them - static Threads::Mutex mutex; - Threads::Mutex::ScopedLock lock (mutex); - for (types::global_dof_index i=0; i - void - compute_intergrid_weights_2 ( - const dealii::DoFHandler &coarse_grid, - const unsigned int coarse_component, - const InterGridMap > &coarse_to_fine_grid_map, - const std::vector > ¶meter_dofs, - const std::vector &weight_mapping, - std::vector > &weights) - { - // simply distribute the range of cells to different threads - typedef typename dealii::DoFHandler::active_cell_iterator active_cell_iterator; - std::vector > - cell_intervals = Threads::split_range (coarse_grid.begin_active(), - coarse_grid.end(), - multithread_info.n_default_threads); - - // TODO: use WorkStream here - - Threads::TaskGroup<> tasks; - void (*fun_ptr) (const dealii::DoFHandler &, - const unsigned int , - const InterGridMap > &, - const std::vector > &, - const std::vector &, - std::vector > &, - const typename dealii::DoFHandler::active_cell_iterator &, - const typename dealii::DoFHandler::active_cell_iterator &) - = &compute_intergrid_weights_3; - for (unsigned int i=0; i - unsigned int - compute_intergrid_weights_1 ( - const dealii::DoFHandler &coarse_grid, - const unsigned int coarse_component, - const dealii::DoFHandler &fine_grid, - const unsigned int fine_component, - const InterGridMap > &coarse_to_fine_grid_map, - std::vector > &weights, - std::vector &weight_mapping) - { - // aliases to the finite elements used by the dof handlers: - const FiniteElement &coarse_fe = coarse_grid.get_fe(), - &fine_fe = fine_grid.get_fe(); - - // global numbers of dofs - const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(), - n_fine_dofs = fine_grid.n_dofs(); - - // local numbers of dofs - const unsigned int fine_dofs_per_cell = fine_fe.dofs_per_cell; - - // alias the number of dofs per cell belonging to the - // coarse_component which is to be the restriction of the fine - // grid: - const unsigned int coarse_dofs_per_cell_component - = coarse_fe.base_element(coarse_fe.component_to_base_index(coarse_component).first).dofs_per_cell; - - - // Try to find out whether the grids stem from the same coarse - // grid. This is a rather crude test, but better than nothing - Assert (coarse_grid.get_tria().n_cells(0) == fine_grid.get_tria().n_cells(0), - ExcGridsDontMatch()); - - // check whether the map correlates the right objects - Assert (&coarse_to_fine_grid_map.get_source_grid() == &coarse_grid, - ExcGridsDontMatch ()); - Assert (&coarse_to_fine_grid_map.get_destination_grid() == &fine_grid, - ExcGridsDontMatch ()); - - - // check whether component numbers are valid - AssertIndexRange (coarse_component,coarse_fe.n_components()); - AssertIndexRange (fine_component, fine_fe.n_components()); - - // check whether respective finite elements are equal - Assert (coarse_fe.base_element (coarse_fe.component_to_base_index(coarse_component).first) - == - fine_fe.base_element (fine_fe.component_to_base_index(fine_component).first), - ExcFiniteElementsDontMatch()); - -#ifdef DEBUG - // if in debug mode, check whether the coarse grid is indeed - // coarser everywhere than the fine grid - for (typename dealii::DoFHandler::active_cell_iterator - cell=coarse_grid.begin_active(); - cell != coarse_grid.end(); ++cell) - Assert (cell->level() <= coarse_to_fine_grid_map[cell]->level(), - ExcGridNotCoarser()); -#endif - - /* - * From here on: the term `parameter' refers to the selected - * component on the coarse grid and its analogon on the fine grid. - * The naming of variables containing this term is due to the fact - * that `selected_component' is longer, but also due to the fact - * that the code of this function was initially written for a - * program where the component which we wanted to match between - * grids was actually the `parameter' variable. - * - * Likewise, the terms `parameter grid' and `state grid' refer to - * the coarse and fine grids, respectively. - * - * Changing the names of variables would in principle be a good - * idea, but would not make things simpler and would be another - * source of errors. If anyone feels like doing so: patches would - * be welcome! - */ - - - - // set up vectors of cell-local data; each vector represents one - // degree of freedom of the coarse-grid variable in the fine-grid - // element - std::vector > - parameter_dofs (coarse_dofs_per_cell_component, - dealii::Vector(fine_dofs_per_cell)); - // for each coarse dof: find its position within the fine element - // and set this value to one in the respective vector (all other - // values are zero by construction) - for (unsigned int local_coarse_dof=0; - local_coarse_dof dof_is_interesting (fine_grid.n_dofs(), false); - std::vector local_dof_indices (fine_fe.dofs_per_cell); - - for (typename dealii::DoFHandler::active_cell_iterator - cell=fine_grid.begin_active(); - cell!=fine_grid.end(); ++cell) - { - cell->get_dof_indices (local_dof_indices); - for (unsigned int i=0; i local_dof_indices(fine_fe.dofs_per_cell); - unsigned int next_free_index=0; - for (typename dealii::DoFHandler::active_cell_iterator - cell=fine_grid.begin_active(); - cell != fine_grid.end(); ++cell) - { - cell->get_dof_indices (local_dof_indices); - for (unsigned int i=0; i1) && (sum==0)), ExcInternalError()); - }; -#endif - - - return n_parameters_on_fine_grid; - } - - - } - } - - - - template - void - compute_intergrid_constraints ( - const DoFHandler &coarse_grid, - const unsigned int coarse_component, - const DoFHandler &fine_grid, - const unsigned int fine_component, - const InterGridMap > &coarse_to_fine_grid_map, - ConstraintMatrix &constraints) - { - // store the weights with which a dof on the parameter grid contributes - // to a dof on the fine grid. see the long doc below for more info - // - // allocate as many rows as there are parameter dofs on the coarse grid - // and as many columns as there are parameter dofs on the fine grid. - // - // weight_mapping is used to map the global (fine grid) parameter dof - // indices to the columns - // - // in the original implementation, the weights array was actually of - // FullMatrix type. this wasted huge amounts of memory, but was - // fast. nonetheless, since the memory consumption was quadratic in the - // number of degrees of freedom, this was not very practical, so we now - // use a vector of rows of the matrix, and in each row a vector of - // pairs (colnum,value). this seems like the best tradeoff between - // memory and speed, as it is now linear in memory and still fast - // enough. - // - // to save some memory and since the weights are usually (negative) - // powers of 2, we choose the value type of the matrix to be @p{float} - // rather than @p{double}. - std::vector > weights; - - // this is this mapping. there is one entry for each dof on the fine - // grid; if it is a parameter dof, then its value is the column in - // weights for that parameter dof, if it is any other dof, then its - // value is -1, indicating an error - std::vector weight_mapping; - - const unsigned int n_parameters_on_fine_grid - = internal::compute_intergrid_weights_1 (coarse_grid, coarse_component, - fine_grid, fine_component, - coarse_to_fine_grid_map, - weights, weight_mapping); - - // global numbers of dofs - const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(), - n_fine_dofs = fine_grid.n_dofs(); - - - // get an array in which we store which dof on the coarse grid is a - // parameter and which is not - std::vector coarse_dof_is_parameter (coarse_grid.n_dofs()); - if (true) - { - std::vector mask (coarse_grid.get_fe().n_components(), - false); - mask[coarse_component] = true; - extract_dofs (coarse_grid, ComponentMask(mask), coarse_dof_is_parameter); - } - - // now we know that the weights in each row constitute a constraint. - // enter this into the constraints object - // - // first task: for each parameter dof on the parameter grid, find a - // representant on the fine, global grid. this is possible since we use - // conforming finite element. we take this representant to be the first - // element in this row with weight identical to one. the representant - // will become an unconstrained degree of freedom, while all others - // will be constrained to this dof (and possibly others) - std::vector representants(n_coarse_dofs, numbers::invalid_dof_index); - for (types::global_dof_index parameter_dof=0; parameter_dof 0, ExcInternalError()); - - // find the column where the representant is mentioned - std::map::const_iterator i = weights[parameter_dof].begin(); - for (; i!=weights[parameter_dof].end(); ++i) - if (i->second == 1) - break; - Assert (i!=weights[parameter_dof].end(), ExcInternalError()); - const types::global_dof_index column = i->first; - - // now we know in which column of weights the representant is, - // but we don't know its global index. get it using the inverse - // operation of the weight_mapping - types::global_dof_index global_dof=0; - for (; global_dof(column)) - break; - Assert (global_dof < weight_mapping.size(), ExcInternalError()); - - // now enter the representants global index into our list - representants[parameter_dof] = global_dof; - } - else - { - // consistency check: if this is no parameter dof on the coarse - // grid, then the respective row must be empty! - Assert (weights[parameter_dof].size() == 0, ExcInternalError()); - }; - - - - // note for people that want to optimize this function: the largest - // part of the computing time is spent in the following, rather - // innocent block of code. basically, it must be the - // ConstraintMatrix::add_entry call which takes the bulk of the time, - // but it is not known to the author how to make it faster... - std::vector > constraint_line; - for (types::global_dof_index global_dof=0; global_dof 0, ExcInternalError()); - std::map::const_iterator - col_entry = weights[0].end(); - for (; first_used_rowsecond == 1) && - (representants[first_used_row] == global_dof)) - // dof unconstrained or constrained to itself (in case this - // cell is mapped to itself, rather than to children of - // itself) - continue; - } - - - // otherwise enter all constraints - constraints.add_line (global_dof); - - constraint_line.clear (); - for (types::global_dof_index row=first_used_row; row::const_iterator - j = weights[row].find(col); - if ((j != weights[row].end()) && (j->second != 0)) - constraint_line.push_back (std::pair(representants[row], - j->second)); - }; - - constraints.add_entries (global_dof, constraint_line); - }; - } - - - - template - void - compute_intergrid_transfer_representation ( - const DoFHandler &coarse_grid, - const unsigned int coarse_component, - const DoFHandler &fine_grid, - const unsigned int fine_component, - const InterGridMap > &coarse_to_fine_grid_map, - std::vector > &transfer_representation) - { - // store the weights with which a dof on the parameter grid contributes - // to a dof on the fine grid. see the long doc below for more info - // - // allocate as many rows as there are parameter dofs on the coarse grid - // and as many columns as there are parameter dofs on the fine grid. - // - // weight_mapping is used to map the global (fine grid) parameter dof - // indices to the columns - // - // in the original implementation, the weights array was actually of - // FullMatrix type. this wasted huge amounts of memory, but was - // fast. nonetheless, since the memory consumption was quadratic in the - // number of degrees of freedom, this was not very practical, so we now - // use a vector of rows of the matrix, and in each row a vector of - // pairs (colnum,value). this seems like the best tradeoff between - // memory and speed, as it is now linear in memory and still fast - // enough. - // - // to save some memory and since the weights are usually (negative) - // powers of 2, we choose the value type of the matrix to be @p{float} - // rather than @p{double}. - std::vector > weights; - - // this is this mapping. there is one entry for each dof on the fine - // grid; if it is a parameter dof, then its value is the column in - // weights for that parameter dof, if it is any other dof, then its - // value is -1, indicating an error - std::vector weight_mapping; - - internal::compute_intergrid_weights_1 (coarse_grid, coarse_component, - fine_grid, fine_component, - coarse_to_fine_grid_map, - weights, weight_mapping); - - // now compute the requested representation - const types::global_dof_index n_global_parm_dofs - = std::count_if (weight_mapping.begin(), weight_mapping.end(), - std::bind2nd (std::not_equal_to (), numbers::invalid_dof_index)); - - // first construct the inverse mapping of weight_mapping - std::vector inverse_weight_mapping (n_global_parm_dofs, - DoFHandler::invalid_dof_index); - for (types::global_dof_index i=0; i::invalid_dof_index), - ExcInternalError()); - - inverse_weight_mapping[parameter_dof] = i; - }; - }; - - // next copy over weights array and replace respective numbers - const types::global_dof_index n_rows = weight_mapping.size(); - - transfer_representation.clear (); - transfer_representation.resize (n_rows); - - const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(); - for (types::global_dof_index i=0; i::const_iterator j = weights[i].begin(); - for (; j!=weights[i].end(); ++j) - { - const types::global_dof_index p = inverse_weight_mapping[j->first]; - Assert (psecond; - }; - }; - } - - - template void map_dof_to_boundary_indices (const DH &dof_handler, @@ -5643,87 +1811,6 @@ namespace DoFTools - template class DH> - void - make_zero_boundary_constraints (const DH &dof, - const types::boundary_id boundary_indicator, - ConstraintMatrix &zero_boundary_constraints, - const ComponentMask &component_mask) - { - Assert (component_mask.represents_n_components(dof.get_fe().n_components()), - ExcMessage ("The number of components in the mask has to be either " - "zero or equal to the number of components in the finite " - "element.")); - - const unsigned int n_components = DoFTools::n_components (dof); - - Assert (component_mask.n_selected_components(n_components) > 0, - VectorTools::ExcNoComponentSelected()); - - // a field to store the indices - std::vector face_dofs; - face_dofs.reserve (max_dofs_per_face(dof)); - - typename DH::active_cell_iterator - cell = dof.begin_active(), - endc = dof.end(); - for (; cell!=endc; ++cell) - if (!cell->is_artificial()) - for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; - ++face_no) - { - const FiniteElement &fe = cell->get_fe(); - - const typename DH::face_iterator face = cell->face(face_no); - - // if face is on the boundary and satisfies the correct - // boundary id property - if (face->at_boundary () - && - ((boundary_indicator == numbers::invalid_boundary_id) - || - (face->boundary_indicator() == boundary_indicator))) - { - // get indices and physical location on this face - face_dofs.resize (fe.dofs_per_face); - face->get_dof_indices (face_dofs, cell->active_fe_index()); - - // enter those dofs into the list that match the component - // signature. - for (unsigned int i=0; iget_fe().get_nonzero_components (i); - bool nonzero = false; - for (unsigned int c=0; c class DH> - void - make_zero_boundary_constraints (const DH &dof, - ConstraintMatrix &zero_boundary_constraints, - const ComponentMask &component_mask) - { - make_zero_boundary_constraints(dof, numbers::invalid_boundary_id, - zero_boundary_constraints, component_mask); - } - - template void make_cell_patches( Sparsity &block_list, @@ -5983,7 +2070,9 @@ namespace DoFTools } } } -} + + +} // end of namespace DoFTools diff --git a/deal.II/source/dofs/dof_tools.inst.in b/deal.II/source/dofs/dof_tools.inst.in index e8eb94087b..9309ae6bc2 100644 --- a/deal.II/source/dofs/dof_tools.inst.in +++ b/deal.II/source/dofs/dof_tools.inst.in @@ -1,395 +1,35 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) { - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler &dof, - SP &sparsity, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler &dof, - SP &sparsity, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const MGDoFHandler &dof, - SP &sparsity, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler&, - const Table<2,Coupling>&, - SP &, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler&, - const Table<2,Coupling>&, - SP &, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const MGDoFHandler&, - const Table<2,Coupling>&, - SP &, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler &dof_row, - const DoFHandler &dof_col, - SP &sparsity); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler &dof_row, - const hp::DoFHandler &dof_col, - SP &sparsity); - - // #if deal_II_dimension > 1 - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const DoFHandler& dof, - const std::vector &, - SP &); - - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const hp::DoFHandler& dof, - const std::vector &, - SP &); - - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const DoFHandler& dof, - const FunctionMap::type &boundary_indicators, - const std::vector &dof_to_boundary_mapping, - SP &sparsity); - - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const hp::DoFHandler& dof, - const FunctionMap::type &boundary_indicators, - const std::vector &dof_to_boundary_mapping, - SP &sparsity); - - template void - DoFTools::make_flux_sparsity_pattern,SP> - (const DoFHandler &dof, - SP &sparsity); - - template void - DoFTools::make_flux_sparsity_pattern,SP> - (const hp::DoFHandler &dof, - SP &sparsity); - - template void - DoFTools::make_cell_patches,SP> - (SP&, const DoFHandler&, const unsigned int, const std::vector&, types::global_dof_index); - - template void - DoFTools::make_cell_patches,SP> - (SP&, const MGDoFHandler&, const unsigned int, const std::vector&, types::global_dof_index); - -#if deal_II_dimension > 1 - - template void - DoFTools::make_flux_sparsity_pattern,SP> - (const DoFHandler &dof, - SP &, - const Table<2,Coupling>&, - const Table<2,Coupling>&); - - template void - DoFTools::make_flux_sparsity_pattern,SP> - (const DoFHandler &dof, - SP &sparsity, - const ConstraintMatrix &constraints, - const bool, const unsigned int); - - template void - DoFTools::make_flux_sparsity_pattern,SP> - (const hp::DoFHandler &dof, - SP &sparsity, - const ConstraintMatrix &constraints, - const bool, const unsigned int); - - template void - DoFTools::make_flux_sparsity_pattern,SP> - (const hp::DoFHandler &dof, - SP &, - const Table<2,Coupling>&, - const Table<2,Coupling>&); -#endif - -#if deal_II_dimension < 3 - - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler &dof, - SP &sparsity, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler &dof, - SP &sparsity, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler&, - const Table<2,Coupling>&, - SP &, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler&, - const Table<2,Coupling>&, - SP &, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler &dof_row, - const DoFHandler &dof_col, - SP &sparsity); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler &dof_row, - const hp::DoFHandler &dof_col, - SP &sparsity); - - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const DoFHandler& dof, - const std::vector &, - SP &); - - //template void - //DoFTools::make_boundary_sparsity_pattern,SP> - //(const hp::DoFHandler& dof, - // const std::vector &, - // SP &); - - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const DoFHandler& dof, - const FunctionMap::type &boundary_indicators, - const std::vector &dof_to_boundary_mapping, - SP &sparsity); - - //template void - //DoFTools::make_boundary_sparsity_pattern,SP> - //(const hp::DoFHandler& dof, - // const FunctionMap::type &boundary_indicators, - // const std::vector &dof_to_boundary_mapping, - // SP &sparsity); - -#endif - - -#if deal_II_dimension == 3 + template void + DoFTools::make_cell_patches,SP> + (SP&, const DoFHandler&, const unsigned int, const std::vector&, types::global_dof_index); - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler<1,3> &dof, - SP &sparsity, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler<1,3> &dof, - SP &sparsity, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler<1,3>&, - const Table<2,Coupling>&, - SP &, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler<1,3>&, - const Table<2,Coupling>&, - SP &, - const ConstraintMatrix &, - const bool, - const unsigned int); - - template void - DoFTools::make_sparsity_pattern, SP> - (const DoFHandler<1,3> &dof_row, - const DoFHandler<1,3> &dof_col, - SP &sparsity); - - template void - DoFTools::make_sparsity_pattern, SP> - (const hp::DoFHandler<1,3> &dof_row, - const hp::DoFHandler<1,3> &dof_col, - SP &sparsity); - - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const DoFHandler<1,3>& dof, - const std::vector &, - SP &); - - //template void - //DoFTools::make_boundary_sparsity_pattern,SP> - //(const hp::DoFHandler<1,3>& dof, - // const std::vector &, - // SP &); - - template void - DoFTools::make_boundary_sparsity_pattern,SP> - (const DoFHandler<1,3>& dof, - const FunctionMap<3>::type &boundary_indicators, - const std::vector &dof_to_boundary_mapping, - SP &sparsity); - - //template void - //DoFTools::make_boundary_sparsity_pattern,SP> - //(const hp::DoFHandler<1,3>& dof, - // const FunctionMap<3>::type &boundary_indicators, - // const std::vector &dof_to_boundary_mapping, - // SP &sparsity); - -#endif - - } - - - - -for (DH : DOFHANDLERS; deal_II_dimension : DIMENSIONS) -{ - template - void - DoFTools::make_hanging_node_constraints (const DH &dof_handler, - ConstraintMatrix &constraints); + template void + DoFTools::make_cell_patches,SP> + (SP&, const MGDoFHandler&, const unsigned int, const std::vector&, types::global_dof_index); } -for (DH : DOFHANDLERS; deal_II_dimension : DIMENSIONS) -{ - -#if deal_II_dimension != 1 - template - void - DoFTools::make_periodicity_constraints (const DH::face_iterator &, - const DH::face_iterator &, - dealii::ConstraintMatrix &, - const ComponentMask &, - bool, bool, bool); - - template - void - DoFTools::make_periodicity_constraints(const DH &, - const types::boundary_id, - const types::boundary_id, - const int, - dealii::ConstraintMatrix &, - const ComponentMask &); - - template - void - DoFTools::make_periodicity_constraints(const DH &, - const types::boundary_id, - const types::boundary_id, - const int, - dealii::Tensor<1,DH::space_dimension> &, - dealii::ConstraintMatrix &, - const ComponentMask &); - - template - void - DoFTools::make_periodicity_constraints(const DH &, - const types::boundary_id, - const int, - dealii::ConstraintMatrix &, - const ComponentMask &); - - template - void - DoFTools::make_periodicity_constraints(const DH &, - const types::boundary_id, - const int, - dealii::Tensor<1,DH::space_dimension> &, - dealii::ConstraintMatrix &, - const ComponentMask &); -#endif -} - -for (deal_II_dimension : DIMENSIONS) -{ -#if deal_II_dimension != 1 - template - void - DoFTools::make_hanging_node_constraints (const MGDoFHandler &dof_handler, - ConstraintMatrix &constraints); - -#endif - } - - for (deal_II_dimension : DIMENSIONS) { - template - Table<2,DoFTools::Coupling> - DoFTools::dof_couplings_from_component_couplings - (const FiniteElement &fe, - const Table<2,DoFTools::Coupling> &component_couplings); - template void DoFTools::make_vertex_patches (SparsityPattern&, const DoFHandler&, unsigned int, bool, bool, bool, bool); @@ -414,22 +54,6 @@ for (deal_II_dimension : DIMENSIONS) void DoFTools::make_child_patches(SparsityPattern&, const MGDoFHandler&, unsigned int, bool, bool); -#if deal_II_dimension < 3 -template -void -DoFTools:: -make_hanging_node_constraints (const DoFHandler &dof_handler, - ConstraintMatrix &constraints); -#endif - -#if deal_II_dimension == 3 -template -void -DoFTools:: -make_hanging_node_constraints (const DoFHandler<1,3> &dof_handler, - ConstraintMatrix &constraints); -#endif - // TODO: can cleanup a bit more to fit into the scheme used above @@ -579,18 +203,35 @@ DoFTools::extract_locally_owned_dofs > (const DoFHandler & dof_handler, IndexSet & dof_set); +template +void +DoFTools::extract_locally_owned_dofs > +(const hp::DoFHandler & dof_handler, + IndexSet & dof_set); + template void DoFTools::extract_locally_active_dofs > (const DoFHandler & dof_handler, IndexSet & dof_set); +template +void +DoFTools::extract_locally_active_dofs > +(const hp::DoFHandler & dof_handler, + IndexSet & dof_set); template void DoFTools::extract_locally_relevant_dofs > (const DoFHandler & dof_handler, IndexSet & dof_set); + +template +void +DoFTools::extract_locally_relevant_dofs > +(const hp::DoFHandler & dof_handler, + IndexSet & dof_set); template void @@ -899,23 +540,6 @@ DoFTools::count_dofs_per_component ( const DoFHandler&, std::vector&, std::vector); -template -void -DoFTools::compute_intergrid_constraints ( - const DoFHandler &, const unsigned int, - const DoFHandler &, const unsigned int, - const InterGridMap > &, - ConstraintMatrix&); - -template -void -DoFTools::compute_intergrid_transfer_representation -(const DoFHandler &, const unsigned int, - const DoFHandler &, const unsigned int, - const InterGridMap > &, - std::vector > &); - - template void DoFTools::map_dof_to_boundary_indices > @@ -1076,36 +700,6 @@ DoFTools::convert_couplings_to_blocks ( const hp::DoFHandler&, const Table<2, Coupling>&, std::vector >&); -template -void -DoFTools::make_zero_boundary_constraints -(const DoFHandler &, - ConstraintMatrix &, - const ComponentMask &); - -template -void -DoFTools::make_zero_boundary_constraints -(const DoFHandler &, - const types::boundary_id , - ConstraintMatrix &, - const ComponentMask &); - -template -void -DoFTools::make_zero_boundary_constraints -(const hp::DoFHandler &, - ConstraintMatrix &, - const ComponentMask &); - -template -void -DoFTools::make_zero_boundary_constraints -(const hp::DoFHandler &, - const types::boundary_id , - ConstraintMatrix &, - const ComponentMask &); - #if deal_II_dimension < 3 @@ -1166,18 +760,18 @@ DoFTools::extract_hanging_node_dofs (const DoFHandler<1,3> &dof_handler, std::vector &selected_dofs); -// template -// void -// DoFTools::map_dof_to_boundary_indices > -// (const hp::DoFHandler<1,3> &, -// const std::set &, -// std::vector &); - -// template -// void -// DoFTools::map_dof_to_boundary_indices > -// (const hp::DoFHandler<1,3> &, -// std::vector &); +template +void +DoFTools::map_dof_to_boundary_indices > +(const hp::DoFHandler<1,3> &, + const std::set &, + std::vector &); + +template +void +DoFTools::map_dof_to_boundary_indices > +(const hp::DoFHandler<1,3> &, + std::vector &); #endif diff --git a/deal.II/source/dofs/dof_tools_constraints.cc b/deal.II/source/dofs/dof_tools_constraints.cc new file mode 100644 index 0000000000..4909d3a7b5 --- /dev/null +++ b/deal.II/source/dofs/dof_tools_constraints.cc @@ -0,0 +1,2880 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1999 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +DEAL_II_NAMESPACE_OPEN + + + +namespace DoFTools +{ + namespace internal + { + namespace + { + inline bool + check_master_dof_list (const FullMatrix &face_interpolation_matrix, + const std::vector &master_dof_list) + { + const unsigned int N = master_dof_list.size(); + + FullMatrix tmp (N,N); + for (unsigned int i=0; i p(N); + for (unsigned int i=0; i max) + { + max = std::fabs(tmp(i,j)); + r = i; + } + } + // check whether the pivot is too small. if that is the case, + // then the matrix is singular and we shouldn't use this set of + // master dofs + if (max < 1.e-12*typical_diagonal_element) + return false; + + // row interchange + if (r>j) + { + for (unsigned int k=0; k + void + select_master_dofs_for_face_restriction (const FiniteElement &fe1, + const FiniteElement &fe2, + const FullMatrix &face_interpolation_matrix, + std::vector &master_dof_mask) + { + Assert (fe1.dofs_per_face >= fe2.dofs_per_face, + ExcInternalError()); + AssertDimension (master_dof_mask.size(), fe1.dofs_per_face); + + Assert (fe2.dofs_per_vertex <= fe1.dofs_per_vertex, + ExcInternalError()); + Assert (fe2.dofs_per_line <= fe1.dofs_per_line, + ExcInternalError()); + Assert ((dim < 3) + || + (fe2.dofs_per_quad <= fe1.dofs_per_quad), + ExcInternalError()); + + // the idea here is to designate as many DoFs in fe1 per object + // (vertex, line, quad) as master as there are such dofs in fe2 + // (indices are int, because we want to avoid the 'unsigned int < 0 + // is always false warning for the cases at the bottom in 1d and + // 2d) + // + // as mentioned in the paper, it is not always easy to find a set + // of master dofs that produces an invertible matrix. to this end, + // we check in each step whether the matrix is still invertible and + // simply discard this dof if the matrix is not invertible anymore. + // + // the cases where we did have trouble in the past were with adding + // more quad dofs when Q3 and Q4 elements meet at a refined face in + // 3d (see the hp/crash_12 test that tests that we can do exactly + // this, and failed before we had code to compensate for this + // case). the other case are system elements: if we have say a Q1Q2 + // vs a Q2Q3 element, then we can't just take all master dofs on a + // line from a single base element, since the shape functions of + // that base element are independent of that of the other one. this + // latter case shows up when running hp/hp_constraints_q_system_06 + + std::vector master_dof_list; + unsigned int index = 0; + for (int v=0; + v(GeometryInfo::vertices_per_face); + ++v) + { + unsigned int dofs_added = 0; + unsigned int i = 0; + while (dofs_added < fe2.dofs_per_vertex) + { + // make sure that we were able to find a set of master dofs + // and that the code down below didn't just reject all our + // efforts + Assert (i < fe1.dofs_per_vertex, + ExcInternalError()); + + // tentatively push this vertex dof + master_dof_list.push_back (index+i); + + // then see what happens. if it succeeds, fine + if (check_master_dof_list (face_interpolation_matrix, + master_dof_list) + == true) + ++dofs_added; + else + // well, it didn't. simply pop that dof from the list + // again and try with the next dof + master_dof_list.pop_back (); + + // forward counter by one + ++i; + } + index += fe1.dofs_per_vertex; + } + + for (int l=0; + l(GeometryInfo::lines_per_face); + ++l) + { + // same algorithm as above + unsigned int dofs_added = 0; + unsigned int i = 0; + while (dofs_added < fe2.dofs_per_line) + { + Assert (i < fe1.dofs_per_line, + ExcInternalError()); + + master_dof_list.push_back (index+i); + if (check_master_dof_list (face_interpolation_matrix, + master_dof_list) + == true) + ++dofs_added; + else + master_dof_list.pop_back (); + + ++i; + } + index += fe1.dofs_per_line; + } + + for (int q=0; + q(GeometryInfo::quads_per_face); + ++q) + { + // same algorithm as above + unsigned int dofs_added = 0; + unsigned int i = 0; + while (dofs_added < fe2.dofs_per_quad) + { + Assert (i < fe1.dofs_per_quad, + ExcInternalError()); + + master_dof_list.push_back (index+i); + if (check_master_dof_list (face_interpolation_matrix, + master_dof_list) + == true) + ++dofs_added; + else + master_dof_list.pop_back (); + + ++i; + } + index += fe1.dofs_per_quad; + } + + AssertDimension (index, fe1.dofs_per_face); + AssertDimension (master_dof_list.size(), fe2.dofs_per_face); + + // finally copy the list into the mask + std::fill (master_dof_mask.begin(), master_dof_mask.end(), false); + for (std::vector::const_iterator i=master_dof_list.begin(); + i!=master_dof_list.end(); ++i) + master_dof_mask[*i] = true; + } + + + + /** + * Make sure that the mask exists that determines which dofs will be + * the masters on refined faces where an fe1 and a fe2 meet. + */ + template + void + ensure_existence_of_master_dof_mask (const FiniteElement &fe1, + const FiniteElement &fe2, + const FullMatrix &face_interpolation_matrix, + std_cxx1x::shared_ptr > &master_dof_mask) + { + if (master_dof_mask == std_cxx1x::shared_ptr >()) + { + master_dof_mask = std_cxx1x::shared_ptr > + (new std::vector (fe1.dofs_per_face)); + select_master_dofs_for_face_restriction (fe1, + fe2, + face_interpolation_matrix, + *master_dof_mask); + } + } + + + + /** + * Make sure that the given @p face_interpolation_matrix pointer + * points to a valid matrix. If the pointer is zero beforehand, + * create an entry with the correct data. If it is nonzero, don't + * touch it. + */ + template + void + ensure_existence_of_face_matrix (const FiniteElement &fe1, + const FiniteElement &fe2, + std_cxx1x::shared_ptr > &matrix) + { + if (matrix == std_cxx1x::shared_ptr >()) + { + matrix = std_cxx1x::shared_ptr > + (new FullMatrix (fe2.dofs_per_face, + fe1.dofs_per_face)); + fe1.get_face_interpolation_matrix (fe2, + *matrix); + } + } + + + + /** + * Same, but for subface interpolation matrices. + */ + template + void + ensure_existence_of_subface_matrix (const FiniteElement &fe1, + const FiniteElement &fe2, + const unsigned int subface, + std_cxx1x::shared_ptr > &matrix) + { + if (matrix == std_cxx1x::shared_ptr >()) + { + matrix = std_cxx1x::shared_ptr > + (new FullMatrix (fe2.dofs_per_face, + fe1.dofs_per_face)); + fe1.get_subface_interpolation_matrix (fe2, + subface, + *matrix); + } + } + + + + /** + * Given the face interpolation matrix between two elements, split it + * into its master and slave parts and invert the master part as + * explained in the @ref hp_paper "hp paper". + */ + void + ensure_existence_of_split_face_matrix (const FullMatrix &face_interpolation_matrix, + const std::vector &master_dof_mask, + std_cxx1x::shared_ptr,FullMatrix > > &split_matrix) + { + AssertDimension (master_dof_mask.size(), face_interpolation_matrix.m()); + Assert (std::count (master_dof_mask.begin(), master_dof_mask.end(), true) == + static_cast(face_interpolation_matrix.n()), + ExcInternalError()); + + if (split_matrix == + std_cxx1x::shared_ptr,FullMatrix > >()) + { + split_matrix + = std_cxx1x::shared_ptr,FullMatrix > > + (new std::pair,FullMatrix >()); + + const unsigned int n_master_dofs = face_interpolation_matrix.n(); + const unsigned int n_dofs = face_interpolation_matrix.m(); + + Assert (n_master_dofs <= n_dofs, ExcInternalError()); + + // copy and invert the master + // component, copy the slave + // component + split_matrix->first.reinit (n_master_dofs, n_master_dofs); + split_matrix->second.reinit (n_dofs-n_master_dofs, n_master_dofs); + + unsigned int nth_master_dof = 0, + nth_slave_dof = 0; + + for (unsigned int i=0; ifirst(nth_master_dof,j) + = face_interpolation_matrix(i,j); + ++nth_master_dof; + } + else + { + for (unsigned int j=0; jsecond(nth_slave_dof,j) + = face_interpolation_matrix(i,j); + ++nth_slave_dof; + } + + AssertDimension (nth_master_dof, n_master_dofs); + AssertDimension (nth_slave_dof, n_dofs-n_master_dofs); + + //TODO[WB]: We should make sure very small entries are removed after inversion + split_matrix->first.gauss_jordan (); + } + } + + + // a template that can determine statically whether a given + // DoFHandler class supports different finite element elements + template + struct DoFHandlerSupportsDifferentFEs + { + static const bool value = true; + }; + + + template + struct DoFHandlerSupportsDifferentFEs< dealii::DoFHandler > + { + static const bool value = false; + }; + + + /** + * A function that returns how many different finite elements a dof + * handler uses. This is one for non-hp DoFHandlers and + * dof_handler.get_fe().size() for the hp-versions. + */ + template + unsigned int + n_finite_elements (const dealii::hp::DoFHandler &dof_handler) + { + return dof_handler.get_fe().size(); + } + + + template + unsigned int + n_finite_elements (const DH &) + { + return 1; + } + + + /** + * For a given face belonging to an active cell that borders to a + * more refined cell, return the fe_index of the most dominating + * finite element used on any of the face's subfaces. + */ + template + unsigned int + get_most_dominating_subface_fe_index (const face_iterator &face) + { + const unsigned int dim + = face_iterator::AccessorType::dimension; + const unsigned int spacedim + = face_iterator::AccessorType::space_dimension; + + unsigned int dominating_subface_no = 0; + for (; dominating_subface_non_children(); + ++dominating_subface_no) + { + // each of the subfaces can have only a single fe_index + // associated with them, since there is no cell on the other + // side + Assert (face->child(dominating_subface_no) + ->n_active_fe_indices() + == 1, + ExcInternalError()); + + const FiniteElement & + this_subface_fe = (face->child(dominating_subface_no) + ->get_fe (face->child(dominating_subface_no) + ->nth_active_fe_index(0))); + + FiniteElementDomination::Domination + domination = FiniteElementDomination::either_element_can_dominate; + for (unsigned int sf=0; sfn_children(); ++sf) + if (sf != dominating_subface_no) + { + const FiniteElement & + that_subface_fe = (face->child(sf) + ->get_fe (face->child(sf) + ->nth_active_fe_index(0))); + + domination = domination & + this_subface_fe.compare_for_face_domination(that_subface_fe); + } + + // see if the element on this subface is able to dominate the + // ones on all other subfaces, and if so take it + if ((domination == FiniteElementDomination::this_element_dominates) + || + (domination == FiniteElementDomination::either_element_can_dominate)) + break; + } + + // check that we have found one such subface + Assert (dominating_subface_no < face->n_children(), + ExcNotImplemented()); + + // return the finite element index used on it. note that only a + // single fe can be active on such subfaces + return face->child (dominating_subface_no)->nth_active_fe_index(0); + } + + + + /** + * Copy constraints into a constraint matrix object. + * + * This function removes zero constraints and those, which constrain + * a DoF which was already eliminated in one of the previous steps of + * the hp hanging node procedure. + * + * It also suppresses very small entries in the constraint matrix to + * avoid making the sparsity pattern fuller than necessary. + */ + void + filter_constraints (const std::vector &master_dofs, + const std::vector &slave_dofs, + const FullMatrix &face_constraints, + ConstraintMatrix &constraints) + { + Assert (face_constraints.n () == master_dofs.size (), + ExcDimensionMismatch(master_dofs.size (), + face_constraints.n())); + Assert (face_constraints.m () == slave_dofs.size (), + ExcDimensionMismatch(slave_dofs.size (), + face_constraints.m())); + + const unsigned int n_master_dofs = master_dofs.size (); + const unsigned int n_slave_dofs = slave_dofs.size (); + + // check for a couple conditions that happened in parallel + // distributed mode + for (unsigned int row=0; row!=n_slave_dofs; ++row) + Assert (slave_dofs[row] != numbers::invalid_dof_index, + ExcInternalError()); + for (unsigned int col=0; col!=n_master_dofs; ++col) + Assert (master_dofs[col] != numbers::invalid_dof_index, + ExcInternalError()); + + + for (unsigned int row=0; row!=n_slave_dofs; ++row) + if (constraints.is_constrained (slave_dofs[row]) == false) + { + bool constraint_already_satisfied = false; + + // Check if we have an identity constraint, which is already + // satisfied by unification of the corresponding global dof + // indices + for (unsigned int i=0; i= 1e-14*abs_sum)) + constraints.add_entry (slave_dofs[row], + master_dofs[i], + face_constraints (row,i)); + constraints.set_inhomogeneity (slave_dofs[row], 0.); + } + } + } + + } + + + + void + make_hp_hanging_node_constraints (const dealii::DoFHandler<1> &, + ConstraintMatrix &) + { + // nothing to do for regular dof handlers in 1d + } + + + + void + make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1> &, + ConstraintMatrix &, + dealii::internal::int2type<1>) + { + // nothing to do for regular dof handlers in 1d + } + + + void + make_hp_hanging_node_constraints (const dealii::MGDoFHandler<1> &, + ConstraintMatrix &) + { + // nothing to do for regular dof handlers in 1d + } + + + + void + make_oldstyle_hanging_node_constraints (const dealii::MGDoFHandler<1> &, + ConstraintMatrix &, + dealii::internal::int2type<1>) + { + // nothing to do for regular dof handlers in 1d + } + + + void + make_hp_hanging_node_constraints (const dealii::hp::DoFHandler<1> &/*dof_handler*/, + ConstraintMatrix &/*constraints*/) + { + // we may have to compute constraints for vertices. gotta think about + // that a bit more + + //TODO[WB]: think about what to do here... + } + + + + void + make_oldstyle_hanging_node_constraints (const dealii::hp::DoFHandler<1> &/*dof_handler*/, + ConstraintMatrix &/*constraints*/, + dealii::internal::int2type<1>) + { + // we may have to compute constraints for vertices. gotta think about + // that a bit more + + //TODO[WB]: think about what to do here... + } + + + void + make_hp_hanging_node_constraints (const dealii::DoFHandler<1,2> &, + ConstraintMatrix &) + { + // nothing to do for regular dof handlers in 1d + } + + + + void + make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1,2> &, + ConstraintMatrix &, + dealii::internal::int2type<1>) + { + // nothing to do for regular dof handlers in 1d + } + + + void + make_hp_hanging_node_constraints (const dealii::DoFHandler<1,3> &, + ConstraintMatrix &) + { + // nothing to do for regular dof handlers in 1d + } + + void + make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1,3> &, + ConstraintMatrix &, + dealii::internal::int2type<1>) + { + // nothing to do for regular dof handlers in 1d + } + + +// currently not used but may be in the future: + +// void +// make_hp_hanging_node_constraints (const dealii::MDoFHandler<1,2> &, +// ConstraintMatrix &) +// { +// // nothing to do for regular +// // dof handlers in 1d +// } + + + +// void +// make_oldstyle_hanging_node_constraints (const dealii::DoFHandler<1,2> &, +// ConstraintMatrix &, +// dealii::internal::int2type<1>) +// { +// // nothing to do for regular +// // dof handlers in 1d +// } + + +// void +// make_oldstyle_hanging_node_constraints (const dealii::hp::DoFHandler<1,2> &/*dof_handler*/, +// ConstraintMatrix &/*constraints*/, +// dealii::internal::int2type<1>) +// { +// // we may have to compute +// // constraints for +// // vertices. gotta think about +// // that a bit more +// +// //TODO[WB]: think about what to do here... +// } +//#endif + + + + template + void + make_oldstyle_hanging_node_constraints (const DH &dof_handler, + ConstraintMatrix &constraints, + dealii::internal::int2type<2>) + { + const unsigned int dim = 2; + + const unsigned int spacedim = DH::space_dimension; + + std::vector dofs_on_mother; + std::vector dofs_on_children; + + // loop over all lines; only on lines there can be constraints. We do + // so by looping over all active cells and checking whether any of + // the faces are refined which can only be from the neighboring cell + // because this one is active. In that case, the face is subject to + // constraints + // + // note that even though we may visit a face twice if the neighboring + // cells are equally refined, we can only visit each face with + // hanging nodes once + typename DH::active_cell_iterator cell = dof_handler.begin_active(), + endc = dof_handler.end(); + for (; cell!=endc; ++cell) + // artificial cells can at best neighbor ghost cells, but we're not + // interested in these interfaces + if (!cell->is_artificial ()) + for (unsigned int face=0; face::faces_per_cell; ++face) + if (cell->face(face)->has_children()) + { + // in any case, faces can have at most two active fe + // indices, but here the face can have only one (namely the + // same as that from the cell we're sitting on), and each + // of the children can have only one as well. check this + Assert (cell->face(face)->n_active_fe_indices() == 1, + ExcInternalError()); + Assert (cell->face(face)->fe_index_is_active(cell->active_fe_index()) + == true, + ExcInternalError()); + for (unsigned int c=0; cface(face)->n_children(); ++c) + if (!cell->neighbor_child_on_subface(face,c)->is_artificial()) + Assert (cell->face(face)->child(c)->n_active_fe_indices() == 1, + ExcInternalError()); + + // right now, all that is implemented is the case that both + // sides use the same fe + for (unsigned int c=0; cface(face)->n_children(); ++c) + if (!cell->neighbor_child_on_subface(face,c)->is_artificial()) + Assert (cell->face(face)->child(c) + ->fe_index_is_active(cell->active_fe_index()) == true, + ExcNotImplemented()); + + // ok, start up the work + const FiniteElement &fe = cell->get_fe(); + const unsigned int fe_index = cell->active_fe_index(); + + const unsigned int + n_dofs_on_mother = 2*fe.dofs_per_vertex + fe.dofs_per_line, + n_dofs_on_children = fe.dofs_per_vertex + 2*fe.dofs_per_line; + + dofs_on_mother.resize (n_dofs_on_mother); + dofs_on_children.resize (n_dofs_on_children); + + Assert(n_dofs_on_mother == fe.constraints().n(), + ExcDimensionMismatch(n_dofs_on_mother, + fe.constraints().n())); + Assert(n_dofs_on_children == fe.constraints().m(), + ExcDimensionMismatch(n_dofs_on_children, + fe.constraints().m())); + + const typename DH::line_iterator this_face = cell->face(face); + + // fill the dofs indices. Use same enumeration scheme as in + // @p{FiniteElement::constraints()} + unsigned int next_index = 0; + for (unsigned int vertex=0; vertex<2; ++vertex) + for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) + dofs_on_mother[next_index++] = this_face->vertex_dof_index(vertex,dof, + fe_index); + for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) + dofs_on_mother[next_index++] = this_face->dof_index(dof, fe_index); + AssertDimension (next_index, dofs_on_mother.size()); + + next_index = 0; + for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) + dofs_on_children[next_index++] + = this_face->child(0)->vertex_dof_index(1,dof,fe_index); + for (unsigned int child=0; child<2; ++child) + for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) + dofs_on_children[next_index++] + = this_face->child(child)->dof_index(dof, fe_index); + AssertDimension (next_index, dofs_on_children.size()); + + // for each row in the constraint matrix for this line: + for (unsigned int row=0; row!=dofs_on_children.size(); ++row) + { + constraints.add_line (dofs_on_children[row]); + for (unsigned int i=0; i!=dofs_on_mother.size(); ++i) + constraints.add_entry (dofs_on_children[row], + dofs_on_mother[i], + fe.constraints()(row,i)); + + constraints.set_inhomogeneity (dofs_on_children[row], 0.); + } + } + else + { + // this face has no children, but it could still be that it + // is shared by two cells that use a different fe index. + // check a couple of things, but ignore the case that the + // neighbor is an artificial cell + if (!cell->at_boundary(face) && + !cell->neighbor(face)->is_artificial()) + { + Assert (cell->face(face)->n_active_fe_indices() == 1, + ExcNotImplemented()); + Assert (cell->face(face) + ->fe_index_is_active(cell->active_fe_index()) == true, + ExcInternalError()); + } + } + } + + + + template + void + make_oldstyle_hanging_node_constraints (const DH &dof_handler, + ConstraintMatrix &constraints, + dealii::internal::int2type<3>) + { + const unsigned int dim = 3; + + std::vector dofs_on_mother; + std::vector dofs_on_children; + + // loop over all quads; only on quads there can be constraints. We do + // so by looping over all active cells and checking whether any of + // the faces are refined which can only be from the neighboring cell + // because this one is active. In that case, the face is subject to + // constraints + // + // note that even though we may visit a face twice if the neighboring + // cells are equally refined, we can only visit each face with + // hanging nodes once + typename DH::active_cell_iterator cell = dof_handler.begin_active(), + endc = dof_handler.end(); + for (; cell!=endc; ++cell) + // artificial cells can at best neighbor ghost cells, but we're not + // interested in these interfaces + if (!cell->is_artificial ()) + for (unsigned int face=0; face::faces_per_cell; ++face) + if (cell->face(face)->has_children()) + { + // first of all, make sure that we treat a case which is + // possible, i.e. either no dofs on the face at all or no + // anisotropic refinement + if (cell->get_fe().dofs_per_face == 0) + continue; + + Assert(cell->face(face)->refinement_case()==RefinementCase::isotropic_refinement, + ExcNotImplemented()); + + // in any case, faces can have at most two active fe + // indices, but here the face can have only one (namely the + // same as that from the cell we're sitting on), and each + // of the children can have only one as well. check this + AssertDimension (cell->face(face)->n_active_fe_indices(), 1); + Assert (cell->face(face)->fe_index_is_active(cell->active_fe_index()) + == true, + ExcInternalError()); + for (unsigned int c=0; cface(face)->n_children(); ++c) + AssertDimension (cell->face(face)->child(c)->n_active_fe_indices(), 1); + + // right now, all that is implemented is the case that both + // sides use the same fe, and not only that but also that + // all lines bounding this face and the children have the + // same fe + for (unsigned int c=0; cface(face)->n_children(); ++c) + if (!cell->neighbor_child_on_subface(face,c)->is_artificial()) + { + Assert (cell->face(face)->child(c) + ->fe_index_is_active(cell->active_fe_index()) == true, + ExcNotImplemented()); + for (unsigned int e=0; e<4; ++e) + { + Assert (cell->face(face)->child(c)->line(e) + ->n_active_fe_indices() == 1, + ExcNotImplemented()); + Assert (cell->face(face)->child(c)->line(e) + ->fe_index_is_active(cell->active_fe_index()) == true, + ExcNotImplemented()); + } + } + for (unsigned int e=0; e<4; ++e) + { + Assert (cell->face(face)->line(e) + ->n_active_fe_indices() == 1, + ExcNotImplemented()); + Assert (cell->face(face)->line(e) + ->fe_index_is_active(cell->active_fe_index()) == true, + ExcNotImplemented()); + } + + // ok, start up the work + const FiniteElement &fe = cell->get_fe(); + const unsigned int fe_index = cell->active_fe_index(); + + const unsigned int n_dofs_on_mother = fe.dofs_per_face; + const unsigned int n_dofs_on_children = (5*fe.dofs_per_vertex+ + 12*fe.dofs_per_line+ + 4*fe.dofs_per_quad); + + //TODO[TL]: think about this and the following in case of anisotropic refinement + + dofs_on_mother.resize (n_dofs_on_mother); + dofs_on_children.resize (n_dofs_on_children); + + Assert(n_dofs_on_mother == fe.constraints().n(), + ExcDimensionMismatch(n_dofs_on_mother, + fe.constraints().n())); + Assert(n_dofs_on_children == fe.constraints().m(), + ExcDimensionMismatch(n_dofs_on_children, + fe.constraints().m())); + + const typename DH::face_iterator this_face = cell->face(face); + + // fill the dofs indices. Use same enumeration scheme as in + // @p{FiniteElement::constraints()} + unsigned int next_index = 0; + for (unsigned int vertex=0; vertex<4; ++vertex) + for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) + dofs_on_mother[next_index++] = this_face->vertex_dof_index(vertex,dof, + fe_index); + for (unsigned int line=0; line<4; ++line) + for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) + dofs_on_mother[next_index++] + = this_face->line(line)->dof_index(dof, fe_index); + for (unsigned int dof=0; dof!=fe.dofs_per_quad; ++dof) + dofs_on_mother[next_index++] = this_face->dof_index(dof, fe_index); + AssertDimension (next_index, dofs_on_mother.size()); + + next_index = 0; + + // assert some consistency assumptions + + //TODO[TL]: think about this in case of anisotropic + //refinement + + Assert (dof_handler.get_tria().get_anisotropic_refinement_flag() || + ((this_face->child(0)->vertex_index(3) == + this_face->child(1)->vertex_index(2)) && + (this_face->child(0)->vertex_index(3) == + this_face->child(2)->vertex_index(1)) && + (this_face->child(0)->vertex_index(3) == + this_face->child(3)->vertex_index(0))), + ExcInternalError()); + for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) + dofs_on_children[next_index++] + = this_face->child(0)->vertex_dof_index(3,dof); + + // dof numbers on the centers of the lines bounding this + // face + for (unsigned int line=0; line<4; ++line) + for (unsigned int dof=0; dof!=fe.dofs_per_vertex; ++dof) + dofs_on_children[next_index++] + = this_face->line(line)->child(0)->vertex_dof_index(1,dof, fe_index); + + // next the dofs on the lines interior to the face; the + // order of these lines is laid down in the FiniteElement + // class documentation + for (unsigned int dof=0; dofchild(0)->line(1)->dof_index(dof, fe_index); + for (unsigned int dof=0; dofchild(2)->line(1)->dof_index(dof, fe_index); + for (unsigned int dof=0; dofchild(0)->line(3)->dof_index(dof, fe_index); + for (unsigned int dof=0; dofchild(1)->line(3)->dof_index(dof, fe_index); + + // dofs on the bordering lines + for (unsigned int line=0; line<4; ++line) + for (unsigned int child=0; child<2; ++child) + for (unsigned int dof=0; dof!=fe.dofs_per_line; ++dof) + dofs_on_children[next_index++] + = this_face->line(line)->child(child)->dof_index(dof, fe_index); + + // finally, for the dofs interior to the four child faces + for (unsigned int child=0; child<4; ++child) + for (unsigned int dof=0; dof!=fe.dofs_per_quad; ++dof) + dofs_on_children[next_index++] + = this_face->child(child)->dof_index(dof, fe_index); + AssertDimension (next_index, dofs_on_children.size()); + + // for each row in the constraint matrix for this line: + for (unsigned int row=0; row!=dofs_on_children.size(); ++row) + { + constraints.add_line (dofs_on_children[row]); + for (unsigned int i=0; i!=dofs_on_mother.size(); ++i) + constraints.add_entry (dofs_on_children[row], + dofs_on_mother[i], + fe.constraints()(row,i)); + + constraints.set_inhomogeneity(dofs_on_children[row], 0.); + } + } + else + { + // this face has no children, but it could still be that it + // is shared by two cells that use a different fe index. + // check a couple of things, but ignore the case that the + // neighbor is an artificial cell + if (!cell->at_boundary(face) && + !cell->neighbor(face)->is_artificial()) + { + Assert (cell->face(face)->n_active_fe_indices() == 1, + ExcNotImplemented()); + Assert (cell->face(face) + ->fe_index_is_active(cell->active_fe_index()) == true, + ExcInternalError()); + } + } + } + + + template + void + make_hp_hanging_node_constraints (const DH &dof_handler, + ConstraintMatrix &constraints) + { + // note: this function is going to be hard to understand if you + // haven't read the hp paper. however, we try to follow the notation + // laid out there, so go read the paper before you try to understand + // what is going on here + + const unsigned int dim = DH::dimension; + + const unsigned int spacedim = DH::space_dimension; + + + // a matrix to be used for constraints below. declared here and + // simply resized down below to avoid permanent re-allocation of + // memory + FullMatrix constraint_matrix; + + // similarly have arrays that will hold master and slave dof numbers, + // as well as a scratch array needed for the complicated case below + std::vector master_dofs; + std::vector slave_dofs; + std::vector scratch_dofs; + + // caches for the face and subface interpolation matrices between + // different (or the same) finite elements. we compute them only + // once, namely the first time they are needed, and then just reuse + // them + Table<2,std_cxx1x::shared_ptr > > + face_interpolation_matrices (n_finite_elements (dof_handler), + n_finite_elements (dof_handler)); + Table<3,std_cxx1x::shared_ptr > > + subface_interpolation_matrices (n_finite_elements (dof_handler), + n_finite_elements (dof_handler), + GeometryInfo::max_children_per_face); + + // similarly have a cache for the matrices that are split into their + // master and slave parts, and for which the master part is inverted. + // these two matrices are derived from the face interpolation matrix + // as described in the @ref hp_paper "hp paper" + Table<2,std_cxx1x::shared_ptr,FullMatrix > > > + split_face_interpolation_matrices (n_finite_elements (dof_handler), + n_finite_elements (dof_handler)); + + // finally, for each pair of finite elements, have a mask that states + // which of the degrees of freedom on the coarse side of a refined + // face will act as master dofs. + Table<2,std_cxx1x::shared_ptr > > + master_dof_masks (n_finite_elements (dof_handler), + n_finite_elements (dof_handler)); + + // loop over all faces + // + // note that even though we may visit a face twice if the neighboring + // cells are equally refined, we can only visit each face with + // hanging nodes once + typename DH::active_cell_iterator cell = dof_handler.begin_active(), + endc = dof_handler.end(); + for (; cell!=endc; ++cell) + // artificial cells can at best neighbor ghost cells, but we're not + // interested in these interfaces + if (!cell->is_artificial ()) + for (unsigned int face=0; face::faces_per_cell; ++face) + if (cell->face(face)->has_children()) + { + // first of all, make sure that we treat a case which is + // possible, i.e. either no dofs on the face at all or no + // anisotropic refinement + if (cell->get_fe().dofs_per_face == 0) + continue; + + Assert(cell->face(face)->refinement_case()==RefinementCase::isotropic_refinement, + ExcNotImplemented()); + + // so now we've found a face of an active cell that has + // children. that means that there are hanging nodes here. + + // in any case, faces can have at most two sets of active + // fe indices, but here the face can have only one (namely + // the same as that from the cell we're sitting on), and + // each of the children can have only one as well. check + // this + Assert (cell->face(face)->n_active_fe_indices() == 1, + ExcInternalError()); + Assert (cell->face(face)->fe_index_is_active(cell->active_fe_index()) + == true, + ExcInternalError()); + for (unsigned int c=0; cface(face)->n_children(); ++c) + Assert (cell->face(face)->child(c)->n_active_fe_indices() == 1, + ExcInternalError()); + + // first find out whether we can constrain each of the + // subfaces to the mother face. in the lingo of the hp + // paper, this would be the simple case. note that we can + // short-circuit this decision if the dof_handler doesn't + // support hp at all + // + // ignore all interfaces with artificial cells + FiniteElementDomination::Domination + mother_face_dominates = FiniteElementDomination::either_element_can_dominate; + + if (DoFHandlerSupportsDifferentFEs::value == true) + for (unsigned int c=0; cface(face)->number_of_children(); ++c) + if (!cell->neighbor_child_on_subface (face, c)->is_artificial()) + mother_face_dominates = mother_face_dominates & + (cell->get_fe().compare_for_face_domination + (cell->neighbor_child_on_subface (face, c)->get_fe())); + + switch (mother_face_dominates) + { + case FiniteElementDomination::this_element_dominates: + case FiniteElementDomination::either_element_can_dominate: + { + // Case 1 (the simple case and the only case that can + // happen for non-hp DoFHandlers): The coarse element + // dominates the elements on the subfaces (or they are + // all the same) + // + // so we are going to constrain the DoFs on the face + // children against the DoFs on the face itself + master_dofs.resize (cell->get_fe().dofs_per_face); + + cell->face(face)->get_dof_indices (master_dofs, + cell->active_fe_index ()); + + // Now create constraint matrix for the subfaces and + // assemble it. ignore all interfaces with artificial + // cells because we can only get to such interfaces if + // the current cell is a ghost cell + for (unsigned int c=0; cface(face)->n_children(); ++c) + { + if (cell->neighbor_child_on_subface (face, c)->is_artificial()) + continue; + + const typename DH::active_face_iterator + subface = cell->face(face)->child(c); + + Assert (subface->n_active_fe_indices() == 1, + ExcInternalError()); + + const unsigned int + subface_fe_index = subface->nth_active_fe_index(0); + + // we sometime run into the situation where for + // example on one big cell we have a FE_Q(1) and on + // the subfaces we have a mixture of FE_Q(1) and + // FE_Nothing. In that case, the face domination is + // either_element_can_dominate for the whole + // collection of subfaces, but on the particular + // subface between FE_Q(1) and FE_Nothing, there + // are no constraints that we need to take care of. + // in that case, just continue + if (cell->get_fe().compare_for_face_domination + (subface->get_fe(subface_fe_index)) + == + FiniteElementDomination::no_requirements) + continue; + + // Same procedure as for the mother cell. Extract + // the face DoFs from the cell DoFs. + slave_dofs.resize (subface->get_fe(subface_fe_index) + .dofs_per_face); + subface->get_dof_indices (slave_dofs, subface_fe_index); + + for (unsigned int i=0; iget_fe(), + subface->get_fe(subface_fe_index), + c, + subface_interpolation_matrices + [cell->active_fe_index()][subface_fe_index][c]); + + // Add constraints to global constraint matrix. + filter_constraints (master_dofs, + slave_dofs, + *(subface_interpolation_matrices + [cell->active_fe_index()][subface_fe_index][c]), + constraints); + } + + break; + } + + case FiniteElementDomination::other_element_dominates: + case FiniteElementDomination::neither_element_dominates: + { + // Case 2 (the "complex" case): at least one (the + // neither_... case) of the finer elements or all of + // them (the other_... case) is dominating. See the hp + // paper for a way how to deal with this situation + // + // since this is something that can only happen for hp + // dof handlers, add a check here... + Assert (DoFHandlerSupportsDifferentFEs::value == true, + ExcInternalError()); + + // we first have to find the finite element that is + // able to generate a space that all the other ones can + // be constrained to + const unsigned int dominating_fe_index + = get_most_dominating_subface_fe_index (cell->face(face)); + + const FiniteElement &dominating_fe + = dof_handler.get_fe()[dominating_fe_index]; + + // check also that it is able to constrain the mother + // face. it should be, or we wouldn't have gotten into + // the branch for the 'complex' case + Assert ((dominating_fe.compare_for_face_domination + (cell->face(face)->get_fe(cell->face(face)->nth_active_fe_index(0))) + == FiniteElementDomination::this_element_dominates) + || + (dominating_fe.compare_for_face_domination + (cell->face(face)->get_fe(cell->face(face)->nth_active_fe_index(0))) + == FiniteElementDomination::either_element_can_dominate), + ExcInternalError()); + + + // first get the interpolation matrix from the mother + // to the virtual dofs + Assert (dominating_fe.dofs_per_face <= + cell->get_fe().dofs_per_face, + ExcInternalError()); + + ensure_existence_of_face_matrix + (dominating_fe, + cell->get_fe(), + face_interpolation_matrices + [dominating_fe_index][cell->active_fe_index()]); + + // split this matrix into master and slave components. + // invert the master component + ensure_existence_of_master_dof_mask + (cell->get_fe(), + dominating_fe, + (*face_interpolation_matrices + [dominating_fe_index] + [cell->active_fe_index()]), + master_dof_masks + [dominating_fe_index] + [cell->active_fe_index()]); + + ensure_existence_of_split_face_matrix + (*face_interpolation_matrices + [dominating_fe_index][cell->active_fe_index()], + (*master_dof_masks + [dominating_fe_index][cell->active_fe_index()]), + split_face_interpolation_matrices + [dominating_fe_index][cell->active_fe_index()]); + + const FullMatrix &restrict_mother_to_virtual_master_inv + = (split_face_interpolation_matrices + [dominating_fe_index][cell->active_fe_index()]->first); + + const FullMatrix &restrict_mother_to_virtual_slave + = (split_face_interpolation_matrices + [dominating_fe_index][cell->active_fe_index()]->second); + + // now compute the constraint matrix as the product + // between the inverse matrix and the slave part + constraint_matrix.reinit (cell->get_fe().dofs_per_face - + dominating_fe.dofs_per_face, + dominating_fe.dofs_per_face); + restrict_mother_to_virtual_slave + .mmult (constraint_matrix, + restrict_mother_to_virtual_master_inv); + + // then figure out the global numbers of master and + // slave dofs and apply constraints + scratch_dofs.resize (cell->get_fe().dofs_per_face); + cell->face(face)->get_dof_indices (scratch_dofs, + cell->active_fe_index ()); + + // split dofs into master and slave components + master_dofs.clear (); + slave_dofs.clear (); + for (unsigned int i=0; iget_fe().dofs_per_face; ++i) + if ((*master_dof_masks + [dominating_fe_index][cell->active_fe_index()])[i] == true) + master_dofs.push_back (scratch_dofs[i]); + else + slave_dofs.push_back (scratch_dofs[i]); + + AssertDimension (master_dofs.size(), dominating_fe.dofs_per_face); + AssertDimension (slave_dofs.size(), + cell->get_fe().dofs_per_face - dominating_fe.dofs_per_face); + + filter_constraints (master_dofs, + slave_dofs, + constraint_matrix, + constraints); + + + + // next we have to deal with the subfaces. do as + // discussed in the hp paper + for (unsigned int sf=0; + sfface(face)->n_children(); ++sf) + { + // ignore interfaces with artificial cells as well + // as interfaces between ghost cells in 2d + if (cell->neighbor_child_on_subface (face, sf)->is_artificial() + || + (dim==2 && cell->is_ghost() + && + cell->neighbor_child_on_subface (face, sf)->is_ghost())) + continue; + + Assert (cell->face(face)->child(sf) + ->n_active_fe_indices() == 1, + ExcInternalError()); + + const unsigned int subface_fe_index + = cell->face(face)->child(sf)->nth_active_fe_index(0); + const FiniteElement &subface_fe + = dof_handler.get_fe()[subface_fe_index]; + + // first get the interpolation matrix from the + // subface to the virtual dofs + Assert (dominating_fe.dofs_per_face <= + subface_fe.dofs_per_face, + ExcInternalError()); + ensure_existence_of_subface_matrix + (dominating_fe, + subface_fe, + sf, + subface_interpolation_matrices + [dominating_fe_index][subface_fe_index][sf]); + + const FullMatrix &restrict_subface_to_virtual + = *(subface_interpolation_matrices + [dominating_fe_index][subface_fe_index][sf]); + + constraint_matrix.reinit (subface_fe.dofs_per_face, + dominating_fe.dofs_per_face); + + restrict_subface_to_virtual + .mmult (constraint_matrix, + restrict_mother_to_virtual_master_inv); + + slave_dofs.resize (subface_fe.dofs_per_face); + cell->face(face)->child(sf)->get_dof_indices (slave_dofs, + subface_fe_index); + + filter_constraints (master_dofs, + slave_dofs, + constraint_matrix, + constraints); + } + + break; + } + + case FiniteElementDomination::no_requirements: + // there are no continuity requirements between the two + // elements. record no constraints + break; + + default: + // we shouldn't get here + Assert (false, ExcInternalError()); + } + } + else + { + // this face has no children, but it could still be that it + // is shared by two cells that use a different fe index + Assert (cell->face(face) + ->fe_index_is_active(cell->active_fe_index()) == true, + ExcInternalError()); + + // see if there is a neighbor that is an artificial cell. + // in that case, we're not interested in this interface. we + // test this case first since artificial cells may not have + // an active_fe_index set, etc + if (!cell->at_boundary(face) + && + cell->neighbor(face)->is_artificial()) + continue; + + // Only if there is a neighbor with a different + // active_fe_index and the same h-level, some action has to + // be taken. + if ((DoFHandlerSupportsDifferentFEs::value == true) + && + !cell->face(face)->at_boundary () + && + (cell->neighbor(face)->active_fe_index () != + cell->active_fe_index ()) + && + (!cell->face(face)->has_children() && + !cell->neighbor_is_coarser(face) )) + { + const typename DH::level_cell_iterator neighbor = cell->neighbor (face); + + // see which side of the face we have to constrain + switch (cell->get_fe().compare_for_face_domination (neighbor->get_fe ())) + { + case FiniteElementDomination::this_element_dominates: + { + // Get DoFs on dominating and dominated side of the + // face + master_dofs.resize (cell->get_fe().dofs_per_face); + cell->face(face)->get_dof_indices (master_dofs, + cell->active_fe_index ()); + + slave_dofs.resize (neighbor->get_fe().dofs_per_face); + cell->face(face)->get_dof_indices (slave_dofs, + neighbor->active_fe_index ()); + + // break if the n_master_dofs == 0, because we are + // attempting to constrain to an element that has + // no face dofs + if (master_dofs.size() == 0) break; + + // make sure the element constraints for this face + // are available + ensure_existence_of_face_matrix + (cell->get_fe(), + neighbor->get_fe(), + face_interpolation_matrices + [cell->active_fe_index()][neighbor->active_fe_index()]); + + // Add constraints to global constraint matrix. + filter_constraints (master_dofs, + slave_dofs, + *(face_interpolation_matrices + [cell->active_fe_index()] + [neighbor->active_fe_index()]), + constraints); + + break; + } + + case FiniteElementDomination::other_element_dominates: + { + // we don't do anything here since we will come + // back to this face from the other cell, at which + // time we will fall into the first case clause + // above + break; + } + + case FiniteElementDomination::either_element_can_dominate: + { + // it appears as if neither element has any + // constraints on its neighbor. this may be because + // neither element has any DoFs on faces at all. or + // that the two elements are actually the same, + // although they happen to run under different + // fe_indices (this is what happens in + // hp/hp_hanging_nodes_01 for example). + // + // another possibility is what happens in crash_13. + // there, we have FESystem(FE_Q(1),FE_DGQ(0)) vs. + // FESystem(FE_Q(1),FE_DGQ(1)). neither of them + // dominates the other. + // + // a final possibility is that we have something like + // FESystem(FE_Q(1),FE_Q(1)) vs + // FESystem(FE_Q(1),FE_Nothing()), see + // hp/fe_nothing_18/19. + // + // in any case, the point is that it doesn't + // matter. there is nothing to do here. + break; + } + + case FiniteElementDomination::neither_element_dominates: + { + // we don't presently know what exactly to do here. + // it isn't quite clear what exactly we would have + // to do here. sit tight until someone trips over + // the following statement and see what exactly is + // going on + Assert (false, ExcNotImplemented()); + break; + } + + case FiniteElementDomination::no_requirements: + { + // nothing to do here + break; + } + + default: + // we shouldn't get here + Assert (false, ExcInternalError()); + } + } + } + } + } + + + + + template + void + make_hanging_node_constraints (const DH &dof_handler, + ConstraintMatrix &constraints) + { + // Decide whether to use the new or old make_hanging_node_constraints + // function. If all the FiniteElement or all elements in a FECollection + // support the new face constraint matrix, the new code will be used. + // Otherwise, the old implementation is used for the moment. + if (dof_handler.get_fe().hp_constraints_are_implemented ()) + internal:: + make_hp_hanging_node_constraints (dof_handler, + constraints); + else + internal:: + make_oldstyle_hanging_node_constraints (dof_handler, + constraints, + dealii::internal::int2type()); + } + + + + namespace + { + // enter constraints for periodicity into the given ConstraintMatrix object. + // this function is called when at least one of the two face iterators corresponds + // to an active object without further children + // + // @param transformation A matrix that maps degrees of freedom from one face + // to another. If the DoFs on the two faces are supposed to match exactly, then + // the matrix so provided will be the identity matrix. if face 2 is once refined + // from face 1, then the matrix needs to be the interpolation matrix from a face + // to this particular child + // + // @precondition: face_1 is supposed to be active + // + // @note As bug #82 ((http://code.google.com/p/dealii/issues/detail?id=82) and the + // corresponding testcase bits/periodicity_05 demonstrate, we can occasionally + // get into trouble if we already have the constraint x1=x2 and want to insert + // x2=x1. we avoid this by skipping an identity constraint if the opposite + // constraint already exists + template + void + set_periodicity_constraints (const FaceIterator &face_1, + const typename identity::type &face_2, + const FullMatrix &transformation, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask, + const bool face_orientation, + const bool face_flip, + const bool face_rotation) + { + static const int dim = FaceIterator::AccessorType::dimension; + static const int spacedim = FaceIterator::AccessorType::space_dimension; + + // we should be in the case where face_1 is active, i.e. has no children: + Assert (!face_1->has_children(), + ExcInternalError()); + + Assert (face_1->n_active_fe_indices() == 1, + ExcInternalError()); + + // if face_2 does have children, then we need to iterate over them + if (face_2->has_children()) + { + Assert (face_2->n_children() == GeometryInfo::max_children_per_face, + ExcNotImplemented()); + const unsigned int dofs_per_face + = face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face; + FullMatrix child_transformation (dofs_per_face, dofs_per_face); + FullMatrix subface_interpolation (dofs_per_face, dofs_per_face); + for (unsigned int c=0; cn_children(); ++c) + { + // get the interpolation matrix recursively from the one that + // interpolated from face_1 to face_2 by multiplying from the + // left with the one that interpolates from face_2 to + // its child + face_1->get_fe(face_1->nth_active_fe_index(0)) + .get_subface_interpolation_matrix (face_1->get_fe(face_1->nth_active_fe_index(0)), + c, + subface_interpolation); + subface_interpolation.mmult (child_transformation, transformation); + set_periodicity_constraints(face_1, face_2->child(c), + child_transformation, + constraint_matrix, component_mask, + face_orientation, face_flip, face_rotation); + } + } + else + // both faces are active. we need to match the corresponding DoFs of both faces + { + const unsigned int face_1_index = face_1->nth_active_fe_index(0); + const unsigned int face_2_index = face_2->nth_active_fe_index(0); + Assert(face_1->get_fe(face_1_index) == face_2->get_fe(face_1_index), + ExcMessage ("Matching periodic cells need to use the same finite element")); + + const FiniteElement &fe = face_1->get_fe(face_1_index); + + Assert(component_mask.represents_n_components(fe.n_components()), + ExcMessage ("The number of components in the mask has to be either " + "zero or equal to the number of components in the finite " "element.")); + + const unsigned int dofs_per_face = fe.dofs_per_face; + + std::vector dofs_1(dofs_per_face); + std::vector dofs_2(dofs_per_face); + + face_1->get_dof_indices(dofs_1, face_1_index); + face_2->get_dof_indices(dofs_2, face_2_index); + + for (unsigned int i=0; i < dofs_per_face; i++) { + if (dofs_1[i] == numbers::invalid_dof_index || + dofs_2[i] == numbers::invalid_dof_index) { + /* If either of these faces have no indices, stop. This is so + * that there is no attempt to match artificial cells of + * parallel distributed triangulations. + * + * While it seems like we ought to be able to avoid even calling + * set_periodicity_constraints for artificial faces, this + * situation can arise when a face that is being made periodic + * is only partially touched by the local subdomain. + * make_periodicity_constraints will be called recursively even + * for the section of the face that is not touched by the local + * subdomain. + * + * Until there is a better way to determine if the cells that + * neighbor a face are artificial, we simply test to see if the + * face does not have a valid dof initialization. + */ + return; + } + } + + // Well, this is a hack: + // + // There is no + // face_to_face_index(face_index, + // face_orientation, + // face_flip, + // face_rotation) + // function in FiniteElementData, so we have to use + // face_to_cell_index(face_index, face + // face_orientation, + // face_flip, + // face_rotation) + // But this will give us an index on a cell - something we cannot work + // with directly. But luckily we can match them back :-] + + std::map cell_to_rotated_face_index; + + // Build up a cell to face index for face_2: + for (unsigned int i = 0; i < dofs_per_face; ++i) + { + const unsigned int cell_index = fe.face_to_cell_index(i, 0, /* It doesn't really matter, just assume + * we're on the first face... + */ + true, false, false // default orientation + ); + cell_to_rotated_face_index[cell_index] = i; + } + + // loop over all dofs on face 2 and constrain them again the ones on face 1 + for (unsigned int i=0; i + void + make_periodicity_constraints (const FaceIterator &face_1, + const typename identity::type &face_2, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask, + const bool face_orientation, + const bool face_flip, + const bool face_rotation) + { + static const int dim = FaceIterator::AccessorType::dimension; + + Assert( (dim != 1) || + (face_orientation == true && + face_flip == false && + face_rotation == false), + ExcMessage ("The supplied orientation " + "(face_orientation, face_flip, face_rotation) " + "is invalid for 1D")); + + Assert( (dim != 2) || + (face_orientation == true && + face_rotation == false), + ExcMessage ("The supplied orientation " + "(face_orientation, face_flip, face_rotation) " + "is invalid for 2D")); + + Assert(face_1 != face_2, + ExcMessage ("face_1 and face_2 are equal! Cannot constrain DoFs " + "on the very same face")); + + Assert(face_1->at_boundary() && face_2->at_boundary(), + ExcMessage ("Faces for periodicity constraints must be on the boundary")); + + + // A lookup table on how to go through the child faces depending on the + // orientation: + + static const int lookup_table_2d[2][2] = + { + // flip: + {0, 1}, // false + {1, 0}, // true + }; + + static const int lookup_table_3d[2][2][2][4] = + { + // orientation flip rotation + { { {0, 2, 1, 3}, // false false false + {2, 3, 0, 1}, // false false true + }, + { {3, 1, 2, 0}, // false true false + {1, 0, 3, 2}, // false true true + }, + }, + { { {0, 1, 2, 3}, // true false false + {1, 3, 0, 2}, // true false true + }, + { {3, 2, 1, 0}, // true true false + {2, 0, 3, 1}, // true true true + }, + }, + }; + + // In the case that both faces have children, we loop over all + // children and apply make_periodicty_constrains recursively: + if (face_1->has_children() && face_2->has_children()) + { + Assert(face_1->n_children() == GeometryInfo::max_children_per_face && + face_2->n_children() == GeometryInfo::max_children_per_face, + ExcNotImplemented()); + + for (unsigned int i = 0; i < GeometryInfo::max_children_per_face; ++i) + { + // Lookup the index for the second face + unsigned int j; + switch (dim) + { + case 2: + j = lookup_table_2d[face_flip][i]; + break; + case 3: + j = lookup_table_3d[face_orientation][face_flip][face_rotation][i]; + break; + default: + AssertThrow(false, ExcNotImplemented()); + } + + make_periodicity_constraints (face_1->child(i), + face_2->child(j), + constraint_matrix, + component_mask, + face_orientation, + face_flip, + face_rotation); + } + } + else + // otherwise at least one of the two faces is active and + // we need to enter the constraints + { + if (face_2->has_children() == false) + set_periodicity_constraints(face_2, face_1, + FullMatrix(IdentityMatrix(face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face)), + constraint_matrix, + component_mask, + face_orientation, face_flip, face_rotation); + else + set_periodicity_constraints(face_1, face_2, + FullMatrix(IdentityMatrix(face_1->get_fe(face_1->nth_active_fe_index(0)).dofs_per_face)), + constraint_matrix, + component_mask, + face_orientation, face_flip, face_rotation); + } + } + + + + template + void + make_periodicity_constraints (const DH &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const int direction, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask) + { + Tensor<1,DH::space_dimension> dummy; + make_periodicity_constraints (dof_handler, + b_id1, + b_id2, + direction, + dummy, + constraint_matrix, + component_mask); + } + + + + template + void + make_periodicity_constraints (const DH &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const int direction, + dealii::Tensor<1,DH::space_dimension> &offset, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask) + { + static const int space_dim = DH::space_dimension; + Assert (0<=direction && direction > FaceVector; + + // Collect matching periodic cells on the coarsest level: + FaceVector matched_faces = + GridTools::collect_periodic_faces(dof_handler, b_id1, b_id2, + direction, offset); + + make_periodicity_constraints + (matched_faces, constraint_matrix, component_mask); + } + + + + template + void + make_periodicity_constraints (const DH &dof_handler, + const types::boundary_id b_id, + const int direction, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask) + { + Tensor<1,DH::space_dimension> dummy; + make_periodicity_constraints (dof_handler, + b_id, + direction, + dummy, + constraint_matrix, + component_mask); + } + + + + template + void + make_periodicity_constraints (const DH &dof_handler, + const types::boundary_id b_id, + const int direction, + dealii::Tensor<1,DH::space_dimension> &offset, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask) + { + static const int dim = DH::dimension; + static const int space_dim = DH::space_dimension; + + Assert (0<=direction && direction > FaceVector; + + // Collect matching periodic cells on the coarsest level: + const FaceVector matched_faces = + GridTools::collect_periodic_faces(dof_handler, b_id, + direction, offset); + + make_periodicity_constraints + (matched_faces, constraint_matrix, component_mask); + } + + + + template + void + make_periodicity_constraints + (const std::vector > + &periodic_faces, + dealii::ConstraintMatrix &constraint_matrix, + const ComponentMask &component_mask) + { + typedef std::vector > + FaceVector; + typename FaceVector::const_iterator it, end_periodic; + it = periodic_faces.begin(); + end_periodic = periodic_faces.end(); + + + // And apply the low level make_periodicity_constraints function to + // every matching pair: + for(; it!=end_periodic; ++it) + { + typedef typename DH::face_iterator FaceIterator; + const FaceIterator face_1 = it->cell[0]->face(it->face_idx[0]); + const FaceIterator face_2 = it->cell[1]->face(it->face_idx[1]); + + Assert(face_1->at_boundary() && face_2->at_boundary(), + ExcInternalError()); + + Assert (face_1 != face_2, + ExcInternalError()); + + make_periodicity_constraints(face_1, + face_2, + constraint_matrix, + component_mask, + it->orientation[0], + it->orientation[1], + it->orientation[2]); + } + } + + + + namespace internal + { + namespace + { + /** + * This is a function that is called by the _2 function and that + * operates on a range of cells only. It is used to split up the + * whole range of cells into chunks which are then worked on in + * parallel, if multithreading is available. + */ + template + void + compute_intergrid_weights_3 ( + const dealii::DoFHandler &coarse_grid, + const unsigned int coarse_component, + const InterGridMap > &coarse_to_fine_grid_map, + const std::vector > ¶meter_dofs, + const std::vector &weight_mapping, + std::vector > &weights, + const typename dealii::DoFHandler::active_cell_iterator &begin, + const typename dealii::DoFHandler::active_cell_iterator &end) + { + // aliases to the finite elements used by the dof handlers: + const FiniteElement &coarse_fe = coarse_grid.get_fe(); + + // for each cell on the parameter grid: find out which degrees of + // freedom on the fine grid correspond in which way to the degrees + // of freedom on the parameter grid + // + // since for continuous FEs some dofs exist on more than one cell, + // we have to track which ones were already visited. the problem is + // that if we visit a dof first on one cell and compute its weight + // with respect to some global dofs to be non-zero, and later visit + // the dof again on another cell and (since we are on another cell) + // recompute the weights with respect to the same dofs as above to + // be zero now, we have to preserve them. we therefore overwrite + // all weights if they are nonzero and do not enforce zero weights + // since that might be only due to the fact that we are on another + // cell. + // + // example: + // coarse grid + // | | | + // *-----*-----* + // | cell|cell | + // | 1 | 2 | + // | | | + // 0-----1-----* + // + // fine grid + // | | | | | + // *--*--*--*--* + // | | | | | + // *--*--*--*--* + // | | | | | + // *--x--y--*--* + // + // when on cell 1, we compute the weights of dof 'x' to be 1/2 from + // parameter dofs 0 and 1, respectively. however, when later we are + // on cell 2, we again compute the prolongation of shape function 1 + // restricted to cell 2 to the globla grid and find that the weight + // of global dof 'x' now is zero. however, we should not overwrite + // the old value. + // + // we therefore always only set nonzero values. why adding up is + // not useful: dof 'y' would get weight 1 from parameter dof 1 on + // both cells 1 and 2, but the correct weight is nevertheless only + // 1. + + // vector to hold the representation of a single degree of freedom + // on the coarse grid (for the selected fe) on the fine grid + const types::global_dof_index n_fine_dofs = weight_mapping.size(); + dealii::Vector global_parameter_representation (n_fine_dofs); + + typename dealii::DoFHandler::active_cell_iterator cell; + std::vector parameter_dof_indices (coarse_fe.dofs_per_cell); + + for (cell=begin; cell!=end; ++cell) + { + // get the global indices of the parameter dofs on this + // parameter grid cell + cell->get_dof_indices (parameter_dof_indices); + + // loop over all dofs on this cell and check whether they are + // interesting for us + for (unsigned int local_dof=0; + local_dof + set_dof_values_by_interpolation (parameter_dofs[local_parameter_dof], + global_parameter_representation); + // now that we've got the global representation of each + // parameter dof, we've only got to clobber the non-zero + // entries in that vector and store the result + // + // what we have learned: if entry @p{i} of the global + // vector holds the value @p{v[i]}, then this is the + // weight with which the present dof contributes to + // @p{i}. there may be several such @p{i}s and their + // weights' sum should be one. Then, @p{v[i]} should be + // equal to @p{\sum_j w_{ij} p[j]} with @p{p[j]} be the + // values of the degrees of freedom on the coarse grid. + // we can thus compute constraints which link the degrees + // of freedom @p{v[i]} on the fine grid to those on the + // coarse grid, @p{p[j]}. Now to use these as real + // constraints, rather than as additional equations, we + // have to identify representants among the @p{i} for + // each @p{j}. this will be done by simply taking the + // first @p{i} for which @p{w_{ij}==1}. + // + // guard modification of the weights array by a Mutex. + // since it should happen rather rarely that there are + // several threads operating on different intergrid + // weights, have only one mutex for all of them + static Threads::Mutex mutex; + Threads::Mutex::ScopedLock lock (mutex); + for (types::global_dof_index i=0; i + void + compute_intergrid_weights_2 ( + const dealii::DoFHandler &coarse_grid, + const unsigned int coarse_component, + const InterGridMap > &coarse_to_fine_grid_map, + const std::vector > ¶meter_dofs, + const std::vector &weight_mapping, + std::vector > &weights) + { + // simply distribute the range of cells to different threads + typedef typename dealii::DoFHandler::active_cell_iterator active_cell_iterator; + std::vector > + cell_intervals = Threads::split_range (coarse_grid.begin_active(), + coarse_grid.end(), + multithread_info.n_default_threads); + + // TODO: use WorkStream here + + Threads::TaskGroup<> tasks; + void (*fun_ptr) (const dealii::DoFHandler &, + const unsigned int , + const InterGridMap > &, + const std::vector > &, + const std::vector &, + std::vector > &, + const typename dealii::DoFHandler::active_cell_iterator &, + const typename dealii::DoFHandler::active_cell_iterator &) + = &compute_intergrid_weights_3; + for (unsigned int i=0; i + unsigned int + compute_intergrid_weights_1 ( + const dealii::DoFHandler &coarse_grid, + const unsigned int coarse_component, + const dealii::DoFHandler &fine_grid, + const unsigned int fine_component, + const InterGridMap > &coarse_to_fine_grid_map, + std::vector > &weights, + std::vector &weight_mapping) + { + // aliases to the finite elements used by the dof handlers: + const FiniteElement &coarse_fe = coarse_grid.get_fe(), + &fine_fe = fine_grid.get_fe(); + + // global numbers of dofs + const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(), + n_fine_dofs = fine_grid.n_dofs(); + + // local numbers of dofs + const unsigned int fine_dofs_per_cell = fine_fe.dofs_per_cell; + + // alias the number of dofs per cell belonging to the + // coarse_component which is to be the restriction of the fine + // grid: + const unsigned int coarse_dofs_per_cell_component + = coarse_fe.base_element(coarse_fe.component_to_base_index(coarse_component).first).dofs_per_cell; + + + // Try to find out whether the grids stem from the same coarse + // grid. This is a rather crude test, but better than nothing + Assert (coarse_grid.get_tria().n_cells(0) == fine_grid.get_tria().n_cells(0), + ExcGridsDontMatch()); + + // check whether the map correlates the right objects + Assert (&coarse_to_fine_grid_map.get_source_grid() == &coarse_grid, + ExcGridsDontMatch ()); + Assert (&coarse_to_fine_grid_map.get_destination_grid() == &fine_grid, + ExcGridsDontMatch ()); + + + // check whether component numbers are valid + AssertIndexRange (coarse_component,coarse_fe.n_components()); + AssertIndexRange (fine_component, fine_fe.n_components()); + + // check whether respective finite elements are equal + Assert (coarse_fe.base_element (coarse_fe.component_to_base_index(coarse_component).first) + == + fine_fe.base_element (fine_fe.component_to_base_index(fine_component).first), + ExcFiniteElementsDontMatch()); + +#ifdef DEBUG + // if in debug mode, check whether the coarse grid is indeed + // coarser everywhere than the fine grid + for (typename dealii::DoFHandler::active_cell_iterator + cell=coarse_grid.begin_active(); + cell != coarse_grid.end(); ++cell) + Assert (cell->level() <= coarse_to_fine_grid_map[cell]->level(), + ExcGridNotCoarser()); +#endif + + /* + * From here on: the term `parameter' refers to the selected + * component on the coarse grid and its analogon on the fine grid. + * The naming of variables containing this term is due to the fact + * that `selected_component' is longer, but also due to the fact + * that the code of this function was initially written for a + * program where the component which we wanted to match between + * grids was actually the `parameter' variable. + * + * Likewise, the terms `parameter grid' and `state grid' refer to + * the coarse and fine grids, respectively. + * + * Changing the names of variables would in principle be a good + * idea, but would not make things simpler and would be another + * source of errors. If anyone feels like doing so: patches would + * be welcome! + */ + + + + // set up vectors of cell-local data; each vector represents one + // degree of freedom of the coarse-grid variable in the fine-grid + // element + std::vector > + parameter_dofs (coarse_dofs_per_cell_component, + dealii::Vector(fine_dofs_per_cell)); + // for each coarse dof: find its position within the fine element + // and set this value to one in the respective vector (all other + // values are zero by construction) + for (unsigned int local_coarse_dof=0; + local_coarse_dof dof_is_interesting (fine_grid.n_dofs(), false); + std::vector local_dof_indices (fine_fe.dofs_per_cell); + + for (typename dealii::DoFHandler::active_cell_iterator + cell=fine_grid.begin_active(); + cell!=fine_grid.end(); ++cell) + { + cell->get_dof_indices (local_dof_indices); + for (unsigned int i=0; i local_dof_indices(fine_fe.dofs_per_cell); + unsigned int next_free_index=0; + for (typename dealii::DoFHandler::active_cell_iterator + cell=fine_grid.begin_active(); + cell != fine_grid.end(); ++cell) + { + cell->get_dof_indices (local_dof_indices); + for (unsigned int i=0; i1) && (sum==0)), ExcInternalError()); + }; +#endif + + + return n_parameters_on_fine_grid; + } + + + } + } + + + + template + void + compute_intergrid_constraints ( + const DoFHandler &coarse_grid, + const unsigned int coarse_component, + const DoFHandler &fine_grid, + const unsigned int fine_component, + const InterGridMap > &coarse_to_fine_grid_map, + ConstraintMatrix &constraints) + { + // store the weights with which a dof on the parameter grid contributes + // to a dof on the fine grid. see the long doc below for more info + // + // allocate as many rows as there are parameter dofs on the coarse grid + // and as many columns as there are parameter dofs on the fine grid. + // + // weight_mapping is used to map the global (fine grid) parameter dof + // indices to the columns + // + // in the original implementation, the weights array was actually of + // FullMatrix type. this wasted huge amounts of memory, but was + // fast. nonetheless, since the memory consumption was quadratic in the + // number of degrees of freedom, this was not very practical, so we now + // use a vector of rows of the matrix, and in each row a vector of + // pairs (colnum,value). this seems like the best tradeoff between + // memory and speed, as it is now linear in memory and still fast + // enough. + // + // to save some memory and since the weights are usually (negative) + // powers of 2, we choose the value type of the matrix to be @p{float} + // rather than @p{double}. + std::vector > weights; + + // this is this mapping. there is one entry for each dof on the fine + // grid; if it is a parameter dof, then its value is the column in + // weights for that parameter dof, if it is any other dof, then its + // value is -1, indicating an error + std::vector weight_mapping; + + const unsigned int n_parameters_on_fine_grid + = internal::compute_intergrid_weights_1 (coarse_grid, coarse_component, + fine_grid, fine_component, + coarse_to_fine_grid_map, + weights, weight_mapping); + + // global numbers of dofs + const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(), + n_fine_dofs = fine_grid.n_dofs(); + + + // get an array in which we store which dof on the coarse grid is a + // parameter and which is not + std::vector coarse_dof_is_parameter (coarse_grid.n_dofs()); + if (true) + { + std::vector mask (coarse_grid.get_fe().n_components(), + false); + mask[coarse_component] = true; + extract_dofs (coarse_grid, ComponentMask(mask), coarse_dof_is_parameter); + } + + // now we know that the weights in each row constitute a constraint. + // enter this into the constraints object + // + // first task: for each parameter dof on the parameter grid, find a + // representant on the fine, global grid. this is possible since we use + // conforming finite element. we take this representant to be the first + // element in this row with weight identical to one. the representant + // will become an unconstrained degree of freedom, while all others + // will be constrained to this dof (and possibly others) + std::vector representants(n_coarse_dofs, numbers::invalid_dof_index); + for (types::global_dof_index parameter_dof=0; parameter_dof 0, ExcInternalError()); + + // find the column where the representant is mentioned + std::map::const_iterator i = weights[parameter_dof].begin(); + for (; i!=weights[parameter_dof].end(); ++i) + if (i->second == 1) + break; + Assert (i!=weights[parameter_dof].end(), ExcInternalError()); + const types::global_dof_index column = i->first; + + // now we know in which column of weights the representant is, + // but we don't know its global index. get it using the inverse + // operation of the weight_mapping + types::global_dof_index global_dof=0; + for (; global_dof(column)) + break; + Assert (global_dof < weight_mapping.size(), ExcInternalError()); + + // now enter the representants global index into our list + representants[parameter_dof] = global_dof; + } + else + { + // consistency check: if this is no parameter dof on the coarse + // grid, then the respective row must be empty! + Assert (weights[parameter_dof].size() == 0, ExcInternalError()); + }; + + + + // note for people that want to optimize this function: the largest + // part of the computing time is spent in the following, rather + // innocent block of code. basically, it must be the + // ConstraintMatrix::add_entry call which takes the bulk of the time, + // but it is not known to the author how to make it faster... + std::vector > constraint_line; + for (types::global_dof_index global_dof=0; global_dof 0, ExcInternalError()); + std::map::const_iterator + col_entry = weights[0].end(); + for (; first_used_rowsecond == 1) && + (representants[first_used_row] == global_dof)) + // dof unconstrained or constrained to itself (in case this + // cell is mapped to itself, rather than to children of + // itself) + continue; + } + + + // otherwise enter all constraints + constraints.add_line (global_dof); + + constraint_line.clear (); + for (types::global_dof_index row=first_used_row; row::const_iterator + j = weights[row].find(col); + if ((j != weights[row].end()) && (j->second != 0)) + constraint_line.push_back (std::pair(representants[row], + j->second)); + }; + + constraints.add_entries (global_dof, constraint_line); + }; + } + + + + template + void + compute_intergrid_transfer_representation ( + const DoFHandler &coarse_grid, + const unsigned int coarse_component, + const DoFHandler &fine_grid, + const unsigned int fine_component, + const InterGridMap > &coarse_to_fine_grid_map, + std::vector > &transfer_representation) + { + // store the weights with which a dof on the parameter grid contributes + // to a dof on the fine grid. see the long doc below for more info + // + // allocate as many rows as there are parameter dofs on the coarse grid + // and as many columns as there are parameter dofs on the fine grid. + // + // weight_mapping is used to map the global (fine grid) parameter dof + // indices to the columns + // + // in the original implementation, the weights array was actually of + // FullMatrix type. this wasted huge amounts of memory, but was + // fast. nonetheless, since the memory consumption was quadratic in the + // number of degrees of freedom, this was not very practical, so we now + // use a vector of rows of the matrix, and in each row a vector of + // pairs (colnum,value). this seems like the best tradeoff between + // memory and speed, as it is now linear in memory and still fast + // enough. + // + // to save some memory and since the weights are usually (negative) + // powers of 2, we choose the value type of the matrix to be @p{float} + // rather than @p{double}. + std::vector > weights; + + // this is this mapping. there is one entry for each dof on the fine + // grid; if it is a parameter dof, then its value is the column in + // weights for that parameter dof, if it is any other dof, then its + // value is -1, indicating an error + std::vector weight_mapping; + + internal::compute_intergrid_weights_1 (coarse_grid, coarse_component, + fine_grid, fine_component, + coarse_to_fine_grid_map, + weights, weight_mapping); + + // now compute the requested representation + const types::global_dof_index n_global_parm_dofs + = std::count_if (weight_mapping.begin(), weight_mapping.end(), + std::bind2nd (std::not_equal_to (), numbers::invalid_dof_index)); + + // first construct the inverse mapping of weight_mapping + std::vector inverse_weight_mapping (n_global_parm_dofs, + DoFHandler::invalid_dof_index); + for (types::global_dof_index i=0; i::invalid_dof_index), + ExcInternalError()); + + inverse_weight_mapping[parameter_dof] = i; + }; + }; + + // next copy over weights array and replace respective numbers + const types::global_dof_index n_rows = weight_mapping.size(); + + transfer_representation.clear (); + transfer_representation.resize (n_rows); + + const types::global_dof_index n_coarse_dofs = coarse_grid.n_dofs(); + for (types::global_dof_index i=0; i::const_iterator j = weights[i].begin(); + for (; j!=weights[i].end(); ++j) + { + const types::global_dof_index p = inverse_weight_mapping[j->first]; + Assert (psecond; + }; + }; + } + + + + template class DH> + void + make_zero_boundary_constraints (const DH &dof, + const types::boundary_id boundary_indicator, + ConstraintMatrix &zero_boundary_constraints, + const ComponentMask &component_mask) + { + Assert (component_mask.represents_n_components(dof.get_fe().n_components()), + ExcMessage ("The number of components in the mask has to be either " + "zero or equal to the number of components in the finite " + "element.")); + + const unsigned int n_components = DoFTools::n_components (dof); + + Assert (component_mask.n_selected_components(n_components) > 0, + ComponentMask::ExcNoComponentSelected()); + + // a field to store the indices + std::vector face_dofs; + face_dofs.reserve (max_dofs_per_face(dof)); + + typename DH::active_cell_iterator + cell = dof.begin_active(), + endc = dof.end(); + for (; cell!=endc; ++cell) + if (!cell->is_artificial()) + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + { + const FiniteElement &fe = cell->get_fe(); + + const typename DH::face_iterator face = cell->face(face_no); + + // if face is on the boundary and satisfies the correct + // boundary id property + if (face->at_boundary () + && + ((boundary_indicator == numbers::invalid_boundary_id) + || + (face->boundary_indicator() == boundary_indicator))) + { + // get indices and physical location on this face + face_dofs.resize (fe.dofs_per_face); + face->get_dof_indices (face_dofs, cell->active_fe_index()); + + // enter those dofs into the list that match the component + // signature. + for (unsigned int i=0; iget_fe().get_nonzero_components (i); + bool nonzero = false; + for (unsigned int c=0; c class DH> + void + make_zero_boundary_constraints (const DH &dof, + ConstraintMatrix &zero_boundary_constraints, + const ComponentMask &component_mask) + { + make_zero_boundary_constraints(dof, numbers::invalid_boundary_id, + zero_boundary_constraints, component_mask); + } + + +} // end of namespace DoFTools + + + +// explicit instantiations + +#include "dof_tools_constraints.inst" + + + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/dofs/dof_tools_constraints.inst.in b/deal.II/source/dofs/dof_tools_constraints.inst.in new file mode 100644 index 0000000000..d61208de26 --- /dev/null +++ b/deal.II/source/dofs/dof_tools_constraints.inst.in @@ -0,0 +1,155 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2009 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + + +for (DH : DOFHANDLERS; deal_II_dimension : DIMENSIONS) +{ + template + void + DoFTools::make_hanging_node_constraints (const DH &dof_handler, + ConstraintMatrix &constraints); + +#if deal_II_dimension != 1 + template + void + DoFTools::make_periodicity_constraints (const DH::face_iterator &, + const DH::face_iterator &, + dealii::ConstraintMatrix &, + const ComponentMask &, + bool, bool, bool); + + template + void + DoFTools::make_periodicity_constraints(const DH &, + const types::boundary_id, + const types::boundary_id, + const int, + dealii::ConstraintMatrix &, + const ComponentMask &); + + template + void + DoFTools::make_periodicity_constraints(const DH &, + const types::boundary_id, + const types::boundary_id, + const int, + dealii::Tensor<1,DH::space_dimension> &, + dealii::ConstraintMatrix &, + const ComponentMask &); + + template + void + DoFTools::make_periodicity_constraints(const DH &, + const types::boundary_id, + const int, + dealii::ConstraintMatrix &, + const ComponentMask &); + + template + void + DoFTools::make_periodicity_constraints(const DH &, + const types::boundary_id, + const int, + dealii::Tensor<1,DH::space_dimension> &, + dealii::ConstraintMatrix &, + const ComponentMask &); + + template + void + DoFTools::make_periodicity_constraints + (const std::vector > &, + dealii::ConstraintMatrix &, + const ComponentMask &); + +#endif +} + +for (deal_II_dimension : DIMENSIONS) +{ +#if deal_II_dimension != 1 + template + void + DoFTools::make_hanging_node_constraints (const MGDoFHandler &dof_handler, + ConstraintMatrix &constraints); + +#endif + +#if deal_II_dimension < 3 + +template +void +DoFTools:: +make_hanging_node_constraints (const DoFHandler &dof_handler, + ConstraintMatrix &constraints); +#endif + +#if deal_II_dimension == 3 +template +void +DoFTools:: +make_hanging_node_constraints (const DoFHandler<1,3> &dof_handler, + ConstraintMatrix &constraints); +#endif + +template +void +DoFTools::make_zero_boundary_constraints +(const DoFHandler &, + ConstraintMatrix &, + const ComponentMask &); + +template +void +DoFTools::make_zero_boundary_constraints +(const DoFHandler &, + const types::boundary_id , + ConstraintMatrix &, + const ComponentMask &); + +template +void +DoFTools::make_zero_boundary_constraints +(const hp::DoFHandler &, + ConstraintMatrix &, + const ComponentMask &); + +template +void +DoFTools::make_zero_boundary_constraints +(const hp::DoFHandler &, + const types::boundary_id , + ConstraintMatrix &, + const ComponentMask &); + +template +void +DoFTools::compute_intergrid_constraints ( + const DoFHandler &, const unsigned int, + const DoFHandler &, const unsigned int, + const InterGridMap > &, + ConstraintMatrix&); + +template +void +DoFTools::compute_intergrid_transfer_representation +(const DoFHandler &, const unsigned int, + const DoFHandler &, const unsigned int, + const InterGridMap > &, + std::vector > &); + +} diff --git a/deal.II/source/dofs/dof_tools_sparsity.cc b/deal.II/source/dofs/dof_tools_sparsity.cc new file mode 100644 index 0000000000..c48bf2f677 --- /dev/null +++ b/deal.II/source/dofs/dof_tools_sparsity.cc @@ -0,0 +1,1179 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1999 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +DEAL_II_NAMESPACE_OPEN + + + +namespace DoFTools +{ + + template + void + make_sparsity_pattern (const DH &dof, + SparsityPattern &sparsity, + const ConstraintMatrix &constraints, + const bool keep_constrained_dofs, + const types::subdomain_id subdomain_id) + { + const types::global_dof_index n_dofs = dof.n_dofs(); + + Assert (sparsity.n_rows() == n_dofs, + ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); + Assert (sparsity.n_cols() == n_dofs, + ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); + + // If we have a distributed::Triangulation only allow locally_owned + // subdomain. Not setting a subdomain is also okay, because we skip + // ghost cells in the loop below. + Assert ( + (dof.get_tria().locally_owned_subdomain() == numbers::invalid_subdomain_id) + || + (subdomain_id == numbers::invalid_subdomain_id) + || + (subdomain_id == dof.get_tria().locally_owned_subdomain()), + ExcMessage ("For parallel::distributed::Triangulation objects and " + "associated DoF handler objects, asking for any subdomain other " + "than the locally owned one does not make sense.")); + + std::vector dofs_on_this_cell; + dofs_on_this_cell.reserve (max_dofs_per_cell(dof)); + typename DH::active_cell_iterator cell = dof.begin_active(), + endc = dof.end(); + + // In case we work with a distributed sparsity pattern of Trilinos + // type, we only have to do the work if the current cell is owned by + // the calling processor. Otherwise, just continue. + for (; cell!=endc; ++cell) + if (((subdomain_id == numbers::invalid_subdomain_id) + || + (subdomain_id == cell->subdomain_id())) + && + cell->is_locally_owned()) + { + const unsigned int dofs_per_cell = cell->get_fe().dofs_per_cell; + dofs_on_this_cell.resize (dofs_per_cell); + cell->get_dof_indices (dofs_on_this_cell); + + // make sparsity pattern for this cell. if no constraints pattern + // was given, then the following call acts as if simply no + // constraints existed + constraints.add_entries_local_to_global (dofs_on_this_cell, + sparsity, + keep_constrained_dofs); + } + } + + + + template + void + make_sparsity_pattern (const DH &dof, + const Table<2,Coupling> &couplings, + SparsityPattern &sparsity, + const ConstraintMatrix &constraints, + const bool keep_constrained_dofs, + const types::subdomain_id subdomain_id) + { + const types::global_dof_index n_dofs = dof.n_dofs(); + + Assert (sparsity.n_rows() == n_dofs, + ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); + Assert (sparsity.n_cols() == n_dofs, + ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); + Assert (couplings.n_rows() == dof.get_fe().n_components(), + ExcDimensionMismatch(couplings.n_rows(), dof.get_fe().n_components())); + Assert (couplings.n_cols() == dof.get_fe().n_components(), + ExcDimensionMismatch(couplings.n_cols(), dof.get_fe().n_components())); + + // If we have a distributed::Triangulation only allow locally_owned + // subdomain. Not setting a subdomain is also okay, because we skip + // ghost cells in the loop below. + Assert ( + (dof.get_tria().locally_owned_subdomain() == numbers::invalid_subdomain_id) + || + (subdomain_id == numbers::invalid_subdomain_id) + || + (subdomain_id == dof.get_tria().locally_owned_subdomain()), + ExcMessage ("For parallel::distributed::Triangulation objects and " + "associated DoF handler objects, asking for any subdomain other " + "than the locally owned one does not make sense.")); + + const hp::FECollection fe_collection (dof.get_fe()); + + // first, for each finite element, build a mask for each dof, not like + // the one given which represents components. make sure we do the right + // thing also with respect to non-primitive shape functions, which + // takes some additional thought + std::vector > dof_mask(fe_collection.size()); + + // check whether the table of couplings contains only true arguments, + // i.e., we do not exclude any index. that is the easy case, since we + // don't have to set up the tables + bool need_dof_mask = false; + for (unsigned int i=0; i dofs_on_this_cell(fe_collection.max_dofs_per_cell()); + typename DH::active_cell_iterator cell = dof.begin_active(), + endc = dof.end(); + + // In case we work with a distributed sparsity pattern of Trilinos + // type, we only have to do the work if the current cell is owned by + // the calling processor. Otherwise, just continue. + for (; cell!=endc; ++cell) + if (((subdomain_id == numbers::invalid_subdomain_id) + || + (subdomain_id == cell->subdomain_id())) + && + cell->is_locally_owned()) + { + const unsigned int fe_index = cell->active_fe_index(); + const unsigned int dofs_per_cell =fe_collection[fe_index].dofs_per_cell; + + dofs_on_this_cell.resize (dofs_per_cell); + cell->get_dof_indices (dofs_on_this_cell); + + + // make sparsity pattern for this cell. if no constraints pattern + // was given, then the following call acts as if simply no + // constraints existed + constraints.add_entries_local_to_global (dofs_on_this_cell, + sparsity, + keep_constrained_dofs, + dof_mask[fe_index]); + } + } + + + + template + void + make_sparsity_pattern ( + const DH &dof_row, + const DH &dof_col, + SparsityPattern &sparsity) + { + const types::global_dof_index n_dofs_row = dof_row.n_dofs(); + const types::global_dof_index n_dofs_col = dof_col.n_dofs(); + + Assert (sparsity.n_rows() == n_dofs_row, + ExcDimensionMismatch (sparsity.n_rows(), n_dofs_row)); + Assert (sparsity.n_cols() == n_dofs_col, + ExcDimensionMismatch (sparsity.n_cols(), n_dofs_col)); + +//TODO: Looks like wasteful memory management here + + const std::list > + cell_list + = GridTools::get_finest_common_cells (dof_row, dof_col); + + + typename std::list >::const_iterator + cell_iter = cell_list.begin(); + + for (; cell_iter!=cell_list.end(); ++cell_iter) + { + const typename DH::cell_iterator cell_row = cell_iter->first; + const typename DH::cell_iterator cell_col = cell_iter->second; + + if (!cell_row->has_children() && !cell_col->has_children()) + { + const unsigned int dofs_per_cell_row = + cell_row->get_fe().dofs_per_cell; + const unsigned int dofs_per_cell_col = + cell_col->get_fe().dofs_per_cell; + std::vector + local_dof_indices_row(dofs_per_cell_row); + std::vector + local_dof_indices_col(dofs_per_cell_col); + cell_row->get_dof_indices (local_dof_indices_row); + cell_col->get_dof_indices (local_dof_indices_col); + for (unsigned int i=0; ihas_children()) + { + const std::vector + child_cells = GridTools::get_active_child_cells (cell_row); + for (unsigned int i=0; iget_fe().dofs_per_cell; + const unsigned int dofs_per_cell_col = + cell_col->get_fe().dofs_per_cell; + std::vector + local_dof_indices_row(dofs_per_cell_row); + std::vector + local_dof_indices_col(dofs_per_cell_col); + cell_row_child->get_dof_indices (local_dof_indices_row); + cell_col->get_dof_indices (local_dof_indices_col); + for (unsigned int i=0; i + child_cells = GridTools::get_active_child_cells (cell_col); + for (unsigned int i=0; iget_fe().dofs_per_cell; + const unsigned int dofs_per_cell_col = + cell_col_child->get_fe().dofs_per_cell; + std::vector + local_dof_indices_row(dofs_per_cell_row); + std::vector + local_dof_indices_col(dofs_per_cell_col); + cell_row->get_dof_indices (local_dof_indices_row); + cell_col_child->get_dof_indices (local_dof_indices_col); + for (unsigned int i=0; i + void + make_boundary_sparsity_pattern ( + const DH &dof, + const std::vector &dof_to_boundary_mapping, + SparsityPattern &sparsity) + { + if (DH::dimension == 1) + { + // there are only 2 boundary indicators in 1d, so it is no + // performance problem to call the other function + typename DH::FunctionMap boundary_indicators; + boundary_indicators[0] = 0; + boundary_indicators[1] = 0; + make_boundary_sparsity_pattern (dof, + boundary_indicators, + dof_to_boundary_mapping, + sparsity); + return; + } + + const types::global_dof_index n_dofs = dof.n_dofs(); + + AssertDimension (dof_to_boundary_mapping.size(), n_dofs); + AssertDimension (sparsity.n_rows(), dof.n_boundary_dofs()); + AssertDimension (sparsity.n_cols(), dof.n_boundary_dofs()); +#ifdef DEBUG + if (sparsity.n_rows() != 0) + { + types::global_dof_index max_element = 0; + for (std::vector::const_iterator i=dof_to_boundary_mapping.begin(); + i!=dof_to_boundary_mapping.end(); ++i) + if ((*i != DH::invalid_dof_index) && + (*i > max_element)) + max_element = *i; + AssertDimension (max_element, sparsity.n_rows()-1); + }; +#endif + + std::vector dofs_on_this_face; + dofs_on_this_face.reserve (max_dofs_per_face(dof)); + + // loop over all faces to check whether they are at a boundary. note + // that we need not take special care of single lines (using + // @p{cell->has_boundary_lines}), since we do not support boundaries of + // dimension dim-2, and so every boundary line is also part of a + // boundary face. + typename DH::active_cell_iterator cell = dof.begin_active(), + endc = dof.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + { + const unsigned int dofs_per_face = cell->get_fe().dofs_per_face; + dofs_on_this_face.resize (dofs_per_face); + cell->face(f)->get_dof_indices (dofs_on_this_face, + cell->active_fe_index()); + + // make sparsity pattern for this cell + for (unsigned int i=0; i + void make_boundary_sparsity_pattern ( + const DH &dof, + const typename FunctionMap::type &boundary_indicators, + const std::vector &dof_to_boundary_mapping, + SparsityPattern &sparsity) + { + if (DH::dimension == 1) + { + // first check left, then right boundary point + for (unsigned int direction=0; direction<2; ++direction) + { + // if this boundary is not requested, then go on with next one + if (boundary_indicators.find(direction) == + boundary_indicators.end()) + continue; + + // find active cell at that boundary: first go to left/right, + // then to children + typename DH::level_cell_iterator cell = dof.begin(0); + while (!cell->at_boundary(direction)) + cell = cell->neighbor(direction); + while (!cell->active()) + cell = cell->child(direction); + + const unsigned int dofs_per_vertex = cell->get_fe().dofs_per_vertex; + std::vector boundary_dof_boundary_indices (dofs_per_vertex); + + // next get boundary mapped dof indices of boundary dofs + for (unsigned int i=0; ivertex_dof_index(direction,i)]; + + for (unsigned int i=0; i::const_iterator i=dof_to_boundary_mapping.begin(); + i!=dof_to_boundary_mapping.end(); ++i) + if ((*i != DH::invalid_dof_index) && + (*i > max_element)) + max_element = *i; + AssertDimension (max_element, sparsity.n_rows()-1); + }; +#endif + + std::vector dofs_on_this_face; + dofs_on_this_face.reserve (max_dofs_per_face(dof)); + typename DH::active_cell_iterator cell = dof.begin_active(), + endc = dof.end(); + for (; cell!=endc; ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (boundary_indicators.find(cell->face(f)->boundary_indicator()) != + boundary_indicators.end()) + { + const unsigned int dofs_per_face = cell->get_fe().dofs_per_face; + dofs_on_this_face.resize (dofs_per_face); + cell->face(f)->get_dof_indices (dofs_on_this_face, + cell->active_fe_index()); + + // make sparsity pattern for this cell + for (unsigned int i=0; i + void + make_flux_sparsity_pattern (const DH &dof, + SparsityPattern &sparsity, + const ConstraintMatrix &constraints, + const bool keep_constrained_dofs, + const types::subdomain_id subdomain_id) + + // TODO: QA: reduce the indentation level of this method..., Maier 2012 + + { + const types::global_dof_index n_dofs = dof.n_dofs(); + + AssertDimension (sparsity.n_rows(), n_dofs); + AssertDimension (sparsity.n_cols(), n_dofs); + + // If we have a distributed::Triangulation only allow locally_owned + // subdomain. Not setting a subdomain is also okay, because we skip + // ghost cells in the loop below. + Assert ( + (dof.get_tria().locally_owned_subdomain() == numbers::invalid_subdomain_id) + || + (subdomain_id == numbers::invalid_subdomain_id) + || + (subdomain_id == dof.get_tria().locally_owned_subdomain()), + ExcMessage ("For parallel::distributed::Triangulation objects and " + "associated DoF handler objects, asking for any subdomain other " + "than the locally owned one does not make sense.")); + + std::vector dofs_on_this_cell; + std::vector dofs_on_other_cell; + dofs_on_this_cell.reserve (max_dofs_per_cell(dof)); + dofs_on_other_cell.reserve (max_dofs_per_cell(dof)); + typename DH::active_cell_iterator cell = dof.begin_active(), + endc = dof.end(); + + // TODO: in an old implementation, we used user flags before to tag + // faces that were already touched. this way, we could reduce the work + // a little bit. now, we instead add only data from one side. this + // should be OK, but we need to actually verify it. + + // In case we work with a distributed sparsity pattern of Trilinos + // type, we only have to do the work if the current cell is owned by + // the calling processor. Otherwise, just continue. + for (; cell!=endc; ++cell) + if (((subdomain_id == numbers::invalid_subdomain_id) + || + (subdomain_id == cell->subdomain_id())) + && + cell->is_locally_owned()) + { + const unsigned int n_dofs_on_this_cell = cell->get_fe().dofs_per_cell; + dofs_on_this_cell.resize (n_dofs_on_this_cell); + cell->get_dof_indices (dofs_on_this_cell); + + // make sparsity pattern for this cell. if no constraints pattern + // was given, then the following call acts as if simply no + // constraints existed + constraints.add_entries_local_to_global (dofs_on_this_cell, + sparsity, + keep_constrained_dofs); + + for (unsigned int face = 0; + face < GeometryInfo::faces_per_cell; + ++face) + { + typename DH::face_iterator cell_face = cell->face(face); + if (! cell->at_boundary(face) ) + { + typename DH::level_cell_iterator neighbor = cell->neighbor(face); + + // in 1d, we do not need to worry whether the neighbor + // might have children and then loop over those children. + // rather, we may as well go straight to to cell behind + // this particular cell's most terminal child + if (DH::dimension==1) + while (neighbor->has_children()) + neighbor = neighbor->child(face==0 ? 1 : 0); + + if (neighbor->has_children()) + { + for (unsigned int sub_nr = 0; + sub_nr != cell_face->number_of_children(); + ++sub_nr) + { + const typename DH::level_cell_iterator + sub_neighbor + = cell->neighbor_child_on_subface (face, sub_nr); + + const unsigned int n_dofs_on_neighbor + = sub_neighbor->get_fe().dofs_per_cell; + dofs_on_other_cell.resize (n_dofs_on_neighbor); + sub_neighbor->get_dof_indices (dofs_on_other_cell); + + constraints.add_entries_local_to_global + (dofs_on_this_cell, dofs_on_other_cell, + sparsity, keep_constrained_dofs); + constraints.add_entries_local_to_global + (dofs_on_other_cell, dofs_on_this_cell, + sparsity, keep_constrained_dofs); + } + } + else + { + // Refinement edges are taken care of by coarser + // cells + + // TODO: in the distributed case, we miss out the + // constraints when the neighbor cell is coarser, but + // only the current cell is owned locally! + if (cell->neighbor_is_coarser(face)) + continue; + + const unsigned int n_dofs_on_neighbor + = neighbor->get_fe().dofs_per_cell; + dofs_on_other_cell.resize (n_dofs_on_neighbor); + + neighbor->get_dof_indices (dofs_on_other_cell); + + constraints.add_entries_local_to_global + (dofs_on_this_cell, dofs_on_other_cell, + sparsity, keep_constrained_dofs); + + // only need to add these in case the neighbor cell + // is not locally owned - otherwise, we touch each + // face twice and hence put the indices the other way + // around + if (!cell->neighbor(face)->active() + || + (cell->neighbor(face)->subdomain_id() != + cell->subdomain_id())) + constraints.add_entries_local_to_global + (dofs_on_other_cell, dofs_on_this_cell, + sparsity, keep_constrained_dofs); + } + } + } + } + } + + + + template + void + make_flux_sparsity_pattern (const DH &dof, + SparsityPattern &sparsity) + { + ConstraintMatrix constraints; + make_flux_sparsity_pattern (dof, sparsity, constraints); + } + + template + Table<2,Coupling> + dof_couplings_from_component_couplings (const FiniteElement &fe, + const Table<2,Coupling> &component_couplings) + { + Assert(component_couplings.n_rows() == fe.n_components(), + ExcDimensionMismatch(component_couplings.n_rows(), + fe.n_components())); + Assert(component_couplings.n_cols() == fe.n_components(), + ExcDimensionMismatch(component_couplings.n_cols(), + fe.n_components())); + + const unsigned int n_dofs = fe.dofs_per_cell; + + Table<2,Coupling> dof_couplings (n_dofs, n_dofs); + + for (unsigned int i=0; i + std::vector > + dof_couplings_from_component_couplings + (const hp::FECollection &fe, + const Table<2,Coupling> &component_couplings) + { + std::vector > return_value (fe.size()); + for (unsigned int i=0; i + void + make_flux_sparsity_pattern (const DH &dof, + SparsityPattern &sparsity, + const Table<2,Coupling> &int_mask, + const Table<2,Coupling> &flux_mask) + { + const FiniteElement &fe = dof.get_fe(); + + std::vector dofs_on_this_cell(fe.dofs_per_cell); + std::vector dofs_on_other_cell(fe.dofs_per_cell); + + const Table<2,Coupling> + int_dof_mask = dof_couplings_from_component_couplings(fe, int_mask), + flux_dof_mask = dof_couplings_from_component_couplings(fe, flux_mask); + + Table<2,bool> support_on_face(fe.dofs_per_cell, + GeometryInfo::faces_per_cell); + for (unsigned int i=0; i::faces_per_cell; ++f) + support_on_face(i,f) = fe.has_support_on_face(i,f); + + typename DH::active_cell_iterator cell = dof.begin_active(), + endc = dof.end(); + for (; cell!=endc; ++cell) + if (cell->is_locally_owned()) + { + cell->get_dof_indices (dofs_on_this_cell); + // make sparsity pattern for this cell + for (unsigned int i=0; i::faces_per_cell; + ++face) + { + const typename DH::face_iterator + cell_face = cell->face(face); + if (cell_face->user_flag_set ()) + continue; + + if (cell->at_boundary (face) ) + { + for (unsigned int i=0; ineighbor(face); + // Refinement edges are taken care of by coarser + // cells + if (cell->neighbor_is_coarser(face)) + continue; + + typename DH::face_iterator cell_face = cell->face(face); + const unsigned int + neighbor_face = cell->neighbor_of_neighbor(face); + + if (cell_face->has_children()) + { + for (unsigned int sub_nr = 0; + sub_nr != cell_face->n_children(); + ++sub_nr) + { + const typename DH::level_cell_iterator + sub_neighbor + = cell->neighbor_child_on_subface (face, sub_nr); + + sub_neighbor->get_dof_indices (dofs_on_other_cell); + for (unsigned int i=0; iface(neighbor_face)->set_user_flag (); + } + } + else + { + neighbor->get_dof_indices (dofs_on_other_cell); + for (unsigned int i=0; iface(neighbor_face)->set_user_flag (); + } + } + } + } + } + + + // implementation of the same function in namespace DoFTools for + // non-hp DoFHandlers + template + void + make_flux_sparsity_pattern (const dealii::hp::DoFHandler &dof, + SparsityPattern &sparsity, + const Table<2,Coupling> &int_mask, + const Table<2,Coupling> &flux_mask) + { + // while the implementation above is quite optimized and caches a + // lot of data (see e.g. the int/flux_dof_mask tables), this is no + // longer practical for the hp version since we would have to have + // it for all combinations of elements in the hp::FECollection. + // consequently, the implementation here is simpler and probably + // less efficient but at least readable... + + const dealii::hp::FECollection &fe = dof.get_fe(); + + std::vector dofs_on_this_cell(DoFTools::max_dofs_per_cell(dof)); + std::vector dofs_on_other_cell(DoFTools::max_dofs_per_cell(dof)); + + const std::vector > + int_dof_mask + = dof_couplings_from_component_couplings(fe, int_mask); + + typename dealii::hp::DoFHandler::active_cell_iterator + cell = dof.begin_active(), + endc = dof.end(); + for (; cell!=endc; ++cell) + { + dofs_on_this_cell.resize (cell->get_fe().dofs_per_cell); + cell->get_dof_indices (dofs_on_this_cell); + + // make sparsity pattern for this cell + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + for (unsigned int j=0; jget_fe().dofs_per_cell; ++j) + if (int_dof_mask[cell->active_fe_index()](i,j) != none) + sparsity.add (dofs_on_this_cell[i], + dofs_on_this_cell[j]); + + // Loop over all interior neighbors + for (unsigned int face = 0; + face < GeometryInfo::faces_per_cell; + ++face) + { + const typename dealii::hp::DoFHandler::face_iterator + cell_face = cell->face(face); + if (cell_face->user_flag_set ()) + continue; + + if (cell->at_boundary (face) ) + { + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + for (unsigned int j=0; jget_fe().dofs_per_cell; ++j) + if ((flux_mask(cell->get_fe().system_to_component_index(i).first, + cell->get_fe().system_to_component_index(j).first) + == always) + || + (flux_mask(cell->get_fe().system_to_component_index(i).first, + cell->get_fe().system_to_component_index(j).first) + == nonzero)) + sparsity.add (dofs_on_this_cell[i], + dofs_on_this_cell[j]); + } + else + { + typename dealii::hp::DoFHandler::level_cell_iterator + neighbor = cell->neighbor(face); + + // Refinement edges are taken care of by coarser cells + if (cell->neighbor_is_coarser(face)) + continue; + + typename dealii::hp::DoFHandler::face_iterator + cell_face = cell->face(face); + const unsigned int + neighbor_face = cell->neighbor_of_neighbor(face); + + if (cell_face->has_children()) + { + for (unsigned int sub_nr = 0; + sub_nr != cell_face->n_children(); + ++sub_nr) + { + const typename dealii::hp::DoFHandler::level_cell_iterator + sub_neighbor + = cell->neighbor_child_on_subface (face, sub_nr); + + dofs_on_other_cell.resize (sub_neighbor->get_fe().dofs_per_cell); + sub_neighbor->get_dof_indices (dofs_on_other_cell); + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + { + for (unsigned int j=0; jget_fe().dofs_per_cell; + ++j) + { + if ((flux_mask(cell->get_fe().system_to_component_index(i).first, + sub_neighbor->get_fe().system_to_component_index(j).first) + == always) + || + (flux_mask(cell->get_fe().system_to_component_index(i).first, + sub_neighbor->get_fe().system_to_component_index(j).first) + == nonzero)) + { + sparsity.add (dofs_on_this_cell[i], + dofs_on_other_cell[j]); + sparsity.add (dofs_on_other_cell[i], + dofs_on_this_cell[j]); + sparsity.add (dofs_on_this_cell[i], + dofs_on_this_cell[j]); + sparsity.add (dofs_on_other_cell[i], + dofs_on_other_cell[j]); + } + + if ((flux_mask(sub_neighbor->get_fe().system_to_component_index(j).first, + cell->get_fe().system_to_component_index(i).first) + == always) + || + (flux_mask(sub_neighbor->get_fe().system_to_component_index(j).first, + cell->get_fe().system_to_component_index(i).first) + == nonzero)) + { + sparsity.add (dofs_on_this_cell[j], + dofs_on_other_cell[i]); + sparsity.add (dofs_on_other_cell[j], + dofs_on_this_cell[i]); + sparsity.add (dofs_on_this_cell[j], + dofs_on_this_cell[i]); + sparsity.add (dofs_on_other_cell[j], + dofs_on_other_cell[i]); + } + } + } + sub_neighbor->face(neighbor_face)->set_user_flag (); + } + } + else + { + dofs_on_other_cell.resize (neighbor->get_fe().dofs_per_cell); + neighbor->get_dof_indices (dofs_on_other_cell); + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + { + for (unsigned int j=0; jget_fe().dofs_per_cell; ++j) + { + if ((flux_mask(cell->get_fe().system_to_component_index(i).first, + neighbor->get_fe().system_to_component_index(j).first) + == always) + || + (flux_mask(cell->get_fe().system_to_component_index(i).first, + neighbor->get_fe().system_to_component_index(j).first) + == nonzero)) + { + sparsity.add (dofs_on_this_cell[i], + dofs_on_other_cell[j]); + sparsity.add (dofs_on_other_cell[i], + dofs_on_this_cell[j]); + sparsity.add (dofs_on_this_cell[i], + dofs_on_this_cell[j]); + sparsity.add (dofs_on_other_cell[i], + dofs_on_other_cell[j]); + } + + if ((flux_mask(neighbor->get_fe().system_to_component_index(j).first, + cell->get_fe().system_to_component_index(i).first) + == always) + || + (flux_mask(neighbor->get_fe().system_to_component_index(j).first, + cell->get_fe().system_to_component_index(i).first) + == nonzero)) + { + sparsity.add (dofs_on_this_cell[j], + dofs_on_other_cell[i]); + sparsity.add (dofs_on_other_cell[j], + dofs_on_this_cell[i]); + sparsity.add (dofs_on_this_cell[j], + dofs_on_this_cell[i]); + sparsity.add (dofs_on_other_cell[j], + dofs_on_other_cell[i]); + } + } + } + neighbor->face(neighbor_face)->set_user_flag (); + } + } + } + } + } + } + + } + + + + + template + void + make_flux_sparsity_pattern (const DH &dof, + SparsityPattern &sparsity, + const Table<2,Coupling> &int_mask, + const Table<2,Coupling> &flux_mask) + { + // do the error checking and frame code here, and then pass on to more + // specialized functions in the internal namespace + const types::global_dof_index n_dofs = dof.n_dofs(); + const unsigned int n_comp = dof.get_fe().n_components(); + + Assert (sparsity.n_rows() == n_dofs, + ExcDimensionMismatch (sparsity.n_rows(), n_dofs)); + Assert (sparsity.n_cols() == n_dofs, + ExcDimensionMismatch (sparsity.n_cols(), n_dofs)); + Assert (int_mask.n_rows() == n_comp, + ExcDimensionMismatch (int_mask.n_rows(), n_comp)); + Assert (int_mask.n_cols() == n_comp, + ExcDimensionMismatch (int_mask.n_cols(), n_comp)); + Assert (flux_mask.n_rows() == n_comp, + ExcDimensionMismatch (flux_mask.n_rows(), n_comp)); + Assert (flux_mask.n_cols() == n_comp, + ExcDimensionMismatch (flux_mask.n_cols(), n_comp)); + + // Clear user flags because we will need them. But first we save them + // and make sure that we restore them later such that at the end of + // this function the Triangulation will be in the same state as it was + // at the beginning of this function. + std::vector user_flags; + dof.get_tria().save_user_flags(user_flags); + const_cast &>(dof.get_tria()).clear_user_flags (); + + internal::make_flux_sparsity_pattern (dof, sparsity, + int_mask, flux_mask); + + // finally restore the user flags + const_cast &>(dof.get_tria()).load_user_flags(user_flags); + } + + +} // end of namespace DoFTools + + +// --------------------------------------------------- explicit instantiations + +#include "dof_tools_sparsity.inst" + + + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/dofs/dof_tools_sparsity.inst.in b/deal.II/source/dofs/dof_tools_sparsity.inst.in new file mode 100644 index 0000000000..6781dbeab2 --- /dev/null +++ b/deal.II/source/dofs/dof_tools_sparsity.inst.in @@ -0,0 +1,323 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2009 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) + { + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler &dof, + SP &sparsity, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler &dof, + SP &sparsity, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const MGDoFHandler &dof, + SP &sparsity, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler&, + const Table<2,Coupling>&, + SP &, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler&, + const Table<2,Coupling>&, + SP &, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const MGDoFHandler&, + const Table<2,Coupling>&, + SP &, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler &dof_row, + const DoFHandler &dof_col, + SP &sparsity); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler &dof_row, + const hp::DoFHandler &dof_col, + SP &sparsity); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const DoFHandler& dof, + const std::vector &, + SP &); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const hp::DoFHandler& dof, + const std::vector &, + SP &); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const DoFHandler& dof, + const FunctionMap::type &boundary_indicators, + const std::vector &dof_to_boundary_mapping, + SP &sparsity); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const hp::DoFHandler& dof, + const FunctionMap::type &boundary_indicators, + const std::vector &dof_to_boundary_mapping, + SP &sparsity); + +#if deal_II_dimension < 3 + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const hp::DoFHandler& dof, + const FunctionMap::type &boundary_indicators, + const std::vector &dof_to_boundary_mapping, + SP &sparsity); + #endif + + template void + DoFTools::make_flux_sparsity_pattern,SP> + (const DoFHandler &dof, + SP &sparsity); + + template void + DoFTools::make_flux_sparsity_pattern,SP> + (const hp::DoFHandler &dof, + SP &sparsity); + +#if deal_II_dimension > 1 + + template void + DoFTools::make_flux_sparsity_pattern,SP> + (const DoFHandler &dof, + SP &, + const Table<2,Coupling>&, + const Table<2,Coupling>&); + + template void + DoFTools::make_flux_sparsity_pattern,SP> + (const DoFHandler &dof, + SP &sparsity, + const ConstraintMatrix &constraints, + const bool, const unsigned int); + + template void + DoFTools::make_flux_sparsity_pattern,SP> + (const hp::DoFHandler &dof, + SP &sparsity, + const ConstraintMatrix &constraints, + const bool, const unsigned int); + + template void + DoFTools::make_flux_sparsity_pattern,SP> + (const hp::DoFHandler &dof, + SP &, + const Table<2,Coupling>&, + const Table<2,Coupling>&); +#endif + +#if deal_II_dimension < 3 + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler &dof, + SP &sparsity, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler &dof, + SP &sparsity, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler&, + const Table<2,Coupling>&, + SP &, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler&, + const Table<2,Coupling>&, + SP &, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler &dof_row, + const DoFHandler &dof_col, + SP &sparsity); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler &dof_row, + const hp::DoFHandler &dof_col, + SP &sparsity); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const DoFHandler& dof, + const std::vector &, + SP &); + + //template void + //DoFTools::make_boundary_sparsity_pattern,SP> + //(const hp::DoFHandler& dof, + // const std::vector &, + // SP &); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const DoFHandler& dof, + const FunctionMap::type &boundary_indicators, + const std::vector &dof_to_boundary_mapping, + SP &sparsity); + + //template void + //DoFTools::make_boundary_sparsity_pattern,SP> + //(const hp::DoFHandler& dof, + // const FunctionMap::type &boundary_indicators, + // const std::vector &dof_to_boundary_mapping, + // SP &sparsity); + +#endif + + +#if deal_II_dimension == 3 + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler<1,3> &dof, + SP &sparsity, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler<1,3> &dof, + SP &sparsity, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler<1,3>&, + const Table<2,Coupling>&, + SP &, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler<1,3>&, + const Table<2,Coupling>&, + SP &, + const ConstraintMatrix &, + const bool, + const unsigned int); + + template void + DoFTools::make_sparsity_pattern, SP> + (const DoFHandler<1,3> &dof_row, + const DoFHandler<1,3> &dof_col, + SP &sparsity); + + template void + DoFTools::make_sparsity_pattern, SP> + (const hp::DoFHandler<1,3> &dof_row, + const hp::DoFHandler<1,3> &dof_col, + SP &sparsity); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const DoFHandler<1,3>& dof, + const std::vector &, + SP &); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const hp::DoFHandler<1,3>& dof, + const std::vector &, + SP &); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const DoFHandler<1,3>& dof, + const FunctionMap<3>::type &boundary_indicators, + const std::vector &dof_to_boundary_mapping, + SP &sparsity); + + template void + DoFTools::make_boundary_sparsity_pattern,SP> + (const hp::DoFHandler<1,3>& dof, + const FunctionMap<3>::type &boundary_indicators, + const std::vector &dof_to_boundary_mapping, + SP &sparsity); + +#endif + + } + + +for (deal_II_dimension : DIMENSIONS) +{ + template + Table<2,DoFTools::Coupling> + DoFTools::dof_couplings_from_component_couplings + (const FiniteElement &fe, + const Table<2,DoFTools::Coupling> &component_couplings); +} diff --git a/deal.II/source/dofs/number_cache.cc b/deal.II/source/dofs/number_cache.cc index d5c7acb12d..69c2f5aebf 100644 --- a/deal.II/source/dofs/number_cache.cc +++ b/deal.II/source/dofs/number_cache.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/dummy.cc b/deal.II/source/dummy.cc new file mode 100644 index 0000000000..f7cb351468 --- /dev/null +++ b/deal.II/source/dummy.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +/* + * Workaround for a bug in the Xcode generator. + * + * This file contains a dummy global symbol to trigger the link phase in + * the generated Xcode project. + */ + +const int _global_symbol_42 = 42; + diff --git a/deal.II/source/fe/CMakeLists.txt b/deal.II/source/fe/CMakeLists.txt index d5d3852aab..57b9e686f8 100644 --- a/deal.II/source/fe/CMakeLists.txt +++ b/deal.II/source/fe/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/fe/*.h - ) - SET(_src block_mask.cc component_mask.cc @@ -35,8 +33,8 @@ SET(_src fe_nothing.cc fe_poly.cc fe_poly_tensor.cc - fe_q.cc fe_q_base.cc + fe_q.cc fe_q_dg0.cc fe_q_hierarchical.cc fe_q_iso_q1.cc @@ -44,6 +42,7 @@ SET(_src fe_raviart_thomas_nodal.cc fe_system.cc fe_tools.cc + fe_tools_interpolate.cc fe_values.cc fe_values_inst2.cc mapping_c1.cc @@ -69,7 +68,7 @@ SET(_inst fe_nothing.inst.in fe_poly.inst.in fe_poly_tensor.inst.in - fe_q_base.inst.in + fe_q_base.inst.in fe_q_dg0.inst.in fe_q_hierarchical.inst.in fe_q.inst.in @@ -78,6 +77,7 @@ SET(_inst fe_raviart_thomas_nodal.inst.in fe_system.inst.in fe_tools.inst.in + fe_tools_interpolate.inst.in fe_values.decl.1.inst.in fe_values.decl.2.inst.in fe_values.impl.1.inst.in @@ -92,6 +92,9 @@ SET(_inst mapping_q.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/fe/*.h + ) + DEAL_II_ADD_LIBRARY(obj_fe OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_fe "${_inst}") - diff --git a/deal.II/source/fe/block_mask.cc b/deal.II/source/fe/block_mask.cc index 75ee185587..4605f3746b 100644 --- a/deal.II/source/fe/block_mask.cc +++ b/deal.II/source/fe/block_mask.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/fe/component_mask.cc b/deal.II/source/fe/component_mask.cc index 100e43443e..f937bcca99 100644 --- a/deal.II/source/fe/component_mask.cc +++ b/deal.II/source/fe/component_mask.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/fe/fe.cc b/deal.II/source/fe/fe.cc index 1a9e9f9fa4..1c4db8ffbc 100644 --- a/deal.II/source/fe/fe.cc +++ b/deal.II/source/fe/fe.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -188,16 +190,16 @@ FiniteElement::FiniteElement ( system_to_component_table.resize(this->dofs_per_cell); face_system_to_component_table.resize(this->dofs_per_face); for (unsigned int j=0 ; jdofs_per_cell ; ++j) - { - system_to_component_table[j] = std::pair(0,j); - system_to_base_table[j] = std::make_pair(std::make_pair(0U,0U),j); - } + system_to_component_table[j] = std::pair(0,j); for (unsigned int j=0 ; jdofs_per_face ; ++j) - { - face_system_to_component_table[j] = std::pair(0,j); - face_system_to_base_table[j] = std::make_pair(std::make_pair(0U,0U),j); - } + face_system_to_component_table[j] = std::pair(0,j); } + + for (unsigned int j=0 ; jdofs_per_cell ; ++j) + system_to_base_table[j] = std::make_pair(std::make_pair(0U,0U),j); + for (unsigned int j=0 ; jdofs_per_face ; ++j) + face_system_to_base_table[j] = std::make_pair(std::make_pair(0U,0U),j); + // Fill with default value; may be changed by constructor of derived class. base_to_block_indices.reinit(1,1); @@ -542,6 +544,96 @@ block_mask (const ComponentMask &component_mask) const +template +unsigned int +FiniteElement:: +face_to_cell_index (const unsigned int face_index, + const unsigned int face, + const bool face_orientation, + const bool face_flip, + const bool face_rotation) const +{ + Assert (face_index < this->dofs_per_face, + ExcIndexRange(face_index, 0, this->dofs_per_face)); + Assert (face < GeometryInfo::faces_per_cell, + ExcIndexRange(face, 0, GeometryInfo::faces_per_cell)); + +//TODO: we could presumably solve the 3d case below using the +// adjust_quad_dof_index_for_face_orientation_table field. for the +// 2d case, we can't use adjust_line_dof_index_for_line_orientation_table +// since that array is empty (presumably because we thought that +// there are no flipped edges in 2d, but these can happen in +// DoFTools::make_periodicity_constraints, for example). so we +// would need to either fill this field, or rely on derived classes +// implementing this function, as we currently do + + // see the function's documentation for an explanation of this + // assertion -- in essence, derived classes have to implement + // an overloaded version of this function if we are to use any + // other than standard orientation + if ((face_orientation != true) || (face_flip != false) || (face_rotation != false)) + Assert ((this->dofs_per_line <= 1) && (this->dofs_per_quad <= 1), + ExcMessage ("The function in this base class can not handle this case. " + "Rather, the derived class you are using must provide " + "an overloaded version but apparently hasn't done so. See " + "the documentation of this function for more information.")); + + // we need to distinguish between DoFs on vertices, lines and in 3d quads. + // do so in a sequence of if-else statements + if (face_index < this->first_face_line_index) + // DoF is on a vertex + { + // get the number of the vertex on the face that corresponds to this DoF, + // along with the number of the DoF on this vertex + const unsigned int face_vertex = face_index / this->dofs_per_vertex; + const unsigned int dof_index_on_vertex = face_index % this->dofs_per_vertex; + + // then get the number of this vertex on the cell and translate + // this to a DoF number on the cell + return (GeometryInfo::face_to_cell_vertices(face, face_vertex, + face_orientation, + face_flip, + face_rotation) + * this->dofs_per_vertex + + + dof_index_on_vertex); + } + else if (face_index < this->first_face_quad_index) + // DoF is on a face + { + // do the same kind of translation as before. we need to only consider + // DoFs on the lines, i.e., ignoring those on the vertices + const unsigned int index = face_index - this->first_face_line_index; + + const unsigned int face_line = index / this->dofs_per_line; + const unsigned int dof_index_on_line = index % this->dofs_per_line; + + return (this->first_line_index + + GeometryInfo::face_to_cell_lines(face, face_line, + face_orientation, + face_flip, + face_rotation) + * this->dofs_per_line + + + dof_index_on_line); + } + else + // DoF is on a quad + { + Assert (dim >= 3, ExcInternalError()); + + // ignore vertex and line dofs + const unsigned int index = face_index - this->first_face_quad_index; + + return (this->first_quad_index + + face * this->dofs_per_quad + + index); + } +} + + + + template unsigned int FiniteElement::adjust_quad_dof_index_for_face_orientation (const unsigned int index, diff --git a/deal.II/source/fe/fe.inst.in b/deal.II/source/fe/fe.inst.in index f9ff03fcfd..f73ecc0b25 100644 --- a/deal.II/source/fe/fe.inst.in +++ b/deal.II/source/fe/fe.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_abf.cc b/deal.II/source/fe/fe_abf.cc index 6e9ba46271..fd5262f3e1 100644 --- a/deal.II/source/fe/fe_abf.cc +++ b/deal.II/source/fe/fe_abf.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_abf.inst.in b/deal.II/source/fe/fe_abf.inst.in index 39c7426305..4c3d98f38e 100644 --- a/deal.II/source/fe/fe_abf.inst.in +++ b/deal.II/source/fe/fe_abf.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_bdm.cc b/deal.II/source/fe/fe_bdm.cc index 0eb002635b..5f53049c90 100644 --- a/deal.II/source/fe/fe_bdm.cc +++ b/deal.II/source/fe/fe_bdm.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_bdm.inst.in b/deal.II/source/fe/fe_bdm.inst.in index 314d27c5e9..78bf3e9d7f 100644 --- a/deal.II/source/fe/fe_bdm.inst.in +++ b/deal.II/source/fe/fe_bdm.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_data.cc b/deal.II/source/fe/fe_data.cc index b61729db0f..894e3c3f18 100644 --- a/deal.II/source/fe/fe_data.cc +++ b/deal.II/source/fe/fe_data.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -97,54 +99,6 @@ bool FiniteElementData::operator== (const FiniteElementData &f) const (conforming_space == f.conforming_space)); } -template -unsigned int -FiniteElementData:: -face_to_cell_index (const unsigned int face_index, - const unsigned int face, - const bool face_orientation, - const bool face_flip, - const bool face_rotation) const -{ - Assert (face_index < this->dofs_per_face, - ExcIndexRange(face_index, 0, this->dofs_per_face)); - Assert (face < GeometryInfo::faces_per_cell, - ExcIndexRange(face, 0, GeometryInfo::faces_per_cell)); - - // DoF on a vertex - if (face_index < this->first_face_line_index) - { - // Vertex number on the face - const unsigned int face_vertex = face_index / this->dofs_per_vertex; - return face_index % this->dofs_per_vertex - + GeometryInfo::face_to_cell_vertices(face, face_vertex, - face_orientation, - face_flip, - face_rotation) - * this->dofs_per_vertex; - } - // Else, DoF on a line? - if (face_index < this->first_face_quad_index) - { - // Ignore vertex dofs - const unsigned int index = face_index - this->first_face_line_index; - // Line number on the face - const unsigned int face_line = index / this->dofs_per_line; - return this->first_line_index + index % this->dofs_per_line - + GeometryInfo::face_to_cell_lines(face, face_line, - face_orientation, - face_flip, - face_rotation) - * this->dofs_per_line; - } - // Else, DoF is on a quad - - // Ignore vertex and line dofs - const unsigned int index = face_index - this->first_face_quad_index; - return this->first_quad_index + index - + face * this->dofs_per_quad; -} - template class FiniteElementData<1>; template class FiniteElementData<2>; diff --git a/deal.II/source/fe/fe_dg_vector.cc b/deal.II/source/fe/fe_dg_vector.cc index 1ce4b1b456..a22345159f 100644 --- a/deal.II/source/fe/fe_dg_vector.cc +++ b/deal.II/source/fe/fe_dg_vector.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_dg_vector.inst.in b/deal.II/source/fe/fe_dg_vector.inst.in index 1bb7dcb6b0..8c2cba0254 100644 --- a/deal.II/source/fe/fe_dg_vector.inst.in +++ b/deal.II/source/fe/fe_dg_vector.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_dgp.cc b/deal.II/source/fe/fe_dgp.cc index 3b42c6ce30..1c4d07bc3e 100644 --- a/deal.II/source/fe/fe_dgp.cc +++ b/deal.II/source/fe/fe_dgp.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -28,9 +32,8 @@ FE_DGP::FE_DGP (const unsigned int degree) std::vector(FiniteElementData( get_dpo_vector(degree), 1, degree).dofs_per_cell, std::vector(1,true))) { - // Reinit the vectors of - // restriction and prolongation - // matrices to the right sizes + // Reinit the vectors of restriction and prolongation matrices to the right + // sizes this->reinit_restriction_and_prolongation_matrices(); // Fill prolongation matrices with embedding operators if (dim == spacedim) @@ -46,12 +49,9 @@ template std::string FE_DGP::get_name () const { - // note that the - // FETools::get_fe_from_name - // function depends on the - // particular format of the string - // this function returns, so they - // have to be kept in synch + // note that the FETools::get_fe_from_name function depends on the + // particular format of the string this function returns, so they have to be + // kept in synch std::ostringstream namebuf; namebuf << "FE_DGP<" << dim << ">(" << this->degree << ")"; @@ -97,12 +97,10 @@ FE_DGP:: get_face_interpolation_matrix (const FiniteElement &x_source_fe, FullMatrix &interpolation_matrix) const { - // this is only implemented, if the source - // FE is also a DGP element. in that case, - // both elements have no dofs on their - // faces and the face interpolation matrix - // is necessarily empty -- i.e. there isn't - // much we need to do here. + // this is only implemented, if the source FE is also a DGP element. in that + // case, both elements have no dofs on their faces and the face + // interpolation matrix is necessarily empty -- i.e. there isn't much we + // need to do here. typedef FiniteElement FE; typedef FE_DGP FEDGP; AssertThrow ((x_source_fe.get_name().find ("FE_DGP<") == 0) @@ -128,12 +126,10 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe const unsigned int , FullMatrix &interpolation_matrix) const { - // this is only implemented, if the source - // FE is also a DGP element. in that case, - // both elements have no dofs on their - // faces and the face interpolation matrix - // is necessarily empty -- i.e. there isn't - // much we need to do here. + // this is only implemented, if the source FE is also a DGP element. in that + // case, both elements have no dofs on their faces and the face + // interpolation matrix is necessarily empty -- i.e. there isn't much we + // need to do here. typedef FiniteElement FE; typedef FE_DGP FEDGP; AssertThrow ((x_source_fe.get_name().find ("FE_DGP<") == 0) @@ -166,8 +162,7 @@ std::vector > FE_DGP:: hp_vertex_dof_identities (const FiniteElement &fe_other) const { - // there are no such constraints for DGP - // elements at all + // there are no such constraints for DGP elements at all if (dynamic_cast*>(&fe_other) != 0) return std::vector > (); @@ -185,8 +180,7 @@ std::vector > FE_DGP:: hp_line_dof_identities (const FiniteElement &fe_other) const { - // there are no such constraints for DGP - // elements at all + // there are no such constraints for DGP elements at all if (dynamic_cast*>(&fe_other) != 0) return std::vector > (); @@ -204,8 +198,7 @@ std::vector > FE_DGP:: hp_quad_dof_identities (const FiniteElement &fe_other) const { - // there are no such constraints for DGP - // elements at all + // there are no such constraints for DGP elements at all if (dynamic_cast*>(&fe_other) != 0) return std::vector > (); @@ -222,8 +215,7 @@ template FiniteElementDomination::Domination FE_DGP::compare_for_face_domination (const FiniteElement &fe_other) const { - // check whether both are discontinuous - // elements, see the description of + // check whether both are discontinuous elements, see the description of // FiniteElementDomination::Domination if (dynamic_cast*>(&fe_other) != 0) return FiniteElementDomination::no_requirements; @@ -239,8 +231,7 @@ bool FE_DGP::has_support_on_face (const unsigned int, const unsigned int) const { - // all shape functions have support on all - // faces + // all shape functions have support on all faces return true; } diff --git a/deal.II/source/fe/fe_dgp.inst.in b/deal.II/source/fe/fe_dgp.inst.in index e28b03e1b8..060ba1f7e4 100644 --- a/deal.II/source/fe/fe_dgp.inst.in +++ b/deal.II/source/fe/fe_dgp.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_dgp_monomial.cc b/deal.II/source/fe/fe_dgp_monomial.cc index 37a934fbbc..fca8e76c69 100644 --- a/deal.II/source/fe/fe_dgp_monomial.cc +++ b/deal.II/source/fe/fe_dgp_monomial.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_dgp_monomial.inst.in b/deal.II/source/fe/fe_dgp_monomial.inst.in index 401fe4df15..71da79061f 100644 --- a/deal.II/source/fe/fe_dgp_monomial.inst.in +++ b/deal.II/source/fe/fe_dgp_monomial.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_dgp_nonparametric.cc b/deal.II/source/fe/fe_dgp_nonparametric.cc index fccbec69f8..abecac8462 100644 --- a/deal.II/source/fe/fe_dgp_nonparametric.cc +++ b/deal.II/source/fe/fe_dgp_nonparametric.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_dgp_nonparametric.inst.in b/deal.II/source/fe/fe_dgp_nonparametric.inst.in index 7e6cfe9486..48069e7969 100644 --- a/deal.II/source/fe/fe_dgp_nonparametric.inst.in +++ b/deal.II/source/fe/fe_dgp_nonparametric.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_dgq.cc b/deal.II/source/fe/fe_dgq.cc index 0431bfc0fe..07139d90a8 100644 --- a/deal.II/source/fe/fe_dgq.cc +++ b/deal.II/source/fe/fe_dgq.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_dgq.inst.in b/deal.II/source/fe/fe_dgq.inst.in index ebef67e748..f9c6ccb13d 100644 --- a/deal.II/source/fe/fe_dgq.inst.in +++ b/deal.II/source/fe/fe_dgq.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_face.cc b/deal.II/source/fe/fe_face.cc index 85812d966c..641e20a684 100644 --- a/deal.II/source/fe/fe_face.cc +++ b/deal.II/source/fe/fe_face.cc @@ -1,27 +1,48 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include +#include +#include +#include +#include #include DEAL_II_NAMESPACE_OPEN + +namespace +{ + std::vector > + get_QGaussLobatto_points (const unsigned int degree) + { + if (degree > 0) + return QGaussLobatto<1>(degree+1).get_points(); + else + return std::vector >(1, Point<1>(0.5)); + } +} + template FE_FaceQ::FE_FaceQ (const unsigned int degree) : FE_PolyFace, dim, spacedim> ( - TensorProductPolynomials(Polynomials::LagrangeEquidistant::generate_complete_basis(degree)), + TensorProductPolynomials(Polynomials::generate_complete_Lagrange_basis(get_QGaussLobatto_points(degree))), FiniteElementData(get_dpo_vector(degree), 1, degree, FiniteElementData::L2), std::vector(1,true)) { @@ -34,27 +55,49 @@ FE_FaceQ::FE_FaceQ (const unsigned int degree) this->unit_face_support_points[0][d] = 0.5; else { - const double step = 1./this->degree; - Point p; + std::vector > points = get_QGaussLobatto_points(degree); unsigned int k=0; for (unsigned int iz=0; iz <= ((codim>2) ? this->degree : 0) ; ++iz) for (unsigned int iy=0; iy <= ((codim>1) ? this->degree : 0) ; ++iy) for (unsigned int ix=0; ix<=this->degree; ++ix) { - p(0) = ix * step; + Point p; + + p(0) = points[ix][0]; if (codim>1) - p(1) = iy * step; + p(1) = points[iy][0]; if (codim>2) - p(2) = iz * step; + p(2) = points[iz][0]; this->unit_face_support_points[k++] = p; } AssertDimension (k, this->unit_face_support_points.size()); } + + // initialize unit support points (this makes it possible to assign initial + // values to FE_FaceQ) + this->unit_support_points.resize(GeometryInfo::faces_per_cell* + this->unit_face_support_points.size()); + const unsigned int n_face_dofs = this->unit_face_support_points.size(); + for (unsigned int i=0; iunit_support_points[n_face_dofs*2*d+i][e] = + this->unit_face_support_points[i][c]; + this->unit_support_points[n_face_dofs*(2*d+1)+i][e] = + this->unit_face_support_points[i][c]; + this->unit_support_points[n_face_dofs*(2*d+1)+i][d] = 1; + ++c; + } + } } + template FiniteElement * FE_FaceQ::clone() const @@ -63,17 +106,14 @@ FE_FaceQ::clone() const } + template std::string FE_FaceQ::get_name () const { - // note that the - // FETools::get_fe_from_name - // function depends on the - // particular format of the string - // this function returns, so they - // have to be kept in synch - + // note that the FETools::get_fe_from_name function depends on the + // particular format of the string this function returns, so they have to be + // kept in synch std::ostringstream namebuf; namebuf << "FE_FaceQ<" << dim << ">(" << this->degree << ")"; @@ -82,6 +122,107 @@ FE_FaceQ::get_name () const +template +void +FE_FaceQ:: +get_face_interpolation_matrix (const FiniteElement &source_fe, + FullMatrix &interpolation_matrix) const +{ + get_subface_interpolation_matrix (source_fe, numbers::invalid_unsigned_int, + interpolation_matrix); +} + + + +template +void +FE_FaceQ:: +get_subface_interpolation_matrix (const FiniteElement &x_source_fe, + const unsigned int subface, + FullMatrix &interpolation_matrix) const +{ + // this function is similar to the respective method in FE_Q + + Assert (interpolation_matrix.n() == this->dofs_per_face, + ExcDimensionMismatch (interpolation_matrix.n(), + this->dofs_per_face)); + Assert (interpolation_matrix.m() == x_source_fe.dofs_per_face, + ExcDimensionMismatch (interpolation_matrix.m(), + x_source_fe.dofs_per_face)); + + // see if source is a FaceQ element + if (const FE_FaceQ *source_fe + = dynamic_cast *>(&x_source_fe)) + { + + // Make sure that the element for which the DoFs should be constrained + // is the one with the higher polynomial degree. Actually the procedure + // will work also if this assertion is not satisfied. But the matrices + // produced in that case might lead to problems in the hp procedures, + // which use this method. + Assert (this->dofs_per_face <= source_fe->dofs_per_face, + (typename FiniteElement:: + ExcInterpolationNotImplemented ())); + + // generate a quadrature with the unit face support points. + const Quadrature face_quadrature (source_fe->get_unit_face_support_points ()); + + // Rule of thumb for FP accuracy, that can be expected for a given + // polynomial degree. This value is used to cut off values close to + // zero. + const double eps = 2e-13*(this->degree+1)*(dim-1); + + // compute the interpolation matrix by simply taking the value at the + // support points. + for (unsigned int i=0; idofs_per_face; ++i) + { + const Point p = + subface == numbers::invalid_unsigned_int + ? + face_quadrature.point(i) + : + GeometryInfo::child_to_cell_coordinates (face_quadrature.point(i), + subface); + + for (unsigned int j=0; jdofs_per_face; ++j) + { + double matrix_entry = this->poly_space.compute_value (j, p); + + // Correct the interpolated value. I.e. if it is close to 1 or 0, + // make it exactly 1 or 0. Unfortunately, this is required to avoid + // problems with higher order elements. + if (std::fabs (matrix_entry - 1.0) < eps) + matrix_entry = 1.0; + if (std::fabs (matrix_entry) < eps) + matrix_entry = 0.0; + + interpolation_matrix(i,j) = matrix_entry; + } + } + + // make sure that the row sum of each of the matrices is 1 at this + // point. this must be so since the shape functions sum up to 1 + for (unsigned int j=0; jdofs_per_face; ++j) + { + double sum = 0.; + + for (unsigned int i=0; idofs_per_face; ++i) + sum += interpolation_matrix(j,i); + + Assert (std::fabs(sum-1) < eps, ExcInternalError()); + } + } + else if (dynamic_cast *>(&x_source_fe) != 0) + { + // nothing to do here, the FE_Nothing has no degrees of freedom anyway + } + else + AssertThrow (false,(typename FiniteElement:: + ExcInterpolationNotImplemented())); +} + + + template bool FE_FaceQ::has_support_on_face ( @@ -92,6 +233,7 @@ FE_FaceQ::has_support_on_face ( } + template std::vector FE_FaceQ::get_dpo_vector (const unsigned int deg) @@ -105,6 +247,255 @@ FE_FaceQ::get_dpo_vector (const unsigned int deg) +template +bool +FE_FaceQ::hp_constraints_are_implemented () const +{ + return true; +} + + + +template +FiniteElementDomination::Domination +FE_FaceQ:: +compare_for_face_domination (const FiniteElement &fe_other) const +{ + if (const FE_FaceQ *fe_q_other + = dynamic_cast*>(&fe_other)) + { + if (this->degree < fe_q_other->degree) + return FiniteElementDomination::this_element_dominates; + else if (this->degree == fe_q_other->degree) + return FiniteElementDomination::either_element_can_dominate; + else + return FiniteElementDomination::other_element_dominates; + } + else if (dynamic_cast*>(&fe_other) != 0) + { + // the FE_Nothing has no degrees of freedom and it is typically used in + // a context where we don't require any continuity along the interface + return FiniteElementDomination::no_requirements; + } + + Assert (false, ExcNotImplemented()); + return FiniteElementDomination::neither_element_dominates; +} + + + +// --------------------------------------- FE_FaceP -------------------------- + +template +FE_FaceP::FE_FaceP (const unsigned int degree) + : + FE_PolyFace, dim, spacedim> + (PolynomialSpace(Polynomials::Legendre::generate_complete_basis(degree)), + FiniteElementData(get_dpo_vector(degree), 1, degree, FiniteElementData::L2), + std::vector(1,true)) +{} + + +template +FiniteElement * +FE_FaceP::clone() const +{ + return new FE_FaceP(this->degree); +} + + +template +std::string +FE_FaceP::get_name () const +{ + // note that the FETools::get_fe_from_name function depends on the + // particular format of the string this function returns, so they have to be + // kept in synch + std::ostringstream namebuf; + namebuf << "FE_FaceP<" << dim << ">(" << this->degree << ")"; + + return namebuf.str(); +} + + + +template +bool +FE_FaceP::has_support_on_face ( + const unsigned int shape_index, + const unsigned int face_index) const +{ + return (face_index == (shape_index/this->dofs_per_face)); +} + + + +template +std::vector +FE_FaceP::get_dpo_vector (const unsigned int deg) +{ + std::vector dpo(dim+1, 0U); + dpo[dim-1] = deg+1; + for (unsigned int i=1; i +bool +FE_FaceP::hp_constraints_are_implemented () const +{ + return true; +} + + + +template +FiniteElementDomination::Domination +FE_FaceP:: +compare_for_face_domination (const FiniteElement &fe_other) const +{ + if (const FE_FaceP *fe_q_other + = dynamic_cast*>(&fe_other)) + { + if (this->degree < fe_q_other->degree) + return FiniteElementDomination::this_element_dominates; + else if (this->degree == fe_q_other->degree) + return FiniteElementDomination::either_element_can_dominate; + else + return FiniteElementDomination::other_element_dominates; + } + else if (dynamic_cast*>(&fe_other) != 0) + { + // the FE_Nothing has no degrees of freedom and it is typically used in + // a context where we don't require any continuity along the interface + return FiniteElementDomination::no_requirements; + } + + Assert (false, ExcNotImplemented()); + return FiniteElementDomination::neither_element_dominates; +} + + + + +template +void +FE_FaceP:: +get_face_interpolation_matrix (const FiniteElement &source_fe, + FullMatrix &interpolation_matrix) const +{ + get_subface_interpolation_matrix (source_fe, numbers::invalid_unsigned_int, + interpolation_matrix); +} + + + +template +void +FE_FaceP:: +get_subface_interpolation_matrix (const FiniteElement &x_source_fe, + const unsigned int subface, + FullMatrix &interpolation_matrix) const +{ + // this function is similar to the respective method in FE_Q + + Assert (interpolation_matrix.n() == this->dofs_per_face, + ExcDimensionMismatch (interpolation_matrix.n(), + this->dofs_per_face)); + Assert (interpolation_matrix.m() == x_source_fe.dofs_per_face, + ExcDimensionMismatch (interpolation_matrix.m(), + x_source_fe.dofs_per_face)); + + // see if source is a FaceP element + if (const FE_FaceP *source_fe + = dynamic_cast *>(&x_source_fe)) + { + // Make sure that the element for which the DoFs should be constrained + // is the one with the higher polynomial degree. Actually the procedure + // will work also if this assertion is not satisfied. But the matrices + // produced in that case might lead to problems in the hp procedures, + // which use this method. + Assert (this->dofs_per_face <= source_fe->dofs_per_face, + (typename FiniteElement:: + ExcInterpolationNotImplemented ())); + + // do this as in FETools by solving a least squares problem where we + // force the source FE polynomial to be equal the given FE on all + // quadrature points + const QGauss face_quadrature (source_fe->degree+1); + + // Rule of thumb for FP accuracy, that can be expected for a given + // polynomial degree. This value is used to cut off values close to + // zero. + const double eps = 2e-13*(this->degree+1)*(dim-1); + + FullMatrix mass (face_quadrature.size(), source_fe->dofs_per_face); + + for (unsigned int k = 0; k < face_quadrature.size(); ++k) + { + const Point p = + subface == numbers::invalid_unsigned_int ? + face_quadrature.point(k) : + GeometryInfo::child_to_cell_coordinates (face_quadrature.point(k), + subface); + + for (unsigned int j = 0; j < source_fe->dofs_per_face; ++j) + mass (k , j) = source_fe->poly_space.compute_value(j, p); + } + + Householder H(mass); + Vector v_in(face_quadrature.size()); + Vector v_out(source_fe->dofs_per_face); + + + // compute the interpolation matrix by evaluating on the fine side and + // then solving the least squares problem + for (unsigned int i=0; idofs_per_face; ++i) + { + for (unsigned int k = 0; k < face_quadrature.size(); ++k) + { + const Point p = numbers::invalid_unsigned_int ? + face_quadrature.point(k) : + GeometryInfo::child_to_cell_coordinates (face_quadrature.point(k), + subface); + v_in(k) = this->poly_space.compute_value(i, p); + } + const double result = H.least_squares(v_out, v_in); + Assert(result < 1e-12, FETools::ExcLeastSquaresError (result)); + + for (unsigned int j = 0; j < source_fe->dofs_per_face; ++j) + { + double matrix_entry = v_out(j); + + // Correct the interpolated value. I.e. if it is close to 1 or 0, + // make it exactly 1 or 0. Unfortunately, this is required to avoid + // problems with higher order elements. + if (std::fabs (matrix_entry - 1.0) < eps) + matrix_entry = 1.0; + if (std::fabs (matrix_entry) < eps) + matrix_entry = 0.0; + + interpolation_matrix(j,i) = matrix_entry; + } + } + } + else if (dynamic_cast *>(&x_source_fe) != 0) + { + // nothing to do here, the FE_Nothing has no degrees of freedom anyway + } + else + AssertThrow (false,(typename FiniteElement:: + ExcInterpolationNotImplemented())); +} + + // explicit instantiations #include "fe_face.inst" diff --git a/deal.II/source/fe/fe_face.inst.in b/deal.II/source/fe/fe_face.inst.in index 631a8f52f6..513eb0030b 100644 --- a/deal.II/source/fe/fe_face.inst.in +++ b/deal.II/source/fe/fe_face.inst.in @@ -1,24 +1,29 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { #if deal_II_dimension > 1 template class FE_PolyFace >; - //template class FE_PolyFace, deal_II_dimension>; + template class FE_PolyFace, deal_II_dimension>; //template class FE_PolyFace, deal_II_dimension>; template class FE_FaceQ; + template class FE_FaceP; #endif } diff --git a/deal.II/source/fe/fe_nedelec.cc b/deal.II/source/fe/fe_nedelec.cc index 4410551a5d..f14d895076 100644 --- a/deal.II/source/fe/fe_nedelec.cc +++ b/deal.II/source/fe/fe_nedelec.cc @@ -1,3 +1,19 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include #include @@ -230,7 +246,7 @@ FE_Nedelec<2>::initialize_support_points (const unsigned int degree) // Initialize quadratures to obtain // quadrature points later on. const QGauss reference_edge_quadrature (degree + 1); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); const unsigned int n_boundary_points = GeometryInfo::lines_per_cell * n_edge_points; @@ -511,7 +527,7 @@ FE_Nedelec::initialize_restriction () const QGauss<1> edge_quadrature (2 * this->degree); const std::vector > &edge_quadrature_points = edge_quadrature.get_points (); - const unsigned int& + const unsigned int & n_edge_quadrature_points = edge_quadrature.size (); const unsigned int index = RefinementCase::isotropic_refinement - 1; @@ -3290,7 +3306,7 @@ FE_Nedelec::interpolate (std::vector &local_dofs, { const QGauss<1> reference_edge_quadrature (this->degree); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); // Let us begin with the @@ -4151,7 +4167,7 @@ FE_Nedelec::interpolate (std::vector &local_dofs, // the interior shape // functions. const QGauss reference_quadrature (this->degree); - const unsigned int& + const unsigned int & n_interior_points = reference_quadrature.size (); // We create the @@ -4556,7 +4572,7 @@ const // Let us begin with the // interpolation part. const QGauss reference_edge_quadrature (this->degree); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); for (unsigned int i = 0; i < 2; ++i) @@ -4672,7 +4688,7 @@ const // vertical, interior // shape functions. const QGauss reference_quadrature (this->degree); - const unsigned int& + const unsigned int & n_interior_points = reference_quadrature.size (); const std::vector > & legendre_polynomials @@ -4827,7 +4843,7 @@ const // Let us begin with the // interpolation part. const QGauss<1> reference_edge_quadrature (this->degree); - const unsigned int& + const unsigned int & n_edge_points = reference_edge_quadrature.size (); for (unsigned int q_point = 0; q_point < n_edge_points; ++q_point) diff --git a/deal.II/source/fe/fe_nedelec.inst.in b/deal.II/source/fe/fe_nedelec.inst.in index 72a5fe8d82..62125b0440 100644 --- a/deal.II/source/fe/fe_nedelec.inst.in +++ b/deal.II/source/fe/fe_nedelec.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_nothing.cc b/deal.II/source/fe/fe_nothing.cc index 71b32f25d7..a37f386811 100644 --- a/deal.II/source/fe/fe_nothing.cc +++ b/deal.II/source/fe/fe_nothing.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/fe/fe_nothing.inst.in b/deal.II/source/fe/fe_nothing.inst.in index b2eb93ec76..28d87008e9 100644 --- a/deal.II/source/fe/fe_nothing.inst.in +++ b/deal.II/source/fe/fe_nothing.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_poly.cc b/deal.II/source/fe/fe_poly.cc index 2c1ba722ea..40e7eab991 100644 --- a/deal.II/source/fe/fe_poly.cc +++ b/deal.II/source/fe/fe_poly.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_poly.inst.in b/deal.II/source/fe/fe_poly.inst.in index 50ad8f5f85..5ac8c5c78c 100644 --- a/deal.II/source/fe/fe_poly.inst.in +++ b/deal.II/source/fe/fe_poly.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_poly_tensor.cc b/deal.II/source/fe/fe_poly_tensor.cc index 8d5562849c..9f6460c363 100644 --- a/deal.II/source/fe/fe_poly_tensor.cc +++ b/deal.II/source/fe/fe_poly_tensor.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -37,9 +41,9 @@ namespace * given cell. */ void - get_face_sign_change (const Triangulation<1>::cell_iterator &, - const unsigned int , - std::vector &face_sign) + get_face_sign_change_rt (const Triangulation<1>::cell_iterator &, + const unsigned int , + std::vector &face_sign) { // nothing to do in 1d std::fill (face_sign.begin (), face_sign.end (), 1.0); @@ -48,9 +52,9 @@ namespace void - get_face_sign_change (const Triangulation<2>::cell_iterator &cell, - const unsigned int dofs_per_face, - std::vector &face_sign) + get_face_sign_change_rt (const Triangulation<2>::cell_iterator &cell, + const unsigned int dofs_per_face, + std::vector &face_sign) { const unsigned int dim = 2; const unsigned int spacedim = 2; @@ -83,13 +87,47 @@ namespace void - get_face_sign_change (const Triangulation<3>::cell_iterator &/*cell*/, - const unsigned int /*dofs_per_face*/, - std::vector &face_sign) + get_face_sign_change_rt (const Triangulation<3>::cell_iterator &cell, + const unsigned int dofs_per_face, + std::vector &face_sign) + { + std::fill (face_sign.begin (), face_sign.end (), 1.0); +//TODO: think about what it would take here + } + + void + get_face_sign_change_nedelec (const Triangulation<1>::cell_iterator &, + const unsigned int , + std::vector &face_sign) + { + // nothing to do in 1d + std::fill (face_sign.begin (), face_sign.end (), 1.0); + } + + + + void + get_face_sign_change_nedelec (const Triangulation<2>::cell_iterator &cell, + const unsigned int dofs_per_face, + std::vector &face_sign) { std::fill (face_sign.begin (), face_sign.end (), 1.0); //TODO: think about what it would take here } + + + void + get_face_sign_change_nedelec (const Triangulation<3>::cell_iterator &cell, + const unsigned int dofs_per_face, + std::vector &face_sign) + { + const unsigned int dim = 3; + std::fill (face_sign.begin (), face_sign.end (), 1.0); +//TODO: This is probably only going to work for those elements for which all dofs are face dofs + for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; ++l) + if (!(cell->line_orientation (l))) + face_sign[l] = -1.0; + } } @@ -383,13 +421,18 @@ FE_PolyTensor::fill_fe_values ( // Compute eventual sign changes depending on the neighborhood // between two faces. std::vector sign_change (this->dofs_per_cell, 1.0); - get_face_sign_change (cell, this->dofs_per_face, sign_change); + if (mapping_type == mapping_raviart_thomas) + get_face_sign_change_rt (cell, this->dofs_per_face, sign_change); + + else if (mapping_type == mapping_nedelec) + get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); // for Piola mapping, the similarity // concept cannot be used because of // possible sign changes from one cell to // the next. - if ( (mapping_type == mapping_piola) || (mapping_type == mapping_raviart_thomas) ) + if ( (mapping_type == mapping_piola) || (mapping_type == mapping_raviart_thomas) + || (mapping_type == mapping_nedelec)) if (cell_similarity == CellSimilarity::translation) cell_similarity = CellSimilarity::none; @@ -444,7 +487,7 @@ FE_PolyTensor::fill_fe_values ( for (unsigned int k = 0; k < n_q_points; ++k) for (unsigned int d = 0; d < dim; ++d) - data.shape_values(first+d,k) = shape_values[k][d]; + data.shape_values(first+d,k) = sign_change[i] * shape_values[k][d]; break; } @@ -530,8 +573,7 @@ FE_PolyTensor::fill_fe_values ( for (unsigned int k = 0; k < n_q_points; ++k) for (unsigned int d = 0; d < dim; ++d) - data.shape_gradients[first + d][k] = shape_grads1[k][d]; - // then copy over to target: + data.shape_gradients[first + d][k] = sign_change[i] * shape_grads1[k][d]; break; } @@ -591,7 +633,12 @@ FE_PolyTensor::fill_fe_face_values ( // Compute eventual sign changes depending // on the neighborhood between two faces. std::vector sign_change (this->dofs_per_cell, 1.0); - get_face_sign_change (cell, this->dofs_per_face, sign_change); + + if (mapping_type == mapping_raviart_thomas) + get_face_sign_change_rt (cell, this->dofs_per_face, sign_change); + + else if (mapping_type == mapping_nedelec) + get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); for (unsigned int i=0; idofs_per_cell; ++i) { @@ -646,7 +693,7 @@ FE_PolyTensor::fill_fe_face_values ( for (unsigned int k = 0; k < n_q_points; ++k) for (unsigned int d = 0; d < dim; ++d) - data.shape_values(first+d,k) = shape_values[k][d]; + data.shape_values(first+d,k) = sign_change[i] * shape_values[k][d]; break; } @@ -732,8 +779,8 @@ FE_PolyTensor::fill_fe_face_values ( for (unsigned int k = 0; k < n_q_points; ++k) for (unsigned int d = 0; d < dim; ++d) - data.shape_gradients[first + d][k] = shape_grads1[k][d]; - // then copy over to target: + data.shape_gradients[first + d][k] = sign_change[i] * shape_grads1[k][d]; + break; } @@ -795,7 +842,12 @@ FE_PolyTensor::fill_fe_subface_values ( // Compute eventual sign changes depending // on the neighborhood between two faces. std::vector sign_change (this->dofs_per_cell, 1.0); - get_face_sign_change (cell, this->dofs_per_face, sign_change); + + if (mapping_type == mapping_raviart_thomas) + get_face_sign_change_rt (cell, this->dofs_per_face, sign_change); + + else if (mapping_type == mapping_nedelec) + get_face_sign_change_nedelec (cell, this->dofs_per_face, sign_change); for (unsigned int i=0; idofs_per_cell; ++i) { @@ -849,7 +901,7 @@ FE_PolyTensor::fill_fe_subface_values ( for (unsigned int k = 0; k < n_q_points; ++k) for (unsigned int d = 0; d < dim; ++d) - data.shape_values(first+d,k) = shape_values[k][d]; + data.shape_values(first+d,k) = sign_change[i] * shape_values[k][d]; break; } diff --git a/deal.II/source/fe/fe_poly_tensor.inst.in b/deal.II/source/fe/fe_poly_tensor.inst.in index 945f4670d7..8e44bd2903 100644 --- a/deal.II/source/fe/fe_poly_tensor.inst.in +++ b/deal.II/source/fe/fe_poly_tensor.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_q.cc b/deal.II/source/fe/fe_q.cc index 5e281b948d..207187093a 100644 --- a/deal.II/source/fe/fe_q.cc +++ b/deal.II/source/fe/fe_q.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_q.inst.in b/deal.II/source/fe/fe_q.inst.in index 3f1dc35893..8e9d1c7356 100644 --- a/deal.II/source/fe/fe_q.inst.in +++ b/deal.II/source/fe/fe_q.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_q_base.cc b/deal.II/source/fe/fe_q_base.cc index a8a966b7b5..40096c09cf 100644 --- a/deal.II/source/fe/fe_q_base.cc +++ b/deal.II/source/fe/fe_q_base.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -455,71 +459,90 @@ FE_Q_Base:: get_interpolation_matrix (const FiniteElement &x_source_fe, FullMatrix &interpolation_matrix) const { - // this is only implemented, if the source FE is also a Q element - AssertThrow ((dynamic_cast *>(&x_source_fe) != 0), - (typename FiniteElement::ExcInterpolationNotImplemented())); + // go through the list of elements we can interpolate from + if (const FE_Q_Base *source_fe + = dynamic_cast*>(&x_source_fe)) + { + // ok, source is a Q element, so we will be able to do the work + Assert (interpolation_matrix.m() == this->dofs_per_cell, + ExcDimensionMismatch (interpolation_matrix.m(), + this->dofs_per_cell)); + Assert (interpolation_matrix.n() == x_source_fe.dofs_per_cell, + ExcDimensionMismatch (interpolation_matrix.m(), + x_source_fe.dofs_per_cell)); + + // only evaluate Q dofs + const unsigned int q_dofs_per_cell = Utilities::fixed_power(this->degree+1); + const unsigned int source_q_dofs_per_cell = Utilities::fixed_power(source_fe->degree+1); - Assert (interpolation_matrix.m() == this->dofs_per_cell, - ExcDimensionMismatch (interpolation_matrix.m(), - this->dofs_per_cell)); - Assert (interpolation_matrix.n() == x_source_fe.dofs_per_cell, - ExcDimensionMismatch (interpolation_matrix.m(), - x_source_fe.dofs_per_cell)); + // evaluation is simply done by evaluating the other FE's basis functions on + // the unit support points (FE_Q has the property that the cell + // interpolation matrix is a unit matrix, so no need to evaluate it and + // invert it) + for (unsigned int j=0; j p = this->unit_support_points[j]; - // ok, source is a Q element, so we will be able to do the work - const FE_Q_Base &source_fe - = dynamic_cast&>(x_source_fe); + // FE_Q element evaluates to 1 in unit support point and to zero in all + // other points by construction + Assert(std::abs(this->poly_space.compute_value (j, p)-1.)<1e-13, + ExcInternalError()); - // only evaluate Q dofs - const unsigned int q_dofs_per_cell = Utilities::fixed_power(this->degree+1); - const unsigned int source_q_dofs_per_cell = Utilities::fixed_power(source_fe.degree+1); + for (unsigned int i=0; ipoly_space.compute_value (i, p); + } - // evaluation is simply done by evaluating the other FE's basis functions on - // the unit support points (FE_Q has the property that the cell - // interpolation matrix is a unit matrix, so no need to evaluate it and - // invert it) - for (unsigned int j=0; j p = this->unit_support_points[j]; + // for FE_Q_DG0, add one last row of identity + if (q_dofs_per_cell < this->dofs_per_cell) + { + AssertDimension(source_q_dofs_per_cell+1, source_fe->dofs_per_cell); + for (unsigned int i=0; ipoly_space.compute_value (j, p)-1.)<1e-13, - ExcInternalError()); + // cut off very small values + const double eps = 2e-13*this->degree*dim; + for (unsigned int i=0; idofs_per_cell; ++i) + for (unsigned int j=0; jdofs_per_cell; ++j) + if (std::fabs(interpolation_matrix(i,j)) < eps) + interpolation_matrix(i,j) = 0.; - for (unsigned int i=0; idofs_per_cell; ++i) + { + double sum = 0.; + for (unsigned int j=0; jdofs_per_cell; ++j) + sum += interpolation_matrix(i,j); - // for FE_Q_DG0, add one last row of identity - if (q_dofs_per_cell < this->dofs_per_cell) - { - AssertDimension(source_q_dofs_per_cell+1, source_fe.dofs_per_cell); - for (unsigned int i=0; idegree*dim; - for (unsigned int i=0; idofs_per_cell; ++i) - for (unsigned int j=0; jdofs_per_cell; ++i) + else if (dynamic_cast*>(&x_source_fe)) { - double sum = 0.; - for (unsigned int j=0; jdofs_per_cell and zero. unfortunately, + // whenever we do FullMatrix::reinit(m,0), it sets both rows and + // columns to zero, instead of m and zero. thus, only test the + // number of columns + Assert (interpolation_matrix.n() == x_source_fe.dofs_per_cell, + ExcDimensionMismatch (interpolation_matrix.m(), + x_source_fe.dofs_per_cell)); - Assert (std::fabs(sum-1) < eps, ExcInternalError()); } + else + AssertThrow (false, + (typename FiniteElement::ExcInterpolationNotImplemented())); + } @@ -527,84 +550,12 @@ get_interpolation_matrix (const FiniteElement &x_source_fe, template void FE_Q_Base:: -get_face_interpolation_matrix (const FiniteElement &x_source_fe, +get_face_interpolation_matrix (const FiniteElement &source_fe, FullMatrix &interpolation_matrix) const { Assert (dim > 1, ExcImpossibleInDim(1)); - - // this is only implemented, if the source FE is also a Q element - AssertThrow ((dynamic_cast *>(&x_source_fe) != 0), - (typename FiniteElement:: - ExcInterpolationNotImplemented())); - - Assert (interpolation_matrix.n() == this->dofs_per_face, - ExcDimensionMismatch (interpolation_matrix.n(), - this->dofs_per_face)); - Assert (interpolation_matrix.m() == x_source_fe.dofs_per_face, - ExcDimensionMismatch (interpolation_matrix.m(), - x_source_fe.dofs_per_face)); - - // ok, source is a Q element, so we will be able to do the work - const FE_Q_Base &source_fe - = dynamic_cast&>(x_source_fe); - - // Make sure that the element for which the DoFs should be constrained is - // the one with the higher polynomial degree. Actually the procedure will - // work also if this assertion is not satisfied. But the matrices produced - // in that case might lead to problems in the hp procedures, which use this - // method. - Assert (this->dofs_per_face <= source_fe.dofs_per_face, - (typename FiniteElement:: - ExcInterpolationNotImplemented ())); - - // generate a quadrature with the unit support points. This is later based - // as a basis for the QProjector, which returns the support points on the - // face. - Quadrature quad_face_support (source_fe.get_unit_face_support_points ()); - - // Rule of thumb for FP accuracy, that can be expected for a given - // polynomial degree. This value is used to cut off values close to zero. - const double eps = 2e-13*this->degree*(dim-1); - - // compute the interpolation matrix by simply taking the value at the - // support points. -//TODO: Verify that all faces are the same with respect to -// these support points. Furthermore, check if something has to -// be done for the face orientation flag in 3D. - const Quadrature face_quadrature - = QProjector::project_to_face (quad_face_support, 0); - for (unsigned int i=0; i &p = face_quadrature.point (i); - - for (unsigned int j=0; jdofs_per_face; ++j) - { - double matrix_entry = this->poly_space.compute_value (this->face_to_cell_index(j, 0), p); - - // Correct the interpolated value. I.e. if it is close to 1 or 0, - // make it exactly 1 or 0. Unfortunately, this is required to avoid - // problems with higher order elements. - if (std::fabs (matrix_entry - 1.0) < eps) - matrix_entry = 1.0; - if (std::fabs (matrix_entry) < eps) - matrix_entry = 0.0; - - interpolation_matrix(i,j) = matrix_entry; - } - } - - // make sure that the row sum of each of the matrices is 1 at this - // point. this must be so since the shape functions sum up to 1 - for (unsigned int j=0; jdofs_per_face; ++i) - sum += interpolation_matrix(j,i); - - Assert (std::fabs(sum-1) < 2e-13*this->degree*(dim-1), - ExcInternalError()); - } + get_subface_interpolation_matrix (source_fe, numbers::invalid_unsigned_int, + interpolation_matrix); } @@ -654,7 +605,11 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe // these support points. Furthermore, check if something has to // be done for the face orientation flag in 3D. const Quadrature subface_quadrature - = QProjector::project_to_subface (quad_face_support, 0, subface); + = subface == numbers::invalid_unsigned_int + ? + QProjector::project_to_face (quad_face_support, 0) + : + QProjector::project_to_subface (quad_face_support, 0, subface); for (unsigned int i=0; idofs_per_face; ++i) { const Point &p = subface_quadrature.point (i); @@ -684,8 +639,7 @@ get_subface_interpolation_matrix (const FiniteElement &x_source_fe for (unsigned int i=0; idofs_per_face; ++i) sum += interpolation_matrix(j,i); - Assert (std::fabs(sum-1) < 2e-13*this->degree*dim, - ExcInternalError()); + Assert (std::fabs(sum-1) < eps, ExcInternalError()); } } else if (dynamic_cast *>(&x_source_fe) != 0) @@ -750,7 +704,7 @@ hp_line_dof_identities (const FiniteElement &fe_other) const { // dofs are located along lines, so two dofs are identical if they are // located at identical positions. if we had only equidistant points, we - // could simple check for similarity like (i+1)*q == (j+1)*p, but we + // could simply check for similarity like (i+1)*q == (j+1)*p, but we // might have other support points (e.g. Gauss-Lobatto // points). Therefore, read the points in unit_support_points for the // first coordinate direction. We take the lexicographic ordering of the @@ -984,11 +938,132 @@ FE_Q_Base::initialize_quad_dof_index_permutation () +template +unsigned int +FE_Q_Base:: +face_to_cell_index (const unsigned int face_index, + const unsigned int face, + const bool face_orientation, + const bool face_flip, + const bool face_rotation) const +{ + Assert (face_index < this->dofs_per_face, + ExcIndexRange(face_index, 0, this->dofs_per_face)); + Assert (face < GeometryInfo::faces_per_cell, + ExcIndexRange(face, 0, GeometryInfo::faces_per_cell)); + +//TODO: we could presumably solve the 3d case below using the +// adjust_quad_dof_index_for_face_orientation_table field. for the +// 2d case, we can't use adjust_line_dof_index_for_line_orientation_table +// since that array is empty (presumably because we thought that +// there are no flipped edges in 2d, but these can happen in +// DoFTools::make_periodicity_constraints, for example). so we +// would need to either fill this field, or rely on derived classes +// implementing this function, as we currently do + + // we need to distinguish between DoFs on vertices, lines and in 3d quads. + // do so in a sequence of if-else statements + if (face_index < this->first_face_line_index) + // DoF is on a vertex + { + // get the number of the vertex on the face that corresponds to this DoF, + // along with the number of the DoF on this vertex + const unsigned int face_vertex = face_index / this->dofs_per_vertex; + const unsigned int dof_index_on_vertex = face_index % this->dofs_per_vertex; + + // then get the number of this vertex on the cell and translate + // this to a DoF number on the cell + return (GeometryInfo::face_to_cell_vertices(face, face_vertex, + face_orientation, + face_flip, + face_rotation) + * this->dofs_per_vertex + + + dof_index_on_vertex); + } + else if (face_index < this->first_face_quad_index) + // DoF is on a face + { + // do the same kind of translation as before. we need to only consider + // DoFs on the lines, i.e., ignoring those on the vertices + const unsigned int index = face_index - this->first_face_line_index; + + const unsigned int face_line = index / this->dofs_per_line; + const unsigned int dof_index_on_line = index % this->dofs_per_line; + + // we now also need to adjust the line index for the case of + // face orientation, face flips, etc + unsigned int adjusted_dof_index_on_line; + switch (dim) + { + case 1: + Assert (false, ExcInternalError()); + + case 2: + // in 2d, only face_flip has a meaning. if it is set, consider + // dofs in reverse order + if (face_flip == false) + adjusted_dof_index_on_line = dof_index_on_line; + else + adjusted_dof_index_on_line = this->dofs_per_line - dof_index_on_line - 1; + break; + + case 3: + // in 3d, things are difficult. someone will have to think + // about how this code here should look like, by drawing a bunch + // of pictures of how all the faces can look like with the various + // flips and rotations. + // + // that said, the Q2 case is easy enough to implement, as is the case + // where everything is in standard orientation + Assert ((this->dofs_per_line <= 1) || + ((face_orientation == true) && + (face_flip == false) && + (face_rotation == false)), + ExcNotImplemented()); + adjusted_dof_index_on_line = dof_index_on_line; + break; + } + + return (this->first_line_index + + GeometryInfo::face_to_cell_lines(face, face_line, + face_orientation, + face_flip, + face_rotation) + * this->dofs_per_line + + + adjusted_dof_index_on_line); + } + else + // DoF is on a quad + { + Assert (dim >= 3, ExcInternalError()); + + // ignore vertex and line dofs + const unsigned int index = face_index - this->first_face_quad_index; + + // the same is true here as above for the 3d case -- someone will + // just have to draw a bunch of pictures. in the meantime, + // we can implement the Q2 case in which it is simple + Assert ((this->dofs_per_quad <= 1) || + ((face_orientation == true) && + (face_flip == false) && + (face_rotation == false)), + ExcNotImplemented()); + return (this->first_quad_index + + face * this->dofs_per_quad + + index); + } +} + + + template std::vector FE_Q_Base::get_dpo_vector(const unsigned int deg) { + AssertThrow(deg>0,ExcMessage("FE_Q needs to be of degree > 0.")); std::vector dpo(dim+1, 1U); for (unsigned int i=1; i::initialize_constraints (const std::vector template -const FullMatrix& +const FullMatrix & FE_Q_Base ::get_prolongation_matrix (const unsigned int child, const RefinementCase &refinement_case) const @@ -1062,7 +1137,7 @@ FE_Q_Base // almost negligible also for high order elements const unsigned int dofs1d = this->degree+1; std::vector > - subcell_evaluations (dim, Table<2,double>(dofs1d, dofs1d)); + subcell_evaluations (dim, Table<2,double>(dofs1d, dofs1d)); const std::vector &index_map_inverse = this->poly_space.get_numbering_inverse(); @@ -1184,7 +1259,7 @@ FE_Q_Base template -const FullMatrix& +const FullMatrix & FE_Q_Base ::get_restriction_matrix (const unsigned int child, const RefinementCase &refinement_case) const diff --git a/deal.II/source/fe/fe_q_base.inst.in b/deal.II/source/fe/fe_q_base.inst.in index 8d6c49215b..8a5488c479 100644 --- a/deal.II/source/fe/fe_q_base.inst.in +++ b/deal.II/source/fe/fe_q_base.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_q_dg0.cc b/deal.II/source/fe/fe_q_dg0.cc index 058ddf954d..8ecc7df865 100644 --- a/deal.II/source/fe/fe_q_dg0.cc +++ b/deal.II/source/fe/fe_q_dg0.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id: fe_q.cc 28798 2013-03-07 17:00:02Z maier $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012, 2013 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -260,7 +264,7 @@ get_interpolation_matrix (const FiniteElement &x_source_fe, x_source_fe.dofs_per_cell)); this->FE_Q_Base,dim,spacedim>:: - get_interpolation_matrix(x_source_fe, interpolation_matrix); + get_interpolation_matrix(x_source_fe, interpolation_matrix); } diff --git a/deal.II/source/fe/fe_q_dg0.inst.in b/deal.II/source/fe/fe_q_dg0.inst.in index 4f73f2c255..5cb57c5386 100644 --- a/deal.II/source/fe/fe_q_dg0.inst.in +++ b/deal.II/source/fe/fe_q_dg0.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id: fe_q.inst.in 25229 2012-03-09 18:34:59Z pauletti $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_q_hierarchical.cc b/deal.II/source/fe/fe_q_hierarchical.cc index ceef17fdac..7185ee76b0 100644 --- a/deal.II/source/fe/fe_q_hierarchical.cc +++ b/deal.II/source/fe/fe_q_hierarchical.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_q_hierarchical.inst.in b/deal.II/source/fe/fe_q_hierarchical.inst.in index 0350400b9f..b1431f7f7c 100644 --- a/deal.II/source/fe/fe_q_hierarchical.inst.in +++ b/deal.II/source/fe/fe_q_hierarchical.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_q_iso_q1.cc b/deal.II/source/fe/fe_q_iso_q1.cc index 925e4c7c45..6aba97cfac 100644 --- a/deal.II/source/fe/fe_q_iso_q1.cc +++ b/deal.II/source/fe/fe_q_iso_q1.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -29,7 +33,7 @@ FE_Q_iso_Q1::FE_Q_iso_Q1 (const unsigned int subdivisions) : FE_Q_Base >, dim, spacedim> ( TensorProductPolynomials > - (Polynomials::generate_complete_Lagrange_basis_on_subdivisions(subdivisions, 1)), + (Polynomials::generate_complete_Lagrange_basis_on_subdivisions(subdivisions, 1)), FiniteElementData(this->get_dpo_vector(subdivisions), 1, subdivisions, FiniteElementData::H1), diff --git a/deal.II/source/fe/fe_q_iso_q1.inst.in b/deal.II/source/fe/fe_q_iso_q1.inst.in index 785a122589..47f935af28 100644 --- a/deal.II/source/fe/fe_q_iso_q1.inst.in +++ b/deal.II/source/fe/fe_q_iso_q1.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/fe_raviart_thomas.cc b/deal.II/source/fe/fe_raviart_thomas.cc index d8304a4125..bf82030640 100644 --- a/deal.II/source/fe/fe_raviart_thomas.cc +++ b/deal.II/source/fe/fe_raviart_thomas.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_raviart_thomas.inst.in b/deal.II/source/fe/fe_raviart_thomas.inst.in index 46eca9e9b1..b61955369e 100644 --- a/deal.II/source/fe/fe_raviart_thomas.inst.in +++ b/deal.II/source/fe/fe_raviart_thomas.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_raviart_thomas_nodal.cc b/deal.II/source/fe/fe_raviart_thomas_nodal.cc index f8dfcd8bbb..c6d6d37cf7 100644 --- a/deal.II/source/fe/fe_raviart_thomas_nodal.cc +++ b/deal.II/source/fe/fe_raviart_thomas_nodal.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/fe_raviart_thomas_nodal.inst.in b/deal.II/source/fe/fe_raviart_thomas_nodal.inst.in index 951a219fe4..cd5757d9f3 100644 --- a/deal.II/source/fe/fe_raviart_thomas_nodal.inst.in +++ b/deal.II/source/fe/fe_raviart_thomas_nodal.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/fe_system.cc b/deal.II/source/fe/fe_system.cc index 4a1966ff07..2b5e504a5e 100644 --- a/deal.II/source/fe/fe_system.cc +++ b/deal.II/source/fe/fe_system.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -44,7 +46,10 @@ namespace template -FESystem::InternalData::InternalData(const unsigned int n_base_elements): +FESystem::InternalData::InternalData(const unsigned int n_base_elements, + const bool compute_hessians) +: + compute_hessians (compute_hessians), base_fe_datas(n_base_elements), base_fe_values_datas(n_base_elements) {} @@ -591,7 +596,7 @@ FESystem::get_interpolation_matrix ( template -const FullMatrix& +const FullMatrix & FESystem ::get_restriction_matrix (const unsigned int child, const RefinementCase &refinement_case) const @@ -618,7 +623,7 @@ FESystem // shortcut for accessing local restrictions further down std::vector *> - base_matrices(this->n_base_elements()); + base_matrices(this->n_base_elements()); for (unsigned int i=0; in_base_elements(); ++i) { @@ -658,11 +663,11 @@ FESystem // so get the common base element and the indices therein: const unsigned int - base = this->system_to_base_table[i].first.first; + base = this->system_to_base_table[i].first.first; const unsigned int - base_index_i = this->system_to_base_table[i].second, - base_index_j = this->system_to_base_table[j].second; + base_index_i = this->system_to_base_table[i].second, + base_index_j = this->system_to_base_table[j].second; // if we are sure that DoFs i and j may couple, then copy // entries of the matrices: @@ -680,7 +685,7 @@ FESystem template -const FullMatrix& +const FullMatrix & FESystem ::get_prolongation_matrix (const unsigned int child, const RefinementCase &refinement_case) const @@ -704,7 +709,7 @@ FESystem bool do_prolongation = true; std::vector *> - base_matrices(this->n_base_elements()); + base_matrices(this->n_base_elements()); for (unsigned int i=0; in_base_elements(); ++i) { base_matrices[i] = @@ -727,11 +732,11 @@ FESystem this->system_to_base_table[j].first) continue; const unsigned int - base = this->system_to_base_table[i].first.first; + base = this->system_to_base_table[i].first.first; const unsigned int - base_index_i = this->system_to_base_table[i].second, - base_index_j = this->system_to_base_table[j].second; + base_index_i = this->system_to_base_table[i].second, + base_index_j = this->system_to_base_table[j].second; prolongate(i,j) = (*base_matrices[base])(base_index_i,base_index_j); } prolongate.swap(const_cast &> @@ -743,6 +748,45 @@ FESystem } +template +unsigned int +FESystem:: +face_to_cell_index (const unsigned int face_dof_index, + const unsigned int face, + const bool face_orientation, + const bool face_flip, + const bool face_rotation) const +{ + // we need to ask the base elements how they want to translate + // the DoFs within their own numbering. thus, translate to + // the base element numbering and then back + const std::pair, unsigned int> + face_base_index = this->face_system_to_base_index(face_dof_index); + + const unsigned int + base_face_to_cell_index + = this->base_element(face_base_index.first.first).face_to_cell_index (face_base_index.second, + face, + face_orientation, + face_flip, + face_rotation); + + // it would be nice if we had a base_to_system_index function, but + // all that exists is a component_to_system_index function. we can't do + // this here because it won't work for non-primitive elements. consequently, + // simply do a loop over all dofs till we find whether it corresponds + // to the one we're interested in -- crude, maybe, but works for now + const std::pair, unsigned int> + target = std::make_pair (face_base_index.first, base_face_to_cell_index); + for (unsigned int i=0; idofs_per_cell; ++i) + if (this->system_to_base_index(i) == target) + return i; + + Assert (false, ExcInternalError()); + return numbers::invalid_unsigned_int; +} + + //--------------------------------------------------------------------------- // Data field initialization @@ -798,7 +842,8 @@ FESystem::get_data (const UpdateFlags flags_, const Quadrature &quadrature) const { UpdateFlags flags = flags_; - InternalData *data = new InternalData(this->n_base_elements()); + InternalData *data = new InternalData(this->n_base_elements(), + flags & update_hessians); data->update_once = update_once (flags); data->update_each = update_each (flags); @@ -809,7 +854,6 @@ FESystem::get_data (const UpdateFlags flags_, // finite differencing are required, // then initialize some objects for // that - data->compute_hessians = flags & update_hessians; if (data->compute_hessians) { // delete @@ -885,14 +929,14 @@ FESystem::get_face_data ( const Quadrature &quadrature) const { UpdateFlags flags = flags_; - InternalData *data = new InternalData(this->n_base_elements()); + InternalData *data = new InternalData(this->n_base_elements(), + flags & update_hessians); data->update_once = update_once (flags); data->update_each = update_each (flags); flags = data->update_once | data->update_each; UpdateFlags sub_flags = flags; - data->compute_hessians = flags & update_hessians; if (data->compute_hessians) { sub_flags = UpdateFlags (sub_flags ^ update_hessians); @@ -937,14 +981,14 @@ FESystem::get_subface_data ( const Quadrature &quadrature) const { UpdateFlags flags = flags_; - InternalData *data = new InternalData(this->n_base_elements()); + InternalData *data = new InternalData(this->n_base_elements(), + flags & update_hessians); data->update_once = update_once (flags); data->update_each = update_each (flags); flags = data->update_once | data->update_each; UpdateFlags sub_flags = flags; - data->compute_hessians = flags & update_hessians; if (data->compute_hessians) { sub_flags = UpdateFlags (sub_flags ^ update_hessians); @@ -2460,17 +2504,17 @@ FESystem::multiply_dof_numbers ( unsigned int index = 0; for (unsigned int index=0; index0) - { - total_conformity = fes[index]->conforming_space; - break; - } + { + total_conformity = fes[index]->conforming_space; + break; + } for (; index0) - total_conformity = - typename FiniteElementData::Conformity(total_conformity - & - fes[index]->conforming_space); + total_conformity = + typename FiniteElementData::Conformity(total_conformity + & + fes[index]->conforming_space); } std::vector dpo; @@ -2480,10 +2524,10 @@ FESystem::multiply_dof_numbers ( if (dim>2) dpo.push_back(multiplied_dofs_per_hex); return FiniteElementData (dpo, - multiplied_n_components, - degree, - total_conformity, - summed_multiplicities); + multiplied_n_components, + degree, + total_conformity, + summed_multiplicities); } diff --git a/deal.II/source/fe/fe_system.inst.in b/deal.II/source/fe/fe_system.inst.in index 5e28b445d8..75934ade41 100644 --- a/deal.II/source/fe/fe_system.inst.in +++ b/deal.II/source/fe/fe_system.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { diff --git a/deal.II/source/fe/fe_tools.cc b/deal.II/source/fe/fe_tools.cc index f5eadd3066..4ba84c5a43 100644 --- a/deal.II/source/fe/fe_tools.cc +++ b/deal.II/source/fe/fe_tools.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -17,15 +21,6 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -395,8 +390,7 @@ namespace FETools start_indices[i] = k; k += block_data[i]; } - -//TODO:[GK] This does not work for a single RT + for (unsigned int i=0; i @@ -1267,703 +1261,6 @@ namespace FETools } - template class DH1, - template class DH2, - class InVector, class OutVector> - void - interpolate(const DH1 &dof1, - const InVector &u1, - const DH2 &dof2, - OutVector &u2) - { - ConstraintMatrix dummy; - dummy.close(); - interpolate(dof1, u1, dof2, dummy, u2); - } - - - - template class DH1, - template class DH2, - class InVector, class OutVector> - void - interpolate (const DH1 &dof1, - const InVector &u1, - const DH2 &dof2, - const ConstraintMatrix &constraints, - OutVector &u2) - { - Assert(&dof1.get_tria()==&dof2.get_tria(), ExcTriangulationMismatch()); - - Assert(u1.size()==dof1.n_dofs(), - ExcDimensionMismatch(u1.size(), dof1.n_dofs())); - Assert(u2.size()==dof2.n_dofs(), - ExcDimensionMismatch(u2.size(), dof2.n_dofs())); - -#ifdef DEAL_II_WITH_PETSC - if (dynamic_cast(&u1) != 0) - if (dynamic_cast*>(&dof1) != 0) - { - // if u1 is a parallel distributed - // PETSc vector, we check the local - // size of u1 for safety - Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); - }; - - if (dynamic_cast(&u2) != 0) - if (dynamic_cast*>(&dof2) != 0) - { - Assert(dynamic_cast(&u2)->local_size() == dof2.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u2)->local_size(), dof2.locally_owned_dofs().n_elements())); - }; -#endif - // allocate vectors at maximal - // size. will be reinited in inner - // cell, but Vector makes sure that - // this does not lead to - // reallocation of memory - Vector u1_local(DoFTools::max_dofs_per_cell(dof1)); - Vector u2_local(DoFTools::max_dofs_per_cell(dof2)); - - // have a map for interpolation - // matrices. shared_ptr make sure - // that memory is released again - std::map *, - std::map *, - std_cxx1x::shared_ptr > > > - interpolation_matrices; - - typename DH1::active_cell_iterator cell1 = dof1.begin_active(), - endc1 = dof1.end(); - typename DH2::active_cell_iterator cell2 = dof2.begin_active(), - endc2 = dof2.end(); - - std::vector dofs; - dofs.reserve (DoFTools::max_dofs_per_cell (dof2)); - - u2 = 0; - OutVector touch_count(u2); - touch_count = 0; - - // for distributed triangulations, - // we can only interpolate u1 on - // a cell, which this processor owns, - // so we have to know the subdomain_id - const types::subdomain_id subdomain_id = - dof1.get_tria().locally_owned_subdomain(); - - for (; cell1!=endc1; ++cell1, ++cell2) - if ((cell1->subdomain_id() == subdomain_id) - || - (subdomain_id == numbers::invalid_subdomain_id)) - { - Assert(cell1->get_fe().n_components() == cell2->get_fe().n_components(), - ExcDimensionMismatch (cell1->get_fe().n_components(), - cell2->get_fe().n_components())); - - // for continuous elements on - // grids with hanging nodes we - // need hanging node - // constraints. Consequentely, - // if there are no constraints - // then hanging nodes are not - // allowed. - const bool hanging_nodes_not_allowed - = ((cell2->get_fe().dofs_per_vertex != 0) && - (constraints.n_constraints() == 0)); - - if (hanging_nodes_not_allowed) - for (unsigned int face=0; face::faces_per_cell; ++face) - Assert (cell1->at_boundary(face) || - cell1->neighbor(face)->level() == cell1->level(), - ExcHangingNodesNotAllowed(0)); - - - const unsigned int dofs_per_cell1 = cell1->get_fe().dofs_per_cell; - const unsigned int dofs_per_cell2 = cell2->get_fe().dofs_per_cell; - u1_local.reinit (dofs_per_cell1); - u2_local.reinit (dofs_per_cell2); - - // check if interpolation - // matrix for this particular - // pair of elements is already - // there - if (interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()].get() == 0) - { - std_cxx1x::shared_ptr > - interpolation_matrix (new FullMatrix (dofs_per_cell2, - dofs_per_cell1)); - interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()] - = interpolation_matrix; - - get_interpolation_matrix(cell1->get_fe(), - cell2->get_fe(), - *interpolation_matrix); - } - - cell1->get_dof_values(u1, u1_local); - interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()] - ->vmult(u2_local, u1_local); - - dofs.resize (dofs_per_cell2); - cell2->get_dof_indices(dofs); - - for (unsigned int i=0; i - void - back_interpolate(const DoFHandler &dof1, - const InVector &u1, - const FiniteElement &fe2, - OutVector &u1_interpolated) - { - Assert(dof1.get_fe().n_components() == fe2.n_components(), - ExcDimensionMismatch(dof1.get_fe().n_components(), fe2.n_components())); - Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); - Assert(u1_interpolated.size()==dof1.n_dofs(), - ExcDimensionMismatch(u1_interpolated.size(), dof1.n_dofs())); - -#ifdef DEAL_II_WITH_PETSC - if (dynamic_cast(&u1) != 0) - if (dynamic_cast*>(&dof1) != 0) - { - // if u1 is a parallel distributed - // PETSc vector, we check the local - // size of u1 for safety - Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); - }; - - if (dynamic_cast(&u1_interpolated) != 0) - if (dynamic_cast*>(&dof1) != 0) - { - Assert(dynamic_cast(&u1_interpolated)->local_size() == dof1.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u1_interpolated)->local_size(), dof1.locally_owned_dofs().n_elements())); - }; -#endif - - // For continuous elements on grids - // with hanging nodes we need - // hanging node - // constraints. Consequently, when - // the elements are continuous no - // hanging node constraints are - // allowed. - const bool hanging_nodes_not_allowed= - (dof1.get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0); - - const unsigned int dofs_per_cell1=dof1.get_fe().dofs_per_cell; - - Vector u1_local(dofs_per_cell1); - Vector u1_int_local(dofs_per_cell1); - - const types::subdomain_id subdomain_id = - dof1.get_tria().locally_owned_subdomain(); - - typename DoFHandler::active_cell_iterator cell = dof1.begin_active(), - endc = dof1.end(); - - FullMatrix interpolation_matrix(dofs_per_cell1, dofs_per_cell1); - get_back_interpolation_matrix(dof1.get_fe(), fe2, - interpolation_matrix); - for (; cell!=endc; ++cell) - if ((cell->subdomain_id() == subdomain_id) - || - (subdomain_id == numbers::invalid_subdomain_id)) - { - if (hanging_nodes_not_allowed) - for (unsigned int face=0; face::faces_per_cell; ++face) - Assert (cell->at_boundary(face) || - cell->neighbor(face)->level() == cell->level(), - ExcHangingNodesNotAllowed(0)); - - cell->get_dof_values(u1, u1_local); - interpolation_matrix.vmult(u1_int_local, u1_local); - cell->set_dof_values(u1_int_local, u1_interpolated); - } - - // if we work on a parallel PETSc vector - // we have to finish the work - u1_interpolated.compress(VectorOperation::insert); - } - - - - template class DH, - class InVector, class OutVector, int spacedim> - void - back_interpolate(const DH &dof1, - const InVector &u1, - const FiniteElement &fe2, - OutVector &u1_interpolated) - { - Assert(u1.size() == dof1.n_dofs(), - ExcDimensionMismatch(u1.size(), dof1.n_dofs())); - Assert(u1_interpolated.size() == dof1.n_dofs(), - ExcDimensionMismatch(u1_interpolated.size(), dof1.n_dofs())); - -#ifdef DEAL_II_WITH_PETSC - if (dynamic_cast(&u1) != 0) - if (dynamic_cast*>(&dof1) != 0) - { - // if u1 is a parallel distributed - // PETSc vector, we check the local - // size of u1 for safety - Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); - }; - - if (dynamic_cast(&u1_interpolated) != 0) - if (dynamic_cast*>(&dof1) != 0) - { - Assert(dynamic_cast(&u1_interpolated)->local_size() == dof1.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u1_interpolated)->local_size(), dof1.locally_owned_dofs().n_elements())); - }; -#endif - - Vector u1_local(DoFTools::max_dofs_per_cell(dof1)); - Vector u1_int_local(DoFTools::max_dofs_per_cell(dof1)); - - const types::subdomain_id subdomain_id = - dof1.get_tria().locally_owned_subdomain(); - - typename DH::active_cell_iterator cell = dof1.begin_active(), - endc = dof1.end(); - - // map from possible fe objects in - // dof1 to the back_interpolation - // matrices - std::map *, - std_cxx1x::shared_ptr > > interpolation_matrices; - - for (; cell!=endc; ++cell) - if ((cell->subdomain_id() == subdomain_id) - || - (subdomain_id == numbers::invalid_subdomain_id)) - { - Assert(cell->get_fe().n_components() == fe2.n_components(), - ExcDimensionMismatch(cell->get_fe().n_components(), - fe2.n_components())); - - // For continuous elements on - // grids with hanging nodes we - // need hanging node - // constraints. Consequently, - // when the elements are - // continuous no hanging node - // constraints are allowed. - const bool hanging_nodes_not_allowed= - (cell->get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0); - - if (hanging_nodes_not_allowed) - for (unsigned int face=0; face::faces_per_cell; ++face) - Assert (cell->at_boundary(face) || - cell->neighbor(face)->level() == cell->level(), - ExcHangingNodesNotAllowed(0)); - - const unsigned int dofs_per_cell1 = cell->get_fe().dofs_per_cell; - - // make sure back_interpolation - // matrix is available - if (interpolation_matrices[&cell->get_fe()] != 0) - { - interpolation_matrices[&cell->get_fe()] = - std_cxx1x::shared_ptr > - (new FullMatrix(dofs_per_cell1, dofs_per_cell1)); - get_back_interpolation_matrix(dof1.get_fe(), fe2, - *interpolation_matrices[&cell->get_fe()]); - } - - u1_local.reinit (dofs_per_cell1); - u1_int_local.reinit (dofs_per_cell1); - - cell->get_dof_values(u1, u1_local); - interpolation_matrices[&cell->get_fe()]->vmult(u1_int_local, u1_local); - cell->set_dof_values(u1_int_local, u1_interpolated); - }; - - // if we work on a parallel PETSc vector - // we have to finish the work - u1_interpolated.compress(VectorOperation::insert); - } - - - - namespace internal - { - namespace - { - template - void back_interpolate (const DoFHandler &dof1, - const ConstraintMatrix &constraints1, - const InVector &u1, - const DoFHandler &dof2, - const ConstraintMatrix &constraints2, - InVector &u1_interpolated) - { - Vector u2(dof2.n_dofs()); - interpolate(dof1, u1, dof2, constraints2, u2); - interpolate(dof2, u2, dof1, constraints1, u1_interpolated); - } - - // special version for PETSc -#ifdef DEAL_II_WITH_PETSC - template - void back_interpolate (const DoFHandler &dof1, - const ConstraintMatrix &constraints1, - const PETScWrappers::MPI::Vector &u1, - const DoFHandler &dof2, - const ConstraintMatrix &constraints2, - PETScWrappers::MPI::Vector &u1_interpolated) - { - // if u1 is a parallel distributed PETSc vector, we create a - // vector u2 with based on the sets of locally owned and relevant - // dofs of dof2 - IndexSet dof2_locally_owned_dofs = dof2.locally_owned_dofs(); - IndexSet dof2_locally_relevant_dofs; - DoFTools::extract_locally_relevant_dofs (dof2, - dof2_locally_relevant_dofs); - - PETScWrappers::MPI::Vector u2_out (u1.get_mpi_communicator(), - dof2_locally_owned_dofs); - interpolate(dof1, u1, dof2, constraints2, u2_out); - PETScWrappers::MPI::Vector u2 (u1.get_mpi_communicator(), - dof2_locally_owned_dofs, - dof2_locally_relevant_dofs); - u2 = u2_out; - interpolate(dof2, u2, dof1, constraints1, u1_interpolated); - } -#endif - - // special version for parallel::distributed::Vector - template - void back_interpolate (const DoFHandler &dof1, - const ConstraintMatrix &constraints1, - const parallel::distributed::Vector &u1, - const DoFHandler &dof2, - const ConstraintMatrix &constraints2, - parallel::distributed::Vector &u1_interpolated) - { - IndexSet dof2_locally_owned_dofs = dof2.locally_owned_dofs(); - IndexSet dof2_locally_relevant_dofs; - DoFTools::extract_locally_relevant_dofs (dof2, - dof2_locally_relevant_dofs); - - parallel::distributed::Vector - u2 (dof2_locally_owned_dofs, - dof2_locally_relevant_dofs, - u1.get_mpi_communicator()); - - interpolate(dof1, u1, dof2, constraints2, u2); - u2.update_ghost_values (); - interpolate(dof2, u2, dof1, constraints1, u1_interpolated); - } - } - } - - - template - void back_interpolate(const DoFHandler &dof1, - const ConstraintMatrix &constraints1, - const InVector &u1, - const DoFHandler &dof2, - const ConstraintMatrix &constraints2, - OutVector &u1_interpolated) - { - // For discontinuous elements without constraints take the simpler version - // of the back_interpolate function. - if (dof1.get_fe().dofs_per_vertex==0 && dof2.get_fe().dofs_per_vertex==0 - && constraints1.n_constraints()==0 && constraints2.n_constraints()==0) - back_interpolate(dof1, u1, dof2.get_fe(), u1_interpolated); - else - { - Assert(dof1.get_fe().n_components() == dof2.get_fe().n_components(), - ExcDimensionMismatch(dof1.get_fe().n_components(), dof2.get_fe().n_components())); - Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); - Assert(u1_interpolated.size()==dof1.n_dofs(), - ExcDimensionMismatch(u1_interpolated.size(), dof1.n_dofs())); - - // For continuous elements first interpolate to dof2, taking into - // account constraints2, and then interpolate back to dof1 taking into - // account constraints1 - internal::back_interpolate(dof1, constraints1, u1, dof2, constraints2, - u1_interpolated); - } - } - - - - template - void interpolation_difference (const DoFHandler &dof1, - const InVector &u1, - const FiniteElement &fe2, - OutVector &u1_difference) - { - Assert(dof1.get_fe().n_components() == fe2.n_components(), - ExcDimensionMismatch(dof1.get_fe().n_components(), fe2.n_components())); - Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); - Assert(u1_difference.size()==dof1.n_dofs(), - ExcDimensionMismatch(u1_difference.size(), dof1.n_dofs())); - -#ifdef DEAL_II_WITH_PETSC - if (dynamic_cast(&u1) != 0) - if (dynamic_cast*>(&dof1) != 0) - { - // if u1 is a parallel distributed - // PETSc vector, we check the local - // size of u1 for safety - Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); - }; - - if (dynamic_cast(&u1_difference) != 0) - if (dynamic_cast*>(&dof1) != 0) - { - Assert(dynamic_cast(&u1_difference)->local_size() == dof1.locally_owned_dofs().n_elements(), - ExcDimensionMismatch(dynamic_cast(&u1_difference)->local_size(), dof1.locally_owned_dofs().n_elements())); - }; -#endif - - // For continuous elements on grids - // with hanging nodes we need - // hanging node - // constraints. Consequently, when - // the elements are continuous no - // hanging node constraints are - // allowed. - const bool hanging_nodes_not_allowed= - (dof1.get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0); - - const unsigned int dofs_per_cell=dof1.get_fe().dofs_per_cell; - - Vector u1_local(dofs_per_cell); - Vector u1_diff_local(dofs_per_cell); - - const types::subdomain_id subdomain_id = - dof1.get_tria().locally_owned_subdomain(); - - FullMatrix difference_matrix(dofs_per_cell, dofs_per_cell); - get_interpolation_difference_matrix(dof1.get_fe(), fe2, - difference_matrix); - - typename DoFHandler::active_cell_iterator cell = dof1.begin_active(), - endc = dof1.end(); - - for (; cell!=endc; ++cell) - if ((cell->subdomain_id() == subdomain_id) - || - (subdomain_id == numbers::invalid_subdomain_id)) - { - if (hanging_nodes_not_allowed) - for (unsigned int face=0; face::faces_per_cell; ++face) - Assert (cell->at_boundary(face) || - cell->neighbor(face)->level() == cell->level(), - ExcHangingNodesNotAllowed(0)); - - cell->get_dof_values(u1, u1_local); - difference_matrix.vmult(u1_diff_local, u1_local); - cell->set_dof_values(u1_diff_local, u1_difference); - } - - // if we work on a parallel PETSc vector - // we have to finish the work and - // update ghost values - u1_difference.compress(VectorOperation::insert); - } - - - - template - void interpolation_difference(const DoFHandler &dof1, - const ConstraintMatrix &constraints1, - const InVector &u1, - const DoFHandler &dof2, - const ConstraintMatrix &constraints2, - OutVector &u1_difference) - { - // For discontinuous elements - // without constraints take the - // cheaper version of the - // interpolation_difference function. - if (dof1.get_fe().dofs_per_vertex==0 && dof2.get_fe().dofs_per_vertex==0 - && constraints1.n_constraints()==0 && constraints2.n_constraints()==0) - interpolation_difference(dof1, u1, dof2.get_fe(), u1_difference); - else - { - back_interpolate(dof1, constraints1, u1, dof2, constraints2, u1_difference); - u1_difference.sadd(-1, u1); - } - } - - - - template - void project_dg(const DoFHandler &dof1, - const InVector &u1, - const DoFHandler &dof2, - OutVector &u2) - { - Assert(&dof1.get_tria()==&dof2.get_tria(), ExcTriangulationMismatch()); - Assert(dof1.get_fe().n_components() == dof2.get_fe().n_components(), - ExcDimensionMismatch(dof1.get_fe().n_components(), dof2.get_fe().n_components())); - Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); - Assert(u2.size()==dof2.n_dofs(), ExcDimensionMismatch(u2.size(), dof2.n_dofs())); - - typename DoFHandler::active_cell_iterator cell1 = dof1.begin_active(); - typename DoFHandler::active_cell_iterator cell2 = dof2.begin_active(); - typename DoFHandler::active_cell_iterator end = dof2.end(); - - const unsigned int n1 = dof1.get_fe().dofs_per_cell; - const unsigned int n2 = dof2.get_fe().dofs_per_cell; - - Vector u1_local(n1); - Vector u2_local(n2); - std::vector dofs(n2); - - FullMatrix matrix(n2,n1); - get_projection_matrix(dof1.get_fe(), dof2.get_fe(), matrix); - - while (cell2 != end) - { - cell1->get_dof_values(u1, u1_local); - matrix.vmult(u2_local, u1_local); - cell2->get_dof_indices(dofs); - for (unsigned int i=0; i - void extrapolate(const DoFHandler &dof1, - const InVector &u1, - const DoFHandler &dof2, - OutVector &u2) - { - ConstraintMatrix dummy; - dummy.close(); - extrapolate(dof1, u1, dof2, dummy, u2); - } - - - - template - void extrapolate(const DoFHandler &dof1, - const InVector &u1, - const DoFHandler &dof2, - const ConstraintMatrix &constraints, - OutVector &u2) - { - Assert(dof1.get_fe().n_components() == dof2.get_fe().n_components(), - ExcDimensionMismatch(dof1.get_fe().n_components(), dof2.get_fe().n_components())); - Assert(&dof1.get_tria()==&dof2.get_tria(), ExcTriangulationMismatch()); - Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); - Assert(u2.size()==dof2.n_dofs(), ExcDimensionMismatch(u2.size(), dof2.n_dofs())); - - OutVector u3; - u3.reinit(u2); - interpolate(dof1, u1, dof2, constraints, u3); - - const unsigned int dofs_per_cell = dof2.get_fe().dofs_per_cell; - Vector dof_values(dofs_per_cell); - - // make sure that each cell on the - // coarsest level is at least once - // refined. otherwise, we can't - // treat these cells and would - // generate a bogus result - { - typename DoFHandler::cell_iterator cell = dof2.begin(0), - endc = dof2.end(0); - for (; cell!=endc; ++cell) - Assert (cell->has_children(), ExcGridNotRefinedAtLeastOnce()); - } - - // then traverse grid bottom up - for (unsigned int level=0; level::cell_iterator cell=dof2.begin(level), - endc=dof2.end(level); - - for (; cell!=endc; ++cell) - if (!cell->active()) - { - // check whether this - // cell has active - // children - bool active_children=false; - for (unsigned int child_n=0; child_nn_children(); ++child_n) - if (cell->child(child_n)->active()) - { - active_children=true; - break; - } - - // if there are active - // children, the we have - // to work on this - // cell. get the data - // from the one vector - // and set it on the - // other - if (active_children) - { - cell->get_interpolated_dof_values(u3, dof_values); - cell->set_dof_values_by_interpolation(dof_values, u2); - } - } - } - - // Apply hanging node constraints. - constraints.distribute(u2); - } - template <> void @@ -2846,7 +2143,7 @@ namespace FETools return Utilities::invert_permutation(hierarchic_to_lexicographic_numbering (fe)); } -} +} // end of namespace FETools diff --git a/deal.II/source/fe/fe_tools.inst.in b/deal.II/source/fe/fe_tools.inst.in index 82fb725f88..3809bdd380 100644 --- a/deal.II/source/fe/fe_tools.inst.in +++ b/deal.II/source/fe/fe_tools.inst.in @@ -1,36 +1,20 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- -for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; Vector : SERIAL_VECTORS) - { - namespace FETools - \{ -#if deal_II_dimension <= deal_II_space_dimension - template - void interpolate - (const DoFHandler &, const Vector &, - const DoFHandler &, Vector &); - - template - void interpolate - (const DoFHandler &, const Vector &, - const DoFHandler &, const ConstraintMatrix &, - Vector &); -#endif - \} - } - for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { namespace FETools @@ -63,6 +47,15 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS { namespace FETools \{ + +#if deal_II_dimension <= deal_II_space_dimension + template + void get_interpolation_matrix + (const FiniteElement &, + const FiniteElement &, + FullMatrix &); +#endif + #if deal_II_dimension == deal_II_space_dimension template class FEFactoryBase; @@ -76,12 +69,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS void compute_component_wise( const FiniteElement& , std::vector&, std::vector >&); - template - - void get_interpolation_matrix - (const FiniteElement &, - const FiniteElement &, - FullMatrix &); + template void get_back_interpolation_matrix (const FiniteElement &, @@ -121,25 +109,6 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS (const FiniteElement &, FullMatrix (&)[GeometryInfo::max_children_per_face], unsigned int, unsigned int); - template - void interpolate - (const hp::DoFHandler &, const Vector &, - const hp::DoFHandler &, Vector &); - template - void interpolate - (const hp::DoFHandler &, const Vector &, - const hp::DoFHandler &, const ConstraintMatrix &, - Vector &); - template - void interpolate - (const hp::DoFHandler &, const Vector &, - const hp::DoFHandler &, Vector &); - template - void interpolate - (const hp::DoFHandler &, const Vector &, - const hp::DoFHandler &, const ConstraintMatrix &, - Vector &); - template FiniteElement * get_fe_from_name (const std::string &); @@ -209,47 +178,3 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS #endif \} } - - - -for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; VEC : SERIAL_VECTORS) - { - namespace FETools - \{ -#if deal_II_dimension == deal_II_space_dimension - template - void back_interpolate - (const DoFHandler &, const VEC &, - const FiniteElement &, VEC &); - template - void back_interpolate - (const DoFHandler &, const ConstraintMatrix &, - const VEC &, - const DoFHandler &, const ConstraintMatrix &, - VEC &); - template - void interpolation_difference - (const DoFHandler &, const VEC &, - const FiniteElement &, VEC &); - template - void interpolation_difference - (const DoFHandler &, const ConstraintMatrix &, - const VEC &, - const DoFHandler &, const ConstraintMatrix &, - VEC &); - template - void project_dg - (const DoFHandler &, const VEC &, - const DoFHandler &, VEC &); - template - void extrapolate - (const DoFHandler &, const VEC &, - const DoFHandler &, VEC &); - template - void extrapolate - (const DoFHandler &, const VEC &, - const DoFHandler &, const ConstraintMatrix &, - VEC &); -#endif - \} - } diff --git a/deal.II/source/fe/fe_tools_interpolate.cc b/deal.II/source/fe/fe_tools_interpolate.cc new file mode 100644 index 0000000000..8eef0c9e12 --- /dev/null +++ b/deal.II/source/fe/fe_tools_interpolate.cc @@ -0,0 +1,761 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2000 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + + +DEAL_II_NAMESPACE_OPEN + +namespace FETools +{ + template class DH1, + template class DH2, + class InVector, class OutVector> + void + interpolate(const DH1 &dof1, + const InVector &u1, + const DH2 &dof2, + OutVector &u2) + { + ConstraintMatrix dummy; + dummy.close(); + interpolate(dof1, u1, dof2, dummy, u2); + } + + + + template class DH1, + template class DH2, + class InVector, class OutVector> + void + interpolate (const DH1 &dof1, + const InVector &u1, + const DH2 &dof2, + const ConstraintMatrix &constraints, + OutVector &u2) + { + Assert(&dof1.get_tria()==&dof2.get_tria(), ExcTriangulationMismatch()); + + Assert(u1.size()==dof1.n_dofs(), + ExcDimensionMismatch(u1.size(), dof1.n_dofs())); + Assert(u2.size()==dof2.n_dofs(), + ExcDimensionMismatch(u2.size(), dof2.n_dofs())); + +#ifdef DEAL_II_WITH_PETSC + if (dynamic_cast(&u1) != 0) + if (dynamic_cast*>(&dof1) != 0) + { + // if u1 is a parallel distributed + // PETSc vector, we check the local + // size of u1 for safety + Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); + }; + + if (dynamic_cast(&u2) != 0) + if (dynamic_cast*>(&dof2) != 0) + { + Assert(dynamic_cast(&u2)->local_size() == dof2.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u2)->local_size(), dof2.locally_owned_dofs().n_elements())); + }; +#endif + // allocate vectors at maximal + // size. will be reinited in inner + // cell, but Vector makes sure that + // this does not lead to + // reallocation of memory + Vector u1_local(DoFTools::max_dofs_per_cell(dof1)); + Vector u2_local(DoFTools::max_dofs_per_cell(dof2)); + + // have a map for interpolation + // matrices. shared_ptr make sure + // that memory is released again + std::map *, + std::map *, + std_cxx1x::shared_ptr > > > + interpolation_matrices; + + typename DH1::active_cell_iterator cell1 = dof1.begin_active(), + endc1 = dof1.end(); + typename DH2::active_cell_iterator cell2 = dof2.begin_active(), + endc2 = dof2.end(); + + std::vector dofs; + dofs.reserve (DoFTools::max_dofs_per_cell (dof2)); + + u2 = 0; + OutVector touch_count(u2); + touch_count = 0; + + // for distributed triangulations, + // we can only interpolate u1 on + // a cell, which this processor owns, + // so we have to know the subdomain_id + const types::subdomain_id subdomain_id = + dof1.get_tria().locally_owned_subdomain(); + + for (; cell1!=endc1; ++cell1, ++cell2) + if ((cell1->subdomain_id() == subdomain_id) + || + (subdomain_id == numbers::invalid_subdomain_id)) + { + Assert(cell1->get_fe().n_components() == cell2->get_fe().n_components(), + ExcDimensionMismatch (cell1->get_fe().n_components(), + cell2->get_fe().n_components())); + + // for continuous elements on + // grids with hanging nodes we + // need hanging node + // constraints. Consequentely, + // if there are no constraints + // then hanging nodes are not + // allowed. + const bool hanging_nodes_not_allowed + = ((cell2->get_fe().dofs_per_vertex != 0) && + (constraints.n_constraints() == 0)); + + if (hanging_nodes_not_allowed) + for (unsigned int face=0; face::faces_per_cell; ++face) + Assert (cell1->at_boundary(face) || + cell1->neighbor(face)->level() == cell1->level(), + ExcHangingNodesNotAllowed(0)); + + + const unsigned int dofs_per_cell1 = cell1->get_fe().dofs_per_cell; + const unsigned int dofs_per_cell2 = cell2->get_fe().dofs_per_cell; + u1_local.reinit (dofs_per_cell1); + u2_local.reinit (dofs_per_cell2); + + // check if interpolation + // matrix for this particular + // pair of elements is already + // there + if (interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()].get() == 0) + { + std_cxx1x::shared_ptr > + interpolation_matrix (new FullMatrix (dofs_per_cell2, + dofs_per_cell1)); + interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()] + = interpolation_matrix; + + get_interpolation_matrix(cell1->get_fe(), + cell2->get_fe(), + *interpolation_matrix); + } + + cell1->get_dof_values(u1, u1_local); + interpolation_matrices[&cell1->get_fe()][&cell2->get_fe()] + ->vmult(u2_local, u1_local); + + dofs.resize (dofs_per_cell2); + cell2->get_dof_indices(dofs); + + for (unsigned int i=0; i + void + back_interpolate(const DoFHandler &dof1, + const InVector &u1, + const FiniteElement &fe2, + OutVector &u1_interpolated) + { + Assert(dof1.get_fe().n_components() == fe2.n_components(), + ExcDimensionMismatch(dof1.get_fe().n_components(), fe2.n_components())); + Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); + Assert(u1_interpolated.size()==dof1.n_dofs(), + ExcDimensionMismatch(u1_interpolated.size(), dof1.n_dofs())); + +#ifdef DEAL_II_WITH_PETSC + if (dynamic_cast(&u1) != 0) + if (dynamic_cast*>(&dof1) != 0) + { + // if u1 is a parallel distributed + // PETSc vector, we check the local + // size of u1 for safety + Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); + }; + + if (dynamic_cast(&u1_interpolated) != 0) + if (dynamic_cast*>(&dof1) != 0) + { + Assert(dynamic_cast(&u1_interpolated)->local_size() == dof1.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u1_interpolated)->local_size(), dof1.locally_owned_dofs().n_elements())); + }; +#endif + + // For continuous elements on grids + // with hanging nodes we need + // hanging node + // constraints. Consequently, when + // the elements are continuous no + // hanging node constraints are + // allowed. + const bool hanging_nodes_not_allowed= + (dof1.get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0); + + const unsigned int dofs_per_cell1=dof1.get_fe().dofs_per_cell; + + Vector u1_local(dofs_per_cell1); + Vector u1_int_local(dofs_per_cell1); + + const types::subdomain_id subdomain_id = + dof1.get_tria().locally_owned_subdomain(); + + typename DoFHandler::active_cell_iterator cell = dof1.begin_active(), + endc = dof1.end(); + + FullMatrix interpolation_matrix(dofs_per_cell1, dofs_per_cell1); + get_back_interpolation_matrix(dof1.get_fe(), fe2, + interpolation_matrix); + for (; cell!=endc; ++cell) + if ((cell->subdomain_id() == subdomain_id) + || + (subdomain_id == numbers::invalid_subdomain_id)) + { + if (hanging_nodes_not_allowed) + for (unsigned int face=0; face::faces_per_cell; ++face) + Assert (cell->at_boundary(face) || + cell->neighbor(face)->level() == cell->level(), + ExcHangingNodesNotAllowed(0)); + + cell->get_dof_values(u1, u1_local); + interpolation_matrix.vmult(u1_int_local, u1_local); + cell->set_dof_values(u1_int_local, u1_interpolated); + } + + // if we work on a parallel PETSc vector + // we have to finish the work + u1_interpolated.compress(VectorOperation::insert); + } + + + + template class DH, + class InVector, class OutVector, int spacedim> + void + back_interpolate(const DH &dof1, + const InVector &u1, + const FiniteElement &fe2, + OutVector &u1_interpolated) + { + Assert(u1.size() == dof1.n_dofs(), + ExcDimensionMismatch(u1.size(), dof1.n_dofs())); + Assert(u1_interpolated.size() == dof1.n_dofs(), + ExcDimensionMismatch(u1_interpolated.size(), dof1.n_dofs())); + +#ifdef DEAL_II_WITH_PETSC + if (dynamic_cast(&u1) != 0) + if (dynamic_cast*>(&dof1) != 0) + { + // if u1 is a parallel distributed + // PETSc vector, we check the local + // size of u1 for safety + Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); + }; + + if (dynamic_cast(&u1_interpolated) != 0) + if (dynamic_cast*>(&dof1) != 0) + { + Assert(dynamic_cast(&u1_interpolated)->local_size() == dof1.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u1_interpolated)->local_size(), dof1.locally_owned_dofs().n_elements())); + }; +#endif + + Vector u1_local(DoFTools::max_dofs_per_cell(dof1)); + Vector u1_int_local(DoFTools::max_dofs_per_cell(dof1)); + + const types::subdomain_id subdomain_id = + dof1.get_tria().locally_owned_subdomain(); + + typename DH::active_cell_iterator cell = dof1.begin_active(), + endc = dof1.end(); + + // map from possible fe objects in + // dof1 to the back_interpolation + // matrices + std::map *, + std_cxx1x::shared_ptr > > interpolation_matrices; + + for (; cell!=endc; ++cell) + if ((cell->subdomain_id() == subdomain_id) + || + (subdomain_id == numbers::invalid_subdomain_id)) + { + Assert(cell->get_fe().n_components() == fe2.n_components(), + ExcDimensionMismatch(cell->get_fe().n_components(), + fe2.n_components())); + + // For continuous elements on + // grids with hanging nodes we + // need hanging node + // constraints. Consequently, + // when the elements are + // continuous no hanging node + // constraints are allowed. + const bool hanging_nodes_not_allowed= + (cell->get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0); + + if (hanging_nodes_not_allowed) + for (unsigned int face=0; face::faces_per_cell; ++face) + Assert (cell->at_boundary(face) || + cell->neighbor(face)->level() == cell->level(), + ExcHangingNodesNotAllowed(0)); + + const unsigned int dofs_per_cell1 = cell->get_fe().dofs_per_cell; + + // make sure back_interpolation + // matrix is available + if (interpolation_matrices[&cell->get_fe()] != 0) + { + interpolation_matrices[&cell->get_fe()] = + std_cxx1x::shared_ptr > + (new FullMatrix(dofs_per_cell1, dofs_per_cell1)); + get_back_interpolation_matrix(dof1.get_fe(), fe2, + *interpolation_matrices[&cell->get_fe()]); + } + + u1_local.reinit (dofs_per_cell1); + u1_int_local.reinit (dofs_per_cell1); + + cell->get_dof_values(u1, u1_local); + interpolation_matrices[&cell->get_fe()]->vmult(u1_int_local, u1_local); + cell->set_dof_values(u1_int_local, u1_interpolated); + }; + + // if we work on a parallel PETSc vector + // we have to finish the work + u1_interpolated.compress(VectorOperation::insert); + } + + + + namespace internal + { + namespace + { + template + void back_interpolate (const DoFHandler &dof1, + const ConstraintMatrix &constraints1, + const InVector &u1, + const DoFHandler &dof2, + const ConstraintMatrix &constraints2, + InVector &u1_interpolated) + { + Vector u2(dof2.n_dofs()); + interpolate(dof1, u1, dof2, constraints2, u2); + interpolate(dof2, u2, dof1, constraints1, u1_interpolated); + } + + // special version for PETSc +#ifdef DEAL_II_WITH_PETSC + template + void back_interpolate (const DoFHandler &dof1, + const ConstraintMatrix &constraints1, + const PETScWrappers::MPI::Vector &u1, + const DoFHandler &dof2, + const ConstraintMatrix &constraints2, + PETScWrappers::MPI::Vector &u1_interpolated) + { + // if u1 is a parallel distributed PETSc vector, we create a + // vector u2 with based on the sets of locally owned and relevant + // dofs of dof2 + IndexSet dof2_locally_owned_dofs = dof2.locally_owned_dofs(); + IndexSet dof2_locally_relevant_dofs; + DoFTools::extract_locally_relevant_dofs (dof2, + dof2_locally_relevant_dofs); + + PETScWrappers::MPI::Vector u2_out (u1.get_mpi_communicator(), + dof2_locally_owned_dofs); + interpolate(dof1, u1, dof2, constraints2, u2_out); + PETScWrappers::MPI::Vector u2 (u1.get_mpi_communicator(), + dof2_locally_owned_dofs, + dof2_locally_relevant_dofs); + u2 = u2_out; + interpolate(dof2, u2, dof1, constraints1, u1_interpolated); + } +#endif + + // special version for parallel::distributed::Vector + template + void back_interpolate (const DoFHandler &dof1, + const ConstraintMatrix &constraints1, + const parallel::distributed::Vector &u1, + const DoFHandler &dof2, + const ConstraintMatrix &constraints2, + parallel::distributed::Vector &u1_interpolated) + { + IndexSet dof2_locally_owned_dofs = dof2.locally_owned_dofs(); + IndexSet dof2_locally_relevant_dofs; + DoFTools::extract_locally_relevant_dofs (dof2, + dof2_locally_relevant_dofs); + + parallel::distributed::Vector + u2 (dof2_locally_owned_dofs, + dof2_locally_relevant_dofs, + u1.get_mpi_communicator()); + + interpolate(dof1, u1, dof2, constraints2, u2); + u2.update_ghost_values (); + interpolate(dof2, u2, dof1, constraints1, u1_interpolated); + } + } + } + + + template + void back_interpolate(const DoFHandler &dof1, + const ConstraintMatrix &constraints1, + const InVector &u1, + const DoFHandler &dof2, + const ConstraintMatrix &constraints2, + OutVector &u1_interpolated) + { + // For discontinuous elements without constraints take the simpler version + // of the back_interpolate function. + if (dof1.get_fe().dofs_per_vertex==0 && dof2.get_fe().dofs_per_vertex==0 + && constraints1.n_constraints()==0 && constraints2.n_constraints()==0) + back_interpolate(dof1, u1, dof2.get_fe(), u1_interpolated); + else + { + Assert(dof1.get_fe().n_components() == dof2.get_fe().n_components(), + ExcDimensionMismatch(dof1.get_fe().n_components(), dof2.get_fe().n_components())); + Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); + Assert(u1_interpolated.size()==dof1.n_dofs(), + ExcDimensionMismatch(u1_interpolated.size(), dof1.n_dofs())); + + // For continuous elements first interpolate to dof2, taking into + // account constraints2, and then interpolate back to dof1 taking into + // account constraints1 + internal::back_interpolate(dof1, constraints1, u1, dof2, constraints2, + u1_interpolated); + } + } + + + + template + void interpolation_difference (const DoFHandler &dof1, + const InVector &u1, + const FiniteElement &fe2, + OutVector &u1_difference) + { + Assert(dof1.get_fe().n_components() == fe2.n_components(), + ExcDimensionMismatch(dof1.get_fe().n_components(), fe2.n_components())); + Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); + Assert(u1_difference.size()==dof1.n_dofs(), + ExcDimensionMismatch(u1_difference.size(), dof1.n_dofs())); + +#ifdef DEAL_II_WITH_PETSC + if (dynamic_cast(&u1) != 0) + if (dynamic_cast*>(&dof1) != 0) + { + // if u1 is a parallel distributed + // PETSc vector, we check the local + // size of u1 for safety + Assert(dynamic_cast(&u1)->local_size() == dof1.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u1)->local_size(), dof1.locally_owned_dofs().n_elements())); + }; + + if (dynamic_cast(&u1_difference) != 0) + if (dynamic_cast*>(&dof1) != 0) + { + Assert(dynamic_cast(&u1_difference)->local_size() == dof1.locally_owned_dofs().n_elements(), + ExcDimensionMismatch(dynamic_cast(&u1_difference)->local_size(), dof1.locally_owned_dofs().n_elements())); + }; +#endif + + // For continuous elements on grids + // with hanging nodes we need + // hanging node + // constraints. Consequently, when + // the elements are continuous no + // hanging node constraints are + // allowed. + const bool hanging_nodes_not_allowed= + (dof1.get_fe().dofs_per_vertex != 0) || (fe2.dofs_per_vertex != 0); + + const unsigned int dofs_per_cell=dof1.get_fe().dofs_per_cell; + + Vector u1_local(dofs_per_cell); + Vector u1_diff_local(dofs_per_cell); + + const types::subdomain_id subdomain_id = + dof1.get_tria().locally_owned_subdomain(); + + FullMatrix difference_matrix(dofs_per_cell, dofs_per_cell); + get_interpolation_difference_matrix(dof1.get_fe(), fe2, + difference_matrix); + + typename DoFHandler::active_cell_iterator cell = dof1.begin_active(), + endc = dof1.end(); + + for (; cell!=endc; ++cell) + if ((cell->subdomain_id() == subdomain_id) + || + (subdomain_id == numbers::invalid_subdomain_id)) + { + if (hanging_nodes_not_allowed) + for (unsigned int face=0; face::faces_per_cell; ++face) + Assert (cell->at_boundary(face) || + cell->neighbor(face)->level() == cell->level(), + ExcHangingNodesNotAllowed(0)); + + cell->get_dof_values(u1, u1_local); + difference_matrix.vmult(u1_diff_local, u1_local); + cell->set_dof_values(u1_diff_local, u1_difference); + } + + // if we work on a parallel PETSc vector + // we have to finish the work and + // update ghost values + u1_difference.compress(VectorOperation::insert); + } + + + + template + void interpolation_difference(const DoFHandler &dof1, + const ConstraintMatrix &constraints1, + const InVector &u1, + const DoFHandler &dof2, + const ConstraintMatrix &constraints2, + OutVector &u1_difference) + { + // For discontinuous elements + // without constraints take the + // cheaper version of the + // interpolation_difference function. + if (dof1.get_fe().dofs_per_vertex==0 && dof2.get_fe().dofs_per_vertex==0 + && constraints1.n_constraints()==0 && constraints2.n_constraints()==0) + interpolation_difference(dof1, u1, dof2.get_fe(), u1_difference); + else + { + back_interpolate(dof1, constraints1, u1, dof2, constraints2, u1_difference); + u1_difference.sadd(-1, u1); + } + } + + + + template + void project_dg(const DoFHandler &dof1, + const InVector &u1, + const DoFHandler &dof2, + OutVector &u2) + { + Assert(&dof1.get_tria()==&dof2.get_tria(), ExcTriangulationMismatch()); + Assert(dof1.get_fe().n_components() == dof2.get_fe().n_components(), + ExcDimensionMismatch(dof1.get_fe().n_components(), dof2.get_fe().n_components())); + Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); + Assert(u2.size()==dof2.n_dofs(), ExcDimensionMismatch(u2.size(), dof2.n_dofs())); + + typename DoFHandler::active_cell_iterator cell1 = dof1.begin_active(); + typename DoFHandler::active_cell_iterator cell2 = dof2.begin_active(); + typename DoFHandler::active_cell_iterator end = dof2.end(); + + const unsigned int n1 = dof1.get_fe().dofs_per_cell; + const unsigned int n2 = dof2.get_fe().dofs_per_cell; + + Vector u1_local(n1); + Vector u2_local(n2); + std::vector dofs(n2); + + FullMatrix matrix(n2,n1); + get_projection_matrix(dof1.get_fe(), dof2.get_fe(), matrix); + + while (cell2 != end) + { + cell1->get_dof_values(u1, u1_local); + matrix.vmult(u2_local, u1_local); + cell2->get_dof_indices(dofs); + for (unsigned int i=0; i + void extrapolate(const DoFHandler &dof1, + const InVector &u1, + const DoFHandler &dof2, + OutVector &u2) + { + ConstraintMatrix dummy; + dummy.close(); + extrapolate(dof1, u1, dof2, dummy, u2); + } + + + + template + void extrapolate(const DoFHandler &dof1, + const InVector &u1, + const DoFHandler &dof2, + const ConstraintMatrix &constraints, + OutVector &u2) + { + Assert(dof1.get_fe().n_components() == dof2.get_fe().n_components(), + ExcDimensionMismatch(dof1.get_fe().n_components(), dof2.get_fe().n_components())); + Assert(&dof1.get_tria()==&dof2.get_tria(), ExcTriangulationMismatch()); + Assert(u1.size()==dof1.n_dofs(), ExcDimensionMismatch(u1.size(), dof1.n_dofs())); + Assert(u2.size()==dof2.n_dofs(), ExcDimensionMismatch(u2.size(), dof2.n_dofs())); + + OutVector u3; + u3.reinit(u2); + interpolate(dof1, u1, dof2, constraints, u3); + + const unsigned int dofs_per_cell = dof2.get_fe().dofs_per_cell; + Vector dof_values(dofs_per_cell); + + // make sure that each cell on the + // coarsest level is at least once + // refined. otherwise, we can't + // treat these cells and would + // generate a bogus result + { + typename DoFHandler::cell_iterator cell = dof2.begin(0), + endc = dof2.end(0); + for (; cell!=endc; ++cell) + Assert (cell->has_children(), ExcGridNotRefinedAtLeastOnce()); + } + + // then traverse grid bottom up + for (unsigned int level=0; level::cell_iterator cell=dof2.begin(level), + endc=dof2.end(level); + + for (; cell!=endc; ++cell) + if (!cell->active()) + { + // check whether this + // cell has active + // children + bool active_children=false; + for (unsigned int child_n=0; child_nn_children(); ++child_n) + if (cell->child(child_n)->active()) + { + active_children=true; + break; + } + + // if there are active + // children, the we have + // to work on this + // cell. get the data + // from the one vector + // and set it on the + // other + if (active_children) + { + cell->get_interpolated_dof_values(u3, dof_values); + cell->set_dof_values_by_interpolation(dof_values, u2); + } + } + } + + // Apply hanging node constraints. + constraints.distribute(u2); + } + +} // end of namespace FETools + + + +/*-------------- Explicit Instantiations -------------------------------*/ +#include "fe_tools_interpolate.inst" + + +/*---------------------------- fe_tools.cc ---------------------------*/ + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/fe/fe_tools_interpolate.inst.in b/deal.II/source/fe/fe_tools_interpolate.inst.in new file mode 100644 index 0000000000..2c7fa67348 --- /dev/null +++ b/deal.II/source/fe/fe_tools_interpolate.inst.in @@ -0,0 +1,107 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + + +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; Vector : SERIAL_VECTORS) + { + namespace FETools + \{ +#if deal_II_dimension <= deal_II_space_dimension + template + void interpolate + (const DoFHandler &, const Vector &, + const DoFHandler &, Vector &); + + template + void interpolate + (const DoFHandler &, const Vector &, + const DoFHandler &, const ConstraintMatrix &, + Vector &); +#endif + \} + } + +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { + namespace FETools + \{ +#if deal_II_dimension == deal_II_space_dimension + template + void interpolate + (const hp::DoFHandler &, const Vector &, + const hp::DoFHandler &, Vector &); + template + void interpolate + (const hp::DoFHandler &, const Vector &, + const hp::DoFHandler &, const ConstraintMatrix &, + Vector &); + template + void interpolate + (const hp::DoFHandler &, const Vector &, + const hp::DoFHandler &, Vector &); + template + void interpolate + (const hp::DoFHandler &, const Vector &, + const hp::DoFHandler &, const ConstraintMatrix &, + Vector &); +#endif + \} + } + + + +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; VEC : SERIAL_VECTORS) + { + namespace FETools + \{ +#if deal_II_dimension == deal_II_space_dimension + template + void back_interpolate + (const DoFHandler &, const VEC &, + const FiniteElement &, VEC &); + template + void back_interpolate + (const DoFHandler &, const ConstraintMatrix &, + const VEC &, + const DoFHandler &, const ConstraintMatrix &, + VEC &); + template + void interpolation_difference + (const DoFHandler &, const VEC &, + const FiniteElement &, VEC &); + template + void interpolation_difference + (const DoFHandler &, const ConstraintMatrix &, + const VEC &, + const DoFHandler &, const ConstraintMatrix &, + VEC &); + template + void project_dg + (const DoFHandler &, const VEC &, + const DoFHandler &, VEC &); + template + void extrapolate + (const DoFHandler &, const VEC &, + const DoFHandler &, VEC &); + template + void extrapolate + (const DoFHandler &, const VEC &, + const DoFHandler &, const ConstraintMatrix &, + VEC &); +#endif + \} + } diff --git a/deal.II/source/fe/fe_values.cc b/deal.II/source/fe/fe_values.cc index b482eba843..a94336f669 100644 --- a/deal.II/source/fe/fe_values.cc +++ b/deal.II/source/fe/fe_values.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998-2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -342,6 +344,104 @@ namespace FEValuesViews } + template + Tensor<2, dim, spacedim>:: + Tensor(const FEValuesBase &fe_values, + const unsigned int first_tensor_component) + : + fe_values(fe_values), + first_tensor_component(first_tensor_component), + shape_function_data(fe_values.fe->dofs_per_cell) + { + Assert(first_tensor_component + dim*dim - 1 + < + fe_values.fe->n_components(), + ExcIndexRange(first_tensor_component + + dim*dim - 1, + 0, + fe_values.fe->n_components())); +//TODO: we'd like to use the fields with the same name as these +// variables from FEValuesData, but they aren't initialized yet +// at the time we get here, so re-create it all + const std::vector shape_function_to_row_table + = make_shape_function_to_row_table (*fe_values.fe); + + for (unsigned int d = 0; d < dim*dim; ++d) + { + const unsigned int component = first_tensor_component + d; + + for (unsigned int i = 0; i < fe_values.fe->dofs_per_cell; ++i) + { + const bool is_primitive = (fe_values.fe->is_primitive() || + fe_values.fe->is_primitive(i)); + + if (is_primitive == true) + shape_function_data[i].is_nonzero_shape_function_component[d] + = (component == + fe_values.fe->system_to_component_index(i).first); + else + shape_function_data[i].is_nonzero_shape_function_component[d] + = (fe_values.fe->get_nonzero_components(i)[component] + == true); + + if (shape_function_data[i].is_nonzero_shape_function_component[d] + == true) + shape_function_data[i].row_index[d] + = shape_function_to_row_table[i*fe_values.fe->n_components()+component]; + else + shape_function_data[i].row_index[d] + = numbers::invalid_unsigned_int; + } + } + + for (unsigned int i = 0; i < fe_values.fe->dofs_per_cell; ++i) + { + unsigned int n_nonzero_components = 0; + for (unsigned int d = 0; d < dim*dim; ++d) + if (shape_function_data[i].is_nonzero_shape_function_component[d] + == true) + ++n_nonzero_components; + + if (n_nonzero_components == 0) + shape_function_data[i].single_nonzero_component = -2; + else if (n_nonzero_components > 1) + shape_function_data[i].single_nonzero_component = -1; + else + { + for (unsigned int d = 0; d < dim*dim; ++d) + if (shape_function_data[i].is_nonzero_shape_function_component[d] + == true) + { + shape_function_data[i].single_nonzero_component + = shape_function_data[i].row_index[d]; + shape_function_data[i].single_nonzero_component_index + = d; + break; + } + } + } + } + + + + template + Tensor<2, dim, spacedim>::Tensor() + : + fe_values(*static_cast*> (0)), + first_tensor_component(numbers::invalid_unsigned_int) + {} + + + + template + Tensor<2, dim, spacedim> & + Tensor<2, dim, spacedim>::operator=(const Tensor<2, dim, spacedim> &) + { + // we shouldn't be copying these objects + Assert(false, ExcInternalError()); + return *this; + } + namespace internal { @@ -380,7 +480,7 @@ namespace FEValuesViews const double *shape_value_ptr = &shape_values(shape_function_data[shape_function].row_index, 0); for (unsigned int q_point=0; q_point void do_function_derivatives (const ::dealii::Vector &dof_values, - const std::vector > > &shape_derivatives, + const std::vector > > &shape_derivatives, const std::vector::ShapeFunctionData> &shape_function_data, - std::vector > &derivatives) + std::vector > &derivatives) { const unsigned int dofs_per_cell = dof_values.size(); const unsigned int n_quadrature_points = dofs_per_cell > 0 ? @@ -401,7 +501,7 @@ namespace FEValuesViews AssertDimension (derivatives.size(), n_quadrature_points); std::fill (derivatives.begin(), derivatives.end(), - Tensor()); + dealii::Tensor()); for (unsigned int shape_function=0; shape_function *shape_derivative_ptr = + const dealii::Tensor *shape_derivative_ptr = &shape_derivatives[shape_function_data[shape_function].row_index][0]; for (unsigned int q_point=0; q_point void do_function_laplacians (const ::dealii::Vector &dof_values, - const std::vector > > &shape_hessians, + const std::vector > > &shape_hessians, const std::vector::ShapeFunctionData> &shape_function_data, std::vector &laplacians) { @@ -442,7 +542,7 @@ namespace FEValuesViews if (value == 0.) continue; - const Tensor<2,spacedim> *shape_hessian_ptr = + const dealii::Tensor<2,spacedim> *shape_hessian_ptr = &shape_hessians[shape_function_data[shape_function].row_index][0]; for (unsigned int q_point=0; q_point &dof_values, const Table<2,double> &shape_values, const std::vector::ShapeFunctionData> &shape_function_data, - std::vector > &values) + std::vector > &values) { const unsigned int dofs_per_cell = dof_values.size(); const unsigned int n_quadrature_points = dofs_per_cell > 0 ? shape_values.n_cols() : values.size(); AssertDimension (values.size(), n_quadrature_points); - std::fill (values.begin(), values.end(), Tensor<1,spacedim>()); + std::fill (values.begin(), values.end(), dealii::Tensor<1,spacedim>()); for (unsigned int shape_function=0; shape_function void do_function_derivatives (const ::dealii::Vector &dof_values, - const std::vector > > &shape_derivatives, + const std::vector > > &shape_derivatives, const std::vector::ShapeFunctionData> &shape_function_data, - std::vector > &derivatives) + std::vector > &derivatives) { const unsigned int dofs_per_cell = dof_values.size(); const unsigned int n_quadrature_points = dofs_per_cell > 0 ? @@ -514,7 +614,7 @@ namespace FEValuesViews AssertDimension (derivatives.size(), n_quadrature_points); std::fill (derivatives.begin(), derivatives.end(), - Tensor()); + dealii::Tensor()); for (unsigned int shape_function=0; shape_function *shape_derivative_ptr = + const dealii::Tensor *shape_derivative_ptr = &shape_derivatives[snc][0]; for (unsigned int q_point=0; q_point *shape_derivative_ptr = + const dealii::Tensor *shape_derivative_ptr = &shape_derivatives[shape_function_data[shape_function]. row_index[d]][0]; for (unsigned int q_point=0; q_point void do_function_symmetric_gradients (const ::dealii::Vector &dof_values, - const std::vector > > &shape_gradients, + const std::vector > > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector > &symmetric_gradients) { @@ -585,7 +685,7 @@ namespace FEValuesViews { const unsigned int comp = shape_function_data[shape_function].single_nonzero_component_index; - const Tensor<1,spacedim> *shape_gradient_ptr = + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[snc][0]; for (unsigned int q_point=0; q_point grad; + dealii::Tensor<2,spacedim> grad; for (unsigned int d=0; d void do_function_divergences (const ::dealii::Vector &dof_values, - const std::vector > > &shape_gradients, + const std::vector > > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector &divergences) { @@ -637,7 +737,7 @@ namespace FEValuesViews { const unsigned int comp = shape_function_data[shape_function].single_nonzero_component_index; - const Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[snc][0]; + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[snc][0]; for (unsigned int q_point=0; q_point *shape_gradient_ptr = + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[shape_function_data[shape_function]. row_index[d]][0]; for (unsigned int q_point=0; q_point void do_function_curls (const ::dealii::Vector &dof_values, - const std::vector > > &shape_gradients, + const std::vector > > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector::type> &curls) { @@ -696,7 +796,7 @@ namespace FEValuesViews if (snc != -1) { - const Tensor<1, spacedim> *shape_gradient_ptr = + const dealii::Tensor<1, spacedim> *shape_gradient_ptr = &shape_gradients[snc][0]; switch (shape_function_data[shape_function].single_nonzero_component_index) @@ -720,7 +820,7 @@ namespace FEValuesViews { if (shape_function_data[shape_function].is_nonzero_shape_function_component[0]) { - const Tensor<1,spacedim> *shape_gradient_ptr = + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[shape_function_data[shape_function].row_index[0]][0]; for (unsigned int q_point = 0; q_point < n_quadrature_points; ++q_point) @@ -729,7 +829,7 @@ namespace FEValuesViews if (shape_function_data[shape_function].is_nonzero_shape_function_component[1]) { - const Tensor<1,spacedim> *shape_gradient_ptr = + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[shape_function_data[shape_function].row_index[1]][0]; for (unsigned int q_point = 0; q_point < n_quadrature_points; ++q_point) @@ -758,7 +858,7 @@ namespace FEValuesViews if (snc != -1) { - const Tensor<1, spacedim> *shape_gradient_ptr = &shape_gradients[snc][0]; + const dealii::Tensor<1, spacedim> *shape_gradient_ptr = &shape_gradients[snc][0]; switch (shape_function_data[shape_function].single_nonzero_component_index) { @@ -800,7 +900,7 @@ namespace FEValuesViews { if (shape_function_data[shape_function].is_nonzero_shape_function_component[0]) { - const Tensor<1,spacedim> *shape_gradient_ptr = + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[shape_function_data[shape_function].row_index[0]][0]; for (unsigned int q_point = 0; q_point < n_quadrature_points; ++q_point) @@ -812,7 +912,7 @@ namespace FEValuesViews if (shape_function_data[shape_function].is_nonzero_shape_function_component[1]) { - const Tensor<1,spacedim> *shape_gradient_ptr = + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[shape_function_data[shape_function].row_index[1]][0]; for (unsigned int q_point = 0; q_point < n_quadrature_points; ++q_point) @@ -824,7 +924,7 @@ namespace FEValuesViews if (shape_function_data[shape_function].is_nonzero_shape_function_component[2]) { - const Tensor<1,spacedim> *shape_gradient_ptr = + const dealii::Tensor<1,spacedim> *shape_gradient_ptr = &shape_gradients[shape_function_data[shape_function].row_index[2]][0]; for (unsigned int q_point = 0; q_point < n_quadrature_points; ++q_point) @@ -844,16 +944,17 @@ namespace FEValuesViews template void do_function_laplacians (const ::dealii::Vector &dof_values, - const std::vector > > &shape_hessians, + const std::vector > > &shape_hessians, const std::vector::ShapeFunctionData> &shape_function_data, - std::vector > &laplacians) + std::vector > &laplacians) { const unsigned int dofs_per_cell = dof_values.size(); const unsigned int n_quadrature_points = dofs_per_cell > 0 ? shape_hessians[0].size() : laplacians.size(); AssertDimension (laplacians.size(), n_quadrature_points); - std::fill (laplacians.begin(), laplacians.end(), Tensor<1,spacedim>()); + std::fill (laplacians.begin(), laplacians.end(), + dealii::Tensor<1,spacedim>()); for (unsigned int shape_function=0; shape_function *shape_hessian_ptr = + const dealii::Tensor<2,spacedim> *shape_hessian_ptr = &shape_hessians[snc][0]; for (unsigned int q_point=0; q_point *shape_hessian_ptr = + const dealii::Tensor<2,spacedim> *shape_hessian_ptr = &shape_hessians[shape_function_data[shape_function]. row_index[d]][0]; for (unsigned int q_point=0; q_point void do_function_divergences (const ::dealii::Vector &dof_values, - const std::vector > > &shape_gradients, + const std::vector > > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, - std::vector > &divergences) + std::vector > &divergences) { const unsigned int dofs_per_cell = dof_values.size(); const unsigned int n_quadrature_points = dofs_per_cell > 0 ? shape_gradients[0].size() : divergences.size(); AssertDimension (divergences.size(), n_quadrature_points); - std::fill (divergences.begin(), divergences.end(), Tensor<1,spacedim>()); + std::fill (divergences.begin(), divergences.end(), + dealii::Tensor<1,spacedim>()); for (unsigned int shape_function=0; shape_function *shape_gradient_ptr = + const dealii::Tensor < 1, spacedim> *shape_gradient_ptr = &shape_gradients[snc][0]; const unsigned int ii = dealii::SymmetricTensor<2,spacedim>:: @@ -1017,7 +1119,7 @@ namespace FEValuesViews const unsigned int comp = shape_function_data[shape_function].single_nonzero_component_index; - const Tensor < 1, spacedim> *shape_gradient_ptr = + const dealii::Tensor < 1, spacedim> *shape_gradient_ptr = &shape_gradients[shape_function_data[shape_function]. row_index[d]][0]; for (unsigned int q_point = 0; q_point < n_quadrature_points; @@ -1034,6 +1136,122 @@ namespace FEValuesViews } } + // ---------------------- non-symmetric tensor part ------------------------ + + template + void + do_function_values (const ::dealii::Vector &dof_values, + const Table<2,double> &shape_values, + const std::vector::ShapeFunctionData> &shape_function_data, + std::vector > &values) + { + const unsigned int dofs_per_cell = dof_values.size(); + const unsigned int n_quadrature_points = dofs_per_cell > 0 ? + shape_values.n_cols() : values.size(); + AssertDimension (values.size(), n_quadrature_points); + + std::fill (values.begin(), values.end(), + dealii::Tensor<2,spacedim>()); + + for (unsigned int shape_function=0; + shape_function indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(comp); + + const double *shape_value_ptr = &shape_values(snc,0); + for (unsigned int q_point=0; q_point indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(d); + + const double *shape_value_ptr = + &shape_values(shape_function_data[shape_function].row_index[d],0); + for (unsigned int q_point=0; q_point + void + do_function_divergences (const ::dealii::Vector &dof_values, + const std::vector > > &shape_gradients, + const std::vector::ShapeFunctionData> &shape_function_data, + std::vector > &divergences) + { + const unsigned int dofs_per_cell = dof_values.size(); + const unsigned int n_quadrature_points = dofs_per_cell > 0 ? + shape_gradients[0].size() : divergences.size(); + AssertDimension (divergences.size(), n_quadrature_points); + + std::fill (divergences.begin(), divergences.end(), + dealii::Tensor<1,spacedim>()); + + for (unsigned int shape_function=0; + shape_function *shape_gradient_ptr = + &shape_gradients[snc][0]; + + const TableIndices<2> indices = dealii::Tensor<2,spacedim>::unrolled_to_component_indices(comp); + const unsigned int ii = indices[0]; + const unsigned int jj = indices[1]; + + for (unsigned int q_point = 0; q_point < n_quadrature_points; + ++q_point, ++shape_gradient_ptr) + { + divergences[q_point][jj] += value * (*shape_gradient_ptr)[ii]; + } + } + else + { + for (unsigned int d = 0; + d < dim*dim; ++d) + if (shape_function_data[shape_function].is_nonzero_shape_function_component[d]) + { + Assert (false, ExcNotImplemented()); + } + } + } + } + } // end of namespace internal @@ -1352,6 +1570,53 @@ namespace FEValuesViews internal::do_function_divergences (dof_values, fe_values.shape_gradients, shape_function_data, divergences); } + + template + template + void + Tensor<2, dim, spacedim>:: + get_function_values(const InputVector &fe_function, + std::vector &values) const + { + typedef FEValuesBase FVB; + Assert(fe_values.update_flags & update_values, + typename FVB::ExcAccessToUninitializedField()); + Assert(fe_values.present_cell.get() != 0, + ExcMessage("FEValues object is not reinit'ed to any cell")); + AssertDimension(fe_function.size(), + fe_values.present_cell->n_dofs_for_dof_handler()); + + // get function values of dofs on this cell + dealii::Vector dof_values(fe_values.dofs_per_cell); + fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values); + internal::do_function_values + (dof_values, fe_values.shape_values, shape_function_data, values); + } + + + + template + template + void + Tensor<2, dim, spacedim>:: + get_function_divergences(const InputVector &fe_function, + std::vector &divergences) const + { + typedef FEValuesBase FVB; + Assert(fe_values.update_flags & update_gradients, + typename FVB::ExcAccessToUninitializedField()); + Assert(fe_values.present_cell.get() != 0, + ExcMessage("FEValues object is not reinit'ed to any cell")); + AssertDimension(fe_function.size(), + fe_values.present_cell->n_dofs_for_dof_handler()); + + // get function values of dofs + // on this cell + dealii::Vector dof_values(fe_values.dofs_per_cell); + fe_values.present_cell->get_interpolated_dof_values(fe_function, dof_values); + internal::do_function_divergences + (dof_values, fe_values.shape_gradients, shape_function_data, divergences); + } } @@ -1376,12 +1641,10 @@ namespace internal scalars.resize (n_scalars); for (unsigned int component=0; component::~Scalar (); -#else + // Use a typedef here to work around an issue with gcc-4.1: typedef dealii::FEValuesViews::Scalar ScalarView; scalars[component].ScalarView::~ScalarView (); -#endif + new (&scalars[component]) dealii::FEValuesViews::Scalar(fe_values, component); @@ -1400,12 +1663,10 @@ namespace internal vectors.resize (n_vectors); for (unsigned int component=0; component::~Vector (); -#else + // Use a typedef here to work around an issue with gcc-4.1: typedef dealii::FEValuesViews::Vector VectorView; vectors[component].VectorView::~VectorView (); -#endif + new (&vectors[component]) dealii::FEValuesViews::Vector(fe_values, component); @@ -1420,17 +1681,33 @@ namespace internal symmetric_second_order_tensors.resize(n_symmetric_second_order_tensors); for (unsigned int component = 0; component < n_symmetric_second_order_tensors; ++component) { -#ifndef DEAL_II_EXPLICIT_DESTRUCTOR_BUG - symmetric_second_order_tensors[component] - .dealii::FEValuesViews::SymmetricTensor<2, dim, spacedim>::~SymmetricTensor(); -#else + // Use a typedef here to work around an issue with gcc-4.1: typedef dealii::FEValuesViews::SymmetricTensor<2, dim, spacedim> SymmetricTensorView; symmetric_second_order_tensors[component].SymmetricTensorView::~SymmetricTensorView(); -#endif + new (&symmetric_second_order_tensors[component]) dealii::FEValuesViews::SymmetricTensor<2, dim, spacedim > (fe_values, component); } + + + // compute number of symmetric + // tensors in the same way as above + const unsigned int n_second_order_tensors + = (fe.n_components() >= dim*dim ? + fe.n_components() - dim*dim + 1 : + 0); + second_order_tensors.resize(n_second_order_tensors); + for (unsigned int component = 0; component < n_second_order_tensors; ++component) + { + // Use a typedef here to work around an issue with gcc-4.1: + typedef dealii::FEValuesViews::Tensor<2, dim, spacedim> TensorView; + second_order_tensors[component].TensorView::~TensorView(); + + new (&second_order_tensors[component]) + dealii::FEValuesViews::Tensor<2, dim, spacedim > (fe_values, + component); + } } } } @@ -1950,7 +2227,7 @@ namespace internal const double *shape_value_ptr = &shape_values(shape_func, 0); for (unsigned int point=0; point *shape_derivative_ptr = &shape_derivatives[shape_func][0]; for (unsigned int point=0; point; template class Vector; template class SymmetricTensor<2, deal_II_dimension, deal_II_space_dimension>; + template class Tensor<2, deal_II_dimension, deal_II_space_dimension>; \} #endif #endif @@ -70,11 +75,11 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesViews::Scalar ::get_function_gradients - (const dealii::VEC&, std::vector >&) const; + (const dealii::VEC&, std::vector >&) const; template void FEValuesViews::Scalar ::get_function_hessians - (const dealii::VEC&, std::vector >&) const; + (const dealii::VEC&, std::vector >&) const; template void FEValuesViews::Scalar ::get_function_laplacians @@ -83,11 +88,11 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesViews::Vector ::get_function_values - (const dealii::VEC&, std::vector >&) const; + (const dealii::VEC&, std::vector >&) const; template void FEValuesViews::Vector ::get_function_gradients - (const dealii::VEC&, std::vector >&) const; + (const dealii::VEC&, std::vector >&) const; template void FEValuesViews::Vector ::get_function_symmetric_gradients @@ -103,11 +108,11 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesViews::Vector ::get_function_hessians - (const dealii::VEC&, std::vector >&) const; + (const dealii::VEC&, std::vector >&) const; template void FEValuesViews::Vector ::get_function_laplacians - (const dealii::VEC&, std::vector >&) const; + (const dealii::VEC&, std::vector >&) const; template void FEValuesViews::SymmetricTensor<2, deal_II_dimension, deal_II_space_dimension> @@ -116,7 +121,16 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesViews::SymmetricTensor<2, deal_II_dimension, deal_II_space_dimension> ::get_function_divergences - (const dealii::VEC&, std::vector >&) const; + (const dealii::VEC&, std::vector >&) const; + + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension> + ::get_function_values + (const dealii::VEC&, std::vector >&) const; + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension> + ::get_function_divergences + (const dealii::VEC&, std::vector >&) const; #endif #endif } @@ -168,35 +182,35 @@ for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimensi template void FEValuesBase::get_function_gradients - (const VEC&, std::vector > &) const; + (const VEC&, std::vector > &) const; template void FEValuesBase::get_function_gradients (const VEC&, const VectorSlice >&, - std::vector > &) const; + std::vector > &) const; template void FEValuesBase::get_function_gradients - (const VEC&, std::vector > > &) const; + (const VEC&, std::vector > > &) const; template void FEValuesBase::get_function_gradients (const VEC&, const VectorSlice >&, - VectorSlice > > >, bool) const; + VectorSlice > > >, bool) const; template void FEValuesBase::get_function_hessians - (const VEC&, std::vector > &) const; + (const VEC&, std::vector > &) const; template void FEValuesBase::get_function_hessians (const VEC&, const VectorSlice >&, - std::vector > &) const; + std::vector > &) const; template void FEValuesBase::get_function_hessians - (const VEC&, std::vector > > &, bool) const; + (const VEC&, std::vector > > &, bool) const; template void FEValuesBase::get_function_hessians (const VEC&, const VectorSlice >&, - VectorSlice > > >, bool) const; + VectorSlice > > >, bool) const; template void FEValuesBase::get_function_laplacians @@ -251,20 +265,20 @@ for (deal_II_dimension : DIMENSIONS) (const dealii::IndexSet&, std::vector&) const; template void FEValuesViews::Scalar::get_function_gradients - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Scalar::get_function_hessians - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Scalar::get_function_laplacians (const dealii::IndexSet&, std::vector&) const; template void FEValuesViews::Vector::get_function_values - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Vector::get_function_gradients - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Vector::get_function_symmetric_gradients (const dealii::IndexSet&, std::vector >&) const; @@ -276,17 +290,24 @@ for (deal_II_dimension : DIMENSIONS) (const dealii::IndexSet&, std::vector&) const; template void FEValuesViews::Vector::get_function_hessians - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Vector::get_function_laplacians - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::SymmetricTensor<2,deal_II_dimension,deal_II_dimension>::get_function_values (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::SymmetricTensor<2,deal_II_dimension,deal_II_dimension>::get_function_divergences - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; + + template + void FEValuesViews::Tensor<2,deal_II_dimension,deal_II_dimension>::get_function_values + (const dealii::IndexSet&, std::vector >&) const; + template + void FEValuesViews::Tensor<2,deal_II_dimension,deal_II_dimension>::get_function_divergences + (const dealii::IndexSet&, std::vector >&) const; #if deal_II_dimension != 3 @@ -297,11 +318,11 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesViews::Scalar ::get_function_gradients - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Scalar ::get_function_hessians - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Scalar ::get_function_laplacians @@ -310,11 +331,11 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesViews::Vector ::get_function_values - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Vector ::get_function_gradients - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Vector ::get_function_symmetric_gradients @@ -326,11 +347,11 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesViews::Vector ::get_function_hessians - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::Vector ::get_function_laplacians - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; template void FEValuesViews::SymmetricTensor<2, deal_II_dimension, deal_II_dimension+1> @@ -339,7 +360,16 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesViews::SymmetricTensor<2, deal_II_dimension, deal_II_dimension+1> ::get_function_divergences - (const dealii::IndexSet&, std::vector >&) const; + (const dealii::IndexSet&, std::vector >&) const; + + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_dimension+1> + ::get_function_values + (const dealii::IndexSet&, std::vector >&) const; + template + void FEValuesViews::Tensor<2, deal_II_dimension, deal_II_dimension+1> + ::get_function_divergences + (const dealii::IndexSet&, std::vector >&) const; #endif #endif @@ -392,35 +422,35 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesBase::get_function_gradients - (const IndexSet&, std::vector > &) const; + (const IndexSet&, std::vector > &) const; template void FEValuesBase::get_function_gradients (const IndexSet&, const VectorSlice >&, - std::vector > &) const; + std::vector > &) const; template void FEValuesBase::get_function_gradients - (const IndexSet&, std::vector > > &) const; + (const IndexSet&, std::vector > > &) const; template void FEValuesBase::get_function_gradients (const IndexSet&, const VectorSlice >&, - VectorSlice > > >, bool) const; + VectorSlice > > >, bool) const; template void FEValuesBase::get_function_hessians - (const IndexSet&, std::vector > &) const; + (const IndexSet&, std::vector > &) const; template void FEValuesBase::get_function_hessians (const IndexSet&, const VectorSlice >&, - std::vector > &) const; + std::vector > &) const; template void FEValuesBase::get_function_hessians - (const IndexSet&, std::vector > > &, bool) const; + (const IndexSet&, std::vector > > &, bool) const; template void FEValuesBase::get_function_hessians (const IndexSet&, const VectorSlice >&, - VectorSlice > > >, bool) const; + VectorSlice > > >, bool) const; template void FEValuesBase::get_function_laplacians @@ -503,35 +533,35 @@ for (deal_II_dimension : DIMENSIONS) template void FEValuesBase::get_function_gradients - (const IndexSet&, std::vector > &) const; + (const IndexSet&, std::vector > &) const; template void FEValuesBase::get_function_gradients (const IndexSet&, const VectorSlice >&, - std::vector > &) const; + std::vector > &) const; template void FEValuesBase::get_function_gradients - (const IndexSet&, std::vector > > &) const; + (const IndexSet&, std::vector > > &) const; template void FEValuesBase::get_function_gradients (const IndexSet&, const VectorSlice >&, - VectorSlice > > >, bool) const; + VectorSlice > > >, bool) const; template void FEValuesBase::get_function_hessians - (const IndexSet&, std::vector > &) const; + (const IndexSet&, std::vector > &) const; template void FEValuesBase::get_function_hessians (const IndexSet&, const VectorSlice >&, - std::vector > &) const; + std::vector > &) const; template void FEValuesBase::get_function_hessians - (const IndexSet&, std::vector > > &, bool) const; + (const IndexSet&, std::vector > > &, bool) const; template void FEValuesBase::get_function_hessians (const IndexSet&, const VectorSlice >&, - VectorSlice > > >, bool) const; + VectorSlice > > >, bool) const; template void FEValuesBase::get_function_laplacians diff --git a/deal.II/source/fe/fe_values_inst2.cc b/deal.II/source/fe/fe_values_inst2.cc index 69ae580b8a..6fb6a9372b 100644 --- a/deal.II/source/fe/fe_values_inst2.cc +++ b/deal.II/source/fe/fe_values_inst2.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id: $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- // This file compiles the second half of the instantiations from fe_values.cc // to get the memory consumption below 1.5gb with gcc. diff --git a/deal.II/source/fe/mapping.cc b/deal.II/source/fe/mapping.cc index aacd12029a..9475f67904 100644 --- a/deal.II/source/fe/mapping.cc +++ b/deal.II/source/fe/mapping.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2005, 2006, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/mapping.inst.in b/deal.II/source/fe/mapping.inst.in index df9073dc3b..f0dd595bac 100644 --- a/deal.II/source/fe/mapping.inst.in +++ b/deal.II/source/fe/mapping.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + diff --git a/deal.II/source/fe/mapping_c1.cc b/deal.II/source/fe/mapping_c1.cc index a481469f61..5a6115220a 100644 --- a/deal.II/source/fe/mapping_c1.cc +++ b/deal.II/source/fe/mapping_c1.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -51,88 +53,46 @@ MappingC1<2>::add_line_support_points (const Triangulation<2>::cell_iterator &ce const unsigned int dim = 2; std::vector > line_points (2); - // loop over each of the lines, - // and if it is at the - // boundary, then first get the - // boundary description and - // second compute the points on - // it. if not at the boundary, - // get the respective points - // from another function + // loop over each of the lines, and if it is at the boundary, then first get + // the boundary description and second compute the points on it. if not at + // the boundary, get the respective points from another function for (unsigned int line_no=0; line_no::lines_per_cell; ++line_no) { const Triangulation::line_iterator line = cell->line(line_no); if (line->at_boundary()) { - // first get the normal - // vectors at the two - // vertices of this line - // from the boundary - // description + // first get the normal vectors at the two vertices of this line + // from the boundary description const Boundary &boundary = line->get_triangulation().get_boundary(line->boundary_indicator()); Boundary::FaceVertexNormals face_vertex_normals; boundary.get_normals_at_vertices (line, face_vertex_normals); - // then transform them into - // interpolation points for - // a cubic polynomial + // then transform them into interpolation points for a cubic + // polynomial // - // for this, note that if - // we describe the boundary - // curve as a polynomial in - // tangential coordinate - // @p{t=0..1} (along the - // line) and @p{s} in - // normal direction, then - // the cubic mapping is - // such that @p{s = a*t**3 - // + b*t**2 + c*t + d}, and - // we want to determine the - // interpolation points at - // @p{t=1/3} and - // @p{t=2/3}. Since at - // @p{t=0,1} we want a - // vertex which is actually - // at the boundary, we know - // that @p{d=0} and - // @p{a=-b-c}. As - // side-conditions, we want - // that the derivatives at - // @p{t=0} and @p{t=1}, - // i.e. at the vertices - // match those returned by - // the boundary. We then - // have that - // @p{s(1/3)=1/27(2b+8c)} - // and - // @p{s(2/3)=4/27b+10/27c}. + // for this, note that if we describe the boundary curve as a + // polynomial in tangential coordinate @p{t=0..1} (along the line) + // and @p{s} in normal direction, then the cubic mapping is such + // that @p{s = a*t**3 + b*t**2 + c*t + d}, and we want to determine + // the interpolation points at @p{t=0.276} and @p{t=0.724} + // (Gauss-Lobatto points). Since at @p{t=0,1} we want a vertex which + // is actually at the boundary, we know that @p{d=0} and @p{a=-b-c}, + // which gives @p{s(0.276)} and @{s(0.726)} in terms of @p{b,c}. As + // side-conditions, we want that the derivatives at @p{t=0} and + // @p{t=1}, i.e. at the vertices match those returned by the + // boundary. // - // The task is then first - // to determine the - // coefficients from the - // tangentials. for that, - // first rotate the - // tangents of @p{s(t)} - // into the global - // coordinate system. they - // are @p{A (1,c)} and @p{A - // (1,-b-2c)} with @p{A} the - // rotation matrix, since - // the tangentials in the - // coordinate system - // relative to the line are - // @p{(1,c)} and @p{(1,-b-2c)} - // at the two vertices, - // respectively. We then - // have to make sure by - // matching @p{b,c} that - // these tangentials are - // orthogonal to the normals - // returned by the boundary - // object + // The task is then first to determine the coefficients from the + // tangentials. for that, first rotate the tangents of @p{s(t)} into + // the global coordinate system. they are @p{A (1,c)} and @p{A + // (1,-b-2c)} with @p{A} the rotation matrix, since the tangentials + // in the coordinate system relative to the line are @p{(1,c)} and + // @p{(1,-b-2c)} at the two vertices, respectively. We then have to + // make sure by matching @p{b,c} that these tangentials are + // orthogonal to the normals returned by the boundary object const Tensor<1,2> coordinate_vector = line->vertex(1) - line->vertex(0); const double h = std::sqrt(coordinate_vector * coordinate_vector); Tensor<1,2> coordinate_axis = coordinate_vector; @@ -149,18 +109,18 @@ MappingC1<2>::add_line_support_points (const Triangulation<2>::cell_iterator &ce -face_vertex_normals[1][0] * std::sin(alpha))) -2*c; + QGaussLobatto<1> quad_points(4); + const double t1 = quad_points.point(1)[0]; + const double t2 = quad_points.point(2)[0]; + const double s_t1 = (((-b-c)*t1+b)*t1+c)*t1; + const double s_t2 = (((-b-c)*t2+b)*t2+c)*t2; - // next evaluate the so - // determined cubic - // polynomial at the points - // 1/3 and 2/3, first in - // unit coordinates - const Point<2> new_unit_points[2] = { Point<2>(1./3., 1./27.*(2*b+8*c)), - Point<2>(2./3., 4./27.*b+10./27.*c) + // next evaluate the so determined cubic polynomial at the points + // 1/3 and 2/3, first in unit coordinates + const Point<2> new_unit_points[2] = { Point<2>(t1, s_t1), + Point<2>(t2, s_t2) }; - // then transform these - // points to real - // coordinates by rotating, + // then transform these points to real coordinates by rotating, // scaling and shifting for (unsigned int i=0; i<2; ++i) { diff --git a/deal.II/source/fe/mapping_c1.inst.in b/deal.II/source/fe/mapping_c1.inst.in index 27a107a0d9..d9e830d5d0 100644 --- a/deal.II/source/fe/mapping_c1.inst.in +++ b/deal.II/source/fe/mapping_c1.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/mapping_cartesian.cc b/deal.II/source/fe/mapping_cartesian.cc index 48ec6cfaea..814b0385df 100644 --- a/deal.II/source/fe/mapping_cartesian.cc +++ b/deal.II/source/fe/mapping_cartesian.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/fe/mapping_cartesian.inst.in b/deal.II/source/fe/mapping_cartesian.inst.in index ab9c3cf951..e6f1a0e6be 100644 --- a/deal.II/source/fe/mapping_cartesian.inst.in +++ b/deal.II/source/fe/mapping_cartesian.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/fe/mapping_q.cc b/deal.II/source/fe/mapping_q.cc index 213905d2a7..eeb52d8a3a 100644 --- a/deal.II/source/fe/mapping_q.cc +++ b/deal.II/source/fe/mapping_q.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -128,15 +130,11 @@ MappingQ::MappingQ (const unsigned int p, || (dim != spacedim)), feq(degree) { - // Construct the tensor product - // polynomials used as shape - // functions for the Qp mapping of - // cells at the boundary. - std::vector v; - for (unsigned int i=0; i<=degree; ++i) - v.push_back(Polynomials::LagrangeEquidistant(degree,i)); - - tensor_pols = new TensorProductPolynomials (v); + // Construct the tensor product polynomials used as shape functions for the + // Qp mapping of cells at the boundary. + const QGaussLobatto<1> points(degree+1); + tensor_pols = new TensorProductPolynomials + (Polynomials::generate_complete_Lagrange_basis(points.get_points())); Assert (n_shape_functions==tensor_pols->n(), ExcInternalError()); Assert(n_inner+n_outer==n_shape_functions, ExcInternalError()); @@ -292,10 +290,8 @@ MappingQ::get_subface_data (const UpdateFlags update_flags, } -// Note that the CellSimilarity flag is -// modifyable, since MappingQ can need to -// recalculate data even when cells are -// similar. +// Note that the CellSimilarity flag is modifyable, since MappingQ can need to +// recalculate data even when cells are similar. template void MappingQ::fill_fe_values ( @@ -310,35 +306,23 @@ MappingQ::fill_fe_values ( std::vector > &normal_vectors, CellSimilarity::Similarity &cell_similarity) const { - // convert data object to internal - // data for this class. fails with - // an exception if that is not - // possible + // convert data object to internal data for this class. fails with an + // exception if that is not possible Assert (dynamic_cast (&mapping_data) != 0, ExcInternalError()); InternalData &data = static_cast (mapping_data); - // check whether this cell needs - // the full mapping or can be - // treated by a reduced Q1 mapping, - // e.g. if the cell is in the - // interior of the domain + // check whether this cell needs the full mapping or can be treated by a + // reduced Q1 mapping, e.g. if the cell is in the interior of the domain data.use_mapping_q1_on_current_cell = !(use_mapping_q_on_all_cells || cell->has_boundary_lines()); - // depending on this result, use this or - // the other data object for the - // mapping. furthermore, we need to - // ensure that the flag indicating - // whether we can use some similarity has - // to be modified - for a general - // MappingQ, the data needs to be - // recomputed anyway since then the - // mapping changes the data. this needs - // to be known also for later operations, - // so modify the variable here. this also - // affects the calculation of the next - // cell -- if we use Q1 data on the next - // cell, the data will still be invalid. + // depending on this result, use this or the other data object for the + // mapping. furthermore, we need to ensure that the flag indicating whether + // we can use some similarity has to be modified - for a general MappingQ, + // the data needs to be recomputed anyway since then the mapping changes the + // data. this needs to be known also for later operations, so modify the + // variable here. this also affects the calculation of the next cell -- if + // we use Q1 data on the next cell, the data will still be invalid. typename MappingQ1::InternalData *p_data=0; if (data.use_mapping_q1_on_current_cell) p_data=&data.mapping_q1_data; @@ -370,34 +354,23 @@ MappingQ::fill_fe_face_values ( std::vector > &exterior_forms, std::vector > &normal_vectors) const { - // convert data object to internal - // data for this class. fails with - // an exception if that is not - // possible + // convert data object to internal data for this class. fails with an + // exception if that is not possible Assert (dynamic_cast (&mapping_data) != 0, ExcInternalError()); InternalData &data = static_cast (mapping_data); - // check whether this cell needs - // the full mapping or can be - // treated by a reduced Q1 mapping, - // e.g. if the cell is entirely in - // the interior of the domain. note - // that it is not sufficient to ask - // whether the present _face_ is in - // the interior, as the mapping on - // the face depends on the mapping - // of the cell, which in turn - // depends on the fact whether - // _any_ of the faces of this cell - // is at the boundary, not only the - // present face + // check whether this cell needs the full mapping or can be treated by a + // reduced Q1 mapping, e.g. if the cell is entirely in the interior of the + // domain. note that it is not sufficient to ask whether the present _face_ + // is in the interior, as the mapping on the face depends on the mapping of + // the cell, which in turn depends on the fact whether _any_ of the faces of + // this cell is at the boundary, not only the present face data.use_mapping_q1_on_current_cell=!(use_mapping_q_on_all_cells || cell->has_boundary_lines()); - // depending on this result, use - // this or the other data object - // for the mapping + // depending on this result, use this or the other data object for the + // mapping typename MappingQ1::InternalData *p_data=0; if (data.use_mapping_q1_on_current_cell) p_data=&data.mapping_q1_data; @@ -432,34 +405,23 @@ MappingQ::fill_fe_subface_values (const typename Triangulation > &exterior_forms, std::vector > &normal_vectors) const { - // convert data object to internal - // data for this class. fails with - // an exception if that is not - // possible + // convert data object to internal data for this class. fails with an + // exception if that is not possible Assert (dynamic_cast (&mapping_data) != 0, ExcInternalError()); InternalData &data = static_cast (mapping_data); - // check whether this cell needs - // the full mapping or can be - // treated by a reduced Q1 mapping, - // e.g. if the cell is entirely in - // the interior of the domain. note - // that it is not sufficient to ask - // whether the present _face_ is in - // the interior, as the mapping on - // the face depends on the mapping - // of the cell, which in turn - // depends on the fact whether - // _any_ of the faces of this cell - // is at the boundary, not only the - // present face + // check whether this cell needs the full mapping or can be treated by a + // reduced Q1 mapping, e.g. if the cell is entirely in the interior of the + // domain. note that it is not sufficient to ask whether the present _face_ + // is in the interior, as the mapping on the face depends on the mapping of + // the cell, which in turn depends on the fact whether _any_ of the faces of + // this cell is at the boundary, not only the present face data.use_mapping_q1_on_current_cell=!(use_mapping_q_on_all_cells || cell->has_boundary_lines()); - // depending on this result, use - // this or the other data object - // for the mapping + // depending on this result, use this or the other data object for the + // mapping typename MappingQ1::InternalData *p_data=0; if (data.use_mapping_q1_on_current_cell) p_data=&data.mapping_q1_data; @@ -501,25 +463,19 @@ MappingQ::set_laplace_on_quad_vector(Table<2,double> &loqvs) const const unsigned int n_inner_2d=(degree-1)*(degree-1); const unsigned int n_outer_2d=4+4*(degree-1); - // first check whether we have precomputed - // the values for some polynomial degree; - // the sizes of arrays is - // n_inner_2d*n_outer_2d + // first check whether we have precomputed the values for some polynomial + // degree; the sizes of arrays is n_inner_2d*n_outer_2d double const *loqv_ptr=0; switch (degree) { - // for degree==1, we shouldn't have to - // compute any support points, since + // for degree==1, we shouldn't have to compute any support points, since // all of them are on the vertices case 2: { - // (checked these values against the - // output of compute_laplace_vector - // again, and found they're indeed - // right -- just in case someone - // wonders where they come from -- - // WB) + // (checked these values against the output of compute_laplace_vector + // again, and found they're indeed right -- just in case someone wonders + // where they come from -- WB) static const double loqv2[1*8] = {1/16., 1/16., 1/16., 1/16., 3/16., 3/16., 3/16., 3/16.}; loqv_ptr=&loqv2[0]; @@ -530,133 +486,14 @@ MappingQ::set_laplace_on_quad_vector(Table<2,double> &loqvs) const break; } - case 3: - { - // (same as above) - static const double loqv3[4*12] - = {80/1053., 1/81., 1/81., 11/1053., 25/117., 44/351., - 7/117., 16/351., 25/117., 44/351., 7/117., 16/351., - 1/81., 80/1053., 11/1053., 1/81., 7/117., 16/351., - 25/117., 44/351., 44/351., 25/117., 16/351., 7/117., - 1/81., 11/1053., 80/1053., 1/81., 44/351., 25/117., - 16/351., 7/117., 7/117., 16/351., 25/117., 44/351., - 11/1053., 1/81., 1/81., 80/1053., 16/351., 7/117., - 44/351., 25/117., 16/351., 7/117., 44/351., 25/117. - }; - Assert (sizeof(loqv3)/sizeof(loqv3[0]) == - n_inner_2d * n_outer_2d, - ExcInternalError()); - - loqv_ptr=&loqv3[0]; - - break; - } - - - case 4: - { - static const double loqv4[9*16] - = {0.07405921850311571, -0.001075744628905992, - -0.001075744628906007, 0.001914292239071463, - 0.2231273865431892, 0.1346851306015187, - 0.03812914216116724, 0.02913160002633252, - 0.02200737428129396, 0.01600835564431224, - 0.2231273865431891, 0.1346851306015187, - 0.03812914216116723, 0.02913160002633253, - 0.02200737428129391, 0.01600835564431222, - - 0.00664803151334206, 0.006648031513342719, - 0.002873452861657458, 0.002873452861657626, - 0.07903572682584378, 0.05969238281250031, - 0.03619864817415824, 0.07903572682584187, - 0.0596923828124999, 0.03619864817415815, - 0.1527716818820237, 0.2348152760709273, - 0.152771681882024, 0.02496269311797778, - 0.04081948955407129, 0.02496269311797789, - - -0.001075744628906923, 0.07405921850311589, - 0.001914292239071339, -0.001075744628905884, - 0.02913160002633509, 0.02200737428129395, - 0.01600835564431229, 0.2231273865431878, - 0.1346851306015183, 0.0381291421611672, - 0.03812914216116729, 0.1346851306015185, - 0.2231273865431898, 0.01600835564431217, - 0.02200737428129394, 0.02913160002633262, - - 0.006648031513342073, 0.002873452861657473, - 0.006648031513342726, 0.002873452861657636, - 0.1527716818820238, 0.2348152760709273, - 0.152771681882024, 0.02496269311797779, - 0.04081948955407131, 0.0249626931179779, - 0.07903572682584376, 0.05969238281250026, - 0.03619864817415824, 0.07903572682584187, - 0.0596923828124998, 0.0361986481741581, - - 0.01106770833333302, 0.01106770833333336, - 0.01106770833333337, 0.01106770833333374, - 0.06770833333333424, 0.1035156250000011, - 0.0677083333333344, 0.06770833333333376, - 0.103515624999999, 0.06770833333333399, - 0.06770833333333422, 0.1035156250000009, - 0.06770833333333436, 0.0677083333333337, - 0.1035156249999988, 0.0677083333333339, - - 0.002873452861657185, 0.006648031513342362, - 0.002873452861657334, 0.006648031513343038, - 0.02496269311797779, 0.04081948955407401, - 0.02496269311797788, 0.1527716818820234, - 0.234815276070926, 0.1527716818820237, - 0.03619864817415819, 0.05969238281250028, - 0.07903572682584407, 0.03619864817415804, - 0.05969238281249986, 0.0790357268258422, - - -0.001075744628906913, 0.00191429223907134, - 0.07405921850311592, -0.001075744628905865, - 0.03812914216116729, 0.1346851306015185, - 0.2231273865431899, 0.01600835564431217, - 0.02200737428129396, 0.02913160002633264, - 0.02913160002633509, 0.02200737428129391, - 0.01600835564431228, 0.2231273865431878, - 0.1346851306015183, 0.03812914216116718, - - 0.002873452861657176, 0.002873452861657321, - 0.006648031513342374, 0.006648031513343037, - 0.03619864817415817, 0.05969238281250032, - 0.07903572682584409, 0.03619864817415805, - 0.05969238281249992, 0.07903572682584221, - 0.02496269311797776, 0.04081948955407392, - 0.02496269311797785, 0.1527716818820233, - 0.2348152760709258, 0.1527716818820236, - - 0.001914292239071237, -0.001075744628906803, - -0.001075744628906778, 0.07405921850311617, - 0.01600835564431228, 0.02200737428129401, - 0.02913160002633524, 0.03812914216116726, - 0.1346851306015182, 0.2231273865431886, - 0.01600835564431228, 0.02200737428129397, - 0.02913160002633523, 0.03812914216116726, - 0.1346851306015181, 0.2231273865431886, - }; - - Assert (sizeof(loqv4)/sizeof(loqv4[0]) == - n_inner_2d * n_outer_2d, - ExcInternalError()); - - loqv_ptr=&loqv4[0]; - - break; - } - - // no other cases implemented, - // so simply fall through + // no other cases implemented, so simply fall through default: break; } if (loqv_ptr!=0) { - // precomputed. copy values to - // the loqvs array + // precomputed. copy values to the loqvs array loqvs.reinit(n_inner_2d, n_outer_2d); for (unsigned int unit_point=0; unit_point::set_laplace_on_quad_vector(Table<2,double> &loqvs) const else { // not precomputed, then do so now - if (dim==2) + if (dim == 2) compute_laplace_vector(loqvs); - else - // computing the Laplace vector for - // faces is not supported in 3d at - // present. presumably, doing so - // would not be so hard: we would - // only have to call the function in - // 2d, i.e. the quad(=face) values in - // 3d are equal to the quad(=cell) - // values in 2d. however, that would - // require us to link in the 2d - // library, which is kind of awkward - // (note that compute_laplace_vector - // really makes use of a lot of 2d - // stuff, such as FEValues etc). an - // alternative would be to precompute - // the values of this array for a - // couple of higher mapping orders, - // pin down their values and insert - // them into the array above. - Assert (false, ExcNotImplemented()); + else if (dim == 3) + { + MappingQ<2,2> mapping_2d(this->degree); + loqvs = mapping_2d.laplace_on_quad_vector; + } } - // the sum of weights of the points - // at the outer rim should be - // one. check this + // the sum of weights of the points at the outer rim should be one. check + // this for (unsigned int unit_point=0; unit_pointdegree, ExcInternalError()); } @@ -706,9 +527,8 @@ MappingQ<3>::set_laplace_on_hex_vector(Table<2,double> &lohvs) const { Assert(degree>1, ExcInternalError()); - // first check whether we have - // precomputed the values for some - // polynomial degree + // first check whether we have precomputed the values for some polynomial + // degree double const *lohv_ptr=0; if (degree==2) { @@ -724,8 +544,7 @@ MappingQ<3>::set_laplace_on_hex_vector(Table<2,double> &lohvs) const if (lohv_ptr!=0) { - // precomputed. copy values to - // the lohvs array + // precomputed. copy values to the lohvs array lohvs.reinit(n_inner, n_outer); for (unsigned int unit_point=0; unit_point::set_laplace_on_hex_vector(Table<2,double> &lohvs) const // not precomputed, then do so now compute_laplace_vector(lohvs); - // the sum of weights of the points - // at the outer rim should be - // one. check this + // the sum of weights of the points at the outer rim should be one. check + // this for (unsigned int unit_point=0; unit_pointdegree, ExcInternalError()); } @@ -771,14 +589,11 @@ MappingQ::compute_laplace_vector(Table<2,double> &lvs) const Assert(lvs.n_rows()==0, ExcInternalError()); Assert(dim==2 || dim==3, ExcNotImplemented()); - // for degree==1, we shouldn't have to - // compute any support points, since all of - // them are on the vertices + // for degree==1, we shouldn't have to compute any support points, since all + // of them are on the vertices Assert(degree>1, ExcInternalError()); - // compute the shape - // gradients at the quadrature - // points on the unit cell + // compute the shape gradients at the quadrature points on the unit cell const QGauss quadrature(degree+1); const unsigned int n_q_points=quadrature.size(); @@ -786,37 +601,44 @@ MappingQ::compute_laplace_vector(Table<2,double> &lvs) const quadrature_data.shape_derivatives.resize(n_shape_functions * n_q_points); this->compute_shapes(quadrature.get_points(), quadrature_data); - // Compute the stiffness matrix of - // the inner dofs - FullMatrix S(n_inner); + // Compute the stiffness matrix of the inner dofs + FullMatrix S(n_inner); for (unsigned int point=0; point T(n_inner, n_outer); + FullMatrix T(n_inner, n_outer); for (unsigned int point=0; point S_1(n_inner); + FullMatrix S_1(n_inner); S_1.invert(S); - FullMatrix S_1_T(n_inner, n_outer); + FullMatrix S_1_T(n_inner, n_outer); // S:=S_1*T S_1.mmult(S_1_T,T); - // Resize and initialize the - // lvs + // Resize and initialize the lvs lvs.reinit (n_inner, n_outer); for (unsigned int i=0; i::apply_laplace_vector(const Table<2,double> &lvs, std::vector > &a) const { - // check whether the data we need - // is really available. if you fail - // here and if - // lvs==laplace_on_quad_vector in - // the calling function, then we - // didn't compute the quad laplace - // vector. this is mentioned in the - // constructor of this class, - // although I don't understand the - // reason for not aborting there + // check whether the data we need is really available. if you fail here and + // if lvs==laplace_on_quad_vector in the calling function, then we didn't + // compute the quad laplace vector. this is mentioned in the constructor of + // this class, although I don't understand the reason for not aborting there // any more [WB] Assert(lvs.n_rows()!=0, ExcLaplaceVectorNotSet(degree)); @@ -850,12 +666,9 @@ MappingQ::apply_laplace_vector(const Table<2,double> &lvs, Assert(a.size()==n_outer_apply, ExcDimensionMismatch(a.size(), n_outer_apply)); - // compute each inner point as - // linear combination of the outer - // points. the weights are given by - // the lvs entries, the outer - // points are the first (existing) - // elements of a + // compute each inner point as linear combination of the outer points. the + // weights are given by the lvs entries, the outer points are the first + // (existing) elements of a for (unsigned int unit_point=0; unit_point::compute_mapping_support_points( const typename Triangulation::cell_iterator &cell, std::vector > &a) const { - // if this is a cell for which we - // want to compute the full - // mapping, then get them from the - // following function + // if this is a cell for which we want to compute the full mapping, then get + // them from the following function if (use_mapping_q_on_all_cells || cell->has_boundary_lines()) compute_support_points_laplace(cell, a); else - // otherwise: use a Q1 mapping - // for which the mapping shape - // function support points are - // simply the vertices of the - // cell + // otherwise: use a Q1 mapping for which the mapping shape function + // support points are simply the vertices of the cell { a.resize(GeometryInfo::vertices_per_cell); @@ -900,8 +708,7 @@ void MappingQ::compute_support_points_laplace(const typename Triangulation::cell_iterator &cell, std::vector > &a) const { - // in any case, we need the - // vertices first + // in any case, we need the vertices first a.resize(GeometryInfo::vertices_per_cell); for (unsigned int i=0; i::vertices_per_cell; ++i) a[i] = cell->vertex(i); @@ -913,11 +720,8 @@ MappingQ::compute_support_points_laplace(const typename Triangulat add_line_support_points(cell, a); break; case 2: - // in 2d, add the - // points on the four - // bounding lines to - // the exterior (outer) - // points + // in 2d, add the points on the four bounding lines to the exterior + // (outer) points add_line_support_points (cell, a); if (dim != spacedim) add_quad_support_points(cell, a); @@ -927,9 +731,7 @@ MappingQ::compute_support_points_laplace(const typename Triangulat case 3: { - // in 3d also add the - // points located on - // the boundary faces + // in 3d also add the points located on the boundary faces add_line_support_points (cell, a); add_quad_support_points (cell, a); apply_laplace_vector (laplace_on_hex_vector, a); @@ -948,8 +750,7 @@ void MappingQ<1>::add_line_support_points (const Triangulation<1>::cell_iterator &, std::vector > &) const { - // there are no points on bounding - // lines which are to be added + // there are no points on bounding lines which are to be added const unsigned int dim=1; Assert (dim > 1, ExcImpossibleInDim(dim)); } @@ -963,8 +764,7 @@ MappingQ<1,2>::add_line_support_points (const Triangulation<1,2>::cell_iterator { const unsigned int dim = 1; const unsigned int spacedim = 2; - // Ask for the mid point, if that's - // the only thing we need. + // Ask for the mid point, if that's the only thing we need. if (degree==2) { const Boundary *const boundary @@ -972,10 +772,8 @@ MappingQ<1,2>::add_line_support_points (const Triangulation<1,2>::cell_iterator a.push_back(boundary->get_new_point_on_line(cell)); } else - // otherwise call the more - // complicated functions and ask - // for inner points from the - // boundary description + // otherwise call the more complicated functions and ask for inner points + // from the boundary description { std::vector > line_points (degree-1); @@ -997,8 +795,7 @@ MappingQ<1,3>::add_line_support_points (const Triangulation<1,3>::cell_iterator { const unsigned int dim = 1; const unsigned int spacedim = 3; - // Ask for the mid point, if that's - // the only thing we need. + // Ask for the mid point, if that's the only thing we need. if (degree==2) { const Boundary *const boundary @@ -1006,10 +803,8 @@ MappingQ<1,3>::add_line_support_points (const Triangulation<1,3>::cell_iterator a.push_back(boundary->get_new_point_on_line(cell)); } else - // otherwise call the more - // complicated functions and ask - // for inner points from the - // boundary description + // otherwise call the more complicated functions and ask for inner points + // from the boundary description { std::vector > line_points (degree-1); @@ -1030,8 +825,7 @@ MappingQ::add_line_support_points (const typename Triangulation > &a) const { static const StraightBoundary straight_boundary; - // if we only need the midpoint, - // then ask for it. + // if we only need the midpoint, then ask for it. if (degree==2) { for (unsigned int line_no=0; line_no::lines_per_cell; ++line_no) @@ -1048,19 +842,13 @@ MappingQ::add_line_support_points (const typename Triangulation > line_points (degree-1); - // loop over each of the lines, - // and if it is at the - // boundary, then first get the - // boundary description and - // second compute the points on - // it + // loop over each of the lines, and if it is at the boundary, then first + // get the boundary description and second compute the points on it for (unsigned int line_no=0; line_no::lines_per_cell; ++line_no) { const typename Triangulation::line_iterator line = cell->line(line_no); @@ -1075,8 +863,7 @@ MappingQ::add_line_support_points (const typename Triangulationget_intermediate_points_on_line (line, line_points); if (dim==3) { - // in 3D, lines might be in wrong - // orientation. if so, reverse + // in 3D, lines might be in wrong orientation. if so, reverse // the vector if (cell->line_orientation(line_no)) a.insert (a.end(), line_points.begin(), line_points.end()); @@ -1084,9 +871,8 @@ MappingQ::add_line_support_points (const typename Triangulation::cell_iterator &cell, vertices_per_cell = GeometryInfo<3>::vertices_per_cell; static const StraightBoundary<3> straight_boundary; - // used if face quad at boundary or - // entirely in the interior of the - // domain + // used if face quad at boundary or entirely in the interior of the domain std::vector > quad_points ((degree-1)*(degree-1)); - // used if only one line of face - // quad is at boundary + // used if only one line of face quad is at boundary std::vector > b(4*degree); - // loop over all faces and collect - // points on them + // loop over all faces and collect points on them for (unsigned int face_no=0; face_no::face_iterator face = cell->face(face_no); - // select the correct mappings - // for the present face + // select the correct mappings for the present face const bool face_orientation = cell->face_orientation(face_no), face_flip = cell->face_flip (face_no), face_rotation = cell->face_rotation (face_no); @@ -1138,9 +919,7 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell, face_rotation)), ExcInternalError()); - // indices of the lines that - // bound a face are given by - // GeometryInfo<3>:: + // indices of the lines that bound a face are given by GeometryInfo<3>:: // face_to_cell_lines for (unsigned int i=0; iline(i)==cell->line(GeometryInfo<3>::face_to_cell_lines( @@ -1148,22 +927,16 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell, ExcInternalError()); #endif - // if face at boundary, then - // ask boundary object to - // return intermediate points - // on it + // if face at boundary, then ask boundary object to return intermediate + // points on it if (face->at_boundary()) { face->get_triangulation().get_boundary(face->boundary_indicator()) .get_intermediate_points_on_quad (face, quad_points); - // in 3D, the orientation, flip and - // rotation of the face might not - // match what we expect here, namely - // the standard orientation. thus - // reorder points accordingly. since - // a Mapping uses the same shape - // function as an FEQ, we can ask a - // FEQ to do the reordering for us. + // in 3D, the orientation, flip and rotation of the face might not + // match what we expect here, namely the standard orientation. thus + // reorder points accordingly. since a Mapping uses the same shape + // function as an FEQ, we can ask a FEQ to do the reordering for us. for (unsigned int i=0; i::cell_iterator &cell, } else { - // face is not at boundary, - // but maybe some of its - // lines are. count them + // face is not at boundary, but maybe some of its lines are. count + // them unsigned int lines_at_boundary=0; for (unsigned int i=0; iline(i)->at_boundary()) @@ -1182,37 +954,23 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell, Assert(lines_at_boundary<=lines_per_face, ExcInternalError()); - // if at least one of the - // lines bounding this quad - // is at the boundary, then - // collect points - // separately + // if at least one of the lines bounding this quad is at the + // boundary, then collect points separately if (lines_at_boundary>0) { - // call of function - // apply_laplace_vector - // increases size of b - // about 1. There - // resize b for the - // case the mentioned - // function was already - // called. + // call of function apply_laplace_vector increases size of b + // about 1. There resize b for the case the mentioned function + // was already called. b.resize(4*degree); - // b is of size - // 4*degree, make sure - // that this is the - // right size + // b is of size 4*degree, make sure that this is the right size Assert(b.size()==vertices_per_face+lines_per_face*(degree-1), ExcDimensionMismatch(b.size(), vertices_per_face+lines_per_face*(degree-1))); - // sort the points into b. We - // used access from the cell (not - // from the face) to fill b, so - // we can assume a standard face - // orientation. Doing so, the - // calculated points will be in + // sort the points into b. We used access from the cell (not + // from the face) to fill b, so we can assume a standard face + // orientation. Doing so, the calculated points will be in // standard orientation as well. for (unsigned int i=0; i::face_to_cell_vertices(face_no, i)]; @@ -1223,8 +981,7 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell, a[vertices_per_cell + GeometryInfo<3>::face_to_cell_lines( face_no, i)*(degree-1)+j]; - // Now b includes the support - // points on the quad and we can + // Now b includes the support points on the quad and we can // apply the laplace vector apply_laplace_vector(laplace_on_quad_vector, b); Assert(b.size()==4*degree+(degree-1)*(degree-1), @@ -1235,22 +992,14 @@ add_quad_support_points(const Triangulation<3>::cell_iterator &cell, } else { - // face is entirely in - // the interior. get - // intermediate points - // from a straight - // boundary object + // face is entirely in the interior. get intermediate points + // from a straight boundary object straight_boundary.get_intermediate_points_on_quad (face, quad_points); - // in 3D, the orientation, flip - // and rotation of the face might - // not match what we expect here, - // namely the standard - // orientation. thus reorder - // points accordingly. since a - // Mapping uses the same shape - // function as an FEQ, we can ask - // a FEQ to do the reordering for - // us. + // in 3D, the orientation, flip and rotation of the face might + // not match what we expect here, namely the standard + // orientation. thus reorder points accordingly. since a Mapping + // uses the same shape function as an FEQ, we can ask a FEQ to + // do the reordering for us. for (unsigned int i=0; i::transform ( const MappingType mapping_type) const { AssertDimension (input.size(), output.size()); - // The data object may be just a - // MappingQ1::InternalData, so we - // have to test for this first. + // The data object may be just a MappingQ1::InternalData, so we have to test + // for this first. const typename MappingQ1::InternalData *q1_data = dynamic_cast::InternalData *> (&mapping_data); Assert(q1_data!=0, ExcInternalError()); - // If it is a genuine - // MappingQ::InternalData, we have - // to test further + // If it is a genuine MappingQ::InternalData, we have to test further if (!q1_data->is_mapping_q1_data) { Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); const InternalData &data = static_cast(mapping_data); - // If we only use the - // Q1-portion, we have to - // extract that data object + // If we only use the Q1-portion, we have to extract that data object if (data.use_mapping_q1_on_current_cell) q1_data = &data.mapping_q1_data; } - // Now, q1_data should have the - // right tensors in it and we call - // the base classes transform - // function + // Now, q1_data should have the right tensors in it and we call the base + // classes transform function MappingQ1::transform(input, output, *q1_data, mapping_type); } @@ -1338,31 +1080,24 @@ MappingQ::transform ( const MappingType mapping_type) const { AssertDimension (input.size(), output.size()); - // The data object may be just a - // MappingQ1::InternalData, so we - // have to test for this first. + // The data object may be just a MappingQ1::InternalData, so we have to test + // for this first. const typename MappingQ1::InternalData *q1_data = dynamic_cast::InternalData *> (&mapping_data); Assert(q1_data!=0, ExcInternalError()); - // If it is a genuine - // MappingQ::InternalData, we have - // to test further + // If it is a genuine MappingQ::InternalData, we have to test further if (!q1_data->is_mapping_q1_data) { Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); const InternalData &data = static_cast(mapping_data); - // If we only use the - // Q1-portion, we have to - // extract that data object + // If we only use the Q1-portion, we have to extract that data object if (data.use_mapping_q1_on_current_cell) q1_data = &data.mapping_q1_data; } - // Now, q1_data should have the - // right tensors in it and we call - // the base classes transform - // function + // Now, q1_data should have the right tensors in it and we call the base + // classes transform function MappingQ1::transform(input, output, *q1_data, mapping_type); } @@ -1375,31 +1110,24 @@ void MappingQ::transform const MappingType mapping_type) const { AssertDimension (input.size(), output.size()); - // The data object may be just a - // MappingQ1::InternalData, so we - // have to test for this first. + // The data object may be just a MappingQ1::InternalData, so we have to test + // for this first. const typename MappingQ1::InternalData *q1_data = dynamic_cast::InternalData *> (&mapping_data); Assert(q1_data!=0, ExcInternalError()); - // If it is a genuine - // MappingQ::InternalData, we have - // to test further + // If it is a genuine MappingQ::InternalData, we have to test further if (!q1_data->is_mapping_q1_data) { Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); const InternalData &data = static_cast(mapping_data); - // If we only use the - // Q1-portion, we have to - // extract that data object + // If we only use the Q1-portion, we have to extract that data object if (data.use_mapping_q1_on_current_cell) q1_data = &data.mapping_q1_data; } - // Now, q1_data should have the - // right tensors in it and we call - // the base classes transform - // function + // Now, q1_data should have the right tensors in it and we call the base + // classes transform function MappingQ1::transform(input, output, *q1_data, mapping_type); } @@ -1410,11 +1138,9 @@ MappingQ:: transform_unit_to_real_cell (const typename Triangulation::cell_iterator &cell, const Point &p) const { - // Use the get_data function to - // create an InternalData with data - // vectors of the right size and - // transformation shape values - // already computed at point p. + // Use the get_data function to create an InternalData with data vectors of + // the right size and transformation shape values already computed at point + // p. const Quadrature point_quadrature(p); std::auto_ptr mdata (dynamic_cast ( @@ -1429,8 +1155,7 @@ transform_unit_to_real_cell (const typename Triangulation::cell_it &*mdata); compute_mapping_support_points(cell, p_data->mapping_support_points); - // If this should be Q1, ignore all - // other support points. + // If this should be Q1, ignore all other support points. if (p_data->shape_values.size()mapping_support_points.size()) p_data->mapping_support_points.resize (GeometryInfo::vertices_per_cell); @@ -1447,24 +1172,15 @@ MappingQ:: transform_real_to_unit_cell (const typename Triangulation::cell_iterator &cell, const Point &p) const { - // first a Newton iteration based - // on a Q1 mapping to get a good - // starting point, the idea being - // that this is cheaper than trying - // to start with the real mapping - // and likely also more robust. + // first a Newton iteration based on a Q1 mapping to get a good starting + // point, the idea being that this is cheaper than trying to start with the + // real mapping and likely also more robust. // - // that said, this doesn't always - // work: there are cases where the - // point is outside the cell and - // the inverse mapping doesn't - // converge. in that case, use the - // center point of the cell as a - // starting point if we are to go - // on using the full mapping, or - // just propagate up the exception - // if we had no intention of - // continuing with the full mapping + // that said, this doesn't always work: there are cases where the point is + // outside the cell and the inverse mapping doesn't converge. in that case, + // use the center point of the cell as a starting point if we are to go on + // using the full mapping, or just propagate up the exception if we had no + // intention of continuing with the full mapping Point initial_p_unit; try { @@ -1473,11 +1189,8 @@ transform_real_to_unit_cell (const typename Triangulation::cell_it } catch (const typename Mapping::ExcTransformationFailed &) { - // mirror the conditions of the - // code below to determine if - // we need to use an arbitrary - // starting point or if we just - // need to rethrow the + // mirror the conditions of the code below to determine if we need to + // use an arbitrary starting point or if we just need to rethrow the // exception if (cell->has_boundary_lines() || @@ -1492,30 +1205,22 @@ transform_real_to_unit_cell (const typename Triangulation::cell_it throw; } - // then a Newton iteration based on the - // full MappingQ if we need this. note that - // for interior cells with dim==spacedim, - // the mapping used is in fact a Q1 - // mapping, so there is nothing we need to - // do unless the iteration above failed + // then a Newton iteration based on the full MappingQ if we need this. note + // that for interior cells with dim==spacedim, the mapping used is in fact a + // Q1 mapping, so there is nothing we need to do unless the iteration above + // failed if (cell->has_boundary_lines() || use_mapping_q_on_all_cells || (dim!=spacedim) ) { - // use the full mapping. in case the - // function above should have given us - // something back that lies outside the - // unit cell (that might happen because - // we may have given a point 'p' that - // lies inside the cell with the higher - // order mapping, but outside the - // Q1-mapped reference cell), then - // project it back into the reference - // cell in hopes that this gives a - // better starting point to the - // following iteration + // use the full mapping. in case the function above should have given us + // something back that lies outside the unit cell (that might happen + // because we may have given a point 'p' that lies inside the cell with + // the higher order mapping, but outside the Q1-mapped reference cell), + // then project it back into the reference cell in hopes that this gives + // a better starting point to the following iteration initial_p_unit = GeometryInfo::project_to_unit_cell(initial_p_unit); const Quadrature point_quadrature(initial_p_unit); @@ -1531,13 +1236,11 @@ transform_real_to_unit_cell (const typename Triangulation::cell_it compute_mapping_support_points (cell, mdata->mapping_support_points); - // If this is a q1 mapping, - // then only use the support - // points on the vertices. + // If this is a q1 mapping, then only use the support points on the + // vertices. if (mdata->shape_values.size() < mdata->mapping_support_points.size()) mdata->mapping_support_points.resize(GeometryInfo::vertices_per_cell); - return this->transform_real_to_unit_cell_internal(cell, p, initial_p_unit, *mdata); } else diff --git a/deal.II/source/fe/mapping_q.inst.in b/deal.II/source/fe/mapping_q.inst.in index c705674d50..f1ec88e76f 100644 --- a/deal.II/source/fe/mapping_q.inst.in +++ b/deal.II/source/fe/mapping_q.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + diff --git a/deal.II/source/fe/mapping_q1.cc b/deal.II/source/fe/mapping_q1.cc index e141e0a3a6..530a199602 100644 --- a/deal.II/source/fe/mapping_q1.cc +++ b/deal.II/source/fe/mapping_q1.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -961,7 +965,7 @@ namespace internal case 1: // in 1d, we don't have access to any of the data.aux // fields (because it has only dim-1 components), but we - // can still compute the boundary form simply by simply + // can still compute the boundary form by simply // looking at the number of the face boundary_forms[i][0] = (face_no == 0 ? -1 : +1); diff --git a/deal.II/source/fe/mapping_q1.inst.in b/deal.II/source/fe/mapping_q1.inst.in index a528ce957a..b4ee36efc4 100644 --- a/deal.II/source/fe/mapping_q1.inst.in +++ b/deal.II/source/fe/mapping_q1.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { diff --git a/deal.II/source/fe/mapping_q1_eulerian.cc b/deal.II/source/fe/mapping_q1_eulerian.cc index a2a73a7776..f02797d6c5 100644 --- a/deal.II/source/fe/mapping_q1_eulerian.cc +++ b/deal.II/source/fe/mapping_q1_eulerian.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/fe/mapping_q1_eulerian.inst.in b/deal.II/source/fe/mapping_q1_eulerian.inst.in index e479e35903..06d1ebc290 100644 --- a/deal.II/source/fe/mapping_q1_eulerian.inst.in +++ b/deal.II/source/fe/mapping_q1_eulerian.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/fe/mapping_q_eulerian.cc b/deal.II/source/fe/mapping_q_eulerian.cc index 22eb4c1d2a..902c6cd359 100644 --- a/deal.II/source/fe/mapping_q_eulerian.cc +++ b/deal.II/source/fe/mapping_q_eulerian.cc @@ -1,21 +1,26 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include #include #include +#include +#include +#include #include #include #include @@ -66,20 +71,15 @@ SupportQuadrature (const unsigned int map_degree) : Quadrature(Utilities::fixed_power(map_degree+1)) { - // first we determine the support points - // on the unit cell in lexicographic order. - // for this purpose we can use an interated - // trapezoidal quadrature rule. - const QTrapez<1> q1d; - const QIterated q_iterated(q1d,map_degree); + // first we determine the support points on the unit cell in lexicographic + // order, which are (in accordance with MappingQ) the support points of + // QGaussLobatto. + const QGaussLobatto q_iterated(map_degree+1); const unsigned int n_q_points = q_iterated.size(); - // we then need to define a renumbering - // vector that allows us to go from a - // lexicographic numbering scheme to a hierarchic - // one. this fragment is taking almost verbatim - // from the MappingQ class. - + // we then need to define a renumbering vector that allows us to go from a + // lexicographic numbering scheme to a hierarchic one. this fragment is + // taking almost verbatim from the MappingQ class. std::vector renumber(n_q_points); std::vector dpo(dim+1, 1U); for (unsigned int i=1; i (dpo, 1, map_degree), renumber); - // finally we assign the quadrature points in the - // required order. - + // finally we assign the quadrature points in the required order. for (unsigned int q=0; qquadrature_points[renumber[q]] = q_iterated.point(q); } @@ -107,43 +105,30 @@ compute_mapping_support_points std::vector > &a) const { - // first, basic assertion - // with respect to vector size, + // first, basic assertion with respect to vector size, const types::global_dof_index n_dofs = euler_dof_handler->n_dofs(); const types::global_dof_index vector_size = euler_vector->size(); AssertDimension(vector_size,n_dofs); - // we then transform our tria iterator - // into a dof iterator so we can - // access data not associated with - // triangulations + // we then transform our tria iterator into a dof iterator so we can access + // data not associated with triangulations typename DoFHandler::cell_iterator dof_cell(*cell, euler_dof_handler); Assert (dof_cell->active() == true, ExcInactiveCell()); - // our quadrature rule is chosen - // so that each quadrature point - // corresponds to a support point - // in the undeformed configuration. - // we can then query the given - // displacement field at these points - // to determine the shift vector that - // maps the support points to the - // deformed configuration. - - // we assume that the given field contains - // dim displacement components, but - // that there may be other solution - // components as well (e.g. pressures). - // this class therefore assumes that the - // first dim components represent the - // actual shift vector we need, and simply - // ignores any components after that. - // this implies that the user should order - // components appropriately, or create a - // separate dof handler for the displacements. + // our quadrature rule is chosen so that each quadrature point corresponds + // to a support point in the undeformed configuration. we can then query + // the given displacement field at these points to determine the shift + // vector that maps the support points to the deformed configuration. + + // we assume that the given field contains dim displacement components, but + // that there may be other solution components as well (e.g. pressures). + // this class therefore assumes that the first dim components represent the + // actual shift vector we need, and simply ignores any components after + // that. this implies that the user should order components appropriately, + // or create a separate dof handler for the displacements. const unsigned int n_support_pts = support_quadrature.size(); const unsigned int n_components = euler_dof_handler->get_fe().n_components(); @@ -152,20 +137,15 @@ compute_mapping_support_points std::vector > shift_vector(n_support_pts,Vector(n_components)); - // fill shift vector for each - // support point using an fe_values - // object. make sure that the - // fe_values variable isn't used - // simulatenously from different + // fill shift vector for each support point using an fe_values object. make + // sure that the fe_values variable isn't used simulatenously from different // threads Threads::Mutex::ScopedLock lock(fe_values_mutex); fe_values.reinit(dof_cell); fe_values.get_function_values(*euler_vector, shift_vector); - // and finally compute the positions of the - // support points in the deformed + // and finally compute the positions of the support points in the deformed // configuration. - a.resize(n_support_pts); for (unsigned int q=0; q::fill_fe_values ( std::vector > &normal_vectors, CellSimilarity::Similarity &cell_similarity) const { - // disable any previously detected - // similarity and hand on to the respective + // disable any previously detected similarity and hand on to the respective // function of the base class. cell_similarity = CellSimilarity::invalid_next_cell; MappingQ::fill_fe_values (cell, q, mapping_data, diff --git a/deal.II/source/fe/mapping_q_eulerian.inst.in b/deal.II/source/fe/mapping_q_eulerian.inst.in index 4bed2047f6..439ef92f51 100644 --- a/deal.II/source/fe/mapping_q_eulerian.inst.in +++ b/deal.II/source/fe/mapping_q_eulerian.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { @@ -21,6 +25,17 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template class MappingQEulerian; # endif +# ifdef DEAL_II_WITH_TRILINOS + template class MappingQEulerian; + template class MappingQEulerian; + template class MappingQEulerian; + template class MappingQEulerian; +# endif + #endif } diff --git a/deal.II/source/grid/CMakeLists.txt b/deal.II/source/grid/CMakeLists.txt index bd92b3debb..fcac409a1b 100644 --- a/deal.II/source/grid/CMakeLists.txt +++ b/deal.II/source/grid/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/grid/*.h - ) - SET(_src grid_generator.cc grid_in.cc @@ -50,6 +48,9 @@ SET(_inst tria_objects.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/grid/*.h + ) + DEAL_II_ADD_LIBRARY(obj_grid OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_grid "${_inst}") - diff --git a/deal.II/source/grid/grid_generator.cc b/deal.II/source/grid/grid_generator.cc index 34bcf1a71e..298de0aac3 100644 --- a/deal.II/source/grid/grid_generator.cc +++ b/deal.II/source/grid/grid_generator.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -44,3784 +46,3795 @@ DEAL_II_NAMESPACE_OPEN -namespace +namespace GridGenerator { - // Corner points of the cube [-1,1]^3 - const Point<3> hexahedron[8] = + namespace { - Point<3>(-1,-1,-1), - Point<3>(+1,-1,-1), - Point<3>(-1,+1,-1), - Point<3>(+1,+1,-1), - Point<3>(-1,-1,+1), - Point<3>(+1,-1,+1), - Point<3>(-1,+1,+1), - Point<3>(+1,+1,+1) - }; - - // Octahedron inscribed in the cube - // [-1,1]^3 - const Point<3> octahedron[6] = - { - Point<3>(-1, 0, 0), - Point<3>( 1, 0, 0), - Point<3>( 0,-1, 0), - Point<3>( 0, 1, 0), - Point<3>( 0, 0,-1), - Point<3>( 0, 0, 1) - }; -} - + // Corner points of the cube [-1,1]^3 + const Point<3> hexahedron[8] = + { + Point<3>(-1,-1,-1), + Point<3>(+1,-1,-1), + Point<3>(-1,+1,-1), + Point<3>(+1,+1,-1), + Point<3>(-1,-1,+1), + Point<3>(+1,-1,+1), + Point<3>(-1,+1,+1), + Point<3>(+1,+1,+1) + }; -template -void -GridGenerator::hyper_rectangle (Triangulation &tria, - const Point &p_1, - const Point &p_2, - const bool colorize) -{ - // First, normalize input such that - // p1 is lower in all coordinate directions. - Point p1(p_1); - Point p2(p_2); + // Octahedron inscribed in the cube + // [-1,1]^3 + const Point<3> octahedron[6] = + { + Point<3>(-1, 0, 0), + Point<3>( 1, 0, 0), + Point<3>( 0,-1, 0), + Point<3>( 0, 1, 0), + Point<3>( 0, 0,-1), + Point<3>( 0, 0, 1) + }; - for (unsigned int i=0; i p2(i)) - std::swap (p1(i), p2(i)); - std::vector > vertices (GeometryInfo::vertices_per_cell); - switch (dim) + /** + * Perform the action specified by the @p colorize flag of the + * hyper_rectangle() function of this class. + */ + template + void + colorize_hyper_rectangle (Triangulation &tria) { - case 1: - vertices[0] = p1; - vertices[1] = p2; - break; - case 2: - vertices[0] = vertices[1] = p1; - vertices[2] = vertices[3] = p2; - - vertices[1](0) = p2(0); - vertices[2](0) = p1(0); - break; - case 3: - vertices[0] = vertices[1] = vertices[2] = vertices[3] = p1; - vertices[4] = vertices[5] = vertices[6] = vertices[7] = p2; + // there is nothing to do in 1d + if (dim > 1) + { + // there is only one cell, so + // simple task + const typename Triangulation::cell_iterator + cell = tria.begin(); + for (unsigned int f=0; f::faces_per_cell; ++f) + cell->face(f)->set_boundary_indicator (f); + } + } - vertices[1](0) = p2(0); - vertices[2](1) = p2(1); - vertices[3](0) = p2(0); - vertices[3](1) = p2(1); - vertices[4](0) = p1(0); - vertices[4](1) = p1(1); - vertices[5](1) = p1(1); - vertices[6](0) = p1(0); - break; - default: - Assert (false, ExcNotImplemented ()); + void + colorize_subdivided_hyper_rectangle (Triangulation<1> &tria, + const Point<1> &, + const Point<1> &, + const double) + { + for (Triangulation<1>::cell_iterator cell = tria.begin(); + cell != tria.end(); ++cell) + if (cell->center()(0) > 0) + cell->set_material_id(1); + // boundary indicators are set to + // 0 (left) and 1 (right) by default. } - // Prepare cell data - std::vector > cells (1); - for (unsigned int i=0; i::vertices_per_cell; ++i) - cells[0].vertices[i] = i; - cells[0].material_id = 0; - tria.create_triangulation (vertices, cells, SubCellData()); - // Assign boundary indicators - if (colorize) - colorize_hyper_rectangle (tria); -} + template + void + colorize_subdivided_hyper_rectangle (Triangulation &tria, + const Point &p1, + const Point &p2, + const double epsilon) + { + // run through all faces and check + // if one of their center coordinates matches + // one of the corner points. Comparisons + // are made using an epsilon which + // should be smaller than the smallest cell + // diameter. + typename Triangulation::face_iterator face = tria.begin_face(), + endface = tria.end_face(); + for (; face!=endface; ++face) + { + if (face->boundary_indicator() == 0) + { + const Point center (face->center()); + if (std::abs(center(0)-p1[0]) < epsilon) + face->set_boundary_indicator(0); + else if (std::abs(center(0) - p2[0]) < epsilon) + face->set_boundary_indicator(1); + else if (dim > 1 && std::abs(center(1) - p1[1]) < epsilon) + face->set_boundary_indicator(2); + else if (dim > 1 && std::abs(center(1) - p2[1]) < epsilon) + face->set_boundary_indicator(3); + else if (dim > 2 && std::abs(center(2) - p1[2]) < epsilon) + face->set_boundary_indicator(4); + else if (dim > 2 && std::abs(center(2) - p2[2]) < epsilon) + face->set_boundary_indicator(5); + else + // triangulation says it + // is on the boundary, + // but we could not find + // on which boundary. + Assert (false, ExcInternalError()); -template -void -GridGenerator::colorize_hyper_rectangle (Triangulation &tria) -{ - // there is nothing to do in 1d - if (dim > 1) - { - // there is only one cell, so - // simple task - const typename Triangulation::cell_iterator - cell = tria.begin(); - for (unsigned int f=0; f::faces_per_cell; ++f) - cell->face(f)->set_boundary_indicator (f); + } + } + for (typename Triangulation::cell_iterator cell = tria.begin(); + cell != tria.end(); ++cell) + { + char id = 0; + for (unsigned int d=0; dcenter()(d) > 0) id += 1 << d; + cell->set_material_id(id); + } } -} - -template -void GridGenerator::hyper_cube (Triangulation &tria, - const double left, - const double right) -{ - Assert (left < right, - ExcMessage ("Invalid left-to-right bounds of hypercube")); - - Point p1; - Point p2; + /** + * Assign boundary number zero to the inner shell boundary and 1 to the + * outer. + */ + void colorize_hyper_shell (Triangulation<1> &, + const Point<1> &, + const double, + const double) + { + Assert (false, ExcNotImplemented()); + } - p1(spacedim-1) = 0; - p2(spacedim-1) = 0; - for (unsigned int i=0; i &tria, + const Point<2> &, + const double, + const double) { - p1(i) = left; - p2(i) = right; + // In spite of receiving geometrical + // data, we do this only based on + // topology. + + // For the mesh based on cube, + // this is highly irregular + for (Triangulation<2>::cell_iterator cell = tria.begin (); + cell != tria.end (); ++cell) + { + Assert(cell->face(2)->at_boundary(), ExcInternalError()); + cell->face (2)->set_boundary_indicator (1); + } } - hyper_rectangle (tria, p1, p2); -} + /** + * Assign boundary number zero to the inner shell boundary and 1 to the + * outer. + */ + void + colorize_hyper_shell (Triangulation<3> &tria, + const Point<3> &, + const double, + const double) + { + // the following uses a good amount + // of knowledge about the + // orientation of cells. this is + // probably not good style... + if (tria.n_cells() == 6) + { + Triangulation<3>::cell_iterator cell = tria.begin(); -void -GridGenerator::moebius ( - Triangulation<3> &tria, - const size_type n_cells, - const unsigned int n_rotations, - const double R, - const double r) -{ - const unsigned int dim=3; - Assert (n_cells>4, ExcMessage("More than 4 cells are needed to create a moebius grid.")); - Assert (r>0 && R>0, ExcMessage("Outer and inner radius must be positive.")); - Assert (R>r, ExcMessage("Outer radius must be greater than inner radius.")); + cell->face(4)->set_boundary_indicator(1); + Assert (cell->face(4)->at_boundary(), ExcInternalError()); + (++cell)->face(2)->set_boundary_indicator(1); + Assert (cell->face(2)->at_boundary(), ExcInternalError()); - std::vector > vertices (4*n_cells); - double beta_step=n_rotations*numbers::PI/2.0/n_cells; - double alpha_step=2.0*numbers::PI/n_cells; + (++cell)->face(2)->set_boundary_indicator(1); + Assert (cell->face(2)->at_boundary(), ExcInternalError()); - for (size_type i=0; iface(0)->set_boundary_indicator(1); + Assert (cell->face(0)->at_boundary(), ExcInternalError()); - size_type offset=0; + (++cell)->face(2)->set_boundary_indicator(1); + Assert (cell->face(2)->at_boundary(), ExcInternalError()); - std::vector > cells (n_cells); - for (size_type i=0; iface(0)->set_boundary_indicator(1); + Assert (cell->face(0)->at_boundary(), ExcInternalError()); + } + else if (tria.n_cells() == 12) + { + // again use some internal + // knowledge + for (Triangulation<3>::cell_iterator cell = tria.begin(); + cell != tria.end(); ++cell) + { + Assert (cell->face(5)->at_boundary(), ExcInternalError()); + cell->face(5)->set_boundary_indicator(1); + } + } + else if (tria.n_cells() == 96) { - cells[i].vertices[0+4*j]=offset+0+4*j; - cells[i].vertices[1+4*j]=offset+3+4*j; - cells[i].vertices[2+4*j]=offset+2+4*j; - cells[i].vertices[3+4*j]=offset+1+4*j; + // the 96-cell hypershell is + // based on a once refined + // 12-cell mesh. consequently, + // since the outer faces all + // are face_no==5 above, so + // they are here (unless they + // are in the interior). Use + // this to assign boundary + // indicators, but also make + // sure that we encounter + // exactly 48 such faces + unsigned int count = 0; + for (Triangulation<3>::cell_iterator cell = tria.begin(); + cell != tria.end(); ++cell) + if (cell->face(5)->at_boundary()) + { + cell->face(5)->set_boundary_indicator(1); + ++count; + } + Assert (count == 48, ExcInternalError()); } - offset+=4; - cells[i].material_id=0; + else + Assert (false, ExcNotImplemented()); } - // now correct the last four vertices - cells[n_cells-1].vertices[4]=(0+n_rotations)%4; - cells[n_cells-1].vertices[5]=(3+n_rotations)%4; - cells[n_cells-1].vertices[6]=(2+n_rotations)%4; - cells[n_cells-1].vertices[7]=(1+n_rotations)%4; - GridReordering::invert_all_cells_of_negative_grid(vertices,cells); - tria.create_triangulation_compatibility (vertices, cells, SubCellData()); -} + /** + * Assign boundary number zero the inner shell boundary, one to the outer + * shell boundary, two to the face with x=0, three to the face with y=0, + * four to the face with z=0. + */ + void + colorize_quarter_hyper_shell(Triangulation<3> &tria, + const Point<3> ¢er, + const double inner_radius, + const double outer_radius) + { + if (tria.n_cells() != 3) + AssertThrow (false, ExcNotImplemented()); + double middle = (outer_radius-inner_radius)/2e0 + inner_radius; + double eps = 1e-3*middle; + Triangulation<3>::cell_iterator cell = tria.begin(); -void -GridGenerator::torus (Triangulation<2,3> &tria, - const double R, - const double r) -{ - Assert (R>r, ExcMessage("Outer radius must be greater than inner radius.")); - - const unsigned int dim=2; - const unsigned int spacedim=3; - std::vector > vertices (16); - - vertices[0]=Point(R-r,0,0); - vertices[1]=Point(R,-r,0); - vertices[2]=Point(R+r,0,0); - vertices[3]=Point(R, r,0); - vertices[4]=Point(0,0,R-r); - vertices[5]=Point(0,-r,R); - vertices[6]=Point(0,0,R+r); - vertices[7]=Point(0,r,R); - vertices[8]=Point(-(R-r),0,0); - vertices[9]=Point(-R,-r,0); - vertices[10]=Point(-(R+r),0,0); - vertices[11]=Point(-R, r,0); - vertices[12]=Point(0,0,-(R-r)); - vertices[13]=Point(0,-r,-R); - vertices[14]=Point(0,0,-(R+r)); - vertices[15]=Point(0,r,-R); - - std::vector > cells (16); - //Right Hand Orientation - cells[0].vertices[0] = 0; - cells[0].vertices[1] = 4; - cells[0].vertices[2] = 7; - cells[0].vertices[3] = 3; - cells[0].material_id = 0; - - cells[1].vertices[0] = 1; - cells[1].vertices[1] = 5; - cells[1].vertices[2] = 4; - cells[1].vertices[3] = 0; - cells[1].material_id = 0; - - cells[2].vertices[0] = 2; - cells[2].vertices[1] = 6; - cells[2].vertices[2] = 5; - cells[2].vertices[3] = 1; - cells[2].material_id = 0; - - cells[3].vertices[0] = 3; - cells[3].vertices[1] = 7; - cells[3].vertices[2] = 6; - cells[3].vertices[3] = 2; - cells[3].material_id = 0; - - cells[4].vertices[0] = 4; - cells[4].vertices[1] = 8; - cells[4].vertices[2] = 11; - cells[4].vertices[3] = 7; - cells[4].material_id = 0; - - cells[5].vertices[0] = 5; - cells[5].vertices[1] = 9; - cells[5].vertices[2] = 8; - cells[5].vertices[3] = 4; - cells[5].material_id = 0; - - cells[6].vertices[0] = 6; - cells[6].vertices[1] = 10; - cells[6].vertices[2] = 9; - cells[6].vertices[3] = 5; - cells[6].material_id = 0; - - cells[7].vertices[0] = 7; - cells[7].vertices[1] = 11; - cells[7].vertices[2] = 10; - cells[7].vertices[3] = 6; - cells[7].material_id = 0; - - cells[8].vertices[0] = 8; - cells[8].vertices[1] = 12; - cells[8].vertices[2] = 15; - cells[8].vertices[3] = 11; - cells[8].material_id = 0; - - cells[9].vertices[0] = 9; - cells[9].vertices[1] = 13; - cells[9].vertices[2] = 12; - cells[9].vertices[3] = 8; - cells[9].material_id = 0; - - cells[10].vertices[0] = 10; - cells[10].vertices[1] = 14; - cells[10].vertices[2] = 13; - cells[10].vertices[3] = 9; - cells[10].material_id = 0; - - cells[11].vertices[0] = 11; - cells[11].vertices[1] = 15; - cells[11].vertices[2] = 14; - cells[11].vertices[3] = 10; - cells[11].material_id = 0; - - cells[12].vertices[0] = 12; - cells[12].vertices[1] = 0; - cells[12].vertices[2] = 3; - cells[12].vertices[3] = 15; - cells[12].material_id = 0; - - cells[13].vertices[0] = 13; - cells[13].vertices[1] = 1; - cells[13].vertices[2] = 0; - cells[13].vertices[3] = 12; - cells[13].material_id = 0; - - cells[14].vertices[0] = 14; - cells[14].vertices[1] = 2; - cells[14].vertices[2] = 1; - cells[14].vertices[3] = 13; - cells[14].material_id = 0; - - cells[15].vertices[0] = 15; - cells[15].vertices[1] = 3; - cells[15].vertices[2] = 2; - cells[15].vertices[3] = 14; - cells[15].material_id = 0; - - // Must call this to be able to create a - // correct triangulation in dealii, read - // GridReordering<> doc - GridReordering::reorder_cells (cells); - tria.create_triangulation_compatibility (vertices, cells, SubCellData()); -} + for (; cell!=tria.end(); ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + { + if (!cell->face(f)->at_boundary()) + continue; + double radius = cell->face(f)->center().norm() - center.norm(); + if (std::fabs(cell->face(f)->center()(0)) < eps ) // x = 0 set boundary 2 + { + cell->face(f)->set_boundary_indicator(2); + for (unsigned int j=0; j::lines_per_face; ++j) + if (cell->face(f)->line(j)->at_boundary()) + if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps) + cell->face(f)->line(j)->set_boundary_indicator(2); + } + else if (std::fabs(cell->face(f)->center()(1)) < eps) // y = 0 set boundary 3 + { + cell->face(f)->set_boundary_indicator(3); + for (unsigned int j=0; j::lines_per_face; ++j) + if (cell->face(f)->line(j)->at_boundary()) + if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps) + cell->face(f)->line(j)->set_boundary_indicator(3); + } + else if (std::fabs(cell->face(f)->center()(2)) < eps ) // z = 0 set boundary 4 + { + cell->face(f)->set_boundary_indicator(4); + for (unsigned int j=0; j::lines_per_face; ++j) + if (cell->face(f)->line(j)->at_boundary()) + if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps) + cell->face(f)->line(j)->set_boundary_indicator(4); + } + else if (radius < middle) // inner radius set boundary 0 + { + cell->face(f)->set_boundary_indicator(0); + for (unsigned int j=0; j::lines_per_face; ++j) + if (cell->face(f)->line(j)->at_boundary()) + if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps) + cell->face(f)->line(j)->set_boundary_indicator(0); + } + else if (radius > middle) // outer radius set boundary 1 + { + cell->face(f)->set_boundary_indicator(1); + for (unsigned int j=0; j::lines_per_face; ++j) + if (cell->face(f)->line(j)->at_boundary()) + if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps) + cell->face(f)->line(j)->set_boundary_indicator(1); + } + else + AssertThrow (false, ExcInternalError()); + } + } -// Implementation for 2D only -template<> -void -GridGenerator::parallelogram (Triangulation<2> &tria, - const Point<2> (&corners)[2], - const bool colorize) -{ - std::vector > vertices (GeometryInfo<2>::vertices_per_cell); - - vertices[1] = corners[0]; - vertices[2] = corners[1]; - vertices[3] = vertices[1] + vertices[2]; - // Prepare cell data - std::vector > cells (1); - for (unsigned int i=0; i::vertices_per_cell; ++i) - cells[0].vertices[i] = i; - cells[0].material_id = 0; - - tria.create_triangulation (vertices, cells, SubCellData()); - - // Assign boundary indicators - if (colorize) - colorize_hyper_rectangle (tria); -} + } -template<> -void -GridGenerator::parallelogram (Triangulation<2> &tria, - const Tensor<2,2> &corners, - const bool colorize) -{ - // simply pass everything to the other function of same name - const Point<2> x[2] = { corners[0], corners[1] }; - parallelogram (tria, x, colorize); -} + template + void + hyper_rectangle (Triangulation &tria, + const Point &p_1, + const Point &p_2, + const bool colorize) + { + // First, normalize input such that + // p1 is lower in all coordinate directions. + Point p1(p_1); + Point p2(p_2); + for (unsigned int i=0; i p2(i)) + std::swap (p1(i), p2(i)); + std::vector > vertices (GeometryInfo::vertices_per_cell); + switch (dim) + { + case 1: + vertices[0] = p1; + vertices[1] = p2; + break; + case 2: + vertices[0] = vertices[1] = p1; + vertices[2] = vertices[3] = p2; + + vertices[1](0) = p2(0); + vertices[2](0) = p1(0); + break; + case 3: + vertices[0] = vertices[1] = vertices[2] = vertices[3] = p1; + vertices[4] = vertices[5] = vertices[6] = vertices[7] = p2; + + vertices[1](0) = p2(0); + vertices[2](1) = p2(1); + vertices[3](0) = p2(0); + vertices[3](1) = p2(1); + + vertices[4](0) = p1(0); + vertices[4](1) = p1(1); + vertices[5](1) = p1(1); + vertices[6](0) = p1(0); + + break; + default: + Assert (false, ExcNotImplemented ()); + } -// Parallelepiped implementation in 1d, 2d, and 3d. @note The -// implementation in 1d is similar to hyper_rectangle(), and in 2d is -// similar to parallelogram(). -// -// The GridReordering::reorder_grid is made use of towards the end of -// this function. Thus the triangulation is explicitly constructed for -// all dim here since it is slightly different in that respect -// (cf. hyper_rectangle(), parallelogram()). -template -void -GridGenerator::parallelepiped (Triangulation &tria, - const Point (&corners) [dim], - const bool colorize) -{ - // Check that none of the user defined vertices overlap - for (unsigned int i=0; i > cells (1); + for (unsigned int i=0; i::vertices_per_cell; ++i) + cells[0].vertices[i] = i; + cells[0].material_id = 0; - // Note: vertex[0] is the origin and is initialised as so here: - std::vector > vertices (GeometryInfo::vertices_per_cell); + tria.create_triangulation (vertices, cells, SubCellData()); - switch (dim) - { - // A line (1d parallelepiped) - case 1: - vertices[1] = corners[0]; - break; + // Assign boundary indicators + if (colorize) + colorize_hyper_rectangle (tria); + } - // A parallelogram (2d parallelepiped) - case 2: - // assign corners to vertices: - vertices[1] = corners[0]; - vertices[2] = corners[1]; - // compose the remaining vertex: - vertices[3] = vertices[1] + vertices[2]; - break; + template + void hyper_cube (Triangulation &tria, + const double left, + const double right) + { + Assert (left < right, + ExcMessage ("Invalid left-to-right bounds of hypercube")); - // A parallelepiped (3d parallelepiped) - case 3: - // assign corners to vertices: - vertices[1] = corners[0]; - vertices[2] = corners[1]; - vertices[4] = corners[2]; - - // compose the remaining vertices: - vertices[3] = vertices[1] + vertices[2]; - vertices[5] = vertices[1] + vertices[4]; - vertices[6] = vertices[2] + vertices[4]; - vertices[7] = vertices[1] + vertices[2] + vertices[4]; - break; + Point p1; + Point p2; - default: - Assert (false, ExcNotImplemented()); - } + p1(spacedim-1) = 0; + p2(spacedim-1) = 0; - // Prepare cell data and wipe material identity - std::vector > cells (1); - for (unsigned int i=0; i::vertices_per_cell; ++i) - cells[0].vertices[i] = i; - cells[0].material_id = 0; + for (unsigned int i=0; i::reorder_cells (cells); - tria.create_triangulation (vertices, cells, SubCellData()); - // Finally assign boundary indicators according to hyper_rectangle - if (colorize) - colorize_hyper_rectangle (tria); -} -template -void -GridGenerator::subdivided_parallelepiped (Triangulation &tria, - const size_type n_subdivisions, - const Point (&corners) [dim], - const bool colorize) -{ - // Equalise number of subdivisions in each dim-direction, heir - // validity will be checked later - size_type (n_subdivisions_) [dim]; - for (unsigned int i=0; i &tria, + const unsigned int n_cells, + const unsigned int n_rotations, + const double R, + const double r) + { + const unsigned int dim=3; + Assert (n_cells>4, ExcMessage("More than 4 cells are needed to create a moebius grid.")); + Assert (r>0 && R>0, ExcMessage("Outer and inner radius must be positive.")); + Assert (R>r, ExcMessage("Outer radius must be greater than inner radius.")); -template -void -GridGenerator::subdivided_parallelepiped (Triangulation &tria, - const size_type ( n_subdivisions) [dim], - const Point (&corners) [dim], - const bool colorize) -{ - // Zero n_subdivisions is the origin only, which makes no sense - for (unsigned int i=0; i0, ExcInvalidRepetitions(n_subdivisions[i])); - // Check corners do not overlap (unique) - for (unsigned int i=0; i > vertices (4*n_cells); + double beta_step=n_rotations*numbers::PI/2.0/n_cells; + double alpha_step=2.0*numbers::PI/n_cells; - // Create a list of points - Point (delta) [dim]; + for (unsigned int i=0; i > points; + unsigned int offset=0; - switch (dim) - { - case 1: - for (size_type x=0; x<=n_subdivisions[0]; ++x) - points.push_back (Point (x*delta[0])); - break; + std::vector > cells (n_cells); + for (unsigned int i=0; i (x*delta[0] + y*delta[1])); - break; + // now correct the last four vertices + cells[n_cells-1].vertices[4]=(0+n_rotations)%4; + cells[n_cells-1].vertices[5]=(3+n_rotations)%4; + cells[n_cells-1].vertices[6]=(2+n_rotations)%4; + cells[n_cells-1].vertices[7]=(1+n_rotations)%4; - case 3: - for (size_type z=0; z<=n_subdivisions[2]; ++z) - for (size_type y=0; y<=n_subdivisions[1]; ++y) - for (size_type x=0; x<=n_subdivisions[0]; ++x) - points.push_back (Point (x*delta[0] + y*delta[1] + z*delta[2])); - break; + GridReordering::invert_all_cells_of_negative_grid(vertices,cells); + tria.create_triangulation_compatibility (vertices, cells, SubCellData()); + } - default: - Assert (false, ExcNotImplemented()); - } - // Prepare cell data - size_type n_cells = 1; - for (unsigned int i=0; i > cells (n_cells); - // Create fixed ordering of - switch (dim) - { - case 1: - for (size_type x=0; x &tria, + const double R, + const double r) + { + Assert (R>r, ExcMessage("Outer radius must be greater than inner radius.")); + + const unsigned int dim=2; + const unsigned int spacedim=3; + std::vector > vertices (16); + + vertices[0]=Point(R-r,0,0); + vertices[1]=Point(R,-r,0); + vertices[2]=Point(R+r,0,0); + vertices[3]=Point(R, r,0); + vertices[4]=Point(0,0,R-r); + vertices[5]=Point(0,-r,R); + vertices[6]=Point(0,0,R+r); + vertices[7]=Point(0,r,R); + vertices[8]=Point(-(R-r),0,0); + vertices[9]=Point(-R,-r,0); + vertices[10]=Point(-(R+r),0,0); + vertices[11]=Point(-R, r,0); + vertices[12]=Point(0,0,-(R-r)); + vertices[13]=Point(0,-r,-R); + vertices[14]=Point(0,0,-(R+r)); + vertices[15]=Point(0,r,-R); + + std::vector > cells (16); + //Right Hand Orientation + cells[0].vertices[0] = 0; + cells[0].vertices[1] = 4; + cells[0].vertices[2] = 7; + cells[0].vertices[3] = 3; + cells[0].material_id = 0; + + cells[1].vertices[0] = 1; + cells[1].vertices[1] = 5; + cells[1].vertices[2] = 4; + cells[1].vertices[3] = 0; + cells[1].material_id = 0; + + cells[2].vertices[0] = 2; + cells[2].vertices[1] = 6; + cells[2].vertices[2] = 5; + cells[2].vertices[3] = 1; + cells[2].material_id = 0; + + cells[3].vertices[0] = 3; + cells[3].vertices[1] = 7; + cells[3].vertices[2] = 6; + cells[3].vertices[3] = 2; + cells[3].material_id = 0; + + cells[4].vertices[0] = 4; + cells[4].vertices[1] = 8; + cells[4].vertices[2] = 11; + cells[4].vertices[3] = 7; + cells[4].material_id = 0; + + cells[5].vertices[0] = 5; + cells[5].vertices[1] = 9; + cells[5].vertices[2] = 8; + cells[5].vertices[3] = 4; + cells[5].material_id = 0; + + cells[6].vertices[0] = 6; + cells[6].vertices[1] = 10; + cells[6].vertices[2] = 9; + cells[6].vertices[3] = 5; + cells[6].material_id = 0; + + cells[7].vertices[0] = 7; + cells[7].vertices[1] = 11; + cells[7].vertices[2] = 10; + cells[7].vertices[3] = 6; + cells[7].material_id = 0; + + cells[8].vertices[0] = 8; + cells[8].vertices[1] = 12; + cells[8].vertices[2] = 15; + cells[8].vertices[3] = 11; + cells[8].material_id = 0; + + cells[9].vertices[0] = 9; + cells[9].vertices[1] = 13; + cells[9].vertices[2] = 12; + cells[9].vertices[3] = 8; + cells[9].material_id = 0; + + cells[10].vertices[0] = 10; + cells[10].vertices[1] = 14; + cells[10].vertices[2] = 13; + cells[10].vertices[3] = 9; + cells[10].material_id = 0; + + cells[11].vertices[0] = 11; + cells[11].vertices[1] = 15; + cells[11].vertices[2] = 14; + cells[11].vertices[3] = 10; + cells[11].material_id = 0; + + cells[12].vertices[0] = 12; + cells[12].vertices[1] = 0; + cells[12].vertices[2] = 3; + cells[12].vertices[3] = 15; + cells[12].material_id = 0; + + cells[13].vertices[0] = 13; + cells[13].vertices[1] = 1; + cells[13].vertices[2] = 0; + cells[13].vertices[3] = 12; + cells[13].material_id = 0; + + cells[14].vertices[0] = 14; + cells[14].vertices[1] = 2; + cells[14].vertices[2] = 1; + cells[14].vertices[3] = 13; + cells[14].material_id = 0; + + cells[15].vertices[0] = 15; + cells[15].vertices[1] = 3; + cells[15].vertices[2] = 2; + cells[15].vertices[3] = 14; + cells[15].material_id = 0; + + // Must call this to be able to create a + // correct triangulation in dealii, read + // GridReordering<> doc + GridReordering::reorder_cells (cells); + tria.create_triangulation_compatibility (vertices, cells, SubCellData()); + } - // wipe material id - cells[x].material_id = 0; - } - break; - case 2: - { - // Shorthand - const size_type n_dy = n_subdivisions[1]; - const size_type n_dx = n_subdivisions[0]; +// Implementation for 2D only + template<> + void + parallelogram (Triangulation<2> &tria, + const Point<2> (&corners)[2], + const bool colorize) + { + std::vector > vertices (GeometryInfo<2>::vertices_per_cell); + + vertices[1] = corners[0]; + vertices[2] = corners[1]; + vertices[3] = vertices[1] + vertices[2]; + // Prepare cell data + std::vector > cells (1); + for (unsigned int i=0; i::vertices_per_cell; ++i) + cells[0].vertices[i] = i; + cells[0].material_id = 0; + + tria.create_triangulation (vertices, cells, SubCellData()); + + // Assign boundary indicators + if (colorize) + colorize_hyper_rectangle (tria); + } + + + template<> + void + parallelogram (Triangulation<2> &tria, + const Tensor<2,2> &corners, + const bool colorize) + { + // simply pass everything to the other function of same name + const Point<2> x[2] = { corners[0], corners[1] }; + parallelogram (tria, x, colorize); + } + + + +// Parallelepiped implementation in 1d, 2d, and 3d. @note The +// implementation in 1d is similar to hyper_rectangle(), and in 2d is +// similar to parallelogram(). +// +// The GridReordering::reorder_grid is made use of towards the end of +// this function. Thus the triangulation is explicitly constructed for +// all dim here since it is slightly different in that respect +// (cf. hyper_rectangle(), parallelogram()). + template + void + parallelepiped (Triangulation &tria, + const Point (&corners) [dim], + const bool colorize) + { + // Check that none of the user defined vertices overlap + for (unsigned int i=0; i > vertices (GeometryInfo::vertices_per_cell); + + switch (dim) + { + // A line (1d parallelepiped) + case 1: + vertices[1] = corners[0]; + break; + + // A parallelogram (2d parallelepiped) + case 2: + // assign corners to vertices: + vertices[1] = corners[0]; + vertices[2] = corners[1]; + + // compose the remaining vertex: + vertices[3] = vertices[1] + vertices[2]; + break; + + // A parallelepiped (3d parallelepiped) + case 3: + // assign corners to vertices: + vertices[1] = corners[0]; + vertices[2] = corners[1]; + vertices[4] = corners[2]; + + // compose the remaining vertices: + vertices[3] = vertices[1] + vertices[2]; + vertices[5] = vertices[1] + vertices[4]; + vertices[6] = vertices[2] + vertices[4]; + vertices[7] = vertices[1] + vertices[2] + vertices[4]; + break; + + default: + Assert (false, ExcNotImplemented()); + } + + // Prepare cell data and wipe material identity + std::vector > cells (1); + for (unsigned int i=0; i::vertices_per_cell; ++i) + cells[0].vertices[i] = i; + cells[0].material_id = 0; + + // Check ordering of vertices and create triangulation + GridReordering::reorder_cells (cells); + tria.create_triangulation (vertices, cells, SubCellData()); + + // Finally assign boundary indicators according to hyper_rectangle + if (colorize) + colorize_hyper_rectangle (tria); + } + + template + void + subdivided_parallelepiped (Triangulation &tria, + const unsigned int n_subdivisions, + const Point (&corners) [dim], + const bool colorize) + { + // Equalise number of subdivisions in each dim-direction, heir + // validity will be checked later + unsigned int (n_subdivisions_) [dim]; + for (unsigned int i=0; i + void + subdivided_parallelepiped (Triangulation &tria, + const unsigned int ( n_subdivisions) [dim], + const Point (&corners) [dim], + const bool colorize) + { + // Zero n_subdivisions is the origin only, which makes no sense + for (unsigned int i=0; i0, ExcInvalidRepetitions(n_subdivisions[i])); - for (size_type y=0; y (delta) [dim]; + + for (unsigned int i=0; i > points; + + switch (dim) + { + case 1: + for (unsigned int x=0; x<=n_subdivisions[0]; ++x) + points.push_back (Point (x*delta[0])); + break; + + case 2: + for (unsigned int y=0; y<=n_subdivisions[1]; ++y) + for (unsigned int x=0; x<=n_subdivisions[0]; ++x) + points.push_back (Point (x*delta[0] + y*delta[1])); + break; + + case 3: + for (unsigned int z=0; z<=n_subdivisions[2]; ++z) + for (unsigned int y=0; y<=n_subdivisions[1]; ++y) + for (unsigned int x=0; x<=n_subdivisions[0]; ++x) + points.push_back (Point (x*delta[0] + y*delta[1] + z*delta[2])); + break; + + default: + Assert (false, ExcNotImplemented()); + } + + // Prepare cell data + unsigned int n_cells = 1; + for (unsigned int i=0; i > cells (n_cells); + + // Create fixed ordering of + switch (dim) + { + case 1: + for (unsigned int x=0; x -void -GridGenerator::subdivided_hyper_cube (Triangulation &tria, - const unsigned int repetitions, - const double left, - const double right) -{ - Assert (repetitions >= 1, ExcInvalidRepetitions(repetitions)); - Assert (left < right, - ExcMessage ("Invalid left-to-right bounds of hypercube")); - - // first generate the necessary - // points - const double delta = (right-left)/repetitions; - std::vector > points; - switch (dim) - { - case 1: - for (unsigned int x=0; x<=repetitions; ++x) - points.push_back (Point (left+x*delta)); - break; - case 2: - for (unsigned int y=0; y<=repetitions; ++y) + template + void + subdivided_hyper_cube (Triangulation &tria, + const unsigned int repetitions, + const double left, + const double right) + { + Assert (repetitions >= 1, ExcInvalidRepetitions(repetitions)); + Assert (left < right, + ExcMessage ("Invalid left-to-right bounds of hypercube")); + + // first generate the necessary + // points + const double delta = (right-left)/repetitions; + std::vector > points; + switch (dim) + { + case 1: for (unsigned int x=0; x<=repetitions; ++x) - points.push_back (Point (left+x*delta, - left+y*delta)); - break; + points.push_back (Point (left+x*delta)); + break; - case 3: - for (unsigned int z=0; z<=repetitions; ++z) + case 2: for (unsigned int y=0; y<=repetitions; ++y) for (unsigned int x=0; x<=repetitions; ++x) points.push_back (Point (left+x*delta, - left+y*delta, - left+z*delta)); - break; - - default: - Assert (false, ExcNotImplemented()); - } - - // next create the cells - // Prepare cell data - std::vector > cells; - // Define these as abbreviations - // for the step sizes below. The - // number of points in a single - // direction is repetitions+1 - const unsigned int dy = repetitions+1; - const unsigned int dz = dy*dy; - switch (dim) - { - case 1: - cells.resize (repetitions); - for (unsigned int x=0; x (left+x*delta, + left+y*delta, + left+z*delta)); + break; + + default: + Assert (false, ExcNotImplemented()); + } - case 2: - cells.resize (repetitions*repetitions); - for (unsigned int y=0; y > cells; + // Define these as abbreviations + // for the step sizes below. The + // number of points in a single + // direction is repetitions+1 + const unsigned int dy = repetitions+1; + const unsigned int dz = dy*dy; + switch (dim) + { + case 1: + cells.resize (repetitions); for (unsigned int x=0; x -void -GridGenerator::subdivided_hyper_rectangle ( - Triangulation &tria, - const std::vector &repetitions, - const Point &p_1, - const Point &p_2, - const bool colorize) -{ - // contributed by Joerg R. Weimar - // (j.weimar@jweimar.de) 2003 - Assert(repetitions.size() == dim, - ExcInvalidRepetitionsDimension(dim)); - // First, normalize input such that - // p1 is lower in all coordinate - // directions. - Point p1(p_1); - Point p2(p_2); - - for (unsigned int i=0; i p2(i)) - std::swap (p1(i), p2(i)); - - // then check that all repetitions - // are >= 1, and calculate deltas - // convert repetitions from double - // to int by taking the ceiling. - Point delta; - - for (unsigned int i=0; i= 1, ExcInvalidRepetitions(repetitions[i])); + template + void + subdivided_hyper_rectangle ( + Triangulation &tria, + const std::vector &repetitions, + const Point &p_1, + const Point &p_2, + const bool colorize) + { + // contributed by Joerg R. Weimar + // (j.weimar@jweimar.de) 2003 + Assert(repetitions.size() == dim, + ExcInvalidRepetitionsDimension(dim)); + // First, normalize input such that + // p1 is lower in all coordinate + // directions. + Point p1(p_1); + Point p2(p_2); + + for (unsigned int i=0; i p2(i)) + std::swap (p1(i), p2(i)); - delta[i] = (p2[i]-p1[i])/repetitions[i]; - } + // then check that all repetitions + // are >= 1, and calculate deltas + // convert repetitions from double + // to int by taking the ceiling. + Point delta; - // then generate the necessary - // points - std::vector > points; - switch (dim) - { - case 1: - for (unsigned int x=0; x<=repetitions[0]; ++x) - points.push_back (Point (p1[0]+x*delta[0])); - break; + for (unsigned int i=0; i= 1, ExcInvalidRepetitions(repetitions[i])); - case 2: - for (unsigned int y=0; y<=repetitions[1]; ++y) + delta[i] = (p2[i]-p1[i])/repetitions[i]; + } + + // then generate the necessary + // points + std::vector > points; + switch (dim) + { + case 1: for (unsigned int x=0; x<=repetitions[0]; ++x) - points.push_back (Point (p1[0]+x*delta[0], - p1[1]+y*delta[1])); - break; + points.push_back (Point (p1[0]+x*delta[0])); + break; - case 3: - for (unsigned int z=0; z<=repetitions[2]; ++z) + case 2: for (unsigned int y=0; y<=repetitions[1]; ++y) for (unsigned int x=0; x<=repetitions[0]; ++x) points.push_back (Point (p1[0]+x*delta[0], - p1[1]+y*delta[1], - p1[2]+z*delta[2])); - break; - - default: - Assert (false, ExcNotImplemented()); - } - - // next create the cells - // Prepare cell data - std::vector > cells; - switch (dim) - { - case 1: - { - cells.resize (repetitions[0]); - for (unsigned int x=0; x (p1[0]+x*delta[0], + p1[1]+y*delta[1], + p1[2]+z*delta[2])); + break; + + default: + Assert (false, ExcNotImplemented()); + } - case 2: - { - cells.resize (repetitions[1]*repetitions[0]); - for (unsigned int y=0; y > cells; + switch (dim) + { + case 1: + { + cells.resize (repetitions[0]); for (unsigned int x=0; x 0, - ExcMessage ("The distance between corner points must be positive.")) - - // actual code is external since - // 1-D is different from 2/3D. - colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon); - } -} + default: + Assert (false, ExcNotImplemented()); + } + tria.create_triangulation (points, cells, SubCellData()); + if (colorize) + { + // to colorize, run through all + // faces of all cells and set + // boundary indicator to the + // correct value if it was 0. + + // use a large epsilon to + // compare numbers to avoid + // roundoff problems. + const double epsilon + = 0.01 * *std::min_element (&delta[0], &delta[0]+dim); + Assert (epsilon > 0, + ExcMessage ("The distance between corner points must be positive.")) + + // actual code is external since + // 1-D is different from 2/3D. + colorize_subdivided_hyper_rectangle (tria, p1, p2, epsilon); + } + } -template -void -GridGenerator::subdivided_hyper_rectangle( - Triangulation &tria, - const std::vector > &step_sz, - const Point &p_1, - const Point &p_2, - const bool colorize) -{ - // contributed by Joerg R. Weimar - // (j.weimar@jweimar.de) 2003 - // modified by Yaqi Wang 2006 - Assert(step_sz.size() == dim, - ExcInvalidRepetitionsDimension(dim)); - - - // First, normalize input such that - // p1 is lower in all coordinate - // directions. - - // and check the consistency of - // step sizes, i.e. that they all - // add up to the sizes specified by - // p_1 and p_2 - Point p1(p_1); - Point p2(p_2); - std::vector< std::vector > step_sizes(step_sz); - - for (unsigned int i=0; i p2(i)) - { - std::swap (p1(i), p2(i)); - std::reverse (step_sizes[i].begin(), step_sizes[i].end()); - } - double x = 0; - for (size_type j=0; j + void + subdivided_hyper_rectangle( + Triangulation &tria, + const std::vector > &step_sz, + const Point &p_1, + const Point &p_2, + const bool colorize) + { + // contributed by Joerg R. Weimar + // (j.weimar@jweimar.de) 2003 + // modified by Yaqi Wang 2006 + Assert(step_sz.size() == dim, + ExcInvalidRepetitionsDimension(dim)); + + + // First, normalize input such that + // p1 is lower in all coordinate + // directions. + + // and check the consistency of + // step sizes, i.e. that they all + // add up to the sizes specified by + // p_1 and p_2 + Point p1(p_1); + Point p2(p_2); + std::vector< std::vector > step_sizes(step_sz); + + for (unsigned int i=0; i p2(i)) + { + std::swap (p1(i), p2(i)); + std::reverse (step_sizes[i].begin(), step_sizes[i].end()); + } - // then generate the necessary - // points - std::vector > points; - switch (dim) - { - case 1: - { - double x=0; - for (size_type i=0; ; ++i) - { - points.push_back (Point (p1[0]+x)); - - // form partial sums. in - // the last run through - // avoid accessing - // non-existent values - // and exit early instead - if (i == step_sizes[0].size()) - break; + double x = 0; + for (unsigned int j=0; j (p1[0]+x, - p1[1]+y)); - if (i == step_sizes[0].size()) - break; + // then generate the necessary + // points + std::vector > points; + switch (dim) + { + case 1: + { + double x=0; + for (unsigned int i=0; ; ++i) + { + points.push_back (Point (p1[0]+x)); - x += step_sizes[0][i]; - } + // form partial sums. in + // the last run through + // avoid accessing + // non-existent values + // and exit early instead + if (i == step_sizes[0].size()) + break; - if (j == step_sizes[1].size()) - break; + x += step_sizes[0][i]; + } + break; + } - y += step_sizes[1][j]; - } - break; + case 2: + { + double y=0; + for (unsigned int j=0; ; ++j) + { + double x=0; + for (unsigned int i=0; ; ++i) + { + points.push_back (Point (p1[0]+x, + p1[1]+y)); + if (i == step_sizes[0].size()) + break; - } - case 3: - { - double z=0; - for (size_type k=0; ; ++k) - { - double y=0; - for (size_type j=0; ; ++j) - { - double x=0; - for (size_type i=0; ; ++i) - { - points.push_back (Point (p1[0]+x, - p1[1]+y, - p1[2]+z)); - if (i == step_sizes[0].size()) - break; + x += step_sizes[0][i]; + } - x += step_sizes[0][i]; - } + if (j == step_sizes[1].size()) + break; - if (j == step_sizes[1].size()) - break; + y += step_sizes[1][j]; + } + break; - y += step_sizes[1][j]; - } + } + case 3: + { + double z=0; + for (unsigned int k=0; ; ++k) + { + double y=0; + for (unsigned int j=0; ; ++j) + { + double x=0; + for (unsigned int i=0; ; ++i) + { + points.push_back (Point (p1[0]+x, + p1[1]+y, + p1[2]+z)); + if (i == step_sizes[0].size()) + break; - if (k == step_sizes[2].size()) - break; + x += step_sizes[0][i]; + } - z += step_sizes[2][k]; - } - break; - } + if (j == step_sizes[1].size()) + break; - default: - Assert (false, ExcNotImplemented()); - } + y += step_sizes[1][j]; + } - // next create the cells - // Prepare cell data - std::vector > cells; - switch (dim) - { - case 1: - { - cells.resize (step_sizes[0].size()); - for (size_type x=0; x > cells; + switch (dim) + { + case 1: + { + cells.resize (step_sizes[0].size()); + for (unsigned int x=0; x -void -GridGenerator::subdivided_hyper_rectangle ( - Triangulation<1> &tria, - const std::vector< std::vector > &spacing, - const Point<1> &p, - const Table<1,types::material_id> &material_id, - const bool colorize) -{ - // contributed by Yaqi Wang 2006 - Assert(spacing.size() == 1, - ExcInvalidRepetitionsDimension(1)); - const size_type n_cells = material_id.size(0); - Assert(spacing[0].size() == n_cells, - ExcInvalidRepetitionsDimension(1)); + template <> + void + subdivided_hyper_rectangle ( + Triangulation<1> &tria, + const std::vector< std::vector > &spacing, + const Point<1> &p, + const Table<1,types::material_id> &material_id, + const bool colorize) + { + // contributed by Yaqi Wang 2006 + Assert(spacing.size() == 1, + ExcInvalidRepetitionsDimension(1)); - double delta = std::numeric_limits::max(); - for (size_type i=0; i= 0, ExcInvalidRepetitions(-1)); - delta = std::min (delta, spacing[0][i]); - } + const unsigned int n_cells = material_id.size(0); - // generate the necessary points - std::vector > points; - double ax = p[0]; - for (size_type x=0; x<=n_cells; ++x) - { - points.push_back (Point<1> (ax)); - if (x > cells(n_val_cells); - size_type id = 0; - for (size_type x=0; x::max(); + for (unsigned int i=0; i= 0, ExcInvalidRepetitions(-1)); + delta = std::min (delta, spacing[0][i]); } - // create triangulation - SubCellData t; - GridTools::delete_unused_vertices (points, cells, t); - tria.create_triangulation (points, cells, t); + // generate the necessary points + std::vector > points; + double ax = p[0]; + for (unsigned int x=0; x<=n_cells; ++x) + { + points.push_back (Point<1> (ax)); + if (x > cells(n_val_cells); + unsigned int id = 0; + for (unsigned int x=0; x -void -GridGenerator::subdivided_hyper_rectangle ( - Triangulation<2> &tria, - const std::vector< std::vector > &spacing, - const Point<2> &p, - const Table<2,types::material_id> &material_id, - const bool colorize) -{ - // contributed by Yaqi Wang 2006 - Assert(spacing.size() == 2, - ExcInvalidRepetitionsDimension(2)); - - std::vector repetitions(2); - size_type n_cells = 1; - double delta = std::numeric_limits::max(); - for (unsigned int i=0; i<2; i++) - { - repetitions[i] = spacing[i].size(); - n_cells *= repetitions[i]; - for (size_type j=0; j= 0, ExcInvalidRepetitions(-1)); - delta = std::min (delta, spacing[i][j]); - } - Assert(material_id.size(i) == repetitions[i], - ExcInvalidRepetitionsDimension(i)); - } - // generate the necessary points - std::vector > points; - double ay = p[1]; - for (size_type y=0; y<=repetitions[1]; ++y) - { - double ax = p[0]; - for (size_type x=0; x<=repetitions[0]; ++x) - { - points.push_back (Point<2> (ax,ay)); - if (x + void + subdivided_hyper_rectangle ( + Triangulation<2> &tria, + const std::vector< std::vector > &spacing, + const Point<2> &p, + const Table<2,types::material_id> &material_id, + const bool colorize) + { + // contributed by Yaqi Wang 2006 + Assert(spacing.size() == 2, + ExcInvalidRepetitionsDimension(2)); + + std::vector repetitions(2); + unsigned int n_cells = 1; + double delta = std::numeric_limits::max(); + for (unsigned int i=0; i<2; i++) + { + repetitions[i] = spacing[i].size(); + n_cells *= repetitions[i]; + for (unsigned int j=0; j= 0, ExcInvalidRepetitions(-1)); + delta = std::min (delta, spacing[i][j]); + } + Assert(material_id.size(i) == repetitions[i], + ExcInvalidRepetitionsDimension(i)); + } - // create the cells - size_type n_val_cells = 0; - for (size_type i=0; i > cells(n_val_cells); - size_type id = 0; - for (size_type y=0; y > points; + double ay = p[1]; + for (unsigned int y=0; y<=repetitions[1]; ++y) + { + double ax = p[0]; + for (unsigned int x=0; x<=repetitions[0]; ++x) + { + points.push_back (Point<2> (ax,ay)); + if (x > cells(n_val_cells); + unsigned int id = 0; + for (unsigned int y=0; y::cell_iterator cell = tria.begin(), - endc = tria.end(); - for (; cell !=endc; ++cell) - { - Point<2> cell_center = cell->center(); - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->face(f)->boundary_indicator() == 0) - { - Point<2> face_center = cell->face(f)->center(); - for (unsigned int i=0; i<2; ++i) - { - if (face_center[i]face(f)->set_boundary_indicator(i*2); - if (face_center[i]>cell_center[i]+eps) - cell->face(f)->set_boundary_indicator(i*2+1); - } - } - } - } -} + // create triangulation + SubCellData t; + GridTools::delete_unused_vertices (points, cells, t); + tria.create_triangulation (points, cells, t); -template <> -void -GridGenerator::subdivided_hyper_rectangle ( - Triangulation<3> &tria, - const std::vector< std::vector > &spacing, - const Point<3> &p, - const Table<3,types::material_id> &material_id, - const bool colorize) -{ - // contributed by Yaqi Wang 2006 - const unsigned int dim = 3; + // set boundary indicator + if (colorize) + { + double eps = 0.01 * delta; + Triangulation<2>::cell_iterator cell = tria.begin(), + endc = tria.end(); + for (; cell !=endc; ++cell) + { + Point<2> cell_center = cell->center(); + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->boundary_indicator() == 0) + { + Point<2> face_center = cell->face(f)->center(); + for (unsigned int i=0; i<2; ++i) + { + if (face_center[i]face(f)->set_boundary_indicator(i*2); + if (face_center[i]>cell_center[i]+eps) + cell->face(f)->set_boundary_indicator(i*2+1); + } + } + } + } + } - Assert(spacing.size() == dim, - ExcInvalidRepetitionsDimension(dim)); - std::vector repetitions(dim); - size_type n_cells = 1; - double delta = std::numeric_limits::max(); - for (unsigned int i=0; i= 0, ExcInvalidRepetitions(-1)); - delta = std::min (delta, spacing[i][j]); - } - Assert(material_id.size(i) == repetitions[i], - ExcInvalidRepetitionsDimension(i)); - } + template <> + void + subdivided_hyper_rectangle ( + Triangulation<3> &tria, + const std::vector< std::vector > &spacing, + const Point<3> &p, + const Table<3,types::material_id> &material_id, + const bool colorize) + { + // contributed by Yaqi Wang 2006 + const unsigned int dim = 3; - // generate the necessary points - std::vector > points; - double az = p[2]; - for (size_type z=0; z<=repetitions[2]; ++z) - { - double ay = p[1]; - for (size_type y=0; y<=repetitions[1]; ++y) - { - double ax = p[0]; - for (size_type x=0; x<=repetitions[0]; ++x) + Assert(spacing.size() == dim, + ExcInvalidRepetitionsDimension(dim)); + + std::vector repetitions(dim); + unsigned int n_cells = 1; + double delta = std::numeric_limits::max(); + for (unsigned int i=0; i= 0, ExcInvalidRepetitions(-1)); + delta = std::min (delta, spacing[i][j]); + } + Assert(material_id.size(i) == repetitions[i], + ExcInvalidRepetitionsDimension(i)); + } + + // generate the necessary points + std::vector > points; + double az = p[2]; + for (unsigned int z=0; z<=repetitions[2]; ++z) + { + double ay = p[1]; + for (unsigned int y=0; y<=repetitions[1]; ++y) + { + double ax = p[0]; + for (unsigned int x=0; x<=repetitions[0]; ++x) + { + points.push_back (Point (ax,ay,az)); + if (x > cells(n_val_cells); + unsigned int id = 0; + const unsigned int n_x = (repetitions[0]+1); + const unsigned int n_xy = (repetitions[0]+1)*(repetitions[1]+1); + for (unsigned int z=0; z (ax,ay,az)); - if (x > cells(n_val_cells); - size_type id = 0; - const size_type n_x = (repetitions[0]+1); - const size_type n_xy = (repetitions[0]+1)*(repetitions[1]+1); - for (size_type z=0; z1) + { + double eps = 0.01 * delta; + Triangulation::cell_iterator cell = tria.begin(), + endc = tria.end(); + for (; cell !=endc; ++cell) { - cells[id].vertices[0] = z*n_xy + y*n_x + x; - cells[id].vertices[1] = z*n_xy + y*n_x + x+1; - cells[id].vertices[2] = z*n_xy + (y+1)*n_x + x; - cells[id].vertices[3] = z*n_xy + (y+1)*n_x + x+1; - cells[id].vertices[4] = (z+1)*n_xy + y*n_x + x; - cells[id].vertices[5] = (z+1)*n_xy + y*n_x + x+1; - cells[id].vertices[6] = (z+1)*n_xy + (y+1)*n_x + x; - cells[id].vertices[7] = (z+1)*n_xy + (y+1)*n_x + x+1; - cells[id].material_id = material_id[x][y][z]; - id++; + Point cell_center = cell->center(); + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->boundary_indicator() == 0) + { + Point face_center = cell->face(f)->center(); + for (unsigned int i=0; iface(f)->set_boundary_indicator(i*2); + if (face_center[i]>cell_center[i]+eps) + cell->face(f)->set_boundary_indicator(i*2+1); + } + } } + } + } - // create triangulation - SubCellData t; - GridTools::delete_unused_vertices (points, cells, t); - tria.create_triangulation (points, cells, t); - // set boundary indicator - if (colorize && dim>1) - { - double eps = 0.01 * delta; - Triangulation::cell_iterator cell = tria.begin(), - endc = tria.end(); - for (; cell !=endc; ++cell) - { - Point cell_center = cell->center(); - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->face(f)->boundary_indicator() == 0) - { - Point face_center = cell->face(f)->center(); - for (unsigned int i=0; iface(f)->set_boundary_indicator(i*2); - if (face_center[i]>cell_center[i]+eps) - cell->face(f)->set_boundary_indicator(i*2+1); - } - } - } - } -} + template <> + void hyper_cube_slit (Triangulation<1> &, + const double, + const double, + const bool) + { + Assert (false, ExcNotImplemented()); + } -template <> -void -GridGenerator::colorize_subdivided_hyper_rectangle ( - Triangulation<1> &tria, - const Point<1> &, - const Point<1> &, - const double) -{ - for (Triangulation<1>::cell_iterator cell = tria.begin(); - cell != tria.end(); ++cell) - if (cell->center()(0) > 0) - cell->set_material_id(1); - // boundary indicators are set to - // 0 (left) and 1 (right) by default. -} + template <> + void enclosed_hyper_cube (Triangulation<1> &, + const double, + const double, + const double, + const bool) + { + Assert (false, ExcNotImplemented()); + } -template -void -GridGenerator::colorize_subdivided_hyper_rectangle (Triangulation &tria, - const Point &p1, - const Point &p2, - const double epsilon) -{ + template <> + void hyper_L (Triangulation<1> &, + const double, + const double) + { + Assert (false, ExcNotImplemented()); + } - // run through all faces and check - // if one of their center coordinates matches - // one of the corner points. Comparisons - // are made using an epsilon which - // should be smaller than the smallest cell - // diameter. - typename Triangulation::face_iterator face = tria.begin_face(), - endface = tria.end_face(); - for (; face!=endface; ++face) - { - if (face->boundary_indicator() == 0) - { - const Point center (face->center()); - if (std::abs(center(0)-p1[0]) < epsilon) - face->set_boundary_indicator(0); - else if (std::abs(center(0) - p2[0]) < epsilon) - face->set_boundary_indicator(1); - else if (dim > 1 && std::abs(center(1) - p1[1]) < epsilon) - face->set_boundary_indicator(2); - else if (dim > 1 && std::abs(center(1) - p2[1]) < epsilon) - face->set_boundary_indicator(3); - else if (dim > 2 && std::abs(center(2) - p1[2]) < epsilon) - face->set_boundary_indicator(4); - else if (dim > 2 && std::abs(center(2) - p2[2]) < epsilon) - face->set_boundary_indicator(5); - else - // triangulation says it - // is on the boundary, - // but we could not find - // on which boundary. - Assert (false, ExcInternalError()); - } - } - for (typename Triangulation::cell_iterator cell = tria.begin(); - cell != tria.end(); ++cell) - { - char id = 0; - for (unsigned int d=0; dcenter()(d) > 0) id += 1 << d; - cell->set_material_id(id); - } -} + template <> + void hyper_ball (Triangulation<1> &, + const Point<1> &, + const double) + { + Assert (false, ExcNotImplemented()); + } -template <> -void GridGenerator::hyper_cube_slit (Triangulation<1> &, - const double, - const double, - const bool) -{ - Assert (false, ExcNotImplemented()); -} + template <> + void cylinder (Triangulation<1> &, + const double, + const double) + { + Assert (false, ExcNotImplemented()); + } -template <> -void GridGenerator::enclosed_hyper_cube (Triangulation<1> &, - const double, - const double, - const double, - const bool) -{ - Assert (false, ExcNotImplemented()); -} + template <> + void truncated_cone (Triangulation<1> &, + const double, + const double, + const double) + { + Assert (false, ExcNotImplemented()); + } -template <> -void GridGenerator::hyper_L (Triangulation<1> &, - const double, - const double) -{ - Assert (false, ExcNotImplemented()); -} + template <> + void hyper_shell (Triangulation<1> &, + const Point<1> &, + const double, + const double, + const unsigned int , + const bool) + { + Assert (false, ExcNotImplemented()); + } -template <> -void GridGenerator::hyper_ball (Triangulation<1> &, - const Point<1> &, - const double) -{ - Assert (false, ExcNotImplemented()); -} + template <> + void cylinder_shell (Triangulation<1> &, + const double, + const double, + const double, + const unsigned int , + const unsigned int ) + { + Assert (false, ExcNotImplemented()); + } + template <> + void + half_hyper_ball (Triangulation<1> &, + const Point<1> &, + const double) + { + Assert (false, ExcNotImplemented()); + } -template <> -void GridGenerator::cylinder (Triangulation<1> &, - const double, - const double) -{ - Assert (false, ExcNotImplemented()); -} + template <> + void + half_hyper_shell (Triangulation<1> &, + const Point<1> &, + const double, + const double, + const unsigned int , + const bool) + { + Assert (false, ExcNotImplemented()); + } + + template <> + void quarter_hyper_shell (Triangulation<1> &, + const Point<1> &, + const double, + const double, + const unsigned int , + const bool) + { + Assert (false, ExcNotImplemented()); + } + + template <> + void enclosed_hyper_cube (Triangulation<2> &tria, + const double left, + const double right, + const double thickness, + const bool colorize) + { + Assert(left > vertices(16); + double coords[4]; + coords[0] = left-thickness; + coords[1] = left; + coords[2] = right; + coords[3] = right+thickness; + + unsigned int k=0; + for (unsigned int i0=0; i0<4; ++i0) + for (unsigned int i1=0; i1<4; ++i1) + vertices[k++] = Point<2>(coords[i1], coords[i0]); + + const types::material_id materials[9] = { 5, 4, 6, + 1, 0, 2, + 9, 8,10 + }; + + std::vector > cells(9); + k = 0; + for (unsigned int i0=0; i0<3; ++i0) + for (unsigned int i1=0; i1<3; ++i1) + { + cells[k].vertices[0] = i1+4*i0; + cells[k].vertices[1] = i1+4*i0+1; + cells[k].vertices[2] = i1+4*i0+4; + cells[k].vertices[3] = i1+4*i0+5; + if (colorize) + cells[k].material_id = materials[k]; + ++k; + } + tria.create_triangulation (vertices, + cells, + SubCellData()); // no boundary information + } -template <> -void GridGenerator::truncated_cone (Triangulation<1> &, - const double, - const double, - const double) -{ - Assert (false, ExcNotImplemented()); -} +// Implementation for 2D only + template <> + void + hyper_cube_slit (Triangulation<2> &tria, + const double left, + const double right, + const bool colorize) + { + const double rl2=(right+left)/2; + const Point<2> vertices[10] = { Point<2>(left, left ), + Point<2>(rl2, left ), + Point<2>(rl2, rl2 ), + Point<2>(left, rl2 ), + Point<2>(right,left ), + Point<2>(right,rl2 ), + Point<2>(rl2, right), + Point<2>(left, right), + Point<2>(right,right), + Point<2>(rl2, left ) + }; + const int cell_vertices[4][4] = { { 0,1,3,2 }, + { 9,4,2,5 }, + { 3,2,7,6 }, + { 2,5,6,8 } + }; + std::vector > cells (4, CellData<2>()); + for (unsigned int i=0; i<4; ++i) + { + for (unsigned int j=0; j<4; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[10]), + cells, + SubCellData()); // no boundary information + if (colorize) + { + Triangulation<2>::cell_iterator cell = tria.begin(); + cell->face(1)->set_boundary_indicator(1); + ++cell; + cell->face(3)->set_boundary_indicator(2); + } + } -template <> -void GridGenerator::hyper_shell (Triangulation<1> &, - const Point<1> &, - const double, - const double, - const size_type , - const bool) -{ - Assert (false, ExcNotImplemented()); -} -template <> -void GridGenerator::colorize_hyper_shell (Triangulation<1> &, - const Point<1> &, - const double, - const double) -{ - Assert (false, ExcNotImplemented()); -} + template <> + void truncated_cone (Triangulation<2> &triangulation, + const double radius_0, + const double radius_1, + const double half_length) + { + Point<2> vertices_tmp[4]; + vertices_tmp[0] = Point<2> (-half_length, -radius_0); + vertices_tmp[1] = Point<2> (half_length, -radius_1); + vertices_tmp[2] = Point<2> (-half_length, radius_0); + vertices_tmp[3] = Point<2> (half_length, radius_1); -template <> -void GridGenerator::cylinder_shell (Triangulation<1> &, - const double, - const double, - const double, - const size_type , - const size_type ) -{ - Assert (false, ExcNotImplemented()); -} + const std::vector > vertices (&vertices_tmp[0], &vertices_tmp[4]); + unsigned int cell_vertices[1][GeometryInfo<2>::vertices_per_cell]; + for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i) + cell_vertices[0][i] = i; -template <> -void -GridGenerator::half_hyper_ball (Triangulation<1> &, - const Point<1> &, - const double) -{ - Assert (false, ExcNotImplemented()); -} + std::vector > cells (1, CellData<2> ()); + for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i) + cells[0].vertices[i] = cell_vertices[0][i]; -template <> -void -GridGenerator::half_hyper_shell (Triangulation<1> &, - const Point<1> &, - const double, - const double, - const size_type , - const bool) -{ - Assert (false, ExcNotImplemented()); -} + cells[0].material_id = 0; + triangulation.create_triangulation (vertices, cells, SubCellData ()); -template <> -void GridGenerator::quarter_hyper_shell (Triangulation<1> &, - const Point<1> &, - const double, - const double, - const size_type , - const bool) -{ - Assert (false, ExcNotImplemented()); -} + Triangulation<2>::cell_iterator cell = triangulation.begin (); -template <> -void GridGenerator::enclosed_hyper_cube (Triangulation<2> &tria, - const double left, - const double right, - const double thickness, - const bool colorize) -{ - Assert(left > vertices(16); - double coords[4]; - coords[0] = left-thickness; - coords[1] = left; - coords[2] = right; - coords[3] = right+thickness; - - unsigned int k=0; - for (unsigned int i0=0; i0<4; ++i0) - for (unsigned int i1=0; i1<4; ++i1) - vertices[k++] = Point<2>(coords[i1], coords[i0]); - - const types::material_id materials[9] = { 5, 4, 6, - 1, 0, 2, - 9, 8,10 - }; - - std::vector > cells(9); - k = 0; - for (unsigned int i0=0; i0<3; ++i0) - for (unsigned int i1=0; i1<3; ++i1) - { - cells[k].vertices[0] = i1+4*i0; - cells[k].vertices[1] = i1+4*i0+1; - cells[k].vertices[2] = i1+4*i0+4; - cells[k].vertices[3] = i1+4*i0+5; - if (colorize) - cells[k].material_id = materials[k]; - ++k; - } - tria.create_triangulation (vertices, - cells, - SubCellData()); // no boundary information -} + cell->face (0)->set_boundary_indicator (1); + cell->face (1)->set_boundary_indicator (2); + + for (unsigned int i = 2; i < 4; ++i) + cell->face (i)->set_boundary_indicator (0); + } +//TODO: Colorize edges as circumference, left and right radius // Implementation for 2D only -template <> -void -GridGenerator::hyper_cube_slit (Triangulation<2> &tria, - const double left, - const double right, - const bool colorize) -{ - const double rl2=(right+left)/2; - const Point<2> vertices[10] = { Point<2>(left, left ), - Point<2>(rl2, left ), - Point<2>(rl2, rl2 ), - Point<2>(left, rl2 ), - Point<2>(right,left ), - Point<2>(right,rl2 ), - Point<2>(rl2, right), - Point<2>(left, right), - Point<2>(right,right), - Point<2>(rl2, left ) - }; - const int cell_vertices[4][4] = { { 0,1,3,2 }, - { 9,4,2,5 }, - { 3,2,7,6 }, - { 2,5,6,8 } - }; - std::vector > cells (4, CellData<2>()); - for (unsigned int i=0; i<4; ++i) - { - for (unsigned int j=0; j<4; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; + template <> + void + hyper_L (Triangulation<2> &tria, + const double a, + const double b) + { + const Point<2> vertices[8] = { Point<2> (a,a), + Point<2> ((a+b)/2,a), + Point<2> (b,a), + Point<2> (a,(a+b)/2), + Point<2> ((a+b)/2,(a+b)/2), + Point<2> (b,(a+b)/2), + Point<2> (a,b), + Point<2> ((a+b)/2,b) + }; + const int cell_vertices[3][4] = {{0, 1, 3, 4}, + {1, 2, 4, 5}, + {3, 4, 6, 7} }; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[10]), - cells, - SubCellData()); // no boundary information - if (colorize) - { - Triangulation<2>::cell_iterator cell = tria.begin(); - cell->face(1)->set_boundary_indicator(1); - ++cell; - cell->face(3)->set_boundary_indicator(2); - } -} + std::vector > cells (3, CellData<2>()); + for (unsigned int i=0; i<3; ++i) + { + for (unsigned int j=0; j<4; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[8]), + cells, + SubCellData()); // no boundary information + } -template <> -void GridGenerator::truncated_cone (Triangulation<2> &triangulation, - const double radius_0, - const double radius_1, - const double half_length) -{ - Point<2> vertices_tmp[4]; - vertices_tmp[0] = Point<2> (-half_length, -radius_0); - vertices_tmp[1] = Point<2> (half_length, -radius_1); - vertices_tmp[2] = Point<2> (-half_length, radius_0); - vertices_tmp[3] = Point<2> (half_length, radius_1); - const std::vector > vertices (&vertices_tmp[0], &vertices_tmp[4]); - unsigned int cell_vertices[1][GeometryInfo<2>::vertices_per_cell]; +// Implementation for 2D only + template <> + void + hyper_ball (Triangulation<2> &tria, + const Point<2> &p, + const double radius) + { + // equilibrate cell sizes at + // transition from the inner part + // to the radial cells + const double a = 1./(1+std::sqrt(2.0)); + const Point<2> vertices[8] = { p+Point<2>(-1,-1) *(radius/std::sqrt(2.0)), + p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)), + p+Point<2>(-1,-1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(-1,+1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(-1,+1) *(radius/std::sqrt(2.0)), + p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)) + }; + + const int cell_vertices[5][4] = {{0, 1, 2, 3}, + {0, 2, 6, 4}, + {2, 3, 4, 5}, + {1, 7, 3, 5}, + {6, 4, 7, 5} + }; - for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i) - cell_vertices[0][i] = i; + std::vector > cells (5, CellData<2>()); - std::vector > cells (1, CellData<2> ()); + for (unsigned int i=0; i<5; ++i) + { + for (unsigned int j=0; j<4; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; - for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i) - cells[0].vertices[i] = cell_vertices[0][i]; + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[8]), + cells, + SubCellData()); // no boundary information + } - cells[0].material_id = 0; - triangulation.create_triangulation (vertices, cells, SubCellData ()); - Triangulation<2>::cell_iterator cell = triangulation.begin (); - cell->face (0)->set_boundary_indicator (1); - cell->face (1)->set_boundary_indicator (2); + template <> + void hyper_shell (Triangulation<2> &tria, + const Point<2> ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n_cells, + const bool colorize) + { + Assert ((inner_radius > 0) && (inner_radius < outer_radius), + ExcInvalidRadii ()); + + const double pi = numbers::PI; + + // determine the number of cells + // for the grid. if not provided by + // the user determine it such that + // the length of each cell on the + // median (in the middle between + // the two circles) is equal to its + // radial extent (which is the + // difference between the two + // radii) + const unsigned int N = (n_cells == 0 ? + static_cast + (std::ceil((2*pi* (outer_radius + inner_radius)/2) / + (outer_radius - inner_radius))) : + n_cells); + + // set up N vertices on the + // outer and N vertices on + // the inner circle. the + // first N ones are on the + // outer one, and all are + // numbered counter-clockwise + std::vector > vertices(2*N); + for (unsigned int i=0; i( std::cos(2*pi * i/N), + std::sin(2*pi * i/N)) * outer_radius; + vertices[i+N] = vertices[i] * (inner_radius/outer_radius); - for (unsigned int i = 2; i < 4; ++i) - cell->face (i)->set_boundary_indicator (0); -} + vertices[i] += center; + vertices[i+N] += center; + }; + std::vector > cells (N, CellData<2>()); + for (unsigned int i=0; i -void -GridGenerator::hyper_L (Triangulation<2> &tria, - const double a, - const double b) -{ - const Point<2> vertices[8] = { Point<2> (a,a), - Point<2> ((a+b)/2,a), - Point<2> (b,a), - Point<2> (a,(a+b)/2), - Point<2> ((a+b)/2,(a+b)/2), - Point<2> (b,(a+b)/2), - Point<2> (a,b), - Point<2> ((a+b)/2,b) - }; - const int cell_vertices[3][4] = {{0, 1, 3, 4}, - {1, 2, 4, 5}, - {3, 4, 6, 7} - }; - - std::vector > cells (3, CellData<2>()); - - for (unsigned int i=0; i<3; ++i) - { - for (unsigned int j=0; j<4; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; - }; + cells[i].material_id = 0; + }; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[8]), - cells, - SubCellData()); // no boundary information -} + tria.create_triangulation ( + vertices, cells, SubCellData()); + if (colorize) + colorize_hyper_shell(tria, center, inner_radius, outer_radius); + } // Implementation for 2D only -template <> -void -GridGenerator::hyper_ball (Triangulation<2> &tria, - const Point<2> &p, - const double radius) -{ - // equilibrate cell sizes at - // transition from the inner part - // to the radial cells - const double a = 1./(1+std::sqrt(2.0)); - const Point<2> vertices[8] = { p+Point<2>(-1,-1) *(radius/std::sqrt(2.0)), - p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)), - p+Point<2>(-1,-1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(-1,+1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(-1,+1) *(radius/std::sqrt(2.0)), - p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)) - }; - - const int cell_vertices[5][4] = {{0, 1, 2, 3}, - {0, 2, 6, 4}, - {2, 3, 4, 5}, - {1, 7, 3, 5}, - {6, 4, 7, 5} - }; - - std::vector > cells (5, CellData<2>()); - - for (unsigned int i=0; i<5; ++i) - { - for (unsigned int j=0; j<4; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; - }; + template <> + void + cylinder (Triangulation<2> &tria, + const double radius, + const double half_length) + { + Point<2> p1 (-half_length, -radius); + Point<2> p2 (half_length, radius); - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[8]), - cells, - SubCellData()); // no boundary information -} + hyper_rectangle(tria, p1, p2, true); + + Triangulation<2>::face_iterator f = tria.begin_face(); + Triangulation<2>::face_iterator end = tria.end_face(); + while (f != end) + { + switch (f->boundary_indicator()) + { + case 0: + f->set_boundary_indicator(1); + break; + case 1: + f->set_boundary_indicator(2); + break; + default: + f->set_boundary_indicator(0); + break; + } + ++f; + } + } // Implementation for 2D only -template<> -void -GridGenerator::colorize_hyper_shell ( - Triangulation<2> &tria, - const Point<2> &, const double, const double) -{ - // In spite of receiving geometrical - // data, we do this only based on - // topology. - - // For the mesh based on cube, - // this is highly irregular - for (Triangulation<2>::cell_iterator cell = tria.begin(); - cell != tria.end(); ++cell) - { - Assert (cell->face(2)->at_boundary(), ExcInternalError()); - cell->face(2)->set_boundary_indicator(1); - } -} - + template <> + void cylinder_shell (Triangulation<2> &, + const double, + const double, + const double, + const unsigned int, + const unsigned int) + { + Assert (false, ExcNotImplemented()); + } -template <> -void GridGenerator::hyper_shell (Triangulation<2> &tria, - const Point<2> ¢er, - const double inner_radius, - const double outer_radius, - const size_type n_cells, - const bool colorize) -{ - Assert ((inner_radius > 0) && (inner_radius < outer_radius), - ExcInvalidRadii ()); - - const double pi = numbers::PI; - - // determine the number of cells - // for the grid. if not provided by - // the user determine it such that - // the length of each cell on the - // median (in the middle between - // the two circles) is equal to its - // radial extent (which is the - // difference between the two - // radii) - const size_type N = (n_cells == 0 ? - static_cast - (std::ceil((2*pi* (outer_radius + inner_radius)/2) / - (outer_radius - inner_radius))) : - n_cells); - - // set up N vertices on the - // outer and N vertices on - // the inner circle. the - // first N ones are on the - // outer one, and all are - // numbered counter-clockwise - std::vector > vertices(2*N); - for (size_type i=0; i( std::cos(2*pi * i/N), - std::sin(2*pi * i/N)) * outer_radius; - vertices[i+N] = vertices[i] * (inner_radius/outer_radius); - vertices[i] += center; - vertices[i+N] += center; + template <> + void + half_hyper_ball (Triangulation<2> &tria, + const Point<2> &p, + const double radius) + { + // equilibrate cell sizes at + // transition from the inner part + // to the radial cells + const double a = 1./(1+std::sqrt(2.0)); + const Point<2> vertices[8] = { p+Point<2>(0,-1) *radius, + p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)), + p+Point<2>(0,-1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(0,+1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a), + p+Point<2>(0,+1) *radius, + p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)) + }; + + const int cell_vertices[5][4] = {{0, 1, 2, 3}, + {2, 3, 4, 5}, + {1, 7, 3, 5}, + {6, 4, 7, 5} }; - std::vector > cells (N, CellData<2>()); - - for (size_type i=0; i > cells (4, CellData<2>()); - tria.create_triangulation ( - vertices, cells, SubCellData()); + for (unsigned int i=0; i<4; ++i) + { + for (unsigned int j=0; j<4; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; - if (colorize) - colorize_hyper_shell(tria, center, inner_radius, outer_radius); -} + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[8]), + cells, + SubCellData()); // no boundary information + Triangulation<2>::cell_iterator cell = tria.begin(); + Triangulation<2>::cell_iterator end = tria.end(); -// Implementation for 2D only -template <> -void -GridGenerator::cylinder (Triangulation<2> &tria, - const double radius, - const double half_length) -{ - Point<2> p1 (-half_length, -radius); - Point<2> p2 (half_length, radius); - hyper_rectangle(tria, p1, p2, true); + while (cell != end) + { + for (unsigned int i=0; i::faces_per_cell; ++i) + { + if (cell->face(i)->boundary_indicator() == numbers::internal_face_boundary_id) + continue; - Triangulation<2>::face_iterator f = tria.begin_face(); - Triangulation<2>::face_iterator end = tria.end_face(); - while (f != end) - { - switch (f->boundary_indicator()) - { - case 0: - f->set_boundary_indicator(1); - break; - case 1: - f->set_boundary_indicator(2); - break; - default: - f->set_boundary_indicator(0); - break; - } - ++f; - } -} + // If x is zero, then this is part of the plane + if (cell->face(i)->center()(0) < p(0)+1.e-5) + cell->face(i)->set_boundary_indicator(1); + } + ++cell; + } + } // Implementation for 2D only -template <> -void GridGenerator::cylinder_shell (Triangulation<2> &, - const double, - const double, - const double, - const size_type, - const size_type) -{ - Assert (false, ExcNotImplemented()); -} + template <> + void + half_hyper_shell (Triangulation<2> &tria, + const Point<2> ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n_cells, + const bool colorize) + { + Assert ((inner_radius > 0) && (inner_radius < outer_radius), + ExcInvalidRadii ()); + + const double pi = numbers::PI; + // determine the number of cells + // for the grid. if not provided by + // the user determine it such that + // the length of each cell on the + // median (in the middle between + // the two circles) is equal to its + // radial extent (which is the + // difference between the two + // radii) + const unsigned int N = (n_cells == 0 ? + static_cast + (std::ceil((pi* (outer_radius + inner_radius)/2) / + (outer_radius - inner_radius))) : + n_cells); + + // set up N+1 vertices on the + // outer and N+1 vertices on + // the inner circle. the + // first N+1 ones are on the + // outer one, and all are + // numbered counter-clockwise + std::vector > vertices(2*(N+1)); + for (unsigned int i=0; i<=N; ++i) + { + // enforce that the x-coordinates + // of the first and last point of + // each half-circle are exactly + // zero (contrary to what we may + // compute using the imprecise + // value of pi) + vertices[i] = Point<2>( ( (i==0) || (i==N) ? + 0 : + std::cos(pi * i/N - pi/2) ), + std::sin(pi * i/N - pi/2)) * outer_radius; + vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius); + + vertices[i] += center; + vertices[i+N+1] += center; + }; -template <> -void -GridGenerator::half_hyper_ball (Triangulation<2> &tria, - const Point<2> &p, - const double radius) -{ - // equilibrate cell sizes at - // transition from the inner part - // to the radial cells - const double a = 1./(1+std::sqrt(2.0)); - const Point<2> vertices[8] = { p+Point<2>(0,-1) *radius, - p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)), - p+Point<2>(0,-1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(+1,-1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(0,+1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)*a), - p+Point<2>(0,+1) *radius, - p+Point<2>(+1,+1) *(radius/std::sqrt(2.0)) - }; - - const int cell_vertices[5][4] = {{0, 1, 2, 3}, - {2, 3, 4, 5}, - {1, 7, 3, 5}, - {6, 4, 7, 5} - }; - - std::vector > cells (4, CellData<2>()); - - for (unsigned int i=0; i<4; ++i) - { - for (unsigned int j=0; j<4; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; - }; + std::vector > cells (N, CellData<2>()); - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[8]), - cells, - SubCellData()); // no boundary information + for (unsigned int i=0; i::cell_iterator cell = tria.begin(); - Triangulation<2>::cell_iterator end = tria.end(); + cells[i].material_id = 0; + }; + tria.create_triangulation (vertices, cells, SubCellData()); - while (cell != end) - { - for (unsigned int i=0; i::faces_per_cell; ++i) - { - if (cell->face(i)->boundary_indicator() == numbers::internal_face_boundary_id) - continue; + if (colorize) + { + Triangulation<2>::cell_iterator cell = tria.begin(); + for (; cell!=tria.end(); ++cell) + { + cell->face(2)->set_boundary_indicator(1); + } + tria.begin()->face(0)->set_boundary_indicator(3); - // If x is zero, then this is part of the plane - if (cell->face(i)->center()(0) < p(0)+1.e-5) - cell->face(i)->set_boundary_indicator(1); - } - ++cell; - } -} + tria.last()->face(1)->set_boundary_indicator(2); + } + } + template <> + void quarter_hyper_shell (Triangulation<2> &tria, + const Point<2> ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n_cells, + const bool colorize) + { + Assert ((inner_radius > 0) && (inner_radius < outer_radius), + ExcInvalidRadii ()); + + const double pi = numbers::PI; + // determine the number of cells + // for the grid. if not provided by + // the user determine it such that + // the length of each cell on the + // median (in the middle between + // the two circles) is equal to its + // radial extent (which is the + // difference between the two + // radii) + const unsigned int N = (n_cells == 0 ? + static_cast + (std::ceil((pi* (outer_radius + inner_radius)/4) / + (outer_radius - inner_radius))) : + n_cells); + + // set up N+1 vertices on the + // outer and N+1 vertices on + // the inner circle. the + // first N+1 ones are on the + // outer one, and all are + // numbered counter-clockwise + std::vector > vertices(2*(N+1)); + for (unsigned int i=0; i<=N; ++i) + { + // enforce that the x-coordinates + // of the last point is exactly + // zero (contrary to what we may + // compute using the imprecise + // value of pi) + vertices[i] = Point<2>( ( (i==N) ? + 0 : + std::cos(pi * i/N/2) ), + std::sin(pi * i/N/2)) * outer_radius; + vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius); + + vertices[i] += center; + vertices[i+N+1] += center; + }; -// Implementation for 2D only -template <> -void -GridGenerator::half_hyper_shell (Triangulation<2> &tria, - const Point<2> ¢er, - const double inner_radius, - const double outer_radius, - const size_type n_cells, - const bool colorize) -{ - Assert ((inner_radius > 0) && (inner_radius < outer_radius), - ExcInvalidRadii ()); - - const double pi = numbers::PI; - // determine the number of cells - // for the grid. if not provided by - // the user determine it such that - // the length of each cell on the - // median (in the middle between - // the two circles) is equal to its - // radial extent (which is the - // difference between the two - // radii) - const size_type N = (n_cells == 0 ? - static_cast - (std::ceil((pi* (outer_radius + inner_radius)/2) / - (outer_radius - inner_radius))) : - n_cells); - - // set up N+1 vertices on the - // outer and N+1 vertices on - // the inner circle. the - // first N+1 ones are on the - // outer one, and all are - // numbered counter-clockwise - std::vector > vertices(2*(N+1)); - for (size_type i=0; i<=N; ++i) - { - // enforce that the x-coordinates - // of the first and last point of - // each half-circle are exactly - // zero (contrary to what we may - // compute using the imprecise - // value of pi) - vertices[i] = Point<2>( ( (i==0) || (i==N) ? - 0 : - std::cos(pi * i/N - pi/2) ), - std::sin(pi * i/N - pi/2)) * outer_radius; - vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius); - - vertices[i] += center; - vertices[i+N+1] += center; - }; + std::vector > cells (N, CellData<2>()); - std::vector > cells (N, CellData<2>()); + for (unsigned int i=0; i::cell_iterator cell = tria.begin(); + for (; cell!=tria.end(); ++cell) + { + cell->face(2)->set_boundary_indicator(1); + } + tria.begin()->face(0)->set_boundary_indicator(3); - if (colorize) - { - Triangulation<2>::cell_iterator cell = tria.begin(); - for (; cell!=tria.end(); ++cell) - { - cell->face(2)->set_boundary_indicator(1); - } - tria.begin()->face(0)->set_boundary_indicator(3); + tria.last()->face(1)->set_boundary_indicator(2); + } + } - tria.last()->face(1)->set_boundary_indicator(2); - } -} -template <> -void GridGenerator::quarter_hyper_shell (Triangulation<2> &tria, - const Point<2> ¢er, - const double inner_radius, - const double outer_radius, - const size_type n_cells, - const bool colorize) -{ - Assert ((inner_radius > 0) && (inner_radius < outer_radius), - ExcInvalidRadii ()); - - const double pi = numbers::PI; - // determine the number of cells - // for the grid. if not provided by - // the user determine it such that - // the length of each cell on the - // median (in the middle between - // the two circles) is equal to its - // radial extent (which is the - // difference between the two - // radii) - const size_type N = (n_cells == 0 ? - static_cast - (std::ceil((pi* (outer_radius + inner_radius)/4) / - (outer_radius - inner_radius))) : - n_cells); - - // set up N+1 vertices on the - // outer and N+1 vertices on - // the inner circle. the - // first N+1 ones are on the - // outer one, and all are - // numbered counter-clockwise - std::vector > vertices(2*(N+1)); - for (size_type i=0; i<=N; ++i) - { - // enforce that the x-coordinates - // of the last point is exactly - // zero (contrary to what we may - // compute using the imprecise - // value of pi) - vertices[i] = Point<2>( ( (i==N) ? - 0 : - std::cos(pi * i/N/2) ), - std::sin(pi * i/N/2)) * outer_radius; - vertices[i+N+1] = vertices[i] * (inner_radius/outer_radius); - - vertices[i] += center; - vertices[i+N+1] += center; +// Implementation for 3D only + template <> + void hyper_cube_slit (Triangulation<3> &tria, + const double left, + const double right, + const bool colorize) + { + const double rl2=(right+left)/2; + const double len = (right-left)/2.; + + const Point<3> vertices[20] = + { + Point<3>(left, left , -len/2.), + Point<3>(rl2, left , -len/2.), + Point<3>(rl2, rl2 , -len/2.), + Point<3>(left, rl2 , -len/2.), + Point<3>(right,left , -len/2.), + Point<3>(right,rl2 , -len/2.), + Point<3>(rl2, right, -len/2.), + Point<3>(left, right, -len/2.), + Point<3>(right,right, -len/2.), + Point<3>(rl2, left , -len/2.), + Point<3>(left, left , len/2.), + Point<3>(rl2, left , len/2.), + Point<3>(rl2, rl2 , len/2.), + Point<3>(left, rl2 , len/2.), + Point<3>(right,left , len/2.), + Point<3>(right,rl2 , len/2.), + Point<3>(rl2, right, len/2.), + Point<3>(left, right, len/2.), + Point<3>(right,right, len/2.), + Point<3>(rl2, left , len/2.) }; - - - std::vector > cells (N, CellData<2>()); - - for (size_type i=0; i > cells (4, CellData<3>()); + for (unsigned int i=0; i<4; ++i) + { + for (unsigned int j=0; j<8; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[20]), + cells, + SubCellData()); // no boundary information - tria.create_triangulation (vertices, cells, SubCellData()); - - if (colorize) - { - Triangulation<2>::cell_iterator cell = tria.begin(); - for (; cell!=tria.end(); ++cell) - { - cell->face(2)->set_boundary_indicator(1); - } - tria.begin()->face(0)->set_boundary_indicator(3); - - tria.last()->face(1)->set_boundary_indicator(2); - } -} + if (colorize) + { + Assert(false, ExcNotImplemented()); + Triangulation<3>::cell_iterator cell = tria.begin(); + cell->face(1)->set_boundary_indicator(1); + ++cell; + cell->face(3)->set_boundary_indicator(2); + } + } // Implementation for 3D only -template <> -void GridGenerator::hyper_cube_slit (Triangulation<3> &tria, - const double left, - const double right, - const bool colorize) -{ - const double rl2=(right+left)/2; - const double len = (right-left)/2.; - - const Point<3> vertices[20] = + template <> + void enclosed_hyper_cube (Triangulation<3> &tria, + const double left, + const double right, + const double thickness, + const bool colorize) { - Point<3>(left, left , -len/2.), - Point<3>(rl2, left , -len/2.), - Point<3>(rl2, rl2 , -len/2.), - Point<3>(left, rl2 , -len/2.), - Point<3>(right,left , -len/2.), - Point<3>(right,rl2 , -len/2.), - Point<3>(rl2, right, -len/2.), - Point<3>(left, right, -len/2.), - Point<3>(right,right, -len/2.), - Point<3>(rl2, left , -len/2.), - Point<3>(left, left , len/2.), - Point<3>(rl2, left , len/2.), - Point<3>(rl2, rl2 , len/2.), - Point<3>(left, rl2 , len/2.), - Point<3>(right,left , len/2.), - Point<3>(right,rl2 , len/2.), - Point<3>(rl2, right, len/2.), - Point<3>(left, right, len/2.), - Point<3>(right,right, len/2.), - Point<3>(rl2, left , len/2.) - }; - const int cell_vertices[4][8] = { { 0,1,3,2, 10, 11, 13, 12 }, - { 9,4,2,5, 19,14, 12, 15 }, - { 3,2,7,6,13,12,17,16 }, - { 2,5,6,8,12,15,16,18 } - }; - std::vector > cells (4, CellData<3>()); - for (unsigned int i=0; i<4; ++i) - { - for (unsigned int j=0; j<8; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; + Assert(left > vertices(64); + double coords[4]; + coords[0] = left-thickness; + coords[1] = left; + coords[2] = right; + coords[3] = right+thickness; + + unsigned int k=0; + for (unsigned int z=0; z<4; ++z) + for (unsigned int y=0; y<4; ++y) + for (unsigned int x=0; x<4; ++x) + vertices[k++] = Point<3>(coords[x], coords[y], coords[z]); + + const types::material_id materials[27] = + { + 21,20,22, + 17,16,18, + 25,24,26, + 5 , 4, 6, + 1 , 0, 2, + 9 , 8,10, + 37,36,38, + 33,32,34, + 41,40,42 }; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[20]), - cells, - SubCellData()); // no boundary information - if (colorize) - { - Assert(false, ExcNotImplemented()); - Triangulation<3>::cell_iterator cell = tria.begin(); - cell->face(1)->set_boundary_indicator(1); - ++cell; - cell->face(3)->set_boundary_indicator(2); - } -} + std::vector > cells(27); + k = 0; + for (unsigned int z=0; z<3; ++z) + for (unsigned int y=0; y<3; ++y) + for (unsigned int x=0; x<3; ++x) + { + cells[k].vertices[0] = x+4*y+16*z; + cells[k].vertices[1] = x+4*y+16*z+1; + cells[k].vertices[2] = x+4*y+16*z+4; + cells[k].vertices[3] = x+4*y+16*z+5; + cells[k].vertices[4] = x+4*y+16*z+16; + cells[k].vertices[5] = x+4*y+16*z+17; + cells[k].vertices[6] = x+4*y+16*z+20; + cells[k].vertices[7] = x+4*y+16*z+21; + if (colorize) + cells[k].material_id = materials[k]; + ++k; + } + tria.create_triangulation ( + vertices, + cells, + SubCellData()); // no boundary information + } -// Implementation for 3D only -template <> -void GridGenerator::enclosed_hyper_cube (Triangulation<3> &tria, - const double left, - const double right, - const double thickness, - const bool colorize) -{ - Assert(left > vertices(64); - double coords[4]; - coords[0] = left-thickness; - coords[1] = left; - coords[2] = right; - coords[3] = right+thickness; - - unsigned int k=0; - for (unsigned int z=0; z<4; ++z) - for (unsigned int y=0; y<4; ++y) - for (unsigned int x=0; x<4; ++x) - vertices[k++] = Point<3>(coords[x], coords[y], coords[z]); - - const types::material_id materials[27] = + template <> + void truncated_cone (Triangulation<3> &triangulation, + const double radius_0, + const double radius_1, + const double half_length) { - 21,20,22, - 17,16,18, - 25,24,26, - 5 , 4, 6, - 1 , 0, 2, - 9 , 8,10, - 37,36,38, - 33,32,34, - 41,40,42 - }; - - std::vector > cells(27); - k = 0; - for (unsigned int z=0; z<3; ++z) - for (unsigned int y=0; y<3; ++y) - for (unsigned int x=0; x<3; ++x) - { - cells[k].vertices[0] = x+4*y+16*z; - cells[k].vertices[1] = x+4*y+16*z+1; - cells[k].vertices[2] = x+4*y+16*z+4; - cells[k].vertices[3] = x+4*y+16*z+5; - cells[k].vertices[4] = x+4*y+16*z+16; - cells[k].vertices[5] = x+4*y+16*z+17; - cells[k].vertices[6] = x+4*y+16*z+20; - cells[k].vertices[7] = x+4*y+16*z+21; - if (colorize) - cells[k].material_id = materials[k]; - ++k; - } - tria.create_triangulation ( - vertices, - cells, - SubCellData()); // no boundary information -} - - - -template <> -void GridGenerator::truncated_cone (Triangulation<3> &triangulation, - const double radius_0, - const double radius_1, - const double half_length) -{ - // Determine number of cells and vertices - const size_type - n_cells = static_cast(std::floor (half_length / - std::max (radius_0, - radius_1) + - 0.5)); - const size_type n_vertices = 4 * (n_cells + 1); - std::vector > vertices_tmp(n_vertices); - - vertices_tmp[0] = Point<3> (-half_length, 0, -radius_0); - vertices_tmp[1] = Point<3> (-half_length, radius_0, 0); - vertices_tmp[2] = Point<3> (-half_length, -radius_0, 0); - vertices_tmp[3] = Point<3> (-half_length, 0, radius_0); - - const double dx = 2 * half_length / n_cells; - - for (size_type i = 0; i < n_cells; ++i) - { - vertices_tmp[4 * (i + 1)] - = vertices_tmp[4 * i] + - Point<3> (dx, 0, 0.5 * (radius_0 - radius_1) * dx / half_length); - vertices_tmp[4 * i + 5] - = vertices_tmp[4 * i + 1] + - Point<3> (dx, 0.5 * (radius_1 - radius_0) * dx / half_length, 0); - vertices_tmp[4 * i + 6] - = vertices_tmp[4 * i + 2] + - Point<3> (dx, 0.5 * (radius_0 - radius_1) * dx / half_length, 0); - vertices_tmp[4 * i + 7] - = vertices_tmp[4 * i + 3] + - Point<3> (dx, 0, 0.5 * (radius_1 - radius_0) * dx / half_length); - } + // Determine number of cells and vertices + const unsigned int + n_cells = static_cast(std::floor (half_length / + std::max (radius_0, + radius_1) + + 0.5)); + const unsigned int n_vertices = 4 * (n_cells + 1); + std::vector > vertices_tmp(n_vertices); + + vertices_tmp[0] = Point<3> (-half_length, 0, -radius_0); + vertices_tmp[1] = Point<3> (-half_length, radius_0, 0); + vertices_tmp[2] = Point<3> (-half_length, -radius_0, 0); + vertices_tmp[3] = Point<3> (-half_length, 0, radius_0); + + const double dx = 2 * half_length / n_cells; + + for (unsigned int i = 0; i < n_cells; ++i) + { + vertices_tmp[4 * (i + 1)] + = vertices_tmp[4 * i] + + Point<3> (dx, 0, 0.5 * (radius_0 - radius_1) * dx / half_length); + vertices_tmp[4 * i + 5] + = vertices_tmp[4 * i + 1] + + Point<3> (dx, 0.5 * (radius_1 - radius_0) * dx / half_length, 0); + vertices_tmp[4 * i + 6] + = vertices_tmp[4 * i + 2] + + Point<3> (dx, 0.5 * (radius_0 - radius_1) * dx / half_length, 0); + vertices_tmp[4 * i + 7] + = vertices_tmp[4 * i + 3] + + Point<3> (dx, 0, 0.5 * (radius_1 - radius_0) * dx / half_length); + } - const std::vector > vertices (vertices_tmp.begin(), - vertices_tmp.end()); - Table<2,unsigned int> cell_vertices(n_cells,GeometryInfo<3>::vertices_per_cell); + const std::vector > vertices (vertices_tmp.begin(), + vertices_tmp.end()); + Table<2,unsigned int> cell_vertices(n_cells,GeometryInfo<3>::vertices_per_cell); - for (size_type i = 0; i < n_cells; ++i) - for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j) - cell_vertices[i][j] = 4 * i + j; + for (unsigned int i = 0; i < n_cells; ++i) + for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j) + cell_vertices[i][j] = 4 * i + j; - std::vector > cells (n_cells, CellData<3> ()); + std::vector > cells (n_cells, CellData<3> ()); - for (size_type i = 0; i < n_cells; ++i) - { - for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; + for (unsigned int i = 0; i < n_cells; ++i) + { + for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; - } + cells[i].material_id = 0; + } - triangulation.create_triangulation (vertices, cells, SubCellData ()); + triangulation.create_triangulation (vertices, cells, SubCellData ()); - for (Triangulation<3>::cell_iterator cell = triangulation.begin (); - cell != triangulation.end (); ++cell) - { - if (cell->vertex (0) (0) == -half_length) - { - cell->face (4)->set_boundary_indicator (1); + for (Triangulation<3>::cell_iterator cell = triangulation.begin (); + cell != triangulation.end (); ++cell) + { + if (cell->vertex (0) (0) == -half_length) + { + cell->face (4)->set_boundary_indicator (1); - for (unsigned int i = 0; i < 4; ++i) - cell->line (i)->set_boundary_indicator (0); - } + for (unsigned int i = 0; i < 4; ++i) + cell->line (i)->set_boundary_indicator (0); + } - if (cell->vertex (4) (0) == half_length) - { - cell->face (5)->set_boundary_indicator (2); + if (cell->vertex (4) (0) == half_length) + { + cell->face (5)->set_boundary_indicator (2); - for (unsigned int i = 4; i < 8; ++i) - cell->line (i)->set_boundary_indicator (0); - } + for (unsigned int i = 4; i < 8; ++i) + cell->line (i)->set_boundary_indicator (0); + } - for (unsigned int i = 0; i < 4; ++i) - cell->face (i)->set_boundary_indicator (0); - } -} + for (unsigned int i = 0; i < 4; ++i) + cell->face (i)->set_boundary_indicator (0); + } + } // Implementation for 3D only -template <> -void -GridGenerator::hyper_L (Triangulation<3> &tria, - const double a, - const double b) -{ - // we slice out the top back right - // part of the cube - const Point<3> vertices[26] - = + template <> + void + hyper_L (Triangulation<3> &tria, + const double a, + const double b) { - // front face of the big cube - Point<3> (a, a,a), - Point<3> ((a+b)/2,a,a), - Point<3> (b, a,a), - Point<3> (a, a,(a+b)/2), - Point<3> ((a+b)/2,a,(a+b)/2), - Point<3> (b, a,(a+b)/2), - Point<3> (a, a,b), - Point<3> ((a+b)/2,a,b), - Point<3> (b, a,b), - // middle face of the big cube - Point<3> (a, (a+b)/2,a), - Point<3> ((a+b)/2,(a+b)/2,a), - Point<3> (b, (a+b)/2,a), - Point<3> (a, (a+b)/2,(a+b)/2), - Point<3> ((a+b)/2,(a+b)/2,(a+b)/2), - Point<3> (b, (a+b)/2,(a+b)/2), - Point<3> (a, (a+b)/2,b), - Point<3> ((a+b)/2,(a+b)/2,b), - Point<3> (b, (a+b)/2,b), - // back face of the big cube - // last (top right) point is missing - Point<3> (a, b,a), - Point<3> ((a+b)/2,b,a), - Point<3> (b, b,a), - Point<3> (a, b,(a+b)/2), - Point<3> ((a+b)/2,b,(a+b)/2), - Point<3> (b, b,(a+b)/2), - Point<3> (a, b,b), - Point<3> ((a+b)/2,b,b) - }; - const int cell_vertices[7][8] = {{0, 1, 9, 10, 3, 4, 12, 13}, - {1, 2, 10, 11, 4, 5, 13, 14}, - {3, 4, 12, 13, 6, 7, 15, 16}, - {4, 5, 13, 14, 7, 8, 16, 17}, - {9, 10, 18, 19, 12, 13, 21, 22}, - {10, 11, 19, 20, 13, 14, 22, 23}, - {12, 13, 21, 22, 15, 16, 24, 25} - }; - - std::vector > cells (7, CellData<3>()); - - for (unsigned int i=0; i<7; ++i) - { - for (unsigned int j=0; j<8; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; + // we slice out the top back right + // part of the cube + const Point<3> vertices[26] + = + { + // front face of the big cube + Point<3> (a, a,a), + Point<3> ((a+b)/2,a,a), + Point<3> (b, a,a), + Point<3> (a, a,(a+b)/2), + Point<3> ((a+b)/2,a,(a+b)/2), + Point<3> (b, a,(a+b)/2), + Point<3> (a, a,b), + Point<3> ((a+b)/2,a,b), + Point<3> (b, a,b), + // middle face of the big cube + Point<3> (a, (a+b)/2,a), + Point<3> ((a+b)/2,(a+b)/2,a), + Point<3> (b, (a+b)/2,a), + Point<3> (a, (a+b)/2,(a+b)/2), + Point<3> ((a+b)/2,(a+b)/2,(a+b)/2), + Point<3> (b, (a+b)/2,(a+b)/2), + Point<3> (a, (a+b)/2,b), + Point<3> ((a+b)/2,(a+b)/2,b), + Point<3> (b, (a+b)/2,b), + // back face of the big cube + // last (top right) point is missing + Point<3> (a, b,a), + Point<3> ((a+b)/2,b,a), + Point<3> (b, b,a), + Point<3> (a, b,(a+b)/2), + Point<3> ((a+b)/2,b,(a+b)/2), + Point<3> (b, b,(a+b)/2), + Point<3> (a, b,b), + Point<3> ((a+b)/2,b,b) + }; + const int cell_vertices[7][8] = {{0, 1, 9, 10, 3, 4, 12, 13}, + {1, 2, 10, 11, 4, 5, 13, 14}, + {3, 4, 12, 13, 6, 7, 15, 16}, + {4, 5, 13, 14, 7, 8, 16, 17}, + {9, 10, 18, 19, 12, 13, 21, 22}, + {10, 11, 19, 20, 13, 14, 22, 23}, + {12, 13, 21, 22, 15, 16, 24, 25} }; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[26]), - cells, - SubCellData()); // no boundary information -} - - + std::vector > cells (7, CellData<3>()); -// Implementation for 3D only -template <> -void -GridGenerator::hyper_ball (Triangulation<3> &tria, - const Point<3> &p, - const double radius) -{ - const double a = 1./(1+std::sqrt(3.0)); // equilibrate cell sizes at transition - // from the inner part to the radial - // cells - const unsigned int n_vertices = 16; - const Point<3> vertices[n_vertices] - = - { - // first the vertices of the inner - // cell - p+Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)*a), - p+Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)*a), - p+Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)*a), - p+Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)*a), - p+Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)*a), - p+Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)*a), - p+Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)*a), - p+Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)*a), - // now the eight vertices at - // the outer sphere - p+Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)), - p+Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)), - p+Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)), - p+Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)), - p+Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)), - p+Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)), - p+Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)), - p+Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)), - }; - - // one needs to draw the seven cubes to - // understand what's going on here - const unsigned int n_cells = 7; - const int cell_vertices[n_cells][8] = {{0, 1, 4, 5, 3, 2, 7, 6}, // center - {8, 9, 12, 13, 0, 1, 4, 5}, // bottom - {9, 13, 1, 5, 10, 14, 2, 6}, // right - {11, 10, 3, 2, 15, 14, 7, 6}, // top - {8, 0, 12, 4, 11, 3, 15, 7}, // left - {8, 9, 0, 1, 11, 10, 3, 2}, // front - {12, 4, 13, 5, 15, 7, 14, 6} - }; // back - - std::vector > cells (n_cells, CellData<3>()); - - for (unsigned int i=0; i::vertices_per_cell; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; - }; + for (unsigned int i=0; i<7; ++i) + { + for (unsigned int j=0; j<8; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[n_vertices]), - cells, - SubCellData()); // no boundary information -} + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[26]), + cells, + SubCellData()); // no boundary information + } // Implementation for 3D only -template <> -void -GridGenerator::cylinder (Triangulation<3> &tria, - const double radius, - const double half_length) -{ - // Copy the base from hyper_ball<3> - // and transform it to yz - const double d = radius/std::sqrt(2.0); - const double a = d/(1+std::sqrt(2.0)); - Point<3> vertices[24] = - { - Point<3>(-d, -half_length,-d), - Point<3>( d, -half_length,-d), - Point<3>(-a, -half_length,-a), - Point<3>( a, -half_length,-a), - Point<3>(-a, -half_length, a), - Point<3>( a, -half_length, a), - Point<3>(-d, -half_length, d), - Point<3>( d, -half_length, d), - Point<3>(-d, 0,-d), - Point<3>( d, 0,-d), - Point<3>(-a, 0,-a), - Point<3>( a, 0,-a), - Point<3>(-a, 0, a), - Point<3>( a, 0, a), - Point<3>(-d, 0, d), - Point<3>( d, 0, d), - Point<3>(-d, half_length,-d), - Point<3>( d, half_length,-d), - Point<3>(-a, half_length,-a), - Point<3>( a, half_length,-a), - Point<3>(-a, half_length, a), - Point<3>( a, half_length, a), - Point<3>(-d, half_length, d), - Point<3>( d, half_length, d), - }; - // Turn cylinder such that y->x - for (unsigned int i=0; i<24; ++i) - { - const double h = vertices[i](1); - vertices[i](1) = -vertices[i](0); - vertices[i](0) = h; - } - - int cell_vertices[10][8] = + template <> + void + hyper_ball (Triangulation<3> &tria, + const Point<3> &p, + const double radius) { - {0, 1, 8, 9, 2, 3, 10, 11}, - {0, 2, 8, 10, 6, 4, 14, 12}, - {2, 3, 10, 11, 4, 5, 12, 13}, - {1, 7, 9, 15, 3, 5, 11, 13}, - {6, 4, 14, 12, 7, 5, 15, 13} - }; - for (unsigned int i=0; i<5; ++i) - for (unsigned int j=0; j<8; ++j) - cell_vertices[i+5][j] = cell_vertices[i][j]+8; - - std::vector > cells (10, CellData<3>()); - - for (unsigned int i=0; i<10; ++i) - { - for (unsigned int j=0; j<8; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; + const double a = 1./(1+std::sqrt(3.0)); // equilibrate cell sizes at transition + // from the inner part to the radial + // cells + const unsigned int n_vertices = 16; + const Point<3> vertices[n_vertices] + = + { + // first the vertices of the inner + // cell + p+Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)*a), + p+Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)*a), + p+Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)*a), + p+Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)*a), + p+Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)*a), + p+Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)*a), + p+Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)*a), + p+Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)*a), + // now the eight vertices at + // the outer sphere + p+Point<3>(-1,-1,-1) *(radius/std::sqrt(3.0)), + p+Point<3>(+1,-1,-1) *(radius/std::sqrt(3.0)), + p+Point<3>(+1,-1,+1) *(radius/std::sqrt(3.0)), + p+Point<3>(-1,-1,+1) *(radius/std::sqrt(3.0)), + p+Point<3>(-1,+1,-1) *(radius/std::sqrt(3.0)), + p+Point<3>(+1,+1,-1) *(radius/std::sqrt(3.0)), + p+Point<3>(+1,+1,+1) *(radius/std::sqrt(3.0)), + p+Point<3>(-1,+1,+1) *(radius/std::sqrt(3.0)), }; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[24]), - cells, - SubCellData()); // no boundary information - - // set boundary indicators for the - // faces at the ends to 1 and 2, - // respectively. note that we also - // have to deal with those lines - // that are purely in the interior - // of the ends. we determine wether - // an edge is purely in the - // interior if one of its vertices - // is at coordinates '+-a' as set - // above - Triangulation<3>::cell_iterator cell = tria.begin(); - Triangulation<3>::cell_iterator end = tria.end(); - - for (; cell != end; ++cell) - for (unsigned int i=0; i::faces_per_cell; ++i) - if (cell->at_boundary(i)) - { - if (cell->face(i)->center()(0) > half_length-1.e-5) - { - cell->face(i)->set_boundary_indicator(2); - - for (unsigned int e=0; e::lines_per_face; ++e) - if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) || - (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) || - (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) || - (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a)) - cell->face(i)->line(e)->set_boundary_indicator(2); - } - else if (cell->face(i)->center()(0) < -half_length+1.e-5) - { - cell->face(i)->set_boundary_indicator(1); + // one needs to draw the seven cubes to + // understand what's going on here + const unsigned int n_cells = 7; + const int cell_vertices[n_cells][8] = {{0, 1, 4, 5, 3, 2, 7, 6}, // center + {8, 9, 12, 13, 0, 1, 4, 5}, // bottom + {9, 13, 1, 5, 10, 14, 2, 6}, // right + {11, 10, 3, 2, 15, 14, 7, 6}, // top + {8, 0, 12, 4, 11, 3, 15, 7}, // left + {8, 9, 0, 1, 11, 10, 3, 2}, // front + {12, 4, 13, 5, 15, 7, 14, 6} + }; // back + + std::vector > cells (n_cells, CellData<3>()); + + for (unsigned int i=0; i::vertices_per_cell; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; - for (unsigned int e=0; e::lines_per_face; ++e) - if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) || - (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) || - (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) || - (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a)) - cell->face(i)->line(e)->set_boundary_indicator(1); - } - } -} + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[n_vertices]), + cells, + SubCellData()); // no boundary information + } // Implementation for 3D only -template <> -void -GridGenerator::half_hyper_ball (Triangulation<3> &tria, - const Point<3> ¢er, - const double radius) -{ - // These are for the two lower squares - const double d = radius/std::sqrt(2.0); - const double a = d/(1+std::sqrt(2.0)); - // These are for the two upper square - const double b = a/2.0; - const double c = d/2.0; - // And so are these - const double hb = radius*std::sqrt(3.0)/4.0; - const double hc = radius*std::sqrt(3.0)/2.0; - - Point<3> vertices[16] = + template <> + void + cylinder (Triangulation<3> &tria, + const double radius, + const double half_length) { - center+Point<3>( 0, d, -d), - center+Point<3>( 0, -d, -d), - center+Point<3>( 0, a, -a), - center+Point<3>( 0, -a, -a), - center+Point<3>( 0, a, a), - center+Point<3>( 0, -a, a), - center+Point<3>( 0, d, d), - center+Point<3>( 0, -d, d), - - center+Point<3>(hc, c, -c), - center+Point<3>(hc, -c, -c), - center+Point<3>(hb, b, -b), - center+Point<3>(hb, -b, -b), - center+Point<3>(hb, b, b), - center+Point<3>(hb, -b, b), - center+Point<3>(hc, c, c), - center+Point<3>(hc, -c, c), - }; - - int cell_vertices[6][8] = - { - {0, 1, 8, 9, 2, 3, 10, 11}, - {0, 2, 8, 10, 6, 4, 14, 12}, - {2, 3, 10, 11, 4, 5, 12, 13}, - {1, 7, 9, 15, 3, 5, 11, 13}, - {6, 4, 14, 12, 7, 5, 15, 13}, - {8, 10, 9, 11, 14, 12, 15, 13} - }; - - std::vector > cells (6, CellData<3>()); + // Copy the base from hyper_ball<3> + // and transform it to yz + const double d = radius/std::sqrt(2.0); + const double a = d/(1+std::sqrt(2.0)); + Point<3> vertices[24] = + { + Point<3>(-d, -half_length,-d), + Point<3>( d, -half_length,-d), + Point<3>(-a, -half_length,-a), + Point<3>( a, -half_length,-a), + Point<3>(-a, -half_length, a), + Point<3>( a, -half_length, a), + Point<3>(-d, -half_length, d), + Point<3>( d, -half_length, d), + Point<3>(-d, 0,-d), + Point<3>( d, 0,-d), + Point<3>(-a, 0,-a), + Point<3>( a, 0,-a), + Point<3>(-a, 0, a), + Point<3>( a, 0, a), + Point<3>(-d, 0, d), + Point<3>( d, 0, d), + Point<3>(-d, half_length,-d), + Point<3>( d, half_length,-d), + Point<3>(-a, half_length,-a), + Point<3>( a, half_length,-a), + Point<3>(-a, half_length, a), + Point<3>( a, half_length, a), + Point<3>(-d, half_length, d), + Point<3>( d, half_length, d), + }; + // Turn cylinder such that y->x + for (unsigned int i=0; i<24; ++i) + { + const double h = vertices[i](1); + vertices[i](1) = -vertices[i](0); + vertices[i](0) = h; + } - for (unsigned int i=0; i<6; ++i) + int cell_vertices[10][8] = { - for (unsigned int j=0; j<8; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; + {0, 1, 8, 9, 2, 3, 10, 11}, + {0, 2, 8, 10, 6, 4, 14, 12}, + {2, 3, 10, 11, 4, 5, 12, 13}, + {1, 7, 9, 15, 3, 5, 11, 13}, + {6, 4, 14, 12, 7, 5, 15, 13} }; + for (unsigned int i=0; i<5; ++i) + for (unsigned int j=0; j<8; ++j) + cell_vertices[i+5][j] = cell_vertices[i][j]+8; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[16]), - cells, - SubCellData()); // no boundary information + std::vector > cells (10, CellData<3>()); - Triangulation<3>::cell_iterator cell = tria.begin(); - Triangulation<3>::cell_iterator end = tria.end(); + for (unsigned int i=0; i<10; ++i) + { + for (unsigned int j=0; j<8; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; - // go over all faces. for the ones on the flat face, set boundary - // indicator for face and edges to one; the rest will remain at - // zero but we have to pay attention to those edges that are - // at the perimeter of the flat face since they should not be - // set to one - while (cell != end) - { + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[24]), + cells, + SubCellData()); // no boundary information + + // set boundary indicators for the + // faces at the ends to 1 and 2, + // respectively. note that we also + // have to deal with those lines + // that are purely in the interior + // of the ends. we determine whether + // an edge is purely in the + // interior if one of its vertices + // is at coordinates '+-a' as set + // above + Triangulation<3>::cell_iterator cell = tria.begin(); + Triangulation<3>::cell_iterator end = tria.end(); + + for (; cell != end; ++cell) for (unsigned int i=0; i::faces_per_cell; ++i) - { - if (!cell->at_boundary(i)) - continue; + if (cell->at_boundary(i)) + { + if (cell->face(i)->center()(0) > half_length-1.e-5) + { + cell->face(i)->set_boundary_indicator(2); + + for (unsigned int e=0; e::lines_per_face; ++e) + if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a)) + cell->face(i)->line(e)->set_boundary_indicator(2); + } + else if (cell->face(i)->center()(0) < -half_length+1.e-5) + { + cell->face(i)->set_boundary_indicator(1); + + for (unsigned int e=0; e::lines_per_face; ++e) + if ((std::fabs(cell->face(i)->line(e)->vertex(0)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(0)[2]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[1]) == a) || + (std::fabs(cell->face(i)->line(e)->vertex(1)[2]) == a)) + cell->face(i)->line(e)->set_boundary_indicator(1); + } + } + } + - // If the center is on the plane x=0, this is a planar element. set - // its boundary indicator. also set the boundary indicators of the - // bounding faces unless both vertices are on the perimeter - if (cell->face(i)->center()(0) < center(0)+1.e-5*radius) - { - cell->face(i)->set_boundary_indicator(1); - for (unsigned int j=0; j::lines_per_face; ++j) - { - const Point<3> vertices[2] - = { cell->face(i)->line(j)->vertex(0), - cell->face(i)->line(j)->vertex(1) }; - if ((std::fabs(vertices[0].distance(center)-radius) > - 1e-5*radius) - || - (std::fabs(vertices[1].distance(center)-radius) > - 1e-5*radius)) - cell->face(i)->line(j)->set_boundary_indicator(1); - } - } - } - ++cell; - } -} // Implementation for 3D only -template<> -void -GridGenerator:: -colorize_hyper_shell (Triangulation<3> &tria, - const Point<3> &, - const double, - const double) -{ - // the following uses a good amount - // of knowledge about the - // orientation of cells. this is - // probably not good style... - if (tria.n_cells() == 6) + template <> + void + half_hyper_ball (Triangulation<3> &tria, + const Point<3> ¢er, + const double radius) + { + // These are for the two lower squares + const double d = radius/std::sqrt(2.0); + const double a = d/(1+std::sqrt(2.0)); + // These are for the two upper square + const double b = a/2.0; + const double c = d/2.0; + // And so are these + const double hb = radius*std::sqrt(3.0)/4.0; + const double hc = radius*std::sqrt(3.0)/2.0; + + Point<3> vertices[16] = + { + center+Point<3>( 0, d, -d), + center+Point<3>( 0, -d, -d), + center+Point<3>( 0, a, -a), + center+Point<3>( 0, -a, -a), + center+Point<3>( 0, a, a), + center+Point<3>( 0, -a, a), + center+Point<3>( 0, d, d), + center+Point<3>( 0, -d, d), + + center+Point<3>(hc, c, -c), + center+Point<3>(hc, -c, -c), + center+Point<3>(hb, b, -b), + center+Point<3>(hb, -b, -b), + center+Point<3>(hb, b, b), + center+Point<3>(hb, -b, b), + center+Point<3>(hc, c, c), + center+Point<3>(hc, -c, c), + }; + + int cell_vertices[6][8] = { - Triangulation<3>::cell_iterator cell = tria.begin(); + {0, 1, 8, 9, 2, 3, 10, 11}, + {0, 2, 8, 10, 6, 4, 14, 12}, + {2, 3, 10, 11, 4, 5, 12, 13}, + {1, 7, 9, 15, 3, 5, 11, 13}, + {6, 4, 14, 12, 7, 5, 15, 13}, + {8, 10, 9, 11, 14, 12, 15, 13} + }; - cell->face(4)->set_boundary_indicator(1); - Assert (cell->face(4)->at_boundary(), ExcInternalError()); + std::vector > cells (6, CellData<3>()); - (++cell)->face(2)->set_boundary_indicator(1); - Assert (cell->face(2)->at_boundary(), ExcInternalError()); + for (unsigned int i=0; i<6; ++i) + { + for (unsigned int j=0; j<8; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; - (++cell)->face(2)->set_boundary_indicator(1); - Assert (cell->face(2)->at_boundary(), ExcInternalError()); + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[16]), + cells, + SubCellData()); // no boundary information - (++cell)->face(0)->set_boundary_indicator(1); - Assert (cell->face(0)->at_boundary(), ExcInternalError()); + Triangulation<3>::cell_iterator cell = tria.begin(); + Triangulation<3>::cell_iterator end = tria.end(); - (++cell)->face(2)->set_boundary_indicator(1); - Assert (cell->face(2)->at_boundary(), ExcInternalError()); + // go over all faces. for the ones on the flat face, set boundary + // indicator for face and edges to one; the rest will remain at + // zero but we have to pay attention to those edges that are + // at the perimeter of the flat face since they should not be + // set to one + while (cell != end) + { + for (unsigned int i=0; i::faces_per_cell; ++i) + { + if (!cell->at_boundary(i)) + continue; - (++cell)->face(0)->set_boundary_indicator(1); - Assert (cell->face(0)->at_boundary(), ExcInternalError()); - } - else if (tria.n_cells() == 12) - { - // again use some internal - // knowledge - for (Triangulation<3>::cell_iterator cell = tria.begin(); - cell != tria.end(); ++cell) - { - Assert (cell->face(5)->at_boundary(), ExcInternalError()); - cell->face(5)->set_boundary_indicator(1); - } - } - else if (tria.n_cells() == 96) - { - // the 96-cell hypershell is - // based on a once refined - // 12-cell mesh. consequently, - // since the outer faces all - // are face_no==5 above, so - // they are here (unless they - // are in the interior). Use - // this to assign boundary - // indicators, but also make - // sure that we encounter - // exactly 48 such faces - unsigned int count = 0; - for (Triangulation<3>::cell_iterator cell = tria.begin(); - cell != tria.end(); ++cell) - if (cell->face(5)->at_boundary()) - { - cell->face(5)->set_boundary_indicator(1); - ++count; + // If the center is on the plane x=0, this is a planar element. set + // its boundary indicator. also set the boundary indicators of the + // bounding faces unless both vertices are on the perimeter + if (cell->face(i)->center()(0) < center(0)+1.e-5*radius) + { + cell->face(i)->set_boundary_indicator(1); + for (unsigned int j=0; j::lines_per_face; ++j) + { + const Point<3> vertices[2] + = { cell->face(i)->line(j)->vertex(0), + cell->face(i)->line(j)->vertex(1) + }; + if ((std::fabs(vertices[0].distance(center)-radius) > + 1e-5*radius) + || + (std::fabs(vertices[1].distance(center)-radius) > + 1e-5*radius)) + cell->face(i)->line(j)->set_boundary_indicator(1); + } + } } - Assert (count == 48, ExcInternalError()); - } - else - Assert (false, ExcNotImplemented()); -} - - + ++cell; + } + } -template <> -void -GridGenerator::hyper_shell (Triangulation<3> &tria, - const Point<3> &p, - const double inner_radius, - const double outer_radius, - const size_type n, - const bool colorize) -{ - Assert ((inner_radius > 0) && (inner_radius < outer_radius), - ExcInvalidRadii ()); - const double irad = inner_radius/std::sqrt(3.0); - const double orad = outer_radius/std::sqrt(3.0); - std::vector > vertices; - std::vector > cells; + template <> + void + hyper_shell (Triangulation<3> &tria, + const Point<3> &p, + const double inner_radius, + const double outer_radius, + const unsigned int n, + const bool colorize) + { + Assert ((inner_radius > 0) && (inner_radius < outer_radius), + ExcInvalidRadii ()); - // Start with the shell bounded by - // two nested cubes - if (n == 6) - { - for (unsigned int i=0; i<8; ++i) - vertices.push_back(p+hexahedron[i]*irad); - for (unsigned int i=0; i<8; ++i) - vertices.push_back(p+hexahedron[i]*orad); + const double irad = inner_radius/std::sqrt(3.0); + const double orad = outer_radius/std::sqrt(3.0); + std::vector > vertices; + std::vector > cells; - const unsigned int n_cells = 6; - const int cell_vertices[n_cells][8] = + // Start with the shell bounded by + // two nested cubes + if (n == 6) { - {8, 9, 10, 11, 0, 1, 2, 3}, // bottom - {9, 11, 1, 3, 13, 15, 5, 7}, // right - {12, 13, 4, 5, 14, 15, 6, 7}, // top - {8, 0, 10, 2, 12, 4, 14, 6}, // left - {8, 9, 0, 1, 12, 13, 4, 5}, // front - {10, 2, 11, 3, 14, 6, 15, 7} - }; // back + for (unsigned int i=0; i<8; ++i) + vertices.push_back(p+hexahedron[i]*irad); + for (unsigned int i=0; i<8; ++i) + vertices.push_back(p+hexahedron[i]*orad); - cells.resize(n_cells, CellData<3>()); - - for (unsigned int i=0; i::vertices_per_cell; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; - } + {8, 9, 10, 11, 0, 1, 2, 3}, // bottom + {9, 11, 1, 3, 13, 15, 5, 7}, // right + {12, 13, 4, 5, 14, 15, 6, 7}, // top + {8, 0, 10, 2, 12, 4, 14, 6}, // left + {8, 9, 0, 1, 12, 13, 4, 5}, // front + {10, 2, 11, 3, 14, 6, 15, 7} + }; // back - tria.create_triangulation (vertices, cells, SubCellData()); - } - // A more regular subdivision can - // be obtained by two nested - // rhombic dodecahedra - else if (n == 12) - { - for (unsigned int i=0; i<8; ++i) - vertices.push_back(p+hexahedron[i]*irad); - for (unsigned int i=0; i<6; ++i) - vertices.push_back(p+octahedron[i]*inner_radius); - for (unsigned int i=0; i<8; ++i) - vertices.push_back(p+hexahedron[i]*orad); - for (unsigned int i=0; i<6; ++i) - vertices.push_back(p+octahedron[i]*outer_radius); - - const unsigned int n_cells = 12; - const unsigned int rhombi[n_cells][4] = - { - { 10, 4, 0, 8}, - { 4, 13, 8, 6}, - { 10, 5, 4, 13}, - { 1, 9, 10, 5}, - { 9, 7, 5, 13}, - { 7, 11, 13, 6}, - { 9, 3, 7, 11}, - { 1, 12, 9, 3}, - { 12, 2, 3, 11}, - { 2, 8, 11, 6}, - { 12, 0, 2, 8}, - { 1, 10, 12, 0} - }; + cells.resize(n_cells, CellData<3>()); - cells.resize(n_cells, CellData<3>()); + for (unsigned int i=0; i::vertices_per_cell; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + } - for (unsigned int i=0; i boundary (p); - Triangulation<3> tmp; - GridGenerator::hyper_shell (tmp, p, inner_radius, outer_radius, 12); - tmp.set_boundary(0, boundary); - tmp.set_boundary(1, boundary); - tmp.refine_global (1); - - // let's determine the distance at - // which the interior nodes should be - // from the center. let's say we - // measure distances in multiples of - // outer_radius and call - // r=inner_radius. - // - // then note - // that we now have 48 faces on the - // inner and 48 on the outer sphere, - // each with an area of approximately - // 4*pi/48*r^2 and 4*pi/48, for - // a face edge length of approximately - // sqrt(pi/12)*r and sqrt(pi/12) - // - // let's say we put the interior nodes - // at a distance rho, then a measure of - // deformation for the inner cells - // would be - // di=max(sqrt(pi/12)*r/(rho-r), - // (rho-r)/sqrt(pi/12)/r) - // and for the outer cells - // do=max(sqrt(pi/12)/(1-rho), - // (1-rho)/sqrt(pi/12)) - // - // we now seek a rho so that the - // deformation of cells on the inside - // and outside is equal. there are in - // principle four possibilities for one - // of the branches of do== one of the - // branches of di, though not all of - // them satisfy do==di, of - // course. however, we are not - // interested in cases where the inner - // cell is long and skinny and the - // outer one tall -- yes, they have the - // same aspect ratio, but in different - // space directions. - // - // so it only boils down to the - // following two possibilities: the - // first branch of each max(.,.) - // functions are equal, or the second - // one are. on the other hand, since - // they two branches are reciprocals of - // each other, if one pair of branches - // is equal, so is the other - // - // this yields the following equation - // for rho: - // sqrt(pi/12)*r/(rho-r) - // == sqrt(pi/12)/(1-rho) - // with solution rho=2r/(1+r) - const double r = inner_radius / outer_radius; - const double rho = 2*r/(1+r); - - // then this is the distance of the - // interior nodes from the center: - const double middle_radius = rho * outer_radius; - - // mark vertices we've already moved or - // that we want to ignore: we don't - // want to move vertices at the inner - // or outer boundaries - std::vector vertex_already_treated (tmp.n_vertices(), false); - for (Triangulation<3>::active_cell_iterator cell = tmp.begin_active(); - cell != tmp.end(); ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->at_boundary(f)) - for (unsigned int v=0; v::vertices_per_face; ++v) - vertex_already_treated[cell->face(f)->vertex_index(v)] = true; - - // now move the remaining vertices - for (Triangulation<3>::active_cell_iterator cell = tmp.begin_active(); - cell != tmp.end(); ++cell) - for (unsigned int v=0; v::vertices_per_cell; ++v) - if (vertex_already_treated[cell->vertex_index(v)] == false) - { - // this is a new interior - // vertex. mesh refinement may - // have placed it at a number - // of places in radial - // direction and oftentimes not - // in a particularly good - // one. move it to halfway - // between inner and outer - // sphere - const Point<3> old_distance = cell->vertex(v) - p; - const double old_radius = cell->vertex(v).distance(p); - cell->vertex(v) = p + old_distance * (middle_radius / old_radius); - - vertex_already_treated[cell->vertex_index(v)] = true; - } + cells.resize(n_cells, CellData<3>()); - // now copy the resulting level 1 cells - // into the new triangulation, - cells.resize(tmp.n_active_cells(), CellData<3>()); + for (unsigned int i=0; i::active_cell_iterator cell = tmp.begin_active(); - cell != tmp.end(); ++cell, ++index) - { + tria.create_triangulation (vertices, cells, SubCellData()); + } + else if (n == 96) + { + // create a triangulation based on the + // 12-cell one where we refine the mesh + // once and then re-arrange all + // interior nodes so that the mesh is + // the least distorted + HyperShellBoundary<3> boundary (p); + Triangulation<3> tmp; + hyper_shell (tmp, p, inner_radius, outer_radius, 12); + tmp.set_boundary(0, boundary); + tmp.set_boundary(1, boundary); + tmp.refine_global (1); + + // let's determine the distance at + // which the interior nodes should be + // from the center. let's say we + // measure distances in multiples of + // outer_radius and call + // r=inner_radius. + // + // then note + // that we now have 48 faces on the + // inner and 48 on the outer sphere, + // each with an area of approximately + // 4*pi/48*r^2 and 4*pi/48, for + // a face edge length of approximately + // sqrt(pi/12)*r and sqrt(pi/12) + // + // let's say we put the interior nodes + // at a distance rho, then a measure of + // deformation for the inner cells + // would be + // di=max(sqrt(pi/12)*r/(rho-r), + // (rho-r)/sqrt(pi/12)/r) + // and for the outer cells + // do=max(sqrt(pi/12)/(1-rho), + // (1-rho)/sqrt(pi/12)) + // + // we now seek a rho so that the + // deformation of cells on the inside + // and outside is equal. there are in + // principle four possibilities for one + // of the branches of do== one of the + // branches of di, though not all of + // them satisfy do==di, of + // course. however, we are not + // interested in cases where the inner + // cell is long and skinny and the + // outer one tall -- yes, they have the + // same aspect ratio, but in different + // space directions. + // + // so it only boils down to the + // following two possibilities: the + // first branch of each max(.,.) + // functions are equal, or the second + // one are. on the other hand, since + // they two branches are reciprocals of + // each other, if one pair of branches + // is equal, so is the other + // + // this yields the following equation + // for rho: + // sqrt(pi/12)*r/(rho-r) + // == sqrt(pi/12)/(1-rho) + // with solution rho=2r/(1+r) + const double r = inner_radius / outer_radius; + const double rho = 2*r/(1+r); + + // then this is the distance of the + // interior nodes from the center: + const double middle_radius = rho * outer_radius; + + // mark vertices we've already moved or + // that we want to ignore: we don't + // want to move vertices at the inner + // or outer boundaries + std::vector vertex_already_treated (tmp.n_vertices(), false); + for (Triangulation<3>::active_cell_iterator cell = tmp.begin_active(); + cell != tmp.end(); ++cell) + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->at_boundary(f)) + for (unsigned int v=0; v::vertices_per_face; ++v) + vertex_already_treated[cell->face(f)->vertex_index(v)] = true; + + // now move the remaining vertices + for (Triangulation<3>::active_cell_iterator cell = tmp.begin_active(); + cell != tmp.end(); ++cell) for (unsigned int v=0; v::vertices_per_cell; ++v) - cells[index].vertices[v] = cell->vertex_index(v); - cells[index].material_id = 0; - } - - tria.create_triangulation (tmp.get_vertices(), cells, SubCellData()); - } - else - { - Assert(false, ExcMessage ("Invalid number of coarse mesh cells.")); - } + if (vertex_already_treated[cell->vertex_index(v)] == false) + { + // this is a new interior + // vertex. mesh refinement may + // have placed it at a number + // of places in radial + // direction and oftentimes not + // in a particularly good + // one. move it to halfway + // between inner and outer + // sphere + const Point<3> old_distance = cell->vertex(v) - p; + const double old_radius = cell->vertex(v).distance(p); + cell->vertex(v) = p + old_distance * (middle_radius / old_radius); + + vertex_already_treated[cell->vertex_index(v)] = true; + } - if (colorize) - colorize_hyper_shell(tria, p, inner_radius, outer_radius); -} + // now copy the resulting level 1 cells + // into the new triangulation, + cells.resize(tmp.n_active_cells(), CellData<3>()); + unsigned int index = 0; + for (Triangulation<3>::active_cell_iterator cell = tmp.begin_active(); + cell != tmp.end(); ++cell, ++index) + { + for (unsigned int v=0; v::vertices_per_cell; ++v) + cells[index].vertices[v] = cell->vertex_index(v); + cells[index].material_id = 0; + } + tria.create_triangulation (tmp.get_vertices(), cells, SubCellData()); + } + else + { + Assert(false, ExcMessage ("Invalid number of coarse mesh cells.")); + } + if (colorize) + colorize_hyper_shell(tria, p, inner_radius, outer_radius); + } -// Implementation for 3D only -template <> -void -GridGenerator::half_hyper_shell (Triangulation<3> &tria, - const Point<3> ¢er, - const double inner_radius, - const double outer_radius, - const size_type n, - const bool colorize) -{ - Assert ((inner_radius > 0) && (inner_radius < outer_radius), - ExcInvalidRadii ()); - Assert(colorize == false, ExcNotImplemented()); - if (n <= 5) - { - // These are for the two lower squares - const double d = outer_radius/std::sqrt(2.0); - const double a = inner_radius/std::sqrt(2.0); - // These are for the two upper square - const double b = a/2.0; - const double c = d/2.0; - // And so are these - const double hb = inner_radius*std::sqrt(3.0)/2.0; - const double hc = outer_radius*std::sqrt(3.0)/2.0; - - Point<3> vertices[16] = - { - center+Point<3>( 0, d, -d), - center+Point<3>( 0, -d, -d), - center+Point<3>( 0, a, -a), - center+Point<3>( 0, -a, -a), - center+Point<3>( 0, a, a), - center+Point<3>( 0, -a, a), - center+Point<3>( 0, d, d), - center+Point<3>( 0, -d, d), - - center+Point<3>(hc, c, -c), - center+Point<3>(hc, -c, -c), - center+Point<3>(hb, b, -b), - center+Point<3>(hb, -b, -b), - center+Point<3>(hb, b, b), - center+Point<3>(hb, -b, b), - center+Point<3>(hc, c, c), - center+Point<3>(hc, -c, c), - }; - int cell_vertices[5][8] = - { - {0, 1, 8, 9, 2, 3, 10, 11}, - {0, 2, 8, 10, 6, 4, 14, 12}, - {1, 7, 9, 15, 3, 5, 11, 13}, - {6, 4, 14, 12, 7, 5, 15, 13}, - {8, 10, 9, 11, 14, 12, 15, 13} - }; - std::vector > cells (5, CellData<3>()); +// Implementation for 3D only + template <> + void + half_hyper_shell (Triangulation<3> &tria, + const Point<3> ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n, + const bool colorize) + { + Assert ((inner_radius > 0) && (inner_radius < outer_radius), + ExcInvalidRadii ()); + Assert(colorize == false, ExcNotImplemented()); - for (unsigned int i=0; i<5; ++i) + if (n <= 5) + { + // These are for the two lower squares + const double d = outer_radius/std::sqrt(2.0); + const double a = inner_radius/std::sqrt(2.0); + // These are for the two upper square + const double b = a/2.0; + const double c = d/2.0; + // And so are these + const double hb = inner_radius*std::sqrt(3.0)/2.0; + const double hc = outer_radius*std::sqrt(3.0)/2.0; + + Point<3> vertices[16] = { - for (unsigned int j=0; j<8; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; + center+Point<3>( 0, d, -d), + center+Point<3>( 0, -d, -d), + center+Point<3>( 0, a, -a), + center+Point<3>( 0, -a, -a), + center+Point<3>( 0, a, a), + center+Point<3>( 0, -a, a), + center+Point<3>( 0, d, d), + center+Point<3>( 0, -d, d), + + center+Point<3>(hc, c, -c), + center+Point<3>(hc, -c, -c), + center+Point<3>(hb, b, -b), + center+Point<3>(hb, -b, -b), + center+Point<3>(hb, b, b), + center+Point<3>(hb, -b, b), + center+Point<3>(hc, c, c), + center+Point<3>(hc, -c, c), }; - tria.create_triangulation ( - std::vector >(&vertices[0], &vertices[16]), - cells, - SubCellData()); // no boundary information - } - else - { - Assert(false, ExcIndexRange(n, 0, 5)); - } + int cell_vertices[5][8] = + { + {0, 1, 8, 9, 2, 3, 10, 11}, + {0, 2, 8, 10, 6, 4, 14, 12}, + {1, 7, 9, 15, 3, 5, 11, 13}, + {6, 4, 14, 12, 7, 5, 15, 13}, + {8, 10, 9, 11, 14, 12, 15, 13} + }; -} + std::vector > cells (5, CellData<3>()); -// Implementation for 3D only -template <> -void -GridGenerator::colorize_quarter_hyper_shell(Triangulation<3> &tria, - const Point<3> ¢er, - const double inner_radius, - const double outer_radius) -{ + for (unsigned int i=0; i<5; ++i) + { + for (unsigned int j=0; j<8; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; + }; + + tria.create_triangulation ( + std::vector >(&vertices[0], &vertices[16]), + cells, + SubCellData()); // no boundary information + } + else + { + Assert(false, ExcIndexRange(n, 0, 5)); + } - if (tria.n_cells() != 3) - AssertThrow (false, ExcNotImplemented()); + } - double middle = (outer_radius-inner_radius)/2e0 + inner_radius; - double eps = 1e-3*middle; - Triangulation<3>::cell_iterator cell = tria.begin(); - for (; cell!=tria.end(); ++cell) - for (unsigned int f=0; f::faces_per_cell; ++f) +// Implementation for 3D only + template <> + void quarter_hyper_shell (Triangulation<3> &tria, + const Point<3> ¢er, + const double inner_radius, + const double outer_radius, + const unsigned int n, + const bool colorize) + { + Assert ((inner_radius > 0) && (inner_radius < outer_radius), + ExcInvalidRadii ()); + if (n == 0 || n == 3) { - if (!cell->face(f)->at_boundary()) - continue; + const double a = inner_radius*std::sqrt(2.0)/2e0; + const double b = outer_radius*std::sqrt(2.0)/2e0; + const double c = a*std::sqrt(3.0)/2e0; + const double d = b*std::sqrt(3.0)/2e0; + const double e = outer_radius/2e0; + const double h = inner_radius/2e0; + + std::vector > vertices; + + vertices.push_back (center+Point<3>( 0, inner_radius, 0)); //0 + vertices.push_back (center+Point<3>( a, a, 0)); //1 + vertices.push_back (center+Point<3>( b, b, 0)); //2 + vertices.push_back (center+Point<3>( 0, outer_radius, 0)); //3 + vertices.push_back (center+Point<3>( 0, a , a)); //4 + vertices.push_back (center+Point<3>( c, c , h)); //5 + vertices.push_back (center+Point<3>( d, d , e)); //6 + vertices.push_back (center+Point<3>( 0, b , b)); //7 + vertices.push_back (center+Point<3>( inner_radius, 0 , 0)); //8 + vertices.push_back (center+Point<3>( outer_radius, 0 , 0)); //9 + vertices.push_back (center+Point<3>( a, 0 , a)); //10 + vertices.push_back (center+Point<3>( b, 0 , b)); //11 + vertices.push_back (center+Point<3>( 0, 0 , inner_radius)); //12 + vertices.push_back (center+Point<3>( 0, 0 , outer_radius)); //13 + + const int cell_vertices[3][8] = + { + {0, 1, 3, 2, 4, 5, 7, 6}, + {1, 8, 2, 9, 5, 10, 6, 11}, + {4, 5, 7, 6, 12, 10, 13, 11}, + }; + std::vector > cells(3); - double radius = cell->face(f)->center().norm() - center.norm(); - if (std::fabs(cell->face(f)->center()(0)) < eps ) // x = 0 set boundary 2 - { - cell->face(f)->set_boundary_indicator(2); - for (unsigned int j=0; j::lines_per_face; ++j) - if (cell->face(f)->line(j)->at_boundary()) - if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps) - cell->face(f)->line(j)->set_boundary_indicator(2); - } - else if (std::fabs(cell->face(f)->center()(1)) < eps) // y = 0 set boundary 3 - { - cell->face(f)->set_boundary_indicator(3); - for (unsigned int j=0; j::lines_per_face; ++j) - if (cell->face(f)->line(j)->at_boundary()) - if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps) - cell->face(f)->line(j)->set_boundary_indicator(3); - } - else if (std::fabs(cell->face(f)->center()(2)) < eps ) // z = 0 set boundary 4 - { - cell->face(f)->set_boundary_indicator(4); - for (unsigned int j=0; j::lines_per_face; ++j) - if (cell->face(f)->line(j)->at_boundary()) - if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) > eps) - cell->face(f)->line(j)->set_boundary_indicator(4); - } - else if (radius < middle) // inner radius set boundary 0 - { - cell->face(f)->set_boundary_indicator(0); - for (unsigned int j=0; j::lines_per_face; ++j) - if (cell->face(f)->line(j)->at_boundary()) - if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps) - cell->face(f)->line(j)->set_boundary_indicator(0); - } - else if (radius > middle) // outer radius set boundary 1 + for (unsigned int i=0; i<3; ++i) { - cell->face(f)->set_boundary_indicator(1); - for (unsigned int j=0; j::lines_per_face; ++j) - if (cell->face(f)->line(j)->at_boundary()) - if (std::fabs(cell->face(f)->line(j)->vertex(0).norm() - cell->face(f)->line(j)->vertex(1).norm()) < eps) - cell->face(f)->line(j)->set_boundary_indicator(1); + for (unsigned int j=0; j<8; ++j) + cells[i].vertices[j] = cell_vertices[i][j]; + cells[i].material_id = 0; } - else - AssertThrow (false, ExcInternalError()); + + tria.create_triangulation ( vertices, cells, SubCellData()); // no boundary information + } + else + { + AssertThrow(false, ExcNotImplemented()); } -} + if (colorize) + colorize_quarter_hyper_shell(tria, center, inner_radius, outer_radius); + } // Implementation for 3D only -template <> -void GridGenerator::quarter_hyper_shell (Triangulation<3> &tria, - const Point<3> ¢er, - const double inner_radius, - const double outer_radius, - const size_type n, - const bool colorize) -{ - Assert ((inner_radius > 0) && (inner_radius < outer_radius), - ExcInvalidRadii ()); - if (n == 0 || n == 3) - { - const double a = inner_radius*std::sqrt(2.0)/2e0; - const double b = outer_radius*std::sqrt(2.0)/2e0; - const double c = a*std::sqrt(3.0)/2e0; - const double d = b*std::sqrt(3.0)/2e0; - const double e = outer_radius/2e0; - const double h = inner_radius/2e0; - - std::vector > vertices; - - vertices.push_back (center+Point<3>( 0, inner_radius, 0)); //0 - vertices.push_back (center+Point<3>( a, a, 0)); //1 - vertices.push_back (center+Point<3>( b, b, 0)); //2 - vertices.push_back (center+Point<3>( 0, outer_radius, 0)); //3 - vertices.push_back (center+Point<3>( 0, a , a)); //4 - vertices.push_back (center+Point<3>( c, c , h)); //5 - vertices.push_back (center+Point<3>( d, d , e)); //6 - vertices.push_back (center+Point<3>( 0, b , b)); //7 - vertices.push_back (center+Point<3>( inner_radius, 0 , 0)); //8 - vertices.push_back (center+Point<3>( outer_radius, 0 , 0)); //9 - vertices.push_back (center+Point<3>( a, 0 , a)); //10 - vertices.push_back (center+Point<3>( b, 0 , b)); //11 - vertices.push_back (center+Point<3>( 0, 0 , inner_radius)); //12 - vertices.push_back (center+Point<3>( 0, 0 , outer_radius)); //13 - - const int cell_vertices[3][8] = - { - {0, 1, 3, 2, 4, 5, 7, 6}, - {1, 8, 2, 9, 5, 10, 6, 11}, - {4, 5, 7, 6, 12, 10, 13, 11}, + template <> + void cylinder_shell (Triangulation<3> &tria, + const double length, + const double inner_radius, + const double outer_radius, + const unsigned int n_radial_cells, + const unsigned int n_axial_cells) + { + Assert ((inner_radius > 0) && (inner_radius < outer_radius), + ExcInvalidRadii ()); + + const double pi = numbers::PI; + + // determine the number of cells + // for the grid. if not provided by + // the user determine it such that + // the length of each cell on the + // median (in the middle between + // the two circles) is equal to its + // radial extent (which is the + // difference between the two + // radii) + const unsigned int N_r = (n_radial_cells == 0 ? + static_cast + (std::ceil((2*pi* (outer_radius + inner_radius)/2) / + (outer_radius - inner_radius))) : + n_radial_cells); + const unsigned int N_z = (n_axial_cells == 0 ? + static_cast + (std::ceil (length / + (2*pi*(outer_radius + inner_radius)/2/N_r))) : + n_axial_cells); + + // set up N vertices on the + // outer and N vertices on + // the inner circle. the + // first N ones are on the + // outer one, and all are + // numbered counter-clockwise + std::vector > vertices_2d(2*N_r); + for (unsigned int i=0; i( std::cos(2*pi * i/N_r), + std::sin(2*pi * i/N_r)) * outer_radius; + vertices_2d[i+N_r] = vertices_2d[i] * (inner_radius/outer_radius); }; - std::vector > cells(3); - for (unsigned int i=0; i<3; ++i) + std::vector > vertices_3d; + vertices_3d.reserve (2*N_r*(N_z+1)); + for (unsigned int j=0; j<=N_z; ++j) + for (unsigned int i=0; i<2*N_r; ++i) { - for (unsigned int j=0; j<8; ++j) - cells[i].vertices[j] = cell_vertices[i][j]; - cells[i].material_id = 0; + const Point<3> v (vertices_2d[i][0], + vertices_2d[i][1], + j*length/N_z); + vertices_3d.push_back (v); } - tria.create_triangulation ( vertices, cells, SubCellData()); // no boundary information - } - else - { - AssertThrow(false, ExcNotImplemented()); - } + std::vector > cells (N_r*N_z, CellData<3>()); - if (colorize) - colorize_quarter_hyper_shell(tria, center, inner_radius, outer_radius); -} + for (unsigned int j=0; j -void GridGenerator::cylinder_shell (Triangulation<3> &tria, - const double length, - const double inner_radius, - const double outer_radius, - const size_type n_radial_cells, - const size_type n_axial_cells) -{ - Assert ((inner_radius > 0) && (inner_radius < outer_radius), - ExcInvalidRadii ()); - - const double pi = numbers::PI; - - // determine the number of cells - // for the grid. if not provided by - // the user determine it such that - // the length of each cell on the - // median (in the middle between - // the two circles) is equal to its - // radial extent (which is the - // difference between the two - // radii) - const size_type N_r = (n_radial_cells == 0 ? - static_cast - (std::ceil((2*pi* (outer_radius + inner_radius)/2) / - (outer_radius - inner_radius))) : - n_radial_cells); - const size_type N_z = (n_axial_cells == 0 ? - static_cast - (std::ceil (length / - (2*pi*(outer_radius + inner_radius)/2/N_r))) : - n_axial_cells); - - // set up N vertices on the - // outer and N vertices on - // the inner circle. the - // first N ones are on the - // outer one, and all are - // numbered counter-clockwise - std::vector > vertices_2d(2*N_r); - for (size_type i=0; i( std::cos(2*pi * i/N_r), - std::sin(2*pi * i/N_r)) * outer_radius; - vertices_2d[i+N_r] = vertices_2d[i] * (inner_radius/outer_radius); - }; + cells[i+j*N_r].material_id = 0; + } - std::vector > vertices_3d; - vertices_3d.reserve (2*N_r*(N_z+1)); - for (size_type j=0; j<=N_z; ++j) - for (size_type i=0; i<2*N_r; ++i) - { - const Point<3> v (vertices_2d[i][0], - vertices_2d[i][1], - j*length/N_z); - vertices_3d.push_back (v); - } + tria.create_triangulation ( + vertices_3d, cells, SubCellData()); + } - std::vector > cells (N_r*N_z, CellData<3>()); - for (size_type j=0; j + void + merge_triangulations (const Triangulation &triangulation_1, + const Triangulation &triangulation_2, + Triangulation &result) + { + Assert (triangulation_1.n_levels() == 1, + ExcMessage ("The input triangulations must be coarse meshes.")); + Assert (triangulation_2.n_levels() == 1, + ExcMessage ("The input triangulations must be coarse meshes.")); + + // get the union of the set of vertices + std::vector > vertices = triangulation_1.get_vertices(); + vertices.insert (vertices.end(), + triangulation_2.get_vertices().begin(), + triangulation_2.get_vertices().end()); + + // now form the union of the set of cells + std::vector > cells; + cells.reserve (triangulation_1.n_cells() + triangulation_2.n_cells()); + for (typename Triangulation::cell_iterator + cell = triangulation_1.begin(); cell != triangulation_1.end(); ++cell) + { + CellData this_cell; + for (unsigned int v=0; v::vertices_per_cell; ++v) + this_cell.vertices[v] = cell->vertex_index(v); + this_cell.material_id = cell->material_id(); + cells.push_back (this_cell); + } - cells[i+j*N_r].material_id = 0; + // now do the same for the other other mesh. note that we have to + // translate the vertex indices + for (typename Triangulation::cell_iterator + cell = triangulation_2.begin(); cell != triangulation_2.end(); ++cell) + { + CellData this_cell; + for (unsigned int v=0; v::vertices_per_cell; ++v) + this_cell.vertices[v] = cell->vertex_index(v) + triangulation_1.n_vertices(); + this_cell.material_id = cell->material_id(); + cells.push_back (this_cell); } - tria.create_triangulation ( - vertices_3d, cells, SubCellData()); -} + // throw out duplicated vertices from the two meshes + // and create the triangulation + SubCellData subcell_data; + std::vector considered_vertices; + GridTools::delete_duplicated_vertices (vertices, cells, subcell_data, considered_vertices); + result.clear (); + result.create_triangulation (vertices, cells, subcell_data); + } + + + void + extrude_triangulation(const Triangulation<2, 2> &input, + const unsigned int n_slices, + const double height, + Triangulation<3,3> &result) + { + Assert (input.n_levels() == 1, + ExcMessage ("The input triangulations must be coarse meshes.")); + Assert(result.n_cells()==0, ExcMessage("resultin Triangulation need to be empty upon calling extrude_triangulation.")); + Assert(height>0, ExcMessage("The height in extrude_triangulation needs to be positive.")); + Assert(n_slices>=2, ExcMessage("The number of slices in extrude_triangulation needs to be at least 2.")); + std::vector > points(n_slices*input.n_vertices()); + std::vector > cells; + cells.reserve((n_slices-1)*input.n_active_cells()); + for (unsigned int slice=0; slice -void -GridGenerator:: -merge_triangulations (const Triangulation &triangulation_1, - const Triangulation &triangulation_2, - Triangulation &result) -{ - Assert (triangulation_1.n_levels() == 1, - ExcMessage ("The input triangulations must be coarse meshes.")); - Assert (triangulation_2.n_levels() == 1, - ExcMessage ("The input triangulations must be coarse meshes.")); - - // get the union of the set of vertices - std::vector > vertices = triangulation_1.get_vertices(); - vertices.insert (vertices.end(), - triangulation_2.get_vertices().begin(), - triangulation_2.get_vertices().end()); - - // now form the union of the set of cells - std::vector > cells; - cells.reserve (triangulation_1.n_cells() + triangulation_2.n_cells()); - for (typename Triangulation::cell_iterator - cell = triangulation_1.begin(); cell != triangulation_1.end(); ++cell) - { - CellData this_cell; - for (unsigned int v=0; v::vertices_per_cell; ++v) - this_cell.vertices[v] = cell->vertex_index(v); - this_cell.material_id = cell->material_id(); - cells.push_back (this_cell); - } + { + const Point<2> &v = input.get_vertices()[i]; + points[i+slice*input.n_vertices()](0) = v(0); + points[i+slice*input.n_vertices()](1) = v(1); + points[i+slice*input.n_vertices()](2) = height * slice / (n_slices-1); + } + } - // now do the same for the other other mesh. note that we have to - // translate the vertex indices - for (typename Triangulation::cell_iterator - cell = triangulation_2.begin(); cell != triangulation_2.end(); ++cell) - { - CellData this_cell; - for (unsigned int v=0; v::vertices_per_cell; ++v) - this_cell.vertices[v] = cell->vertex_index(v) + triangulation_1.n_vertices(); - this_cell.material_id = cell->material_id(); - cells.push_back (this_cell); - } + for (Triangulation<2,2>::cell_iterator + cell = input.begin(); cell != input.end(); ++cell) + { + for (unsigned int slice=0; slice this_cell; + for (unsigned int v=0; v::vertices_per_cell; ++v) + { + this_cell.vertices[v] + = cell->vertex_index(v)+slice*input.n_vertices(); + this_cell.vertices[v+GeometryInfo<2>::vertices_per_cell] + = cell->vertex_index(v)+(slice+1)*input.n_vertices(); + } - // throw out duplicated vertices from the two meshes - // and create the triangulation - SubCellData subcell_data; - std::vector considered_vertices; - GridTools::delete_duplicated_vertices (vertices, cells, subcell_data, considered_vertices); - result.clear (); - result.create_triangulation (vertices, cells, subcell_data); -} + this_cell.material_id = cell->material_id(); + cells.push_back(this_cell); + } + } -void -GridGenerator:: -extrude_triangulation(const Triangulation<2, 2> &input, - const size_type n_slices, - const double height, - Triangulation<3,3> &result) -{ - Assert (input.n_levels() == 1, - ExcMessage ("The input triangulations must be coarse meshes.")); - Assert(result.n_cells()==0, ExcMessage("resultin Triangulation need to be empty upon calling extrude_triangulation.")); - Assert(height>0, ExcMessage("The height in extrude_triangulation needs to be positive.")); - Assert(n_slices>=2, ExcMessage("The number of slices in extrude_triangulation needs to be at least 2.")); + SubCellData s; + types::boundary_id bid=0; + s.boundary_quads.reserve(input.n_active_lines()*(n_slices-1) + input.n_active_cells()*2); + for (Triangulation<2,2>::cell_iterator + cell = input.begin(); cell != input.end(); ++cell) + { + CellData<2> quad; + for (unsigned int f=0; f<4; ++f) + if (cell->at_boundary(f)) + { + quad.boundary_id = cell->face(f)->boundary_indicator(); + bid = std::max(bid, quad.boundary_id); + for (unsigned int slice=0; sliceface(f)->vertex_index(0)+slice*input.n_vertices(); + quad.vertices[1] = cell->face(f)->vertex_index(1)+slice*input.n_vertices(); + quad.vertices[2] = cell->face(f)->vertex_index(0)+(slice+1)*input.n_vertices(); + quad.vertices[3] = cell->face(f)->vertex_index(1)+(slice+1)*input.n_vertices(); + s.boundary_quads.push_back(quad); + } + } + } - std::vector > points(n_slices*input.n_vertices()); - std::vector > cells; - cells.reserve((n_slices-1)*input.n_active_cells()); + for (Triangulation<2,2>::cell_iterator + cell = input.begin(); cell != input.end(); ++cell) + { + CellData<2> quad; + quad.boundary_id = bid + 1; + quad.vertices[0] = cell->vertex_index(0); + quad.vertices[1] = cell->vertex_index(1); + quad.vertices[2] = cell->vertex_index(2); + quad.vertices[3] = cell->vertex_index(3); + s.boundary_quads.push_back(quad); + + quad.boundary_id = bid + 2; + for (int i=0; i<4; ++i) + quad.vertices[i] += (n_slices-1)*input.n_vertices(); + s.boundary_quads.push_back(quad); + } - for (size_type slice=0; slice &v = input.get_vertices()[i]; - points[i+slice*input.n_vertices()](0) = v(0); - points[i+slice*input.n_vertices()](1) = v(1); - points[i+slice*input.n_vertices()](2) = height * slice / (n_slices-1); - } - } - for (Triangulation<2,2>::cell_iterator - cell = input.begin(); cell != input.end(); ++cell) - { - for (size_type slice=0; slice this_cell; - for (unsigned int v=0; v::vertices_per_cell; ++v) - { - this_cell.vertices[v] - = cell->vertex_index(v)+slice*input.n_vertices(); - this_cell.vertices[v+GeometryInfo<2>::vertices_per_cell] - = cell->vertex_index(v)+(slice+1)*input.n_vertices(); - } + /** + * Solve the Laplace equation for @p laplace_transformation function for one + * of the @p dim space dimensions. Factorized into a function of its own + * in order to allow parallel execution. + */ + void laplace_solve (const SparseMatrix &S, + const std::map &m, + Vector &u) + { + const unsigned int n_dofs=S.n(); + FilteredMatrix > SF (S); + PreconditionJacobi > prec; + prec.initialize(S, 1.2); + FilteredMatrix > PF (prec); - this_cell.material_id = cell->material_id(); - cells.push_back(this_cell); - } - } + SolverControl control (n_dofs, 1.e-10, false, false); + GrowingVectorMemory > mem; + SolverCG > solver (control, mem); - SubCellData s; - types::boundary_id bid=0; - s.boundary_quads.reserve(input.n_active_lines()*(n_slices-1) + input.n_active_cells()*2); - for (Triangulation<2,2>::cell_iterator - cell = input.begin(); cell != input.end(); ++cell) - { - CellData<2> quad; - for (unsigned int f=0; f<4; ++f) - if (cell->at_boundary(f)) - { - quad.boundary_id = cell->face(f)->boundary_indicator(); - bid = std::max(bid, quad.boundary_id); - for (size_type slice=0; sliceface(f)->vertex_index(0)+slice*input.n_vertices(); - quad.vertices[1] = cell->face(f)->vertex_index(1)+slice*input.n_vertices(); - quad.vertices[2] = cell->face(f)->vertex_index(0)+(slice+1)*input.n_vertices(); - quad.vertices[3] = cell->face(f)->vertex_index(1)+(slice+1)*input.n_vertices(); - s.boundary_quads.push_back(quad); - } - } - } + Vector f(n_dofs); - for (Triangulation<2,2>::cell_iterator - cell = input.begin(); cell != input.end(); ++cell) - { - CellData<2> quad; - quad.boundary_id = bid + 1; - quad.vertices[0] = cell->vertex_index(0); - quad.vertices[1] = cell->vertex_index(1); - quad.vertices[2] = cell->vertex_index(2); - quad.vertices[3] = cell->vertex_index(3); - s.boundary_quads.push_back(quad); - - quad.boundary_id = bid + 2; - for (int i=0; i<4; ++i) - quad.vertices[i] += (n_slices-1)*input.n_vertices(); - s.boundary_quads.push_back(quad); - } + SF.add_constraints(m); + SF.apply_constraints (f, true); + solver.solve(SF, u, f, PF); + } +// Implementation for 1D only + template <> + void laplace_transformation (Triangulation<1> &, + const std::map > &) + { + Assert(false, ExcNotImplemented()); + } - result.create_triangulation ( - points, - cells, - s); -} +// Implementation for dimensions except 1 + template + void laplace_transformation (Triangulation &tria, + const std::map > &new_points) + { + // first provide everything that is + // needed for solving a Laplace + // equation. + MappingQ1 mapping_q1; + FE_Q q1(1); + + DoFHandler dof_handler(tria); + dof_handler.distribute_dofs(q1); + + CompressedSparsityPattern c_sparsity_pattern (dof_handler.n_dofs (), + dof_handler.n_dofs ()); + DoFTools::make_sparsity_pattern (dof_handler, c_sparsity_pattern); + c_sparsity_pattern.compress (); + + SparsityPattern sparsity_pattern; + sparsity_pattern.copy_from (c_sparsity_pattern); + sparsity_pattern.compress (); + + SparseMatrix S(sparsity_pattern); + + QGauss quadrature(4); + + MatrixCreator::create_laplace_matrix(mapping_q1, dof_handler, quadrature, S); + + // set up the boundary values for + // the laplace problem + std::vector > m(dim); + typename std::map >::const_iterator map_iter; + typename std::map >::const_iterator map_end=new_points.end(); + + // fill these maps using the data + // given by new_points + typename DoFHandler::cell_iterator cell=dof_handler.begin_active(), + endc=dof_handler.end(); + typename DoFHandler::face_iterator face; + for (; cell!=endc; ++cell) + { + if (cell->at_boundary()) + for (unsigned int face_no=0; face_no::faces_per_cell; ++face_no) + { + face=cell->face(face_no); + if (face->at_boundary()) + for (unsigned int vertex_no=0; + vertex_no::vertices_per_face; ++vertex_no) + { + const unsigned int vertex_index=face->vertex_index(vertex_no); + map_iter=new_points.find(vertex_index); -// make the following function inline. this is so that it becomes marked -// internal/weak for the linker and we don't get multiply defined errors -// when linking with more than one dimension at a time. Usually we used -// the trick of putting these functions in a .all_dimensions.cc file, but -// this is not necessary here as this is an internal only function. -inline -void GridGenerator::laplace_solve (const SparseMatrix &S, - const std::map &m, - Vector &u) -{ - const size_type n_dofs=S.n(); - FilteredMatrix > SF (S); - PreconditionJacobi > prec; - prec.initialize(S, 1.2); - FilteredMatrix > PF (prec); + if (map_iter!=map_end) + for (unsigned int i=0; i ( + face->vertex_dof_index(vertex_no, 0), map_iter->second(i))); + } + } + } - SolverControl control (n_dofs, 1.e-10, false, false); - GrowingVectorMemory > mem; - SolverCG > solver (control, mem); + // solve the dim problems with + // different right hand sides. + Vector us[dim]; + for (unsigned int i=0; i tasks; + for (unsigned int i=0; i::vertices_per_cell; ++vertex_no) + { + Point &v=cell->vertex(vertex_no); + const unsigned int dof_index=cell->vertex_dof_index(vertex_no, 0); + for (unsigned int i=0; i f(n_dofs); - SF.add_constraints(m); - SF.apply_constraints (f, true); - solver.solve(SF, u, f, PF); -} + template <> + void hyper_cube_with_cylindrical_hole (Triangulation<1> &, + const double, + const double, + const double, + const unsigned int, + bool) + { + Assert(false, ExcNotImplemented()); + } -// Implementation for 1D only -template <> -void GridGenerator::laplace_transformation (Triangulation<1> &, - const std::map > &) -{ - Assert(false, ExcNotImplemented()); -} -// Implementation for dimensions except 1 -template -void GridGenerator::laplace_transformation (Triangulation &tria, - const std::map > &new_points) -{ - // first provide everything that is - // needed for solving a Laplace - // equation. - MappingQ1 mapping_q1; - FE_Q q1(1); - - DoFHandler dof_handler(tria); - dof_handler.distribute_dofs(q1); - - CompressedSparsityPattern c_sparsity_pattern (dof_handler.n_dofs (), - dof_handler.n_dofs ()); - DoFTools::make_sparsity_pattern (dof_handler, c_sparsity_pattern); - c_sparsity_pattern.compress (); - - SparsityPattern sparsity_pattern; - sparsity_pattern.copy_from (c_sparsity_pattern); - sparsity_pattern.compress (); - - SparseMatrix S(sparsity_pattern); - - QGauss quadrature(4); - - MatrixCreator::create_laplace_matrix(mapping_q1, dof_handler, quadrature, S); - - // set up the boundary values for - // the laplace problem - std::vector > m(dim); - typename std::map >::const_iterator map_iter; - typename std::map >::const_iterator map_end=new_points.end(); - - // fill these maps using the data - // given by new_points - typename DoFHandler::cell_iterator cell=dof_handler.begin_active(), - endc=dof_handler.end(); - typename DoFHandler::face_iterator face; - for (; cell!=endc; ++cell) - { - if (cell->at_boundary()) - for (unsigned int face_no=0; face_no::faces_per_cell; ++face_no) - { - face=cell->face(face_no); - if (face->at_boundary()) - for (unsigned int vertex_no=0; - vertex_no::vertices_per_face; ++vertex_no) + template <> + void + hyper_cube_with_cylindrical_hole (Triangulation<2> &triangulation, + const double inner_radius, + const double outer_radius, + const double, // width, + const unsigned int, // width_repetition, + bool colorize) + { + const int dim = 2; + + Assert(inner_radius < outer_radius, + ExcMessage("outer_radius has to be bigger than inner_radius.")); + + Point center; + // We create an hyper_shell in two dimensions, and then we modify it. + hyper_shell (triangulation, + center, inner_radius, outer_radius, + 8); + Triangulation::active_cell_iterator + cell = triangulation.begin_active(), + endc = triangulation.end(); + std::vector treated_vertices(triangulation.n_vertices(), false); + for (; cell != endc; ++cell) + { + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->at_boundary()) + { + for (unsigned int v=0; v < GeometryInfo::vertices_per_face; ++v) { - const size_type vertex_index=face->vertex_index(vertex_no); - map_iter=new_points.find(vertex_index); - - if (map_iter!=map_end) - for (unsigned int i=0; i ( - face->vertex_dof_index(vertex_no, 0), map_iter->second(i))); + unsigned int vv = cell->face(f)->vertex_index(v); + if (treated_vertices[vv] == false) + { + treated_vertices[vv] = true; + switch (vv) + { + case 1: + cell->face(f)->vertex(v) = center+Point(outer_radius,outer_radius); + break; + case 3: + cell->face(f)->vertex(v) = center+Point(-outer_radius,outer_radius); + break; + case 5: + cell->face(f)->vertex(v) = center+Point(-outer_radius,-outer_radius); + break; + case 7: + cell->face(f)->vertex(v) = center+Point(outer_radius,-outer_radius); + default: + break; + } + } } - } - } - - // solve the dim problems with - // different right hand sides. - Vector us[dim]; - for (unsigned int i=0; i tasks; - for (unsigned int i=0; i::vertices_per_cell; ++vertex_no) - { - Point &v=cell->vertex(vertex_no); - const size_type dof_index=cell->vertex_dof_index(vertex_no, 0); - for (unsigned int i=0; i -void GridGenerator::hyper_cube_with_cylindrical_hole (Triangulation<1> &, - const double, - const double, - const double, - const size_type, - bool) -{ - Assert(false, ExcNotImplemented()); -} - + double eps = 1e-3 * outer_radius; + cell = triangulation.begin_active(); + for (; cell != endc; ++cell) + { + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->at_boundary()) + { + double dx = cell->face(f)->center()(0) - center(0); + double dy = cell->face(f)->center()(1) - center(1); + if (colorize) + { + if (std::abs(dx + outer_radius) < eps) + cell->face(f)->set_boundary_indicator(0); + else if (std::abs(dx - outer_radius) < eps) + cell->face(f)->set_boundary_indicator(1); + else if (std::abs(dy + outer_radius) < eps) + cell->face(f)->set_boundary_indicator(2); + else if (std::abs(dy - outer_radius) < eps) + cell->face(f)->set_boundary_indicator(3); + else + cell->face(f)->set_boundary_indicator(4); + } + else + { + double d = (cell->face(f)->center() - center).norm(); + if (d-inner_radius < 0) + cell->face(f)->set_boundary_indicator(1); + else + cell->face(f)->set_boundary_indicator(0); + } + } + } + } -template <> -void -GridGenerator::hyper_cube_with_cylindrical_hole (Triangulation<2> &triangulation, - const double inner_radius, - const double outer_radius, - const double, // width, - const size_type, // width_repetition, - bool colorize) -{ - const int dim = 2; - - Assert(inner_radius < outer_radius, - ExcMessage("outer_radius has to be bigger than inner_radius.")); - - Point center; - // We create an hyper_shell in two dimensions, and then we modify it. - GridGenerator::hyper_shell (triangulation, - center, inner_radius, outer_radius, - 8); - Triangulation::active_cell_iterator - cell = triangulation.begin_active(), - endc = triangulation.end(); - std::vector treated_vertices(triangulation.n_vertices(), false); - for (; cell != endc; ++cell) - { - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->face(f)->at_boundary()) - { - for (unsigned int v=0; v < GeometryInfo::vertices_per_face; ++v) - { - size_type vv = cell->face(f)->vertex_index(v); - if (treated_vertices[vv] == false) - { - treated_vertices[vv] = true; - switch (vv) - { - case 1: - cell->face(f)->vertex(v) = center+Point(outer_radius,outer_radius); - break; - case 3: - cell->face(f)->vertex(v) = center+Point(-outer_radius,outer_radius); - break; - case 5: - cell->face(f)->vertex(v) = center+Point(-outer_radius,-outer_radius); - break; - case 7: - cell->face(f)->vertex(v) = center+Point(outer_radius,-outer_radius); - default: - break; - } - } - } - } - } - double eps = 1e-3 * outer_radius; - cell = triangulation.begin_active(); - for (; cell != endc; ++cell) - { - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->face(f)->at_boundary()) - { - double dx = cell->face(f)->center()(0) - center(0); - double dy = cell->face(f)->center()(1) - center(1); - if (colorize) - { - if (std::abs(dx + outer_radius) < eps) - cell->face(f)->set_boundary_indicator(0); - else if (std::abs(dx - outer_radius) < eps) - cell->face(f)->set_boundary_indicator(1); - else if (std::abs(dy + outer_radius) < eps) - cell->face(f)->set_boundary_indicator(2); - else if (std::abs(dy - outer_radius) < eps) - cell->face(f)->set_boundary_indicator(3); - else - cell->face(f)->set_boundary_indicator(4); - } - else - { - double d = (cell->face(f)->center() - center).norm(); - if (d-inner_radius < 0) - cell->face(f)->set_boundary_indicator(1); - else - cell->face(f)->set_boundary_indicator(0); - } - } - } -} -template <> -void GridGenerator::hyper_cube_with_cylindrical_hole(Triangulation<3> &triangulation, - const double inner_radius, - const double outer_radius, - const double L, - const size_type Nz, - bool colorize) -{ - const int dim = 3; - - Assert(inner_radius < outer_radius, - ExcMessage("outer_radius has to be bigger than inner_radius.")); - Assert(L > 0, - ExcMessage("Must give positive extension L")); - Assert(Nz >= 1, ExcLowerRange(1, Nz)); - - GridGenerator::cylinder_shell (triangulation, - L, inner_radius, outer_radius, - 8, - Nz); - - Triangulation::active_cell_iterator - cell = triangulation.begin_active(), - endc = triangulation.end(); - std::vector treated_vertices(triangulation.n_vertices(), false); - for (; cell != endc; ++cell) - { - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->face(f)->at_boundary()) - { - for (unsigned int v=0; v < GeometryInfo::vertices_per_face; ++v) - { - size_type vv = cell->face(f)->vertex_index(v); - if (treated_vertices[vv] == false) - { - treated_vertices[vv] = true; - for (size_type i=0; i<=Nz; ++i) - { - double d = ((double) i)*L/((double) Nz); - switch (vv-i*16) - { - case 1: - cell->face(f)->vertex(v) = Point(outer_radius,outer_radius,d); - break; - case 3: - cell->face(f)->vertex(v) = Point(-outer_radius,outer_radius,d); - break; - case 5: - cell->face(f)->vertex(v) = Point(-outer_radius,-outer_radius,d); - break; - case 7: - cell->face(f)->vertex(v) = Point(outer_radius,-outer_radius,d); - break; - default: - break; - } - } - } - } - } - } - double eps = 1e-3 * outer_radius; - cell = triangulation.begin_active(); - for (; cell != endc; ++cell) - { - for (unsigned int f=0; f::faces_per_cell; ++f) - if (cell->face(f)->at_boundary()) - { - double dx = cell->face(f)->center()(0); - double dy = cell->face(f)->center()(1); - double dz = cell->face(f)->center()(2); + template <> + void hyper_cube_with_cylindrical_hole(Triangulation<3> &triangulation, + const double inner_radius, + const double outer_radius, + const double L, + const unsigned int Nz, + bool colorize) + { + const int dim = 3; + + Assert(inner_radius < outer_radius, + ExcMessage("outer_radius has to be bigger than inner_radius.")); + Assert(L > 0, + ExcMessage("Must give positive extension L")); + Assert(Nz >= 1, ExcLowerRange(1, Nz)); + + cylinder_shell (triangulation, + L, inner_radius, outer_radius, + 8, + Nz); + + Triangulation::active_cell_iterator + cell = triangulation.begin_active(), + endc = triangulation.end(); + std::vector treated_vertices(triangulation.n_vertices(), false); + for (; cell != endc; ++cell) + { + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->at_boundary()) + { + for (unsigned int v=0; v < GeometryInfo::vertices_per_face; ++v) + { + unsigned int vv = cell->face(f)->vertex_index(v); + if (treated_vertices[vv] == false) + { + treated_vertices[vv] = true; + for (unsigned int i=0; i<=Nz; ++i) + { + double d = ((double) i)*L/((double) Nz); + switch (vv-i*16) + { + case 1: + cell->face(f)->vertex(v) = Point(outer_radius,outer_radius,d); + break; + case 3: + cell->face(f)->vertex(v) = Point(-outer_radius,outer_radius,d); + break; + case 5: + cell->face(f)->vertex(v) = Point(-outer_radius,-outer_radius,d); + break; + case 7: + cell->face(f)->vertex(v) = Point(outer_radius,-outer_radius,d); + break; + default: + break; + } + } + } + } + } + } + double eps = 1e-3 * outer_radius; + cell = triangulation.begin_active(); + for (; cell != endc; ++cell) + { + for (unsigned int f=0; f::faces_per_cell; ++f) + if (cell->face(f)->at_boundary()) + { + double dx = cell->face(f)->center()(0); + double dy = cell->face(f)->center()(1); + double dz = cell->face(f)->center()(2); - if (colorize) - { - if (std::abs(dx + outer_radius) < eps) - cell->face(f)->set_boundary_indicator(0); + if (colorize) + { + if (std::abs(dx + outer_radius) < eps) + cell->face(f)->set_boundary_indicator(0); - else if (std::abs(dx - outer_radius) < eps) - cell->face(f)->set_boundary_indicator(1); + else if (std::abs(dx - outer_radius) < eps) + cell->face(f)->set_boundary_indicator(1); - else if (std::abs(dy + outer_radius) < eps) - cell->face(f)->set_boundary_indicator(2); + else if (std::abs(dy + outer_radius) < eps) + cell->face(f)->set_boundary_indicator(2); - else if (std::abs(dy - outer_radius) < eps) - cell->face(f)->set_boundary_indicator(3); + else if (std::abs(dy - outer_radius) < eps) + cell->face(f)->set_boundary_indicator(3); - else if (std::abs(dz) < eps) - cell->face(f)->set_boundary_indicator(4); + else if (std::abs(dz) < eps) + cell->face(f)->set_boundary_indicator(4); - else if (std::abs(dz - L) < eps) - cell->face(f)->set_boundary_indicator(5); + else if (std::abs(dz - L) < eps) + cell->face(f)->set_boundary_indicator(5); - else - { - cell->face(f)->set_boundary_indicator(6); - for (unsigned int l=0; l::lines_per_face; ++l) - cell->face(f)->line(l)->set_boundary_indicator(6); - } + else + { + cell->face(f)->set_boundary_indicator(6); + for (unsigned int l=0; l::lines_per_face; ++l) + cell->face(f)->line(l)->set_boundary_indicator(6); + } - } - else - { - Point c = cell->face(f)->center(); - c(2) = 0; - double d = c.norm(); - if (d-inner_radius < 0) - { - cell->face(f)->set_boundary_indicator(1); - for (unsigned int l=0; l::lines_per_face; ++l) - cell->face(f)->line(l)->set_boundary_indicator(1); - } - else - cell->face(f)->set_boundary_indicator(0); - } - } - } + } + else + { + Point c = cell->face(f)->center(); + c(2) = 0; + double d = c.norm(); + if (d-inner_radius < 0) + { + cell->face(f)->set_boundary_indicator(1); + for (unsigned int l=0; l::lines_per_face; ++l) + cell->face(f)->line(l)->set_boundary_indicator(1); + } + else + cell->face(f)->set_boundary_indicator(0); + } + } + } + } } - // explicit instantiations #include "grid_generator.inst" diff --git a/deal.II/source/grid/grid_generator.inst.in b/deal.II/source/grid/grid_generator.inst.in index a579b33217..5ce5fcc0f4 100644 --- a/deal.II/source/grid/grid_generator.inst.in +++ b/deal.II/source/grid/grid_generator.inst.in @@ -1,54 +1,57 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { +namespace GridGenerator +\{ #if deal_II_dimension <= deal_II_space_dimension template void - GridGenerator::hyper_rectangle ( + hyper_rectangle ( Triangulation &, const Point&, const Point&, const bool); template void - GridGenerator::colorize_hyper_rectangle ( - Triangulation &); - - template void - GridGenerator::hyper_cube ( + hyper_cube ( Triangulation &, const double, const double); template void - GridGenerator::merge_triangulations + merge_triangulations (const Triangulation &triangulation_1, const Triangulation &triangulation_2, Triangulation &result); #endif +\} } for (deal_II_dimension : DIMENSIONS) { - +namespace GridGenerator \{ template void - GridGenerator::subdivided_hyper_cube ( + subdivided_hyper_cube ( Triangulation &, const unsigned int, const double, const double); template void - GridGenerator::subdivided_hyper_rectangle + subdivided_hyper_rectangle (Triangulation &, const std::vector&, const Point&, @@ -57,7 +60,7 @@ for (deal_II_dimension : DIMENSIONS) template void - GridGenerator::subdivided_hyper_rectangle( + subdivided_hyper_rectangle( Triangulation &, const std::vector > &, const Point &, @@ -65,32 +68,31 @@ for (deal_II_dimension : DIMENSIONS) const bool ); template void - GridGenerator::parallelepiped ( + parallelepiped ( Triangulation&, const Point (&) [deal_II_dimension], const bool); template void - GridGenerator::subdivided_parallelepiped ( + subdivided_parallelepiped ( Triangulation&, - const size_type, + const unsigned int, const Point (&) [deal_II_dimension], const bool); template void - GridGenerator::subdivided_parallelepiped ( + subdivided_parallelepiped ( Triangulation&, - const size_type [deal_II_dimension], + const unsigned int [deal_II_dimension], const Point (&) [deal_II_dimension], const bool); #if deal_II_dimension > 1 template void - GridGenerator:: laplace_transformation (Triangulation &, - const std::map > &); + const std::map > &); #endif - +\} } diff --git a/deal.II/source/grid/grid_in.cc b/deal.II/source/grid/grid_in.cc index e49aea76f8..158de1331a 100644 --- a/deal.II/source/grid/grid_in.cc +++ b/deal.II/source/grid/grid_in.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/grid/grid_in.inst.in b/deal.II/source/grid/grid_in.inst.in index 613147debb..ff205bac0c 100644 --- a/deal.II/source/grid/grid_in.inst.in +++ b/deal.II/source/grid/grid_in.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/grid/grid_out.cc b/deal.II/source/grid/grid_out.cc index 57169eaae2..5a204ef522 100644 --- a/deal.II/source/grid/grid_out.cc +++ b/deal.II/source/grid/grid_out.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -486,7 +488,7 @@ GridOut::default_suffix (const OutputFormat output_format) default: Assert (false, ExcNotImplemented()); return ""; - }; + } } @@ -575,7 +577,7 @@ GridOut::declare_parameters(ParameterHandler ¶m) GridOutFlags::XFig::declare_parameters(param); param.leave_subsection(); - param.enter_subsection("MathGl"); + param.enter_subsection("MathGL"); GridOutFlags::MathGL::declare_parameters(param); param.leave_subsection(); } @@ -684,9 +686,7 @@ void GridOut::write_dx (const Triangulation &tria, for (unsigned int i=0; i &tria, for (unsigned int d=spacedim+1; d<=3; ++d) out << " 0"; // fill with zeroes out << std::endl; - }; + } // Write cells preamble out << "$ENDNOD" << std::endl @@ -1006,7 +1006,7 @@ void GridOut::write_msh (const Triangulation &tria, ++vertex) out << cell->vertex_index(GeometryInfo::ucd_to_deal[vertex])+1 << ' '; out << std::endl; - }; + } // write faces and lines with // non-zero boundary indicator @@ -1063,7 +1063,7 @@ void GridOut::write_ucd (const Triangulation &tria, << "# For a description of the UCD format see the AVS Developer's guide." << '\n' << "#" << '\n'; - }; + } // start with ucd data out << n_vertices << ' ' @@ -1086,7 +1086,7 @@ void GridOut::write_ucd (const Triangulation &tria, for (unsigned int d=spacedim+1; d<=3; ++d) out << " 0"; // fill with zeroes out << '\n'; - }; + } // write cells. Enumerate cells // consecutively, starting with 1 @@ -1110,7 +1110,7 @@ void GridOut::write_ucd (const Triangulation &tria, break; default: Assert (false, ExcNotImplemented()); - }; + } // it follows a list of the // vertices of each cell. in 1d @@ -1131,7 +1131,7 @@ void GridOut::write_ucd (const Triangulation &tria, ++vertex) out << cell->vertex_index(GeometryInfo::ucd_to_deal[vertex])+1 << ' '; out << '\n'; - }; + } // write faces and lines with // non-zero boundary indicator @@ -1363,7 +1363,7 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const unsigned int n_levels = 0; unsigned int n_subdomains = 0; unsigned int n_level_subdomains = 0; - + unsigned int n = 0; unsigned int min_level, max_level; @@ -1437,7 +1437,7 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const // auxiliary array for the level subdomains being used int level_subdomains[256]; - for(int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) + for (int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) level_subdomains[level_subdomain_index] = 0; // We use an active cell iterator to determine the @@ -1458,10 +1458,10 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const if ((unsigned int)cell->level() < min_level) min_level = cell->level(); if ((unsigned int)cell->level() > max_level) max_level = cell->level(); - materials[(unsigned int)cell->material_id()] = 1; + materials[(unsigned int)cell->material_id()] = 1; levels[(unsigned int)cell->level()] = 1; if (cell->active()) - subdomains[cell->subdomain_id()+2] = 1; + subdomains[cell->subdomain_id()+2] = 1; level_subdomains[cell->level_subdomain_id()+2] = 1; } @@ -1487,14 +1487,14 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const } // count the level subdomains being used - for(int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) - { - if(level_subdomains[level_subdomain_index]) n_level_subdomains++; - } + for (int level_subdomain_index = 0; level_subdomain_index < 256; level_subdomain_index++) + { + if (level_subdomains[level_subdomain_index]) n_level_subdomains++; + } switch (svg_flags.coloring) { - case GridOutFlags::Svg::material_id: + case GridOutFlags::Svg::material_id: n = n_materials; break; case GridOutFlags::Svg::level_number: @@ -1503,7 +1503,8 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case GridOutFlags::Svg::subdomain_id: n = n_subdomains; break; - case GridOutFlags::Svg::level_subdomain_id: n = n_level_subdomains; + case GridOutFlags::Svg::level_subdomain_id: + n = n_level_subdomains; break; default: break; @@ -1657,7 +1658,7 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const x_dimension_perspective = x_max_perspective - x_min_perspective; y_dimension_perspective = y_max_perspective - y_min_perspective; - cell_label_font_size = static_cast(.5 + (height/100.) * 2.75) * 9. * (min_level_min_vertex_distance / std::min(x_dimension, y_dimension)); + cell_label_font_size = static_cast((int)(.5 + (height/100.) * 2.75) * 9. * (min_level_min_vertex_distance / std::min(x_dimension, y_dimension))); // create the svg file with an internal style sheet @@ -1768,9 +1769,9 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case GridOutFlags::Svg::subdomain_id: while (!subdomains[labeling_index]) labeling_index++; break; - case GridOutFlags::Svg::level_subdomain_id: - while(!level_subdomains[labeling_index]) labeling_index++; - break; + case GridOutFlags::Svg::level_subdomain_id: + while (!level_subdomains[labeling_index]) labeling_index++; + break; default: break; } @@ -1847,11 +1848,14 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const out << (unsigned int)cell->level(); break; case GridOutFlags::Svg::subdomain_id: - out << cell->subdomain_id() + 2; + if (cell->active()) + out << cell->subdomain_id() + 2; + else + out << 'X'; + break; + case GridOutFlags::Svg::level_subdomain_id: + out << cell->level_subdomain_id() + 2; break; - case GridOutFlags::Svg::level_subdomain_id: - out << cell->level_subdomain_id() + 2; - break; default: break; } @@ -1959,19 +1963,25 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const if (svg_flags.label_subdomain_id) { - if (svg_flags.label_level_number || svg_flags.label_cell_index || svg_flags.label_material_id) out << ','; - out << static_cast(cell->subdomain_id()); + if (svg_flags.label_level_number + || svg_flags.label_cell_index + || svg_flags.label_material_id) + out << ','; + if (cell->active()) + out << static_cast(cell->subdomain_id()); + else + out << 'X'; } - if(svg_flags.label_level_subdomain_id) - { - if(svg_flags.label_level_number - || svg_flags.label_cell_index - || svg_flags.label_material_id - || svg_flags.label_subdomain_id) - out << ','; - out << static_cast(cell->level_subdomain_id()); - } + if (svg_flags.label_level_subdomain_id) + { + if (svg_flags.label_level_number + || svg_flags.label_cell_index + || svg_flags.label_material_id + || svg_flags.label_subdomain_id) + out << ','; + out << static_cast(cell->level_subdomain_id()); + } out << "" << '\n'; } @@ -2092,21 +2102,21 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const << "\">" << "subdomain_id"; - if(svg_flags.label_level_subdomain_id) - out << ','; + if (svg_flags.label_level_subdomain_id) + out << ','; out << "" << '\n'; } - if(svg_flags.label_level_subdomain_id) - { - out << " (.5 + (height/100.) * 2.) - << "\" y=\"" << static_cast(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size ) - << "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size - << "\">" - << "level_subdomain_id" - << "" << '\n'; - } + if (svg_flags.label_level_subdomain_id) + { + out << " (.5 + (height/100.) * 2.) + << "\" y=\"" << static_cast(.5 + (height/100.) * margin_in_percent + (++line_offset) * 1.5 * font_size ) + << "\" style=\"text-anchor:start; font-style:oblique; font-size:" << font_size + << "\">" + << "level_subdomain_id" + << "" << '\n'; + } } // show azimuth angle and polar angle as text below the explanation of the cell labeling @@ -2139,8 +2149,9 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case 3: out << "subdomain_id"; break; - case 4: out << "level_subdomain_id"; - break; + case 4: + out << "level_subdomain_id"; + break; default: break; } @@ -2165,8 +2176,9 @@ void GridOut::write_svg(const Triangulation<2,2> &tria, std::ostream &out) const case GridOutFlags::Svg::subdomain_id: while (!subdomains[labeling_index]) labeling_index++; break; - case GridOutFlags::Svg::level_subdomain_id: while(!level_subdomains[labeling_index]) labeling_index++; - break; + case GridOutFlags::Svg::level_subdomain_id: + while (!level_subdomains[labeling_index]) labeling_index++; + break; default: break; } @@ -2270,7 +2282,7 @@ void GridOut::write_mathgl (const Triangulation &tria, break; default: Assert (false, ExcNotImplemented ()); - }; + } out << "\n"; // (iii) write vertex ordering @@ -2286,15 +2298,15 @@ void GridOut::write_mathgl (const Triangulation &tria, { case 2: out << "\nlist f 0 1 2 3" - << "\n"; + << "\n"; break; case 3: out << "\nlist f 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7 | 0 1 2 3 | 4 5 6 7" - << "\n"; + << "\n"; break; default: Assert (false, ExcNotImplemented ()); - }; + } // (iv) write a list of vertices of cells out << "\n#" @@ -2539,7 +2551,7 @@ void GridOut::write_msh_faces (const Triangulation &tria, break; default: Assert (false, ExcNotImplemented()); - }; + } out << static_cast(face->boundary_indicator()) << ' ' << static_cast(face->boundary_indicator()) @@ -2551,7 +2563,7 @@ void GridOut::write_msh_faces (const Triangulation &tria, out << '\n'; ++index; - }; + } } @@ -2695,14 +2707,14 @@ void GridOut::write_ucd_faces (const Triangulation &tria, break; default: Assert (false, ExcNotImplemented()); - }; + } // note: vertex numbers are 1-base for (unsigned int vertex=0; vertex::vertices_per_face; ++vertex) out << face->vertex_index(GeometryInfo::ucd_to_deal[vertex])+1 << ' '; out << '\n'; ++index; - }; + } } @@ -3258,7 +3270,7 @@ namespace internal { Assert(false, ExcInternalError()); break; - }; + } case 2: { @@ -3376,12 +3388,12 @@ namespace internal line_list.push_back (LineEntry(p0, p1, face->user_flag_set(), cell->level())); - }; - }; - }; + } + } + } break; - }; + } case 3: { @@ -3484,7 +3496,7 @@ namespace internal y_max = std::max (y_max, line->second(1)); max_level = std::max (max_level, line->level); - }; + } // scale in x-direction such that // in the output 0 <= x <= 300. @@ -3571,14 +3583,14 @@ namespace internal "/MCshow { currentpoint stroke m\n" "exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n") << '\n'; - }; + } out << "%%EndProlog" << '\n' << '\n'; // set fine lines out << eps_flags_base.line_width << " setlinewidth" << '\n'; - }; + } // now write the lines const Point<2> offset(x_min, y_min); @@ -3623,8 +3635,8 @@ namespace internal out << ")] " << "] -6 MCshow" << '\n'; - }; - }; + } + } // and the vertex numbers if ((dim == 2) && (eps_flags_2.write_vertex_numbers == true)) @@ -3658,8 +3670,8 @@ namespace internal << ")] " << "] -6 MCshow" << '\n'; - }; - }; + } + } out << "showpage" << '\n'; diff --git a/deal.II/source/grid/grid_out.inst.in b/deal.II/source/grid/grid_out.inst.in index 1a470c9a47..1da4845a0b 100644 --- a/deal.II/source/grid/grid_out.inst.in +++ b/deal.II/source/grid/grid_out.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/grid/grid_refinement.cc b/deal.II/source/grid/grid_refinement.cc index e0a3acdaeb..1de5c7b1ac 100644 --- a/deal.II/source/grid/grid_refinement.cc +++ b/deal.II/source/grid/grid_refinement.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/grid/grid_refinement.inst.in b/deal.II/source/grid/grid_refinement.inst.in index 366c0f8324..9116a20fb3 100644 --- a/deal.II/source/grid/grid_refinement.inst.in +++ b/deal.II/source/grid/grid_refinement.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + diff --git a/deal.II/source/grid/grid_reordering.cc b/deal.II/source/grid/grid_reordering.cc index dd8aeee74d..b5d385272a 100644 --- a/deal.II/source/grid/grid_reordering.cc +++ b/deal.II/source/grid/grid_reordering.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// grid_reordering.cc,v 1.27 2002/05/28 07:43:22 wolf Exp -// Version: +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/grid/grid_tools.cc b/deal.II/source/grid/grid_tools.cc index 5d96127509..4f6981479d 100644 --- a/deal.II/source/grid/grid_tools.cc +++ b/deal.II/source/grid/grid_tools.cc @@ -1,20 +1,23 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include #include +#include #include #include #include @@ -605,7 +608,7 @@ namespace GridTools template void - laplace_transform (const std::map > &new_points, + laplace_transform (const std::map > &new_points, Triangulation &triangulation) { //TODO: Move implementation of this function into the current @@ -962,7 +965,7 @@ next_cell: } } - Assert (best_cell.first.state() == IteratorState::valid, + AssertThrow (best_cell.first.state() == IteratorState::valid, ExcPointNotFound(p)); return best_cell; @@ -1085,7 +1088,7 @@ next_cell: } } - Assert (best_cell.first.state() == IteratorState::valid, + AssertThrow (best_cell.first.state() == IteratorState::valid, ExcPointNotFound(p)); return best_cell; @@ -2214,7 +2217,6 @@ next_cell: } - /* * Internally used in orthogonal_equality * @@ -2223,7 +2225,7 @@ next_cell: * * See the comment on the next function as well as the detailed * documentation of make_periodicity_constraints and - * collect_periodic_face_pairs for details + * collect_periodic_faces for details */ template struct OrientationLookupTable {}; @@ -2352,14 +2354,82 @@ next_cell: /* - * Internally used in collect_periodic_face_pairs + * Internally used in collect_periodic_faces + */ + template + std::vector > + match_periodic_face_pairs + (std::set > + &pairs1, + std::set::type, unsigned int> > + &pairs2, + int direction, + const dealii::Tensor<1,CellIterator::AccessorType::space_dimension> + &offset) + { + static const int space_dim = CellIterator::AccessorType::space_dimension; + Assert (0<=direction && direction > matched_faces; + + // Match with a complexity of O(n^2). This could be improved... + std::bitset<3> orientation; + typedef typename std::set + >::const_iterator PairIterator; + for (PairIterator it1 = pairs1.begin(); it1 != pairs1.end(); ++it1) + { + for (PairIterator it2 = pairs2.begin(); it2 != pairs2.end(); ++it2) + { + const CellIterator cell1 = it1->first; + const CellIterator cell2 = it2->first; + const unsigned int face_idx1 = it1->second; + const unsigned int face_idx2 = it2->second; + if (GridTools::orthogonal_equality(orientation, + cell1->face(face_idx1), + cell2->face(face_idx2), + direction, offset)) + { + // We have a match, so insert the matching pairs and + // remove the matched cell in pairs2 to speed up the + // matching: + const PeriodicFacePair matched_face + = {{cell1, cell2},{face_idx1, face_idx2}, orientation}; + matched_faces.push_back(matched_face); + pairs2.erase(it2); + break; + } + } + } + + AssertThrow (matched_faces.size() == pairs1.size() && pairs2.size() == 0, + ExcMessage ("Unmatched faces on periodic boundaries")); + + return matched_faces; + } + + /* Deprecated version of the function above with different return value. + * It is used the deprecated collect_periodic_face_pairs. */ template std::map > > - match_periodic_face_pairs (std::set &faces1, /* not const! */ - std::set::type> &faces2, /* not const! */ - int direction, - const dealii::Tensor<1,FaceIterator::AccessorType::space_dimension> &offset) + match_periodic_face_pairs + (std::set &faces1, /* not const! */ + std::set::type> &faces2, /* not const! */ + int direction, + const dealii::Tensor<1,FaceIterator::AccessorType::space_dimension> &offset) + DEAL_II_DEPRECATED; + + template + std::map > > + match_periodic_face_pairs + (std::set &faces1, /* not const! */ + std::set::type> &faces2, /* not const! */ + int direction, + const dealii::Tensor<1,FaceIterator::AccessorType::space_dimension> &offset) { static const int space_dim = FaceIterator::AccessorType::space_dimension; Assert (0<=direction && direction + std::vector > + collect_periodic_faces + (const DH &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const unsigned int direction, + const dealii::Tensor<1,DH::space_dimension> &offset) + { + static const unsigned int dim = DH::dimension; + static const unsigned int space_dim = DH::space_dimension; + Assert (0<=direction && direction > pairs1; + std::set > pairs2; + + for (typename DH::cell_iterator cell = dof_handler.begin(0); + cell != dof_handler.end(0); ++cell) + { + for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) + { + const typename DH::face_iterator face = cell->face(i); + if (face->at_boundary() && face->boundary_indicator() == b_id1) + { + const std::pair pair1 + = std::make_pair(cell, i); + pairs1.insert(pair1); + } + + if (face->at_boundary() && face->boundary_indicator() == b_id2) + { + const std::pair pair2 + = std::make_pair(cell, i); + pairs2.insert(pair2); + } + } + } + + Assert (pairs1.size() == pairs2.size(), + ExcMessage ("Unmatched faces on periodic boundaries")); + + // and call match_periodic_face_pairs that does the actual matching: + return match_periodic_face_pairs(pairs1, pairs2, direction, offset); + } + + template + std::vector > + collect_periodic_faces (const DH &dof_handler, + const types::boundary_id b_id, + const unsigned int direction, + const dealii::Tensor<1,DH::space_dimension> &offset) + { + static const unsigned int dim = DH::dimension; + static const unsigned int space_dim = DH::space_dimension; + Assert (0<=direction && direction > pairs1; + std::set > pairs2; + + for (typename DH::cell_iterator cell = dof_handler.begin(0); + cell != dof_handler.end(0); ++cell) + { + const typename DH::face_iterator face_1 = cell->face(2*direction); + const typename DH::face_iterator face_2 = cell->face(2*direction+1); + + if (face_1->at_boundary() && face_1->boundary_indicator() == b_id) + { + const std::pair pair1 + = std::make_pair(cell, 2*direction); + pairs1.insert(pair1); + } + + if (face_2->at_boundary() && face_2->boundary_indicator() == b_id) + { + const std::pair pair2 + = std::make_pair(cell, 2*direction+1); + pairs2.insert(pair2); + } + } + + Assert (pairs1.size() == pairs2.size(), + ExcMessage ("Unmatched faces on periodic boundaries")); + + // and call match_periodic_face_pairs that does the actual matching: + + typedef std::vector > + FaceVector; + + FaceVector matching = match_periodic_face_pairs(pairs1, pairs2, + direction, offset); + + for (typename FaceVector::iterator pairing = matching.begin(); + pairing != matching.end(); ++pairing) + { + Assert(pairing->orientation == 1, + ExcMessage("Found a face match with non standard orientation. " + "This function is only suitable for meshes with cells " + "in default orientation")); + } + + return matching; + } template std::map > > @@ -2433,8 +2616,6 @@ next_cell: return match_periodic_face_pairs(faces1, faces2, direction, offset); } - - template std::map > > collect_periodic_face_pairs (const DH &dof_handler, @@ -2443,41 +2624,26 @@ next_cell: int direction, const dealii::Tensor<1,DH::space_dimension> &offset) { - static const int dim = DH::dimension; - static const int space_dim = DH::space_dimension; - Assert (0<=direction && direction > FaceVector; - // Loop over all cells on the highest level and collect all boundary - // faces belonging to b_id1 and b_id2: - - std::set faces1; - std::set faces2; + const FaceVector face_vector + = collect_periodic_faces (dof_handler, b_id1, b_id2, direction, offset); - for (typename DH::cell_iterator cell = dof_handler.begin(0); - cell != dof_handler.end(0); ++cell) - { - for (unsigned int i = 0; i < GeometryInfo::faces_per_cell; ++i) - { - const typename DH::face_iterator face = cell->face(i); - - if (face->at_boundary() && face->boundary_indicator() == b_id1) - faces1.insert(face); - - if (face->at_boundary() && face->boundary_indicator() == b_id2) - faces2.insert(face); - } - } - - Assert (faces1.size() == faces2.size(), - ExcMessage ("Unmatched faces on periodic boundaries")); + std::map > > + return_value; + for(typename FaceVector::const_iterator it = face_vector.begin(); + it != face_vector.end(); ++it) + { + const typename DH::face_iterator face1 = it->cell[0]->face(it->face_idx[0]); + const typename DH::face_iterator face2 = it->cell[1]->face(it->face_idx[1]); + return_value[face1] = std::make_pair(face2, it->orientation); + } - // and call match_periodic_face_pairs that does the actual matching: - return match_periodic_face_pairs(faces1, faces2, direction, offset); + return return_value; } - - + template std::map collect_periodic_face_pairs (const DH &dof_handler, @@ -2485,58 +2651,56 @@ next_cell: int direction, const dealii::Tensor<1,DH::space_dimension> &offset) { - static const int dim = DH::dimension; - static const int space_dim = DH::space_dimension; - Assert (0<=direction && direction faces1; - std::set faces2; - - for (typename DH::cell_iterator cell = dof_handler.begin(0); - cell != dof_handler.end(0); ++cell) - { - const typename DH::face_iterator face_1 = cell->face(2*direction); - const typename DH::face_iterator face_2 = cell->face(2*direction+1); - - if (face_1->at_boundary() && face_1->boundary_indicator() == b_id) - faces1.insert(face_1); - - if (face_2->at_boundary() && face_2->boundary_indicator() == b_id) - faces2.insert(face_2); - } - - Assert (faces1.size() == faces2.size(), - ExcMessage ("Unmatched faces on periodic boundaries")); - - // and call match_periodic_face_pairs that does the actual matching: - - typedef std::map > > FaceMap; - FaceMap matching = match_periodic_face_pairs(faces1, faces2, direction, offset); - - std::map - return_value; - - for (typename FaceMap::iterator pairing = matching.begin(); - pairing != matching.end(); ++pairing) - { - Assert(pairing->second.second == 1, - ExcMessage("Found a face match with non standard orientation. " - "This function is only suitable for meshes with cells " - "in default orientation")); - - return_value[pairing->first] = pairing->second.first; - } - + typedef std::vector > FaceVector; + + const FaceVector face_vector + = collect_periodic_faces (dof_handler, b_id, direction, offset); + + std::map return_value; + for(typename FaceVector::const_iterator it = face_vector.begin(); + it != face_vector.end(); ++it) + { + const typename DH::face_iterator face1 = it->cell[0]->face(it->face_idx[0]); + const typename DH::face_iterator face2 = it->cell[1]->face(it->face_idx[1]); + return_value[face1] = face2; + } + return return_value; } + + template + void + identify_periodic_face_pairs + (const DH &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const unsigned int direction, + std::vector > + &periodicity_vector) + { + typedef std::vector > + FaceVector; + const FaceVector periodic_faces + = collect_periodic_faces(dof_handler, b_id1, b_id2, direction, + dealii::Tensor<1,DH::space_dimension> ()); + + typename FaceVector::const_iterator it, end_faces; + it = periodic_faces.begin(); + end_faces = periodic_faces.end(); + + for(; it!=end_faces; ++it) + { + + const std_cxx1x::tuple + periodic_tuple (it->cell[0], it->face_idx[0], + it->cell[1], it->face_idx[1]); + + periodicity_vector.push_back(periodic_tuple); + } + } } /* namespace GridTools */ diff --git a/deal.II/source/grid/grid_tools.inst.in b/deal.II/source/grid/grid_tools.inst.in index 0a1d6e7558..4f16d66392 100644 --- a/deal.II/source/grid/grid_tools.inst.in +++ b/deal.II/source/grid/grid_tools.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) @@ -24,7 +28,7 @@ for (deal_II_dimension : DIMENSIONS) for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS) { - + #if deal_II_dimension <= deal_II_space_dimension namespace GridTools \{ @@ -65,6 +69,23 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II } + +for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS) +{ + +#if deal_II_dimension <= deal_II_space_dimension + namespace GridTools \{ + template + bool + have_same_coarse_mesh (const MGDoFHandler &mesh_1, + const MGDoFHandler &mesh_2); + + \} + + #endif +} + + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension @@ -80,7 +101,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS volume (const Triangulation &, const Mapping &); - + template void delete_unused_vertices (std::vector > &, std::vector > &, @@ -115,7 +136,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS template void partition_triangulation (const unsigned int, Triangulation &); - + template void partition_triangulation (const unsigned int, const SparsityPattern &, @@ -128,9 +149,9 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS (const hp::MappingCollection &, const hp::DoFHandler &, const Point &); - - + + template void get_subdomain_association (const Triangulation &, std::vector &); @@ -139,11 +160,11 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS unsigned int count_cells_with_subdomain_association( const Triangulation &, const types::subdomain_id); - + template double minimal_cell_diameter (const Triangulation &triangulation); - + template double maximal_cell_diameter (const Triangulation &triangulation); @@ -154,10 +175,10 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS const Triangulation &triangulation_1, const Triangulation &triangulation_2, Triangulation &result); -#if deal_II_dimension == deal_II_space_dimension +#if deal_II_dimension == deal_II_space_dimension template void - laplace_transform (const std::map > &new_points, + laplace_transform (const std::map > &new_points, Triangulation &triangulation); template @@ -167,12 +188,12 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS Triangulation &triangulation); #endif - + \} #endif - + } @@ -230,6 +251,23 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II #if deal_II_dimension >= 2 + template + std::vector > + collect_periodic_faces + (const X &, + const types::boundary_id, + const types::boundary_id, + unsigned int, + const Tensor<1,X::space_dimension> &); + + template + std::vector > + collect_periodic_faces + (const X &, + const types::boundary_id, + unsigned int, + const Tensor<1,X::space_dimension> &); + template std::map > > collect_periodic_face_pairs @@ -238,8 +276,7 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const types::boundary_id, const types::boundary_id, int, - const Tensor<1,deal_II_space_dimension> &); - + const Tensor<1,X::space_dimension> &); template std::map > > collect_periodic_face_pairs @@ -248,7 +285,7 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const types::boundary_id, const types::boundary_id, int, - const Tensor<1,deal_II_space_dimension> &); + const Tensor<1,X::active_face_iterator::AccessorType::space_dimension> &); template std::map > > @@ -257,7 +294,7 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const types::boundary_id, const types::boundary_id, int, - const Tensor<1,deal_II_space_dimension> &); + const Tensor<1,X::space_dimension> &); template std::map @@ -266,6 +303,16 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II const types::boundary_id, int, const Tensor<1,deal_II_space_dimension> &); + + template + void + identify_periodic_face_pairs + (const X &, + const types::boundary_id, + const types::boundary_id, + const unsigned int, + std::vector > &); #endif @@ -273,3 +320,25 @@ for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II #endif } +for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS) +{ +#if deal_II_dimension <= deal_II_space_dimension + #if deal_II_dimension >= 2 + namespace GridTools \{ + template + void + identify_periodic_face_pairs + (const parallel::distributed::Triangulation &, + const types::boundary_id, + const types::boundary_id, + const unsigned int, + std::vector::cell_iterator, + unsigned int, + parallel::distributed::Triangulation::cell_iterator, + unsigned int> > &); + \} + #endif +#endif +} + + diff --git a/deal.II/source/grid/intergrid_map.cc b/deal.II/source/grid/intergrid_map.cc index 0ca0578806..47575ab7d3 100644 --- a/deal.II/source/grid/intergrid_map.cc +++ b/deal.II/source/grid/intergrid_map.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/grid/intergrid_map.inst.in b/deal.II/source/grid/intergrid_map.inst.in index cd766fd4f4..392ba342dd 100644 --- a/deal.II/source/grid/intergrid_map.inst.in +++ b/deal.II/source/grid/intergrid_map.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2010 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (X : TRIANGULATION_AND_DOFHANDLERS; deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/grid/persistent_tria.cc b/deal.II/source/grid/persistent_tria.cc index 7e6a7d5e1d..376b422240 100644 --- a/deal.II/source/grid/persistent_tria.cc +++ b/deal.II/source/grid/persistent_tria.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/grid/tria.cc b/deal.II/source/grid/tria.cc index f9a3901d7a..9dc8aa8edf 100644 --- a/deal.II/source/grid/tria.cc +++ b/deal.II/source/grid/tria.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -2049,7 +2053,7 @@ namespace internal // first, we only collect the data // now - // the bool array stores, wether the lines + // the bool array stores, whether the lines // are in the standard orientation or not // note that QuadComparator is a @@ -2565,7 +2569,7 @@ namespace internal else { - // look wether it exists in + // look whether it exists in // reverse direction std::swap (line_vertices.first, line_vertices.second); if (needed_lines.find(line_vertices) != needed_lines.end()) @@ -2623,7 +2627,7 @@ namespace internal if (needed_lines.find(line_vertices) != needed_lines.end()) line[i] = needed_lines[line_vertices]; else - // look wether it exists + // look whether it exists // in reverse direction { std::swap (line_vertices.first, line_vertices.second); @@ -9329,7 +9333,7 @@ namespace internal /** * Helper function for - * @p fix_coarsen_flags. Return wether + * @p fix_coarsen_flags. Return whether * coarsening of this cell is allowed. * Coarsening can be forbidden if the * neighboring cells are or will be @@ -9386,7 +9390,7 @@ namespace internal // to the common neighbor cell, // not to its children. what we // really want to know in the - // following is, wether the + // following is, whether the // neighbor cell is refined twice // with reference to our cell. // that only has to be asked, if @@ -9744,7 +9748,7 @@ create_triangulation (const std::vector > &v, Its entries are indexes by the local indeces of the common face. For example if two elements share a face, and this face is face 0 for element 0 and face 1 for element 1, then - table(0,1) will tell wether the orientation are the same (true) or + table(0,1) will tell whether the orientation are the same (true) or opposite (false). Even though there may be a combinatorial/graph theory argument to get @@ -10995,15 +10999,8 @@ template typename Triangulation::cell_iterator Triangulation::last () const { - return last (levels.size()-1); -} - - + const unsigned int level = levels.size()-1; -template -typename Triangulation::cell_iterator -Triangulation::last (const unsigned int level) const -{ Assert (levelcells.cells.size() ==0) return end(level); @@ -11031,42 +11028,21 @@ Triangulation::last_active () const { // get the last used cell cell_iterator cell = last(); - + if (cell != end()) { // then move to the last active one if (cell->active()==true) - return cell; + return cell; while ((--cell).state() == IteratorState::valid) - if (cell->active()==true) - return cell; + if (cell->active()==true) + return cell; } return cell; } -template -typename Triangulation::active_cell_iterator -Triangulation::last_active (const unsigned int level) const -{ - // get the last used cell on this level - cell_iterator cell = last(level); - - if (cell != end(level)) - { - // then move to the last active one - if (cell->active()==true) - return cell; - while ((--cell).state() == IteratorState::valid) - if (cell->active()==true) - return cell; - } - return cell; -} - - - template typename Triangulation::cell_iterator Triangulation::end () const @@ -11105,7 +11081,8 @@ template typename Triangulation::active_cell_iterator Triangulation::end_active (const unsigned int level) const { - return (level == levels.size()-1 ? + Assert (level= levels.size()-1 ? active_cell_iterator(end()) : begin_active (level+1)); } @@ -11190,7 +11167,7 @@ Triangulation::begin_raw_line (const unsigned int level) const { case 1: Assert (level= levels.size() || levels[level]->cells.cells.size() == 0) return end_line(); @@ -11350,10 +11327,10 @@ Triangulation::begin_raw_hex (const unsigned int level) const case 3: { Assert (level= levels.size() || levels[level]->cells.cells.size() == 0) return end_hex(); - + return raw_hex_iterator (const_cast*>(this), level, 0); @@ -12230,11 +12207,12 @@ void Triangulation::execute_coarsening () // deleted (if the latter are on a // higher level for example) // - // if there is only one level, - // there can not be anything to do + // since we delete the *children* of cells, we can ignore cells + // on the highest level, i.e., level must be less than or equal + // to n_levels()-2. if (levels.size() >= 2) - for (cell = last(levels.size()-2); cell!=endc; --cell) - if (cell->user_flag_set()) + for (cell = last(); cell!=endc; --cell) + if (cell->level()<=static_cast(levels.size()-2) && cell->user_flag_set()) // use a separate function, // since this is dimension // specific @@ -13617,7 +13595,7 @@ bool Triangulation::prepare_coarsening_and_refinement () // next global loop. when this // function terminates, the // requirement will be - // fullfilled. However, it might be + // fulfilled. However, it might be // faster to insert an inner loop // here. bool changed = true; diff --git a/deal.II/source/grid/tria.inst.in b/deal.II/source/grid/tria.inst.in index 16a72fdfbe..e16829955d 100644 --- a/deal.II/source/grid/tria.inst.in +++ b/deal.II/source/grid/tria.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) diff --git a/deal.II/source/grid/tria_accessor.cc b/deal.II/source/grid/tria_accessor.cc index 9bd2a453f4..ec3a111957 100644 --- a/deal.II/source/grid/tria_accessor.cc +++ b/deal.II/source/grid/tria_accessor.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/grid/tria_accessor.inst.in b/deal.II/source/grid/tria_accessor.inst.in index 1aed96c4f7..fbf7755c76 100644 --- a/deal.II/source/grid/tria_accessor.inst.in +++ b/deal.II/source/grid/tria_accessor.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/grid/tria_boundary.cc b/deal.II/source/grid/tria_boundary.cc index 247b780afc..65b3bafe7b 100644 --- a/deal.II/source/grid/tria_boundary.cc +++ b/deal.II/source/grid/tria_boundary.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -245,6 +247,33 @@ project_to_surface (const typename Triangulation::hex_iterator &, } + +template +const std::vector > & +Boundary:: +get_line_support_points (const unsigned int n_intermediate_points) const +{ + if (points.size() <= n_intermediate_points || + points[n_intermediate_points].get() == 0) + { + Threads::Mutex::ScopedLock lock(mutex); + if (points.size() <= n_intermediate_points) + points.resize(n_intermediate_points+1); + + // another thread might have created points in the meantime + if (points[n_intermediate_points].get() == 0) + { + std_cxx1x::shared_ptr > + quadrature (new QGaussLobatto<1>(n_intermediate_points+2)); + points[n_intermediate_points] = quadrature; + } + } + return points[n_intermediate_points]->get_points(); +} + + + + /* -------------------------- StraightBoundary --------------------- */ @@ -392,15 +421,18 @@ get_intermediate_points_on_line (const Triangulation<1, 2>::line_iterator &line, const unsigned int n=points.size(); Assert(n>0, ExcInternalError()); - const double dx=1./(n+1); - double x=dx; - + // Use interior points of QGaussLobatto quadrature formula support points + // for consistency with MappingQ + const std::vector > &line_points = this->get_line_support_points(n); const Point vertices[2] = { line->vertex(0), line->vertex(1) }; - for (unsigned int i=0; i::li const unsigned int n=points.size(); Assert(n>0, ExcInternalError()); - const double dx=1./(n+1); - double x=dx; + // Use interior points of QGaussLobatto quadrature formula support points + // for consistency with MappingQ + const std::vector > &line_points = this->get_line_support_points(n); const Point vertices[2] = { line->vertex(0), line->vertex(1) }; - for (unsigned int i=0; i::quad_iterator &quad, // is n a square number Assert(m*m==n, ExcInternalError()); - const double ds=1./(m+1); - double y=ds; + const std::vector > &line_points = this->get_line_support_points(m); const Point vertices[4] = { quad->vertex(0), quad->vertex(1), @@ -462,14 +497,17 @@ get_intermediate_points_on_quad (const Triangulation<3>::quad_iterator &quad, quad->vertex(3) }; - for (unsigned int i=0; i::quad_iterator &quad, // is n a square number Assert(m*m==n, ExcInternalError()); - const double ds=1./(m+1); - double y=ds; + const std::vector > &line_points = this->get_line_support_points(m); const Point vertices[4] = { quad->vertex(0), quad->vertex(1), @@ -497,14 +534,17 @@ get_intermediate_points_on_quad (const Triangulation<2,3>::quad_iterator &quad, quad->vertex(3) }; - for (unsigned int i=0; i #include @@ -163,14 +165,14 @@ CylinderBoundary::get_intermediate_points_between_points ( const unsigned int n=points.size(); Assert(n>0, ExcInternalError()); - // Do a simple linear interpolation - // followed by projection, using - // the same algorithm as above - const Point ds = (v1-v0) / (n+1); + // Do a simple linear interpolation followed by projection, using the same + // algorithm as above + const std::vector > &line_points = this->get_line_support_points(n); for (unsigned int i=0; i middle = v0 + (i+1)*ds; + const double x = line_points[i+1][0]; + const Point middle = (1-x)*v0 + x*v1; const Point vector_from_axis = (middle-point_on_axis) - ((middle-point_on_axis) * direction) * direction; @@ -305,24 +307,23 @@ get_intermediate_points_between_points (const Point &p0, { const unsigned int n = points.size (); const Point axis = x_1 - x_0; - const Point dx = (p1 - p0) / (n + 1); Assert (n > 0, ExcInternalError ()); - for (unsigned int i = 0; i < n; ++i) + const std::vector > &line_points = this->get_line_support_points(n); + + for (unsigned int i=0; i x_i = p0 + (i + 1) * dx; - // To project this point on the - // boundary of the cone we first - // compute the orthogonal - // projection of this point onto - // the axis of the cone. + const Point x_i = (1-x)*p0 + x*p1; + // To project this point on the boundary of the cone we first compute + // the orthogonal projection of this point onto the axis of the cone. const double c = (x_i - x_0) * axis / axis.square (); const Point x_ip = x_0 + c * axis; - // Compute the projection of - // the middle point on the - // boundary of the cone. + // Compute the projection of the middle point on the boundary of the + // cone. points[i] = x_ip + get_radius (x_ip) * (x_i - x_ip) / (x_i - x_ip).norm (); } } @@ -335,16 +336,11 @@ get_new_point_on_line (const typename Triangulation::line_iterator &line) c const Point axis = x_1 - x_0; // Compute the middle point of the line. const Point middle = StraightBoundary::get_new_point_on_line (line); - // To project it on the boundary of - // the cone we first compute the - // orthogonal projection of the - // middle point onto the axis of - // the cone. + // To project it on the boundary of the cone we first compute the orthogonal + // projection of the middle point onto the axis of the cone. const double c = (middle - x_0) * axis / axis.square (); const Point middle_p = x_0 + c * axis; - // Compute the projection of the - // middle point on the boundary - // of the cone. + // Compute the projection of the middle point on the boundary of the cone. return middle_p + get_radius (middle_p) * (middle - middle_p) / (middle - middle_p).norm (); } @@ -358,20 +354,14 @@ get_new_point_on_quad (const Triangulation<3>::quad_iterator &quad) const const int dim = 3; const Point axis = x_1 - x_0; - // Compute the middle point of the - // quad. + // Compute the middle point of the quad. const Point middle = StraightBoundary<3>::get_new_point_on_quad (quad); - // Same algorithm as above: To - // project it on the boundary of - // the cone we first compute the - // orthogonal projection of the - // middle point onto the axis of - // the cone. + // Same algorithm as above: To project it on the boundary of the cone we + // first compute the orthogonal projection of the middle point onto the axis + // of the cone. const double c = (middle - x_0) * axis / axis.square (); const Point middle_p = x_0 + c * axis; - // Compute the projection of the - // middle point on the boundary - // of the cone. + // Compute the projection of the middle point on the boundary of the cone. return middle_p + get_radius (middle_p) * (middle - middle_p) / (middle - middle_p).norm (); } @@ -473,15 +463,12 @@ get_normals_at_vertices (const typename Triangulation::face_iterator &face, for (unsigned int vertex = 0; vertex < GeometryInfo::vertices_per_cell; ++vertex) { - // Compute the orthogonal - // projection of the vertex onto - // the axis of the cone. + // Compute the orthogonal projection of the vertex onto the axis of the + // cone. const double c = (face->vertex (vertex) - x_0) * axis / axis.square (); const Point vertex_p = x_0 + c * axis; - // Then compute the vector - // pointing from the point - // vertex_p on the axis - // to the vertex. + // Then compute the vector pointing from the point vertex_p on + // the axis to the vertex. const Point axis_to_vertex = face->vertex (vertex) - vertex_p; face_vertex_normals[vertex] = axis_to_vertex / axis_to_vertex.norm (); @@ -627,49 +614,28 @@ HyperBallBoundary::get_intermediate_points_between_points ( Assert(std::fabs(v1.square()-r2) pm=0.5*(v0+v1); const double h=std::sqrt(pm.square()); - double beta=0; - unsigned int left_index=0, right_index=0; - if ((n+1)%2==0) - { - // if the number of - // parts is even insert - // the midpoint - left_index=(n-1)/2; - right_index=left_index; - points[left_index]=pm; - --left_index; - ++right_index; - beta=d_alpha; - } - else - { - beta=(n/2+1)*d_alpha-alpha/2.; - right_index=n/2; - left_index=n/2-1; - } - // n even: m=n/2, // n odd: m=(n-1)/2 + const std::vector > &line_points = this->get_line_support_points(n); const unsigned int m=n/2; - for (unsigned int i=0; i=1, ExcInternalError()); - - double d=h*std::tan(beta); - points[right_index]=pm+d/length*(v1-v0); - points[left_index]=pm-d/length*(v1-v0); + const double beta = alpha * (line_points[i+1][0]-0.5); + const double d=h*std::tan(beta); + points[i]=pm+d/length*(v1-v0); + points[n-1-i]=pm-d/length*(v1-v0); } + if ((n+1)%2==0) + // if the number of parts is even insert the midpoint + points[(n-1)/2]=pm; + - // project the points from the - // straight line to the - // HyperBallBoundary + // project the points from the straight line to the HyperBallBoundary for (unsigned int i=0; i::line_iterator &line) c if ((line_center(0) == this->center(0)) && ((std::fabs(vertices[0].distance(this->center)-this->radius) > - 1e-5*this->radius) + 1e-5*this->radius) || (std::fabs(vertices[1].distance(this->center)-this->radius) > - 1e-5*this->radius))) + 1e-5*this->radius))) return line_center; else return HyperBallBoundary::get_new_point_on_line (line); @@ -883,10 +849,8 @@ HalfHyperBallBoundary:: get_intermediate_points_on_line (const typename Triangulation::line_iterator &line, std::vector > &points) const { - // check whether center of object is - // at x==0, since then it belongs - // to the plane part of the - // boundary + // check whether center of object is at x==0, since then it belongs to the + // plane part of the boundary const Point line_center = line->center(); if (line_center(0) == this->center(0)) return StraightBoundary::get_intermediate_points_on_line (line, points); @@ -906,10 +870,8 @@ get_intermediate_points_on_quad (const typename Triangulation::quad_iterato points[0]=get_new_point_on_quad(quad); else { - // check whether center of - // object is at x==0, since - // then it belongs to the plane - // part of the boundary + // check whether center of object is at x==0, since then it belongs to + // the plane part of the boundary const Point quad_center = quad->center(); if (quad_center(0) == this->center(0)) StraightBoundary::get_intermediate_points_on_quad (quad, points); @@ -948,10 +910,8 @@ HalfHyperBallBoundary:: get_normals_at_vertices (const typename Triangulation::face_iterator &face, typename Boundary::FaceVertexNormals &face_vertex_normals) const { - // check whether center of object is - // at x==0, since then it belongs - // to the plane part of the - // boundary + // check whether center of object is at x==0, since then it belongs to the + // plane part of the boundary const Point quad_center = face->center(); if (quad_center(0) == this->center(0)) StraightBoundary::get_normals_at_vertices (face, face_vertex_normals); @@ -1003,10 +963,8 @@ get_new_point_on_line (const typename Triangulation::line_iterator &line) c { switch (dim) { - // in 2d, first check whether the two - // end points of the line are on the - // axis of symmetry. if so, then return - // the mid point + // in 2d, first check whether the two end points of the line are on the + // axis of symmetry. if so, then return the mid point case 2: { if ((line->vertex(0)(0) == this->center(0)) @@ -1014,17 +972,13 @@ get_new_point_on_line (const typename Triangulation::line_iterator &line) c (line->vertex(1)(0) == this->center(0))) return (line->vertex(0) + line->vertex(1))/2; else - // otherwise we are on the outer or - // inner part of the shell. proceed + // otherwise we are on the outer or inner part of the shell. proceed // as in the base class return HyperShellBoundary::get_new_point_on_line (line); } - // in 3d, a line is a straight - // line if it is on the symmetry - // plane and if not both of its - // end points are on either the - // inner or outer sphere + // in 3d, a line is a straight line if it is on the symmetry plane and if + // not both of its end points are on either the inner or outer sphere case 3: { @@ -1045,8 +999,7 @@ get_new_point_on_line (const typename Triangulation::line_iterator &line) c - outer_radius) < 1e-12 * outer_radius)))) return (line->vertex(0) + line->vertex(1))/2; else - // otherwise we are on the outer or - // inner part of the shell. proceed + // otherwise we are on the outer or inner part of the shell. proceed // as in the base class return HyperShellBoundary::get_new_point_on_line (line); } @@ -1077,10 +1030,8 @@ Point HalfHyperShellBoundary:: get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) const { - // if this quad is on the symmetry plane, - // take the center point and project it - // outward to the same radius as the - // centers of the two radial lines + // if this quad is on the symmetry plane, take the center point and project + // it outward to the same radius as the centers of the two radial lines if ((quad->vertex(0)(0) == this->center(0)) && (quad->vertex(1)(0) == this->center(0)) && (quad->vertex(2)(0) == this->center(0)) && @@ -1117,9 +1068,8 @@ get_new_point_on_quad (const typename Triangulation::quad_iterator &quad) c Assert (false, ExcInternalError()); } - // otherwise we are on the outer or - // inner part of the shell. proceed - // as in the base class + // otherwise we are on the outer or inner part of the shell. proceed as in + // the base class return HyperShellBoundary::get_new_point_on_quad (quad); } @@ -1133,10 +1083,8 @@ get_intermediate_points_on_line (const typename Triangulation::line_iterato { switch (dim) { - // in 2d, first check whether the two - // end points of the line are on the - // axis of symmetry. if so, then return - // the mid point + // in 2d, first check whether the two end points of the line are on the + // axis of symmetry. if so, then return the mid point case 2: { if ((line->vertex(0)(0) == this->center(0)) @@ -1144,18 +1092,14 @@ get_intermediate_points_on_line (const typename Triangulation::line_iterato (line->vertex(1)(0) == this->center(0))) StraightBoundary::get_intermediate_points_on_line (line, points); else - // otherwise we are on the outer or - // inner part of the shell. proceed + // otherwise we are on the outer or inner part of the shell. proceed // as in the base class HyperShellBoundary::get_intermediate_points_on_line (line, points); break; } - // in 3d, a line is a straight - // line if it is on the symmetry - // plane and if not both of its - // end points are on either the - // inner or outer sphere + // in 3d, a line is a straight line if it is on the symmetry plane and if + // not both of its end points are on either the inner or outer sphere case 3: { if (((line->vertex(0)(0) == this->center(0)) @@ -1175,8 +1119,7 @@ get_intermediate_points_on_line (const typename Triangulation::line_iterato - outer_radius) < 1e-12 * outer_radius)))) StraightBoundary::get_intermediate_points_on_line (line, points); else - // otherwise we are on the outer or - // inner part of the shell. proceed + // otherwise we are on the outer or inner part of the shell. proceed // as in the base class HyperShellBoundary::get_intermediate_points_on_line (line, points); @@ -1198,10 +1141,8 @@ get_intermediate_points_on_quad (const typename Triangulation::quad_iterato { Assert (dim < 3, ExcNotImplemented()); - // check whether center of object is - // at x==0, since then it belongs - // to the plane part of the - // boundary + // check whether center of object is at x==0, since then it belongs to the + // plane part of the boundary const Point quad_center = quad->center(); if (quad_center(0) == this->center(0)) StraightBoundary::get_intermediate_points_on_quad (quad, points); @@ -1348,9 +1289,9 @@ TorusBoundary<2,3>::get_new_point_on_line (const Triangulation<2,3>::line_iterat Point<2> middle(0,0); - //Take care for periodic conditions, - //For instance phi0= 0, phi1= 3/2*Pi middle has to be 7/4*Pi not 3/4*Pi - //This also works for -Pi/2 + Pi, middle is 5/4*Pi + //Take care for periodic conditions, For instance phi0= 0, phi1= 3/2*Pi + //middle has to be 7/4*Pi not 3/4*Pi. This also works for -Pi/2 + Pi, middle + //is 5/4*Pi for (unsigned int i=0; i<2; i++) if (std::abs(p0(i)-p1(i))> numbers::PI) middle(i)=2*numbers::PI; @@ -1438,7 +1379,7 @@ TorusBoundary<2,3>:: get_intermediate_points_on_line (const Triangulation<2, 3>::line_iterator &line, std::vector< Point< 3 > > &points) const { - //Almost the same implementation as StraightBoundary<2,3> + //Almost the same implementation as StraightBoundary<2,3> unsigned int npoints=points.size(); if (npoints==0) return; @@ -1451,10 +1392,10 @@ get_intermediate_points_on_line (const Triangulation<2, 3>::line_iterator &lin offset[0]=0; offset[1]=0; - //Take care for periodic conditions & negative angles, - //see get_new_point_on_line() above - //Because we dont have a symmetric interpolation (just the middle) we need to - //add 2*Pi to each almost zero and negative angles. + //Take care for periodic conditions & negative angles, see + //get_new_point_on_line() above. Because we dont have a symmetric + //interpolation (just the middle) we need to add 2*Pi to each almost zero + //and negative angles. for (unsigned int i=0; i<2; i++) for (unsigned int j=1; j<2; j++) { @@ -1471,11 +1412,11 @@ get_intermediate_points_on_line (const Triangulation<2, 3>::line_iterator &lin p[j](i)+=2*numbers::PI*offset[i]; - double dx=1.0/(npoints+1); - double x=dx; Point<2> target; - for (unsigned int i=0; i > &line_points = this->get_line_support_points(npoints); + for (unsigned int i=0; i::quad_iterator &qua // is n a square number Assert(m*m==n, ExcInternalError()); - const double ds=1./(m+1); - double y=ds; - Point<2> p[4]; for (unsigned int i=0; i<4; i++) @@ -1508,10 +1446,10 @@ get_intermediate_points_on_quad (const Triangulation< 2, 3 >::quad_iterator &qua offset[0]=0; offset[1]=0; - //Take care for periodic conditions & negative angles, - //see get_new_point_on_line() above - //Because we dont have a symmetric interpolation (just the middle) we need to - //add 2*Pi to each almost zero and negative angles. + //Take care for periodic conditions & negative angles, see + //get_new_point_on_line() above. Because we dont have a symmetric + //interpolation (just the middle) we need to add 2*Pi to each almost zero + //and negative angles. for (unsigned int i=0; i<2; i++) for (unsigned int j=1; j<4; j++) { @@ -1527,11 +1465,13 @@ get_intermediate_points_on_quad (const Triangulation< 2, 3 >::quad_iterator &qua if (p[j](i)<1.E-12 ) //Take care for periodic conditions & negative angles p[j](i)+=2*numbers::PI*offset[i]; - for (unsigned int i=0; i > &line_points = this->get_line_support_points(m); + for (unsigned int i=0; i #include diff --git a/deal.II/source/grid/tria_levels.cc b/deal.II/source/grid/tria_levels.cc index c438a8578e..3fc8b1022a 100644 --- a/deal.II/source/grid/tria_levels.cc +++ b/deal.II/source/grid/tria_levels.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/grid/tria_objects.cc b/deal.II/source/grid/tria_objects.cc index 27e09b129d..c153febdc1 100644 --- a/deal.II/source/grid/tria_objects.cc +++ b/deal.II/source/grid/tria_objects.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/grid/tria_objects.inst.in b/deal.II/source/grid/tria_objects.inst.in index 777e0ba6cb..4f8448ed55 100644 --- a/deal.II/source/grid/tria_objects.inst.in +++ b/deal.II/source/grid/tria_objects.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/hp/CMakeLists.txt b/deal.II/source/hp/CMakeLists.txt index cc6d712816..d360552acc 100644 --- a/deal.II/source/hp/CMakeLists.txt +++ b/deal.II/source/hp/CMakeLists.txt @@ -1,28 +1,25 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/hp/*.h - ) - SET(_src dof_faces.cc dof_handler.cc - dof_levels.cc - dof_objects.cc + dof_level.cc fe_collection.cc fe_values.cc mapping_collection.cc @@ -35,6 +32,9 @@ SET(_inst mapping_collection.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/hp/*.h + ) + DEAL_II_ADD_LIBRARY(obj_hp OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_hp "${_inst}") - diff --git a/deal.II/source/hp/dof_faces.cc b/deal.II/source/hp/dof_faces.cc index 54f743349c..f7a531311f 100644 --- a/deal.II/source/hp/dof_faces.cc +++ b/deal.II/source/hp/dof_faces.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2011, 2012 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -21,9 +23,35 @@ namespace internal { namespace hp { +// ---------------------- DoFObjects ---------------------------- + + template + std::size_t + DoFIndicesOnFacesOrEdges::memory_consumption () const + { + return (MemoryConsumption::memory_consumption (dofs) + + MemoryConsumption::memory_consumption (dof_offsets)); + } + + + // explicit instantiations + template + std::size_t + DoFIndicesOnFacesOrEdges<1>::memory_consumption () const; + + template + std::size_t + DoFIndicesOnFacesOrEdges<2>::memory_consumption () const; + + template + std::size_t + DoFIndicesOnFacesOrEdges<3>::memory_consumption () const; + + +// ---------------------- DoFFaces ---------------------------- std::size_t - DoFFaces<1>::memory_consumption () const + DoFIndicesOnFaces<1>::memory_consumption () const { return 0; } @@ -31,7 +59,7 @@ namespace internal std::size_t - DoFFaces<2>::memory_consumption () const + DoFIndicesOnFaces<2>::memory_consumption () const { return MemoryConsumption::memory_consumption (lines); } @@ -39,9 +67,9 @@ namespace internal std::size_t - DoFFaces<3>::memory_consumption () const + DoFIndicesOnFaces<3>::memory_consumption () const { - return (MemoryConsumption::memory_consumption (quads) + + return (MemoryConsumption::memory_consumption (lines) + MemoryConsumption::memory_consumption (quads) ); } diff --git a/deal.II/source/hp/dof_handler.cc b/deal.II/source/hp/dof_handler.cc index 4fa7a7f666..fdb3a42ae5 100644 --- a/deal.II/source/hp/dof_handler.cc +++ b/deal.II/source/hp/dof_handler.cc @@ -1,23 +1,24 @@ -//---------------------------- hp_dof_handler.cc ------------------------ -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- hp_dof_handler.cc ------------------------ - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include #include #include -#include -#include +#include #include #include #include @@ -537,10 +538,11 @@ namespace internal // active_fe_indices field which // we have to backup before { - std::vector > + std::vector > active_fe_backup(dof_handler.levels.size ()); for (unsigned int level = 0; levelactive_fe_indices, active_fe_backup[level]); + std::swap (dof_handler.levels[level]->active_fe_indices, + active_fe_backup[level]); // delete all levels and set them up // newly, since vectors are @@ -550,7 +552,7 @@ namespace internal for (unsigned int level=0; leveln_levels(); ++level) { - dof_handler.levels.push_back (new internal::hp::DoFLevel); + dof_handler.levels.push_back (new internal::hp::DoFLevel); std::swap (active_fe_backup[level], dof_handler.levels[level]->active_fe_indices); } @@ -574,24 +576,35 @@ namespace internal // finite element is used for it for (unsigned int level=0; leveln_levels(); ++level) { - dof_handler.levels[level]->dof_object.dof_offsets - = std::vector ( + dof_handler.levels[level]->dof_offsets + = std::vector ( dof_handler.tria->n_raw_lines(level), - DoFHandler::invalid_dof_index); + (DoFLevel::offset_type)(-1)); + dof_handler.levels[level]->cell_cache_offsets + = std::vector ( + dof_handler.tria->n_raw_lines(level), + (DoFLevel::offset_type)(-1)); types::global_dof_index next_free_dof = 0; + types::global_dof_index cache_size = 0; for (typename DoFHandler::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) if (!cell->has_children()) { - dof_handler.levels[level]->dof_object.dof_offsets[cell->index()] = next_free_dof; + dof_handler.levels[level]->dof_offsets[cell->index()] = next_free_dof; next_free_dof += cell->get_fe().dofs_per_line; + + dof_handler.levels[level]->cell_cache_offsets[cell->index()] = cache_size; + cache_size += cell->get_fe().dofs_per_cell; } - dof_handler.levels[level]->dof_object.dofs + dof_handler.levels[level]->dof_indices = std::vector (next_free_dof, DoFHandler::invalid_dof_index); + dof_handler.levels[level]->cell_dof_indices_cache + = std::vector (cache_size, + DoFHandler::invalid_dof_index); } // safety check: make sure that @@ -611,12 +624,12 @@ namespace internal if (!cell->has_children()) counter += cell->get_fe().dofs_per_line; - Assert (dof_handler.levels[level]->dof_object.dofs.size() == counter, + Assert (dof_handler.levels[level]->dof_indices.size() == counter, ExcInternalError()); Assert (static_cast - (std::count (dof_handler.levels[level]->dof_object.dof_offsets.begin(), - dof_handler.levels[level]->dof_object.dof_offsets.end(), - DoFHandler::invalid_dof_index)) + (std::count (dof_handler.levels[level]->dof_offsets.begin(), + dof_handler.levels[level]->dof_offsets.end(), + (DoFLevel::offset_type)(-1))) == dof_handler.tria->n_raw_lines(level) - dof_handler.tria->n_active_lines(level), ExcInternalError()); @@ -651,7 +664,7 @@ namespace internal // active_fe_indices field which // we have to backup before { - std::vector > + std::vector > active_fe_backup(dof_handler.levels.size ()); for (unsigned int level = 0; levelactive_fe_indices, @@ -665,11 +678,11 @@ namespace internal for (unsigned int level=0; leveln_levels(); ++level) { - dof_handler.levels.push_back (new internal::hp::DoFLevel); + dof_handler.levels.push_back (new internal::hp::DoFLevel); std::swap (active_fe_backup[level], dof_handler.levels[level]->active_fe_indices); } - dof_handler.faces = new internal::hp::DoFFaces<2>; + dof_handler.faces = new internal::hp::DoFIndicesOnFaces<2>; } @@ -691,24 +704,35 @@ namespace internal // finite element is used for it for (unsigned int level=0; leveln_levels(); ++level) { - dof_handler.levels[level]->dof_object.dof_offsets - = std::vector ( + dof_handler.levels[level]->dof_offsets + = std::vector ( dof_handler.tria->n_raw_quads(level), - DoFHandler::invalid_dof_index); + (DoFLevel::offset_type)(-1)); + dof_handler.levels[level]->cell_cache_offsets + = std::vector ( + dof_handler.tria->n_raw_quads(level), + (DoFLevel::offset_type)(-1)); types::global_dof_index next_free_dof = 0; + types::global_dof_index cache_size = 0; for (typename DoFHandler::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) if (!cell->has_children()) { - dof_handler.levels[level]->dof_object.dof_offsets[cell->index()] = next_free_dof; + dof_handler.levels[level]->dof_offsets[cell->index()] = next_free_dof; next_free_dof += cell->get_fe().dofs_per_quad; + + dof_handler.levels[level]->cell_cache_offsets[cell->index()] = cache_size; + cache_size += cell->get_fe().dofs_per_cell; } - dof_handler.levels[level]->dof_object.dofs + dof_handler.levels[level]->dof_indices = std::vector (next_free_dof, DoFHandler::invalid_dof_index); + dof_handler.levels[level]->cell_dof_indices_cache + = std::vector (cache_size, + DoFHandler::invalid_dof_index); } // safety check: make sure that @@ -728,12 +752,12 @@ namespace internal if (!cell->has_children()) counter += cell->get_fe().dofs_per_quad; - Assert (dof_handler.levels[level]->dof_object.dofs.size() == counter, + Assert (dof_handler.levels[level]->dof_indices.size() == counter, ExcInternalError()); Assert (static_cast - (std::count (dof_handler.levels[level]->dof_object.dof_offsets.begin(), - dof_handler.levels[level]->dof_object.dof_offsets.end(), - DoFHandler::invalid_dof_index)) + (std::count (dof_handler.levels[level]->dof_offsets.begin(), + dof_handler.levels[level]->dof_offsets.end(), + (DoFLevel::offset_type)(-1))) == dof_handler.tria->n_raw_quads(level) - dof_handler.tria->n_active_quads(level), ExcInternalError()); @@ -747,7 +771,7 @@ namespace internal // then allocate as much space as // we need and prime the linked // list for lines (see the - // description in hp::DoFLevels) + // description in hp::DoFLevel) // with the indices we will // need. note that our task is // more complicated since two @@ -844,8 +868,8 @@ namespace internal // active ones will have a // non-invalid value later on dof_handler.faces->lines.dof_offsets - = std::vector (dof_handler.tria->n_raw_lines(), - DoFHandler::invalid_dof_index); + = std::vector (dof_handler.tria->n_raw_lines(), + (unsigned int)(-1)); dof_handler.faces->lines.dofs = std::vector (n_line_slots, DoFHandler::invalid_dof_index); @@ -1016,7 +1040,7 @@ namespace internal // active_fe_indices field which // we have to backup before { - std::vector > + std::vector > active_fe_backup(dof_handler.levels.size ()); for (unsigned int level = 0; levelactive_fe_indices, @@ -1030,11 +1054,11 @@ namespace internal for (unsigned int level=0; leveln_levels(); ++level) { - dof_handler.levels.push_back (new internal::hp::DoFLevel); + dof_handler.levels.push_back (new internal::hp::DoFLevel); std::swap (active_fe_backup[level], dof_handler.levels[level]->active_fe_indices); } - dof_handler.faces = new internal::hp::DoFFaces<3>; + dof_handler.faces = new internal::hp::DoFIndicesOnFaces<3>; } @@ -1056,23 +1080,35 @@ namespace internal // finite element is used for it for (unsigned int level=0; leveln_levels(); ++level) { - dof_handler.levels[level]->dof_object.dof_offsets - = std::vector (dof_handler.tria->n_raw_hexs(level), - DoFHandler::invalid_dof_index); + dof_handler.levels[level]->dof_offsets + = std::vector ( + dof_handler.tria->n_raw_hexs(level), + (DoFLevel::offset_type)(-1)); + dof_handler.levels[level]->cell_cache_offsets + = std::vector ( + dof_handler.tria->n_raw_hexs(level), + (DoFLevel::offset_type)(-1)); types::global_dof_index next_free_dof = 0; + types::global_dof_index cache_size = 0; for (typename DoFHandler::active_cell_iterator cell=dof_handler.begin_active(level); cell!=dof_handler.end_active(level); ++cell) if (!cell->has_children()) { - dof_handler.levels[level]->dof_object.dof_offsets[cell->index()] = next_free_dof; + dof_handler.levels[level]->dof_offsets[cell->index()] = next_free_dof; next_free_dof += cell->get_fe().dofs_per_hex; + + dof_handler.levels[level]->cell_cache_offsets[cell->index()] = cache_size; + cache_size += cell->get_fe().dofs_per_cell; } - dof_handler.levels[level]->dof_object.dofs + dof_handler.levels[level]->dof_indices = std::vector (next_free_dof, DoFHandler::invalid_dof_index); + dof_handler.levels[level]->cell_dof_indices_cache + = std::vector (cache_size, + DoFHandler::invalid_dof_index); } // safety check: make sure that @@ -1092,12 +1128,12 @@ namespace internal if (!cell->has_children()) counter += cell->get_fe().dofs_per_hex; - Assert (dof_handler.levels[level]->dof_object.dofs.size() == counter, + Assert (dof_handler.levels[level]->dof_indices.size() == counter, ExcInternalError()); Assert (static_cast - (std::count (dof_handler.levels[level]->dof_object.dof_offsets.begin(), - dof_handler.levels[level]->dof_object.dof_offsets.end(), - DoFHandler::invalid_dof_index)) + (std::count (dof_handler.levels[level]->dof_offsets.begin(), + dof_handler.levels[level]->dof_offsets.end(), + (DoFLevel::offset_type)(-1))) == dof_handler.tria->n_raw_hexs(level) - dof_handler.tria->n_active_hexs(level), ExcInternalError()); @@ -1111,7 +1147,7 @@ namespace internal // then allocate as much space as // we need and prime the linked // list for quad (see the - // description in hp::DoFLevels) + // description in hp::DoFLevel) // with the indices we will // need. note that our task is // more complicated since two @@ -1212,8 +1248,9 @@ namespace internal if (true) { dof_handler.faces->quads.dof_offsets - = std::vector (dof_handler.tria->n_raw_quads(), - DoFHandler::invalid_dof_index); + = std::vector + (dof_handler.tria->n_raw_quads(), + (unsigned int)(-1)); dof_handler.faces->quads.dofs = std::vector (n_quad_slots, DoFHandler::invalid_dof_index); @@ -1421,7 +1458,7 @@ namespace internal // line_dofs_offsets field dof_handler.faces->lines.dof_offsets .resize (dof_handler.tria->n_raw_lines(), - numbers::invalid_dof_index); + numbers::invalid_unsigned_int); unsigned int line_slots_needed = 0; for (unsigned int line=0; linen_raw_lines(); ++line) @@ -1480,9 +1517,9 @@ namespace internal max_couplings_between_dofs (const DoFHandler<1,spacedim> &dof_handler) { return std::min(static_cast (3* - dof_handler.finite_elements->max_dofs_per_vertex() + - 2*dof_handler.finite_elements->max_dofs_per_line()), - dof_handler.n_dofs()); + dof_handler.finite_elements->max_dofs_per_vertex() + + 2*dof_handler.finite_elements->max_dofs_per_line()), + dof_handler.n_dofs()); } @@ -1953,7 +1990,8 @@ namespace hp const unsigned int dofs_per_face = cell->get_fe().dofs_per_face; dofs_on_face.resize (dofs_per_face); - cell->face(f)->get_dof_indices (dofs_on_face); + cell->face(f)->get_dof_indices (dofs_on_face, + cell->active_fe_index()); for (unsigned int i=0; i (1, - (types::global_dof_index) number_cache.n_global_dofs); + (types::global_dof_index) number_cache.n_global_dofs); number_cache.locally_owned_dofs_per_processor = std::vector (1, number_cache.locally_owned_dofs); + // update the cache used for cell dof indices and compress the data on the levels + for (active_cell_iterator cell = begin_active(); + cell != end(); ++cell) + cell->update_cell_dof_indices_cache (); + + for (unsigned int level=0; levelcompress_data (*finite_elements); + // finally restore the user flags const_cast &>(*tria).load_user_flags(user_flags); } @@ -2720,7 +2766,22 @@ namespace hp } #endif + // uncompress the internal storage scheme of dofs on cells + // so that we can access dofs in turns + for (unsigned int level=0; leveluncompress_data (*finite_elements); + + // do the renumbering renumber_dofs_internal (new_numbers, dealii::internal::int2type()); + + // update the cache used for cell dof indices + for (active_cell_iterator cell = begin_active(); + cell != end(); ++cell) + cell->update_cell_dof_indices_cache (); + + // now re-compress the dof indices + for (unsigned int level=0; levelcompress_data (*finite_elements); } @@ -3081,7 +3142,7 @@ namespace hp // Create sufficiently many // hp::DoFLevels. while (levels.size () < tria->n_levels ()) - levels.push_back (new dealii::internal::hp::DoFLevel); + levels.push_back (new dealii::internal::hp::DoFLevel); // then make sure that on each // level we have the appropriate @@ -3116,7 +3177,7 @@ namespace hp { create_active_fe_table (); - // Remember if the cells have already + // Remember if the cells already have // children. That will make the transfer // of the active_fe_index to the finer // levels easier. @@ -3127,101 +3188,20 @@ namespace hp std::vector *has_children_level = new std::vector (cells_on_level); - // Check for each cell, if it has children. - std::transform (tria->levels[i]->cells.refinement_cases.begin (), - tria->levels[i]->cells.refinement_cases.end (), - has_children_level->begin (), - std::bind2nd (std::not_equal_to(), - static_cast(RefinementCase::no_refinement))); - - has_children.push_back (has_children_level); - } - } - - - - template <> - void DoFHandler<1>::pre_refinement_action () - { - create_active_fe_table (); - - // Remember if the cells have already - // children. That will make the transfer - // of the active_fe_index to the finer - // levels easier. - Assert (has_children.size () == 0, ExcInternalError ()); - for (unsigned int i=0; in_raw_cells (i); - std::vector *has_children_level = - new std::vector (cells_on_level); - - // Check for each cell, if it has - // children. here we cannot use - // refinement_cases, since it is unused in - // 1d (as there is only one choice - // anyway). use the 'children' vector - // instead - std::transform (tria->levels[i]->cells.children.begin (), - tria->levels[i]->cells.children.end (), - has_children_level->begin (), - std::bind2nd (std::not_equal_to(), -1)); - - has_children.push_back (has_children_level); - } - } - - - - template <> - void DoFHandler<1,2>::pre_refinement_action () - { - create_active_fe_table (); - - // Remember if the cells have already - // children. That will make the transfer - // of the active_fe_index to the finer - // levels easier. - Assert (has_children.size () == 0, ExcInternalError ()); - for (unsigned int i=0; in_raw_lines(i); - std::vector *has_children_level = - new std::vector (lines_on_level); - - // Check for each cell, if it has children. - std::transform (tria->levels[i]->cells.children.begin (), - tria->levels[i]->cells.children.end (), - has_children_level->begin (), - std::bind2nd (std::not_equal_to(), -1)); - - has_children.push_back (has_children_level); - } - } - - - - template <> - void DoFHandler<1,3>::pre_refinement_action () - { - create_active_fe_table (); - - // Remember if the cells have already - // children. That will make the transfer - // of the active_fe_index to the finer - // levels easier. - Assert (has_children.size () == 0, ExcInternalError ()); - for (unsigned int i=0; in_raw_lines(i); - std::vector *has_children_level = - new std::vector (lines_on_level); - - // Check for each cell, if it has children. - std::transform (tria->levels[i]->cells.children.begin (), - tria->levels[i]->cells.children.end (), - has_children_level->begin (), - std::bind2nd (std::not_equal_to(), -1)); + // Check for each cell, if it has children. in 1d, + // we don't store refinement cases, so use the 'children' + // vector instead + if (dim == 1) + std::transform (tria->levels[i]->cells.children.begin (), + tria->levels[i]->cells.children.end (), + has_children_level->begin (), + std::bind2nd (std::not_equal_to(), -1)); + else + std::transform (tria->levels[i]->cells.refinement_cases.begin (), + tria->levels[i]->cells.refinement_cases.end (), + has_children_level->begin (), + std::bind2nd (std::not_equal_to(), + static_cast(RefinementCase::no_refinement))); has_children.push_back (has_children_level); } @@ -3235,12 +3215,10 @@ namespace hp { Assert (has_children.size () == levels.size (), ExcInternalError ()); - // In each refinement at most one new - // new level may appear. If that happened - // it is appended to the DoFHandler - // levels. - if (levels.size () < tria->n_levels ()) - levels.push_back (new dealii::internal::hp::DoFLevel); + // Normally only one level is added, but if this Triangulation + // is created by copy_triangulation, it can be more than one level. + while (levels.size () < tria->n_levels ()) + levels.push_back (new dealii::internal::hp::DoFLevel); // Coarsening can lead to the loss // of levels. Hence remove them. @@ -3250,6 +3228,8 @@ namespace hp levels.pop_back (); } + Assert(levels.size () == tria->n_levels (), ExcInternalError()); + // Resize active_fe_indices // vectors. use zero indicator to // extend @@ -3306,11 +3286,6 @@ namespace hp children_level != has_children.end (); ++children_level) delete (*children_level); - /* - for_each (has_children.begin (), - has_children.end (), - delete()); - */ has_children.clear (); } diff --git a/deal.II/source/hp/dof_handler.inst.in b/deal.II/source/hp/dof_handler.inst.in index 8272116607..b83830a8b5 100644 --- a/deal.II/source/hp/dof_handler.inst.in +++ b/deal.II/source/hp/dof_handler.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/hp/dof_level.cc b/deal.II/source/hp/dof_level.cc new file mode 100644 index 0000000000..fc11565a33 --- /dev/null +++ b/deal.II/source/hp/dof_level.cc @@ -0,0 +1,244 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2003 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include + +DEAL_II_NAMESPACE_OPEN + +namespace internal +{ + namespace hp + { + template + void + DoFLevel::compress_data (const dealii::hp::FECollection &fe_collection) + { + return; + + if (dof_offsets.size() == 0 || dof_indices.size()==0) + return; + + // in a first run through, count how many new slots we need in the + // dof_indices array after compression. note that the 'cell' + // counter is incremented inside the loop + unsigned int new_size = 0; + for (unsigned int cell=0; cell(), + ExcInternalError()); + + // see if the range of dofs for this cell can be compressed and if so + // how many slots we have to store for them + if (next_offset > dof_offsets[cell]) + { + bool compressible = true; + for (unsigned int j=dof_offsets[cell]+1; j new_dof_indices; + new_dof_indices.reserve(new_size); + for (unsigned int cell=0; cell(), + ExcInternalError()); + + // see if the range of dofs for this cell can be compressed and if so + // how many slots we have to store for them + if (next_offset > dof_offsets[cell]) + { + bool compressible = true; + for (unsigned int j=dof_offsets[cell]+1; j= 0, ExcInternalError()); + + // then mark the compression + active_fe_indices[cell] = (active_fe_index_type)~(signed_active_fe_index_type)active_fe_indices[cell]; + } + else + for (unsigned int i=dof_offsets[cell]; i + void + DoFLevel::uncompress_data(const dealii::hp::FECollection &fe_collection) + { + return; + + if (dof_offsets.size() == 0 || dof_indices.size()==0) + return; + + // in a first run through, count how many new slots we need in the + // dof_indices array after uncompression. + unsigned int new_size = 0; + for (unsigned int cell=0; cell(); + } + + // now allocate the new array and copy into it whatever we need + std::vector new_dof_indices; + new_dof_indices.reserve(new_size); + std::vector new_dof_offsets (dof_offsets.size(), (offset_type)(-1)); + for (unsigned int cell=0; cell=0) + { + // apparently not. simply copy them + Assert (next_offset-dof_offsets[cell] == fe_collection[active_fe_indices[cell]].template n_dofs_per_object(), + ExcInternalError()); + for (unsigned int i=dof_offsets[cell]; i(); ++i) + new_dof_indices.push_back (dof_indices[dof_offsets[cell]]+i); + } + + // then move on to the next cell + cell = next_cell; + } + else + ++cell; + + // verify correct size, then swap arrays + Assert (new_dof_indices.size() == new_size, ExcInternalError()); + dof_indices.swap (new_dof_indices); + dof_offsets.swap (new_dof_offsets); + } + + + std::size_t + DoFLevel::memory_consumption () const + { + return (MemoryConsumption::memory_consumption (active_fe_indices) + + MemoryConsumption::memory_consumption (dof_indices) + + MemoryConsumption::memory_consumption (dof_offsets) + + MemoryConsumption::memory_consumption (cell_cache_offsets) + + MemoryConsumption::memory_consumption(cell_dof_indices_cache)); + } + + + // explicit instantiations + template void DoFLevel::compress_data(const dealii::hp::FECollection<1,1> &); + template void DoFLevel::compress_data(const dealii::hp::FECollection<1,2> &); + template void DoFLevel::compress_data(const dealii::hp::FECollection<1,3> &); + template void DoFLevel::compress_data(const dealii::hp::FECollection<2,2> &); + template void DoFLevel::compress_data(const dealii::hp::FECollection<2,3> &); + template void DoFLevel::compress_data(const dealii::hp::FECollection<3,3> &); + + template void DoFLevel::uncompress_data(const dealii::hp::FECollection<1,1> &); + template void DoFLevel::uncompress_data(const dealii::hp::FECollection<1,2> &); + template void DoFLevel::uncompress_data(const dealii::hp::FECollection<1,3> &); + template void DoFLevel::uncompress_data(const dealii::hp::FECollection<2,2> &); + template void DoFLevel::uncompress_data(const dealii::hp::FECollection<2,3> &); + template void DoFLevel::uncompress_data(const dealii::hp::FECollection<3,3> &); + } +} + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/hp/dof_levels.cc b/deal.II/source/hp/dof_levels.cc deleted file mode 100644 index f37fbcdef4..0000000000 --- a/deal.II/source/hp/dof_levels.cc +++ /dev/null @@ -1,61 +0,0 @@ -//---------------------------- hp_dof_levels.cc --------------------------- -// $Id$ -// Version: $Name$ -// -// Copyright (C) 2003, 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 -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//---------------------------- hp_dof_levels.cc ------------------------ - - -#include -#include - -DEAL_II_NAMESPACE_OPEN - -namespace internal -{ - namespace hp - { - - std::size_t - DoFLevel<1>::memory_consumption () const - { - return (DoFLevel<0>::memory_consumption() + - MemoryConsumption::memory_consumption (dof_object)); - } - - - - std::size_t - DoFLevel<2>::memory_consumption () const - { - return (DoFLevel<0>::memory_consumption () + - MemoryConsumption::memory_consumption (dof_object)); - } - - - - std::size_t - DoFLevel<3>::memory_consumption () const - { - return (DoFLevel<0>::memory_consumption () + - MemoryConsumption::memory_consumption (dof_object)); - } - - - - std::size_t - DoFLevel<0>::memory_consumption () const - { - return MemoryConsumption::memory_consumption (active_fe_indices); - } - - } -} - -DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/hp/dof_objects.cc b/deal.II/source/hp/dof_objects.cc deleted file mode 100644 index 38c3a0347b..0000000000 --- a/deal.II/source/hp/dof_objects.cc +++ /dev/null @@ -1,48 +0,0 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ -// -// Copyright (C) 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 -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//--------------------------------------------------------------------------- - - -#include -#include - -DEAL_II_NAMESPACE_OPEN - -namespace internal -{ - namespace hp - { - template - std::size_t - DoFObjects::memory_consumption () const - { - return (MemoryConsumption::memory_consumption (dofs) + - MemoryConsumption::memory_consumption (dof_offsets)); - } - - - // explicit instantiations - template - std::size_t - DoFObjects<1>::memory_consumption () const; - - template - std::size_t - DoFObjects<2>::memory_consumption () const; - - template - std::size_t - DoFObjects<3>::memory_consumption () const; - } -} - -DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/hp/fe_collection.cc b/deal.II/source/hp/fe_collection.cc index 55ece91b9a..834140145b 100644 --- a/deal.II/source/hp/fe_collection.cc +++ b/deal.II/source/hp/fe_collection.cc @@ -1,15 +1,19 @@ -//---------------------------- fe_collection.cc --------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2006, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- fe_collection.cc --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/hp/fe_collection.inst.in b/deal.II/source/hp/fe_collection.inst.in index d8dabcc8bd..7b95936715 100644 --- a/deal.II/source/hp/fe_collection.inst.in +++ b/deal.II/source/hp/fe_collection.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/hp/fe_values.cc b/deal.II/source/hp/fe_values.cc index 3e43ff6ce6..782c3595d1 100644 --- a/deal.II/source/hp/fe_values.cc +++ b/deal.II/source/hp/fe_values.cc @@ -1,16 +1,18 @@ -//---------------------------- hp_fe_values.cc --------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- hp_fe_values.cc --------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/hp/fe_values.inst.in b/deal.II/source/hp/fe_values.inst.in index 59e2c96811..ceb33fa701 100644 --- a/deal.II/source/hp/fe_values.inst.in +++ b/deal.II/source/hp/fe_values.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/hp/mapping_collection.cc b/deal.II/source/hp/mapping_collection.cc index 8c0426dd8e..0d9fdcfa83 100644 --- a/deal.II/source/hp/mapping_collection.cc +++ b/deal.II/source/hp/mapping_collection.cc @@ -1,15 +1,19 @@ -//----------------------- mapping_collection.cc --------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2006, 2011, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//----------------------- mapping_collection.cc --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/hp/mapping_collection.inst.in b/deal.II/source/hp/mapping_collection.inst.in index 43d2362466..35caaf7c17 100644 --- a/deal.II/source/hp/mapping_collection.inst.in +++ b/deal.II/source/hp/mapping_collection.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/integrators/CMakeLists.txt b/deal.II/source/integrators/CMakeLists.txt index 1f2ef00f97..ba7be39101 100644 --- a/deal.II/source/integrators/CMakeLists.txt +++ b/deal.II/source/integrators/CMakeLists.txt @@ -1,24 +1,26 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/integrators/*.h +SET(_src ) -SET(_src +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/integrators/*.h ) DEAL_II_ADD_LIBRARY(obj_integrators OBJECT ${_src} ${_header}) diff --git a/deal.II/source/lac/CMakeLists.txt b/deal.II/source/lac/CMakeLists.txt index e4a11e76c9..ebdcde19de 100644 --- a/deal.II/source/lac/CMakeLists.txt +++ b/deal.II/source/lac/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/lac/*.h - ) - SET(_src block_matrix_array.cc block_sparse_matrix.cc @@ -77,7 +75,7 @@ SET(_src vector.cc vector_memory.cc vector_view.cc -) + ) SET(_inst block_sparse_matrix.inst.in @@ -97,8 +95,11 @@ SET(_inst vector.inst.in vector_memory.inst.in vector_view.inst.in -) + ) + +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/lac/*.h + ) DEAL_II_ADD_LIBRARY(obj_lac OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_lac "${_inst}") - diff --git a/deal.II/source/lac/block_matrix_array.cc b/deal.II/source/lac/block_matrix_array.cc index c90824a219..15d50f6f41 100644 --- a/deal.II/source/lac/block_matrix_array.cc +++ b/deal.II/source/lac/block_matrix_array.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2008, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/lac/block_sparse_matrix.cc b/deal.II/source/lac/block_sparse_matrix.cc index 6b12598d82..cd6591c7ae 100644 --- a/deal.II/source/lac/block_sparse_matrix.cc +++ b/deal.II/source/lac/block_sparse_matrix.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/lac/block_sparse_matrix.inst.in b/deal.II/source/lac/block_sparse_matrix.inst.in index e0e5b97008..4d9463d81c 100644 --- a/deal.II/source/lac/block_sparse_matrix.inst.in +++ b/deal.II/source/lac/block_sparse_matrix.inst.in @@ -1,3 +1,19 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : REAL_SCALARS) { template class BlockSparseMatrix; diff --git a/deal.II/source/lac/block_sparse_matrix_ez.cc b/deal.II/source/lac/block_sparse_matrix_ez.cc index ed2fa68683..b32384beee 100644 --- a/deal.II/source/lac/block_sparse_matrix_ez.cc +++ b/deal.II/source/lac/block_sparse_matrix_ez.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/lac/block_sparsity_pattern.cc b/deal.II/source/lac/block_sparsity_pattern.cc index cf8e5f3ba8..695ae57da6 100644 --- a/deal.II/source/lac/block_sparsity_pattern.cc +++ b/deal.II/source/lac/block_sparsity_pattern.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/lac/block_vector.cc b/deal.II/source/lac/block_vector.cc index 134da28312..3399fbda30 100644 --- a/deal.II/source/lac/block_vector.cc +++ b/deal.II/source/lac/block_vector.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/lac/block_vector.inst.in b/deal.II/source/lac/block_vector.inst.in index a2c442c7e4..cc9f945d88 100644 --- a/deal.II/source/lac/block_vector.inst.in +++ b/deal.II/source/lac/block_vector.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : REAL_SCALARS) diff --git a/deal.II/source/lac/chunk_sparse_matrix.cc b/deal.II/source/lac/chunk_sparse_matrix.cc index 9bbbd73fd1..a3b4663d1b 100644 --- a/deal.II/source/lac/chunk_sparse_matrix.cc +++ b/deal.II/source/lac/chunk_sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/chunk_sparse_matrix.inst.in b/deal.II/source/lac/chunk_sparse_matrix.inst.in index d8a46dcf3f..9b5f64387c 100644 --- a/deal.II/source/lac/chunk_sparse_matrix.inst.in +++ b/deal.II/source/lac/chunk_sparse_matrix.inst.in @@ -1,15 +1,19 @@ -//---------------------------- sparse_matrix.inst.in --------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2008 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- sparse_matrix.inst.in --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // real instantiations diff --git a/deal.II/source/lac/chunk_sparsity_pattern.cc b/deal.II/source/lac/chunk_sparsity_pattern.cc index 697360a1b8..021d90b89b 100644 --- a/deal.II/source/lac/chunk_sparsity_pattern.cc +++ b/deal.II/source/lac/chunk_sparsity_pattern.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -186,10 +190,10 @@ ChunkSparsityPattern::reinit ( void ChunkSparsityPattern::reinit ( - const size_type m, - const size_type n, - const VectorSlice > &row_lengths, - const size_type chunk_size) + const size_type m, + const size_type n, + const VectorSlice > &row_lengths, + const size_type chunk_size) { Assert (row_lengths.size() == m, ExcInvalidNumber (m)); Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); @@ -261,22 +265,26 @@ namespace internal // distinguish between compressed sparsity types that define row_begin() // and SparsityPattern that uses begin() as iterator type template - void copy_row (const Sparsity &csp, - const size_type row, - ChunkSparsityPattern &dst) + void copy_row (const Sparsity &csp, + const size_type row, + const unsigned int chunk_size, + CompressedSimpleSparsityPattern &dst) { typename Sparsity::row_iterator col_num = csp.row_begin (row); + const size_type reduced_row = row/chunk_size; for (; col_num != csp.row_end (row); ++col_num) - dst.add (row, *col_num); + dst.add (reduced_row, *col_num/chunk_size); } - void copy_row (const SparsityPattern &csp, - const size_type row, - ChunkSparsityPattern &dst) + void copy_row (const SparsityPattern &csp, + const size_type row, + const unsigned int chunk_size, + CompressedSimpleSparsityPattern &dst) { SparsityPattern::iterator col_num = csp.begin (row); + const size_type reduced_row = row/chunk_size; for (; col_num != csp.end (row); ++col_num) - dst.add (row, col_num->column()); + dst.add (reduced_row, col_num->column()/chunk_size); } } } @@ -288,23 +296,28 @@ ChunkSparsityPattern::copy_from (const SparsityType &csp, const size_type chunk_size) { Assert (chunk_size > 0, ExcInvalidNumber (chunk_size)); + this->chunk_size = chunk_size; + rows = csp.n_rows(); + cols = csp.n_cols(); - // count number of entries per row, then initialize the underlying sparsity - // pattern - std::vector entries_per_row (csp.n_rows(), 0); - for (size_type row = 0; row &matrix, for (size_type row=0; rowcolumn() != sparsity_pattern.n_cols() - 1)) - n += chunk_size * chunk_size; - else if ((row == sparsity_pattern.n_rows() - 1) - && - (p->column() != sparsity_pattern.n_cols() - 1)) - // last chunk row, but not last chunk column. only a smaller - // number (n_rows % chunk_size) of rows actually exist - n += (n_rows() % chunk_size) * chunk_size; - else if ((row != sparsity_pattern.n_rows() - 1) - && - (p->column() == sparsity_pattern.n_cols() - 1)) - // last chunk column, but not row - n += (n_cols() % chunk_size) * chunk_size; - else - // bottom right chunk - n += (n_cols() % chunk_size) * - (n_rows() % chunk_size); - } - - return n; + // if columns don't align, then just iterate over all chunks and see + // what this leads to. follow the advice in the documentation of the + // sparsity pattern iterators to do the loop over individual rows, + // rather than all elements + size_type n = 0; + + for (size_type row = 0; row < sparsity_pattern.n_rows(); ++row) + { + SparsityPattern::const_iterator p = sparsity_pattern.begin(row); + for (; p!=sparsity_pattern.end(row); ++p) + if ((row != sparsity_pattern.n_rows() - 1) + && + (p->column() != sparsity_pattern.n_cols() - 1)) + n += chunk_size * chunk_size; + else if ((row == sparsity_pattern.n_rows() - 1) + && + (p->column() != sparsity_pattern.n_cols() - 1)) + // last chunk row, but not last chunk column. only a smaller + // number (n_rows % chunk_size) of rows actually exist + n += (n_rows() % chunk_size) * chunk_size; + else if ((row != sparsity_pattern.n_rows() - 1) + && + (p->column() == sparsity_pattern.n_cols() - 1)) + // last chunk column, but not row + n += (n_cols() % chunk_size) * chunk_size; + else + // bottom right chunk + n += (n_cols() % chunk_size) * + (n_rows() % chunk_size); + } + + return n; } } } @@ -640,7 +653,7 @@ ChunkSparsityPattern::print_gnuplot (std::ostream &out) const -ChunkSparsityPattern::size_type +ChunkSparsityPattern::size_type ChunkSparsityPattern::bandwidth () const { // calculate the bandwidth from that of the underlying sparsity diff --git a/deal.II/source/lac/compressed_set_sparsity_pattern.cc b/deal.II/source/lac/compressed_set_sparsity_pattern.cc index 59b83e651e..8086c68642 100644 --- a/deal.II/source/lac/compressed_set_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_set_sparsity_pattern.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -108,7 +110,7 @@ CompressedSetSparsityPattern::empty () const -CompressedSetSparsityPattern::size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::max_entries_per_row () const { size_type m = 0; @@ -211,7 +213,7 @@ CompressedSetSparsityPattern::print_gnuplot (std::ostream &out) const -CompressedSetSparsityPattern::size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::bandwidth () const { size_type b=0; @@ -229,7 +231,7 @@ CompressedSetSparsityPattern::bandwidth () const -CompressedSetSparsityPattern::size_type +CompressedSetSparsityPattern::size_type CompressedSetSparsityPattern::n_nonzero_elements () const { size_type n=0; diff --git a/deal.II/source/lac/compressed_simple_sparsity_pattern.cc b/deal.II/source/lac/compressed_simple_sparsity_pattern.cc index 07206370d9..df3953b87f 100644 --- a/deal.II/source/lac/compressed_simple_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_simple_sparsity_pattern.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2011, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -249,6 +251,15 @@ CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const size_typ } +CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const IndexSet &rowset_) + : + rows(0), + cols(0), + rowset(0) +{ + reinit (rowset_.size(), rowset_.size(), rowset_); +} + CompressedSimpleSparsityPattern::CompressedSimpleSparsityPattern (const size_type n) : @@ -306,7 +317,7 @@ CompressedSimpleSparsityPattern::empty () const -CompressedSimpleSparsityPattern::size_type +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::max_entries_per_row () const { size_type m = 0; @@ -419,7 +430,7 @@ CompressedSimpleSparsityPattern::print_gnuplot (std::ostream &out) const -CompressedSimpleSparsityPattern::size_type +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::bandwidth () const { size_type b=0; @@ -440,7 +451,7 @@ CompressedSimpleSparsityPattern::bandwidth () const -CompressedSimpleSparsityPattern::size_type +CompressedSimpleSparsityPattern::size_type CompressedSimpleSparsityPattern::n_nonzero_elements () const { size_type n=0; diff --git a/deal.II/source/lac/compressed_sparsity_pattern.cc b/deal.II/source/lac/compressed_sparsity_pattern.cc index f589438965..a857dec9c1 100644 --- a/deal.II/source/lac/compressed_sparsity_pattern.cc +++ b/deal.II/source/lac/compressed_sparsity_pattern.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -400,7 +402,7 @@ CompressedSparsityPattern::empty () const -CompressedSparsityPattern::size_type +CompressedSparsityPattern::size_type CompressedSparsityPattern::max_entries_per_row () const { size_type m = 0; @@ -511,7 +513,7 @@ CompressedSparsityPattern::print_gnuplot (std::ostream &out) const -CompressedSparsityPattern::size_type +CompressedSparsityPattern::size_type CompressedSparsityPattern::bandwidth () const { size_type b=0; @@ -532,7 +534,7 @@ CompressedSparsityPattern::bandwidth () const -CompressedSparsityPattern::size_type +CompressedSparsityPattern::size_type CompressedSparsityPattern::n_nonzero_elements () const { size_type n=0; diff --git a/deal.II/source/lac/constraint_matrix.cc b/deal.II/source/lac/constraint_matrix.cc index f3176faf72..4c1a7e8fac 100644 --- a/deal.II/source/lac/constraint_matrix.cc +++ b/deal.II/source/lac/constraint_matrix.cc @@ -1,15 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -194,7 +197,7 @@ void ConstraintMatrix::close () // won't modify the size any more after this point. { std::vector new_lines (lines_cache.size(), - numbers::invalid_size_type); + numbers::invalid_size_type); size_type counter = 0; for (std::vector::const_iterator line=lines.begin(); line!=lines.end(); ++line, ++counter) @@ -526,7 +529,7 @@ ConstraintMatrix::merge (const ConstraintMatrix &other_constraints, for (ConstraintLine::Entries::const_iterator j=other_line->begin(); j!=other_line->end(); ++j) tmp.push_back (std::pair(j->first, - j->second*weight)); + j->second*weight)); line->inhomogeneity += other_constraints.get_inhomogeneity(line->entries[i].first) * weight; @@ -628,6 +631,12 @@ void ConstraintMatrix::clear () void ConstraintMatrix::reinit (const IndexSet &local_constraints) { local_lines = local_constraints; + + // make sure the IndexSet is compressed. Otherwise this can lead to crashes + // that are hard to find (only happen in release mode). + // see tests/mpi/constraint_matrix_crash_01 + local_lines.compress(); + clear(); } @@ -868,7 +877,7 @@ void ConstraintMatrix::condense (CompressedSparsityPattern &sparsity) const q!=lines[distribute[column]].entries.size(); ++q) { - const size_type + const size_type new_col = lines[distribute[column]].entries[q].first; sparsity.add (row, new_col); @@ -945,7 +954,7 @@ void ConstraintMatrix::condense (CompressedSetSparsityPattern &sparsity) const q!=lines[distribute[column]].entries.size(); ++q) { - const size_type + const size_type new_col = lines[distribute[column]].entries[q].first; sparsity.add (row, new_col); @@ -997,7 +1006,7 @@ void ConstraintMatrix::condense (CompressedSimpleSparsityPattern &sparsity) cons // otherwise, the number states which line in the constraint matrix // handles this index std::vector distribute(sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c(c); @@ -1318,7 +1327,7 @@ void ConstraintMatrix::condense (BlockCompressedSetSparsityPattern &sparsity) co // otherwise, the number states which line in the constraint matrix // handles this index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c(c); @@ -1431,7 +1440,7 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) // otherwise, the number states which line in the constraint matrix // handles this index std::vector distribute (sparsity.n_rows(), - numbers::invalid_size_type); + numbers::invalid_size_type); for (size_type c=0; c(c); @@ -1500,7 +1509,8 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) if (distribute[global_col] == numbers::invalid_size_type) // distribute entry at irregular row @p{row} and // regular column global_col. - { for (size_type q=0; + { + for (size_type q=0; q!=lines[distribute[row]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[q].first, global_col); @@ -1508,7 +1518,8 @@ void ConstraintMatrix::condense (BlockCompressedSimpleSparsityPattern &sparsity) else // distribute entry at irregular row @p{row} and // irregular column @p{global_col} - { for (size_type p=0; + { + for (size_type p=0; p!=lines[distribute[row]].entries.size(); ++p) for (size_type q=0; q!=lines[distribute[global_col]].entries.size(); ++q) sparsity.add (lines[distribute[row]].entries[p].first, @@ -1537,8 +1548,38 @@ bool ConstraintMatrix::is_identity_constrained (const size_type index) const } +bool ConstraintMatrix::are_identity_constrained (const size_type index1, + const size_type index2) const +{ + if (is_constrained(index1) == true) + { + const ConstraintLine &p = lines[lines_cache[calculate_line_index(index1)]]; + Assert (p.line == index1, ExcInternalError()); + + // return if an entry for this line was found and if it has only one + // entry equal to 1.0 and that one is index2 + return ((p.entries.size() == 1) && + (p.entries[0].first == index2) && + (p.entries[0].second == 1.0)); + } + else if (is_constrained(index2) == true) + { + const ConstraintLine &p = lines[lines_cache[calculate_line_index(index2)]]; + Assert (p.line == index2, ExcInternalError()); + + // return if an entry for this line was found and if it has only one + // entry equal to 1.0 and that one is index1 + return ((p.entries.size() == 1) && + (p.entries[0].first == index1) && + (p.entries[0].second == 1.0)); + } + else + return false; +} + + -ConstraintMatrix::size_type +ConstraintMatrix::size_type ConstraintMatrix::max_constraint_indirections () const { size_type return_value = 0; diff --git a/deal.II/source/lac/constraint_matrix.inst.in b/deal.II/source/lac/constraint_matrix.inst.in index 9880f7044a..6320aaa188 100644 --- a/deal.II/source/lac/constraint_matrix.inst.in +++ b/deal.II/source/lac/constraint_matrix.inst.in @@ -1,3 +1,19 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S: REAL_SCALARS; T : DEAL_II_VEC_TEMPLATES) { template void ConstraintMatrix::condense >(const T &, T &) const; diff --git a/deal.II/source/lac/full_matrix.cc b/deal.II/source/lac/full_matrix.cc index ca061d2d18..92bab17377 100644 --- a/deal.II/source/lac/full_matrix.cc +++ b/deal.II/source/lac/full_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/full_matrix.inst.in b/deal.II/source/lac/full_matrix.inst.in index d04b444c29..f902a72697 100644 --- a/deal.II/source/lac/full_matrix.inst.in +++ b/deal.II/source/lac/full_matrix.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : REAL_SCALARS) diff --git a/deal.II/source/lac/lapack_full_matrix.cc b/deal.II/source/lac/lapack_full_matrix.cc index a735267446..215f9c07e1 100644 --- a/deal.II/source/lac/lapack_full_matrix.cc +++ b/deal.II/source/lac/lapack_full_matrix.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/lac/lapack_full_matrix.inst.in b/deal.II/source/lac/lapack_full_matrix.inst.in index ddde87b7cc..9db46db4a0 100644 --- a/deal.II/source/lac/lapack_full_matrix.inst.in +++ b/deal.II/source/lac/lapack_full_matrix.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : REAL_SCALARS) diff --git a/deal.II/source/lac/matrix_lib.cc b/deal.II/source/lac/matrix_lib.cc index 3a42ff1a4d..69b68c0298 100644 --- a/deal.II/source/lac/matrix_lib.cc +++ b/deal.II/source/lac/matrix_lib.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/matrix_out.cc b/deal.II/source/lac/matrix_out.cc index bb0790c3ed..634d5dd7f9 100644 --- a/deal.II/source/lac/matrix_out.cc +++ b/deal.II/source/lac/matrix_out.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/parallel_vector.cc b/deal.II/source/lac/parallel_vector.cc index 6433b8fc75..9781ae3ad9 100644 --- a/deal.II/source/lac/parallel_vector.cc +++ b/deal.II/source/lac/parallel_vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/parallel_vector.inst.in b/deal.II/source/lac/parallel_vector.inst.in index 534d690dc1..5763c77c13 100644 --- a/deal.II/source/lac/parallel_vector.inst.in +++ b/deal.II/source/lac/parallel_vector.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (SCALAR : REAL_SCALARS) diff --git a/deal.II/source/lac/petsc_block_sparse_matrix.cc b/deal.II/source/lac/petsc_block_sparse_matrix.cc index 4d74ec85dc..58e6e29973 100644 --- a/deal.II/source/lac/petsc_block_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_block_sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2008, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/petsc_full_matrix.cc b/deal.II/source/lac/petsc_full_matrix.cc index 5f5b3e3806..20903076e8 100644 --- a/deal.II/source/lac/petsc_full_matrix.cc +++ b/deal.II/source/lac/petsc_full_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2008, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/petsc_matrix_base.cc b/deal.II/source/lac/petsc_matrix_base.cc index f78c5b3f67..81780da99d 100644 --- a/deal.II/source/lac/petsc_matrix_base.cc +++ b/deal.II/source/lac/petsc_matrix_base.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -279,7 +281,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase::n () const { PetscInt n_rows, n_cols; @@ -292,7 +294,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase::local_size () const { PetscInt n_rows, n_cols; @@ -319,7 +321,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase::n_nonzero_elements () const { MatInfo mat_info; @@ -332,7 +334,7 @@ namespace PETScWrappers - MatrixBase::size_type + MatrixBase::size_type MatrixBase:: row_length (const size_type row) const { @@ -356,13 +358,16 @@ namespace PETScWrappers ierr = MatGetRow(*this, row, &ncols, &colnums, &values); AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr)); - // then restore the matrix and return the - // number of columns in this row as - // queried previously + // then restore the matrix and return the number of columns in this row as + // queried previously. Starting with PETSc 3.4, MatRestoreRow actually + // resets the last three arguments to zero/NULL, to avoid abuse of pointers + // now dangling. as a consequence, we need to save the size of the array + // and return the saved value. + const PetscInt ncols_saved = ncols; ierr = MatRestoreRow(*this, row, &ncols, &colnums, &values); AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr)); - return ncols; + return ncols_saved; } @@ -467,16 +472,16 @@ namespace PETScWrappers MatrixBase & MatrixBase::add (const MatrixBase &other, - const PetscScalar factor) + const PetscScalar factor) { const int ierr = MatAXPY (matrix, factor, - other, DIFFERENT_NONZERO_PATTERN); + other, DIFFERENT_NONZERO_PATTERN); Assert (ierr == 0, ExcPETScError(ierr)); return *this; } - + void MatrixBase::vmult (VectorBase &dst, @@ -608,6 +613,36 @@ namespace PETScWrappers MatView (matrix, PETSC_VIEWER_STDOUT_WORLD); } + void + MatrixBase::print (std::ostream &out, + const bool alternative_output) const + { + std::pair + loc_range = local_range(); + + PetscInt ncols; + const PetscInt *colnums; + const PetscScalar *values; + + MatrixBase::size_type row; + for (row = loc_range.first; row < loc_range.second; ++row) + { + int ierr; + ierr = MatGetRow(*this, row, &ncols, &colnums, &values); + AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr)); + + for (PetscInt col = 0; col < ncols; ++col) + { + out << "(" << row << "," << colnums[col] << ") " << values[col] << std::endl; + } + + ierr = MatRestoreRow(*this, row, &ncols, &colnums, &values); + AssertThrow (ierr == 0, MatrixBase::ExcPETScError(ierr)); + } + + AssertThrow (out, ExcIO()); + } + std::size_t diff --git a/deal.II/source/lac/petsc_matrix_free.cc b/deal.II/source/lac/petsc_matrix_free.cc index 0a02fd6a27..b169d1260a 100644 --- a/deal.II/source/lac/petsc_matrix_free.cc +++ b/deal.II/source/lac/petsc_matrix_free.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include @@ -230,7 +234,7 @@ namespace PETScWrappers vmult (*y, *x); // copy the result back to dst - ierr = VecCopy (&(*(*y)), dst); + ierr = VecCopy (static_cast(*y), dst); AssertThrow (ierr == 0, ExcPETScError(ierr)); delete (x); diff --git a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc index 529645a50c..531cd6be06 100644 --- a/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_block_sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2008, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -66,6 +68,57 @@ namespace PETScWrappers } } + void + BlockSparseMatrix:: + reinit(const std::vector &rows, + const std::vector &cols, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com) + { + Assert(rows.size() == bcsp.n_block_rows(), ExcMessage("invalid size")); + Assert(cols.size() == bcsp.n_block_cols(), ExcMessage("invalid size")); + + + clear(); + this->sub_objects.reinit (bcsp.n_block_rows(), + bcsp.n_block_cols()); + + std::vector row_sizes; + for (unsigned int r=0; rrow_block_indices.reinit (row_sizes); + + std::vector col_sizes; + for (unsigned int c=0; ccolumn_block_indices.reinit (col_sizes); + + for (unsigned int r=0; rn_block_rows(); ++r) + for (unsigned int c=0; cn_block_cols(); ++c) + { + Assert(rows[r].size() == bcsp.block(r,c).n_rows(), ExcMessage("invalid size")); + Assert(cols[c].size() == bcsp.block(r,c).n_cols(), ExcMessage("invalid size")); + + BlockType *p = new BlockType(); + p->reinit(rows[r], + cols[c], + bcsp.block(r,c), + com); + this->sub_objects[r][c] = p; + } + + collect_sizes(); + } + + void + BlockSparseMatrix:: + reinit(const std::vector &sizes, + const BlockCompressedSimpleSparsityPattern &bcsp, + const MPI_Comm &com) + { + reinit(sizes, sizes, bcsp, com); + } + void diff --git a/deal.II/source/lac/petsc_parallel_block_vector.cc b/deal.II/source/lac/petsc_parallel_block_vector.cc index 45dbc8d1b1..6103c62213 100644 --- a/deal.II/source/lac/petsc_parallel_block_vector.cc +++ b/deal.II/source/lac/petsc_parallel_block_vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2008, 2012, 2013 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -48,7 +50,7 @@ namespace PETScWrappers this->components.resize(this->n_blocks()); for (unsigned int i=0; in_blocks(); ++i) - components[i].reinit (MPI_Comm(), 0, 0); + components[i].reinit (MPI_COMM_SELF, 0, 0); collect_sizes(); } diff --git a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc index ffefdf851d..6e91035df7 100644 --- a/deal.II/source/lac/petsc_parallel_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_parallel_sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -41,6 +43,14 @@ namespace PETScWrappers } + SparseMatrix::~SparseMatrix () + { +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); +#endif + } SparseMatrix::SparseMatrix (const MPI_Comm &communicator, const size_type m, @@ -99,7 +109,17 @@ namespace PETScWrappers return *this; } + void + SparseMatrix::copy_from (const SparseMatrix &other) + { + if (&other == this) + return; + + this->communicator = other.communicator; + int ierr = MatCopy(other.matrix, matrix, SAME_NONZERO_PATTERN); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + } void SparseMatrix::reinit (const MPI_Comm &communicator, @@ -178,7 +198,27 @@ namespace PETScWrappers preset_nonzero_locations); } + template + void + SparseMatrix:: + reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern, + const MPI_Comm &communicator) + { + this->communicator = communicator; + + // get rid of old matrix and generate a + // new one +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + const int ierr = MatDestroy (matrix); +#else + const int ierr = MatDestroy (&matrix); +#endif + AssertThrow (ierr == 0, ExcPETScError(ierr)); + do_reinit (local_rows, local_columns, sparsity_pattern); + } void SparseMatrix::do_reinit (const size_type m, @@ -308,6 +348,172 @@ namespace PETScWrappers } + template + void + SparseMatrix:: + do_reinit (const IndexSet &local_rows, + const IndexSet &local_columns, + const SparsityType &sparsity_pattern) + { + Assert(sparsity_pattern.n_rows()==local_rows.size(), + ExcMessage("SparsityPattern and IndexSet have different number of rows")); + Assert(sparsity_pattern.n_cols()==local_columns.size(), + ExcMessage("SparsityPattern and IndexSet have different number of columns")); + Assert(local_rows.is_contiguous() && local_columns.is_contiguous(), + ExcMessage("PETSc only supports contiguous row/column ranges")); + + + + + // create the matrix. We do not set row length but set the + // correct SparsityPattern later. + int ierr; + + ierr = MatCreate(communicator,&matrix); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + ierr = MatSetSizes(matrix, + local_rows.n_elements(), + local_columns.n_elements(), + sparsity_pattern.n_rows(), + sparsity_pattern.n_cols()); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + ierr = MatSetType(matrix,MATMPIAIJ); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + + + // next preset the exact given matrix + // entries with zeros. this doesn't avoid any + // memory allocations, but it at least + // avoids some searches later on. the + // key here is that we can use the + // matrix set routines that set an + // entire row at once, not a single + // entry at a time + // + // for the usefulness of this option + // read the documentation of this + // class. + //if (preset_nonzero_locations == true) + if (local_rows.n_elements()>0) + { + Assert(local_columns.n_elements()>0, ExcInternalError()); + // MatMPIAIJSetPreallocationCSR + // can be used to allocate the sparsity + // pattern of a matrix + + const PetscInt local_row_start = local_rows.nth_index_in_set(0); + const PetscInt + local_row_end = local_row_start + local_rows.n_elements(); + + + // first set up the column number + // array for the rows to be stored + // on the local processor. have one + // dummy entry at the end to make + // sure petsc doesn't read past the + // end + std::vector + + rowstart_in_window (local_row_end - local_row_start + 1, 0), + colnums_in_window; + { + unsigned int n_cols = 0; + for (PetscInt i=local_row_start; i void @@ -337,7 +543,7 @@ namespace PETScWrappers local_row_start += local_rows_per_process[p]; local_col_start += local_columns_per_process[p]; } - const size_type + const size_type local_row_end = local_row_start + local_rows_per_process[this_process]; #if DEAL_II_PETSC_VERSION_LT(2,3,3) @@ -346,7 +552,7 @@ namespace PETScWrappers //at least starting from 2.3.3 (tested, //see below) - const size_type + const size_type local_col_end = local_col_start + local_columns_per_process[this_process]; // then count the elements in- and @@ -452,7 +658,7 @@ namespace PETScWrappers // now copy over the information // from the sparsity pattern. { - PetscInt* ptr = & colnums_in_window[0]; + PetscInt *ptr = & colnums_in_window[0]; for (size_type i=local_row_start; i &, @@ -627,6 +840,12 @@ namespace PETScWrappers const unsigned int , const bool); + template void + SparseMatrix:: + do_reinit (const IndexSet &, + const IndexSet &, + const CompressedSimpleSparsityPattern &); + PetscScalar SparseMatrix::matrix_norm_square (const Vector &v) const diff --git a/deal.II/source/lac/petsc_parallel_vector.cc b/deal.II/source/lac/petsc_parallel_vector.cc index c4784fa9b1..848ba3eec1 100644 --- a/deal.II/source/lac/petsc_parallel_vector.cc +++ b/deal.II/source/lac/petsc_parallel_vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2006, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -37,6 +39,7 @@ namespace PETScWrappers const int ierr = VecCreateSeq (PETSC_COMM_SELF, n, &vector); AssertThrow (ierr == 0, ExcPETScError(ierr)); + ghosted = false; } @@ -79,10 +82,35 @@ namespace PETScWrappers Vector::create_vector(local.size(), local.n_elements(), ghost_set); } + Vector::Vector (const IndexSet &local, + const IndexSet &ghost, + const MPI_Comm &communicator) + : + communicator (communicator) + { + Assert(local.is_contiguous(), ExcNotImplemented()); + + IndexSet ghost_set = ghost; + ghost_set.subtract_set(local); + + Vector::create_vector(local.size(), local.n_elements(), ghost_set); + } + + + Vector::Vector (const IndexSet &local, + const MPI_Comm &communicator) + : + communicator (communicator) + { + Assert(local.is_contiguous(), ExcNotImplemented()); + Vector::create_vector(local.size(), local.n_elements()); + } + + Vector::Vector (const MPI_Comm &communicator, - const IndexSet &local) - : - communicator (communicator) + const IndexSet &local) + : + communicator (communicator) { Assert(local.is_contiguous(), ExcNotImplemented()); Vector::create_vector(local.size(), local.n_elements()); @@ -103,7 +131,7 @@ namespace PETScWrappers MPI_Allreduce (&k, &k_global, 1, MPI_INT, MPI_LOR, communicator); - if (k_global) + if (k_global || has_ghost_elements()) { // FIXME: I'd like to use this here, // but somehow it leads to odd errors @@ -138,9 +166,17 @@ namespace PETScWrappers Vector::reinit (const Vector &v, const bool fast) { - communicator = v.communicator; - - reinit (communicator, v.size(), v.local_size(), fast); + if (v.has_ghost_elements()) + { + reinit (v.locally_owned_elements(), v.ghost_indices, v.communicator); + if (!fast) + { + int ierr = VecSet(vector, 0.0); + AssertThrow (ierr == 0, ExcPETScError(ierr)); + } + } + else + reinit (v.communicator, v.size(), v.local_size(), fast); } @@ -150,6 +186,22 @@ namespace PETScWrappers const IndexSet &local, const IndexSet &ghost) { + reinit(local, ghost, comm); + } + + void + Vector::reinit (const IndexSet &local, + const IndexSet &ghost, + const MPI_Comm &comm) + { + int ierr; +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + ierr = VecDestroy (vector); +#else + ierr = VecDestroy (&vector); +#endif + AssertThrow (ierr == 0, ExcPETScError(ierr)); + communicator = comm; Assert(local.is_contiguous(), ExcNotImplemented()); @@ -162,11 +214,27 @@ namespace PETScWrappers void Vector::reinit (const MPI_Comm &comm, - const IndexSet &local) + const IndexSet &local) + { + reinit(local, comm); + } + + void + Vector::reinit (const IndexSet &local, + const MPI_Comm &comm) { + int ierr; +#if DEAL_II_PETSC_VERSION_LT(3,2,0) + ierr = VecDestroy (vector); +#else + ierr = VecDestroy (&vector); +#endif + AssertThrow (ierr == 0, ExcPETScError(ierr)); + communicator = comm; Assert(local.is_contiguous(), ExcNotImplemented()); + Assert(local.size()>0, ExcMessage("can not create vector of size 0.")); create_vector(local.size(), local.n_elements()); } @@ -175,7 +243,7 @@ namespace PETScWrappers Vector::operator = (const PETScWrappers::Vector &v) { Assert(last_action==VectorOperation::unknown, - ExcMessage("Call to compress() required before calling operator=.")); + ExcMessage("Call to compress() required before calling operator=.")); //TODO [TH]: can not access v.last_action here. Implement is_compressed()? //Assert(v.last_action==VectorOperation::unknown, // ExcMessage("Call to compress() required before calling operator=.")); diff --git a/deal.II/source/lac/petsc_precondition.cc b/deal.II/source/lac/petsc_precondition.cc index d799ae708f..8c466b0ba6 100644 --- a/deal.II/source/lac/petsc_precondition.cc +++ b/deal.II/source/lac/petsc_precondition.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2006, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/petsc_solver.cc b/deal.II/source/lac/petsc_solver.cc index dfed0c3b35..9da2aeef47 100644 --- a/deal.II/source/lac/petsc_solver.cc +++ b/deal.II/source/lac/petsc_solver.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2006, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -849,10 +853,10 @@ namespace PETScWrappers } PetscErrorCode SparseDirectMUMPS::convergence_test (KSP /*ksp*/, - const PetscInt iteration, - const PetscReal residual_norm, - KSPConvergedReason *reason, - void *solver_control_x) + const PetscInt iteration, + const PetscReal residual_norm, + KSPConvergedReason *reason, + void *solver_control_x) { SolverControl &solver_control = *reinterpret_cast(solver_control_x); diff --git a/deal.II/source/lac/petsc_sparse_matrix.cc b/deal.II/source/lac/petsc_sparse_matrix.cc index d1a747ec91..3b31a75316 100644 --- a/deal.II/source/lac/petsc_sparse_matrix.cc +++ b/deal.II/source/lac/petsc_sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2008, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -195,7 +197,7 @@ namespace PETScWrappers // convert, unless we want to play dirty // tricks with conversions of pointers const std::vector - int_row_lengths (row_lengths.begin(), row_lengths.end()); + int_row_lengths (row_lengths.begin(), row_lengths.end()); const int ierr = MatCreateSeqAIJ(PETSC_COMM_SELF, m, n, 0, diff --git a/deal.II/source/lac/petsc_vector.cc b/deal.II/source/lac/petsc_vector.cc index 10fbb942d0..68881a9f98 100644 --- a/deal.II/source/lac/petsc_vector.cc +++ b/deal.II/source/lac/petsc_vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2006, 2008, 2012 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/petsc_vector_base.cc b/deal.II/source/lac/petsc_vector_base.cc index 3cd36b336e..ae6e39c52b 100644 --- a/deal.II/source/lac/petsc_vector_base.cc +++ b/deal.II/source/lac/petsc_vector_base.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2004 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -152,8 +154,8 @@ namespace PETScWrappers attained_ownership(true) { Assert( multithread_info.is_running_single_threaded(), - ExcMessage("PETSc does not support multi-threaded access, set " - "the thread limit to 1 in MPI_InitFinalize().")); + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); } @@ -167,8 +169,8 @@ namespace PETScWrappers attained_ownership(true) { Assert( multithread_info.is_running_single_threaded(), - ExcMessage("PETSc does not support multi-threaded access, set " - "the thread limit to 1 in MPI_InitFinalize().")); + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); int ierr = VecDuplicate (v.vector, &vector); AssertThrow (ierr == 0, ExcPETScError(ierr)); @@ -188,8 +190,8 @@ namespace PETScWrappers attained_ownership(false) { Assert( multithread_info.is_running_single_threaded(), - ExcMessage("PETSc does not support multi-threaded access, set " - "the thread limit to 1 in MPI_InitFinalize().")); + ExcMessage("PETSc does not support multi-threaded access, set " + "the thread limit to 1 in MPI_InitFinalize().")); } @@ -267,7 +269,7 @@ namespace PETScWrappers - VectorBase::size_type + VectorBase::size_type VectorBase::size () const { PetscInt sz; @@ -279,7 +281,7 @@ namespace PETScWrappers - VectorBase::size_type + VectorBase::size_type VectorBase::local_size () const { PetscInt sz; @@ -467,13 +469,13 @@ namespace PETScWrappers return mean; #else // PETSC_USE_COMPLEX - Assert ((false), - ExcMessage ("Your PETSc/SLEPc installation was configured with scalar-type complex " - "but this function is not defined for complex types.")); + Assert ((false), + ExcMessage ("Your PETSc/SLEPc installation was configured with scalar-type complex " + "but this function is not defined for complex types.")); - // Prevent compiler warning about no return value - PetscScalar dummy; - return dummy; + // Prevent compiler warning about no return value + PetscScalar dummy; + return dummy; #endif } diff --git a/deal.II/source/lac/precondition_block.cc b/deal.II/source/lac/precondition_block.cc index 77960c01b1..3675584576 100644 --- a/deal.II/source/lac/precondition_block.cc +++ b/deal.II/source/lac/precondition_block.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/precondition_block.inst.in b/deal.II/source/lac/precondition_block.inst.in index 0f601bcfa6..e079184b97 100644 --- a/deal.II/source/lac/precondition_block.inst.in +++ b/deal.II/source/lac/precondition_block.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : REAL_SCALARS) diff --git a/deal.II/source/lac/precondition_block_ez.cc b/deal.II/source/lac/precondition_block_ez.cc index 01987b49bf..d3dad0fedd 100644 --- a/deal.II/source/lac/precondition_block_ez.cc +++ b/deal.II/source/lac/precondition_block_ez.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/relaxation_block.cc b/deal.II/source/lac/relaxation_block.cc index 153051f90e..c1133f9c5e 100644 --- a/deal.II/source/lac/relaxation_block.cc +++ b/deal.II/source/lac/relaxation_block.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/relaxation_block.inst.in b/deal.II/source/lac/relaxation_block.inst.in index aea5d8324f..b16557a2d8 100644 --- a/deal.II/source/lac/relaxation_block.inst.in +++ b/deal.II/source/lac/relaxation_block.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2011 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S1, S2 : REAL_SCALARS) diff --git a/deal.II/source/lac/slepc_solver.cc b/deal.II/source/lac/slepc_solver.cc index 2703bc964c..4e372994d1 100644 --- a/deal.II/source/lac/slepc_solver.cc +++ b/deal.II/source/lac/slepc_solver.cc @@ -1,17 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ -// Author: Toby D. Young, Polish Academy of Sciences, 2008-2013 +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009-2013 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -49,7 +50,7 @@ namespace SLEPcWrappers : solver_control (cn), mpi_communicator (mpi_communicator), - target_eigenvalue (PETSC_NULL), + target_eigenvalue (0.), set_which (EPS_LARGEST_MAGNITUDE), set_problem (EPS_NHEP), opA (NULL), @@ -109,8 +110,8 @@ namespace SLEPcWrappers } void - SolverBase::solve (const size_type n_eigenpairs, - size_type *n_converged) + SolverBase::solve (const unsigned int n_eigenpairs, + unsigned int *n_converged) { int ierr; @@ -150,14 +151,18 @@ namespace SLEPcWrappers AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } - // set transformation type if any + // if a spectral transformation is to be used, set the + // transformation and target the wanted eigenvalues if (transformation) - transformation->set_context (solver_data->eps); + { + // set transformation type if any + transformation->set_context (solver_data->eps); + + // set target eigenvalues to solve for + ierr = EPSSetTarget (solver_data->eps, target_eigenvalue); + AssertThrow (ierr == 0, ExcSLEPcError(ierr)); + } - // set target eigenvalues to solve for - ierr = EPSSetTarget (solver_data->eps, target_eigenvalue); - AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - // set which portion of the eigenspectrum to solve for ierr = EPSSetWhichEigenpairs (solver_data->eps, set_which); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); @@ -186,11 +191,11 @@ namespace SLEPcWrappers // get number of converged eigenstates ierr = EPSGetConverged (solver_data->eps, - reinterpret_cast(n_converged)); + reinterpret_cast(n_converged)); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - PetscInt n_iterations = 0; - double residual_norm = 1e300; + PetscInt n_iterations = 0; + PetscReal residual_norm = 1.e300; // @todo Investigate elaborating on some of this to act on the // complete eigenspectrum @@ -199,9 +204,13 @@ namespace SLEPcWrappers ierr = EPSGetIterationNumber (solver_data->eps, &n_iterations); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); - // get the residual norm of the most extreme eigenvalue - ierr = EPSComputeResidualNorm (solver_data->eps, 0, &residual_norm); - AssertThrow (ierr == 0, ExcSLEPcError(ierr)); + // get the residual norm of the most extreme eigenvalue if and + // only if at least one eigenvector has converged. + if ((*n_converged)>0) + { + ierr = EPSComputeResidualNorm (solver_data->eps, 0, &residual_norm); + AssertThrow (ierr == 0, ExcSLEPcError(ierr)); + } // check the solver state const SolverControl::State state @@ -218,7 +227,7 @@ namespace SLEPcWrappers } void - SolverBase::get_eigenpair (const size_type index, + SolverBase::get_eigenpair (const unsigned int index, PetscScalar &eigenvalues, PETScWrappers::VectorBase &eigenvectors) { @@ -226,8 +235,8 @@ namespace SLEPcWrappers // get converged eigenpair int ierr = EPSGetEigenpair (solver_data->eps, index, - &eigenvalues, PETSC_NULL, - eigenvectors, PETSC_NULL); + &eigenvalues, PETSC_NULL, + eigenvectors, PETSC_NULL); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); } @@ -241,11 +250,11 @@ namespace SLEPcWrappers { #ifndef PETSC_USE_COMPLEX AssertThrow (solver_data.get() != 0, ExcSLEPcWrappersUsageError()); - + // get converged eigenpair int ierr = EPSGetEigenpair (solver_data->eps, index, - &real_eigenvalues, &imag_eigenvalues, - real_eigenvectors, imag_eigenvectors); + &real_eigenvalues, &imag_eigenvalues, + real_eigenvectors, imag_eigenvectors); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); #else Assert ((false), @@ -448,7 +457,7 @@ namespace SLEPcWrappers this->solver_control.max_steps()); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); #else - // Supress compiler warnings about unused paameters. + // Suppress compiler warnings about unused parameters. (void) eps; // PETSc/SLEPc version must be > 3.1.0. @@ -481,7 +490,7 @@ namespace SLEPcWrappers this->solver_control.max_steps()); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); #else - // Supress compiler warnings about unused paameters. + // Suppress compiler warnings about unused parameters. (void) eps; // PETSc/SLEPc version must be > 3.1.0. @@ -494,8 +503,8 @@ namespace SLEPcWrappers /* ---------------------- LAPACK ------------------------- */ SolverLAPACK::SolverLAPACK (SolverControl &cn, - const MPI_Comm &mpi_communicator, - const AdditionalData &data) + const MPI_Comm &mpi_communicator, + const AdditionalData &data) : SolverBase (cn, mpi_communicator), additional_data (data) @@ -517,7 +526,7 @@ namespace SLEPcWrappers this->solver_control.max_steps()); AssertThrow (ierr == 0, ExcSLEPcError(ierr)); #else - // Supress compiler warnings about unused paameters. + // Suppress compiler warnings about unused parameters. (void) eps; Assert ((false), @@ -530,13 +539,5 @@ namespace SLEPcWrappers DEAL_II_NAMESPACE_CLOSE -#else - -// On gcc2.95 on Alpha OSF1, the native assembler does not like empty -// files, so provide some dummy code -namespace -{ - void dummy () {} -} #endif // DEAL_II_WITH_SLEPC diff --git a/deal.II/source/lac/slepc_spectral_transformation.cc b/deal.II/source/lac/slepc_spectral_transformation.cc index 977e29876b..fdd6eb5ae7 100644 --- a/deal.II/source/lac/slepc_spectral_transformation.cc +++ b/deal.II/source/lac/slepc_spectral_transformation.cc @@ -1,17 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ -// Author: Toby D. Young, Polish Academy of Sciences, 2009 +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -163,12 +164,5 @@ namespace SLEPcWrappers DEAL_II_NAMESPACE_CLOSE -#else -// On gcc2.95 on Alpha OSF1, the native assembler does not like empty -// files, so provide some dummy code -namespace -{ - void dummy () {} -} #endif // DEAL_II_WITH_SLEPC diff --git a/deal.II/source/lac/solver.cc b/deal.II/source/lac/solver.cc index a5dd8a6384..145347c6cf 100644 --- a/deal.II/source/lac/solver.cc +++ b/deal.II/source/lac/solver.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/lac/solver.inst.in b/deal.II/source/lac/solver.inst.in index f01301a37e..7e158b9d2a 100644 --- a/deal.II/source/lac/solver.inst.in +++ b/deal.II/source/lac/solver.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : SERIAL_VECTORS) diff --git a/deal.II/source/lac/solver_control.cc b/deal.II/source/lac/solver_control.cc index 7308250b4e..a6f1c61cb5 100644 --- a/deal.II/source/lac/solver_control.cc +++ b/deal.II/source/lac/solver_control.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/sparse_decomposition.cc b/deal.II/source/lac/sparse_decomposition.cc index e500e64a35..4ba8f1abc8 100644 --- a/deal.II/source/lac/sparse_decomposition.cc +++ b/deal.II/source/lac/sparse_decomposition.cc @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 2002, 2003, 2005, 2006, 2012 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 2002 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/lac/sparse_direct.cc b/deal.II/source/lac/sparse_direct.cc index 3a5c543c99..ed801cea31 100644 --- a/deal.II/source/lac/sparse_direct.cc +++ b/deal.II/source/lac/sparse_direct.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2001 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -249,7 +251,7 @@ factorize (const Matrix &matrix) for (size_type row = 0; row < matrix.m(); ++row) { for (typename Matrix::const_iterator p=matrix.begin(row); - p!=matrix.end(row); ++p) + p!=matrix.end(row); ++p) { // write entry into the first free one for this row Ai[row_pointers[row]] = p->column(); @@ -291,7 +293,8 @@ factorize (const Matrix &matrix) void -SparseDirectUMFPACK::solve (Vector &rhs_and_solution) const +SparseDirectUMFPACK::solve (Vector &rhs_and_solution, + bool transpose /*=false*/) const { // make sure that some kind of factorize() call has happened before Assert (Ap.size() != 0, ExcNotInitialized()); @@ -304,8 +307,11 @@ SparseDirectUMFPACK::solve (Vector &rhs_and_solution) const // solve the system. note that since UMFPACK wants compressed column // storage instead of the compressed row storage format we use in // deal.II's SparsityPattern classes, we solve for UMFPACK's A^T instead + + // Conversely, if we solve for the transpose, we have to use UMFPACK_A + // instead. const int status - = umfpack_dl_solve (UMFPACK_At, + = umfpack_dl_solve (transpose ? UMFPACK_A : UMFPACK_At, &Ap[0], &Ai[0], &Ax[0], rhs_and_solution.begin(), rhs.begin(), numeric_decomposition, @@ -315,14 +321,15 @@ SparseDirectUMFPACK::solve (Vector &rhs_and_solution) const void -SparseDirectUMFPACK::solve (BlockVector &rhs_and_solution) const +SparseDirectUMFPACK::solve (BlockVector &rhs_and_solution, + bool transpose /*=false*/) const { // the UMFPACK functions want a contiguous array of elements, so // there is no way around copying data around. thus, just copy the // data into a regular vector and back Vector tmp (rhs_and_solution.size()); tmp = rhs_and_solution; - solve (tmp); + solve (tmp, transpose); rhs_and_solution = tmp; } @@ -331,20 +338,22 @@ SparseDirectUMFPACK::solve (BlockVector &rhs_and_solution) const template void SparseDirectUMFPACK::solve (const Matrix &matrix, - Vector &rhs_and_solution) + Vector &rhs_and_solution, + bool transpose /*=false*/) { factorize (matrix); - solve (rhs_and_solution); + solve (rhs_and_solution, transpose); } template void -SparseDirectUMFPACK::solve (const Matrix &matrix, - BlockVector &rhs_and_solution) +SparseDirectUMFPACK::solve (const Matrix &matrix, + BlockVector &rhs_and_solution, + bool transpose /*=false*/) { factorize (matrix); - solve (rhs_and_solution); + solve (rhs_and_solution, transpose); } @@ -372,7 +381,7 @@ void SparseDirectUMFPACK::factorize (const Matrix &) void -SparseDirectUMFPACK::solve (Vector &) const +SparseDirectUMFPACK::solve (Vector &, bool) const { AssertThrow(false, ExcMessage("To call this function you need UMFPACK, but configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html.")); } @@ -380,7 +389,7 @@ SparseDirectUMFPACK::solve (Vector &) const void -SparseDirectUMFPACK::solve (BlockVector &) const +SparseDirectUMFPACK::solve (BlockVector &, bool) const { AssertThrow(false, ExcMessage("To call this function you need UMFPACK, but configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html.")); } @@ -389,7 +398,8 @@ SparseDirectUMFPACK::solve (BlockVector &) const template void SparseDirectUMFPACK::solve (const Matrix &, - Vector &) + Vector &, + bool) { AssertThrow(false, ExcMessage("To call this function you need UMFPACK, but configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html.")); } @@ -399,7 +409,8 @@ SparseDirectUMFPACK::solve (const Matrix &, template void SparseDirectUMFPACK::solve (const Matrix &, - BlockVector &) + BlockVector &, + bool) { AssertThrow(false, ExcMessage("To call this function you need UMFPACK, but configured deal.II without passing the necessary switch to 'cmake'. Please consult the installation instructions in doc/readme.html.")); } @@ -439,10 +450,22 @@ SparseDirectUMFPACK::vmult ( void SparseDirectUMFPACK::Tvmult ( - Vector &, - const Vector &) const + Vector &dst, + const Vector &src) const { - Assert(false, ExcNotImplemented()); + dst = src; + this->solve(dst, /*transpose=*/ true); +} + + + +void +SparseDirectUMFPACK::Tvmult ( + BlockVector &dst, + const BlockVector &src) const +{ + dst = src; + this->solve(dst, /*transpose=*/ true); } @@ -465,6 +488,7 @@ SparseDirectUMFPACK::Tvmult_add ( + #ifdef DEAL_II_WITH_MUMPS SparseDirectMUMPS::SparseDirectMUMPS () @@ -528,7 +552,7 @@ void SparseDirectMUMPS::initialize_matrix (const Matrix &matrix) for (size_type row = 0; row < matrix.m(); ++row) { for (typename Matrix::const_iterator ptr = matrix.begin (row); - ptr != matrix.end (row); ++ptr) + ptr != matrix.end (row); ++ptr) if (std::abs (ptr->value ()) > 0.0) { a[index] = ptr->value (); @@ -641,17 +665,19 @@ void SparseDirectMUMPS::vmult (Vector &dst, // explicit instantiations for SparseMatrixUMFPACK -#define InstantiateUMFPACK(MATRIX) \ - template \ - void SparseDirectUMFPACK::factorize (const MATRIX &); \ - template \ - void SparseDirectUMFPACK::solve (const MATRIX &, \ - Vector &); \ - template \ - void SparseDirectUMFPACK::solve (const MATRIX &, \ - BlockVector &); \ - template \ - void SparseDirectUMFPACK::initialize (const MATRIX &, \ +#define InstantiateUMFPACK(MATRIX) \ + template \ + void SparseDirectUMFPACK::factorize (const MATRIX &); \ + template \ + void SparseDirectUMFPACK::solve (const MATRIX &, \ + Vector &, \ + bool); \ + template \ + void SparseDirectUMFPACK::solve (const MATRIX &, \ + BlockVector &, \ + bool); \ + template \ + void SparseDirectUMFPACK::initialize (const MATRIX &, \ const AdditionalData); InstantiateUMFPACK(SparseMatrix) @@ -663,8 +689,8 @@ InstantiateUMFPACK(BlockSparseMatrix) // explicit instantiations for SparseDirectMUMPS #ifdef DEAL_II_WITH_MUMPS -#define InstantiateMUMPS(MATRIX) \ - template \ +#define InstantiateMUMPS(MATRIX) \ + template \ void SparseDirectMUMPS::initialize (const MATRIX &, const Vector &); InstantiateMUMPS(SparseMatrix) diff --git a/deal.II/source/lac/sparse_ilu.cc b/deal.II/source/lac/sparse_ilu.cc index ef125efd33..a163eb43af 100644 --- a/deal.II/source/lac/sparse_ilu.cc +++ b/deal.II/source/lac/sparse_ilu.cc @@ -1,13 +1,18 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2012 by the deal.II authors +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 1999 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- - +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/sparse_matrix.cc b/deal.II/source/lac/sparse_matrix.cc index c088dfef36..09cceabf25 100644 --- a/deal.II/source/lac/sparse_matrix.cc +++ b/deal.II/source/lac/sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/sparse_matrix.inst.in b/deal.II/source/lac/sparse_matrix.inst.in index 53eee70191..8905a99209 100644 --- a/deal.II/source/lac/sparse_matrix.inst.in +++ b/deal.II/source/lac/sparse_matrix.inst.in @@ -1,15 +1,19 @@ -//---------------------------- sparse_matrix.inst.in --------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2006, 2007, 2009, 2011 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- sparse_matrix.inst.in --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + // real instantiations diff --git a/deal.II/source/lac/sparse_matrix_ez.cc b/deal.II/source/lac/sparse_matrix_ez.cc index 9ad33b16db..d248429bb0 100644 --- a/deal.II/source/lac/sparse_matrix_ez.cc +++ b/deal.II/source/lac/sparse_matrix_ez.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/sparse_matrix_ez.inst.in b/deal.II/source/lac/sparse_matrix_ez.inst.in index 1747bc210b..e0c33c4102 100644 --- a/deal.II/source/lac/sparse_matrix_ez.inst.in +++ b/deal.II/source/lac/sparse_matrix_ez.inst.in @@ -1,15 +1,19 @@ -//---------------------------- sparse_matrix_ez.inst.in --------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2002, 2003, 2006, 2007 by the deal.II authors +// Copyright (C) 2002 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//---------------------------- sparse_matrix_ez.inst.in --------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : REAL_SCALARS) diff --git a/deal.II/source/lac/sparse_mic.cc b/deal.II/source/lac/sparse_mic.cc index 51a40f531a..8761138f0a 100644 --- a/deal.II/source/lac/sparse_mic.cc +++ b/deal.II/source/lac/sparse_mic.cc @@ -1,13 +1,19 @@ -//--------------------------------------------------------------------------- -// Copyright (C) 2002, 2003, 2005, 2006, 2012 by the deal.II authors -// by the deal.II authors and Stephen "Cheffo" Kolaroff +// --------------------------------------------------------------------- +// $Id$ // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// Copyright (C) 2002 - 2013 by the deal.II authors // -//--------------------------------------------------------------------------- +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include diff --git a/deal.II/source/lac/sparse_vanka.cc b/deal.II/source/lac/sparse_vanka.cc index 47fbdd4498..94815867d7 100644 --- a/deal.II/source/lac/sparse_vanka.cc +++ b/deal.II/source/lac/sparse_vanka.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/sparsity_pattern.cc b/deal.II/source/lac/sparsity_pattern.cc index 27656dedf1..edef0ca4ef 100644 --- a/deal.II/source/lac/sparsity_pattern.cc +++ b/deal.II/source/lac/sparsity_pattern.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -385,8 +389,8 @@ SparsityPattern::reinit (const size_type m, std::size_t vec_len = 0; for (size_type i=0; i(store_diagonal_first_in_row ? - std::max(row_lengths[i], 1U) : - row_lengths[i]), + std::max(row_lengths[i], 1U) : + row_lengths[i]), n); // sometimes, no entries are @@ -412,7 +416,7 @@ SparsityPattern::reinit (const size_type m, max_row_length = (row_lengths.size() == 0 ? 0 : std::min (static_cast(*std::max_element(row_lengths.begin(), - row_lengths.end())), + row_lengths.end())), n)); if (store_diagonal_first_in_row && (max_row_length==0) && (m!=0)) @@ -464,7 +468,7 @@ SparsityPattern::reinit (const size_type m, rowstart[i] = rowstart[i-1] + (store_diagonal_first_in_row ? std::max(std::min(static_cast(row_lengths[i-1]),n), - static_cast (1U)) : + static_cast (1U)) : std::min(static_cast(row_lengths[i-1]),n)); Assert ((rowstart[rows]==vec_len) || @@ -771,7 +775,7 @@ SparsityPattern::empty () const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::max_entries_per_row () const { // if compress() has not yet been @@ -793,7 +797,7 @@ SparsityPattern::max_entries_per_row () const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::operator () (const size_type i, const size_type j) const { @@ -831,8 +835,8 @@ SparsityPattern::operator () (const size_type i, &colnums[rowstart[i]]); const size_type *const p = Utilities::lower_bound (sorted_region_start, - &colnums[rowstart[i+1]], - j); + &colnums[rowstart[i+1]], + j); if ((p != &colnums[rowstart[i+1]]) && (*p == j)) return (p - &colnums[0]); else @@ -931,7 +935,7 @@ SparsityPattern::exists (const size_type i, const size_type j) const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::row_position (const size_type i, const size_type j) const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); @@ -1067,7 +1071,7 @@ SparsityPattern::print_gnuplot (std::ostream &out) const -SparsityPattern::size_type +SparsityPattern::size_type SparsityPattern::bandwidth () const { Assert ((rowstart!=0) && (colnums!=0), ExcEmptyObject()); @@ -1191,6 +1195,7 @@ template void SparsityPattern::copy_from (const template void SparsityPattern::copy_from (const FullMatrix &, bool); template void SparsityPattern::copy_from (const FullMatrix &, bool); +template void SparsityPattern::copy_from (const SparsityPattern &); template void SparsityPattern::copy_from (const CompressedSparsityPattern &); template void SparsityPattern::copy_from (const CompressedSetSparsityPattern &); template void SparsityPattern::copy_from (const CompressedSimpleSparsityPattern &); diff --git a/deal.II/source/lac/sparsity_tools.cc b/deal.II/source/lac/sparsity_tools.cc index 6aa7765be9..066aa09a9b 100644 --- a/deal.II/source/lac/sparsity_tools.cc +++ b/deal.II/source/lac/sparsity_tools.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -501,6 +505,132 @@ namespace SparsityTools MPI_Waitall(requests.size(), &requests[0], MPI_STATUSES_IGNORE); } + +template +void distribute_sparsity_pattern(CSP_t &csp, + const std::vector &owned_set_per_cpu, + const MPI_Comm &mpi_comm, + const IndexSet &myrange) +{ + size_type myid = Utilities::MPI::this_mpi_process(mpi_comm); + + typedef std::map > map_vec_t; + map_vec_t send_data; + + { + unsigned int dest_cpu=0; + + size_type n_local_rel_rows = myrange.n_elements(); + for (size_type row_idx=0; row_idx &dst = send_data[dest_cpu]; + + dst.push_back(rlen); // number of entries + dst.push_back(row); // row index + for (size_type c=0; c send_to; + send_to.reserve(send_data.size()); + for (map_vec_t::iterator it=send_data.begin(); it!=send_data.end(); ++it) + send_to.push_back(it->first); + + num_receive = + Utilities::MPI:: + compute_point_to_point_communication_pattern(mpi_comm, send_to).size(); + } + + std::vector requests(send_data.size()); + + + // send data + { + unsigned int idx=0; + for (map_vec_t::iterator it=send_data.begin(); it!=send_data.end(); ++it, ++idx) + MPI_Isend(&(it->second[0]), + it->second.size(), + DEAL_II_DOF_INDEX_MPI_TYPE, + it->first, + 124, + mpi_comm, + &requests[idx]); + } + +//TODO: In the following, we read individual bytes and then reinterpret them +// as size_type objects. this is error prone. use properly typed reads that +// match the write above + { + //receive + std::vector recv_buf; + for (unsigned int index=0; index::const_iterator ptr = recv_buf.begin(); + std::vector::const_iterator end = recv_buf.end(); + while (ptr+1 +(BlockCompressedSimpleSparsityPattern &csp, + const std::vector &owned_set_per_cpu, + const MPI_Comm &mpi_comm, + const IndexSet &myrange); + #endif #undef SPARSITY_FUNCTIONS diff --git a/deal.II/source/lac/swappable_vector.cc b/deal.II/source/lac/swappable_vector.cc index 172fbcc863..8b69a06923 100644 --- a/deal.II/source/lac/swappable_vector.cc +++ b/deal.II/source/lac/swappable_vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/tridiagonal_matrix.cc b/deal.II/source/lac/tridiagonal_matrix.cc index 819545660d..06087be645 100644 --- a/deal.II/source/lac/tridiagonal_matrix.cc +++ b/deal.II/source/lac/tridiagonal_matrix.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2005, 2006, 2012 by the deal.II authors +// Copyright (C) 2005 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/lac/trilinos_block_sparse_matrix.cc b/deal.II/source/lac/trilinos_block_sparse_matrix.cc index 8db28fc610..b338de4186 100644 --- a/deal.II/source/lac/trilinos_block_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_block_sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -402,6 +404,11 @@ namespace TrilinosWrappers BlockSparseMatrix::reinit (const std::vector &, const dealii::BlockCompressedSimpleSparsityPattern &); + template void + BlockSparseMatrix::reinit (const std::vector &, + const dealii::BlockCompressedSimpleSparsityPattern &, + const MPI_Comm &); + } diff --git a/deal.II/source/lac/trilinos_block_vector.cc b/deal.II/source/lac/trilinos_block_vector.cc index aaa3eb830c..7344ec1199 100644 --- a/deal.II/source/lac/trilinos_block_vector.cc +++ b/deal.II/source/lac/trilinos_block_vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -57,6 +59,11 @@ namespace TrilinosWrappers BlockVector & BlockVector::operator = (const BlockVector &v) { + // we only allow assignment to vectors with the same number of blocks + // or to an empty BlockVector + Assert (n_blocks() == 0 || n_blocks() == v.n_blocks(), + ExcDimensionMismatch(n_blocks(), v.n_blocks())); + if (this->n_blocks() != v.n_blocks()) reinit(v.n_blocks()); @@ -136,6 +143,28 @@ namespace TrilinosWrappers collect_sizes(); } + void + BlockVector::reinit (const std::vector ¶llel_partitioning, + const std::vector &ghost_values, + const MPI_Comm &communicator) + { + const size_type no_blocks = parallel_partitioning.size(); + std::vector block_sizes (no_blocks); + + for (size_type i=0; iblock_indices.reinit (block_sizes); + if (components.size() != n_blocks()) + components.resize(n_blocks()); + + for (size_type i=0; i @@ -627,7 +629,7 @@ namespace TrilinosWrappers for (size_type d=0; d(n_rows), - 0, communicator)); + vector_distributor.reset (new Epetra_Map(static_cast(n_rows), + 0, communicator)); if (trilinos_matrix.get() == 0) trilinos_matrix.reset (new SparseMatrix()); @@ -743,6 +745,52 @@ namespace TrilinosWrappers const AdditionalData &, const double, const ::dealii::SparsityPattern *); + + + + /* -------------------------- PreconditionAMG -------------------------- */ + + void + PreconditionIdentity::vmult(VectorBase &dst, + const VectorBase &src) const + { + dst = src; + } + + void + PreconditionIdentity::Tvmult(VectorBase &dst, + const VectorBase &src) const + { + dst = src; + } + + void + PreconditionIdentity::vmult(dealii::Vector &dst, + const dealii::Vector &src) const + { + dst = src; + } + + void + PreconditionIdentity::Tvmult(dealii::Vector &dst, + const dealii::Vector &src) const + { + dst = src; + } + + void + PreconditionIdentity::vmult(parallel::distributed::Vector &dst, + const parallel::distributed::Vector &src) const + { + dst = src; + } + + void + PreconditionIdentity::Tvmult(parallel::distributed::Vector &dst, + const parallel::distributed::Vector &src) const + { + dst = src; + } } DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/lac/trilinos_solver.cc b/deal.II/source/lac/trilinos_solver.cc index 60ae66c5de..25edefb025 100644 --- a/deal.II/source/lac/trilinos_solver.cc +++ b/deal.II/source/lac/trilinos_solver.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2010, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -73,8 +75,6 @@ namespace TrilinosWrappers const VectorBase &b, const PreconditionBase &preconditioner) { - int ierr; - linear_problem.reset(); // We need an @@ -87,86 +87,30 @@ namespace TrilinosWrappers &x.trilinos_vector(), const_cast(&b.trilinos_vector()))); - // Next we can allocate the - // AztecOO solver... - solver.SetProblem(*linear_problem); - - // ... and we can specify the - // solver to be used. - switch (solver_name) - { - case cg: - solver.SetAztecOption(AZ_solver, AZ_cg); - break; - case cgs: - solver.SetAztecOption(AZ_solver, AZ_cgs); - break; - case gmres: - solver.SetAztecOption(AZ_solver, AZ_gmres); - solver.SetAztecOption(AZ_kspace, additional_data.gmres_restart_parameter); - break; - case bicgstab: - solver.SetAztecOption(AZ_solver, AZ_bicgstab); - break; - case tfqmr: - solver.SetAztecOption(AZ_solver, AZ_tfqmr); - break; - default: - Assert (false, ExcNotImplemented()); - } + execute_solve(preconditioner); + } - // Introduce the - // preconditioner, ... - ierr = solver.SetPrecOperator (const_cast - (preconditioner.preconditioner.get())); - AssertThrow (ierr == 0, ExcTrilinosError(ierr)); - // ... set some options, ... - solver.SetAztecOption (AZ_output, additional_data.output_solver_details ? - AZ_all : AZ_none); - solver.SetAztecOption (AZ_conv, AZ_noscaled); - // ... and then solve! - ierr = solver.Iterate (solver_control.max_steps(), - solver_control.tolerance()); - - // report errors in more detail - // than just by checking whether - // the return status is zero or - // greater. the error strings are - // taken from the implementation - // of the AztecOO::Iterate - // function - switch (ierr) - { - case -1: - AssertThrow (false, ExcMessage("AztecOO::Iterate error code -1: " - "option not implemented")); - case -2: - AssertThrow (false, ExcMessage("AztecOO::Iterate error code -2: " - "numerical breakdown")); - case -3: - AssertThrow (false, ExcMessage("AztecOO::Iterate error code -3: " - "loss of precision")); - case -4: - AssertThrow (false, ExcMessage("AztecOO::Iterate error code -4: " - "GMRES hessenberg ill-conditioned")); - default: - AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); - } + void + SolverBase::solve (Epetra_Operator &A, + VectorBase &x, + const VectorBase &b, + const PreconditionBase &preconditioner) + { + linear_problem.reset(); - // Finally, let the deal.II - // SolverControl object know - // what has happened. If the - // solve succeeded, the status - // of the solver control will - // turn into - // SolverControl::success. - solver_control.check (solver.NumIters(), solver.TrueResidual()); + // We need an + // Epetra_LinearProblem object + // to let the AztecOO solver + // know about the matrix and + // vectors. + linear_problem.reset + (new Epetra_LinearProblem(&A, + &x.trilinos_vector(), + const_cast(&b.trilinos_vector()))); - if (solver_control.last_check() != SolverControl::success) - throw SolverControl::NoConvergence (solver_control.last_step(), - solver_control.last_value()); + execute_solve(preconditioner); } @@ -177,8 +121,6 @@ namespace TrilinosWrappers const dealii::Vector &b, const PreconditionBase &preconditioner) { - int ierr; - linear_problem.reset(); // In case we call the solver with @@ -205,6 +147,39 @@ namespace TrilinosWrappers (const_cast(&A.trilinos_matrix()), &ep_x, &ep_b)); + execute_solve(preconditioner); + } + + + + void + SolverBase::solve (Epetra_Operator &A, + dealii::Vector &x, + const dealii::Vector &b, + const PreconditionBase &preconditioner) + { + linear_problem.reset(); + + Epetra_Vector ep_x (View, A.OperatorDomainMap(), x.begin()); + Epetra_Vector ep_b (View, A.OperatorRangeMap(), const_cast(b.begin())); + + // We need an + // Epetra_LinearProblem object + // to let the AztecOO solver + // know about the matrix and + // vectors. + linear_problem.reset (new Epetra_LinearProblem(&A,&ep_x, &ep_b)); + + execute_solve(preconditioner); + } + + + + void + SolverBase::execute_solve(const PreconditionBase &preconditioner) + { + int ierr; + // Next we can allocate the // AztecOO solver... solver.SetProblem(*linear_problem); @@ -233,11 +208,17 @@ namespace TrilinosWrappers Assert (false, ExcNotImplemented()); } - // Introduce the - // preconditioner, ... - ierr = solver.SetPrecOperator (const_cast - (preconditioner.preconditioner.get())); - AssertThrow (ierr == 0, ExcTrilinosError(ierr)); + // Introduce the preconditioner, + // if the identity preconditioner is used, + // the precondioner is set to none, ... + if (preconditioner.preconditioner.use_count()!=0) + { + ierr = solver.SetPrecOperator (const_cast + (preconditioner.preconditioner.get())); + AssertThrow (ierr == 0, ExcTrilinosError(ierr)); + } + else + solver.SetAztecOption(AZ_precond,AZ_none); // ... set some options, ... solver.SetAztecOption (AZ_output, additional_data.output_solver_details ? @@ -247,7 +228,31 @@ namespace TrilinosWrappers // ... and then solve! ierr = solver.Iterate (solver_control.max_steps(), solver_control.tolerance()); - AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); + + // report errors in more detail + // than just by checking whether + // the return status is zero or + // greater. the error strings are + // taken from the implementation + // of the AztecOO::Iterate + // function + switch (ierr) + { + case -1: + AssertThrow (false, ExcMessage("AztecOO::Iterate error code -1: " + "option not implemented")); + case -2: + AssertThrow (false, ExcMessage("AztecOO::Iterate error code -2: " + "numerical breakdown")); + case -3: + AssertThrow (false, ExcMessage("AztecOO::Iterate error code -3: " + "loss of precision")); + case -4: + AssertThrow (false, ExcMessage("AztecOO::Iterate error code -4: " + "GMRES hessenberg ill-conditioned")); + default: + AssertThrow (ierr >= 0, ExcTrilinosError(ierr)); + } // Finally, let the deal.II // SolverControl object know diff --git a/deal.II/source/lac/trilinos_sparse_matrix.cc b/deal.II/source/lac/trilinos_sparse_matrix.cc index 15076c9320..dddb391a86 100644 --- a/deal.II/source/lac/trilinos_sparse_matrix.cc +++ b/deal.II/source/lac/trilinos_sparse_matrix.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -438,8 +440,8 @@ namespace TrilinosWrappers { namespace { - // distinguish between compressed sparsity types that define row_begin() - // and SparsityPattern that uses begin() as iterator type + // distinguish between compressed sparsity types that define row_begin() + // and SparsityPattern that uses begin() as iterator type template void copy_row (const Sparsity &csp, const size_type row, @@ -499,7 +501,7 @@ namespace TrilinosWrappers column_space_map.reset (new Epetra_Map (input_col_map)); const size_type first_row = min_my_gid(input_row_map), - last_row = max_my_gid(input_row_map)+1; + last_row = max_my_gid(input_row_map)+1; std::vector n_entries_per_row(last_row-first_row); for (size_type row=first_row; row( - n_global_cols(*graph))); + n_global_cols(*graph))); // And now finally generate the matrix. matrix.reset (new Epetra_FECrsMatrix(Copy, *graph, false)); @@ -846,7 +848,7 @@ namespace TrilinosWrappers // Extract local indices in // the matrix. int trilinos_i = matrix->LRID(static_cast(i)), - trilinos_j = matrix->LCID(static_cast(j)); + trilinos_j = matrix->LCID(static_cast(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -921,7 +923,7 @@ namespace TrilinosWrappers // Extract local indices in // the matrix. int trilinos_i = matrix->LRID(static_cast(i)), - trilinos_j = matrix->LCID(static_cast(j)); + trilinos_j = matrix->LCID(static_cast(j)); TrilinosScalar value = 0.; // If the data is not on the @@ -1480,9 +1482,9 @@ namespace TrilinosWrappers SparseMatrix::memory_consumption () const { size_type static_memory = sizeof(this) + sizeof (*matrix) - + sizeof(*matrix->Graph().DataPtr()); + + sizeof(*matrix->Graph().DataPtr()); return ((sizeof(TrilinosScalar)+sizeof(TrilinosWrappers::types::int_type))* - matrix->NumMyNonzeros() + sizeof(int)*local_size() + static_memory); + matrix->NumMyNonzeros() + sizeof(int)*local_size() + static_memory); } } diff --git a/deal.II/source/lac/trilinos_sparse_matrix.inst.in b/deal.II/source/lac/trilinos_sparse_matrix.inst.in index 32fc182ad8..c145556104 100644 --- a/deal.II/source/lac/trilinos_sparse_matrix.inst.in +++ b/deal.II/source/lac/trilinos_sparse_matrix.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (S : REAL_SCALARS) diff --git a/deal.II/source/lac/trilinos_sparsity_pattern.cc b/deal.II/source/lac/trilinos_sparsity_pattern.cc index 3ad7872527..92d0789b74 100644 --- a/deal.II/source/lac/trilinos_sparsity_pattern.cc +++ b/deal.II/source/lac/trilinos_sparsity_pattern.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -53,7 +55,7 @@ namespace TrilinosWrappers return graph.NumGlobalRows(); } - int n_global_cols(const Epetra_CrsGraph &graph) + int n_global_cols(const Epetra_CrsGraph &graph) { return graph.NumGlobalCols(); } @@ -67,7 +69,7 @@ namespace TrilinosWrappers { return graph.GRID(i); } - #else +#else long long int n_global_elements (const Epetra_BlockMap &map) { return map.NumGlobalElements64(); @@ -146,7 +148,7 @@ namespace TrilinosWrappers // would it point to?) Assert (ncols != 0, ExcInternalError()); colnum_cache.reset (new std::vector (colnums, - colnums+ncols)); + colnums+ncols)); } } @@ -167,12 +169,12 @@ namespace TrilinosWrappers compressed (true) { column_space_map.reset(new Epetra_Map (TrilinosWrappers::types::int_type(0), - TrilinosWrappers::types::int_type(0), - Utilities::Trilinos::comm_self())); + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())); graph.reset (new Epetra_FECrsGraph(View, - *column_space_map, - *column_space_map, - 0)); + *column_space_map, + *column_space_map, + 0)); graph->FillComplete(); } @@ -234,13 +236,13 @@ namespace TrilinosWrappers : Subscriptor(), column_space_map (new Epetra_Map(TrilinosWrappers::types::int_type(0), - TrilinosWrappers::types::int_type(0), - Utilities::Trilinos::comm_self())), + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())), compressed (false), graph (new Epetra_FECrsGraph(View, - *column_space_map, *column_space_map, - 0)) + *column_space_map, + 0)) { Assert (input_sparsity.n_rows() == 0, ExcMessage ("Copy constructor only works for empty sparsity patterns.")); @@ -267,9 +269,9 @@ namespace TrilinosWrappers const size_type n_entries_per_row) { const Epetra_Map rows (TrilinosWrappers::types::int_type(m), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); const Epetra_Map columns (TrilinosWrappers::types::int_type(n), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } @@ -319,9 +321,9 @@ namespace TrilinosWrappers const std::vector &n_entries_per_row) { const Epetra_Map rows (TrilinosWrappers::types::int_type(m), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); const Epetra_Map columns (TrilinosWrappers::types::int_type(n), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); reinit (rows, columns, n_entries_per_row); } @@ -369,8 +371,8 @@ namespace TrilinosWrappers namespace { typedef dealii::types::global_dof_index size_type; - // distinguish between compressed sparsity types that define row_begin() - // and SparsityPattern that uses begin() as iterator type + // distinguish between compressed sparsity types that define row_begin() + // and SparsityPattern that uses begin() as iterator type template void copy_row (const Sparsity &csp, const size_type row, @@ -415,11 +417,11 @@ namespace TrilinosWrappers ExcMessage ("This function is not efficient if the map is not contiguous.")); const size_type first_row = min_my_gid(input_row_map), - last_row = max_my_gid(input_row_map)+1; + last_row = max_my_gid(input_row_map)+1; std::vector n_entries_per_row(last_row - first_row); - // Trilinos wants the row length as an int - // this is hopefully never going to be a problem. + // Trilinos wants the row length as an int + // this is hopefully never going to be a problem. for (size_type row=first_row; row(sp.row_length(row)); @@ -485,9 +487,9 @@ namespace TrilinosWrappers SparsityPattern::copy_from (const SparsityType &sp) { const Epetra_Map rows (TrilinosWrappers::types::int_type(sp.n_rows()), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); const Epetra_Map columns (TrilinosWrappers::types::int_type(sp.n_cols()), 0, - Utilities::Trilinos::comm_self()); + Utilities::Trilinos::comm_self()); reinit (rows, columns, sp); } @@ -501,8 +503,8 @@ namespace TrilinosWrappers // the pointer and generate an // empty sparsity pattern. column_space_map.reset (new Epetra_Map (TrilinosWrappers::types::int_type(0), - TrilinosWrappers::types::int_type(0), - Utilities::Trilinos::comm_self())); + TrilinosWrappers::types::int_type(0), + Utilities::Trilinos::comm_self())); graph.reset (new Epetra_FECrsGraph(View, *column_space_map, *column_space_map, 0)); graph->FillComplete(); @@ -538,7 +540,7 @@ namespace TrilinosWrappers // Extract local indices in // the matrix. int trilinos_i = graph->LRID(static_cast(i)), - trilinos_j = graph->LCID(static_cast(j)); + trilinos_j = graph->LCID(static_cast(j)); // If the data is not on the // present processor, we throw @@ -564,12 +566,12 @@ namespace TrilinosWrappers // Generate the view and make // sure that we have not generated // an error. - // TODO: trilinos_i is the local row index -> it is an int but + // TODO: trilinos_i is the local row index -> it is an int but // ExtractGlobalRowView requires trilinos_i to be the global row // index and thus it should be a long long int int ierr = graph->ExtractGlobalRowView( - static_cast(trilinos_i), - nnz_extracted, col_indices); + static_cast(trilinos_i), + nnz_extracted, col_indices); Assert (ierr==0, ExcTrilinosError(ierr)); Assert (nnz_present == nnz_extracted, ExcDimensionMismatch(nnz_present, nnz_extracted)); @@ -589,7 +591,7 @@ namespace TrilinosWrappers // Prepare pointers for extraction // of a view of the row. int nnz_present = graph->NumGlobalIndices( - static_cast(i)); + static_cast(i)); int nnz_extracted; int *col_indices; @@ -597,7 +599,7 @@ namespace TrilinosWrappers // sure that we have not generated // an error. int ierr = graph->ExtractMyRowView(trilinos_i, - nnz_extracted, col_indices); + nnz_extracted, col_indices); Assert (ierr==0, ExcTrilinosError(ierr)); Assert (nnz_present == nnz_extracted, @@ -605,7 +607,7 @@ namespace TrilinosWrappers // Search the index int *el_find = std::find(col_indices, col_indices + nnz_present, - static_cast(trilinos_j)); + static_cast(trilinos_j)); int local_col_index = (int)(el_find - col_indices); @@ -781,7 +783,7 @@ namespace TrilinosWrappers // x-y, that is we have to exchange // the order of output out << indices[global_row_index(*graph,static_cast(j))] - << " " << -static_cast(row) << std::endl; + << " " << -static_cast(row) << std::endl; } AssertThrow (out, ExcIO()); diff --git a/deal.II/source/lac/trilinos_vector.cc b/deal.II/source/lac/trilinos_vector.cc index 99b65221f7..a8b0265287 100644 --- a/deal.II/source/lac/trilinos_vector.cc +++ b/deal.II/source/lac/trilinos_vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2009, 2012, 2013 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include @@ -44,12 +46,12 @@ namespace TrilinosWrappers // by calling either the 32- or 64-bit function necessary, and returns the // result in the correct data type so that we can use it in calling other // Epetra member functions that are overloaded by index type - int* my_global_elements(const Epetra_BlockMap &map) + int *my_global_elements(const Epetra_BlockMap &map) { - return map.MyGlobalElements(); + return map.MyGlobalElements(); } // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. int global_length(const Epetra_FEVector &vector) { @@ -69,12 +71,12 @@ namespace TrilinosWrappers // by calling either the 32- or 64-bit function necessary, and returns the // result in the correct data type so that we can use it in calling other // Epetra member functions that are overloaded by index type - long long int* my_global_elements(const Epetra_BlockMap &map) + long long int *my_global_elements(const Epetra_BlockMap &map) { - return map.MyGlobalElements64(); + return map.MyGlobalElements64(); } // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. long long int global_length(const Epetra_FEVector &vector) { @@ -127,8 +129,8 @@ namespace TrilinosWrappers VectorBase() { AssertThrow (n_global_elements(input_map) == n_global_elements(v.vector->Map()), - ExcDimensionMismatch (n_global_elements(input_map), - n_global_elements(v.vector->Map()))); + ExcDimensionMismatch (n_global_elements(input_map), + n_global_elements(v.vector->Map()))); last_action = Zero; @@ -149,7 +151,7 @@ namespace TrilinosWrappers : VectorBase() { - AssertThrow (parallel_partitioner.size() == + AssertThrow (parallel_partitioner.size() == static_cast(n_global_elements(v.vector->Map())), ExcDimensionMismatch (parallel_partitioner.size(), n_global_elements(v.vector->Map()))); @@ -162,6 +164,17 @@ namespace TrilinosWrappers reinit (v, false, true); } + Vector::Vector (const IndexSet &local, + const IndexSet &ghost, + const MPI_Comm &communicator) + : + VectorBase() + { + IndexSet parallel_partitioning = local; + parallel_partitioning.add_indices(ghost); + reinit(parallel_partitioning, communicator); + } + Vector::~Vector () @@ -336,6 +349,13 @@ namespace TrilinosWrappers } + void Vector::reinit(const IndexSet &local, const IndexSet &ghost, const MPI_Comm &communicator) + { + IndexSet parallel_partitioning = local; + parallel_partitioning.add_indices(ghost); + reinit(parallel_partitioning, communicator); + } + Vector & Vector::operator = (const Vector &v) diff --git a/deal.II/source/lac/trilinos_vector_base.cc b/deal.II/source/lac/trilinos_vector_base.cc index c2695901ee..a04d816612 100644 --- a/deal.II/source/lac/trilinos_vector_base.cc +++ b/deal.II/source/lac/trilinos_vector_base.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -29,7 +31,7 @@ namespace TrilinosWrappers { #ifndef DEAL_II_USE_LARGE_INDEX_TYPE // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. int global_length(const Epetra_FEVector &vector) { @@ -37,7 +39,7 @@ namespace TrilinosWrappers } #else // define a helper function that queries the global vector length of an - // Epetra_FEVector object by calling either the 32- or 64-bit + // Epetra_FEVector object by calling either the 32- or 64-bit // function necessary. long long int global_length(const Epetra_FEVector &vector) { @@ -61,7 +63,7 @@ namespace TrilinosWrappers // we can use []. Note that we // can only get local values. - const TrilinosWrappers::types::int_type local_index = + const TrilinosWrappers::types::int_type local_index = vector.vector->Map().LID(static_cast(index)); Assert (local_index >= 0, ExcAccessToNonLocalElement (index, @@ -189,7 +191,7 @@ namespace TrilinosWrappers { // Extract local indices in // the vector. - TrilinosWrappers::types::int_type trilinos_i = + TrilinosWrappers::types::int_type trilinos_i = vector->Map().LID(static_cast(index)); TrilinosScalar value = 0.; @@ -218,7 +220,7 @@ namespace TrilinosWrappers { // Extract local indices in // the vector. - TrilinosWrappers::types::int_type trilinos_i = + TrilinosWrappers::types::int_type trilinos_i = vector->Map().LID(static_cast(index)); TrilinosScalar value = 0.; @@ -447,7 +449,7 @@ namespace TrilinosWrappers //entry. return sizeof(*this) + this->local_size()*( sizeof(double)+ - sizeof(TrilinosWrappers::types::int_type) ); + sizeof(TrilinosWrappers::types::int_type) ); } } /* end of namespace TrilinosWrappers */ diff --git a/deal.II/source/lac/trilinos_vector_base.inst.in b/deal.II/source/lac/trilinos_vector_base.inst.in index 976e0bd070..9c4d495f91 100644 --- a/deal.II/source/lac/trilinos_vector_base.inst.in +++ b/deal.II/source/lac/trilinos_vector_base.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2008 by the deal.II authors +// Copyright (C) 2008 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (SCALAR : REAL_SCALARS) diff --git a/deal.II/source/lac/vector.cc b/deal.II/source/lac/vector.cc index 57fcef309c..63d5aecdf0 100644 --- a/deal.II/source/lac/vector.cc +++ b/deal.II/source/lac/vector.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/vector.inst.in b/deal.II/source/lac/vector.inst.in index 73bdab2d77..ac8514b522 100644 --- a/deal.II/source/lac/vector.inst.in +++ b/deal.II/source/lac/vector.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (SCALAR : REAL_SCALARS) diff --git a/deal.II/source/lac/vector_memory.cc b/deal.II/source/lac/vector_memory.cc index 0ca33b4065..ecc97a6b0d 100644 --- a/deal.II/source/lac/vector_memory.cc +++ b/deal.II/source/lac/vector_memory.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/lac/vector_memory.inst.in b/deal.II/source/lac/vector_memory.inst.in index 39228c1fdd..32f15b0e4c 100644 --- a/deal.II/source/lac/vector_memory.inst.in +++ b/deal.II/source/lac/vector_memory.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (VECTOR : SERIAL_VECTORS) diff --git a/deal.II/source/lac/vector_view.cc b/deal.II/source/lac/vector_view.cc index 4850d5eaf2..f00d31abd6 100644 --- a/deal.II/source/lac/vector_view.cc +++ b/deal.II/source/lac/vector_view.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include diff --git a/deal.II/source/lac/vector_view.inst.in b/deal.II/source/lac/vector_view.inst.in index 7971632165..8475af26db 100644 --- a/deal.II/source/lac/vector_view.inst.in +++ b/deal.II/source/lac/vector_view.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (SCALAR : REAL_SCALARS) diff --git a/deal.II/source/matrix_free/CMakeLists.txt b/deal.II/source/matrix_free/CMakeLists.txt index 57fc6dfe66..b3fe95a237 100644 --- a/deal.II/source/matrix_free/CMakeLists.txt +++ b/deal.II/source/matrix_free/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/matrix_free/*.h - ) - SET(_src matrix_free.cc ) @@ -26,5 +24,9 @@ SET(_inst matrix_free.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/matrix_free/*.h + ) + DEAL_II_ADD_LIBRARY(obj_matrix_free OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_matrix_free "${_inst}") diff --git a/deal.II/source/matrix_free/matrix_free.cc b/deal.II/source/matrix_free/matrix_free.cc index 0d12293cc6..265b93c542 100644 --- a/deal.II/source/matrix_free/matrix_free.cc +++ b/deal.II/source/matrix_free/matrix_free.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2011 by the deal.II authors +// Copyright (C) 2011 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/matrix_free/matrix_free.inst.in b/deal.II/source/matrix_free/matrix_free.inst.in index 3c2dee08e8..2b8d9aac8c 100644 --- a/deal.II/source/matrix_free/matrix_free.inst.in +++ b/deal.II/source/matrix_free/matrix_free.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/meshworker/CMakeLists.txt b/deal.II/source/meshworker/CMakeLists.txt index e33ac0ef50..7819483220 100644 --- a/deal.II/source/meshworker/CMakeLists.txt +++ b/deal.II/source/meshworker/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## ## Copyright (C) 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/meshworker/*.h - ) - SET(_src mesh_worker.cc mesh_worker_info.cc @@ -29,5 +27,9 @@ SET(_inst mesh_worker_vector_selector.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/meshworker/*.h + ) + DEAL_II_ADD_LIBRARY(obj_meshworker OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_meshworker "${_inst}") diff --git a/deal.II/source/meshworker/mesh_worker.cc b/deal.II/source/meshworker/mesh_worker.cc index 211a7e5764..f2bbd879f5 100644 --- a/deal.II/source/meshworker/mesh_worker.cc +++ b/deal.II/source/meshworker/mesh_worker.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2006 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -61,10 +66,46 @@ namespace MeshWorker {} + template + LocalIntegrator::LocalIntegrator (bool c, bool b, bool f) + : + use_cell(c), use_boundary(b), use_face(f) + {} + + template LocalIntegrator::~LocalIntegrator () {} + template + void + LocalIntegrator::cell (DoFInfo &, + IntegrationInfo &) const + { + Assert(false, ExcPureFunction()); + } + + + template + void + LocalIntegrator::boundary (DoFInfo &, + IntegrationInfo &) const + { + Assert(false, ExcPureFunction()); + } + + + template + void + LocalIntegrator::face (DoFInfo &, + DoFInfo &, + IntegrationInfo &, + IntegrationInfo &) const + { + Assert(false, ExcPureFunction()); + } + + template class LocalIntegrator<1,1,float>; template class LocalIntegrator<1,1,double>; template class LocalIntegrator<1,2,float>; diff --git a/deal.II/source/meshworker/mesh_worker_info.cc b/deal.II/source/meshworker/mesh_worker_info.cc index a02e9a572c..8ad40c5205 100644 --- a/deal.II/source/meshworker/mesh_worker_info.cc +++ b/deal.II/source/meshworker/mesh_worker_info.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/meshworker/mesh_worker_info.inst.in b/deal.II/source/meshworker/mesh_worker_info.inst.in index d0225173a2..f23c25e24f 100644 --- a/deal.II/source/meshworker/mesh_worker_info.inst.in +++ b/deal.II/source/meshworker/mesh_worker_info.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/meshworker/mesh_worker_vector_selector.cc b/deal.II/source/meshworker/mesh_worker_vector_selector.cc index df72c651ac..36d58a446a 100644 --- a/deal.II/source/meshworker/mesh_worker_vector_selector.cc +++ b/deal.II/source/meshworker/mesh_worker_vector_selector.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/meshworker/mesh_worker_vector_selector.inst.in b/deal.II/source/meshworker/mesh_worker_vector_selector.inst.in index 3b545d35eb..4de6186fc8 100644 --- a/deal.II/source/meshworker/mesh_worker_vector_selector.inst.in +++ b/deal.II/source/meshworker/mesh_worker_vector_selector.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) @@ -24,6 +29,8 @@ for (VECTOR : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS) namespace MeshWorker \{ template class VectorData; + template class VectorData; template class MGVectorData; + template class MGVectorData; \} } diff --git a/deal.II/source/multigrid/CMakeLists.txt b/deal.II/source/multigrid/CMakeLists.txt index 27c0307d6f..36738e2b50 100644 --- a/deal.II/source/multigrid/CMakeLists.txt +++ b/deal.II/source/multigrid/CMakeLists.txt @@ -1,23 +1,21 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012, 2013 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/multigrid/*.h - ) - SET(_src mg_base.cc mg_dof_handler.cc @@ -38,5 +36,9 @@ SET(_inst multigrid.inst.in ) +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/multigrid/*.h + ) + DEAL_II_ADD_LIBRARY(obj_multigrid OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_multigrid "${_inst}") diff --git a/deal.II/source/multigrid/mg_base.cc b/deal.II/source/multigrid/mg_base.cc index fe5435bac4..424e043082 100644 --- a/deal.II/source/multigrid/mg_base.cc +++ b/deal.II/source/multigrid/mg_base.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2010, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/multigrid/mg_base.inst.in b/deal.II/source/multigrid/mg_base.inst.in index 6697887ffd..7446bc6e32 100644 --- a/deal.II/source/multigrid/mg_base.inst.in +++ b/deal.II/source/multigrid/mg_base.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id: vector_tools.inst.in 26105 2012-08-23 22:10:05Z heister $ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (VEC : SERIAL_VECTORS) { diff --git a/deal.II/source/multigrid/mg_dof_handler.cc b/deal.II/source/multigrid/mg_dof_handler.cc index 0d0e84c53a..ca6c9c0831 100644 --- a/deal.II/source/multigrid/mg_dof_handler.cc +++ b/deal.II/source/multigrid/mg_dof_handler.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/multigrid/mg_dof_handler.inst.in b/deal.II/source/multigrid/mg_dof_handler.inst.in index 8ae02f0e91..52779b60d5 100644 --- a/deal.II/source/multigrid/mg_dof_handler.inst.in +++ b/deal.II/source/multigrid/mg_dof_handler.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/multigrid/mg_tools.cc b/deal.II/source/multigrid/mg_tools.cc index 07b15f52a4..5d74887ef2 100644 --- a/deal.II/source/multigrid/mg_tools.cc +++ b/deal.II/source/multigrid/mg_tools.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -589,6 +591,8 @@ namespace MGTools endc = dof.end(level); for (; cell!=endc; ++cell) { + if (!cell->is_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // make sparsity pattern for this cell for (unsigned int i=0; i=1) && (level=1) && (levelis_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // Loop over all interior neighbors for (unsigned int face = 0; @@ -740,6 +746,8 @@ namespace MGTools for (; cell!=endc; ++cell) { + if (!cell->is_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // make sparsity pattern for this cell for (unsigned int i=0; i &fe = dof.get_fe(); const unsigned int n_comp = fe.n_components(); - Assert ((level>=1) && (level=1) && (levelis_locally_owned_on_level()) continue; + cell->get_mg_dof_indices (dofs_on_this_cell); // Loop over all interior neighbors for (unsigned int face = 0; @@ -950,7 +960,7 @@ namespace MGTools { const FiniteElement &fe = dof_handler.get_fe(); const unsigned int n_components = fe.n_components(); - const unsigned int nlevels = dof_handler.get_tria().n_levels(); + const unsigned int nlevels = dof_handler.get_tria().n_global_levels(); Assert (result.size() == nlevels, ExcDimensionMismatch(result.size(), nlevels)); @@ -1064,7 +1074,7 @@ namespace MGTools { const FiniteElement &fe = dof_handler.get_fe(); const unsigned int n_blocks = fe.n_blocks(); - const unsigned int n_levels = dof_handler.get_tria().n_levels(); + const unsigned int n_levels = dof_handler.get_tria().n_global_levels(); AssertDimension (dofs_per_block.size(), n_levels); @@ -1177,7 +1187,7 @@ namespace MGTools if (function_map.size() == 0) return; - const unsigned int n_levels = dof.get_tria().n_levels(); + const unsigned int n_levels = dof.get_tria().n_global_levels(); @@ -1238,120 +1248,120 @@ namespace MGTools for (; cell!=endc; ++cell) if (dof.get_tria().locally_owned_subdomain()==numbers::invalid_subdomain_id || cell->level_subdomain_id()==dof.get_tria().locally_owned_subdomain()) - for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; - ++face_no) - { - if (cell->at_boundary(face_no) == false) - continue; + for (unsigned int face_no = 0; face_no < GeometryInfo::faces_per_cell; + ++face_no) + { + if (cell->at_boundary(face_no) == false) + continue; - const FiniteElement &fe = cell->get_fe(); - const unsigned int level = cell->level(); - - // we can presently deal only with - // primitive elements for boundary - // values. this does not preclude - // us using non-primitive elements - // in components that we aren't - // interested in, however. make - // sure that all shape functions - // that are non-zero for the - // components we are interested in, - // are in fact primitive - for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) - { - const ComponentMask &nonzero_component_array - = cell->get_fe().get_nonzero_components (i); - for (unsigned int c=0; cget_fe().is_primitive (i), - ExcMessage ("This function can only deal with requested boundary " - "values that correspond to primitive (scalar) base " - "elements")); - } + const FiniteElement &fe = cell->get_fe(); + const unsigned int level = cell->level(); + + // we can presently deal only with + // primitive elements for boundary + // values. this does not preclude + // us using non-primitive elements + // in components that we aren't + // interested in, however. make + // sure that all shape functions + // that are non-zero for the + // components we are interested in, + // are in fact primitive + for (unsigned int i=0; iget_fe().dofs_per_cell; ++i) + { + const ComponentMask &nonzero_component_array + = cell->get_fe().get_nonzero_components (i); + for (unsigned int c=0; cget_fe().is_primitive (i), + ExcMessage ("This function can only deal with requested boundary " + "values that correspond to primitive (scalar) base " + "elements")); + } - typename DoFHandler::face_iterator face = cell->face(face_no); - const types::boundary_id boundary_component = face->boundary_indicator(); - if (function_map.find(boundary_component) != function_map.end()) - // face is of the right component - { - // get indices, physical location and - // boundary values of dofs on this - // face - local_dofs.resize (fe.dofs_per_face); - face->get_mg_dof_indices (level, local_dofs); - if (fe_is_system) - { - // enter those dofs - // into the list that - // match the - // component - // signature. avoid - // the usual - // complication that - // we can't just use - // *_system_to_component_index - // for non-primitive - // FEs - for (unsigned int i=0; i::face_iterator face = cell->face(face_no); + const types::boundary_id boundary_component = face->boundary_indicator(); + if (function_map.find(boundary_component) != function_map.end()) + // face is of the right component + { + // get indices, physical location and + // boundary values of dofs on this + // face + local_dofs.resize (fe.dofs_per_face); + face->get_mg_dof_indices (level, local_dofs); + if (fe_is_system) + { + // enter those dofs + // into the list that + // match the + // component + // signature. avoid + // the usual + // complication that + // we can't just use + // *_system_to_component_index + // for non-primitive + // FEs + for (unsigned int i=0; i &boundary_indices, const ComponentMask &component_mask) { - Assert (boundary_indices.size() == dof.get_tria().n_levels(), + Assert (boundary_indices.size() == dof.get_tria().n_global_levels(), ExcDimensionMismatch (boundary_indices.size(), - dof.get_tria().n_levels())); + dof.get_tria().n_global_levels())); std::vector > - my_boundary_indices (dof.get_tria().n_levels()); + my_boundary_indices (dof.get_tria().n_global_levels()); make_boundary_list (dof, function_map, my_boundary_indices, component_mask); - for (unsigned int i=0; i &mg_dof_handler, std::vector > &interface_dofs) { - Assert (interface_dofs.size() == mg_dof_handler.get_tria().n_levels(), + Assert (interface_dofs.size() == mg_dof_handler.get_tria().n_global_levels(), ExcDimensionMismatch (interface_dofs.size(), - mg_dof_handler.get_tria().n_levels())); + mg_dof_handler.get_tria().n_global_levels())); - for (unsigned int l=0; l &mg_dof_handler, std::vector > &non_interface_dofs) { - Assert (non_interface_dofs.size() == mg_dof_handler.get_tria().n_levels(), + Assert (non_interface_dofs.size() == mg_dof_handler.get_tria().n_global_levels(), ExcDimensionMismatch (non_interface_dofs.size(), - mg_dof_handler.get_tria().n_levels())); + mg_dof_handler.get_tria().n_global_levels())); const FiniteElement &fe = mg_dof_handler.get_fe(); @@ -1545,14 +1555,14 @@ namespace MGTools std::vector > &interface_dofs, std::vector > &boundary_interface_dofs) { - Assert (interface_dofs.size() == mg_dof_handler.get_tria().n_levels(), + Assert (interface_dofs.size() == mg_dof_handler.get_tria().n_global_levels(), ExcDimensionMismatch (interface_dofs.size(), - mg_dof_handler.get_tria().n_levels())); - Assert (boundary_interface_dofs.size() == mg_dof_handler.get_tria().n_levels(), + mg_dof_handler.get_tria().n_global_levels())); + Assert (boundary_interface_dofs.size() == mg_dof_handler.get_tria().n_global_levels(), ExcDimensionMismatch (boundary_interface_dofs.size(), - mg_dof_handler.get_tria().n_levels())); + mg_dof_handler.get_tria().n_global_levels())); - for (unsigned int l=0; l diff --git a/deal.II/source/multigrid/mg_transfer_block.inst.in b/deal.II/source/multigrid/mg_transfer_block.inst.in index 466aac4c48..6bff38e9f7 100644 --- a/deal.II/source/multigrid/mg_transfer_block.inst.in +++ b/deal.II/source/multigrid/mg_transfer_block.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/multigrid/mg_transfer_component.cc b/deal.II/source/multigrid/mg_transfer_component.cc index a6c41c3e80..1be8a299e6 100644 --- a/deal.II/source/multigrid/mg_transfer_component.cc +++ b/deal.II/source/multigrid/mg_transfer_component.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/multigrid/mg_transfer_component.inst.in b/deal.II/source/multigrid/mg_transfer_component.inst.in index 272f78d852..6c53ccb816 100644 --- a/deal.II/source/multigrid/mg_transfer_component.inst.in +++ b/deal.II/source/multigrid/mg_transfer_component.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/multigrid/mg_transfer_prebuilt.cc b/deal.II/source/multigrid/mg_transfer_prebuilt.cc index 6525146ac6..b1fb5910fc 100644 --- a/deal.II/source/multigrid/mg_transfer_prebuilt.cc +++ b/deal.II/source/multigrid/mg_transfer_prebuilt.cc @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 by the deal.II authors +// Copyright (C) 2003 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include @@ -146,8 +151,8 @@ void MGTransferPrebuilt::build_matrices ( cell != mg_dof.end(level); ++cell) if (cell->has_children() && ( mg_dof.get_tria().locally_owned_subdomain()==numbers::invalid_subdomain_id - || cell->level_subdomain_id()==mg_dof.get_tria().locally_owned_subdomain() - )) + || cell->level_subdomain_id()==mg_dof.get_tria().locally_owned_subdomain() + )) { cell->get_mg_dof_indices (dof_indices_parent); @@ -180,23 +185,23 @@ void MGTransferPrebuilt::build_matrices ( } } } - + internal::MatrixSelector::reinit(*prolongation_matrices[level], - *prolongation_sparsities[level], - level, - csp, - mg_dof); + *prolongation_sparsities[level], + level, + csp, + mg_dof); csp.reinit(0,0); - + FullMatrix prolongation; - + // now actually build the matrices for (typename DoFHandler::cell_iterator cell=mg_dof.begin(level); cell != mg_dof.end(level); ++cell) if (cell->has_children() && (mg_dof.get_tria().locally_owned_subdomain()==numbers::invalid_subdomain_id || cell->level_subdomain_id()==mg_dof.get_tria().locally_owned_subdomain()) - ) + ) { cell->get_mg_dof_indices (dof_indices_parent); @@ -210,12 +215,12 @@ void MGTransferPrebuilt::build_matrices ( prolongation = mg_dof.get_fe().get_prolongation_matrix (child, cell->refinement_case()); - - if (mg_constrained_dofs != 0 && mg_constrained_dofs->set_boundary_values()) - for (unsigned int j=0;jis_boundary_index(level, dof_indices_parent[j])) - for (unsigned int i=0; iset_boundary_values()) + for (unsigned int j=0; jis_boundary_index(level, dof_indices_parent[j])) + for (unsigned int i=0; ichild(child)->get_mg_dof_indices (dof_indices_child); @@ -238,9 +243,9 @@ void MGTransferPrebuilt::build_matrices ( // of the global and mgdof, so that we later not access non-local elements // in copy_to/from_mg. // We keep track in the bitfield dof_touched which global dof has - // been processed already (on the current level). This is the same as + // been processed already (on the current level). This is the same as // the multigrid running in serial. - // Only entering on the finest level gives wrong results (why?) + // Only entering on the finest level gives wrong results (why?) copy_indices.resize(n_levels); copy_indices_from_me.resize(n_levels); @@ -267,8 +272,8 @@ void MGTransferPrebuilt::build_matrices ( { if (mg_dof.get_tria().locally_owned_subdomain()!=numbers::invalid_subdomain_id && (level_cell->level_subdomain_id()==numbers::artificial_subdomain_id - || level_cell->subdomain_id()==numbers::artificial_subdomain_id) - ) + || level_cell->subdomain_id()==numbers::artificial_subdomain_id) + ) continue; // get the dof numbers of this cell for the global and the level-wise @@ -291,13 +296,13 @@ void MGTransferPrebuilt::build_matrices ( if (global_mine && level_mine) copy_indices[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::pair (global_dof_indices[i], level_dof_indices[i])); else if (level_mine) copy_indices_from_me[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::pair (global_dof_indices[i], level_dof_indices[i])); else if (global_mine) copy_indices_to_me[level].push_back( - std::pair (global_dof_indices[i], level_dof_indices[i])); + std::pair (global_dof_indices[i], level_dof_indices[i])); else continue; @@ -310,11 +315,11 @@ void MGTransferPrebuilt::build_matrices ( // more reliable output for regression texts #ifdef DEBUG std::less > compare; - for (unsigned int level=0;level::build_matrices ( template void -MGTransferPrebuilt::print_matrices (std::ostream& os) const +MGTransferPrebuilt::print_matrices (std::ostream &os) const { - for (unsigned int level = 0;levelprint(os); @@ -334,26 +339,26 @@ MGTransferPrebuilt::print_matrices (std::ostream& os) const template void -MGTransferPrebuilt::print_indices (std::ostream& os) const +MGTransferPrebuilt::print_indices (std::ostream &os) const { - for (unsigned int level = 0;level diff --git a/deal.II/source/multigrid/multigrid.inst.in b/deal.II/source/multigrid/multigrid.inst.in index 9623c2413a..f74b685f14 100644 --- a/deal.II/source/multigrid/multigrid.inst.in +++ b/deal.II/source/multigrid/multigrid.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id: vector_tools.inst.in 26105 2012-08-23 22:10:05Z heister $ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2012 by the deal.II authors +// Copyright (C) 2012 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (VEC : SERIAL_VECTORS) { diff --git a/deal.II/source/numerics/CMakeLists.txt b/deal.II/source/numerics/CMakeLists.txt index d2d500f71b..3f8b5fa7af 100644 --- a/deal.II/source/numerics/CMakeLists.txt +++ b/deal.II/source/numerics/CMakeLists.txt @@ -1,43 +1,53 @@ -##### +## --------------------------------------------------------------------- +## $Id$ ## -## Copyright (C) 2012 by the deal.II authors +## Copyright (C) 2012 - 2013 by the deal.II authors ## ## This file is part of the deal.II library. ## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. ## -## Author: Matthias Maier -## -##### +## --------------------------------------------------------------------- INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -FILE(GLOB _header - ${CMAKE_SOURCE_DIR}/include/deal.II/numerics/*.h - ) - SET(_src data_out.cc + data_out_dof_data.cc data_out_faces.cc data_out_rotation.cc data_out_stack.cc data_postprocessor.cc derivative_approximation.cc dof_output_operator.cc + error_estimator_1d.cc error_estimator.cc fe_field_function.cc - matrix_tools.cc histogram.cc + matrix_tools.cc point_value_history.cc solution_transfer.cc solution_transfer_inst2.cc + solution_transfer_inst3.cc + solution_transfer_inst4.cc time_dependent.cc - vector_tools.cc + vector_tools_boundary.cc + vector_tools_constraints.cc + vector_tools_integrate_difference.cc + vector_tools_interpolate.cc + vector_tools_mean_value.cc + vector_tools_point_value.cc + vector_tools_project.cc + vector_tools_rhs.cc ) SET(_inst + data_out_dof_data.inst.in data_out_faces.inst.in data_out.inst.in data_out_rotation.inst.in @@ -45,15 +55,26 @@ SET(_inst data_postprocessor.inst.in derivative_approximation.inst.in dof_output_operator.inst.in + error_estimator_1d.inst.in error_estimator.inst.in fe_field_function.inst.in matrix_tools.inst.in point_value_history.inst.in solution_transfer.inst.in time_dependent.inst.in - vector_tools.inst.in + vector_tools_boundary.inst.in + vector_tools_constraints.inst.in + vector_tools_integrate_difference.inst.in + vector_tools_interpolate.inst.in + vector_tools_mean_value.inst.in + vector_tools_point_value.inst.in + vector_tools_project.inst.in + vector_tools_rhs.inst.in + ) + +FILE(GLOB _header + ${CMAKE_SOURCE_DIR}/include/deal.II/numerics/*.h ) DEAL_II_ADD_LIBRARY(obj_numerics OBJECT ${_src} ${_header} ${_inst}) EXPAND_INSTANTIATIONS(obj_numerics "${_inst}") - diff --git a/deal.II/source/numerics/data_out.cc b/deal.II/source/numerics/data_out.cc index 38f67b7efc..c541739d45 100644 --- a/deal.II/source/numerics/data_out.cc +++ b/deal.II/source/numerics/data_out.cc @@ -1,28 +1,20 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include #include @@ -30,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -44,41 +37,30 @@ namespace internal namespace DataOut { template - template ParallelData:: - ParallelData (const Quadrature &quadrature, - const unsigned int n_components, - const unsigned int n_datasets, + ParallelData (const unsigned int n_datasets, const unsigned int n_subdivisions, const std::vector &n_postprocessor_outputs, const Mapping &mapping, - const std::vector > &cell_to_patch_index_map, - const FE &finite_elements, - const UpdateFlags update_flags) + const std::vector > > &finite_elements, + const UpdateFlags update_flags, + const std::vector > &cell_to_patch_index_map) : - ParallelDataBase (n_components, - n_datasets, + ParallelDataBase (n_datasets, n_subdivisions, - quadrature.size(), n_postprocessor_outputs, - finite_elements), - q_collection (quadrature), - mapping_collection (mapping), - x_fe_values (this->mapping_collection, - this->fe_collection, - q_collection, - update_flags), + mapping, + finite_elements, + update_flags, + false), cell_to_patch_index_map (&cell_to_patch_index_map) {} - /** - * In a WorkStream context, use - * this function to append the - * patch computed by the parallel - * stage to the array of patches. + * In a WorkStream context, use this function to append the patch computed + * by the parallel stage to the array of patches. */ template void @@ -92,722 +74,6 @@ namespace internal } -namespace internal -{ - namespace DataOut - { - template - DataEntryBase::DataEntryBase (const std::vector &names_in, - const std::vector &data_component_interpretation) - : - names(names_in), - data_component_interpretation (data_component_interpretation), - postprocessor(0, typeid(*this).name()), - n_output_variables(names.size()) - { - Assert (names.size() == data_component_interpretation.size(), - ExcDimensionMismatch(data_component_interpretation.size(), - names.size())); - - // check that the names use only allowed - // characters - // check names for invalid characters - for (unsigned int i=0; i()") == std::string::npos, - typename dealii::DataOut:: - ExcInvalidCharacter (names[i], - names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_<>()"))); - } - - - - template - DataEntryBase::DataEntryBase (const DataPostprocessor *data_postprocessor) - : - names(data_postprocessor->get_names()), - data_component_interpretation (data_postprocessor->get_data_component_interpretation()), - postprocessor(data_postprocessor, typeid(*this).name()), - n_output_variables(names.size()) - { - Assert (data_postprocessor->get_names().size() - == - data_postprocessor->get_data_component_interpretation().size(), - ExcDimensionMismatch (data_postprocessor->get_names().size(), - data_postprocessor->get_data_component_interpretation().size())); - - // check that the names use only allowed - // characters - for (unsigned int i=0; i()") == std::string::npos, - typename dealii::DataOut:: - ExcInvalidCharacter (names[i], - names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789_<>()"))); - } - - - - template - DataEntryBase::~DataEntryBase () - {} - - - - /** - * Class that stores a pointer to a - * vector of type equal to the template - * argument, and provides the functions - * to extract data from it. - * - * @author Wolfgang Bangerth, 2004 - */ - template - class DataEntry : public DataEntryBase - { - public: - /** - * Constructor. Give a list of names - * for the individual components of - * the vector and their - * interpretation as scalar or vector - * data. This constructor assumes - * that no postprocessor is going to - * be used. - */ - DataEntry (const VectorType *data, - const std::vector &names, - const std::vector &data_component_interpretation); - - /** - * Constructor when a data - * postprocessor is going to be - * used. In that case, the names and - * vector declarations are going to - * be acquired from the postprocessor. - */ - DataEntry (const VectorType *data, - const DataPostprocessor *data_postprocessor); - - /** - * Assuming that the stored vector is - * a cell vector, extract the given - * element from it. - */ - virtual - double - get_cell_data_value (const unsigned int cell_number) const; - - /** - * Given a FEValuesBase object, - * extract the values on the present - * cell from the vector we actually - * store. - */ - virtual - void - get_function_values (const FEValuesBase &fe_patch_values, - std::vector &patch_values) const; - - /** - * Given a FEValuesBase object, - * extract the values on the present - * cell from the vector we actually - * store. This function does the same - * as the one above but for - * vector-valued finite elements. - */ - virtual - void - get_function_values (const FEValuesBase &fe_patch_values, - std::vector > &patch_values_system) const; - - /** - * Given a FEValuesBase object, - * extract the gradients on the present - * cell from the vector we actually - * store. - */ - virtual - void - get_function_gradients (const FEValuesBase &fe_patch_values, - std::vector > &patch_gradients) const; - - /** - * Given a FEValuesBase object, - * extract the gradients on the present - * cell from the vector we actually - * store. This function does the same - * as the one above but for - * vector-valued finite elements. - */ - virtual - void - get_function_gradients (const FEValuesBase &fe_patch_values, - std::vector > > &patch_gradients_system) const; - - /** - * Given a FEValuesBase object, extract - * the second derivatives on the - * present cell from the vector we - * actually store. - */ - virtual - void - get_function_hessians (const FEValuesBase &fe_patch_values, - std::vector > &patch_hessians) const; - - /** - * Given a FEValuesBase object, extract - * the second derivatives on the - * present cell from the vector we - * actually store. This function does - * the same as the one above but for - * vector-valued finite elements. - */ - virtual - void - get_function_hessians (const FEValuesBase &fe_patch_values, - std::vector > > &patch_hessians_system) const; - - /** - * Clear all references to the - * vectors. - */ - virtual void clear (); - - /** - * Determine an estimate for - * the memory consumption (in - * bytes) of this object. - */ - virtual std::size_t memory_consumption () const; - - private: - /** - * Pointer to the data - * vector. Note that - * ownership of the vector - * pointed to remains with - * the caller of this class. - */ - const VectorType *vector; - }; - - - - template - DataEntry:: - DataEntry (const VectorType *data, - const std::vector &names, - const std::vector &data_component_interpretation) - : - DataEntryBase (names, data_component_interpretation), - vector (data) - {} - - - - template - DataEntry:: - DataEntry (const VectorType *data, - const DataPostprocessor *data_postprocessor) - : - DataEntryBase (data_postprocessor), - vector (data) - {} - - - namespace - { - template - double - get_vector_element (const VectorType &vector, - const unsigned int cell_number) - { - return vector[cell_number]; - } - - - double - get_vector_element (const IndexSet &is, - const unsigned int cell_number) - { - return (is.is_element(cell_number) ? 1 : 0); - } - } - - - - template - double - DataEntry:: - get_cell_data_value (const unsigned int cell_number) const - { - return get_vector_element(*vector, cell_number); - } - - - - template - void - DataEntry:: - get_function_values (const FEValuesBase &fe_patch_values, - std::vector > &patch_values_system) const - { - fe_patch_values.get_function_values (*vector, patch_values_system); - } - - - - template - void - DataEntry:: - get_function_values (const FEValuesBase &fe_patch_values, - std::vector &patch_values) const - { - fe_patch_values.get_function_values (*vector, patch_values); - } - - - - template - void - DataEntry:: - get_function_gradients (const FEValuesBase &fe_patch_values, - std::vector > > &patch_gradients_system) const - { - fe_patch_values.get_function_gradients (*vector, patch_gradients_system); - } - - - - template - void - DataEntry:: - get_function_gradients (const FEValuesBase &fe_patch_values, - std::vector > &patch_gradients) const - { - fe_patch_values.get_function_gradients (*vector, patch_gradients); - } - - - - template - void - DataEntry:: - get_function_hessians (const FEValuesBase &fe_patch_values, - std::vector > > &patch_hessians_system) const - { - fe_patch_values.get_function_hessians (*vector, patch_hessians_system); - } - - - - template - void - DataEntry:: - get_function_hessians (const FEValuesBase &fe_patch_values, - std::vector > &patch_hessians) const - { - fe_patch_values.get_function_hessians (*vector, patch_hessians); - } - - - - template - std::size_t - DataEntry::memory_consumption () const - { - return (sizeof (vector) + - MemoryConsumption::memory_consumption (this->names)); - } - - - - template - void - DataEntry::clear () - { - vector = 0; - } - } -} - - - -template -DataOut_DoFData::DataOut_DoFData () - : - dofs(0,typeid(*this).name()) -{} - - - -template -DataOut_DoFData::~DataOut_DoFData () -{ - clear (); -} - - - -template -void -DataOut_DoFData:: -attach_dof_handler (const DH &d) -{ - Assert (dof_data.size() == 0, ExcOldDataStillPresent()); - Assert (cell_data.size() == 0, ExcOldDataStillPresent()); - - dofs = &d; -} - - - - -template -template -void -DataOut_DoFData:: -add_data_vector (const VECTOR &vec, - const std::string &name, - const DataVectorType type, - const std::vector &data_component_interpretation) -{ - Assert (dofs != 0, ExcNoDoFHandlerSelected ()); - const unsigned int n_components = dofs->get_fe().n_components (); - - std::vector names; - // if only one component or vector - // is cell vector: we only need one - // name - if ((n_components == 1) || - (vec.size() == dofs->get_tria().n_active_cells())) - { - names.resize (1, name); - } - else - // otherwise append _i to the - // given name - { - names.resize (n_components); - for (unsigned int i=0; i -template -void -DataOut_DoFData:: -add_data_vector (const VECTOR &vec, - const std::vector &names, - const DataVectorType type, - const std::vector &data_component_interpretation_) -{ - Assert (dofs != 0, ExcNoDoFHandlerSelected ()); - - const std::vector & - data_component_interpretation - = (data_component_interpretation_.size() != 0 - ? - data_component_interpretation_ - : - std::vector - (names.size(), DataComponentInterpretation::component_is_scalar)); - - // either cell data and one name, - // or dof data and n_components names - DataVectorType actual_type = type; - if (type == type_automatic) - { - if (vec.size() == dofs->get_tria().n_active_cells()) - actual_type = type_cell_data; - else - actual_type = type_dof_data; - } - - switch (actual_type) - { - case type_cell_data: - Assert (vec.size() == dofs->get_tria().n_active_cells(), - ExcInvalidVectorSize (vec.size(), - dofs->n_dofs(), - dofs->get_tria().n_active_cells())); - Assert (names.size() == 1, - ExcInvalidNumberOfNames (names.size(), 1)); - break; - - case type_dof_data: - Assert (vec.size() == dofs->n_dofs(), - ExcInvalidVectorSize (vec.size(), - dofs->n_dofs(), - dofs->get_tria().n_active_cells())); - Assert (names.size() == dofs->get_fe().n_components(), - ExcInvalidNumberOfNames (names.size(), dofs->get_fe().n_components())); - break; - - case type_automatic: - // this case should have - // been handled above... - Assert (false, ExcInternalError()); - } - - internal::DataOut::DataEntryBase *new_entry - = new internal::DataOut::DataEntry(&vec, names, - data_component_interpretation); - if (actual_type == type_dof_data) - dof_data.push_back (std_cxx1x::shared_ptr >(new_entry)); - else - cell_data.push_back (std_cxx1x::shared_ptr >(new_entry)); -} - - - -template -template -void -DataOut_DoFData:: -add_data_vector (const VECTOR &vec, - const DataPostprocessor &data_postprocessor) -{ - // this is a specialized version of the - // other function where we have a - // postprocessor. if we do, we know that we - // have type_dof_data, which makes things a - // bit simpler, we also don't need to deal - // with some of the other stuff and use a - // different constructor of DataEntry - - Assert (dofs != 0, ExcNoDoFHandlerSelected ()); - - Assert (vec.size() == dofs->n_dofs(), - ExcInvalidVectorSize (vec.size(), - dofs->n_dofs(), - dofs->get_tria().n_active_cells())); - - internal::DataOut::DataEntryBase *new_entry - = new internal::DataOut::DataEntry(&vec, &data_postprocessor); - dof_data.push_back (std_cxx1x::shared_ptr >(new_entry)); -} - - - -template -void DataOut_DoFData::clear_data_vectors () -{ - dof_data.erase (dof_data.begin(), dof_data.end()); - cell_data.erase (cell_data.begin(), cell_data.end()); - - // delete patches - std::vector dummy; - patches.swap (dummy); -} - - - -template -void -DataOut_DoFData:: -clear_input_data_references () -{ - for (unsigned int i=0; iclear (); - - for (unsigned int i=0; iclear (); - - if (dofs != 0) - dofs = 0; -} - - - -template -void -DataOut_DoFData::clear () -{ - dof_data.erase (dof_data.begin(), dof_data.end()); - cell_data.erase (cell_data.begin(), cell_data.end()); - - if (dofs != 0) - dofs = 0; - - // delete patches - std::vector dummy; - patches.swap (dummy); -} - - - -template -std::vector -DataOut_DoFData:: -get_dataset_names () const -{ - std::vector names; - // collect the names of dof - // and cell data - typedef - typename std::vector > >::const_iterator - data_iterator; - - for (data_iterator d=dof_data.begin(); - d!=dof_data.end(); ++d) - for (unsigned int i=0; i<(*d)->names.size(); ++i) - names.push_back ((*d)->names[i]); - for (data_iterator d=cell_data.begin(); d!=cell_data.end(); ++d) - { - Assert ((*d)->names.size() == 1, ExcInternalError()); - names.push_back ((*d)->names[0]); - } - - return names; -} - - - -template -std::vector > -DataOut_DoFData::get_vector_data_ranges () const -{ - std::vector > - ranges; - - // collect the ranges of dof - // and cell data - typedef - typename std::vector > >::const_iterator - data_iterator; - - unsigned int output_component = 0; - for (data_iterator d=dof_data.begin(); - d!=dof_data.end(); ++d) - for (unsigned int i=0; i<(*d)->n_output_variables; - ++i, ++output_component) - // see what kind of data we have - // here. note that for the purpose of - // the current function all we care - // about is vector data - if ((*d)->data_component_interpretation[i] == - DataComponentInterpretation::component_is_part_of_vector) - { - // ensure that there is a - // continuous number of next - // space_dim components that all - // deal with vectors - Assert (i+patch_space_dim <= - (*d)->n_output_variables, - ExcInvalidVectorDeclaration (i, - (*d)->names[i])); - for (unsigned int dd=1; dddata_component_interpretation[i+dd] - == - DataComponentInterpretation::component_is_part_of_vector, - ExcInvalidVectorDeclaration (i, - (*d)->names[i])); - - // all seems alright, so figure out - // whether there is a common name - // to these components. if not, - // leave the name empty and let the - // output format writer decide what - // to do here - std::string name = (*d)->names[i]; - for (unsigned int dd=1; ddnames[i+dd]) - { - name = ""; - break; - } - - // finally add a corresponding - // range - std_cxx1x::tuple - range (output_component, - output_component+patch_space_dim-1, - name); - - ranges.push_back (range); - - // increase the 'component' counter - // by the appropriate amount, same - // for 'i', since we have already - // dealt with all these components - output_component += patch_space_dim-1; - i += patch_space_dim-1; - } - - // note that we do not have to traverse the - // list of cell data here because cell data - // is one value per (logical) cell and - // therefore cannot be a vector - - // as a final check, the 'component' - // counter should be at the total number of - // components added up now -#ifdef DEBUG - unsigned int n_output_components = 0; - for (data_iterator d=dof_data.begin(); - d!=dof_data.end(); ++d) - n_output_components += (*d)->n_output_variables; - Assert (output_component == n_output_components, - ExcInternalError()); -#endif - - return ranges; -} - - - -template -const std::vector< dealii::DataOutBase::Patch > & -DataOut_DoFData::get_patches () const -{ - return patches; -} - - - -template -std::size_t -DataOut_DoFData::memory_consumption () const -{ - return (DataOutInterface::memory_consumption () + - MemoryConsumption::memory_consumption (dofs) + - MemoryConsumption::memory_consumption (patches)); -} - - - -/* ---------------------------------------------------------------------- */ - template void @@ -817,13 +83,10 @@ build_one_patch (const std::pair *cell_and_index, DataOutBase::Patch &patch, const CurvedCellRegion curved_cell_region) { - // use ucd_to_deal map as patch vertices - // are in the old, unnatural ordering. if - // the mapping does not preserve locations - // (e.g. MappingQEulerian), we need to - // compute the offset of the vertex for the - // graphical output. Otherwise, we can just - // use the vertex info. + // use ucd_to_deal map as patch vertices are in the old, unnatural + // ordering. if the mapping does not preserve locations + // (e.g. MappingQEulerian), we need to compute the offset of the vertex for + // the graphical output. Otherwise, we can just use the vertex info. for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) if (data.mapping_collection[0].preserves_vertex_locations()) patch.vertices[vertex] = cell_and_index->first->vertex(vertex); @@ -834,25 +97,21 @@ build_one_patch (const std::pair *cell_and_index, if (data.n_datasets > 0) { - data.x_fe_values.reinit (cell_and_index->first); - const FEValues &fe_patch_values - = data.x_fe_values.get_present_fe_values (); + // create DH::active_cell_iterator and initialize FEValues + data.reinit_all_fe_values(this->dof_data, cell_and_index->first); + + const FEValuesBase &fe_patch_values + = data.get_present_fe_values (0); const unsigned int n_q_points = fe_patch_values.n_quadrature_points; - // depending on the requested output - // of curved cells, if necessary - // append the quadrature points to - // the last rows of the patch.data - // member. This is the case if we - // want to produce curved cells at - // the boundary and this cell - // actually is at the boundary, or - // else if we want to produce curved - // cells everywhere + // depending on the requested output of curved cells, if necessary + // append the quadrature points to the last rows of the patch.data + // member. This is the case if we want to produce curved cells at the + // boundary and this cell actually is at the boundary, or else if we + // want to produce curved cells everywhere // - // note: a cell is *always* at - // the boundary if dim *cell_and_index, { Assert(patch.space_dim==DH::space_dimension, ExcInternalError()); const std::vector > &q_points=fe_patch_values.get_quadrature_points(); - // resize the patch.data member - // in order to have enough memory - // for the quadrature points as - // well + // resize the patch.data member in order to have enough memory for + // the quadrature points as well patch.data.reinit (data.n_datasets+DH::space_dimension, n_q_points); - // set the flag indicating that - // for this cell the points are + // set the flag indicating that for this cell the points are // explicitly given patch.points_are_available=true; // copy points to patch.data @@ -890,19 +146,22 @@ build_one_patch (const std::pair *cell_and_index, // first fill dof_data for (unsigned int dataset=0; datasetdof_data.size(); ++dataset) { + const FEValuesBase &fe_patch_values + = data.get_present_fe_values (dataset); + const unsigned int n_components = + fe_patch_values.get_fe().n_components(); + const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; if (postprocessor != 0) { - // we have to postprocess the - // data, so determine, which - // fields have to be updated + // we have to postprocess the data, so determine, which fields + // have to be updated const UpdateFlags update_flags=postprocessor->get_needed_update_flags(); - if (data.n_components == 1) + if (n_components == 1) { - // at each point there is - // only one component of - // value, gradient etc. + // at each point there is only one component of value, + // gradient etc. if (update_flags & update_values) this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values); @@ -928,9 +187,9 @@ build_one_patch (const std::pair *cell_and_index, } else { - // at each point there is - // a vector valued - // function and its + data.resize_system_vectors (n_components); + + // at each point there is a vector valued function and its // derivative... if (update_flags & update_values) this->dof_data[dataset]->get_function_values (fe_patch_values, @@ -964,13 +223,10 @@ build_one_patch (const std::pair *cell_and_index, = data.postprocessed_values[dataset][q](component); } else - // now we use the given data - // vector without - // modifications. again, we - // treat single component - // functions separately for - // efficiency reasons. - if (data.n_components == 1) + // now we use the given data vector without modifications. again, + // we treat single component functions separately for efficiency + // reasons. + if (n_components == 1) { this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values); @@ -979,25 +235,22 @@ build_one_patch (const std::pair *cell_and_index, } else { + data.resize_system_vectors(n_components); this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values_system); - for (unsigned int component=0; componentdof_data[dataset]->n_output_variables; } - // then do the cell data. only - // compute the number of a cell if - // needed; also make sure that we - // only access cell data if the - // first_cell/next_cell functions - // only return active cells + // then do the cell data. only compute the number of a cell if needed; + // also make sure that we only access cell data if the + // first_cell/next_cell functions only return active cells if (this->cell_data.size() != 0) { Assert (!cell_and_index->first->has_children(), ExcNotImplemented()); @@ -1015,32 +268,15 @@ build_one_patch (const std::pair *cell_and_index, for (unsigned int f=0; f::faces_per_cell; ++f) { - // let's look up whether - // the neighbor behind that - // face is noted in the - // table of cells which we - // treat. this can only - // happen if the neighbor - // exists, and is on the - // same level as this cell, - // but it may also happen - // that the neighbor is not - // a member of the range of - // cells over which we - // loop, in which case the - // respective entry in the - // cell_to_patch_index_map - // will have the value - // no_neighbor. (note that - // since we allocated only - // as much space in this - // array as the maximum - // index of the cells we - // loop over, not every - // neighbor may have its - // space in it, so we have - // to assume that it is - // extended by values + // let's look up whether the neighbor behind that face is noted in the + // table of cells which we treat. this can only happen if the neighbor + // exists, and is on the same level as this cell, but it may also happen + // that the neighbor is not a member of the range of cells over which we + // loop, in which case the respective entry in the + // cell_to_patch_index_map will have the value no_neighbor. (note that + // since we allocated only as much space in this array as the maximum + // index of the cells we loop over, not every neighbor may have its + // space in it, so we have to assume that it is extended by values // no_neighbor) if (cell_and_index->first->at_boundary(f) || @@ -1065,10 +301,8 @@ build_one_patch (const std::pair *cell_and_index, continue; } - // now, there is a - // neighbor, so get its - // patch number and set it - // for the neighbor index + // now, there is a neighbor, so get its patch number and set it for the + // neighbor index patch.neighbors[f] = (*data.cell_to_patch_index_map)[neighbor->level()][neighbor->index()]; } @@ -1084,17 +318,18 @@ void DataOut::build_patches (const unsigned int n_subdivisions) } + template void DataOut::build_patches (const Mapping &mapping, const unsigned int nnnn_subdivisions, const CurvedCellRegion curved_region) { - // Check consistency of redundant - // template parameter + // Check consistency of redundant template parameter Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); typedef DataOut_DoFData BaseClass; - Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected()); + Assert (this->triangulation != 0, + typename BaseClass::ExcNoTriangulationSelected()); const unsigned int n_subdivisions = (nnnn_subdivisions != 0) ? nnnn_subdivisions @@ -1102,19 +337,15 @@ void DataOut::build_patches (const Mapping= 1, ExcInvalidNumberOfSubdivisions(n_subdivisions)); - // first count the cells we want to - // create patches of. also fill the - // object that maps the cell - // indices to the patch numbers, as - // this will be needed for - // generation of neighborship - // information + // first count the cells we want to create patches of. also fill the object + // that maps the cell indices to the patch numbers, as this will be needed + // for generation of neighborship information std::vector > cell_to_patch_index_map; - cell_to_patch_index_map.resize (this->dofs->get_tria().n_levels()); - for (unsigned int l=0; ldofs->get_tria().n_levels(); ++l) + cell_to_patch_index_map.resize (this->triangulation->n_levels()); + for (unsigned int l=0; ltriangulation->n_levels(); ++l) { unsigned int max_index = 0; - for (cell_iterator cell=first_locally_owned_cell(); cell != this->dofs->end(); + for (cell_iterator cell=first_locally_owned_cell(); cell != this->triangulation->end(); cell = next_locally_owned_cell(cell)) if (static_cast(cell->level()) == l) max_index = std::max (max_index, @@ -1126,24 +357,19 @@ void DataOut::build_patches (const Mapping > all_cells; { - // set the index of the first - // cell. if - // first_locally_owned_cell / - // next_locally_owned_cell - // returns non-active cells, then - // the index is not usable - // anyway, but otherwise we - // should keep track where we are + // set the index of the first cell. if first_locally_owned_cell / + // next_locally_owned_cell returns non-active cells, then the index is not + // usable anyway, but otherwise we should keep track where we are unsigned int index; - if ((first_locally_owned_cell() == this->dofs->end()) + cell_iterator cell = first_locally_owned_cell(); + if ((cell == this->triangulation->end()) || - (first_locally_owned_cell()->has_children())) + (cell->has_children())) index = 0; else - index = std::distance (this->dofs->begin_active(), - active_cell_iterator(first_locally_owned_cell())); - for (cell_iterator cell=first_locally_owned_cell(); cell != this->dofs->end(); - cell = next_locally_owned_cell(cell)) + index = std::distance (this->triangulation->begin_active(), + active_cell_iterator(cell)); + for ( ; cell != this->triangulation->end(); ) { Assert (static_cast(cell->level()) < cell_to_patch_index_map.size(), @@ -1156,22 +382,18 @@ void DataOut::build_patches (const Mappinghas_children() && - next_locally_owned_cell(cell) != this->dofs->end() && - !next_locally_owned_cell(cell)->has_children()) + next != this->triangulation->end() && + !next->has_children()) index += std::distance (active_cell_iterator(cell), - active_cell_iterator(next_locally_owned_cell(cell))); + active_cell_iterator(next)); + cell = next; } } @@ -1179,13 +401,7 @@ void DataOut::build_patches (const Mappingpatches.reserve (all_cells.size()); Assert (this->patches.size() == 0, ExcInternalError()); - // now create a default patch and a - // default object for the - // WorkStream object to work with - const QTrapez<1> q_trapez; - const QIterated patch_points (q_trapez, n_subdivisions); - - const unsigned int n_components = this->dofs->get_fe().n_components(); + // now create a default object for the WorkStream object to work with unsigned int n_datasets=this->cell_data.size(); for (unsigned int i=0; idof_data.size(); ++i) n_datasets += this->dof_data[i]->n_output_variables; @@ -1207,26 +423,24 @@ void DataOut::build_patches (const Mappingdof_data.size(); ++i) if (this->dof_data[i]->postprocessor) update_flags |= this->dof_data[i]->postprocessor->get_needed_update_flags(); - // perhaps update_normal_vectors is present, - // which would only be useful on faces, but - // we may not use it here. + // perhaps update_normal_vectors is present, which would only be useful on + // faces, but we may not use it here. Assert (!(update_flags & update_normal_vectors), ExcMessage("The update of normal vectors may not be requested for evaluation of " "data on cells via DataPostprocessor.")); internal::DataOut::ParallelData - thread_data (patch_points, - n_components, n_datasets, n_subdivisions, + thread_data (n_datasets, n_subdivisions, n_postprocessor_outputs, mapping, - cell_to_patch_index_map, - this->dofs->get_fe(), - update_flags); + this->get_finite_elements(), + update_flags, + cell_to_patch_index_map); ::dealii::DataOutBase::Patch sample_patch; sample_patch.n_subdivisions = n_subdivisions; - sample_patch.data.reinit (n_datasets, patch_points.size()); - + sample_patch.data.reinit (n_datasets, + Utilities::fixed_power(n_subdivisions+1)); // now build the patches in parallel @@ -1248,7 +462,7 @@ template typename DataOut::cell_iterator DataOut::first_cell () { - return this->dofs->begin_active (); + return this->triangulation->begin_active (); } @@ -1257,10 +471,10 @@ template typename DataOut::cell_iterator DataOut::next_cell (const typename DataOut::cell_iterator &cell) { - // convert the iterator to an - // active_iterator and advance - // this to the next active cell - typename DH::active_cell_iterator active_cell = cell; + // convert the iterator to an active_iterator and advance this to the next + // active cell + typename Triangulation:: + active_cell_iterator active_cell = cell; ++active_cell; return active_cell; } @@ -1272,12 +486,11 @@ typename DataOut::cell_iterator DataOut::first_locally_owned_cell () { typename DataOut::cell_iterator - cell = this->dofs->begin_active (); + cell = this->triangulation->begin_active (); - // skip cells if the current one - // has no children (is active) and - // is a ghost or artificial cell - while ((cell != this->dofs->end()) && + // skip cells if the current one has no children (is active) and is a ghost + // or artificial cell + while ((cell != this->triangulation->end()) && (cell->has_children() == false) && !cell->is_locally_owned()) cell = next_cell(cell); @@ -1293,7 +506,7 @@ DataOut::next_locally_owned_cell (const typename DataOut::cell_i { typename DataOut::cell_iterator cell = next_cell(old_cell); - while ((cell != this->dofs->end()) && + while ((cell != this->triangulation->end()) && (cell->has_children() == false) && !cell->is_locally_owned()) cell = next_cell(cell); diff --git a/deal.II/source/numerics/data_out.inst.in b/deal.II/source/numerics/data_out.inst.in index b084eabe27..5210bb1d05 100644 --- a/deal.II/source/numerics/data_out.inst.in +++ b/deal.II/source/numerics/data_out.inst.in @@ -1,248 +1,41 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - -for (VEC : SERIAL_VECTORS; DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) -{ -// codim=0 - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: - add_data_vector (const VEC &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: - add_data_vector (const VEC &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: - add_data_vector (const VEC &, - const DataPostprocessor::space_dimension> &); - -// stuff needed for face data - - template void - DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: - add_data_vector (const VEC &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: - add_data_vector (const VEC &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: - add_data_vector (const VEC &, - const DataPostprocessor::space_dimension> &); - -// things for DataOutRotation - - template void - DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: - add_data_vector (const VEC &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: - add_data_vector (const VEC &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: - add_data_vector (const VEC &, - const DataPostprocessor::space_dimension> &); - -// codim 1 - - #if deal_II_dimension < 3 - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: - add_data_vector (const VEC &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: - add_data_vector (const VEC &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: - add_data_vector (const VEC &, - const DataPostprocessor::space_dimension> &); - #endif - - - -// codim 2 - - #if deal_II_dimension == 3 - template void - DataOut_DoFData,1,3>:: - add_data_vector (const VEC &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,1,3>:: - add_data_vector (const VEC &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,1,3>:: - add_data_vector (const VEC &, - const DataPostprocessor::space_dimension> &); - #endif - -} +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- -for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) { -// codim=0 - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: - add_data_vector (const IndexSet &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: - add_data_vector (const IndexSet &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: - add_data_vector (const IndexSet &, - const DataPostprocessor::space_dimension> &); - -// stuff needed for face data - - template void - DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: - add_data_vector (const IndexSet &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: - add_data_vector (const IndexSet &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: - add_data_vector (const IndexSet &, - const DataPostprocessor::space_dimension> &); - -// things for DataOutRotation - - template void - DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: - add_data_vector (const IndexSet &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: - add_data_vector (const IndexSet &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: - add_data_vector (const IndexSet &, - const DataPostprocessor::space_dimension> &); - -// codim 1 - - #if deal_II_dimension < 3 - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: - add_data_vector (const IndexSet &, - const std::string &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: - add_data_vector (const IndexSet &, - const std::vector &, - const DataVectorType, - const std::vector &); - - template void - DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: - add_data_vector (const IndexSet &, - const DataPostprocessor::space_dimension> &); - #endif - + namespace internal \{ + namespace DataOut \{ +#if deal_II_dimension <= deal_II_space_dimension + template struct ParallelData; +#endif + \} + \} } - for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) { - template class DataOut_DoFData,deal_II_dimension>; - template class DataOut_DoFData,deal_II_dimension+1>; - - #if deal_II_dimension < 3 - template class DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>; - template class DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>; - #endif - - #if deal_II_dimension >= 2 - template class DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>; - #endif - template class DataOut >; #if deal_II_dimension < 3 template class DataOut >; #endif #if deal_II_dimension == 3 - template class DataOut_DoFData,1,3>; - template class DataOut_DoFData,1,3>; template class DataOut<1, DH<1,3> >; #endif - -} +} \ No newline at end of file diff --git a/deal.II/source/numerics/data_out_dof_data.cc b/deal.II/source/numerics/data_out_dof_data.cc new file mode 100644 index 0000000000..88e7508247 --- /dev/null +++ b/deal.II/source/numerics/data_out_dof_data.cc @@ -0,0 +1,1146 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1999 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +DEAL_II_NAMESPACE_OPEN + + +namespace internal +{ + namespace DataOut + { + template + ParallelDataBase:: + ParallelDataBase (const unsigned int n_datasets, + const unsigned int n_subdivisions, + const std::vector &n_postprocessor_outputs, + const Mapping &mapping, + const std::vector > > &finite_elements, + const UpdateFlags update_flags, + const bool use_face_values) + : + n_datasets (n_datasets), + n_subdivisions (n_subdivisions), + postprocessed_values (n_postprocessor_outputs.size()), + mapping_collection (mapping), + finite_elements (finite_elements), + update_flags (update_flags) + { + unsigned int n_q_points = 0; + if (use_face_values == false) + { + dealii::hp::QCollection + quadrature(QIterated(QTrapez<1>(), n_subdivisions)); + n_q_points = quadrature[0].size(); + x_fe_values.resize(this->finite_elements.size()); + for (unsigned int i=0; ifinite_elements.size(); ++i) + { + // check if there is a finite element that is equal to the + // present one, then we can re-use the FEValues object + for (unsigned int j=0; jfinite_elements[i].get() == + this->finite_elements[j].get()) + { + x_fe_values[i] = x_fe_values[j]; + break; + } + if (x_fe_values[i].get() == 0) + x_fe_values[i].reset(new dealii::hp::FEValues + (this->mapping_collection, + *this->finite_elements[i], + quadrature, + this->update_flags)); + } + } + else + { + dealii::hp::QCollection + quadrature(QIterated(QTrapez<1>(), n_subdivisions)); + n_q_points = quadrature[0].size(); + x_fe_face_values.resize(this->finite_elements.size()); + for (unsigned int i=0; ifinite_elements.size(); ++i) + { + // check if there is a finite element that is equal to the + // present one, then we can re-use the FEValues object + for (unsigned int j=0; jfinite_elements[i].get() == + this->finite_elements[j].get()) + { + x_fe_face_values[i] = x_fe_face_values[j]; + break; + } + if (x_fe_face_values[i].get() == 0) + x_fe_face_values[i].reset(new dealii::hp::FEFaceValues + (this->mapping_collection, + *this->finite_elements[i], + quadrature, + this->update_flags)); + } + } + + patch_values.resize (n_q_points); + patch_values_system.resize (n_q_points); + patch_gradients.resize (n_q_points); + patch_gradients_system.resize (n_q_points); + patch_hessians.resize (n_q_points); + patch_hessians_system.resize (n_q_points); + + for (unsigned int dataset=0; dataset(n_postprocessor_outputs[dataset])); + } + + + + + + // implement copy constructor to create a thread's own version of + // x_fe_values + template + ParallelDataBase:: + ParallelDataBase (const ParallelDataBase &data) + : + n_datasets (data.n_datasets), + n_subdivisions (data.n_subdivisions), + patch_values (data.patch_values), + patch_values_system (data.patch_values_system), + patch_gradients (data.patch_gradients), + patch_gradients_system (data.patch_gradients_system), + patch_hessians (data.patch_hessians), + patch_hessians_system (data.patch_hessians_system), + postprocessed_values (data.postprocessed_values), + mapping_collection (data.mapping_collection), + finite_elements (data.finite_elements), + update_flags (data.update_flags) + { + if (data.x_fe_values.empty() == false) + { + Assert(data.x_fe_face_values.empty() == true, ExcInternalError()); + dealii::hp::QCollection + quadrature(QIterated(QTrapez<1>(), n_subdivisions)); + x_fe_values.resize(this->finite_elements.size()); + for (unsigned int i=0; ifinite_elements.size(); ++i) + { + // check if there is a finite element that is equal to the + // present one, then we can re-use the FEValues object + for (unsigned int j=0; jfinite_elements[i].get() == + this->finite_elements[j].get()) + { + x_fe_values[i] = x_fe_values[j]; + break; + } + if (x_fe_values[i].get() == 0) + x_fe_values[i].reset(new dealii::hp::FEValues + (this->mapping_collection, + *this->finite_elements[i], + quadrature, + this->update_flags)); + } + } + else + { + dealii::hp::QCollection + quadrature(QIterated(QTrapez<1>(), n_subdivisions)); + x_fe_face_values.resize(this->finite_elements.size()); + for (unsigned int i=0; ifinite_elements.size(); ++i) + { + // check if there is a finite element that is equal to the + // present one, then we can re-use the FEValues object + for (unsigned int j=0; jfinite_elements[i].get() == + this->finite_elements[j].get()) + { + x_fe_face_values[i] = x_fe_face_values[j]; + break; + } + if (x_fe_face_values[i].get() == 0) + x_fe_face_values[i].reset(new dealii::hp::FEFaceValues + (this->mapping_collection, + *this->finite_elements[i], + quadrature, + this->update_flags)); + } + } + } + + + + template + template + void + ParallelDataBase:: + reinit_all_fe_values(std::vector > > &dof_data, + const typename dealii::Triangulation::cell_iterator &cell, + const unsigned int face) + { + for (unsigned int dataset=0; datasetget_triangulation(), + cell->level(), + cell->index(), + dof_data[dataset]->dof_handler); + if (x_fe_values.empty()) + { + AssertIndexRange(face, + GeometryInfo::faces_per_cell); + x_fe_face_values[dataset]->reinit(dh_cell, face); + } + else + x_fe_values[dataset]->reinit (dh_cell); + } + } + if (dof_data.empty()) + { + if (x_fe_values.empty()) + { + AssertIndexRange(face, + GeometryInfo::faces_per_cell); + x_fe_face_values[0]->reinit(cell, face); + } + else + x_fe_values[0]->reinit (cell); + } + } + + + + template + const FEValuesBase & + ParallelDataBase:: + get_present_fe_values(const unsigned int dataset) const + { + AssertIndexRange(dataset, finite_elements.size()); + if (x_fe_values.empty()) + return x_fe_face_values[dataset]->get_present_fe_values(); + else + return x_fe_values[dataset]->get_present_fe_values(); + } + + + + template + void + ParallelDataBase:: + resize_system_vectors(const unsigned int n_components) + { + Assert(patch_values_system.size() > 0, ExcInternalError()); + AssertDimension(patch_values_system.size(), + patch_gradients_system.size()); + AssertDimension(patch_values_system.size(), + patch_hessians_system.size()); + if (patch_values_system[0].size() == n_components) + return; + for (unsigned int k=0; k + void + append_patch_to_list (const DataOutBase::Patch &patch, + std::vector > &patches) + { + patches.push_back (patch); + patches.back().patch_index = patches.size()-1; + } + } +} + +namespace internal +{ + namespace DataOut + { + template + DataEntryBase::DataEntryBase (const DH *dofs, + const std::vector &names_in, + const std::vector &data_component_interpretation) + : + dof_handler (dofs, typeid(dealii::DataOut_DoFData).name()), + names(names_in), + data_component_interpretation (data_component_interpretation), + postprocessor(0, typeid(*this).name()), + n_output_variables(names.size()) + { + Assert (names.size() == data_component_interpretation.size(), + ExcDimensionMismatch(data_component_interpretation.size(), + names.size())); + + // check that the names use only allowed characters + for (unsigned int i=0; i()") == std::string::npos, + typename dealii::DataOut:: + ExcInvalidCharacter (names[i], + names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()"))); + } + + + + template + DataEntryBase::DataEntryBase (const DH *dofs, + const DataPostprocessor *data_postprocessor) + : + dof_handler (dofs, typeid(dealii::DataOut_DoFData).name()), + names(data_postprocessor->get_names()), + data_component_interpretation (data_postprocessor->get_data_component_interpretation()), + postprocessor(data_postprocessor, typeid(*this).name()), + n_output_variables(names.size()) + { + Assert (data_postprocessor->get_names().size() + == + data_postprocessor->get_data_component_interpretation().size(), + ExcDimensionMismatch (data_postprocessor->get_names().size(), + data_postprocessor->get_data_component_interpretation().size())); + + // check that the names use only allowed characters + for (unsigned int i=0; i()") == std::string::npos, + typename dealii::DataOut:: + ExcInvalidCharacter (names[i], + names[i].find_first_not_of("abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "0123456789_<>()"))); + } + + + + template + DataEntryBase::~DataEntryBase () + {} + + + + /** + * Class that stores a pointer to a vector of type equal to the template + * argument, and provides the functions to extract data from it. + * + * @author Wolfgang Bangerth, 2004 + */ + template + class DataEntry : public DataEntryBase + { + public: + /** + * Constructor. Give a list of names for the individual components of + * the vector and their interpretation as scalar or vector data. This + * constructor assumes that no postprocessor is going to be used. + */ + DataEntry (const DH *dofs, + const VectorType *data, + const std::vector &names, + const std::vector &data_component_interpretation); + + /** + * Constructor when a data postprocessor is going to be used. In that + * case, the names and vector declarations are going to be acquired from + * the postprocessor. + */ + DataEntry (const DH *dofs, + const VectorType *data, + const DataPostprocessor *data_postprocessor); + + /** + * Assuming that the stored vector is a cell vector, extract the given + * element from it. + */ + virtual + double + get_cell_data_value (const unsigned int cell_number) const; + + /** + * Given a FEValuesBase object, extract the values on the present cell + * from the vector we actually store. + */ + virtual + void + get_function_values (const FEValuesBase &fe_patch_values, + std::vector &patch_values) const; + + /** + * Given a FEValuesBase object, extract the values on the present cell + * from the vector we actually store. This function does the same as the + * one above but for vector-valued finite elements. + */ + virtual + void + get_function_values (const FEValuesBase &fe_patch_values, + std::vector > &patch_values_system) const; + + /** + * Given a FEValuesBase object, extract the gradients on the present + * cell from the vector we actually store. + */ + virtual + void + get_function_gradients (const FEValuesBase &fe_patch_values, + std::vector > &patch_gradients) const; + + /** + * Given a FEValuesBase object, extract the gradients on the present + * cell from the vector we actually store. This function does the same + * as the one above but for vector-valued finite elements. + */ + virtual + void + get_function_gradients (const FEValuesBase &fe_patch_values, + std::vector > > &patch_gradients_system) const; + + /** + * Given a FEValuesBase object, extract the second derivatives on the + * present cell from the vector we actually store. + */ + virtual + void + get_function_hessians (const FEValuesBase &fe_patch_values, + std::vector > &patch_hessians) const; + + /** + * Given a FEValuesBase object, extract the second derivatives on the + * present cell from the vector we actually store. This function does + * the same as the one above but for vector-valued finite elements. + */ + virtual + void + get_function_hessians (const FEValuesBase &fe_patch_values, + std::vector > > &patch_hessians_system) const; + + /** + * Clear all references to the vectors. + */ + virtual void clear (); + + /** + * Determine an estimate for the memory consumption (in bytes) of this + * object. + */ + virtual std::size_t memory_consumption () const; + + private: + /** + * Pointer to the data vector. Note that ownership of the vector pointed + * to remains with the caller of this class. + */ + const VectorType *vector; + }; + + + + template + DataEntry:: + DataEntry (const DH *dofs, + const VectorType *data, + const std::vector &names, + const std::vector &data_component_interpretation) + : + DataEntryBase (dofs, names, data_component_interpretation), + vector (data) + {} + + + + template + DataEntry:: + DataEntry (const DH *dofs, + const VectorType *data, + const DataPostprocessor *data_postprocessor) + : + DataEntryBase (dofs, data_postprocessor), + vector (data) + {} + + + namespace + { + template + double + get_vector_element (const VectorType &vector, + const unsigned int cell_number) + { + return vector[cell_number]; + } + + + double + get_vector_element (const IndexSet &is, + const unsigned int cell_number) + { + return (is.is_element(cell_number) ? 1 : 0); + } + } + + + + template + double + DataEntry:: + get_cell_data_value (const unsigned int cell_number) const + { + return get_vector_element(*vector, cell_number); + } + + + + template + void + DataEntry:: + get_function_values (const FEValuesBase &fe_patch_values, + std::vector > &patch_values_system) const + { + fe_patch_values.get_function_values (*vector, patch_values_system); + } + + + + template + void + DataEntry:: + get_function_values (const FEValuesBase &fe_patch_values, + std::vector &patch_values) const + { + fe_patch_values.get_function_values (*vector, patch_values); + } + + + + template + void + DataEntry:: + get_function_gradients (const FEValuesBase &fe_patch_values, + std::vector > > &patch_gradients_system) const + { + fe_patch_values.get_function_gradients (*vector, patch_gradients_system); + } + + + + template + void + DataEntry:: + get_function_gradients (const FEValuesBase &fe_patch_values, + std::vector > &patch_gradients) const + { + fe_patch_values.get_function_gradients (*vector, patch_gradients); + } + + + + template + void + DataEntry:: + get_function_hessians (const FEValuesBase &fe_patch_values, + std::vector > > &patch_hessians_system) const + { + fe_patch_values.get_function_hessians (*vector, patch_hessians_system); + } + + + + template + void + DataEntry:: + get_function_hessians (const FEValuesBase &fe_patch_values, + std::vector > &patch_hessians) const + { + fe_patch_values.get_function_hessians (*vector, patch_hessians); + } + + + + template + std::size_t + DataEntry::memory_consumption () const + { + return (sizeof (vector) + + MemoryConsumption::memory_consumption (this->names)); + } + + + + template + void + DataEntry::clear () + { + vector = 0; + this->dof_handler = 0; + } + } +} + + + +template +DataOut_DoFData::DataOut_DoFData () + : + triangulation(0,typeid(*this).name()), + dofs(0,typeid(*this).name()) +{} + + + +template +DataOut_DoFData::~DataOut_DoFData () +{ + clear (); +} + + + +template +void +DataOut_DoFData:: +attach_dof_handler (const DH &d) +{ + Assert (dof_data.size() == 0, ExcOldDataStillPresent()); + Assert (cell_data.size() == 0, ExcOldDataStillPresent()); + + triangulation = SmartPointer >(&d.get_tria(), typeid(*this).name()); + dofs = SmartPointer(&d, typeid(*this).name()); +} + + + +template +void +DataOut_DoFData:: +attach_triangulation (const Triangulation &tria) +{ + Assert (dof_data.size() == 0, ExcOldDataStillPresent()); + Assert (cell_data.size() == 0, ExcOldDataStillPresent()); + + triangulation = SmartPointer >(&tria, typeid(*this).name()); +} + + + + +template +template +void +DataOut_DoFData:: +add_data_vector (const VECTOR &vec, + const std::string &name, + const DataVectorType type, + const std::vector &data_component_interpretation) +{ + Assert (triangulation != 0, ExcNoTriangulationSelected ()); + const unsigned int n_components = + dofs != 0 ? dofs->get_fe().n_components () : 1; + + std::vector names; + // if only one component or vector is cell vector: we only need one name + if ((n_components == 1) || + (vec.size() == triangulation->n_active_cells())) + { + names.resize (1, name); + } + else + // otherwise append _i to the given name + { + names.resize (n_components); + for (unsigned int i=0; i +template +void +DataOut_DoFData:: +add_data_vector (const VECTOR &vec, + const std::vector &names, + const DataVectorType type, + const std::vector &data_component_interpretation_) +{ + Assert (triangulation != 0, ExcNoTriangulationSelected ()); + + const std::vector & + data_component_interpretation + = (data_component_interpretation_.size() != 0 + ? + data_component_interpretation_ + : + std::vector + (names.size(), DataComponentInterpretation::component_is_scalar)); + + // either cell data and one name, + // or dof data and n_components names + DataVectorType actual_type = type; + if (type == type_automatic) + { + if (vec.size() == triangulation->n_active_cells()) + actual_type = type_cell_data; + else + actual_type = type_dof_data; + } + + switch (actual_type) + { + case type_cell_data: + Assert (vec.size() == triangulation->n_active_cells(), + ExcDimensionMismatch (vec.size(), + triangulation->n_active_cells())); + Assert (names.size() == 1, + ExcInvalidNumberOfNames (names.size(), 1)); + break; + + case type_dof_data: + Assert (dofs != 0, ExcNoDoFHandlerSelected ()); + Assert (vec.size() == dofs->n_dofs(), + ExcInvalidVectorSize (vec.size(), + dofs->n_dofs(), + triangulation->n_active_cells())); + Assert (names.size() == dofs->get_fe().n_components(), + ExcInvalidNumberOfNames (names.size(), dofs->get_fe().n_components())); + break; + + case type_automatic: + // this case should have been handled above... + Assert (false, ExcInternalError()); + } + + internal::DataOut::DataEntryBase *new_entry + = new internal::DataOut::DataEntry(dofs, &vec, names, + data_component_interpretation); + if (actual_type == type_dof_data) + dof_data.push_back (std_cxx1x::shared_ptr >(new_entry)); + else + cell_data.push_back (std_cxx1x::shared_ptr >(new_entry)); +} + + + +template +template +void +DataOut_DoFData:: +add_data_vector (const VECTOR &vec, + const DataPostprocessor &data_postprocessor) +{ + // this is a specialized version of the other function where we have a + // postprocessor. if we do, we know that we have type_dof_data, which makes + // things a bit simpler, we also don't need to deal with some of the other + // stuff and use a different constructor of DataEntry + + Assert (dofs != 0, ExcNoDoFHandlerSelected ()); + + Assert (vec.size() == dofs->n_dofs(), + ExcInvalidVectorSize (vec.size(), + dofs->n_dofs(), + dofs->get_tria().n_active_cells())); + + internal::DataOut::DataEntryBase *new_entry + = new internal::DataOut::DataEntry(dofs, &vec, &data_postprocessor); + dof_data.push_back (std_cxx1x::shared_ptr >(new_entry)); +} + + + +template +template +void +DataOut_DoFData:: +add_data_vector (const DH &dof_handler, + const VECTOR &vec, + const DataPostprocessor &data_postprocessor) +{ + // this is a specialized version of the other function where we have a + // postprocessor. if we do, we know that we have type_dof_data, which makes + // things a bit simpler, we also don't need to deal with some of the other + // stuff and use a different constructor of DataEntry + + AssertDimension (vec.size(), dof_handler.n_dofs()); + + internal::DataOut::DataEntryBase *new_entry + = new internal::DataOut::DataEntry(&dof_handler, &vec, &data_postprocessor); + dof_data.push_back (std_cxx1x::shared_ptr >(new_entry)); +} + + + +template +template +void +DataOut_DoFData:: +add_data_vector (const DH &dof_handler, + const VECTOR &data, + const std::string &name, + const std::vector &data_component_interpretation) +{ + const unsigned int n_components = dof_handler.get_fe().n_components (); + + std::vector names; + // if only one component: we only need one name + if (n_components == 1) + names.resize (1, name); + else + // otherwise append _i to the given name + { + names.resize (n_components); + for (unsigned int i=0; i +template +void +DataOut_DoFData:: +add_data_vector (const DH &dof_handler, + const VECTOR &data, + const std::vector &names, + const std::vector &data_component_interpretation_) +{ + // this is an extended version of the other functions where we pass a vector + // together with its DoFHandler. if we do, we know that we have + // type_dof_data, which makes things a bit simpler + if (triangulation == 0) + triangulation = SmartPointer >(&dof_handler.get_tria(), typeid(*this).name()); + + Assert (&dof_handler.get_tria() == triangulation, + ExcMessage("The triangulation attached to the DoFHandler does not " + "match with the one set previously")); + + Assert (data.size() == dof_handler.n_dofs(), + ExcDimensionMismatch (data.size(), dof_handler.n_dofs())); + + const std::vector & + data_component_interpretation + = (data_component_interpretation_.size() != 0 + ? + data_component_interpretation_ + : + std::vector + (names.size(), DataComponentInterpretation::component_is_scalar)); + + internal::DataOut::DataEntryBase *new_entry + = new internal::DataOut::DataEntry(&dof_handler, &data, names, + data_component_interpretation); + dof_data.push_back (std_cxx1x::shared_ptr >(new_entry)); +} + + + +template +void DataOut_DoFData::clear_data_vectors () +{ + dof_data.erase (dof_data.begin(), dof_data.end()); + cell_data.erase (cell_data.begin(), cell_data.end()); + + // delete patches + std::vector dummy; + patches.swap (dummy); +} + + + +template +void +DataOut_DoFData:: +clear_input_data_references () +{ + for (unsigned int i=0; iclear (); + + for (unsigned int i=0; iclear (); + + if (dofs != 0) + dofs = 0; +} + + + +template +void +DataOut_DoFData::clear () +{ + dof_data.erase (dof_data.begin(), dof_data.end()); + cell_data.erase (cell_data.begin(), cell_data.end()); + + if (dofs != 0) + dofs = 0; + + // delete patches + std::vector dummy; + patches.swap (dummy); +} + + + +template +std::vector +DataOut_DoFData:: +get_dataset_names () const +{ + std::vector names; + // collect the names of dof + // and cell data + typedef + typename std::vector > >::const_iterator + data_iterator; + + for (data_iterator d=dof_data.begin(); + d!=dof_data.end(); ++d) + for (unsigned int i=0; i<(*d)->names.size(); ++i) + names.push_back ((*d)->names[i]); + for (data_iterator d=cell_data.begin(); d!=cell_data.end(); ++d) + { + Assert ((*d)->names.size() == 1, ExcInternalError()); + names.push_back ((*d)->names[0]); + } + + return names; +} + + + +template +std::vector > +DataOut_DoFData::get_vector_data_ranges () const +{ + std::vector > + ranges; + + // collect the ranges of dof + // and cell data + typedef + typename std::vector > >::const_iterator + data_iterator; + + unsigned int output_component = 0; + for (data_iterator d=dof_data.begin(); + d!=dof_data.end(); ++d) + for (unsigned int i=0; i<(*d)->n_output_variables; + ++i, ++output_component) + // see what kind of data we have + // here. note that for the purpose of + // the current function all we care + // about is vector data + if ((*d)->data_component_interpretation[i] == + DataComponentInterpretation::component_is_part_of_vector) + { + // ensure that there is a + // continuous number of next + // space_dim components that all + // deal with vectors + Assert (i+patch_space_dim <= + (*d)->n_output_variables, + ExcInvalidVectorDeclaration (i, + (*d)->names[i])); + for (unsigned int dd=1; dddata_component_interpretation[i+dd] + == + DataComponentInterpretation::component_is_part_of_vector, + ExcInvalidVectorDeclaration (i, + (*d)->names[i])); + + // all seems alright, so figure out + // whether there is a common name + // to these components. if not, + // leave the name empty and let the + // output format writer decide what + // to do here + std::string name = (*d)->names[i]; + for (unsigned int dd=1; ddnames[i+dd]) + { + name = ""; + break; + } + + // finally add a corresponding + // range + std_cxx1x::tuple + range (output_component, + output_component+patch_space_dim-1, + name); + + ranges.push_back (range); + + // increase the 'component' counter + // by the appropriate amount, same + // for 'i', since we have already + // dealt with all these components + output_component += patch_space_dim-1; + i += patch_space_dim-1; + } + + // note that we do not have to traverse the + // list of cell data here because cell data + // is one value per (logical) cell and + // therefore cannot be a vector + + // as a final check, the 'component' + // counter should be at the total number of + // components added up now +#ifdef DEBUG + unsigned int n_output_components = 0; + for (data_iterator d=dof_data.begin(); + d!=dof_data.end(); ++d) + n_output_components += (*d)->n_output_variables; + Assert (output_component == n_output_components, + ExcInternalError()); +#endif + + return ranges; +} + + + +template +const std::vector< dealii::DataOutBase::Patch > & +DataOut_DoFData::get_patches () const +{ + return patches; +} + + + +template +std::vector > > +DataOut_DoFData::get_finite_elements() const +{ + const unsigned int dhdim = DH::dimension; + const unsigned int dhspacedim = DH::space_dimension; + std::vector > > + finite_elements(this->dof_data.size()); + for (unsigned int i=0; idof_data.size(); ++i) + { + Assert (dof_data[i]->dof_handler != 0, ExcNoDoFHandlerSelected ()); + + // avoid creating too many finite elements and doing a lot of work on + // initializing FEValues downstream: if two DoFHandlers are the same + // (checked by pointer comparison), we can re-use the shared_ptr object + // for the second one. We cannot check for finite element equalities + // because we need different FEValues objects for different dof + // handlers. + bool duplicate = false; + for (unsigned int j=0; jdof_handler == dof_data[j]->dof_handler) + { + finite_elements[i] = finite_elements[j]; + duplicate = true; + } + if (duplicate == false) + finite_elements[i].reset(new dealii::hp::FECollection + (this->dof_data[i]->dof_handler->get_fe())); + } + if (this->dof_data.empty()) + { + finite_elements.resize(1); + finite_elements[0].reset(new dealii::hp::FECollection + (FE_DGQ(0))); + } + return finite_elements; +} + + + +template +std::size_t +DataOut_DoFData::memory_consumption () const +{ + return (DataOutInterface::memory_consumption () + + MemoryConsumption::memory_consumption (dofs) + + MemoryConsumption::memory_consumption (patches)); +} + +// explicit instantiations +#ifndef PETSC_USE_COMPLEX + #include "data_out_dof_data.inst" +#endif + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/data_out_dof_data.inst.in b/deal.II/source/numerics/data_out_dof_data.inst.in new file mode 100644 index 0000000000..08ee60879b --- /dev/null +++ b/deal.II/source/numerics/data_out_dof_data.inst.in @@ -0,0 +1,428 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2010 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (VEC : SERIAL_VECTORS; DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +{ +// codim=0 + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const VEC &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const VEC &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const VEC &, + const DataPostprocessor::space_dimension> &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const DH &, + const VEC &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const DH &, + const VEC &, + const std::vector &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const DH &, + const VEC &, + const DataPostprocessor::space_dimension> &); + + + +// stuff needed for face data + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const VEC &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const VEC &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const VEC &, + const DataPostprocessor::space_dimension> &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const DH &, + const VEC &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const DH &, + const VEC &, + const std::vector &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const DH &, + const VEC &, + const DataPostprocessor::space_dimension> &); + + + +// things for DataOutRotation + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const VEC &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const VEC &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const VEC &, + const DataPostprocessor::space_dimension> &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const DH &, + const VEC &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const DH &, + const VEC &, + const std::vector &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const DH &, + const VEC &, + const DataPostprocessor::space_dimension> &); + + + +// codim 1 + + #if deal_II_dimension < 3 + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const VEC &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const VEC &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const VEC &, + const DataPostprocessor::space_dimension> &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const DH &, + const VEC &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const DH &, + const VEC &, + const std::vector &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const DH &, + const VEC &, + const DataPostprocessor::space_dimension> &); + #endif + + + +// codim 2 + + #if deal_II_dimension == 3 + template void + DataOut_DoFData,1,3>:: + add_data_vector (const VEC &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,1,3>:: + add_data_vector (const VEC &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,1,3>:: + add_data_vector (const VEC &, + const DataPostprocessor::space_dimension> &); + + template void + DataOut_DoFData,1,3>:: + add_data_vector (const DH<1,3> &, + const VEC &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,1,3>:: + add_data_vector (const DH<1,3> &, + const VEC &, + const std::vector &, + const std::vector &); + + template void + DataOut_DoFData,1,3>:: + add_data_vector (const DH<1,3> &, + const VEC &, + const DataPostprocessor::space_dimension> &); + #endif + +} + + + +for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +{ +// codim=0 + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const IndexSet &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const IndexSet &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const DH &, + const IndexSet &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const DH &, + const IndexSet &, + const std::vector &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension>:: + add_data_vector (const IndexSet &, + const DataPostprocessor::space_dimension> &); + + + +// stuff needed for face data + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const IndexSet &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const IndexSet &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const IndexSet &, + const DataPostprocessor::space_dimension> &); + + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const DH &, + const IndexSet &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>:: + add_data_vector (const DH &, + const IndexSet &, + const std::vector &, + const std::vector &); + +// things for DataOutRotation + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const IndexSet &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const IndexSet &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const IndexSet &, + const DataPostprocessor::space_dimension> &); + + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const DH &, + const IndexSet &, + const std::string &, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension+1,deal_II_dimension+1>:: + add_data_vector (const DH &, + const IndexSet &, + const std::vector &, + const std::vector &); + +// codim 1 + + #if deal_II_dimension < 3 + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const IndexSet &, + const std::string &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const IndexSet &, + const std::vector &, + const DataVectorType, + const std::vector &); + + template void + DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>:: + add_data_vector (const IndexSet &, + const DataPostprocessor::space_dimension> &); + #endif + +} + + + +for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +{ + template class DataOut_DoFData,deal_II_dimension>; + template class DataOut_DoFData,deal_II_dimension+1>; + + #if deal_II_dimension < 3 + template class DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>; + template class DataOut_DoFData,deal_II_dimension,deal_II_dimension+1>; + #endif + + #if deal_II_dimension >= 2 + template class DataOut_DoFData,deal_II_dimension-1,deal_II_dimension>; + #endif + + #if deal_II_dimension == 3 + template class DataOut_DoFData,1,3>; + template class DataOut_DoFData,1,3>; + #endif + +} + + +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) +{ + namespace internal \{ + namespace DataOut \{ +#if deal_II_dimension <= deal_II_space_dimension + template struct ParallelDataBase; +#endif + \} + \} +} + + +for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) +{ + namespace internal \{ + namespace DataOut \{ +#if deal_II_dimension <= deal_II_space_dimension + template + void + ParallelDataBase:: + reinit_all_fe_values > + (std::vector > > > &dof_data, + const dealii::Triangulation::cell_iterator &cell, + const unsigned int face); +#endif + \} + \} +} diff --git a/deal.II/source/numerics/data_out_faces.cc b/deal.II/source/numerics/data_out_faces.cc index ec0cf5e1dc..4dd1ccec43 100644 --- a/deal.II/source/numerics/data_out_faces.cc +++ b/deal.II/source/numerics/data_out_faces.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -34,38 +36,29 @@ namespace internal namespace DataOutFaces { template - template ParallelData:: - ParallelData (const Quadrature &quadrature, - const unsigned int n_components, - const unsigned int n_datasets, + ParallelData (const unsigned int n_datasets, const unsigned int n_subdivisions, const std::vector &n_postprocessor_outputs, const Mapping &mapping, - const FE &finite_elements, + const std::vector > > &finite_elements, const UpdateFlags update_flags) : internal::DataOut:: - ParallelDataBase (n_components, - n_datasets, + ParallelDataBase (n_datasets, n_subdivisions, - quadrature.size(), n_postprocessor_outputs, - finite_elements), - q_collection (quadrature), - mapping_collection (mapping), - x_fe_values (this->mapping_collection, - this->fe_collection, - q_collection, - update_flags) + mapping, + finite_elements, + update_flags, + true) {} + /** - * In a WorkStream context, use - * this function to append the - * patch computed by the parallel - * stage to the array of patches. + * In a WorkStream context, use this function to append the patch computed + * by the parallel stage to the array of patches. */ template void @@ -79,6 +72,7 @@ namespace internal } + template DataOutFaces::DataOutFaces(const bool so) : @@ -86,6 +80,7 @@ DataOutFaces::DataOutFaces(const bool so) {} + template void DataOutFaces:: @@ -96,14 +91,10 @@ build_one_patch (const FaceDescriptor *cell_and_face, Assert (cell_and_face->first->is_locally_owned(), ExcNotImplemented()); - // we use the mapping to transform the - // vertices. However, the mapping works on - // cells, not faces, so transform the face - // vertex to a cell vertex, that to a unit - // cell vertex and then, finally, that to - // the mapped vertex. In most cases this - // complicated procedure will be the - // identity. + // we use the mapping to transform the vertices. However, the mapping works + // on cells, not faces, so transform the face vertex to a cell vertex, that + // to a unit cell vertex and then, finally, that to the mapped vertex. In + // most cases this complicated procedure will be the identity. for (unsigned int vertex=0; vertex::vertices_per_cell; ++vertex) patch.vertices[vertex] = data.mapping_collection[0].transform_unit_to_real_cell (cell_and_face->first, @@ -117,24 +108,22 @@ build_one_patch (const FaceDescriptor *cell_and_face, if (data.n_datasets > 0) { - data.x_fe_values.reinit (cell_and_face->first, cell_and_face->second); - const FEFaceValues &fe_patch_values - = data.x_fe_values.get_present_fe_values (); + data.reinit_all_fe_values(this->dof_data, cell_and_face->first, + cell_and_face->second); + const FEValuesBase &fe_patch_values + = data.get_present_fe_values (0); const unsigned int n_q_points = fe_patch_values.n_quadrature_points; // store the intermediate points Assert(patch.space_dim==DH::dimension, ExcInternalError()); const std::vector > &q_points=fe_patch_values.get_quadrature_points(); - // resize the patch.data member - // in order to have enough memory - // for the quadrature points as - // well + // resize the patch.data member in order to have enough memory for the + // quadrature points as well patch.data.reinit(data.n_datasets+DH::dimension, patch.data.size(1)); - // set the flag indicating that - // for this cell the points are - // explicitly given + // set the flag indicating that for this cell the points are explicitly + // given patch.points_are_available=true; // copy points to patch.data for (unsigned int i=0; idof_data.size(); ++dataset) { + const FEValuesBase &fe_patch_values + = data.get_present_fe_values (dataset); + const unsigned int n_components + = fe_patch_values.get_fe().n_components(); const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; if (postprocessor != 0) { - // we have to postprocess the - // data, so determine, which - // fields have to be updated + // we have to postprocess the data, so determine, which fields + // have to be updated const UpdateFlags update_flags=postprocessor->get_needed_update_flags(); - // get normals, if - // needed. this is a - // geometrical information - // and thus does not depend - // on the number of - // components of the data + // get normals, if needed. this is a geometrical information and + // thus does not depend on the number of components of the data // vector if (update_flags & update_normal_vectors) data.patch_normals=fe_patch_values.get_normal_vectors(); - if (data.n_components == 1) + if (n_components == 1) { - // at each point there is - // only one component of - // value, gradient etc. + // at each point there is only one component of value, + // gradient etc. if (update_flags & update_values) this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values); @@ -193,10 +180,9 @@ build_one_patch (const FaceDescriptor *cell_and_face, } else { - // at each point there is - // a vector valued - // function and its + // at each point there is a vector valued function and its // derivative... + data.resize_system_vectors(n_components); if (update_flags & update_values) this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values_system); @@ -226,13 +212,10 @@ build_one_patch (const FaceDescriptor *cell_and_face, = data.postprocessed_values[dataset][q](component); } else - // now we use the given data - // vector without - // modifications. again, we - // treat single component - // functions separately for - // efficiency reasons. - if (data.n_components == 1) + // now we use the given data vector without modifications. again, + // we treat single component functions separately for efficiency + // reasons. + if (n_components == 1) { this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values); @@ -241,36 +224,29 @@ build_one_patch (const FaceDescriptor *cell_and_face, } else { + data.resize_system_vectors(n_components); this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values_system); - for (unsigned int component=0; componentdof_data[dataset]->n_output_variables; } // then do the cell data for (unsigned int dataset=0; datasetcell_data.size(); ++dataset) { - // we need to get at - // the number of the - // cell to which this - // face belongs in - // order to access the - // cell data. this is - // not readily - // available, so choose - // the following rather - // inefficient way: + // we need to get at the number of the cell to which this face + // belongs in order to access the cell data. this is not readily + // available, so choose the following rather inefficient way: Assert (cell_and_face->first->active(), ExcCellNotActiveForCellData()); const unsigned int cell_number - = std::distance (this->dofs->begin_active(), - typename DH::active_cell_iterator(cell_and_face->first)); + = std::distance (this->triangulation->begin_active(), + typename Triangulation::active_cell_iterator(cell_and_face->first)); const double value = this->cell_data[dataset]->get_cell_data_value (cell_number); @@ -295,8 +271,7 @@ template void DataOutFaces::build_patches (const Mapping &mapping, const unsigned int n_subdivisions_) { - // Check consistency of redundant - // template parameter + // Check consistency of redundant template parameter Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); const unsigned int n_subdivisions = (n_subdivisions_ != 0) @@ -307,33 +282,22 @@ void DataOutFaces::build_patches (const Mapping &mapping, ExcInvalidNumberOfSubdivisions(n_subdivisions)); typedef DataOut_DoFData BaseClass; - Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected()); - - // before we start the loop: - // create a quadrature rule that - // actually has the points on this - // patch - const QTrapez<1> q_trapez; - const QIterated patch_points (q_trapez, n_subdivisions); - - const unsigned int n_components = this->dofs->get_fe().n_components(); + Assert (this->triangulation != 0, + typename BaseClass::ExcNoTriangulationSelected()); unsigned int n_datasets = this->cell_data.size(); for (unsigned int i=0; idof_data.size(); ++i) n_datasets += this->dof_data[i]->n_output_variables; - // first count the cells we want to - // create patches of and make sure - // there is enough memory for that + // first count the cells we want to create patches of and make sure there is + // enough memory for that std::vector all_faces; for (FaceDescriptor face=first_face(); - face.first != this->dofs->end(); + face.first != this->triangulation->end(); face = next_face(face)) all_faces.push_back (face); - // clear the patches array and - // allocate the right number of - // elements + // clear the patches array and allocate the right number of elements this->patches.clear (); this->patches.reserve (all_faces.size()); Assert (this->patches.size() == 0, ExcInternalError()); @@ -352,17 +316,17 @@ void DataOutFaces::build_patches (const Mapping &mapping, update_flags |= this->dof_data[i]->postprocessor->get_needed_update_flags(); update_flags |= update_quadrature_points; - internal::DataOutFaces::ParallelData - thread_data (patch_points, n_components, n_datasets, + internal::DataOutFaces::ParallelData + thread_data (n_datasets, n_subdivisions, n_postprocessor_outputs, mapping, - this->dofs->get_fe(), + this->get_finite_elements(), update_flags); DataOutBase::Patch sample_patch; sample_patch.n_subdivisions = n_subdivisions; sample_patch.data.reinit (n_datasets, - patch_points.size()); + Utilities::fixed_power(n_subdivisions+1)); // now build the patches in parallel WorkStream::run (&all_faces[0], @@ -384,8 +348,8 @@ DataOutFaces::first_face () { // simply find first active cell // with a face on the boundary - typename DH::active_cell_iterator cell = this->dofs->begin_active(); - for (; cell != this->dofs->end(); ++cell) + typename Triangulation::active_cell_iterator cell = this->triangulation->begin_active(); + for (; cell != this->triangulation->end(); ++cell) for (unsigned int f=0; f::faces_per_cell; ++f) if (!surface_only || cell->face(f)->at_boundary()) return FaceDescriptor(cell, f); @@ -405,9 +369,7 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) { FaceDescriptor face = old_face; - // first check whether the present - // cell has more faces on the - // boundary + // first check whether the present cell has more faces on the boundary for (unsigned int f=face.second+1; f::faces_per_cell; ++f) if (!surface_only || face.first->face(f)->at_boundary()) // yup, that is so, so return it @@ -416,23 +378,19 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) return face; }; - // otherwise find the next active - // cell that has a face on the - // boundary + // otherwise find the next active cell that has a face on the boundary - // convert the iterator to an - // active_iterator and advance - // this to the next active cell - typename DH::active_cell_iterator active_cell = face.first; + // convert the iterator to an active_iterator and advance this to the next + // active cell + typename Triangulation::active_cell_iterator active_cell = face.first; // increase face pointer by one ++active_cell; // while there are active cells - while (active_cell != this->dofs->end()) + while (active_cell != this->triangulation->end()) { - // check all the faces of this - // active cell + // check all the faces of this active cell for (unsigned int f=0; f::faces_per_cell; ++f) if (!surface_only || active_cell->face(f)->at_boundary()) { @@ -440,15 +398,12 @@ DataOutFaces::next_face (const FaceDescriptor &old_face) face.second = f; return face; }; - // the present cell had no - // faces on the boundary, so - // check next cell + // the present cell had no faces on the boundary, so check next cell ++active_cell; }; - // we fell off the edge, so return - // with invalid pointer - face.first = this->dofs->end(); + // we fell off the edge, so return with invalid pointer + face.first = this->triangulation->end(); face.second = 0; return face; } diff --git a/deal.II/source/numerics/data_out_faces.inst.in b/deal.II/source/numerics/data_out_faces.inst.in index f33ccf0591..84516e4da6 100644 --- a/deal.II/source/numerics/data_out_faces.inst.in +++ b/deal.II/source/numerics/data_out_faces.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/numerics/data_out_rotation.cc b/deal.II/source/numerics/data_out_rotation.cc index 07e4a56805..5593d7a792 100644 --- a/deal.II/source/numerics/data_out_rotation.cc +++ b/deal.II/source/numerics/data_out_rotation.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -47,37 +49,31 @@ namespace internal namespace DataOutRotation { template - template ParallelData:: - ParallelData (const Quadrature &quadrature, - const unsigned int n_components, - const unsigned int n_datasets, + ParallelData (const unsigned int n_datasets, const unsigned int n_subdivisions, const unsigned int n_patches_per_circle, const std::vector &n_postprocessor_outputs, - const FE &finite_elements, + const Mapping &mapping, + const std::vector > > &finite_elements, const UpdateFlags update_flags) : internal::DataOut:: - ParallelDataBase (n_components, - n_datasets, + ParallelDataBase (n_datasets, n_subdivisions, - quadrature.size(), n_postprocessor_outputs, - finite_elements), - n_patches_per_circle (n_patches_per_circle), - q_collection (quadrature), - x_fe_values (this->fe_collection, - q_collection, - update_flags) + mapping, + finite_elements, + update_flags, + false), + n_patches_per_circle (n_patches_per_circle) {} + /** - * In a WorkStream context, use - * this function to append the - * patch computed by the parallel - * stage to the array of patches. + * In a WorkStream context, use this function to append the patch computed + * by the parallel stage to the array of patches. */ template void @@ -104,10 +100,8 @@ build_one_patch (const cell_iterator *cell, { if (dim == 3) { - // would this function make any - // sense after all? who would want - // to output/compute in four space - // dimensions? + // would this function make any sense after all? who would want to + // output/compute in four space dimensions? Assert (false, ExcNotImplemented()); return; } @@ -117,20 +111,13 @@ build_one_patch (const cell_iterator *cell, const unsigned int n_patches_per_circle = data.n_patches_per_circle; - // another abbreviation denoting - // the number of q_points in each - // direction + // another abbreviation denoting the number of q_points in each direction const unsigned int n_points = data.n_subdivisions+1; - // set up an array that holds the - // directions in the plane of - // rotation in which we will put - // points in the whole domain (not - // the rotationally reduced one in - // which the computation took - // place. for simplicity add the - // initial direction at the end - // again + // set up an array that holds the directions in the plane of rotation in + // which we will put points in the whole domain (not the rotationally + // reduced one in which the computation took place. for simplicity add the + // initial direction at the end again std::vector > angle_directions (n_patches_per_circle+1); for (unsigned int i=0; i<=n_patches_per_circle; ++i) { @@ -142,13 +129,9 @@ build_one_patch (const cell_iterator *cell, for (unsigned int angle=0; angle v = (*cell)->vertex(vertex); - // make sure that the - // radial variable does - // attain negative + // make sure that the radial variable does attain negative // values Assert (v(0) >= 0, ExcRadialVariableHasNegativeValues(v(0))); - // now set the vertices - // of the patch + // now set the vertices of the patch patches[angle].vertices[vertex] = v(0) * angle_directions[angle]; patches[angle].vertices[vertex][0] = v(1); @@ -203,13 +183,14 @@ build_one_patch (const cell_iterator *cell, // then fill in data if (data.n_datasets > 0) { - data.x_fe_values.reinit (*cell); - const FEValues &fe_patch_values - = data.x_fe_values.get_present_fe_values (); - + data.reinit_all_fe_values(this->dof_data, *cell); // first fill dof_data for (unsigned int dataset=0; datasetdof_data.size(); ++dataset) { + const FEValuesBase & fe_patch_values + = data.get_present_fe_values(dataset); + const unsigned int n_components + = fe_patch_values.get_fe().n_components(); const DataPostprocessor *postprocessor=this->dof_data[dataset]->postprocessor; if (postprocessor != 0) { @@ -218,7 +199,7 @@ build_one_patch (const cell_iterator *cell, // fields have to be updated const UpdateFlags update_flags=postprocessor->get_needed_update_flags(); - if (data.n_components == 1) + if (n_components == 1) { // at each point there is // only one component of @@ -247,10 +228,10 @@ build_one_patch (const cell_iterator *cell, } else { - // at each point there is - // a vector valued - // function and its - // derivative... + data.resize_system_vectors(n_components); + + // at each point there is a vector valued function and + // its derivative... if (update_flags & update_values) this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values_system); @@ -304,7 +285,7 @@ build_one_patch (const cell_iterator *cell, } } } - else if (data.n_components == 1) + else if (n_components == 1) { this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values); @@ -337,10 +318,11 @@ build_one_patch (const cell_iterator *cell, else // system of components { + data.resize_system_vectors(n_components); this->dof_data[dataset]->get_function_values (fe_patch_values, data.patch_values_system); - for (unsigned int component=0; componentcell_data.size(); ++dataset) { - // we need to get at - // the number of the - // cell to which this - // face belongs in - // order to access the - // cell data. this is - // not readily - // available, so choose - // the following rather - // inefficient way: + // we need to get at the number of the cell to which this face + // belongs in order to access the cell data. this is not readily + // available, so choose the following rather inefficient way: Assert ((*cell)->active(), ExcMessage("Cell must be active for cell data")); const unsigned int cell_number - = std::distance (this->dofs->begin_active(), - typename DH::active_cell_iterator(*cell)); + = std::distance (this->triangulation->begin_active(), + typename Triangulation::active_cell_iterator(*cell)); const double value = this->cell_data[dataset]->get_cell_data_value (cell_number); switch (DH::dimension) @@ -432,7 +407,8 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci // template parameter Assert (dim==DH::dimension, ExcDimensionMismatch(dim, DH::dimension)); typedef DataOut_DoFData BaseClass; - Assert (this->dofs != 0, typename BaseClass::ExcNoDoFHandlerSelected()); + Assert (this->triangulation != 0, + typename BaseClass::ExcNoTriangulationSelected()); const unsigned int n_subdivisions = (nnnn_subdivisions != 0) ? nnnn_subdivisions @@ -440,10 +416,6 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci Assert (n_subdivisions >= 1, ExcInvalidNumberOfSubdivisions(n_subdivisions)); - const QTrapez<1> q_trapez; - const QIterated patch_points (q_trapez, n_subdivisions); - - const unsigned int n_components = this->dofs->get_fe().n_components(); unsigned int n_datasets=this->cell_data.size(); for (unsigned int i=0; idof_data.size(); ++i) n_datasets+= this->dof_data[i]->n_output_variables; @@ -463,7 +435,7 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci // create patches of and make sure // there is enough memory for that std::vector all_cells; - for (cell_iterator cell=first_cell(); cell != this->dofs->end(); + for (cell_iterator cell=first_cell(); cell != this->triangulation->end(); cell = next_cell(cell)) all_cells.push_back (cell); @@ -483,10 +455,11 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci else n_postprocessor_outputs[dataset] = 0; + const MappingQ1 mapping; internal::DataOutRotation::ParallelData - thread_data (patch_points, n_components, n_datasets, + thread_data (n_datasets, n_subdivisions, n_patches_per_circle, - n_postprocessor_outputs, this->dofs->get_fe(), + n_postprocessor_outputs, mapping, this->get_finite_elements(), update_flags); std::vector > new_patches (n_patches_per_circle); @@ -494,8 +467,7 @@ void DataOutRotation::build_patches (const unsigned int n_patches_per_ci { new_patches[i].n_subdivisions = n_subdivisions; new_patches[i].data.reinit (n_datasets, - patch_points.size() - * (n_subdivisions+1)); + Utilities::fixed_power(n_subdivisions+1)); } // now build the patches in parallel @@ -516,7 +488,7 @@ template typename DataOutRotation::cell_iterator DataOutRotation::first_cell () { - return this->dofs->begin_active (); + return this->triangulation->begin_active (); } @@ -527,7 +499,7 @@ DataOutRotation::next_cell (const cell_iterator &cell) // convert the iterator to an // active_iterator and advance // this to the next active cell - typename DH::active_cell_iterator active_cell = cell; + typename Triangulation::active_cell_iterator active_cell = cell; ++active_cell; return active_cell; } diff --git a/deal.II/source/numerics/data_out_rotation.inst.in b/deal.II/source/numerics/data_out_rotation.inst.in index 95bbbea204..a44a7c69f8 100644 --- a/deal.II/source/numerics/data_out_rotation.inst.in +++ b/deal.II/source/numerics/data_out_rotation.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/numerics/data_out_stack.cc b/deal.II/source/numerics/data_out_stack.cc index 41750ae635..9498aeef4a 100644 --- a/deal.II/source/numerics/data_out_stack.cc +++ b/deal.II/source/numerics/data_out_stack.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/numerics/data_out_stack.inst.in b/deal.II/source/numerics/data_out_stack.inst.in index 2c77b5ff57..67a6ccc773 100644 --- a/deal.II/source/numerics/data_out_stack.inst.in +++ b/deal.II/source/numerics/data_out_stack.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/numerics/data_postprocessor.cc b/deal.II/source/numerics/data_postprocessor.cc index 99149e8bd2..70c386017c 100644 --- a/deal.II/source/numerics/data_postprocessor.cc +++ b/deal.II/source/numerics/data_postprocessor.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2010, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include DEAL_II_NAMESPACE_OPEN diff --git a/deal.II/source/numerics/data_postprocessor.inst.in b/deal.II/source/numerics/data_postprocessor.inst.in index 601653a179..b170d35b3b 100644 --- a/deal.II/source/numerics/data_postprocessor.inst.in +++ b/deal.II/source/numerics/data_postprocessor.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/numerics/derivative_approximation.cc b/deal.II/source/numerics/derivative_approximation.cc index 59929690ba..bea59d9959 100644 --- a/deal.II/source/numerics/derivative_approximation.cc +++ b/deal.II/source/numerics/derivative_approximation.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012, 2013 by the deal.II authors +// Copyright (C) 2000 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include diff --git a/deal.II/source/numerics/derivative_approximation.inst.in b/deal.II/source/numerics/derivative_approximation.inst.in index 8abdb2bde7..6e7ed876ab 100644 --- a/deal.II/source/numerics/derivative_approximation.inst.in +++ b/deal.II/source/numerics/derivative_approximation.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS ; VEC : SERIAL_VECTORS ; DH : DOFHANDLER_TEMPLATES) { diff --git a/deal.II/source/numerics/dof_output_operator.cc b/deal.II/source/numerics/dof_output_operator.cc index 8fd7ff76ad..740c8e89e7 100644 --- a/deal.II/source/numerics/dof_output_operator.cc +++ b/deal.II/source/numerics/dof_output_operator.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/numerics/dof_output_operator.inst.in b/deal.II/source/numerics/dof_output_operator.inst.in index 2f28e5e08b..5aeafb7734 100644 --- a/deal.II/source/numerics/dof_output_operator.inst.in +++ b/deal.II/source/numerics/dof_output_operator.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/numerics/error_estimator.cc b/deal.II/source/numerics/error_estimator.cc index 676a4c7e7f..83e89a9afa 100644 --- a/deal.II/source/numerics/error_estimator.cc +++ b/deal.II/source/numerics/error_estimator.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -49,24 +51,14 @@ DEAL_II_NAMESPACE_OPEN namespace { - inline - double sqr (const double x) - { - return x*x; - } - - template inline void advance_by_n (CellIterator &cell, const unsigned int n) { - // store a pointer to the end - // iterator, since we can't get at - // it any more once cell is already - // the end iterator (in that case - // dereferencing cell-> triggers an - // assertion) + // store a pointer to the end iterator, since we can't get at it any more + // once cell is already the end iterator (in that case dereferencing + // cell-> triggers an assertion) const CellIterator endc = cell->get_dof_handler().end(); for (unsigned int t=0; ((t struct ParallelData @@ -146,14 +109,12 @@ namespace internal const dealii::hp::FECollection finite_element; /** - * The quadrature formulas to be used for - * the faces. + * The quadrature formulas to be used for the faces. */ const dealii::hp::QCollection face_quadratures; /** - * FEFaceValues objects to integrate over - * the faces of the current and + * FEFaceValues objects to integrate over the faces of the current and * potentially of neighbor cells. */ dealii::hp::FEFaceValues fe_face_values_cell; @@ -161,38 +122,22 @@ namespace internal dealii::hp::FESubfaceValues fe_subface_values; /** - * A vector to store the jump - * of the normal vectors in - * the quadrature points for - * each of the solution - * vectors (i.e. a temporary - * value). This vector is not - * allocated inside the - * functions that use it, but - * rather globally, since - * memory allocation is slow, - * in particular in presence - * of multiple threads where - * synchronisation makes - * things even slower. + * A vector to store the jump of the normal vectors in the quadrature + * points for each of the solution vectors (i.e. a temporary + * value). This vector is not allocated inside the functions that use + * it, but rather globally, since memory allocation is slow, in + * particular in presence of multiple threads where synchronisation + * makes things even slower. */ std::vector > > phi; /** - * A vector for the gradients of - * the finite element function - * on one cell + * A vector for the gradients of the finite element function on one cell * - * Let psi be a short name - * for a grad u_h, where - * the third index be the - * component of the finite - * element, and the second - * index the number of the - * quadrature point. The - * first index denotes the - * index of the solution - * vector. + * Let psi be a short name for a grad u_h, where the third + * index be the component of the finite element, and the second index + * the number of the quadrature point. The first index denotes the index + * of the solution vector. */ std::vector > > > psi; @@ -202,43 +147,35 @@ namespace internal std::vector > > > neighbor_psi; /** - * The normal vectors of the finite - * element function on one face + * The normal vectors of the finite element function on one face */ std::vector > normal_vectors; /** - * Two arrays needed for the - * values of coefficients in - * the jumps, if they are - * given. + * Two arrays needed for the values of coefficients in the jumps, if + * they are given. */ std::vector coefficient_values1; std::vector > coefficient_values; /** - * Array for the products of - * Jacobian determinants and - * weights of quadraturs - * points. + * Array for the products of Jacobian determinants and weights of + * quadraturs points. */ std::vector JxW_values; /** - * The subdomain id we are to care - * for. + * The subdomain id we are to care for. */ const types::subdomain_id subdomain_id; /** - * The material id we are to care - * for. + * The material id we are to care for. */ const types::material_id material_id; /** - * Some more references to input data to - * the KellyErrorEstimator::estimate() - * function. + * Some more references to input data to the + * KellyErrorEstimator::estimate() function. */ const typename FunctionMap::type *neumann_bc; const ComponentMask component_mask; @@ -260,10 +197,9 @@ namespace internal const Function *coefficients); /** - * Resize the arrays so that they fit the - * number of quadrature points associated - * with the given finite element index - * into the hp collections. + * Resize the arrays so that they fit the number of quadrature points + * associated with the given finite element index into the hp + * collections. */ void resize (const unsigned int active_fe_index); }; @@ -361,11 +297,9 @@ namespace internal /** - * Copy data from the - * local_face_integrals map of a single - * ParallelData object into a global such - * map. This is the copier stage of a - * WorkStream pipeline. + * Copy data from the local_face_integrals map of a single ParallelData + * object into a global such map. This is the copier stage of a WorkStream + * pipeline. */ template void @@ -373,16 +307,14 @@ namespace internal std::map > &face_integrals) { - // now copy locally computed elements - // into the global map + // now copy locally computed elements into the global map for (typename std::map >::const_iterator p=local_face_integrals.begin(); p!=local_face_integrals.end(); ++p) { - // double check that the - // element does not already - // exists in the global map + // double check that the element does not already exists in the + // global map Assert (face_integrals.find (p->first) == face_integrals.end(), ExcInternalError()); @@ -398,105 +330,38 @@ namespace internal /** - * Actually do the computation on - * a face which has no hanging - * nodes (it is regular), i.e. - * either on the other side there - * is nirvana (face is at - * boundary), or the other side's - * refinement level is the same - * as that of this side, then - * handle the integration of - * these both cases together. + * Actually do the computation based on the evaluated gradients in + * ParallelData. */ - template - void - integrate_over_regular_face (const std::vector &solutions, - ParallelData ¶llel_data, - std::map > &local_face_integrals, - const typename DH::active_cell_iterator &cell, - const unsigned int face_no, - dealii::hp::FEFaceValues &fe_face_values_cell, - dealii::hp::FEFaceValues &fe_face_values_neighbor) + template + std::vector + integrate_over_face (ParallelData ¶llel_data, + const typename DH::face_iterator &face, + dealii::hp::FEFaceValues &fe_face_values_cell) { - const unsigned int dim = DH::dimension; - - const typename DH::face_iterator face = cell->face(face_no); - const unsigned int n_q_points = parallel_data.face_quadratures[cell->active_fe_index()].size(), + const unsigned int n_q_points = parallel_data.psi[0].size(), n_components = parallel_data.finite_element.n_components(), - n_solution_vectors = solutions.size(); - + n_solution_vectors = parallel_data.psi.size(); - // initialize data of the restriction - // of this cell to the present face - fe_face_values_cell.reinit (cell, face_no, - cell->active_fe_index()); - - // get gradients of the finite element - // function on this cell - for (unsigned int n=0; nat_boundary() == false) - // internal face; integrate jump - // of gradient across this face { - Assert (cell->neighbor(face_no).state() == IteratorState::valid, - ExcInternalError()); - - const typename DH::active_cell_iterator neighbor = cell->neighbor(face_no); - - // find which number the - // current face has relative to - // the neighboring cell - const unsigned int neighbor_neighbor - = cell->neighbor_of_neighbor (face_no); - Assert (neighbor_neighbor::faces_per_cell, - ExcInternalError()); - - // get restriction of finite element - // function of @p{neighbor} to the - // common face. in the hp case, use the - // quadrature formula that matches the - // one we would use for the present - // cell - fe_face_values_neighbor.reinit (neighbor, neighbor_neighbor, - cell->active_fe_index()); - - // get gradients on neighbor cell + // compute the jump in the gradients for (unsigned int n=0; nn_components == 1) { - parallel_data.coefficients ->value_list (fe_face_values_cell.get_present_fe_values() .get_quadrature_points(), @@ -543,18 +407,15 @@ namespace internal if (face->at_boundary() == true) - // neumann boundary face. compute - // difference between normal - // derivative and boundary function + // neumann boundary face. compute difference between normal derivative + // and boundary function { const types::boundary_id boundary_indicator = face->boundary_indicator(); Assert (parallel_data.neumann_bc->find(boundary_indicator) != parallel_data.neumann_bc->end(), ExcInternalError ()); - // get the values of the boundary - // function at the quadrature - // points + // get the values of the boundary function at the quadrature points if (n_components == 1) { std::vector g(n_q_points); @@ -585,26 +446,94 @@ namespace internal // now phi contains the following: // - for an internal face, phi=[a du/dn] - // - for a neumann boundary face, - // phi=a du/dn-g - // each component being the - // mentioned value at one of the - // quadrature points + // - for a neumann boundary face, phi=a du/dn-g + // each component being the mentioned value at one of the quadrature + // points parallel_data.JxW_values = fe_face_values_cell.get_present_fe_values().get_JxW_values(); - // take the square of the phi[i] - // for integration, and sum up + // take the square of the phi[i] for integration, and sum up std::vector face_integral (n_solution_vectors, 0); for (unsigned int n=0; n(parallel_data.phi[n][p][component]) * parallel_data.JxW_values[p]; - local_face_integrals[face] = face_integral; + return face_integral; + } + + + + /** + * Actually do the computation on a face which has no hanging nodes (it is + * regular), i.e. either on the other side there is nirvana (face is at + * boundary), or the other side's refinement level is the same as that of + * this side, then handle the integration of these both cases together. + */ + template + void + integrate_over_regular_face (const std::vector &solutions, + ParallelData ¶llel_data, + std::map > &local_face_integrals, + const typename DH::active_cell_iterator &cell, + const unsigned int face_no, + dealii::hp::FEFaceValues &fe_face_values_cell, + dealii::hp::FEFaceValues &fe_face_values_neighbor) + { + const unsigned int dim = DH::dimension; + + const typename DH::face_iterator face = cell->face(face_no); + const unsigned int n_solution_vectors = solutions.size(); + + + // initialize data of the restriction + // of this cell to the present face + fe_face_values_cell.reinit (cell, face_no, + cell->active_fe_index()); + + // get gradients of the finite element + // function on this cell + for (unsigned int n=0; nat_boundary() == false) + // internal face; integrate jump of gradient across this face + { + Assert (cell->neighbor(face_no).state() == IteratorState::valid, + ExcInternalError()); + + const typename DH::active_cell_iterator neighbor = cell->neighbor(face_no); + + // find which number the current face has relative to the + // neighboring cell + const unsigned int neighbor_neighbor + = cell->neighbor_of_neighbor (face_no); + Assert (neighbor_neighbor::faces_per_cell, + ExcInternalError()); + + // get restriction of finite element function of @p{neighbor} to the + // common face. in the hp case, use the quadrature formula that + // matches the one we would use for the present cell + fe_face_values_neighbor.reinit (neighbor, neighbor_neighbor, + cell->active_fe_index()); + + // get gradients on neighbor cell + for (unsigned int n=0; n void - integrate_over_irregular_face (const std::vector &solutions, - ParallelData ¶llel_data, + integrate_over_irregular_face (const std::vector &solutions, + ParallelData ¶llel_data, std::map > &local_face_integrals, const typename DH::active_cell_iterator &cell, const unsigned int face_no, @@ -633,28 +562,21 @@ namespace internal const unsigned int dim = DH::dimension; const typename DH::cell_iterator neighbor = cell->neighbor(face_no); - const unsigned int n_q_points = parallel_data.face_quadratures[cell->active_fe_index()].size(), - n_components = parallel_data.finite_element.n_components(), - n_solution_vectors = solutions.size(); + const unsigned int n_solution_vectors = solutions.size(); const typename DH::face_iterator face=cell->face(face_no); Assert (neighbor.state() == IteratorState::valid, ExcInternalError()); Assert (face->has_children(), ExcInternalError()); - // set up a vector of the gradients - // of the finite element function - // on this cell at the quadrature - // points + + // set up a vector of the gradients of the finite element function on + // this cell at the quadrature points // - // let psi be a short name for - // [a grad u_h], where the second - // index be the component of the - // finite element, and the first - // index the number of the - // quadrature point - - // store which number @p{cell} has - // in the list of neighbors of + // let psi be a short name for [a grad u_h], where the second index be + // the component of the finite element, and the first index the number + // of the quadrature point + + // store which number @p{cell} has in the list of neighbors of // @p{neighbor} const unsigned int neighbor_neighbor = cell->neighbor_of_neighbor (face_no); @@ -664,138 +586,38 @@ namespace internal // loop over all subfaces for (unsigned int subface_no=0; subface_non_children(); ++subface_no) { - // get an iterator pointing to the - // cell behind the present subface + // get an iterator pointing to the cell behind the present subface const typename DH::active_cell_iterator neighbor_child = cell->neighbor_child_on_subface (face_no, subface_no); Assert (!neighbor_child->has_children(), ExcInternalError()); - // restrict the finite element - // on the present cell to the - // subface + // restrict the finite element on the present cell to the subface fe_subface_values.reinit (cell, face_no, subface_no, cell->active_fe_index()); - // restrict the finite element - // on the neighbor cell to the - // common @p{subface}. + // restrict the finite element on the neighbor cell to the common + // @p{subface}. fe_face_values.reinit (neighbor_child, neighbor_neighbor, cell->active_fe_index()); - // store the gradient of the - // solution in psi + // store the gradient of the solution in psi for (unsigned int n=0; nn_components == 1) - { - parallel_data.coefficients - ->value_list (fe_face_values.get_present_fe_values() - .get_quadrature_points(), - parallel_data.coefficient_values1); - for (unsigned int n=0; nvector_value_list (fe_face_values.get_present_fe_values() - .get_quadrature_points(), - parallel_data.coefficient_values); - for (unsigned int n=0; n face_integral (n_solution_vectors, 0); - for (unsigned int n=0; nface(neighbor_neighbor)] - = face_integral; + // call generic evaluate function + local_face_integrals[neighbor_child->face(neighbor_neighbor)] = + integrate_over_face (parallel_data, face, fe_face_values); } - - // finally loop over all subfaces to - // collect the contributions of the - // subfaces and store them with the - // mother face + // finally loop over all subfaces to collect the contributions of the + // subfaces and store them with the mother face std::vector sum (n_solution_vectors, 0); for (unsigned int subface_no=0; subface_non_children(); ++subface_no) { @@ -814,29 +636,25 @@ namespace internal /** - * Computate the error on the faces of a - * single cell. + * Computate the error on the faces of a single cell. * - * This function is only needed - * in two or three dimensions. - * The error estimator in one - * dimension is implemented - * seperatly. + * This function is only needed in two or three dimensions. The error + * estimator in one dimension is implemented separately. */ - template + template void estimate_one_cell (const typename DH::active_cell_iterator &cell, ParallelData ¶llel_data, std::map > &local_face_integrals, const std::vector &solutions) { + const unsigned int dim = DH::dimension; const unsigned int n_solution_vectors = solutions.size(); const types::subdomain_id subdomain_id = parallel_data.subdomain_id; const unsigned int material_id = parallel_data.material_id; - // empty our own copy of the local face - // integrals + // empty our own copy of the local face integrals local_face_integrals.clear(); // loop over all faces of this cell @@ -846,20 +664,11 @@ namespace internal const typename DH::face_iterator face=cell->face(face_no); - // make sure we do work - // only once: this face - // may either be regular - // or irregular. if it is - // regular and has a - // neighbor, then we - // visit the face twice, - // once from every - // side. let the one with - // the lower index do the - // work. if it is at the - // boundary, or if the - // face is irregular, - // then do the work below + // make sure we do work only once: this face may either be regular + // or irregular. if it is regular and has a neighbor, then we visit + // the face twice, once from every side. let the one with the lower + // index do the work. if it is at the boundary, or if the face is + // irregular, then do the work below if ((face->has_children() == false) && !cell->at_boundary(face_no) && (!cell->neighbor_is_coarser(face_no) && @@ -868,24 +677,17 @@ namespace internal cell->neighbor(face_no)->level() < cell->level())))) continue; - // if the neighboring cell is less - // refined than the present one, - // then do nothing since we - // integrate over the subfaces when - // we visit the coarse cells. + // if the neighboring cell is less refined than the present one, + // then do nothing since we integrate over the subfaces when we + // visit the coarse cells. if (face->at_boundary() == false) if (cell->neighbor_is_coarser(face_no)) continue; - // if this face is part of the - // boundary but not of the neumann - // boundary -> nothing to - // do. However, to make things - // easier when summing up the - // contributions of the faces of - // cells, we enter this face into - // the list of faces with - // contribution zero. + // if this face is part of the boundary but not of the neumann + // boundary -> nothing to do. However, to make things easier when + // summing up the contributions of the faces of cells, we enter this + // face into the list of faces with contribution zero. if (face->at_boundary() && (parallel_data.neumann_bc->find(face->boundary_indicator()) == @@ -896,12 +698,9 @@ namespace internal continue; } - // finally: note that we only have - // to do something if either the - // present cell is on the subdomain - // we care for (and the same for - // material_id), or if one of the - // neighbors behind the face is on + // finally: note that we only have to do something if either the + // present cell is on the subdomain we care for (and the same for + // material_id), or if one of the neighbors behind the face is on // the subdomain we care for if ( ! ( ((subdomain_id == numbers::invalid_subdomain_id) || @@ -911,11 +710,8 @@ namespace internal || (cell->material_id() == material_id))) ) { - // ok, cell is unwanted, but - // maybe its neighbor behind - // the face we presently work - // on? oh is there a face at - // all? + // ok, cell is unwanted, but maybe its neighbor behind the face + // we presently work on? oh is there a face at all? if (face->at_boundary()) continue; @@ -948,32 +744,24 @@ namespace internal } } - // so if none of the neighbors - // cares for this subdomain or - // material either, then try - // next face + // so if none of the neighbors cares for this subdomain or + // material either, then try next face if (care_for_cell == false) continue; } - // so now we know that we care for - // this face, let's do something - // about it. first re-size the - // arrays we may use to the correct + // so now we know that we care for this face, let's do something + // about it. first re-size the arrays we may use to the correct // size: parallel_data.resize (cell->active_fe_index()); // then do the actual integration if (face->has_children() == false) - // if the face is a regular one, - // i.e. either on the other side - // there is nirvana (face is at - // boundary), or the other side's - // refinement level is the same - // as that of this side, then - // handle the integration of - // these both cases together + // if the face is a regular one, i.e. either on the other side + // there is nirvana (face is at boundary), or the other side's + // refinement level is the same as that of this side, then handle + // the integration of these both cases together integrate_over_regular_face (solutions, parallel_data, local_face_integrals, @@ -982,10 +770,8 @@ namespace internal parallel_data.fe_face_values_neighbor); else - // otherwise we need to do some - // special computations which do - // not fit into the framework of - // the above function + // otherwise we need to do some special computations which do not + // fit into the framework of the above function integrate_over_irregular_face (solutions, parallel_data, local_face_integrals, @@ -1001,418 +787,6 @@ namespace internal - - -template -template -void -KellyErrorEstimator<1,spacedim>:: -estimate (const Mapping<1,spacedim> &mapping, - const DH &dof_handler, - const Quadrature<0> &quadrature, - const typename FunctionMap::type &neumann_bc, - const InputVector &solution, - Vector &error, - const ComponentMask &component_mask, - const Function *coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id) -{ - // just pass on to the other function - const std::vector solutions (1, &solution); - std::vector*> errors (1, &error); - estimate (mapping, dof_handler, quadrature, neumann_bc, solutions, errors, - component_mask, coefficients, n_threads, subdomain_id, material_id); -} - - - -template -template -void -KellyErrorEstimator<1,spacedim>:: -estimate (const DH &dof_handler, - const Quadrature<0> &quadrature, - const typename FunctionMap::type &neumann_bc, - const InputVector &solution, - Vector &error, - const ComponentMask &component_mask, - const Function *coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id) -{ - estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solution, - error, component_mask, coefficients, n_threads, subdomain_id, material_id); -} - - - -template -template -void -KellyErrorEstimator<1,spacedim>:: -estimate (const DH &dof_handler, - const Quadrature<0> &quadrature, - const typename FunctionMap::type &neumann_bc, - const std::vector &solutions, - std::vector*> &errors, - const ComponentMask &component_mask, - const Function *coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id) -{ - estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solutions, - errors, component_mask, coefficients, n_threads, subdomain_id, material_id); -} - - - -template -template -void -KellyErrorEstimator<1,spacedim>:: -estimate (const Mapping<1,spacedim> &mapping, - const DH &dof_handler, - const hp::QCollection<0> &quadrature, - const typename FunctionMap::type &neumann_bc, - const InputVector &solution, - Vector &error, - const ComponentMask &component_mask, - const Function *coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id) -{ - // just pass on to the other function - const std::vector solutions (1, &solution); - std::vector*> errors (1, &error); - estimate (mapping, dof_handler, quadrature, neumann_bc, solutions, errors, - component_mask, coefficients, n_threads, subdomain_id, material_id); -} - - -template -template -void -KellyErrorEstimator<1,spacedim>:: -estimate (const DH &dof_handler, - const hp::QCollection<0> &quadrature, - const typename FunctionMap::type &neumann_bc, - const InputVector &solution, - Vector &error, - const ComponentMask &component_mask, - const Function *coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id) -{ - estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solution, - error, component_mask, coefficients, n_threads, subdomain_id, material_id); -} - - - -template -template -void -KellyErrorEstimator<1,spacedim>:: -estimate (const DH &dof_handler, - const hp::QCollection<0> &quadrature, - const typename FunctionMap::type &neumann_bc, - const std::vector &solutions, - std::vector*> &errors, - const ComponentMask &component_mask, - const Function *coefficients, - const unsigned int n_threads, - const types::subdomain_id subdomain_id, - const types::material_id material_id) -{ - estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solutions, - errors, component_mask, coefficients, n_threads, subdomain_id, material_id); -} - - - - -template -template -void KellyErrorEstimator<1,spacedim>:: -estimate (const Mapping<1,spacedim> &/*mapping*/, - const DH &/*dof_handler*/, - const hp::QCollection<0> &, - const typename FunctionMap::type &/*neumann_bc*/, - const std::vector &/*solutions*/, - std::vector*> &/*errors*/, - const ComponentMask &/*component_mask_*/, - const Function */*coefficient*/, - const unsigned int, - const types::subdomain_id /*subdomain_id*/, - const types::material_id /*material_id*/) -{ - Assert (false, ExcInternalError()); -} - - - -template -template -void KellyErrorEstimator<1,spacedim>:: -estimate (const Mapping<1,spacedim> &mapping, - const DH &dof_handler, - const Quadrature<0> &, - const typename FunctionMap::type &neumann_bc, - const std::vector &solutions, - std::vector*> &errors, - const ComponentMask &component_mask, - const Function *coefficient, - const unsigned int, - const types::subdomain_id subdomain_id_, - const types::material_id material_id) -{ -#ifdef DEAL_II_WITH_P4EST - if (dynamic_cast*> - (&dof_handler.get_tria()) - != 0) - Assert ((subdomain_id_ == numbers::invalid_subdomain_id) - || - (subdomain_id_ == - dynamic_cast&> - (dof_handler.get_tria()).locally_owned_subdomain()), - ExcMessage ("For parallel distributed triangulations, the only " - "valid subdomain_id that can be passed here is the " - "one that corresponds to the locally owned subdomain id.")); - - const types::subdomain_id subdomain_id - = ((dynamic_cast*> - (&dof_handler.get_tria()) - != 0) - ? - dynamic_cast&> - (dof_handler.get_tria()).locally_owned_subdomain() - : - subdomain_id_); -#else - const types::subdomain_id subdomain_id - = subdomain_id_; -#endif - - const unsigned int n_components = dof_handler.get_fe().n_components(); - const unsigned int n_solution_vectors = solutions.size(); - - // sanity checks - Assert (neumann_bc.find(numbers::internal_face_boundary_id) == neumann_bc.end(), - ExcInvalidBoundaryIndicator()); - - for (typename FunctionMap::type::const_iterator i=neumann_bc.begin(); - i!=neumann_bc.end(); ++i) - Assert (i->second->n_components == n_components, ExcInvalidBoundaryFunction()); - - Assert (component_mask.represents_n_components(n_components), - ExcInvalidComponentMask()); - Assert (component_mask.n_selected_components(n_components) > 0, - ExcInvalidComponentMask()); - - Assert ((coefficient == 0) || - (coefficient->n_components == n_components) || - (coefficient->n_components == 1), - ExcInvalidCoefficient()); - - Assert (solutions.size() > 0, - ExcNoSolutions()); - Assert (solutions.size() == errors.size(), - ExcIncompatibleNumberOfElements(solutions.size(), errors.size())); - for (unsigned int n=0; nsize() == dof_handler.n_dofs(), - ExcInvalidSolutionVector()); - - Assert ((coefficient == 0) || - (coefficient->n_components == n_components) || - (coefficient->n_components == 1), - ExcInvalidCoefficient()); - - for (typename FunctionMap::type::const_iterator i=neumann_bc.begin(); - i!=neumann_bc.end(); ++i) - Assert (i->second->n_components == n_components, - ExcInvalidBoundaryFunction()); - - // reserve one slot for each cell and set - // it to zero - for (unsigned int n=0; n > > > - gradients_here (n_solution_vectors, - std::vector > >(2, std::vector >(n_components))); - std::vector > > > - gradients_neighbor (gradients_here); - std::vector > - grad_neighbor (n_solution_vectors, Vector(n_components)); - - // reserve some space for - // coefficient values at one point. - // if there is no coefficient, then - // we fill it by unity once and for - // all and don't set it any more - Vector coefficient_values (n_components); - if (coefficient == 0) - for (unsigned int c=0; c quadrature; - const hp::QCollection<1> q_collection(quadrature); - - const hp::FECollection<1,spacedim> fe (dof_handler.get_fe()); - - hp::MappingCollection<1,spacedim> mapping_collection; - mapping_collection.push_back (mapping); - - hp::FEValues<1,spacedim> fe_values (mapping_collection, fe, q_collection, - update_gradients); - - // loop over all cells and do something on - // the cells which we're told to work - // on. note that the error indicator is - // only a sum over the two contributions - // from the two vertices of each cell. - typename DH::active_cell_iterator cell = dof_handler.begin_active(); - for (unsigned int cell_index=0; cell != dof_handler.end(); - ++cell, ++cell_index) - if (((subdomain_id == numbers::invalid_subdomain_id) - || - (cell->subdomain_id() == subdomain_id)) - && - ((material_id == numbers::invalid_material_id) - || - (cell->material_id() == material_id))) - { - for (unsigned int n=0; nneighbor(n); - if (neighbor.state() == IteratorState::valid) - while (neighbor->has_children()) - neighbor = neighbor->child(n==0 ? 1 : 0); - - // now get the gradients on the - // both sides of the point - fe_values.reinit (cell); - - for (unsigned int s=0; ssecond->value(cell->vertex(0)); - - for (unsigned int s=0; s v(n_components); - neumann_bc.find(n)->second->vector_value(cell->vertex(0), v); - - for (unsigned int s=0; sn_components == 1) - { - const double c_value = coefficient->value (cell->vertex(n)); - for (unsigned int c=0; cvector_value(cell->vertex(n), - coefficient_values); - } - - - for (unsigned int s=0; sdiameter(); - } - } - - for (unsigned int s=0; s @@ -1579,20 +953,14 @@ estimate (const Mapping &mapping, const unsigned int n_solution_vectors = solutions.size(); - // Map of integrals indexed by - // the corresponding face. In this map - // we store the integrated jump of the - // gradient for each face. - // At the end of the function, we again - // loop over the cells and collect the - // contributions of the different faces - // of the cell. + // Map of integrals indexed by the corresponding face. In this map we store + // the integrated jump of the gradient for each face. At the end of the + // function, we again loop over the cells and collect the contributions of + // the different faces of the cell. std::map > face_integrals; - // all the data needed in the error - // estimator by each of the threads - // is gathered in the following - // stuctures + // all the data needed in the error estimator by each of the threads is + // gathered in the following structures const hp::MappingCollection mapping_collection(mapping); const internal::ParallelData parallel_data (dof_handler.get_fe(), @@ -1610,18 +978,16 @@ estimate (const Mapping &mapping, // now let's work on all those cells: WorkStream::run (dof_handler.begin_active(), static_cast(dof_handler.end()), - std_cxx1x::bind (&internal::estimate_one_cell, + std_cxx1x::bind (&internal::estimate_one_cell, std_cxx1x::_1, std_cxx1x::_2, std_cxx1x::_3, std_cxx1x::ref(solutions)), std_cxx1x::bind (&internal::copy_local_to_global, std_cxx1x::_1, std_cxx1x::ref(face_integrals)), parallel_data, sample_local_face_integrals); - // finally add up the contributions of the - // faces for each cell + // finally add up the contributions of the faces for each cell - // reserve one slot for each cell and set - // it to zero + // reserve one slot for each cell and set it to zero for (unsigned int n=0; n &mapping, (*errors[n])(i)=0; } - // now walk over all cells and collect - // information from the faces. only do - // something if this is a cell we care for - // based on the subdomain id + // now walk over all cells and collect information from the faces. only do + // something if this is a cell we care for based on the subdomain id unsigned int present_cell=0; for (typename DH::active_cell_iterator cell=dof_handler.begin_active(); cell!=dof_handler.end(); @@ -1656,9 +1020,8 @@ estimate (const Mapping &mapping, for (unsigned int n=0; nface(face_no)][n] >= 0, ExcInternalError()); diff --git a/deal.II/source/numerics/error_estimator.inst.in b/deal.II/source/numerics/error_estimator.inst.in index 7b701a6992..8ca601fbcf 100644 --- a/deal.II/source/numerics/error_estimator.inst.in +++ b/deal.II/source/numerics/error_estimator.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS ; deal_II_space_dimension : SPACE_DIMENSIONS) { @@ -20,7 +24,7 @@ template class KellyErrorEstimator; for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; DH : DOFHANDLER_TEMPLATES ) { -#if deal_II_dimension <= deal_II_space_dimension +#if deal_II_dimension != 1 && deal_II_dimension <= deal_II_space_dimension template void diff --git a/deal.II/source/numerics/error_estimator_1d.cc b/deal.II/source/numerics/error_estimator_1d.cc new file mode 100644 index 0000000000..15b65d0bc8 --- /dev/null +++ b/deal.II/source/numerics/error_estimator_1d.cc @@ -0,0 +1,439 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +DEAL_II_NAMESPACE_OPEN + + + +template +template +void +KellyErrorEstimator<1,spacedim>:: +estimate (const Mapping<1,spacedim> &mapping, + const DH &dof_handler, + const Quadrature<0> &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const ComponentMask &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id) +{ + // just pass on to the other function + const std::vector solutions (1, &solution); + std::vector*> errors (1, &error); + estimate (mapping, dof_handler, quadrature, neumann_bc, solutions, errors, + component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + + +template +template +void +KellyErrorEstimator<1,spacedim>:: +estimate (const DH &dof_handler, + const Quadrature<0> &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const ComponentMask &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id) +{ + estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solution, + error, component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + + +template +template +void +KellyErrorEstimator<1,spacedim>:: +estimate (const DH &dof_handler, + const Quadrature<0> &quadrature, + const typename FunctionMap::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const ComponentMask &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id) +{ + estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solutions, + errors, component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + + +template +template +void +KellyErrorEstimator<1,spacedim>:: +estimate (const Mapping<1,spacedim> &mapping, + const DH &dof_handler, + const hp::QCollection<0> &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const ComponentMask &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id) +{ + // just pass on to the other function + const std::vector solutions (1, &solution); + std::vector*> errors (1, &error); + estimate (mapping, dof_handler, quadrature, neumann_bc, solutions, errors, + component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + +template +template +void +KellyErrorEstimator<1,spacedim>:: +estimate (const DH &dof_handler, + const hp::QCollection<0> &quadrature, + const typename FunctionMap::type &neumann_bc, + const InputVector &solution, + Vector &error, + const ComponentMask &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id) +{ + estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solution, + error, component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + + +template +template +void +KellyErrorEstimator<1,spacedim>:: +estimate (const DH &dof_handler, + const hp::QCollection<0> &quadrature, + const typename FunctionMap::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const ComponentMask &component_mask, + const Function *coefficients, + const unsigned int n_threads, + const types::subdomain_id subdomain_id, + const types::material_id material_id) +{ + estimate(StaticMappingQ1<1,spacedim>::mapping, dof_handler, quadrature, neumann_bc, solutions, + errors, component_mask, coefficients, n_threads, subdomain_id, material_id); +} + + + + +template +template +void KellyErrorEstimator<1,spacedim>:: +estimate (const Mapping<1,spacedim> &/*mapping*/, + const DH &/*dof_handler*/, + const hp::QCollection<0> &, + const typename FunctionMap::type &/*neumann_bc*/, + const std::vector &/*solutions*/, + std::vector*> &/*errors*/, + const ComponentMask &/*component_mask_*/, + const Function */*coefficient*/, + const unsigned int, + const types::subdomain_id /*subdomain_id*/, + const types::material_id /*material_id*/) +{ + Assert (false, ExcInternalError()); +} + + + +template +template +void KellyErrorEstimator<1,spacedim>:: +estimate (const Mapping<1,spacedim> &mapping, + const DH &dof_handler, + const Quadrature<0> &, + const typename FunctionMap::type &neumann_bc, + const std::vector &solutions, + std::vector*> &errors, + const ComponentMask &component_mask, + const Function *coefficient, + const unsigned int, + const types::subdomain_id subdomain_id_, + const types::material_id material_id) +{ +#ifdef DEAL_II_WITH_P4EST + if (dynamic_cast*> + (&dof_handler.get_tria()) + != 0) + Assert ((subdomain_id_ == numbers::invalid_subdomain_id) + || + (subdomain_id_ == + dynamic_cast&> + (dof_handler.get_tria()).locally_owned_subdomain()), + ExcMessage ("For parallel distributed triangulations, the only " + "valid subdomain_id that can be passed here is the " + "one that corresponds to the locally owned subdomain id.")); + + const types::subdomain_id subdomain_id + = ((dynamic_cast*> + (&dof_handler.get_tria()) + != 0) + ? + dynamic_cast&> + (dof_handler.get_tria()).locally_owned_subdomain() + : + subdomain_id_); +#else + const types::subdomain_id subdomain_id + = subdomain_id_; +#endif + + const unsigned int n_components = dof_handler.get_fe().n_components(); + const unsigned int n_solution_vectors = solutions.size(); + + // sanity checks + Assert (neumann_bc.find(numbers::internal_face_boundary_id) == neumann_bc.end(), + ExcInvalidBoundaryIndicator()); + + for (typename FunctionMap::type::const_iterator i=neumann_bc.begin(); + i!=neumann_bc.end(); ++i) + Assert (i->second->n_components == n_components, ExcInvalidBoundaryFunction()); + + Assert (component_mask.represents_n_components(n_components), + ExcInvalidComponentMask()); + Assert (component_mask.n_selected_components(n_components) > 0, + ExcInvalidComponentMask()); + + Assert ((coefficient == 0) || + (coefficient->n_components == n_components) || + (coefficient->n_components == 1), + ExcInvalidCoefficient()); + + Assert (solutions.size() > 0, + ExcNoSolutions()); + Assert (solutions.size() == errors.size(), + ExcIncompatibleNumberOfElements(solutions.size(), errors.size())); + for (unsigned int n=0; nsize() == dof_handler.n_dofs(), + ExcInvalidSolutionVector()); + + Assert ((coefficient == 0) || + (coefficient->n_components == n_components) || + (coefficient->n_components == 1), + ExcInvalidCoefficient()); + + for (typename FunctionMap::type::const_iterator i=neumann_bc.begin(); + i!=neumann_bc.end(); ++i) + Assert (i->second->n_components == n_components, + ExcInvalidBoundaryFunction()); + + // reserve one slot for each cell and set it to zero + for (unsigned int n=0; n > > > + gradients_here (n_solution_vectors, + std::vector > >(2, std::vector >(n_components))); + std::vector > > > + gradients_neighbor (gradients_here); + std::vector > + grad_neighbor (n_solution_vectors, Vector(n_components)); + + // reserve some space for coefficient values at one point. if there is no + // coefficient, then we fill it by unity once and for all and don't set it + // any more + Vector coefficient_values (n_components); + if (coefficient == 0) + for (unsigned int c=0; c quadrature; + const hp::QCollection<1> q_collection(quadrature); + + const hp::FECollection<1,spacedim> fe (dof_handler.get_fe()); + + hp::MappingCollection<1,spacedim> mapping_collection; + mapping_collection.push_back (mapping); + + hp::FEValues<1,spacedim> fe_values (mapping_collection, fe, q_collection, + update_gradients); + + // loop over all cells and do something on the cells which we're told to + // work on. note that the error indicator is only a sum over the two + // contributions from the two vertices of each cell. + typename DH::active_cell_iterator cell = dof_handler.begin_active(); + for (unsigned int cell_index=0; cell != dof_handler.end(); + ++cell, ++cell_index) + if (((subdomain_id == numbers::invalid_subdomain_id) + || + (cell->subdomain_id() == subdomain_id)) + && + ((material_id == numbers::invalid_material_id) + || + (cell->material_id() == material_id))) + { + for (unsigned int n=0; nneighbor(n); + if (neighbor.state() == IteratorState::valid) + while (neighbor->has_children()) + neighbor = neighbor->child(n==0 ? 1 : 0); + + // now get the gradients on the both sides of the point + fe_values.reinit (cell); + + for (unsigned int s=0; ssecond->value(cell->vertex(0)); + + for (unsigned int s=0; s v(n_components); + neumann_bc.find(n)->second->vector_value(cell->vertex(0), v); + + for (unsigned int s=0; sn_components == 1) + { + const double c_value = coefficient->value (cell->vertex(n)); + for (unsigned int c=0; cvector_value(cell->vertex(n), + coefficient_values); + } + + + for (unsigned int s=0; sdiameter(); + } + } + + for (unsigned int s=0; s:: +estimate > (const Mapping &, + const DH &, + const Quadrature &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const Quadrature &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > (const Mapping &, + const DH &, + const Quadrature &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const Quadrature &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > (const Mapping &, + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const VEC &, + Vector &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > (const Mapping &, + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +template +void +KellyErrorEstimator:: +estimate > ( + const DH &, + const hp::QCollection &, + const FunctionMap::type &, + const std::vector &, + std::vector *> &, + const ComponentMask &, + const Function *, + const unsigned int , + const unsigned int , + const types::material_id); + +#endif +} diff --git a/deal.II/source/numerics/fe_field_function.cc b/deal.II/source/numerics/fe_field_function.cc index f71739892c..d6f176aac0 100644 --- a/deal.II/source/numerics/fe_field_function.cc +++ b/deal.II/source/numerics/fe_field_function.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/numerics/fe_field_function.inst.in b/deal.II/source/numerics/fe_field_function.inst.in index 1a8f3c9e6b..e124e5cce3 100644 --- a/deal.II/source/numerics/fe_field_function.inst.in +++ b/deal.II/source/numerics/fe_field_function.inst.in @@ -1,14 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2007, 2008, 2009, 2012 by the deal.II authors +// Copyright (C) 2007 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (VECTOR : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/numerics/histogram.cc b/deal.II/source/numerics/histogram.cc index b80e62aa3e..ac21b650a4 100644 --- a/deal.II/source/numerics/histogram.cc +++ b/deal.II/source/numerics/histogram.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -22,7 +24,6 @@ DEAL_II_NAMESPACE_OPEN template -inline bool Histogram::logarithmic_less (const number n1, const number n2) { @@ -118,14 +119,14 @@ void Histogram::evaluate (const std::vector > &values, values[i].end(), logarithmic_less_function), logarithmic_less_function); - }; + } break; - }; + } default: Assert (false, ExcInternalError()); - }; + } // move right bound arbitrarily if // necessary. sometimes in logarithmic diff --git a/deal.II/source/numerics/matrix_tools.cc b/deal.II/source/numerics/matrix_tools.cc index 136fd5baee..84004b0079 100644 --- a/deal.II/source/numerics/matrix_tools.cc +++ b/deal.II/source/numerics/matrix_tools.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -195,8 +197,6 @@ namespace MatrixCreator std::vector rhs_values; std::vector > rhs_vector_values; - std::vector old_JxW; - const Function *coefficient; const Function *rhs_function; @@ -1276,7 +1276,7 @@ namespace MatrixCreator UpdateFlags update_flags = UpdateFlags (update_values | update_JxW_values | update_quadrature_points); - hp::FEFaceValues x_fe_values (mapping, fe_collection, q, update_flags); + hp::FEFaceValues x_fe_values (mapping, fe_collection, q, update_flags); // two variables for the coefficient, // one for the two cases indicated in @@ -2010,7 +2010,7 @@ namespace MatrixTools std::map::const_iterator dof = boundary_values.begin(), - endd = boundary_values.end(); + endd = boundary_values.end(); for (; dof != endd; ++dof) { Assert (dof->first < n_dofs, ExcInternalError()); diff --git a/deal.II/source/numerics/matrix_tools.inst.in b/deal.II/source/numerics/matrix_tools.inst.in index 9b37200449..211ccdac5b 100644 --- a/deal.II/source/numerics/matrix_tools.inst.in +++ b/deal.II/source/numerics/matrix_tools.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2010, 2012 by the deal.II authors +// Copyright (C) 2010 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension @@ -109,8 +113,29 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS const Function * const a, std::vector); + template + void + MatrixCreator::create_boundary_mass_matrix + (const hp::MappingCollection&, + const hp::DoFHandler&, + const hp::QCollection&, + SparseMatrix&, + const FunctionMap::type&, + Vector&, + std::vector&, + const Function * const, + std::vector); - + template + void MatrixCreator::create_boundary_mass_matrix + (const hp::DoFHandler&, + const hp::QCollection&, + SparseMatrix&, + const FunctionMap::type&, + Vector&, + std::vector&, + const Function * const, + std::vector); #endif } @@ -120,111 +145,88 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS // where applicable and move to codimension cases above also when applicable for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { -#if deal_II_dimension == deal_II_space_dimension - +#if deal_II_dimension <= deal_II_space_dimension // hp versions of functions template - void MatrixCreator::create_mass_matrix - (const hp::MappingCollection &mapping, - const hp::DoFHandler &dof, + void MatrixCreator::create_mass_matrix + (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function * const coefficient, + const Function * const coefficient, const ConstraintMatrix &constraints); + template - void MatrixCreator::create_mass_matrix - (const hp::DoFHandler &dof, + void MatrixCreator::create_mass_matrix + (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function * const coefficient, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix - (const hp::MappingCollection &mapping, - const hp::DoFHandler &dof, + (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, const hp::QCollection &q, - SparseMatrix &matrix, - const Function &rhs, + SparseMatrix &matrix, + const Function &rhs, Vector &rhs_vector, - const Function * const coefficient, + const Function * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix - (const hp::DoFHandler &dof, + (const hp::DoFHandler &dof, const hp::QCollection &q, - SparseMatrix &matrix, - const Function &rhs, + SparseMatrix &matrix, + const Function &rhs, Vector &rhs_vector, - const Function * const coefficient, + const Function * const coefficient, const ConstraintMatrix &constraints); +#endif +#if deal_II_dimension == deal_II_space_dimension + + template void MatrixCreator::create_mass_matrix - (const hp::MappingCollection &mapping, - const hp::DoFHandler &dof, + (const hp::DoFHandler &dof, const hp::QCollection &q, - SparseMatrix &matrix, - const Function * const coefficient, + SparseMatrix &matrix, + const Function * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix - (const hp::DoFHandler &dof, + (const hp::DoFHandler &dof, const hp::QCollection &q, - SparseMatrix &matrix, - const Function * const coefficient, + SparseMatrix &matrix, + const Function &rhs, + Vector &rhs_vector, + const Function * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix - (const hp::MappingCollection &mapping, - const hp::DoFHandler &dof, + (const hp::MappingCollection &mapping, + const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient, + const Function * const coefficient, const ConstraintMatrix &constraints); + template void MatrixCreator::create_mass_matrix - (const hp::DoFHandler &dof, + (const hp::DoFHandler &dof, const hp::QCollection &q, SparseMatrix &matrix, - const Function &rhs, - Vector &rhs_vector, - const Function * const coefficient, - const ConstraintMatrix &constraints); - - -#if deal_II_dimension != 1 - - - - template - void - MatrixCreator::create_boundary_mass_matrix - (const hp::MappingCollection&, - const hp::DoFHandler&, - const hp::QCollection&, - SparseMatrix&, - const FunctionMap::type&, - Vector&, - std::vector&, - const Function * const, - std::vector); - - template - void MatrixCreator::create_boundary_mass_matrix - (const hp::DoFHandler&, - const hp::QCollection&, - SparseMatrix&, - const FunctionMap::type&, - Vector&, - std::vector&, - const Function * const, - std::vector); - -#endif - + const Function * const coefficient, + const ConstraintMatrix &constraints); // non-hp versions of create_laplace_matrix template diff --git a/deal.II/source/numerics/point_value_history.cc b/deal.II/source/numerics/point_value_history.cc index 35824a54a0..17e4a8c3a2 100644 --- a/deal.II/source/numerics/point_value_history.cc +++ b/deal.II/source/numerics/point_value_history.cc @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009, 2010, 2012 by Michael Rapson and the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + #include #include diff --git a/deal.II/source/numerics/point_value_history.inst.in b/deal.II/source/numerics/point_value_history.inst.in index e175ccbb23..c3ae1f0896 100644 --- a/deal.II/source/numerics/point_value_history.inst.in +++ b/deal.II/source/numerics/point_value_history.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2009 by Michael Rapson and the deal.II authors +// Copyright (C) 2009 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) diff --git a/deal.II/source/numerics/solution_transfer.cc b/deal.II/source/numerics/solution_transfer.cc index c2d78805f1..beb4b0155d 100644 --- a/deal.II/source/numerics/solution_transfer.cc +++ b/deal.II/source/numerics/solution_transfer.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -186,24 +188,13 @@ namespace internal { matrices(i,j).reinit (fe[i].dofs_per_cell, fe[j].dofs_per_cell); - // see if we can get the - // interpolation matrices - // for this combination - // of elements. if not, - // reset the matrix sizes - // to zero to indicate - // that this particular - // combination isn't - // supported. this isn't - // an outright error - // right away since we - // may never need to - // actually interpolate - // between these two - // elements on actual - // cells; we simply have - // to trigger an error if - // someone actually tries + // see if we can get the interpolation matrices for this + // combination of elements. if not, reset the matrix sizes to zero + // to indicate that this particular combination isn't + // supported. this isn't an outright error right away since we may + // never need to actually interpolate between these two elements + // on actual cells; we simply have to trigger an error if someone + // actually tries try { fe[i].get_interpolation_matrix (fe[j], matrices(i,j)); @@ -572,12 +563,41 @@ interpolate (const std::vector &all_in, local_values.reinit (cell->has_children() ? cell->child(0)->get_fe().dofs_per_cell : cell->get_fe().dofs_per_cell, true); - AssertDimension (local_values.size(), - interpolation_hp(new_fe_index,old_index).m()); + // do the interpolation. we get into trouble if the + // interpolation_hp(new,old) matrix hasn't been computed. + // this can happen if the respective elements don't support + // the corresponding interpolation; if that's the case, then + // the computation of the matrix simply sets the matrix + // back to size zero. so if we get here and that is + // the wrong size, then this may be because the elements + // haven't implemented the correct function yet + // + // there is one wrinkle. we would like to only error out if + // the size of the matrix is 0 times 0 but at least one + // of the elements has more than one dof per cell. the + // problem is that if you reinit a matrix to 4x0, it automatically + // sets its size to 0x0. so we can only execute the following + // test if *both* elements have dofs_per_cell>0, not if *at + // least one* have. + Assert (! ((interpolation_hp(new_fe_index,old_index).m() == 0) + && + (interpolation_hp(new_fe_index,old_index).n() == 0) + && + ((dof_handler->get_fe()[new_fe_index].dofs_per_cell > 0) + && + (dof_handler->get_fe()[old_index].dofs_per_cell > 0))), + ExcMessage ("The interpolation between two different " + "elements you are trying to use here has " + "not been implemented for this pair of " + "elements!")); + // simple case where all children have the // same FE index: just interpolate to their FE // first and then use the standard routines - interpolation_hp(new_fe_index,old_index).vmult (local_values, tmp); + if (tmp.size() > 0) + interpolation_hp(new_fe_index,old_index).vmult (local_values, tmp); + else + local_values = 0; } if (cell->has_children() == false) @@ -594,9 +614,24 @@ interpolate (const std::vector &all_in, AssertDimension (tmp.size(), interpolation_hp(c_index,old_index).n()); local_values.reinit(cell->child(child)->get_fe().dofs_per_cell, true); - AssertDimension (local_values.size(), - interpolation_hp(c_index,old_index).m()); - interpolation_hp(c_index,old_index).vmult (local_values, tmp); + + // do the interpolation. same problem as above + Assert (! ((interpolation_hp(c_index,old_index).m() == 0) + && + (interpolation_hp(c_index,old_index).n() == 0) + && + ((dof_handler->get_fe()[c_index].dofs_per_cell > 0) + && + (dof_handler->get_fe()[old_index].dofs_per_cell > 0))), + ExcMessage ("The interpolation between two different " + "elements you are trying to use here has " + "not been implemented for this pair of " + "elements!")); + + if (tmp.size() > 0) + interpolation_hp(c_index,old_index).vmult (local_values, tmp); + else + local_values = 0; } else local_values = tmp; @@ -729,6 +764,8 @@ SolutionTransfer::Pointerstruct::memory_consumption () const #define DIM_B 2 #endif +// This file compiles the first quarter of the instantiations from solution_transfer.cc +// to reduce the compilation unit (and memory consumption) #include "solution_transfer.inst" DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/solution_transfer.inst.in b/deal.II/source/numerics/solution_transfer.inst.in index 5d8ec479d6..05f2760106 100644 --- a/deal.II/source/numerics/solution_transfer.inst.in +++ b/deal.II/source/numerics/solution_transfer.inst.in @@ -1,25 +1,32 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (VEC : SERIAL_VECTORS; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension #if (deal_II_space_dimension == DIM_A) || (deal_II_space_dimension == DIM_B) +#ifndef INSTANTIATE_HP_DH template class SolutionTransfer >; +#else template class SolutionTransfer >; #endif #endif +#endif } diff --git a/deal.II/source/numerics/solution_transfer_inst2.cc b/deal.II/source/numerics/solution_transfer_inst2.cc index e903f04353..8292d039e6 100644 --- a/deal.II/source/numerics/solution_transfer_inst2.cc +++ b/deal.II/source/numerics/solution_transfer_inst2.cc @@ -1,20 +1,23 @@ -//--------------------------------------------------------------------------- -// $Id: $ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 2013 by the deal.II authors +// Copyright (C) 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- -// This file compiles the second half of the instantiations from solution_transfer.cc -// to get the memory consumption below 1.5gb with gcc (if compiling with PETSc and Trilinos). +// This file compiles the second quarter of the instantiations from solution_transfer.cc +// to reduce the compilation unit (and memory consumption) +//#define INSTANTIATE_HP_DH #define SOLUTION_TRANSFER_INSTANTIATE_PART_TWO #include "solution_transfer.cc" diff --git a/deal.II/source/numerics/solution_transfer_inst3.cc b/deal.II/source/numerics/solution_transfer_inst3.cc new file mode 100644 index 0000000000..5ba125b1d7 --- /dev/null +++ b/deal.II/source/numerics/solution_transfer_inst3.cc @@ -0,0 +1,23 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +// This file compiles the third quarter of the instantiations from solution_transfer.cc +// to reduce the compilation unit (and memory consumption) + +#define INSTANTIATE_HP_DH +//#define SOLUTION_TRANSFER_INSTANTIATE_PART_TWO + +#include "solution_transfer.cc" diff --git a/deal.II/source/numerics/solution_transfer_inst4.cc b/deal.II/source/numerics/solution_transfer_inst4.cc new file mode 100644 index 0000000000..f8c9518530 --- /dev/null +++ b/deal.II/source/numerics/solution_transfer_inst4.cc @@ -0,0 +1,23 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +// This file compiles the fourth quarter of the instantiations from solution_transfer.cc +// to reduce the compilation unit (and memory consumption) + +#define INSTANTIATE_HP_DH +#define SOLUTION_TRANSFER_INSTANTIATE_PART_TWO + +#include "solution_transfer.cc" diff --git a/deal.II/source/numerics/time_dependent.cc b/deal.II/source/numerics/time_dependent.cc index 8944ad436c..97db6b277b 100644 --- a/deal.II/source/numerics/time_dependent.cc +++ b/deal.II/source/numerics/time_dependent.cc @@ -1,16 +1,18 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013 by the deal.II authors +// Copyright (C) 1999 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- - +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- #include #include @@ -215,8 +217,8 @@ void TimeDependent::end_sweep () void (TimeDependent::*p) (const unsigned int, const unsigned int) = &TimeDependent::end_sweep; parallel::apply_to_subranges (0U, timesteps.size(), - std_cxx1x::bind (p, this, std_cxx1x::_1, std_cxx1x::_2), - 1); + std_cxx1x::bind (p, this, std_cxx1x::_1, std_cxx1x::_2), + 1); } diff --git a/deal.II/source/numerics/time_dependent.inst.in b/deal.II/source/numerics/time_dependent.inst.in index 863f5d5524..b851acc61c 100644 --- a/deal.II/source/numerics/time_dependent.inst.in +++ b/deal.II/source/numerics/time_dependent.inst.in @@ -1,15 +1,19 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ +// --------------------------------------------------------------------- +// $Id$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 by the deal.II authors +// Copyright (C) 1998 - 2013 by the deal.II authors // -// This file is subject to QPL and may not be distributed -// without copyright and license information. Please refer -// to the file deal.II/doc/license.html for the text and -// further information on this license. +// This file is part of the deal.II library. // -//--------------------------------------------------------------------------- +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + for (deal_II_dimension : DIMENSIONS) { diff --git a/deal.II/source/numerics/vector_tools.cc b/deal.II/source/numerics/vector_tools.cc deleted file mode 100644 index af44a3a505..0000000000 --- a/deal.II/source/numerics/vector_tools.cc +++ /dev/null @@ -1,21 +0,0 @@ -//--------------------------------------------------------------------------- -// $Id$ -// Version: $Name$ -// -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 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 -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//--------------------------------------------------------------------------- - -#include - -DEAL_II_NAMESPACE_OPEN - -// ---------------------------- explicit instantiations -------------------- -#include "vector_tools.inst" - -DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools.inst.in b/deal.II/source/numerics/vector_tools.inst.in deleted file mode 100644 index 6d0e6054de..0000000000 --- a/deal.II/source/numerics/vector_tools.inst.in +++ /dev/null @@ -1,655 +0,0 @@ -//--------------------------------------------------------------------------- -// $Id$ -// -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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 -// to the file deal.II/doc/license.html for the text and -// further information on this license. -// -//--------------------------------------------------------------------------- - -for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) - { -#if deal_II_dimension <= deal_II_space_dimension - namespace VectorTools \{ - - template - void integrate_difference, deal_II_space_dimension> - (const DoFHandler&, - const VEC&, - const Function&, - Vector&, - const Quadrature&, - const NormType&, - const Function*, - const double); - - template - void integrate_difference, deal_II_space_dimension > - (const DoFHandler&, - const VEC&, - const Function&, - Vector&, - const Quadrature&, - const NormType&, - const Function*, - const double); - - template - void integrate_difference, deal_II_space_dimension> - (const Mapping&, - const DoFHandler&, - const VEC&, - const Function&, - Vector&, - const Quadrature&, - const NormType&, - const Function*, - const double); - - template - void integrate_difference, deal_II_space_dimension > - (const Mapping&, - const DoFHandler&, - const VEC&, - const Function&, - Vector&, - const Quadrature&, - const NormType&, - const Function*, - const double); - - - - template - double compute_mean_value - (const Mapping&, - const DoFHandler&, - const Quadrature&, - const VEC&, - const unsigned int); - - template - double compute_mean_value - (const DoFHandler&, - const Quadrature&, - const VEC&, - const unsigned int); - - template - void interpolate - (const Mapping&, - const DoFHandler&, - const Function&, - VEC&); - - template - void interpolate - (const DoFHandler&, - const Function&, - VEC&); - - template - void project - (const Mapping &, - const DoFHandler &, - const ConstraintMatrix &, - const Quadrature &, - const Function &, - VEC &, - const bool, - const Quadrature &, - const bool); - - template - void project - (const DoFHandler &, - const ConstraintMatrix &, - const Quadrature &, - const Function &, - VEC &, - const bool, - const Quadrature &, - const bool); - \} -#endif - } - - - -//TODO[SP]: replace by -// where applicable and move to codimension cases above also when applicable -for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) - { -#if deal_II_dimension == deal_II_space_dimension - - namespace VectorTools \{ - - template - void point_value ( - const hp::DoFHandler&, - const VEC&, - const Point&, - Vector&); - - template - void interpolate - (const Mapping&, - const hp::DoFHandler&, - const Function&, - VEC&); - template - void interpolate - (const hp::DoFHandler&, - const Function&, - VEC&); - - template - double point_value ( - const hp::DoFHandler&, - const VEC&, - const Point&); - - template - void point_value ( - const hp::MappingCollection&, - const hp::DoFHandler&, - const VEC&, - const Point&, - Vector&); - - template - void interpolate - (const DoFHandler&, - const DoFHandler&, - const FullMatrix&, - const VEC&, - VEC&); - - template - double point_value ( - const hp::MappingCollection&, - const hp::DoFHandler&, - const VEC&, - const Point&); - - template - void integrate_difference - (const hp::DoFHandler&, - const VEC&, - const Function&, - Vector&, - const hp::QCollection&, - const NormType&, - const Function*, - const double); - template - void integrate_difference - (const hp::DoFHandler&, - const VEC&, - const Function&, - Vector&, - const hp::QCollection&, - const NormType&, - const Function*, - const double); - template - void integrate_difference - (const hp::MappingCollection&, - const hp::DoFHandler&, - const VEC&, - const Function&, - Vector&, - const hp::QCollection&, - const NormType&, - const Function*, - const double); - template - void integrate_difference - (const hp::MappingCollection&, - const hp::DoFHandler&, - const VEC&, - const Function&, - Vector&, - const hp::QCollection&, - const NormType&, - const Function*, - const double); - - template - void point_difference ( - const DoFHandler&, - const VEC&, - const Function&, - Vector&, - const Point&); - - template - void point_difference ( - const Mapping&, - const DoFHandler&, - const VEC&, - const Function&, - Vector&, - const Point&); - - template - void point_value ( - const DoFHandler&, - const VEC&, - const Point&, - Vector&); - - template - double point_value ( - const DoFHandler&, - const VEC&, - const Point&); - - template - void point_value ( - const Mapping&, - const DoFHandler&, - const VEC&, - const Point&, - Vector&); - - template - double point_value ( - const Mapping&, - const DoFHandler&, - const VEC&, - const Point&); - - \} -#endif - } - - -for (VEC : SERIAL_VECTORS) -{ - namespace VectorTools \{ - template - void subtract_mean_value(VEC &, const std::vector &); - \} -} - - -for (deal_II_dimension : DIMENSIONS) -{ - namespace VectorTools \{ - template - void interpolate_boundary_values ( - const MGDoFHandler &, - const types::boundary_id, - const Function &, - ConstraintMatrix&, - const ComponentMask &); - - template - void interpolate_boundary_values ( - const MGDoFHandler &, - const types::boundary_id, - const Function &, - std::map &, - const ComponentMask &); - \} -} - - -for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; DH : DOFHANDLER_TEMPLATES) - { -#if deal_II_dimension <= deal_II_space_dimension - namespace VectorTools \{ - template - void interpolate_boundary_values - (const Mapping &, - const DH &, - const FunctionMap::type &, - std::map &, - const ComponentMask &); - - template - void interpolate_boundary_values - (const Mapping &, - const DH &, - const types::boundary_id, - const Function &, - std::map &, - const ComponentMask &); - - template - void interpolate_boundary_values ( - const DH &, - const types::boundary_id, - const Function &, - std::map &, - const ComponentMask &); - - template - void interpolate_boundary_values - (const DH &, - const FunctionMap::type &, - std::map &, - const ComponentMask &); - - template - void interpolate_boundary_values ( - const Mapping &, - const DH &, - const FunctionMap::type &, - ConstraintMatrix &, - const ComponentMask &); - - template - void interpolate_boundary_values - (const Mapping &, - const DH &, - const types::boundary_id, - const Function &, - ConstraintMatrix &, - const ComponentMask &); - - template - void interpolate_boundary_values ( - const DH &, - const types::boundary_id, - const Function &, - ConstraintMatrix &, - const ComponentMask &); - - template - void interpolate_boundary_values ( - const DH &, - const FunctionMap::type &, - ConstraintMatrix &, - const ComponentMask &); - - \} -#endif - } - - -for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) - { -#if deal_II_dimension <= deal_II_space_dimension - namespace VectorTools \{ - template - void create_right_hand_side - (const Mapping &, - const DoFHandler &, - const Quadrature &, - const Function &, - Vector &); - - template - void create_right_hand_side - (const DoFHandler &, - const Quadrature &, - const Function &, - Vector &); - - \} -#endif - } - -//TODO[SP]: replace by -// where applicable and move to codimension cases above also when applicable -for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) - { -#if deal_II_dimension == deal_II_space_dimension - namespace VectorTools \{ - template - void create_right_hand_side - (const hp::MappingCollection &, - const hp::DoFHandler &, - const hp::QCollection &, - const Function &, - Vector &); - - template - void create_right_hand_side - (const hp::DoFHandler &, - const hp::QCollection &, - const Function &, - Vector &); - - template - void create_point_source_vector - (const Mapping &, - const DoFHandler &, - const Point &, - Vector &); - template - void create_point_source_vector - (const DoFHandler &, - const Point &, - Vector &); - - template - void create_point_source_vector - (const hp::MappingCollection &, - const hp::DoFHandler &, - const Point &, - Vector &); - template - void create_point_source_vector - (const hp::DoFHandler &, - const Point &, - Vector &); - template - void create_point_source_vector - (const Mapping &, - const DoFHandler &, - const Point &, - const Point &, - Vector &); - template - void create_point_source_vector - (const DoFHandler &, - const Point &, - const Point &, - Vector &); - - template - void create_point_source_vector - (const hp::MappingCollection &, - const hp::DoFHandler &, - const Point &, - const Point &, - Vector &); - template - void create_point_source_vector - (const hp::DoFHandler &, - const Point &, - const Point &, - Vector &); - -#if deal_II_dimension > 1 - template - void - create_boundary_right_hand_side - (const Mapping &, - const DoFHandler &, - const Quadrature &, - const Function &, - Vector &, - const std::set &); -#endif - - template - void - create_boundary_right_hand_side - (const DoFHandler &, - const Quadrature &, - const Function &, - Vector &, - const std::set &); - -#if deal_II_dimension > 1 - template - void - create_boundary_right_hand_side - (const hp::MappingCollection &, - const hp::DoFHandler &, - const hp::QCollection &, - const Function &, - Vector &, - const std::set &); -#endif - - template - void - create_boundary_right_hand_side - (const hp::DoFHandler &, - const hp::QCollection &, - const Function &, - Vector &, - const std::set &); - - - - - -#if deal_II_dimension > 1 - template - void project_boundary_values - (const Mapping &, - const DoFHandler &, - const FunctionMap::type &, - const Quadrature&, - std::map&, std::vector); -#endif - - template - void project_boundary_values - (const DoFHandler &, - const FunctionMap::type &, - const Quadrature&, - std::map&, std::vector); - - - template - void project_boundary_values - (const Mapping &, - const DoFHandler &, - const FunctionMap::type &, - const Quadrature&, - ConstraintMatrix&, std::vector); - - template - void project_boundary_values - (const DoFHandler &, - const FunctionMap::type &, - const Quadrature&, - ConstraintMatrix&, std::vector); - - -#if deal_II_dimension != 1 - template - void project_boundary_values_curl_conforming - (const DoFHandler&, - const unsigned int, - const Function&, - const types::boundary_id, - ConstraintMatrix&, - const Mapping&); - template - void project_boundary_values_curl_conforming - (const hp::DoFHandler&, - const unsigned int, - const Function&, - const types::boundary_id, - ConstraintMatrix&, - const hp::MappingCollection&); - template - void project_boundary_values_div_conforming - (const DoFHandler&, - const unsigned int, - const Function&, - const types::boundary_id, - ConstraintMatrix&, - const Mapping&); - template - void project_boundary_values_div_conforming - (const hp::DoFHandler&, - const unsigned int, - const Function&, - const types::boundary_id, - ConstraintMatrix&, - const hp::MappingCollection&); - template - void - compute_no_normal_flux_constraints (const DoFHandler &dof_handler, - const unsigned int first_vector_component, - const std::set &boundary_ids, - ConstraintMatrix &constraints, - const Mapping &mapping); - template - void - compute_no_normal_flux_constraints (const hp::DoFHandler &dof_handler, - const unsigned int first_vector_component, - const std::set &boundary_ids, - ConstraintMatrix &constraints, - const Mapping &mapping); -#endif - \} -#endif - } - - - -for (deal_II_dimension : DIMENSIONS) -{ - namespace VectorTools \{ - - template - void interpolate_to_different_mesh - (const DoFHandler &, - const Vector &, - const DoFHandler &, - Vector &); - - template - void interpolate_to_different_mesh - (const DoFHandler &, - const Vector &, - const DoFHandler &, - const ConstraintMatrix &, - Vector &); - - template - void interpolate_to_different_mesh - (const InterGridMap > &, - const Vector &, - const ConstraintMatrix &, - Vector &); - - template - void interpolate_to_different_mesh - (const DoFHandler &, - const Vector &, - const DoFHandler &, - Vector &); - - template - void interpolate_to_different_mesh - (const DoFHandler &, - const Vector &, - const DoFHandler &, - const ConstraintMatrix &, - Vector &); - - template - void interpolate_to_different_mesh - (const InterGridMap > &, - const Vector &, - const ConstraintMatrix &, - Vector &); - - \} -} - - diff --git a/deal.II/source/numerics/vector_tools_boundary.cc b/deal.II/source/numerics/vector_tools_boundary.cc new file mode 100644 index 0000000000..6ecf213c9c --- /dev/null +++ b/deal.II/source/numerics/vector_tools_boundary.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_boundary.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_boundary.inst.in b/deal.II/source/numerics/vector_tools_boundary.inst.in new file mode 100644 index 0000000000..813f195003 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_boundary.inst.in @@ -0,0 +1,186 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (deal_II_dimension : DIMENSIONS) +{ + namespace VectorTools \{ + template + void interpolate_boundary_values ( + const MGDoFHandler &, + const types::boundary_id, + const Function &, + ConstraintMatrix&, + const ComponentMask &); + + template + void interpolate_boundary_values ( + const MGDoFHandler &, + const types::boundary_id, + const Function &, + std::map &, + const ComponentMask &); + \} +} + + +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; DH : DOFHANDLER_TEMPLATES) + { +#if deal_II_dimension <= deal_II_space_dimension + namespace VectorTools \{ + template + void interpolate_boundary_values + (const Mapping &, + const DH &, + const FunctionMap::type &, + std::map &, + const ComponentMask &); + + template + void interpolate_boundary_values + (const Mapping &, + const DH &, + const types::boundary_id, + const Function &, + std::map &, + const ComponentMask &); + + template + void interpolate_boundary_values ( + const DH &, + const types::boundary_id, + const Function &, + std::map &, + const ComponentMask &); + + template + void interpolate_boundary_values + (const DH &, + const FunctionMap::type &, + std::map &, + const ComponentMask &); + + template + void interpolate_boundary_values ( + const Mapping &, + const DH &, + const FunctionMap::type &, + ConstraintMatrix &, + const ComponentMask &); + + template + void interpolate_boundary_values + (const Mapping &, + const DH &, + const types::boundary_id, + const Function &, + ConstraintMatrix &, + const ComponentMask &); + + template + void interpolate_boundary_values ( + const DH &, + const types::boundary_id, + const Function &, + ConstraintMatrix &, + const ComponentMask &); + + template + void interpolate_boundary_values ( + const DH &, + const FunctionMap::type &, + ConstraintMatrix &, + const ComponentMask &); + \} +#endif +} + +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { + namespace VectorTools \{ +#if deal_II_dimension == deal_II_space_dimension + + template + void project_boundary_values + (const Mapping &, + const DoFHandler &, + const FunctionMap::type &, + const Quadrature&, + std::map&, std::vector); + + template + void project_boundary_values + (const DoFHandler &, + const FunctionMap::type &, + const Quadrature&, + std::map&, + std::vector); + + template + void project_boundary_values + (const Mapping &, + const DoFHandler &, + const FunctionMap::type &, + const Quadrature&, + ConstraintMatrix&, std::vector); + + template + void project_boundary_values + (const DoFHandler &, + const FunctionMap::type &, + const Quadrature&, + ConstraintMatrix&, + std::vector); + + + +#if deal_II_dimension != 1 + template + void project_boundary_values_curl_conforming + (const DoFHandler&, + const unsigned int, + const Function&, + const types::boundary_id, + ConstraintMatrix&, + const Mapping&); + template + void project_boundary_values_curl_conforming + (const hp::DoFHandler&, + const unsigned int, + const Function&, + const types::boundary_id, + ConstraintMatrix&, + const hp::MappingCollection&); + template + void project_boundary_values_div_conforming + (const DoFHandler&, + const unsigned int, + const Function&, + const types::boundary_id, + ConstraintMatrix&, + const Mapping&); + template + void project_boundary_values_div_conforming + (const hp::DoFHandler&, + const unsigned int, + const Function&, + const types::boundary_id, + ConstraintMatrix&, + const hp::MappingCollection&); +#endif +#endif + \} + } diff --git a/deal.II/source/numerics/vector_tools_constraints.cc b/deal.II/source/numerics/vector_tools_constraints.cc new file mode 100644 index 0000000000..1ec77ec3e5 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_constraints.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_constraints.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_constraints.inst.in b/deal.II/source/numerics/vector_tools_constraints.inst.in new file mode 100644 index 0000000000..f3bfa2a7d3 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_constraints.inst.in @@ -0,0 +1,58 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +//TODO[SP]: replace by +// where applicable and move to codimension cases above also when applicable +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { + namespace VectorTools \{ + +#if deal_II_dimension == deal_II_space_dimension +#if deal_II_dimension != 1 + template + void + compute_no_normal_flux_constraints (const DoFHandler &dof_handler, + const unsigned int first_vector_component, + const std::set &boundary_ids, + ConstraintMatrix &constraints, + const Mapping &mapping); + template + void + compute_no_normal_flux_constraints (const hp::DoFHandler &dof_handler, + const unsigned int first_vector_component, + const std::set &boundary_ids, + ConstraintMatrix &constraints, + const Mapping &mapping); + + template + void + compute_normal_flux_constraints (const DoFHandler &dof_handler, + const unsigned int first_vector_component, + const std::set &boundary_ids, + ConstraintMatrix &constraints, + const Mapping &mapping); + template + void + compute_normal_flux_constraints (const hp::DoFHandler &dof_handler, + const unsigned int first_vector_component, + const std::set &boundary_ids, + ConstraintMatrix &constraints, + const Mapping &mapping); +#endif +#endif + \} + } diff --git a/deal.II/source/numerics/vector_tools_integrate_difference.cc b/deal.II/source/numerics/vector_tools_integrate_difference.cc new file mode 100644 index 0000000000..4e6e8e6888 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_integrate_difference.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_integrate_difference.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_integrate_difference.inst.in b/deal.II/source/numerics/vector_tools_integrate_difference.inst.in new file mode 100644 index 0000000000..4ad4fe0ec4 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_integrate_difference.inst.in @@ -0,0 +1,117 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension <= deal_II_space_dimension + namespace VectorTools \{ + + template + void integrate_difference, deal_II_space_dimension> + (const Mapping&, + const DoFHandler&, + const VEC&, + const Function&, + Vector&, + const Quadrature&, + const NormType&, + const Function*, + const double); + + template + void integrate_difference, deal_II_space_dimension> + (const DoFHandler&, + const VEC&, + const Function&, + Vector&, + const Quadrature&, + const NormType&, + const Function*, + const double); + + template + void integrate_difference, deal_II_space_dimension > + (const Mapping&, + const DoFHandler&, + const VEC&, + const Function&, + Vector&, + const Quadrature&, + const NormType&, + const Function*, + const double); + + template + void integrate_difference, deal_II_space_dimension > + (const DoFHandler&, + const VEC&, + const Function&, + Vector&, + const Quadrature&, + const NormType&, + const Function*, + const double); + + template + void integrate_difference, deal_II_space_dimension> + (const hp::MappingCollection&, + const hp::DoFHandler&, + const VEC&, + const Function&, + Vector&, + const hp::QCollection&, + const NormType&, + const Function*, + const double); + + template + void integrate_difference, deal_II_space_dimension> + (const hp::DoFHandler&, + const VEC&, + const Function&, + Vector&, + const hp::QCollection&, + const NormType&, + const Function*, + const double); + + template + void integrate_difference, deal_II_space_dimension> + (const hp::MappingCollection&, + const hp::DoFHandler&, + const VEC&, + const Function&, + Vector&, + const hp::QCollection&, + const NormType&, + const Function*, + const double); + + template + void integrate_difference, deal_II_space_dimension> + (const hp::DoFHandler&, + const VEC&, + const Function&, + Vector&, + const hp::QCollection&, + const NormType&, + const Function*, + const double); + + \} +#endif + } diff --git a/deal.II/source/numerics/vector_tools_interpolate.cc b/deal.II/source/numerics/vector_tools_interpolate.cc new file mode 100644 index 0000000000..3d57d8890c --- /dev/null +++ b/deal.II/source/numerics/vector_tools_interpolate.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_interpolate.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_interpolate.inst.in b/deal.II/source/numerics/vector_tools_interpolate.inst.in new file mode 100644 index 0000000000..f877d0f4f0 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_interpolate.inst.in @@ -0,0 +1,124 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension <= deal_II_space_dimension + namespace VectorTools \{ + + template + void interpolate + (const Mapping&, + const DoFHandler&, + const Function&, + VEC&); + + template + void interpolate + (const DoFHandler&, + const Function&, + VEC&); + \} +#endif + } + + + +//TODO[SP]: replace by +// where applicable and move to codimension cases above also when applicable +for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension == deal_II_space_dimension + + namespace VectorTools \{ + + template + void interpolate + (const Mapping&, + const hp::DoFHandler&, + const Function&, + VEC&); + template + void interpolate + (const hp::DoFHandler&, + const Function&, + VEC&); + + template + void interpolate + (const DoFHandler&, + const DoFHandler&, + const FullMatrix&, + const VEC&, + VEC&); + \} +#endif + } + + +for (deal_II_dimension : DIMENSIONS) +{ + namespace VectorTools \{ + + template + void interpolate_to_different_mesh + (const DoFHandler &, + const Vector &, + const DoFHandler &, + Vector &); + + template + void interpolate_to_different_mesh + (const DoFHandler &, + const Vector &, + const DoFHandler &, + const ConstraintMatrix &, + Vector &); + + template + void interpolate_to_different_mesh + (const InterGridMap > &, + const Vector &, + const ConstraintMatrix &, + Vector &); + + template + void interpolate_to_different_mesh + (const DoFHandler &, + const Vector &, + const DoFHandler &, + Vector &); + + template + void interpolate_to_different_mesh + (const DoFHandler &, + const Vector &, + const DoFHandler &, + const ConstraintMatrix &, + Vector &); + + template + void interpolate_to_different_mesh + (const InterGridMap > &, + const Vector &, + const ConstraintMatrix &, + Vector &); + + \} +} + + diff --git a/deal.II/source/numerics/vector_tools_mean_value.cc b/deal.II/source/numerics/vector_tools_mean_value.cc new file mode 100644 index 0000000000..a907916a06 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_mean_value.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_mean_value.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_mean_value.inst.in b/deal.II/source/numerics/vector_tools_mean_value.inst.in new file mode 100644 index 0000000000..89e5be1545 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_mean_value.inst.in @@ -0,0 +1,50 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension <= deal_II_space_dimension + namespace VectorTools \{ + + template + double compute_mean_value + (const Mapping&, + const DoFHandler&, + const Quadrature&, + const VEC&, + const unsigned int); + + template + double compute_mean_value + (const DoFHandler&, + const Quadrature&, + const VEC&, + const unsigned int); + + \} +#endif + } + + + +for (VEC : SERIAL_VECTORS) +{ + namespace VectorTools \{ + template + void subtract_mean_value(VEC &, const std::vector &); + \} +} diff --git a/deal.II/source/numerics/vector_tools_point_value.cc b/deal.II/source/numerics/vector_tools_point_value.cc new file mode 100644 index 0000000000..e5a0c30edd --- /dev/null +++ b/deal.II/source/numerics/vector_tools_point_value.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_point_value.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_point_value.inst.in b/deal.II/source/numerics/vector_tools_point_value.inst.in new file mode 100644 index 0000000000..8dd47f73e0 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_point_value.inst.in @@ -0,0 +1,165 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +//TODO[SP]: replace by +// where applicable and move to codimension cases above also when applicable +for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension == deal_II_space_dimension + + namespace VectorTools \{ + + template + void point_value ( + const hp::DoFHandler&, + const VEC&, + const Point&, + Vector&); + + template + double point_value ( + const hp::DoFHandler&, + const VEC&, + const Point&); + + template + void point_value ( + const hp::MappingCollection&, + const hp::DoFHandler&, + const VEC&, + const Point&, + Vector&); + + template + double point_value ( + const hp::MappingCollection&, + const hp::DoFHandler&, + const VEC&, + const Point&); + + template + void point_difference ( + const DoFHandler&, + const VEC&, + const Function&, + Vector&, + const Point&); + + template + void point_difference ( + const Mapping&, + const DoFHandler&, + const VEC&, + const Function&, + Vector&, + const Point&); + + template + void point_value ( + const DoFHandler&, + const VEC&, + const Point&, + Vector&); + + template + double point_value ( + const DoFHandler&, + const VEC&, + const Point&); + + template + void point_value ( + const Mapping&, + const DoFHandler&, + const VEC&, + const Point&, + Vector&); + + template + double point_value ( + const Mapping&, + const DoFHandler&, + const VEC&, + const Point&); + + \} +#endif + } + + + +//TODO[SP]: replace by +// where applicable and move to codimension cases above also when applicable +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { + namespace VectorTools \{ + +#if deal_II_dimension == deal_II_space_dimension + + template + void create_point_source_vector + (const Mapping &, + const DoFHandler &, + const Point &, + Vector &); + template + void create_point_source_vector + (const DoFHandler &, + const Point &, + Vector &); + + template + void create_point_source_vector + (const hp::MappingCollection &, + const hp::DoFHandler &, + const Point &, + Vector &); + template + void create_point_source_vector + (const hp::DoFHandler &, + const Point &, + Vector &); + template + void create_point_source_vector + (const Mapping &, + const DoFHandler &, + const Point &, + const Point &, + Vector &); + template + void create_point_source_vector + (const DoFHandler &, + const Point &, + const Point &, + Vector &); + + template + void create_point_source_vector + (const hp::MappingCollection &, + const hp::DoFHandler &, + const Point &, + const Point &, + Vector &); + template + void create_point_source_vector + (const hp::DoFHandler &, + const Point &, + const Point &, + Vector &); +#endif + \} + } diff --git a/deal.II/source/numerics/vector_tools_project.cc b/deal.II/source/numerics/vector_tools_project.cc new file mode 100644 index 0000000000..cd5ba6fb7a --- /dev/null +++ b/deal.II/source/numerics/vector_tools_project.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_project.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_project.inst.in b/deal.II/source/numerics/vector_tools_project.inst.in new file mode 100644 index 0000000000..3dc5d6b3e9 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_project.inst.in @@ -0,0 +1,70 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (VEC : SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension <= deal_II_space_dimension + namespace VectorTools \{ + + template + void project + (const Mapping &, + const DoFHandler &, + const ConstraintMatrix &, + const Quadrature &, + const Function &, + VEC &, + const bool, + const Quadrature &, + const bool); + + template + void project + (const DoFHandler &, + const ConstraintMatrix &, + const Quadrature &, + const Function &, + VEC &, + const bool, + const Quadrature &, + const bool); + + template + void project + (const hp::MappingCollection &, + const hp::DoFHandler &, + const ConstraintMatrix &, + const hp::QCollection &, + const Function &, + VEC &, + const bool, + const hp::QCollection &, + const bool); + + template + void project + (const hp::DoFHandler &, + const ConstraintMatrix &, + const hp::QCollection &, + const Function &, + VEC &, + const bool, + const hp::QCollection &, + const bool); + \} +#endif + } diff --git a/deal.II/source/numerics/vector_tools_rhs.cc b/deal.II/source/numerics/vector_tools_rhs.cc new file mode 100644 index 0000000000..cb12d608e1 --- /dev/null +++ b/deal.II/source/numerics/vector_tools_rhs.cc @@ -0,0 +1,86 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + + +namespace VectorTools +{ + +// separate implementation for 1D because otherwise we get linker errors since +// (hp::)FEFaceValues<1> is not compiled + template <> + void + create_boundary_right_hand_side (const Mapping<1,1> &, + const DoFHandler<1,1> &, + const Quadrature<0> &, + const Function<1> &, + Vector &, + const std::set &) + { + Assert (false, ExcImpossibleInDim(1)); + } + + + + template <> + void + create_boundary_right_hand_side (const Mapping<1,2> &, + const DoFHandler<1,2> &, + const Quadrature<0> &, + const Function<2> &, + Vector &, + const std::set &) + { + Assert (false, ExcImpossibleInDim(1)); + } + + + + template <> + void + create_boundary_right_hand_side (const hp::MappingCollection<1,1> &, + const hp::DoFHandler<1,1> &, + const hp::QCollection<0> &, + const Function<1> &, + Vector &, + const std::set &) + { + Assert (false, ExcImpossibleInDim(1)); + } + + + + template <> + void + create_boundary_right_hand_side (const hp::MappingCollection<1,2> &, + const hp::DoFHandler<1,2> &, + const hp::QCollection<0> &, + const Function<2> &, + Vector &, + const std::set &) + { + Assert (false, ExcImpossibleInDim(1)); + } +} + +// ---------------------------- explicit instantiations -------------------- +#include "vector_tools_rhs.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/deal.II/source/numerics/vector_tools_rhs.inst.in b/deal.II/source/numerics/vector_tools_rhs.inst.in new file mode 100644 index 0000000000..aed42a76ec --- /dev/null +++ b/deal.II/source/numerics/vector_tools_rhs.inst.in @@ -0,0 +1,108 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 1998 - 2013 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { +#if deal_II_dimension <= deal_II_space_dimension + namespace VectorTools \{ + template + void create_right_hand_side + (const Mapping &, + const DoFHandler &, + const Quadrature &, + const Function &, + Vector &); + + template + void create_right_hand_side + (const DoFHandler &, + const Quadrature &, + const Function &, + Vector &); + + \} +#endif + } + +//TODO[SP]: replace by +// where applicable and move to codimension cases above also when applicable +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) + { + namespace VectorTools \{ + +#if deal_II_dimension == deal_II_space_dimension + template + void create_right_hand_side + (const hp::MappingCollection &, + const hp::DoFHandler &, + const hp::QCollection &, + const Function &, + Vector &); + + template + void create_right_hand_side + (const hp::DoFHandler &, + const hp::QCollection &, + const Function &, + Vector &); + +#if deal_II_dimension > 1 + template + void + create_boundary_right_hand_side + (const Mapping &, + const DoFHandler &, + const Quadrature &, + const Function &, + Vector &, + const std::set &); +#endif + + template + void + create_boundary_right_hand_side + (const DoFHandler &, + const Quadrature &, + const Function &, + Vector &, + const std::set &); + +#if deal_II_dimension > 1 + template + void + create_boundary_right_hand_side + (const hp::MappingCollection &, + const hp::DoFHandler &, + const hp::QCollection &, + const Function &, + Vector &, + const std::set &); +#endif + + template + void + create_boundary_right_hand_side + (const hp::DoFHandler &, + const hp::QCollection &, + const Function &, + Vector &, + const std::set &); + + +#endif + \} + } -- 2.39.5